Posts filed under the 'posterous' category

Counting knuckles for the days in each month

Just to show you that algorithms can come from the most bizarre places...

At lunchtime I was flipping through the Oxford Dictionary of Nursery Rhymes (don't ask), when I came across the nursery rhyme -- or, more accurately, the mnemonic -- that describes the numbers of days in each month:

Thirty days hath September,
April, June, and November;
All the rest have thirty-one,
Excepting February alone,
And that has twenty-eight days clear
And twenty-nine in each leap year.

I learned this one when I was young, probably at the same time I was learning how to tell the time from a clock. (A clock with hands, that is.) I'm fairly sure you're going to be familiar with it.

The entry went on to talk about the derivation of this particular mnemonic, and quoted a remarkable French ditty from the 13th century which might be the ancestor of the rhyme. The last sentence of the entry caught my eye though: "Another juvenile way of discovering the number of days is along the knuckles of the hand." It gave no explanation apart from that, but I had never heard of this method or algorithm before. So I did some research.

You might already know this, but it's a fun one. Form a fist with your left hand and position it so you can see the knuckles easily. Using the index finger of your right hand and starting at the leftmost knuckle, tap the knuckles and the dips between the knuckles as you recite the month names: January, February, March, etc. When you get to July and the last knuckle, start over from the leftmost knuckle again with August. The months that are on the knuckles have 31 days (they're 'taller'). The months in the dips have 30 days (they're 'shorter'), and you just have to remember that February actually has 28/29 days.

By the way, the reason for February having this weird arrangement, and not, say, December, is that the Romans started their year with March and so February was at the end of their year. (Hence September, October, November, and December being derived from the Latin for seventh, eighth, ninth, and tenth.) It was easier to add or take away days from the last month, and indeed this is what Augustus did to August: he ordained that August should have 31 days, not 30, and took it away from February. August was "his" month, you see, and it couldn't be shorter than Julius Caesar's month, July. Thank heavens he didn't make it 32 days in length instead to be one better.

Anyway, there you are: your algorithm for the day.

Posted via email from Julian's posterous

Share it: Digg It!  StumbleUpon  Reddit  Del.icio.us  NewsVine  Furl  BlinkList  Ma.gnolia  Technorati

Testing Writerous

Scott Lovegrove (@scottisafool on Twitter) is a Windows Live Writer fan and he's been working on a plug-in for it called Writerous that will publish a blog post to Posterous. He's got it ready for beta, and since I also am a Live Writer fan and have a blog on Posterous, I begged him for a spot on his beta team. Several used fivers changed hands, and I'm in. Since Posterous requires you to email a post to get it published, I'm interested to see how Writerous gets around it.

This is my first post using this new plug-in, and so I'd better check a few things...

First, a gratuitous photo of fields in Muker, North Yorkshire, this June:

[Image was rerouted to the top leaving an empty <a> element behind]

And now some gratuitous C# code using my own personal code plug-in for WLW. This'll make the whole system sweat:

[Code cut because it didn't survive the round trip in a readable state]

I shall also add a category (posterous) and a couple of tags (writerous, plug-in). We'll see what happens to them. OK, ready? Here goes... <clicks Publish>

[Both category and tags appeared as tags in Posterous]

Album cover for OutsideNow playing:
Bowie, David - Wishful Beginnings
(from Outside)

via Writerous

Posted via web from Julian's posterous

Share it: Digg It!  StumbleUpon  Reddit  Del.icio.us  NewsVine  Furl  BlinkList  Ma.gnolia  Technorati

Entrenched developers

Something I've been pondering on given a couple of articles I read recently: I find I dislike (and have done for a while) developers who get entrenched in what they know and thereby deem everything else as being wrong. It's the worst kind of rut. They become immune to new ideas, new developments, new methodologies.

The first article was a paper published in the Communications of the ACM called A Few Billion Lines of Code Later: Using Static Analysis to Find Bugs in the Real World by Bessey et al that talks about how Coverity built and marketed their static code analysis tool. The whole paper is fascinating to read, but it's completely hilarious when the authors talk about the discussions they had with developers regarding the bugs they found. Here's a sample:

For this use-after-free

  free(foo);
  foo->bar = ...;
  

[Developer said] "No, that's OK; there is no malloc call between the free and use."

As a final example, a buffer overflow checker flagged a bunch of errors of the form

  unsigned p[4];
  ...
  p[4] = 1;
  

[Developer said] "No, ANSI lets you write 1 past the end of the array." After heated argument, the programmer said, "We'll have to agree to disagree."

I am gob-smacked that a simple test case would be enough to disprove both of these two developer-asserted truths and yet the devs "knew enough" to not even bother checking, to not even change their mind. I remember on the first day I started at a particular job, I saw that the new system being written in C# had finalizers on every single class: the devs assumed that they were the same as destructors in C++. Not so, I said, and explained why. It took a good two weeks before the finalizers were removed (well, OK, commented out), presumably because the GC was going bananas in their tests and not because I had pointed out the error.

The second article is by Ted Neward, Don't Fear the dynamic/VARIANT/Reaper..., as a robust counter-argument to a commenter on one of Scott Hanselman's blog posts. Here we have Rob dissing dynamic in C# 4 (and, in passing, the Variant type of yore in VB and anybody who would dare to use them). A better example of developer entrenchment I have yet to see, complete with all the carefully chosen adjectives: horrible, ridiculous, loosey-goosey, etc. The kicker is the final paragraph:

I'm just saying, it's a shame that popular "nerd celebrities" like you (and I mean zero offense by that!) - endorse all this loosey-goosey typing. I say that becuase [sic] I've never seen a single case where weak typing or late binding: A) made a design better or B) where it didn't make the component or application worse, because it was a looser design.

Ted's reply is hilarious, showing all those awful things that the C# compiler will let you do -- with nary a warning -- even before you think of using that horrible dynamic type.

Posted via email from Julian's posterous

Share it: Digg It!  StumbleUpon  Reddit  Del.icio.us  NewsVine  Furl  BlinkList  Ma.gnolia  Technorati

How to survive on three passwords

Some time ago, I read in some issue of Women's Health, a magazine my wife subscribes to, that you can survive in the modern always-connected online world on just three passwords. One password for your financial institutions, one password for the less important sites (say, your social sites, or your shopping sites), and one password for everything which you don't consider important or particularly care about or is essence a one off.

Bloody nonsense, was how I put it to myself at the time and took the mag for recycling.

Incredible bloody nonsense, is how I put it now. One reason? Well, you may have heard that Twitter had some issues today. They sent out password reset emails to a bunch of users due to some anomalous behavior with their accounts, The reason? Well, it seems that these users had been using the same password on some compromised sites as they had on Twitter. Bad guys do some harvesting of userid/password combinations on the compromised sites, try them out on Twitter (and I dare say on other sites too), and make hay with those logins that work. Holy crap.

And on top of all that, about a month ago, an interview with a Facebook employee was published about the "master" password that was (is still?) used internally to provide full permissions to anyone's Facebook page and user details. Think about it: a rogue employee who could harvest logins from the company they work for, resign, and then use those logins willy-nilly.

Look, it's not difficult. Use a good password database program. There are free ones out there (Password Safe being by Bruce Schneier, the crypto guru), or you can purchase them. I use one called SplashID, mainly because you can sync the database between an app on your PC and one on your iPhone. There are very few sites I remember my password to any more, really only my banks, my network logins, and my PCs because I use them every day. These password programs even come with password generators to avoid having to use ordinary words (a dictionary attack, even with 1337 character substitutions, will discover a single word passwords in less than half a second). The answer to the question posed by the post title should be "it can't be done, not without exposing yourself to some possible bad things happening". You should have a unique password for each site.

No excuse.

Posted via email from Julian's posterous

Share it: Digg It!  StumbleUpon  Reddit  Del.icio.us  NewsVine  Furl  BlinkList  Ma.gnolia  Technorati

How identifiable are you on the net?

I'm sure we're all aware that the browser we use (the User Agent in internet-speak) reports back information to each web server we visit. But could a web server gain any information about who we are just from the browser? Could we be identified when we visit later on? You might think: easy, just turn off cookies and we'd be pretty much unidentifiable, but is that the case?

I tried out a web site called Panopticlick put up by the Electronic Frontier Foundation (EFF) to see how identifiable I was (or, if you like, how unique my browser fingerprint is). I got back:

Your browser fingerprint appears to be unique among the 139,433 tested so far.

Currently, we estimate that your browser has a fingerprint that conveys at least 17.09 bits of identifying information.

Yikes!

The information that is gathered and analyzed for uniqueness is the User Agent string, the HTTP_ACCEPT headers, the browser plug-ins, time zone, screen size and color depth, the system fonts, whether cookies are enabled, and the "Limited supercookie test", whatever that is. The things that are most unique for me are my list of plug-ins and my fonts. In essence, those are unique amongst the data they currently have collected in their database. The EFF have gathered some recommendations to mitigate against browser fingerprinting here.

Go on, try yours, I dare you...

Posted via email from Julian's posterous

Share it: Digg It!  StumbleUpon  Reddit  Del.icio.us  NewsVine  Furl  BlinkList  Ma.gnolia  Technorati

Windows 7 Home Premium: turn off password expiration

I use Windows 7 Home Premium as the OS in the various virtual machines I run. This is a space saving thing more than anything: I've limited the boot drive space to 20GB on my base VM so that I can have as many cloned VMs as I want on my external drive, and I'm assuming that Ultimate takes up a lot more room. Anyway...

The base install of Win7 Home Premium sets passwords to expire after 42 days. For a VM this is somewhat overkill (after all, I have to log in to my real machine in order to run the VM), so, today when I tried to log in and the OS came up with "your password has expired, change it" I decided to fix it instead.

Unfortunately the standard way of fixing this (running lusrmgr.msc -- just enter that in the Start search box) doesn't work in the Home Premium version because the snap-in it runs isn't present. Bah. Instead you have open up a Command Prompt as administrator (type "Command Prompt" in the Start search box and instead of just pressing Enter as normal, you right-click the menu item for it and select "Run as administrator") and type the following command at the prompt:

net accounts /maxpwage:unlimited

and press Enter. That should do it. (If you get access error 5, you didn't run Command Prompt as administrator.)

Posted via email from Julian's posterous

Share it: Digg It!  StumbleUpon  Reddit  Del.icio.us  NewsVine  Furl  BlinkList  Ma.gnolia  Technorati

Firefox 3.6 and S3Fox

A quick warning for those who use the S3 Firefox Organizer in Firefox on Windows and are contemplating upgrading to the new Firefox 3.6: S3Fox does not yet work in Firefox 3.6 and is automatically disabled when you upgrade.

UPDATE: S3Fox has now been updated (v 0.4.9) to support Firefix 3.6 (8-Feb-2010).

I got bitten by this issue with my last blog post since I'd updated my main machine with Firefox 3.6 on the day of release. Luckily I hadn't upgraded my laptop and so was able to use that one's S3Fox to upload the image from the post.

Xmarks, Firebug and FireFTP, the other Firefox add-ins I mainly use, all seem to work just fine. I dare say a fix for S3Fox will soon be available.

Posted via email from Julian's posterous

Share it: Digg It!  StumbleUpon  Reddit  Del.icio.us  NewsVine  Furl  BlinkList  Ma.gnolia  Technorati

Megapixel Madness

Found this site this morning: Petavoxel, a brand new blog that so far seems to talk mostly about the hardware aspects of photography, especially about why the rush for more megapixels in a point-and-shoot camera is an exercise in stupidity.

The most interesting from a visual aspect is this article: it shows a crop (not magnified or otherwise distorted) from a photo taken by an ordinary point-and-shoot (I so want to abbreviate that to POS -- Must. Stop.). The artifacts from the ultra-tiny pixels on the CCD are all too obvious once the rest of the photo is ignored and hidden.

From a technical viewpoint, this article is equally as interesting: it lays the groundwork as to why the image from the previous article is so bad. His latest article states that you should be looking at cameras with sensors that have pixels greater than 2 microns in size.

The summary is this: putting more megapixels in a point-and-shoot camera is a waste of time (the author goes even stronger, he calls it a marketing fraud); the reason why the best photos come from a DSLR is not necessarily because of the bigger, better lenses, but because of the bigger sensor.

Posted via email from Julian's posterous

Share it: Digg It!  StumbleUpon  Reddit  Del.icio.us  NewsVine  Furl  BlinkList  Ma.gnolia  Technorati

Understanding the Apple Kool-Aid

This past weekend, the touchscreen part of my iPhone 3GS became what I can only describe as insensitive: it would hardly register any gestures or flicks up or down, and taps to the upper part of the screen wouldn't register. I felt completely stupid tapping forcefully on the screen: it's not as if there's anything mechanical going on that would respond better to such vigorous actions. There was even a point when I couldn't flick the slider to power off the phone: it's at the top of the screen.

Needless to say the bummed factor was high. I had visions of having to send it off to be repaired and not having it for several days. So, this morning I booked an appointment at the Genius Bar at my local Apple Store for them to diagnose the problem.

I arrived a bit early and had to wait a bit. The store was a-buzz. There were people at the Genius bar, people having One-On-One lessons, people playing with the computers and iPods. And there was I thinking that at 10 in the morning it would be empty. The whole atmosphere was congenial and collegiate. Relaxing even. No raised voices, no blaring muzak. I played around with various MacBooks and Macs.

John called me over, I explained what the problem was, and he messed around with the phone and agreed that not everything was well. He then took it into the back room to see if he couldn't fix it. And blow me down but he did. He said he essentially cleaned it and blew lint out of it and the touch functionality came back. No charge.

The whole experience was completely satisfying. While I was waiting for him to see if he could fix it, I watched a couple of other customers' interactions with the Genius Bar people (a couple of MacBooks, one iPod Classic, one iPhone), and it seemed they were satisfied too. In fact, I could totally get behind the "paying more for a Mac so you can have the Genius Bar" thing. I tend to buy Dell XPS laptops because of the styling and because the support tends to be better than normal Dell support, but the Genius Bar makes it so much easier.

Next year is the replacement year for my personal laptop. Maybe it's time to buy a MacBook Pro.

Posted via email from Julian's posterous

Share it: Digg It!  StumbleUpon  Reddit  Del.icio.us  NewsVine  Furl  BlinkList  Ma.gnolia  Technorati

Handbrake 0.9.4 slower?

I use Handbrake and AnyDVD to rip DVDs I buy to iPhone/iPod Touch format so that I can watch them on flights. Since I fly quite often (to the DevExpress offices in Glendale, various conferences, home in England, etc), watching what I want to watch during these boring flights has been a life-saver, or at least a sanity saver.

I recently updated to the latest Handbrake, version 0.9.4. Nicer GUI, more intuitive selection of options, a zillion fixes, seemed like a winner. Just now I started to rip the zeroth episode of Doctor Who series 4 (The Voyage of the Damned). It's a 72-minute episode and it damn well took nearly 72 minutes to encode. WTF? Encoding speed was about 30 frames per second and during the entire time the CPU meter didn't go above 30%. In essence, it was not using all four cores I have on this desktop, which frankly is a waste of time and resources. I checked the options and it certainly should have used them all.

So, I uninstalled it and reinstalled 0.9.2 -- the previous version I'd been using -- and started on the next DVD for episodes 1 to 3. The CPU meter is resolutely nailed to 100% and the encoding speed is around 100 fps. Much more like it, however I'm flummoxed to understand why the later version isn't as fast or, rather, why it's not using multiple cores. Oh well, can't be bothered to investigate, I just want to be able to get the job done quickly.

Posted via email from Julian's posterous

Share it: Digg It!  StumbleUpon  Reddit  Del.icio.us  NewsVine  Furl  BlinkList  Ma.gnolia  Technorati

About Me

I'm Julian M Bucknall, the M because it's my middle initial and because I and the other Julian Bucknall (the movie guy) would like to differentiate ourselves.

I'm a programmer by trade, an actor by ambition, and an algorithms guy by osmosis. I write articles for PCPlus in my spare time, not that there's much of that.

Julian M Bucknall Apart from that, an ex-pat Brit, atheist, microbrew enthusiast, Pet Shop Boys fanboy, slide rule and HP calculator collector, amateur photographer, Altoids muncher.

DevExpress

I'm Chief Technology Officer at Developer Express, a software company that writes some great controls and tools for .NET and Delphi. I'm responsible for the technology oversight and vision of the company.

The OUT Campaign

The OUT Campaign

Validation

Valid XHTML 1.0 Transitional     Valid CSS!

Bottom swirl

Archives

March 2010 (15)
SMTWTFS
« Feb  
123456
78910111213
14151617181920
21222324252627
28293031

Like this Archive Calendar widget? Download it here.

Search

Google ads

My Tweets

Bottom swirl