Tuesday, August 28, 2012

Chris Maki's Blog: Annotated JAXB Classes

Interesting, but JAXB sometimes is not able to use its own generated .java files.
So, if you see the error
javax.xml.bind.JAXBException: "your.package" doesnt contain ObjectFactory.class or jaxb.index

the following post might be your solution:
Chris Maki's Blog: Annotated JAXB Classes

Friday, July 27, 2012

Setting up HTTPS support for WAMP

If you use WAMP to get local PHP server, you might run into issues to set up the HTTPS. The following step-by-step tutorial indeed helped me, and I think it would be useful to re-post it.
Recently I had to run a website with several https links under local server for testing and I had to configure the Open SSL server that comes with WAMP server. I'm sure it would be helpful for you as well.

  1. First thing first, we need to create that self-signed SSL certificate, so go to DOS command prompt (Start menu -> Run -> cmd).
  2. ext, we need to navigate to the directory that contains the openssl executive file which is located in folder C:\wamp\bin\apache\apache2.2.11\bin by default. In order to go there, we need to type the command as follows.
    Code: Select all

  3. After press Enter, your prompt should change as follows
    Code: Select all

    From there, we begin to create the self-signed SSL certificate and the first command you have to type is as follows.
    Code: Select all
    openssl genrsa -aes256 -out pass.key 2048
  4. After press Enter and wait a little while, it should ask you for a pass phrase. Just type in anything but make sure you have to remember that for later use. Of course, it will ask you to verify the pass phrase.
    You may type test123 for testing.
  5. Now, we will create the key for our server. In this tutor guide for HTTPS SSL on WAMP, we will use our domain ExpertCore, but you should use your domain or design name instead.
    Code: Select all
    openssl rsa -in pass.key -out expertcore.key

  6. Next, it will ask you to enter the pass phrase that you have created before. Wait a little while for it to write the key for your server.
  7. Now is the time to type in the command to create our self-signed SSL certificate; since this command is quite long, you will see it takes more than one line, so make sure not to press the Enter key until you finish the whole command.
    Code: Select all
    openssl req -new -x509 -nodes -sha1 -key expertcore.key -out expertcore.crt -days 999 -config C:\wamp\bin\apache\apache2.2.11\conf\openssl.cnf

  8. After press Enter, it will ask you to input 2 letters that presents your country. You can enter LK, US, IN, JP, etc... that represents your country. Next you have to input your State or Province, City, Organization Name, Organization Unit Name, Common Name and Email address.
  9. Guess what, you just got yourself a self-signed SSL certificate. Now, open folder c:\wamp\bin\apache\apache2.2.11\conf and create a new folder "ssl" (without quotes).
  10. Then, from folder c:\wamp\bin\apache\apache2.2.11\bin, copy 2 files key and crt to ssl folder.
  11. Create another folder named as "logs" inside c:\wamp\bin\apache\apache2.2.11\conf\ssl. We save all HTTPS transaction and error logs in this folder.
  12. After that, go to folder c:\wamp\bin\apache\apache2.2.11\conf\extra to open file httpd-ssl.conf.
  13. Find this line:
    Code: Select all
    SSLSessionCache "shmcb:C:/Program Files/Apache Software Foundation/Apache2.2/logs/ssl_scache(512000)"

    Replace with:
    Code: Select all
    SSLSessionCache "shmcb:C:/wamp/bin/Apache/apache2.2.11/conf/ssl/logs/ssl_scache(512000)"

  14. Next find this line:
    Code: Select all
    SSLCertificateFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/server.crt"

    Remember to substitute expertcore with your domain to replace with:
    Code: Select all
    SSLCertificateFile "C:/wamp/bin/Apache/apache2.2.11/conf/ssl/expertcore.crt"

  15. Then find:
    Code: Select all
    SSLCertificateKeyFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/server.key"

    Again, substitute expertcore with your domain to replace:
    Code: Select all
    SSLCertificateKeyFile "C:/wamp/bin/Apache/apache2.2.11/conf/ssl/expertcore.key"

  16. Then find:
    Code: Select all
    SSLMutex "file:C:/Program Files/Apache Software Foundation/Apache2.2/conf/ssl/logs/ssl_mutex"

    Replace with:
    Code: Select all
    SSLMutex default

  17. In Virtual Host, find these lines: (ssl34.jpg).
    Code: Select all
    # General setup for the virtual host
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
    ServerName localhost:443
    ServerAdmin admin@localhost
    ErrorLog "C:/Program Files/Apache Software Foundation/Apache2.2/logs/error_log"
    TransferLog "C:/Program Files/Apache Software Foundation/Apache2.2/logs/access_log"

    HTTPS SSL is the secure transaction which is good for sensitive informations such as Credit card numbers, membership accounts... however, it might slow down your server performances if everything go through it; thus, we suggest that you only set it to the specific directory that you want to use for SSL, and in this example, we use folder ssl:
    Code: Select all
    # General setup for the virtual host
    DocumentRoot "C:/wamp/www/ssl"
    ServerName expertcore:443
    ServerAdmin admin@localhost
    ErrorLog "C:/wamp/bin/Apache/apache2.2.11/conf/ssl/logs/ssl_error.log"
    TransferLog "C:/wamp/bin/Apache/apache2.2.11/conf/ssl/logs/ssl_access.log"

  18. Then find:
    Code: Select all
    <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
    SSLOptions +StdEnvVars

    Modify to become as below:
    Code: Select all
    <Directory "C:/wamp/www/ssl">
    SSLOptions +StdEnvVars
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all

  19. Then find:
    Code: Select all
    CustomLog "C:/Program Files/Apache Software Foundation/Apache2.2/logs/ssl_request_log" \"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

    And change it as below:
    Code: Select all
    CustomLog "C:/wamp/logs/ssl_request.log" \
        "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

  20. Next, open file httpd.conf in folder c:\wamp\bin\apache\apache2.2.11\conf and find these lines:

    Code: Select all
    # Secure (SSL/TLS) connections
    #Include conf/extra/httpd-ssl.conf

    Uncomment the second line, and make sure there is no blank space in front of second line and in the end of first line or your wamp will not run:

    Code: Select all
    # Secure (SSL/TLS) connections
    Include conf/extra/httpd-ssl.conf

  21. After save and close all files, left click on WAMP tray icon and navigate to Apache modules and scroll down until you get ssl_module; then, left click on it to enable SSL on WAMP.
  22. Next, navigate to PHP extensions and scroll down until you get php_openssl; then, left click on it to enable open_ssl on WAMP.
  23. Left click on the WAMP tray icon and click on Restart all services.
  24. After that, open folder C:\wamp\bin\apache\apache2.2.11\bin and copy 2 files libeay32.dll and ssleay32.dll and paste them in folder C:\Windows\System32.
  25. Now is the time to test our HTTPS SSL on WAMP, so open your desire text editor and create a simple webpage index.html which is then saved in folder C:\wamp\www\ssl as follows:
    Code: Select all
    font size="5" color="red">test SSL successful</font>

  26. Now is the time to run the created test file; open your desire browser and input the address bar as below, remember to replace expertcore with your domain or design name:
    Code: Select all

  27. Oops, error... If using Firefox, you can left click on the line "Or you can add an exception...". Again, left click on the button "Add Exception".
  28. On the popup windows, left click on the button "Get Certificate".
  29. You have to left click on the button "Confirm Security Exception".
  30. The moment of success that show up the red line in your browser.
    SSL successful

