## Archive for January, 2009

### Using a linear array as a bidimensional matrix

Tuesday, January 27th, 2009

Often times I find the need to use a list or linear array as if it was a table.

Everytime I need to do so, I always end up coding functions to convert a (x,y) coordinate to the real index n in the array.

Let me illustrate, with an example. You have a string that defines the elements of a game board, and you want to work using (x,y) coordinates.

```s="xxxxx@xx@xxx@@xx"
```

If you were to look at it as a matrix (width=4), it’d be something like this

```s="xxxx
x@xx
@xxx
@@xx"
```

However, I can’t do
s[x,y], since it’s a linear array, it’s a string.

You need to convert from (x,y) to a number that represents an index in the array.

This is very simple:

```width=4
def getNforXY(x,y):
return x + width*y
```

What if you want to do it backwards. What if you need to know what’s the X and Y for a given index N in the string?

```def getXYforN(n):
y = int(n/width)
x = n - width/y
return (x,y)
```

Cheers

### Jack Bauer: “HE DID WHAT???”:

Friday, January 23rd, 2009

My first attempt at a political satire using some fiction. Obama always reminded me of President Palmer on 24. The future release of a bunch of uncertain status prisoners in Guantanamo reminds me of Jack Bauer going through hell, doing a lot of illegal shit to catch the bad guys, and then they’ll get released, they’ll say they were put in there ilegally and they will be back outside more pissed than ever.

### Unsigned band breaks into top 20 most shared music on the planet

Wednesday, January 21st, 2009

From Georgia Wonder:

London, UK: Georgia Wonder, an unsigned British band, climbed into the top 20 most shared music in the world last weekend, reaching 14th position in just four days with their debut EP ‘Hello Stranger’.

The EP was put onto the Pirate Bay tracker on Wednesday 14th January and by Saturday 17th was the only music in the top 100 from an unsigned artist. The EP of five songs, which the duo released themselves last year, hit the Pirate Bay Top 20 on Saturday evening and peaked at the 14th position in the early hours of Sunday morning. The Pirate Bay is the worlds largest tracker of shared files.

The band were able to propel their music into well over 50,000 homes across the world in just a few days after making their EP readily available to download from the welcome page of the Limewire software offshoot ‘Frostwire’.

“What Frostwire helped us achieve is incredible” explained Stephanie Grant, vocalist with Georgia Wonder. “Their support has put our music into the hands of tens of thousands of potential fans in a matter of days. 40 billion songs were shared online last year – that’s 6 songs for every person on earth. You can imagine what just five days in the top 20 means to a relatively unknown band like us.”

“We met the Frostwire guys on Twitter” said Julian Moore, the other half of Georgia Wonder. “I’d recently dusted off our Twitter account after hearing that British celebrities such as Jonathan Ross and Stephen Fry had become avid users, and after a few weeks we got chatting to the Frostwire team. They were really keen to let us try their new approach to band promotion and as we were already letting people share our music on Twitter we agreed to give it a shot. I’m so glad we did!’

Pirate Bay, the world’s largest BitTorrent tracker has repelled many unsuccessful attempts to shut it down over the last few years including a police raid in 2006 and bitter disputes with a variety of music and media companies in 2007. “It’s easy to forget that while the major record labels and anti-copyright groups have been taking high-profile shots at each other there are a lot of independent artists out here who are simply trying to navigate their way through the wreckage” said Julian. “Our success with Frostwire proves that you can cut through the argument and chart your own course.”

Georgia Wonder played in front of over 14,000 people for Simply Red frontman Mick Hucknall on his UK tour and performed at an historic election night at the London American Embassy alongside Glenn Tilbrook from Squeeze. Their song ‘Girl You Never Knew’ from their debut EP ‘Hello Stranger’ has been on rotation on Bliss TV for six months and has received plaudits from Record Of The Day and Pop Justice who called it ‘..one Grey’s Anatomy soundtrack appearance away from being an international hit single.’ They were recently nominated for an interactive award at Eurosonic and won best video in the rock category on OurStage.com in November ’08 for their song ‘Would Love To Meet’. Originally picked up by legendary BBC presenter ‘whispering’ Bob Harris who played their demos for two concurrent weeks on his BBC Radio 2 show, they have performed live on BBC Southern Counties, BBC Radio Solent, Original FM and a host of other regional radio stations.

