Posts

Showing posts from October, 2011

Great example why JavaScript fundamentally sucks

This issue report describes a great case that shows why JavaScript fundamentally sucks . By doing this... window.location=window.location; you assign a variable to itself. Unlike in JavaScript , doing this in any other statically compiled language is completely redundant, not to say "silly". In fact some compilers or interpreters would throw a warning or even an error if you try to do this in any other language. However assigning a variable to itself isn't stupid at all in JavaScript because you have to do it, to " reliably reload the current window in Firefox / Chrome / IE / Safari ".

Tomcat: Set Timezone & Other JVM / CATALINA Parameters

Image
If you want to change the timezone in which a Tomcat instance is running, you have to add -Duser.timezone=GMT to JVM_OPTS  environment variable or more specific (and better for most cases), to Tomcat's  CATALINA_OPTS environment variable. You can do it on the command line or via Tomcat's Configure dialog: This way you can also add other parameters to Tomcat's startup script.

Mac Terminal: Style Your Command Prompt

Image
If you want to change Mac Terminal's default command prompt to something more useful, I'd suggest this style: And to get those fancy colors in your Bash prompt, just add PS1="\h:\[\e[0;32m\]\w\[\e[m\] " to your ~/.bash_profile file.

Mac: Add colors to your Bash

Recently Xcode 4.2 changed Bash's version, so Bash's coloring no longer worked for me. Just add export CLICOLOR=1 export TERM=xterm-color to your ~/.bash_profile file to fix this problem.

GWT: Synchronous Code Execution Using Callbacks

   @Override     public void onModuleLoad() {         startingHere();     }     void startingHere() {         callback_To_Execute_And_Wait_Until_It_Returns(new Callback<Integer, String>() {             @Override             public void onFailure(final String reason) {                 System.out.println("callback failed because: " + reason);             }             @Override             public void onSuccess(final Integer callback_return_value) {                 System.out.println("executed SECOND");                 System.out.println("callback result: " + callback_return_value );                 do_something_that_requires_the_callback_to_finish_successfully() ;             }         });     }     void callback_To_Execute_And_Wait_Until_It_Returns(final Callback<Integer, String> cb) {         System.out.println("executed FIRST");         do_something_that_has_to_finish_completely_before_the_c