Friday, July 31, 2009

Computer pranks

This is beautiful.



When I was a kid (10 years old or so), I came across a program called LOVEDOS.



LOVEDOS gave every impression of being the normal DOS shell, except that the directories shown by "dir" clearly weren't your own, the files clearly weren't your own—And the computer was coming on to you, in various subtle and not-so-subtle ways. The only way to exit the program was to type "I love you" at c:>



I put it in my step-dad's autoexec.bat.

Monday, July 27, 2009

Gender Neutral

Coworker: haha

Coworker: oh man

Coworker: want to bet that exhibitors at comic con, starting next year, are going to have a hard time getting "booth babes"?

Coworker: http://arstechnica.com/gaming/news/2009/07/ea-puts-sexual-bounty-on-the-heads-of-its-own-booth-babes.ars

Me: In other news, NPR has been reporting over the weekend that there are very few women gamers, that this leads to fewer women in the video game development field, which leads to fewer games targeted for women.

Me: I'm not kidding.

Coworker: and they are right.

Coworker: want to borrow my copy of a book on gender neutral game design?

Me: The hilarity of the timing is why I brought it up...

Me: Is that the one where they neuter the game? :P





At that point, coworker tried to shoot me with his Nerf gun, but it misfired.

Handful

A A, You're a handful.

B No, you're a handful.

C You guys would both be handfuls for Rock Biter.

A, B Huh? What's a rock biter?

D: I'm torn between dismay that the Nothing is not at my disposal and pleasure that I might have just seen it eat itself.

A, B, C: Huh?

Sunday, July 26, 2009

Wanted: S/PDIF decoder.

I like my receiver, but it only decodes Dolby Pro Logic. My PS3 outputs stereo audio to the TV, which bounces it back as stereo audio to the receiver. This is insufficient, and the lag is noticable in anything synced to music.

The PS3 can be configured to output to S/PDIF in one of two modes: decoded to linear PCM, or "bitsream", which I take to mean a raw dump of whatever audio codec is on the disc being played.

I need something simple that takes optical S/PDIF in and outputs line-level 5.1. Please advise where I can find such a thing...

On syntax highlighting and artificial intelligence

