Posts for Tuesday, September 8, 2009

Fast Compositing with KDE4 and FGLRX

After a much heated discussion about how to fix the horrible resizing and performance bug with FGLRX and KDE4, no one knew where to start looking. The X team had to do a little digging; the KDE4 team needed to change somethings; the FGLRX warehouse needed to get their shit together and listen to the users… bla bla bla the flame wars raged on, fingers were pointed, and nothing ever got done.

That is, nothing got done until a lone user piped up with a workaround. Here is what he wrote in the comments of that blog post:

Hi, I have been pissed off by this problem a long time and assumed it was ATI’s fault. Tonight I made one last effort before ordering a Nvidia graphics card. And I was successful.

I am running catalyst 9.8 using a Radeon 3850 and have had this re-size/maximize problem as long as long as I have used KDE4. To solve the problem I needed to modify a file in xorg-server. in the code directory it is called ./composite/compalloc.c. Here I commented out most of a function called compNewPixmap. Everything below these lines:

pPixmap->screen_x = x;
pPixmap->screen_y = y;

all the way down to (but not including) the last line:

return pPixmap;

After this I am running KDE4 with all desktop effects that I want and without any lag in resizing/maximizing.
I am running Gentoo, so I just updated the xorg-server source package file and put it back into the source repository, rebuilt the manifest and emerged it again. Voila!

Voila indeed. The patch he’s talking about looks like this (thanks to this Russian blog I can’t read):

--- composite/compalloc.c.orig  2009-09-08 02:54:28.657143479 +0700                              
+++ composite/compalloc.c       2009-09-08 02:55:42.835357653 +0700                              
@@ -484,64 +484,6 @@                                                                             
     pPixmap->screen_x = x;                                                                      
     pPixmap->screen_y = y;                                                                      
 
-    if (pParent->drawable.depth == pWin->drawable.depth)                                        
-    {                                                                                           
-       GCPtr   pGC = GetScratchGC (pWin->drawable.depth, pScreen);                              
-                                                                                                
-       /*                                                                                       
-        * Copy bits from the parent into the new pixmap so that it will                         
-        * have "reasonable" contents in case for background None areas.                         
-        */                                                                                      
-       if (pGC)                                                                                 
-       {                                                                                        
-           XID val = IncludeInferiors;                                                          
-                                                                                                
-           ValidateGC(&pPixmap->drawable, pGC);                                                 
-           dixChangeGC (serverClient, pGC, GCSubwindowMode, &val, NULL);                        
-           (*pGC->ops->CopyArea) (&pParent->drawable,                                           
-                                  &pPixmap->drawable,                                           
-                                  pGC,                                                          
-                                  x - pParent->drawable.x,                                      
-                                  y - pParent->drawable.y,                                      
-                                  w, h, 0, 0);                                                  
-           FreeScratchGC (pGC);                                                                 
-       }                                                                                        
-    }                                                                                           
-    else                                                                                        
-    {                                                                                           
-       PictFormatPtr   pSrcFormat = compWindowFormat (pParent);                                 
-       PictFormatPtr   pDstFormat = compWindowFormat (pWin);                                    
-       XID             inferiors = IncludeInferiors;                                            
-       int             error;                                                                   
-                                                                                                
-       PicturePtr      pSrcPicture = CreatePicture (None,                                       
-                                                    &pParent->drawable,                         
-                                                    pSrcFormat,                                 
-                                                    CPSubwindowMode,                            
-                                                    &inferiors,                                 
-                                                    serverClient, &error);                      
-                                                                                                
-       PicturePtr      pDstPicture = CreatePicture (None,                                       
-                                                    &pPixmap->drawable,                         
-                                                    pDstFormat,
-                                                    0, 0,
-                                                    serverClient, &error);
-
-       if (pSrcPicture && pDstPicture)
-       {
-           CompositePicture (PictOpSrc,
-                             pSrcPicture,
-                             NULL,
-                             pDstPicture,
-                             x - pParent->drawable.x,
-                             y - pParent->drawable.y,
-                             0, 0, 0, 0, w, h);
-       }
-       if (pSrcPicture)
-           FreePicture (pSrcPicture, 0);
-       if (pDstPicture)
-           FreePicture (pDstPicture, 0);
-    }
     return pPixmap;
 }

This patch works like a charm. All of the FGLRX resizing/maximizing bugs disappear. Not only that, but things like clicking on the K menu are suddenly a lot faster… KDE4 doesn’t seem laggy and now has the performance I’ve expected all along. The effects look great, and my transparent terminal is a delight.

There is, however, a bit of garbage that shows up occasionally, and perhaps there’s a good use for the code that was removed in the patch. Why is it only FGLRX that benefits from removing this code? I don’t know much about XOrg internals, but I’m guessing it has to do with some sort of sometimes-required allocation that causes a readback in the FGLRX driver but not in other drivers. What’s the deal? Is fixing this problem as simple as committing this patch and then fixing the garbage error? Or is the code that was removed necessary, and really the problem lays with FGLRX? What to do at this point?

Posts for Monday, September 7, 2009

Dress-up your Firefox

I just stumbled across a Mozilla Labs project called Personas.  It’s  light-weight theming for Firefox that can be changed without restarting the browser.  After you install Personas, you get a new menu entry Tools->Personas for Firefox, where you can quickly change the persona you are using.  From what I can tell, Personas seem to change the your browser toolbar and menu font colors and usually add a lightweight background picture.  According to the website, the project has been going since Dec 2007, so there’s a lot of Personas to choose from.  I guess I’m a little slow sometimes. :)

