Wednesday, November 18, 2009

How to get rid of Internet Explorer

I am not a big fan of Microsoft products and using Internet Explorer is one of the most painful experiences I have to go through while testing a UI for a web development or just while browsing the intranet at work, but today I took a look at a Firefox addon that allows you to open an IE tab inside Firefox called (not surprisingly) IE Tab.

The best part of it is that I can add trusted sites just as in IE, something that is not available in the current version of FF, and this avoids having to enter my credentials every time I go to a different page in the intranet! The addon is not perfect, IE 8 sites don’t look exactly the same but still it helps a lot while testing previous versions.

That’s it for now ;)

Tuesday, November 17, 2009

Javac OutOfMemory error while compiling with Ant

Did you get this OutOfMemory error message from javac  while compiling with ant:

“The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: Java heap space”

Well there is an easy way to fix it! first set property “fork” to true, this will allow javac to execute in a separate thread with its own resources, then you can set the values for “memoryinitialsize” and “memorymaximumsize” according to your needs. Here is a sample of how the javac task would look.

 <javac  
     fork="true"
     srcdir="${basedir}/src"  
     destdir="${basedir}/build/classes"  
     classpath="${project.classpath}"  
     memoryinitialsize="256m"  
     memorymaximumsize="256m"
 />  

That’s it! I hope it helps ;)

How to remove dotted lines from blogger (bottom)

Yesterday I removed dotted lines from the top of each post from Google Blogger, but I didn't have enough time to check how to remove them at the bottom, so today I took a look at it and here it goes for anyone else that needs it:

  • Login to you Blogger account and go to Layout -> Edit HTML
  • Ctrl + F "border-bottom:1px dotted $bordercolor;" it should be located in something like this
.post {
margin:.5em 0 1.5em;
border-bottom:1px dotted $bordercolor;
padding-bottom:1.5em;
}
  • Set "border-bottom" to zero
.post {
margin:.5em 0 1.5em;
border-bottom:0px dotted $bordercolor;
padding-bottom:1.5em;
} 
  • Save and check your blog

How to remove dotted lines from blogger

I personally don't like blogger's dotted lines on each post title, so with some help from Greasemonkey and after taking a look at the HTML  template I managed to removed them with a simple line of code:
  1. Login you blogger account and go to Layout -> Edit HTML
  2. Ctrl + F "]]>"
  3. Copy this "a {outline:none;}"  before the result of step 2
  4. Save and check your blog
That's it! I hope it helps ;)

Monday, November 16, 2009

Remove svn folders recursively

Today I was about to zip and send some code folders to a co-worker, at that point what I needed was a simple feature to remove all svn related things from this folder and recursively through all subfolders, I still don't know isn't this included as a feature by kdesvn, eSvn, QSvn or RapidSVN.

I'm a Linux user so this will do the trick:

find . -name ".svn" -exec rm -rf {} \;
 
In case you are using Windows and probably Tortoise you can go this way:

Export the current copy and choose a different folder, it will copy the code there and it will remove all svn things. Beware that if you choose the same folder Tortoise will just remove things without copying anything.

Well I hope this helps ;)

Geronimo Load Balancing database deployment

