ASpeak IOpine!

Boost Firefox Startup Performance

Posted on September 6, 2010

I have been an avid user of Firefox in the past. I was so much in Firefox customization that one of my friend stated once that I would start using Firefox OS if it ever comes out. Firefox didn’t start it but Chrome did which I switched on not many months back. Chrome replaced Firefox for me in my normal day to day usage primarily because of its sheer fast launch time. Clicking on a link will take several seconds for Firefox to start whereas chrome will come up almost instantly. However, I always missed my favorite extensions from Firefox and being a software developer I was still forced to use Firefox for various reasons. Recently, I thought of giving Firefox another shot and thought of looking at alternate ways to make it stand against chrome and thereby replacing chrome with Firefox for my daily usage. This was primarily motivated by my observation that Firefox v3.6.x has fixes for RAM issues which has long been a nightmare for Firefox users like me.

I tweaked around settings based on several guides on internet. Cleaning cache at shutdown is an ultimate solution. Set this in the preference and the performance benefit in next launch is very noticeable. There are many other ways to optimize Firefox performance which one should Google to find out.

Another tangential approach in the optimization was to avoid launching new instances of Firefox and have just one available to me all the time. Being a devoted keyboard usage, I use “Executor” for launching my tasks with customized keyboard shortcuts. You maybe using other apps viz. launchy etc. I looked through Firefox command line options and identified a way to start Firefox in a new tab instead of a new window. This was super efficient as it didn’t spawn new windows and stopped cluttering of windows. Just set the Firefox to open with “-new-tab http://www.google.com” parameter. One can do the same with any custom Firefox shortcut on the desktop.

I also installed an extension called “Minimize On Start and Close”. This nifty little extension allows me to minimize the Firefox on closing or on pressing escape. This helps me keep an instance alive. I don't really use minimize on close as I like the ability to close Firefox if needed. Luckily, all this is configurable. I have also removed the Menu bar from the top by unselecting it in the context menu. I can always access it by pressing Alt and it gives me more viewing area like chrome.

“about:config” has plethora of options to customize if you know what you are doing. Try out yourself when you have free time and share your experience.

Filed under: General No Comments

First encounter with OData

Posted on May 3, 2010

After installing VS2010 Professional I could not resist my temptation to start spelunking the newer features available to me. I have seen a couple of videos about OData in Mix10 and I thought it would be the easiest to begin with. I didn’t know the very first encounter with creature of this type would demystify a bug in it. I opened up my solution which comprises of various test projects. I added a new Console Application Project targeting the DotNET4ClientFramework. I added reference to the Mix10Live OData Feed and followed as was demonstrated by presenters in the mix video.

Following is the code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ODataTest.Mix10Live;

namespace ODataTest
{
    class Program
    {
        static void Main(string[] args)
        {
            EventEntities eventEntities = new EventEntities(new Uri("http://api.visitmix.com/OData.svc"));
            try
            {
                var query = eventEntities.Speakers.Where(x => x.Sessions.Count > 0).Take(10);
                query.ToList().ForEach(x =>
                    {
                        Console.WriteLine(new String('-', 10));
                        Console.WriteLine(x.SpeakerDisplayName);
                        Console.WriteLine(x.Bio);
                        x.Sessions.ToList().ForEach(y => Console.WriteLine("Session: {0}", y.Title));
                        Console.WriteLine(new String('-', 10));
                    });
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
    }
}

The LINQ Query generates following URL:

