Tag Archives: silt

Reflection on Reflections from Damaged Life

Final Serenity

A newspaper obituary for a businessman once contained the words: “The breadth of his conscience vied with the kindness of his heart.” The blunder committed by the bereaved in the elevated language reserved for such purposes, the inadvertent admission that the kind-hearted deceased had lacked a conscience, expedites the funeral procession by the shortest route to the land of truth. If a man of of advanced years is praised for his exceptional serenity, his life can be assumed to comprise a succession of infamies. He has rid himself of the habit of getting excited. Breadth of conscience is passed off as magnanimity, all-forgiving because all-too-understanding. The quid pro quo between one’s own guilt and that of others, is resolved in favor of whoever has come off best. After so long a life one quite loses the capacity to distinguish who has done what harm to whom. In the abstract conception of universal wrong, all concrete responsibility vanishes. The blackguard presents himself as a victim of injustice: if only you knew, young man, what life is like. But those conspicuous midway through life by an exceptional kindness are usually drawing advances on such serenity. He who is not malign does not live serenely but with a peculiarly chaste hardness and intolerance. Lacking appropriate objects, his love can scarcely express itself except by hatred for the inappropriate, in which admittedly he comes to resemble what he hates. The bourgeois, however, is tolerant. His love of people as they are stems from his hatred of what they might be.

Yes.

Gentoo Love: Intro to Portage Sets

A few quick gentoo tips before we get to the instructional material.

  1. Emerge world as often as you can. Once a week is probably a good frequency.
  2. Unless you’ve got a rock solid track record emerging world, don’t do it when you are really tired.
  3. In the best interest of the above, and your sanity, minimize the number of tilde keywords you have unmasked. I got all adventurous with one of my servers some years ago and there’s no good exit strategy. Sometimes it’s a pride point, other times, just pain.
  4. Don’t unmerge zlib. Just don’t, even if you are planning to put it right back. Pretty much nothing can run without it. Not portage, and not make, so you can’t get it back really. If you did, just copy libz.so (and symlinks) from another machine (probably of the same architecture).
  5. Also, don’t run eclean. It will break a lot of ebuilds and can’t even do that particularly well.

Getting setsy with portage

One of the main disadvantages of portage is the generally poor grouping of related packages. There are:

  • Package Categories (media-libs, dev-python, etc.) – These are pretty great, except when a package’s category changes and some ebuilds don’t pick up on that change. There is some way for portage people to redirect old ebuilds to new packages, but it has failed me more than once. Also, package categories don’t speak much to dependencies (not that they should). Portage/ebuild people decide on these, though the project maintainers might have some say.
  • Meta Packages (kde-meta) – Not many of these, but they seem to mostly be a dependency container. They are fine for installing, if a bit opaque, but they can be terrible for uninstalling. I’ve uninstalled old metas that left their obsolete and orphaned packages strewn about (kde 4.2 stuff). These are made by the project maintainers, I think.
  • “Profiles”(world, system) – Not a great name (maybe the wrong name?), but these aren’t as helpful and commonly used as they should be. Emerging world is definitely useful, but there could be a more granular operation between individual packages and ALL PACKAGES. These are generally automatically constructed for the user, though the user can do some manual editing.
Portage Screenshot

Oh KDE, you slay me.

Enter sets

Sets are basically like profiles, but the user gets a lot more control. They are groups of packages that can be reference like:

emerge --ask --update @my-set

You’ve got to admit that’s nicer than doing something like this.

Now when I said “Enter sets,” I meant… almost. Sets are only available in portage 2.2+. So the first step is to get that. Before that, I want to mention that it is technically still in alpha and a broken portage can make it hard to revert to a working portage. Nevertheless, so far it works fine for me and a lot of others have been using it since early 2009. In /etc/portage/package.unmask, add:

>=sys-apps/portage-2.2.0_alpha8

And in /etc/portage/package.keywords add:

sys-apps/portage ~*

Now, just emerge --ask portage and make sure it’s gonna pull in 2.2.

Your first set

Long story short, the format of the most basic user sets is just like the world file under /var/lib/portage/world. Just make a file with a list of packages, one per line, and put that file under /etc/portage/sets. For example, a set of scripting languages:


dev-lang/nodejs
dev-lang/php
=dev-lang/python-3.1.3
>=dev-lang/ruby-1.8.7_p249-r2
dev-lang/tcl

Now you can refer to that list of package like:

emerge --ask --update --deep @my-scripting-set

