Saturday, November 26, 2011

Just played around with Greasemonkey

I'm not a javascript expert, but just played around using js in greasemonkey, quite funny.

// ==UserScript==
// @name FilterGuruEntry
// @description Filter Guru Entry
// @include http://www.guru.com/pro/search_results.cfm*
// ==/UserScript==


var allTRs, thisTR;
allTRs = document.getElementsByTagName('SPAN');
for (var i = 0; i < allTRs.length; i++) {

thisTR = allTRs[i];

if (thisTR.getAttribute("class") == "btblue") {

//myTBODY = thisTR.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
myTR = thisTR.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
myTD = thisTR.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;

if (myTR.nodeName == "TR") {
//myTR.removeChild(myTD);
//myTR.removeChild(myTR.lastChild);
myTR.removeChild(myTD);

}

//myTBODY.removeChild(myTR);
}
}

Friday, November 25, 2011

To run portable Chrome using chrome.exe in \App\Chrome-bin

For portable Chrome, if you execute the \App\Chrome-bin\chrome.exe directly, you may not able to start Chrome and having a file "debug.log" stating that Chrome "Could not get Chrome DLL version.".

To handle this issue, you need to do the following:
  • Copy the chrome.exe to \App\Chrome-bin\15.0.874.120\ (depends on the Chrome version) and use the chrome.exe in this path instead
  • Specify the --User-Data-Dir and --Enable-Extension parameters

For example:
  • chrome.exe --User-Data-Dir="D:\ChromePortable\Data\profile" --Enable-Extensions

Some more parameters for reference:
  • Private browsing mode:
      --incognito
  • Read local files (e.g. local XML, XSL, etc):
      --allow-file-access-from-files

Thursday, November 24, 2011

Using Expression Language (EL) in JSP

To use EL in JSP, a page directive has to be specified:

<%@ page isELIgnored="false" %>


Then you can use EL in the JSP, e.g.:

<logic:iterate id="var" name="sampleForm" property="list" indexId="index"> 

          <p>${var.id}</p>
          <logic:equal name="var"
                       property="foo"
                       value="${sampleForm.list[index+1].foo}">
             Value is same as next entry.
          </logic:equal>
</logic:iterate>

Getting Action Mapping in JSP

One can use "org.apache.struts.action.mapping.instance" to get the action mapping in JSP:

import org.apache.struts.config.ActionConfig;
ActionConfig mapping = (ActionConfig)request.getAttribute("org.apache.struts.action.mapping.instance");

Form name will be mapping.getName()

Friday, November 18, 2011

To activate a window using VBS

set oShell = WScript.CreateObject("WScript.Shell")
call oShell.AppActivate(<Window's Title>)

Tuesday, November 15, 2011

Copy files from tsclient

For example:

xcopy \\TSCLIENT\F\$Update\ *.* "C:\Documents and Settings\%USERNAME%\My Documents\" /s /v /f


Enable/Disable network interface via command line

c:\> netsh interface set interface "INTERFACE_NAME" enable

OR

c:\> netsh interface set interface "INTERFACE_NAME"disable

Thursday, November 3, 2011

Debug mode in Eclipse and Tomcat

For Tomcat:
  set JPDA_ADDRESS=8000
  set JPDA_TRANSPORT=dt_socket
  catalina.bat jpda start

For Eclipse:
  Set Connection Port (8000) and Connection Host (localhost) in "Run > Debug Configurations"
  Configuration Type: "Remote Java Application"
  Set connection port to "8000"
  Set connection host to "localhost"

Thursday, October 27, 2011

Download Eclipse Plugins in Zip at GitHub

This can be done via:

https://github.com/eclipse-color-theme/eclipse-color-theme.github.com/zipball/master

Ref: https://github.com/eclipse-color-theme/eclipse-color-theme.github.com/issues/1

Thursday, July 7, 2011

Firefox plugins

Some Firefox plugins recommended:

Firebug
Greasemonkey
Hide Caption Titlebar Plus
Hide Navigation Bar
HttpFox
ImagePref (not from mozilla site)
MM3-ProxySwitch
No Color
Stylish
User Agent Switcher
Web Developer

Upgrade nodejs in conda (from v18 to v26)

If your conda env is nodejs v18, doing a conda install nodejs=26 is likely to create a lot of conflict. Consider remove those conflicting p...