Archive for 2008


PhotoFunia … The ultimate fantasy machine :)

So introducing PhotoFunia. image_thumb_1

Put your face on any given image. It is amazing. They use face detection technology, and my my, magic.

1. Select and effect from gallery. These are basically collection of images there algorithm can process.

image_thumb_3

2. Select your photo, make sure to check My photo should not be available to the public, if you dont intend to do so.

image_thumb_4

3. Bingo….  You got your photo there.. now you are also a celebrity :)

image_thumb_2

 

There are lots of images from which you can choose…

 

I will give : 4/5

Superb work. They are doing just too good job.

 

Thanks and Regards,

Mahin Gupta


Checking Internet Connection

So basically there are 3 ways to do it. We will check each of them and will find the best out of them.

 1) Send WebRequest

                private static bool IsInternetConnected()
        {
            HttpWebRequest req;
            HttpWebResponse resp;
            bool bRet = false;
            try
            {
                req = (HttpWebRequest) WebRequest.Create("
http://www.google.com");
                resp = (HttpWebResponse) req.GetResponse();
                bRet = resp.StatusCode.ToString().Equals("OK");
                resp.Close();
            }
            catch (Exception exc)
            {
                bRet = false;
            }
            finally
            {
                // resp.Close();
            }
            return bRet;
        }

Remarks : You need System.Net namespace to use HttpWebrequest and HttpWebresponse.

 

2) InternetGetConnectedState()  – wininet api

 

       private static bool APIInternetGetConnectedState()
        {
            bool bRet = false;
            try
            {
                int Desc = 0;
                bRet = InternetGetConnectedState(ref Desc, 0);
            }
            catch (Exception exc)
            {
                bRet = false;
            }
            return bRet;
        }

Remarks : You need to create extern function to use this api and have to use runtime interop assemblies. So you need to reference namespace  

        System.Runtime.InteropServices and include following code in your class definition.

        [DllImport("wininet.dll")]
        private extern static bool InternetGetConnectedState(ref int description, int ReservedValue);

 

3 )InternetCheckConnection – wininet api

        private static bool APIInternetCheckConnection()
        {
            bool bRet = false;
            try
            {
                bRet = InternetCheckConnection("
http://www.google.com", 0x01, 0);
            }
            catch (Exception exc)
            {
                bRet = false;
            }
            return bRet;
        }

Remarks : You need to create extern function to use this api and have to use runtime interop assemblies. So you need to reference namespace  

        System.Runtime.InteropServices and include following code in your class definition.

        [DllImport("wininet.dll")]
        private extern static bool InternetCheckConnection(string description,int flags, int ReservedValue);

 

Comparision :

Table shown below compares all the methods. Interestingly InternetGetConnectedState() reports connected even if we are not connected to Internet, and that is very natural since it has no way to detect if you are connected to actual Internet ( ie particular server ) unless you send a request to web server. You can find a good explanation about it here.Again you have to use interop services to use both this api which can cause performance issues.

Using Google server as server to request has also pros and cons. 1) Google is used heavily – but again it effectively uses CDN, so I don't think this argument holds a point. 2) You are almost very sure that Google server will be up and running in almost all circumstances, but yet for the sake of precaution use this as parameter and get it from either Database or App.Config

So after all of this for the time being I will go with Method 1 ie by using Send Web Request.

Method No Connection Connected to Intranet Connected to Internet
Send WebRequest false (0 ms) false (0 ms) true (550 ms)
InternetGetConnectedState false ( 30 ms ) true ( 0 ms ) true ( < 10 ms )
InternetCheckConnection false ( more than 2 seconds ) false ( 400 ms ) true ( 78 ms )

 

There exist other methods also to check Internet connectivity ie Create a socket connection to Web server, Use Ping or tracert, Open a telnet connection but many of this can create problems when firewall is on. yet, I am still interested in finding a better method than this. Please let me know if you know one.

 

Best Regards,

Mahin Gupta


Picasa -3 ….. Space eater