This is not my work, this is re-post of user named Saman in ExpertCore.org forum (Source)

Sunday, July 22, 2012

jQuery 2.0, planned for early 2013, will drop the support for IE6-7-8

Sky High Code: jQuery 2.0 ends WinXP support - Good.

Interesting article, interesting news from jQuery! It is seriously great step for jQuery to stop the support of IE8,7,6, depicting overall programmers opinion about these versions.

As what jQuery officials have explained on (source), all those hooks used to fix oldIE compatibility issues made the jQuery run slower for modern browsers. Minding the percentage of IE6-7-8 users, this is a logical step forward. Luckily, starting from early 2013, when this change is planned, would mean adding a simple condition checking whether browser is IE8- and loading jQuery1.9, and otherwise loading jQuery2.0.
I could imagine a issues that people using CDN and latest jQuery versions would come up with, if they forget to make the correct condition switch.

1) If my clients aren't willing to stay current, then it's time for me to find new clients

I dont think everyone can change their clients like that. Even suggesting to switch to IE9 might cause performance problems as the computers they own are usually from pre-historic times and it was probably already heavy workload to start those IE6-7-8. As long as there is some decent percentage of clients using IE6-7-8, the most companies would prefer to support them. However, as it seems here, APIs are the same, so there would not be bigger development issues right now. But will it stay also in future, with newer versions of jQuery? Would they at some point start to use different APIs as well, causing a need for addition development for oldIE browsers, just to make them compatible? This should mainly be the concern of company's management to decide whether the cost of additional and in most of the cases rather expensive development, or simply take up the risk and advise clients to modernize a bit.

