.comment-link {margin-left:.6em;}

.code

.. ola \o/ :)

Path class is a blessing
Thursday, May 29, 2014

Just wanted to say a quick thanks to the guys who made the Path class in .Net framework, its such a BIG blessing. My fav methods: "GetFileName" and "GetFileNameWithoutExtension"! <3 p="">


Visual Studio 2013 requires IE 10 to install?
Tuesday, October 22, 2013

Really? Disappointing! I completed downloading Visual Studio 2013 in my office and brought it home to install it on a Windows 7 VM. Right after launching the installer it informs me I need to first install IE10. On the host OS I find a little web installer of IE 10, so I copy it to VM and launch it, but then this installer tells me I need to install the pre-reqs of IE10! All this when i'm running Visual Studio 2012 Ultimate absolutely fine in the same VM. Now the problem is there is something wrong with the network configurations of the VM and I'm unable to download the pre-reqs or run the windows update to locate and install IE10 and its prereqs. So this all is frustrating, I have no idea why would IE10 be such a hard prerequisite for VS2013. This is cheap and stupid when Microsoft has to just force their fav software on users when they fail to compete with competing browsers. They need to learn to keep IE away from VS, thanks!


no include files :|
Friday, May 17, 2013

installed visual studio 2012, the directory C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include does not contain any files. What is going on, none of my VC++ programs are compiling.

Update: reinstalling will not fix this problem. You have to download the Update 2 of Visual Studio 2012 and install it over this broken installation of vs 2012 and the problem will be fixed. Update 2 has got a lot of very nice improvements, you should have the update anyway.


Crystal Reports for Stunning Visual Studio 2012
Tuesday, December 25, 2012

hmm ... so i'm desperately waiting for Crystal Reports for Visual Studio 2012 so I can move my project to vs2012!

Update: ok good news, the version of crystal reports for VS 2012 is now available for download here: http://scn.sap.com/docs/DOC-35074. (requires windows 7 sp1 or windows 8). Have fun.


Visual Studio 2012 offline help
Saturday, December 22, 2012

here is the link for the offline documentation of Visual Studio 2012, it can be downloaded as an iso image, its 2.7gb in size. Important link!


The Class dot Folder dot Class dot Class dot CRAP
Tuesday, November 29, 2011

You know how Visual Studio changes the "namespace" name to "namespace.foldername" when you move a file from one folder to a sub folder? I TOTALLY HATE THAT. VS doesn't need to manage this for me. I hate to write class.class.class.class.something.bla.bla.crap in my source code. No I don't want to manage stuff like that. If I got confuse, I'll just arrange stuff myself. I am NOT ALWAYS writing a 50 million lines of code so don't think I'm going to get confused right after 2 days of writing code finding which class is where. And please DONT DO THIS with the dreaded typed datasets!! You moved a typed dataset from one place to another and the code breaks like **** (it was the s word not the f word). Ok, have fun now.


Occupy Internet!!
Sunday, November 20, 2011

I live in Pakistan and I just noticed that a very important website used by developers around Internet has been blocked by my ISP, i.e, www.pastebin.com. Few days back I wanted to download a free download manager, aka FDM, which is my fav download manager, and I discovered that http://www.freedownloadmanager.org/ has also been blocked by the ISP. The message that you get is this:


so I asked friends on google+ if they can access this stuff, they were using a different isp and that isp has not implemented the *blacklisted* urls. I called up the support to ask them whats going on, the guy told me that PTA has given them a list of thousands of urls including countless blogs that they want them to ban. The list has been implemented by almost all ISPs except for perhaps PTCL. But ptcl will soon follow.

There must be other websites that do the same stuff as pastebin, are they going to be blocked too? What someone can do on pastebin, cant they do the same on other related websites? What harm does a website like pastebin causes? I fail to understand. Does blocking a download manager saves a government from getting toppled? After UK's gov blamed London Riots on internet, and many Islamic countries banning facebook/twitter/skype or any website that helps protesters to collaborate, do you see where all this is going? The governments of the world have gone crazy, who comes to power wants to stay forever in power. Going forward few years (or a decade) from now, I dont see a bright future of Internet. I see restrictions, I see a blockade of freedom and free-speech.


