Showing posts with label Computer Stuff. Show all posts
Showing posts with label Computer Stuff. Show all posts

Saturday, 24 October 2009

Thursday, 13 August 2009

Greasemonkey + Facebook

Psst, facebook, I don't want to be friends with random people just because "we both went to UBC", or "we both live in Vancouver". UBC is pretty big, so is Vancouver. I also don't want to become fans of things just because my friends have. So.. bye-bye suggestion box:

Step 1, install greasemonkey: https://addons.mozilla.org/en-US/firefox/addon/748

Step 2, install this greasemonkey script, just detaches the suggestion box from the HTML, making it disappear, the more elegant solution would be if facebook would just not send the HTML in the first place.. but that's asking too much mehtinks: http://slicer.ca/files/facebook_desuckify.user.js

Step 3, enjoy facebook without the stupid suggestion box.

Wednesday, 22 July 2009

Recovering Ubuntu

A few days ago I did something bad.  I did a distro upgrade to bleeding edge Ubuntu (9.10) before release, all for the want of the latest version of libvirt on my antiquated laptop.

I know pre-release software might be rough around the edges, I know things might not work, but I didn't really care, after all these things are usually fixed over time.  However, what I didn't bargin for was that the upgrade process was to totally bjorked that it sent dpkg into an infinite loop unpacking the same packages, over and over again, until I stopped it.

Big mistake, but what else could I do?

Thursday, 25 June 2009

Error message FAIL

I'm trying to get libvirt working, just to play with it.  Here's the error:


libvir: Network Config error : cannot create bridge 'virbr0': Package not installed

Package not installed?  But the bridge utilities are installed.  After much googling, I discovered it's a bridge-utils error message, and here's my translated version:


Ethernet bridging support isn't enabled in the kernel

lrn2writeerrormessages.  kthx.


Tuesday, 16 June 2009

nVidia blocking signal problem fixed

have been experiencing this bug since the 180.35 nVidia drivers were released.  The dreaded blocked signals bug.  The .37 driver was supposed to fix it, and did for many people, but not me.  Neither did .41, .44, .51, or the latest ones, 180.60.  This wasn't a big problem,  I reasoned I'd just wait until it was actually fixed and continue using the 180.29 drivers.  That waiting ended today when I upgraded to kernel 2.6.30 and discovered the .29 drivers don't build against that kernel.  Curses.

Wednesday, 3 June 2009

Profiling PHP Code

I have a PHP script I wrote for my research that takes stupidly long time to run. Why? I don't know.  So on an off chance of finding something useful, I put "PHP profiling" into google.


So it turns out that PHP profiling is a huge topic, there are many websites ready to provide HOWTOs and tutorials for a zillion different techniques.  And, like everything in the computer world it seems, the solution is easy and sifting through all useless advice and "type-this-random-thing-into-your-console" is what takes the time.


Here's what gentoo users need to know:



  1. emerge xdebug

  2. Edit /etc/php/php-cli/ext/xdebug.ini , set xdebug.enable_profiling="1", and I also had to increase my max_nesting_level to "1000".  It took forever to figure this out, ALL the documents say "oh, just put the settings in php.ini.". WRONG.  They get ignored in there.

  3. Install kcachegrind, and use it to load the profile dumps now being written in /tmp/cachegrind*


Done.




Friday, 13 February 2009

Rogers sold my email address

One of the advantages of having my own domain name is that I can give out a different email address to every company that wants my email.  I use a pattern to generate these addresses, they're not one-word somethings that a spambot would guess.


Yesterday, I recieved an email from netmarketingcanada.com with links that point me back to netmarketingcanada.com to unsubscribe and view things.  They're advertising.. 30% off.. something... my email client doesn't load the remote images (also from netmarketingcanada.com) so I can't see the majority of their email, but that's not the point.


The email was TO the email address that Rogers Canada (and only Rogers Canada) has for me.  So, a big thanks Rogers for selling my email address to spammers. I don't remember seeing "will sell your email address to spammers" in their privacy policy, but perhaps it has been updated and someone could point me to that clause?


Wednesday, 11 February 2009

