Archive for the ‘Computers’ Category

bend, drip, mythvideo

Tuesday, September 2nd, 2008

Here’s something I haven’t written about in a long time — bend, my custom written CLI PHP5 scripts to rip and encode TV shows.

I actually rewrote the entire thing over Labor Day weekend.  What’s amazing is it took so long to write the original one, but so short a time to completely revamp it.  It’s something I’ve been wanting to do for a long time, and I’m glad I finally got to it.  The code on the old one was so horrible, and was such a frustrating experience to patch, debug or add features.  The new one is already 20 times better.

The first one was just plagued by scope creep, though — I started off just mostly coding it around the way that I thought DVDs *should* work and how they ought to be authored, only to be constantly slapped in the face by so many exceptions that I’d have to go back and hack it to work around the new found realities.

One example is that either lsdvd or libdvdread is buggy in how it outputs chapter information.  Actually, my whole experience with chapters have been that if there are any oddities, then the players will just freak out.  You wouldn’t believe the cases I ran into.  Anyway, here’s a small example.  On one DVD, lsdvd will report in original output that one track has 30 chapters on it.  But when you go to display the chapters, it will only say that there are two.  Most of the time, what happens, is that it will choke anytime there is a chapter between others that is zero length.  In this case, lsdvd just chokes and stops counting them.  MPlayer (at least, the ancient version I’m using) will do a couple of things depending on its mood — sometimes freeze, sometimes skip over it, sometimes act like its not even there.  It’s very odd.  I’ve found a lot of interesting little bugs in the dvd libraries and tools.  I’d love to poke and the source and fix them up … when I have time.

The code is online in my svn repo, and the new one is called ‘drip’ for dvd ripper.  Original, I know, but eventually it will replace bend completely once I add in all the features the old one had plus all the new stuff I want.  I would throw in a link to trac which has prettier display output for viewing SVN files, but my installation is broken (again) and I have no idea why, and it’s always a royal pain trying to figure out what went wrong, so I’ll just fix it later.  I love trac, but its not easy debugging the setup.

Oh yah, also I’ve been working on my mythvideo setup, tweaking it even more.  One really thing that dawned on me, which I’ll write in more detail once I actually have a script ready, is that you can use it to execute shell scripts using the File Types admin menu.  Just tell it to execute .sh files in your folders with /bin/bash and away you can go.

Another thing I learned is that MythVideo will only pass two variables to any external scripts, the default player (%d) and the video file (%s), or more accurately, the file you’ve selected to run.  So if you wanted to see what you’re executing, you would add this to the file type for .sh files: /bin/bash %s %s

Then, say you had test.sh, this would be the contents:

#!/bin/bash

echo $a

I’m getting ahead of myself, though .. I’ll write more about that when I’ve got something to show.  I’m actually working on a shell script similar to mplayer-resume to resume playback of a playlist you’re in.  It’s a bit trickier than I thought it would (or rather, not nearly as simple as I had hoped), so I’m still scoping it out in my head.

Speaking of mplayer-resume, I fixed a bug I kept running into with it for a while now.  The script will now catch the exit code of mplayer, and if it’s not successful (zero), then it won’t overwrite or delete the old position.  I used to hit it all the time because I used to run mplayer -hardframedrop when playing my videos, which would crash the playback about 10% of the time and of course kill the file that had the playback position.  I need to repackage it and push it live, but there’s a few more small fixes I want to make to it first … I might finish the playlist resume script first and add it to there.  Plus I want to get trac working, because that’s where it’s homepage is.

But, I moved my mini-itx to the living room and hooked it up to my HDTV.  It was sitting in my bedroom just collecting dust, and I figured I might as well move it to see if it gets any more usage.  Actually, I remember now, I moved it was because the LED lights were really bright in my bedroom at night, and I have to sleep in total darkness to get a good night’s rest.   Anyway, it’s worked out well so far.  My TV has a VGA port so it’s super simple to plug it in, not to mention I like the fact that it doesn’t use up an HDMI port.  I love my TV. :)  Once I have this series playlist resume script finished, I think I’ll be pretty much “done” with having the setup that I’ve wanted so long.  Well, aside from the fact that I need about 12 more terabytes of harddrive space.

