Sunday, January 17, 2010

EJB 3.1 (Asynchronous Beans)

Enterprise Java Beans specifications have finally matured to a point where it may actually help with performance: container-managed Asynchronous beans.
speed
You can now specify a Session Bean (and/or a method) to be asynchronous. End-user perceived wait times can be significantly reduced with an asynchronous programming model that doesn’t force the complexity of AJAX, MoM or application-managed server threads.
With EJB 3.1 when you call the method from your client, the container will take the request and return immediately. Then it will dispatch the request to a bean instance within the pool of SLSBs.
The return type for async methods is either void or Future. The Future interface provides methods to check whether the operation has completed, gets the result – with options for a timeout and also cancel the operation. A concrete implementation of Future is AsyncResult which is available in the javax.ejb package.
Stateless EJBs may choose to return the AsyncResult object with any type returned. Transaction propagation is simple &  limited - REQUIRED=REQUIRES_NEW attributes. If your client is already in a transaction, or your beans are in a transaction, the async method is called in a totally new transaction with no propagation (as in synchronous methods). This makes a lot of sense, because the entire purpose of asynchronous calls are to decouple a process orchestration to speed up things. However, it does complicate compensation and atomicity. Software architects need to trade-off between transaction demarcation and generally ACID properties across various calls. Any application exception that gets thrown by the bean for a void return type cannot be handled by the client. If your bean can encounter an exception and your client cares about handling it, then return a Future<V> form the bean. The client must handle the exception on a Future.get and getCause from ExecutionException.
An entire bean (itself or via it’s super class) can be marked as @Asynchronous. Sometimes it makes sense to expose the same business function as a synchronous and an asynchronous interface, using the @Asynchronous tag can provide the cohesion with a decoupled interaction model. This opens the door to multiple use-cases that need a simple way to conduct asynchronous calls without the complexity of MDBs or managing application owned threads. EJB 3.1 has built upon the POJO model for EJBs with an excellent way to realize asynchronous server-side models.

Saturday, January 2, 2010

Google Chrome @ 5% (almost)

Google Chrome is now the 3rd most popular browser in the world.

According to recent reports here and here, Google's Chrome has overtaken Apple's Safari in the browser wars. While still at less than 5% chrome is no match for Microsoft's Internet Explorer which is slightly above 62%. Chrome is gaining strength quickly mostly due to two quality attributes: speed and reliability. Chrome is noticeably faster than Opera, IE, Firefox and Safari. It's reliability is unsurpassed due to its multi-process architecture.


Coming in at #3 just months after it's GA release is commendable. With new features like bookmark sync and support for themes and plug-ins it will rival the # 2 spot in a couple years, eating away Microsoft's and Mozilla's share.

Tuesday, December 8, 2009

SSH and Strawberry Perl

Strawberry Perl doesn't come with SSH modules pre-installed.

Here is how to insall

C:\>perl -MCPAN -e shell

cpan shell -- CPAN exploration and modules installation (v1.9304)
ReadLine support enabled

