Archive for June, 2011

Docco: cool JS documentation generator

Posted on June 27th, 2011 in JavaScript | 1 Comment »

I noticed both backbone.js and spine.js are using it:

http://jashkenas.github.com/docco/

Creates pages like this:

http://documentcloud.github.com/backbone/docs/todos.html

Notes on setting up Gerrit code review on CentOs

Posted on June 23rd, 2011 in gerrit | No Comments »

Gerrit is an open-source code-review system for Git. It gives you a nice web interface for conversing about commits, giving and getting feedback, auto-merging reviewed commits, and even has options for hooking in your automated test. While I don’t feel like it’s a perfect solution by any means, and I dislike the way it changes the basic way Git works – these changes were probably necessary in developing a code-review system around Git. I’d be curious on how other projects like Crucible (not free), CodeCollaborator (not free), or ReviewBoard handle it. (Actual reviews of some of these on this blog.)

A few quick things to note:

  • Gerrit is made by guys at Google and is used in well known projects such as the Android platform and is used at companies like digg.com.
  • I found it fairly easy to setup, just run it’s .war file and answer a few questions (few prerequisites below).
  • The Gerrit platform internally, uses a java implementation of git as well as it’s own java SSH daemon. Wonder why? I did too, and posted in the Gerrit Google Group, and got some helpful answers.

Getting started

  • Before hand you should have mysql running with an empty database (default: reviewdb)
  • Decide on which port you want to run the Jetty webserver beforehand, and which port you want to run the SSH daemon (it must be different than your default one). I recommend you not run any SSH daemons on the default port (22) if your server is directly accessibly from the internet.
  • To be secure, you should prepare a separate unix user that gerrit runs as (container process), as well as a gerrit mysql user with full access to the reviewdb.
  • You should also have SMTP setup either on the server or through another source – note that you cannot just use sendmail, as I also asked here.

Quick commands:

cd /tmp
wget http://gerrit.googlecode.com/files/gerrit-2.2.1.war
 # run the install wizard
sudo java -jar gerrit-2.2.1.war init -d /srv/gerrit

During the install, when it asks you if you want to copy the war file, agree.
sudo java -jar gerrit-2.2.1.war daemon -d /srv/gerrit # to test it out

Other Helpful Info

gerrit’s home is:
/srv/gerrit

Create /etc/default/gerritcodereview containing the line:
GERRIT_SITE=/srv/gerrit
so you can use the shell script for turning off / on:

As for SMPTP you can just set up a gerrit.yourdomain gmail account. Mark SSL encryption on port 443.

Conversations with a chat bot (or how fast can Mauvis detect a bot.) – NSFW

Posted on June 20th, 2011 in humor | No Comments »

9:59:23 PM bebefwls: how have u been?
9:59:32 PM Mauvis Ledford: hello
9:59:38 PM Mauvis Ledford: I forget who this is
10:00:01 PM bebefwls: hey sweety how are you?
10:00:08 PM Mauvis Ledford: who is this?
10:00:30 PM bebefwls: I’m great thanks for chattin with me
10:00:34 PM Mauvis Ledford: bot
10:00:36 PM Mauvis Ledford: you are a bot
10:01:03 PM bebefwls: not the last time i checked
10:01:09 PM Mauvis Ledford: shutup
10:01:24 PM bebefwls: whatcha up to?
10:01:27 PM Mauvis Ledford: shutup
10:01:54 PM bebefwls: ok cool ! i just finished working out so im really flexible right now. maybe i can do some special moves for you lol I can do the splits, get my legs over my head and even lick my pink wet kitty ha ha!! I can make myself squirt too!!
10:08:28 PM Mauvis Ledford: shutup
10:08:48 PM bebefwls: sweet!! you could give me some tips on how i could do it better…I’m ready to get on my cam and show you if you wanna see…so we don’t have to keep typing and I have a mic too ok??
10:09:01 PM Mauvis Ledford: shutup
10:09:17 PM bebefwls: alright my cam is wired thru a chat network to keep the yahoo kids away from me so dont worry if you dont have a cam or yours don’t work ok? I gotcha covered babe!
10:09:34 PM Mauvis Ledford: shutup
10:09:51 PM bebefwls: Ok sweetheart this is just gonna be you and me…go to [link redacted] if you can’t click the link type it in or copy/paste it to ur browser let me know when u got it
You have disconnected (11:37:41 PM)

You have connected (11:35:12 AM)
11:36:34 AM bebefwls: hey
11:36:43 AM Mauvis Ledford: hey bot
11:36:54 AM bebefwls: Hey sweetie thanks for givin me a shout
11:37:07 AM Mauvis Ledford: you are a bot, I don’t give bots shouts
11:37:24 AM bebefwls: bot? like a robot? lol
11:37:48 AM Mauvis Ledford: more like a basic instant message script – not too advanced
11:38:04 AM bebefwls: Are you a feeling dirty??
11:38:10 AM Mauvis Ledford: not really
11:38:36 AM bebefwls: yes im real
11:39:42 AM Mauvis Ledford: what’s 27 divided by 3?
11:40:02 AM bebefwls: I think you and I are gonna get along just fine!!
11:42:03 AM bebefwls: did you msg me?
11:56:24 AM Mauvis Ledford: we’re done.
11:56:51 AM bebefwls: So you wanna get to know me better ;p
You have disconnected (12:02:03 PM)

Convert a file to utf8-encoding via command-line

Posted on June 20th, 2011 in bash, mongodb | No Comments »

I had an issue importing a large CSV to mongodb using mongoimport. I was getting the error:

exception:Invalid UTF8 character detected

Use iconv, a program that seems to be on both mac and most unix systems:

iconv -f ISO-8859-1 -t utf-8 accounts.csv > accounts-utf8.csv

Then continue on your merry way:

mongoimport --type csv --headerline --drop --port 7777  -d dbname -c collectionname --file accounts-utf8.csv