@भि कहिन

my personal web log

Pic of the day

Posted by @bhitalks on July 9, 2009

@bhitalks

View of the landscape and skyline of Teesta Valley

Posted in Summer of 2009 | Tagged: | Comments Off

Office Web Apps

Posted by @bhitalks on June 11, 2010

Office Web Apps was up for evaluation for a long time when it was introduced as a Technical Preview along with Office 2010 to select participants. I received this news today…

Office Web Apps are now available for general public on Windows Live. The initial release is available to Windows Live customers in the USA, Canada, Great Britain and Ireland only. Later on by next week when MS Office 2010 is released, this will be extended to all customers.

Also, important news is that Office Web Apps will be available for free on Windows Live for general public starting two weeks from now!

Official announcement is here: http://blogs.msdn.com/b/officewebapps/archive/2010/06/07/10021218.aspx

I have been evaluating Office Web Apps for some time now. Here is a little screenshot walkthrough for you all:

clip_image002

When you log in to Windows Live (or SkyDrive), you see a new link called “New”, clicking which drops down to show a menu to create new Word, Excel, PowerPoint and OneNote documents. There are quick icons on the right too to do the same (but these icons are not visible always). You can also create/open a document in Office 2010 and then “Send to Web” using the “Share” option on “BackStage”, which will publish it to your SkyDrive account on Windows Live. The documents on SkyDrive can then be marked private or shared or public depending on how you want to share them. Co-Authoring is a new feature in Office 2010 and extends to Office Web Apps as well. This is in direct competition to share documents on Google Docs where multiple users can work on the same document from different places. But Microsoft Office Web Apps are far ahead!

clip_image004

Let’s see what happens when I click on the create new “Excel Workbook” menu option (as shown above)…

Windows Live asks for the filename to be given to the new document (notice that extension and hence version cannot be changed). Office Web Apps are limited to Office 2010 documents, however these documents are backward compatible with Office 2003 and Office 2007 by using document convertors.

Now once I give a filename (Sample.xlsx) in this case, it opens up the Excel Web App to edit and manage the document…

clip_image006

Notice how polished the interface is and how closely it resembles the Desktop version of Office 2010 including the “Ribbon Bar” and the “Backstage”! The application is very responsive and rightly so because it is based on Silverlight. Try looking at the source in Internet Explorer or use the Development Tools to inspect the DOM. You will find it very interesting and informative. The Excel Web App feels just like its desktop counterpart. Arrow keys work exactly the same, Double-click on column separator and column-autofit works exactly the same, F2 to edit a cell works and so do all keyboard shortcuts. Try entering a formula (although the sophisticated formula wizard is absent), but the auto-suggest works like a charm. (see the above screenshot). Notice the bottom-right corner where you will see how many people including you are currently working on this document. You may pull out presence information if you have Microsoft Live Communicator installed.

The backstage looks exactly same as its desktop counterpart, however the menu options are different to suit the web application…

clip_image008

Notice the above screenshot with “BackStage” open. There is no “Save” option! The documents are saved automatically!

It seems great as of now. Surely a Google Docs killer in my opinion. Do give it a try at least. You have to use it to believe it.

Okay, if you have seen the announcement, you must be aware that is open only for a few locations (USA, Canada, Great Britain and Ireland). It will still take some time before it opens out to all. If you have Office 2010 Beta or Trial version installed then you can start right away by sending your document to Web using the “Share” option on “BackStage”.

However, if you do not have Office 2010 (or for some reason unable to upload a document), then here is a little trick:

  1. Login to you Windows Live account at: http://windows.live.com or at http://skydrive.live.com
  2. Now once you are logged in, sign-up for the tech preview at: http://skydrive.live.com/acceptpreview.aspx/.documents?aobrp=browse
  3. This will add Office Web Apps to your live account and you can start creating and sharing your documents as shown in above screenshots.

So, if you haven’t already tasted it, do it now!

-@bhitalks

Posted in Web Development | 1 Comment »

Problem with jQuery fadeOut with remove

Posted by @bhitalks on March 29, 2010

I faced this peculiar problem when trying to remove an element from DOM after fading it out. Ditto for slideUp or other similar methods.

This is what I was trying to do;

$('#elem').fadeOut('slow', function() { $('#elem').remove(); });

But this wasn’t working out as expected. It should have removed the element from the DOM after it finished fadeOut on the element. But to my frustation, it wouldn’t. The element was very much there albeit hidden owing to its display set to ‘none’ courtesy fadeOut.

As usual, my first saviour being Google, I googled. Only to find the same snippet (as above) being suggested on several sites!

After much struggling with it, found out that I was attempting to remove the element within the context, which in effect was failing.

The correct way would be to call the method on the context reference, i.e. ‘this’. So the technique becomes:

$('#elem').fadeOut('slow', function() { $(this).remove(); });

And this works like a charm!

-@bhitalks

Posted in Javascript and jQuery | Tagged: , | Leave a Comment »

Taming Date and Time formats in ASP.Net app ?

Posted by @bhitalks on March 4, 2010

 