One thing that is really cool is you can visit the personas gallery and see a bunch of different personas and when you hover your cursor over a persona, your browser will temporarily use that persona.  If you want to use that persona now, just click on it and it’s your active persona.

Here’s a quick little clip that shows what Personas does.

Spriting and learning

In the mid-1990's I was really into Nintendo games, as was everyone. My favorite was the original NES Final Fantasy. Sometime in my teens I got my first computer, and I decided it would be cool if I had some sprites of that game on my computer.

Before

My first computer ran at 640x480 with 16 colors. I had Windows 3.1 and the most sophisticated image manipulation program around was MS Paint. How could I get sprites into my computer? Well, I had a strategy guide for the game, with blurry photos of all of the enemies, so I just opened up MS Paint, zoomed waaaaaaaay in, and drew all of the sprites pixel-by-pixel. Insane? Maybe, but it's a fun kind of insane.

This took about a year of off-and-on work, but in the end I had something I thought was great. I still have the file:

FF1

Note that my computer couldn't even produce sophisticated colors like "orange" and "brown", so I had to tile red and yellow together so it looks orange from a distance. Oh how computers have progressed since then.

At this point I loved computers but I literally didn't even know what programming was. I had never heard of the internet. I didn't even get a taste of programming until high school.

In 1999 I was in college but still largely ignorant of programming. I decided to start my first website, which was about the NES Final Fantasy that I still liked. I decided to put some sprites on the site. For the first version I chopped up my old image file from above into individual sprite files, but the quality of these was terrible.

So the way I got good sprites was by taking screen-captures of the game in an NES emulator, then in Paint Shop Pro I cropped out the backgrounds. This was much faster than hand-drawing, but it still took months.

This is an example of using a thousand-dollar piece of equipment as a hammer to pound in a nail. It's the most rudimentary form of computer use. It's the kind of thing I cringe at when I see coworkers do it today.

After

Last weekend, many years older and hopefully a tiny bit wiser, I pulled out my copy of the most recent remake of FF1, for the PSP. I decided it'd be cool if I could rip some sprites from this.

So, first I got an ISO of the game and mounted it loopback so I could view the files. In the ISO there's a 100MB BPK file. I didn't know what this is so I opened it in a hex editor and saw that it was some kind of archive. You could clearly see an initial list of filenames with byte offsets and some other flags for each, then a bunch of binary data.

A few google searches later and I found this where someone else had the same idea as I did. There's an extraction script there in some language I don't know, but it wasn't hard to figure out what it was doing.

So then I was going to write a script to extract the BPK but thankfully someone in Japan already did which saved me the trouble of even doing that. Some of the extracted files were themselves archives, but after running the script on its own output a few times I had a bunch of GIM files.

What's a GIM file? Never heard of it. But a quick google search for "GIM to BMP" will net you a program called gimconv. Sadly it's Windows-only, but a batch file or two later and I had a bunch of BMPs like this:

KURO

These files have solid backgrounds, but I want transparent backgrounds. But it isn't hard to make an image's background transparent in Linux using ImageMagick and its nice documentation. One snag is that all the images have different background colors, but I can tell ImageMagick to use the color of the top-left pixel as the transparency color:

for f in *.bmp; do convert -matte -fill none -draw 'color 0,0 replace' $f ${f/bmp/png}; done

Some of these images look like sprite sheets. So let's pick one, chop the sprites into individual files, then make an animated .gif from these sprites (while also adding a transparent border around it).

convert KURO.png -crop 32x32 +repage KURO%d.gif
convert -matte -bordercolor none -border 28 -compose Copy KURO?.gif -delay 25 -dispose Background KURO.gif

Giving us:

KURO

So after a matter of 2-3 hours (most of which was puzzling over some hex data and then googling around), I am already pretty much done. Barely any skill on my part required other than knowing what to look for.

The moral of this story is:

  1. The internet is awesome. It's easy to forget how much better life is with so much knowledge at our fingertips. I can't even remember what it was like without the internet and I'd never want to go back to that.
  2. Learning is fun. What was a year-long job became a few-minutes job with even a rudimentary knowledge of scripting.
  3. ImageMagick is pretty handy.
  4. Old school games are great. FF1 is still fun after 20 years. They keep re-making it for new systems for a good reason.
  5. I got a late start in programming. I wish I would've started at a younger age. Think of how much more I could've accomplished with my time. I'm still playing catch-up in many ways.
  6. Sitting here in front of 3840x1200 pixels worth of million-color monitor screen, typing a story people are going to read in a few minutes in countries I'll never visit, ripping sprites from a portable game device that's probably thousands of times faster than my old NES, I can't even imagine what we're going to be doing with computers in another 15 years.

New Resolver Data Structure Pictures, or, Why I Need Lots of Pens


As some people may or may not have heard, one of the big Paludis projects we’ve been discussing for the past couple of years has been to come up with a super-amazing dependency resolver that can handle ABIs, binaries and chroots perfectly, provide complete customisation so people can do stupid things like “update everything except glibc”, cure cancer, be adapted to support arbitrary new features with no difficulty and explain all of its decisions in an easy to understand manner. Obviously, doing all of that at once is rather ambitious, so in the interests of it ever being finished, I’ve instead been working on a stupid but incrementally expandable resolver designed around:

  • Doing only the basics initially, but having a simple design that cleanly splits apart things like ID selection, dependency selection and ordering, even if doing so prevents certain short cuts from being taken. That way, when we add things in later, we don’t have to rely upon lots of subtle interactions between all the different components.
  • Making sure that we can explain exactly why we’ve done a particular thing, even if this means not including clever trickery.
  • Having easily accessible innards, meaning if people still insist upon having an “upgrade everything except glibc” option, we can easily move a very small amount of code out into a std::tr1::function and let clients handle it that way without having to pollute the resolver.

