Flash Crowds in your garage…

July 8th, 2008

AKA how to build a distributed web system on a budget…

Link here

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]

Storing chess positions efficiently in PostgreSQL

May 7th, 2008

PostgreSQL has a wonderful feature which is called User-Defined types. It allows anyone to create a new datatype, along with the relevant operators, which are then managed almost natively by Postgres.

I decided to use this feature to manage chessboard positions in a more efficient manner than the usual ASCII storage which looks like “rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR”

I named this new type EPD, for “Extended Position Description”. I know that all the relevant data is not present (I shall typically store information like the active color, the casting availability, and a few other fields), but it didn’t sound like a bad choice for a name.

It allows to do some cool things like:

– Create a table with the epd type

chess=# CREATE TEMPORARY TABLE test_epd(my_epd epd);
CREATE TABLE

– Insert a string - it gets automatically converted to a native format and only takes 32 bytes
chess=# INSERT INTO test_epd VALUES (’rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR’);
INSERT 0 1

– And converted back into a string

chess=# SELECT * FROM test_epd;
my_epd
———————————————
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR
(1 row)

– What’s on A2 ?
chess=# SELECT epd_piece_at(my_epd, ‘a2′) FROM test_epd;
epd_piece_at
————–
n
(1 row)

chess=#

The code is available here. The installation process is:

  1. Compile: make
  2. Install the .so: make install
  3. Configure postgresql: cat epd.sql | psql
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]

Installing the VMWare tools with Debian Etch

March 17th, 2008

Startup the guest Debian.

In VMWare, click on VM / Install VMWare Tools…

/dev/hdc must be unused !

Click on “Install”

VMWare will mount a virtual CD on your system. Copy VMwareTools-.tar.gz to your home directory

cd ~ && tar xzvf VMwareTools*

cd vmware-tools*

apt-get install gcc linux-headers-2.6-686

ln -s /usr/src/linux-headers-2.6.18-6-686 /usr/src/linux
cd /usr/src/linux

apt-get source kernel-image-2.6-686./vmware_install.pl

Answer [ENTER] to all questions - should work :)

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]

Measuring a web server performance

March 4th, 2008

This can obviously be done through the CLI using Apache Workbench.

Another nice interface is Apache JMeter.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]

Home to make a Samsung PVR HR-737 zone-free?

February 23rd, 2008

This tricks only works if your DVD is in Zone 2.

  • Empty the DVD tray
  • Power off / Power On
  • Wait for the boot
  • Press 5 times 0 within 1 second
  • Press “Repeat”
  • Type: 57538
  • You should see a “2″ in the upper left corner of the screen
  • Quickly type 9

That’s it.

(Apparently if your DVD is Zone-2 then you should type 76884 instaed of 57538, but I couldn’t confirm it)

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]

High-performance websites

January 28th, 2008

… check Googletalk :)

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]

How many CPUs are on my FreeBSD box?

January 19th, 2008

-bash-3.2$ sysctl -a hw.ncpu
hw.ncpu: 8
-bash-3.2$

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]

Optimizing bulk inserts in MySQL

December 21st, 2007

Link Here

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]

How to make a Höher H088 DIVX/DVD zone-free?

September 6th, 2007

Quite easy actually:

  • Plug in
  • Power on
  • On the remote, press “Open”
  • And press on 9 as many times as it takes to get a “9″ displayed on the screen

That’s it.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]

MySQL logfiles analysis

September 4th, 2007

Looking for a way to check your global MySQL performance, to identify missing indexes and other possible optimization points?

Today’s featured link should solve all your issues: mysqlsla.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]