Friday, October 12, 2007

A drawing in Electro-magnetic motor patent

It was in the 1821s. Thanks Faraday, without your patent life would be too hard.

Tuesday, October 09, 2007

Google is gonna launch a new service for health care

Google health, a new product from Google. It's to target sickies searches . This is the information I was able to find.


Saturday, August 18, 2007

After a long wait, I've received my "Google Desktop Patch"

Today, I've just received the precious Google Desktop Patch. Hoho, after ~2 weeks of waiting.

Really it's a nice embroidered patch with a plastic back. You can stick it on your room's wall, put it at the front of your Computer Case, stick it on your T-Shirt so all friends ask "where did you get that?"

The patch

Shipped package, thik and heavy as
I thought its including money :D

How do I receive a Desktop Patch?
Simply, submit a good desktop gadget to google.

How to I develop a Desktop Gadget?
First, get a nice idea, get the Desktop SDK, check the attached samples, choose your preferred language JavaScript or vbscript ...

Wish you luck :)

Developers Guide
Submit Gadget form
Google Desktop SDK

Tuesday, August 14, 2007

Implementing an RSS reader using Java

RssParser rssReader = RssParserFactory.createDefault();

PrintStream printStream = System.out;
System.setOut( new PrintStream( new ByteArrayOutputStream() ) );
Rss rss = rssReader
.parse( new URL(
"" ) );
System.setOut( printStream );

Collection items = rss.getChannel().getItems();
if( items != null && !items.isEmpty() )
// Iterate over our main elements. Should have one for each article
for( Iterator i = items.iterator() ; i.hasNext() ; System.out.println() )
Item item = (Item);
System.out.println( "Title: " + item.getTitle() );
System.out.println( "Link: " + item.getLink() );
System.out.println( "Description: " + item.getDescription() );


// Iterate over categories if we are provided with any
Collection categories = rss.getChannel().getCategories();
if( categories != null && !categories.isEmpty() )
Category cat;
for( Iterator i = categories.iterator() ; i.hasNext() ; System.out
.println( "Category Domain: " + cat.getDomain() ) )
cat = (Category);
System.out.println( "Category: " + cat );


Get the full project

Monday, August 13, 2007

Saturday, July 28, 2007

Wikicodia - The code snippets encyclopedia

Wikicodia - WikiCodeEncyclopedia - is the first code snippets wiki for code-based programming languages, scripts, shells and consoles.

The idea of Wikicodia was inspired by Google Code Search and Wikipedia and based on MediaWiki.

  • Wiki based
  • Syntax highlighting
  • Snippets directory - for more organization
  • Snippets request sections


Thursday, July 26, 2007

Are you ready for the show, Gmail M-velope

The gmail team went crazy :), I was checking out the Google blog, I read about M-velope. They were discussing how the emailing became easier and fast that ever. I love GMail. They have some crazy thought abouts mail.

Are you ready to post your own thought about emailing.
Compose your video and post it to Google

Original Google blog post

Wednesday, July 25, 2007

YouTube mobile version

Oh, today as usual I got to YouTube home page, and I found this interesting news.

YouTube launches it's website for mobile access, enjoy watching and uploading whenever you're

The site uses 3gp encoding to stream videos. This is for viewing. They handle the uploads using MMS.

Do you think we'll have that change here in Egypt to join the YouTube mobile world?

Any way, What's the next?

Tuesday, July 17, 2007

Java Documentation - The new look

A project for JDK 6.0 documentation named Java Doc Web, really nice interface. More JavaScript interactivity. Support of collapse and expand sections in documentation.

Here's the link

Tuesday, July 03, 2007

The easiest way to earn money out of your website

Creating a website became as easy as watching TV, Thanks web2.0.
Mobile blogging turned into a way keeping in touch with your friends, social networking became a communication channel. Wikipedia, YouTube, Facebook, ... all of us at least visit those once a day. WYSIWYG is improved. Web is turning to be the world IT industry.

Online money investment now is easy, if you have a website, with useful content and good traffic you're one step away of making money online. Ads – the not traditional ones – became more intelligent and useful. With Google Ads you can earn up to 5,000$ monthly with the ability to be increased.

Let's start getting the Google Ad program idea. The program is separated into two:-
  • AdWords
  • AdSense

The AdWords is a Google service for those who have websites and need to put ads in the sponsored links list of Google search page, or even within other sites' pages enabled with Google Ads.
The AdSense program enables web site owners to place ads in their sites and then they're paid per number of hits and clicks.