Steve Jobs dies at the age of 56
Thursday, October 06, 2011

Steve Jobs died today in peace in the presence of his family, according to his family's statement. An amazingly focused person and it seems that majority of the projects he did, he shockingly understood what people wanted and delivered it (or just convinced you that this is what you should use). I have never owned an Apple product, but I have used them briefly through friends or colleagues. I have never owned them but I strongly suggest them to people who can afford them. They are amazing products. Products that other companies look at and try to copy. But as you follow the technology industry its so clear that copying something in the form of a product and then be able to sell it as well is in most cases nearly impossible to do. You really have to understand and appreciate as to what is so great about a revolutionary product that you are trying to copy. But well, I think if you were great enough, you would not copy something in the first place, you would just understand the greatness, say something nice about it, and take the aim to make something even better. Some companies get the hardware right, but the software is not good, and some get the software right but the hardware is crappy. Some get the product to be pretty decent, but have no idea who the audience is, and why, because the inception of the idea is not coming from their own minds, they are just trying to copy someone else's success. They are loosing their dignity and respect. Some become so desperate to copy success, like Nokia, that they kill their revolutionary mobile platforms like Meego, and some become so desperate, like Microsoft, that they use their deep pockets to convince others to kill their innovations and join their crappy platform, ridding the world of innovative products to come. So much for contributing to make the world a better place. Both are desperate and both end up achieving nothing.

I'm pretty concerned about the new leadership of Apple. Yes I have read a lot about Tim Cook and the rest of the team, they are all great people. They are all very intelligent/clever, they love the work they do, they understood what Steve Jobs wanted, but in my honest opinion, all of them combined, they don't even begin to come close in talent and genius that Steve was for his company. They could have done anything if there was no Apple, they could have made a product successful following another good leader in some other random company, but their minds and hands could not have possibly made something as revolutionary as what they got opportunity to do at Apple. And that's only because Steve Jobs was working as their boss. Yes, you can teach someone, yes you can learn from a great leader, but I should remind you that we are talking about a talent that no university or institute can teach you, not even the genius himself because he knows he has a gift and he can do things right and that he can be a leader, but what he can not do is translate all this genious in words and actions that can be documented and followed for times to come. Its that rare kind of talent we have under discussion. No matter how much you try to mentor, you cannot deliver this passion and genius on to someone. How many great leaders in the world have mentored their subordinates, and how many have had successors like them. Very few indeed.

It is to be seen in the years to come how good the leadership of Apple really is. While he was leaving, Steve Jobs would have certainly given them a lot to think on, guidance on future products, possible future products, possible new markets that can be explored, which may continue to feed the success (for sometime) that they have today. But i think if they can come up with just one product that is totally conceived on their own without any help or ideas that Steve has left behind, and at the same time be as successful as an iPhone, that something even Steve would look and say "why didnt I think of this". Because this is how big of a success you have to be, to be Apple, and only then I think we can say that Apple's leadership transferred to the right minds. But otherwise, they will loose the spark, they will loose a lot. Because Apple is not a company that copy to succeed, its just not in their DNA.

RIP Steve Jobs!



So ... Meego is DEAD!
Wednesday, September 28, 2011

So this day brings a very bad news from intel and linux foundation. They are just creating a yet another new Linux project for, well, "all devices". Just few years back it was Moblin from Intel and Maemo from Nokia, and then they got merged and formed Meego. Then one day the Mr. *f*ELop decided he wanted to please his old boss and he decided to just abandon EVERYTHING and start making the lame windows phone devices. That came as a surprise to Intel which used to think Nokia was its core partner in developing Meego. But still, Intel told everyone to stay calm and they are just fully committed to Meego. Yeah Right! And now fresh out of twitter the world is learning that "Good bye Meego" has been sung and there is a new effort in town, called Tarzan .. ooops sorry its called Tizne .. TintintintinTINZIN .. umm no Tizen dammit! Yes its called #Tizen. You can read the *justification* here https://meego.com/community/blogs/imad/2011/whats-next-meego. Really silly, what an excuse! HTML5. Huh.

Anyway, so some twitter reaction:


@qole:
Intel: Moblin... MeeGo... Tizen! This time it will work! http://t.co/GasmsXci

@qole:
Why do companies (fail to) compete against established platforms by repeatedly starting over instead of refining existing platforms?

@segphault
Not convinced that starting over from scratch and rewriting the whole stack with yet another toolkit is going to accomplish anything #Tizen

@achipa
When I hear a platform's software offering is built around HTML5, it almost feels like hearing 'no real software offering yet'

@segphault
Intel and the Linux Foundation have shown that they can't get the job done. I don't see why anybody should give a crap about Tizen.

@Texrat
Why #Tizen? Was FlibberGertz taken?

@murraycumming
The Meego #Tizen announcement (ur1.ca/583lj), is arbitrary and one-directional, as usual. It causes failure. It prevents success.

@qole
Random word generators produce some interesting results. #Maemo #Tizen #FlibberGertz #Gobbryfux

@corneliushald
I know another OS that tried to use HTML/JS as it's primary API. #intel #meego #webos

@RevdKathy
#Tizen. Sounds like a cheap fizzy drink. Lots of caffeine and additives, and no actual nutritional value.

@jaffa2
Dear #Intel, will you consider handing over *.meego.com to a community governance body so we can enact a truly open mobile Linux OS?

@jaffa2
#Intel blamed #Nokia for delay in their handset efforts with #MeeGo. So doing everything again from scratch is way of speeding up?!

@mece66
I think this is rather relevant right now: xkcd.com/934/ #tizen #meego #html5 #fail #xkcd

oh well, lets just hope for the best and grab a N9 while we are at it.


Crystal Report Error on 64 bits
Wednesday, September 07, 2011

If you get this error that says:

"An error has occurred while attempting to load the Crystal Reports runtime.

Either the Crystal Reports registry key permissions are insufficient or the Crystal Reports runtime is not installed correctly.

Please install the appropriate Crystal Reports redistributable (CRRedist*.msi) containing the correct version of the Crystal Reports runtime (x86, x64, or Itanium) required.  Please go to http://www.businessobjects.com/support for more information. "

Open your IIS and click "Application Pools", select the application pool name that your application is using, then on the right side click "Advanced Settings", which will show you the advanced settings for your app pool. There set the "Enable 32-Bit Applications" to True. Click Ok, and now go check your page which uses crystal reports, it should work just fine.

This info was for 64-bits Windows 7 rocking Visual Studio 2005, may also work for few other microsoft operating systems and iis.


Convert DataTable to JSON in C#
Monday, September 05, 2011

A generic code to convert your C# DataTable to JSON:



  string makejsonoftable(DataTable table, makejson e)
  {
    StringBuilder sb = new StringBuilder();
    foreach (DataRow dr in table.Rows)
    {
      if (sb.Length != 0)
        sb.Append(",");
      sb.Append("{");
      StringBuilder sb2 = new StringBuilder();
      foreach (DataColumn col in table.Columns)
      {
        string fieldname = col.ColumnName;
        string fieldvalue = dr[fieldname].ToString();
        if (sb2.Length != 0)
          sb2.Append(",");
        sb2.Append(string.Format("{0}:\"{1}\"", fieldname, fieldvalue));


      }
      sb.Append(sb2.ToString());
      sb.Append("}");


    }
    if (e == makejson.e_with_square_brackets)
    {
      sb.Insert(0, "[");
      sb.Append("]");
    }
    return sb.ToString();


  }

and I added this enum:

  enum makejson
  {
    e_without_square_brackets,
    e_with_square_brackets
  }

because you wont need the square brackets in case you are calling this function again for some nested object definition, for example like:
[{name:{name1:"ab",name2:"cd"},id:9}]

resulting json for one of my data query looked like this:

[{village_name:"Lourba leten",school_name:"EB 1.2 Nazare Gumer",village_id:"4030301",school_id:"525",classroom_id:"1893",location_name:"Seluk tan",location_id:"9"},{village_name:"",school_name:"",village_id:"",school_id:"",classroom_id:"1905",location_name:"Seluk tan",location_id:"9"}]