It may be prudent to prefix your sets so they don’t conflict with any other packages.

How to really clean up your system

By now you’ve probably seen the light, but I’m going to share one of my favorite uses so far to drive the point home. Say you’ve let your system go for a while, and you’ve accumulated some packages. Maybe you’ve switched from Gnome to KDE or maybe all the way to xmonad; regardless there is cruft to be removed. Here’s how you clean that stuff the Right Way:

  1. Update your gentoolkit and portage
  2. equery for some packages to remove and save the list:

    equery list kde-*/* > ~/kde_installed_packages_12122010

  3. Review the result and format properly. equery gives specific versions by defaults, so we’re just gonna throw ‘=’ in front of every line to make them valid package atoms. We’ll use sed:

    sed ':a;N;$!ba;s/\n/\n=/g' ~/my-kde-set

    You’ll have to manually add one more equal sign for the first line, but that should work.

  4. Review the result and move the file into place:

    mv ~/my-kde-set /etc/portage/sets/

  5. Depclean and unmerge:

    emerge --depclean --ask --verbose @my-kde-set

Ah, so fresh and so clean. You should move the set file out of the /etc/portage/sets directory now.

Conclusion

Sets fill a much-lamented (by me) gap in portage. They add organizational power without removing fine-grained control, without which Gentoo would not be Gentoo. My only concern is
Why did this take so long? Given that this is basically how ‘world’ has always worked and we’re well into version 2, we should have had this ages ago. Also, sets are really not that complex or tailored to package management, I wonder if archlinux or some other distro has solved this better. Of course, I’ve only scratched the surface, and there’s a lot more you can do with sets, it seems. For a good starting point, you can do a search on sets.conf.


P.S. The screenshot above was brought to you by ImageMagick:

import -window root ~/screenshot.png


SILT: Canvas/SVG, jQuery, LESS update

Cover art for my latest mix on boroboro.com. Instead of just photos I'll probably do more stuff like this, as it is fun and enticing.

Whew, a little bit longer than expected between updates, but the reasons for this are soon to be told. First, some things:

  • For my next work project, I’m having to visualize and lay out semi-complex graphs (DAGs, as far as I can discern). I started looking at a Flash-based kit for a similar project in 2008, but these days Canvas-based solutions like the Javascript InfoVis Toolkit are popping up.
    But, as I soon learned, Canvas isn’t really the right tool for this job. the right way to go seems to be SVG, despite iffy browser support. This fantastic article by the Opera browser team has me thinking I’ll use Graphviz+dot+SVG+jQuery. I’m excited and I’ll probably write about it again the future.
  • Speaking of jQuery, I’m learning me all the JavaScript tricks by looking directly at the jQuery source. Nothing like a lean, mean piece of code to teach oneself The Right Way. Reminder: don’t forget to update to jQuery 1.4, which has been a dream so far.
  • LESS is still treating me right; did some rapid development recently, and it worked gloriously. Some observations:
    • One issue I had with LESS recently was getting the mixin syntax working with IE’s filter syntax. The equal signs throw the compiler off. I was doing terrible IE things because I was doing cross-browser pure CSS gradients.
    • I use the LESS –watch option to achieve incron-like effects when dealing with small CSS projects. Unfortunately the –watch option means having to start lessc before doing work (not a big deal) and having to monitor it for when you have errors in your file (it pauses and waits for a return key, kind of a big deal).
    • I just read about less.js, a javascript implentation done by the LESS dudes for on-the-fly, in-browser LESS action, and plenty of new features. Here’s the github page. It’s due the end of this month, but I’m in no hurry.

And if you’ve been missing me, listen to more mixes. Two up since the last Superdrivel edit, a downtempo one and an uptempo one.

SILT: Reverse templates, the pixels, and swig

The Final Frontier

In case you've been wondering where I've been. (space, duh.)

Wow, it has been a while. Sorry for the silent treatment, it’s been a busy time. I’ve been learning lots, so hopefully I’ll process that queue in a blaze of consistency. Bring on the MEAT:

  • Recently I had to do a whole load of data processing. Not a one-time deal, but good old XML processing for API integration. It occurred to me that just as Web 2.0 and its myriad frameworks have brought a new age of templates, it seems that there should be a complementary reverse template. As in, I specify a template, and a string, and I get a map of variables back (as opposed to template+map = string). This would seriously be the most beautiful thing.
    And as it turns out, for once, Perl schools all other languages, because it has it. Template::Extract. If someone made this happen in Python and/or PHP, I would probably engage in an illicit tryst with them.¬†Until then, I have to do xpath-style stuff. Which is fine, I guess, but you’d agree that it’s harder to read and maintain.
  • Back when I started doing serious web frontend stuff last summer, I was pretty sure the pragmatic among us were on the same page: px is the way to go for CSS. Everything pixels. em was a hack for IE6, and we’re done with that now, to the point that I’m even exasperated by dead-horse pages like this.
  • For my next project, which will be depriving y’all of blog posts soon enough, I’m planning on using the crap out of swig. Use it to call C/C++/Objective C from basically any scripting language (in my case Python, again). I’m not yet sure of its advantages with PHP as I use it, because it’s really not hard to write your own C++ PHP extension. If all goes well, I’ll be following up on this.

OK, three is good. I save the rest in drafts as they come, in case you were wondering.

SILT: Fences, Pastebin gone crazy, networking gone mad edition

Augh, I battled some large networking demons today to get a Gentoo box to have multiple MACs and static IPs. Also, it would seem some .NET/Windows developers are only a few years behind my brain.

Fences in play at work

Fences in play at work

  1. Today I got around to installing Fences 1.0. It’s an application to organize your desktop by functionally giving you icon groups. It’s kind of like being able to have multiple folders open in the background. This is all relevant because this is one of the first items on my software-writing to-do list that I tried to implement.
    Actually, it was #2 after writing an online to-do list, like Remember the Milk, except theirs doesn’t integrate with Checklist for the Palm, like I had started to write (I got as far as reverse engineering and writing a parser and minimal editor for Checklist’s binary format. It’s at once freeing and frustrating that 99% of the ideas I come up with will be implemented by someone else, and a good portion of those implementations will be too good for me to challenge. I gave up on Windows desktop development after a summer of .NET gross-out.
    BTW, pretty sure KDE4 has this.
  2. This link summed up how to get multiple IPs in the best way. It’s pretty much a quick primer in using ifconfig to set up your network card in bridging mode. The link specifies ubuntu, but it worked on Gentoo (and should work on all modern distros).
  3. I installed a pastebin over the weekend for internal use at work. I used the tarball made available at pastebin.com. It took quite a bit of modification to get it working the way I wanted to, however. Most importantly when using the "file" storage engine, it actually does not run, dying with an error about follow up posts. The solution is to actually dig through the code and comment out the die() call, then set the $post["followups"] = array(); inside the isset($post["followups"]) if clause. I realize the explanation is kind of hazy, if you actually run into this problem, let me know. In pretty much all othe respects it’s a great piece of software, and the perfect balance of things I was looking for in pastebin.

SILT: Aptana SFTP and symbolic links edition

The van and some wind power

The van and some wind power

Short post today because I’m too tired to think at the moment. Something I learned just now is that Aptana Studio, my web development editor of choice, does not follow symbolic links when you’re syncing through SFTP (ftp over ssh). Furthermore, Dreamhost, my general-purpose host because I got 2 years for 20 bucks, doesn’t support FTPS (ftp with ssl). So Aptana will hang while it tries to connect (and there’s no cancel button). And now I have to use FTP, which is of course insecure. Edit: And FTP doesn’t work either. I will have to think about/research this more later.

And don’t even get me started on Django and WSGI. On the brighter side of things, Dreamhost has git, yay.

SILT: bcrypt, IZZE, and burp edition

Delicious drank

Delicious drank

  • For all password storage, use bcrypt. Don’t use salted md5, definitely don’t use plain text. Also, don’t email users their passwords. The crypt() function in PHP actually has the blowfish algorithm alternative built in for versions >5.3.0, though you may want to set up the system libraries yourself, to allow for updates.
  • I recently invested in some IZZE sparkling juice. It’s pretty much carbonated juice cocktails. There are a few flavors and I’ve tried the Pomegranate, Clementine, and Grapefruit. Cranberry’s cranberry, Clementine is ok, Pomegranate could taste more like pomegranate, but is still good, and Grapefruit is probably the best. Grapefruit’s a little too sweet, so I like to add some tonic water. For drinkers, these would probably be great mixers. I get mine on Amazon, where they go on sale every once in a while for like $15 for 24.
  • Speaking of security and carbonated things, you’ve got to check out Burp Suite. It is an amazing application for security testing web applications. It automatically fuzzes apps. For the click-lazy, fuzzing is just providing wildly invalid data where only a computer could think to put it. As soon as I develop something security-sensitive, ya’ll know I’m buying this.