Posts

Showing posts from October, 2014

Implement Auto-Hide Scrollbar in SWT Text Component

Text textControl = new Text(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); Listener listener = new Listener (){ @Override public void handleEvent(Event event) { Text t = (Text)event.widget; Rectangle r1 = t.getClientArea(); Rectangle r2 = t.computeTrim(r1.x, r1.y, r1.width, r1.height); Point p = t.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); t.getHorizontalBar().setVisible(r2.width <= p.x); t.getVerticalBar().setVisible(r2.height <= p.y); if (event.type == SWT.Modify){ t.getParent().layout(true); t.showSelection(); } }}; textControl.addListener(SWT.Resize, listener); textControl.addListener(SWT.Modify, listener);

Elementary Parallel Algorithm

Summation (Hypercube SIMD) Here SIMD - Single Instruction Multiple Data-streams Parameter n {number of elements to add} P {number of processing elements} Global j Local local.size, local.value [0….ceil([n/P]), sum, tmp { for all Pi where 0 ≤ i ≤ P – 1 do if i < (n mod p) then local.size <- ceil([n/P]) else local.size <- flr([n/P]) end if sum <- 0 end for for (j = 1; j <= ceil([n/P]); j++) do for all Pi where 0 ≤ i ≤ P – 1 do if local.size ≥ j then sum <- sum + local.value[j] end if end for end for for (j = log P - 1; j ≥ 0; j--) do for all Pi where 0 ≤ i ≤ P – 1 do if i < 2j then tmp <- [i + 2j] sum sum <- sum + tmp end if end for end for }

Trying to install Tomcat on Solaris 10

Problem: There is a problem in installing Tomcat on Solaris as there is some kind of incompatibility between Solaris Tar and GNU tar. When you will try to extract the Tomcat via tar utility then it will cut file names which is longer than some specific number of characters. It will produce @LongLink error. One solution:  Download Apache-Tomcat(required version).zip from ftp site of Apache tomcat. You will find some FTP links on this page http://www.apache.org/dyn/closer.cgi   Unzip that tomcat.zip file   Removed extra new line character on startup.sh and shutdown.sh: "dos2unix startup.sh startup.sh"  and  "dos2unix shutdown.sh shutdown.sh"  Changed permissions of the startup.sh and shutdown.sh:  "chmod 775  *.sh"