Good times, I tell you what.  I’m gonna go watch some Star Trek TNG.

mplayer + dvdnav + dvdread svn ebuilds

Friday, August 15th, 2008

I updated the mplayer and dvdnav ebuilds in my small overlay, and added one for dvdread now, which has been split into a separate package.  I haven’t had time in the past while to keep an eye on what’s been going on, but I do know that the heavy flurry of development has stopped, and that the installer works better.  Plus, the software works fine for me. :)

My overlay isn’t in layman right now, so if you want to check it out, here’s the skinny:

svn co http://overlays.gentoo.org/svn/dev/beandog/

Have fun and lemme know if there’s any problems.

quick and dirty opendns howto for gentoo (using openrc)

Thursday, August 7th, 2008

If, like me, you don’t trust your ISP’s nameservers to be patched and working correctly (or for them to sell you out to advertisers by redirecting broken links or whatever), then here’s a quick solution to setting up your box to use OpenDNS servers instead.

Using this assumes three things though:

  • You don’t have anything in /etc/conf.d/net
  • You are a DHCP client
  • You are using sys-apps/openrc

Anything besides that, you’ll just have to figure it out yourself, though the commands should be close.  BTW, someone correct me if I’m wrong.

Add this to /etc/conf.d/net:

dhcp_eth0=”nodns”
dns_servers_eth0=”208.67.222.222 208.67.220.220″

If eth0 is not your primary NIC, then you’d have to change that.

Then just restart net.eth0 (/etc/init.d/net.eth0 restart) and  you should see this in /etc/resolv.conf:

nameserver 208.67.222.222
nameserver 208.67.220.220

postgres and mysql comparison paper

Wednesday, August 6th, 2008

I’ve been job hunting, and while my dream job would be somewhere that uses PostgreSQL, I am having an extremely hard time finding anyone that uses it. So, I think my chances might be better actually getting a company to convert to using it instead. In doing that, I’ve started outlining a draft of a paper that I can present to both lead programmers, database administrators, and management on the pros of using PostgreSQL over MySQL. If anyone has some ideas that I could add in, I would appreciate it.

Here’s the general principles I already plan on covering: foreign key support, data types, transactions, shell interface, ANSI SQL support, table types, general features, history, licensing, abstraction layers (using PHP).

Also, and I don’t mean to sound like I’m spreading FUD, but it occurred to me this morning that I’ve never heard anyone say that MySQL is better than PostgreSQL.

Anyway, ideas welcome. I’ll post my progress as I get the paper put together. This is something I’ve been meaning to do for a long time.

finally rebuilding

Thursday, July 24th, 2008

I’ve put this off for a long time, but I’m finally rebuilding my desktop from scratch. Actually, my one at work, too. Today is a state holiday here in Utah, and it’s great taking a day off in the middle of the week. I honestly have no idea what time it even is right now.

Anyway, at home my box is a dual-core AMD Athlon64 something or other. I’ve stopped building boxes a while ago after realizing that while it may be only around $300 to get started, it ends up costing another $400 for all the stuff I really wanna get on there, like a decent video card and quiet power supply, so this has been my box for a while. In fact, I’m running the exact same motherboard in my media server as well. It’s actually really nice knowing that I can swap hardware between the two boxes in a pinch (which has already happened) without worrying about the specs.

This box has been doing great, and I really don’t use it for much more than just surfing the web, writing email and of course Gentoo development. I’ve had problems on and off with XFCE and X. Exiting out would kill all input, and I could never figure out the cause. It wouldn’t matter which video driver or video card I used, so I just worked around it — I’d switch to the shell if I wanted to kill X, instead of just logging out, etc. But, one thing I sorely miss is using tuxonice, so today I finally decided to take the plunge and scratch it all.

