Daft Punk vs. formal attire

In an obvious case of attitude trumping style, Daft Punk resolved the aged sartorial conundrum, “What goes well with chrome helmets at a red carpet function?”, with certain ease. And apparently the answer to that question is not an LED-prepped, solar-powered space suit, but gorgeous, black Balenciaga suits and a lot of flair and attitude.

Fresh Celeb: Daft Punk – Balenciaga Suits, Dec 14, 2010

Validating credit card numbers in code using the Lunh algorithm

I’ve been writing billing system code for years, but this is something I’ve not known until today: VISA, MasterCard and American Express credit card numbers can be checked for validity (meaning you gain one extra check against someone typing in random numbers) using what’s known as the Luhn algorithm.

Read More

Getting the bcrypt-ruby and Devise gems working in Windows

Anyone who’s tried to install the Rails gem Devise on their Windows PC know that it’s not a smooth process – it takes a bit of massaging, requiring use of a development kit from the RubyInstaller For Windows website and a special parameter to be passed to the gem executable.

  1. Grab the latest version of the development kit, DevKit-4.5.0-20100819-1536-sfx.exe, from the RubyInstaller Downloads page.
  2. Run the self-extracting installer, placing all files to C:\devkit\ . Navigate to the directory and initialize the development kit by executing:
    ruby dk.rb init
  3. Review the auto-recognized paths to ensure its accuracy:
    ruby dk.rb review
  4. Finally, actually install the development kit add-ons:
    ruby dk.rb install
  5. Now we’re ready to install our problematic gems! In the same directory, execute your gem command:
    gem install devise --platform=ruby

You’ll note the include of the flag –platform=ruby in the last command listed above – it’s essential in avoiding a make issue inherent to the Windows environment. Also, bcrypt-ruby is installed as a requirement of the devise gem, so that’s two birds with one stone if you’re looking to make use of both. Enjoy!

References:

Why work doesn’t happen at work



From a TEDxMidwest talk given by Jason Fried of 37 Signals:

Why work doesn’t happen at work

We’ve all heard of the casual Friday thing. I don’t know if people still do that. But how about no-talk Thursdays. How about — pick one Thursday just once a month and cut that day in half and just say the afternoon — I’ll make it really easy for you. So just the afternoon, one Thursday. The first Thursday of the month — just the afternoon — nobody in the office can talk to each other. Just silence, that’s it. And what you’ll find is that a tremendous amount of work actually gets done when nobody talks to each other. This is when people actually get stuff done, is when no one’s bothering them, when no one’s interrupting them.

And you can give someone — giving someone four hours of uninterrupted time is the best gift you can give anybody at work. It’s better than a computer. It’s better than a new monitor. It’s better than new software, or whatever people typically use. Giving them four hours of quiet time at the office is going to be incredibly valuable. And if you try that, I think you’ll find that you agree. And maybe, hopefully you can do it more often. So maybe it’s every other week, or every week, once a week, afternoons no one can talk to each other. That’s something that you’ll find will really, really work.

Another thing you an try is switching from active communication and collaboration, which is like face-to-face stuff, tapping people on the shoulder, saying hi to them, having meetings, and replace that with more passive models of communication using things like email and instant messaging, or collaboration products — things like that. Now some people might say email is really distracting and I.M. is really distracting, and these other things are really distracting, but they’re distracting at a time of your own choice and your own choosing. You can quit the email app, you can’t quit your boss. You can quit I.M., you can’t hide your manager. You can put these things away, and then you can be interrupted on your own schedule, at your own time, when you’re available, when you’re ready to go again.

Body and mind

Your body has to be in top condition. Your chess deteriorates as your body does. You can’t separate body from mind.

Bobby Fischer, 1989

Businesses can’t maintain a frenetic pace forever

A post made today to the Harvard Business Review titled The High Overemployment Rate led me to this (unfortunately paywalled) four-page article on what’s been deemed “The Acceleration Trap” and how it can ultimately be detrimental to any organization. I’ve reprinted what’s not behind the paywall below.

