Archive for the 'tech' Category

Ubuntu’s shell != bash, and how to fix your scripts

November 15, 2010

I just found out that on Ubuntu, /bin/sh is a symlink to /bin/dash, not to /bin/bash.  Apparently this was changed to make booting up a little bit faster.

In any case, it might mean that many of your scripts won’t work because they are starting with ‘#!/bin/sh’.  Instead, you should have them point directly to /bin/bash.  Here’s a one line script that will update all the scripts in a directory:

find . -type f | xargs sed -i ‘s_#!/bin/sh_!/bin/bash_’

How Bespoke Row is running a new-product survey

September 28, 2010

We’ve talked for a long time about adding new products at Bespoke Row, so yesterday I started that process with a survey about custom pants.  We’re conducting an experiment using our Startup Mastermind spreadsheet – if we can get 5 positive responses with less than $100 of advertising, we’ll start selling pants.

To begin with, we thought about what the most important piece of information someone can share with us is.  Perhaps obviously, we realized that it’s their email address.  With just that, they’ve shown that they’re a potential customer by letting us know how to contact them when we’re ready to sell.

Therefore, we decided to make our initial survey one question long.  We start out on a page that tells people what we’re doing and asks for their email address.  If they submit it, we add them to our custom pants mailing list on MailChimp.

Initial Survey Page - just email address

Initial Survey Page - just email address

Then, we take them to a second page that has all our secondary questions – what materials/options are they looking for, whether they think the benefit will be better fit or better style, etc.  None of these are required, but if the user answers them, they’d help us make a better product.  The answers from these questions are collected in a Google Spreadsheet Form that gives us the ability to analyze the answers easily using Google’s tools.

Details Survey

Details Survey Second

I think the best part of this survey is that we randomly choose an amount of money in our potential price range and ask them “Would you be willing to pay $X for a pair of custom pants?”  This is far better than the last survey I tried, when I asked this as a multiple choice question and every person naturally chose the lowest listed price.

Finally, we take the user to a thank-you page and encourage them to try a custom shirt while they’re waiting.

All together, this was pretty easy to set up (about 5 hours) and uses MailChimp and Google Docs, which are both great free tools that do their job better than we could in-house.

Mac OSX – tabbing in forms and skipping select controls.

August 12, 2010

The fact that when I tab through a form on my Mac, it skips the drop downs, which forces me to use the mouse, has been bugging me for a long time.  I finally decided to try searching google for an answer and came upon this old, but still very relevant post by Tony Spencer:

http://www.tonyspencer.com/2006/05/02/tab-skips-select-form-fields-in-mac-browsers/

Awesome.  The only difference between 2006 and now (Snow Leopard) is that in System Preferences, Keyboard and Mouse have been split into two separate menus, so you should go System Preferences >> Keyboard >> Keyboard Shortcuts to find the ‘All controls’ radio button.

Beijing Startup Resources

August 10, 2010

I recently read a great blog post from Jon O’Shaughnessy that lists all the startup resources in Boston and a similar post by Rob Go provides a todo list for new entrepreneurs in the area.  I thought it was a great idea, so this is my attempt to do the same for Beijing.  Beijing’s startup scene isn’t quite as cohesive as Boston’s, which should make a list even more useful.  I’m going to keep adding to this as I learn more, so please add anything I miss in the comments.

Events and Groups

  • Beijing Coworking – Beijing Coworking is a group of independent workers who like to work together better than being lonely working at home.  For the most part, we’re techie/startup people, so the biggest benefit is having other people to talk to about ideas and problems with our businesses.
  • Beijing Web Wednesday – Startup and tech folks who meet once a month at Nearby The Tree.  Usually there’s a presentation and then some time afterward for networking.
  • iWeekend Beijing – This is part business plan competition, part networking event.  The first one in November was a huge success, and they’re planning to have more later.
  • StartupWeekend Beijing – Very similar to iWeekend, except that it focuses on slightly later stage ideas.  At the end of the weekend, there will probably be a few ideas that get funding.
  • Beijing HackerLab – Hosted by Yuanfen~flow incubator, the plan is to have an open space every two weeks to give people space to work on random projects.  The first one will be December 11, 2010.
  • Mobile Monday – I haven’t had a chance to go to this yet, especially since my startup isn’t mobile related, but I hear it’s also exciting

People

  • Benjamin Joffe – Twitter Organizer of Mobile Monday and deep thinker about tech in Asia.  I really enjoyed his presentation at the Geeks on a Plane Beijing mixer
  • Frank Yu – Twitter Edits the Beijing Startup Digest newsletter
  • Lee Kai-Fu – Twitter Ex. Google head and founder of Innovation Works
  • Me – Twitter – only partially joking here; I’m trying to learn as much as I can in Beijing as well, so if you’re doing cool stuff, I’d love to follow you.

