Wednesday, September 30, 2009

Wave extensions preview is now available

Check out some of the extensions that were developed during Google Wave developer preview period:

http://wave.google.com/help/wave/extensions.html

Tuesday, September 29, 2009

Guidelines for Website content and design


  • Provide useful content and meaningful information for users. Write clear and cohesive pages that appeal to a specific topic of interest. 
  • Engage users in your pages, i.e. create meet-up, start blogging, connect to social networking, post how-to-dos, write professional articles, etc. You can also provide incentives that encourages users to participate in your site
  • Create a list of keywords for your pages, and be sure to include them in your page. This will help search engines identify your site when users search for similar keywords. 
  • Create a labels or tags list for your pages in order to help users quickly find information on your site. 
  • Include useful links in your site to your own pages or external page. 
  • Use text instead of images to describe your topic. While an image is worth thousand words, using images alone as site content does not provide user with helpful information. 
Create a site map for your website to help Google reach any dynamic content of your site that is not easily detected or is relatively new.

When your site is ready for the public, be sure to submit your site to:

Monday, September 28, 2009

Sunday, September 27, 2009

GWT: how to make your Composite widget clickable

by implementing HasClickHandlers

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;

public class IconWithText extends Composite implements StyleConstants, HasClickHandlers
{
HorizontalPanel widget;

public IconWithText(String iconStyleName, String text)
{
widget = new HorizontalPanel();
widget.setStyleName(STYLE_WIDGET);
HTML icon = new HTML("");
icon.setStyleName(iconStyleName);
widget.add(icon);

Label label = new Label(text);
label.setStyleName("label_for_icon");
widget.add(label);
initWidget(widget);
}

public HandlerRegistration addClickHandler(ClickHandler handler)
{
return addDomHandler(handler, ClickEvent.getType());
}

}

CSS sprites

CSS sprites are a great way to SPEED UP your application, and simplify the design changes. You save in two ways:

1) amount of HTTP calls, each call has a relatively large overhead compared to small icon file it fetches
2) putting many small files into single saves a lot of "weight" as well

Take example of these icons, each about 37 kb...


When combined into a single file they weight ONLY 49 kb, that is from about total of 250 kb, including all other icons I have put into it.


You want to put your files into a narrow image to make it convenient for yourself, you will use your favorite graphic tool (Pixelmator, Photoshop) to measure where the icon starts. I made all my icons 30 pixel tall.

Here I am interested in Facebook (heart icon) and I see that it starts at about 1264 pixels (X coordinate), since Y is ALWAYS at 0 pixels, and width and height are 30 pixel, that is all I need...


Finally, I write a simple to understand CSS style:

.icon_favorite {

background: url("images/icons001.png") no-repeat;

background-position: -928px 0px;

width: 30px;

height: 30px;

cursor: pointer;

}


.icon_facebook {

background: url("images/icons001.png") no-repeat;

background-position: -1264px 0px;

width: 30px;

height: 30px;

cursor: pointer;

}


.icon_edit {

background: url("images/icons001.png") no-repeat;

background-position: -1299px 0px;

width: 30px;

height: 30px;

cursor: pointer;

}


Then GWT code to use that style, notice I use HTML, not Image for that icon.


HTML submitToFacebook = new HTML("");

submitToFacebook.setStyleName("icon_facebook");

submitToFacebook.setTitle("Click to post this recipe on Facebook");

...

HTML edit = new HTML("");

edit.setStyleName("edit_facebook");

edit.setTitle("Click to edit this recipe");

...


And that is it...



Updated (after receiving some feedback):

I still like the CSS sprites solution because it gives a full control to the graphic (HTML/CSS) designer, but GWT developers should definitely take a look at ImageBundle.


Saturday, September 26, 2009

Microsoft Tells Users Not to Install Google Chrome Frame | Search Engine Optimization & Internet Marketing (SEO & SEM) Blog

My advise to my customers, friends and family is... please DO install
Google Chrome!


http://www.deondesigns.ca/blog/microsoft-tells-users-not-to-install-google-chrome-frame/

How to separate UI from code in GWT

1. Create a general structure in HTML with all DIVs that represent major widgets


<script type="text/javascript" language="javascript" src="myapp/myapp.nocache.js"></script>
</head>
<body>

<div id="header">
<h1>Welcome to My App</h1>
<div id="facebook_login"></div>
</div>
<div id="tool_tip"></div>

<table id="main_content">
<tr>
<td id="left_column">
<div id="list_of_products"></div>
</td>
...

2. Style the widgets in CSS

#header h1 {
background-color: yellow;
border-style: dotted;
font-size: xx-large;
}

3. Build the widgets in Java. Note: widgets are composites of various HTML elements and can have their own CSS styling.

RootPanel.get("facebook_login").clear();
RootPanel.get("facebook_login").add(new FbLogin(session));

3 generations of Apple power supply

It is interesting how they get smaller.

Friday, September 25, 2009

Thursday, September 24, 2009

MySQL Database backup (mysqldump) from command line

As the database grows in size the convenient GUI tools became too slow, at some point it is easier to log in to the database server and do it from the command line...

mysqldump --user MY_USER_NAME -p DB_NAME> /var/www/UNIQUE_NAME_AND_DATE.sql
Enter password: MY_PASSWORD

#compress, you can also use gzip
tar cvzf UNIQUE_NAME_AND_DATE.sql.tar UNIQUE_NAME_AND_DATE.sql

# delete sql
rm /var/www/UNIQUE_NAME_AND_DATE.sql

#download:
http://www.DOMAIN_NAME.com/UNIQUE_NAME_AND_DATE.sql.tar

