Wednesday, April 27, 2011

gnome terminal Opening multiple terminals from script - always on top- at custom locations

http://www.linuxquestions.org/questions/linux-newbie-8/is-there-a-always-on-top-option-for-gnome-terminal-809611/
Says about wmctrl and its command to do "always on top"

http://multignometerm.sourceforge.net/web/doc/options.html
Refer this for --geometry option.

My scipt using these:

startMod1() {
  echo "Running ${mod1}..."
  cd ${project}/${mod1};
  gnome-terminal -e "mvn clean jetty:run-exploded -e" -t mod1 --geometry=150x10+20+50 &
  wmctrl -r mod1 -b add,above
}

startMod2() {
  echo "Running ${mod2}..."
  cd ${project}/${mod2};
  gnome-terminal -e "mvn clean jetty:run-war -e" -t mod2 --geometry=150x10+20+300 &
  wmctrl -r mod2 -b add,above
}

startMod3() {
  echo "Running ${mod3}..."
  cd ${project}/${mod3};
  gnome-terminal -e "mvn clean jetty:run -e" -t mod3 --geometry=150x10+20+520 &
  wmctrl -r mod3 -b add,above
}

startMod4() {
  echo "Running ${simulator}..."
  cd ${project}/${mod4};
  gnome-terminal -e "mvn clean jetty:run -e" -t mod4 --geometry=150x10+20+780 &
  wmctrl -r mod4 -b add,above
}

Monday, April 25, 2011

http-connection-timeout-on-android-not-working

http://stackoverflow.com/questions/3075506/http-connection-timeout-on-android-not-working


HttpParams httpParameters = new BasicHttpParams();
// Set the timeout in milliseconds until a connection is established.
int timeoutConnection = 3000;
HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
// Set the default socket timeout (SO_TIMEOUT) 
// in milliseconds which is the timeout for waiting for data.
int timeoutSocket = 3000;
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
DefaultHttpClient httpClient = new DefaultHttpClient(httpParameters);

Google Spreadsheet API and android

Android: Getting google account associated wid device

http://stackoverflow.com/questions/2112965/how-to-get-the-android-devices-primary-e-mail-address


Account[] accounts = AccountManager.get(this).getAccounts();
for (Account account : accounts) {
  // TODO: Check possibleEmail against an email regex or treat
  // account.name as an email address only for certain account.type values.
  String possibleEmail = account.name;
  ...
}

Thursday, April 21, 2011

Spring security custom filters order

It's beneficial to have a look at spring-security's
HttpSecurityBeanDefinitionParser.buildCustomFilterList
and SecurityFilters enum.

Try grepcode.com.
or Fisheye if they have it on their git site.

Monday, April 18, 2011

Stripes ValidationErrorReportResolution with IllegalStateException


[ValidationErrorReportResolution] (qtp700486981-53:)
java.lang.IllegalStateException: Here's how it is. Someone (quite possibly the Stripes Dispatcher) needed to get the source page resolution. But no source page was supplied in the request, and unless you override ActionBeanContext.getSourcePageResolution() you're going to need that value. When you use a <stripes:form> tag a hidden field called '_sourcePage' is included. If you write your own forms or links that could generate validation errors, you must include a value  for this parameter. This can be done by calling request.getServletPath().

The Why:
It was seen that some URLs(action beans) with malformed  parameters were being set as src attrib of img tags
eg: /Hello.action?getUserImage&userId='{userId}'
where actual URL should be some like  /Hello.action?getUserImage&userId=5001

What worked for me:
The construction HTML for the creating the img tags had outer single-quotes and inner double quotes like:
innerHtml ='<img src="/Hello.action?getUserImage&userId=' + userId
+ ' " rel="${contextPath}/" width="87" height="54" alt="' + userName
+'" title="'+userName+'" />' +
'<span></span>'

It should have double quotes outside like:
innerHtml ="<img src='/Hello.action?getUserImage&userId=" + userId + " ' "


NoClassDefFound for custom/user class while starting eclipse debug

Try adding the the project having the class as a dependency(project) in build path of project being debugged