Emad Al-Ashi’s Blog

February 21, 2009

www.emadashi.com my new blog space!

Filed under: Misc, Personal — eashi @ 1:54 am

Finally, I am doing it! I am becoming a big boy and taking care of my self; moving from the caring WordPress.com world to my own hosting with my own domain: www.emadashi.com

While taking this step I had many flashes ranging from “COOL, I CAN DO ALL THAT NOW!” to “OH MY GOD, WHAT AM I DOING!”; it’s hard, has lots of responsibility, and many sacrifices like simple life, and the Google ranking I will be losing since June last year.

Checking all the stats and visits brings my tears down (not really down though!). So what I am going to do is to keep my old blog (this one) so visitors can still see my old posts and I won’t loose the ranking, what do you think? should I do that? (comment if you please)

The good thing is, though, that if you are subscribed to this blog’s feed, you don’t have to change anything; It will happen automatically and you will still get the new posts (you might get the old posts again once more when I take that step).

So anyway, I hope this step to be a new era for better life, all hope.

February 19, 2009

Google Is Moving Feedburners’ Servers

Filed under: Misc — eashi @ 7:17 pm

As the title tells, Google is moving the Feedburner servers, and my RSS feed URL has changed now to http://feeds2.feedburner.com/eashi

Google “promised” to keep the old feeds working for a while, so anyone who has subscribed to this blog will not be affected “for a while”; so if you want to stay up to date with the proper feed URL of this blog (and I hope you do :) ), please change the feed url to http://feeds2.feedburner.com/eashi.

Thank you all  for your continuous attention :)

February 7, 2009

Beware of Static Constructors

Filed under: Bunian, Development — Tags: , , — eashi @ 12:39 am

In Bunian we needed to use a static constructor for some reason, it was all going good; we tested the code and it ran smoothly…excellent (Code Coverage anyone?!).
But when I came across this situation, it appeared that the static constructor wasn’t invoked!even when “Class.Method();” is called! so lets examine it.

I have two simple classes as an Example:

public class Parent

{

    public static string DoSomething()

    {

        return “Parent: DoSomething() called”;

    }

}

public class Child : Parent

{

    static Child()

    {

        Console.WriteLine(“Child Static constructor called”);

    }

 

    public static string DoSomethingDifferent()

    {

        return “DoSomethingDifferent() called”;

    }

}

As it may be obvious, Child inherits from Parent, Child has a static constructor that we need to be executed when ever a method is invoked by Child. Now lets check the main program executing these two lines:

Console.WriteLine(Child.DoSomething()); //This code will NOT invoke the static constructor

Console.WriteLine(Child.DoSomethingDifferent());//This code WILL invoke the static constructor

The surprise (at least to me) when calling “Child.DoSomething()” the static constructor isn’t invoked! because it is in the parent!! aaaaaah! bad!! that was serious for our architecture  and we had to do lots of fixes to turns things around the right way (which I think it was for our own good for other reasons :P )

This brings up the Code Coverage topic as well; in our case that static constructor’s job was to create an instance of a member that is only needed once, and we check on it in other times by “if _instance != null”. It always ran ok because all the test code we created used to call an original Child before calling any other method that resided in the Parent.

bottom line: be ware of static constructors, and check your test code…it maybe hiding “surprises” for you ;)

January 26, 2009

default ASP.NET Membership provider on different database

Filed under: Development — Tags: , , — eashi @ 2:27 am

Every ASP.NET developer should already know about the Membership Provider that ships with ASP.NET 2.0. Configuring it is as easy as opening Visual Studio > select the Web project file > navigate to the Project menu item > and select “ASP.NET Configuration”. Follow the wizard and you are up and running now.

