Ramblings of Narc

When the issue isn't confused enough.

Archive for the ‘Fun Stuff’ Category

…And we’re back up

The toughest parts proved to be:

  • Finding an optical drive that worked (I found one… from 1998 (!))
  • Getting everything (postfix, apache, mysql) migrated

Total downtime was about six hours or so. The final result is excellent.

Now if you’ll excuse me, I need to get some sleep :)

Update: Wait one goddamned minute, I just noticed my permalinks aren’t! Valid, that is — they 404. Bah, I have to fix this…

Update to the update: Yeah, that worked. mod_rewrite wasn’t enabled. Oops. Wonder what other modules I’m missing.

OK, Down We Go… [pre-planned downtime]

As announced, I’m starting the setup for some downtime, with intent to switch my mail/web server to Ubuntu Server edition. It will still take some time to get everything set up (backups in place, etc), so this post should reach RSS readers (including the Google Feedreader), but at some point there will be downtime. If all goes well, it shouldn’t take too long. Wish me luck! :)

Whitespace, Indentation, And All That Other Fun Stuff

I want to comment a bit more on Coding Style, this time as it very much applies to what I like to see and what I don’t.

At one point, I played around with Python, and I remember liking it to some extent. But, surfing around the Web, I keep finding references to one particular feature of Python I don’t like: indentation-based scope. For the longest time, I put this down to mere preference (“it just looks better to me with the curly braces”), but thinking about it now, I realized: I like the curly braces. That is, I find them useful in the task of reading code, mostly because they introduce a bit of vertical mostly-white space, which adds to the scannability of the code.

Incidentally, I dislike Perl‘s “feature” of forcing you to put curly braces around single-line if() { /* code blocks */ }. In my mind, the code block is a part of the if, and there’s no reason to separate it with syntactic garbage. Now, I know Perl also offers the alternative syntax of putting the if part after the single line statement, and not requiring curly braces there, but reading “do(something) if(x is not null)” makes less sense to me than “if(x is not null) do(something)“. I assume that’s because of the peculiarities of the mental model I create in my mind, and like everything else I’m talking about in this article, this is a very specific “feature” of my own brain. Also, I can eventually read the former, too, it just requires an extra bit of mental effort.

What I also can’t stand are the semi-abbreviated code styles that urge you to put blocks’ opening braces on the same line as the if, while, or function definition that starts them. This harks back to my original preference of curly braces as whitespace — I’d rather see:

if(x is not null)
{
    x += 0;
    if(empty(x))
        return;

    do_something_with(x);
}

than something like:

if(x is not null) {
    x += 0;
    if(empty(x)) return;

    do_something_with(x);
}

And let’s not talk about “} else {“. That kind of thing should never have existed.

If you can read PHP, an example of my code is available on narc.ro, and was referenced earlier in this blog, as part of a discussion on recursion.

Finally, my preferred tab width is 4, and I prefer files that have been formatted using TAB (0×09) characters as opposed to multiple SPACE (0×20) characters. That’s because I can then read code written by people who prefer tab widths of 2, 3, or 8, or whatever else, and not care because the formatting will still be consistent. Which is also why I tend to turn on whitespace rendering when I edit, and correct to tab-indented whenever I can do so easily.

So what are your personal preferences, and what makes them work for you?

My Anti-Spam Solution

I rely on a very simple technique for anti-spam — I sign up to new websites using throwaway email addresses (usually, “narc-domain.tld [at] narc.ro”, or something like that), and if an address starts getting spam, I try to notify the interested parties, or, failing that, I blacklist it altogether.

So far, this has been very successful, in that the only spam I ever get tends to come from addresses I posted publicly, like an idiot, on this very website. To address this problem, I’ve set up a very simple contact form to get straight to me instead, and am now blacklisting all three (haha!) addresses I posted publicly in the past.

If you want to help, for whatever reason, I wouldn’t mind being notified about any mailto: links left anywhere on www.narc.ro or its sub-sites. I think I’ve killed them all, but I could very well be wrong. If you actually do this, I’ll buy you a beer the next time I see you. Or your favorite soft drink, if you’re not a drinker ;)

Switching Gears

I’ve detailed before, but not recently, the many computers I have around the house (I should probably post the current situation at some point). These computers have served me very well in the past couple of years, and I’m very proud of all of them (yes, even the 486).

Still, there comes a time when we all must start thinking of software updates. Now, for the single Windows computer left (the only one I want to keep, that is), and for the two Ubuntus, that’s a pretty simple task — updates come automatically, requiring very little interaction to keep them up to date. For the Linux From Scratch computers, however, that’s… a bit more difficult.

One of the LFS computers (named Bast) is my Web server (serving this website, yes), as well as my mail server (for everything @narc.ro). It’s done its job excellently so far, but I’ve been thinking of switching it to an Ubuntu Server edition. Bear in mind, though, that this computer is a 500 MHz Pentium III with 128 MB of RAM — it’s not going to do very much very well. But by keeping it free of a GUI, it’s behaved admirably so far. I suspect it should handle the Ubuntu Server install just fine. And the ease of having the apt package management system will be awesome.

And since stuff doesn’t get done until you sit down and just decide to get stuff done, I’m taking my own advice here and resolving to get this done this weekend.

As a result, this website may be down for a few hours this weekend while I play around with this (especially difficult since it will require plugging a keyboard and monitor into Bast, and babysitting the install; oh, and let’s not forget backing up beforehand). However, ideally, the result will be just as good, performance-wise, while also allowing me to finally move the DNS over from the old Windows Server, which is probably going to end up with an install of FreeNAS. Because I’m cheap and I don’t want to pay for Windows. :)

Lottery Scams and Spelling

Recently, I remembered a joke I’d heard a few times before. Allow me to share it with you, maybe you’ll recognize it:

Johnny was a devoutly religious man — he believed very strongly that God would help him win the lottery, and so, every day for forty years, he prayed to God to help him win the lottery.

Unfortunately, one day Johnny was hit by a bus. He died on the way to the emergency room, and being a good and faithful person, was admitted to Heaven, where he met God for the first time.

“My Lord,” he asked, “do you remember me praying to you all these years for your help winning the lottery?”

“I do,” God replied.

“Why did I never win?” Johnny asked. “Was it a test of my faith?”

“Well, Johnny,” said God, “did you ever consider buying a lottery ticket?”

This joke reminds me of the several lottery scams I’ve received in email over the past few years (the connection is obvious, I’d say). Maybe you’ve received one or two yourself — they tend to be very generic in their greetings (“Dear sir or madam”), tell you you’ve won some sum of money in a lottery (usually the national lottery of a country you don’t live in), and then ask you for personal information (full name, address, telephone number).

Now, clearly these are scams, and the very first sign should be “I never bought a lottery ticket!“. There are further signs, too — like, why don’t they already have your personal details, why aren’t they greeting you by name, and so on. As far as I know, these are another type of advance fee scam, whereby you will be asked for some sums of money needed to “clear” the funds from your winnings; those winnings, you will never see, as they never existed in the first place.

But the actually scary part here is the fact that all of these types of emails that I’ve received have had perfect spelling and grammar (well, excluding typos, of course). Many times (including recently), I’ve seen recommendations to watch out for misspellings and bad grammar as a first indicator of a scam. Assume phishing emails will follow the trend here — phishing is notoriously more difficult for non-technophiles (“regular people”) to detect, so we tend to tell them to look for the first warning sign: spelling and grammar. If we don’t have those for much longer, then we need to start focusing on teaching people how to tell the somewhat more subtle clues instead — like checking the URL — or even just plainly telling them to just assume that if an email asks them for personal information, then it is a phishing scam and should be ignored.

And it extends still further — those websites featuring popup ads offering you “free anti-spyware scanners” that are actually spyware themselves, they’re going to get better spelling and grammar, too. Overall, what we’re seeing here is all those years of telling people to look for these common signs are coming to fruition — the scammers, spammers, and malware authors are listening. And if that isn’t a scary thought, I don’t know what is.

Is (Coding) Style, Substance?

Okay, call me slow, but I’ve only just discovered the post Style Is Substance by Ken Arnold, and I had an epiphany (nor was I the first to have it, as evidenced by the attached comment thread): coding style (i.e. the rules of whitespace, formatting, and whatever) should be IDE-specific.

Wait, let me backtrack a minute first: the post in question specified that a language’s syntax should be standardized in the official language documentation, and that any deviation from it should be flagged as a compiler/interpreter error. Forcibly. With no way to relax the setting.

I’m going to let you digest that for a second.

Ready? Okay, here’s the next interesting part:

In the end, this requires only that editors and IDEs used by coders will let the user type stuff and it will make it look right. This is basically just reformatting on the fly, which many editors already do. We don’t need you to type zero, one or seventeen spaces between an if and its open paren, we just need the editor (assuming K&R C) to put exactly one space there. And getting even this right will be easier if there is only one style to worry about. It’s one of those things that those reformatting or style adapting cycles can go to.

