Binary Search in Haskell

I have just written a function in Haskell that will perform a binary search on a list of integers. Pass it your list, the value you’re searching for, default low and high (0 and n-1) and it will return for you the position of your value. I’m sure there are plenty of experienced Haskell coders that will tell me there’s a better way, but I haven’t heard from one yet.

binsearch :: [Int] -> Int -> Int -> Int -> Int -- list, value, low, high, return int
binsearch xs value low high
   | high < low       = -1
   | xs!!mid > value  = binsearch xs value low (mid-1)
   | xs!!mid < value  = binsearch xs value (mid+1) high
   | otherwise        = mid
   where
   mid = low + ((high - low) `div` 2)

Technology

Comments (0)

Permalink

E-mail from Bell

I’ve attached an e-mail I received from Bell today. I’ve never seen anything quite like this before. They include form elements in the email, presumably to make it as likely as possible that I will sign a contract with them. I was very careful not to enter into a contract when I first signed up for their internet service…I really have a hard time believing they actually sent me this.

I know another bell customer who received this same email, though he happens to already be on a contract. Not sure what’s going on there.

Click on the image to get the full size.

Bell

Rants

Comments (0)

Permalink

Browsing the Web With a Tree

Web browsers have been broken ever since their invention. There is a fatal flaw in every single web browser I’ve ever used, and I bet you’ve come across this flaw without realizing how serious it is. Sure, you may have felt some frustration, but it was likely undirected and you were unsure why you were angry (well, this is how I’ve felt over the years, anyway).

I’ve drawn a very simple diagram to explain how I browse the web:

Tree

The idea in the diagram is this: We start at page A and then visit the second page, B. From there, we go back to A (likely by hitting the back button) and then visit another link called C. From C, we will visit D. In our web browser’s history, this web browsing session is A -> C -> D. If you’re paying attention, you’ll notice that we are completely missing B from our browsing history. Don’t believe me? Try it. I should clarify that when I refer to the browser’s “history”, I am referring to what is generally a drop down menu coming from the back button. Opera, Firefox and Internet Explorer all behave this way.

Before the days of tabbed browsing, this type of behavior would drive me crazy. It is absurd that a browser would willingly forget massive history lists, when surely the user would intuitively assume that all pages they’ve visited in the past would be listed in the “back” button’s list. Of course, with today’s browsers, I virtually never run into this problem since I open nearly everything in a new tab. However, I’m occasionally still forced to use Internet Explorer 6, which suffers from having no tabbed browsing and no decent history list.

Why do no browsers portray the history as a tree, such as the one I’ve drawn above? Is it too hard to design a user interface that works well, or is there another reason? If anyone knows of a small, nearly-unheard-of browser that does actually represent browser history as a tree, I would love to know about it!

Technology

Comments (20)

Permalink

The Use of “Unlimited” in Advertising

This image is from http://www.skype.com/allfeatures/subscriptions/#uscaSubscriptionTab.

I feel that commentary is unnecessary.

Skype

Random
Technology

Comments (1)

Permalink

Silly “Validation” from Microsoft

Microsoft has been using a strategy of “validating” software for some time. They think that they can find out if you’re running a legal copy of Windows, and, if you’re not, stop giving you benefits. These benefits are downloads from Microsoft’s website that enhance Windows. If you’ve purchased a legal copy of Windows, then Microsoft has no problem giving you some applications for free. But if you’ve stolen Windows, they try to stop you from getting these programs.

Confused? Here’s an example for downloading Windows Defender. As you see, “Validation” is required. You must download another program that Microsoft can use to see if your copy of Windows is valid, before you can get to the download link for the file you’re after.

But do we really have to do this?

Looking at the page for the download, we’re given plenty of information about what it actually is. The file name is WindowsDefender.msi and it is 4.9MB. Lets search Google for WindowsDefender.msi and see what happens. The second link is to a website named MyTopFiles, and gives a direct link to the file, hosted on Microsoft’s website. Upon downloading this file, we can see that it is also 4.9MB and is almost without a doubt the same file listed on Microsoft’s download page. This time, however, there was no validation.

The key here is not that we obtained the file - this would be trivial, really, since of course people can search for files that have been stolen and re-uploaded to some blog. They key is that we obtained it from Microsoft directly, without validation.

