Friday, January 30, 2009
At work we develop in the ASP.NET framework (with VB), which is powerful but it has a lot of oddities - especially for me writing all the markup and CSS. My biggest gripe has been with the ID property of any element. You give it an ID, and then ASP all assign it a different one when it renders! For example, lets say I write the following code:
<asp:Panel runat="server" id="MyPanel">Hello</asp:Panel>
What actually gets rendered to the page may look something like this depending on how many Masterpages and controls its been nested inside of:
<div id="ctl00_ctl00__userMessage_uxUpnMessage_MyPanel">Hello</div>
Why the long ID Microsoft? I understand that sometimes ASP will need these unique ID's for forms and postbacks, but in reality for many things (especially things that only relate to page structure or style) you don't need this unique ID, you only need the ID you gave it! Today I was messing around with exactly how to do this and I came across a solution! Check out the VB code below:
Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
Me.MyPanel.ID = String.Empty
Me.MyPanel.Attributes.Add("id", "MyPanel")
MyBase.OnPreRender(e)
End Sub
So just put that as the last step of your VB code, and it renders the exact way it should now - with the ID you told it to have in the first place. It's a bit of a hack, or a way to trick ASP into doing what I want, but ti works great. I'm sure there's a better way to implement this, or perhaps even extend certain elements to have a RenderID="MyNewIDName" property that would set the ID property from the front end instead.
Anyway, that's my big discovery for today. Hope it can help someone else out who was as frustrated as I was.
Posted by Chris Barr on 01/30 at 11:08 AM
Filed under
Web,
Code,
ASP •
•
Permanent link
Saturday, January 24, 2009
It's usually a good idea to wipe off your hard drive and start fresh once every year or so, regardless of what OS you run. In the past it's been a thing I've dreaded mostly due to the huge time commitment involved. My process before was to:
- Make sure all important files were backed up (1 hour minimum)
- Wipe the hard drive and re-install OS X (1-2 hours)
- Reboot and install OS updates (~30 minutes)
- Copy all the backed up file back onto the machine (~1 hour)
- Install all software needed from installation disks and the web (3-4 hours No thanks to Creative Suite...)
Needless to say, that's pretty much an all day event. It involved so many steps that were spaced out just enough so that you couldn't really leave and get anything done. It can also cause a lot of mental stress because you're always worried with "Did I remember to back up my _____???" In the end, it was worth it though, I got rid of all kinds of junk that had built up and I ended up with a faster machine that's no longer bogged down.
Enter Time Machine. I began to use this last year and haven't looked back yet. For those that don't yet know, Time Machine is Apple's brilliant and easy backup solutions. You just designate another hard drive for backups, and once an hour it makes a copy of all the files that have changed. Because of this I have pretty much everything I've worked on since the beginning of 2008 - and multiples copies of it.
For those curious, I choose to trust my data with a Drobo, which is like RAID for dummies. I've got two redundant 1 Terabyte drives - I feel my data is safe.
One of the best new features in OS X was the ability to use that Time Machine backup as a way to restore your computer to a previous state. This is perfect for you if your hard drive crashes, or even if you're having problems. My initial thought was that if I was having problems, wouldn't restoring from Time Machine just restore the problems as well? In short, no. Time Machine only backs up your user data, no system files are backed up and noting that can be re-generated will be backed up (things like caches and your spotlight index).
Recently my Macbook Pro was feeling pretty sluggish. Videos didn't play smoothly, applications took forever to load, and importing and browsing through my photos in iPhoto was painfully slow. It was time for a clean start. Lucky for me, Time Machine removes the majority of the steps I listed above. Basically all that needs to be done now is:
- Wipe the drive, install OS X
- Restore from Time Machine
- Install OS updates
Now this isn't a quick process, but it's no longer a thought intensive, worrisome, all day process. So if you're in a similar situation to mine and you're already using Time Machine, lets get started! Follow the jump to read more.
Read more...
Posted by Chris Barr on 01/24 at 11:12 PM
Filed under
General,
Photography,
Macintosh,
Productivity,
Tech •
•
Permanent link
Sunday, January 11, 2009
I'm constantly amazed by how disk storage is constantly growing larger, yet takes on a smaller form factor at the same time. Take a look way back in 1956 when IBM made the worlds first hard drive called the IBM 305, a 5 Megabyte disk that actually had to be transported via forklift and airplane! It weighed in at just over 1 ton and cost $160,000! Today 5MB of space is hardly enough to store a single song or photograph. It's just a tiny amount to us today, but back then it was revolutionary.
Several years ago I purchased a 256MB flash drive that I could keep in pocket for about $20-$30. This is over 50 times the storage at 1/8000th the price of IBM's first hard drive! Again a few years later I spent another $20-$30 and bought a 1 Gigabyte flash drive for a similar price, and roughly half the physical size. When compared to IBM's original, this has 200 times the storage!
I usually use my flash drives to transfer my music from my home to my work computer, or share photos with friends. All of these take up a considerable amount of storage, so I decided it was time for yet another upgrade. I had heard about this awesome little KingMax 8GB flash drive
that's roughly the size of a paperclip and only cost me $12 + shipping. To top all of that off, it's completely washer/dryer safe as well!
We've really come a long way in storage. Check out my USB flash drive heritage.
Posted by Chris Barr on 01/11 at 01:24 PM
Filed under
General,
Tech •
•
Permanent link
Thursday, January 01, 2009
Thinking back over all the new music I discovered this past year, I’ve compiled a list of my favorite albums (in no particular order). Not all of these were released in the past year, it’s just that I’ve discovered them in the past year. They’re are amazing albums I can listen to over and over again. If you haven’t heard anything on this list, go get it right now!
There’s links to download music after the jump, and there’s even some free stuff too!
Read more...
Posted by Chris Barr on 01/01 at 02:05 AM
Filed under
General,
Music •
•
Permanent link