Skip to main content

Posts

Showing posts from 2008

Maintaining session when using DWR

DWR (Direct Web Remoting) provides an amazingly convenient approach to AJAX and the best thing is that it is so easy to implement.

When I was using DWR, I got a little confused about maintaining session, since most of the examples available used POJO/bean to implement java code which was then sent back to javascript.

In my application, an arraylist (formList) was maintained in session. I had to use DWR to show the details about this arraylist on the JSP.

In the java class being used by DWR, I needed to pass the session from calling JSP. DWR gives this in a surprisingly easy way!

JSP snippet:
<button onclick="getProperties(id);">Click! </button>

In the javascript:

function getProperties(id) {
DwrUtility.getDetails(paneId, function(data) {
dwr.util.setValues(data);
}); }

In the Java class:

public String getDetails(String menuId, HttpSession session){
int paneId=Integer.parseInt(menuId);
ArrayList formList=(ArrayList)session.getAttribute("FormsList");
String paneD…

Snipping Tool in Vista

I came across this very nifty utility in Windows Vista today (darn, I own this system since past 1 year!) called 'Snipping Tool' which very nearly renders Print Screen key useless!

What do you do when you have to take a snapshot of any thing on your screen? Do 'Print Screen' and paste the image in the file (like Word or Powerpoint) or in Paint/Photoshop to save the image after doing some editing (mostly cropping) or adding some text.

When you run Snipping Tool, you are asked to select the area on screen whose snapshot you want to take. This takes care of your cropping needs and as soon as you make selection, you can do the basic operations like adding text or highlighting on the saved selection. You can now save/email the image. Done!

It's so convenient, I can't believe I didn't use it till now.This snapshot was taken by Print Screen. The Snipping Tool was used to select the area enclosed by red border from HP website.

Google makes Microsoft look God! Thanks to Chrome.

"The New York Times reports that Microsoft's new Internet browser includes a search box in the upper-right corner that is typically set up to send users to Microsoft's MSN search service. Google contends that this puts Microsoft in a position to unfairly grab Web traffic and advertising dollars from its competitors."
This was what Google was shouting from rooftops when IE7 was launched. And they conveniently made the world forget that Apple's Safari and Mozilla Firefox always had Google as their default search engine. But it seems that someone is celebrating 'Make Microsoft Look God Day' and to commemorate this, they launched a browser!
Unlike IE, FF or Safari you don't have a separate browser in-built search box in Chrome. To search for anything you simply need to type search term in address bar and press enter. This may sound very cool but you can do this in any of above mentioned browsers too! For IE by default this is MSN/Live Search and for FF it i…

Amazing Live.com glitch!

Now how do these guys manage to these kinds of things. I am genuinely surprised.

I am one of the (few?) fans of Microsoft's Live.com. I find much better than Google Reader and though I would like others to add my blogs' feeds to Reader, I manage my subscriptions through Live.com.
But today what I saw was just unbelievably hilarious! Just look at this one. Have you ever seen a site's name getting disappeared from its banner?

Well here is the magic for you! Not only the name, even the menu options get disappeared.


This is Microsoft, and anything is possible!

Funny typo on Yahoo! India

This must be the silliest typo. But it was outright funny.

Saw this error on Yahoo India on 25th August'08.

Why should you edit your photos?

In my initial phase of digital photography, I was one of those who believe that editing an image is cheating the viewer. I took pride in my untouched photos and thought it was upto me to take a good shot each time I clicked the button and editing should not substitute my abilities as a photographer.

To some extent, I was correct. Technology should not, actually it can not, substitute my abilities as a photographer, however it can take my photos to a higher level. And if you thought touching your photos is 'cheating', consider having an orchestra at your command but you insist on using just the synthesizer! A digital photo is like creating music, a note here, a symphony there and you come up with a completely new tune. Similarly a little deeper tint, a little brightness and your photo can become a piece of art.

Composition is a very important aspect of taking a photo, one which can affect the perspective of your photo like no other. Sometimes it is not in your control to place yo…

How to upload a file using JSP/Servlets

This short article describes how to upload a file using Apache Jakarta commons upload library.

1) Required downloads: Download the library from here. Keep the following JAR files in classpath: commons-fileupload-1.2.1.jar and commons-io-1.4.jar.

