*blog... kind of... *rss 



r08028 - Swine Flu


Composed for the escena.org renoise 2 competition #1

Download the renoise file

no comments
£25 later




Click to see bigger.

5 comments
Masters of Doom


Somehow, the film Choke made me buy four Chuck Palahniuk books last Christmas. I'm usually really bad on this, I buy books but I don't read them, mostly because I read very slowly. But thanks to Chuck I'm gave it another try. After fully reading Choke and Fight Club (2 books in a year it's a record already) I was now reading Masters of Doom which Andreas recommended and lent (thx!).

If you played Commander Keen, Wolfenstein 3D and Doom back in the days, you'll want to read this as it explains how they were done. Pure nerd-gossip.

5 comments
Optimising Asian fonts for Multi-language flash sites
So I'm sure you've done a website that needed to be on 1,238 different languages. And every time you reached Chinese, Japanese, Korean... you got surprised that just the embeded font made your swf 9,000kbytes big.

For this project we're working on I'm mainly doing little tools with PHP. One of them is a translations manager, so you have a little SQL database with all the keywords and languages and someone fills it with data. At any point you can export it as .xml ready to be used in the website.

Having this set up, Theo came up with the idea that, as we had control on the text that was going to be needed for each language, we could do a script to output the list of characters needed for each font.

The PHP script goes down to this:

// In this case $lines is a associative array that comes from MySQL.

$list = array();

foreach($lines as $line)
{
	$string = $line["text"];
	$string = strip_tags($string);
	$string = str_replace('\n','',$string);

	preg_match_all('/./u', $string, $chars);

	foreach($chars[0] as $char)
	{
		$found = false;

		foreach($list as $listchar)
			if ($listchar == $char)
				$found = true;

		if ($found == false)
			$list[] = $char;
	}
}

foreach($list as $item)
{
	echo "U+" . zeropad( strtoupper( dechex( substr( mb_encode_numericentity ( $item, array (0x0, 0xffff, 0, 0xffff), 'UTF-8'), 2, -1 ) ) ), 4 ) . ",";
}

You'll also need this:

function zeropad($num, $lim)
{
   return (strlen($num) >= $lim) ? $num : zeropad("0" . $num, $lim);
}

What this code does (properly setted up in yours) is split the whole string into characters and check one by one if has been added to the list of characters used, if it's a new it just adds it. Then it writes a unicode list formated as U+XXXX. The output looks something like this:

U+0043, U+0048, U+0041, U+004E, U+0045, U+004C, U+002E, U+004F, U+004D, U+0052, U+0044, U+0049, U+0054, U+0053, U+5168, U+5C4F, U+89C2, U+770B, U+5176, U+5B83, U+8BED, U+8A00, U+6CD5, U+5F8B, U+58F0, U+660E, U+97F3, U+91CF, U+5E55, U+540E, U+82B1, U+7D6E, U+5965, U+9EDB, U+4E3D, U+2022, U+5854, U+56FE, U+0020, U+4E0E, U+8BA9, U+002D, U+76AE, U+8036, U+5C14, U+70ED, U+5185, U+62CD, U+6444, U+8BB0, U+5F55, U+73B0, U+573A, U+5F71, U+7247, U+0032, U+5206, U+0030, U+79D2, U+0036, U+00B0, U+0035, U+4F20, U+5947, U+4E3A, U+4EC0, U+4E48, U+9009, U+5851, U+9020, U+5973, U+795E, U+642D, U+4E58, U+591C, U+95F4, U+5217, U+8F66, U+7684, U+4EBA, U+6027, U+611F, U+8BF1, U+60D1, U+4F60, U+6700, U+559C, U+7231, U+955C, U+5934, U+7B2C, U+4E00, U+6B21, U+7EED, U+5199, U+8F89, U+714C, U+4EE3, U+00BA, U+9999, U+6C34, U+6C1B, U+5FC6, U+6211, U+53F7, U+2014, U+79D8, U+6570, U+5B57, U+0039, U+5948, U+513F, U+4E4B, U+5E74, U+7537, U+4E3B, U+89D2, U+5D14, U+7EF4, U+65AF, U+0660, U+8FBE, U+6587, U+6CE2, U+7279, U+8FC7, U+7A0B, U+4E2D, U+7F8E, U+597D, U+56DE, U+5609, U+4F2F, U+8389, U+5212, U+65F6, U+521B, U+4F5C, U+73CD, U+8D35, U+6735, U+539F, U+6599, U+5999, U+8C03, U+548C, U+5242, U+7A7F, U+8D8A, U+5149, U+7ECF, U+5178, U+56DB, U+79CD, U+6F14, U+7ECE

What's this for you'll ask. Well, just look at this:

