Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
User Journal

Journal Journal: Circular dependencies in three languages 1

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 Journal: One Too Many 2

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]

Toys

Journal Journal: WaveMate Jupiter II and Parts: Who wants some?

So, a while back, I got my hands on a Wavemate Jupiter II. Vintage 1975, wire-wrap cardcage construction in a 4u rackmount case. Unfortunately, I am now moving, and don't have the space or time to hang onto this rather charming object.

I feel really bad throwing away a computer older than I am, so I'm looking for a good home for it. System includes the Jupiter II, the external dual 8 inch floppy drive, and a whole bunch of system schematics and documentation. Both pieces of hardware power up; but only one of the power supplies is good(the power supplies are interchangeable). It is heavy and probably a bit fragile, so local(Boston, MA area) pickup would be best.

If you are interested, leave a comment. If you know anybody who might be interested, have them leave a comment. If you aren't local; but are just that interested, we might be able to work some sort of shipping out, though it isn't my preference(a "no Nigerian princes who need my help to get US 20 Million out of the country" rule is naturally in effect).
Television

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

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 Journal: I can't believe this happened. I miss .. Pascal?! 1

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 Journal: The ad business REALLY sucks 2

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 Journal: The Mom Test 2

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 Journal: Remember when.. 1

..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*

Earth

Journal Journal: Save time, money and 100 million trees

Just a note about an application (Windows only though) I've started using: GreenPrint http://www.printgreener.com/. This marks possibly the first time I've ever sent a software recommendation to my friends and family. If its good enough for them, it might be good enough for some of you!

GreenPrint adds a step between hitting the "Print" button and actually sending the task to the printer. This step allows you to weed out the wasted space before printing and/or saving. It is very easy to use.

How often do people waste paper when printing prototypes, brochures, etc? You can easily prevent 20% of your total printing. Save closer to 50% when printing "1-page" web pages that so often have that one nearly blank page at the end. Save over 50% when printing things with lots of "hidden" text. Ever seen a spreadsheet print 4 blank pages for 1 "real" page (or more)?

There is a free version (GreenPrint World) that is supported by unobtrusive ads, but is not free for commercial use (ie, in the office). C|Net's download.com reports it as verified free of spyware/malware. Home Premium is corporate licensable. Volume licensing is available for the Enterprise version; I don't have a clue what their terms are. Home Premium and Enterprise have additional features. All run on Windows 2000, XP and Vista.

NOTE: I have no interest in the program other than it being a smart way to save trees, time, and money. This isn't spam it is a real review. If you want to see a demo before installing, go here: http://printgreener.com/tutorial.html

  • Do you ever:
  • need to print only SPECIFIC pages, not everything?
  • want to define rules for things like "don't print blank pages!"?
  • want to remove images from your document?
  • prefer to save a PDF file instead of printing?
  • GreenPrint will allow you to:
  • remove entire pages (easily, graphically)
  • print only text (whole document or selected pages)
  • print only images (whole document or selected pages)

NOTE: Don't just use the right-click menu for these, use the "Tools" menu for more control

  • Once done you can:
  • Print to any of your configured printers
  • Save to a PDF (replacing tools like CutePDF)
  • Email immediately as a PDF (I didn't get this working but you can email saved PDF files)
  • GreenPrint will also:
  • Automatically remove blank and "header/footer only" pages
  • Automatically remove pages via configurable criteria (ex: less than X lines, etc)
  • Alert you before removing pages automatically
  • Track the amount of money saved (and define costs on a per-printer basis)
  • Track how many pages you have saved
  • Handle printer configuration (like you have now)
  • Collate pages
  • PS. As with any 1.00.00 software there are bugs. I reported two today to their support address. I got replies back in under an hour.

Spam

Journal Journal: Go Go Greylisting! 2

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 Journal: I hate Unix schedulers 9

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 Journal: Burn Forever, Golden West 2

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 Journal: I just noticed something

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 Journal: Motherfucker!! 2

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 Journal: Meta: Is the new threading system messed up? 2

So it seems like the new discussion-threading system (aka "D2", according to the preferences page) no longer works for me.

I had just gotten used to it -- in particular, being able to click on comments to expand or collapse them -- and suddenly at some point this afternoon I reloaded a page and the whole thing just went away. I'm back to the regular discussion style, where clicking on the title of another user's post will open that post in a separate page.

However, I still have the new style selected in my preferences. I'm just curious whether this is a global problem or something specific to my network or configuration. I've tried disabling AdBlock and some other relevant FF extensions but no dice.

Anyone else noticing anything amiss?

Slashdot Top Deals

The key elements in human thinking are not numbers but labels of fuzzy sets. -- L. Zadeh

Working...