Friday, August 20, 2010

how to install node.js 0.2.0 on ubuntu

Node.js deb package is available on ubuntu repository. i just updated it to Node.js 0.2.0

To install it:
sudo add-apt-repository ppa:jerome-etienne/neoip && sudo apt-get update && sudo apt-get install nodejs

nodejs will be automatically updated when you do the usual apt-get upgrade

Sunday, August 15, 2010

removing git submodule

To remove a submodule you need to:
  • Delete the relevant line from the .gitmodules file.
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Commit and delete the now untracked submodule files.

PS: i needed to change the path to a submodule. The way i found is to remove it and add it to the new path. if you got better, ping me.

Closure Compiler on ubuntu

Install it
get it there, then run
mkdir -p ~/opt/closurec
cd ~/opt/closurec
unzip ../../Downloads/compiler-latest.zip

shortcut it
create a file ~/bin/closurec which contains
#!/bin/sh
exec java -jar ~/opt/closurec/compiler.jar $*

authorize it
chmod +x ~/bin/closurec

use it
closurec --help

Friday, August 13, 2010

Using jsdoc on ubuntu

I spent the last hour finding out how to use jsdoc-toolkit. I found it way too long. The project seems poorly documented, ironic hey.

Step #1: download it
Download jsdoc-toolkit version 2.4.0.
mkdir -p ~/opt
cd ~/opt
unzip ~/Downloads/jsdoc_toolkit-2.4.0.zip

Step #2: install it
Create a file ~/bin/jsrun.sh with the following content.
#!/bin/sh
export JSDOCDIR=~/opt/jsdoc_toolkit-2.4.0/jsdoc-toolkit
export JSDOCTEMPLATEDIR=$JSDOCDIR/templates/jsdoc
exec java -jar jsrun.jar $JSDOCDIR/jsrun.sh $*

authorize it
chmod +x ~/bin/jsrun.sh

Step #3: use it
The command line i use is below
jsrun.sh -d=build/jsdoc src/




Trick #1
use the beta version (2.4.0 at the time of this writing). The stable one, 2.3.2, only seems to produce
Cannot convert NaN to java.lang.Integer

Trick #2
Do specify the -d option to specify the destination directory. The inline doc claims to default to "out" but doesnt honor it.

PS: jsdoc-toolkit is reimplementation of the original jsdoc in perl.

Friday, August 6, 2010

Node.js deb package on ubuntu repository

I like node.js a LOT. In an effort to make it easier to install, i just made a node.js deb package on a ubuntu repository.

To install it:
sudo add-apt-repository ppa:jerome-etienne/neoip && sudo apt-get update && sudo apt-get install nodejs

nodejs will be automatically updated when you do the usual apt-get upgrade
$ node -v
v0.1.103

Wednesday, June 30, 2010

memory fragmentation fix

Memory fragmentation often becomes a problem on large programs. After a while, the kernel gives them much more than they actually used.

My current strategy is to log all memory allocation and freeing in a file. This file is then parsed to measure the issue and experiment on various solutions. My current favorite is using memory pool which are scope aware (aka short-term things go here, long term things go there)

Thursday, June 10, 2010

Fixing AVI Index on Ubuntu

After a recent system update, a lot of my videos became unseekable, aka . After some research i found out this is because the avi index was absent or corrupted. mencoder is how to fix a avi index on ubuntu.
sudo apt-get install mencoder
mencoder -idx input.avi -ovc copy -oac copy -o output.avi
Share/Save/Bookmark