Archive for the ‘computers’ Category

HTML5 video buffering works better than Flash video buffering

Friday, August 20th, 2010

Support for the HTML5 “buffered” attribute was recently added to Firefox.

As I was playing around with the demo, I noticed that it worked much nicer than any video buffering I’d seen in flash (e.g. youtube). Specifically, if you load a video, and seek around to various points in the stream, flash will lose all buffered data except in a few specific circumstances (specifically, you have buffered a continuous range that includes both the current play position and the requested play position). Firefox with HTML5 video saves all the data it’s downloaded at any point, so you never need to redownload any data, and generally just works.

This is very nice. And if you needed any more encouragement, give up on flash for video, and switch to HTML5.

My desire for a giant, print-quality screen

Thursday, June 4th, 2009

So I got curious today and was wondering how long it’ll be until we have giant, print-quality screens that can be hanging around on walls places and displaying stuff—the new part of course being print quality.

I had heard in the past that the middle range of print quality went from 300 dpi to 600 dpi, with <300 being low quality and >600 being high. However, I looked around while writing this up and found that much of that number has to do with displaying color, and the fact that printers typically work with only 3 colors in fixed sizes (plus black, which is not used in combination). This gives only 8 color values per dot, so they need to use more dots (more dots! Okay stop dots.) per area to get a given color.*

In place of “print quality”, then, I decided I really meant “the unaided eye can’t see pixel boundaries. Now, I have a little bit of experience I can bring to bear here: the OLPC, in monochrome mode, has a DPI of exactly 200. With that, I personally can see pixel boundaries only in small text, when I look very closely. To allow for the possibility of people with better eyes than me, and for proper letter spacing in small text, I’d say 300 dpi would be past the limits of all but a few people. This would be necessary for monochrome, and more than sufficient for color.

Now giant needs to be defined, and what I’m imagining is around 1 meter square (perhaps already too large for a high dpi to matter, but I know I’d be that close to the screen trying to read the book reflected in the mirror in the image taking up only part of the screen).

Assume that at least 85 HZ refresh rate is needed (I know people that can see flicker at 75 on a CRT, other technology such as OLED might make it harder to get annoyed by but still within the eye’s ability to see).

Putting it all together, you get a little under 12000×12000 pixels, and a total pixel clock needed of around 12 billion pixels / second.

Now, I’ve had trouble finding pixel clock numbers on modern graphics cards. The OGP’s upcoming graphics card looks like it’ll be 330MHz. I found a few numbers on older cards at about that range. My guess is that, since there hasn’t been a need for it, even high-end cards are barely above 500. If we say that improvement on this would follow a misstated Moore’s law and double every two years (probably underestimating potential in the early years, but then, they won’t do it anyway because there won’t be enough demand), it’d take about 9 years for a graphics card to be able to handle that many pixels.

If we assume that LCD and plasma can’t get that good a resolution and OLED will be needed (I’m imagining a very thin screen anyway), the question is then “will a screen of that size and resolution be feasible with OLED 9 years from now”. My guess is 9 years from now, if there were enough demand, something like that could be (very expensively) produced.

So, in summary, if enough people wanted it, in about 10 years… in reality, it’ll probably be barely possible to buy in 20.

* Modern printers apparently can have variable amounts of ink per dot, though not as much as monitors vary light

portage with user privileges

Thursday, May 14th, 2009

Today I added FEATURES=”userfetch userpriv usersandbox usersync” to my /etc/make.conf on one of my gentoo boxes. These make portage drop root privileges when doing various parts of its package-managery stuff (and in combination, almost everything it doesn’t need them for). I ran into a small snag where some packages from the X11 overlay that pull the sources straight from git—they’d previously been fetched by portage as root, so the files on the system were owned by root and they couldn’t be updated by the new non-root pull. I fixed that by just deleting the files that were already there and letting them be pulled fresh with the right permissions, and everything worked.

It’s nice to see that, outside some bleeding-edge developer stuff that you can’t even get to without a good knowledge of the OS, this security feature just works. Hopefully it can be enabled by default soon.