In this post I'm talking about AdSense in order to get revenue out of. The post is in form of QAs. I hope you like it. Feel free to contact me for comments.

Deeply inside the word AdSense
One day I was walking with a friend, we talked about the AdSense; the word is very intelligent. When you read you'll feel the word telling you I'm an ad with a sense. Woow, did you get it? When you place ads inside a page it senses the page content and display ads relevant to. Which will almost be clicked with your site visitors.

Is these Ads random?
No, it senses, do you think Google cannot parse your page content and get the page tag keywords :). All ads displayed are relevant to page content.

How much will I be paid per click?
Google doesn't make a commission for the certain amount you'll be paid per click, but it's around 5 cent to 15$ depending of advertiser payment. All what you've to do is to trust Google, they sharing the revenue with you.

Is it text only?

No, There're many kinds of AdSense.
  • AdSense for Content.
    • Text ads: You can select to view ad units or ad links only
    • Image ads: Show image banners related to your page content (more attractive)
  • AdSense for Search
    • Google search box and you're paid per sponsored links click.
  • Referrals
    • Firefox with Google Toolbar
    • Apply for AdWords
    • Apply for AdSense
    • Others... (Picasa, Apps,... )

How will Google pay me?

Simply, while filling the registration form, Google will ask you where do you live and billing address and once your balance reaches - 100$ - the limit; Google will mail you a check.

How would I install AdSense?

Easily, Google AdSense wizard will help you to customizing your ads, then it'll provide a JavaScript code, copy-paste it into your web page and tell me what's your impression.
It would be something like that
<span style="font-size:78%;"><script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxxxxxx";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "44769C";
google_color_bg = "EAF3F9";
google_color_link = "000000";
google_color_text = "000000";
google_color_url = "44769C";
<script type="text/javascript" src="">

Don't ever never think of posting crap and stolen article in order to get more traffic, Google will get you and deactivate your AdSense account.

How to get more traffic

Post whenever you've something to say, post useful things so visitors would bookmark you and come again, share your site with friends, always choose keywords and a good title for you pages. Don't hesitate meta tags. Don't use text images, search engines index text only. Use HTML head tags to highlight sections (h1, h2...). Search engines always scan headings and make then keywords. Use groups and usenets to share your articles.

  • Post always useful things specially that ones you know well.
  • Even your website is an informatics one, don't hesitate AdSense.
  • Be special, make your content unique and professional.
  • Post an article under the topic "Making money ". :D
  • Always post articles your made.
  • Don't be depressed if you don't make money within 6 months. Many people revenue was <20$>


Working for Google - An interview with Larry Page and Sergy Brin

A company owned by two thirtieths

How to turn on your PC

Extremly funny video

Wednesday, June 20, 2007

ITL, Masha'a Allah

The Islamic Tools and Libraries (ITL) is a project to provide a plethora of useful Islamic tools and applications as well as a comprehensive feature-full Islam-centric library. The ITL project currently includes Hijri date, Muslim prayer times, and Qibla.

There is also Minbar, a Gnome GUI with tray icon, athan call and notifications at prayer times.

Tuesday, June 12, 2007

JUnit - The ever easier

Really how amazing and powerful is that framework. JUnit is in role one of the most well-known unit testing frameworks for Java.

It's the issue of testing component by component, integrate, test again and fix and so ... . Unit testing applies test driven development aspects. If you're familiar with Extreme programming you'll feel it the most suitable for you.

Let start with a simple example describing how to test a simple calculator using JUnit 3.8 and Eclipse IDE

1. Create a new Java Project, name it "JUnit Calculator Test"

2. Create a new class name it "SimpleCalculator" under package "calculator"

3. Write down those two sample functions
package calculator;

public class SimpleCalculator

public static int add( int a , int b )
return a + b;

public static int subtract( int a , int b )
return a - b;

4. Now we're about to test

5. Get to your project properties, right click your project and choose properties.

6. Now you should have something like that

7. Choose "Java Build Path" tab

8. Click "Add library" and Choose "JUnit" from the library list

9. By default you'll find "JUnit 3.8.1" selected leave and proceed till finish.

10. You should have a class path like that. Click OK and be ready to write down your first test case.

11. Right click you project select new -> "JUnit Test Case"

12. Name it SimpleCalculatorTestCase
13. Now write down this code into the source file
package calculator.test;
import calculator.SimpleCalculator;
import junit.framework.TestCase;