iPhone Bliss

I have three beefs with my iPhone:

  1. I can't use gtkpod or other software to sync my music, because it's running firmware >= 2.0

  2. Disregarding music, I can only sync everything else (contacts, whatnot) in Linux over ssh to a jailbroken iPhone (requires remote mounting via. sshfs), even if the phone is sitting beside, me plugged into a USB port.

  3. 1 and 2 should happen automatically as soon as I plug in to USB, I shoudn't need to drop to a terminal and type stuff.


Happily, there is a solution for all 3.  Here, I'll talk about 1 and 2.

Sunday, 30 March 2008

Bridging Media

I haven't posted anything hackishery in a while, so here we go.. Yesterday I attended Bridging Media, my super sekret invite was secured through a friend of mine, Erica, who happened to be co-running the event. A very successful event. Hats off to Erica and the whole organizing crew! I'd signup for another one in a heartbeat.

Sunday, 3 February 2008

Making Drupal exist in a subdirectory

I have a confession: I am a bit of a neat freak when it comes to my files. Clutter annoys me almost as much as compressed files that extract themselves into the current working directory.
I set out on a quest today, to upgrade Drupal AND to make it happily exist in a subdirectory on my server, BUT, to make it appear that it exists in the root directory.


Actually just that turned out to be easy, Drupal even provides a guide that conveniently assumes you don't have any other content in your directory. I mean, you've got Drupal, why would you want a /photos directory that's not "inside" Drupal? Or a /files directory that Drupal doesn't manage? Stop being silly.


It turns out, though, that what I wanted was also quite easy, but piecing together the bits and cutting the cruft took excessively long.  But that's a typcial computery solution: A simple solution and a long and winding road to find it.


