Twitter Feed Popout byInfofru

Attack on Gaza: Emergency Appeal

Gaza  destruction

Assalamualaikum wa rahmatullah

Three days of intense aerial bombardment have left more than 300 people dead and hundreds more injured.

The bombings have taken the lives of civilians including women and children, and have affected hospitals and medical warehouses. The 19 month blockade of Gaza has already severely restricted the capacity of local hospitals to cope with the injured, with many reported to have already run out of critical supplies.

The blockade of Gaza has also forced more than half of the 1.5 million population to be dependant on humanitarian assistance. International aid agencies have been struggling to provide food, medicine and clean water whilst the shortage of fuel has made it extremely difficult to run essential services in Gaza including power to hospitals and sewerage treatment plants. This new and severe onslaught has brought yet more misery to an already suffering people.

Muslim Aid has been delivering humanitarian and developmental assistance in Palestine through its partners for over two decades. The £2 million raised through this appeal for the people of Gaza will be used by local partners to provide medicine and food for those most affected.

We urgently need your help to provide life-saving assistance to those that need it most.

Click here to donate

Note : This post is on the behalf of Muslim Aid Serving Humanity

Configuration Membership API Asp.net 2.0

Membership API is yet another enhancement from asp.net team. In this post, I will guide you through the configuring of Membership API to the enhanced usage.

So, to get started let me clear one more confusion which most of people have in there mind

They think that Membership API does not use any database behind and asp.net runtime engine perform some miracle at the back end  and all the user information is stored somewhere which is known by runtime engine.

 

That is wrong ..... big WRONG ....

By default, asp.net uses SQL Server as the back end of Membership API. If you have planned to use it, before doing any thing you need to implement the schema of Membership API to your database.

Step 1 (Implement Schema & Configure Database):

To do that, you need to use aspnet_regsql. which can be accessed by the instruction give below.

  • Go to X:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727 (version of dotnet framework can be vary but it should be at least 2.0)
  • Find and execute aspnet_regsql which will appear following screen.

aspnet_regsql_screen1

  • Once you click next, you will be asked to "Configure SQL Server for application services" or "Remove application services information from existing database". You need to select the first one.
  • Select the appropriate database, click next and you are done with the database stuff.

Step 2 (Configure Asp.net Application):

In this step we will configure our existing or new asp.net application to user asp.net membership API.

Please bear in mind that Asp.net Web Application Administration is a very handy and useful tool to check Membership API integration.

Now, to use API you need to specify the connection string of the database which we have configured with aspnet_regsql.

  • Add the following connection string in web.config
   1: <add name="ConnectionString" connectionString="Data Source=SAMHEAVEN;Initial Catalog=Northwind;User Id=sa;Password=usam;"
   2:      providerName="System.Data.SqlClient" />
  • Specify membership and role configuration under system.web of web.config.
   1: <roleManager enabled="true">
   2:    <providers>
   3:      <clear/>
   4:      <add name="AspnetSqlRoleProvider" applicationName="/AppName" connectionStringName="ConnectionString" type="System.Web.Security.SqlRoleProvider"/>
   5:    </providers>
   6:  </roleManager>
   7:  <membership>
   8:    <providers>
   9:      <clear/>
  10:      <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ConnectionString" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/DanyTech" requiresUniqueEmail="true" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
  11:    </providers>
  12:  </membership>

 

  • Finally, you need to set authentication type.
   1: <authentication mode="Forms" />

To be descriptive, we have specified settings for two basic parts of Membership API. which is using Connection String called "connectionString" which we have created in the first step.

AspNetSqlMembershipProvider and  AspnetSqlRoleProvider have an attribute called applicationName which is really important. All the information of the Membership API will stored in the database against the applicationName specified here.

Where as, AspNetSqlMembershipProvider have a list of settings. Click here to get the complete list of Membership Provider settings.

Now the configuration stuff is complete. You can check is every thing running fine by clicking on the Asp.net Configuration Icon give right above the solution explorer.

se_config

Go to the security tab and check you can create some users and roles (at least administrator, user) . If not then make sure you have not skipped any step.

A Personal Look On 2008

Finally, its the end of year 2008. Another very long and difficult year of mine. The things went odd and odd this year. No improvements. Still, marriage remains the unsolvable matter of my life.Nobody is there to say Happy New Year this time too. Sometime, I really think to leave every thing behind and get a new way but there is something inside me which appeals .... which always appeals to carry on what I am up to there is something which always make me think positive no matter how difficult the situation is.ALLAH gave me many things from this year which includes Health, Wealth, Maturity and nevertheless Long hairs :) but there is one more thing on which I am really proud off and that is worth to share. It is the title of LOVE GURU given me by my close friends. This year I have settle three major love stories to the success. I mean there are lot more but thee are the top three.