cpan> install Net::SSH
Fetching with LWP:
http://cpan.strawberryperl.com/authors/01mailrc.txt.gz
LWP failed with code[500] message[Can't connect to cpan.strawberryperl.com:80 (connect: timeout)]

As a last ressort we now switch to the external ftp command 'C:\WINDOWS\system32\ftp.EXE'
to get 'C:\strawberry\cpan\sources\authors\01mailrc.txt.gz.tmp3104'.

Doing so often leads to problems that are hard to diagnose.

If you're victim of such problems, please consider unsetting the ftp
config variable with

o conf ftp ""
o conf commit

I would like to connect to one of the following sites to get 'authors/01mailrc.txt.gz':

http://www.perl.org/CPAN/
ftp://ftp.perl.org/pub/CPAN/

Is it OK to try to connect to the Internet? [yes] yes
Fetching with LWP:
http://www.perl.org/CPAN/authors/01mailrc.txt.gz
LWP failed with code[500] message[Can't connect to www.perl.org:80 (connect: timeout)]
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz
Fetching with LWP:
http://cpan.strawberryperl.com/modules/02packages.details.txt.gz
LWP failed with code[500] message[Can't connect to cpan.strawberryperl.com:80 (connect: timeout)]
Fetching with LWP:
http://www.cpan.org/modules/02packages.details.txt.gz
LWP failed with code[500] message[Can't connect to www.cpan.org:80 (connect: timeout)]
Fetching with LWP:
http://www.perl.org/CPAN/modules/02packages.details.txt.gz
LWP failed with code[500] message[Can't connect to www.perl.org:80 (connect: timeout)]
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/modules/02packages.details.txt.gz
Fetching with LWP:
http://cpan.strawberryperl.com/modules/03modlist.data.gz
LWP failed with code[500] message[Can't connect to cpan.strawberryperl.com:80 (connect: timeout)]
Fetching with LWP:
http://www.cpan.org/modules/03modlist.data.gz
LWP failed with code[500] message[Can't connect to www.cpan.org:80 (connect: timeout)]
Fetching with LWP:
http://www.perl.org/CPAN/modules/03modlist.data.gz
LWP failed with code[500] message[Can't connect to www.perl.org:80 (connect: timeout)]
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/modules/03modlist.data.gz
Creating database file ...

Gathering information from index files ...
Populating database tables ...
Done!
Running install for module 'Net::SSH'
Running make for I/IV/IVAN/Net-SSH-0.09.tar.gz
Fetching with LWP:
http://cpan.strawberryperl.com/authors/id/I/IV/IVAN/Net-SSH-0.09.tar.gz
LWP failed with code[500] message[Can't connect to cpan.strawberryperl.com:80 (connect: timeout)]
Fetching with LWP:
http://www.cpan.org/authors/id/I/IV/IVAN/Net-SSH-0.09.tar.gz
LWP failed with code[500] message[Can't connect to www.cpan.org:80 (connect: timeout)]
Fetching with LWP:
http://www.perl.org/CPAN/authors/id/I/IV/IVAN/Net-SSH-0.09.tar.gz
LWP failed with code[500] message[Can't connect to www.perl.org:80 (connect: timeout)]
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/Net-SSH-0.09.tar.gz
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/CHECKSUMS
Checksum for C:\strawberry\cpan\sources\authors\id\I\IV\IVAN\Net-SSH-0.09.tar.gz ok
Scanning cache C:\strawberry\cpan\build for sizes
DONE

CPAN.pm: Going to build I/IV/IVAN/Net-SSH-0.09.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Net::SSH
cp SSH.pm blib\lib\Net\SSH.pm
IVAN/Net-SSH-0.09.tar.gz
C:\strawberry\c\bin\dmake.EXE -- OK
Running make test
C:\strawberry\perl\bin\perl.exe "-Iblib\lib" "-Iblib\arch" test.pl
1..1
ok 1
IVAN/Net-SSH-0.09.tar.gz
C:\strawberry\c\bin\dmake.EXE test -- OK
Running make install
Prepending C:\strawberry\cpan\build\Net-SSH-0.09-cQfbZo/blib/arch C:\strawberry\cpan\build\Net-SSH-0
.09-cQfbZo/blib/lib to PERL5LIB for 'install'
Installing C:\strawberry\perl\site\lib\Net\SSH.pm
Appending installation info to C:\strawberry\perl\lib/perllocal.pod
IVAN/Net-SSH-0.09.tar.gz
C:\strawberry\c\bin\dmake.EXE install UNINST=1 -- OK

cpan>

ADSL on Ubuntu 9.10 (Karmic Koala)





Working with ADSL modems on Ubuntu 9.10:


Configure: pppoeconf
sudo pppoeconf
Check: rohit@lenovo:/etc/network$ more interfaces auto lo iface lo inet loopback iface dsl-provider inet ppp pre-up /sbin/ifconfig eth0 up # line maintained by pppoeconf provider dsl-provider auto eth0 iface eth0 inet manual
Start: pon

rohit@lenovo:/etc/network$ sudo pon dsl-provider
Plugin rp-pppoe.so loaded. RP-PPPoE plugin version 3.8p compiled against pppd 2.4.5
Stop:poff
sudo poff
Log:plog

rohit@lenovo:/etc/network$ plog Dec 8 16:37:45 lenovo pppd[11102]: Plugin rp-pppoe.so loaded. Dec 8 16:37:45 lenovo pppd[11102]: RP-PPPoE plugin version 3.8p compiled against pppd 2.4.5

This method works well for BSNL's ADSL lines in Kolkata.

Sunday, January 11, 2009

Download HD Trailers from Apple Trailers

Apple movies now 'stream' mov files, they cannot be saved (like they us. for example, if you view the HD movie trailer for the movie "GOOD" - the URL on the page leads to this stream:
http://movies.apple.com/movies/ifc_films/good/good_1080p.mov
Saving link creates a mov file of 75k - not the movie.

In order to download, add the letter 'h' (Hidden) to the movie file name:

wget http://movies.apple.com/movies/ifc_films/good/good_h1080p.mov

HD-Trailers.net has an article on this and a tip for Yahoo HD Movie Trailers - which I've never used...

Tuesday, December 23, 2008

The Green Way to Fax (paper-less)

If you are like me and work with PDFs a lot, often times you get PDFs that you may need to PRINT and sign, then fax - because they can't accept e-mails etc.

PRINTing and Faxing wastes Paper on both sides. 

There are many FOSS tools in Linux that allow you to edit PDFs, insert Text and images.

  1. Use PDF Editor to open a PDF document, and open it for editing 
  2. You can insert text and/or images (like a scanned ink signature)
  3. Once done, simply save it as a PDF, or JPG image.
  4. Now you have an electronic document filled out and 'physically signed' to be faxed away

PDF Editor provides a very good interface to open a PDF and edit it in multiple ways, repackage and save it as a PDF.

Go to Ubuntu Software Center and search for 'PDFEditor'

Related articles:

Saturday, November 29, 2008

Initialize Interpid Ibex

Well well - I decided to remove Vista from the Vostro, downgraded to XP and dual-booted with Ubuntu 8.10

Installation was smooth as ever and grub worked perfectly. Dell ships with these broadcom network adapters that need b43 drivers - thankfully these are provided with the new dist.

There is a bunch of software that I typically need/want/desire - here are the steps to get it

I don't mind free closed-source software, so edit /etc/apt/sources.list & enable what's disabled.

Enable medibuntu:

sudo wget http://www.medibuntu.org/sources.list.d/intrepid.list -O /etc/apt/sources.list.d/medibuntu.list

sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update


Now go for the mass install - remember Google & Sun want you to agree with their license terms - so keep an eye out for those when the time comes tab to Ok and hit enter.

sudo apt-get install python python-central python-gtk2 python-compizconfig compizconfig-settings-manager amarok flashplugin-nonfree amule audacity azureus banshee bluefish dvdrip filezilla msttcorefonts gnucash gstreamer* gtkpod-aac sun-java6-bin sun-java6-javadb sun-java6-jdk sun-java6-jre sun-java6-plugin k3b kino mplayer mozilla-mplayer quanta kompozer scribus xchat-gnome bittornado bittornado-gui sound-juicer helix-player mozilla-helix-player googleearth acroread mozilla-acroread non-free-codecs ubuntu-restricted-extras libdvdcss2 opera xine-ui xine-plugin xmms2 xmms2tray xmms2-plugin-airplay xmms2-plugin-alsa xmms2-plugin-ao xmms2-plugin-asf xmms2-plugin-asx xmms2-plugin-avcodec xmms2-plugin-cdda xmms2-plugin-cue xmms2-plugin-curl xmms2-plugin-daap xmms2-plugin-faad xmms2-plugin-flac xmms2-plugin-gme xmms2-plugin-gvfs xmms2-plugin-ices xmms2-plugin-icymetaint xmms2-plugin-id3v2 xmms2-plugin-jack xmms2-plugin-karaoke xmms2-plugin-lastfm xmms2-plugin-m3u xmms2-plugin-mad xmms2-plugin-mms xmms2-plugin-modplug xmms2-plugin-mp4 xmms2-plugin-musepack xmms2-plugin-normalize xmms2-plugin-ofa xmms2-plugin-oss xmms2-plugin-pls xmms2-plugin-pulse xmms2-plugin-rss xmms2-plugin-sid xmms2-plugin-smb xmms2-plugin-speex xmms2-plugin-vocoder xmms2-plugin-vorbis xmms2-plugin-wma xmms2-plugin-xml xmms2-plugin-xspf vlc vlc-data vlc-dbg vlc-nox vlc-plugin-arts vlc-plugin-esd vlc-plugin-ggi vlc-plugin-jack vlc-plugin-pulse vlc-plugin-sdl vlc-plugin-svgalib thunderbird skype


Note: When you run Google Earth ensure that you have not Desktop Effects enabled.

This should provide nearly all the functionality that's needed for a baseline O/S installation.

Sunday, July 20, 2008

Recover Dual Boot XP, Ubuntu 8.04 (Hardy Heron)

Issue: I needed to reinstall Windows XP on a dual-boot machine. No new partitions were needed, there were 2 O/S partitions - one with XP and the other with Ubuntu. After reinstalling Windows - the machine would simply boot into Windows XP (no dual-boot menu)

Solution: Boot from Ubuntu LiveCD - choose to demo. Then open terminal.


rohit@rs-dimension:~$ sudo -i
[sudo] password for rohit:
root@rs-dimension:~# grub

[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]

grub> find /boot/grub/stage1
(hd0,4)

grub> root (hd0,4)

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,4)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.



This setup grub in hd0 on my system - bringing back the boot menu. Simple

Saturday, December 22, 2007

iTunes Audio only Podcast & Video only Podcast SmartList

(I) Unplayed Audio Podcast smartlist that plays 100 audio unheard unskipped podcasts starting from the earliest added.

Podcast is true
Play Count is 0
Skip Count is 0
Kind
does not contain MPEG-4

Limit to 100 items selected by least recently added

To create a Video podcast just change the Kind parameter on the smartlist to "contains"

You can sort the list so it will play by artist, album (most Podcasts have album names consistent), genre etc

Setting Video Kind to Movie admits most video podcasts however others get filtered out - so avoid this parameter.

Wednesday, August 8, 2007

Mule ESB Distribution

So I started playing with Mule starting Feb 2007. Mule is an integration platform that allows for pluggable connectors to other types of systems. There are so many descriptions of ESBs and architecture styles, and almost everyone claims to be an expert in the space.
IMO Mule is basically a container-type framework that rests on various open source products...
if you go to the 1.4.1 distribution's opt folder the listing is as such:

05/22/2007 08:23a 444,463 acegi-security-1.0.1.jar 05/22/2007 08:28a 443,432 antlr-2.7.6.jar 05/22/2007 08:26a 1,599,570 axis-1.4.jar 05/22/2007 08:26a 31,191 axis-jaxrpc-1.4.jar 05/22/2007 08:26a 18,979 axis-saaj-1.4.jar 05/22/2007 08:26a 126,771 axis-wsdl4j-1.5.1.jar 05/22/2007 08:21a 327,810 backport-util-concurrent-3.0.jar 05/22/2007 08:28a 490,136 c3p0-0.9.0.4.jar 05/22/2007 08:23a 193,391 carol-2.0.5.jar 05/22/2007 08:28a 324,238 cglib-nodep-2.1_3.jar 05/22/2007 08:26a 36,342 commons-attributes-api-2.1.jar 05/22/2007 08:21a 188,671 commons-beanutils-1.7.0.jar 05/22/2007 08:21a 30,117 commons-cli-1.0.jar 05/22/2007 08:23a 46,725 commons-codec-1.3.jar 05/22/2007 08:21a 571,259 commons-collections-3.2.jar 05/22/2007 08:28a 33,976 commons-dbutils-1.1.jar 05/22/2007 08:22a 139,966 commons-digester-1.7.jar 05/22/2007 08:21a 71,442 commons-discovery-0.2.jar 05/22/2007 08:23a 279,781 commons-httpclient-3.0.1.jar 05/22/2007 08:21a 83,613 commons-io-1.3.1.jar 05/22/2007 08:22a 285,104 commons-jxpath-1.2.jar 05/22/2007 08:17a 245,274 commons-lang-2.3.jar 05/22/2007 08:27a 180,792 commons-net-1.4.1.jar 05/22/2007 08:21a 62,086 commons-pool-1.3.jar 05/22/2007 08:25a 38,830 cryptix-jce-api-20050328.jar 05/22/2007 08:25a 296,386 cryptix-jce-provider-20050328.jar 05/22/2007 08:25a 30,258 cryptix-message-api-20050405.jar 05/22/2007 08:25a 276,885 cryptix-openpgp-provider-20050405.jar 05/22/2007 08:25a 16,652 cryptix-pki-api-20050405.jar 05/22/2007 08:22a 486,522 dom4j-1.4.jar 08/08/2007 01:41p 6,205 ds.txt 05/22/2007 08:22a 19,759 geronimo-ejb_2.1_spec-1.0.1.jar 05/22/2007 08:21a 36,396 geronimo-j2ee-connector_1.5_spec-1.0.1.jar 05/22/2007 08:22a 19,259 geronimo-j2ee-management_1.0_spec-1.0.1.jar 05/22/2007 08:25a 34,263 geronimo-jaxrpc_1.1_spec-1.0.1.jar 05/22/2007 08:23a 31,397 geronimo-jms_1.1_spec-1.0.1.jar 05/22/2007 08:21a 14,637 geronimo-jta_1.0.1B_spec-1.0.1.jar 05/22/2007 08:25a 8,097 geronimo-qname_1.1_spec-1.0.1.jar 05/22/2007 08:25a 24,611 geronimo-saaj_1.1_spec-1.0.1.jar 05/22/2007 08:22a 82,923 geronimo-servlet_2.4_spec-1.0.1.jar 05/22/2007 08:25a 2,356,373 groovy-all-1.0.jar 05/22/2007 08:25a 10,832 groovy-engine-1.0-jdk14.jar 05/22/2007 08:28a 2,208,240 hibernate-3.2.2.ga.jar 05/22/2007 08:23a 386,591 hivemind-1.1.1.jar 05/22/2007 08:23a 74,662 hivemind-lib-1.1.1.jar 05/22/2007 08:23a 72,741 howl-logger-0.1.11.jar 05/22/2007 08:23a 405,545 javassist-3.0.jar 05/23/2007 08:15a 226,915 jaxen-1.1.1.jar 05/22/2007 08:28a 603,060 jbpm-3.1.4.jar 05/22/2007 08:21a 11,670 jcl104-over-slf4j-1.3.1.jar 05/22/2007 08:11a 153,253 jdom-1.0.jar 05/22/2007 08:23a 124,316 jotm-2.0.10.jar 05/22/2007 08:23a 5,798 jotm_jrmp_stubs-2.0.10.jar 05/22/2007 08:25a 11,292 jruby-engine-1.0-jdk14.jar 05/22/2007 08:25a 10,250 js-engine-1.0-jdk14.jar 05/22/2007 08:21a 31,906 jug-2.0.0-asl.jar 05/22/2007 08:20a 120,640 junit-3.8.2.jar 05/22/2007 08:25a 10,250 jython-engine-1.0-jdk14.jar 08/09/2007 08:33a 0 list.txt 05/22/2007 08:21a 367,444 log4j-1.2.14.jar 05/22/2007 08:21a 56,164 mockobjects-core-0.09.jar 05/22/2007 08:22a 148,213 mx4j-impl-2.1.1.jar 05/22/2007 08:22a 261,174 mx4j-jmx-2.1.1.jar 05/22/2007 08:22a 167,410 mx4j-remote-2.1.1.jar 05/22/2007 08:22a 485,831 mx4j-tools-2.1.1.jar 05/22/2007 08:25a 149,445 nanocontainer-1.0.jar 05/22/2007 08:24a 167,958 ognl-2.6.9.jar 05/22/2007 08:23a 682,351 org.mortbay.jetty-5.1.12.jar 05/22/2007 08:19a 65,425 oro-2.0.7.jar 05/22/2007 08:25a 112,635 picocontainer-1.2.jar 05/22/2007 08:30a 405,607 quartz-all-1.5.2.jar 05/22/2007 08:25a 251,039 retrotranslator-runtime-1.2.1.jar 05/22/2007 08:25a 14,921 script-api-1.0-jdk14.jar 05/22/2007 08:21a 12,231 slf4j-api-1.3.1.jar 05/22/2007 08:21a 6,869 slf4j-log4j12-1.3.1.jar 05/22/2007 08:30a 188,221 smack-2.2.1.jar 05/22/2007 08:23a 2,694,134 spring-2.0.5.jar 05/22/2007 08:28a 31,020 spring-modules-jbpm31-nodeps-0.8a.jar 05/22/2007 08:22a 26,514 stax-api-1.0.1.jar 05/22/2007 08:26a 113,780 stax-utils-20040917.jar 05/22/2007 08:22a 83,820 wrapper-3.2.3.jar 05/22/2007 08:26a 148,522 wsdl4j-1.6.1.jar 05/22/2007 08:22a 505,825 wstx-asl-3.2.1.jar 05/22/2007 08:28a 86,956 xapool-1.4.jar 05/22/2007 08:21a 1,212,965 xercesImpl-2.8.1.jar 05/22/2007 08:26a 131,384 xfire-aegis-1.2.6.jar 05/22/2007 08:26a 28,705 xfire-annotations-1.2.6.jar 05/22/2007 08:26a 423,888 xfire-core-1.2.6.jar 05/22/2007 08:26a 25,055 xfire-java5-1.2.6.jar 05/22/2007 08:26a 8,074 xfire-jsr181-api-1.0-M1.jar 05/22/2007 08:21a 195,119 xml-apis-1.3.03.jar 05/22/2007 08:26a 127,961 XmlSchema-1.1.jar 05/22/2007 08:21a 24,677 xpp3_min-1.1.3.4.O.jar 05/22/2007 08:22a 349,667 xstream-1.2.1.jar 94 File(s) 24,263,547 bytes


94 files make up the optional open source distribution shipped with Mule.

Writing a web-service is as simple as creating a POJO & modifying the configuration file with the right parameters.

The Human-AI Partnership: Why Mastering Touch Typing is Your Next Generative AI Superpower

Generative AI requires humans to establish thought partnership rather than allow AI to take over critical thinking skills. I believe that ty...