public class SimpleCalculatorTestCase extends TestCase
public void testAdd()
int added = SimpleCalculator.add( 10 , 12 );
assertEquals( 12 , added );

public void testSubtract()
int subtract = SimpleCalculator.subtract( 12 , 10 );
assertEquals( 2 , subtract );


14. Now we have a test case for both add and subtract methods of our simple calculator.
15. Let's run it. Choose run menu -> Run as -> JUnit Test
16. You should have result like that.

17. When your run a JUnit test case, JUnit automatically parses your test class and find all methods starting with "test" clause, so they are the points to check. So we have two methods testAdd and testSubtract.

18. As you can see testAdd failed, testSubtract succeed. This is because if you check the assertEquals parameters you'll find that the expected parameter is not the really the expected one. But I intended to put it that false to get the idea. The function assertEquals took two parameters.
  • The expected value of an expression
  • The expression to be evaluated
If the two are equals so it means the the test is passed.

I think you should now take your hands changing that 12 to 22 and check the results. Waiting for you comments.

Download the full eclipse project here


Saturday, June 02, 2007

JPanel with gradient background

Thanks Sun for your great Swing framework. You've to know that Swing is the most powerful GUI framework I've seen in my life. Well architecture and extraordinary think for being very usable. The well MVC model, the ease of creating custom GUI components all of this should reflect the power of Swing. Check my blog I'll soon write down tips and lessons for having nice GUI using swing.

Let's start

First you've to know some about Swing painting mechanism. Each Swing component - JComponent - has a paint method which has a role of calling three main method to draw the component right

  1. paintComponent(Graphics g) this function is responsible for drawing the status of the component. Think of the JButton's paintComponent, it's responsible for drawing the JButton in three ways: normal, mouse over, clicked. The button is aware of it's status so it could paint itself right.
  2. paintBorder(Graphics g) this is the one responsible for drawing the border of your component, in case it have a border.
  3. paintChildren(Graphics g) this one is called to draw children components of the current component. For example, a panel which has two buttons. This function would call the paint of each component attached to this component.
For you to implement your custom drawing. You've to override "paintComponent", you've not to touch "paint", "paintBorder" nor "paintChildren".

Read this if you've difficulties understanding

Secondly you've to know about Opacity. What is opacity? An opaque thing is difficult to see through - your room walls -. In Java each JComponent defines it's opacity. If it's opaque so you can't see through. The else is you can see through.

For example we've two panels. p1 and p2. p2 is a child of p1. p1's background is red, p2's background is green.

If the two panels are opaque you should see a green color; as p2 is opaque and you can't see p1 through it.

If p1 is opaque and p2 is not. You'll see a red color. whatever p2's background is you'll see a red color. As p2 is not opaque you can see through.

Read this if you didn't get it

Thirdly we're now to start coding.

Open your favorite IDE which is Eclipse for me.
And follow the next steps

1- Create a new Java project and name it "Gradient Panel"
2- Create a new package - to organize your work - and name it "gradient"
3- Create a new class name it "GradientPanel".
4- You should have something like :

5- Now open you editor and type in the following code

package gradient;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;

import javax.swing.JPanel;

* GradientPanel is a class with a gradient background, put your non-opaque objects over it and enjoy.
* @author Mohammad Abou-Basha
public class GradientPanel extends JPanel

private Color startColor;

private Color endColor;

public GradientPanel()
this( Color.GRAY , Color.WHITE );

public GradientPanel( Color startColor , Color endColor )
this.startColor = startColor;
this.endColor = endColor;

protected void paintComponent( Graphics g )
super.paintComponent( g );
int panelHeight = getHeight();
int panelWidth = getWidth();
GradientPaint gradientPaint = new GradientPaint( 0 , 0 , startColor , panelWidth , panelHeight , endColor );
if( g instanceof Graphics2D )
Graphics2D graphics2D = (Graphics2D)g;
graphics2D.setPaint( gradientPaint );
graphics2D.fillRect( 0 , 0 , panelWidth , panelHeight );

Now we've a gradient panel. We have to create a demo and try playing.

6- Create a new Frame, name it "GradientPanelDemo". For the ease you can use the visual editor.
7- Drag a new bean and select the GradientPanel. The code should be something like that

package gradient;

import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;

public class GradientPanelDemo extends JFrame

private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private GradientPanel gradientPanel = null;

* This is the default constructor
public GradientPanelDemo()

* This method initializes this
* @return void
private void initialize()
this.setSize( 300 , 200 );
this.setContentPane( getJContentPane() );
this.setTitle( "JFrame" );

