Logo

ZLB



Blog


SC Hint #3 – Block – Break

Tuesday, December 22nd, 2009

if you need to break from the middle of a iteration, because let’s say you had an error and you shouldn’t continue, then you can use:

block{ |break| 10.do{ |i| if(i==5){ break.value(999) } } }

SC Hint #2 – get the Rect with the size of View

Friday, December 18th, 2009

If you have a view and you want to get a Rect with it’s width and height you can do:

Rect(0,0,view.bounds.width,view.bounds.height)

But it’s more compact to do:

view.bounds.extent.asRect

SC Hint #1 – reduce

Thursday, November 26th, 2009

A great way to apply a binary operator successively  to the elements of an array is to use reduce.

e.g.

[true,false,true].reduce('&&')
["This ","is ","a string."].reduce('++')

svn heaven

Thursday, November 19th, 2009

Hi

I just discovered this week that it takes about 4 commands to set up an svn repository on my mac. Now I wonder how I ever survived without it. No more zips with different versions of the code, all changes are logged with comments, I can go back to older versions of the code easilly and compare changes between any two revisions.

A guide to setting up a local svn here.

Xperimental Events Netherlands

Monday, November 16th, 2009

A google calendar with nice events going on in the netherlands is up in the web:

If you want to add events, drop me a mail and I’ll add you to the list.

hypocrisy

Thursday, November 12th, 2009

In what concerns the music distribution, we are living in an age of hypocrisy: people only take seriously labels that release albums in cd format, yet a large amount of people only want to listen to such cds in their computer, and buys the cds of their favorite artists only to arrive home and rip them to iTunes.
Releasing in cd format brings respectability, because, specially for the indies, it means effort, commitment and seriousness. Any loser in the net can upload some mp3 to some stupid web 2.0 website, but shelling out a couple of hundred euros to make a pressing, that’s a different business altogether. There is risk involved. Well, I don’t disagree with this, but wether people like it or not, we are moving to the web, and cds will be something of the past, so online-only labels need to start finding ways to increase confidence in the consumer, namely by taking it as seriously to release something online has they did to release something physically. Each single release has to have quality.
And the current indie labels that release only cds, they should start releasing in lossless with high quality pdfs of the artwork, that would go a long way to making people spend money online.

[edit]

Apparently it’s not only me that’s saying it, MC Hammer agrees:

”The CD is now the wax album and so it is a collector’s item for people who collect music and love to look at the liner notes and feel paper. I don’t know what would turn them on about having to go through that terrible exercise of trying to open the packaging – it’s unbelievable when you’re trying to open a CD, right? You need a box cutter … it’s a tough deal to get it open. And once you get it open … you go and upload it to your computer,” he says with a hearty laugh.

[/edit]

Apple Vs Stalin

Wednesday, November 11th, 2009

from tuaw:

The C64 emulator that was pulled from the App Store by Apple for leaving a BASIC interpreter intact has now returned, though we presume it’s minus the Apple-offending code.

In fact, the only thing it doesn’t have is an interpreter, but of course you know why that is by now: Apple doesn’t want anyone running code on their devices that they haven’t approved through the App Store.

Hum, no code but apple approved code, what does that remind me of ?… Ah, yes, it’s called censorship.  Why think too much about it, let’s just go along like happy lemmings into the brave new world of  touch enabled, good looking, well designed, proprietary, closed, totalitarian mobile platforms.

I mean there’s the debate between open-source (Linux) and closed source (OSX and Windows), but any of these, independently of the licensing gives you the freedom to develop and run whatever you want in your device without having to ask permission to anyone (except in the case of DRM).  Even the children eating Microsoft allows you to do this. But now, Apple seems to think THAT is too much freedom, and like the good old bolsheviks they want some “democratic centralism” . I really don’t like where this is going.

Perl poetry

Wednesday, November 11th, 2009
#!/usr/bin/perl
 
APPEAL:
 
listen (please, please);
 
