Thursday, October 28, 2010

Setting WebSphere JVM Heap size without the web console

It seems that when you update the JVM Heap size settings for WebSphere through the web console via:

Servers > Application Servers > WebSphere_Portal > Server Infrastructure > Java and Process Management > Process Definition > Java Virtual Machine > Maximum/Minimum Heap Size

There is no warning at all about setting the minimum value and NOT setting the maximum value.  The maximum value by default is 256mb, so if by any chance you set the minimum to 512mb and you go get  a coffee while restarting the server, you will get the following error message in the native_stderr.log file:

“Could not create the Java virtual machine.
JVMJ9GC019E -Xms too large for -xmx “

The message is quite clear, but it doesn’t say where to change this setting and by now you will notice that your server won’t start and you have no access to the web console in order to change the settings.

So how to solve this? find the server.xml config file, that could be located in path similar to this one:

“C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\config\cells\mycomputernameNode01Cell\nodes\mycomputernameNode01\servers\server1″

Please make a BACKUP before proceeding.

Then look for the “jvmEntries” xml element that could look like this:

initialHeapSize=”512″ runHProf=”false” debugMode=”false” debugArgs=”-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7777″ disableJIT=”false”>

Now you can either:
  • Remove the “initialHeapSize” attribute
  • Modify the value to something equal or below 256mb (the default)
  • Add the “maximumHeapSize” and set it to equal or more than the initial, in this case 512mb
Save the file and your server should be ready to go.

Wednesday, October 13, 2010

Take screenshots with your Android

Do you need to take screenshots with your HTC, Motorola or whatever Android mobile phone you have? Well there are a couple of applications in the market that will allow you to do this but they are only available for rooted devices, for example Shoot Me.

But in case you are a developer and you have DDMS installed in your Eclipse, then all you have to do is plug in your device and click on the screenshot button as seen below:

Friday, September 24, 2010

Subversion problem with case insensitive filesystems

If you are using SVN with Linux/Mac and Windows XP you may run into this problem sooner or later. The cause of the problem is the case-sensitive characteristic of Linux/Mac systems not getting along with the insensitive Windows XP, which results in an error message like this:

 svn: In directory '.'  
 svn: Can't open file '.svn\tmp\text-base\qt_temp.N19845.svn-base': The system ca  
 nnot find the file specified.  

