explore this

http://www.softwarecybersleuth.co.uk/pagethree.htm


Quick Add Links to Windows Vista Explorer Favorite Links


If you’ve used Windows Vista for 5 minutes, you’ll have seen the Favorite Links when browsing around your filesystem. What is annoying is that by default the favorite links doesn’t include enough useful links.

Here’s the default links list (I’m sure you have seen this)

If you want to add a new link to the links bar, all you have to do is drag and drop the folder onto the links bar. I’m going to add my Computer link to the menu:

Now, it shows up in the list:

Much better!

Managing your links is extremely simple. Just open up your home directory by clicking on your icon on the start menu. You’ll see the LInks folder:

This folder contains all of the shortcuts to your favorite locations.

To remove an item from the list, you can either right-click the item and choose Remove Link, or just go to your Links folder and delete it from there.

Kindle On PC

Just updated Kindle on PC, found some very nice new features.

The nicest one: you could search now....

so nice...

Driver Genius

A very nice tool to install/backup drivers....

ClipMagic

Pretty handy.

Little tip on outlook attachments

Even had a situation that you received an Email with a lot of attachments, and you have to save them one by one?

Well, you could select them all, then save as into a folder all by once.
Or you could select all, and copy them, then paste to your desired folder.

Use command's output as input

See, I want to use the output of pwd as input of cygpath, here is what I do

cygpath -w "`pwd`"

`` means executing pwd and get the result, "" will make sure we get the full path without worrying about blank. This command will show current path in windows format.

Where is color of ls command defined?

Where is color of ls command defined?

by NIXCRAFT · 5 COMMENTS

1) Configuration file for the ls color command is /etc/DIR_COLORS for Linux. You can modify those colours if you want.

2) Here is list of most common colors: (RHEL 3.x/FCx/RH and other linux distros)
Executable files: Green
* Normal file : Normal
* Directory: Blue
* Symbolic link : Cyan
* Pipe: Yellow
* Socket: Magenta
* Block device driver: Bold yellow foreground, with black background
* Character device driver: Bold yellow foreground, with black background
* Orphaned syminks : Blinking Bold white with red background
* Missing links ( - and the files they point to) : Blinking Bold white with red background
* Archives or compressed : Red (.tar, .gz, .zip, .rpm)
* Image files : Magenta (.jpg, gif, bmp, png, tif)

3) They are stored in special shell variable called LS_COLORS

4) You can customized them in /etc/DIR_COLORS or file pointed by shell variable COLORS.

5) To customized colors you must use special string combination:
FILE-TYPE Attribute codes: Text color codes:Background color codes

Where,

  • FILE-TYPE: is file type like DIR (for directories)
  • Attribute codes:
    • 00=none
    • 01=bold
    • 04=underscore
    • 05=blink
    • 07=reverse
    • 08=concealed
  • Text color codes:
    • 30=black
    • 31=red
    • 32=green
    • 33=yellow
    • 34=blue
    • 35=magenta
    • 36=cyan
    • 37=white
  • Background color codes:
    • 40=black
    • 41=red
    • 42=green
    • 43=yellow
    • 44=blue
    • 45=magenta
    • 46=cyan
    • 47=white

For example to define Bold Blue color for DIR file type, entry should look as follows:
DIR 01;34

6) Let us modify dir color on Red Hat (Fedora) Linux:

# vi /etc/DIR_COLORS

Modify DIR entry
From:

DIR 01;34 # default is Bold blue with black background

To:

DIR 01;34;41 # NEW default is Bold blue with RED background

Save file.

7) Logout and login again, Please note that if you have shell variable defined COLORS then use that file (use echo $COLORS to find it out).

todo.txt

This is todo tool for cygwin (not just for cygwin).

couple of things to set up:

export PATH=$PATH:"C:\cygwin\home\hliu\working_dir\todo.txt_cli-2.7"
chmod +x todo.sh
mv todo.cfg ~/.
(make some changes on todo.cfg, like define location of todo.txt and colors)
in .bashrc
alias t='todo.sh -d C:/cygwin/home/hliu/todo.cfg'

some commands
t add "go to drug store"
t do 1
t pri 1 A
t depri 1 A
t ls

Search in cygwin

Open in Windows (cygstart is doing the same thing)
Search File
credit to Rob


I made a little change to use TextPad as my editor.

now how to use this command:

cd $de_arc
u -f "*.xml" "DB" : this is to search the current directory for all *.xml file which contains "DB".