Thursday, June 14, 2012

Google Developers Blog: Better Web Templating with AngularJS 1.0

I have tried out a bit AngularJS. I have to say I am sad to get to know it so late, because it could have been of grate use for certain html form related project. I really like the dynamic web templating of AngularJS, as you it makes the overall code very neat and easy to read.

Google Developers Blog: Better Web Templating with AngularJS 1.0: By Miško Hevery , Google AngularJS team AngularJS lets you write web applications as if you had a smarter browser.  It lets you extend ...

A pew-pew manifesto...

Interesting discussion about Javascript by Bernd Paradies from Adobe.

JavaScript is not suitable for large web apps

Friday, May 4, 2012

Compile Error: WSDLException, faultCode=CONFIGURATION_ERROR...

I found the best solution for such errors when using Spring WS.

So, if you see errors like:
 WSDLException, faultCode=CONFIGURATION_ERROR...

Take a look at this url

Nicely categorized list of java libraries/utilities/frameworks

For up-to-date frameworks/utilities/libraries, this truly deserves it's name, ultimate collection!
Further, there are very nice tutorials/examples in there as well!

Turn off the windows automatic updates

I am one of those people who don't like to turn off their PCs. Yea, really nice waste of energy, I know...

Usually work PC is the place when always something is running overnight, either some sort of calculations, parsing, simulations or any other nerdy stuff are performed.

The most annoying part, when you work on windows, are the automatic updates. It can restart your PC by itself just to apply just installed updates. "§$%&%$ windows!

The disable such a stupid option,
Go to Start, Run "gpedit.msc" to bring up the group policy editor.
Then navigate to the folder
Local Computer Policy
->Computer Configuration
->Administrative Templates
->Windows Components
->Windows Update

There are two settings and both will work, so it's your choice. Either enable No auto-restart for schedule Automatic Updates installations or set Re-prompt for restart with scheduled installations to a long time interval, like 1440 minutes.

I prefer the first one :)

Thursday, April 19, 2012

Runtime Error:class loading constraint violated

Webapp reports the following error every time it tries to poll the sql server:

Uncaught exception thrown in one of the service methods of the servlet: dispatcher. Exception thrown : org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.VerifyError: class loading constraint violated (class: com/microsoft/sqlserver/jdbc/SQLServerResultSet method: updateNClob(ILcom/microsoft/sqlserver/jdbc/NClob;)V) at pc: 0

And it worked in the local environment, but not on the test server.

