Thursday, February 6, 2014

How to Debug Eclipse Based Application

There are at least two way to do it:
  1. Run your eclipse application from your eclipse development environment in debug mode
  2. Attach to running eclipse application using Eclipse remote debugger 

Run your eclipse application from your eclipse development environment in debug mode

For this option you need to have all sources imported in eclipse development environment and compiled without errors. Then you can just create Eclipse Application launch configuration and run it in debug mode. If for some reason it is not possible, you still can debug your application with second option.

Attach to running eclipse application using Eclipse remote debugger

Using this approach you need to start your eclipse app with remote debugger enabled. Add in your eclipse application ini file following lines in -vmargs part
So you would have something like this (note last two lines)
Now you can start custom eclipse. You won't see anything because it would be in debug mode and wait until remote debugger is attached. When console output shows the message
Listening for transport dt_socket at address: 8001
It is time to start remote debugger session in eclipse development environment.
Import source code you want to debug into development workspace. Make sure you use source code eclipse application was built from or line numbers won't match in debug. There is no need to have source compiled without errors because your application is already running.
Select Project->Debug Configurations ... form bar menu and create new Remote Java Application configuration with name you want and configure port as 8001 (see options in ini file above). Do not forget to visit Source tab and add all projects with sources you need during debug session.
Run it ignoring a warning about compilation errors and you should see eclipse splash form your eclipse application started before. After that you can use debugger as usual.


Both options require to have configured development environment in Eclipse, I prefer to use option (2) because it doesn't require to have everything compiled without problems in eclipse workspace. You always can start from what you really interested in and then add missing sources into development environment in the middle of debugging session.

Wednesday, November 20, 2013

JavaScript: Minification and Compression

After JavaScript is baked it is time to think about fastest delivery of your fresh tasty product. You might think about how to shrink your source to minimize download time. There are couple ways to achieve this goal by using minification and compression. Don't think about them as the different names for the same process they are different and can be combined to get better result.

Minification is the process of eliminating unnecessary characters from java script that doesn't affect functionality like white-spaces, comments and shorten the names of script objects. The resulting file stays in the same text format and can be opened and read by regular text editor.

Compression is the process of shrinking JavaScript text even further using special compression algorithm. Resulting file is not readable and must be decompressed to be used. Modern browsers understands files received with header 'Content-Encoding: gzip' and decompress them by default.

To get best results files with JavaScript could be minified and then compressed.

There are several popular minifiers out there:

  • YUI Compressor
  • Cosure Compiles
  • UglifyJS
It is definitely worth to automate minification process and do it during the packaging of your application. Whatever you use in your build and CI there is always some sort of build extensions that can do it for you.

Wednesday, November 13, 2013

EclipseCon 2010 API Design and Evolution (Tutorial)

EclipseCon 2010 API Design and Evolution (Tutorial):

In Open Source Development anyone doing something for public consumption should be aware it is not just his personal possession anymore and there are developers out there using it in every day work. Thus this API Design and Evolution practices should be the part of every day work.

'via Blog this'

Monday, July 1, 2013

MouseFeed for Eclipse is Your Personal Keyboard Shortcuts Coach

MouseFeed | Eclipse Plugins, Bundles and Products - Eclipse Marketplace: "MouseFeed helps to form a habit of using keyboard shortcuts. When the user clicks on a button or on a menu item, the plugin shows a popup reminding about the key shortcut. After a few times, you remember the keyboard shortcut and you will start using it, rather than clicking through menus. This will save you a lot of time at the end of the day."

It works as advertised and started to show popups for actions selected trough menu right after installation and restart. For example, if  "Run->Run..." menu action selected popup shown below appear.

MouseFeed Plug-in Popup Window look

It also has "Action invocation counter threshold" parameter in preferences, which controls the popup behavior for actions without shortcuts.

MouseFeed Plug-in Preferences

If for example "Help->About Eclipse Platform" menu Item selected 3 times, then this plugin shows popup with link to configure shortcut for it.

MouseFeed Plug-in Popup window look for action without shortcut

For more information look at:

'via Blog this'

Monday, April 30, 2012

JBoss Tools Browser Simulator Standalone Application Build

What is JBoss Tools Browser Simulator (BrowserSim)?

Browsersim is quick and easy way to test how your web application going to look like on mobile device. Truth be told it cannot be 100% reliable and no a replacement for platform specific emulator.

BrowserSim is available as part of JBoss Tools Project, but there is simpler way to get your hand over it and try if it works for you.

How to configure your environment to get BrowserSim running

  • Windows: 
    • Only 32-bit Eclipse/JBDS is supported; 
    • Apple QuickTime or iTunes must be installed (they contain Apple Application Support which provides WebKit engine for BrowserSim). 
  • Linux: 
    • WebKitGTK 1.2.0 or newer must be installed and available in the library load path. 
    • This should be available on RHEL and Ubuntu by default, if not use your package manager to install libwebkitgtk 
  • Mac OS X 
    • It just works. 

What is required to build BrowserSim standalone application

    Install prerequisites listed below:
  • Java SDK 1.6
  • Apache Maven 3.0.X
  • Subversion client

How to build BrowserSim standalone application with maven

mkdir browsersim
cd browsersim
svn checkout
mvn package -Dmaven.repo.local=.m2 -Declipse.p2.mirrors=false
then depending on used platform it can be started as
and will show iPhone2 skin by default. Use context menu on window title to:
  • select device
  • rotate your device
  • change settings

Tuesday, April 3, 2012

Forge for DB Reverse Engineering with CRUD (video)

Forge also has a Hibernate Tools plugin that allows it to analyze a database schema and produce JPA entity classes. Then Forge can use its scaffolding feature to generate JSF2 Create, Read, Update and Delete (CRUD) user interfaces.

Forge for DB Reverse Engineering with CRUD from JBoss Developer on Vimeo.

Hibernate Tools for DB Reverse Engineering (video)

Hibernate Tools have been part of JBoss Developer Studio for a long time - now they are integrated with Dali - and you can use Dali's JPA Generate Entities from Tables feature. This video walks you through how to setup the Hibernate Configuration and the JBDC connection to allow for JPA entity generation.

Sakila H2 Database:

Hibernate Tools for DB Reverse Engineering from JBoss Developer on Vimeo.