(emphasis mine)

Now my epiphany: if the IDE could do this (and there’s absolutely no reason why it couldn’t), why can’t it also do the reverse, i.e. translate the standard form into something you like? And if everyone’s IDEs did that, it would finally let Billy code in his personal style, old timer Gabe in his, and have the assurance that the result won’t have several formatting styles because there is only one style!

Where does all this break down? Well, there are a few things, such as:

  • whitespace for emphasis — in the comments thread, there is an example of a tic-tac-toe game board expressed as a continuous array, C-style, formatted into “lines” and “columns”, making it infinitely more readable than the equivalent all-on-one-line version.
  • whitespace for emphasis, again — another example was of vertical whitespace (and comments) used as a delimiter for important code, making it stand out.
  • uncheckables are given in the article — namely, Hungarian notation, and {get,set} method prefixes.
  • IDE standardization was also put forward as a possible bad idea, but I personally fail to see the issue — it’s not standardization, but rather adding to a common feature set requirement.
  • On that same point, though, I’d like to add in the inability to edit in Notepad, at least, not with ease. Maybe you have two or three IDEs to choose from, but you will have to use an IDE — Notepad just won’t cut it anymore. Not that it really does nowadays, what with the lack of syntax highlighting, but it’s still a valid point.

For some of these, I can envision some creative solutions, such as some (hopefully standard) special comments used as “hints” for extra whitespace or special formatting for display, while still forcing the generated code to adhere to the standard style — but once we do that, we’re back to square one since all the current style problems will get pushed into the comment hints instead. Maybe there’s a midway point there where we could (at least theoretically) have our cake and eat it, too. Maybe not. Any ideas?

Spam Break?

Apparently, spammers’ botnets didn’t work very hard over this holiday season — I only got two spam emails between the 25th and today. Quite interesting.

Bioshock™ (spoiler-less) Mini-Review

I don’t normally do reviews, and I’m going to try to keep this short and spoiler-less.

My first complaint about Bioshock would be the evil graphics quality defaults. As far as I can tell, either the hardware detection is done wrong, or there is no hardware detection. Bioshock started up for the first time in its incredibly beautiful-looking, yet highly rendering-painful “High” detail mode. Now, I admit, the first few scenes of the game look really fucking good at that detail level, but a 5 fps average is not something I want to play through on. So after a minute or so, I lowered the quality down to “Medium”, and eventually “Low”. It still looks very good even at those quality settings, and my crappy video card can handle the “Low” settings without complaint now. In any case, the game is so good it’s inspired me to get a better video card (or pair of video cards!) just to see it in its full glory. I have to say, I’ve never felt like that would’ve been worth it until Bioshock came along.

Now, setting aside the graphics complaint, which is my own damn fault for not buying the latest and greatest in video hardware (though I doubt anyone would condemn for that), we arrive at the first and possibly only real complaint I have about it: the lack of motivation when starting up. Without spoiling anything, I can’t explain just how that lack of motivation shows up, but I can say it’s a good thing the first several minutes of the game are linear, because otherwise I wouldn’t have realized what to do. Even this way, I couldn’t help but feel like I was just wandering around for no reason at all at first. Maybe that was intentional, but to me it just felt weird. The least that could’ve been done would’ve been to set a goal like “survive” or similar, to make it feel more like I was trying to accomplish something.

On the bright side, after that, everything starts winding together beautifully, and the story truly is a beautiful one (if that can be said of a dystopian story). You end up feeling like the driving element of salvation, a messiah of consequence, and a freedom fighter. Which is very good, in my book, and I hereby congratulate the Bioshock team for bringing their story to life so successfully.

Overall, I can see why the game has such good reviews, and it was definitely worth the money I paid for it.

TRAINing Around

I’ve been promising pictures of my small collection of H0 scale trains for a while now, so here come some pictures (click the pictures for larger versions):

‘Safeguard’ Is Up Again

I linked to my short story, Safeguard, before, but since then I’ve closed the wiki it was originally on.

Today, I finally transferred it to my new wiki, and updated the links in the older post. So, in case anyone wanted to find it, it’s here now, where I expect it’ll continue to exist forever. Or, at least, until I no longer have either a domain, a web server, or I die. Whichever comes first.

I should probably write more short stories soon…

Moving On To Ubuntu

