Ehsanul Haque

Welcome to my personal site & blog

18 January
0Comments

Tricks for MS Excel: Add a frozen header row and set alternate background colors for rows

Here are couple of tricks for MS Excel users.

First we take a look at how to add a “Frozen” header row. Frozen header row is the one you could have for a very long worksheet. This row will be frozen (to act as the column header) and rest of the rows will scroll. Here’s how to do this.

1. Select the row below the one you want to be the header (or be frozen)

2. From Window menu select Freeze Panes (for MS Excel 2007 click on the View tab and inside Window panel click on Freeze Panes and pick the first option which is also Freeze Panes)

The frozen row will have a border at the bottom. Simple but an essential option for MS Excel users.

Second trick is the alternate background color for rows in the MS Excel worksheet.

1. Select the rows

2. From the Format menu go to Conditional Formatting (or in MS Excel 2007 under Home tab click on Conditional Formatting from Styles panel and click on New Rule)

3. When the window appears select Formula Is… (or on MS Excel 2007 select the last option Use a Formula to Determine Which Cells to Format)

4. Add this formula: =mod(row(),2)=1

5. Then click on Format button and go to Fill tab

6. Pick the color that will be used as the alternate color

7. Hit OK and go back to the worksheet

You will see the worksheet has alternate background colors.

30 November
0Comments

Import contacts from Blackberry to iPhone 3GS

If you are switching from Blackberry to iPhone 3GS, you must be trying to import all your Blackberry contacts to iPhone 3GS. When I switched to other phones before I always copied all my contacts to SIM and import them to the new phone. Most of the time the format would be different for the phones so you will end up editing the contacts. But with Blackberry to iPhone 3GS the process was really simple and clean.

I downloaded Blackberry Desktop Manager on my Mac Book Pro. After installing the BDM I had to reboot my Mac. After Mac restarted I plugged in my Blackberry on USB and started BDM (Blackberry Desktop Manager). Synced the contact with my Mac Address Book. After it was done I plugged in my iPhone 3GS with Mac and synced it using iTunes.

In few minutes and with few easy steps I’ve all my contacts on iPhone 3GS from Blackberry. I didn’t try to do it on my PC but I believe the process will be close to Mac, if not similar.

Enjoy!

31 December
2Comments

Inanis Glass theme for Wordpress: Set the clock to 24hr format

I have installed Inanis Glass theme (v. 1.2) for my Wordpress blog and it is really an amazing theme. It was very easy to install (unlike other themes where something is always missing or not fitting). I made small changes here and there to make it work the way I want. For example, it showed a message on the pages or articles where I turned off the comments that the comments are off etc. I modified it to remove that. Made few more CSS changes.

When I visited the author’s website I found few requests to show the clock in 24hrs format. When I looked at the javascript (functions.js) for the theme I found that the “clock” function is compressed by http://javascriptcompressor.com/. When I visited that site to see if they have any decompressor then I found a contribution on their forum which unpacks/decompresses the javascript – read about it on their forum http://javascriptcompressor.com/forums/p/9/42.aspx – and decompressed the “clock” function.

Decompressed/unpacked function looks like:

function init() {
   timeDisplay=document.createTextNode("");
   document.getElementById("clockhr").appendChild(timeDisplay);
   timeDisplay1=document.createTextNode("");
   document.getElementById("clockmin").appendChild(timeDisplay1);
   timeDisplay2=document.createTextNode("");
   document.getElementById("clockpart").appendChild(timeDisplay2)
}
function updateClock() {
   var currentTime=new Date();
   var currentHours=currentTime.getHours();
   var currentMinutes=currentTime.getMinutes();
   currentMinutes=(currentMinutes<10?"0":"")+currentMinutes;
   var timeOfDay=(currentHours<12)?"AM":"PM";
   currentHours=(currentHours>12)?currentHours-12:currentHours;
   currentHours=(currentHours===0)?12:currentHours;
   document.getElementById("clockhr").firstChild.nodeValue=currentHours;
   document.getElementById("clockmin").firstChild.nodeValue=currentMinutes;
   document.getElementById("clockpart").firstChild.nodeValue=timeOfDay
}

Basically the Javascript function used to find the current time – getHours() – returns the hour in 24hrs format. But to display the clock in 12hrs format the author has done some math. So if anyone wants to display 24hrs format clock comment out line number 14, 15, 16 and 19. To replace the function you can use the site above to re-compress the function or comment the existing function in functions.js file (clock function) and paste this decompressed version in the file.

Note: As I understand javascriptcompressor.com is used to pack/compress your javascript, not to encrypt it or hide it by any means. It is compressed so that it is either unreadable or smaller in size.

24 August
4Comments

New functionality for Grab Yahoo

I have added a new functionality for the Grab Yahoo class. Soon after I released the patch, I figured out that I could add this new functionality which did not take me much time to implement. This new feature will allow you to grab your Yahoo! Calendar in an array format.

Using Yahoo’s calendar export feature, I grab the CSV file and parse it to form an array. This was a very simple addition as it uses same method as Address Book parsing. Only thing that was different was the way I had to parse the CSV, which Yahoo creates for Outlook. I don’t have any further plan to upgrade this class but do have other plans to build similar web service based classes.

Please download the latest version of grab yahoo class (v.1.3) here.


Thank you.

20 December
14Comments

Javascript: Select Multiple Dropdown Items

If you would like to have a multiple select dropdown and want to use the selection in a specified format, then here is the solution. Sometimes you may need to create a query string value or fill in a textbox or textarea with the selected values. Say for example you have a dropdown list where you can select multiple items. Upon selecting each option you want to fill in a textarea with the selected value.

Example:


HTML Part:

<form method=POST name='testing'>
  <select name='testsel' multiple onchange='showselection()'>
    <option value="one">one</option>
    <option value="two">two</option>
    <option value="three">three</option>
  </select>
  <textarea id="txtEditions"></textarea>
</form>

Javascript Part:

<script language='javascript'>
  function showselection()
  {
    var frm = document.testing
    var opt = frm.testsel

    var numofoptions = opt.length
    var selValue = new Array

    var j = 0
    for (i=0; i<numofoptions; i++)
    {
      if (opt[i].selected === true)
      {
        selValue[j] = opt[i].value
        j++
      }
    }

    selValue = selValue.join("+")

    document.getElementById("txtEditions").innerHTML = selValue
  }
</script>