January 23rd, 2009
Master pages are great time savers in ASP.NET and we use them extensively to simplify user interface management in our applications. Recently, I ran into a situation where the master page to be used needed to be set from the Database. Turns out this is relatively simple to do if you know the path to the master page. You need to harness the Page_PreInit event that fires before the Page_Load and set the master page at runtime:
protected void Page_PreInit (object sender, EventArgs e) {
this.MasterPageFile = "~/path/to/masterpage.master";
}
The other problem I ran into was accessing a control on the master page from the web form that uses the master as a template. This is important because if all the inter-changeable master pages have the same control names they become useable from the web form irrespective of their location on the page. One way is to define the same content areas in all the master pages and set them accordingly within the child, however in many cases you’d be duplicating the code relating to the control on the web forms. The other option is to use the FindControl function on the Master object. In order for this to work it needs to be cast to the appropriate control class. In the case of a Literal the syntax works out like this:
((Literal)this.Master.FindControl("literalControl")).Text = "Foobar";
Nice and easy.
Tags: .net
Posted in Code | Leave a Comment »
January 20th, 2009
Much to my surprise the Indian Passport Office has been completely overhauled. Application forms are filled out online, appointments handed out from the web site (15 minute time increments with a specific date), PDF printouts with most of the fields filled in, it’s all very organized. Until you get there. And then you figure out a couple of things that they really should have made plain on the site. This post is really just a reminder for me so I don’t screw up next time around. Maybe it will help some poor soul and save them some time in a queue.
First things first, while filling out the form you will find them constantly referring to the Passport Information Booklet. This hallowed tome is in fact available on the Indian Passport website but is cleverly disguised as Passport Rules rather than Passport Information Booklet. Download it here. Bear in mind that it is in fact ~30 megabytes. This is because it is just a scanned version of the real handbook. If anyone has an OCR’ed version of this I’d love to have a copy.
The PDF will tell you what documents you need in excruciating detail. It also has a bunch of annexures at the end that will need to be used depending on the type of passport service needed. For instance, I had to use Annexure ‘H’ to get a passport for my kid. So, hopefully you’ve rounded up the relevant documents and are ready to fill up the form. Here is the checklist when filling it up:
- Fill up ALL fields. Don’t leave anything empty, if it doesn’t apply write “N/A”. The Information Booklet refers to fields as columns. Go figure.
- Make sure you have 3 copies of all documents you’re submitting. The way I think this works is 2 copies is enough unless you have lived in more than one place in the last year. You need to add one more set for each place you stayed in. Better to take 3 copies just in case and add an additional copy for every place you stayed at.
- Make sure you have originals of all documents you’re submitting. They won’t take them but you need to show them at the counter.
- If you have lived in more than one place in the last year you have to provide 2 Personal Particulars forms for each place you stayed at.
- Don’t forget to sign the photo you stick on every Personal Particulars form.
And the checklist for when you’re at the passport office:
- Make sure you’re in the right line. Sometimes the cop at the entrance makes a mistake. There are different lines (at the Pune Office at least) for Fresh Passports, Renewals, Minors, Government Officials and Senior Citizens. The list of people/services the line handles are stuck on the glass at the counter. Go read it and ensure you’re at the right window.
- If you travel a lot pick up the Jumbo Passport. It has 60 pages instead of 36 and costs Rs. 500 more. I still had 4 years to go on my passport but ran out of pages and needed a new one. Tell the guy at the counter you want a Jumbo so he files it correctly. I crossed out the amount mentioned at the top of the PDF (Rs. 1000) and wrote Rs. 1500 in it’s place.
- Make sure you have exact change for the passport payment. Don’t bother with a Demand Draft, they take Cash over the counter just as happily.
That’s all I can think of. Hopefully I won’t have to go back there for another 10 years.
Tags: india, passport
Posted in Reminder | 2 Comments »
January 17th, 2009
While pondering the effects of Google on the way facts and information are assimilated I realized that I’ve almost entirely stopped learning details. My memory now consists of search terms rather than the actual information. I remember the minimum necessary to be able to locate the item the next time around. The details live in Google.
I don’t even bookmark, I have some timesavers linked on my bookmark bar in Safari but those are really url shortcuts. The more I think about it, this is not because I’m lazy or forgetful (though I am definitely both those things). I genuinely believe Google can find something faster and more effectively than I can thumbing through bookmarks. Consider the pitfalls of a bookmark:
- The page’s location might change
- The information contained on the page might no longer be accurate
- The very same search might yield a better, newer method of doing the same thing or reveal new information that was previously unavailable
So not only is it faster than finding a bookmark, it’s also more accurate and more up to date.
This got me thinking about a specific instance where what I had been taught in school turned out to be wrong. I was taught that gravity is a force that is based on the mass of two objects. The larger the mass, the stronger the force. Right? Well, sure it’s right but it turns out it isn’t a force at all according to a certain Albert Einstein. That text book didn’t contain the whole story and the facts weren’t updated later on in my memory. I had to discover this through Wikipedia and Google. The fact that Ekta and I just had a kid has made this lapse in the education system all the more troubling.
Is it possible that rather than learning that information in school I could have been taught the basics of how gravity works and then just taught how to look it up in Google when I want the details?
I always drop down into what I understand best when testing out an idea, so obviously I go straight into software programming terrain. The knowledge of when and why to use a technique (like say, recursive loops) is much more important than the exact syntax to do so for a given programming language. So broad concepts are much more important than the actual technical minutiae. Knowledge of what to use is much more important than specific details of how to use it. Knowing how to drive a car is more important than knowing how every part of it works. When you need that information it’s always available through Google. What this amounts to is a kind of Knowledge Abstraction facilitated by Google.
Google allows us this luxury because of 3 important things. Firstly, it is everywhere. I can access it anywhere on a suitable web device thanks to ubiquitous networking. Secondly, it is convenient, I’m not lugging around the Encyclopedia. Third, it is really fast, so the time spent hunting through documents on my hard disk or worse, the index of a book is gone. In almost magical fashion this means I don’t need to remember specific facts but at the same time know more than I did before.
I firmly believe that our kids should be taught language, math and searching at the lowest level because knowing how to access information effectively is probably as important as being able to read a sentence. It is the internet age equivalent of learning how to count and is just as important for that kid’s success. Teachers need to concentrate on teaching large, broad concepts and let the kids explore the details. They would effectively abstract the world and how it works from the technical details. The kids will probably find out what they love to do and branch off in directions of learning that would otherwise have been inaccessible. They will not be limited by the text book or the teacher’s own knowledge.
Tags: kids, knowledge
Posted in Google, Interwebs, Opinion | Leave a Comment »