–ENDS–

Contact

Julian Moore
julian at gwonder dot com

References
Pirate Bay Snapshot 18/1/09

40 Billion Songs Shared Online

Georgia Wonder Website

Frostwire

‘Hello Stranger’ EP Torrent on Pirate Bay

Reviews

Record Of The Day

Record Of The Day – Record Of The Week

Pop Justice – Song Of The Day

### Georgia Wonder sails to the pirate bay’s top 20 in 4 days

Sunday, January 18th, 2009

Here’s a screen capture of the Georgia Wonder’s Twitter update in regards to the promotion they did with FrostWire and FrostClick.

They decided to share their EP, “Hello Stranger” for free via FrostWire. Their torrent has reached the Top 20 most shared music torrents of The Pirate Bay in only 4 days.

### Britney Breaks the ice with Anime Fans

Tuesday, January 13th, 2009

A little too many references to Matrix, but it’s pretty cool. Seems like it’s part one of more to come.

### Remaining Questions about Palm’s Pre and it’s WebOS

Tuesday, January 13th, 2009

It was an impressive presentation the one Palm gave about it’s new product, but there are still many things they didn’t mention:

• Battery life? It’s cool that it has a removable battery, but how long does it last?
• What can we build on it? They mentioned HTML, CSS and Javascript as the tools of the trade, but if their JS interpreter doesn’t give us namespaces or global access to built in functions to access core functionality of the phone, there won’t be nothing more than a bunch of web widgets available. There was no mention whatsoever of games for this platform, maybe they’re going after the blackberry crowd and not the iPhone crowd
• How do developers distribute apps? I didn’t like the whole Sprint Exclusive crap, give us a palm-pre store!
• Flash Support?
• No demo of the camera, can it do video, no demo whatsoever of multimedia so far
• No demo of the device making a phone call

Not sure if those are things that we should take for granted, or that the device still has a long way to go.

### Preparing your primary mount and swap with fdisk

Saturday, January 10th, 2009

I have 4 big drives on a new machine, each can hold up to 2Tb of data, at first I thought I’d use the first drive for the OS and the other 3 for a RAID5 (software controlled)

Then after I had installed the operating system, I decided it was a big waste, and that I’d only need about 80gigs for the OS, and that I should use the 1920Gb (-swap,-other blocks) to be part of the RAID.

The first thing I needed to do was to resize the primary partition, but you can’t really do this while you’re using it. So I restarted with the Ubuntu CD in rescue mode, and jumped to the part where you setup the partition sizes. I told it I wanted to make the first partition smaller, I made it 80Gb, I accepted the rest of the options, and after a long while, it was finished creating the file systems, but it seems like it did a mess.

I restarted without the CD, crossed my fingers, and it did boot.

I did a:

```sudo fdisk -l
Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63   156264254    78132096   83  Linux
/dev/sda2       156264255  2930272064  1387003905    5  Extended
/dev/sda5      2882334168  2930272064    23968948+  82  Linux swap / Solaris
/dev/sda6       156264381  2834380079  1339057849+  83  Linux
/dev/sda7      2834380143  2882334104    23976981   82  Linux swap / Solaris
```

and there were 6 partitions, some overlapping, but the primary looked right. I entered fdisk and deleted the 5 other partitions, and started a new.

Created a new partition (2) for Swap. Since the machine has 8GB of Ram, that’s the amount of Swap I used for it. After the partition was defined, I changed it’s type to type 82 (Linux Swap)

Then I created another partition (3), this one using the remaining space, and set it’s type to 83 (Linux)

I wrote the changes (w) and exited. It told me that the changes were written but the partitions would not be used until I rebooted, so I rebooted.

