Laith Zraikat

I Innovate, Therefore I Am.

Shia mosque in Jordan

Natasha Twal talks about a proposed plan to build the first Shia mosque in Jordan (read). While she did not strike any comparison between the faiths in Jordan, the people who commented on it did.

I think there is really no reason to discuss the position of Sunni Muslims regarding the matter, because simply, Jordan is not a "proper" Islamic country -or Sunni for that matter. By proper I mean to the extent of not allowing alcoholic drinks to be sold anywhere in the country, for example.

Jordan is very liberal and very far from being the model for Islamic rule and behavior. Therefore, we can't take the position of the Jordanian government or the people -whether they permit the Shia mosque or not- to represent the Sunni Islamic opinion on the matter.


Converting a date from Gregorian calendar to Hijri

This piece of code will take the date you give it, and convert it to its equivilant under the Hijri or Gregorian calendar according to your arguments. It will also enable you to set the language in which you wish to display the Gregorian dates (Hijri date will always be displayd in arabic).


C#

public string ConvertDateCalendar(DateTime DateConv, string Calendar, string DateLangCulture)
{
DateTimeFormatInfo DTFormat;
DateLangCulture = DateLangCulture.ToLower();
/// We can't have the hijri date writen in English. We will get a runtime error - LAITH - 11/13/2005 1:01:45 PM -

if (Calendar == "Hijri" && DateLangCulture.StartsWith("en-"))
{
DateLangCulture = "ar-sa";
}

/// Set the date time format to the given culture - LAITH - 11/13/2005 1:04:22 PM -
DTFormat = new System.Globalization.CultureInfo(DateLangCulture, false).DateTimeFormat;

/// Set the calendar property of the date time format to the given calendar - LAITH - 11/13/2005 1:04:52 PM -
switch (Calendar)
{
case"Hijri":
DTFormat.Calendar = new System.Globalization.HijriCalendar();
break;

case"Gregorian":
DTFormat.Calendar = new System.Globalization.GregorianCalendar();
break;

default:
return"";
}

/// We format the date structure to whatever we want - LAITH - 11/13/2005 1:05:39 PM -
DTFormat.ShortDatePattern = "dd/MM/yyyy";
return (DateConv.Date.ToString("f", DTFormat));
}


The HYPEx around AJAX

First, let me declare that I really hate meaningless acronyms, I don’t just dislike them. Now what’s the deal with everyone and this new acronym, suddenly there's something called an "AJAX Specialist"?!This is like saying "HTML & GraphicsSpecialist" instead of "Web Designer". Why not just say "JavaScript Developer" or "Remote Scripting developer" –for those who insist on using fancy words- and give all of those JavaScript developers out there a chance. After all, isn’t the bulk of the work in any so called AJAX application done using JavaScript?

Almost every web designer and developer has had some JavaScript experience, and almost everyone with JavaScript experience has done some design and development for the web. The majority have had good experience with both.

AJAX is an abbreviation for: "Asynchronous JavaScript with XML".

  • JavaScript: a very old and great language.
  • Asynchronous: simple put means "without refreshing"
  • XML: It's actually not a requirement, because you can use plain text if you want and it will work just as good.

So we see that the core lies in the word "Asynchronous" –making callbacks to the server without refreshing the page. Asynchronous callbacks are the transport element in a broader concept called "Remote Scripting", which is made possible using JavaScript through the "Microsoft.XMLHTTP" ActiveX Object in IE and the "XMLHttpRequest" object in all other browsers. One interesting fact is that neither Microsoft.XMLHTTP nor XMLHttpRequest is a standard.

After retrieving your data through remote scripting, anything you do next will use methods that manipulate the Document Object Model which has been supported in all browsers for a long time. This data doesn’t even have to be XML formatted, it can be any form of text which suits your needs. XML just happens to make more sense these days.

The really funny part is that a lot of people talk about AJAX as a standard. Let's revise some facts:

  1. Neither Microsoft.XMLHTTP nor XMLHttpRequest is a standard for all browsers.
  2. Your data can be any form of text, not just XML.

So how can a standard be based on things which are not standard themselves?

I think the only good thing that came out of this new acronym is enabling non-techy business people to talk about "Remote Scripting" without having to explain and prove that they know what they're talking about.

