A cabinet installation can be a big job, but for all except the most involved projects,…
Monthly Archives: February 2008
Building Sleek, Soft and Simple DataGridsMatt Berseth
Last November Josh Stodola wrote a detailed post discussing how great looking fluid-width rounded corners can easily be created using Paint.NET, a handful of DIV tags and a small amount of CSS. The basic technique Josh outlines isn't new, but he does a great job walking through the steps with just the right amount of detail. I remember reading the article sometime after I struggled through creating an AjaxControlToolkit control based on NiftyCorners (being completely uncreative, I called my custom extender control the NiftyCornersExtender) and I found it very interesting. I recently went back through and re-read Josh's article this past week and went through his tutorial again.
It turns out this was great timing – I am working on a project where the client has requested a sleek, soft and simple interface – those were their exact words. So I used Josh's tutorial to frame a couple of my interface elements with a rounded light blue border. The screen shots of these grids are below, and I am pretty happy with how they turned out (we will see what the client thinks). The grids have that nice professional and polished feel like the ones found on some of the .Net component vendors demo sites AND they are fluid.
Live Demo (IE6, IE7, FF, Opera 9.24) | Download Code (.Net 3.5)
Sample Grids
Below are the screen shots for the two grids I created. The top one displays the rows in the Northwind products table, 10 rows at a time. It supports paging and sorting. The second grid also displays product data, but only one row at a time. The second one is what I am planning to use for a DetailView.
Â
Markup and Images
CSS doesn't have any built in mechanism for rounding corners, so Josh uses the following markup to build the frame.Â
<div class="rounded"> <div class="top"><div class="right"></div></div> <div class="middle"><div class="right"> <div class="content"> <!--Content goes here--> </div> </div></div> <div class="bottom"><div class="right"></div></div> </div>
For both the samples above, a ListView control is embedded within the content DIV (where it says 'Content goes here'). The ListView is bound to the products data source and is responsible for create the HTML table for each of the grids.
The CSS for the classes above position the following the images around the border. Again, Josh's tutorial has a great explanation of how to create these images.
Top Left:Â Â Â Â Â Â Â Â
Top Right:Â Â Â Â Â Â Â
Â
Left:Â Â Â Â Â Â Â Â Â Â Â Â Â Â
Right:Â Â Â Â Â Â Â Â Â Â Â Â Â
Bottom Left:Â Â Â
Bottom Right:Â Â
A Few Tips
If you download the sample code, you will no doubt notice there isn't too much code for the above examples. Both of the data grids are rendered as HTML tables by the ListView control. Both of these grids support some sort of paging, so a DataPager has been embedded into the ListView's LayoutTemplate. If either of these topics are new to you, feel free to check out my posting archives for both the ListView and DataPager controls to see a few more live samples. Besides that, here is a small collection of subtle tips that maybe aren't so obvious from browsing the code.
Â
1. Sorting with Arrow Icons
To toggle the sorting icons I run a bit of code when the ItemDataBound event fires on the ListView. In this event handler, I use the SortExpression property of the ListView to see what column the grid is being sorted by. Then, I rip through all of the tables header cells and find the one that has a LinkButton with the corresponding SortExpression. After the button is found, I add a sortasc or sortdesc CSS classes to the TH element. By default the anchor rendered by the column header LinkButtons have the no sort applied image applied for its background. If the sorting css classes are applied, this image is replaced by the ascending or descending one.
Â
2. Making the Complete Header Cell Clickable
I find users are most happy when clicking anywhere in the grids header cell sorts the grid. If you look at our grid, the sorting icon is right aligned and the text is left aligned. Some users will naturally click the text to sort, others will click the icons. Either way it would be nice to be a little forgiving so any mouse click within the header cell results in the sort being executed. The easiest way to accomplish this is to set the anchor to render as a block element instead of inline. For the grid above, I have done this using the following CSS rule.
Â
3. Using LINQ to XML to Create a Portable Example
If you have downloaded any of my other examples, you may have noticed that I do what I can to make my examples as portable as possible. Most commonly I do this by using an XML file as my datasource instead of SQL Server. For this sample I exported the Northiwnd Products, Categories and Suppliers tables to an XML file and used LINQ to XML to extract the data and fill my grid. And it was all pretty simple.Â
To extract the data from the products table I used the FOR XML clause like so …
select * from dbo.Products product for xml auto
I then saved the resulting XML into a flat file and placed it in the app_data directory. Then I used the LINQ to XML objects to load this data into .Net objects that bind to my ListView. Below is the LINQ query that fills the grids above.
4. Rendering a 4 Column DetailsView using the ListView
Finally, this might seem like a no-brainer, but with the ListView it is really easy to create a DetailsView like presentation with 4 columns instead of the 2. To do this, I bound the following basic template to the ListView for the second grid (the one that displays Products one at a time) – notice each row has two TH elements and two TD elements. I haven't actually used this layout before, but I saw that SalesForce.com does something similar and I liked how it looked. Again, we will see what my client's think.
That's it. Enjoy!
Turn Your Favorite RSS Feeds into a Newspaper with FeedJournal [Newsreader]Lifehacker

