Forgot your password?
typodupeerror
User Journal

Journal: Circular dependencies in three languages 1

Journal by Sloppy

Here are six files for ya, showing a problem in 3 different scripting languages. What will they do?
--------- test1.php:
<?php
require 'test2.php';

define('SOMECONSTANT','hello world');

function foo() {
                return SOMECONSTANT;
}

echo foo(); echo "\n";

--------- test2.php:
<?php
require_once 'test1.php';

echo foo(); echo "\n";
--------- test1.py:
#!/usr/bin/python
import test2

SOMECONSTANT='hello world'

def foo():
                return SOMECONSTANT

print foo()
--------- test2.py:
#!/usr/bin/python
import test1

print test1.foo()
--------- test1.rb:
#!/usr/bin/ruby
require 'test2.rb'

SOMECONSTANT='hello world'

def foo
                SOMECONSTANT
end

puts foo()
--------- test2.rb:
#!/usr/bin/ruby
require 'test1.rb'

puts foo()
---------
Ok, scriptfiends, predict the output of these three commands:
php -q -f test1.php
python test1.py
ruby test1.rb

and then do some pasting and try it out. Match your predictions?

The PHP one bit me pretty hard today.

User Journal

Journal: One Too Many 2

Journal by Sloppy

I have a password written on a post-it note underneath my keyboard. Decades went by without this ever having happened, but now I have one of these. [rationalize]And I'm keeping the post-it, because it'll probably be months or years before I ever need that password again, so there's just no chance I'll be able to remember it (it's actually a pretty well-made password).[/rationalize] OTOH, I suppose I could just throw it away and then the next time I need it, ask someone for it again. [truth]But no, it amuses me that I've entered the ranks of people with passwords on post-its at their desks, so I'm keeping it, for that reason if nothing else.[/truth]

Television

Journal: multicast video: someone's finally doing it 1

Journal by Sloppy

I've long advocated that the future of video delivery should either be multicast, or old-school protocols like HTTP combined with caching at the ISP. (Why all ISPs don't run transparent Squids, I still don't understand.) Bittorrent just isn't the right way to do it.

Thanks to Freedom To Tinker I've just learned that someone is using multicast to deliver TV.

Except it's not available in my area, and still requires propriety DVRs/STBs, which I assume means that it probably uses DRM and therefore has massive interoperability problems.

But it's a start. I hadn't heard of anyone actually doing it, before now.

Programming

Journal: I can't believe this happened. I miss .. Pascal?! 1

Journal by Sloppy

I was writing a function in PHP4 and it kept getting bigger. It could use some splitting up for readability/testing/debugging purposes, although it didn't really need that to work. But then I realized I needed to reuse some sections of code, and since I hate duplicating code, those parts needed to be pulled out into their own functions.

But they needed access to the working set of local variables of the big function. Oh great.. do I pass all those vars by reference, making the argument list really long? Do I move all those variables into a struct (well, an associative array) and pass that?

These are, like, Programming 101 issues. Experienced programmers don't normally have to think about this stuff, because the right thing to do is just .. obvious.

Then I remembered that Pascal has the unusual (and rarely(*) needed) feature of nested procedures, where the sub-procedures can directly access the outer scope's local variables. It dawned on me: that would be incredibly convenient (and readable) in this case.

I wussed out and put everything into a class. It's not really oop (all this class does, is return a result) but that looked like the best way to deal, except now I have an ugly this-> in front of everything.

(*) I haven't programmed in Pascal (or anything like it) in over 20 years. Never really missed that feature until today.

Security

Journal: The ad business REALLY sucks 2

Journal by Sloppy

It's bad enough when you're actually serving the data from your own site but it's in some form where you can't audit it. That's one of the many reasons I hate Flash.

But even Javascript sucks, when you <script src="someothersite">. The moment you do that, you know that all sorts of horrible things can go wrong. You just have to have faith. Faith is what it comes down to. And it can be justified, I guess, because you can get away with it for years.

Until this morning when our webpage was only showing for a second and then the whole thing would then redirect to someone else's site. Adios, visitors.

(What actually happened: the domain we were including from, apparently expired and now any http request goes to a Network Solutions page, instead of returning a DNS error like it should. Fuck you, Network Solutions, as if we didn't already know you're evil and dangerous. But the same risk remains even if someone's domain doesn't expire; they can always serve a different script today than they did yesterday, and that script can do anything with the DOM that it wants to. There's no way to sandbox it.)

It's "standard practices" to include external scripts. Everyone does it. The ad people aren't techies; if I were to tell them, "uh, we don't want to include any external scripts that might change from load-to-load, and we also don't want to include any Flash crap unless we've compiled it from readable, auditable source ourselves," they would think I'm crazy. You know, one of those open source fanatics. They would say, "Gee, that's a shame you don't want the money," and go on sending the same dangerous ads to our competitors while we collect nothing.

Is it really an unreasonable weirdo religious fanatic position, to just want to be able to make sure that stuff will work and not do anything crazy? I don't think so. The fucking "standard practices" need to change, but how can one person do that? *sigh* I feel so powerless.

Encryption

Journal: The Mom Test 2

Journal by Sloppy

Out of the blue, I got an email from my mom. She's been corresponding with someone about some sensitive things, and asked how to encrypt her emails.

My writeup is 9 paragraphs long. *sigh* There's so way she's really going to be able to do all that without me eventually going over there.

This is on Mac OS X. Sheesh. A Unix that doesn't come with gpg out-of-the-box, and the preloaded mailer (mail.app) needs a hard-to-maintain 3rd-party hack just to get basic functionality: you call this "just works?"

I don't wanna turn this into a specifically-Apple flame (I know of another high-marketshare desktop OS maker that also makes some pretty shitty apps), so I'll just make this generic comment: mail encryption is a very fundamental thing and it's ridiculous for it to not be built into all desktops. That's like a web browser that can't talk https. The howto I sent to my mom should have been about key exchange issues, not installing plugins. It's a disgrace for any mailer to not have this. This kind of shit is half the reason crypto goes unused by so many people. It's a pain in the ass not just because of the complex concepts (e.g. learning how to exchange keys safely) but because the most highly-deployed apps don't even work as-is.

Programming

Journal: Remember when.. 1

Journal by Sloppy

..a character was a byte, and you always knew what that byte meant, and you didn't have to worry about what database library the script interpreter was compiled against, and in turn what character sets the database library was compiled with support for? Remember when what you saw on the screen was the same as the underlying data?

How I long for those days. *sigh*

Spam

Journal: Go Go Greylisting! 2

Journal by Sloppy
Wow, postgrey just got rid of 99% of my spam, before it gets to spamassassin, and with no false positives (any standards-compliant mailers can get through it). I should have done this ages ago.
Unix

Journal: I hate Unix schedulers 9

Journal by Sloppy

One of the things that annoyed the hell out of me when I made the "big switch" around 2000-2002 from AmigaOS to Linux, is the dynamic scheduling. I'm pretty sure I've bitched in my /. journal about this before, but I'm too lazy to go back and look.

Hey, when I "nice" a time-consuming process, I fucking expect it to not slow my computer down, no matter how CPU-intense it is. That's how it was on AmigaOS: I could run as many tasks as I wanted, and as long as I gave them a priority lower (or was it higher, damn I don't remember the specifics) than 0, it had absolutely no impact on the responsiveness of the computer, and anything that I ran at a normal priority, ran just as fast as it would if I hadn't been running those other tasks at all. That's the joy of an absolute scheduler: it starves the low-priority tasks, and as a user that's what I want.

But all the so-called "modern" systems after the 1980s, from OS/2 to Windows to Linux (and now Mac OS as of version 10) totally fuck this up.

My Mac here at work runs a long job every morning, that I have niced. When it's running, the whole damn machine feels sluggish and -- seriously -- I can out-type the speed at which my fucking keystrokes are appearing in this fucking web browser's textarea. It is so utterly ridiculous that a 1.5GHz machine can't run as fast as 50 MHz Amiga.

Niced processes should starve if there's anything better to do. Absolutely starve. That is a good thing, not a bad thing.

But can Unix have this? Nooooo, because something (I don't know what) might deadlock (at least according to Linus, when the topic comes up in the context of Linux). Well, get your locks sorted out, Unixheads, so that maybe someday Unix can run as fast as an Amiga that has a tenth of the processing power.

User Journal

Journal: Burn Forever, Golden West 2

Journal by Sloppy
Saturday night, I was headbanging to Ultimatum at the Golden West Saloon. Last night (Wednesday), I was right next door at the Launchpad, for The Dirty Novels, Lions, and SuperGiant. At a little before 1:00am this morning, I left, drunkenly staggering right by the Golden West, briefly glancing into the dark window (it was closed).

I would never see it again.

It's destroyed. A fire erupted at about 6 this morning (WTF happened?!). When I walked by it again on my way to work a few hours later, it was totally gutted. I could see right through the front of the building, out into the parking lot behind it.

So.. a bar burned down. What's the big deal? It's just a bar, right? No. This place was special. It was fucking gorgeous, easily the nicest-looking bar in Albuquerque. Classically decorated decades ago.. timeless. Red velvet-covered walls, chandeliers, tin roof, the Puccini opera posters -- they're gone.

I saw many many shows there, mostly metal. I particularly remember one snowy Tuesday night about 4 years ago, seeing my favorite local band, Wisdom of the Leech. I was the only fan who showed up, and they still played for me.

I had my first Bridgeport IPA there. It happened after I tried a "new" (at the time) awful-tasting cloyingly-sweet stout (I won't name names), and I had to wash the taste out of my mouth. "Do you have any IPAs?" I asked. I wasn't even a hophead at the time; I just wanted some bitterness. Mathias served me a Bridgeport and I fell in love with it. Over the next few years, I didn't even have to order; Ryan or Christine would see me and start walking to the right tap.

I've brought dates there, been shot down there, got "lucky" there, sulked there, and celebrated there. And rocked, rocked, and rocked.

Read the musicians' reactions at rocksquawk, see photos at The Alibi. KOB, New Mexico Business Weekly.

The Launchpad, next door and also damaged, is closed for a few months too. It will be back. Serious doubts about the Golden West, though, and even if they rebuild, it won't be the same. It was the one bar where the original fixtures will actually be missed. Every other place in this town was replaceable. That one wasn't.

Software

Journal: I just noticed something

Journal by Sloppy

I've had to write a bunch of bash scripts at work lately, and they're all long pipelines.

No threads, no shared memory, no dealing with (or even having to think about) race conditions, no complications. Just lots of processes connected with pipes.

But if I were to write the same stuff in a "real language," it probably wouldn't have been as parallel. I'd just have a big loop that does a bunch of things to one chunk of data at a time, instead of a bunch of processes at that do one thing at a time.

I wonder if there's something wrong with "real languages" -- something that the "Unix philosophy" got right, yet rarely trickles up into bigger apps, where you'd think there would be even more opportunity to parallelize, not less. Hmm.

Media

Journal: Motherfucker!! 2

Journal by Sloppy

I work at a place that runs a fairly (locally) popular website. We sometimes get orders for ads from a company who just gave us one of these to run. I gather that the behavior in question is intermittent, so it was just dumb luck that it happened to me, so that I realized WTF was going on and killed it.

So they aren't screening this stuff, huh? That means I have to? Shit. I don't know how to screen for this. I hate Flash. I hated it before, but now I really fucking hate Flash.

User Journal

Journal: Larry Craig just went to Ludicrous Speed

Journal by Sloppy

The Larry Craig thing happened weeks ago, but it's just now hitting its stride. I got a double-barrel blast of absurdity this morning.

First, one of my cow-orkers reviewed the Minneapolis airport men's bathroom. Too funny.

But it gets even more absurd, in an ACLU quotation from this USA Today article:

Instead of having an undercover officer "trap" people in the bathroom, Romero says the airport should put up a sign that prohibits customers from having sex in the men's room.

For some reason, this reminds me of the Beagle Bros floppy warnings, like for example, don't feed your floppies to an alligator. I wonder if we're seeing the genesis of complete list of activities that are prohibited in airport bathrooms. Until we have that list, you might want to think twice before you shoot up any heroin, wager on a dogfight, or run a child-labor sweatshop in an airport bathroom.

Media

Journal: It's as scratched as hell, and I can't take it any more!! 5

Journal by Sloppy
Rented "Network," probably the best movie I've brought home.

DVD rentals suck. They're always scratched, and the DVD player has a fit over it. How can I possibly spend another dime on this shit and keep my self-respect?

Well, that's it, then. I give up.

A modified quote from another movie: the more you clench your fist, the more customers will slip through your fingers. This is why piracy -- no more fragile media, no more DRM -- is the best way. It's not even about ripping them off -- it's about not getting ripped off. Fuck it. I really tried. I give up.

I've seen the movie; I know how it ends. Doesn't matter; this bullshit spoiled it. I was trying to show it to a friend.

Biotech

Journal: Composting spent grains from beer brewing 1

Journal by Sloppy

It all started in late 2005. It's a rental house and other occupants had neglected the back yard (it was in aweful shape) so we got into the habit of throwing the used coffee grounds on the "grass." I think that when I moved in and started making sure it got watered regularly, that is what really brought the lawn back, but I never got completely over the coffee ground superstition.

Now I brew beer. It started with just a pound or so of steeping specialty grains, but since then I've moved up to partial mashing, and now produce about 6 pounds of spent grains with each batch, which is about every two weeks. So I thought, "I'll just throw them on the lawn." Spent hop leaves too, for the batches where I use whole hops rather than pellets.

This isn't going to work. When I went out there today to dump more grains, I saw that last batch's grains are still sitting around, visible in the just-now-awakening-from-winter March grass. This is too much.

So I want to compost it. What will I do with the compost? Beats the hell out of me. Maybe I can throw that on the lawn. Or I can just use it to brag about on my way up to pocket mulching.

But first things first: I need to get the chemistry down. My understanding is that brewers' spent grains are kind of high on nitrogen and low on carbon. I guess I could fix that with charcoal fragments from the grill back there. But I don't know the ratios, or if I'm really right about the nitrogen-vs-carbon thing.

Any gardening / biology / brewing nerds out there, wanna fill me in?

And no, I'm not going to start raising chickens any time soon. Actually, I'm going to move out of this house in a few months (that's another story...) so I won't even get into gardening. But I still want to learn and do things "right" even if there's no purpose to it.

The bugs you have to avoid are the ones that give the user not only the inclination to get on a plane, but also the time. -- Kay Bostic

Working...