- Don’t use an UPDATE or DELETE statement on a live, critical database from a query browser. Inevitably, you will forget to highlight the WHERE clause. The more time passes that you haven’t fucked this up, the more likely and damaging it will be when you do.
- Don’t use email addresses in test data that resolve to a domain you don’t control. Yes, someone owns balls.com. And they probably have a catch all set up so they are getting those test orders fuck@balls.com seems to keep placing.
- Don’t use personally identifiable data for testing. That goes for your info and your customers’.
- Delete nothing. Archive everything. Version control is a necessity, not a luxury.
- When writing email replies, especially serious replies about serious stuff, first remove everyone from the To:, CC:, and BCC: lists. Write your message. Save it. Spell check it. Proof it. Then, once you are satisfied with your reply, fill in the recipient lists. This is great to prevent premature-emailculation, a serious problem that affects up to 70% of email users.
- Junk food and cigarettes don’t actually make you feel better. Water, cursing, and walking do. Having a seat near the free soda and cookies is not a boon.
- If you can’t do it without a mouse, it’s probably not worth doing (unless you are a designer, artist, or talking about games). Your hands will thank you too.
- Your users might be idiots, but you are an asshole for not providing them with an interface so easy to use that even an idiot could figure it out.
- A fish bowl does not a good drainage system make.
- There was something else, but I forget. I guess ‘Write good ideas down somewhere’ will have to sit in the tenth slot for the time being.
Some Things You Will Only Learn By Screwing Up
August 7th, 2008 · No Comments
→ No CommentsTags: horseshit · humor · idiocy · technology
Changing My Name
July 25th, 2008 · No Comments
Zac([kh]|hary)$
As Afshin says, it’s pronounced “Zack Dollar”.
→ No CommentsTags: goodstuff · humor · programming
Disable/Hide Menu Items?
July 1st, 2008 · No Comments
Joel writes about disabled/hidden menu items. I don’t completely agree. I think it’s very useful to quickly visually identify what actions are not allowed in any given context. One compromise might be to make the menu item look disabled, but when clicked it gives an explanation of why the selected action cannot be taken. Of course the messages presented to the user need to be made meaninful, instead of just “This action cannot be performed at the current time”, but that seems like a whole can of worms.
→ No CommentsTags: technology
Oh Well
July 1st, 2008 · No Comments
Adobe makes flash searchable. 1/2 ain’t bad.
→ No CommentsTags: technology
Python String Interpolation
June 30th, 2008 · 2 Comments
AKA string formatting, AKA Putting values of variables into strings, AKA that thing you do with the funny symbols to get the values of variables inside strings.
At the most basic level, most programmers find that at some point they need to insert the values of a whole bunch of variables into a string. The naive approach is generally to concatenate a bunch of strings together.
>>>first_name = 'Zack' >>>last_name = 'Halbrecht' >>>output = "Hello " + first_name + " " + last_name >>>print output 'Hello Zack Halbrecht'
Besides being inefficient to concatenate strings this way, what if one of the variabes you are trying to interpolate isn’t a string, but an integer? Then you’ve got to go and cast each variable using str()? Ugly. Ew. I can’t even write the code demonstrating this out of priciple. Luckily, there’s a better way. Well, there are actually two.
The first one basically dictates that you are going to create a string, and within that string you will put in placeholders where you want your variables to end up. The placeholder marker is a combination of the percent symbol (%) and a conversion type symbol which is going to determine how a variable’s value is formatted within the string. More on this later. After the string, you use the string formatting operator (% again) and pass it a tuple of the variables you want to appear in the string, in the order you want them to appear.
>>>output = "%s %s" % (first_name, last_name) >>>print output 'Zack Halbrecht'
Damn. That’s concise. So what’s going on here? %s is a placeholder for a string. The first %s will get replaced by the first value of the tuple in this case, the value of first_name. Same with the second %s and the second value of the tuple. This is great when you’ve got less than five variables to interpolate, but what if you have 10? 20? Some huge amount? You don’t want to worry about the ordering. Well, of course there’s an easy way to deal with this situation too.
>>>output = "%(fname)s %(lname)s" % {'fname': first_name, 'lname': last_name}
>>>print output
'Zack Halbrecht'
OK. Same concept. Except this time we’re giving our % operator a dictionary of name/value pairs and our output string contains identifiers that act as lookup keys on the dictionary. Cool. We no longer have to worry about ordering. When using this method, every placeholder inside the string MUST have a parenthesized identifier. Another benefit of using this method is that if you want to insert the value of a variable in more than one place, it only has to be specified once in the dictionary. Sweet.
Oh duh, and one of the coolest things about this is that interpolation will actually do type coercion. So if you’ve got something like:
>>>output = "%(fname)s %(lname)s is %(age)i" % {'fname': first_name, 'lname': last_name, 'age': 28.5}
That %i is telling the interpolation operator to take the value of the age variable, whatever it is, in this case a float, and convert it into its string representation as an integer (using the %i). Pretty sweet. Normal concatenation with + will just get you a nice fat ValueError there.
>>>print output 'Zack Halbrecht is 28'
I realize a lot of this is covered in the truly wonderful Dive Into Python, but I was surprised to learn that the technique of using a dictionary instead of a tuple wasn’t covered. Additionally it seems that when just starting out programming in general, not a lot of people know this process as ’string interpolation’ or ’string formatting’, and it might help someone out there to have an article that covers it as one of the silly ways its described in the intro. Thoughts?
→ 2 CommentsTags: programming · python
TV I’d Like to See
June 17th, 2008 · No Comments
I’d really like to see Martin Yan (of Yan Can Cook fame) take on Iron Chef Chen Kenichi (Iron Chef Chinese). This would be a battle of epic proportions! Make it happen foodtv.
→ No CommentsTags: food
How I Roll
June 12th, 2008 · No Comments
At Home:
- Macbook Pro
- External 24″ Monitor
- Slim Mac Keyboard
- Crappy Dell USB Mouse
- Gmail
- Synergy
- TextMate
- iTerm
- MySQL
- SQLite
- Python
- Ruby
- Firefox
- Firebug
- QuickSilver
- SVN
- Adium
- Quinn
- CyberDuck
- Skype
At Work:
- Dell OptiCrap with an shitton of RAM
- XP Pro SP2
- Dual 19″ Widescreens
- Visual Studio 2008, 2005 (c#)
- Python (one off scripts/text parsing jobs)
- VMWare Workstation
- Ubuntu Server
- Fedora Core
- Vista x64
- Windows Server 2003
- Notepad++
- OneNote
- Outlook =[
- Visio
- Pidgin
- Firefox
- Firebug
- Launchy
- TortoiseSVN
- WinSCP
- Unlocker
→ No CommentsTags: technology
Tech Job Wisdom
June 11th, 2008 · No Comments
If you blow a tech interview because you are greatly under qualified and honestly don’t know the things required for the job, but they still give you an offer anyway, DON’T TAKE THAT JOB. It’s a trap. It most likely means the people hiring you are less competent than yourself and you’re going to be doing all the work.
In some cases, this might be OK though. If you are straight out of school and you don’t have “real world” experience, this might be a great way to get a lot of it very quickly. The thing to keep in mind when going this route is to try to learn the proper way to do your duties (training, researching, books, etc…), and then instilling those best practices into the organization.
Over the past five and a half years, I seem to have been building from the sub-basement up, but I feel like I’ve accomplished quite a bit in terms of infrastructure and software development practice that this company will be much better off with after I’m gone. I mean come on! Before I started here no one was using version control! Argh. At least it only took one major disaster to convince the CEO we needed to get off our ass and put some common sense things in place. Here are the things that I’d recommend you set up immediately, if they are not already in place when you get there.
- Email. This is so easy nowadays. Don’t buy an email server. Don’t host it yourself. Under your desk is not a reliable hosting situation. Get someone to do it for you, and make sure they’ve got a good SLA in place for backups, downtime, etc. It can be as cheap as $50/year/user (Hello Google Apps!) or as expensive as RackSpace managed Exchange hosting, but please, just get something reliable in place.
- Source Code Version Control. For the love of all that is holy in this world, I don’t give a shit if you are a Flash designer, a email marketer, a JavaScript ninja, or the badass mother who invented C, use version control system. Use it for everything. Everything goes in there! Config files? Yes. Images? Yes. Database schema? Why the world wouldn’t you? Build files? (Hint: YES). Make sure it’s secured. Make sure your developers can access it from home.
- Anti-virus software. OK this is really only necessary on a company-wide scale if you are a Windows shop, but jeez, get something that can be managed distributively so you don’t have to spend three weeks updating all your sales people’s computers when their subscriptions expire.
- Reliable, Competent Office Firewall. When I first started here, there was a POS that couldn’t even do simple VPN pass through. Our web server (at that point hosted by Digex [memories...they used to be great before MCI got their hands on them]) was only accessible through a VPN connection - good. So, in order to remedy this problem, some genius decided the most efficient solution would be to order up hm let’s see, how many developers do we have?, four? five? Good! Five External IP addresses! Jump on it Verizon! Bad! Now each development machine could sit outside the firewall, directly connected to the internet, and not have an issue VPNing into the web server. Sweet monkey Jesus. No. I’m not kidding. And if you really want to be shocked, this was happening well before anti-virus was even a thought on the horizon. Get a decent firewall for the office. At this point for less than 10 people, you could even get by with a WRT-54G hooked up with DD-WRT and be more than fine!
Those are the top four I can’t imagine living without again, but if I find myself in this position again, depending on the influence my role has, I’ll be hooking this stuff up, or running for the door.
→ No CommentsTags: technology
Up Yours, Reddit
June 6th, 2008 · No Comments
I might stop by from time to time to see what’s going on, but I’m out. This is just total bullshit.
→ No CommentsTags: annoyance · horseshit · idiocy · technology · uncategorized
Innovation
May 27th, 2008 · No Comments
It’s pretty funny that we actually have Microsoft to thank for the original XHR. Makes you wonder what else is hiding in their R&D labs.
→ No CommentsTags: goodstuff · microsoft · technology