The basic features all now pretty much work, and cave resolve is usable on Exherbo (although not Gentoo at present, since I haven’t implemented virtuals handling), although there’s no sensible error handling, several obvious optimisations haven’t been made, the UI is highly crude and there are no bells, whistles or cookies. Still. being able to do this is rather fun:

$ cave resolve gnome --explain libbonoboui:2
[snip]

Explaining requested decisions:

For gnome-platform/libbonoboui:2:
    The following constraints were in action:
      * >=gnome-platform/libbonoboui-2.1.1, use installed if possible, installing to /
        because of dependency >=gnome-platform/libbonoboui-2.1.1 from gnome-desktop/gnome-panel-2.26.3:0::gnome
      * >=gnome-platform/libbonoboui-2.1.1, use installed if possible, installing to /
        because of dependency >=gnome-platform/libbonoboui-2.1.1 from gnome-desktop/gnome-panel-2.26.3:0::gnome
      * >=gnome-platform/libbonoboui-2.13.1:2, use installed if possible, installing to /
        because of dependency >=gnome-platform/libbonoboui-2.13.1:2 from gnome-platform/libgnomeui-2.24.0:2::gnome
      * >=gnome-platform/libbonoboui-2.13.1:2, use installed if possible, installing to /
        because of dependency >=gnome-platform/libbonoboui-2.13.1:2 from gnome-platform/libgnomeui-2.24.0:2::gnome
    The decision made was:
        Use gnome-platform/libbonoboui-2.24.0:2::gnome
        Install to / using repository installed

Now to the important part: the pretty pictures!

Regular visitors to #exherbo may have noticed me moaning that I don’t have enough pens to implement their feature of choice. Here’s why:

Resolver Design 7

Resolver Design 7

Since I can’t keep track of more than around five classes at once in my head, I have to have summaries written out on paper. Furthermore, each class summary has to be in a different colour (although my scanner’s done a fairly good job of hiding that in the picture above…), which means I need a pen (a proper fountain pen, or I can’t write with it) for each class. This in turn means that any new feature will likely require one or more additional pens, and I am more or less at my limit.

I also need a couple of colours spare to be able to scribble all over the diagrams, draw lines, change things and generally make a huge mess of things. An earlier design page now looks like this (and note that this is the most readable of the earlier design pages):

Resolver Design 5

Resolver Design 5

On top of that, any problem too complicated to be solved in my head gets its own highly weird picture drawn out. Unfortunately the only example of this that I have handy (working out a circular dependency breaking algorithm) is on A3 paper, which I can’t easily scan…

I’ve found that working on paper for this kind of thing is much faster than working on a computer (writing’s as fast as typing, but the layout’s much quicker on paper, and scribbling over computerised designs doesn’t work). I don’t use a formal design system at this stage because it’s more pain than it’s worth, especially when there’s no need for other people to be able to read the design without being able to ask questions, although in some ways what I do is close to CRC cards with all the bits I don’t need ripped out.

I do not claim that my system is sane; merely that it works.

Posted in paludis internals Tagged: paludis

Posts for Sunday, September 6, 2009

Looking better.

Just a few small updates today before work. It looks like my updated captcha is stopping all the spam comments, thank god. Today, I focused a little on the backend to make sure categories were working properly. Changing pages on categories still doesn't work, but I haven't started on it yet. I'm sure it'll be done in a few more days.

I'm trying to focus a little more on the aesthetics at this point as well, but I just can't find a way that I like the little login box on the right hand side. What's there at the moment works for me at the moment, but any ideas would be appreciated.

I'm also thinking about writing my own Twitter script to update the Twitter box at the top of my page. After about an hour or so of no updates, the box stops displaying anything. Why? That's stupid.

avatar

How to solve the big Internet problem.

I’ve said it before and I’ll say it again, the Internet is full of trash.

When I say trash, I don’t just refer to websites and data, I mean people. The Internet has a startlingly similar effect to drugs – its addictive and makes people act like idiots. As you’ve probably already guessed from the title, these two are the “big internet problem(s)”.

Addiction is one that is easily fixed and is progressively being fixed. As we integrate technology and the Internet more and more into our daily lives addiction will be disguised as a lifestyle. If you can’t see the problem anymore, you don’t try to solve it. Not because it’s the right or wrong thing to do, it’s because most people are lazy arses (I once misspelt “lazy” as “lady” in a chat conversation, big mistake) and so the tackling the fundamental problem becomes quite futile.

The second is that people start acting like idiots. The reasons for this falls neatly into two categories: 1) they were idiots to begin with, and 2) they interacted too much with real idiots and so acculturated accordingly. Removing the first category kills two birds with one stone, which is what I shall accomplish in my lovely plan which I’ll write about in a bit.

In a bit.

Here’s the plan. You let evolution take its course. You simply remove the Internet. For a year or two. The issue lies with the fact that you can’t punch somebody through a computer screen. Once you remove the Internet, idiots cannot hide behind aliases and are forced to be idiots to real, live people.

These innocent people will be suddenly exposed to a huge influx of stupidity and will involuntarily resort to their instincts – to vent out their frustration in the most effective way possible. The most effective way is also normally proportional to the amount of pain the idiot experiences.

A year or two of this shock treatment should be enough to weed out the majority of this problem. We then put the Internet back up and purge any website that isn’t visited within the first couple of days. The people hosting these websites that get purged which represent more than 30% of the total amount of folks they host will be suspended for manual interrogation.

