Archive for March, 2009

Optimze SQL Queries for UserControls in Sitecore

Tuesday, March 31st, 2009

sitecore-xpath

Many times we have to deal with the process of getting content from a database, then sorting it and then displaying it to the user. Recently I was given a task of optimizing a user control on the website that pulls upcoming and past events for a particular category. The way this thing was programmed was something like this:

  • Pull all the event data  irrespective of the category. More than 1000 records.
  • Put all events starting from current datetime in upcoming list
  • Put events dated prior to current date in past list
  • Grab the page category name and filter both upcoming and past lists
  • Display events in respective placeholder/view

This logic was spun across the site as the upcoming/past event controls were almost everywhere. It was taking up to 5 seconds to run this whole process for each user, thereby making it really slow when there are 1000s of users. The first thing I did to fix this is analyzed the queries using Sitecore’s built in X-Path query builder. I could clearly see that although grabbing all the events from the parent directory was taking less time than filtering out events per category. But I was certain that when we fit this filtered data into respective user controls things will be faster. Here’s what I did:

  • Modified sitecore query to grab events per field name.
    Using something like (C#): /sitecore/content/calendar events/calendars/meeting events//*[@@templatename = 'Meeting' and @Short Title = '" + Sitecore.Context.Item.Name + "' or @Short Title = '" + Sitecore.Context.Item.Name.ToUpper() + "']
  • Now that I have events specific to just one category. Only 10 to 20 records. I sorted them based on currentdate to see if its an upcoming or past event.
  • Display events in respective placeholder/view

This logic took less than a second to process the whole thing. Not sure why the previous designers thought about it before. So, the moral of the story is, If data is huge collectively (as in all categories here), pull only what you need. Others may argue.

myView: Open Source hobbies slowly shifting to earnings

Friday, March 20th, 2009

I used to see people create open source scripts/softwares and give out for free to the community and rely on donations to make few bucks out of it. Not really a good source of income but wouldn’t hurt if you do something as a hobby and people donate you some cash when they use it. But relying on donations may not fetch you as much as it would if you sell your script for a buck or two.

The way I see it, open source hobbyists are becoming smarter in business models and instead of giving the product for free, they are charging 99 cents to 5 bucks. A silly Magento CAPTCHA module I came across sells at $4.99 and most of the scripts from the vendor are of the same price. The vendor also has a community forum for people to help each other if they fall short of handling support tickets.  With this kind of business model you (vendors or freelancers) are sure to make good profit. iPhone Apps are another good example of how people are being tempted to own an app for just 99 cents. Considering millions of downloads of each app, you will be quick to make a million.

My advice to freelancers building products in free time, sell your product for a buck or two rather than put it free.

About myView: myViews are totally my point of view of things I see in the industry. Could be a good analysis or just stupidity.

It’s all about staying connected.

Wednesday, March 4th, 2009

logmein-ignition-iphoneLogMeIn provides easy access to your computers (with static or dynamic IP) from any other computer using nothing but just a web browser (of course, internet too). I’ve been using LogMeIn’s  free service for a while now and I really enjoy it. Especially when I am at work and need to quickly access my PC either to grab some songs or files, I find this tool really handy. I know there are other services out there but I am so happy with LogMeIn that I never felt a need to try something else.

Recently, LogMeIn came up with an ignition/app for iPhone/iPod that will allow you to do the same as with a computer. It’s currently priced $30 (probably the most expensive app on the AppStore) and its totally worth every penny. If you are a freelancer living a nomad life and own an iPhone or iPod, then I strongly recommend going for this app.

Before I end this quick review, the connection speed when using on WiFi is obviously faster than 3G. But it wont disappoint you. Unless you are living in some deserted area with bad 3G reception. I haven’t had a chance to try it on 2G iPhone.

iPhone App Development Offer!

Monday, March 2nd, 2009

 

So I have this crush on my new iPhone… I’ve been discovering new things each day and it goes on impressing me with cooler apps, or features every day.

Like many things I want… I always wanted to create an iPhone/iPod application based on some of my ideas and put it on the App Store. I’ve been reading quite a lot on how to get it done and feel pretty confident about it. The only problem seems to be the hardware… I am more of a PC guy, been with windows my entire life and the iPhone SDK doesnt seem to give a *hit about PC. So the bottom line is, I need to either buy a Mac, or tweak my PC to install OS X and then pray for iPhone SDK to work flawlessly (which doesnt seems to be the case based on my research). The only recommendation I am getting from my friends and associates is to get a Mac…

Thus, I started looking for some new and refurbished options… while refurbished machines are great, I am just not into saving few bucks and getting a used piece. So, I’ve decided to get a new one… and thinking whether to go with a Mini or Book… Since, both seems to serve the purpose, I am kinda tempted to go with the aluminum macbooks…  Now that the expense of buying one is coming down to somewhere around $1700 (yeah, I want a good config machine), I am getting in touch with my clients who were once interested in getting an iPhone application done, to sponsor me for the hardware… what do they get in return? Well, theres a lot in the offering. First, service valued upto $2500 (redeemable once or in multiple phases), secondly, free hosting on my supreme servers for 5 years, finally, a free iPhone app based on their idea (upto $1000)… thats more than $5000 for just a mac book!

Interested in sponsoring me? contact me now before someone else does. Think, its too late? you can still get in touch to see the current exclusive vaked.com offers.

About Me

Like most of the people living in USA, I recently joined 'the two jobs on shoulder' club. Working my ass off throughout the day as a software consultant and at night as a freelance web developer, this is my attempt at earning $1.1 million in 3 years. While this blog is mainly focused at freelancing, I take pleasure in writing about other things that interests me. If you like any of my posts, please do subscribe! And also keep an eye on my goals list ;) More

Want to subscribe?

 Subscribe in a reader Or, subscribe via email:
Enter your email address:  

hireme

Find entries :