Posts

Handling long string not visible in one entry of list field in Blackberry (show ...@ end)

This code returns string which can be shown in a field having width=width, 5 pixel margin on left and 5 pixel on right. private String getTextShown( String completeString, int width ) { if ( completeString == null ) return null; width = width - 10; Font font = listfield.getFont( ); if ( font.getAdvance( completeString ) < width ) return completeString; for ( int i = completeString.length( ) - 1; i > 0; i-- ) { completeString = completeString.substring( 0, i ); StringBuffer tempBuffer = new StringBuffer( completeString ); tempBuffer.append( "..." ); String temp = tempBuffer.toString( ); if ( font.getAdvance( temp ) < width ) { return temp; } } return completeString; } This can be called from protected void paint( Graphics graphics ) { String stringToDraw = getTextShown( ...

Blackberry ListField with custom image to highlight and 3 strings in single row.

Image
This is the code in Blackberry ListField for showing multiple entries in a list. Each entry 3 distinct strings, with different fonts sizes. The entry is highlighted by using a custom colored image. User can highlight the list item and hit menu key to see the details about the highlighted entry as well. package mypackage; import java.util.Vector; import net.rim.device.api.i18n.ResourceBundle; import net.rim.device.api.system.Bitmap; import net.rim.device.api.system.Display; import net.rim.device.api.ui.Color; import net.rim.device.api.ui.DrawStyle; import net.rim.device.api.ui.Field; import net.rim.device.api.ui.FieldChangeListener; import net.rim.device.api.ui.Font; import net.rim.device.api.ui.Graphics; import net.rim.device.api.ui.Manager; import net.rim.device.api.ui.MenuItem; import net.rim.device.api.ui.XYRect; import net.rim.device.api.ui.component.ButtonField; import net.rim.device.api.ui.component.LabelField; import net.rim.device.api.ui.component.ListFie...

Setting up CVS in fedora 12

1. install cvs using: "yum -y install cvs" 2. execute "cvs -d ~/cvsRepo init" to build a new cvs repository at ~/cvsRepo. This will build a CVSROOT structure inside it. 3. create a new group in your OS. Call it as "cvs". Add your user to this group. 4. reboot the machine so that group changes can take effect. 5. change group owner for ~/cvsRepo by using: chgrp -R cvs ~/cvsRepo/ 6. chmod ug+rwx . CVSROOT You may have noticed that the chgrp and chmod commands in that example gave write access to a user named anonymous, which is not what one would expect. The reason is that even anonymous, read-only repository users need system-level write access, so that their CVS processes can create temporary lockfiles inside the repository. Before running through the steps needed to set up the password server, let's examine how such connections work in the abstract. When a remote CVS client uses the :pserver: method to connect to a repository, the client is a...

Setting and using Apache Tomcat/5.0.28 in windows

1. Install the tomcat in windows by selecting port 8090. Do not change any location. 2. Start the tomcat server. If it gets started, no problem. Otherwise check the log in C:\Program Files\Apache Software Foundation\Tomcat 5.0\logs If you find [2009-01-16 11:22:19] [1343 prunsrv.c] [debug] Procrun log initialized [2009-01-16 11:22:19] [info] Procrun (2.0.4.0) started [2009-01-16 11:22:19] [info] Running Service... [2009-01-16 11:22:19] [1166 prunsrv.c] [debug] Inside ServiceMain... [2009-01-16 11:22:19] [info] Starting service... ... [error] The specified module could not be found. [2009-01-16 11:22:19] [994 prunsrv.c] [error] Failed creating java C:\Program Files\Java\jre1.6.0_07\bin\client\jvm.dll [2009-01-16 11:22:19] [1269 prunsrv.c] [error] ServiceStart returned 1 [2009-01-16 11:22:19] [info] Run service finished. [2009-01-16 11:22:19] [info] Procrun finished. [2009-01-16 11:24:41] [1343 prunsrv.c] [debug] Procrun log initialized [2009-01-16 11:24:41] [info] Procru...

P2P

Designing a P2P grid which will uses decentralized approach entirely. There will be no central coordinator. Is it possible? Let me find it out.

Globus continued....

1. export GLOBUS_LOCATION=/usr/local/globus 2. cd /usr/local/globus/setup/globus 3. ./setup-simple-ca Press y to keep the default subject name. Enter the email of the CA (It must be working because all the certificate requests will be sent to this emailID). Accept the default for expiration date. passphrase: should be hard to guess, as its compromise may compromise all the certificates signed by the CA. Your passphrase must not contain any spaces. Private key is in /home/globus/.globus/simpleCA//private/cakey.pem The public CA certificate is stored in /home/globus/.globus/simpleCA//cacert.pem The distribution package built for this CA is stored in /home/globus/.globus/simpleCA//globus_simple_ca_decb74a7_setup-0.20.tar.gz This file must be distributed to any host wishing to request certificates from this CA. The number decb74a7 in the last line is known as your CA hash. It will be an 8 he...

Creating a grid using Globus toolkit

I have used fedora core 12 for installation. 1. Download the globus toll installer from http://www.globus.org. The current version is gt5.0.2-all-source-installer.tar.bz2. 2. create a directory with root login mkdir /usr/local/globus Copy gt5.0.2-all-source-installer.tar.bz2 to /usr/local/globus using the command cp gt5.0.2-all-source-installer.tar.bz2 /usr/local/globus 2. Login as globus user and extract gt5.0.2-all-source-installer.tar.bz2 in /usr/local/globus: chown globus:globus /usr/local/globus tar xvf gt5.0.2-all-source-installer.tar.bz2 3.Configure the installation path to /usr/local/globus/ using commands: cd gt5.0.2-all-source-installer ./configure --prefix /usr/local/globus/ This will create makefile. 4. make It will take 15-20 minutes depending on the configuration of your machine. 5. make install 6. export GLOBUS_LOCATION on terminal and add a line in ~/.bashrc : export GLOBUS_LOCATION=/usr/local/globus-5.0.2 To setup Simple CA see next blog.