This one to two year absence of the internet will also remove Internet addiction. It should be ample time for people to redevelop a lifestyle that doesn’t revolve around the constant communication the Internet provides.

We’d also save on a crapload of energy costs for those two years. This has major environmental advantages. We’d also shutdown a good percentage of our industry with labourers with non-transferrable skills, not to mention seriously harm the backbone of many other businesses. However this will also allow us to look with a fresh vision on whatever stupid economic system we’ve got in place today. This is the jolt we all need to start restructuring our societies, not with visionaries spouting their optimism to closed ears but an actual realisable event.

Ok. I promise I’ll do a real post when I’m next due.

Related posts:

  1. Good riddance, Twitter.
  2. Is your ISP causing slow Internet?
  3. Mass-amateurisation of the Internet

Posts for Saturday, September 5, 2009

Improve flash performance (a bit, maybe)


Header

I’ve been struggling with flash quite a bit. I like to watch flash videos online because the time I’m able to get to them are usually at odd times of the day. The issue with flash (I’m using the 64bit alpha but think this effects other versions too) is that higher definition flash can often become choppy, and tear – particularly in fullscreen. I read that this has to do with how flash uses Xvideo. I’ve tried numerous hacks I’ve seen around but none that have worked. Flash 64bit alpha has been around coming on 10 months now so hopefully we’ll see an update soon, but until then I did find something that might improve your flash performance a bit. This I found while going through the Ubuntu forums – (thanks to Labello who figured it out). This is just a simple xorg server edit that may on some systems be already enabled. Flash appears to require a couple options that some xorg.confs may not provide. To give an idea on performance, 1080 flash video before was unwatchable sometimes giving me as low as 1 frame every five seconds and 720 video would tear at times. With the edit, low motion 1080 video (yeah I know) like Law and Order is mostly tolerable and 720 is playing without a problem. To get these benefits (will vary from system to system) be sure that these settings are in your xorg.conf and then restart the xorg server.

Section "Extensions" Option "Composite" "Enable" EndSection Section "DRI" Mode 0666 EndSection

There’s also an edit on the link about overriding gpu checks. I think that this may help a bit, but it could just be my imagination :), not sure.

Assorted C++ Linkage


Posted in Uncategorized Tagged: c++, c++0x, programming

Posts for Friday, September 4, 2009

avatar

why do people program perl these days?


With so many other awesome alternatives, I don’t understand why people use perl.

Just the other day, I was programming in perl (at the day job… as I have written a considerable amount in perl already and haven’t gotten the infrastructure in python yet to switch over).  I noticed how poorly the support is for Windows.  Alright everyone, guess what perl returns from this on Windows:

C:\Documents and Settings\username\> perl
use Cwd;
print “cwd: “.getcwd().”\n”;

Well, if you guessed “C:\Documents and Settings\username\“, you are wrong.  In perl, of course, its actually “C:/Documents and Settings/username/“.  I realize it “happens” to work (as in, some windows versions support it… not perl), but I’m not ok with it “happening” to work.  I need it to work.  I don’t want my code breaking on something so simple as a path separator.  And it really isn’t that hard to support both / and \.  Sure enough though, I can’t trust perl to “do the right thing”.  I end up hacking around everything perl has in its standard library.

Another doozy is when you start using File::Find and find out, it doesn’t work on Windows with no_chdir.  Why? Not sure… And I don’t much care.

I guess, what I’m curious about is, how many people still see a good reason to use perl.  One that doesn’t include “we already have an entire infrastructure coded in perl”.  I understand no one really likes “rewriting” code and that it has a batch of its own problems such as reintroducing regressions and is “needlessly expensive”.  However, I would think those projects go away over time.  New projects should use newer technologies and get the old and new technologies to work together.  And eventually, maybe, phase out the old stuff.  Maybe its not something that someone converts overnight, but at least move in the right direction.

My biggest problem with perl is that its standard library is hard to trust to “do the right thing”.  A language in which this stands true is very hard to program efficiently and effectively in.

avatar

Sabnzbd behind apache

So after upgrading my sabnzbd installation to version 0.4.11, which I by the way the way should create a better ebuild for and do some dependency cleaning but that is a different story.

Like I was saying after upgrading to version 0.4.11 I decided I wanted to close port 8080 (the one sabnzbd is using) to the outside word. Now I know apache has some nice proxy functions so it should be easy.

Make sure apache is compiled with the following modules: apache2_modules_proxy apache2_modules_proxy_http apache2_modules_proxy_balancer

That was the hard part. Now just add a vhost:


ServerName yourserver.com

order deny,allow
deny from all
allow from all
ProxyPass http://localhost:8080/sabnzbd/
ProxyPassReverse http://localhost:8080/sabnzbd/a

ErrorLog /var/log/apache2/error.sabnzb.log
LogLevel warn
CustomLog /var/log/apache2/access.sabnzb.log combined

This assumes that you have sabnzbd listening on localhost:8080. Now you probably do not want the whole world watching your downloads (or deleting them or whatever). So we just add some basic apache authentication, use htpasswd2 to create a file with authorized users and add the following lines into the location block.


AuthName "Login Required"
AuthType Basic
AuthUserFile <>
require valid-user

That is all.
Happy downloading!

Posts for Thursday, September 3, 2009

avatar

The Euphemism Website – the failed idea.

One of the websites I always wanted to make was a Euphemism dictionary. It would be pretty similar to urbandictionary in terms of concept and allow user-defined euphemisms for common insulting phrases. This would thus prevent us racking our brains every single time we wanted to come up with another creative way of saying “my aunt’s maid’s son is better at computers than you“.

It’s also a great initiative to start putting literature to good use rather than the common application of analysing the themes and symbolic imagery behind fictional characters.

Another objective would be to disprove most of the web community do’s and don’ts through the context and artificially induced environment the website will create. For example, users will be insulted constantly, from the minute they enter the website, when they register, log in, or do anything that involves a mouse and a screen. Definitions and euphemisms will have a voting system, except it’s unidirectional – you are only allowed to vote down submissions. I don’t mean this in the rottentomatoes format where more tomatoes means its good, I mean this quite literally. You’re not allowed to say something is good, you say if something is crap, and then we’ll list the least crap and the most crap. Take your pick. User interaction will be minimal – you’re allowed submit and vote, nothing else, users with accounts will be given no option but to receive spam email from an entirely unrelated mailing list, all the time mocking you of your gullibility of registering to such a shady website.

We won’t only break community conventions, we’ll break design conventions too. There will be no clear header or footer. The title will be a randomly rotating insulting phrase (of your choice if you register an account). The content will be single column, left aligned, with a colourscheme worse than my dad’s tie, and a table will be used for everything. One huge table with colspans and rowspans that’ll make the folks in the #css channel choke.

With all that said, it’ll still be better than 95% of the websites on the internet.

Gosh the internet is so full of trash.

Related posts:

  1. How to Make a Website Part 1 – The Environment
  2. Blender Model Repository system upgraded
  3. What is FTP?

Paludis 0.40.0 Released


Paludis 0.40.0 has been released:

  • Notifier callbacks allow clients to tell the user what’s going on when generating metadata, performing resolutions etc.
  • Sets now work slightly differently. For sets defined by multiple repositories (e.g. ’system’), ’setname::repo’ can be used to access the part of the set defined by a given repository.
  • Bugfix: Upgrading an unpackaged package no longer errors out.
  • Bugfix: Combining :slot and ::/path restrictions now works correctly.
Posted in paludis releases Tagged: paludis

dev-lang works… maybe


I updated the one exheres in my dev-lang repository. I still have not purchased the power supply for my Linux computer so I still have not tested my own repository, but if someone else wants to that would be nice! I more or less just copied the it straight from the ebuild in Gentoo (giving proper credit of course). I hope they all work. I’ve been looking around at how to get all of falcon vim config files pulled in together into one exheres.

Moving on to my app-vim exheres; I’ve been looking around and the only method of doing this I can find is to tarball the files then install that. While I’m sure that works wonderfully, that would require more work than I thought it would. While creating an exheres for every config doesn’t sound like a good idea either, it would be easier to keep current. I’d only have to update the script on Vim’s homepage, which I’ll be doing anyway. If I did have one for each file though, then I could simply do a single flacon-vim-config-all.exheres-0 file and let it pull them all in as required deps. That seems very sloppy to me though, and I’m not sure how paludis would handle the deps. Suggestions anyone?

Enjoy the Penguins!

Posts for Tuesday, September 1, 2009

Exherbo Repository


My would be repository, as far as I can tell, has everything it needs now in order for paludis to actually pick up and install things from it. Granted, at this point it only has three exheres in it, and granted, only two of them will work. But none the less it is there and you can use it.

the steveno repo

Again, suggestions, hints, and corrections are welcome.

Enjoy the Penguins!

avatar

Rapid Fire

Some things that didn’t make it into a thinkMoult post. In no particular order. Sometimes posts like these are mandatory.

  • Wipup.org is now functional and running, albeit very unfinished. Our social desktop submission stands at 68% and we welcome you to contribute your vote.
  • Kamal has joined the Eadrax team from the graphics side to replace Chris Peters.
  • I have the privilege of being a beta-tester on Lockerz, a site where you earn points through doing activities and can exchange these for real-life merchandise. It’s legit and looks quite spiffy. Leave a comment if you want me to send you an invite.
  • The first 5 portfolio entries on the carousel have been linked properly to their respective items. Go on, try click them.
  • 10 or so new submissions have been added to the Blender Model Repository.
  • A one-hour speech to a small group of 50-60 people on education and communities.
  • School has started and I finally received my badge for the International Award Silver Level (they forgot to give it last time and I only got the certificate) – hopefully I’ll get my gold before the end of this year.
  • A lovely new set of material to use for portfolio creation after some full time work-experience at an architecture firm.
  • An attempt to cook with my Dad that ended up in spaghetti being burned. Yes, with flames and everything – I didn’t even know that was possible.

… and of course all the usual routine stuff with a hilarious schedule – but then again, you already knew that.

Related posts:

  1. Blender Suzanne Awards announced.
  2. Back from the Jungle
  3. What’s new 18th July 09

Posts for Monday, August 31, 2009

Tools for prototyping

Yesterday I sat in a meeting where we looked at a prototype modelling something that we had come up in an earlier workshop. The prototype is necessary cause it's not obvious whether the model we came up with works (well enough) to be of use to us, we had to check our assumptions basically.

One of the participants put quite a lot of work into the prototype so we could check out results, the prototype kinda integrated with some sort of metamodelling framework in JAVA so the class diagram was a mess (not cause of bad modelling on his part but just cause of all the hoops he had to jump through to get stuff going).

It was one of those moments where you realize something consciously that you always knew but never properly phrased: You need some sort of prototyping tool for your area of expertise or you will waste a lot of time and/or create bad results.