I wanted to install Visual Studio 2008 -SP1 , and it requires mind blowing 5.61 Gigs of space. :(

Again I ran out of space, so I have started to work on getting my C:\ space back again, and I got one more culprit, thanks to WinDir

Picasa !!!

We all know Picasa scans our computer and prepares its own database. it uses "C:\Documents and Settings\Mahin Gupta\Local Settings\Application Data\Google\Picasa2\db3" path for this.

I checked it and it was almost 900 MB.

I tried to search on Internet how can I change this location, I checked registry also but the bad news is that you can not change this location.

So what i have done ?

I just copied all *.db files from "C:\Documents and Settings\Mahin Gupta\Local Settings\Application Data\Google\Picasa2\db3" to one temporary location. Now my C:\ has more 900 MB space.

Now if I open Picasa, then it will again ask you to rescan your computer because it has no database now. I forcefully killed picasa process ( Because there is no way to stop it in that screen ). once again copied all the *.db files into "C:\Documents and Settings\Mahin Gupta\Local Settings\Application Data\Google\Picasa2\db3"  folder. Now again I opened picasa and bingo!!! all my images are back.

I will use this work around for the time being until google announces picasa version which let us to change image db location, till then watch this space.

I have also added this in my post where I have listed few steps of how to reclaim your c:\ space


Google Toolbar – Send to sms is retired…

Google toolbar had a feature to share a link with friends via sms. It was available for US numbers only.

image_thumb_2

 

But it seems that they have pulled out plugs from it.

image_thumb_1

I used it for couple of times to share something with my friends. it was very quick. Lets hope it will be back with same or some other name in near future.

 

Regards,

Mahin Gupta


App_Offline.htm – An easy way to take your asp.net application offline.

Sometimes it is really a big pain to take your application offline. ASP.net has one very good feature to take your application offline without any pain.

Method : put an HTML file named app_offline.htm in the root directory of your web site. ASP.net will shutdown your application, Will unload your application domain, and for every request made to your web site it will return the content of App_Offline.htm

So now you don’t need to write any logic for taking your application offline.

Remarks :

1. Make sure you put at least 512 bytes content in the page, otherwise the browser will display 404 Not Found.

 

There is one more way to take your application offline : You can set enabled attribute to false  in <httpRuntime> tag.

 

Regards,

Mahin Gupta


BlogEngine – Windows Live Writer Bug – Post not visible

I am using BlogEngine for my blog and using Windows Live Writer to post it to my blog.

I came across a very strange thing today.

I have posted a post using Windows Live Writer but it was not visible to the world. Strangely I was able to see it when I am logged in to my blog, moreover in the Month Archive

After digging sometime I got the point. BlogEngine comes with a handy feature of preposting, where you can publish a post in advance and it will be visible to the world only after it's publish time you have set.

The problem was basically of the difference between my Local Time and Server time.

When I post it using Live Writer it sets the publish time according to my local time. When BlogEngine displays any post it checks for its publish time and will display it only if the publish time is not in future.

So What is the solution :

1. When you post to your blog through live Writer, Set the publish date which is not in future for your Server.

or

1. Post to your blog through Live Writer, Go to your blog admin panel, change the publish date.

or

1. Wait for future… it will show up automatically. :)

Any ways…. Take my words, except this small problems the combination of BlogEngine and Windows Live Writer is killer… too Good.

I will give this pair 5/5.

 

Thanks and regards,

Mahin Gupta


Google Talk chatback badge on your Blog/Web

Here it is… Google again came with bang.

One of my client needed live Chat support on his web site. So I have tried lots of options including third party component, making my own chat system but than I came across the Google thing. Yes, you can add google talk chat support on your blog/Web site.

They call it Google Talk chatback badge.

If you want one for your own than go to http://www.google.com/talk/service/badge/New

They will ask you for login, after login you will be redirected to Create a Google Talk chatback badge Page.

GTalkBadge

Rest of the steps are very easy..

1. Select a title for your badge.