When I came back and did:

`sudo fdisk -l`

There they were:

```   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        9727    78132096   83  Linux
/dev/sda2            9728       10700     7812500+  82  Linux swap / Solaris
/dev/sda3           10700      182402  1379193956   83  Linux
```

But now there was a problem, when I checked for the memory available there was no swap

```\$ free
total       used       free     shared    buffers     cached
Mem:       8183920     198524    7985396          0       6668      70284
-/+ buffers/cache:     121572    8062348
Swap:            0          0          0
```

So, first thing, I made sure the swap was specified on /etc/fstab for the next boot to include the swap

`/dev/sda2 none swap sw 0 0`

And then I had to make a file system for the swap

`sudo mkswap /dev/sda2`

Then, the “free” command did show the swap:

```\$ free
total       used       free     shared    buffers     cached
Mem:       8183920     220420    7963500          0       7552      86880
-/+ buffers/cache:     125988    8057932
Swap:      7812492          0    7812492
```

In this case I didn’t have to make the file system for the primary partition because it was already made, I suppose the term “making the file system” is the equivalent of saying “formatting the drive with a specific filesystem”

However I had to do it for the remainder of the disk:

`sudo mkfs.ext3 /dev/sda3`

I’ll let you know if I find anything different from the tutorials on how to make RAID5.

New /etc/fstab format in Ubuntu
I while later, I updated the /etc/fstab to include the UUID of the swap partition on the fstab, instead of the device name.
To obtain this UUID I learned about the vol_id command

```\$ sudo vol_id /dev/sda2
ID_FS_USAGE=other
ID_FS_TYPE=swap
ID_FS_VERSION=2
ID_FS_UUID=b9b825c2-85dc-4def-bfd1-9071042452fa
ID_FS_UUID_ENC=b9b825c2-85dc-4def-bfd1-9071042452fa
ID_FS_LABEL=
ID_FS_LABEL_ENC=
ID_FS_LABEL_SAFE=```

Now my /etc/fstab file looks like this:

```# /etc/fstab: static file system information.
#
#
proc            /proc           proc    defaults        0       0
# /dev/sda1
UUID=13676a4b-b669-4a7a-9776-cb10c7b492b9 /               ext3    relatime,errors=remount-ro 0       1
#/dev/sda2
UUID=b9b825c2-85dc-4def-bfd1-9071042452fa none swap sw 0 0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0
```

### The Religion Infomercial

Thursday, January 1st, 2009

• ## Categories

• June 2013
• May 2013
• April 2013
• March 2013
• February 2013
• January 2013
• December 2012
• November 2012
• October 2012
• September 2012
• July 2012
• June 2012
• May 2012
• April 2012
• March 2012
• February 2012
• January 2012
• December 2011
• November 2011
• October 2011
• September 2011
• August 2011
• June 2011
• May 2011
• April 2011
• March 2011
• February 2011
• December 2010
• November 2010
• October 2010
• September 2010
• August 2010
• July 2010
• June 2010
• May 2010
• April 2010
• March 2010
• February 2010
• January 2010
• December 2009
• October 2009
• September 2009
• July 2009
• May 2009
• April 2009
• March 2009
• February 2009
• January 2009
• December 2008
• November 2008
• October 2008
• September 2008
• August 2008
• July 2008
• June 2008
• May 2008
• April 2008
• March 2008
• February 2008
• January 2008
• December 2007
• November 2007
• October 2007
• September 2007
• August 2007
• July 2007
• June 2007
• May 2007
• April 2007
• March 2007
• February 2007
• January 2007
• December 2006
• November 2006
• October 2006
• September 2006
• August 2006
• July 2006
• June 2006
• May 2006
• April 2006
• March 2006
• February 2006
• January 2006
• December 2005
• November 2005
• October 2005
• September 2005
• August 2005
• July 2005
• June 2005
• May 2005
• April 2005
• March 2005
• February 2005
• January 2005
• December 2004
• November 2004
• October 2004