I also don't like my janitor to be using the same jargon I use. So to me, AJAX is that very potent dish washing solution or kitchen and bathroom surface cleaner and thats how it stays. for more information about AJAX click here.

Sad but True

>"The government solution to a problem is usually as bad as the problem." -- Milton Friedman

Milton Friedman, recipient of the 1976 Nobel Memorial Prize for economic science, has been a senior research fellow at the Hoover Institution since 1977. He is also the Paul Snowden Russell Distinguished Service Professor Emeritus of Economics at the University of Chicago, where he taught from 1946 to 1976, and was a member of the research staff of the National Bureau of Economic Research from 1937 to 1981.

Friedman was awarded the Presidential Medal of Freedom in 1988 and received the National Medal of Science the same year.

(read more on Wikipedia)

Automated Speed-driving Penalty System

In response to Samir Rawashdeh's plead: "People of the Internet, please help!" I decided to rub my head, and come up with something.

This is an idea which will reduce speed driving and save lives. This is how it goes:

Create a GPS enabled device which can be installed in any vehicle to monitor its speed. The device will be loaded with data about the city streets; Streets are given unique code numbers, which are then associated with the GPS coordinates of its entire path. On the road, special antennas will transmit the speed limit of every street in the city. The code for each street and its speed limit are then transmitted as Key-value pairs. This data can be compressed and transmitted repeatedly as a radio broadcast with a second pause between each transmission.

This data is then collected and processed by the device on the vehicle, and stored in a tiny database. Every few seconds, the new GPS location of the vehicle is matched with the corresponding street code number from the built in street database, the number is then matched with the speed limit obtained from the radio broadcast stream.

The device will keep monitor over the car's speed. If the car exceeds the speed limit of the current street, it will alarm the driver to slow down, and give him 10 seconds to bring his speed below the limit. If the driver does not comply , the device will send a signal to receivers setup at traffic control stations around the city, which will then relay that signal to a central police database where this incident will be recorded and a ticket issued for the driver. The device then tells the driver that a ticket has been issued. If the driver still does not comply, the device will keep updating the central police database with his current speed and GPS coordinates.

I hope this helps :)

Strip HTML tags from a string in .NET

The best and shortest way is to use Regular Expression for this task:

VB.Net

Function StripHTMLTags(ByVal HTMLToStrip AsString) AsString
Dim stripped AsString
If HTMLToStrip <> "" Then
stripped = Regex.Replace(HTMLToStrip, "<(.|\n)+?>", String.Empty)
Return stripped
Else
Return ""
EndIf
EndFunction


C#

privatestring StripHTMLTags(string HTMLToStrip)
{
string stripped;
if (!Convert.ToBoolean(HTMLToStrip == ""))
{
stripped = Regex.Replace(formHTML.Text, @"<(.|\n)*?>", string.Empty);
return stripped;
}
else
{
return"";
}
}





Domain name investment still works!

About a week ago, the domain name Fish.com was purchased by Dog.com for 1,000,000 dollars in an auction held by Afternic.com. (read the story). I guess theres still some hope for all those domain name investors out there.

Did you know?

Did you know that these domain names actually have sites on them:

10.com
11.com
12.com
14.com
15.com
16.com
17.com
18.com
19.com
20.com

Only 10.com, 11.com, and 12.com have serious web sites, while the rest look like they've been built back in 1997 and left to rot since!

Generate a Random String Key in VB.NET

Introduction

I had to create a piece of code that will give me a set of randomly generated keys. Each key had to consist of letters and numbers, and the letters could be either (randomly) lowercase or uppercase.

Looking at some sample code on the web, I could not find what I needed. All the examples I found either generated numbers only, or letters only. I also wanted this random key to be based on a certain rule that made it "not straightforward" random, so, I came up with this little piece of code.

Using the code

The way it works is as follows:

You feed it with a string of letters: KeyLetters, a string of numbers: KeyNumbers, and how many characters you want the random key to be: Keychars. We then call Generate() which goes and generates a random number through the Randomize() statement and the Rnd() function.

Multiply Rnd() by 111 -could be any number we choose which is sufficient enough to bring the value above zero. If the resulting number is an even number, then our random character will be a letter. If we get an odd number, then our random character will be a number. To generate a random character, we generate a random index for one of the character arrays (depending on what our random character will be). Once we have an index which is >= o, we use it to get the value in the corresponding index in the character array.