say you requested this through an ajax call, you can call a:
var jsondatastructure = eval (yourResponseText);
in case of the above sample result the "jsondatastructure" will have a jsondatastructure.length set to 2.




Jailbreak 4.3.4
Saturday, July 23, 2011

So if you are desperately seeking to jailbreak your ipad while rocking 4.3.4 firmware on it, you are not completely out of luck. The jailbreakme.com is not working so far for 4.3.4 so you have to look for alternative methods. What is working is a solution from redsnow (i believe). Just follow this link http://bit.ly/qY0JXQ and you will be good. There is a very nicely done youtube video that makes things very clear, I have used ipad for the first time and was jailbreaking for the first time, and i was able to follow it.

Please note that you will need to be looking for your *.ipsw extension file (to follow the video), which is the complete firmware that you flashed your ipad with using iTunes. If you are a windows user, this file will be located at "C:\Users\[username]\AppData\Roaming\Apple Computer\iTunes\iPad Software Updates" assuming you are rocking windows 7/Vista on your C drive, also please replace the username with whatever is correct in your case. Since I updated my ipad 1, the file I have in there was named iPad1,1_4.3.4_8K2_Restore.ipsw (622,279,895 bytes, md5 hash 3414ec10c6e7f50d8eca5d5c25d60ff0 http://bit.ly/n1jv13).

Also a note on putting the device in the DFU mode (whatever that is), when you follow the sequence in the video, make sure that your device is powered off!

Happy jailbreaking!


Bluetooth on Windows 7 64 bits
Saturday, June 18, 2011

If you are running Windows 7 64 bits on your computer and for some reason your bluetooth is not behaving as you expect it to, you can try doing the following, it worked for me. Open the bluetooth settings window:


switch to the "COM Ports" tab, and see if there is any entry in the list of com ports. If you find nothing there, click that "Add..." button, and the window that comes up click OK in it. A new COM Port will be added to work with your bluetooth connection. Now try transferring files between 2 of your bluetooth devices, it should work. I am right now using the internet connection from my cell phone (nokia n900) through bluetooth on my laptop, which is working pretty great. All this usually works automatically on Windows 7 32 bits, but i dont know why I had to go through this extra step to make the BT work in windows 7 64 bits.


IE9 crashing windows !!
Thursday, March 17, 2011

So in excitement to see how fast IE9 really is, I installed one on my office pc (core i5, windows 7 32bits, 4gb ram). After the installation completed, the machine restarted, and I launched IE9 to start browsing, and not even google.com worked! Everytime i typed google.com and tried searching for something and before I could press Enter I would get a windows message that "Internet Explorer has crashed", I tried a lot, nothing worked, it just wont stay alive for more then few seconds. I uninstalled it!

At home on my laptop, I installed it (core 2, windows 7 64bits, 4gb ram) to try again expecting it to work better here for some reason :). Installation went fine, restarted windows and launched IE9, things were going ok (i had about 5 tabs opened browsing websites like casio/engadget/google/localhost and few others) but I just got a blue screen right when i was using IE9 and my machine restarted! And i must say that i NEVER get a blue screen of death (bsod) on my laptop! In the past 3 years there have not been much times that I have got a bsod on my laptop. Sigh .. The UX looks good here and all, things feel snappy, but crashing a machine? Maybe IE10 would be joy browsing the web on. Back to Chrome <3


My Code Comments
Thursday, August 06, 2009

Do you comment like this too :) ?






Chrome's Versions
Sunday, August 02, 2009

Following is a screenshot showing chrome's About dialog boxes. The first one is the one I built from the lastest source code available from chromium's website. The second one is the publicly available final version of chrome, updated to the letest version.




There are some other differences that you immediately notice when you first run the chromium build. The home screen has changes, the url drop down has some ui changes. Will see what other changes are, I may post some more screenshots.


Generating "chrome.sln" file
Friday, July 17, 2009

This post may help you in generating chrome.sln file which you will need to load the chrome browser's source in visual studio 2005 for building it. So you must have noticed that this page tells you to load the chrome/chrome.sln in vs. But you look and you cannot find it. First make sure that your depot_tools are ready to be used. I used TortoiseSvn to get the source for depot_tools but you can download it also. After getting the depot_tools source you need to add it to the Path environment variable so that you can than use it from within any folder in the chrome's source. So once added, you goto the path where chrome browser's source is which is this chrometrunk\chrome-svn\tarball\chromium\src\chrome on my pc, and write:
gclient runhooks --force
after this the output on my console was:
Installing subversion ...
Installing python ...

