2013-11-11

Apple iPhone 4 not showing up in Windows Live Photogallery on Windows 7

This is for iPhone 4, but may also work on other versions of iPhone.

The problem I am having is that the iPhone does not show up when I press the “Import” button in Windows Live Photogallery, and it’s been driving me nuts.

So today I fixed the problem this way:

Procedure 1 (RECOMMENDED):
1. Connect the phone to your Windows PC
2. Open Programs from the Control Panel, and then click the Programs and Features link.
3. Locate and right click the Apple Mobile Device Support application, then choose Repair.
4. Locate and right click the Apple Application Support application, then choose Repair.
5. If you have opened Windows Live Photogallery, close and restart it, then click the “Import” button (top left).

Unfortunately it seems to me that I need to do that each time I connect my iPhone, so it is somehow reverted when I restart the computer. I really think someone at Apple or Microsoft should have done a better job to avoid these problems.

If this does not fix your problem, then I must admit that I also did the following before the procedure above:

Procedure 2 (NOT RECOMMENDED/STRONGLY DISCOURAGED):
1. Connect the phone to your Windows PC
2. Open Device Manager (Right click Computer, then choose Properties, then click the Device Manager option).
3. Under “Universal Serial Bus controllers” I found at the top an entry called something starting with Apple.
4. Uninstall the driver for this.
5. Repeat Procedure 1.

Problem now is that iTunes cannot detect the phone any more.
So… I will need to repair or reinstall iTunes, which is turning out to be a nightmare from hell.

To reinstall iTunes you need to uninstall (according to http://support.apple.com/kb/ht1925):
1. iTunes
2. Apple Software Update
3. Apple Mobile Device Support
4. Bonjour
5. Apple Application Support

I needed to uninstall the following also, although it did not say so on Apple’s web page so I am unsure the web page is up to date:
6. iCloud

Then restart your computer.

Then download the latest version of iTunes from Apple, and run the installation.

2013-10-21

Safe Enum Pattern

Here’s my implementation of the Safe Enum Pattern.

Why? Because Enums are kind of cumbersome to handle, and you need to use methods like Enum.Parse and Enum.ToObject etc, and you cannot compare them to string without casting them to string.

I just wanted to collect all my constant strings in one place, and also allow them to be constrained to a set of values, so that I can send them as parameters to a function knowing that only my predefined legal values will be allowed.

So to make it easy to compare them I have implemented the IEquatable<T> interface, and also operator overloading on the == and != operators, so that I can do this:

PropertyName myPropertyName = getPropertyName();
if(myPropertyName == “test”) { /*… do stuff */ }

I can also have a function like this:

public object GetPropertyValue(PropertyName propertyName)
{
    ….
}

And I am guaranteed that only my set of valid strings will be allowed as a parameter, like enums really.

Well, here’s the code:

public class SafeEnumBase : IEquatable<string>, IEquatable<SafeEnumBase>
{
    
public SafeEnumBase(string name) { Name = name; }
     public string Name { get; protected set; }
     public override string ToString() { return Name; }
     #region IEquatable<T> implementetion
     public bool Equals(string other)
     {
         return (other == Name);
     }
     public bool Equals(SafeEnumBase other)
     {
         return (other.Name == Name);
     }
     #endregion
     #region OPERATOR OVERLOADING allows comparing objects to strings and objects to objects without need to specify which property to compare
     public static bool operator ==(SafeEnumBase p1, PropertyName p2)
     {
         return p1.Equals(p2);
     }
     public static bool operator !=(SafeEnumBase p1, PropertyName p2)
     {
         return !p1.Equals(p2);
     }
     public static bool operator ==(SafeEnumBase p1, string p2)
     {
         return p1.Equals(p2);
     }
     public static bool operator !=(SafeEnumBase p1, string p2)
     {
         return !p1.Equals(p2);
     }
     #endregion


}



public sealed class PropertyName : SafeEnumBase

{
     private PropertyName(string name) : base(name) { }

     public static readonly PropertyName ID = new PropertyName("ID");
     public static readonly PropertyName NAME = new PropertyName("NAME");
     public static readonly PropertyName NUMBER = new PropertyName("NUMBER");
     public static readonly PropertyName TYPE = new PropertyName("TYPE");

}


public sealed class ClassName : SafeEnumBase
{
     private ClassName(string name) : base(name) { }


     public static readonly PropertyName CUSTOMER = new PropertyName("CUSTOMER");
     public static readonly PropertyName EMPLOYEE = new PropertyName("EMPLOYEE");
     public static readonly PropertyName ADMIN = new PropertyName("ADMIN");
     public static readonly PropertyName TYPE = new PropertyName("TYPE");
}


2013-08-27

My Instagram Tags Collection (work in progress)


Animals

#igw_animal #natureskingdom #animal_digest #petsofinstagram #petstagram

Beauty

#jaw_dropping_shots #stunning_shots #flawless_shots #instagood #all_my_own #ig_watchers #ig_captures #ig_exquisite

#jaw_dropping_shots – follow follow @jaw_dropping_shots
#stunning_shots – follow @stunning_shots
#flawless_shots – follow @flawless_shots
#instagood – follow @instagood
#all_my_own – follow @allmyown
#igw_photo – follow @ig_watchers
#ig_captures – follow @ig_captures
#ig_exquisite – follow @ig_exquisite

Children

#thechildrenoftheworld #thepursuitofjoyproject #throughachildseyes #ig_kids #instagram_kids #childofig #kids_circle #childrenphotography

City / Urban

#ig_captures_city #citybestpics #rsa_streetview #bestofmycity_2see

Europe / World

#ig_europe #world_union #worldcaptures #world_shotz #worldplaces #worldingram

Nature / Landscape

#love_natura #landscapehunters #landscape_captures #ig_captures_nature #ig_captures_landscape

Norway

#i_love_norway #ignorway #bestofnorway #beautifulnorway #visitnorway #our_amazing_norway #wu_norway #instasfromnorway #igofnorway #life_in_norway #scanshots

Sky / Clouds

#rebel_sky #cloud_skye #cloudonthehorizon #cloudwhisperers #rsa_sky

Sunset

#fairytale_sunset #sunrise_sunsets_aroundworld #sunsetsniper #all_sunsets #ig_sunsetshots #sendmeyoursunset

Travel

#mytravelgram #ourtravelgram #globe_travel #travelgram #travelingram

2013-08-26

Problem with Windows Live Photo Gallery not detecting iPhone 4

I am facing an issue which is that my iPhone 4 is not detected by Windows Live Photo Gallery. Well, sometimes it is showing up and sometimes not.

My computer is running Windows 7 Professional.

I normally connect my phone before I log on to my computer, sometimes even before I turn it on. Not sure if that makes any difference.

When I attach my iPhone, iTunes runs the long lasting process of syncronizing and backing up my phone, so attaching and detaching the phone to see if that helps gets tedious, especially since it seems that iTunes takes posession of the phone and blocks all other programs while the backup is in process, and I must wait for it to finish each time.

Sometimes it does help to detach and attach the phone though, but as I said, it’s a tedious process. There must be a better way!

2013-08-21

Generic Cache Helper

I have written a generic Cache Helper which adds new methods to any object of type T which will add the object to either the global (application) or user (session) cache. It uses the HttpContext.Current.Cache underneath.

Example on how to use the class:

public MyType GetMyObject()
{
     MyType myObject;
     if(CacheHelper.TryGetFromCache(“key”, out myObject))
     {
          return myObject;
     }
     //fetch/create a new object, then cache it and return it
     myObject = CreateNewMyObject();
     myObject.AddToApplicationCache(“key”);
     return myObject;
}

Here’s the code for the Cache Helper:

public static class CacheHelper
{
    public static void AddToSessionCache<T>(this T item, string key) where T : class
    {

        HttpContext.Current.Session.Add(key, item);
    }
    public static void AddToApplicationCache<T>(this T item, string key) where T : class
    {
        AddToApplicationCache(item, key, Cache.NoSlidingExpiration, null);
    }

     public static void AddToApplicationCache<T>(this T item, string key, TimeSpan slidingExpiration) where T : class
    {
        AddToApplicationCache(item, key, slidingExpiration, null);
    }    

    public static void AddToApplicationCache<T>(this T item, string key, TimeSpan slidingExpiration, CacheDependency dependency) where T : class
     {
         HttpContext.Current.Cache.Add(key, item, null, Cache.NoAbsoluteExpiration, slidingExpiration, CacheItemPriority.Normal, null);
     }

     public static bool TryGetFromCache<T>(string key, out T item) where T : class
     {
         if (HttpContext.Current.Session[key] != null)
         {
             item = HttpContext.Current.Session[key] as T;
             return true;
         }
         if (HttpContext.Current.Cache[key] != null)
         {
             item = HttpContext.Current.Cache[key] as T;
             return true;
         }
         item = null;
         return false;
     }
}

Please use as you will, and at your own risk.

2013-03-21

Fiddler tricks

Capture traffic from localhost:
  • Add a dot after “localhost”, so it becomes http://localhost.
    • This does not always work. On my Windows Server 2008 R2 box, it does not.
  • Access your web using the (netbios) machine name.
  • Access your web through the fiddler proxy: http://ipv4.fiddler/AppName
  • Run your web’s application pool under the same account that fiddler is running under, ie. the account you are logged on as.
    • NB! This also has the MAJOR benefit that you will see web service calls from your website.
    • IIS Express by default runs as the logged on user, so Fiddler will capture traffic.
Source:
http://weblogs.asp.net/lorenh/archive/2008/01/10/tip-for-using-fiddler-on-localhost.aspx