tag:blogger.com,1999:blog-96376282024-03-07T14:59:25.689+05:00My blogSyed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.comBlogger25125tag:blogger.com,1999:blog-9637628.post-7192550878482669602008-11-13T12:39:00.004+05:002009-12-02T18:56:57.738+05:00Blog moved to WordPressI have moved this blog to WordPress. Please refer to <a href="http://smehrozalam.wordpress.com/">http://smehrozalam.wordpress.com/</a> for further posts.<br /><br />Have a nice day.Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com1tag:blogger.com,1999:blog-9637628.post-72223830919566529782008-11-06T11:41:00.007+05:002010-02-16T12:27:22.293+05:00SSIS: How to use a query containing table variables for an OLE DB SourceFor a more recent version, please visit: <a href="http://smehrozalam.wordpress.com/2008/11/06/ssis-how-to-use-a-query-containing-table-variables-for-an-ole-db-source/">http://smehrozalam.wordpress.com/2008/11/06/ssis-how-to-use-a-query-containing-table-variables-for-an-ole-db-source/</a><br /><br />This one consumed a lot of my brain energies yesterday. I was working on some Sql Server Integration Services task and needed to create a complex query containing table variables. The query was working fine in SQL Management Studio and the SSIS designer was even previewing the data correctly. But when the task was actually executed, the query did not return any rows. I posted a question on TechNet forums and got an answer from Charles Talleyrand <a href="http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=4090433&SiteID=17">here</a>. Actually, I needed a <code>SET NOCOUNT ON</code> statement. Let me explain using an example:<br /><br />Say, I want to create a table variable (not a temp table), populate it and then use the result set as an input for an OLE DB Source. Here's a sample query for this:<br /><br /><code><br />declare @mytable table<br />(<br /> <wbr>col1 int,<br /> <wbr>col2 varchar(20)<br />)<br /><br />insert @mytable values (1, 'one')<br />insert @mytable values (2, 'two')<br />insert @mytable values (3, 'three')<br /><br />select * from @mytable<br /></code><br /><br />The SSIS designer will correctly identify the column names from the above query and even display the data if you click on the Preview button. But when the task is executed, no rows will be returned. I think the output of insert statements: i.e. 1 row(s) affected was the source of problem and so a <code>SET NOCOUNT ON</code> prevented such interferences. Hooray!! So if you are ever working on some SSIS Data Transfer Task and want to use table variables inside your query, make sure you do not forget the <code>SET NOCOUNT ON</code> statement.Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com7tag:blogger.com,1999:blog-9637628.post-18105831179282715032008-10-29T10:20:00.002+06:002008-10-29T10:28:05.958+06:00More controls for Silverlight: Silverlight Toolkit ReleasedMicrosoft has released some new controls for Silverlight 2 with full source codes. These new controls include:<br /><ul><li>AutoCompleteBox<br /></li><li>Chart<br /></li><li>DockPanel<br /></li><li>Label<br /></li><li>Expander<br /></li><li>TreeView<br /></li><li>UpDown<br /></li><li>ViewBox<br /></li><li>WrapPanel<br /></li><li>ImplicitStyleManager<br /></li><li>Themes</li><br /></ul>Check out: <a href="http://www.codeplex.com/Silverlight">http://www.codeplex.com/Silverlight</a>Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com0tag:blogger.com,1999:blog-9637628.post-16549176049833842492008-10-08T12:13:00.003+06:002008-10-08T12:18:54.165+06:00Command Prompt Here optionDevelopers typically need a quick shortcut to opening command prompt in any folder they want. Here's what I personally use:<br /><br />Create a new file AnyName.reg and edit it to enter the following text:<br /><code>Windows Registry Editor Version 5.00<br />[HKEY_CLASSES_ROOT\Directory\shell\OpenNew]<br />@="Command Prompt Here"<br />[HKEY_CLASSES_ROOT\Directory\shell\OpenNew\Command]<br />@="cmd.exe /k cd %1"</code><br /><br />Run the file to update the registry. Now, you will get a "Command Prompt Here" option whenever you right click on any folder.Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com1tag:blogger.com,1999:blog-9637628.post-403795099104358902008-09-29T14:05:00.003+06:002008-09-29T14:15:11.517+06:00mscorsvw.exe taking up 100% cpu after VS2008 SP1Today, when I installed VS2008 SP1 on my office PC, I noticed that one of my cores are totally captured by mscorsvw.exe. A quick google search reveled that this service is used to precompile .NET assemblies. If you ever encounter this, then run <code>ngen.exe executequeueditems</code>, this will compile all the queued assemblies, followed by a restart. After reboot, your CPU will return to normal. Hoooray.<br /><br />Reference: <a href="http://blogs.msdn.com/davidnotario/archive/2005/04/27/412838.aspx">David Natario's WebLog</a>Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com0tag:blogger.com,1999:blog-9637628.post-50662132886927809992008-09-26T13:00:00.003+06:002008-09-26T13:05:58.871+06:00Silverlight 2 RC0 ReleasedFinally, the first public release candidate version has been released. InshaAllah, I will have more posts on this after Ramadhan.<br /><br />A few links:<br />Official site: <a href="http://silverlight.net/GetStarted/sl2rc0.aspx">http://silverlight.net/GetStarted/sl2rc0.aspx</a><br />ScottGu's blog: <a href="http://weblogs.asp.net/scottgu/archive/2008/09/25/silverlight-2-release-candidate-now-available.aspx">http://weblogs.asp.net/scottgu/archive/2008/09/25/silverlight-2-release-candidate-now-available.aspx</a>Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com0tag:blogger.com,1999:blog-9637628.post-76323188593974566542008-08-12T11:13:00.005+06:002008-08-25T16:07:15.807+06:00Silverlight article posted at CodeProjectAt last, I was able to complete and post my article: "My First Data Application in Silverlight" at CodeProject here: <a href="http://www.codeproject.com/KB/silverlight/MySilverlightDataApp.aspx">http://www.codeproject.com/KB/silverlight/MySilverlightDataApp.aspx</a><br />This one is a detailed article intended for beginners starting Silverlight. It discusses how data from a database can be retrieved and displayed in a silverlight application. It discusses how LINQ objects are returned using a WCF service and consumed in a silverlight application. On the layout side, it looks at the ListBox and DataGrid and provides an introduction to the data templates too. I think that most of the silverlight programmers have past experience of ASP.NET so I also discussed the similarities between ASP.NET and Silverlight. I hope people will find this article beneficial.Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com0tag:blogger.com,1999:blog-9637628.post-85266585765337810302008-08-07T11:26:00.007+06:002008-08-25T16:06:26.733+06:00Silverlight-enabled WCF Service templateBefore Beta 2 of silverlight 2, we needed some tweaks with the standard WCF service template to use it in our silverlight application. But luckily, the new Silverlight-enabled WCF Service template does the job lot easier for us. Now we just need to define our methods(marked with OperationContract atribute) in the service.svc.cs file and we are ready to consume it. No need to change the binding configuration to basicHttpBinding, no need to add ASP.NET compatibility support in special cases, no need to define method signatures in a separate contract file. Just use the new template and use the service in your silverlight application without any worries.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIIbc4zYIKxrM7jdkwR3cfbq8bW18Z5uXi8Em10Ozzc4MpOKhtIUXg3FzCZ3NknsJWs02N9aXpp-UYgrlRLm8NmR4J8T5hJmrTtkmXCU4kEN1vt3fXD__pgK28ThBBugUoWBul/s1600-h/image6.jpg"><img style="cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIIbc4zYIKxrM7jdkwR3cfbq8bW18Z5uXi8Em10Ozzc4MpOKhtIUXg3FzCZ3NknsJWs02N9aXpp-UYgrlRLm8NmR4J8T5hJmrTtkmXCU4kEN1vt3fXD__pgK28ThBBugUoWBul/s320/image6.jpg" alt="" id="BLOGGER_PHOTO_ID_5231646742237575650" border="0" /></a>Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com0tag:blogger.com,1999:blog-9637628.post-66225030979986862262008-08-04T11:57:00.005+06:002008-08-05T16:45:10.147+06:00I won a Silverlight competitionI am very glad to announce that yesterday, 4th of August, I stood first in a silverlight competition held at Sir Syed University of Engineering and Technology. In the 8 hour competition, the participants were asked to make a custom control "Drag and Drop Shopping Cart" in Silverlight 2 Beta 2. Here were the prizes I got:<br /><ul><li>MSDN Premium Subscription for 1 Year (Total Market Value: $10, 939)</li><li>10,000 Rupees cash</li></ul>It was a very wonderful experience. I will soon post my code here.Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com10tag:blogger.com,1999:blog-9637628.post-38765659500777098532008-07-24T18:17:00.005+06:002008-08-18T23:18:11.669+06:00Assign percentage width to a column in silverlight gridI was wondering how can I define the column widths for a silverlight/WPF grid with percentages like we use to define in html tables. <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.columndefinition.width%28VS.95%29.aspx">This</a> msdn document was quite helpful. Let me paste the important part here. The width attribute can take three type of values:<br /><ul><li><span style="font-weight: bold;">doubleValue</span>: The column's width, expressed as a floating-point value for a pixel count. Typically this is given as an integer, although interpolation of floating-point values is supported by grid layout.</li><li><span style="font-weight: bold;">starSizing</span>: A convention by which you can size rows or columns to take remaining available space in the Grid. A starSizing always includes the literal character *, and optionally precedes the * with an integer value that specifies what share of available space should be given as a weighted factor versus other possible star sizings (for example, 3*).<br /></li><li><span style="font-weight: bold;">Auto</span>: The column's width, described by the literal Auto.<br /></li></ul>So this is how we can define a grid with two equally divided rows and three columns divided in the ratio 1:2:3:<br /><br /><Grid><br /> <Grid.RowDefinitions><br /> <RowDefinition Height=".5*"></RowDefinition><br /> <RowDefinition Height=".5*"></RowDefinition><br /> </Grid.RowDefinitions><br /> <Grid.ColumnDefinitions><br /> <ColumnDefinition Width="1*"></ColumnDefinition><br /> <ColumnDefinition Width="2*"></ColumnDefinition><br /> <ColumnDefinition Width="3*"></ColumnDefinition><br /> </Grid.ColumnDefinitions><br /></Grid> <br /><br />The .5* in the row height can be changed to any value but both values must be same to make sure the rows are divided evenly.Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com3tag:blogger.com,1999:blog-9637628.post-90093493391852309102008-07-10T17:24:00.001+06:002008-08-25T16:04:56.587+06:00Transposing an excel sheetToday, I came across a problem where I needed to transpose data inside an excel sheet. After some Google search, I was able to achieve it like this:<br /><br /><ul><li>Select the data you wish to transform</li><li>Copy it to clipboard</li><li>In a new worksheet (or file), right click and select "Paste Special"</li><li>Check the "Transpose" checkbox and hit Ok.</li></ul><br />Thats all......Now you use "Filters" on the columns (that were previously rows).Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com0tag:blogger.com,1999:blog-9637628.post-90203994709380370832008-07-09T16:31:00.000+06:002008-07-09T16:33:37.161+06:00Coming soonMy blog will be re-active soon. Stay tuned for new posts.<br /><br />Thank you.Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com0tag:blogger.com,1999:blog-9637628.post-1136091345751759442006-01-01T09:49:00.001+05:002008-07-10T22:59:51.114+06:00I am now a Microsoft Certified ProfessionalIts a long since I last updated by blog. Reasons were my exams and ofcourse, my usual laziness. But now I have come with a thrilling news.<br />Oh...I cant believe it.. I have cleared the Microsoft certification, "Developing and Implementing Windows-Based Applications with Microsoft Visual C# .NET and Microsoft Visual Studio .NET" (Exam 70-316), by securing 940/1000 marks on 29 December 2005.<br />The questions were much hard but thanks God, I was able to do that.Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com1tag:blogger.com,1999:blog-9637628.post-1110867228917181732005-03-15T11:08:00.000+05:002005-03-15T11:13:48.916+05:00Victory in Softec 2005We got 3rd position in All Asia Dynamic Programming Competition. My other two team members were Faisal and Usman. We were first upset to know that C# was not allowed, then we starting coding in VC++ and yeah, we were able to beat 50+ teams in a tough competition of 5 hours.Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com3tag:blogger.com,1999:blog-9637628.post-1110866809044138332005-03-03T11:02:00.000+05:002005-03-15T11:06:49.046+05:00Article Update: Maze Solver in C#Check out <a href="http://www.codeproject.com/csharp/MazeSolver.asp">http://www.codeproject.com/csharp/MazeSolver.asp</a> for an updated version of my MazeSolver article. The article now describes the internal working of my class. I hope this version will help you to understand my logic.Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com0tag:blogger.com,1999:blog-9637628.post-1110866536195204282005-02-25T10:58:00.000+05:002005-03-15T11:02:16.196+05:00New article: Analog clock control in C#Visit <a href="http://www.codeproject.com/cs/miscctrl/AnalogClockControl.asp">http://www.codeproject.com/cs/miscctrl/AnalogClockControl.asp</a> for my new article. It is a step-by-step guide on how to make a clock control in C#. The article contains much description and pictures. I hope you will like this.Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com1tag:blogger.com,1999:blog-9637628.post-1110866316767437712005-02-22T10:54:00.000+05:002005-03-15T10:58:36.770+05:00VB Graph Plotter UpdatedI have updated the VB version of Graph Plotter. Now it is a nice application with many new features e.g. Selecting a range for a Graph, Copying a graph to clipboard, Printing it, Saving it as bitmap file, and much more. I highly recomment to take a look at <a href="http://www.geocities.com/smehrozalam/files/graphvb.zip">http://www.geocities.com/smehrozalam/files/graphvb.zip</a>Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com0tag:blogger.com,1999:blog-9637628.post-1107973397114927112005-02-09T23:21:00.000+05:002005-02-09T23:23:17.113+05:00PROCOM 2005I went for PROCOM with two of my fellows, Usman and Faisal. On the first day, there were two trial sessions. We stood 8th in the very first session but then we gathered our distributed skills and yeah, we stood 1st in the 2nd trial session. On the second day, there was only one session of 3 hours. All the participating teams including us could solve only 3 problems out of given 6. We were the first one to solve those 3 problems but Ah.... Some penalty points kept us far from first 3 rankings. We were not much upset and InshaAllah we’ll make a remarkable victory in the upcoming Softec Competition in Lahore.
<br />Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com1tag:blogger.com,1999:blog-9637628.post-1106455152299391562005-01-23T09:33:00.000+05:002005-01-23T09:39:12.300+05:00Participation in Procom 2005I have registered to participate in the Software and Programmming competetion organized by "Fast". I registered myself with Faisal and Usman for Programming competetion while with Sajjad, Asad, Tanveer and Zeeshan for Software competetion. Lets see how well we do there.
<br />Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com0tag:blogger.com,1999:blog-9637628.post-1103865445991739292004-12-24T10:17:00.001+05:002004-12-24T10:17:25.990+05:00MazeSolver It was a difficult problem to find a shortest path in a 2D Maze. During my second year exams, I got a mail in which I was asked to write a program for this. I started to think but first no solution could come into my mind, but soon I thought that this could be done using graphs. The maze is similar to a graph, with every element of the maze (node) adjacent to its left, right, top and bottom nodes. After this I applied simple breadth first search to find the shortest path.
<br />Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com2tag:blogger.com,1999:blog-9637628.post-1103865241823868952004-12-24T10:13:00.000+05:002004-12-24T10:14:01.823+05:00Matrix and Fraction classesI always get confused when performing row operations in a Matrix. But matrices were a great portion of our Maths-III course, as well as our Economics’ Linear programming section. Hence I needed a program which could tell me at when I was doing mistakes. The solution was simple, just to download any matrix application. But the problem was that all matrix programs I got, worked on floating point numbers and in our class problems we have to consider the exact values using fractions. I therefore needed a matrix application which could show results in a fraction format, but I didn’t found any. At that time we learned how to represent real world objects in a programming language and we did the example of a fraction class in our OOP course. I further enhanced that idea and was able to develop a fraction class and later on, a matrix using the fraction class. I incorporated all my needs and it worked fine. Then I uploaded the classes on GotDotNet<<a href="http://www.gotdotnet.com/">www.gotdotnet.com</a>> and other similar sites and yes, I was able to further improve my classes with the help of user responses. I finally posted two articles on CodeProject<<a href="http://www.codeproject.com/">www.codeproject.com</a>> and user responses were wonderful. I finally thank all of those who were helpful starting from Sir Saqib Ilyas to Jeffrey, Marc and other fellows.
<br />Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com0tag:blogger.com,1999:blog-9637628.post-1103865144434711802004-12-24T10:04:00.000+05:002004-12-24T10:12:24.433+05:00Second year in the universityThere were two subjects related to programming in Second year: Data Structures and Object Oriented Programming using C#. Object oriented programming was taught by Sir Saqib Ilyas. He was a skilled teacher and told us the ups and downs of .Net framework and C#, from inheritance to polymorphism, from delegates to events, from Abstract classes to interfaces, from persistence(FileIO) to serialization, from Exception throwing to Exception handling, and many more. As a practice, I wrote my Fraction and Matrix classes to aid in mathematics problems. My final project was to develop an Address Book in C# which I did along with other group members.Data Structures was taught by Sir Zaffar Qasim. He was an experienced teacher and taught us useful stuff to enhance our programming skills, from Arrays to linked lists, from stacks to queues, from trees to graphs, from searching to sorting, and much more. I, after my exams, put Data Structures in practice by making a MazeSolver which finds the shortest path between two nodes in a 2D Maze.
<br />Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com0tag:blogger.com,1999:blog-9637628.post-1103863882519735122004-12-24T09:45:00.000+05:002004-12-24T09:51:22.520+05:00First year in the universityIn the first year of engineering, we were taught C by Madam Humera Noor. She was a nice teacher and introduced us about every element of C, from basics to advanced, from Text mode to Graphics, from structures to unions, from File IO to port addressing, from Pointers to variables to pointers to functions, and many more. I was able to make some logic games in C. As the final project of C, I made a Graph Plotter which was very appreciated by teachers and class fellows. The program inputs an expression from user and plots its graph in rectangular as well as polar mode. I further transformed the same program in VB also.
<br />Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com2tag:blogger.com,1999:blog-9637628.post-1103860462573382882004-12-24T08:52:00.000+05:002004-12-24T08:54:22.573+05:00Some words about my programming in early stagesI started to do programming when I was 12. At that time, I used to program in BASIC. Then, I learned some COBOL by seeing my brother programming in COBOL and a little VB as well. When I was 16, I participated in the National Software Competition held by CSP(Computer Society of Pakistan) in collaboration with Phillips. Alhamdulillah, I got 1st prize in it. Then I was sent to Singapore by CSP along with two other fellows, Zeeshan Zia and Ashar Akhtar. We participated in the ISSC(International Schools Software Competition). That was a nice trip, although we could not get any good ranking there.
<br />Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com0tag:blogger.com,1999:blog-9637628.post-1103171405141439952004-12-16T10:26:00.000+05:002004-12-16T09:30:05.140+05:00My first messageWelcome to my blog. Here I will be posting my activities related to programming. Please check back soon.
<br />Syed Mehroz Alamhttp://www.blogger.com/profile/17198347155403197968noreply@blogger.com0