The Acceleration Trap

Faced with intense market pressures, corporations often take on more than they can handle: They increase the number and speed of their activities, raise performance goals, shorten innovation cycles, and introduce new management technologies or organizational systems. For a while, they succeed brilliantly, but too often the CEO tries to make this furious pace the new normal. What began as an exceptional burst of achievement becomes chronic overloading, with dire consequences. Not only does the frenetic pace sap employee motivation, but the company’s focus is scattered in various directions, which can confuse customers and threaten the brand.

Realizing something is amiss, leaders frequently try to fight the symptoms instead of the cause. Interpreting employees’ lack of motivation as laziness or unjustified protest, for example, they increase the pressure, only making matters worse. Exhaustion and resignation begin to blanket the company, and the best employees defect.

We call this phenomenon the acceleration trap. It harms the company on many levels—over-accelerated firms fare worse than their peers on performance, efficiency, employee productivity, and retention, among other measures, our research shows. The problem is pervasive, especially in the current environment of 24/7 accessibility and cost cutting. Half of 92 companies we investigated in 2009 were affected by the trap in one way or another—and most were unaware of the fact.

Read More

Ask Hacker News: “What should I build to support my web app?”

I had this really great post on Hacker News forwarded my way. It was worth reprinting here so I can reference it later when I need it.

Ask HN: What should I build to support my web app?

What you need on day one:

  1. Something which solves problems for people. I assume you’ve got this covered.
  2. Some way to charge people money for solving their problems. I like Paypal with e-junkie — total integration time under 2 hours. Your mileage may vary if you do subscriptions rather than one-time payments. Subscriptions scare me. Look into Spreedly.

What you may eventually want to build, buy, adapt from OSS code, etc (I have all of these in production and run a very small business):

  1. Analytics software. Google Analytics is an easy snap-in for 1.0.
  2. Conversion tracking. Again, GA for easy snap-in.
  3. Funnel tracking. I like Mixpanel as opposed to GA. You can find out why later.
  4. A CMS to publish content (for any definition of content) in a fashion which scales out of proportion to your personal time invested.
  5. Blogging software because every small business should have a blog. WordPress is an easy snap-in.
  6. Read More

Output data from PostgreSQL as a CSV without use of COPY

Here’s a one-line command that bypasses the necessity of the COPY privilege in being able to output data in comma-separated value (CSV) format:

psql -U username -h 127.0.0.1 -W database -F ',' -t -A -c 'SELECT * FROM Users' -o outputfile.csv

Also useful is taking input from a file (which helps avoid issues with quote characters):

psql -U username -h 127.0.0.1 -W database -F ',' -t -A -f input.sql -o outputfile.csv

You’re probably already familiar with most of these options, but the less common ones are:

  • -F changes the field separator to the , character
  • -t outputs the rows without their column names (which seems to undo the use of -F)
  • -A un-centers the row output
  • -c contains the actual query you wish to run
  • -f takes input of the query you wish to run from a file
  • -o redirects the output of the query to the specified file

Getting Aptana Studio 3 working with GitHub on your Windows PC

While setting up my laptop to do development work on I came to the realization that I’ve always gotten my IDE running using a patchwork quilt of websites, each providing small but crucial tips on getting a Rails dev environment with GitHub integration working smoothly under Windows. Here’s my attempt to put all those tips in an ordered list for others to benefit from.inflatables for sale in canada

This guide assumes you’ve already created yourself a GitHub account, so if you haven’t gotten to that yet, head on over and spend the two minutes it takes to register and verify an account.

Read More

XPATH query for a node based on its value

Found the article Locating the node by value containing whitespaces using XPath on Stack Overflow – reprinted here so I don’t forget it:

If you know the exact value of the node – say it’s “Hello World” with a space used jumpers for sale:

<top>
   <aChild>Hello World</aChild>
</top>

Then the XPath expression:


/top/aChild[.='Hello World']

will select this node.