Wednesday, July 28, 2010
What is HTML color code notation?
Six characters from hexadecimal digits (0-F) are used with each pair from left to right representing Red, Green and Blue (RGB) color values.
Example:
For color "gray", the code is: #808080
Friday, April 23, 2010
Method Overloading In JAVA
//output
Wednesday, April 21, 2010
Ant task to check for OS before executing a batch (.bat) or shell (.sh) script
Lets call this ant task "run.script", and this depends on whether OS family is windows or not windows.
<target depends="ifWindows, ifNotWindows" name="run.script"/>
This is no brainer - we are just saying that "run.script" task depends on tasks called "ifWindows" and "ifNotWindows". We then define these two tasks as below:
<target name="ifWindows" if="is-windows">
<antcall target="run.script.windows"/>
</target>
<target name="<b">"ifNotWindows" if="is-unix">
<antcall target="run.script.unix"/>
</target>As we see, ifWindows and ifNotWindows task are based on a condition, which if true calls the specific target.
If "is-windows" property, defind as -
<condition property=""is-windows">
<os family="windows"/>
</condition>returns true, than ant target "run.script.windows" is executed.
Else, ifNotWindows tested using "is-unix" property:
<condition property="is-unix">
<not>
<os family="windows"/>
</not>
</condition>If this condition returns true, then "run.script.unix" will be called.
Following is how you can define an ant task to execute a batch script on windows:
To execute a script , exec command is used wrapped inside you target definition:
<target name="run.script.windows">
<exec dir="." executable="cmd" os="Windows Vista">
<arg line="/c myScript.bat -p myScriptArg1 myScriptArg2"/>
</exec>
</target>
Following is to run a shell script on unix using Ant task:
<target name=""run.script.unix">
<exec dir="." executable="/bin/sh">
<arg line="-c "myScript.bat -p myScriptArg1 myScriptArg2"">
</exec>
</target>
Note:
1. Note: The double-quotes are nested inside the single-quotes.
2. Using "arg line" we are passing the command and command-line parameters to be executed by the shell in one line itself. Alternatively, you may consider using "arg value" instead.
To sum up:
On systems running a Unix-type shell (for example, Cygwin on Windows) execute the (command) shell :
1. sh for shell scripts. Use -c switch to pass the shell script (.sh), any arguments to the script (as needed).
2. cmd for batch files. Use /c switch to pass the batch script (.bat), any arguments to the script (as needed).
Friday, December 18, 2009
Error 1606 during JDK 6 Update 17 installation on Vista !
P.S: I have my original post on other blog at wordpress.com.
Problem:
While installing JDK 6, update 17 ( installation package: jdk-6u17-windows-i586.exe), “error 1606: Could not find network location … %APPDATA%” is thrown. How do I resolve this issue?
Solution:
I encountered error 1606 (Could not find network location … %APPDATA%) while installing JDK 6 update 17 on Vista online. Research should that this may be caused due to incorrect registry key settings. Refer Microsoft’s Support to validate your settings.
Despite having correct registry key settings, I was running into this error. After hours of investigation, I could finally do successful installation .
Thanks to Grif Thomas’s reply to a posting in CNet forum who suggested deleting“Recent” registry key and restarting the machine.
Here’s what you need: (Note: Administrator privileges may be required for the following)
1. Run regedit.exe (Go to : Start -> Run; enter: regedit.exe) The registry settings will open in a pop up window.
2. Browse to HKEY_CURRENT_USER –> Software
3. Now click on : Microsoft –> Windows
4. Then select: Current Version –> Explorer –> User Shell Folders
5. Right Click on “Recent” key and select “delete”.
6. Restart/reboot the machine.
Remember only on restarting the machine will new registry changes become effective. So first reboot the system and then:
7. run jdk-6u17-windows-i586.exe
Installation should proceed smoothly.