But the problem with this approach is that it will build it’s OWN database in the App_Data folder and create the required tables there. Wouldn’t most of us have their own databases to work with? ok then, if you want the defualt ASP.NET Membership Provide (AspNetSqlMembershipProvider) to work on YOUR database do the following:

  1. Navigate to the folder: “C:\Windows\Microsoft.NET\Framework\v2.0.50727” and run the “aspnet_regsql.exe” file, follow the wizard (it’s pretty easy, see the images below)

    Step1Step2

    This step will create the Membership and Profile Provider tables necessary; if you are lucky you will see many dbo.aspnet_something tables.
  2. Now we need to tell the website which Provider it should use for this functionality, and to which database it should connect to; the default configuration information that drives the default behavior of the default Provider resides in the Machine.config (C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG), which explains why you can’t find the configuration information on YOUR web.config even after you finish using the ASP.NET Configuration mini-website.
    The best thing to do is to copy that configuration information from the machine.config to your website web.config in order to override its behavior to our desired one, for more information about configuration files and configuration hierarchy read this.

    <membership defaultProvider=AspNetSqlMembershipProvider >

          <providers>

            <clear/>

            <add name=AspNetSqlMembershipProvider type=System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a connectionStringName=”BunianConnectionString” enablePasswordRetrieval=false enablePasswordReset=true requiresQuestionAndAnswer=true applicationName=/ requiresUniqueEmail=false passwordFormat=Hashed maxInvalidPasswordAttempts=5 minRequiredPasswordLength=7 minRequiredNonalphanumericCharacters=1 passwordAttemptWindow=10 passwordStrengthRegularExpression=“”/>

          </providers>

        </membership>

    Note that highlighted changes:

    1. clear any previous configuration of the AspNetSqlMebershipProvider (machine.config) which if not moved will give you an error of already being configured
    2. changing the connection string to mach a connectionstring name that you use to connect to your database in general

This way you will have the default Membership Provider running on your database for your website; if you use the mini-site for the ASP.NET Configuration now and create new users, you will find them created in your database.

Note that some resources say that you can change the database from the ASP.NET Configuration but I couldn’t find it there.

Disclaimer: use the above on your own responsibility :)

January 16, 2009

Get On With It!

Filed under: Bunian, Development, software management — Tags: , , , — eashi @ 6:56 pm

clockWhen we started gathering requirements from the charity organizations for Bunian, it appeared that there are other kinds of people who benefit from the charity organization; there are “needy families” whose father is still alive but can’t sustain their families, and “students” who can’t afford their study. 

So Bunian needs to support all these Beneficiaries in smart way; we solved the problem by creating the IBeneficiary interface. But the problem is that in order to get out with the best solution ever (damn perfectionism!), we kept coming up with different solutions, and overriding them with other solutions every once in a while, and this kept going like forever!

Though we agreed from the beginning that we shall keep it as simple as possible and then add up to it as we get out with the first phase, yet it kept sliding “ok only we have to do this, oh and that too”. Until one day I thought I came up with the silver bullet everyone talks about 4 , and sent an email to the group about the changes I wanted to make, when a colleague caught me online and showed her objection about the new solutions, and proposed another. Only then I woke up!! “OMG…WE ARE STILL HERE!!”
Instantly, I remembered my oldest brothers comment  (Mohammad, very wise brother) about Bunian “It’s great that you want to build the greatest architecture ever, but remember that Orphans are waiting!!

So LET’S JUST GET ON WITH IT!! ship it!! do it!! let version one come out, let “customers” benefit from it, then you take your time doing your silver bullet. So this is one of the challenges facing the Project Managers, something we developers rarely think about :) ; today…I learned my lesson!

December 27, 2008

Gaza, Starvation For 18 Months And a Massacre Today!

Filed under: Misc — Tags: , , , , — eashi @ 6:09 pm

Update: death toll rate reaches 470 and 2400 injuries, and I will stop counting.

After a 20 months siege during which there was no water, food, medicine, gas, oil, and electricity…today Israel thinks that’s not enough…and starts a massacre; 160 dead, 200 wounded by 40 rockets hit Gaza and still going.

Photos From the Massacre Taking Place Today

English news: here
Arabic news: here

2008122711545599734_2

1_880821_1_34

1_880850_1_34

Photos From the Siege

English news: here
Arabic news: here, and here

26337_11223465084 smuggling food through the tunnels

26337_21223465084 Milk for the small children who lack the basic ingredients for healthy food, finds its only way trough tunnels under ground.

6210x no electricity, you know what this affects; imagine yourself without electricity for 1 week, not saying 20 months!

6130x

610x

December 26, 2008

Importance of Documentation

Filed under: Bunian, Development, NHibernate, software management — Tags: , , — eashi @ 2:25 pm

 

documentation