# after transfer delete
rm /var/www/UNIQUE_NAME_AND_DATE.sql.tar

Tuesday, September 22, 2009

Sunday, September 20, 2009

Eclipse 3.5 (Galileo) and GWT, M2, SVN plugins

I gave another try to Eclipse 3.5 (Galileo) for Mac Cocoa, in the previous attempt I discovered the plugins were not working, you can read about it via the link on the bottom of this page.

There are 3 plugins that I use:

1) Google GWT and AppEngine:
http://dl.google.com/eclipse/plugin/3.5

2) SVN repository plugin:
http://subclipse.tigris.org/update_1.6.x

3) Maven Integration for Eclipse
http://m2eclipse.sonatype.org/

The installation went smoothly, all within 10 minutes.


Previous attempt to use Eclipse Galileo:

Saturday, September 19, 2009

Upgrade to Snow Leopard Mac OS X 10.6

The upgrade went OK, took about 1 hour (actually I fell asleep and left it to install itself).

Installation cleared about 12 Gb of space on my hard drive, which is a good thing for me.

After the installation I had to do the following:

- install new GlobeTrotter Connect for my AT&T card, thankfully I have WI-FI at home. See instructions in the earlier post.
- restore Java 1.5.0 from my Time Machine to get GWT working again. See instructions in the earlier post.
- Growl for Mail.app

You must use a Java 1.5 runtime to use GWT Hosted Mode on Mac OS X.

After the upgrade to Snow Leopard Mac OS X 10.6 I got the following error in GWT Eclipse console:

You must use a Java 1.5 runtime to use GWT Hosted Mode on Mac OS X.

I FIXED this issue by restoring Java 1.5 from my Time Machine in following steps:

1) Verify that Java 1.5.0 is missing from Snow Leopard
1.5.0 -> CurrentJDK
CurrentJDK -> 1.6

uki@Uki:/System/Library/Frameworks/JavaVM.framework/Versions $ ls -alt
total 48
drwxr-xr-x 11 root wheel 374 Sep 19 00:18 .
drwxr-xr-x 11 root wheel 374 Sep 19 00:18 ..
drwxr-xr-x 8 root wheel 272 Sep 19 00:17 A
lrwxr-xr-x 1 root wheel 1 Sep 19 00:17 Current -> A
lrwxr-xr-x 1 root wheel 5 Sep 19 00:17 1.6 -> 1.6.0
drwxr-xr-x 7 root wheel 238 Sep 19 00:17 1.6.0
lrwxr-xr-x 1 root wheel 3 Sep 19 00:17 CurrentJDK -> 1.6
lrwxr-xr-x 1 root wheel 5 Sep 19 00:17 1.3 -> 1.3.1
lrwxr-xr-x 1 root wheel 10 Sep 19 00:17 1.5 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Sep 19 00:17 1.5.0 -> CurrentJDK
drwxr-xr-x 3 root wheel 102 Jul 20 18:35 1.3.1
uki@Uki:/System/Library/Frameworks/JavaVM.framework/Versions $

2) Restore Java 1.5.0 from your Time Machine (if you have no backup, shame on you!)


3) Create a symbolic link (sudo ln -s 1.5.0/ CurrentJDK)


uki@Uki:/System/Library/Frameworks/JavaVM.framework/Versions $ sudo ln -s 1.5.0/ CurrentJDK

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
uki@Uki:/System/Library/Frameworks/JavaVM.framework/Versions $ ls -alt
total 40
drwxr-xr-x 11 root wheel 374 Sep 19 06:38 .
lrwxr-xr-x 1 root wheel 6 Sep 19 06:38 CurrentJDK -> 1.5.0/
drwxr-xr-x 11 root wheel 374 Sep 19 00:18 ..
drwxr-xr-x 8 root wheel 272 Sep 19 00:17 A
lrwxr-xr-x 1 root wheel 1 Sep 19 00:17 Current -> A
lrwxr-xr-x 1 root wheel 5 Sep 19 00:17 1.6 -> 1.6.0
drwxr-xr-x 7 root wheel 238 Sep 19 00:17 1.6.0
lrwxr-xr-x 1 root wheel 5 Sep 19 00:17 1.3 -> 1.3.1
lrwxr-xr-x 1 root wheel 10 Sep 19 00:17 1.5 -> CurrentJDK
drwxr-xr-x 3 root wheel 102 Jul 20 18:35 1.3.1
drwxr-xr-x 8 root wheel 272 May 7 2008 1.5.0
uki@Uki:/System/Library/Frameworks/JavaVM.framework/Versions $

4) Verify that you have the right set up

uki@Uki:/System/Library/Frameworks/JavaVM.framework/Versions $ java -version
java version "1.5.0_20"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-b02-315)
Java HotSpot(TM) Client VM (build 1.5.0_20-141, mixed mode, sharing)
uki@Uki:/System/Library/Frameworks/JavaVM.framework/Versions $

The GWT will work now, I will switch to Java 1.6 AFTER GWT release next update.

"Card not found" GlobeTrotter Connect in Snow Leopard OS X 10.6


I was able to get it work in following steps:

1) go to the driver download page:

2) Type in the SNR number on the back of your modem (EN4883****)

3) It will take you to similar page to:

4) Download the Snow Leopard 10.6 specific files:
Option 7.2 Driver v2.15.0 for 10.4.dmg
150_Caballus_1.3d0-349.33724_43585.zip

I think it was the second one (GlobeTrotter Connect 1.3.0) that after the installation got my card to work.

5) Type in "isp.cingular" in the APN text field