Twitter Feed Popout byInfofru

Long Waited Task in Asp.net

Yesterday, one my my friend ask me a query about sending some 500+ emails using an asp.net page. Sending bulk email using asp.net is obviously an issue. I mean, You cannot keep the page on the post back state for the five minutes. Your page will get expired and even if you increase the Request Timeout period it is still not a good approach.So for that, There are couple of approaches like1. You can have a table in which you store all the emails and create a Windows Service or Schedule Task to read tables of send emails accordingly.2. Open a thread on the server side using delegate and return the page to the browser and show the progress using Asynchronous operation. As We were operating on shared hosting first approach doesn't seem fruitful for us. So, we decided to go with the second approach and for that we use delegates. Let me show you step by step.
1: Public Delegate Sub LongTimeTask_Delegate()2: Private fileName as String
Here I have declared a delegate and a global variable called filename which I will use for getting the status of the process.Now on the click event of my button which start the process. I have write the following code
1: Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click2: Dim rnd As Double = New Random().Next()3: fileName = Session.SessionID & "_" & rnd & ".txt"4: Dim d As LongTimeTask_Delegate5: d = New LongTimeTask_Delegate(AddressOf LongTimeTask)6:  7: Dim R As IAsyncResult8: 9: R = d.BeginInvoke(New AsyncCallback(AddressOf TaskCompleted),nothing)10: Dim strScript As String = "<script language='javascript'> setInterval('GetResult(""" + fileName + """)',2000); </script>"11:  12: Button1.Enabled= False13: Response.Write(strScript) 'TODO : Can take write on literal14: End Sub
On line no 3, I am setting filename variable to the session id and a random numberOn line no 4, Declare and Initialize Delegate and passed a function that will be executed by DelegateOn line no 7 and on, We invoke the delegate and store the result in IAsyncResult and also specify the function that will execute once the delegate is complete.On line no 10, we are writing a script on the page which is there to show us the status of process timely.Now, lets come LongTimeTask function, in which we have the whole stuff.
1: Public Sub LongTimeTask()2: Dim totCount As Integer = 5003: For a As Integer = 1 to totCount4: Try5: If Not File.Exists(fileName)6: File.Create(fileName)7: End If8: using sw As StreamWriter = New StreamWriter(Server.MapPath(fileName))9: sw.WriteLine("Processing " + a.ToString() + " of " + totCount.ToString() + " emails")10: End Using11: Catch 12:  13: End Try14: System.Threading.Thread.Sleep(2000)15: Next16: End Sub
Notice that, system will be in the loop for 500 times and each time before start processing it will update the status which will display to the browser. The Try/Catch block is updating the status where as notice the line no 14 in which I pause the thread. You can add your email sending or other long process stuff here but for me it is enough to sleep the thread for twenty seconds.Let me show you what happen when the task gets finished.
1: Public Sub TaskCompleted(ByVal R As IAsyncResult)2: Try3: using sw As StreamWriter = New StreamWriter(Server.MapPath(fileName))4: sw.WriteLine("Process has been completed successfully <a href='default.aspx'>Click here </a> to go back") 'You might shoot an email or some thing else here5: End Using6: If File.Exists(fileName)7: File.Delete(fileName)8: End If9: Catch 10:  11: End Try12: End Sub
This time, we have updated the status with some other text and a hyper link. You can also have any kind of alert here. This is just the part of the code behind stuff. ASPX file contain the actual Asynchronous logic here is the HTML
1: <form id="form1" runat="server">2: <div>3:  4: <asp:Button ID="Button1" runat="server" Text="Start IAsync" />5: <div id="resultDiv"></div>6: </div>7: </form>
The resultDiv is responsible of showing the status. Now to get the status following Javscript will do the complete magic
1: <script language="javascript">2: var request = false;3: try {4: request = new XMLHttpRequest();5: } catch (trymicrosoft) {6: try {7: request = new ActiveXObject("Msxml2.XMLHTTP");8: } catch (othermicrosoft) {9: try {10: request = new ActiveXObject("Microsoft.XMLHTTP");11: } catch (failed) {12: request = false;13: } 14: }15: }16: 17: function GetResult(filename) {18: var rnd = Math.random() * 1000000;19: var url = filename + '?rnd=' + rnd;20: request.open("GET", url, true);21: request.onreadystatechange = GetResultComplete;22: request.send(null);23: }24: function GetResultComplete() {25: if (request.readyState == 4) {26: 27: if (request.status == 200) {28: var divComm = document.getElementById('resultDiv');29: if (divComm) {30: divComm.innerHTML = request.responseText;31: }32: }33: }34: }35: </script>
There it is ... we are all done. Following is the snapshot of the working long waited task in asp.netasyncYou can find the complete code for Visual Studio 2008 ... cheers

Prevent .js caching in asp.net

This is like a very common issue, specially for those who are working on public site which is live and they have to release the builds every week or month and if the new build contain JS files then your change will not reflect on the client browser until someone there presses ctrl + F5.So, after googling this issue. I came to know it is possible to prevent the browser from accessing the cache copy by writing the script tag as below
   1: <script type="text/javascript" src="../Includes/main.js?random=556"></script>
 It is good, when I have a single or some number of pages to change. Unfortunately, That is not the case I have hundreds of pages and that will be hassle to make those changes again and again for every build. So, I try to make this thing happen using Response Filter.

Create Response Filter:

So, to write the Response Filter we need to create a class and which is extended from Stream (System.IO.Stream) and I named it BuildTokenFilter.
   1: Imports Microsoft.VisualBasic
   2: Imports System.IO
   3: Imports System.Text.RegularExpressions
   4: Imports System.Configuration
   5: 
   6: 
   7: Public Class BuildTokenFilter
   8:     Inherits Stream
   9:     Private _responseStream As Stream
  10:     Public Sub New(ByVal responseStream As Stream)
  11:         _responseStream = responseStream
  12:     End Sub
  13:     Public Overrides ReadOnly Property CanRead() As Boolean
  14:         Get
  15:             Return _responseStream.CanRead
  16:         End Get
  17:     End Property
  18:     Public Overrides ReadOnly Property CanSeek() As Boolean
  19:         Get
  20:             Return _responseStream.CanSeek
  21:         End Get
  22:     End Property
  23: 
  24:     Public Overrides ReadOnly Property CanWrite() As Boolean
  25:         Get
  26:             Return _responseStream.CanWrite
  27:         End Get
  28:     End Property
  29: 
  30:     Public Overrides Sub Flush()
  31:         _responseStream.Flush()
  32:     End Sub
  33: 
  34:     Public Overrides ReadOnly Property Length() As Long
  35:         Get
  36:             Return _responseStream.Length
  37:         End Get
  38:     End Property
  39: 
  40:     Public Overrides Property Position() As Long
  41:         Get
  42:             Return _responseStream.Position
  43:         End Get
  44:         Set(ByVal value As Long)
  45:             _responseStream.Position = value
  46:         End Set
  47:     End Property
  48: 
  49:     Public Overrides Function Read(ByVal buffer() As Byte, ByVal offset As Integer, ByVal count As Integer) As Integer
  50:         Return _responseStream.Read(buffer, offset, count)
  51:     End Function
  52:     Public Overrides Function Seek(ByVal offset As Long, ByVal origin As System.IO.SeekOrigin) As Long
  53:         _responseStream.Seek(offset, origin)
  54:     End Function
  55: 
  56:     Public Overrides Sub SetLength(ByVal value As Long)
  57:         _responseStream.SetLength(value)
  58:     End Sub
  59:     Public Overrides Sub Write(ByVal buffer() As Byte, ByVal offset As Integer, ByVal count As Integer)
  60:         Dim strRegex As String = "src=(?<Link>.*js)"
  61:         Dim BuildTokenString As String = "?token=" & IIf(ConfigurationManager.AppSettings("BuildToken") = Nothing, "1.0", ConfigurationManager.AppSettings("BuildToken"))
  62:         Dim objRegex As New Regex(strRegex)
  63:         Dim html As String = System.Text.Encoding.UTF8.GetString(buffer)
  64:         Dim extCharCount As Integer = 0
  65: 
  66:         Dim objCol As MatchCollection = objRegex.Matches(html)
  67:         For Each m As Match In objCol
  68:             extCharCount += BuildTokenString.Length
  69:             Dim newJSValue As String = m.Value & BuildTokenString
  70:             html = html.Replace(m.Value, newJSValue)
  71:         Next
  72:         buffer = System.Text.Encoding.UTF8.GetBytes(html)
  73:         _responseStream.Write(buffer, offset, count + extCharCount)
  74:     End Sub
  75: End Class
"Write" is the function which is doing the whole stuff. It is really simple to understand. Let me go linewise.
60. Create a string variable and assign and regular expression which will search all the js files tags in html61. Create a string which will append to the JS file. Checking the App key in web.config So that the token can be extended in future.62. Create a Regex Object63. Get the html from Buffer64. Create an integer variable which will keep track of the characters that are added to the html variable. 66. Save the matches in a collection67. Get each mach object from Match Collection68. Add the character count which will added to the html variable69. Create a variable and assign value of match and concatenated with build token70. Replace the old value with the new with build token in html variable72. Encode the html variable back to the buffer73. Write the buffer to the stream by adding count with build token character count.
Now lets create a HttpModule which will responsible of attaching this response filter with every request.

Create HttpModule:

Now to write HttpModule, I will create a class which will Implements IHttpModule (interface) and I name it "BuildToken"/
   1: Imports Microsoft.VisualBasic
   2: Imports System.Web
   3: Public Class BuildToken
   4:     Implements IHttpModule
   5:     Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
   6: 
   7:     End Sub
   8:     Public Sub Init(ByVal context As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
   9:         AddHandler context.BeginRequest, AddressOf Application_BeginRequest
  10:     End Sub
  11:     Private Sub Application_BeginRequest(ByVal source As Object, ByVal e As EventArgs)
  12:         Dim context As HttpApplication = CType(source, HttpApplication)
  13:         If context.Request.RawUrl.Contains(".aspx") = True Then
  14:             context.Response.Filter = New BuildTokenFilter(context.Response.Filter)
  15:         End If
  16:     End Sub
  17: End Class
 In this case the magical function is Application_BeginRequest which can easily be understand but the question might arises why I have put the If condition on line number 13. Well, I don't want my module to attach response filter against all the files. Keep in mind, HttpModule is always called no matter what content type are you requesting. when somebody write http://www.sitename.net/images/border2.jpg it will still process through HttpModule and that is what I don't want.

Configuration Setting:

We are almost done, just a web.config entry is left which we keep for the modification of token string.
   1: <appSettings>
   2:     <add key="BuildToken" value="7.0"/>
   3: </appSettings>
 

Test the filter:

Now to check the the response filter create a page that is called default.aspx and paste the following markup
   1: <html xmlns="http://www.w3.org/1999/xhtml" >
   2: <head runat="server">
   3:     <title>Untitled Page</title>
   4:     <script type="text/javascript" src="../Script/samain.js"></script>
   1: 
   2:     <script type="text/javascript" src="../ControlsScripts/preloadshare.js">
   1: </script>
   2:     <script type="text/javascript" src="../Script/mainview.js">
</script>
   5: </head>
   6: <body>
   7:     <form id="form1" runat="server">
   8:     <div>
   9:     <p>
  10:     Right click and view source you will find JS files with query string</p>
  11:     </div>
  12:     </form>
  13: </body>
  14: </html>
Now Run the application and view source the page you will notice some thing like give below.sc_responsefiltercacheEach time, when you made some changes in JS file just change Build Token entry in the web.config file and your visitors will get the updated copy of JS. You can also download the project files.

Different Style for IE7 and Firefox in CSS

Well, I with my designer Atiq was trying to set the a div which is working fine in IE7 but when it comes to Firefox, it was asking us to give the margin-top:10px. when we put that, the div comes down in IE7. So, in this situation we need to specify two different styles for these two browsers.

I don't want to use that, which can also be done using the following HTML.

   1: <!--[if IE 7]><link rel="stylesheet" type="text/css" href="IE7styles.css" /><![endif]--> 

But I don't want to create two css files for this work. Somehow, I want to mage it in the name same CSS. So what I did is so I use Child Selector Command and Star HTML Hack.

Child Selector Command is not understandable by IE, hence whenever it gets something like this .... IE Ignores the style. So I decided to specify Firefox stuff here. it looks like as follows

   1: html>body #ContainerCodeQuestionAnser
   2: {
   3:     position:absolute; z-index:50;background-color:#FFFFFF;width:auto;
   4:     height:20px;margin-left:10px;overflow:hidden;top:10px; /*top is for firefox*/
   5:     }

In contrast, Star HTML Hack is not understandable by any other browser except IE. So IE Stuff Goes here.

   1: * #ContainerCodeQuestionAnser
   2: {
   3:     position:absolute; z-index:50;background-color:#FFFFFF;width:auto;
   4:     height:20px;margin-left:10px;overflow:hidden;
   5:     }

That's it ... the design looks really good.......

How to change default button of a form

Often, we have condition when we have multiple forms on a page which have multiple submit buttons as well. Whenever, you press enter on any text box it will call the command button which is at top most sequence of command buttons.

So, to overcome this problem here is the little code. Take your each set of fields and button in a panel and specify the default Button Property. In the example below I have a form which have two buttons one is command button and another is an image button and I am setting the second button of the sequence to get called each time enter key press on the panel. (rather then the top most)

   1: <asp:Panel ID="pnl1" runat="server" DefaultButton="ImageButton1">
   2:         <asp:TextBox ID="TextBox1" runat="server">
   3:         </asp:TextBox>
   4:         <asp:Button ID="Button1" runat="server" Text="Submit" />
   5:         <asp:ImageButton ID="ImageButton1" runat="server" />
   6:     </asp:Panel>

Validate username using custom validation (AJAX)

In this post, I will explain you how to have an ajax call on custom validator control and check for the username in the database. This task will include two pages one is the form page (default.aspx in our case) in which we have the custom validator and the other one is the page which we call through AJAX to give us the result (validateUser.aspx). You can also have a web service instead of that page but in my scenario , I am using ASPX page.

So, the form will look like as following.

 

   1: <form id="form1" runat="server">
   2: <div>
   3: <asp:Panel ID="pnl1" runat="server" DefaultButton="Button1">
   4:     <asp:TextBox ID="TextBox1" runat="server">
   5:     </asp:TextBox>
   6:     <asp:Button ID="Button1" runat="server" Text="Submit" />
   7:     <asp:HiddenField ID="hfOutput" runat="server" />
   8: </asp:Panel>
   9:     <asp:customvalidator ID="Customvalidator1" runat="server" errormessage="Enter Valid User" ControlToValidate="TextBox1" ClientValidationFunction="ValidMe"></asp:customvalidator>    
  10: </div>
  11: </form>

Default.aspx (Form)

Notice, the hiddent field called hfOutput which we will use to store the output of the AJAX call.

Where as the page which we call through AJAX will look like as follows

   1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="validateUser.aspx.cs" Inherits="LearnWebApp.validateUser" %>

validateUser.aspx

In short, we have deleted every thing from this page except page directive. Now if we call this page we will see the simple output without having any HTML tag. we did it because we want to get rid from all the html tags so that we can have a neat and clean output at the time we call this page from Javascript (AJAX). What we want this page to return us is either "True" or "False". If you look at the code behind file of this page you will have a good idea of what we actually upto. Here is the code for that.

   1: protected void Page_Load(object sender, EventArgs e)
   2:         {
   3:             // We can also use a database call here ... right now we are compairing string.
   4:             if (Request.QueryString["username"] == "username")
   5:             {
   6:                 Response.Write("true");
   7:             }
   8:             else 
   9:             {
  10:                 Response.Write("false");
  11:             }
  12:         }

validateUser.aspx.cs

As it is there on comments, here we are only comparing string. You can have a database call and return the result accordingly.

To call the validateUser.aspx from validMe function which we have defined in ClientValidationFunction property of custom validator, we need to write the following javascript on default.aspx

   1: <script type="text/javascript">
   2:         var ajaxCalled = false;
   3:         
   4:         function ValidMe(source, args) {
   5:            callPage(args.Value)
   6:            while (document.getElementById("hfOutput").value != ""){
   7:                 if (document.getElementById("hfOutput").value == "true") {
   8:                     args.IsValid = true;
   9:                 }
  10:                 else {
  11:                     args.IsValid = false;
  12:                 }
  13:                 document.getElementById("hfOutput").value = "";
  14:                 return;
  15:             }
  16:         }
  17:  
  18:         function callPage(strName) {
  19:             var rnd = Math.random() * 1000000;
  20:  
  21:             if (window.XMLHttpRequest) { // Mozilla, Safari, IE7...
  22:                 request = new XMLHttpRequest();
  23:             } else if (window.ActiveXObject) { // IE6 and older
  24:                 request = new ActiveXObject("Microsoft.XMLHTTP");
  25:             }
  26:             var url = 'validateUser.aspx?username=' + strName + '&R=' + rnd;
  27:             request.open("GET", url, true);
  28:             request.onreadystatechange = SetPage;
  29:             request.send(null);
  30:             
  31:         }
  32:  
  33:  
  34:         function SetPage() {
  35:             if (request.readyState == 4) {
  36:                 var objHf = document.getElementById("hfOutput");
  37:                 if (request.status == 200) {
  38:                     if (objHf) {
  39:                         objHf.value = request.responseText;
  40:                     }
  41:                 }
  42:             }
  43:             
  44:         }
  45:     </script>

 

Let me describe what we have done here, I am calling CallPage function from ValidMe which will call from the asp.net validation mechanism. CallPage function is an AJAX call which will call validateUser.aspx and SetPage function will be called once the AJAX call is finish and we have output ready to use.

And on that SetPage function we are setting the Hidden field  called hfOutput to get used by ValidMe function.

That's it ..... :) . You can also download the complete project give below.

Get Current Time Using JavaScript

Here is the quick code to get the current time in 12 hours format using JavaScript.

   1: <script language="javascript">
   2: function getTime() {
   3:     var dTime = new Date();
   4:     var hours = dTime.getHours();
   5:     var minute = dTime.getMinutes();
   6:     var period = "AM";
   7:     if (hours > 12) {
   8:         period = "PM"
   9:     }
  10:     else {
  11:         period = "AM";
  12:     }
  13:     hours = ((hours > 12) ? hours - 12 : hours)
  14:     return hours + ":" + minute + " " + period
  15: }
  16: </script>

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 ................