You have this great web application being developed and you find yourself struggling with handling date/time data. Days and months have switched places, or even worse table columns have gone awry with width, trying to accommodate long dates instead of expected short format! And you start pulling your hair out of their roots trying to figure out whatever happened to the nice “01/03/2010” format, now showing as “Monday, March 1, 2010 11:15:26 PM”?

Am sure most of you must have at some point of time or other, struggled with taming dates in your ASP.Net application. Is yours a similar story? Let me consolidate here a few options of taming dates that I have learnt during my ordeals with such scenarios.

There are actually two parts to handle date/time formats. One while displaying on the webpage, and the other while trying to capture user input. Well, capturing user input is not the topic of discussion here because there are several calendar controls and other validation mechanisms in place always. So maybe a different post for that. Let’s see how we can control display of date/time data.

Scenario:

We want the date field to be displayed in “01-Mar-2010” format, so that there is no confusion. And yes, we are talking VB.Net here.

Option 1: The easiest way

Like an experienced trapeze artiste, do some acrobatics and put in a “Format” or “FormatDateTime” just before you are spitting out your date/time as a string.

dateString = FormatDateTime(dateField, DateFormat.ShortDate)

A “FormatDateTime” would be ideal, but the server’s culture may not be the format we need. Also, it needs a named format as its second parameter and so cannot be customized. So, do a “Format” instead.

dateString = Format(dateField, "dd-MMM-yyyy")

Ah that looks good. Fine go do that everywhere you are spitting out that date in your code. You have that at a hundred places? Go ahead do that, it is the easiest way. You have gridviews and other complex controls? Go ahead tap in the “RowDataBound” event and do something like this:

e.Row.Cells(4).Text = Format(DataBinder.Eval(e.Row.DataItem, "dateField"), "dd-MMM-yyyy")

Option 2: A little difficult way

Change your custom entity class to spit out a string instead of date. And then do a CDate whenever you need a date type in your code.

For example, for your customer class like this…

Class Customer
    Private _dateField As DateTime
    Public Property Datefield() As DateTime
        Get
            Return _dateField
        End Get
        Set(ByVal value As DateTime)
            _dateField = value
        End Set
    End Property
End Class

… change it to …

Class Customer
    Private _dateField As DateTime
    Public Property Datefield() As String
        Get
            Return Format(_dateField, "dd-MMM-yyyy")
        End Get
        Set(ByVal value As String)
            _dateField = CDate(value)
        End Set
    End Property
End Class

Notice the change in property. We are spitting out a string (formatted) and accepting a string which we convert to date just before assigning internally to our object.

So now you need not to worry. Everywhere in our code we will have a nicely formatted string, data-bound controls and all. You have a gridview bound to a List( Of Customer), nothing to change because the property is a string.

What? You do not have access to the entity layer? Or your controls are bound directly to the database (of course it is a small app, fine). Maybe, you do NOT want to change your code or perhaps you just can’t. Try out option #3.

Option 3: The most difficult part

We don’t know what culture the server follows. We don’t have access to that server anyway. So what we do is, we change the culture settings for our application.

We do that at the page level for any or all aspx pages:

<%@ Page Culture="hi-IN" Language="VB" %>

Or at the web.config level for the entire application (under system.web):

<system.web>
    <globalization culture="hi-IN"/>

Great, the above snippet shows that we changed the culture to Hindi-India. But, this will work only for named formats like ShortDate. Remember our discussion on Option 1 (FormatDateTime named formats) problem? We still do not have a control on this culture because we need a custom format.

So, now we add a little piece of code to our global.asax (inside the Application_BeginRequest handler)

Dim myCulture As CultureInfo
myCulture= CType(CurrentThread.CurrentCulture.Clone(), CultureInfo)
myCulture.DateTimeFormat.ShortDatePattern = "dd-MMM-yyyy"
myCulture.DateTimeFormat.DateSeparator = "-"
CurrentThread.CurrentCulture = myCulture

Don’t forget to add reference at the top:

Imports System.Globalization
Imports System.Threading.Thread

So what we are doing here is to implement a custom culture changing the date formats. In order to do this, we clone the current culture and change the required formats. Simple. Every time our application is requested, the culture gets customized. You don’t need to change anything elsewhere. No need to do “Format” or “FormatDateTime” scattered everywhere.

I haven’t touched on “Time” here, but as you can see it is the same. You can have it going yourself.

Hope that helps to ease your pain while dealing with date/time data in your web apps.

-@bhitalks

Posted in ASP.Net | Tagged: , , | 1 Comment »

Summer of 2009 – Photos

Posted by @bhitalks on July 1, 2009

The photographs that we took during our trip to Tinchuley and Sikkim are ready.

You may view the slidehows here:

  1. Summer of 2009, Part 1
  2. Summer of 2009, Part 2

 We hope you will like the photographs as much as we did.

Thank you all for patiently standing by for the complete series of this trip.

- Jaishree & @bhimanyu

Posted in Summer of 2009 | Leave a Comment »

Summer of 2009 – Acks…

Posted by @bhitalks on June 1, 2009

This trip of ours would not have been possible without the help of our friends. We appreciate and acknowledge their support..

Kingshuk Bagchi: Our friend at Kolkata. For literally forcing us on Tinchuley!