________ running 'T:\Downloads\depot_tools\python_bin\python.exe
src/tools/gyp/gyp_dogfood src/build/all.gyp' in
'T:\Downloads\chrometrunk\chrome-svn\tarball\chromium'
Updating projects from gyp files...

After this, your current directory should be filled with the *.vcproj and *.sln files which you know what you want to use them for.
If in case things dont go as smooth as I mentioned up there, you should follow this post, i think it'll help:

btw the build takes painfully long time :)


is Bing better or Google
Sunday, July 12, 2009

So I'm eating "toasty cheese crackers" by Aim Biscuits right now. So I decide to search the net for it to know more about them. So as sometimes I do to compare search engines to see how much have they progressed against google, I do similar searches on more than one search engine to find who gets me to the right destination first. So my search term right now is "aim biscuits toasty cheese crackers" without the quotes. I goto google.com and write this search term, and i also open bing.com to write the same sentense/search-phrase. And hit enter on both. They come up with the results.
Bing: there is no mention of the Aim biscuits on the first page anywhere. There are pages that seem to be focusing on the word AIM, crackers, toasty etc individually sort of in a way that after few seconds I dont want to think what exactly the search algorithms had in them to finally decide to come with the results that it did.
Google: I wanna start with "amazing". The first link shows a site named tradercity.com with exactly the biscuits I was searching for. The third link (on the first page) refers to a proper web site of what I searched for! Absolutely what I wanted.

While looking at bing's results before I set my eyes on google's search, I started doubting if this Aim Biscuit company even has a web site of its own, cuz bing didnt mention it on the first page. I dont know and I cannot imagine why if aimbiscuits.com exists, that it is so hard for bing to infer that it should give atleast some weightage to that web site address given my search terms. For the love of computer science, the first 2 words are exactly what the website address is if you combine them! Unbelievable and very disappointing!

Btw, the same goes for the image search on the same terms: bing is completely showing things like it took my search term, trashed it, and randomly picked bunch of images from its image database and threw on me. While with google, it shows atleast 3 images of what I'm eating right now!
This is what microsoft is being so loud about? Give me a break!


Where are the Merge Modules for Crystal Reports?
Tuesday, June 23, 2009

Long time ago in a galaxy far far away, crystalreports were acquired by something called businessobjects! And some time back BO got acquired by SAP. If you now search for some stuff related to crystal reports and you get links to the businessobjects' website and you try to open them, you are going to be redirected to some page of sap's website. And SAP's website is awefully intimidating (atleast for me). Their search sucks! There crystalreports page is not at all developer-friendly. And the experience gets more frustrating if your internet speed is fluctuating.

So anyway, the thing is that after a long time I have returned to doing some .net development, as its progressing I had to do some crystal reports development also. Now I wanted to deploy the crystal reports to the server where my website is deployed. I'm using Visual Studio 2005 & the crystal reports that comes with it. So in it the cr version is "10.2.3600.0". Just before declaring that both bing and google sucks at searches (its not there fault I guess?), sap's cr forums revealed this page which is *the* page for finding out various deployment scenerios. As it turned out, the setup package that I wanted to create, it was already there on my hard drive installed/placed along visual studio 2005, in the form of file named "CRRedist2005_x86.msi". This file is also mentioned on the link I mentioned earlier. I hope that page helps you too in your cr deployments!


Killing All IE Processes
Wednesday, June 03, 2009

During asp.net development its possible that a lot of internet explorer's processes are left running, which you can see from the task manager. This happens when you are starting and closing the browser many times for testing your web application. Some scenerios keep the browsing open and the browser process doesnt shutdown when you close the browser to go back to the debug mode of visual studio (mayeb due to some javascript scripting activities, I noticed because I write a lot of javascript). And I dont restart my computer for days, I only put it to sleep when I am not working on it, so the IE processes just keep on piling up. So sooner or later I have to goto the task manager and kill them all which takes time. So I wrote a little c# code to do this for me, I hope this helps someone else too:

using System;
using System.Collections.Generic;
using System.Text;

using System.Diagnostics;


namespace killIE
{
  class Program
  {
    static void Main(string[] args)
    {
      if (args.Length > 0)
      {
        if (args[0].ToLower() == "/l" || args[0].ToLower() == "-l")
          new Program(). listprocesses();
        else if (args[0].ToLower() == "/k" || args[0].ToLower() == "-k")
        {
          string goodbyemessage = "Quiting. Have a good day.";
          Console.WriteLine("finding all IE processes ...");
          Process[] ieprocesses = Process.GetProcessesByName("iexplore");
          Console.WriteLine("processes found {0}", ieprocesses.Length);
          if (ieprocesses.Length == 0)
          {
            Console.WriteLine("no one to kill. {0}", goodbyemessage);
            return;

          }
          Console.WriteLine("killing them all ...");
          foreach (Process ieproc in ieprocesses)
          {
            Console.WriteLine("killing {0} ..", ieproc.Id);
            ieproc.Kill();
          }

          Console.WriteLine(goodbyemessage);

        }
      }

    }
    void listprocesses()
    {
      Process[] ieprocesses = Process.GetProcessesByName("iexplore");
      foreach (Process p in ieprocesses)
      {
        Console.WriteLine(p.Id);

      }

    }
  }
}

You can pass /l for the list of IE processes and /k to kill all of them.



A detailed review of Windows 7 RC1
Monday, May 11, 2009

Anandtech reviews Windows 7 RC1. Its a detailed review not usually found on other websites. They tell a lot about the new gui, the way the new windows graphics get handled by the gpu, uac, changes in networking, gaming performance etc.

update: after reading this article, once windows 7 update asks you to install the latest wddm1.1 drivers, you will feel *happy* about installing them rather than just thinking "um, ok, its just something that Microsoft wants me to install to update graphics drivers"


Windows 7 RC
Monday, May 04, 2009

So the windows 7's release candidate is out, umm will be available to everyone on May 5th, although you can get it from various torrent sites. The really really cool thing about the release is first - its a production quality OS, second - you can use it for 1 year and a lil bit more (so essentially its free) ! So you have it so grab it! Btw I also wanted to say that the hatred for Windows Vista on the Internet really irritates me, because I have been using windows Vista for more than one year (it came installed on my laptop) and in all that time I have never wished to go back to XP. My laptop right now is a cor 2 duo 2.0ghz, 2gb ram, 120gb hdd, wifi, etc, and Vista runs really well (and I use sql server 2005, asp.net, IIS, and c++/C# on this machine for my day job). Of course more faster and intuitive OS is most welcome, but I think Vista deserves much more good words about it than is the status of the views on the web right now about it. But its good now that Windows 7 is available for you, we are seeing a lot of positive comments about Windows 7 on the Internet. Happy 7!


A good article on DirectX 11
Friday, February 06, 2009

A very good article at Anandtech for people who play games or are interested in game technologies.


Booting Vista from Grub Prompt
Saturday, October 18, 2008

I have fedora core 9 and Vista on my laptop. Grub is the boot loader and it gives me the options to boot fedora or vista. Vista is installed on the first partition and fedora on 4th partition in order. Today I just deleted the partition which has fedora on it (intentionally messing up my pc), and than when I booted, instead of getting the gui version of the grub boot loader, I was stopped at a grub command prompt. Now I instantly knew I clearly messed things up, but the great thing is that this cool black command line is offering me *something* at least. So now I had to boot the Vista OS through this grub prompt. I booted up my desktop and started searching the net for how can I boot vista from grub prompt. I realized that it was pretty easy to do. Following is what I had to write on the command prompt (4 lines):
root (hd0,0)
rootnoverify (hd0,0)
chainloader +1
boot

and after your write the boot command, you will see Vista starting to boot.


encoding urls
Tuesday, June 03, 2008