So, let's begin.



  1. Put Drupal in a subdirectory. Mine is called drupal-5.7

  2. Add a .htaccess to the root of the website to rewrite incoming requests to Drupal:
    RewriteEngine on
    RewriteRule ^$ drupal-5.7/index.php [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ drupal-5.7/$1 [L]

    Now, I'm not a .htaccess expert, so I may be slightly wrong in how exactly this works. The first RewriteRule directs the server to redirect all requests for "/" to Drupal's index.php, so drupal is what you see when you just type the base URL. The .htaccess inside the drupal directory can further rewrite this.
    The two rewrite conditions are for the next rule, !-f and !-d mean that only do this next rewrite if the file(or directory) doesn't already exist. I have /photos on my server that I don't want rewritten to /drupal-5.7/photos/
    The final rule simply appends the prefix drupal-5.7/ to the request, and sends it off. Drupal further rewrites this when Tidy URLs are used.

  3. Delete /index.php, we don't want the server to find it.

  4. Make sure you don't already have any existing files/directories that are inside the Drupal install. For example, I already use a /files directory, so does Drupal, so I renamed Drupal's to 'dfiles', and changed the config accordingly (Administration -> File System).


Cake. It all works as far as I can tell.

Sunday, 26 November 2006

JACK Audio with OSS

I have JACK.. and it works, except for 32bit apps, and any app that only has OSS support.. which unfortunately are the 32bit apps. However, I did manage to get OSS working in 64bit mode... an unlimited number of 64bit OSS apps can connect to my JACK server.

First, the way you do it is with a program called oss2jack (http://fort2.xdas.com/~kor/oss2jack/). It works by adding 2 components to the system. One is a kernel module that can create userland character devices on demand. The other is a program that acts as a JACK client, and bridges the userland character devices (/dev/dsp?) with the JACK server.

Unfortunate, life is never simple. And the latest fusd (the userland character device kernel module) doesn't work with the latest 2.6.19 kernels.. So, here is a patch: fusd-kor-1.10-11-linux-2.6.19.patch

JACK Audio

I found myself some free time between research and other work stuff. I played with JACK audio on my AMD64 system (http://www.jackaudio.org). In my opinion there are 3 things that GNU/Linux sux0rs at.. Audio, Printing, and Installing. Each one is a black art. JACK audio is yet another audio server, but it has a twist, it was designed and written to have zero-to-low latency. The server eats up 0.25% of my processor when it's running and I can't detect any latency (unlike some other sound daemons with several K buffers).
Jack shows some promise, it's installing it on an AMD64 system is probably my first mistake, since nothing works on AMD64 right away.. My second mistake is that I have 2 soundcards, and I'd like to use both of them. Problem, the JACK daemon supports one soundcard.. you have to run one daemon for each soundcard. Problem, JACK daemons don't talk to each other.

One of the reasons I took a liking to JACK was what it lets you do with connections. A GUI app like qjackctl (http://qjackctl.sourceforge.net/) can connect and disconnect apps to various sound interfaces while running. I can start playing an MP3, then disconnect the left, right, or both channels from my "sound card". My sound card is just an object that accepts a sound stream. Other objects that accept sound streams are, for example, Audacity (http://audacity.sourceforge.net/) so I can redirect the MP3 into Audacity. The music player is just a sound source, so is the MIC input.. you get the idea. Using this sort of system you can chain applications together, duplicate input or output, and generally be in total control of your sound. /me likes.




But I'm a special user, I have 2 sound cards (a 5.1 dolby system connected to an SB Audigy, and an el-cheapo AC'97 onboard jobbie connected to my headset earphone and mic). It would sure be nice to be able to redirect the output of any app to _either_ sound card, from a single interfece.. or redirect my headset MIC input to my 5.1 speakers (well, that's not very common, but I succeeded!, read on.)

I run Gentoo, JACK installed out of the box (emerge jack-audio-connection-kit). qjackctl also installed out of the box (emerge qjackctl). Fire up the GUI, set the driver to ALSA (JACK uses ALSA to actually talk to the sound hardware, it doesn't re-implement all the individual sound card drivers, that would be silly). Set my device to hw:1,0 (second sound card, the 5.1 system). And start the daemon. Recompile the various apps to use JACK.. and presto, sound works. Now, I actually followed the realtime guide too, so I could have the server running in realtime mode. I like my sound to be skip free, even when under load.

So what, when does the fun start? Well, I have spent many hours searching for a solution to use multiple sound cards. Everything I have read says the "best" solution is to combine multiple sound cards into one virtual card with 4 channels, instead of 2, and just use one JACK daemon. That's great, except first of all I couldn't get it to work, second, I don't want one big virtual sound cards, I have a 5.1 system and a headset, I want 2 separate cards.

I know I can run 2 JACK daemons, one for each card.. so, all I really need is a bridge. Something that registers itself as a client in both daemons, and just shunts sound back and forth. So I can do all the sound redirection in a single qjackctl window... and so I don't have to tell individual apps which JACK daemon to connect to, they all connect to the same one.
And here is my first crack at it: jack_bridge.c

There is a "master" daemon, and the "slave" daemon. The bridge connects to the slave JACK daemon, and just steals all MIC input, and forwards anything it gets to the speaker output. The bridge also connects to the master daemon, but doesn't do any stealing of signals, it just gives itself a name (I use "Headset" as the client name). In the qjackctl that is talking to the "master" daemon, I can create a connection between any app and "Headset", and the bridge accepts data from the master JACK daemon, and writes it to the slave JACK daemon.. which forwards it to the speakers which is actually the headset. Same for the MIC, only backwards.

It's not perfect, there is an audible ticking sound.. I don't think i'm transporting the data "real-time" enough.. sounds like it's playing just slightly too fast, creating a momentary break in the audio where there is no data.. no idea how to fix that yet :( .. but it works. :)

Monday, 31 July 2006

SCO+ELF = video!

Alrighty, I just read the latest SCO+ELF on groklaw.. Great site, thanks PJ. Here is the article:
http://www.groklaw.net/article.php?story=20060731122623203

For fun, I made a video of me downloading binutils and checking out the license. It's about 20megs, completely unprocessed.
http://www.slicer.ca/files/sco-binutils.mpeg

xvidcap is a neat little tool. Just remember to set your output file to "something.mpeg", instead of "file-%d.xwd". xvidcap can write directly to an mpeg stream, no need to write separate images.