Feeds:
Posts
Comments

Guess what!


I have my blog, finally!

http://blog.osamadwairi.com/

Please Drive safe

yes, Mr. Driver, you have a machine that can carry you and your beloved ones to your targeted places and it can also destroy, kill and maim you, your beloved ones and others beloved one.

so, be careful, you are fully charged. and No one thinks big of you.

a video that every driver should watch, listen and feel.

Java Annotations provide Java developers full potential of doing things in more easy and nice way. I will not go explaining Java annotations pros, cons, and the definitions; you can find out here http://java.sun.com/docs/books/tutorial/java/javaOO/annotations.html

instead I will add some piece which I hardly found: how can I write my own Annotation class and make use of them?! here you go:

I will take a simple Beans that Document who wrote some Java class and who reviewed it.

Requirements

  1. Author, Data Type: String
  2. Reviewers, Data Type: Array of String

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)

public @interface Documentation {

String author();

String [] reviewers() default {};

}

what have we done? we created a file called Documentation.java that is an interface, and because it’s an annotation it’s written like this @interface

we have add two methods signatures:

  1. author: returns a String.
  2. reviewers: returns an array of string, that is an optional element to mention, so we provided a default value of empty string array (I know you noticed that 😉

a question: what does@Retention(RetentionPolicy.RUNTIME) do? well, it indicates to the JVM that this annotation is intended to be used at runtime, simply.

now, it’s time to introduce the famous Hello World class 😀

import java.lang.annotation.Annotation;

@Documentation(author=”Alex”, reviewers={“Divid”, “Osama”})

public class HelloWorld {

public static void main(String [] args){

System.out.println(“checking documentation for class HelloWorld.java”);

Annotation annotation = HelloWorld.class.getAnnotation(Documentation.class);

if (annotation == null) {

System.out.println(“No Documentation was found for class HelloWorld, exit”);

System.exit(0);

}

Documentation doc = (Documentation) annotation;

System.out.println(“author: ” + doc.author());

for (String reviewer : doc.reviewers()) {

System.out.println(“reviewer: ” + reviewer);

}

System.exit(0);

}

}

what have we done? we created a Java Class called HelloWorld, that uses @Documentation annotation.

we have extracted the informtion provided for this class in @Documentation annotation element.

pointing out http://stackoverflow.com/questions/461896 write your experience ….

SEO is the abbreviation of Search Engine Optimization, and simply making your website search-engines friendly, that you try to get your websites’ pages included correctly in some search engine.

Search engines is #1 traffic source for nowadays, and that does not need a prove, does it? you can watch yourself when you need something, you directly point your browser to your favorite search engine (mine is http://www.google.com btw), type your keywords and there you are; asking the right question (here: the search keywords), the better and more relevant results you get.

so, what is the basic things to do to improve your websites reach through serach engines, here is a few:

  • Page title: page title should be short, meaningful and directly to the subject of the page. page title has a higher rank than body for example when search engines look for results againest some keywords.
  • MetaTags: use meta tags description and keywords , make sure you write the right keywords here, that the search engines spider (crawler) look for them.
  • heading tags: use heading tags were possible, that most search engines take attention to <h1> <h2> … etc tags, and consider them as important keywords in the article.
  • use as many moderation tools as you can, both automated and manual, so, you make sure you are away from spamming and the repeated and no-meaning posts (i.e: repeated comments and replies in forums Thank You).
  • create a website that XHTML and better W3C compliant, don’t mess things up, use CSS+XHTML, making sure of that, you make sure search engines can extract the best keywords from your websites’ pages.
  • short and meaning-full URLs with as less parameters as possible, use  URL rewrite and  that is, try to avoid long URLs, a zillion parameters URLs.
    you can ask your system administrator to do the job, or on the application level – that is – asking the developer who developed your application.

This article is the first in a series about SEO techniques and tactics, to see all related articles click on the category SEO on the right hand.

josh groban – My December

he is just perfect, he is Cool.

and the song, I just love it.

have you heard this song from others? ok, what you think?

World Dance by Yanni

sometimes it needs such a Good music to refresh the buffers

Enjoy!

lately I was working with open flash chart (OFC 1.x) to add some sexy statistics showings. it’s really cool tool and easy to work with.

the charts was set right in, and everything is good, when moved to HTTPS domain it crashed on IE (6 and 7).

after a few minutes googling I found the solution that you need to add two response headers for IE to show the chart.

in JSP

response.addHeader(“Cache-Control”,”cache, must-revalidate”);
response.addHeader(“Pragma”,”public”);

here is the forum I benefit from: http://forums.codecharge.com/posts.php?post_id=97771

Enjoy!

following is a JavaScript code snippet using Powerful JQuery library for dealing with select HTML tag (which is – by the way – pain to deal with core javascript language).

the html code

…..

<select id=”my-ml-list” name=”my-ml-list”>

<option value=”java”>XML</option>

<option value=”java”>HTML</option>

<option value=”java”>XHTML</option>

<option value=”java”>HAML</option>

<option value=”java”>YAML</option>

<option value=”java”>YASL</option>

</select>

…..

what can jquery do for you with this list, some is follow:

iterate on all elements

<script language=”javascript”>

$(“my-ml-list option”).each (

function () {

// this object is the current option HTML object.

alert(“current option value is: ” + this.value); // show message of it’s value.

}

);

</script>

Software doesn’t just appear on the shelves by magic. That program shrink-wrapped inside the box along with the indecipherable manual and 12-paragraph disclaimer notice actually came to you by way of an elaborate path, through the most rigid quality control on the planet (well, not exactly). Here you can see the cycle:

  1. Programmer produces code he believes is bug-free.
  2. Product is tested. 20 bugs are found.
  3. Programmer fixes 10 of the bugs and explains to the testing department that the other 10 aren’t really bugs.
  4. Testing department finds that five of the fixes didn’t work and discovers 15 new bugs.
  5. See 3.
  6. See 4.
  7. See 5.
  8. See 6.
  9. See 7.
  10. See 8.
  11. Due to marketing pressure and an extremely premature product announcement based on an overly optimistic programming schedule, the product is released.
  12. Users find 137 new bugs.
  13. Original programmer, having cashed his royalty check, is nowhere to be found.
  14. Newly-assembled programming team fixes almost all of the 137 bugs, but introduce 456 new ones.
  15. Original programmer sends underpaid testing department a postcard from Fiji. Entire testing department quits.
  16. Company is bought in a hostile takeover by competitor using profits from their latest release, which had 783 bugs.
  17. New CEO is brought in by board of directors. He hires programmer to redo program from scratch.
  18. Programmer produces code he believes is bug-free.

That is why software projects fail (or don’t get to their target)

See Also: