Sunday, February 15, 2009

Firefox Redirect loop error for GMail

Since yesterday I started getting a weird 'Firefox Redirect Loop' error whenever I try to access GMail in Firefox. The exact error message goes something like this.

Redirect Loop

Firefox has detected that the server is redirecting the request for

this address in a way that will never complete.

The browser has stopped trying to retrieve the requested item. The

site is redirecting the request in a way that will never complete.

* Have you disabled or blocked cookies required by this site?

* NOTE: If accepting the site's cookies does not resolve the

problem, it is likely a server configuration issue and not your

computer.

Here is a screenshot of the same:



This was driving me nuts. I tried some obvious things like restarting firefox, rebooting my machine. Needless to say none of them fixed the problem.

Then I started looking on internet for any fixes and all of them talked about cookies. One of the recommended fix that I saw over and over was to clear cookies. The steps are as follows:

Tools > Options > Privacy > Clear Now > Make sure that cookies option is checked before you clear data.

This fix did work but it was temoporary relief. The error was back once I close the GMail tab. Upon further digging through the forums I found somewhere that it this error was caused by a Firefox add-on but they did nto mention whichone. My initial suspects were all add-on's I have that concern with GMail and cookies like 'Better GMail 2', 'GMail Manager', 'FireCookie' etc. I started going through the reviews for these add-on's to find any mention of this error.

Bingo, I found that 0.5.7 version of 'GMail Manager' was responsible for this problem. The author put out a new version 0.5.7.1 which can he found here.

Hope this is helpful.


Powered by ScribeFire.

Sunday, August 31, 2008

Error while loading Pidgin on UBuntu

When I ran Pidgin on UBuntu the other day I got the following error:

Error Reading blist.xml

An error was encountered reading your buddy list. They have not been loaded, and the old file has been renamed to /home/sai/.purple/blist.xml~.

I used the following procedure to debug this process:


Using the following command:

pidgin -d log > ~/Desktop/log.log

I redirected the log messages to a log.log file and then searched that file for 'error' and was able to locate the following:

(23:01:26) util: Reading file blist.xml from directory /home/sai/.purple
(23:01:26) xmlnode: Error parsing xml file: xmlParseCharRef: invalid xmlChar value 5

(23:01:26) util: Error parsing file /home/sai/.purple/blist.xml. Renaming old file to blist.xml~


When I looked at blist.xml file xmlChar 5 it turned out that there were two groups with same names from two different messengers. I then deleted that group, Quit Pidgin and then deleted blist.xml & blist.xml~ from /home/sai/.purple/ folder. After this when I started Pidgin that error was gone.

Please do share if this helps you to resolve your issues.

Tuesday, May 6, 2008

System.Data.DataSetExtensions Build Error

Today I opened a Web Application (developed by someone else) from a client and tried to build it in Visual Studio 2008 and I got this build error:

Could not load file or assembly 'System.Data.DataSetExtensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

Upon further investigation I figured out that the Framework 3.5 has changed the System.Data.DataSetExtensions from version 2.0.0.0 to 3.5.0.0. To resolve the problem,

1. Right-Click on the Web project and select "Property pages", The following window will load up and we can clearly see in the following screenshot that the System.Data.DataSetExtensions assembly is of the version 2.0.0.0.

2. Highlight the v2.0.0.0.0 assembly and re-add the same assembly using the Add button. The Property pages should now look as follows:
3. That's it you are done, atleast with this error....

In this blog article I would like a take a simple code example in C# and explore the different ways of expressing it using LINQ, Anonymous methods and Lambda Expressions.

Code Sample:
Let's start by defining a simple class Person

public class Person
{
public Person(string name, int age)
{
if(!string.IsNullOrEmpty(name) & age > 0)
{
Name = name;
Age = age;
}
}

public string Name { get; set; }
public int Age { get; set; }
}

As first step let's create a List<Person> and initialize with some people as follows:

static void Main(string[] args)
{
PopulateSample();
}

private static void PopulateSample()
{
persons = new List<Person>();

persons.Add(new Person("Joe", 40));
persons.Add(new Person("Steve", 35));
persons.Add(new Person("Mike", 29));
persons.Add(new Person("Dan", 45));
persons.Add(new Person("Jeff", 30));
}