2) JSP/HTML code: To upload a file you need to set the encoding type in your form to multipart/form-data.




Give your users a file-select box to select the file :
input type="file" name="myFile" width="100"
You will most probably have other form fields like textbox, radio buttons etc. We have one text field with name 'user' in this form:
input maxlength="255" size="40" name="user"

3) Form data handling: Now you have sent the file and other form data, now we need to make use of this form data. Most probably you need to save the file at some location on the server.
One problem that many developers face is getting a null when they try to extract the value in form fields using request.getP…

Yuil is no more!

For a moment, I thought this is the most enjoyable week of my life as far as search engines are concerned! This headline 'Yahoo Exec Makes Yuil: Looks Like Cuil, With Better Results' on WashingtonPost.com (courtesy TechCrunch) was enough to make me smile as I was thinking of writing on how easily Cuil has generated so much noise.

Unfortunately 'Yuil' built by a Yahoo! engineer using Yahoo's recently release BOSS API has been now taken off the web. For those who don't know, BOSS stands for 'Build Your Own Search Service'. Yahoo recently opened its entire search technology to developers as now they can access almost all the services and functionalities given by Yahoo search.

I could not use Yuil, but comments on the page and even TechCrunch report said Yuil performed better than Cuil. I am not at all surprised. Cuil is so pathetically bad at the moment that any thing will perform better and since Yuil was based on Yahoo Search, you can great results (second…

Firefox Download Day 2008: Indian contribution

Above is the snapshot of downloads across the world at 1.53 PM IST on June 18 2008. According to details on this page: US had 2,095, 322 downloads and India downloaded just 42,770 times.

I downloaded it in my office, which has actually got a US IP address and I guess many people in India downloaded it in their offices and that counted towards US's downloads. Internet penetration in India is still very low and mostly people access net in their offices only.

I am not saying that all office downloads swelled US numbers or the cause of a huge US number is due to us only, but this could be a significant number.

I don't know if FF3 has created a record or not, but the fact is that record or no-record, FF3 is a better browser in all aspects!

Google's new browser icon!

Suddenly I saw that Google's now familiar 'G' icon has been replaced by 'g'. And it looks better actually!
I don't want to read more into it but I am very sure there will be much talk about it in blogosphere.

Site search within Google Search Results page

Just saw another feature on Google search results page. I searched for LonelyPlanet and the first result which usually gives bunch of options related to a result, now shows another option: search that site from results page directly.

I repeated the experiment with National Geographic and Discovery Channel and got the search box, but it didn't appear for BBC, Rediff, Hindustan Times, TCS, Animal Planet and Al Jazeera.

Is it only for travel and wildlife sites?

Yahoo! shows new way of showing search results. Thumbs Up!

Yahoo! has launched a new interface for showing search results. They call it Glue Page and it is displayed in a tabbed page along side normal 'Classic Search' page.
Glue Page gives a 'portal' look to the search results with images, videos, news, wikipedia entry, Yahoo! Answers and ofcourse search results.


I like it, if you are looking for information on any current issue, you get everything well arranged. It's like 'Special' or 'In-Depth' feature given by news sites and much better than many of them.

And if you want to give it a try go to Yahoo! India search.

Gtalk 'Labs Edition' launched

After toying a lot with IM features in GMail and Google Desktop Gtalk Gadget, Google finally released new version of Gtalk, named 'Gtalk Labs Edition'. This is second release of popular IM client which has given Yahoo! Messenger, AIM and MSN Messenger a run for their money. The success was due to extremely light weight size, a clean and easy interface and simplicity in use.

All of these features seem to be on their way out, if Labs edition is any indicator. I remember the earliest version of Gtalk was 900 kb. The one I have got installed is 3.5 MB. Labs edition is more than 8 MB. However install is still very fast and simple as compared to any other IM client. The interface seems a little crowded but still is passable!

Most of the features of Gtalk Desktop gadget have been incorporated in this version. So you have group chat, tabbed conversations and what I wanted most: good smilies :) There is tighter integration with Orkut and Calendar and you can even
snooze Calendar notificat…

Yahoo on Reliance India Mobile