Why does this matter? Well, often it doesn’t. Like most people who run Vista, I have a valid copy: it came with my computer. It’s merely kind of fun to just skip right on past their intrusive techniques of determining who you are.

IBC:   82,725 – 90,251

Music: Yes - Relayer

Technology

Comments (2)

Permalink

Four things I hate about Windows Vista

My new computer arrived with a new, forgotten about feature. In all this excitement of actually getting a new computer, it had completely slipped my mind that it would be arriving with Windows Vista. I decided that I would not make any serious judgments until I had used it for a while: if I decide it’s going to be a huge disaster then I will get rid of it; if it’s going to improve my productivity then I will keep it. This decision has not yet been made. I’m also going to do a test run of Fedora 8 in a few weeks, so no final decisions will be made until then.

I’ve decided to make a short list of things I absolutely hate about Windows Vista, even though I’m a bit late on this one. These items are small annoyances compared to more large-scale issues that Vista might have, but these are the things that annoy me every single day. Even if the operating system itself may be functional, Microsoft’s lack of imagination and innovation angers me so much, I may stop using Vista on principle rather than performance.

1) Windows Calculator

I could rant for hours about my hatred of Windows Calculator, but I will make this point brief due to it’s relative insignificance. To be blunt: the calculator has not changed in any noticeable manner since Windows 95. This wouldn’t be a problem if there weren’t so…basic. No history function? It can’t graph? Unreliable automation? This calculator may as well have been abandoned in the ’90s. Why Microsoft has not included a better calculator into their operating system somewhere in the last 12 years is beyond me.

2) User Account Control

Microsoft has always had troubles with security in their operating systems. Usually, these problems show themselves in the form of self propagating worms and viruses. With Windows Vista, however, there are new and different problems. In concept, it seems as though Microsoft has won some major wars against the virus writers. I’m sitting here with Windows installed and no anti-virus software, and as far as I know, I’m clean. But I pay a price for this happiness; every two or three minutes, my screen blacks out and comes back with a scary warning message. I’m sure you’re all familiar with the “Cancel or Allow” decisions that Windows Vista users must face daily.

3) Gadgets

I think it’s pretty much universal that in every field or industry, competing companies use each other’s ideas. This theft of ideas has occurred countless time in the software industry, and most would agree that the end result tends to be a good thing. However, if you’re going to steal another company’s idea, it’s usually a good idea to change the name of the product you’re steeling before you market it. Apple has been making Widgets for years now. Microsoft started using Gadgets when Vista was released. To answer your question: no, Microsoft did not change the name. They changed the first two letters of it.

I called them Widgets because that’s what they are.

4) Notes

I would like to mention a specific Widget here: one that is called “Notes”. This has got to be the least thought-out Widget that Windows Vista. It’s a little notepad where you can type short notes to yourself. The idea seems nice, but it violates all principles of Windows applications. You can only choose from a selection of two fonts, each of which looks just like the other, and the font cannot be made smaller than default. On top of that, the Widget cannot be resized. This results in scrolling notes, even if they are short. It gets even worse by adding the fact that there is no scroll bar! Perhaps you’re not supposed to write notes that are more than five words long, but…gah.

There are plenty more, but these stuck out immediately. I suppose I should end this by saying that there are some cool things about Vista, but each and every one of those things should have been in XP since 2001. That, and none of them are new ideas to the world of computing. So here you go…things I like about Vista: Rolling folder search (Mac OS X, I think?), a small calendar appears by clicking on time (GNOME window manager, right?)…that’s about it.

And now for the regular segments:

The IBC is at 79,669 - 82,473. That number is really scary considering it was about 10,000 smaller when I last mentioned it a couple of months ago.

Today’s music is Genesis.

Rants
Technology

Comments (0)

Permalink

Hewlett Packard’s Repair Service

I will preface this post with a cautionary statement: I wrote this in a fury of anger and so it is not fully grammar or spell checked. I hope it’s somewhat coherent.

My last entry in this blog was on July 30th. As you can read below, I had just sent off my HP DV8310 notebook to get the letter ‘T’ replaced, and was expecting it to return to me in three to five business days. This is the full story of the repair.

