by Saurabh
4. May 2009 20:03
I was installing Visual Studio 2008 sp1 on my fresh installation of Windows 7 RC, when my installation failed with an "Operation Aborted" message, and there's a strong chance that almost everyone trying to install VS 2008 sp1 on a X86 machine would encounter it. I found on stackoverflow that deleting the following key - HKLM\SOFTWARE\Microsoft\SQMClient\Windows\DisabledSessions or other equivalent methods like renaming the key works like a cinch.
It seems to be the same "SQM bug" discovered by Rafael Rivera and reported by multiple bloggers including Paul Thurrott. And I'd agree with him that claiming "Machine Throttling" is causing the failure is a bit of a stretch, as I noticed that I didn't had "MachineThrottling" under HKLM\SOFTWARE\Microsoft\SQMClient\Windows\DisabledSessions. So although WinSqmStartSession() in ntdll.dll did crash on my system it didn't happen because MachineThrottling was enabled in the registry.
by Saurabh
22. January 2008 20:55
Couple of years ago I did a blog post about using PostBackUrl with PHP. Although the code sample I used as illustration was a ASP.net page in it's simplest form, real world ASP.net pages aren't as simple as that. Almost any ASP.net web app that does a little more than just input some form data and flush it out would be doing so with the help of user controls and/or Master Pages. This complicates the HTML form entity names as it prefixes the user specified IDs with a number of _ (underscores) and $ signs.
So how can your PHP script read form data when element names ain't that simple anymore? Allow me to illustrate. Say we have a very basic Master page like this:
1: <%@ Master Language="C#" AutoEventWireup="true" CodeFile="verybasic.master.cs" Inherits="Masters_verybasic" %>
2:
3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4:
5: <html xmlns="http://www.w3.org/1999/xhtml" >
6: <head runat="server">
7: <title>Untitled Page</title>
8: </head>
9: <body>
10: <form id="form1" runat="server">
11: <div style="clear: both; width: 100%; text-align: center;">MASTER HEADER. <br />
12: <asp:CheckBox ID="CheckBox1" runat="server" Text="Master's chkBox" /></div>
13: <div>
14: <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
15: </asp:contentplaceholder>
16: </div>
17: </form>
18: </body>
19: </html>
And we have a simple webform that uses the above master:
1: <%@ Page Language="C#" MasterPageFile="~/Masters/verybasic.master" AutoEventWireup="true" CodeFile="p2php.aspx.cs" Inherits="p2php" Title="Post To PHP" %>
2: <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
3: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
4: <br />
5: <asp:Button ID="Button1" runat="server" Text="Submit" PostBackUrl="catchpostback.php" />
6: </asp:Content>
To read values of controls that are part of the Master page, the form itself or user controls, we will exploit the fact that in all such cases the form elements are "prefixed" with their containers and a bunch of underscores & dollar signs to the original developer specified control IDs. We can build a function similar to the one below:
1: function getFormVar($var,$isPostBack = false)
2: {
3: $retVal = "";
4: if($isPostBack == true)
5: {
6: $var = $var.'$';
7: foreach($_POST as $key => $r)
8: {
9: if(ereg($var,$key))
10: return $_POST[$key];
11: }
12: return "";
13: }
14: else
15: {
16: if(isset($_REQUEST[$var]))
17: {
18: return $_REQUEST[$var];
19: }
20: else
21: return $retVal;
22: }
23: }
To read the value of a control say TextBox1 you do something like this: $myvar = getFormVar("TextBox1",true);
The function getFormVar can read regular form elements as if they were from a PHP or HTML page, but when the 2nd parameter is set to true it loops through the POST variables and returns the value of the element of a ASP.net control (buried inside a user control or a master page) while you only specify the control ID you used in the ASP.net itself.
Some tidbits of this function you should know:
- Although it gets you started, this function is not a complete solution. For example if the form element you want to read is part of a user control which has more than one instances on the page, it will fail flat out. But you can easily change the regex to enable reading in those cases.
- I used ereg() instead of preg_match() (comparatively fast) in my function as preg_match() might not be available on many setups.
A complete working demo can be downloaded from here.
There's one more thing that's pretty interesting IMO; ASP.net posts the entire form to the target page specified in PostBackUrl and of course __EVENTTARGET is empty!