Fortunately the solution is quite simple, first access the working copy through Linux/Mac and remove from the repository the file that is causing the problem with the following command:
     svn delete --keep-local the_file  

    Then commit your changes:

     svn ci  

    Now go to your Windows XP system and everything should be working.

    Monday, September 13, 2010

    Joomla Basics: How to customize the style of a module

    So you need to customize the look of a Joomla module? This is quite simple, just follow these steps:

    1) Go to the backend -> Extensions -> Module Manager -> Find your module and set the name of the custom css that you will add

    2) Refresh the page and check the source code. You will find the element using the new class name as shown below

    3) Modify the css file and include the specific propreties you want for this module and use the name set previously

    That's it, now you can make your modules look the way you want!

    Saturday, September 11, 2010

    Removing MySQL from the Linux boot sequence

    Do you want to speed up your boot time? maybe you are a software developer that doesn't require MySQL server to be up and running eveytime you turn on your laptop, and if you are running Kubuntu Lucid Lynx (10.4) like me, you probably already noticed that configuring the startup scripts via sysvrc conf doesn't work anymore.

    You can read more about the change in this link, but the important thing right now is how to stop MySQL from loading next time you boot the computer:

    • cd /etc/init directory
    • sudo editor mysql.conf
    • At the beginning of the file add a comment to the "start on" line (actually two lines)
    In the same folder you will find other services that may be stop in a similar way.

    Monday, August 9, 2010

    Good deed of the day: can I replace my broken power adapter with a used one?

    Most of you may be using a laptop to read this, and if you do you may already ran into the annoying issue of a broken power adapter. You don’t have to be an IT person to know that this is a critical part of your computer, but what many people out there don’t know is that you don’t have to get a brand new charger when this happens.

    This post is aimed to all those people wondering “can I use a different brand or model charger to replace mine?” the answer is: yes, you can and you should!

    Why you should? Well it is very common to hear from people that they want to help and do something good for the world but they either don’t have the time or the energy to join an NGO or a project that works in the area, but it is in our everyday decisions where we make the biggest impact on the world and reusing and old adapter instead of buying a new one is a perfect example of how you can contribute to having a better and more sustainable society.

    Now just keep in mind the following rules before doing your good deed of the day:

    • -Check the adapter jack and make sure that they are almost the same diameter and length to make sure that there is a good connection.
    • -Check the label on your adapter and find the voltage and amperage.
      • -The voltage can’t be too different from the original one, e.g. I just replaced a 19.5V adapter with a 19V one without any problems.
      • -The amperage has to be the same or higher than the original one, e.g. replacing a 3.34A for a 4.70A won’t hurt.

    Drawbacks of this? Some adapters won’t recharge your battery if they are not from the same brand and model as the original one, but it is very likely that by the time your adapter breaks your laptop has been already been used for a couple of years and the battery is useless anyway.

    Just for the records, I replaced a Dell Inspiron 1501 adapter with an Acer adapter (model AP12AD02) and it works perfectly.

    Thursday, July 29, 2010

    Spanish version of Facebook got hacked

    Did Facebook all of the sudden got very impolite? mmmm nope, it seems that the Spanish version of the social network giant was hacked and (at least for some profiles) now instead of wishing you happy birthday it says... well check the image below

    Well another day, another hacked site...

    JVM Heap Size Tuning

    Earlier this week I had to solve a major performance issue affecting our application, in the end it turned out to be a database (missing statistics) problem that lead to a slow response from a query, but in the mean time I had the opportunity to play a little bit more with Websphere’s JVM Heap size settings.

    First of all, what is the JVM Heap size? The simple answer is: The amount of memory used by the virtual machine to allocate new objects created by your Java applications.

    You can find tons of details about it online, but here I’ll post the main ones:

    ·It directly affects performance, so it’s one of the most important JVM tuning parameters

    ·If you set the max heap size too low, your apps will reach the max level soon and you’ll get the following error:

    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

    ·In case you choose big amount for the max heap size setting, then your applications will have all the room needed to create objects, but then the Garbage Collection (GC) process will take longer. The effect of this setting will depend on the GC policy you choose.

    By default the GC policy is set to “Optthruput” which means your app will not respond during GC. The second option is “Optavgpause”, that runs the GC concurrently with the app and gives a better response time. Finally “Gencon”, that treats long-lived and short-lived objects in a different way by allocating the latter ones in a special area (Nursery space) that can be disposed more often, hence reducing the time spent during GC.

    In the end the value of the heap size will depend on the needs and resources available in each case, so now it’s time for you to go and give it a try ;)

    Wednesday, July 28, 2010

    The Inner History of Devices

    An interesting presentation by the famous MIT sociologist Sherry Turkle called "The Inner History of Devices". In the 30 minutes of her presentation (followed by 30 minutes of Q&A) the talk brings you back to a hidden subject within our daily lives: the feelings we have for our devices.

    Check it out and you'll come up with your own ideas about the subject, in my case it made me realize that my wife's idea of me having an emotional attachment to my laptop actually makes sense! Think about it, I work, talk to my family, connect with old friends and have fun through the same device, so who could blame me?

    Now take a couple of minutes, and think about the device that has or is affecting you the most ;)

    Tuesday, July 27, 2010

    My Anti-Creativity Checklist

    I was just working today when Victor, my officemate, told me to check out the following video. It summarizes some of the most commonly used excuses to avoid creativity and challenges in our daily lives.

    Is it something new? No, then why did I post it? Because I think we all need to remind ourselves about this from time to time, otherwise we may lose our focus on what we are aiming for at work and even in our lives.

    I hope these 4 minutes sparked your creativity at least a little bit ;)

    Sunday, July 25, 2010

    Internet Explorer giving a run-time error when executing object.innerHTML

    By any chance did you get an “unknown run-time error” while using the following javascript method object.innerHTML=”yourhtml” in Internet Explorer? well I just did and obviously the very helpful (sarcastic) message by Microsoft didn't help at all.

    Fortunately the solution is quite simple, for example in this case:

     document.getElementById('cartAddSpecContent').innerHTML = spec;  

    All you have to do is to replace the 'cart'AddSpecContent' element (that used to be a


    ) for a block-level one like


    and that's it ;)

    Monday, July 19, 2010

    Creative Web Cam VF0330 not working with Skype

    This weekend I tried to have a video call with my sister that unfortunately didn't work. What happened? Skype didn't like my Creative Webcame VF0330! why do I blame Skype? cause Kopete doesn't have to have any issues with it ;)

    So after a couple of hours of googling and I ended up stuck while trying to compile the Ov51xJPEG hacked driver, then after reading a little bit more I found the following forum entry with a pretty simple solution to my problem:

    First I renamed the old skype executable:

     sudo editor /usr/bin/skypemv /usr/bin/skype /usr/bin/skypewithoutcam  

    Then I created the new executable

     sudo editor /usr/bin/skype  

    And included the following code

     LD_PRELOAD=/usr/lib/libv4l/ /your-skype-folder/skypewithoutcam  

    That's it! enjoy your video calls ;)

    Sunday, May 16, 2010

    OpenJDK or Sun's JDK?

    Did you just install Ubuntu and noticed that OpenJDK is the default Java Virtual Machine? I have nothing against OpenJDK but some programs require the Sun version.

    The good news is that you don't have remove neither of them cause both can live happily next to each other and all it takes to switch from one version to another is the following command:

    sudo update-alternatives --config java 

    Wednesday, May 12, 2010

    Number of files and folders in a Linux folder

    Recently I transfered a folder with big a mount of archives and something seemed to be missing, obviously I wanted to verify that the amount of files was correct and probably just like you, I couldn't find a simple Linux command to help me with this, in fact I found crazy commands like:

    "echo $(($(ls -l | grep -v ^d | wc -l)-1))"

    Until I found the simple and elegant "tree", if you don't have it already just run a simple:

    "sudo apt-get install tree"

    And then you'll have the simple response you were looking for:

    "234 directories, 1786 files"

    Simplest way to test mod_rewrite in Apache

    Are you looking for a way to test if mod_rewrite is enabled in your Apache server? here is an easy one, create a .htaccess file in a folder like for example "www/rewrite_test_folder" with the following code in it:

    Options +FollowSymLinks
    RewriteEngine On

    Then try to access it via http://localhost/rewrite_test_folder and you should get one of these:

    - No errors, mod_rewrite engine is enabled
    - 500, Internal Server Error, this means that mod_rewrite was not installed/enabled in your computer

    Tuesday, May 4, 2010

    First 5 minutes with Kubuntu Lucid Lynx


    During the weekend I ran into the news that Lucid Lynx 10.04 LTS, the new upgrade of Ubuntu, was already available. As a Linux fan this is always good news, but at the same time I'm wary about bugs an problems that can delay what I'm doing at the moment or even break something and make my system unusable for a couple of days.
    It was time to check the features included in this version and see if they were interesting enough to make me go “lucid”.

    It turned out that most of the things were already somehow available for me, but what mainly caught my attention was the new Ubuntu One music store, open for many European countries including Estonia, unfortunately not so sure about Venezuela and other Latin American countries yet.

    One of the best things of the store is that it will be synched with Ubuntu One, the cloud storage solution offered by Canonical, which means that all my songs will be available in my work and personal computer automatically. Besides this, if you buy through the store you’ll get to help the Iberian Lynx:

    To contribute to the charity all you have to do is buy a track at the normal cost. That's it. Canonical will give away 50% of our take of the revenue up to a total of $1004. You can of course directly contribute to the charity if you prefer.”

    After reading all this I decided to go for the upgrade, which took around 7 hours with a 80KB/s average download speed and around 1 hour to install, remove deprecated packages and configure the whole thing. In the end, it was the smoothest upgrade ever! Though I have to warn that some people with dual partition (I removed Windows a while ago) have had problems after reboot, so it might be wise for you to check this out before doing it.

    My first impression? Awesomeness! The UI seems more stable and integrated, boot up time reduction is obvious, in general you can feel that it was totally worth doing the upgrade J

    So that’s it, I hope this gives you enough interest to give a try to the new Lucid Lynx!

    Saturday, March 27, 2010

    Enabling Curl with PHP on Windows

    Today I was installing Zen Cart when I ran into this error message:

    CURL not compiled into PHP - notify server administrator
    Even though it is quite simple to solve the problem, it took me a while to find this. That's usually a good sign that I should write it down ASAP so here it goes

    1) remove ';' from extension=php_curl.dll in php.ini
    2) ensure that  ssleay32.dll and libeay32.dll are in Windows/system32.
    3) Copy php_curl.dll into Windows\System32 as well.

    I hope it helps

    Sunday, March 14, 2010

    How to synchronize FTP files using Notepad++

    Lately I have been working on the migration of a website to a new platform, which required me to modify many files through FTP or remote desktop, most of the times I do this on my Linux computer using Kate which already updates the file on the FTP folder without any issues.

    This time I'm working on a Windows XP machine and Notepad++ doesn't include this feature out of the box. Fortunately there are many plugins for Notepad++ and FTP_synchronize can solve this problem for me, here goes basic info on how to install it and use it;

    1.- Download FTP_synchronize here
    2.- Unzip it and depending on your system copy the file "FTP_synchronizeA.dll" (Win9x/WinME) or "FTP_synchronize.dll" (Windows NT) to "C:\Program Files\Notepad++\plugins"
    3.- Restart Notepad++
    4.- Click on the new button in the toolbar that says "Show FTP folders"
    5.- Click on the "Settings" button
    6.- Add a new profile using your info (user, password, server, initial folder, etc) and click on "OK"
    7.- Click on the "Connect" button and choose the profile you just created.

      Now you have access to your FTP folder from within Notepad++ and every time you  click on "Ctrl + S" the changes will be updated in the server.

      Friday, March 12, 2010

      Can't load PHP's mcrypt extension?

      After installing MySQL and PHP, both were working correctly and the only thing missing was to install phpMyAdmin. After downloading and unzipping the installation file I try to access the application through the browser and I get this error:

      "Cannot load mcrypt extension"

      This can be solved quite easily:

      1. Open your php.ini file (e.g. c://php5/php.ini or c://windows/php.ini)
      2. Find and uncomment "extension=php_mcrypt.dll", save the file.
      3. Copy "libmcrypt.dll" from your php folder to "c://windows"
      4. Restart the server
      That's it!

      Wednesday, March 10, 2010

      How to install PHP 5.2 on Windows 2003 Server with IIS6

      Let's skip all the blabbing and  go straight to the content.


      1.    Windows 2003 Server
      2.    IIS6 Web server
      3.    PHP 5.2.13 binaries zip file (Download here)


      1.    Unzip the content of the zip in the following location "C:\php5"
      2.    Copy "C:\php5\php.ini-recommended" to "C:\WINDOWS"
      3.    Rename the previous file to "php.ini"
      4.    Copy "C:\php5\php5ts.dll" to "C:\WINDOWS\system32"
      5.    Open IIS Manager - Expand your server - Right click on "Websites" - Properties - Home Directory - Configuration - Add
      6.    Browse and select the file "C:\php5\php5isapi.dll" and set the extension value to ".php" and click "OK"
      7.    Now in the same "Websites" properties window, go to the "Documents" tab
      8.    Click on "Add" and enter this value "index.php" and move it to the top
      9.    Right click on the "Web Service Extensions" and add a new one
      10.    Set the extension name to "PHP", then click on "Add" and select the file "C:\php5\php5isapi.dll"
      11.    Tick on "Set extension status to Allowed"
      12.    Create a text file with the following content " to test our installation:
       <?php phpinfo(); ?>  
      13.    Save the file as "index.php" in the following location "C:\inetpub\wwwroot"
      14.    Open your internet browser and open "http://localhost" or "http://localhost/index.php"

      That should it be it! you should get a PHP info similar to this one:

      Monday, March 1, 2010

      Useful constants in JavaFX

      There are a couple of useful constants in JavaFX that for sure I'll use later in the future, check them out:

      Dir will return the directory of the currently executed FX source file. A sample of how to use it would be something simple like:
       println("The current directory of this FX file is: {__DIR__});  
      The value of this constant may be a jar in case you are executing this from a jar.

      File is similar to the previous one, the main difference is that it will return the url of the current source file.

      Profile will have only three values, "mobile","desktop" and "browser" depending on how the script was executed.

      Using the following code you will get the value of the "codebase" attribute located in the .jnlp file from your application. So in case you .jnpl file goes like this:
      Then you can retrieve the value this way:
       var codebase = FX.getProperty("javafx.application.codebase");  

      Wednesday, January 27, 2010

      How to clear your browser's JRE cache?

      I was just testing a Java Applet on Firefox and noticed that either I had to reload the page a thousand times or restart the browser, obviously this results in wasting a big amount of precious time but fortunately there is an easy way to clear your browser's JRE cache:

      1. Open the Java console -> Tools -> Web Developer -> Tools -> Java Console
      2. Click on "x" to clear the classloader cache and you will get the following message:

      "Clear classloader cache ... completed."

      Thursday, January 21, 2010

      JavaFX Eclipse plugin error

      If you decided to give it a try to JavaFX using Eclipse you may run into your first problem right after installing the JavaFX plugin for Eclipse and it may look like these errors:

      Cannot access java.lang.Object class file for java.lang.Object not found
      Invalid assignment
      Package javafx.scene does not exist
      Package javafx.stage does not exist

      First of all make sure that you added correctly the JavaFX SDK to your libraries:

      If this is correct then take a look at your ".classpath" file and make sure that the JavaFX entry looks like this:

            <classpathentry kind="con" path="com.sun.javafx.eclipse.core.classpath.SDKClasspathContainer"/>  

      And not like this:

            <classpathentry kind="con" path="com.sun.javafx.eclipse.core.classpath.SDKClasspathContainer/reserved/desktop"/>  

      That fixed it for me ;)

      Tuesday, January 12, 2010

      Simple Spring 3 tutorial

      Here goes a tutorial to get your feet wet with a (really) simple Java Application using the latest version of Spring.

      1- Create a simple Java project named "SimpleSpring3"

       2- Create a "lib" in your project right under your "src" folder, then download the latest Spring version and copy the jars to "lib". Also copy "commons-logging.jar" located in the following location "projects/spring-build/lib/ivy" in the unzipped Spring file. Your library should look like this

      3- Create a "SimpleSpring3" java class in the "com.greensoft" package, this class will contain one simple "sayHola" method that prints "Hola Spring 3.0!!" in the console

      4- Create the Spring config "SimpleSpring3.xml" file located in the "src" folder

      5- Add the following code to the Spring config file

       <beans xmlns=""  
            xmlns:xsi="" xmlns:aop=""  
            <bean id="SimpleSpring3Bean" class="com.greensoft.SimpleSpring3" />  

      The code in the config file defines a bean that can be accessed later on from our test file using the bean factory

      6- Create the test file "SimpleSpring3Test" and the following code

       package com.greensoft;  
       import org.springframework.beans.factory.xml.XmlBeanFactory;  
       public class SimpleSpring3Test {  
            public static void main(String[] args) {  
                 XmlBeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource(  
                 SimpleSpring3 simpleSpringBean = (SimpleSpring3) beanFactory  

      In the above code we use XmlBeanFactory to get access to our config file "SimpleSpring3.xml" in order to get our "SimpleSpring3Bean" object.

      7- The final project structure should look like this

      8- Execute the code by right clicking on the test file "SimpleSpring3Test" then --> Run As --> Java Application" and you should get the following output in the console

      simple, right? I hope it was useful for someone out there, that's it for now ;)

      Sunday, January 10, 2010

      Windows Movie Maker app on Linux

      I was about to upload a video on YouTube for the first time (ever!) and I noticed that I was missing Movie Maker type of application in Linux,  After searching for a few minutes I found this post about "Top 10 Free Video Editors for Ubuntu Linux", well I decided to try some of them.

      if you want a quick recommendation for a simple app, go for Avidemux, in case you are looking for more advanced features go for Cinelarra. Finally Kino maybe somewhere in between.