• Enter Slide 1 Title Here

    This is slide 1 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words.

  • Enter Slide 2 Title Here

    This is slide 2 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words.

  • Enter Slide 3 Title Here

    This is slide 3 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words.

Wednesday, August 29, 2007

Add css styles for gwt widgets

Adding Cascading styles (CSS) to Google Web Toolkit (GWT) widgets is much simpler and involves only two steps.
  1. Style name
    • set style name
      for a widget using the $widgetInstance$.setStyleName() method or
    • stick with the default
      style name of the widget (use for setting global values)
      default style name examples:
      • for buttons: .gwt-Button
      • for Check Boxs: .gwt-CheckBox

  2. CSS style rule
    • Add CSS style rules to a .css file and import that into the html page or

    • write those inside the html page itself. (not recommended)

Let us provide you with an example which would create buttons shown below.


Coding in your java class:
Button cancelButton = new Button("Cancel");
Button loginButton = new Button("Login");
loginButton.setStyleName("buttons");

CSS rules:
.gwt-button {
background: #EEEEFF;
color: #0000CC;
font-size: 12px;
}

.buttons {
background: #CCCCCC;
color: #333333;
font-size: 12px;
}

GWT releases 1.4 and is no longer beta

Google Web Toolkit (GWT) has released a new version, 1.4. With over 1 million downloads GWT is moving forward well; and it's no longer beta. The user group is really active and well established; so if you haven't tried GWT yet, it's time to have a look.

GWT LogoRead more about GWT and news release at GWT blog.

For any issues visit the GWT user group here.

Monday, August 27, 2007

Would Google Adsense let a website earn $100,000 per month?

With Google Adsense earning $100,000 per month!!! Feels like day dreaming? Are there web sites earning around 100k dollars per month; shockingly and interestingly the answer is yes. There are some few sites that earn this much; even more than that.

Believe me

A social site named "PlentryOfFish" owned by "Markus" has earned more than $900k in two months while "ShoeMoney" blog earned more than $100k in one month. See the proofs here and here. So the good news is we should try now and reach there since it is possible.

Analysis of sites earning with Adsense

  • Monthly visitors
    Number of visitors is a huge factor considering the Adsense revenue as visitors help revenue increase; so having a healthy visitors base is a must.

  • Adsense ads placement
    Many sites have been using text/image advertisements rather than going for text only ads or image only ads to change what user sees at first. Adsense text only ads are placed before/inside/after articles; but 250x250 / 300x250 ad formats are mainly used inside articles which would attract reads attention easily and quickly. Also one more point to note is the placement of 160x600 wide Skyscraper advertisements on to left or right bar running parallel to article content. Google Adsense Ad units are not much seen. One important point to note is the color matching of the ads with site content.

How can you reach there

Since every website or blog is unique, suitable adsense ad type, colors, sizes and places differ from each other; also whether to choose image only/text only or text and image also differ. Must choose between rounded corners(LINK) or not; depending on used web template. Best approach is to experiment many combinations of these and decide the best matching format. Adsense channels become handy in testing ads; as each ad placement can be assigned a unique channel which ease the experimenting and lead to accurate decisions. As an example; one channel may be named "leftBar.468x60.Pal3.21092007"; as the name suggests all features of used format, analysis would be really easy. Between one to two months will be enough to judge one advertisement format.

While experimenting for best Adsense ad formats, one important point to note is " publishing valuable contents frequently is a must".

Tuesday, August 21, 2007

Adsense Ads between blogger posts

If you have switched your blog from older blogger to new blogger platform (which uses layouts) and looking for adding adsense advertisements in between posts; Blogger has created a new widget for this purpose. And they have made it such that any non-tech blogger even can use this. This widget lets you specify number of posts between an adsense advertisement. You can see the full guide here at Get inline.

If you haven't switched to new blogger yet, don't worry. You still can put adsense ads between your posts. You have to put the adsense code inside the tags that shows up the blog post. My home page has done like that. If you need any assistance on that, just drop me a mail or write below as a comment. I would be happy to help you.

Thursday, August 16, 2007

GWT not working on Internet explorer 7 (IE7) giving "Element not found" javascript error

GWT web application started to give "Element not found" javascript error message on Internet Explorer 7 (IE7)? This application worked fine on Internet Explorer 6 and Firefox 2. Now your best guess would be; GWT not working on IE 7 properly. Wasn't it?

But the scenario became confusing and unbelievable because your application worked fine on IE7 in some machines while not on some others. Have you faced this issue? Then the below solution is for you.

This issue can be fixed by a making a change on windows registry.

Steps to follow are;
1. Open up the Registry editor - type regedit on command prompt.

2. Look for the key shown below
HKEY_CLASSES_ROOT\TypeLib\{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}\1.1\0\win32

3. Click on the "Default" row and see the value there. If it's value is "C:\WINDOWS\system32\shdocvw.dll", then that is what causes the above mentioned issue. If you have installed Windows in a different drive; C:\ must be replaced with the that letter.

4. Replace that value with "C:\WINDOWS\system32\ieframe.dll".

5. Now restart IE7, and load your GWT application.

Monday, August 13, 2007

Set Cookies with GWT applications to expire after expected time period

Google Web Toolkit (GWT) supports HTTP cookies similar to other web technologies. GWT provides methods for setting cookies for specified time duration, for specific domains and paths. Below is a listing on how to set a basic cookie for a duration of one day.
Date now = new Date();
long nowLong = now.getTime();
nowLong = nowLong + (1000 * 60 * 60 * 24 * 7);//seven days
now.setTime(nowLong);

Cookies.setCookie("sampleCookieName", "sampleCookiValue", now);

When retrieving the cookies, you have to specify only the name of the cookie, nothing related to duration. If the cookie is found in the browser for this domain (not expired); value you set will be returned.
Cookies.getCookie("sampleCookieName");//only name

In setting cookies, you must consider on what you actually plans to get done using a cookie. There are two features you can achieve; remember duration (i)from the day it's created, (ii) from the last day this particular user viewed your site. If your site always set cookies when ever a user visits your site; then your cookies will expire only after the user does not revisit your site for the specified duration. But if you are providing a feature like "Saving the password for 2 weeks", then you probably should store the cookie only if the cookie does not exists. For that you must look for cookie before setting it again.
String sampleValue = Cookies.getCookie("sampleCookieName");
if(sampleValue == null){
//set cookie again after informing user on expiration.}