So I work on this application which has all its code in c++. I need to communicate with an http server alot, so i frequently send data through wininet win32 apis (no mfc wrappers). So anyone who sends raw text data knows that there are some kind of characters that really messes up your requests to the server, like "#", {, & etc. If you want to deal with this data and convert it to something and is legit according to the http specs, you need to do a conversion called url encoding (i think :p). Its basically pretty simple, all that is needed to be done is convert the nasty characters to their hex ascii equivilent and prefix it with a '%' sign. So for example if you have a new line as \r\n, it should become %0D%0A, which is 0D for \r and 0A for \n respectively. So as I was searching for an api that could make this easy for me I found some interestingly named api called InternetCanonicalizeUrl. I used this api and it helped a little, but it does not work for all the nasty characters. For example the first weird thing that you discover about this api is that it strips the \r\n from your data if they exist anywhere so your data is left with no line breaks (not to mention "#"). So a friend suggested that why not we write a code to convert all the characters to their ascii hex equivilent and leave the obvious ones like a-z and 0-9 as they are. So we came up with this simple code to do the conversion and it works so far for all the data that we our sending to our server:


#define ENCODE_BUF_LENGTH 10000
void UrlEncodePlz (char * src, char * destallocatedbuf)
{
char * buf = src;
char tmpbuf[ENCODE_BUF_LENGTH];
memset(tmpbuf, 0, ENCODE_BUF_LENGTH);
char cbuf[10];
for (int i = 0, x=0; i< strlen (buf); i++)
{
char c = buf[i];
if ( ((c>='a' && c<='z') || (c>='A' && c<='Z')
|| (c>='0' && c<='9')))
{
tmpbuf [x++] = buf[i];

}
else
{
sprintf (cbuf, "%%%02X", c);
strcat (tmpbuf, cbuf);
x+=strlen(cbuf);
}
}

strcpy(destallocatedbuf, tmpbuf);
}

Ok some words about the above code: it may not seem so efficient in terms of the size of the tmpbuf that I took which is 10000. Its just something I choose, you can of course pick any number that suits you, but know this that for a single \n character the hex equivilent is %0A which is 3 characters. I am really bad in naming functions and variables (5 years of programming and yes I still dont do much of the so called *engineering* formalities well). I think this code is going to give enough good shape to your data that will guarantee its safe delivery to the server.


Linux Kernel Dev Stats
Wednesday, April 09, 2008

So if you want to know how many organisations and individuals are contributing to the linux kernel, read this (the original report) and this. And according to this news.com article: "As detailed statistics demonstrate, the Linux kernel is perhaps the world's largest, most distributed development effort, reflecting its increasing importance to an ever-widening array of disparate parties".


IE 8 beta 1 ready for download
Friday, March 07, 2008

Click here to download Internet Explorer 8. Read this page also.


Microsoft opens source of Singularity OS
Thursday, March 06, 2008

The source code for singularity operating system is open for research and non-commercial uses. It can be downloaded from codeplex http://www.codeplex.com/singularity. A 60mb download.


Java Damaging for Students
Wednesday, January 09, 2008

I couldnt agree more. These two links i'm giving here. This one I followed from slashdot. Joel wrote "the perils of javaschools" sometime back, beautiful article, awesome detailed explanation of why not java at schools.


Dx Refactor for C++
Wednesday, December 05, 2007

For any one writing code in visual c++ 2k5, downloading "Refactor for C++" is a must. Its amazing to say the least, and its *free*. Get it from here.





Blogs:

MSDN Blogs
Joel Pobar
Don Syme

Friends:
Adeel
Aqeel
#Fahad
Haroon
Omer
Muhammad Ali
Lahore Food Blog

Links:
Rotor
CodeGuru
Mozilla
OpenSourceNokia
Tech Blog

Languages:
IronPython
F#

Archives

June 2004   July 2004   August 2004   September 2004   October 2004   November 2004   December 2004   February 2005   April 2005   June 2005   July 2005   September 2005   October 2005   November 2005   June 2007   December 2007   January 2008   March 2008   April 2008   June 2008   October 2008   February 2009   May 2009   June 2009   July 2009   August 2009   March 2011   June 2011   July 2011   September 2011   October 2011   November 2011   December 2012   May 2013   October 2013   May 2014  

This page is powered by Blogger. Isn't yours?