It has been a long time coming, too. I can’t even remember the last time I installed the system on here. Generally speaking, I usually reinstall anyway just to clear out cruft and what not about every 18 months or so. It’s also a good way to keep me on my toes with new installs — my biggest problem is *still* forgetting to change my root password from a fresh stage3 install.

I’ve gotten pretty far, as I’m writing this in Seamonkey right now, and I started this morning. I’ve already been going through the list of stuff I had installed and it’s amazing how many applications I try out and then completely forget about. I’m actually excited to try out the new jobs and resume options in portage, see how that changes things around.

Actually, the thing that kicked off the reinstall at home was that I finally broke down and decided to do my one at work, first. The box is also a dual-core 64-bit machine, but it’s an Intel Pentium D. Now, for some reason, I have *never* had much luck with any of the Intel boxes. I always have some stupid problem where they just end up unresponsive for some reason that I’ve never had on the AMD boxes. I’ve never been able to pin it down, and so I’ve been methodically getting rid of any Intel-based boxes I have around.

This one at work is particularly painful though, though it’s mostly my fault. It’s only got 512 megs of RAM in there which is the obvious bottleneck in today’s modern desktop scenario — especially for a Linux workstation like mine where running a dozen applications all at once is the norm. At first I tried to resist doing anything about it so I changed my CFLAGS to -Os to save on memory (which I probably should have done in the first place), and while that helped, everything of course slowed down by a huge magnitude. Still, at least I wasn’t having jerkiness — it just took everything twice as long to load and save.

I finally broke down this week and shelled out $50 to buy 2 gigs of RAM for the machine. I haven’t been watching computer prices at all recently, so I was quite surprised by how cheap it was. In fact, I’m tempted to put more in my box at home. I’m sure that’ll fix things up alright. In the meantime, it’s reinstalling right now, chugging along, and seeming to do fine. I think I needed my head cleared of all the crap more than that box did, really. Sometimes, even though we technically don’t need to reinstall, it’s just a good mental relief knowing that you’ve done everything you can to make things run better. That’s a hard belief to argue against.

One thing I also did on my box at home is I finally switched over to ~amd64. I’m running unstable, which may not seem that big of a deal, but my policy over the last six years or so of using Gentoo, on my desktop at least, was to use the stable tree. Slowly, though, one by one, on all my other boxes, I’d switch them over to unstable and just run that tree, and I found that more often than not, it runs just fine without a hitch. I first switched over with my myth box, when I realized that my package.keywords file was longer than my arm — if there was one thing I always wanted the very latest bleeding edge code of, it was all the bugfixes and improvements for the multimedia software. The myth box is an obvious choice, and even then, you get it to a working point and then just leave it alone for an eternity. Those last two sentences just contradicted each other, I realize, but anyway, the point was — well, I forget.

Ooh, this –jobs option is pretty cool. Good work, Zack. :) Gentoo rocks, what more can I say.  After all this time, I’m still a fan.

mplayer and transcode fixes

Thursday, July 17th, 2008

Since things are finally starting to settle down (hey, I’ve had Internet for a week now, cool), I’ve started getting back to poking at stuff, slowly. Today I cleaned up some mplayer and transcode stuff in the portage tree, and I just thought I’d mention what’s new.

First of all, mplayer. The latest revision is 1.0_rc2_p27120. The snapshot itself is about a month old, and I don’t know of anything particularly major that’s in there (I haven’t had time to follow development for the past month anyway). It’s been masked for testing, not because upstream has done anything funky, but because there are some new use flags, which have helped me to go back and clean up some stuff that I should have done a long time ago. I haven’t heard a peep from anyone on bugzilla so either no one’s tried it, or it works great.