* This method initializes jContentPane
* @return javax.swing.JPanel
private JPanel getJContentPane()
if( jContentPane == null )
jContentPane = new JPanel();
jContentPane.setLayout( new BorderLayout() );
jContentPane.add(getGradientPanel(), BorderLayout.CENTER);
return jContentPane;

* This method initializes gradientPanel
* @return gradient.GradientPanel
private GradientPanel getGradientPanel()
if( gradientPanel == null )
gradientPanel = new GradientPanel();
return gradientPanel;


8- You should see that in your visual editor

9-Now let add some buttons and text stuff and check the result

Here's the component hierarchy

Preview 2

Ooh, why is the last panel "jPanel" gray!!
Don't you remember? I told you about opacity. Simply make this panel not opaque and check the result
jPanel.setOpaque( false );

Preview after setting the panel opacity to false

Use this constructor to define your own colors
gradientPanel = new GradientPanel( Color.RED , Color.YELLOW );

This was the first tip having great Swing GUI.
Click here to get the full project.

Comments are welcomed, so feel free.


Friday, June 01, 2007

Share you calendar events from your mobile

Google has just announced the new web interface for Google Calendar, now enjoy the synchronization between your mobile phone and PC. Point to and start.

Thursday, May 31, 2007

Oh my God, Google Street View

Street view

Google has just announced a new service integrated with Google Maps. It's Street View. With it you can go to San Francisco and and move in the streets watch buildings cars. Ooohhhhh. You've to check it.


How about Maplets?? It's a gadget-like for Google desktop. You can write your own APIs and refer to some places. For example you can make a mapplet referring to places you've captured some videos in. Check the last link, you'll create your hello world mapplet ;)

Wednesday, May 23, 2007

The new with Rich Internet Applications

Surfing as usual, suddenly my Manager asks any one have idea about Silverlight?. I wondered what is that? Is it really a Microsoft Stuff. Oh it can do as flash :O. How and when they do it.

As usual I did
I read about the technology and I was astonished when I read this quote "Silverlight aims to compete with Adobe Flash and the presentation components of Ajax. It also competes with Sun Microsystems' JavaFX, which was launched a few days after Silverlight." :D again Microsoft?
Surely, I checked the competitors of Silverlight.

wikipedia/Adobe Apollo

JavaFX is a great project from Sun. It was firstly announced in JavaOne conference May 2007. I was happy to read that Sun announced the project to make development of RIAs very easy. James Gosling Sun Fellow said : "Most scripting languages are oriented at banging out Web pages. This is oriented around interfaces that are highly animated."

Apollo was first released at March 19th, 2007. It's expected to be released the second half of 2007. It allows web developers to use web technologies building desktop applications.

I've tried to make a comparison between them and here's the result:
Supported devices
Windows (XP/Server 2003/Vista), Mac OS X 10.4
Desktop Cross-OS
IDE Support
Visual Studio 2005 / Expression Studio
Browser support
Any Java-enabled browser
Internet Explorer 6.0/7.0, Firefox 1.5/2.0 and Safari 2.0
System requirements
Java 5.0 or higher
SilverLight RT
Flash Player + Apollo RT
Size of prerequisites
15 MB
1.7 MB
1 MB + 2.5 MB = 3.5 MB
Building Rich Internet applications (RIAs)Building Rich Internet applications (RIAs)Building and deploying web applications to the desktop
Languages/Script used
JavaFX Script / Java
C#.Net / VB.Net / any .Net technology
Flex / HTML / JS
Current version
1.0 beta / 1.1 alpha for developersalpha
First announcement
May 2007December 2006March 19th, 2007
Comparison between JavaFX, Silver Light and Apollo





This article is still a stub. If you have any comments feel free.

Tuesday, February 13, 2007

What wastes my hard disk space?

Busy for the long term, having no time to organize your hard disk folders hierarchy. And for sure using Google Desktop ;). How about knowing what specifically is wasting your hard disk space.

And if you want to pay 47.95$ for charts and more extended features.

I've already used the freeware version and I loved it. It's very powerful knowing which folders are taking the space in a tree view.

Friday, January 05, 2007

Play and Help

Did you try before to play and help the world. Amazing!!!

It's Google again :D. A game named "Google Image Labeler", it display an image for a pair of users and waits for their labels for that image; if one of your labels matches, tt gives them some score according to some criteria.Then those labels are used back for enhancing Google image search. Play and Help the world search better.


Game finished

Try this game at