Santanu Bhaumik: Our friend at Kolkata. For commiting us into this trip. His support in convincing us for Tinchuley is gratifying. His extended support in securing arrangements for us is invaluable!

Dipendra Gurung: Our host at Tinchuley (the Gurung Guest House). For hospitality we can never forget!

Didi: Our co-host at Tinchuley (the Gurung Guest House). For a home away from home!

Milan: Our escort and concierge at tinchuley (the Gurung Guest House). For his spirits, cheerfulness, and enthusiasm with which we got introduced to this wonderful place!

Gelek Gyatso Bhutia: Our tour organiser at Gangtok. For tailoring our itinerary for Gangtok and Nathu-la.

Karma: Our escort at Gangtok. For helping us soak the serenity around Gangtok. Especially, the gorgeous Lingdong monastary.

Sachin: Our escort on the drive to Nathu-la. For his composed driving and letting us enjoy this beautiful valley.

Rahul and Poonam: Our friends at New Delhi. For extending their help to secure our return tickets.

We thank you all for making this trip a memorable one for us.

Posted in Summer of 2009 | Leave a Comment »

Summer of 2009 – Day 9

Posted by @bhitalks on June 1, 2009

Phew.. finally we are going home! After 8 long days of awesome holidays, we are now just not feeling like going back. From what we experienced in the hills, the 45 degree heat of Delhi coupled with noise, crowd and pollution is scaring the hell out of us!We were on cloud nine while returning home!

Got up late today. Lazy. Got ready lazily. Thanks to our friends, the tickets were confirmed and so was our drop to Bagdogra. Took us hardly 45 minutes to reach the airport. 

We landed at Delhi at about 1700 hrs. Reached home by 1900 hrs. Missing our holidays now!

Missing Tinchuley especially!

Posted in Summer of 2009 | Leave a Comment »

Stranded at Siliguri

Posted by @bhitalks on May 31, 2009

Temple at Siliguri

 

With nothing to do at Siliguri, we decided to enjoy whatever we had on our hands! This photograph on the left is of a beautiful temple near Savin Kingdom on the Darjeeling road. We saw this from the road as we walked down to the park. Perhaps the dusk added to the beauty of this temple.

 

Archery at Savin Kingdom, an amusement park at Siliguri

 

We had fun at the amusement park (Savin Kingdom) in Siliguri. For these 2 hours we became children. Uninhibited and hell bent on trying everything!

Shown in this picture on the right is Jaishree, trying her hands at archery!

Posted in Summer of 2009 | 1 Comment »

Summer of 2009 – Day 8

Posted by @bhitalks on May 31, 2009

Humph… The time has come to leave back a week’s full of refreshing hills, clean air and pristine waters only as memories to cherish!

We had our train back from NJP at 1300 hrs and so we started early by 8, so as to reach there in time. It took 4 hours for us to reach NJP. Meanwhile all this time I had been checking on the status of our ticket from my iPhone and it was stuck at W/L 1. Hoping for it to get thru when the charts are released, we waiting impatiently at the station with increased heartbeats. When the charts were out, our jaws dropped as our ticket was still at W/L 1 and looking at the heavy rush of tourists this season, there was absolutely no hope. When the train arrived, we tried to find out from the TTE if we could be accommodated in any class, not necessarily 1st AC, and he expressed helplessness!

So here we were, stranded at an unknown place with no tickets and brain blanked out. We just sat at the platform watching our train moving on, sans us. Time to call up our friends and seek help. Enquired about the flights from Bagdogra and found that there were none left for today. So we had no option but to spend the night here at Siliguri and try for some flight tomorrow. And that is what we did. With the help of our friends, we lodged ourselves at a decent hotel and got our tickets on a flight tomorrow. I would consider that as very lucky indeed, because chances of getting a flight ticket at this moment were bleak owing to the heavy rush of tourists. I still don’t know how, but we got the tickets and it cost us Rs.31,000! The way the airlines vary their fares based on various factors on a particular sector!

By the time we checked in to the hotel and go fresh it was already evening. Siliguri… what do we do? Sit back and wait for tomorrow? No way… it should be just another place on our holiday trip! And so be it. We enquired about Siliguri and found out that although there is absolutely nothing to see around, but we can try Savin Kingdom, a small amusement park a kilometre from our hotel. We walked up to the park which is on the Darjeeling road, and dashed right in. We tried all rides and games and had uninhibited fun as if we were children!

After having spent nearly 2 hours there, we are back in our hotel now. No hush, our flight is late tomorrow and we can sleep to our hearts desire.

Posted in Summer of 2009 | Leave a Comment »

The Tsomgo Lake

Posted by @bhitalks on May 30, 2009

View of Tsomgo Lake

The Tsomgo Lake also known as the Chhangu Lake in local parlance, is a small beautiful lake situated at an altitude of 12,400 feet. Surrounded by steep mountains on all sides it is a charming sight to watch. The streams from the mountains that rush towards it look like silver streaks from a distance.

Posted in Summer of 2009 | Tagged: , , | 1 Comment »

 
Follow

Get every new post delivered to your Inbox.