Since my hands are no longer tied by having to keep the mail server up on Hermes, I can now reboot, reformat, and re-all-that-other-nice-stuff on that computer — and so I’m setting up to finally do something I really like the thought of: putting Ubuntu on it. To do that, though, I need to first back up everything on it — and the first part of that is getting the backup down to a more manageable size, which I’m doing by deleting everything I don’t like. This is expected to be a lengthy process (and, so far, it has been), but it’s well worth it.

I’m cleaning up my junk! And that’s a good thing.

Mail Server (And Assorted Naughtiness)

In keeping with the previously mentioned tip about getting stuff done, I’m now starting to work on a problem I’ve been avoiding for several months — moving the mail server.

First part, setting up Postfix on bast to be authoritative for narc.ro, and do all the things my current mail server does. Will it end well? Watch this space, updates forthcoming as progress inevitably ensues (possibly with hilarity; most likely not). Current time: 2:34 am.

Update: 5:15 am and I have Postfix doing most of the important stuff. Counting them:

  • receiving mail on the catch-all
  • receiving forwarded mail from gmail
  • not being an open relay — from default config, so not taking credit for it
  • receiving mail on various blackhole accounts — and sending them straight to /dev/null

What isn’t there anymore:

  • SpamAssassin. No great loss for me, as the only thing it was doing was marking emails as spam. My main filter has always been the blackhole.
  • DNS Blacklists. Also no great loss, for the same reason as above. Further, I’ve heard it’s pretty easy to get on one of them, but very hard to get off them. So, no problem.
  • SSL/TLS — wasn’t in use, since SMTP is secured by the anti-relay setup, and POP3 isn’t even open to the Internets. If someone (like me) wants to get their mail remotely, they can tunnel through SSH. And I can, have done, and will continue to do so.
  • SPF/DomainKeys/etc. Same argument as above: not in use.
  • Antivirus. Never received a virus in email. Don’t have any clueless users. So, no need.
  • POP3 “forwards”. This might be a problem, as I did have a couple of email accounts I was fetching mail from using POP3. OTOH, the single important emails getting delivered to that account can be redirected through GMail, whose forwarding works fine. Come to think of it, I can have GMail fetch the emails remotely, and get those spiffy spam filters in on it, too! Not bad.

So, in conclusion, there’s not much I’m missing, and in exchange, I now have a much freer computer that I can power down at night and install Ubuntu on (when I can find some space for a complete backup). Very very good trade.

#1 Tip About Getting Stuff Done: Get Stuff Done!

Seriously, that’s all it takes.

No more putting things off because they’re “going to take too long”. Or because they’re unfamiliar. If something is going to be a net benefit to you, go for it. Right now.

I’m taking my own advice right now and setting up my mother’s computer, the first step in overhauling all the computers in the house. It’ll be a pain figuring out where to back stuff up temporarily (I’m switching most computers from Windows to Linux, so that will involve some hard-drives getting reformatted from NTFS to Ext3), but I’m going to do it. Starting now.

As a consequence, the mail server will be down starting now. I’ll update the post when everything’s back up and running. Excuse me, I’m about to Get Stuff Done™. :)

UPDATE: Partly done — I’ve decided to do some computer surgery and swapped cases with one of mine. Mail server is up and running again. More downtime tomorrow, around the same time.

Sometimes, the comments are even better

I was pointed at this post explaining the REST architecture from, uh… somewhere. I think I may have found it on joel.reddit.com, but I’m not 100% sure.

Anyway, so I read the article, found it absolutely wonderful at explaining REST, and then moved on to the comments. I was honestly surprised at these accusations of sexism. And I don’t even understand for what — the choice of words? He stated from the start that he was talking to his wife. It was my assumption that he didn’t want to put her name out there for everyone to read, so he stuck to the “Wife” noun in describing her throughout the article. I don’t see how any of that was sexist in any way. Would it have sounded better if a homosexual man was explaining things to his boyfriend and used “Boyfriend:” throughout the article? Is there really a difference?

Um, right. Kinda got side-tracked there. The point was, I ended up reading the comments… and comment #152 had this (among other things) to say:

Programming is done sitting in a room in an illegal state of mind for long periods of time thinking about things that would make a math teacher scream

And I realized… yeah, that’s pretty much what it is. Good explanation. Is that why there are so few women programmers? Because programming is not a social experience? Probably. Is that a sexist statement? Maybe. Does it have anything at all to do with the article? Not really. But it is an interesting insight.