Thread safe servlet

Just half way reading a book, and found something is important in order to create a thread safe servlet, few attribute and variable must be synchronized as below:

  • Context Scope Attribute
  • Session Scope Attribute
  • Instance Variable
  • Static Variable/Class Variable
 

Disable create a war/jar file in Netbeans6

To disable generation of a WAR file for a project:
1 . In the Files window, open your project folder and open build.xml.
2 . Override the do-dist target to have no contents and no dependencies. For example, add the following to build.xml:
<target name=”do-dist”/>

To disable generation of a JAR file for a project:
1 . In the Files window, open your project folder and open build.xml.
2 . Override the jar target to have no contents and no dependencies. For example, add the following to build.xml:
<target name=”jar”/>

*Information is getting from Netbeans help file.

 

Fedora core 8 – Twin View/DualScreen


Wow, desktop extended, can have more icon to put, can manipulate files at *large* screen…

1) open a terminal, type xrandr to check your display configuration, see image below:

NOTE : based on the result, maximum resolution to display = 2048 x 768 and 2 output is currently connected, which is VGA-0 and DVI-0, ok, note it down, it’s needed to edit xorg.conf file.

2) create a copy of /etc/X11/xorg.conf as xorg.conf.ori for backup purposes.

3) edit xorg.conf as example below :

# Xorg configuration created by pyxf86config

Section "ServerLayout"
Identifier "Default Layout"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "us+inet"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "FLATRON 775FT"
HorizSync 31.5 - 61.0
VertRefresh 50.0 - 75.0
Option "dpms"
EndSection

Section "Monitor"
Identifier "Monitor1"
VendorName "Monitor Vendor"
ModelName "FLATRON 775FT"
HorizSync 31.5 - 61.0
VertRefresh 50.0 - 75.0
Option "RightOf" "Monitor0"
EndSection

Section "Device"
Identifier "Videocard0"
Driver "radeon"
Option "Monitor-VGA-0" "Monitor0"
Option "Monitor-DVI-0" "Monitor1"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Videocard0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Virtual 2048 768
Depth 24
Modes "1024x768"
EndSubSection
EndSection

# End Xorg configuration created by pyxf86config

4) Few thing here you need to aware of (for those keyword in red colour), and need to change accordingly your hardware:

  • RightOf – its a identifier which determine where your 2nd screen to display, other usable keywords are , “LeftOf” , “Above”, “Below”. In this case: monitor1 is RightOf monitor0
  • VGA-0 and DVI-0 – there are output connected to your monitor.
  • 2048 768 – It is maximum resolution for your Virtual configuration.


P/S : From my understanding after doing these, I think we just created a virtual screen which has big resolution(2048×768) and so, we can view it as twin screen as both screen will get 1024×768 individually.
Please correct me, if I’m wrong 🙂

 

NetBeans 6 java.lang.ClassCastException

Wow, Netbeans6 IDE is finally out! After download here.. installed, happily run the cool IDE with newly added features…. opps….. exception occur as :

java.lang.ClassCastException: org.openide.filesystems.MultiFileObject$VoidValue cannot be cast to java.lang.Stringat org.netbeans.modules.editor.settings.storage.EditorSettingsImpl.getCurrentFontColorProfile
(EditorSettingsImpl.java:233)
xxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx

After playing around with those settings file located at home directory as .netbeans folder, I found that, when user trying to import setting from their previous settings created by older version of Netbeans will hit such error (I use Netbeans 5.5) in their first run.

Okie, here come with solution:

  1. Delete folder created/imported when first run in %HOMEDIR%/.netbeans/6.0.
  2. Run Netbeans again, then choose not to import settings created by previous version of Netbeans

p/s : I don’t know why this senario happen in Netbeans6, as I just try out this, if you know why or have better way to solve this, please help to comment here.

 

1st Computing Book I Read

“Coder To Developer – by Mike Gunderloy”, this will be the 1st computing book I manage to digestED in my life, I learned from that book, although not all topic I can get in it well, but at least I know that, developer is not only who wrote code well, but a lot of thing need to know/learn….. from starting till the “end” of a application/project, tools and strategies for deliver software….xxx,xxx…so on.
Now I realised, I’m just a coder, not developer, after working 2 years in IT industry…. so sad….
~~Today onward, I will no call myself as developer untill a day I manage to deliver software with those tools, and strategies apply on ~~

Wow!!! what a cool slogan….

 

Insert ampersand ‘&’ in MenuStrip

Busy Googling web to looking for information “How to put an ampersand ‘&’ in menustrip ” this morning. ….

found that hard to find the related article, finally, I try to put double ‘&’, WOW!! it works.

Normally we put ‘&’ to indicate underline for the character after ‘&’

For eg : &Property will show Property

To have Save & Close like image show, simply put &Save &amp;& Close will do.

 

Unhelpful Error Message

org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.company.core.common.pojo.Consultant.setAvailability

I found this error when I’m trying to run a method which is not related at all for Consultant class, but this error occur and make me surprise, I’ve check through the maping file, the settle method as error claim, restart netBeans, clean and build project…

but it still not working as what the expected result, FINALLY…. I found that, there is a null value in Consultant table (But the field is allow null), can some 1 tell me why….

 

Hibernate mapping error

org.hibernate.type.IntegerType.set(IntegerType.java:39)

Let say you declare “long” as your variable data type in your class file, but you put type =”int” in hibernate mapping file, above exception will throw.
so, be careful when mapping your hibernate xml file.

 

Just Deploy

I was confuse for long time, what should I do when I want to see the changes/output after modified the Java source file when web services is running?
stop tomcat, run again? clean and build project? no, the answer is –just clisk on “Deploy Project“, then netbeans will do the compiling, undeploy and redeploy job for you, that’s simple.
(NOTE: There must be a app server bundle in netbeans).