2. Write your nick name : ( Mahin )

3. Select Style depending on layout of your website or blog.

4. if you want to display your status message there then check the checkbox Show your status message.

5. Click update badge.

You will be given a script in below textbox, just copy and paste this script in your blog/Website.

 

How it works :

1. If your gTalk Status is Available ie. Your status icon is green ball Available then your nick name/Title will become hyperlink. ( If your status is busy then it will not be a hyperlink.)

2. When someone will click on that link

– he will get a popup chat window.

– You will get a chat from chatback.talk.google.com with one link. If you want to join this chat than click on that link.

– you will be redirected to your default browser to open a popup window. if you are not already  logged in in to your gMail account than it will ask you to login.

– After login you will get Launch Chat button. Click on that and you will get a popup window, where you can chat with user.

 

Remarks :

1. Both party must have Flash 8 or higher plugin installed in their browsers.

2. System is quiet slow, so better you write warning about same in your blog/Website.

3. You should not put this type of things directly on your home page, because basically it is a cross domain request so it will affect the loading time of your home page. So better you put link for this on home page and open a pop up or new page for this.


Network Connection Periodically goes down

It is tough job to lead some one, because now their Hardware/Software all kinds of problems are yours.

I am not a good trouble shooter when it comes to hardware, but in this job I have to do everything.

Recently one of my employee was facing very strange problem. Her Network connection used to go down periodically after some inactivity.

I have tried a lot to troubleshoot it but found nothing relevant on Internet. Everyone was suspecting a virus or something malicious.

But after some careful digging I got it solved by some extent.

Here how it goes…

Windows have one handy feature of Power saving… :) I think now you got it.  So below are the steps

1. Double Click on network Icon in your taskbar. NetworkIcon

2. Click On Properties

3. Click on Configure button next to your Network card

4. Click On Power Management Tab.

5. Uncheck Allow the computer to turn  off this device to save power. Check box.

6. Click Ok.

7. Click Close.


TwinkleMods

No, we aren't gonna talk about Twinkle Khanna; no matter how hot some people may find her.
Neither are we gonna practice the "Like A Diamond In The Sky" nursery rhyme!

This mail is about Advertizing; about Twinkle Beauty Parlour, jo Lajpat Nagar mein khula tha; and was an offering from the SAB TV stables.

I saw one of their promotional ads; and found that it was not bad at all!

The ad opens with a romeo on a bike, giving way to another biker to try and pataao a girl living in a nearby building.
This other guy emulates Himesh Reshammiya [or Himessbhai, as his fans calls him!] and sings teraaaa teraaaa teraaaa surooooor for the pretty lass; who then comes out in the balcony. All the while, the background music lives up to the theme.

To Himesh's shock, the girl has a moustache!!!!
Flabbergasted, he runs away from the place; naturally!
Then this girl remarks: Omigod! Kab Khulega Yeh Beauty Parlour?!
And a voice says – Jald hi. 15 May ko gali gali mein khulega Twinkle Beauty Parlour!!!

Then we again have Himesbhai.
This time, he is giving a chance to a third flirt to pataao the girl. The third guy is obliged, and removes his helmet and looks towards the balcony…..and swoosh…….
…..the screen is covered by the expansive SAB logo.

Bhai Wah!
Brilliant propaganda.
According to Outlook's survey, TWINKLE BEAUTY PARLOUR generated enough curiosity as KBC 2!

Just that the show itself, flopped miserably. But the promos hyped it up, and the show recorded an impressive TRP rating for the first week.

NEERAV MODY
how i wonder what you are!


ModsPoint

Inspite of losing his everything in the game of dice, Yuddhishthir agreed to play the gambling game for a second time.

Satiring this, Ved Vyas remarked –
"There never was, and there never will be a golden antelope. Yet, Shri Raam went into the forest in the pursuit of what 'seemed' one.
When calamities approach, the first thing to get destroyed is the perspicacity (judgment)."

So apt.

NEERAV MODY
point taken.