Monday 28 August 2006

Unix file processing magic...


Given a bunch of files like this

2.csv
3.csv

- divide each file into chunks small enough to upload to Dartmail.
Dartmail handles maximum of 1,000,000 bytes

-- find out how many lines in each file, and how big each one is

wc -l 2.csv

ls -l 2.csv

-- split a file into equal chunks, or max. specified number of lines per
segment

$ split --help
Usage: split [OPTION] [INPUT [PREFIX]]
Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...; default
size is 1000 lines, and default PREFIX is `x'. With no INPUT, or when
INPUT
is -, read standard input.

Mandatory arguments to long options are mandatory for short options too.
-a, --suffix-length=N use suffixes of length N (default 2)
-b, --bytes=SIZE put SIZE bytes per output file
-C, --line-bytes=SIZE put at most SIZE bytes of lines per output
file
-d, --numeric-suffixes use numeric suffixes instead of alphabetic
-l, --lines=NUMBER put NUMBER lines per output file
--verbose print a diagnostic to standard error just
before each output file is opened
--help display this help and exit
--version output version information and exit

SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.

Report bugs to <bug-coreutils@gnu.org>.

$ split -l 110000 2.csv 2

-- get header row from csv

$ head -1 2.csv > header.txt

-- add header file to other files that don't have header row

(doing it for 3* files

$ for i in b c <-- b and c is the array.. we'll be processing 3ab and
3ac
> do
> cat header.txt 3a$i > 3a${i}.csv <-- the 2nd i is in {} because of
the . after it.
> rm 3a$i
> done

do-done defines the block ...

-- can also be written out as one row, with commands separated by ";"
for i in b c; do cat header.txt 3a$i > 3a${i}.csv ; rm 3a$i; done

=================================

history of all commands:

split
split -h
split --help
cd e:
less 0.csv
q
wc -l 2.csv
split -l 110000 2.csv 2
ls 2*
ls -l 2*
head -1 2.csv > header.txt
cat header.txt 2ab > 2ab.csv
less 2ab.csv
cat header.txt 2ac > 2ac.csv
cat header.txt 3ab > 3ab.csv
mv 2aa 2aa.csv
rm 2ab 2ac 2ad
ls 2*
wc -l 3.csv
ls -l 3.csv
split -l 90000 3.csv 3
ls -l 3*
for i in b c; do cat header.txt 3a$i > 3a${i}.csv ; rm 3a$i; done
ls 3*
mv 3aa 3aa.csv
less 3ab.csv
wc -l 4.csv
ls -l 4.csv
ls -l 5.csv
ls -l 6.csv
ls -l 7.csv
split --help
history

Saturday 26 August 2006

Bebot bebot bet bebot bebot

Damn. My eyes are glazing over. Why don't you guys just get an interview with Apl so you can grill him over what the songs really mean?

"So Apl... what is the moral of your song? What is your mesasge to all the Filipinos out there?" (ala-Germspesyal questions)

Juskoday. It's a freaking song. A freaking bad song - bad rapping, incoherent lyrics. (not Snakes on a Plane bad.. you know what i mean)

Ang tawag sa lalake, "kelots", ang babae naman yung "bebot". It's not a derogatory term. It's just ancient 70s slang. Di ko nga maintindihan bakit niya ginamit yung salitang "bebot", considering I last heard it used around the early 80s. =)

APL: (rings a family friend) "Tito, I'm kinda writing this song, and like, it's gonna be like an anthem about Filipinos and pride and raising our game and shit, y'knowhamsaying, giving us visiblity, without any sampling issues like that Asin jam I had on the previous album. (cos i know we should've paid them royalties for using the bloody stanza of "Balita", but let's not get into that)

So, like, I was kinda wondering what's a Filipino term for 'mah gurl', or 'baybeee'"

Tito: E di Baby! Like your Tita Baby, you know? You know what I em saying also, ha?

APL: Yeah, well, it's kinda too American.. isn't there a Pinoy word, something indigeneous?

Tito: Ah, like "bebot", "chicas", "chicks".

APL: So, that's not a word that's gonna get me in trouble Tito? I'm not going for that snoop dogg angle.

Tito: Ay, hinde, iho, that's a word we used in college.. tandang tanda ko pa nung magkasama kami nina Tisoy at Pomposa... (harp strums, fade out.. flashback sequence)

Fek. Academe. Tends to remove intelligible words from vocabularies.

Check this out:

"i suggest that this focus might be a way for the female poet to harness the political power to be garnered from heteronormative sympathy for the manongs and then by extension/lateral movement to inherit a largely male tradition of filipino american writing established by manong-generation writers bulosan, gonzalez, santos, and villa as well as the flip generation of robles, tagatac, syquia, penaranda, and others."

Goddamn! That's supposed to be English?

Thursday 24 August 2006

Clerks 2, State Theatre, 22 August 2006

Went to Australian premiere of Clerks 2, with Q&A with Kevin Smith
afterwards. Made the BIG mistake of only lining up at 10 to 6. There
were probably a few hundred people before me, lined up from the State
Theatre entrance, down the alleyway beside the theatre, then going
back out again. By the time we were near the entrance the line was now
going down the side, back up, then out along Market St.



Kevin Smith introduced the film by saying, "This place is <i>way </i>too classy for a film like this"



There was 15 min break after the movie (finished around 9), then the
Q&A. It went on til 12pm! Originally Q&A was supposed to be 90 mins,
and it went for 150 (9.30-12).



Surprising, heart-warming story about Jason Mewes, his battle with
drugs and alcohol, and how cleaned up he was on this film, and he
played the role of cheerleader for the rest of the team.

Was his first time in Sydney, didn't think anyone gave a fuck over
here. Hah! And then the usual stuff about this place being really
nice, wanting to move here, bla bla. We lap it up anyway cos we love
him!



Everyone except me, and my 2 other friends left. I knew my wife wasnt
really into it, but I thought one of my brothers might. Feh. They
missed out bigtime.

Sunday 20 August 2006

Fixing Windows error "NTLDR is missing"

My friend rang this morning and asked if I had a Windows XP install
CD. His girlfriend's laptop wasn't booting up and she had an
assignment due this week. They were getting the message "NTLDR is
missing". Initially, we booted up using the Bootable XP rescue disk
(see Bart PE Loader) but didn't really know what to do once we got in.
Then tried booting with Windows XP install CD and selecting "Repair
Windows" option. It eventually got to command-prompt but again, we
didn't know what to fix.

Then finally, I went to google, entered the error message and in about
30 seconds I had the solution:

http://www.computerhope.com/issues/ch000465.htm

Windows XP users

1. Insert the Windows XP bootable CD into the computer.
2. When prompted to press any key to boot from the CD, press any key.
3. Once in the Windows XP setup menu press the "R" key to repair Windows.
4. Log into your Windows installation by pressing the "1" key and
pressing enter.
5. You will then be prompted for your administrator password, enter
that password.
6. Copy the below two files to the root directory of the primary hard
disk. In the below example we are copying these files from the CD-ROM
drive letter "E". This letter may be different on your computer.

copy e:\i386\ntldr c:copy e:\i386\ntdetect.com c:\

7. Once both of these files have been successfully copied, remove the
CD from the computer and reboot.

--------------

Makes you wonder why the hell these files constantly get corrupted!

Wednesday 9 August 2006

Lily Allen!

OMG. I'm grinning stupidly. I love her album, Alright Still. I love it so much I'm actually thinking of buying the CD. Imagine that. All that adsl2+ bandwidth and this album's good enough to make me pay for it? Hot damn.

I was pretty sure I would looove the new Pharrell album, but it kinda fell flat. But with this one - love at first listen, baby!

NOTE: I wrote this at around 3am, and my English composition skillz are not as 1337 as they should be, and all these are first impressions anyway. I might be more coherent in a future attempt at a review.

Funny how Smile has already made its way onto TV, via the Just Jeans commercial, when it's only started climbing the charts. I guess the marketing department's learned the lessons of Moby - saturate the ether, by any means necessary! Not that this addictive stew of reggae, dancehall, funk, ska, girl group pop would have any trouble making its mark.

Knock Em Out is like a Streets-y successor to TLC's No Scrubs. How English - to actually be taking the trouble to find a polite way to say, "Just get out my face/ just leave me alone/ oh no you can't have my number/ cos I lost my phone". Possible next single?

Everything is wonderful in Everything's Just Wonderful. That 60s sounding beat. (papap-PAP, papap-PAP!) Handclaps! Farfisa! (or whatever makes that carnival-sounding organ sound). Harmonies. The heady chorus "Oh yeah, just fine/ everything's just wonderful/ I'm having the time of my life" contrasts with verses like "I wanna be able to eat spaghetti bolognaise/ and not feel bad about it for days and days and days/ all the magazines they talk about weight loss/ if i buy those jeans i can look like kate moss" This also gets a vote as the next single. The swearing might be an issue with radio though.

Not Big is one of the most hummable diss songs. Reminds me of that 90s song Short Dick Man, but clever. Telling your ex he's rubbish in bed and you'll making your way through his mates, and tell them that he's "small in the game". Damn, that's harsh. But you still end up singing it, even if you're a guy.

Shame For You reminds me of Dawn Penn's "No No No (You Don't Love Me)". There's a mashup out there, waiting to be made! Or maybe Lily's already made one.

Littlest Things takes the Karma Police intro, sends it through a harpsichord, then gets a bit Dido. But a bit more melody.

Take What You Take sounds like an indie-rock, girl power anthem - Spice Girls go back to '89 and hook up with the Stone Roses.

Alfie reminds me of The Beatles' "Obladi-Oblada". In a good way. =) Song to a younger brother wasted and smoking pot and pulling her hair. Unexpected closing song. Heck, it's all unexpected anyway.

Just emailed my friend MA to ask if she wants to check out Lily at her (only) Sydney gig at Club 77 in Sydney, on Thursday, 10 August. Hope a proper tour comes soon!

It's the melodies that hook you in. Reminds me of those old Beatle's albums where practicallly every song sounds like it was made as a single. No meandering, noodly, wanky, time-wasting, spinach art (it's good for you!). Hooks, melodies, and more hooks. My favourite album, probably for the rest of the year.