 http://api.visitmix.com/OData.svc/Speakers()?$filter=Sessions/Count gt 0&$top=10

Following the URL leads to an xml output which gives following error

An error occurred while processing this request. Property 'System.Nullable`1[System.DateTime] PublishedDate' is not defined for type 'System.Data.Objects.DataClasses.EntityCollection`1[api.visitmix.com.Session]' System.ArgumentException at System.Linq.Expressions.Expression.Property(Expression expression, PropertyInfo property) at System.Linq.Expressions.Expression.MakeMemberAccess(Expression expression, MemberInfo member) at System.Data.Services.ExpressionVisitor.VisitMemberAccess(MemberExpression m) at System.Data.Services.ExpressionVisitor.Visit(Expression exp) at System.Data.Services.ExpressionVisitor.VisitBinary(BinaryExpression b) at System.Data.Services.ExpressionVisitor.Visit(Expression exp) at System.Data.Services.RequestQueryProcessor.ComposePropertyNavigation(Expression expression, LambdaExpression filterLambda, Boolean propagateNull) at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseMemberAccess(Expression instance) at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseIdentifier() at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParsePrimaryStart(ExpressionLexer l) at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParsePrimary() at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseUnary() at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseMultiplicative() at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseAdditive() at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseComparison() at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseLogicalAnd() at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseLogicalOr() at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseExpression() at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseWhere() at System.Data.Services.Parsing.RequestQueryParser.ParseLambdaForWhere(IDataService service, ResourceSetWrapper setForIt, ResourceType typeForIt, Type queryElementType, String expression) at System.Data.Services.Parsing.RequestQueryParser.Where(IDataService service, ResourceSetWrapper setForIt, ResourceType typeForIt, IQueryable source, String predicate) at System.Data.Services.RequestQueryProcessor.ProcessFilter() at System.Data.Services.RequestQueryProcessor.ProcessQuery() at System.Data.Services.RequestQueryProcessor.ProcessQuery(IDataService service, RequestDescription description) at System.Data.Services.RequestUriProcessor.ProcessRequestUri(Uri absoluteRequestUri, IDataService service) at System.Data.Services.DataService`1.ProcessIncomingRequestUri() at System.Data.Services.DataService`1.HandleRequest()

This looks strange as I did not use PublishedDate in my code and the service reference was generated entirely by the IDE. On Twitter, I was told that the “Count” filter is invalid. Now, since the query is generated by Linq2OData, the onus is on either OData or on Linq2OData to provide compatible query or generate error while generating the query itself.

I played around a little more and modified the LINQ query as follows


var query = eventEntities.Speakers.Where(x => !String.IsNullOrWhiteSpace(x.Twitter)).Take(10);

This time it gives me following error

{Error translating Linq expression to URI: The expression Not(IsNullOrWhiteSpace([10007].Twitter)) is not supported.}

So, this is established that the LINQ does validate the linq expression before generating the OData uri and also, not all LINQ operators are compatible with OData operators.

I would like to know where the bug resides, in OData or LINQ.

Tagged as: , , No Comments

Debug installer

Posted on June 17, 2009

The installer created using WIX was failing. I had no option but to perform following on command line:

msiexec -i MYSETUPFILE.msi /leavx log.txt

This will create a log file for the installer when this command is invoked. The failure sequence can be traced from the log file and is relatively simpler to debug the setup issue.

Funny Out of Office Messages

Posted on May 29, 2009

We all have times when we are off for a few days from work and we want the email senders to be automatically notified of it. In outlook you can use Out of Office Assistant wizard for this purpose.

image 

While searching for good funny out of office quotes, I stumbled across following set of hilarious messages. Some are offending but worth a try.

1- I am currently out at a job interview and will reply to you if I fail to get the position. Be prepared for my mood.
2- You are receiving this automatic notification because I am out of the office. If I was in, chances are you wouldn’t have received anything at all.
3- Sorry to have missed you but I am at the doctors having my brain removed so that I may be promoted to management.
4- I will be unable to delete all the unread, worthless emails you send me until I return from vacation on 5/18. Please be patient and your mail will be deleted in the order it was received.
5- Thank you for your email. Your credit card has been charged $5.99 for the first ten words and $1.99 for each additional word in your message.
6- The e-mail server is unable to verify your server connection and is unable to deliver this message. Please restart your computer and try sending again. (The beauty of this one is that when you return, you can see how many in-duh-viduals did this over and over).
7- Thank you for your message, which has been added to a queuing system. You are currently in 352nd place and can expect to receive a reply in approximately 19 weeks.
8- Please reply to this e-mail so I will know that you got this message.
9- I am on holiday. Your e-mail has been deleted.
10- Hi. I’m thinking about what you’ve just sent me. Please wait by your PC for my response.
11- Hi! I’m busy negotiating the salary for my new job. Don’t bother to leave me any messages.
12- I’ve run away to join a different circus.
13- AND, FINALLY, ABSOLUTELY THE BEST: I will be out of the office for the next 2 weeks for medical reasons. When I return, please refer to me as ‘Loretta’ instead of ‘Anthony’

 

I can see the smile on your face :)   If you have any other funny quote then share with me.

Forcefully delete an assembly from GAC

Posted on April 17, 2009

image 

Very often during development we try to remove an assembly from GAC. However, due to many reasons the assembly might not get deleted and the above screen is displayed. There is no easy way to remove this assembly as it may be locked due to numerous reasons and one might need to break his head identifying the proper reason behind this.

However, there is an easy solution to this problem.

Open “regedit” and navigate to “HKEY_CLASSES_ROOT\Installer\Assemblies\Global”. In this location one can find the list of all the assemblies which are registered in GAC. Delete the appropriate entry from this list. Now you can delete the assembly from GAC as well. This is a simple trick to get rid of that stubborn assembly which was stuck in your GAC.

I hope this simple trick will save many man hours ! :)