-d: directory
-e: editor, otherwise will search editors
-f: file name pattern
-s: case senstive
-h: help

u [-d] [-e] [-f] [regular expression or file path]

Open Windows Explorer in Cygwin

Robert on programming

put the script in a file called windows in /bin/
dos2unix windows
chmod 755 windows

that's it.


- and _

SWIFT doesn't like underscore.
CHIPS is ok with underscore.
Both are OK with dash.
DataBase doesn't like dash.

Run a Command as Administrator from the Windows 7 / Vista Run box

If you are a command line junkie like me, and have been testing out Windows 7 or Vista… one of the first things you’ll notice is that there is no way to run a command from the run box in “Administrator” mode. Until now.

To try this out, go to the run box and type in something (cmd, for example)

Now instead of hitting the Enter key, use Ctrl+Shift + Enter. You will be prompted with the obnoxious User Account Control dialog… but it will then open up a command prompt in Administrator mode.

Hint: You can use Alt + C to quickly close the User Account Control dialog in Vista, or Alt+Y in Windows 7.

HTML Parser

http://htmlparser.sourceforge.net/samples.html

need change 2.1-SNAPSHOT to 2.3.1 for all pom.xml, 2.1 one must be outdated.

cygwin

export google=http://keyboardr.com/nightly/#home/
export blog=http://forevergarden17.blogspot.com

alias cs='cygstart'

then I could just type
cs $google
cs $blog

to go straight to my favorite page.

# Display the $PATH in a human acceptable way
function path()
{
old=$IFS
IFS=:
printf "%s\n" $PATH
IFS=$old
}

uname -srv: find the version of cygwin
man uname

dos2unix: if you edit a file in windows, then try to execute this file in cygwin, you will have problem, so should use dos2unix to fix it.

MS Dos warning in cygwin 7 fix:

Environment Variables (kinda awkward hidden button) -> Add a variable of CYGWIN with value of nodosfilewarning.

Search multiple lines

I am seeking a way or a tool to search/replace multiple lines.

CVS commands

cvs --help-commands: list all cvs commands
cvs -H : show options for command
cvs -d :ext:$hliu@jupiter:/var/local/devcvs checkout create_eclipse_iach_environment
---this will login to juipter using user name 'hliu', go to folder /var/local/devcvs, and checkout folder "create_eclipse_iach_environment".
rtag -r dbeurope-pts2-branch EUROPE_10_3_0_8_2010_08_12 DBPayments

Some Eclipse Text Edit Shortcut

Home: go to beginning of the line.
End: go to end of the line.
Shift + Home: select from current cursor till start of the line.
Shift + End: select from current cursor till end of the line.
CTR + Delete: Delete next word.
CTR + Backspace: Delete previous word.
CTR + Shift + Delete: Delete to end of the line.
CTR + Shift + right/left: Select next/previous word.
CTR + ALT + Up/Dn: Copy the current line before or after the current line.
CTR + ALT + J: Join the lines. (move the next line to join the current line.)
ALT + Up/Dn: Move the current line up or down.
Shift + CTR + P: move cursor between open/close bracket.
Shift + ALT + R: Re factor Rename the variable
CTR + LF/RT: move cursor by word
SHIFT + Enter: Insert a line after the current line.
SHIFT + CTR + Enter: insert a new line before the current line.

Console2

This almost drove me crazy.

I am using Console2, but there is one problem really bother me: I could display previous commands. When I hit Up arrow key, it always scroll the screen up. Finally, I found how to fix this: Settings->Hotkeys, uncheck "Use scroll lock for scrolling".

Now, I am happy.

Ant

Without a good grasp on Ant, I don't think I could master this whole system.
So Ant In Action.

Build File contains ONE project.
Each project contains MULTIPLE targets.
Target contains tasks.
Tasks do the work.

You could invoke any of the tasks individually.


<target name="execute" depends="compile">
<java classname="org.antbook.welcome.Main" classpath="build/classes">
<arg value="a"/>
<arg value="b"/>
<arg file="."/>
</java>
</target>

ant -buildfile build.xml compile <==> ant compile

That's the default thing that I have been talking about, when you use ant without specifying build file name, ant will by default use file name build.xml.

Eclipse has a good integration with Ant, so you could invoke build.xml directly from Eclipse.

