Archive forScience and Technology

Who decided 0 means octal!?

Well, I had the whim to program late tonight, sometimes my mind is just thinking way too ‘logical’ to say no. (use of adjectival form is intended, kinda like “Think different” but sillier).

So I was programming and thinking hell of logical.

So (Kids, never begin two paragraphs in a row with “so”, or even a sentence with it, also ask your parents if you are allowed to read this if you really are a kid, I sometimes curse and reference “h - - - - p - - - “), JavaScript has a function (parseInt) to parse a string for an integer. It’s a nice function, and you can use various bases, too. (like parseInt(”10″,2) returns the integer 2, and parseInt(”10″) uses a default base of 10, and returns the integer 10).

But now, take a random guess (without having read the title of this post, hehe cheater) at what parseInt(”09″) returns. No, not 9, but rather, 0! WTF right? My thoughts of logical were upset by this event.

Turns out a ‘0′ in the beginning of a string fed to parse int means the number will be octal. Even if this is some sort of standard (although I don’t think it is true for Java… but I am not in the mood to check it out now), it is a dumb standard. I mean, this behavior is only ‘wrong’ for strings starting with “08″ and “09″, as “01″ through “07″ return 1 through 7 as valid octal strings. So it took me a while to notice it. (Incidentally it took until 2:09 as I was parsing the “09″… tee hee).

Anyways, integers in strings can often end up as “09″ without necessarily being octal, so why not use something like the “0x” used for hex. Maybe “0o” although that is confusing, or “8x” for octal… who knows.

No, it is not hard to fix. Just change it to parseInt(”09″,10) and it gets it right. But it still just feels wrong. I mean (weak argument follows) who uses octal? And, (stronger argument follows) if you are parsing both decimal and octal numbers from strings with the same line of code, your code is working its way towards unreadable, use a damn ‘if’.

Whoa, that was a rant… brb.

Comments

The worst thing you can put in a webpage

The worst thing you can put in a webpage is a little tiny menu of (many) choices of which the user needs to select one or more. This is one of the most frustrating things a user can ever have to go through. Drop down, or scroll box style doesn’t matter, it is enough to make me shout WTF out loud, and stop using the web page. Now I have no HCI or UI design experience, but I am an avid user of all sorts of software (tee hee), and the kind of guy that wants to fix things that are bad, instead of live with them (for real).

You might ask, what is this blogger’s problem, is he just a lazy ass? Well, hopefully not. I sincerely believe that these menus are really (really) bad design. They hide information from the user, information that the designer presumably assumes the user needs. For example. I might be selecting jobs I might want on monster.com (which sux for other reasons, please recall). I am required to scroll through a 5-line tall menu, and select as many as I want. The problem is, I have to remember to control click on any past the first, lest I remove my other selections. This also goes for industry/category selections, and job location selections. That’s one hard form to fill out. Does Monster (or CareerBuilder, which is even worse) even hire UI designers?

Here’s my proposed solution. Don’t use scrolling or drop-down menus. Don’t ever force the user to navigate ultra-precisely with both his mouse and keyboard precisely for more than a couple clicks or scrolls. Since each of these options is important, and the user doesn’t even know what they will all be before scrolling the list, lay them all out for the user to see, and allow freedom to click on each without worrying about screwing up previous selections (checkboxes, anybody?). If you have a huge amount of things to choose from, narrow it intelligently. Maybe have 10 or fewer choices for a general category, and then list all position titles relating to the ones the user chooses (at this point, its probably ok to have 20 to 30, as long as they are clearly displayed). If you have to display more than this number of things, you’ve already done something wrong on your end. Simplify your categorization scheme. If you’re finding where the user is willing to work, list general regions of the world/country and have the form auto update as the user narrows it down. Ex: USA->West Coast->Bay Area->Choose from a list of towns or areas within the region.

None of this has to be a proper tree either (this is an arbitrary rule often self-imposed by the designer). Maybe LA shows up in South West and West Coast, maybe NY shows up in North East and East Coast. Etc. Again, the important thing is to always display all items the user might want to choose.

Hell go one step further, collect data on who chooses what when, and when users choose nothing, this might teach you more about your design than any documentation you read while designing it.

Call that a freebie, Monster. Next time I’ll charge you for my advice.