Now that we have some data to work with as a next step let's try to find all the people in the list whose age is above 31 and print their names. As soon as try to write a solution to this, the first thing that comes to my mind is iterating through the list using a foreach loop. A very basic code sample would be as follows:


private static void ExecuteSampleUsingForEach()
{
Console.WriteLine("The Result using Foreach method:");
foreach(Person p in persons)
{
if(p.Age > 31)
{
Console.WriteLine(p.Name);
}
}

}

There is absolutely nothing wrong with this approach. But there are different methods of representing the same thing in code. The following methods may look very different but they all yield the same result.

private static void ExecuteSampleUsingAnonymousMethod()
{
IEnumerable<Person> peopleWithLongNames = persons.FindAll(delegate(Person p){return p.Age > 31; });
Console.WriteLine("The Result using Anonymous Method:");
foreach(Person person in peopleWithLongNames)
{
Console.WriteLine(person.Name);
}
}

private static void ExecuteSampleUsingLINQ()
{
IEnumerable<Person> peopleWithLongNames = from p in persons where p.Age > 31 select p;
Console.WriteLine("The Result using LINQ:");
foreach(Person person in peopleWithLongNames)
{
Console.WriteLine(person.Name);
}
}

private static void ExecuteSampleUsingLambdaExpressions()
{
IEnumerable<Person> peopleWithLongNames = persons.Where(p => p.Age > 31);
Console.WriteLine("The Result using Lambda Expressions:");
foreach(Person person in peopleWithLongNames)
{
Console.WriteLine(person.Name);
}
}

As a developer one of my goals is to write less but elegant code. With Framework 3.5 C# gives so many options to do the same thing. As developers it's up to us to use the right way at the right place.

Wednesday, April 23, 2008

Tortoise SVN - Ignoring unwanted file check-in

One of the annoyances with Tortoise SVN is keeping away from checking in binaries (*.exe, *.dll etc) and other unwanted files. There is neat trick that can help with this.

> Right-Click on any source controlled file/folder and select Settings. The following window should pop-up:

In the General > Subversion > Global ignore pattern filed enter all the extensions that you want to be ignored. A sample entry would be as follows:
*/bin */obj *.bak *.*scc *.user *.suo *.webinfo bin obj *.dll *.pdb *.exe

Sunday, April 13, 2008

Pittsburgh CodeCamp

A major portion of my day on Saturday was spent at Pittsburgh Code Camp. Being a not-so-eager-to-make-friends-at-new-places kinda guy I am I have never been to one of these code camps. It actually was pretty good. I got to meet some old friends.

Lessons learnt:

  • Don't be fooled by the presentation topic names, some of the topics are NOT as advanced as the topics suggest
  • Take my laptop next time I attend this so that when I get bored just write a blog or read some feeds using Google Gears (as there was no internet connection there)
  • It's not just about the presentations that are made, it's about meeting new people, catching up with old ones
  • If I am looking for a job this is where I wanna be
Some of the Presentations attended:
  • Getting Started with Silverlight 2 - John Juback from ComponentOne (presentation notes will be made available here in couple of days)
  • Refactoring in C# - Bad code to better code - Jonathan Cogley
  • Advanced Unit Testing with Mock Objects - Jeremy Jarrell (presentation notes is available here)
Overall it was a rewarding experience and I should really applaud and Pittsburgh .NET User Group & Pittsburgh Technical Council for conducting this code camp.

InputBox in C# and VB.NET

For developers with VB background InputBox may not be a new thing but for C# and VB.NET programmers developing Windows Forms (OR WinForms) this may seem alien. The reason this is not familiar to the WinForms developers is that it is not under the namespace "System.Windows.Forms" where all the other WinForms controls are available. InputBox is actually a method that can be used to collect some information from user. A screenshot of a input box is shown below:

In order to use InputBox, we need to add a reference to Microsoft.VisualBasic.dll

The method signature for InputBox looks as follows:
public static string InputBox( string Prompt, string Title, string DefaultResponse, int XPos, int YPos )

More information on the input parameters can be found here.

A sample usage in C# can be as follows:
string userInput = Microsoft.VisualBasic.Interaction.InputBox("Enter your name", "My Title", "default", 0, 0);

Note: If the user clicks cancel string.Empty is returned.