My contemplations and diurnal novelties are publicized here

Archive for May, 2010

Color Codes


color Codes.jpg

jQuery $(document).ready and UpdatePanels?


An UpdatePanel completely replaces the contents of the update panel on an update. This means that those events you subscribed to are no longer subscribed because there are new elements in that update panel.

What I’ve done to work around this is re-subscribe to the events I need after every update. I use $(document).ready() for the initial load, then this snippet below to re-subscribe every update.

var prm = Sys.WebForms.PageRequestManager.getInstance();

prm.add_endRequest(function() {
    // re-bind your jquery events here
});

The PageRequestManager is a javascript object which is automatically available if an update panel is on the page. You shouldn’t need to do anything other than the code above in order to use it as long as the UpdatePanel is on the page.

If you need more detailed control, this event passes arguments similar to how .NET events are passed arguments (sender, eventArgs) so you can see what raised the event and only re-bind if needed.

Read more about the RequestManager here: asp.net/…/UpdatePanelClientScripting.aspx (If using .NET 2.0)

Here is the latest version of the documentation from Microsoft: msdn.microsoft.com/…/bb383810.aspx


One other option you may have, depending on your needs is to use jQuery’s live() event subscriber, or the jQuery plugin livequery. These methods are more efficient than re-subscribing to DOM elements on every update. Read all of the documentation before you use this approach however, since it may or may not meet your needs. There are a lot of jQuery plugins that would be unreasonable to refactor to use live(), so in those cases, you’re better off re-subscribing.

http://stackoverflow.com/questions/256195/jquery-document-ready-and-updatepanels

 

Time Boxing is an Effective Getting Things Done Strategy


Given a task, there are essentially two ways we can approach it. Either, we can work as hard as we can until it is “done” or we can fix the amount of time we have available and do the “best” we can. The latter approach is known as “Time boxing“.
Time boxing is a very simple technique we often use in software development. It is an effective technique for tracking progress and simply getting things done. From a planning perspective, time boxing is useful, especially when things appear complex or daunting initially and we are unsure of how to begin.
From a personal management perspective, I’ve found that time boxing can greatly improve our productivity and effectiveness. Because it’s simple, anyone can do it – including you. I use it when working on open ended tasks, like writing, where neither the scope or the quality is well defined.
This article briefly discusses how we can apply time boxing to our daily lives and get things done.
What is time boxing?
Time boxing is about fixing the time we have available to work on a given task and then doing the best we can within that time frame. So instead working on something until it is “done” in one sitting, we only work on it for say 30 minutes. It is either marked as done at the end of this period or we commit to another 30 minutes at a later time or another day.
In software development, an agile team releases new versions of a product to the customer for testing in fixed length iterations, say weekly. The customer and the development team work together to identify the features to be included in each release based on the relative priority and complexity of each task.
What’s special about Time boxing?
There are always several things competing for our time. At any moment, each of us could have hundreds of outstanding things to do. This question immediately become important – How can we ensure we get as much done as possible?
I believe time boxing is special for four reasons. Firstly, by consciously being aware of time, it allows us to focus on doing the things that matter most. Secondly, it serves as a reality check on how much time we spend working on open ended tasks. Thirdly, because of the fixed time constraints, it can be an effective tool against procrastination. Finally, it allows us to work on things during the free gaps we have between our commitments and appointments.
Focus on doing the things that matter most
If the time available we have is limited, a rational person should immediately think about prioritizing their outstanding tasks based on what’s important and urgent.
By using time boxing and ranking our outstanding tasks, we make ourselves consciously aware of how much time we have available. This allows us to focus our energies towards things that matter most. In this way, we get things that matter most done first.
There are many techniques for ranking tasks and I won’t go into them in this post. However, it’s worth mentioning “Quality Function Deployment” – which is a technique we use in software development and engineering to translate customer requirements into engineering specifications. In the simplest sense, for each feature, we multiply a number representing a customer’s perception of its importance by another number representing an engineer’s estimation of the complexity. The final result is ranked and the relative ordering gives us an indication of what we should implement given a certain time constraint.
Limiting the time spent on open ended tasks
Do you know people who are perfectionists? Those who are constantly tweaking things to make them incrementally better or just different? To a certain extent, I suffer from a perfectionist personality which is why I find working on open ended tasks difficult. I’ll use some examples relating to my writing to illustrate: Should this sentence be structured in a passive voice? Does this paragraph look ok here? Are there enough anecdotes in this article?
Because by their nature there is no distinction between done and not done, an arbitrary open ended task can take anywhere between 1 min and 3 weeks. Time boxing is particularly useful as a reality check when working on open ended tasks. By limiting the time we spend on a given task, as long as it is complete though not perfect, we can objectively decide when something is done. This frees us up to work on the next task.
Effective tool against procrastination
In my experience, people procrastinate for two reasons – firstly, when faced with a complex task they are unsure of how to start and secondly, the prospect of having to do something they’re not particularly interested in doing.

  • As a tool against complex tasks: Time boxing is useful here because it allows us to work on complex tasks over several iterations or in bite sized chunks. For example, writing a good article is a complex task for me and it is rare to be able to find one block of time in which I can write an article from start to finish. For me, it is more effective to write as best as I can within a fixed period, constantly refining and repeating this process until I finish.
  • As a tool against uninteresting things: Time boxing is useful here because it allows us to commit to an undesirable task for only a limited amount of time. It’s a lot easier to start working on something we don’t like if we knew we only need to work on it for the next 30 minutes. For example, if you have to clean a messy house, instead of trying to get through the entire house in one go, try only doing as much as you can for 30 minutes. When you have another 30 minutes to spare another day and feel so inclined, you can continue.