Lately we have decided in Bunian to move on to NHibernate 2.0, and the contributor assigned to the move started out, only to send an email one day after: “THERE IS NO DOCUMENTATION!’.
We had errors as a result to the move which couldn’t be fixed without a documentation explaining why this happened.

After searching for a while, we found two resources of the new documentation:

Neither links were included anywhere in the NHibernate zipped file.

I didn’t realize how important a documentation is until it stopped us from moving on in our project; Only after we made sure that the documentation is available we decided to move on to version 2.0. The lesson to be learned is that if you are an enthusiast developer and want to add another piece of code to the world, keep in mind that your project is not only code; it is people, resources, community, ease of use, documentation, and any other simple thing that people need while you think it’s not important.

Of course I couldn’t find developers or contributors to open source projects greater than the NHibernate team, having such a project in the first place is awesome, and I thank each and everyone of them. I hope one day I can really contribute back to NHibernate. Thanks again guys.

December 14, 2008

HttpApplication EndRequest Event Invoked Many Times In Single Request?

Filed under: Bunian, Development, NHibernate — Tags: — eashi @ 11:44 pm

The other day I was putting the last touch of a temporary way to manage the NHibernate session (ISession) in Bunian. So part of the task was to bind a method to the HttpApplication EndRequest event (in the Global.asax.cs file) like the following:

public override void Init()

{

       this.EndRequest += WorkContext.NHibernateSessionManager.Instance.HttpRequestEnded;

}

By doing this, at the end of each page request the NHibernateSessionManager.Instance.HttpRequestEnded() will be called and I can clean the session then. But to my surprise this method was called at least 10 times!! So I thought maybe the Global.Init() method is called many times for some reason and I ended up binding the same method to the EndRequest event many times, so I set a breakpoint at the Global.Init() method and…it’s called one time only.

That was strange, ok so it’s only the HttpRequestEnded() mehtod that is called many times, but I am requesting only one page!! how come there are 10 requests!

So I opened Firefox which is already “armed” with the magnificent add-on Firebug, and I requested the page again, Firebug showed the following:

CropperCapture[1]

And that was it!! the page contained 10 resources (1 CSS file and 9 images), OH! so it is one page, but for each resource referenced on the page you get a request, hence a raise of the EndRequest event.

I couldn’t love Firebug more; I am not only happy that I wasn’t doing something wrong, but yet I learned something new about the ASP.NET internals. awesome.

December 12, 2008

Travians be Warned…Rapacious is Rising

Filed under: Development, Misc, Personal — Tags: , — eashi @ 3:55 pm

I don’t know whether thank or scold my good friend Omar Qadan for introducing me to Travian, a strategy game played online.

travian

It’s amazing how a simple,  web-based, HTML-front game can be so rich and vast entertainment wise! It’s a real strategy game where you build villages, resources, armies, embassies, and conduct trading, diplomacy, wars, and alliances…all through simple images, numbers and text.

On the other hand, I can’t ignore the programming part of the game (being a developer that is), it must be big, fun and tiring; think of all these rules and the simulation algorithms the game is being built upon , the server handling thousands of players, …and scripts (yes! lots of hacks!  161 ). Even the hacking idea it self is so delicious (programming wise only  251 ), a true heaven for developers :) .
Also the makers of the game are on the right track of providing developers points through which they can access the game and display information on other sites or applications; ok for now it’s only exporting database tables of statistical information about the game status, but still I consider it a cool step toward supplying nice end-point for developers, maybe Web Services in the future 4.gif .

Every time a new idea hits the web I say “ok, that’s it…there are no more idea’s!”, and every time I say that I  am proved to be wrong; YouTube, Facebook, Wikipedia, Delicous, Digg, SlideShare, Flickr…and the list goes on.
So this is a message for all of us, don’t limit your imagination, ideas never run out.

The only concern now is that I don’t want to be addicted, so let’s wish for the best…and be warned…because Rapacious is rising ;)

December 5, 2008

Introduction to NHibernate Session at Jordev Was Good

Filed under: Development, Misc, NHibernate, Personal — Tags: , , , , — eashi @ 4:29 pm

The feedback was very good, and I was glad that everybody liked it. Jordev is really moving ahead, and I am very excited being part of it :)

Below is the slide show (it’s an enhanced version from my previous one):

Code is the same of the previous one which you can download from here

Older Posts »

Theme: Shocking Blue Green. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.