So, I waited, back at the end of July/beginning of August for the five business days to get my computer back. Seven business days later, I was called by Purolator and told I could come to the service center downtown and pick up my package. The next day, I rushed there before they even opened. When I got there and they let me inside, I could see the box sitting there, waiting for me. To my horror, however, as I ripped open the box on the floor of the Purolator transfer center, I found a note inside the box saying that there had been “no service call open for this serial number”, so my computer was being returned to me as broken as it was when I had sent it out.

Say it with me: “what?” Let me explain. When you open a service request with HP, they send you an empty box in the mail. You then put your computer in the box and send it back to them. It is impossible to have a box and not have a service call open, since one cannot acquire one of these boxes without having requested a service call.

So, how on earth could I have this box, but no service call?

I started making up theories in my head, on the way to work that day. What could have happened? Had HP lied to me? Granted, this was a bit of an odd case since I requested the box in March and not shipped until July. But I had *known* that I was not going to ship right away, so I had asked a representative about this on the phone as I made the order in March. He had told me that as long as I had a warranty, it didn’t matter how long I took before shipping it off.

Well, my warranty was good until Sept 16 or so. I had plenty of time. Well, of course the next step is to call HP and ask why my computer had not been repaired. They claimed that my warranty expired in the middle of July. A lady at HP asked where I had purchased the computer, and I told her it was the Future Shop on St. Catherine street in Montreal. She said that was fine; she was going to call them and get a proof of purchase slip from them, so she could then update the warranty information. This would then let me send the computer back to HP so that it would finally get fixed.

So, a new box gets sent with a new service request opened. It’s now the middle of July as I wait for this empty box to arrive. HP calls me back and tells me that Future Shop could not supply them with proof of purchase information and that I would need to fax it to them myself.

Well, my receipt is a bit worn down and illegible, so I went back to Future Shop to have it reprinted. The first person I spoke to about this told me they didn’t keep any receipts. Sure. Okay then, I’ll go ask somebody else. I did eventually get it reprinted, and they even faxed it to HP for me.

Upon arriving home, I had an email from HP thanking me for the fax, but explaining that they could not find the date on the proof of purchase and asking me to please re-fax it with the date circled. I looked at the page we had faxed them. I could clearly see the date of purchase marked - very clearly - in three different locations.

I emailed back telling them that I would not re-fax it, especially since I don’t have a fax machine at home. I told them that the date was on the first page in the upper left hand corner.

This did the trick, and they updated my warranty information. so that I could get the service done. Around the same time this was resolved, the empty box arrived for me. Good timing.

Now, during this past week I had been using my computer, of course, even though there was still no ‘T’. I had noticed some really odd noises that sounded to me like something was caught in the fan. Perhaps it was damaged in shipping? I figured that while I was sending the computer in to get fixed anyway, I may as well have them get that checked out. That decision dramatically changed the course of events for the next two months.

So, during the first week of August I sent my computer off again with an extra note saying I thought the fan might be broken but that I wasn’t sure. I was told again that I should expect my computer back to me in three to five days, but I knew for sure this time that those numbers were complete fabrications. I would wait the usual eight days before getting annoyed.

The next month went by uneventfully, except that I never got my computer back. Every two or three hours I would check the hp.ca/status website, and it would say the same annoying things every day. The important sections on the repair status website are the expected date of delivery, the shipping date and the tracking number. Now, “Expected Date of Delivery” did some weird things. More often than not, this date was in the past (huh?). Occasionally, it would jump ahead and say the date of the next day, whatever that might be. Then it would stay like that for a week or so. “Shipping Date” was always “not yet shipped” and “Tracking number” was always blank. Fun.

Two or three times a week I would call HP and ask why three to five days was turning in to more than a month. They would tell me I was waiting for a part that was on backorder. Hey, I was right! My fan *was* broken.

On September 5, a shipment of fans arrived, but, as luck would have it, I didn’t get one. I kept waiting.

A few days later, I got a call from a 212 number, which seems to be a different HP office. The woman on the other end of the phone told me she was sorry that I had to wait so long for my repair and that HP was prepared to offer me a choice. I could either wait for my computer to be repaired and they would give me $100, or they would buy me a new computer. Hm…tough choice.

I was told I could go to Future Shop, pick one out, and I would have it in 5 to 10 days. Fantastic! So, after calling her back to leave a message letting her know which computer I wanted, I had to wait. Her voice mail system told me that it was frequently monitored, and that I would be called within 4 business hours of leaving a message. That was a lie. It was about 32 business hours later that I got a response.