Prototyping is something completely different than "proper" development. Let's look at software as an example: If I write software to try out something the internal design, the architecture isn't all that relevant, I just slap enough code together that I can validate or invalidate my assumptions, not one line more. In prototyping there's no "ugly code", no "wrong" cause they are basically just tests that are gonna be thrown away later anyways. After I have validated my assumptions I then start from scratch and design a "proper" solution, that does things right.

We are lazy and the idea of throwing away code scares many people: "Why would I write something again that already worked? That sounds like twice the work!" is something you might hear from these people. This train of thought is based on the wrong assumptions.

More often than not it's a bad idea to carry the code from your prototype over to the proper implementation. All the corners you cut when prototyping will get expensive code dept in your "proper" design.

Prototyping is about quicklygetting results. That also means that some technologies work better than others: If you design interfaces for your software for example, prototyping on paper is about the fastest and most useful tool you can ever have. Using a GUI-editor to click together interfaces is second and writing real "code" to create a GUI is way last. Paper gets results quickly, it's easy to change stuff, to develop ideas and change details, it's easy to rearrange things. When you want to write prototypical code, don't use something like C++ or JAVA cause you have to deal with too much "administration" and "code bureaucracy" in order to get shit done. Use something dynamic, fast that gives you a bunch of building blocks that you loosely throw together to check whether an idea works. Use Python, Ruby, Prolog, whatever dynamic tool floats your boat and gets stuff done quickly, even if you subscribe to the belief that static typing is somehow a good thing. Actually, especially then.

Thinking back to the wide array of classes on the diagram yesterday I wonder how much more could have been done using a proper prototyping tool for the job. How much easier some quick fixes would have been to check some other idea.

If you develop anything you will have to prototype at some point. If you don't have the proper toolset to do that you will waste your time running in the wrong direction. Look at your own design process. Do you have proper tools to prototype really quickly? If not, find some now. Learn their ins and outs. You'll be thankful when your next project comes.
avatar

Xen Hypervisor Nullmodem Connection

Been playing about with the rebase/master xen git branch again today to see if I can get it to boot my Gentoo xen setup. No luck, still the same panic on boot, so I decided to find out how to capture the output.

Grabbing the output from the kernel is simple: Add “console=tty0 console=ttyS0″ to your kernel command line. Then cat ttyS0 on the other end. For more details, there’s the TDLP Remove Serial Console Howto

Getting the Xen hypervisor to do something similar was slightly trickier. Turns out you have to use minicom, or all you get is a string of control codes. After some help from ##xen on Freenode, I was able to find OpenSuse Wiki: How to capture Xen hypervisor and kernel messages using a serial cable.

I can now get Xen output - however it seems to block the kernel output, so it’s one or the other at the moment. Would be nice if I can find out how to get both (kernel and hypervisor) working at the same time.

Posts for Sunday, August 30, 2009

Apple Trailers Fix


Header

As some of you may have found out or read about, Apple trailer downloads for Linux are currently broken. Apple has implemented a Quicktime user agent check prior to downloading. Personally I agree with the decision because Apple is concerned about the quality of reproduction (though Apple trailers still play with an odd hue on Windows – think this has to do with Quicktime not correctly reading Window’s color setting – but I’m getting off topic). This means that movie players plugins for web browsers (like gecko-mediaplayer and totem) will no longer work. Until gstreamer gets a patch that fix’s this, here’s a script that can download them manually.

#!/bin/bash # atget - download trailers from Apple website # Usage if no parameters given if [ -z $@ ]; then echo "atget apple-trailer-url"; exit fi # Prepend 'h' before resolution to create a valid url newurl=$(echo $@ | sed 's/_\([0-9]*[0-9][0-9][0-9]\)p.mov/_h\1p.mov/g') # Download trailer and save to the desktop wget -U QuickTime/7.6.2 "$newurl" -O $HOME/Desktop/${@##*/} # Play trailer with mplayer (using 200MB cache to be sure trailer is dl'd first) #mplayer -cache 200000 -user-agent 'QuickTime/7.6.2 (qtver=7.6.2;os=Windows NT 5.1Service Pack 3)' $newurl

You can comment wget line and uncomment the mplayer line to directly play the trailer. The mplayer line needs to have a cache to be sure the video is downloaded before it start or errors will occur (200MB should be enough for just about and video on the site). Watching trailers is a fix for me, so hopefully this will help you too.

Credits

Thanks to Ian on stack overflow, who help me figure out how to prepend a regex search.

Falcon and Exherbo updates


Thanks to this guy, you can now learn about setting up Vim for use with the falcon programming language on Falcon’s site. Which I must admit I broke the first day I had access too. I’m back to that “feeling like a tool” comment I made a couple of posts ago. I created a separate filetype plugin and detection script for vim. So now vim will properly detect and use falcon source code. The filetype.vim code I have is correct, and works, but using the separate files works better. You can naturally find them all on my github site in their respective directories. If you would rather download them from vim’s website, they are here.

I have not created exheres for these new files yet. No real reason why not at this point. I would like to create a single exheres to setup all the vim scripts needed to use falcon. But, looking at the examples on Exherbo’s git repository, I have not setup mine correctly. I assume there is a way around it, I just haven’t found it yet. Speaking of which the dev-lang exheres, while in much better shape now, still doesn’t do anything. Any suggestions on any of this would be much appreciated.

Enjoy the Penguins!

avatar

Good riddance, Twitter.

Twitter has successfully put the “Twit” in “Twitter”. Some people realised that I apparently vanished off the face of the Earth on Twitter. I realised that I used Twitter in a way that was better served through other methods. I followed people/groups in order to keep up with tech news, and mainly “tweeted” in order to alert others of new updates on my various projects.