So on Rosetta Code, we use GeSHi for syntax highlighting. The relationship between Rosetta Code, GeSHi, a programming language and the code written in that language is fairly simple. (The exact order of events inside GeSHi might be slightly different; I haven't delved deeply into its core)



Rosetta Code (by way of a MediaWiki parser extension) gives GeSHi a few pointers about how it wants the code formatted, the language the code sample will be in, and, finally, the code sample itself.



GeSHi takes the code example, and loads the language file named after the language in question. Each language file defines a PHP associative array that contains(among a couple other things) simple rules for how GeSHi can apply formatting to the code in a way that will clarify it to the viewer. These rules include lists of known keywords of various classifications, symbols used for normal commenting conventions and optional regex matching rules for each, among other things.



It's a perfectly reasonable, fairly static approach that allows syntax highlighting to cover a broad variety of languages without knowing how to parse that language's actual syntax, and so avoiding having a syntax error break the whole process.



Unfortunately, it requires Rosetta Code to be able to tell GeSHi what language a code sample is written in. It also leads to odd scenarios where a supported language and an unsupported language are so closely related that examples written for the unsupported language can be comfortably highlighted using the the rules for the supported language.



And I have yet to learn of a good way to do syntax highlighting for Forth. (The Forth developers appear to pretty much keep to their own community, and don't seem to do much in the way of outreach, which makes finding a solution relatively difficult, but I digress...)



So what does this have to do with artificial intelligence? Well, in identifying a language without being told what it is, of course!



A few solutions have been discussed. One approach that has been attempted had something to do with Markov Chains. The code is in the GeSHi repos, and I haven't looked at it.



One solution I suggested was to run the code example through all the supported languages (Yes, I know, that's expensive. Not something to be done in real time.), and select the ruleset based on how many rules(X) were matched for a language and how much of the code sample was identified(Y). Using a simple heuristic of (a*X)/(b*Y), you can account for a number of matched rules while hopefully accounting for an overly-greedy regex rule.



How can we take this a step farther? How about formatting languages we don't know about?



Well, many, many languages have rules in common. Common keywords, common code block identifiers, common symbols for comments, common symbols for quotation, etc. This tends to result from their being derived or inspired in some way by another language. For the sake of avoiding pedantry, I'll just say that C, C++, Perl, Python, PHP, Pascal and Java all have a few common ancestors.



One way would be to note the best N language matches, take an intersection of their common rules, and apply that intersection as its own ruleset. This would certainly work for many of the variants of BASIC out there, as well as specialized variants of common languages like C and low-level ISAs.

Localnet attempt

At some point in the next few weeks, I'm going to take one of my ASUS WL-330gEs and set it up as an AP without an Internet Connection. I'll use WPA2 encryption to keep the wireless communications encrypted (even client-client communications pass through the AP first, and are protected by a pairwise cypher), make the key evident in the SSID, and have all DNS requests resolve to a box I'll be running a web server on with a greeting page, an explanation, and phpBB.

I'm curious to see what happens; There are a couple tech-savvy neighbors around here, including one I suspect is running a honeypot. I'm wondering if I might be able to spawn a by-wireless neighborhood BBS.

I broached the idea of a localnet to grlug once before, but I emphasized its potential as a wireless mesh cloud with gated for-pay access to the open Internet. There are a number of problems with using a mesh for any latency-sensitive activities, so many folks would be disappointed when they find that not all Internet connections are created equal.

So I'm going to drop the Internet from the equation, and focus on community-centric services like a bulletin board and, maybe, a local email and XMPP server.

Let's see if they notice...

Saturday, July 25, 2009

Otaku

We are Otaku.

We are Virulent.

We are Everywhere.

We have subsumed your Role.

We are assuming your Throne.

We will consume your Home.

You cannot Run.

You may not Offer.

You will Wilt.

Now.

Friday, July 24, 2009

Let's see if I can keep this straight.

Ctrl-A c ... Creates a new session in screen.
Ctrl-K Ctrl-c ... Comments (or uncomments) a block of code in Visual Studio.

I'm starting to understand why the greybeards out there swap their CAPSLOCK and Ctrl keys, but Lord help me if I try to learn Emacs. :P

Saturday, July 18, 2009

Well, this is neat

I've got a working Gentoo system. I feel like I've gotten the hang of Portage, the USE system, logging and configuration.

Is it faster than other Linux distros? I couldn't tell you; I didn't arrange for any meaningful benchmarks. Not that there is such a thing.

Is it faster than my other box? Well, sure, but it has 2.5x the bogomips and 4x the RAM.

And all that compiling? Well, I can rebuild my entire OS overnight, so that doesn't even really get in my way.

Why Gentoo? I got sick of running an OS that with every upgrade, and where those In The Know reinstalled the new version rather than upgrade. And I'm not talking about Windows. Also, I have a processor (AMD Phenom X4 9650) that has a ton of features that aren't being used by most distributions--even 64-bit ones--that I wanted to see what it felt like to take advantage of them.

No, I wouldn't recommend it to most people. Heck, I don't know if I know anyone I'd recommend it to in the Linux world, just because it requires a significant amount of low-level knowledge to get working. Sure, there's a nice tutorial to walk you through chroot, mounting proc and friends, configuring your kernel and installing grub--but if you don't know what you're doing, screwing up in that installation phase is easy to do and difficult to recover from. And the first couple times you start X and discover it ignoring keyboard and mouse input are sure to be interesting. (hint: configure portage to log out those elog notices and then read them.)

Thursday, July 16, 2009

On shouting...

00:18 < XAVIER> how am i shouting my name ?
00:18 < XAVIER> oh

Wednesday, July 15, 2009

On low-profile subwoofers

I finally noticed earlier this week that the placement of my subwoofer leads the vast majority of its sound energy to wind up outside the livingroom and instead be in the kitchen and dining room. (Which kinda explains a few things, but anyway...)

There are only two other places I could put the subwoofer in that room, but both places put it so close to an outside wall that I'd worry about bothering the neighbors. (Yeah, yeah, I know, you risk that with subwoofers. That doesn't mean I won't take precautions...)

Ideally, you want a subwoofer in the center of the room, so that the sound gets spread fairly equally among the people listening, but that position is taken by a very large rug and a low wooden table.

It occurred to me that what I really wanted was a low-profile subwoofer. Preferably something disguised as a rug, or even a floor.

The first option that came to mind was attaching a weight to a solenoid, and the whole thing to the center of the foor of the room from underneath. Much like those turn-your-window-into-a-tweeter devices you can find on ThinkGeek, I'd then have turned my floor into a subwoofer.

The second option that came to mind was to take one of those powerful magnets I'm so fond of, ditch the solenoid, and use the magnet itself as the free weight with a high-power voice coil vibrating it. For that approach, I'd probably use one of these, and put on a good additional mass of plain old steel to protect the magnet and give it some actual heft. Suspending the magnet+steel mass is left as an exercise for the mechanically inclined. (Hint: A simple spring or elastic band would probably be enough; It's the voice coil that actually moves the floor.)

The third option that came to mind doesn't use any permanent magnets. Instead, you take two voice coils, and power them such that they're like polarized on a signal high and opposite-polarized (or less-like polarized, depending on if there are any external stresses on the system) on a signal low.

Take that a step farther and give each each coil a core such as silicon steel to concentrate the field lines, and your cores will attract and repel each other.

Now you've got a nice, giant degausser in your living room; You're losing concentration of your field liines, and they're spreading out. Need to add some shielding, some material to pretty much complete the magnetic circuit. Instead of wrapping around your discs for your metal cores, cut a wire route groove somewhere within the disc. If you sandwich the two discs together, they should look like one disc. Now, of course, you'll need to drill holes in each disc to let your coil feeds in. At this point, it's worth mentioning you've created a good old-fashioned toroidal transformer, except you're powering both windings.

You'll want some sort of tough, spongy material in between the two halves, to keep them from banging together. And then something decorative so that it can be walked on. I'd be careful about setting things on it; They might start walking around like a wine glass on magic fingers.

Of course, now you've got to power the coils.

Tuesday, July 14, 2009

To Forever be a Learner

To forever be a learner
But think of other ways
To always look for knowledge
And never look away
The past may be what raised us
The future's on the way

Monday, July 13, 2009

Using the legal system as a central message passing daemon: The next step in supercomputing?

It's just hilarious...

My observations on the ASUS WL-520GU

The Wireless:


I have to think that when someone at ASUS submitted a design proposal for this device, what they had in mind was what a wireless router would do if it were designed by Tim Taylor, and then trimmed it back so that it'd be legal.

To start with, here are a couple paragraphs taken from its quicksetup guide:

"This device and its antenna(s) must not be co-located or operating in conjunction with any other antenna or transmitter."

"To maintain compliance with FCC's RF exposure guidelines, this equipment should be installed and operated with minimum distance 20cm between the radiator and your body. Use on[ly] the supplied antenna."

Don't panic, the wifi transceiver in your laptop isn't going to sterilize you.

I stopped by #hamradio on Freenode to discuss it, and wound up looking up the FCC ID on the FCC's website.[1] I pulled a copy of the correspondance regarding the RF exposure, to figure out what's going on.

First, according to that correspondance, the maximum safe exposure limit for RF in the 2.4GHz range for uncontrolled exposure (i.e. consumer setup) is 1mW/cm^2. Taking the inverse square law backward 20cm, that tells me that the antenna is radiating at 4000mW, or 4W.

Taking this back to #hamradio, it was explained to me that 4W is the maximum legal[2] ERP[3] for a one-to-many link[4] on the 2.4GHz unlicensed band. The prohibition on using a different antenna is so that the consumer doesn't replace it with an antenna that has a higher gain than the one that came with the router.

The RF exposure documentation in the correspondance between the engineers in Taiwan and the FCC also contains the design and specs of the antenna, which indicate the antenna is omnidirectional and has a gain of 1.9dBm. If the consumer uses an antenna with a gain higher than that, they risk going over that 4W ERP limit, which in turn brings us back to that 20cm safe distance warning.

4W is more than enough, though; My laptop used to be able to pick up seven or so wireless networks from the neighborhood sitting right here in the house. Now I can only see me, most of the time. I imagine it's possible to see me from Ottawa county.

[1] If you're curious, the FCC ID is MSQWL520GUGC.

[2] Possibly only so for unlicensed user; A licensed ham gets more privileges, but there are additional

strings attached. Unlicensed equipment and configurations are targeted for the least-common-denominator.

[3] Effective Radiating Power; Essentially how much energy you'll see coming out of an antenna.

[4] This is something of an odd requirement that I may not understand properly. The assumption, apparently, is that if you're going to have a higher effective power output, you're only going to use it for point-to-point links. There's also a rule saying you should only put out as much power as needed for the application, but that would seem to leave things a little loose, still.

The Wired

The WL-520GU has four 10/100 LAN ports built in, as well as a WAN port presumably for attaching to your DSL or cable modem. Fine for access from a wired device to a wireless, or from a wired device to the Internet by way of today's broadband, but it's not going to grant impressive degrees of performance going from one wired device to another. If you have need of high-speed data transfer from two wired devices, it's probably best to chain the WL-520GU with a gigabit switch, and accept that you'll be stuck sharing a 100Mb pipe between wired-to-Internet and wired-to-wireless connections.

The Firmware

This is the part that Tim Taylor overlooked. The firmware has a great array of features, even going so far as to provide an AJAX-augmented web interface that gives you a live overview of your network in your browser, complete with problem analysis and diagnosis.

But they missed some of the more basic points of having functional software. So far, I've hit three nasty bugs.

The first bug I encountered was related to the first configuration option I changed: I turned off the wireless radio until I had everything configured the way I wanted it. I got everything configured, and then I turned the radio back on. When I turned the radio back on, the firmware lost all of the configuration settings I'd put in, defaulting to a completely open (no WEP, no WPA, no nuthin') 802.11bg network with an SSID of "default" and a broadcast power of 4W[1]. Not fun.

The second bug (well, there are two here) I encountered was in the configuration of the router's IP address. At first, I accidentally told it to change the IP address outside of the network's IP range and netmask. It kindly warned me that I was being stupid, so I clicked Cancel. And it kindly went ahead and applied the changes anyway. The second half of the bug was when I got in for another go, and discovered that it wasn't possible to set them at the same time; The interface lost the configuration as soon as you switched to the other property page; You had to click Apply in order to save the changes. At which point you were hosed. It's this second half of the bug that may well have caused me to discover the first half.

The third bug was the most nefarious, and cost me several hours and a second call to Comcast tech support. When you click Apply? It applies changes to its configurations, and implies it's going to reboot, shows a pretty "progress meter", and so on. When you click Reboot? Well, it tells you it's going to reboot, has the browser show a pretty "progress meter" of the percentage of the bootup, and then lets you go on and do your thing. Or try to; The router never really reboots, and you can see that by watching the lights on its front. That, in turn, helped confuse Comcast's modem[3], which in turn made things difficult for me.

[1] I add this for a bit of perspective. There's no configuration option for controlling the radio power output, but for about twenty minutes[2], I had a completely open wireless network visible to much of the suburb.

[2] It took me that long to make the connection between "I'm not able to attach to my network" and "wait...default...that's ME?!" I assumed I'd screwed up a setting on my laptop, or that it was looking for the old router's MAC address, or something along those lines.

[3] Whose firmware is pretty shoddy in itself. There's a reason they tell you to power off the router and modem, bring up the modem, and then bring up the router. I used to think Comcast was logging MAC addresses and hostnames, but that was apparently based on a coincidence of "try this theory and see if it works" and "it works!" combined with poor process control. At this point, I think the modem simply drops any DHCP packets once there's a lease in place, until the lease expires. But I'm definitely not interested in poking it to test this.

The Conclusion

I'm not going to make any conclusions. I've drawn up all my observations and the like above. Look them over and figure it out if it works for you. For my purposes, it Works For Now. But I'm back in the position where I don't even want to breath on the configuration for fear of spending horrendous amounts of time getting the connection to the Internet working again.

In my opinion, the WL-330gE was a much more solid product. I used one as my home router for over a year and a half, and liked it enough to buy a second. I won't be buying a second WL-520gE. If this guy dies, I'll probably buy a wired-only router, and use one of the WL-330gEs as an access point to the wired network.

Caveat Emptor.

But what about (custom firmware)

I don't feel like messing with it. Might solve problems, but I really don't feel like messing with it. There's even a firmware community built around the WL-500 series. But I really don't feel like messing with it.

Sunday, July 12, 2009

A quick poem about Lisards.

So someone on IRC by the name of "lisard" was having difficulty with their internet connection, and their IRC client was using "lisard2" and "lisard3" as alternate names when the IRC server hadn't yet decided that the original lisard was no longer connected.



And this burst out of my head and onto the channel...



Three little lisards sitting in a channel
All in a row, and none wearing flannel.
One in the morning
Two to-day
Three in the evening
Four on the way

Saturday, July 11, 2009

Finally got around to using sshfs

So I finally got around to using sshfs.

It's a heck of a lot nicer to use than sftp.

For giggles, mount a system's log directory, and run tail -f on syslog or some such.

Wednesday, July 8, 2009

Tell me the Why and Why Not

I often have questions, and they're often very detailed.



I don't just want the answer to the question.

I don't just want the answer to the question you think I should be asking.



I want the answer to the question, the answer to the question you think I should be asking, why you think I should be looking for your answer, and why you think I shouldn't be looking for the answer to the question I asked.



You see, I realize I don't know everything, and I know I will never know the best way to do things. However, I am perfectly willing to read any and every piece of reference material I can get my hands on if it will lead me to understand the why and the why not of the choices that I need to make. With the understanding of the underlying reasons, I can apply that understanding inductively to other problems with superficially similar structure. I can learn more not just about how the thing it self is alike and different from something else, but I can learn more about how its structure and basis for existence is alike and different from that of something else.



Understanding where things stand is one thing, understanding why things stand is another, but taking those and getting things closer to where they can be is everything.

Tuesday, July 7, 2009

Sentinel States and Irritable Iteration

I'm getting real annoyed with return value contracts like "returns a typed value if possible, or a T object" and "returns an array of U objects, or FALSE on failure." That's not what dynamic typing is for! I'll check for a failure code in the object. Just give me a return value I can iterate through!

Sunday, July 5, 2009

My 4th

I did catch a few shots of the 4th of July...

Thursday, July 2, 2009

A quickie about Bernard Madoff

There are three sides to punitive (as opposed to reformative) justice:

1. Protection of society from the convicted -- Appropriate to a point; Nothing stops him from running another illegal scam so long as he has communication with people with the power to do such things. However, that's only true if his communications are monitored, or if he's put in solitary. It's also only true up until he dies; 100 year plus sentence for a guy already near that old?

2. Dissuasion of others to enact similar crimes. (I don't think punishment has much, if any, dissuasive impact on people who would be likely to commit the crime. Even primarily fear-controlled societies still have an underground where people risk their lives to do things that would seem trivial in other places. People who think that legal punishment has significant dissuasive impact are living in their own little world...)

3. Revenge...And I think that's mostly what this is about. Whenever you hear someone saying that so-and-so deserves such-and-such a punishment, it's about revenge.

Top ten photos on my Flickr account

Curiously, they all seem to be from AWA14.