Using free gaps between commitments
The composition of a day from person to person and day to day is different. For some of us, our calendars are completely filled with appointments and meetings. For others, our days are relatively unstructured. Irrespective of our calendars, we often have what I call “null” time. That is, gaps between commitments in which we are either waiting for something or have free brain cycles.
Examples of “null” times are: At the station minutes before the train comes. In the car on a winter morning whilst waiting for the engine to warm up. At the desk, after you have kicked off a full compile on a complex codebase.
Time boxing can be immensely useful during these “null” times. If you knew the train will come soon, the car will warm up in moments or the code will compile in a few minutes, you can choose to use that time effectively and work on a relatively simple task you know can be done within that short “null” time.
In conclusion
Time boxing is an effective way for getting things done. By fixing the amount of time we spend on a given set of tasks, we can focus on doing the things that matter, give us motivation to start, prevent overruns and use our “null” times effectively. In contrast, if we worked on things until completion in one sitting, we’re less likely to start on complex tasks, more likely to overrun on open ended tasks and leaves us with less time and motivation to work on the next set of tasks.
http://www.davecheong.com/2006/07/26/time-boxing-is-an-effective-getting-things-done-strategy/

Microsoft JScript runtime error: ‘Sys’ is undefined


Cyrstal Report Navigation Issue


Recommended solution: move the CrystalReportViewer control’s binding code to the Init event

The solution for the CrystalReportViewer control is to move your report binding code to the Init event, which occurs before ViewState is restored.

This solution raises one complication. Since the Init event is coded against less commonly than the Load event, it is harder to access. In Visual Studio .NET 2002 or 2003 Web or Windows projects, the Init event handling code is located within the Web Form Designer Generated code region, an area that is typically hidden and reserved for generated code.

To resolve this, the following approach is recommended:

  • Extract all CrystalReportViewer binding and configuration code into a private helper method named ConfigureCrystalReports().
  • Within the Web Form Designer Generated code region, place only a single line of code in the Page_Init() event handler or OnInit() event raising method: a call to the ConfigureCrystalReports() helper method.

http://msdn.microsoft.com/en-us/library/ms225455%28VS.80%29.aspx