Happy Zombie Jesus day!

Sunday, April 12th, 2009

Today is zombie jesus day! So in the spirit of the day, I thought I’d write a little program so your computer too can have a zombie jesus.

File: jesus.c

#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>

int main(int argc, char **argv)
{
    pid_t  pid;

    pid = getpid();
    fork();
    if (pid == getpid()) {
        strncpy(argv[0],"god",strlen(argv[0]));
        sleep(30);
    } else {
    }

    return 0;
}

And then…

$ ./jesus &
$ ps ax | grep jesus
19565 pts/0    Z      0:00 [jesus] <defunct>

Voilà! Your very own zombie jesus! (for 30 seconds)

(See also: http://en.wikipedia.org/wiki/Zombie_process

Computer without a CD/DVD drive?

Friday, December 19th, 2008

I had a thought today and I’d like to see what other people think.

I’ve been thinking about getting a new computer, in the “I won’t have the money for a while, nor will some of the parts I want be available for at least another few years, but I like thinking about it so I might as well plan it out years in advance” sense.

One of the things I’m thinking about is not getting an internal CD/DVD drive. Instead, I’d just get an external drive hooked up with USB or eSATA or whatever. This could provide:

  • Lower power usage—I don’t know how much here, but I suspect it’s some. Also, sometimes I’m too lazy to remove a cd, and then it spins up every once in a while.
  • Faster boot—fewer components to scan means faster. Especially when I leave an audio CD in and the drive has to spin up to see if it can boot from it.
  • Fewer cables inside—easier to work with and improves airflow.
  • Frees up a 5 1/2 inch bay for something else, if I ever need it

The downsides would include it being in the way on my desk or a pain to get out when I need it, and not being able to boot from it (maybe?).

What do people think? Worth it? How often do you use your drive? Anyone have actual numbers on power usage?

Automatic updates

Thursday, October 25th, 2007

This has got to be one of the coolest things I’ve ever seen about Mozilla as a platform.

Software Update - Sunbird

Today I learned (2007-08-25)

Saturday, August 25th, 2007

Today I learned that sort -R (random) will place two (or more) identical lines together in the output, even though the order will change each time it’s run (even with identical input). I wonder how they do this. Maybe they put everything in a hash, but with a random salt?

Getting rid of “Clear scrollback” in Pidgin (changing keybindings in GTK applications)

Wednesday, August 1st, 2007

For some reason, Ctrl+L in Pidgin is “Clear scrollback”, which is something I almost never want to do, whereas Ctrl+L in Firefox is the incredibly useful “Focus location bar”, the type of thing I hit hundreds of times per day. Obviously, this leads to a problem: I clear my pidgin window accidentally over and over again.

Luckily, the answer for how to fix this was in the pidgin FAQ—not this problem in particular, but changing keybindings in general. Just open up gconf-editor (Applications -> System Tools -> Configuration Editor from gnome, or gconf-editor from the command line) and set /desktop/gnome/interface/can_change_accels to true, then hover over the menu item you want to change the keybinding of and type what you want it to change to. I couldn’t figure out how to make it blank that way, but if you type one that already exists, that one gets overwritten, so I just changed “clear scrollback” to ctrl-f (which was Find) and then changed Find back to that and clear scrollback was cleared.

So problem solved. It was pretty darn easy for me, although I wonder how easily other people could have found the solution. In any case, the best solution would be to have it removed for everyone, so I’m going to report it and hope they agree it’s unneeded.

Making Baldur’s Gate II run in a non-admin account on Windows

Saturday, May 26th, 2007

Today I had the fun experience of dealing with Windows, and the also-fun experience of dealing with poorly-written Windows programs.

The reason for this, and the reason I didn’t just say “not my problem” and give up, was that I wanted to play Baldur’s Gate II. Specifically, I wanted to play it multiplayer, and my dad only lets my siblings use his computer under a limited account (the right thing to do), so I had to find a way to make it play. Installing could be done under an admin account, of course, but playing had to be done under a limited.

This is where the poorly-written bit became a problem. You see, Baldur’s Gate II, like about 97% of windows programs, violates the standards of what things go where in windows. This of course was not a surprise to me, just an annoyance. So I was determined to find a way around it.

The first, most obvious problem, was that it needed to write to files in the program files directory (like, e.g., save files. They’re not supposed to go there! They’re supposed to go in the Application Data folder in the user’s account! I’m not even a windows developer user and I know that!), which limited accounts aren’t allowed to do. Easy fix: Change the permissions on all those files to let anyone write to them. Roadblock to the easy fix: XP home doesn’t have the advanced security tab that lets you control the access control lists. Doh. So with about 10 minutes searching online, I finally found out about the cacls command, which can be run from the command line even in home edition. I got the funness of finding out by trial and error that without the /E switch, it will remove the entire list when you do /P, even though it says it’ll “replace the user’s” permissions. Luckily I’d listed them all out before and still had them on screen. Final command for that: cd installdir; cacls "BGII - SoA" /T /E /P Users:F

Then, it still didn’t run. When you started up the game in the limited account, it still, for some reason, thought it needed to be installed. I had thought (from reading support things on the official website) that making baldur.ini writable would fix that, but I was wrong. So: It must be a registry issue. Long story short, because I’m getting tired of writing about Windows: It was. /HKLM/SOFTWARE/Microsoft/Currentversion/App Paths/BG2Main.exe was readable by the limited user, but apparently, no, it needed to be writable as well, because the programmers were stupid and used the wrong registry call. (Thanks to regmon for helping me find that out). Fix: go in as admin, right click on that key, and there’s some properties that let you make it writable by all. Problem fixed, everything works now.

This all is just one of the many reasons I hate windows.

piping standard error

Wednesday, May 16th, 2007

I’ve often wished I could pipe only standard error to a command, leaving standard out to display on the screen as is. One place this would be useful, the one that finally got me to act, is to make compiler warnings show up in a different color, to make them more noticeable.

I decided grep ".*" would work quite well for coloring things, since I have --color=AUTO on by default. The problem, though, was how could I get standard error to go to grep instead of standard out? (I have green text on a black background, and grep turns what it matches red. If I piped standard out to grep ".*", I’d get red text with green errors, and that’s just backwards :P)

The internet wasn’t very helpful. It gave me a bunch of things halfway there, like redirecting standard error to standard out, and even saving standard out as a file and redirecting standard error to standard out and piping that, but I wanted standard error to stay standard error, standard out to stay standard out, and them both displayed on screen like normal, only with stderr having been run through a command.

So, of course, I had to do it myself.

Here’s what I came up with: (command 2>&1 1>&3 | grep ".*" 1>&2) 3>&1

So how’s this work? Well, first stdout (file handle 1) is redirected to file handle 3. Yes, that’s first. Apparently they’re evaluated in backwards order. Took me a while to figure that out. Then stderr (file handle 2) is redirected to stdout (file handle 1). Then it’s piped to grep (or whatever command you want, I could see useful things being done with sed here) and the output sent back to stderr, and then finally file handle 3, the original stdout, is sent back to stdout.

I hope someone finds this useful. I know I will!

What distro to install on my laptop?

Friday, March 23rd, 2007

I recently got a new* laptop that I’d like to put linux on. I already run a gentoo box that I’ve had no problems with, but I’d like to try something different so I can get more experience. Current thoughts include some random other stock distro, some random other stock distro that runs KDE or XFCE, something running SELinux, or trying out OLPC’s Sugar interface (though that would probably be impossible).

Does anyone have any recommendations, from that list or otherwise? Keep in mind this is entirely to be used as a learning experience, so I can put as much work as I need into it. The only criteria is that it should be something I’ll find useful in the future.

* Not new, but new-to-me. Exactly how not new? It has a sticker on it that says “Designed for Windows 95″.

Ogg Flac

Tuesday, November 14th, 2006

Whee! Both mplayer and gstreamer (which rhythmbox uses) both had their ogg flac decoding bugs fixed recently, and it should be fixed in the next release of both. I can finally stop decoding my music to wav before playing it!

Software Freedom Day

Sunday, September 17th, 2006

Today was Software Freedom Day, and while I certainly could have done more to publicize it, I did take it to heart for myself and my computer.

Today I finally uninstalled the last bit of proprietary software I was using, Flash, and am compiling gnash to replace it. This will certainly be a bit of a drop in functionality—there’s a long list of things unimplemented—but it’s worth it to finally have my computer clean. Macromedia/Adobe hadn’t released any version of flash for linux since 7 anyway, so I was already starting to get locked out of sites. I just hope my game site doesn’t accidentally detect it as me cheating—I’ll probably be the first person ever to use it on their site. :P

(I also got rid of a few old (unused) java plugins that were lying around. I still have some games installed that I can’t see the source for; I treat those as media, the same as music, and while I don’t listen to music from companies I don’t like (read: any RIAA member), I don’t restrict myself to only openly licensed music if the money’s going somewhere decent. Feel free to try to convince me that I’m wrong (or right) about that.)

Enabling encryption in vsftpd

Tuesday, September 12th, 2006

For the past few days I’ve been struggling with enabling SSL (actually TLS) encryption in vsftpd. I followed the directions, but every time I try to connect it gives the message

Connected to xx.xx.xx.xx:21
220 (vsFTPd 2.0.4)
USER anonymous

530 Anonymous sessions must use encryption.
Disconnecting from site xx.xx.xx.xx

(Several hours later)

Apparently it’s not a problem with vsftpd. ftp -z ssl xx.xx.xx.xx works fine. It’s just the ftp clients I tried (gFTP and Filezilla) don’t encrypt the connection. For gFTP I found an FAQ entry that says

You must add the public key of your self signed CA to your OpenSSL certs directory.

but I’ve done that, because I had to put it there for vsftpd to use it!

Edit: Firefox apparently doesn’t have support. That’s annoying.

Phew! My babies are safe.

Sunday, September 10th, 2006

From Gentoo’s default /etc/conf.d/rc file:

# Set to "yes" if start-stop-daemon should attempt to kill
# any children left in the system.

RC_KILL_CHILDREN="no"

With settings like that, how can you not use Gentoo?

A good font package approaches…

Thursday, July 27th, 2006

The STIX Fonts have all been made, and just need to be packaged now! Wooo!

emerge chucknorris

Monday, July 17th, 2006
# emerge -Dtau world

These are the packages that would be merged, in reverse order:

Calculating world dependencies... done!
...
[ebuild  N    ]  games-misc/fortune-mod-chucknorris-0.1

Hard drive archival

Tuesday, July 4th, 2006

To anyone using hard drives as an archival system: Will you have an IDE motherboard in 20 years? In 100?

Perfect Sound

Saturday, July 1st, 2006
  • There is a master sound volume. Only root can change this.
  • There is a per-user sound volume. A user can only change her/his own.
  • There is a per-application sound volume. This is what applications change with their sound control. Applications do not change the per-user volume unless they are specifically for that purpose, like alsamixer. A dedicated volume control program can control application volumes, in case the application doesn’t have a control.
  • If an application wants to provide more detailed control over its sound (e.g. a music track and a sfx track) it ??. Mixes them itself, and only sends one track to the OS? Sends both, but after changing their volume, and with the same application name so the per-application control affects both? Exposes both to the OS entirely, and requests separate volume controls for them (which it then affects using its own in-app controls)?

All values are, of course, multiplied before affecting the sound. Values greater than 100% are allowed.

This does not specify how it interacts with the actual speakers (perhaps volume control on the speakers changes the master volume?).

Per-application sound volume?

Sunday, April 2nd, 2006

Does anyone know if/how I can (in Linux, of course) control sound volume per application? So I can, e.g., turn down the sound coming from a flash game in Firefox, but let Rhythmbox play my music at normal volume?