Monday, December 24, 2012

SQL Developer Tips and Tricks

There's a great blog about SQL Developer by Jeff Smith (SQL Developer team, PdM).

You can find a lot of cool stuff (tips, tricks, performance/monitoring/debug and much more). Enjoy!

Thursday, October 18, 2012

Emulate web apps on multiple platforms

If you have a set of web pages that you need to check on several different devices/platforms there's a great way to quickly switch between the platforms and run through the pages looking for glitches.

If you are using Chrome all you need to do is to open dev. tools (use Ctrl+Shift+I or right click and Inspect element), then click on Settings (gear sign in the bottom right corner), click on Overrides tab and there you are!

Now just select to override User agent and pick one of the drop-down options for a device/platform you want to emulate (iOS, Android, IE etc.) and you are ready to go! Nice and easy.

Displaying Android screen on your PC

You wrote a perfect Android application and now you want to present it to someone over Webex, Skype or any other web conference tool (and you don't want to show it on an emulator, but on a real device). The best way would be to cast your device screen on a PC.

There are several tools that allow you to do this, and among few of them that were tested I was most satisfied with Droid@Screen. It gives you the best control options, allows recording, screen capturing etc.

All you need to do is to install USB driver for Android device that you have (download it from manufacturer's web page), connect device to your PC, let Droid@Screen recognize it (Droid@Screen is started by double click on the jar file) and let the games begin!

Also, you need to have Android SDK installed, and ANDROID_HOME environment variable pointing at Android SDK home.

This is where you can find this great tool and any other information that you might need:


Thursday, September 6, 2012

Multiple JBoss instances on the same box

If for some reason you need to run several JBoss instances on the same machine, you'll probably find that JBoss 5 predefined port ranges perfectly satisfy your needs.

You may change default port range by editing server/default/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml.

<!-- The name of the set of bindings to use for this server --> <parameter>${jboss.service.binding.set:ports-default}</parameter>

Change ports-default to ports-01, ports-02 etc (in ports-01 range ports are increased by 100, in 02 by 200 etc). In the same bindings file you'll find more about these port ranges, and you can even create your own ranges. 

In case you don't want to maintain several folder copies you can start JBoss passing one of port ranges as a parameter: 

run -Djboss.service.binding.set=ports-01

Friday, August 31, 2012

Short List of Useful Unix Commands

These commands should work for bash shell and other Bourne-style shells.

Environment variables 

env - List all existing environment variables
echo $<variable_name> - Check value for some particular environment variable (e.g. echo $JAVA_HOME
export <variable-name>=<java-install-dir> - Set an environment variable:(e.g. export JAVA_HOME=/opt/jdk1.6_20)

To set environment variables permanently (instead for current session only) you'll need to add export line (see above) in your .profile file (${HOME}/.profile) if you are using one of the Bourne-style shells, or in ${HOME}/.bash_profile or .bash_login if you are using bash shell in particular. 

Navigation and listing content

cd <dir_name> - Go to specified subdirectory.
cd ~ - Go back to home directory (from wherever you are)
cd .. - Go back one directory (space is required)
pwd - Show current position as a full path

ls - Lists all files/directories in a current director my
ls <dir> - Lists files/directories in specified directory 
dir <dir> - Same as above (just like in DOS) 
ls -l <dir> - List and show date, size and permissions 
ls -F <dir> - Show file types ("/" = directory, "*" = executable) 
ls -R <dir> - List dir and all subdirs (recursive listing) 
ls <dir> | more - Show listing one screen at the time

Search, sort, compare files

find / -name *.java - finds all files whose name ends with .java (/ tells that search should start from the root directory, if "/" is missing search will start in the current directory)
grep '<pattern>' <file> - Find regular expression in file (e.g. grep --color=auto -R 'main' *.java to find all 'main' occurrences in all java files in current directory and subdirectories (-R) painting them differently for better visibility (--color=auto))
tail -200f <fiel1> grep | <filter> - Show last 200 lines of file1 looking for specified regular expression (e.g. tail -400f grep | 'public static')

diff <file1> <file2> - Show the differences
sdiff <file1> <file2> - Show files side by side
sort <file1> > <file2> - Sort file1 and save as file2 
sort -o <file> <file> - Replace file with sorted version


ps - list processes (e.g. ps -ef | grep java will list a full information (-ef) about all java (grep java) processes currently running)
top - list all processes ordered by CPU time consumption
nohup - command which will ignore hangup signal enabling the command to keep running after the user who has issued the command has logged out
command & - run command in the background (e.g. nohup some_command & will run some_command in the backup and keep it running after the user has logged out)
kill - kill a process (e.g. kill -9 1389 will kill process with id 1389)


* - Match any string of characters (e.g. test* gets test1, and test.txt)
? - Match any single character (e.g. test? gets test1, test2, but not test14)
[...] - Match any characters in a range (e.g. test[1-2] gets test1, and test2)

. - The current directory 
.. - Parent directory ~ - Home directory (e.g. cd ~ takes you home)

Friday, July 20, 2012

Git support in Eclipse


Git is an open source distributed version control system designed to be fast, written in C, developed by Linus Torvalds for Linux kernel development. Distributed nature of this tool actually means that you are not doing a classical checkout of the source code. Instead, you get a clone of the entire repository. Thereby, every user basically has a full backup of the main server and each of these copies can be used to replace the main server in case of the crash/corruption.

Also, since you don't have a single server where all developers push their changes as in a centralized systems, you may use it in quite a different manner. There's a short overview of the common workflow styles on the official Git page.

Most people moving from a centralized system like myself prefer a "centralized workflow" where Git will not allow you to push the changes if someone has pushed since the last time you pulled. However, you might find that some other workflow styles suite you just as well.

Installing Eclipse plugin for Git

Now let's see how you can enable Git support in Eclipse.

Go to Help/Install New Software...
Select Work With: All Available Sites, and type 'Git" to filter results.

Select EGit and click on Next.

Proceed with installation by accepting license agreements and you'll soon have your IDE ready to go.

Now you can import some Git project and start coding. :)

Using Git Repository Perspective

If you want to clone a Git repository, open Git perspective (Window/Open Perspective/Other... select Git Repository Exploring).

Click on the "Clone a Git repository and add the clone to this view".

Fill in repository details. By the way, repository referred in this example contains code samples for a great series of tutorials written by Krams.

Wait for the system to recognize the branches and proceed.

Choose a local destination.

Click Finish and enjoy! You may now right-click on the repository and take some action.


Tuesday, June 26, 2012

Some useful jQuery plugins

Beside previously described jQuery Datatables and accompanying plugins which help you deal with all sort of basic table functionality and advanced transformations (from basic searching, sorting, filtering, pagination to row grouping, inline editing etc.), you can find jQuery plugins for many other needs. Some of them make our life easier by adding core functionality and allowing us to avoid boilerplate code. Others take care of good appearance and add interactivity. Here are few plugins from both sides which come in handy. Hope you'll find them just as useful and interesting.

Quicksand - Animated sorting and filtering:

Nivo Slider - Nice looking slider with fancy transition effects:
Uniform - unified form look and feel:

Several jQuery plugins for facing Google Maps:
Few AJAX jQuery file uploaders:

Collection of Forms plugins: