I have created a subpackage of views in order to customize the default look of securesocial's templates. (I have used https://github.com/ngarera/securesocial-custom-views-sample as an example and basically copied the relevant files)
There are two i18n-files (messages.en, messages.de) in my /conf folder.
Viewing the main page confirms that the messages.en is correctly used.
However, when calling /login (and therefore displaying the custom template), no messages-key is correctly looked up - instead only the key itself (e.g. "auth.login") is displayed, when really it should show "Login".
I have seen a similar request at Stackoverflow (How to change text in SecureSocial) where it was stated to remove the .en file extension. Doing that will show the correct Message...but creating one messages file is not really the point of internationalization...
I have confirmed that my browser sends the correct language (http://www.mybrowserinfo.com/detail.asp?bhcp=1) so messages.de should work...(which it does when I open a self-made controller - only the custom-securesocial-view is not working...)
Does anybody have similar problems?
And why does the localization work for securesocial's messages?
Regards,
David
PS: using Play 2.1.3, Java
There were some issues in the SecureSocial code that prevented i18n from working properly.
This has been fixed and is currently available in the master-SNAPSHOT version because a stable version with those changes has not been released yet.
Related
We're trying to force the client's browser to reload static files when they change. Currently, we have our build scripts automatically creating a new directory with the build timestamp and replace the content in the code to point to that directory.
However, I feel this is hardly an optimal solution. It forces the client browser to load every single file if a new build exists, even if only 1 file changed, and build time increases considerably by scanning every file and replace every static file reference.
I know we can also set the version when we declare files (something like < link src="blahblah.css?version=1.1" />), but this forces us to change all our code to include a version placeholder and still have our build scripts replacing it.
Is there a smarter way to do this? We're using Spring MVC. Is there any option in mvc:resources that I'm not aware of to do this without changing code? Or something on web.xml?
We're using tomcat. Is there a way to do this at server level? Would it help to use a cache like Varnish or something? Or these caches only allow to set expiry times and not check that the file changed? Bear in mind I'm not comfortable at all in server and cache configuration tasks.
I found out about this project https://code.google.com/p/modpagespeed/, but since it's far from my comfort zone, I'm struggling to understand capabilities and if this helps with what I want.
Anyone has any ideas?
Thanks
You can use version as a query parameter, e.g. /resources/foo.js?_version=1.0.0. If you are using Maven, it is not that hard to get version information from /META-INF/maven/{groupId}/{artifactId}/pom.properties. Of course this will force reload all scripts with every new version... but new versions are probably not deployed that often.
Then it is always a good practice to properly set HTTP caching headers. <mvc:resources> should correctly handle Last-Modified header for you. And you can set cache-period to make browser check the for resource modifications more often.
Here is a working solution: CorrectBrowserCacheHandlerFilter.java
Basically, when your browser requests the static files, the server will redirect every requests to the same one but with a hash query parameter (?v=azErT for example) which depends on the content of the target static file.
Doing this, the browser will never cache the static files declared in your index.htmlfor example (because will always received a 302 Moved Temporarily), but will only cache the ones with the hash version (the server will answer 200 for them). So the browser cache will be used efficiently for those static files with hash version.
Disclaimer: I'm the author of CorrectBrowserCacheHandlerFilter.java.
I have the problem that with merchandise where there multiple options (t-shirt sizes, etc) that the 'add to cart' button is missing. It is OK where there there is only one option - a cd for example. I have entered all the info, stock numbers, prices, etc.
The problem persists if I turn off all other plugins. I can't see an error in the Java console (I tried a plugin that is supposed to fix java errors anyway) and the add to cart button is visible if I switch to another theme. Be great of someone who has been down this path can get me started on finding a solution.
Thanks for you help!
http://5.133.182.68/~knifewor/product/knifeworld-gold-logo-t-shirt/
Update
Turning debugging on I can see the following error:
Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home/knifewor/public_html/wp-includes/functions.php on line 3245
Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home/knifewor/public_html/wp-includes/functions.php on line 3245
Notice: Cookie cannot be set - headers already sent in /home/knifewor/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 375
Notice: Cookie cannot be set - headers already sent in /home/knifewor/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 375
Notice: Cookie cannot be set - headers already sent in /home/knifewor/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 375
And I now notice on the shop page the footer fails to load.
There is a php error in the page. You need to turn on the WP_DEBUG to see the error.
Normally, if the problem goes away when you switch themes, especially if there's no JS error, then we can assume the problem is in your theme's WooCommerce templates. They are probably out of date. I fixed a lot of themes that "broke" when WooCommerce updated to 2.0/2.1.
In the admin, under WooCommerce go to System Settings and at the bottom of the page you should see any templates that are being overridden in the theme. I think it should also say which templates are out of date.
If you view source you will see the page is incompletely loaded. This means wp_footer() is never run and therefore all the scripts that belong in the footer are never loaded... including WooCommerce's add to cart scripts.
Therefore, I second #sabanix's answer to turn on WP_DEBUG. The problem may or may not be in your theme's WooCommerce templates, or a more generic error in your theme.
If I had to guess, it is probably single-product/add-to-cart/variable.php template. I would suggest renaming it (or deleting it) so that WooCommerce will use its default template and see if that resolves it.
I am trying to complete the StackMob hello_world tutorial for custom code found here:
https://www.stackmob.com/devcenter/docs/Getting-Started:-Custom-Code-SDK#a-register_your_method
but when I try to run the client-side iOS code it says:
{NSLocalizedRecoverySuggestion={"error":"hello_world is not an existing schema"},
I tried to do a POST request to ReadParams from their example project and that created the schema and returned correctly. Maybe GET requests don't modify schemas, but then how do they expect you to do the hello_world example?
Thanks!
[EDIT]: I got this working by making sure the package is of the correct java package form with src directory, etc. Then I changed my package name and forgot to change the pom.xml file to reflect that.
This happens when the API doesn't think there is a custom code method registered with that name yet. When you go to the settings page for the custom code module, you should see a list of the custom code methods available in the JAR which you uploaded.
If you don't see any such methods, then it is likely something went wrong trying to validate the JAR you uploaded. Feel free to contact support#stackmob.com with any questions specific to your app's custom code!
(Disclaimer: I'm a StackMob engineer)
I just started working on a huge gwt project and asked myself if there is a smart way to find the gwt java classes while researching the HTML with firebug (or simular).
For example, I've a table somewhere on a html page and need to find the gwt class which generated this table.
I'm using gwt 2.4.0, eclipse 3.7, mostly firefox with firebug and the gwt-development-plugin.
You want to use the debugId:
http://ars-codia.raphaelbauer.com/2011/02/when-gwts-debug-ids-come-in-handy.html
You'll need to enable the debug module for that: http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/debug/client/package-summary.html
The only way I can think of is finding the table's ID (if it was set) or other attribute and searching through your Java code to see where it was set.
GWT generated code is highly obfuscated, and the variable names are changed to something smaller to save space - so there's no "easy" way to discover the original code from the JS.
You can also set the "Output style" of your compiled JavaSript to detailed, then it keeps the varible and class names of your Java project.
However this will make your JS files 100 times bigger and it never helped me debug an application. I actually found all my errors using the debug mode in eclipse! Code which didn't work correct in compiled mode also didn't work in the emulated debug version (when debugging, they are simulation the JavaSript functions with Java over the browser plugin).
We have a Seam application that uses rich:effects in several places. They all worked fine until we decided to replace our old school menus with rich:panelMenu components.
At that point all the effects stopped working. It's clear that the inclusion of the rich:panelMenu items is the culprit, as the effects come back to life if we remove the menus from the header file (included in the main template, above the place where the body is inserted).
We're using Seam 2.2.0 GA with richfaces 3.3.2.SR1 and both rich:effect and rich:panelMenu seem to come from the same library. In both cases, the relevant javascript files seem to be included in the same order (judging by the script tags at the top of the page), and the only notable difference seems to be some additional local javascript segments the menu tags introduce.
The javascript error I get is this:
Effect[A.type] is not a constructor
Thanks in advance for any suggestions/pointers.
Are there other RichFaces componentes in that page? When you insert rich:panelMenu, it will trigger to load jQuery/Prototype over that page. Are you using another version of jQuery/Prototype for your old school menus?
Check which jQuery version are you using. Open Firefug console (Firebug is an extension to Firefox) and write this (with and without rich:panelMenu):
jQuery().jquery
Another option: maybe your JavaScript's menu is overriding some JavaScript from jQuery/Prototype (used by rich:panelMenu).