It is no secret that Yahoo! is a cherished brand in India and though Google may be leading in search, Yahoo still is a very significant player in instant messaging, email and web entertainment segments.
Yahoo India has signed a pact with India's leading mobile services provider Reliance according to which Reliance India Mobile users will be able to use Yahoo! Messenger on this network. Reliance has second largest customer base in India after Airtel which has collaborated with Google for search services. 3rd largest player Idea had also teamed up with Yahoo last year.
Now after Yahoo's collaboration with Pune based CRL for research on cloud computing and aggressive hiring in India, is the company looking for India as it's new growth bed?

Microsoft and The Bombay Club

Gopi thinks I am a Microsoft basher. Vaibhav thinks I am a fan of theirs. The reason I am giving both extremes reasons to be happy is that I am none!

Yes I use Windows Vista on my laptop and my resolve of installing Solaris Desktop dwindled since I speeded up booting by turning User Account Control off (from about 5 minutes to about 5 seconds!) and I wrote reviews of several Microsoft offerrings but am I a fan of Microsoft?

I have written about how irritating and stupid Microsoft products can be at times and how Third Party software works better on their OS as compared to their own and often I have complained about their software not being supported on other OSs but does that prove me a Microsoft basher?

I think I am somewhere in the middle ground. I use Microsoft's products and appreciate them for all their goodness. They are popular and by hook or by crook MS has garnered maximum users. These software may not be best available but they do work pretty well for most of the users. But…

Gmail is having glitches?

Since beginning of this week, I have started noticing significant delays in Gmail in simple tasks like attaching files and sending messages. And worse still I got a popup saying 'Oops! There was some error in sending mail (#102)'. I tried again and it worked.

Any updates coming in site?


Technorati Tags:

Firefox Beta 4 rolled back to Firefox 2.0!

What is this happening with Firefox 3 Beta 4? Suddenly my installation seems to be vanished! Vanished. I was doing something when it hung and I closed it. And when I restarted the browser I am back on 2.0.0.12.

Doesn't make sense right?

Well I have downloaded the Firefox installer and will install again, it doesn't ask for system restart anyways!

PS: It is available in 40 languages including 2 Indian regional languages Gujrati and Punjabi. I am surprised that they have ignored Hindi, the most widely spoken Indian language. However I am not trying to be language chauvinistic here, just a genuine surprise.

More Bad News for Yahoo in Mobile Markets

Good news is hard to come by for Yahoo these days. South is the direction for company's search market share, advertising revenue and stock prices. As its future remains shrouded in uncertainty, a number of good engineers have left Yahoo for Google.

No soap Opera for Yahoo!
The recent spate of bad news is from mobile market where Opera has recently replaced Yahoo! One search with Google search. Yahoo! One search had been the default search engine in Opera Mini browser for handsets. It used to show the search results from web, mobile web and image search in the first search result page and users could choose their required search category after that. Google too gives you option of Mobile or Classic version of search page.


Nokia-Google Alliance
Nokia mobile phones come preloaded with Yahoo! Go, a software suite for mobile devices. But now Nokia too has announced that they are collaborating with Google. As a consolation T-Mobile has signed up Yahoo for providing search to their customers …

Changing Eclipse Workspace Directory

Recently I moved my entire Eclipse installation directory but the workspace was still getting created in the older location only. And worst there was no option to select the Workspace directory in the Window->Options->Workspace menu.

To change the workspace location in Eclipse do this. Goto ECLIPSE_HOME\configuration\.settings directory, edit the org.eclipse.ui.ide.prefs file and change the RECENT_WORKSPACES value to the desired location.

If you want that Eclipse prompts you to select workspace when you start it, change the SHOW_WORKSPACE_SELECTION_DIALOG value to true.

And you are done!

How to add a new TLD file to your project in JDeveloper?

You want to use the new tag library you found on internet, in your project. You copy the JAR/TLD file in your project's WEB-INF/lib directory and make the necessary changes in your code, rebuild your code... and get error during build process!

If your error is: " is is not a registered TLD Namespace", chances are you forgot to register the TLD with JDeveloper. Here is how to do it.

Select your project root. Right click->Project Properties. By default Libraries will be selected, if not select it. See if your TLD/JAR is present in the list of libraries. If not click on 'Add Library' and select your libraries. These should now appear in the libraries list. Also make sure to select JSF also.

Refresh your project. The errors should be gone now. If you are getting any errors it is possible that you are missing any library required for your tag library to function properly. Check the documentation of your taglib to pinpoint and resolve such issues.

Your feedback is welco…