If we are generating a number, then that is our random character. If we are generating a letter, then we need to determine whether we want it uppercase or lowercase. For that purpose we generate another random number by multiplying the value of Rnd() by 99 – could be any other number too – and then determine whether the result is even or odd. This time, we capitalize the letter if we get an odd number, otherwise we leave it as it is.

And so on, … the loop keeps "looping" while using, and we use a StringBuilder to construct our resulting string , until we've generated the desired number of characters for our Random Key. We convert the StringBuilder to String and return it with the function.

Note: XML comments in the source code were generated using "VBXC - VB.NET XML Commentor beta 3". I highly recommend it.

Module Module1
SubMain()

Dim KeyGen As RandomKeyGenerator
Dim NumKeys AsInteger
Dim i_Keys AsInteger
Dim RandomKey AsString

''' MODIFY THIS TO GET MORE KEYS - LAITH - 27/07/2005 22:48:30 -
NumKeys = 20
KeyGen = New RandomKeyGenerator
KeyGen.KeyLetters = "abcdefghijklmnopqrstuvwxyz"
KeyGen.KeyNumbers = "0123456789"
KeyGen.KeyChars = 12
For i_Keys = 1 To NumKeys
RandomKey = KeyGen.Generate()
Console.WriteLine(RandomKey)
Next
Console.WriteLine("Press any key to exit...")
Console.Read()

End
Sub
End Module


RandomKeyGenerator.vb

OptionStrictOn
Imports System.Text

''' <date>27072005</date><time>070339</time>
''' <type>class</type>
''' <summary>
''' REQUIRES PROPERTIES: KeyLetters, KeyNumbers, MaxChars
''' </summary>

Public Class RandomKeyGenerator
Dim Key_Letters AsString
Dim Key_Numbers AsString
Dim Key_Chars AsInteger
Dim LettersArray AsChar()
Dim NumbersArray AsChar()

''' <date>27072005</date><time>071924</time>
''' <type>property</type>
''' <summary>
''' WRITE ONLY PROPERTY. HAS TO BE SET BEFORE CALLING GENERATE()
''' </summary>
ProtectedFriendWriteOnlyProperty KeyLetters() AsString
Set(ByVal Value AsString)
Key_Letters = Value
EndSet
End
Property

''' <date>27072005</date><time>071924</time>
''' <type>property</type>
''' <summary>
''' WRITE ONLY PROPERTY. HAS TO BE SET BEFORE CALLING GENERATE()
''' </summary>

ProtectedFriendWriteOnlyProperty KeyNumbers() AsString
Set(ByVal Value AsString)
Key_Numbers = Value
EndSet
EndProperty

''' <date>27072005</date><time>071924</time>
''' <type>property</type>
''' <summary>
''' WRITE ONLY PROPERTY. HAS TO BE SET BEFORE CALLING GENERATE()
''' </summary>
ProtectedFriendWriteOnlyProperty KeyChars() AsInteger
Set(ByVal Value AsInteger)
Key_Chars = Value
EndSet
EndProperty

''' <date>27072005</date><time>072344</time>
''' <type>function</type>
''' <summary>
''' GENERATES A RANDOM STRING OF LETTERS AND NUMBERS.
''' LETTERS CAN BE RANDOMLY CAPITAL OR SMALL.
''' </summary>
''' <returns type="String">RETURNS THE RANDOMLY GENERATED KEY</returns>
Function Generate() AsString
Dim i_key AsInteger
Dim Random1 AsSingle
Dim arrIndex As Int16
Dim sb AsNew StringBuilder
Dim RandomLetter AsString

''' CONVERT LettersArray & NumbersArray TO CHARACTR ARRAYS
LettersArray = Key_Letters.ToCharArray
NumbersArray = Key_Numbers.ToCharArray
For i_key = 1 To Key_Chars
''' START THE CLOCK - LAITH - 27/07/2005 18:01:18 -
Randomize()
Random1 = Rnd()
arrIndex = -1

''' IF THE VALUE IS AN EVEN NUMBER WE GENERATE A LETTER,
''' OTHERWISE WE GENERATE A NUMBER
''' - LAITH - 27/07/2005 18:02:55 -
''' THE NUMBER '111' WAS RANDOMLY CHOSEN. ANY NUMBER
''' WILL DO, WE JUST NEED TO BRING THE VALUE
''' ABOVE '0' - LAITH - 27/07/2005 18:40:48 -
If (CType(Random1 * 111, Integer)) Mod 2 = 0 Then