Web application FeedJournal turns your RSS feed(s) of choice into a newspaper-formatted PDF. You can either enjoy the newspaper-ness of the electronic PDF on your computer, or you can print out the paper for some offline, dead-tree reading. FeedJournal probably isn’t the best solution for feeds that generally have shorter items (like the main Lifehacker feed), but longer articles (like you’ll find in our feature feed) fit really well in the FeedJournal layout. FeedJournal is free to use, requires registration with the site.
FeedJournal [via Download Squad]
Top 10 Smart and Lazy Ways to Save Your Workday [Lifehacker Top 10]Lifehacker

If you leave the office most nights feeling exhausted, overwhelmed, and behind on everything you’ve got to get done at work—even though you just spent 10 hours there—you’re letting your workday get away from you. It’s too easy to let the hours you spend at the office get stolen by meetings, email, interruptions, and impromptu co-worker chats that leave you saddled with busywork and too distracted to get the important stuff done. But with a little thought, you can leave work feeling accomplished and complete instead. When it’s time to take back your workday, there are a few dead easy strategies that can help you focus on your tasks, firewall your attention, and reduce your workload so you can get out the door feeling light, free, and done. Photo by rochelle, et. al.
10. Make a lunch or dinner date (to create a deadline).
Ever wonder why your co-workers who are parents get out of the door on time every day like clockwork? It’s because they’ve got to pick up the kids at daycare by a certain time. If you feel like you’ve got all day to get things done, you’re more likely to get sucked into stuff that’s not that important. But a deadline will light a fire under your butt and keep your eye on the clock. If you know you’ve got a spouse at home expecting to see you by 6:30, or a buddy waiting for you at the gym, you’re more likely to stay focused, get your stuff done, and get out of your chair on time.
If you can take lunch on your own schedule, this same strategy works midday, too: make a date with your co-worker or friend to have lunch at a set time, and use it as a deadline for getting your morning tasks done.
9. Write down the first thing you have to do tomorrow morning and put it on your keyboard before you leave the office.
The sad reality is that if you let it, your workday will get away from you without one single task getting checked off your to-do list: unless you make it your personal mission. The best time of the day to GTD is first thing in the morning, so make it easy on yourself. Every evening, before you leave the office, write down the single most important task you’ve got to get done the next day. Leave it on your desk, with any support material you need to work on it, so you can get rolling first thing. The best way to start your day is accomplishing something instead of fiddling around with email. (See more about how to set yourself up with a small, doable task here.)
8. Don’t check email for the first hour of the day.
Author of Never Check Email in the Morning Julie Morgenstern suggests waiting for one hour before you open up your email inbox in the morning. Instead of thoughtlessly reading email first thing, work on that task you laid out for yourself in #9. Accomplishing something out of the gate sets the tone for the rest of your day, Morgenstern says, and once you’ve launched your email client, you’re “open for business” and paying attention to incoming requests.
Note: If you do business with folks in different time zones, this guideline can be very difficult to follow, especially if you know you’ve got new messages over night. But let’s be realistic: a one hour email delay won’t kill anyone. You can do it.
7. Decide NOT to do one task on your to-do list and cross it off.
It’s not always the boss who’s putting pressure on us to get things done and assigning us tasks: sometimes we take on little projects and to-do’s because they seem like a good idea for one reason or another. If you’ve got a to-do list a mile long with items that have been sitting there for weeks? Chances are there are a few you can cross off right this moment because they’re not worth doing after all. A “good idea at the time” isn’t always a good idea. If you’ve assigned yourself busywork that isn’t that important, simply opt not to do it—that’s the fastest and lowest-effort way to get it off your plate.
6. Edit that email you’re writing down to less than five sentences.
No one likes to get long-winded email, and email’s not the appropriate place to have extended conversations. The shorter your email is, the more likely you are to get a response. Designer Mike Davidson instituted a personal email policy that no message he sends is more than five sentences, which saves himself and the recipient time. Give it a try. If your message has to be longer, pick up the phone and call instead.
5. Cut someone off.
When chatty Cathy’s yapping your head off, or that passive meeting leader is letting things go off the rails in the conference room for too long, speak up. Don’t be rude, of course. A polite but business-like, “Can we get back to the agenda?” or “I hate to cut this short, but I’ve got an appointment” or “This seems off-topic for this meeting–can we move on?” can save you hours of wasted time at the office.
4. Book a meeting with yourself.
If your head is spinning with all the stuff you’ve got to get done and the interruptions keep coming, you need some alone time. If the hours of your day keep getting stolen by meeting requests and drive-by interruptions, box out an hour or so every few days specifically to regroup and get organized. Literally enter the meeting with yourself on your calendar, and if you need to get away from your desk, book a conference room as well. Take your project list, to-do list, and calendar with you to the room and spend that time deciding what, when, and how you’re going to tackle all the stuff in your work life, as if you’re a boss meeting with your assistant. (GTD’ers know this technique as the weekly review.)
3. Master the art of the qualified yes.
Don’t be a yes-man or woman by default. When you have a choice (and most times you do), instead of automatically saying yes unconditionally to incoming requests, qualify it. Ask for more information like the deadline or requirements. See if it’s something that can be put off till a later date or done by someone more available or better-suited. Merlin Mann’s recent talk at Macworld, Time Sinks and Attention Burglars, has a fabulous section on negotiating incoming requests and qualifying your yes’es so you don’t give away your time so easily.
2. Block out distractions and set a timer.
When your brain is frozen in a solid block of paralyzed procrastination around a task and you’re letting yourself get carried away by distractions like email and instant messenger, it’s time to take out the big guns. Turn off your email and IM client, grab a kitchen timer, set it for 10 minutes, and work until the beep. Then, take a break. Wash, rinse, and repeat. I swear by this technique, which got me through writing 400 pages of the Lifehacker book when all I wanted to do was crawl under the bed and hide. If you give yourself an easy deadline (it’s only 10 minutes!) and make it a race with the clock, you’ll unfreeze your brain and break through your blocks.
1. Do a free jot brain dump.
When you’re so stuck in a rut that your brain can’t even grok the concept of a to-do list and you have no idea where you are or where you should be, it’s time to do a serious regroup (while going easy on yourself). Take a piece of paper and a pen, go to a quiet place, and free jot for 10 minutes. Make lists. Mind map. Free associate ideas. Rant. Write down whatever comes to mind to get your juices flowing. When we get hung up on busywork and crushed by overwhelm, our brains can’t take it any more. A last-resort, free-jot brain dump can re-focus the big picture: what’s important to you, what your biggest problem is right now, and what your next step is.
Regular brain dumps and mind maps are a great way to boost creativity and get started on projects, but they’re also an effective last resort strategy for those really bad days that have reduced you to a twitching mess of dysfunctional information anxiety.
How do you reclaim your workday and get yourself home at night feeling accomplished and clear? Let us know in the comments.
Keep SSH Connections Open in Linux [How To]Lifehacker
If you like to have ready-to-go access to remote machines (or a home server, perhaps) from your Linux desktop, you might have noticed that you can’t always get what you want. Many home and office routers kill “idle” connections after a certain length of time, forcing you to log in again. The FOSSwire blog points out a one-line addition to the end of the client’s SSH configuration file (found at /etc/ssh/sshd_config in many systems) to fix this:
ServerAliveInterval 180
That should send a little ping out every three minutes to ensure the connection is kept alive. This tip should work on most any OpenSSH server that allows access to its sshd_config file, but, as FOSSwire points out, it means any connections you leave open are just that—open to any nefarious passer-by, so use session-closing caution when needed.
Keep Your SSH Connection Open [FOSSwire]
Grab a free PDF copy of finance guru Suze … [In Brief]Lifehacker
Grab a free PDF copy of finance guru Suze Orman’s book Women & Money at Oprah’s web site (link halfway down page) until 6 p.m. PST today. Might make a nice addition to your Valentine’s Day offerings or to-read list. [via]
Create Quick FedEx Shipments from Outlook with QuickShip [Featured Windows Download]Lifehacker
Windows only: FedEx QuickShip is a freeware Microsoft Outlook toolbar that integrates your Outlook address book with FedEx shipments. That means creating a new shipment is as easy as clicking Ship and choosing your contact’s name from your address book. You can also track packages, check shipping rates, schedule pickups, find FedEx locations, and more with the FedEx toolbar. As Download Squad points out, the tool could use even tighter integration (for example, recognizing tracking numbers in emails), but if you do a lot of shipping at work and Outlook is your go-to email client, the QuickShip toolbar is a must-have. QuickShip is freeware, Windows only.
QuickShip [FedEx via Download Squad]
Add NFS automount on MAC OS (Darwin)
I had found several resources on Internet on this topic, but every time I had to put bit of information from different source or read twice to get exact steps on how to add NFS automount on MAC OS (Darwin). So I decided to put all this information together for a future use.
My method of choice is to use static mount using NetInfo manager.
1. Start NetInfo Manager from “Utilities”
2. Navigate to the /mounts
3. Add new sub-directory for /mounts
4. Add additional three properties to the new sub-directory
5. Rename and set values using following table:
| Property | Value(s) | |
|---|---|---|
| name | nfsserver:/export_mount/point | Remote path to the NFS share |
| type | nfs | Mount type. |
| dir | /net/nfsserver/export_mount/point | Path where you want to see this share. You need to create directory /net/nfsserver/export_mount. |
| opts | recvport | |
| intr |
This is important, you have to create directory /net/nfsserver/export_mount before instruct automount to read NetInfo data.
6. Restart automount by calling:
sudo kill -1 `cat /var/run/automount.pid`
7. If you are trying to mount a Linux NFS share, and it is failing, check system log file (/var/log/system.log) on your MAC. If reason for failure is “Operation not permitted”, check if NFS share is allowing to mount from your MAC. If it is, check NFS server log (/var/log/messages). If you found something like this “nfsd: request from insecure port”, then you have to configure NFS server or set share’s option to allow insecure connections. For example you can add option for share – “rw,root_squash,sync,insecure“.
Use explicit casting instead of DataBinder.Eval.NET Tip of The Day.org
The DataBinder.Eval method uses .NET reflection to evaluate the arguments that are passed in and to return the results. Consider limiting the use of DataBinder.Eval during data binding operations in order to improve ASP.NET page performance.
Consider the following ItemTemplate element within a Repeater control using DataBinder.Eval:
<ItemTemplate>
<tr>
<td><%# DataBinder.Eval(Container.DataItem, "field1" ) %></td>
<td><%# DataBinder.Eval(Container.DataItem, "field2") %></td>
</tr>
</ItemTemplate>
Using explicit casting offers better performance by avoiding the cost of .NET reflection. Cast the Container.DataItem as a DataRowView:
<ItemTemplate>
<tr>
<td><%# ((DataRowView)Container.DataItem)["field1"] %></td>
<td><%# ((DataRowView)Container.DataItem)["field2"] %></td>
</tr>
</ItemTemplate>