open yourself, wide;
    join (you, me),
connect (us,together),
 
tell me.
 
do something if distressed;
 
    @dawn, dance;
    @evening, sing;
    read (books,$poems,stories) until peaceful;
    study if able;
 
    write me if-you-please;
 
sort your feelings, reset goals, seek (friends, family, anyone);
 
        do*not*die (like this)
        if sin abounds;
 
keys (hidden), open (locks, doors), tell secrets;
do not, I-beg-you, close them, yet.
 
                            accept (yourself, changes),
                            bind (grief, despair);
 
require truth, goodness if-you-will, each moment;
 
select (always), length(of-days)
 
# listen (a perl poem)
# Sharon Hopkins
# rev. June 19, 1995

Guide to making Audio only DVDs with open-source tools in GNU/Linux

Wednesday, November 11th, 2009

Due to an upcoming release involving a DVD I’ve had to figure out how to make a dvd from a couple of multichannel tracks. I’m using a mac and I wanted to use open-source tools. The road wasn’t that easy to travel, so I’m posting my findings for other travelers in the brave new world of Linux.

1 – You will need to use dvd-author and some other tools. I tried to install them in osx, but it was just to difficult, in the end I decided to just make a virtual machine in parallels and install ubuntu 9.10.

2 – After installing ubuntu, install dvd-author (from ubuntu software center) and aften (from synaptic).

3 – The files should be multi-channel interleaved wavs. If you have them as mono files, interleave them on osx with de-interleave or use sox.

4 – In dvds the files always need audio and video, so you need to have a background image. For pal these can ben 720×576 png files.

5 – Put the png files and the wav files in a folder in ubuntu. They should be named dvd1.png, dvd2.png and dvd1.wav, dvd2.wav, etc.

6 – Depending on how many tracks you have to make a dvd.xml file for dvdauthor like this:

?Download dvd.xml
<dvdauthor>
    <vmgm />
    <titleset>
        <titles>
            <pgc>
                <vob file="dvd1.mpg" />
                <vob file="dvd2.mpg" />
                <!- etc -->
            </pgc>
        </titles>
    </titleset>
</dvdauthor>

7 – Then run this script on that folder and wait (one hour or so in my machine)

?Download builddvd.sh
#!/bin/bash
# Miguel Negrão 2009
 
for file in `ls *.png` ; do
 
echo "File is $file"
# name without extension
name=${file%\.*}
# number of samples in audio file
SAMPLES=`sox --info -s "$name".wav`
echo "Number of samples is $SAMPLES"
# number of corresponding pal frames
PALFRAMES=`expr $SAMPLES '/' 1920`
echo "Number of pal frames is $PALFRAMES"
 
echo "converting to ac3"
aften -b 448 -smix 2 -dsur 1 -acmod 6 -lfe 0 -xbsi1 1 -dmixmod 2 -lorosmix 2 "$name".wav "$name".ac3
 
echo "making m2v from png"
pngtopnm "$file" | ppmtoy4m -F 25:1 -A 59:54 -I p -n "$PALFRAMES" -S 420mpeg2 -r  | mpeg2enc -a 2 -n p -f 8 -v 2 -o "$name".m2v
 
echo "muxing m2v and ac3"
mplex -f 8 -o "$name".mpg "$name".m2v "$name".ac3
 
done
 
echo "Creating DVD structure"
dvdauthor -o DVDFOLDER -x dvd.xml

8 – to make a dvd image in osx that is compatible with dvd players type in the terminal:

 
hdiutil makehybrid -udf -udf-volume-name MYDVD 
-o MY_DVD.iso DVDFOLDER

The piratebay is dead…

Tuesday, June 30th, 2009

It’s a sad day… the piratebay has sold out. What is difficult to understand is why they would try to present this as something positive when the new owner already said it will turn it into a “legal” filesharing site. It’s just sad…


info_at_friendlyvirus.org
sales_at_friendlyvirus.org
www.myspace.com/friendlyvirus/