Recently I had the need to deploy a new datasource in Apache Geronimo, usually this would be a five minutes process that will just require a quick update of the deployment plan similar to this one:


 <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">  
   <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">  
     <dep:moduleId>  
       <dep:groupId>console.dbpool</dep:groupId>  
       <dep:artifactId>jdbc.myapp.mydb</dep:artifactId>  
       <dep:version>1.0</dep:version>  
       <dep:type>rar</dep:type>  
     </dep:moduleId>  
     <dep:dependencies>  
       <dep:dependency>  
         <dep:groupId>oracle</dep:groupId>  
         <dep:artifactId>ojdbc5</dep:artifactId>  
         <dep:version>11.1.0.6.0</dep:version>  
         <dep:type>jar</dep:type>  
       </dep:dependency>  
     </dep:dependencies>  
   </dep:environment>  
   <resourceadapter>  
     <outbound-resourceadapter>  
       <connection-definition>  
         <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>  
         <connectiondefinition-instance>  
           <name>jdbc.myapp.mydb</name>  
                          <config-property-setting name="Password">mypass</config-property-setting>  
           <config-property-setting name="UserName">myuser</config-property-setting>  
                          <config-property-setting name="DatabaseName">DB113</config-property-setting>  
                          <config-property-setting name="DataSourceName">mydb</config-property-setting>  
                          <config-property-setting name="ServerName">myserver</config-property-setting>  
                          <config-property-setting name="PortNumber">1521</config-property-setting>  
                          <config-property-setting name="DriverType">thin</config-property-setting>  
           <connectionmanager>  
             <xa-transaction>  
               <transaction-caching/>  
             </xa-transaction>  
             <single-pool>  
               <max-size>10</max-size>  
               <min-size>0</min-size>  
                                    <blocking-timeout-milliseconds>5</blocking-timeout-milliseconds>  
               <idle-timeout-minutes>1</idle-timeout-minutes>  
               <match-one/>  
             </single-pool>  
           </connectionmanager>  
         </connectiondefinition-instance>  
       </connection-definition>  
     </outbound-resourceadapter>  
   </resourceadapter>  
 </connector>  


But in this case I needed to deploy a database with load balancing, since I couldn't find this info online I thought about sharing with everyone the deployment plan that worked for me, it is similar to the previous one and the difference is in the "connectiondefinition-instance" element:


         <connectiondefinition-instance>  
           <name>jdbc.rf2h.mydb</name>  
           <config-property-setting name="Driver">oracle.jdbc.OracleDriver</config-property-setting>  
           <config-property-setting name="Password">mypass</config-property-setting>  
           <config-property-setting name="UserName">myuser</config-property-setting>  
           <config-property-setting name="ConnectionURL">jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS = (PROTOCOL = TCP)(HOST = 192.8.231.8)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = 192.8.231.9)(PORT = 1521))(LOAD_BALANCE = yes)(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = db313))  
                          </config-property-setting>  
                          <config-property-setting name="CommitBeforeAutocommit">true</config-property-setting>  
           <connectionmanager>  
             <local-transaction/>  
             <single-pool>  
               <max-size>5</max-size>  
               <min-size>1</min-size>  
               <blocking-timeout-milliseconds>30</blocking-timeout-milliseconds>  
               <idle-timeout-minutes>1</idle-timeout-minutes>  
               <match-one/>  
             </single-pool>  
           </connectionmanager>  
         </connectiondefinition-instance>                      


As you can see, all the info about the load balance is in this "ConnectionURL" property, that's it, I hope this helps ;)

PS: for this deployment I used the following library: geronimo-tomcat6-javaee5-2.1.2\repository\org\tranql\tranql-connector-ra\1.4\tranql-connector-ra-1.4.rar

Sunday, November 1, 2009

Upgrade to Karmic Koala (Kubuntu 9.10)

The new version Karmic Koala was just released this week and I took a few hours during the weekend to upgrade my system. The download and install process through the upgrade manager went out perfectly until I had to restart and noticed the following errors:

"init:sreadahead main process terminated with status 1 init"

and

"One or more of the mounts listed in /etc/fstab cannot yet be mounted: 
(ESC for recovery shell)
/: waiting for /dev/disk/by-uuid/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

To solve the first issue find the follwing lines in your /etc/init/sreadahead.conf file

“start on starting mountall
stop on stopped rc”


And replace the first line like this:

“#start on starting mountall
start on filesystem”

To solve the second issue edit the following in your /etc/fstab file:

- Disable fsck on vfat by setting to "0" the value in the last column of you vfat entry this way

“UUID=XXXX-XXX /media/hda1 vfat defaults,utf8,umask=007,gid=46 0 0”

- Replace all UUID by /dev/sdxx

After this changes the error was still there, then I noticed that during startup my old kernels were the only option in the grub menu and I couldn´t access the one installed during the upgrade. Googling the issue resulted in a forum thread that describes this solution:

- Make your devices writable again:
“mount -n -o remount,rw /”
- Install broken packages (it took a while for me):
“sudo dpkg --configure -a”
- Now you should be able to reboot the system and access 9.10!

In case you want more info about the fstab file you can check this link.

That´s it for now!