by Saurabh
10. January 2008 20:51
The beauty of PHPLiveX is its astute simplicity that makes it among the best AJAX libraries for PHP. The dev team has now shifted to focus to PHP5, so ver. 2.3 is the last version for PHP4. Although a bit late, it was realized that for the sae of brevity and maintaining clean & tidy code support for outputting the javascript to a file rather than inline was made. Only a minor version too late for developers working on PHP4 code. So although folks using PHPLiveX 2.4 and above get to enjoy a more readable HTML output, the ExternalJS property is not supported by any official build for PHP4. But adding it is surprisingly easy!
I have been working to AJAXify an old PHP4 app on client insistence, this app is deployed on PHP4 and hence cannot use ExternalJS property. And I like my HTML to tidy up. So this is what I did to add ExternalJS to PHPLiveX 2.3 that was used in the project.
Start by adding a new property ExternalJS to the class. And then modify the Run method to something like this:
1: function Run(){
2: $html = $this->CreateJS();
3: for($i=0;$i<count($this->FList);$i++){
4: $html .= $this->CreateFunction($this->FList[$i]);
5: }
6: if(empty($this->ExternalJS)){
7: echo "<script type='text/javascript' language='javascript'>" . $html . "</script>";
8: }
9: else{
10: if(!file_exists($this->ExternalJS)){
11: $fp = fopen($this->ExternalJS, "w");
12: if($fp != false){
13: fwrite($fp, $html);
14: fclose($fp);
15: }
16: else
17: echo "<script type='text/javascript' language='javascript'>" . $html . "</script>";
18:
19:
20: }
21: echo "<script type='text/javascript' src='{$this->ExternalJS}'></script>";
22: }
23: }
That's it! You can get rid of inline embedding of the PHPLiveX javascript. Similar to ver. 2.4 and above the call to Run() must not be inside the <script></script> tags. You can download a modded ver. 2.3 file with ExternalJS property from here.
You can further enhance this code a little more, like - Restrict the ExternalJS property to not use paths or you could restrict it to a bunch of desired paths.
by Saurabh
25. September 2007 07:36
I wouldn't have to make this post if I could post a comment on Jesse Johnston's entry which would most probably solves the problem for anybody. It's just that there's a small explanation missing. Since you will be running Visual Studio as the administrator not pseudo admin that you may probably be, and since that's a different account than yours, remember to install AnkhSVN for "All Users" instead of "Just Me".
by Saurabh
31. August 2007 07:30
I idolize Scott Hanselman, and I've already mentioned this before. Ramesh Sringeri asks a good question... "Is being a 501 developer, bad?"
The question seems obvious to a terminology that is highly restrictive of the definition of the phenomena it is trying to explain. Perhaps there should be another term for this trend exhibited by many people across various sections; not limited to developers alone. I have worked (still am) with some people who surprise me by the very fact that they possess an ability; almost like Data from Star Trek: TNG, that they can shut off at 5:01. How do they do it? It's a question bearing the same equivalence to me as does Scott Hanselman sleep?
My great friend Raj Shekhar in B'lore always kept saying "I have a life outside work". He always came late and almost always was "out o' the door" the moment the clock stuck 6:30. Yeah, no 9 to 5 for us. But that's the case here in India in case you didn't knew! But did it mean he was shut down until he entered the office the next morning? Never! Even while I'm returning home from work, dodging the traffic, the stray cows & dogs (although much less than; say 2 years ago) over the 1 hour drive on my mobike I'm still juggling ideas & thoughts about something work related (not always exciting) every now and then tossing them among the hundreds of other thoughts in my brain every few minutes. But I've worked with many people and converse with some friends who amaze me with their ability to shut down while on or off the work. And I'm not talking about people who have lost their enthusiasm of the workplace, sure that happens; and is probably the number one reason of the shutdown syndrome. But that's not the way the human brain works, it juggles thoughts around at incredible speeds & numbers when awake. So are they lying? Do they think about things relating to work at a subliminal level?
by Saurabh
9. June 2007 20:20
Ego isn't the only thing common among programmers...
I just took a Programmer Personality Test based on the Myers-Briggs Personality Test on Doolwind's Game Coding Site after I read about it on Mads Kristensen's blog.
I have a DHTB (DHTL would be the correct acronym) personality. It's interesting to see an attempt to understanding and classifying programmer personalities. So kudos to the creator(s) of this test.
Here's the test result of my test for record purposes... since there is no option to save/publish on the site itself.
Test Results
Your programmer personality type is:
DHTB
You're a Doer.
You are very quick at getting tasks done. You believe the outcome is the most important part of a task and the faster you can reach that outcome the better. After all, time is money.
You like coding at a High level.
The world is made up of objects and components, you should create your programs in the same way.
You work best in a Team.
A good group is better than the sum of it's parts. The only thing better than a genius programmer is a cohesive group of genius programmers.
You are a liBeral programmer.
Programming is a complex task and you should use white space and comments as freely as possible to help simplify the task. We're not writing on paper anymore so we can take up as much room as we need.
by Saurabh
26. March 2007 18:13
If you're installing SQL Server on your Vista Business/Enterprise or Ultimate machine chances are you do intend to use it for development purposes and obviously have already installed IIS. But chances are you might receive a warning message on the System Configuration Check page of the SQL Server 2005 Setup.
"Microsoft Internet Information Services (IIS) is either not installed or is disabled. IIS is required by some SQL Server features. Without IIS, some SQL Server features will not be available for installation. To install all SQL Server features, install IIS from Add or Remove Programs in Control Panel or enable the IIS service through the Control Panel if it is already installed, and then run SQL Server Setup again. For a list of features that depend on IIS, see Features Supported by Editions of SQL Server in Books Online."
Do not cancel setup to install the missing features in the hopes of re-installing SQL Server again. Cause I did and to find out that SQL Server (more particularly the database services) wouldn't install. You can simply install the required components without canceling the setup and resume it. I've tested that it works.
Let's first see what are the required IIS components that SQL Server depends upon. Well there's a KB article that has the official word on the components you'll need. If you prefer a more graphical illustration refer to the images below:


That's it, resume the setup. You'll notice that the setup again detects your IIS configuration and will continue and will finish without any problems. But what to do if you canceled the setup and ended up on this page via a search engine. Well the solution is fairly simple.
What happens in a re-installation attempt is that the setup determines that you already have SQL Native Client installed on your machine and doesn't extract the MSI package which unfortunately is a very-very important package. So to successfully re-install SQL Server 2005 you must uninstall all of the 4 entries you find in your Add/Remove Program Control Panel Applet bounded in the yellow rectangle in the image below.

Note that you may not have all four items on your list, the item just above the rectangle is of course not on your list as it didn't install successfully. Although you don't need to but I recommend reboot and when run the setup again you will be able to install SQL Server to seamlessly work with IIS.
by Saurabh
27. December 2006 20:02
No! I am not trying to count the reasons. Dear reader, if you came here to find the answer to that, I'm sorry.I'm in the same boat as you are. I just do not understand why?
- It has no separate DB access layer; it supports only the php & MySQL combination; that too, limited versions (the latest stable version of Joomla doesn't support MySQL 5.x).
- It is not SEO (Search Engine Optimized; as it's otherwise known to normal people), although some may argue that's not true, but it's not easy at all. And if you have a site with numerous custom components, just forget it.
- It is severely under-documented. I remember a little above a year ago, we would find sections and sections of the official Mambo documentation with only "TODO". It was utterly agonizing & frustrating experience. Although significant improvements have been made in this area since the Joomla avatar, it doesn't fare as great in terms of structure and content as that of Typo3 & Drupal.
- But the biggest problem I have faced as a developer working on Mambo/Joomla is the lack of separate data/presentation layers (separate Model & View component/layer). And to add to that there are lots of hardcoded presentation elements in the core code, and seems like it's hard severing the ties to the Mambo past, despite great efforts to modernize the code since Joomla first came out more than a year ago. There have been quite a number of occasions when this fact has bitten me in the butt.
I have led the development of a fairly large website serving thousands of users using Mambo and not Joomla (4.5.x, the development began months before the Joomla team left Miro International for good). Since then I've also had deployed 2 more sites (not nearly as large as the first Mambo project), call it utilizing resources… why let the newly acquired skill of my team mates go to waste. And had it not been the clients' insistence I'm sure I wouldn't have used Mambo.
Seems Joomla is having a makeover starting with version 1.5 with the biggest change in the form of the separation of the logic & presentation layer. But does a minor version increment is justified with such a huge behavioral change?
by Saurabh
23. August 2006 17:38
Ever since Brad Abrams mentioned Microsoft will be renaming Atlas, it’s AJAX coding framework, before it ships, and that Microsoft is listening to what the community thinks the name should be.Everybody seems to want to name ATLAS these days, I thought why not take a shot at the Atlas Naming Game
My pick is AJAXPF.net (in 2 more variants - AJAX-PF.net / AJAX PF.net)
That's short for AJAX Presentation Foundation for .net. The "Presentation Foundation" part makes it a nice marketing moniker that can easily be clubbed with the upcoming .net 3.0 lineup which @ the surface appears to be .net 2.0 + WFP hence the name will quickly be adapted & loved by the community.
Although I really wanted to know what Nikhil Kothari would want to name it.
by Saurabh
5. August 2006 17:32
If you find setting up CVS a nightmare like I used to, a few days back! This is what I would call a life saver. This guide by Bo Berglund is fantastic. Because it is simple enough and does not require you to be a SysAdmin or someone who knows what NT stands for …
In the event that this guide becomes inaccessible you can view the pdf version of this guide here. Though made for Windows Server 2003, it will work on Windows xp Professional & all flavors of Windows 2000. Although the guide is accurate in almost every respect, make sure on workstation machines the "Default domain" you specify on the CVSNT "Service Control Panel" within the Server Settings tab is the machine itself even if that machine is part of a domain.