The first is obviously a crappy function duplication of the RSS aggregator – except for lazy people. The people that I were following that weren’t simply news corporations were, quite frankly, idiots. Well, idiots on Twitter.

No. I don’t want to hear about the weather, no matter how you choose to describe it. I don’t care for parrots who simply re-tweet everything. I especially don’t want to hear about your depressing thoughts described in the most enigmatic and bullshit words possible.

What I do like however is people who can readily distinguish between reality and their own little fantasy world and know which of those other people like to know about. Once that distinction is made I’d like further categorisation for time-wasters and useful information. Sad to say that I didn’t really see anything in the “useful information” column outside news companies – who reported real people doing real things that made real impacts.

As interesting as technology might be, the Internet is the nine-years consecutive winner of the “stupid content” award. If you don’t believe me, take a look at this blog post, which lists the most popular alphabetically listed search terms on Google after “I like to”, including my all-time favourites “I like to tape my thumbs to my hands to see what it would be like to be a dinosaur” and “I like to think of Jesus as a mischievous badger“. So-called Social Networks like Twitter are propagating this nonsense and it stands to reason that my Tweets were being read by similar idiots. Or not read at all.

Suffice to say that my account was better off being nonexistent. I wish to disassociate myself from this crowd and remain close to my ideals.

Related posts:

  1. Twit-to-who?
  2. The end is nigh!
  3. Blender Suzanne Awards announced.

Kontact/KMail/KOrganizer <-> Thunderbird/Sunbird conversion

As I'm (again) without my own laptop, I depend (again) on PortableApps.

This means that I use Thunderbird and Sunbird (or rather the Lightning plugin for Thunderbird) to cover my PIM needs. The question now is does anyone know if it's possible (and how) to:

  • import Thunderbird's sentbox to KMail
  • import Thunderbird's inbox; although I can just POP the inbox from the server itself, but having it marked that it's already read, replied to and/or important would be nice without having to do it again in KMail
  • sync Sunbird's/Lightning's calendars and tasks with KOrganizer's (importing KOrganizer's iCal files into Lightning failed already for me)

So, dear lazyweb, if anyone has any tips on how to do that, I'll be glad if you'd share.

hook out >> studying and listening to the latest hip-hop album on BlocSonic
<!--break-->

Posts for Saturday, August 29, 2009

Looking for KDE minions

As the title says I'm looking for a few people to help maintain the KDE packages in Exherbo.

I'm looking for people who's going to actively work on resolving bugs and problems as well make sure we have all the latest packages versions in the KDE repository. Part of the work requires working closely with KDE upstream as you'll be filing bugs and patches upstream as well as applying upstream patches to our packages. We try to stay as close as possible to upstream and I don't expect too many problems from this work.

Standard Exherbo benefits includes:
- The  very cute Exherbo mascot (yes, even as a frequent contributer you can use Zebrapig any way you like as long as you respect the Creative Commons Attribution Share Alike 3.0 license)
- Verbal abuse from Ingmar Vanhassel and myself every time you screw something up
- Your 15 minutes of fame spend on a relatively small open source project

and finally

- You get to pick your own theme song as long as you keep it yourself

So stop being so lazy and step up to this monumental task now :)

Oh, you also get a few other minor things of course..
- Get to hang around some very cool and friendly guys (collectively known as the Exherbo contributors)
- Learn way more about packaging problems in Linux distributions than you ever wanted to
- Move up the hierarchy of open source developers due to your contributions, often helped by other Exherbo contributors

Please contact kloeri (myself) or Ingmar in the #exherbo-kde channel if you're interested in helping and we'll figure out how to get you involved in the KDE/Exherbo work.
avatar

Sibelius, Finale, Cakewalk? Real men use Lilypond.

Some of the old-timers on this site might recognise the title’s startling similarity to the introductory article I wrote about LaTeX. I received some questions on how I created the music sheet in the previous post about my upcoming composition, Evan, and the answer is: with Lilypond.

As you’ve probably guessed already, Lilypond is a markup language, just like LaTeX. You don’t use a graphical user interface to insert your notes, rests, and whatnot, but instead just code it into a plain text file and convert it to a, let’s say PDF format when you’re ready to view it.

lily-1f1cc0c4

Music scores are complex. Much, much more complex than your word documents. You might have a good deal of fun formatting wizardry going around with LaTeX, but with music, you have notes, you have staffs, bars, stems, different symbols, different types of annotations, clusters, rests, expression markings, decoration (stuff like trills etc), and don’t even get me started on modern music. A score of a modern music piece is probably a piece of art in itself, my stemless notes, dotted barlines and lack of a time signature in my previous post being nothing compared to what’s out there. All of this has to be pieced together in a readable format, whilst still giving the composer flexibility to modify the score to put whatever they wants.

If anybody here has used the famous notation softwares out there such as Sibelius or Finale, it’s quick and easy to learn but a pain when you get to decently complex scores. You also quickly realise that the stuff you produce on there definitely looks nothing professional and mediocre at best. If you consider creating a score, for, let’s say an orchestral piece, you’d not want to continue using these traditional programs.

2009-08-26-232355_1280x800_scrot

Take for example that score above. It’s of decent complexity and created using lilypond. Attempt something like that in other programs and you’d fail horribly.

Lilypond is like LaTeX. You tell it what your score will contain, and Lilypond will work out the best way to format it. That’s the best thing - it ensures readability, something vital in any score and a real pain to do manually. Here is a simple example, as a picture speaks a thousand words:

2009-08-26-232958_1280x800_scrot