ant command-line options:
-help, -h: list the options Ant supports.
-Dproperty=value: set a property to a value. for example: ant -Dhost=localhost. set property host=localhost.
-buildfile , -f: Use the named buildfile.
-keep-going, -k: when one target on the command line fails, still run other targets.
-logfile : save the log to the named file.
-verbose, -v: Print verbose output for better debugging.
-diagnostics: Print information that might be helpful to diagnose or report problems.
-debug, -d: Print debugging information.
-logger : Name a different logger.
-propertyfile : Load properties from file. -D definitions take priorty.
-quiet, -q: Run a quiet build: only print errors.

Just as Java has classes and variables, Ant has datatypes and properties. Ant properties are immutable.

Ant allows flexibility in how Booleans can be specified with on, true, and yes.
${...} denotes a use of Ant property.
PATH, FILESET,


Export Eclipse

Ok, I have some certain ways to use Eclipse, and I really don't want to lose them when I have to work on another machine or after a upgrade.

I need a plan to export that.

Command Line vs Runas

In the last post, I have listed a lot of run as commands, well, it's great, but the problem is I need invoke run as first by hitting START + R, then type in the commands. What I really want is I could invoke everything from command line.

Well, windows' default cmd utility sucks, but I found an alternative: Console2. It's pretty nice.

To invoke run as commands in Console2, you need type START first. For example, to invoke excel, you need type like

start excel

Documentum RESTful Web Service

I just checked https://community.emc.com/community/labs/dctm_rest/earlyaccess?view=overview, it's pretty sad that there is not a lot activities about it.

I don't know how the project goes now, but I don't have a good feeling.

Last year, about the same time, I used the web service to build a demo for JPMorgan Chase, and I think it's actually pretty slick.

Craig Randall used to work on this project, but last year he moved on to work for Adobe, check http://craigrandall.net/.

It's sad that you see all these good people are leaving, and Documentum is kind of down......after all, documentum is my main skill to earn a living for about 5 years.

xdoclet

Basically, you put some tags on the bean class, and xdoclet will generate interface, remote interface, and ejb.xml, xml files for weblogic and websphere....

http://xdoclet.sourceforge.net/xdoclet/index.html

Reverse-xdoclet

http://www.gootz.net/gbin/reverse-xdoclet/

What this does is, you already have Bean, interface, xml....but you want to the bean class to have xdoclet tags, reverse-xdoclet will do it for you.

Every Day Shortcut Key

Shortcuts:
Fn + PgUp: turn light on/off.
Fn + Home: increase brightness.
Fn + End: decrease brightness.
F6: in a web browser, hit F6 will activate address bar.
CTR + tab: tab through web browser tabs.
START + D: toggle desktop
START + Pause: Display the System Properties dialog box
START + R: Open the Run dialog box
START + L: Lock computer or Switch user
CTR + Esp: Open Start Menu
ALT + F4: Quit Program
CTR + W: Close Window
CTR + START + F: search computer in network

Commands:
control -> open control panel
calc -> calculator
control admintools ->Admin Tools
sysdm.cpl->System properties

control desktop->Open Personalization
desk.cpl->Display properties
services.msc->Services
devmgmt.msc->Device Manager
lusrmgr.msc-> User Accounts
osk->on screen keyboard
winchat->windows chat
appwiz.cpl->Add/Remove Program
clipbrd->clipboard viewer
intl.cpl->Regional Settings
iexplore->IE
winver->Check Windows Version
winword->Office Word
excel->Office Excel
powerpnt->Office PowerPoint
textpad->TextPad
timedate.cpl->Time Panel
mmsys.cpl->Sound and Audio

taskmgr.exe->Start Task Manager

http://windows.microsoft.com/en-US/windows-vista/Keyboard-shortcuts
http://mypchell.com/guides/34-guides/69-156-useful-run-commands

Quick Establishment on Database

create a user account

create user haibo_comr identified by pass;
grant dba to haibo_comr;

DbHostname: 127.0.0.1
DbPort: 1521
DbDatabase: my_database
DbUsername: Haibo_comr
DbPassword: pass

Script need this kind of information to access to database, so it could create all the tables.

1. build a database quickly---MySQL probably the best option.
2. write an utility to load/unload tables by using xml files as inputs.
3. ORM (object-oriented mapping), so could write Java codes against DB quickly. Hibernate?
4. Store the whole environment: VW Mare image.

Refcardz DZone

Joined Refcardz DZone


Look like a good place to catch some new technologies.

Just learnt: Eclipse Helios (3.6.0) already released.

Also Eclipse SDK 4.0 is on the way.

Groovy

groovy: An agile dynamic language for the Java Platform.

A quick introduction:


Installation:
1. It's zip file, just unzip it to some directory. For example: C:\groovy-1.7.2.
2. Go to C:\groovy-1.7.2\bin, execute groovyConsole.bat (windows) or groovyConsole (Unix).
3. Now you have a groovy console. Now this is what I need, I really don't have much interest to learn some new grammar, but GroovyConsole recognize the normal Java codes too, so I would like to use GroovyConsole as a Java Console. In this way, I could execute some simple Java codes directly in console.
4. How to add some existing library? Script->Add Jar to classpath or Add Directory to classpath.

For example, if I want to test some methods for StringUtils, I just need download the jar, and add it to classpath. Write some codes in Script console:

import org.apache.commons.lang.StringUtils;

String str = StringUtils.leftPad("999", 5, 'x');
System.out.println(str);

*****

Basically just treat the console as a Java file, the nice thing about it is you don't need to compile the codes.

Strange thing: seem Groovy Console doesn't like String[] stars = {"Tom", "Sam"};

But it's ok to use String[] stars = ["Tom", "Sam"];

System.out.println == println

println "${new Date()}"

****************************
class HelloWorld
{
def name
def greet() { "Hello ${name}" }
}

def helloWorld = new HelloWorld()

helloWorld.name = "Groovy"

println helloWorld.greet()

Unix Grep

grep "BusinessStatus" -B10 -A2 importList-Test.xml > output.xml

General meaning: get some stuff from importList-Test.xml, and put it into output.xml.

What stuff? lines which contain "BusinessStatus" + 10 lines before it + 2 lines after it.

This is very useful to extract certain patterned-contents from a large file.

find . -name "*Bean.java" -exec echo "==={}:" \; -exec grep "re\"DefaultDataSource\"" -B1 -A3 {} \;

find . -name "*Extent.java" -exec grep "CLASSNAME =" '{}' > output.xml \;

BlazeDS

turnkey means ready to use.

Is BlazeDS the best (or one of the best) Java way to send back-end data to the front-end?

How about Web Service?

Here is the benchmark:


By Default

By default, you will get some benefits automatically, isn't that nice? Yes, it's really good until you want to know more.

Ok, let me explain. In SQL, ORDER BY keyword sort the records in ascending order by default. That's nice, but what if you want to sort the records in descending order? If you don't know that SQL sort by ascending order by default, you might get confused a little bit. That's just most simple example.

Now, coming into the framework. We now have all sorts of frameworks, and their purpose, simply put, is to make the life easier for us (the developers), but does they?

Let's use Spring as an example. I am saying this is the only benefit, but one of the most basic benefits to use Spring is you don't need write a lot of Java class, all you need is fill up some xml configuration file, and Spring will do this automatically for you. But do you know that all Spring beans are singletons by default? What if you don't want your bean to be singleton? That's where confusion starts.

See the problem, so far? All the frameworks have these default rules, and you must know all these rules to utilize the most benefits, and these are the pains that you have to suffer for the gains.

One of the most import lessons that I have learnt by studying these frameworks is to pay attention to the keyword "default".

StringUtils and others

org.apache.commons.lang.StringUtils

very useful to format Strings

//left(): get the leftmost len characters of a String.

StringUtils.left("abc", 0) ==> ""
StringUtils.left("abc", 1) ==> "a"
StringUtils.left("abc", 2) ==> "ab"

StringUtils.leftPad("999", 4, '0') ==> "0999"
StringUtils.leftPad("999", 5, '0') ==> "00999"

StringUtils.rightPad("999", 4, '0') ==> "9990"
StringUtils.rightPad("999", 5, '0') ==> "99900"

StringUtils.stripToEmpty(null) = ""; //very useful to convert null to empty String.
StringUtils.stripToEmpty(" abc") ==> "abc"
StringUtils.stripToEmpty(" abc ") ==>"abc"
StringUtils.stripToEmpty(" a bc ") ==>"a bc"


StringUtils.isBlank(null) ==> ture
StringUtils.isBlank("") ==> true
StringUtils.isBlanck(" ") ==> true

more often we use isNotBlank(myString) //to make sure myString is a valid non-empty string.


//the only difference is whitespace is not considered as isEmpty.

StringUtils.isEmpty(null) ==> ture
StringUtils.isEmpty("") ==> true
StringUtils.isEmpty(" ") ==> false //see the difference with isBlank

String[] doesn't have a method called contains, but you could use ArrayUtils.contains

String[] stars = {"Tom", "Sam"};
ArrayUtils.contains(starts, "Sam") ==> true