Story  1:

In my ex organization, I have a guy working with me who was not performing. So, my manager asked me to take him to the conference room and dig out the problem. As he gave me an open ground, I just start insulting him on the work he has done. By the time he was leaving office for home he asked"Agha bhai !!! have you ever be in break up situation"I replied : What nonsense type of question is this ?Then he said "I am ... that is why I am not getting focused to the work and made those blenders and all that"Who else can understand his situation better then me. So I call him to my place and discuss the situation. Well, the situation was a very complex family problem. His Girl Friend was also his cousin and a very typical Pakistani family setup.So, I went to his home to meet his father (fathers are the only people who can understand a boy problem). After discussing the problem with him, his father said "The problem is his mother, make her happy some how. Do any thing what you guys can do and then give your demand."After searching ways to make her mom happy we finally discovered that she was really disappointed when he was failed in NUST Fast aptitude test for BS. So, I asked him to made another attempt for admission in MS as his graduation was already completed.I remember, I request for his one week leave from office so that he can prepared for exam and meanwhile I managed all the stupid code he wrote. Then he came to me just before a day of his final interview in FAST. That is used to be taken in English. I myself cannot speak much good English as I am just average on that. But what I did is I force him to speak English continues about 10 to 12 hours. We didn't use any single word of Urdu.He was with me that whole night, we watched "Pirates of Silicon Valley" and next morning I drop him to the university and after three or four hours he called me and give the good news of his admission he said "The result is not yet announced but I am sure my admission is confirm".After about a week, I remember it was 1:25 AM he called me to give the news of his mother agreement on his marriage. The remarks he gave me that day was awesome but more then that I cannot forget his happiness. Man !!!! He was damn happy.He got engaged with her some days after and now I guess in July 2009 they are getting married INSHALLAH.

Story  2:

Some month back, Yasir my childhood friend finally got admission in Chartered Accountancy (CA). while we were on drive I was discussing him the issues he can face during his 7 years of CA.Before I finish my lecture, He said "I can manage all that brother !!! but I really miss her !! and what if she get married in this period".Can you imagine, this guy haven't seen his girl friend for eight years and still this much interest I mean they had break up eight years ago.Who else can understand his situation better then me. So that's the next task. That girl was with us when we were in school and I knew about the location of her house but the way was not that clear as it is about 10 years we used to study school.So, next evening I reached her home and knocked the door (their door bell was not working). Her mother came out and surprisingly she remember me and then I spilled out every thing I had without any fear I know that can be too dangerous but I didn't think any thing that time.She obviously refused. While I was getting back from their place I was thinking that I have made a big mistake I asked ALLAH to manage things in good way.As her mother was pissed off with me. She investigate about Yasir's residence telephone number so that she can talk to Yasir's parents about this happening. Somehow, she got that and told the whole story of last evening to Yasir's mom .While they were talking against us on phone, they develop some good relations and surprisingly Yasir's mother said "If we plan about the marriage of Yasir we will let you know similarly if you plan about your girl marriage let us know."That was an improvement, after some days Yasir received some messages from that girl and they again got together but still there were some marriage proposals that her family was considering. So we need to do some thing really quick to win the war.We talked to Yasir's mother she was agreed but this time the problem is with his father. I tell you, I have very healthy relationships with the fathers of my friends but I really afraid this man.I have no idea how, but somehow his father got agree for this marriage. They become fiancés now and Yasir is completing his CA they will get married by 2010.

Story 3:

I have another friend who's name is Naveed. A top class flirt guy, he used to have three plus girl friends at one time, moreover he used to had all these girls in his neighborhood and surprisingly, all the girls are friend of each other and none of them knew any thing about Naveed's relations with each of them.Imagine, this type of guy came to me and said "Agha !!! I am in love I need your help." I was no way agree to believe him but he force me to think seriously about his seriousness in his new love.Well, I was the first man on this planet who trust him in that case while none of my friends was in agreement with him. After some months of his love scene the problem arises.Normally, In Pakistani culture the problem always occurs due to typical family system. I tell you, don't ever select anybody amongst your relative for love. They are just worst people to deal with.This time, the problem is with Naveed's family. So, he came to me and said some emotional dialogues. Now who else can understand his situation better then me. So, here is the next task. To agree Naveed's family. So, I start with his father. I often meet him in mosque so I have a good impression on him. I talked to him and he gave me good attention but the bottom line remains the same "He was not agree".While, I was talking with his father I feel that they have lots of complains about Naveed's attitude. So I start working on him, gradually Naveed start coming to the mosque for prayer and I observe a clear change in him as he said good bye to all the old girls.I asked him, just be agree on what your parents said but show your feelings as well and the best way to do that is to bring change in your life. I asked him to show disappointment, some time don't have breakfast and some time leave the home at the time of dinner.I remember, at that time, he left home without having breakfast and then we both had it on Pathan's Chai hotel with a Paratha and a friend egg. Sometime, he came to me about 10 PM and we had a dinner together. Just to show his family that he is disappointed we have this type of food system for about a month.After someday his father call me to his place to inquire what's wrong with Naveed these days and I told him the whole story that Naveed is not happy with your decision but he also don't want to heart you and all that.Finally, after this meeting his father agreed on this marriage. He with Naveed's mom, went to the girl house and the proposal was accepted from her family and they are getting engaged in this January INSHALLAH.So, these are some love scenes which I have deal this year. I mean, there are lots of other stuff  like relationship problems, Tips and give selections which I solved on daily basis just on cell phone. I often recieve call from my friends that She is doing this .. she always make me pissed off and I want her to do Hijaab and all that.Trust me, I solve all this type of relationship problems by having my mother's and my supposedly girl friend's nature in my mind. According to me both are the hardest women on this earth but I love both of them, they are my life I am nothing without them. (Papa I am not missing you .... you know I love you).So, along with the struggle I had this and last year. That is the freelancing which I used to do. May ALLAH give reward for this and give me success in my own love scene.I have faith in ALLAH. I am sure one day, the climate around me will change because every thing has its end.May ALLAH make me patience throughout this difficult period and keep my way as easy as it can be. May ALLAH  make this year 2009 a very happy year of my life. Amen !!!!!

Happy New Year


People all around the world have start the celebration of this event. In my city Karachi, one can easily hear the sound of different celebrations including Fireworks, Air firing and all that stuff. In fact, I can listen clearly sound produced by the shell of bullets dropping on the roof of my room. People call it tradition (no comments :)) .

Every year, people across the globe spent millions of dollars on this event but is there anybody who think about those who sleep hungry, who have no home to stay, who sleep in the cold without having a proper blanket, who suffered from the attack made by Israel recently. where the hell is humanity ?

Study any religion on this planet, you will know that by having someone needy around us we are no way allowed to do this celebration.

By having this thought in your mind, lets say good bye to 2008 and welcome the new year 2009. May God gave all of us a straight path with having the feelings of other's pain. May God removes all kind of violence around us and gave us a very peaceful world. Amen......

Happy New Year ................

Get list of installed printers using C# WMI

Well, almost about an year back I write an application which search for the available printer on the server and do some operation accordingly. Today while browsing my code library I found that small test application. So I thought it would be good to share this with the community.

Management Objects are really good, I mean when it comes to windows you can do lots of operations using Management Object. You can get the list of services installed on system, hardware and etc. And the point which is worth to mention here is you can do that by using simple query like TSQL.

To access the printer information on the local machine you can use the following code

   1:             ManagementScope objScope = new ManagementScope(ManagementPath.DefaultPath); //For the local Access
   2:             objScope.Connect();
   3:            
   4:             SelectQuery selectQuery = new SelectQuery();
   5:             selectQuery.QueryString = "Select * from win32_Printer";
   6:             ManagementObjectSearcher MOS = new ManagementObjectSearcher(objScope, selectQuery);
   7:             ManagementObjectCollection MOC = MOS.Get();
   8:             foreach (ManagementObject mo in MOC)
   9:             {
  10:                 listBox1.Items.Add(mo["Name"].ToString().ToUpper());
  11:             }

 

The above code will use the current logged on identity as the default credentials. where as following code will get the list of printer installed from a remote location.

   1: ConnectionOptions objConnection = new ConnectionOptions();
   2: objConnection.Username = "aghausman";
   3: objConnection.Password = "nightmare";
   4: objConnection.Authority = "ntlmdomain:DDI"; //Where DDI is the name of my domain
   5: // Make sure the user you specified have enough permission to access the resource. 
   6:  
   7:  
   8: ManagementScope objScope = new ManagementScope(@"\\\\10.0.0.4\oot\\cimv2",objConnection); //For the local Access
   9: objScope.Connect();
  10:  
  11: SelectQuery selectQuery = new SelectQuery();
  12: selectQuery.QueryString = "Select * from win32_Printer";
  13: ManagementObjectSearcher MOS = new ManagementObjectSearcher(objScope, selectQuery);
  14: ManagementObjectCollection MOC = MOS.Get();
  15: foreach (ManagementObject mo in MOC)
  16: {
  17:     listBox1.Items.Add(mo["Name"].ToString().ToUpper());
  18: }

 

and here is the attachment of the solution files created in Visual Studio 2008

Downloading Zip File Using Asp.net