SOLUTION: Go to test server WAS Integration Solutions Console, Applications->Enterprise Applications, and then click on your application
Within Detail Properties, press, Class loading and update detection and there switch the Class loader order from Classes loaded with parent class loader first to Classes loaded with application class loader first.
If you had it already set, then your issue is different then mine.

Core explanation of the this error is:
java.lang.VerifyError can be the result when you have compiled against a different library than you are using at runtime.

For example, this happened to me when trying to run a program that was compiled against Xerces 1, but Xerces 2 was found on the classpath. The required classes (in org.apache.* namespace) were found at runtime, so ClassNotFoundException was not the result. There had been changes to the classes and methods, so that the method signatures found at runtime did not match what was there at compile-time.
Normally, the compiler will flag problems where method signatures do not match. The JVM will verify the bytecode again when the class is loaded, and throws VerifyError when the bytecode is trying to do something that should not be allowed -- e.g. calling a method that returns String and then stores that return value in a field that holds a List.

Pasted from

Hope this help anyone else, as I havent really managed to find that anyone had similar problem.

Friday, March 30, 2012

Parsing the Logical expression

Sometimes you need to parse the logical expression.

I have made for my own purposes the regular expression which would distringuish all important tokens from the logical expression:
or as java string:

this would give for

 !(! (one== 56) && two>45) || !three!=funny
the following solution
Regular Expression ([\(!\s]*)[\s]*([^<=\s]+)[\s]*(<>|!=|==|<=|>=|<|>)[\s]*([^\s&|\)]*)[\s]*([\)]*)(&&|\|\|)?
as a Java string "([\\(!\\s]*)[\\s]*([^<=\\s]+)[\\s]*(<>|!=|==|<=|>=|<|>)[\\s]*([^\\s&|\\)]*)[\\s]*([\\)]*)(&&|\\|\\|)?"
Replacement $1fieldValue(\"$2\")$3$4$5$6
groupCount() 6
Test Target String matches() replaceFirst() replaceAll() lookingAt() find() group(0) group(1) group(2) group(3) group(4) group(5) group(6)
1 !(! (one== 56) && two>45) || !three!=funny No !(! (fieldValue("one")==56) && two>45) || !three!=funny !(! (fieldValue("one")==56) && fieldValue("two")>45) || !fieldValue("three")!=funny Yes Yes !(! (one== 56) !(! ( one == 56 ) null
next find() Yes two>45) two > 45 ) null
next find() Yes !three!=funny ! three != funny null

Friday, March 23, 2012

A useless, but nice Excel trick

To show just the fields in the worksheet which are useful, and hide all the rest of the fiels,

To Hide Rows

Select row whereyour data finishes
Press Ctrl + Shift + Down Arrow Key
Move mouse pointer over the row numbers, Right Click, Hide

To Hide Columns

Select Column 21
Press Ctrl + Shift + Right Arrow Keys
Move mouse pointer over the column numbers/letters, Right Click, Hide

Thursday, March 22, 2012

jQuery print example

This is just a small update of BenNadel's great post on printing the part of the page using jQuery/Javascript.

The code is placed here

Wednesday, March 7, 2012

Encoding troubles UTF-8 in Eclipse/Rational Application Developer...

Uh, I never understood at all what is the reason for all these encoding types!
I had to do some modifications on a custom made JavaEE project which uses velocity template engine. I ended up having a lots of encoding problems.

Now I want to write sort of a step by step instruction how fix it.

Ok, so let's start.
Sooo, you have troubles with your spring/javaEE eclipse project. Several steps to take a look:

1) Check here: Window->Preferences->General->Workspace->Text file encoding - set to UTF-8
This setting will let even your new files to be encoded in UTF-8. It is usual cause of troubleshttp://www.blogger.com/img/blank.gif

2) under Window->Preferences search for encoding keyword and set everything you see to UTF-8 (this does not help too much, but sometimes is useful)