Excellent Example of Inner Class

Many a times, I have asked myself, what is the requirement of Inner Classes, and on top of that Anonymous Inner Classes. Here is one good example. The following is an excerpt from "Android SDK's" documentation:

Listeners can be one of the more confusing aspects of UI implementation, but what we are trying to achieve in this case is simple. We simply want an onClick() method to be called when the user presses the confirm button, and we can use that to do some work and return the values of the edited note to the Intent caller. We do this using something called an anonymous inner class. This is a bit confusing to look at unless you have seen them before, but all you really need to take away from this is that you can refer to this code in the future to see how to create a listener and attach it to a button. (Listeners are a common idiom in Java development, particularly for user interfaces.)

confirmButton.setOnClickListener(new View.OnClickListener() {
public void o…

Switching between PL/SQL, Java and Shell Scripts

Calling a SQL script from another SQL script:
Suppose we have two script files, main.sql and sub.sql. To call sub.sql from main.sql write in main.sql:

@sub.sql

The SQL code in sub.sql will be run as if it is written in main.sql

Calling a java method from a shell script:
We can only call main method of a class, by running that class with a java command line execution.

#!/bin/ksh
# Here I have already compiled Test.java
echo "Running Test"
java Test

Calling a shell script from a Java method:
You can run it using exec method of Runtime Object. Sample code:

import java.util.*;
import java.io.*;

class Execx{
public static void main(String args[])
{
Runtime r=Runtime.getRuntime();
try{
r.exec("javaex.sh");
}catch(IOException e){
e.printStackTrace();
}
}
}

But check this link also: http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

Calling a stored procedure from Java:

The following code puts the SQL statement into a string and assigns it to the var…

Using SQL*Loader Utility through E-Business Suite Front End

This brief article explains how to create concurrent programs, in E-Business Suite 11i of Oracle Applications, to use SQL*Loader utility for loading data in backend database tables. I assume that you already have knowledge of using SQL*Loader through command prompt.

As you would be aware of the fact, that the concurrent programs or requests are specific for an application (or responsibility) so you will have to decide the application in which you want to keep your request in, like GL (General Ledger) or AP (Account Payables) or any other application. This is important because you will be able to see your request only when you are logged in this particular application (or responsibility).

Place your Control File in the $APPL_TOP/11.5.0/bin of your application. (e.g. I am keeping my control file in AP and hence the corresponding directory is /u02/apps/visappl/ap/11.5.0/bin. It may be different for your system). This is all you have to do at the backend.

Log in the E-Business Suite in ‘Syst…

Using Windows Live Writer

Microsoft has created an offline blogging tool: Windows Live Writer. Connect to internet (even to install it!), register your blog account, it will download the template settings of your blog and done! You can compose your post, save it as draft if you don't want to publish it right away and publish it when you want/have connectivity. Simple!

Yesterday in IndiBlogger meet they gave demo of this software and here I am; trying my hands on it. And I believe at least 50 of the 70 odd bloggers shall try it out. Cost involved: 70 odd pizzas! You can add your blogs from Blogger.com, Wordpress.com, LiveJournal.com, LiveSpaces.com (obviously!) and some others. I could not find any documentation about what all it supports.
They say you can insert maps. You surely can, but only US maps! So I will insert one of Texas where the all important 4th March primaries have to be held! It said 'Update Weblog Style'. I tried doing that and nothing has happened so I guess that works with Windows L…

Sun Tech Days 2008 - Day 1 Disappoints!

This was 10th anniversary of Sun Tech Days and expectations were running understandably very high. Having attended the event last year, I was expecting higher standards both in content as well as event organization.

HICC's 5000 capacity hall is huge and I still remember the last year's keynote which had entire hall packed and still people were standing. But this year the keynote took place in only Hall 3 and 4 combined (entire hall is composed of 4 halls), which is nearly 60% of the entire hall. Was the attendance this low this year?

Address by Sun India CTO Divyeshwar Shah was ok, but it was Rich Green, EVP Sun Microsystems, whom everyone was waiting for. And was the person on stage really Rich Green I have heard about? This person seemed to be some marketing guy from Sun Microsystems who showed marketing slides about almost ALL Sun products! What a yawn!

Technology demos were tiresome, stale and unimpressive! Snow and rain effects on Solaris desktop and creating an application …