The big changes that I can think of off the top of my head are this: first of all, there’s an ewarn added if you enable the cpudetection flag. It finally dawned on me that this one might not make sense. Here’s what it *doesn’t* do — magically make the build detect and build for your CPU architecture. The build system already automatically detects and installs with the correct instruction set by default, using stuff like MMX, SSE, and friends. The only reason (that I can think of) that you would use that, is if you were deploying the binary package on another computer, since it is a runtime feature, not a buildtime one. So, you’ll get a little warning if you enable it, because, in general, desktop users don’t need it. I also fixed the use.local.desc to be a bit more specific as well.

Secondly, there’s a new use flag: custom-cpuopts which should finally solve the long-standing dance of trying to outwit users who always break their system but still allow real tweakers to do exactly what they want. Here’s how it works. MPlayer’s build system, again, by default, will automatically detect the CPU optimizations that are supportd for your platform (MMX, SSE, again, etc.). That means that, again, if you leave everything by default — it should work fine.

Originally the problem we would have is that people would have their CPU optimization use flags turned off (like mmx), which would normally break the build. The ebuild is written to only disable them if they are turned off, so my solution for a long time was to tell people to just turn them all on and let MPlayer *not* disable them, therefore, revert back to autodetection. This would then cause problems, though, for those few who were building MPlayer for some other box, and they wanted specific CPU opts on or off. This use flag will fix just that.

What custom-cpuopts will do, when enabled, is forcibly enable or disable the actual CPU optimization use flags you set. This will help out those on certain profiles and setups who need to tweak their build for whatever reason. For normal desktop users, you don’t need to enable it — if it’s turned off, the ebuild will completely ignore the other use flags (for CPU optimizations) and just use the default checks … which work great. It also means that your build will be optimized the best it can, yay!

I know I really went into depth on that one, but it’s been an issue with the build and users for a long time and I’m glad I finally got a cleaner solution working. Now everyone has the options to do whatever they want, but by default, everything should build and be optimized wonderfully.

Oh yes, one last thing — if someone wants to fix bug 228799, and submit a patch upstream, I’d be extremely grateful. That would clean up the LINGUAS hack in our ebuild, which I’ve heard breaks on paludis anyway.

As far as transcode — I’ve been out of the loop, and the media-video team has been taking things over and cleaning up (I don’t even know who, sorry guys, haven’t taken the time to look into that either — I know loki_val fixed up some imagemagick / ffmpeg dep crap that I didn’t want to touch, thanks man!). 1.0.5 is back in the tree, and should be the next stable candidate. I also added another rc for 1.0.6, and I have to add the 1.10 beta sometime.

That’s about it for now. Have fun. Go break your box. :)

charlie the unicorn ringtone

Thursday, June 12th, 2008

Okay, this is great. This morning at work we were talking about YouTube videos, and then cell phone ringtones, and we got the awesome idea — let’s make some ringtones from YouTube videos! Sweet!

So I downloaded the incomparable video Charlie the Unicorn, used audacity to cut out the Candy Mountain song, and then uploaded it to my cell phone with Bluetooth using my co-worker’s Mac. Freaking right on.

It’s a mecca of love, the candy cave!

Okay, so if you wanna know the technical details, here’s specifically what I did:

Download the youtube video using youtube-dl:

$ youtube-dl -b -t “http://youtube.com/watch?v=Q5im0Ssyyus”

Extract the audio to WAV format using MPlayer:

$ mplayer charlie_the_unicorn-Q5im0Ssyyus.mp4 -ao pcm:file=candy_mountain.wav

Edit the WAV file with Audacity, select the song portion, and export it to MP3 with a64 kbps bitrate. The start point was 2:26 and it’s 42 seconds in length

$ audacity candy_mountain.wav

And that was it! Instant ringtone goodness. :) Here’s the MP3.

larrythecow.org reflux

Tuesday, June 10th, 2008

Something else I’ve been meaning to do for a while, is get the main site up for the larrythecow.org domain since I started hosting stuff there other than planet. Today I got the idea that it might be fun to just have a page of resources of community pages that people are working on. So, that’s what I did.