3) If your files are created outside eclipse project, check whether they are written/saved in UTF-8 coding. Notepad++ has a nice feature that is able to show you encoding of your file/text and also to convert from one encoding to another. TRY NOT USING UTF-8 WITH BOM (adds additional bytes to the beginning of the textual file so the editors can know this is UTF-8. Otherwise it causes  at the beginning of the file as soon as you get some encoding issues (like with ISO-8859-1 and CP1252)).

3.1) if you find this a bit problematic you can either use:
- Solution with Batch Convert to UTF-8 with Iconv and Sponge (under the moreutils package).
- Use the UTFcast Express Edition

4) Usually, Spring and velocity are nicely interconnected, and easily solve the issue with encodings, but if the velocity is directly used, one has to take care additionally to use the getTemplate function in the following way:
Otherwise, it defaults to ISO-8859-1.

Thursday, March 1, 2012

Samsung Galaxy S2 tip

It seems that Samsung is using by default the fast dormancy, a new technology which tries to save your battery life by turning your phone completely connection less if no activity is detected. This is cool, right? Not really, since in order for this to work, network provider has to support it as well, which makes the completely opposite effect, by draining the phone battery and still make phone disconnected when idle (e.g. no SMSes received).

To disable this (my strong suggestion), do the following:
*#*#9900#*#* and then choose
disable fast dormancy
and then

I have tested this already for 1 month, and it works pretty fine, and battery life is extended definitely by some 20%-30%.

- it prolongs/extends the battery life
- it solves the issue of phone being completely disconnected at times

More about fast dormancy:

Some other codes are also interesting, which I haven't tested yet (but will test soon GPS configurations):
*#1234# (View SW Version PDA, CSC, MODEM)
*#12580*369# (SW & HW Info)
*#197328640# (Service Mode)
*#0228# (ADC Reading)
*#32489# (Ciphering Info)
*#232337# (Bluetooth Address)
*#232331# (Bluetooth Test Mode)
*#232338# (WLAN MAC Address)
*#232339# (WLAN Test Mode)
*#0842# (Vibra Motor Test Mode)
*#0782# (Real Time Clock Test)
*#0673# (Audio Test Mode)
*#0*# (General Test Mode)
*#2263# (RF Band Selection)
*#9090# (Diagnostic ConfiguratioN)
*#7284# (USB I2C Mode Control)
*#872564# (USB Logging Control)
*#4238378# (GCF Configuration)
*#0283# (Audio Loopback Control)
*#1575# (GPS Control Menu)
*#3214789650# (LBS Test Mode)
*#745# (RIL Dump Menu)
*#746# (Debug Dump Menu)
*#9900# (System Dump Mode)
*#44336# (Sofware Version Info)
*#7780# (Factory Reset)
*2767*3855# (Full Factory Reset)
*#0289# (Melody Test Mode)
*#2663# (TSP / TSK firmware update)
*#03# (NAND Flash S/N)
*#0589# (Light Sensor Test Mode)
*#0588# (Proximity Sensor Test Mode)
*#273283*255*3282*# (Data Create Menu)
*#273283*255*663282*# (Data Create SD Card)
*#3282*727336*# (Data Usage Status)
*#7594# (Remap Shutdown to End Call TSK)
*#34971539# (Camera Firmware Update)
*#526# (WLAN Engineering Mode)
*#528# (WLAN Engineering Mode)
*#7412365# (Camera Firmware Menu)
*#80# (Unknown)
*#07# (Test History)
*#3214789# (GCF Mode Status)
*#272886# (Auto Answer Selection)
*#8736364# (OTA Update Menu)
*#301279# (HSDPA/HSUPA Control Menu)
*#7353# (Quick Test Menu)
*2767*4387264636# (Sellout SMS / PCODE view)
*#7465625# (View Phone Lock Status)
*7465625*638*# (Configure Network Lock MCC/MNC)
#7465625*638*# (Insert Network Lock Keycode)
*7465625*782*# (Configure Network Lock NSP)
#7465625*782*# (Insert Partitial Network Lock Keycode)
*7465625*77*# (Insert Network Lock Keycode SP)
#7465625*77*# (Insert Operator Lock Keycode)
*7465625*27*# (Insert Network Lock Keycode NSP/CP)
#7465625*27*# (Insert Content Provider Keycode)
*#272*imei#* (Product code)