Lilypond is flexible. It allows you to notate very modern pieces with weird artifacts such as, in my own piece missing stems. Of course you may even have missing notes, or even stems that branch out or waving lines to symbolise a direction. (please, don’t just add these for the fun of it, you need to know why and when they should be used and more importantly how to use them)

2009-08-26-234829_1280x800_scrot

It’s also fast. Don’t believe me if you want to, but I would honestly say that creating a score in Lilypond is faster than other software (well, LaTeX in my opinion is also faster than Word Processors). Not only can you chunk in notes as fast as you can possibly type them (and you get used to how to input notes very quickly), you can also use variables. If you have a repeating section of a piece, you can just assign it to a variable, just like in math you can say x = 5, and whenever you want to use that section, or in math, the number 5, you just dump the variable and it does it all automatically.

One other feature some might consider a plus point is that it can output the score in midi format. My personal view is that midi should be marked illegal and anybody who uses it be sent straight to prison, because it sounds like crap and effectively slaughters the beauty of the piece, but – well, it does it anyway if you tell it to.

flat-design

It’s hard to fully appreciate the capabilities that Lilypond provides but I’d like to stress one: readability. Lilypond takes this very seriously. Just as music has evolved through the ages so has scorewriting, and Lilypond really adds that professional feel to whatever score you produce. If you create scores, I would recommend it.

All well and good, but how do I start using Lilypond?

Just like LaTeX it doesn’t matter if you’re on Windows, Mac or Linux. Lilypond works cross-platform and doesn’t charge a buck. First you’d want to hop over to their website, and proceed to the download page. Their website looks as though somebody ate the stylesheet, but nevertheless I can assure you that the program definitely has style. You’d then want to start reading the documentation.

You’d want to read that documentation carefully and ensure you understand what’s going on especially if you’re new to markup languages. Go through step by step – it contains many cross-links but I would recommend just doing it in the order it presents itself in. I cannot say the first score you ever produce with Lilypond will be up and running within 5 minutes, but you’ll get used to it, and when you do, you’ll be really glad you did.

Note (no pun intended): the images were shamelessly ripped off various parts of their site, but all with good promotional intention.

Related posts:

  1. Word Processing? Real Men use LaTeX!
  2. Composition in progress: Evan
  3. A little introduction to MP3s

Posts for Friday, August 28, 2009

PulseAudio Foray

I’ve taken then plunge: I just installed PulseAudio (PA) and related tools (on Gentoo). A lot of users are vehemently anti, stating numerous complications and bugs, but its potential advantages for networked audio are attractive.

Evidently KMix is supposed to support PA, but it still only shows the alsa devices. I suspect this is related to when PA is loaded, and currently I do not have any user-space loader. What’s the optimal way for this to happen in KDE? An autostart entry? Symlinking some mysterious file to kde’s env directory? All the forum posts are for older KDE versions. Phonon works so far though. All the PA apps are GTK/GConf based, and aren’t very KDE friendly, and generally it seems like KDE has neglected PA support, or PA has neglected KDE support. They simply aren’t very pretty together. What are the plans for integrating KDE and PA a little bit more closely?

I’m using a Macbook as a print server, printing to it from my Linux box, and everything is simple because they both use CUPS. However, I’m having a bit of trouble streaming audio to it. I can’t seem to build PA on OSX, and I don’t even think OSX is officially supported by PA. I tried installing ESD using MacPorts and using PA’s bridge for that, but it played a half a second of sound before skipping. ESD doesn’t do good latency calculations. PA supports streaming to Airport Express, so I thought I’d try out Airfoil Speakers, but unfortunately, Airfoil uses a different protocol. So I’m not sure what to do now… How do I send PA to my Macbook?

PA also doesn’t work well with Skype, and I anticipate some other problems as well. What a hassle. Why the bad integration with KDE? Why the numerous bugs? Any PA tips from veteran readers?

avatar

how to use encrypted loop files with a gpg passphrase in Debian

Fast howto (mostly a note for personal use) on what’s needed on Debian to use an encrypted loop:

1. The necessary utilities (patched losetup)
# aptitude install loop-aes-utils
2. The necessary kernel-module
# aptitude install loop-aes-modules-2.6.30-1-686-bigmem
3. Create the keyfile (keep your computer as busy as possible while doing this to increase entropy)
# head -c 2925 /dev/urandom | uuencode -m - | head -n 66 | tail -n 65| gpg --symmetric -a >/path/to/keyfile.gpg
4. Loopfile creation (10Mb)
# dd if=/dev/urandom of=/my-encrypted-loop.aes bs=1k count=10000
5. Initialize loopfile
# losetup -K /path/to/keyfile.gpg -e AES256 /dev/loop5 /home/username/crypto-loop.img
6. Format loopfile
# mke2fs /dev/loop5
7. Delete loop device
# losetup -d /dev/loop5
8. Create mount point for loopfile
# mkdir /mnt/crypto-loop
9. Add entry to fstab

/home/username/crypto-loop.img /mnt/crypt-loop ext2 defaults,noauto,user,loop=/dev/loop7,encryption=AES256,gpgkey=/path/to/keyfile.gpg 0 0

10. Try mounting the loopfile as user
$ mount /mnt/crypto-loop
11. Check it’s mounted properly
$ mount | grep -i aes

and use it!

P.S. Secure your keyfile.gpg, if it gets lost you won’t _ever_ be able to decrypt what was inside crypto-loop.img!

Planet Larry is not officially affiliated with Gentoo Linux. Original artwork and logos copyright Gentoo Foundation. Yadda, yadda, yadda.