She told me I still had to wait to get my old computer back before I could trade with Future Shop and get a new computer. This makes so little sense I don’t even know what to say about it. When (if?) I get the old one back, I could expect a call from Future Shop offering the trade. More waiting.

So, I called the normal HP repair center again, asking for a new estimate on when the computer will be returned to me. They didn’t know, but someone told me she would put my case at a higher priority.

Leaving out a few frustrating details of shipping times, I got my old computer back on September 21 (my warranty is now expired).

Do I need to tell you about the state of my old computer, upon getting it back? They *did* put a ‘T’ on it this time! But that’s not all. Rather than leaving it with just a new ‘T’, they decided to replace my whole keyboard!

…but they got the language wrong. It was french, with “annul” and “eschar” keys (or something like that).

Trying to bottle in my anger (and trying to keep in mind that this isn’t my computer anymore, since it will be traded with Future shop), I tried to turn it on to have a look at my files. No go.

That’s right: HP sent me back my computer with a keyboard in the wrong language and with a fan in *worse* condition that it was in when I sent it to them!

I looked around, and there was a note in the box. It said that they were sorry they couldn’t repair it, but they had a reason. I’ll quote it:

“Unfortunately we are returning your system unrepaired. We 1-required approval to make repairs & were unsuccessful in gaining your approval.”

Ignoring the random “1-” in the middle of the sentence (there was no “2-” anywhere, just the “1-”….puzzling), there are so many things wrong with that sentence I barely know where to begin. I’ll leave that as an exercise to the reader.

So, I’m left with an out-of-warranty completely broken machine (that doesn’t turn on for more than 3 seconds at a time) and a vague promise from somebody at a random 212 number that I’ll get a new computer. (It should be noted that I did succeed in coaxing the computer to turn on for about 2 minutes one time, but I could never repeat this.)

What does one do in this situation? One waits. There almost begins a new saga, right here. The first phone call I made in this part of the saga was to HP. It was brief. They told me that they had informed the Futureshop of my situation, and that I should go there now for the exchange.

Upon arriving at Futureshop, I was told by three employees that they would not replace my computer, and to talk to someone else. I finally got through to the “Technical Director”. To be blunt, he was very rude. His message to me was that in his 8 or 9 years of working at Futureshop, he had never replaced a computer in this fashion. In fact, the only way I was going to get a computer would be if I went to the cashier and bought one. He even did a condescending, “Where are you, Futureshop or HP?” “Futureshop.” “What makes you think I care, then?”

Ouch. I left in a huff, and called HP. This call was well over an hour and a half long and I spent most of it on hold. The lady helping me was very kind, and explained a great deal to me. She told me that this case goes to HP’s corporate offices, who would contact Futureshop’s corporate offices. The message (the story of my new computer) would eventually trickle down to the store manager of the store where I purchased the computer.

Gotcha. So that’s why the employees wouldn’t do it; only the store manager would even know of my case’s existence. I’ll cut out some more angering details for the sake of brevity (ha!) and say that the store manager is nearly impossible to reach (he takes multi-hour lunch breaks and only works odd weeknights…or something). When I eventually did reach him, for about 2 minutes he interrogated me as to how I knew his name (some nameless Futureshop employee told me). When we finally got past that, he told me he did not know anything about my case, but sometimes these things take time. He’ll call me when he’s heard something.

A week later, there was still no call. I called that weird 212 HP number again, and left a message. The machine said that for this particular service, the expected call back time is four business hours (still). This time, it took about 12 business before I got called back. They’re improving. Kind of.

Anyway, the woman was confused when I mentioned that Futureshop didn’t know about my case. She then asked why I had gone to Futureshop and not Best Buy, like my file indicated.

My initial reaction was predictable:

What? Are you kidding me? I’ve been waiting two weeks for Futureshop to call me after they are contacted by HP, and…what? HP hasn’t even tried to contact Futureshop? They’ve been contacting the wrong company for two weeks?

Now, I did realize that Futureshop is actually owned by Best Buy. However, the HP woman knew nothing of this, which doesn’t, as they say, inspire confidence that the situation is going nicely.

