PhotoFunia ... The ultimate fantasy machine :)

By mahingupta on Dec 31 2008 | 2 Comments

So introducing PhotoFunia. image

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

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

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

image

 

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

Post info

Tags:
Categories: SiteMania , TechNews

Checking Internet Connection

By mahingupta on Dec 24 2008 | 0 Comments

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

Post info

Tags:
Categories: CodeZone , TechTips

Picasa -3 ..... Space eater

By mahingupta on Dec 07 2008 | 3 Comments

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

Post info

Categories: PC Tuneup