If I missed anything, just let me know.

Edit: If you are getting redirected to Planet, then clear out your browser’s cache.  I originally had a permanent redirect going there, which should have been temporary to start with.  Whoops.  The old RSS feed links still work though, for everyone who never updated their entries.

importing ebuild dependencies into gpnl

Tuesday, June 3rd, 2008

I’m still working on getting ebuild dependencies into the database so I can query them with GPNL.  Getting the actual deps was easy, and that part I just barely wrapped up tonight.  The hard part is getting a fine-grained look at which dependencies are which.

Right now, I’m not too sure what the SQLite database generated by portage is doing, as far as setting DEPEND and RDEPEND.  It *looks* like it’s dumping all of RDEPEND into DEPEND, which makes sense as far as pulling in which packages to install, but that makes it hard on me to determine what the actual run time deps are — assuming that’s what it’s doing.  The fact is, there’s a number of possibilities (no DEPEND, no RDEPEND, empty DEPEND, empty RDEPEND, packages in both, etc.) that really the best way to determine which is which is to do something I should have done a long time ago, which was to write something that will parse the ebuild files directly for the variables.  Then I could easily see which ones are set, and which ones are included.

The fact is, though, that I wouldn’t have been able to do that until recently anyway, and the first time I tried it was when I first started on the package.  At that time, it was a such a disastrous mess trying to parse them as text files because you have random comments and straying lines and unquoted variables that it was just too much of a hassle to deal with.  Now that I’ve got regular expressions setup to figure out the difficult stuff like breaking down atoms into every version component and finding the package name from any atom, it should be much simpler to handle.

Until then, though, at least I’ve got dependencies, so I can add support to GPNL real soon now so we can dynamically query which packages at least depend on others.

In setting up the system, I’ve run into some interesting scenarios as well, as is usually the case.  I’m always thrown a few curve balls that I never would have expected and they either turn out to be QA issues or gentoo culture that I never could have accounted for.  One of them I hit this time was that I kept having ebuilds with dependencies for packages that were no longer in the tree.  At first I was confused, as it seemed like an obvious QA bug, but then looking at it closer, (almost) all of them are blockers — that is, don’t include this package in RDEPEND or DEPEND.  It leads to an interesting question like, how long should that be in there once the package is removed from the tree?  Who knows.  It’s fine to leave them in, I guess, but still, it’s interesting to run into stuff like that.

There’s still a lot more work to do, besides breaking down the actual RDEPEND and DEPEND variables more closely.  One thing I didn’t realize until tonight is that included in the variable is all the dependencies of the eclasses.  So if you have an ebuild using the kde eclass, then the ebuild will also have a dep for system packages like make and libtool.  I need to find a way to clean those out as well, obviously.

Fun stuff.  I hope to have an additional section soon for GPNL on the ebuild page that will display the dependencies, and in turn a possibility to display them in reverse.

planet larry: maintenance cleanup

Friday, May 30th, 2008

I’m still getting overdue stuff taking care of, this time in Planet Larry. I’ve finally cleaned up the scripts and the configs to make it much, much simpler to debug and run the update process. Not only that, now it runs about 15 times faster (under one minute, actually).

Something interesting I realized the other day is that Universe gets about 5% of the traffic that Planet does. As a result, I changed it from updating twice an hour to once every 2 hours. Planet, on the other hand, I changed it from twice an hour to every fifteen minutes, and I might make it update even more frequently than that.

Anyway, all that’s changed is a bunch of boring backend stuff, which was some much needed cleanup that I’ve been putting off for a very, very long time. The fact that planet has been a maintenance nightmare is what has mostly kept me from dragging my feet on getting anything done, but now that that headache is gone, I feel hugely relieved.

There’s still more stuff to do, but I think I’m over the worst of it. What I’d like most is to work on next is getting the actual frontend cleaned up, and get a new design. That’s not really my thing, so if someone can help out, that’d be much appreciated.