Skip to content


TortoiseHG, saving username/password

HG is working very well 😀

On the windows machine I have tortoisehg, which seems to want to ask me for password everytime I do a push. There is a solution where you can put both the password and username in the path, but that feels rather weird to have your password out in the open.

To have the password saved, do:

goto %USERPROFILE%\mercurial.ini (create if missing):

[extensions]

mercurial_keyring=

For each repository, edit .hg/hgrc and add [username] to the path, eg. http://[username]@hg.example.com/repo

Now for the repo it should ask for password only the first time

Posted in Technology. Tagged with , , .

Setting up Mercurial with Dreamhost – Part 2

Part 2 details how to configure security, setting up a repo, and running off sub domains (Part 1 is here: http://ucla.jamesyxu.com/?p=95)

So step one left us with a running Mercurial with the web interface. Now we need to do a few more things:

  • Configure security
  • Setting up repositories
  • Running off sub domains (so instead of http://example.com/hg, we want hg.example.com)

Authentication

If you seek clarification, look up at http://mercurial.selenic.com/wiki/PublishingRepositories

To configure security, add into the htaccess:

# Auth
AuthUserFile [Somewhere in your home]/hgweb.passwd
AuthGroupFile /dev/nullAuthName "hg Repos"
AuthType Basic
<Limit GET POST PUT>
Require valid-user
</limit>
To create the passwd file:
htpasswd -c -m [PATH]/hgweb.passwd

Now if we visit the HG address, it should ask for authentication

Setting up Repo

So now we setup a repo. Goto where the hg is hosted:
cd repos
hg init [repo name]
vi [repo name]/.hg/hgrc
[web]
contact =Name
description = Desc
push_ssl = false
allow_push = user from htpasswd that shoud have push access, csv

[ui]
username = Name <email@example.com>
charset = utf-8

Running on a subdomain

Recall to set up for a /sub directory, all we need to do is a symlink.

For subdomain its slightly more complex:

Copy the hg directory to the subdomain

vi .htaccess
change RewriteBase /hg to /
vi hgweb.cgi
after import sys line, add:
import os
os.environ["SCRIPT_NAME"] = ""

All set, we are now ready to go with hg 😀

 

To delete a repository, just remove the directory on the server

Posted in Technology. Tagged with , .

Setting up Mercurial with Dreamhost – Part 1

Part 1 details how to install. Part 2 is here (http://ucla.jamesyxu.com/?p=97)

This is just to document the process of installing Mercurial with Dreamhost. This post assumes you have ssh access and knows a thing or two about linux (since this is mainly a documentation for myself).

mkdir source
wget http://mercurial.selenic.com/release/mercurial-1.8.2.tar.gz

**I have a custom compiled Python 2.6 that somehow did not have bz2 package, these steps installs them**

wget http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz
tar xzf ..
make -f Makefile-libbz2_so
make
make install PREFIX=$HOME
cp libbz2.so.1.0.4 ~/lib/libbz2.so.1.0.4
ln -s ~/lib/libbz2.so.1.0.4 ~/lib/libbz2.so.1.0
cd ~/sources
wget http://www.python.org/ftp/python/2.6.1/Python-2.6.1.tar.bz2
tar jxf ..
./configure –prefix=$HOME
make
[We should not see bz2 on the not built module list now]
make install

[Now test the python still works:]
which python (confirm its the one we have in our own bin)
python (see it actually works…)
[Now test the python still works:]

**I have a custom compiled Python 2.6 that somehow did not have bz2 package, these steps installs them**
[So we are back in mercurial]

make all

**It now complains about missing docutils, this this happens, follow the steps below, this assumes your custom Python has setuptools**

easy_install docutils

**It now complains about missing docutils, this this happens, follow the steps below, this assumes your custom Python has setuptools**

vi ~/.bash_profile
export HGRCPATH=[HOME]/.hgrc
source ~/.bash_profile
hg –version

Now we have Mercurial installed. We can configure repos:

mkdir -p ~/hg/repos
vi ~/hg/hgweb.config
[web]
style = gitweb

cp ~/sources/mercurial-1.8.2/hgweb.cgi ~/hg
chmod +x ~/hg/hgweb.cgivi hgweb.cgi
vi hgweb.cgi
config = “[HOME]/hg/hgweb.config”
import sys; sys.path.insert(0, “[HOME]/lib/python”)

vi ~/hg/.htaccess
# Taken from http://www.pmwiki.org/wiki/Cookbook/CleanUrls#samedir
# Used at http://ggap.sf.net/hg/
Options +ExecCGI
RewriteEngine On #write base depending on where the base url lives
RewriteBase /hg
RewriteRule ^$ hgweb.cgi [L] # Send requests for files that exist to those files.
RewriteCond %{REQUEST_FILENAME} !-f # Send requests for directories that exist to those directories.
RewriteCond %{REQUEST_FILENAME} !-d # Send requests to hgweb.cgi, appending the rest of url.
RewriteRule (.*) hgweb.cgi/$1 [QSA,L]

Now we have everything! To have it linked to a domain, do:

ln -s ~/hg ~/[Sub domain]

Posted in Technology. Tagged with , , .

Finally going to switch to Mercurial from SVN

Have been thinking about this for a long while, but whats always stopped me from moving was the partial check out feature. I keep all kinds of files in SVN (word, pdf etc), we are not going to debate whether it is good or bad, but it is convenient and thats all that matters.

The problem with the SVN thats HUGE, is that everything takes ages, and a broken directory somewhere can lock the entire repo (me using a monolithic repo for everything = very very bad now that I look at it). By moving to Mercurial I am going to look at creating multiple repos for every project. This has advantages of its own, for example you check out only what you need (so I still in a sense get partial check out of my repository), and things are likely to be faster and more stable..

Moving to Mercurial is going to be a long process, and I plan to migrate only individual projects when I touch them. There will most likely be a whole series of posts on Mercurial.

Posted in Technology. Tagged with , .

Weird iPhone Facebook App problem

I installed the facebook app yesterday on the iPhone, so I could do uploads straight from the camera.

Worked ok for a day, and then from yesterday it just comes back with “Cannot upload at this time”. Turns out in Settings -> General -> Location Service, facebook turned itself off, and without location service it doesn’t upload photos…… yea…

Posted in Rant. Tagged with , , .

Finally managed to get my geek code sorted out:

—–BEGIN GEEK CODE BLOCK—–
Version: 3.1
GCS/E d-(+) s+:- a– C++(+++)>++++ !ULC P L+++ E— W+++ N !o K—-(–) w++(++++) !O !M !V PS PE Y PGP(+) t 5 X R tv b++(+++) DI++(+++) D+ G+(++) e+++(++++) h(+)>++ !r y?
——END GEEK CODE BLOCK——

Decode with http://www.ebb.org/ungeek/

Posted in Personal. Tagged with .

OpenSuSE 11.3, Macbook Pro 6.2, Bluetooth fix

See since the older post about installation of OpenSuSE 11.3 on my new macbook pro 6.2, I never realized that the bluetooth wasnt working. Never had to us Bluetooth…

Do a lsusb, and you will see both:

  • ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (Part of BCM2046 Bluetooth)
  • ID 05ac:8218

Not too sure what the first is, but the 2nd one is the actual bluetooth device. The device works fine with the btusb generic driver, but the actual problem is that the btusb kernel module does not recognize the device id, so it never initializes. Since the chipset is actually supported, we just need to patch btusb.c and add in the device ids.

But yeah, so its not working. This is how to make it work (the compiling/installing method is not optimal for building a kernel module, but meh…)

  • This is only tested on kernel version 2.6.34
  • lsusb, confirm you have device 0a5c:4500 and 05ac:8128 (8125 works also but you need to modify the code yourself in btusb.c, really easy anyway)
  • Install kernel source, header, syms
  • Install bluecove, bluecove-firmware, bluecove-test (zypper in bluecove bluecove-firmware bluecove-test)
  • Download this file
  • Check your kernel version and name with uname -r, the symbol [LINUX] below means the actual version
  • cd /usr/src/[LINUX]/drivers
  • su
  • mkdir btusb
  • untar the file into btusb
  • make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
  • cp ./btusb.ko /lib/modules/$(shell uname -r)/updates
  • depmod
  • modprobe btusb

This should then start the BT module on the macbook pro. To confirm, do a dmesg and see if you have something similar:

[   22.539176] Bluetooth: L2CAP ver 2.14
[   22.539181] Bluetooth: L2CAP socket layer initialized
[   22.577101] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   22.577103] Bluetooth: BNEP filters: protocol multicast
[   22.611592] Bridge firewalling registered
[   22.631077] Bluetooth: SCO (Voice Link) ver 0.6
[   22.631079] Bluetooth: SCO socket layer initialized
[   22.694498] usb 1-1.1.1: USB disconnect, address 7
[   22.724451] Bluetooth: RFCOMM TTY layer initialized
[   22.724456] Bluetooth: RFCOMM socket layer initialized
[   22.724457] Bluetooth: RFCOMM ver 1.11

To confirm that the device is started, do hcitool dev and you should see a device user Devices

You can now try discovery etc with the BT Manager of your choice (kbluetooth for me)…

Posted in Technology. Tagged with , , .

Windows VMWare 7.1, MacBook Pro, VMWare USB Arbitration Service

So I have VMWare 7.1 installed on Windows, running on a MacBook Pro. Whenever VMWare starts (or whenever I want to connect a USB device up), a warning comes up complaining about USB Hub cannot be connected, check arbitration service in Windows Services.

Checking the VMWare USB Arbitration Service in Services shows that it cannot be started….

Problem turns out to be that the hcmon.sys driver for looks for the first USB on USBFDO-0, which somehow mysteriously fails on the Macbook Pro.

Someone  at VMWare solved the problem with a patched hcmon.sys (Attached below).

So to fix the problem:

  1. Backup hcmon.sys in WNDOWS\System32\drivers\
  2. Copy the patched version over
  3. Whenever you want the service to run, reboot Windows and hold down F8 to get into the pre boot screen. Make sure to disable “Driver Signature Check”

hcmon.zip

Some more details can be found here

Posted in Technology. Tagged with , , , , .

Daily schedule

So some people back home has been asking what life is like as a graduate student at UCLA. Allow me to summarize my daily time allocations:

  • 6-7 Hours of sleep
  • No time for lunch, no no
  • Dinner in fastest way possible
  • 1 Hour entertainment to stop insanity from creeping in
  • Work
  • Repeat 7 days a week

Posted in Grad school, Personal, Rant.

Import BibTeX references to EndNote

Places like CiteSeerX have bibtex on the side, but no option to export to a EndNote accepted file. There used to be a custom filter for EndNote for CiteSeerX but I can no longer find it (May be I will write one sometime… *adds to todo list with low priority*).

Anyway, to import into EndNote:

  1. Open a text file, copy paste any bibtex references, and add a empty line between each of them.
  2. Use the converter here (Thanks to Trent Apted from http://sydney.edu.au/engineering/it/~tapted/bib2endnote.html)
  3. Import the xml as a EndNote xml

Posted in Information. Tagged with , , .