Newsletters

  • The Startup Digest Beijing – currently edited by Frank Yu.  Fairly new, so only about one event per week listed.  I’m sure it will get better and bigger.

Blogs

  • Mobinode China 2.0 – This is a big blog that covers tech all around Asia, not just startups.  I linked to the China Web 2.0 category, which has more focused content, but there’s a lot on there.  To be totally honest, I’m not sure how good this will be, as I just added it to my RSS reader today.

Incubators

  • Yuanfen~flow This is an art gallery/incubator based in 798.  They host Beijing’s Hacker Lab, and currently have a few projects that they’re incubating.

Angel Investors

  • Intuitive Capital – I met a woman from this company at Web Wednesday in August.  She said they’re interested in funding startups that have some traction, but haven’t yet needed to raise any outside money.
  • Chris Evdemon – Twitter I saw him on Angellist as an Angel in Beijing.  You can pitch him here.  I believe he also works at Innovation Works.

Venture Capital

  • I don’t actually know who the VCs are that are active in Beijing yet…  Add them to the comments!

There are also occasional one-off events, like when Geeks on a Plane showed up, that are great but don’t repeat, so I haven’t included them here.

JSLint’s ‘unexpected end of line’ vs. JQuery style

June 10, 2010

I recently added a script to run JSLint over any javascript files that were changed in my last batch of commits when I push changes to our main repository (if you’re interested, you can take a look).  Immediately, I had my feelings hurt when it started reporting a bunch of errors and warnings.

Most of them I agreed with, but the ambiguous end of line warning when the line was catching syntax that I had very purposefully used to increase readability (for me).  Read the rest of this entry »

mysql_connect and ‘No such file or directory’

June 2, 2010

I was working with a friend to get him started with PHP development on OSX, and we were stumped by a ‘No such file or directory’ error message for a long time.  It seemed to be coming from the following line:

$this->linkid = @mysql_pconnect($host, $user, $password) or die(mysql_error());

At first, we didn’t understand it, because it doesn’t look like PHP is trying to connect to a file there.  However, we eventually discovered that the file that wasn’t found was the MySQL socket.  Because he had used Ports to install MySQL instead of downloading the .dmg from mysql.com, he didn’t have the same default socket as most other people on the internet. Read the rest of this entry »

sed in-place editing (-i) difference on Mac OS X: “undefined label” errors

May 27, 2010

I ran into this problem about a month ago with a bash script that I was writing on my MacBook Pro.  For some reason, sed in place editing with ‘sed -i‘ just wouldn’t work, no matter what I did, and I couldn’t find any solution online.

When running something like

sed -i 's/before/after/' test.txt

you get the error message sed: 1: "test.txt": undefined label 'est.txt'.

Eventually, it turned out to be because sed’s ‘-i‘ option takes a parameter to indicate what extension to add to the file name when making a backup.  For example,

sed -i '.bak' 's/before/after/' test.txt

leaves you with two files, ‘test.txt‘ and ‘test.txt.bak‘, where ‘test.txt.bak‘ is the original version.  Unlike Ubuntu and other linux versions, on OS X, this extension parameter is required.  If you really know what you’re doing and don’t want a backup made, you need to provide an empty string ”.

The correct way to run this command on OSX is

sed -i '' 's/before/after/' test.txt

How to include git hooks in a repository AND still personalize your machine

April 6, 2010

In my new job as Director of Engineering at 25Lux.com, I’ve been dealing with a lot of the infrastructure parts of development that I mostly glossed over before because I always worked at a company that had everything set up for me.  It’s a good chance to think about in what kind of environment I’d really like to develop.

It turns out that big part of my answer involves automating everything.  Part of my reasoning is that our team is very small now, so the more we automate, the more we can concentrate on just development.  Another part of my reasoning is that I’ve read a lot about continuous deployment lately and many of the principles like decreasing the time between developing a hypothesis and learning your answer make sense and can only be achieved through extensive automation. Read the rest of this entry »

Staying Connected Overseas with Google Voice and Skype

March 11, 2010

When I first moved to China, I decided that I still wanted to stay connected to the US.  Part of that is keeping a US phone number that can both send and receive calls and text messages.  Luckily, thanks to products like Google Voice and Skype, doing so is now cheap and easy.
Read the rest of this entry »

Root access on Ubuntu server?

November 1, 2009

I’m in the process of setting up my very first production server using Ubuntu, and I’ve ended up spending a lot of time reading about security online.  Since I’ve always let the ops team worry about setting up environments, etc., I’ve now learned that there are a lot of different concerns to think about.

One decision in particular is bugging me right now – how to secure the root account on my new machine?  Read the rest of this entry »