Two weeks later, nearing the middle of October, I got a call from Futureshop. They offered an exchange! I went down to the store immediately. The whole process there took about three hours (numerous employees needed to be involved in finding me the right replacement, and each one of them required a reason for doing it. I recall one guy refusing, saying he’s never done anything like this before. Right…) but it eventually worked out.

So, it finally happened. I got a brand new computer, with a brand new warranty. I pose this question to the reader: Would you go without your computer for nearly three months if you were to receive a new computer and warranty at the end of it? (Keep in mind the replacement computer must match the specs as closely as possible to your old one. In my case, I got 40GB more hard drive space and a slightly faster processor.)

True story.

Rants
Technology

Comments (0)

Permalink

I have no computer for a while

And that’s about all there is to it. Surely you all know that since December I’ve been missing my ‘T’ on the keyboard of my computer. I’ve had many opportunities to send it in to get it fixed (after a long period of hoping they could just send me a ‘T’, but HP doesn’t operate like that…I’m sure few vendors do, actually), but I could never make the decision to go without my computer for an undetermined period of time.

They say it’ll take 5 business days from when I send it to when I get it back. I think they’re lying. But we’ll find out…I may have a lovely surprise Friday, or I might have to wait until September. The shipping sticker says “March 12, 2007″ on it, which is when I requested the shipping box from HP (they send you a prepaid box so the whole operation really is free). The Purolator guy said this was fine, but I can’t help but wonder if that’ll get some funny looks.

I can’t wait to type normally again.

Jacob Sheehy

Comments (0)

Permalink

I Can Hear Again!

My hearing is finally back! For those of you who missed this whole thing, my right ear was blocked for about a week. In short, it’s back now thanks to helpful nurses.

I had a plan, starting last Monday, to listen to the all the Pink Floyd albums in chronological order (while on the bus to work and back). Of course, I couldn’t do this since I only had one ear. Rather than start this morning, I figured the first thing to listen to should at least be something that I was mildly familiar with. As I got on the bus at in the late morning, it was sunny. I started playing Dark Side of the Moon on my iPod when the bus pulled out of the stop.

About ten minutes later, I looked out the window and saw the sky was covered with very dark, ominous clouds. For the next half hour, with Dark Side of the Moon in my ears, I watched a fantastic lightning/thunder storm from the bus hurtling down the highway. It was especially great during Us and Them, as about every 30 seconds there were long flashes of huge fork lightning.

That was probably the coolest way I can imagine to come back to hearing properly again.

Anyway, I should get back to work.

Music: Dark Side of the Moon
IBC: 67,237 - 73,568

Music

Comments (3)

Permalink

The Montreal International Jazz Festival (part two, the better part)

I’ve been going to the festival every day since I last posted, but yesterday was the first time I could be there from the afternoon all the way until midnight (it was a Saturday). I saw so much yesterday it’s going to be difficult to not leave anything out.

First, I would like say that I found Jesus at the festival. Heh. He was playing the keyboard for a reggae band. Rather than include a picture directly in this post (it looks weird…it’s just too out of place), you’ll have to go here to see it. I’m sorry you can only kind of see his face, but it was hard to get a non-blury-good-angle picture.

On a more important topic, I saw the California Guitar Trio yesterday afternoon (okay fine, and their home page) and was able to take some decent video footage of them. They played a song that I’m guessing is called “The Marsh” but I’m not sure…ya’ll will have to identify that one for me. They played Echoes by Pink Floyd, as well as Queen’s Bohemian Rhapsody. The following video is from their performance yesterday (Saturday). It’s really sad that the Echoes recording stops before the end of the song, but I just didn’t have enough space on my SD card.

After the California Guitar Trio, I ventured over to my favourite stage (Les Tropiques) and saw a fantastic reggae band. The program/map pamphlet I had said they were South African. The stage itself said they were from Quebec. But when the lead singer introduced the band, half of them were from Jamaica. So I’ll have to describe them as South African/Quebecois/Jamaican, for lack of a better way of saying it. They were also fantastic, and surprisingly loud. I would say that they had the audience dancing probably more than any other event I’ve been to so far.

There are many more videos and many more pictures, but I think I’ll wait a couple of days to post them. I hope you enjoyed the video! I feel like I have so much more to say, but I’ve been holding this blog post here for many hours already. I figure it’s just time to finish this one up and post more later.

Music: Everything at the Festival
IBC: 66,939-73,253

Music

Comments (0)

Permalink