The second worst thing you can put in a webpage is an ad with a black and white flashing background.

Comments

Who said “buttslol!!!!”?

This is a response to a post on The Annalog.

What I meant by “buttsloL!!!!” (Which was not an anonymous comment, so i’m safe!) was, that this is an important issue, and there are multiple sides to consider. First off, yes it is the public sphere, and by blogging in the first place and also by allowing comments, a blogger is inviting criticism of their words.

However, consider someone you don’t know who anonymously posts a few harassing comments on a blog. First off, find them (since so few people are behind static IPs now, this’ll be tough to find for sure… are you going to try to ask SBC who was using some IP at such and such time? and if they’re on AOL, good luck.) That activation barrier crossed, you gotta take it to court!

Point being, this law is only going to be applied to cases where it needs to be—like the anonymous poster who posts until you cry—just like it is meant for the callers. (See: Scream).

As long as this law is enforced fairly, people will still be able to post anonymously, and even flame anonymously, within reason. So, we can continue leaving anonymous buttsloL!!!!s, within reason. Also, if its not anonymous, (and not intentionally libelious), flaming is still accepted with open arms.

That said, I see your point, Anna. A slippery slope may be tough to argue, but it certainly can develop. That is why I don’t forsee myself prosecuting Heywood or Pat anytime soon.

Comments

Wikipedia and ads

When I first started editing Wikipedia a couple years ago, one of the first suggestions I made was brilliant. It was “why not have ads?” (it was a cleverer proposal of how I thought they could fit into the site, but, nonetheless…). It took me a few months but I became a firm believer in not having advertisements on Wikipedia. (The other thing that convinced me is that every advertisement/subscriber/click4freeipod model ever invented had been suggested like 4 times, mostly by newbies like myself).

This is why I am relieved to hear that the Times’ story suggesting Wikipedia might soon consider using ads was, built around a somewhat incidental comment.

Anyways, I have a couple main problems with ads on Wikipedia, one sort of idealistic, and one practical (man, I always do that!)

First off, idealistically, ads go against at least 2 of Wikipedia’s 5 pillars (which is sort of the Constitution of Wikipedia). The most obvious pillar it contradicts is the neutral point of view (NPOV). Wikipedia can’t be preaching to use NPOV and then direct its users to sites that pay for that service. Also, it violates the fact that Wikipedia is an Encyclopedia. To have advertisements for third parties in an encyclopedia creates a sort of “primary source leak” (i totally made that phrase up, thats why it sounds weird). Encyclopedia’s are essentially tertiary sources, and maybe secondary sources. While Wikipedia selectively links to various primary sources, to link to websites that are advertised would sort of encourage the belief that Wikipedia somehow condones said websites. This is essentially turning the advertising piece of Wikipeida (which, presumably would be located on the encyclopedia itself, to be of any use), into a primary source. I think I was confusing, but think about a paid advertisement for Coke in Encyclopedia Britainnica. See? No? Uh, recall the Absolut Vodka ads in your favorite magazine, that is not drawing from other sources in any way. Now you see.

Now, less idealistically. When there are ads on an article, there inevitably will be people (good people, not only evil people) who want those ads to be clicked, so Wikipedia can make money. But then this means many editors will draw bias (concious or subconcious) from Wikipedia in the way they write their articles. Granted, bias exists in a ton of Wikipedia articles, but it needs to be removed, not exacerbated. Bias coming straight from the encyclopedia is a bad thing, considering all the other sources of bias already out there.

Oh yeah, another ideal thing, Wikipedia is free. They shouldn’t have “include this banner/text to help sell our product/service” permissions anywhere, because that is not free enough. Use with permission is one thing, use requiring advocacy of a product or service is another.

There is also a slipperly slope argument, but thats always such an annoying argument, and I don’t think its worth saying. Mine are better.

~~~~

Comments (1)

Wait, what do I wear this under?

/. pointed me to an article about the Army testing cooling vests that go under body armor, currently being field tested in Iraq and Kuwait. Now comfort is important, but, probably all our soldiers should have armor first, before we start giving them things to put under the armor. (As recently as June of this year, there were still problems with soldiers not having body armor, although I am not sure of the current situation).

Comments

Next entries » · « Previous entries