''' GENERATE A RANDOM INDEX IN THE LETTERS
''' CHARACTER ARRAY - LAITH - 27/07/2005 18:47:44 -
DoWhile arrIndex < 0
arrIndex = _ Convert.ToInt16(LettersArray.GetUpperBound(0) _
* Random1)
Loop
RandomLetter = LettersArray(arrIndex)
''' CREATE ANOTHER RANDOM NUMBER. IF IT IS ODD,
''' WE CAPITALIZE THE LETTER
''' - LAITH - 27/07/2005 18:55:59 -
If (CType(arrIndex * Random1 * 99, Integer)) Mod 2 <> 0 Then
RandomLetter = LettersArray(arrIndex).ToString
RandomLetter = RandomLetter.ToUpper
EndIf
sb.Append(RandomLetter)
Else

''' GENERATE A RANDOM INDEX IN THE NUMBERS
''' CHARACTER ARRAY - LAITH - 27/07/2005 18:47:44 -
DoWhile arrIndex < 0
arrIndex = _ Convert.ToInt16(NumbersArray.GetUpperBound(0) _
* Random1)
Loop
sb.Append(NumbersArray(arrIndex))
EndIf
Next
Return sb.ToString
EndFunction

End Class


Source Code:

Download demo project - 2.36 Kb
Download source - 7.64 Kb

My Desktop

How do you fit 5 desktops inside one?


Thank you for the bracelets

I just want to express thanks to those people and parties who took it upon themselves to make those bracelets and deliver them to our doorsteps. Thank you all.


Mustafa Al-Akkad passes away

I just learned that Syrian filmmaker Mustafa Al-Akkad is the latest in the long list of those killed in the 11/9 Amman attacks. He is the man who brought us the most well known and widely viewed film on Islam "The Message", as well as the film about the greatest example of modern history Jihad "Lion of the desert". His daughter was also killed. May they rest in peace.

Read more:
http://www.jordanfirst.com/?p=4



11/9 Attacks. Bloggers quick to react

It was 9:15. I was sitting in my office when I first received news of the attacks. It was the familiar ring "ding dong..." from my RSS reader, and then the words "Explosion in Amman", I immediately knew what that meant, but hoped I was wrong. Then followed the sinking feeling that Jordan is like everywhere else where this has been happening, and that it was just a matter of time.

"Explosion in Amman" was Isam Bayazidi's post which broke the first news. At first he did not give much detail, so I went to CNN.com and there it was.

Isam's first post was followed by updates as he got more details. A few minutes later other blog feeds started coming in with the news. Everyone was hearing about it and telling everyone else. The most comprehensive and dedicated updates came in through a post on Global Voices : Explosions Rock Jordanian Capital, Amman

Some even went as far as going to the scene and taking pictures for the world to see.
One avid blogger and young photograqpher –Sabri Hakim- posted some of the first footage in his blog, which was mentioned on CNN.

The next day witnessed the reaction of the Jordanian people on the streets of Amman. Protests were held to express unity and strength against the attackers, as well as support for the families of victims. Isam Bayazidi and Sabri Hakim were there to bring the images to the rest of the world.

I just want to give a big hand to all those people in the Jordanian blogosphere who gave time to tell the world what was happening. Those are young people who had the sense of duty to do anything they could after the tragedy took place.


Fighting Terror

Being united and speaking out in one voice is really good, and sends the message that we will not be defeated or terrorized. But then what? What is the course of action that we should take in order to make sure those or any other terrorists do not succeed in the future.

Some say that the success of this operation is nothing but a statistical anomaly, which was bound to happen, and I will have to agree. Jordan has always been the target of such attempts in the past, and in recent years, these failed attempts have increased in frequency, the latest of which was the Aqaba attack.

A lot of talk has been going on for the last year and a half about installing metal detectors, especially since King Abdullah gave orders to the government back then to begin conducting the necessary studies and to lay down a plan to protect all of the main government locations, hotels, and places of public gatherings. This issue has come up again after the 11/9 attacks, and fingers started pointing to the government as the main party to blame because they did not carry out the King's orders.

I say, lets stop pointing fingers and take responsibility for what happened, because we are all to blame. We are all to blame because we the citizens elect the parliament, and the parliament relays our needs, hopes, and dreams to the government. So it seems to me that the issue of security lies very low in our Representatives' priorities lists, which means that this is where it lies on an individual level as well.

Now that we are convinced that every individual should bear the responsibility, let's discuss the methods which can be employed to foil such future attempts.

Intelligence agencies play a huge role it tracking suspects, and making sure they stop terror attacks while in the planning stages. But as we've seen, the more frequent these attempts are, the more likely it is that one will slip through. So what is the answer? Metal detectors? Metal detectors and x-ray machines are used at airports, but they only act as a deterrent to attempts by small crime groups, and not by worldwide, professional terrorist organizations like the one that carried out the Amman attacks.

What we need is a plan to stop these attacks on more than one level, even while being carried out. What we need is to incorporate the individual citizen as the most effective anti terror weapon.

I want to tell a little story here:

About a year ago, I was in my room late at night, when I heard some noises which got me curious enough to get up and look out the window. I saw a pickup truck parked in front of a storage room for gas distributing company next to my building. They were loading gas containers on to the truck. I thought it was weird they were doing it at this hour. Still, I just closed the window and went back in.

The next day I see a police car in front of the storage room. When I asked what was going on, the company owner told me they were robbed last night. I told him what I saw, but I wasn't of any help because I did not remember much detail.

A short while after this incident, my car was stolen while parked right in front of the building. I was pretty sure that somebody must have seen it being stolen, so I started asking around, then I remembered the incident with the gas company and I realized that even if someone saw those who stole my car, they would not have cared enough to remember any information.

Almost a year passed, when one night I was coming back from work -it was after midnight- and I saw two guys taking out gas containers from that same store room which was robbed. They looked suspicious because they seemed to be in a hurry. I immediately went to the nearby supermarket, and asked him if he knew the guys working in the gas store, and if he can identify them. He came with me and was able to identify them. So I went home knowing that this time, I did the right thing.

The moral of the story is that nowadays people do not feel a sense of obligation towards their neighbors, let alone their fellow citizens. We need to work on that.

We need to educating people on terror and terrorists, give them a greater sense awareness of their surroundings, and educate a sense of loyalty and belonging to this nation. If that is achieved, we will have a country full of watchful eyes, speaking out when they suspect something rather than walk away as if it does not concern them. The void which we need to fill is not in our security, but rather in our awareness, and sense of duty and belonging to all the people of Jordan.

Amman explosions 11/9

CNN breaking news:
http://edition.cnn.com/2005/WORLD/meast/11/09/jordan.blast.reut/index.html

I feel its not a coincidence that this date was chosen by whoever did this.

It is discomforting that there were 3 explosions, and not just one, but its even more discomforting to know that those people have more confidence now that they have succeeded in breaking Jordan's peace and quiet.

Amazon, Google...you should HEAR this!

This thing is very fresh, and it's called PANDORA (www.pandora.com)

Pandora is what you could call a web based jukebox with intelligence. In addition to streaming some very good quality music, it can help you find new songs which suit your musical taste.

How do they do it? Well, it’s a bit more complicated than just creating a super smart software. Actually, the software itself is not smart at all, it’s the extensive database of individually reviewed and dissected songs is what helps it understand your musical taste and match it with songs that you might like.

The foundation of this innovation is what the founders call the "Music Genome Project" (http://pandora.com/mgp.shtml) which – simply put - aims at identifying the basic traits "Genes" that make-up a musical piece. Each song is then analyzed individually and classified according to its "Genes".

In addition to giving you suggestions, it will ask you for feedback, which will help it narrow down your musical taste and suggest better songs.

I have tried it, and incredibly, about 90% of songs suggested are things I really liked. Currently the service is free of charge for the first 10 hours of play. After that the yearly subscription is US $36. I am not sure I would want to subscribe just to listen to music, but I would definitely hit Pandora on my way to Amazon.com in hopes of finding more music that I will want to buy.

Amazon and Google should keep an eye on this new company. It will be an extremely handy tool for people shopping or searching for music. Amazon could have a smarter way of suggesting music based on a scientific understanding of people's musical tastes. As for Google, well, Google has always been about simple applications that intelligently organize the world's content, utilizing the internet.


</


<<Home