[Embed(source="yourfont.ttf", fontFamily="YourFont", fontWeight= "bold", fontStyle = "normal",advancedAntiAliasing="true", mimeType="application/x-font-truetype", 
unicodeRange="U+0043, U+0048, U+0041, U+004E, U+0045, U+004C, U+002E, U+004F, U+004D, U+0052, U+0044, U+0049, U+0054, U+0053, U+5168, U+5C4F, U+89C2, U+770B, U+5176, U+5B83, U+8BED, U+8A00, U+6CD5, U+5F8B, U+58F0, U+660E, U+97F3, U+91CF, U+5E55, U+540E, U+82B1, U+7D6E, U+5965, U+9EDB, U+4E3D, U+2022, U+5854, U+56FE, U+0020, U+4E0E, U+8BA9, U+002D, U+76AE, U+8036, U+5C14, U+70ED, U+5185, U+62CD, U+6444, U+8BB0, U+5F55, U+73B0, U+573A, U+5F71, U+7247, U+0032, U+5206, U+0030, U+79D2, U+0036, U+00B0, U+0035, U+4F20, U+5947, U+4E3A, U+4EC0, U+4E48, U+9009, U+5851, U+9020, U+5973, U+795E, U+642D, U+4E58, U+591C, U+95F4, U+5217, U+8F66, U+7684, U+4EBA, U+6027, U+611F, U+8BF1, U+60D1, U+4F60, U+6700, U+559C, U+7231, U+955C, U+5934, U+7B2C, U+4E00, U+6B21, U+7EED, U+5199, U+8F89, U+714C, U+4EE3, U+00BA, U+9999, U+6C34, U+6C1B, U+5FC6, U+6211, U+53F7, U+2014, U+79D8, U+6570, U+5B57, U+0039, U+5948, U+513F, U+4E4B, U+5E74, U+7537, U+4E3B, U+89D2, U+5D14, U+7EF4, U+65AF, U+0660, U+8FBE, U+6587, U+6CE2, U+7279, U+8FC7, U+7A0B, U+4E2D, U+7F8E, U+597D, U+56DE, U+5609, U+4F2F, U+8389, U+5212, U+65F6, U+521B, U+4F5C, U+73CD, U+8D35, U+6735, U+539F, U+6599, U+5999, U+8C03, U+548C, U+5242, U+7A7F, U+8D8A, U+5149, U+7ECF, U+5178, U+56DB, U+79CD, U+6F14, U+7ECE")]
public var FontClass:Class;

In this way, you're going to import on the .swf only the characters you're using from the .ttf.

In our case, Chinese went down from 9,554kbytes to 45kbytes. That's a 99.6% reduction. Pretty cool!.

Hopefully this will save some sleepless nights to someone.

23 comments
Speaking at IED Madrid
Following the "a speech per year" tradition, here are the details for this year's one. It'll be open for anyone, so feel free to come around if you happen to be in town.

IED Master Madrid
May 13th, 2009 - 19.00h.

c/ Larra nº14, Madrid. [Metro Tribunal]

6 comments
Receptor - Rhyno


This is what russian kids do when they get bored.

2 comments
Good old Plasma effect
Back in 2006, when I was a real noob coding wise (now I'm just below average), I did this plasma effect with AS2.



3 years later, in 2009, the effect with flash 10 looks like this.



Get the sources here. (It's VERY simple)

Thanks to Steve Ferrigno for indirectly pushing myself on coding the effect with Pixel Bender just by asking for the .fla of the 2006 effect :)

9 comments
Things I still miss in Ubuntu
Moving to Linux was quite a decision back in the day. If you really want to move you should be ready to miss many things, in my case: 3D Studio MAX, Photoshop, gaming, ... Although for most of the things you have alternatives: Blender, Gimp, no gaming... When I moved it was even worst because the suspend didn't work so I had to close/start my computer every time. It's been fixed now.

That's ok, but there are those little issues that would make the whole experience just perfect, this is the current list (I'll be updating it whenever I find more issues or solutions):

.psd support on the default image viewer
right now it will get open by Gimp, but this is annoying if you just wanted to preview it. I miss irfanview
.

XnViewMP can display .psd's, .ai's and anything you can imagine. Thanks Jull


vpn working out of the box
I had to connect to a Microsoft VPN and at first it didn't work. Months later I googled for the issue and found this which made it work. Tried to connect to the about-to-be-released 9.04 and it didn't work again, neither with that sites tips. On Windows it just works...


vpn to a Microsoft vpn now works flawlessly with Ubuntu 9.04 RC.


nice and consistent design
Mark recently said that in 2 years they were going to outpretty MacOS. Well, I can't see this happening that easily. 9.04 design additions aren't exactly on the right path. But hey, he also said that on Ubuntu 9.04 was going to load damn fast, and it does. We'll see.


webcam on flash player
Anytime I use the webcam in a browser, the second page I visit that tries to use the webcam breaks the webcam image input. I need to restart the browser if I want to use the webcam again.


Skype 64-bit
This is Skype's fault obviously, and a clear example of why open source is going to dominate the world soon ^^


I believe it's all a matter of patience :)

9 comments
Get the amount of files in a folder with Ubuntu
It's a shame that doing a right click > properties in a folder doesn't tell you this (as Windows does) but well... Open the terminal, go to the folder you want to check a type this:

for t in files links directories; do echo `find . -type ${t:0:1} | wc -l` $t; done 2> /dev/null

Will output this:

655 files
6 links
213 directories

Found it here.

no comments
Install debug version of Flash Player plugin in Ubuntu
Download it from here:

http://www.adobe.com/support/flashplayer/downloads.html

Uncompress it and ignore the installer script, otherwise whenever you restart Firefox the previous plugin will be used instead.

The only way I managed to find was this:

9.10

sudo cp libflashplayer.so /usr/lib/flashplugin-installer/

8.10

sudo cp libflashplayer.so /usr/lib/adobe-flashplugin/

8.04

sudo cp libflashplayer.so /usr/lib/flashplugin-nonfree/

1 comment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69