Here is the quick code of downloading the zip file from asp.net (vb.net)

   1: Dim _strBeingViewedName As String = "MyZip"
   2: Response.ContentType = "application/x-zip-compressed"
   3: Response.AppendHeader("Content-Disposition", "attachment; filename=" + _strBeingViewedName + ".zip")
   4: Response.TransmitFile("..\\zipPath\\" & _strBeingViewedName + ".zip") 'Full Path of the zip file
   5: Response.End()

Z-Index Problem with Flash Object

From this morning I have been snatching my hairs over a very strange problem with Flash Object. Actually I am not a Flash Guru, but I just want to place a flash animation on the home page of the web site which is unfortunately using the Asp Horizontal Menu. The problem lies when the menu drops down and it goes behind the flash object. I thought it is z-index issues, that’s why I put style tag on object tag and give z-index but it didn’t tricked. After full one day of working over it as there is no comprehensive post on the Internet for this sick problem. Here is the snippet which works like a charm for me. 
   1: <div id="Container">
   2:  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="960" height="370">
   3:   <param name="wmode" value="transparent">
   4:   <param name="movie" value="../banner/banner.swf"/>
   5:   <param name="quality" value="high" />
   6:   <embed src="../banner/banner.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="960" height="370" wmode="transparent"></embed>
   7:   </object>
   8:   </div>
I create new param called “wmode” and set its value to “transparent”. In embed tag I specify wmode="transparent" I take the flash object in a div and here is the style for that div.
   1: <style type="text/css">
   2:     #Container
   3:     {
   4:         position: relative; /*or absolute*/
   5:         z-index: 1;
   6:     }
   7: </style>
Now take the Asp Menu in a div and give z-index value higher then we have one in object container div. Also, it is worth to mention here that the flash script generated from Dreamweaver usually contain the following installation script as well which is not compatible to work with this.
   1: <script type="text/javascript">
   1: 
   2: AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','960','height','370','src','file://Path','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','file:///Path' ); //end AC code
</script><noscript>
As I said I am not a flash champ, but at least in my case this code was creating problem. So I preferred to delete this ;)

CLR Integration and Lightweight Pooling Conflict

I thought I am CLR Integration Guru in Sql Server but this morning I came to know that there are lots of things left to grab. While I was moving the local database on the new live server I run some CLR Procedure which Says these procedures required CLR Integration enabled. So to get that done.
I went on SQL Server Surface Area Configuration -> Surface Area configuration for features -> Enable CLR Integration. till here, every thing seems fine I encounter no error.
After that when I re-execute the same query I get a new error:
"Invalid connection (Common languageruntime (CLR) execution is not supported under lightweight pooling.Disable one of two options: "clr enabled or "lightweight pooling".
I really have no idea what the light weight pooling is but the need of the time is to disable it. After googling for a bit I get this link. but still no use as the query written in this page is not working infact it is giving error.
Query:sp_configure 'show advanced options', 1;GOsp_configure 'lightweightpooling', 0;GORECONFIGURE;GO
Error:The configuration option 'lightweightpooling' does not exist, or it may be an advanced option.
To find what is going wrong, I quried on sys.configurations because this table contain database configuration.
select * from sys.configurations where name like '%light%'
Finally, after running the above query I came to know that there is a space in 'lightweightpooling'. It means it is 'lightweight pooling. Now when I diagnose the problem I execute the following query which make my sql server CLR Integrated.
USE masterGOEXEC sp_configure 'show advanced options', 1GORECONFIGURE WITH OVERRIDEGOEXEC sp_configure 'lightweight pooling', 0GOEXEC sp_configure 'clr enabled', 1goRECONFIGURE WITH OVERRIDEGOEXEC sp_configure 'show advanced options', 0GO
After executing the query, we might need to restart the SQL Services to make it work.

Beta Components Detected on SQL Server 2005 Installation

This weekend, I was in Morgan Technologies as they were facing some installation problem in SQL Server 2005 enterprise edition. So they called me up with relation to the community work. So the error was
Errors occurred during the installation:Beta components detected.
It looks that there is some beta software running on the server but after looking at the Program Files and Add Remove Program It seems that there is nothing installed before. No Visual Studio Installation (as that is server) , no Beta stuff. There was .net framework 2.0 installed but to get rid of this error I did uninstall that too.But the error doesnot seems to go. still the beta components deteced comes on screen each time I try to install SQL Server.So, Finally I found Microsoft MSI Cleanup Utility which did my job perfectly. on a clean machine where there is nothing Installed I found two microsoft beta installations, No idea where it came from but this tool remove that and afterward SQL Server installed like a butter with no issue.To download the tool : http://support.microsoft.com/kb/290301

Waking up for Fajr. It Easy!

May Almight ALLAH give all of us the sprit of waking up early in the morning for fajr.