Tuesday, February 28, 2012

When you need to host a specific file on your spring application...

... and you don't want to disturb server configuration, as it would mean you need to make this setting on every new server you deploy your application.

Simply add to web.xml something like this:

Hope this helps anyone else. I was always rechecking Spring Security filters and always forgetting about the supporter MIME types...

Tuesday, February 21, 2012

Using AJAX call to send custom post data from the form

This was my solution and probably there are the better ones:
url : //URL
type: 'post',
data: {'data' : JSON.stringify(data)},
dataType: 'html',
cache: false,
async : false,
error: function (jqXHR, textStatus, errorThrown) {
success: function (result) {

It is interesting to note that replacing whole html page via

does not work in IE9.

Summary: if you wanna replace the whole page with newly html-formatted result, you have to use document.open();document.write(NewHTMLDocAsString);document.close(); instead of jQuery('html').html(result);

Monday, February 20, 2012

Javascript Prototype, sort of a object inheritance

Very cool thing to know about javascript:

Javascript comparison operators

I came across very nice short explanation of the differences between == and === comparison operators. I have copied this into my blog just in case the post gets deleted from stackoverflow for whatever reason.

The identity (===) operator behaves identically to the equality (==) operator except no type conversion is done, and the types must be the same to be considered equal.

Reference: Javascript Tutorial: Comparison Operators

The == operator will compare for equality after doing any necessary type conversions. The === operator will not do the conversion, so if two values are not the same type === will simply return false. It's this case where === will be faster, and may return a different result than ==. In all other cases performance will be the same.

To quote Douglas Crockford's excellent JavaScript: The Good Parts,

JavaScript has two sets of equality operators: === and !==, and their evil twins == and !=. The good ones work the way you would expect. If the two operands are of the same type and have the same value, then === produces true and !== produces false. The evil twins do the right thing when the operands are of the same type, but if they are of different types, they attempt to coerce the values. the rules by which they do that are complicated and unmemorable. These are some of the interesting cases:

'' == '0'           // false
0 == ''             // true
0 == '0'            // true
false == 'false'    // false
false == '0'        // true
false == undefined  // false
false == null       // false
null == undefined   // true
' \t\r\n ' == 0     // true

The lack of transitivity is alarming. My advice is to never use the evil twins. Instead, always use === and !==. All of the comparisons just shown produce false with the === operator.

A good point was brought up by @Casebash in the comments and in @Phillipe Laybaert's answer concerning reference types. For reference types == and === act consistently with one another (except in a special case).

var a = [1,2,3];
var b = [1,2,3];
var c = { x: 1, y: 2 };
var d = { x: 1, y: 2 };
var e = "text";
var f = "te" + "xt";

a == b            // false
a === b           // false

c == d            // false
c === d           // false

e == f            // true
e === f           // true

The special case is when you compare a string literal with a string object created with the String constructor.

"abc" == new String("abc")    // true
"abc" === new String("abc")   // false

Here the == operator is checking the values of the two objects and returning true, but the === is seeing that they're not the same type and returning false. Which one is correct? That really depends on what you're trying to compare. My advice is to bypass the question entirely and just don't use the String constructor to create string objects.


Wednesday, February 15, 2012

When IE doesnt parse the received XML AJAX response...

Take care that configured dataType of your ajax call is set to 'xml' instead fo 'html' or 'json', since otherwise IE will interpret it as XML.

Friday, January 27, 2012

trim() not supported by IE7 and IE8

Funny fact, trim function is not supported by IE7 and IE8.

Ok, it is supported, but through jQuery trim function.
So, when you have something like this:
, this trim() function stops having any relation to jQuery, as the attr() would return String type, which method would be then trim(). Since IE7 and IE8 do not support trim() method within String type, you should use instead

or if you don't wanna use jQuery (whyyyy?), you can simply implement the trim function youself.
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');

source 1
source 2

Testing developments for different versions of Internet Explorer

I found excellent article on development environments different IE versions review, made By

Article can be found here

I usually tend to take all the context from the page into this blog to make sure it exist also after the page disappears (you will be surprised how fast link gets changed, wither due to change of the link itself, or to site being closed down due to whatever reasons). This time I'll give it a risk.

Just as a summary, for fast and simple testing, use F12 development mode, and for more detailed test, use the virtual machines and IECollection (you have to get yourself licensed versions of Windows (XP, Vista, and 7)), or use the Windows Virtual PC VHDs (read Notes, max 90 days of being able to permanently save any changes, made on the images).

As a long time user of Virtual machines, I do like to use virtual machines, like VMware or VirtualBox, but still, the easiest way so far is to use F12 developer mode button on IE, and set the browser version to one you require.

Wednesday, January 25, 2012

tabindex browser compatibility issue

When creating form, take care of the way how the fields are passed on when key is pressed. It is usually solved via tabindex, being set as an attribute to the form fields.
However, if some of the elements in the following set {A, AREA, BUTTON, INPUT, OBJECT, SELECT, and TEXTAREA} are not tabindexed, browsers will behave differently upon them.

Internet Explorer will make them first in the order, and then those which are tabindexed, and Firefox would do opposite. Therefore you can either put to not tabindexed elements very large value (up to 32545), so they are shown always the last, or put tabindex="-1". I personally would not use the latter case, as it is not valid value for tabindex in its defition, so the browsers might change the way they behave upon it in the future.

Some more details about it, I have found pretty nice article:

Tuesday, January 24, 2012

Triggering event in a Form/Javascript

Sometimes the values you put in the form through any kind of way except user interaction are not triggering change event upon which some other parts of the form behave. In order to forcefully trigger the even, you can use jQuery.
or simply

My Advice. ALWAYS use jQuery rather than any custom made functions, since jQuery is guaranteed to be web browser compatible! And it is cool and easy!

Sunday, January 22, 2012

Problem of Spring using ISO9968-1 instead of UTF8

After a long search for a solution, a friend of mine gave me this solution.
Put on top of each jsp file the following two lines:
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page pageEncoding="UTF-8" %>

Thursday, January 19, 2012

Get the current path of the web project - alternative way

This alternative way to get absolute path for some of the things, is useful when you need to read or write a some project related file and use it later again.

File file=new File(.class.getClassLoader().getResource("WEB-INF/").getFile());
System.out.println("path is:"+file.getAbsolutePath());

Wednesday, January 18, 2012

Prevent JAXB from creating JAXBElements

I had some annoying trouble with updating JAXB1.0 code into JAXB2.0 code, among which the one of the things is the generation og JAXBElements instead normal type, like JAXBElements instead of simple double.
This is due to fact that JAXB wants to define cases of elements in XSD with minOccurs="0" and nillable="true". If you don't care about such issue, then you can prevent JAXB from creating the JAXBElements in a following way:

Add to your command line generation -b addCFG.xjb
where addCFG.xjb is this file:


Process Explorer

(Windows related)

There is a nice additional utility from Microsoft, for regulating problems/stuff in windows. This utility is sort of a advanced version of task manager, just muuuch better.

It's called the Process Explorer, and it has number many additional features among which these are probably most interesting for regular users:
- Actual view of all the applications that are running
- list of handles opened - this is especially useful when some of programs have closed the connection opened towards peripherals, like removable media (USB stick, flash stick, camera, etc.)