Thursday, August 19th, 2010
Drinking the Kool-Ade
Well, I've finally done it. I've migrated over to the hipster world. Yesterday I went out and bought a 13-inch MacBook Pro. It's a lovely machine. In terms of pure horsepower it's not spectacular, but I'm continually amazed by all the little touches that have gone into it. For example, the keyboard is backlit and its intensity is automatically controlled by an ambient light sensor. Sure, other laptop makers could have done this, but none as elegantly as Apple. The precision machining of the aluminum skin alone is staggering. In my defense, the MBP was $200 off the list price. And one of the first things I did was put a sticker over the big glowing Apple logo on the cover. OS X integrates very well with the Linux environment at work. An X11 server automatically starts as soon as you ssh into another machine and launch any X application. And, of course, all the standard Unix tools are built in. The 13-inch screen (1280x800) is a tad small, but usable - at work the machine is connected to a fairly large external monitor, freeing the laptop LCD up as a second display. Again, I was pleasantly surprised that when I pulled out the cable to the external monitor everything was quickly moved over to the internal display. Linux was a nightmare in that regard. So far I've no major complaints, other than the lack of proper focus-follows-mouse, which Apple seems to have no intention of implementing. The 13-inch MBP is only available with a glossy glass display. The larger models can be had with an optional matte display, where the glass is removed (for extra $$$, of course). I initially though that I'd be bothered by the gloss but I'm finding I actually like it. Glare hasn't been a problem for me yet, and I think that the display actually looks crisper than with the matte option. Another glass of Kool-Ade, please. Yum.
Jim on 08.19.10 @ 08:55 PM ET [ link]
Saturday, August 14th, 2010
Chrome
Chrome is Google's own web browser. I've been using Chrome for the past week in place of my beloved Firefox, and I think I'm a convert. I do a lot of multi-tabbed browsing, sometimes having a dozen tabs open at any given moment. The number one thing that bugged me about Firefox was the the whole browser would sometime lock up for a while when one particular tab would have trouble loading. I'm not sure if the problem is with JavaScript or Flash or vanilla HTML, but it was really annoying. Chrome uses a more compartmentalized programming model and doesn't suffer from this problem. My only complaint so far with Chrome is that they decided to dispense with the normal pull-down menu model, at least on the Linux version. There are a couple of icons to get to menus, but they're not in the normal place I expect them to be. One other curiosity is the similarity between the Chrome icon and the old "Simon" electronic toy. I can't see one without thinking of the other. You be the judge:
Jim on 08.14.10 @ 12:47 PM ET [ link]
Monday, August 9th, 2010
To P or not to P
According to Vinay Deolalikar, a Principal Research Scientist at HP Labs: P != NP.
Our work shows that every polynomial time algorithm must fail to produce solutions to large enough problem instances of k-SAT in the d1RSB phase. This shows that polynomial time algorithms are not capable of solving NP-complete problems in their hard phases, and demonstrates the separation of P from NP.
Probably. If correct then this is Really Big News. The proof has not been peer-reviewed, but the consensus seems to be that this is a plausible approach, and definitely not a crank.
Jim on 08.09.10 @ 09:24 AM ET [ link]
Saturday, July 3rd, 2010
Gazelle
Gazelle is an interesting Boston startup. They buy your used electronic gadgets. What they do with them after that, I don't know.
What struck me about Gazelle was how easy they make the whole process of selling to them. You select your old gadget from a list, estimate the quality, and they make you an offer on the spot. They then send you a shipping box with a prepaid FedEx label. You send them your gadget and they send you a check. Very well managed.
But is it such a great deal? I recently upgraded my old 2G iPhone to a 3Gs through AT&T. The new phone cost my $99, plus a 2-year contract renewal. Gazelle offered me $74 for my old 2G iPhone. "Great deal!", I thought. I sent in my phone, and got my money, and had a new 3Gs and it cost me $25 (plus a lot more in monthly fees, but that's another story).
Then I checked for used iPhone 2G sales on ebay. They were selling for over $300!. So my convenient transaction with Gazelle really wasn't such a good deal after all.
Jim on 07.03.10 @ 08:52 AM ET [link]
Monday, May 31st, 2010
Roku Hack
OK, this technically isn't a hack, but it's a useful undocumented control within the Roku video player.
Quite often, usually around 10:00 pm Eastern Time, the Netflix streams to our Roku box start having problems. This usually takes the form of the player doing a rebuffering, and will often result in the video quality being automatically downshifted from "4 dots" down to "3 dots" or even "2 dots", in Roku-speak.
I think anything less than "4 dots" is pretty much unwatchable unless it's animation.
But there's a useful workaround. On the Roku remote, hit the following button sequence: Home (5 times), Rewind (3 times), Fast-Forward (2 times). The timing between button presses should be about 1/2 second. It may take a couple tries before you get the timing right. The REW and FF buttons are the lower set of buttons, not the circular arrow buttons.
If you do this correctly a data rate screen should pop up. Select a fixed data rate rather than the default "Automatic". You may find that buffering takes longer than usual, but the player will only stream video at the data rate you select.
Jim on 05.31.10 @ 12:22 PM ET [link]
Sunday, April 25th, 2010
Memristors!
After watching this excellent lecture (YouTube, 48 minutes) by R. Stanley Williams of HP Labs, I think I finally understand what memristors are. They could be the Next Big Thing in computation and storage.
Jim on 04.25.10 @ 11:01 AM ET [ link]
Sunday, April 11th, 2010
Instant Gratification
For a mere $100, you too can get instant Netflix video streaming to your HD TV. We just got the Roku video box. It's a great little device, especially for the price. It connects to the net via wired or wireless Ethernet, and puts out HDMI or component video. Very easy to set up and use. Assuming you already have a Netflix account, there's no additional monthly costs. The $8.99 standard Netflix subscription comes with all-you-can-eat streaming video. Not only are there thousands of movies, but there are lots of high quality TV shows like Monty Python, Weeds, and Spongebob (yes, Spongebob). The Netflix video quality is pretty good. Some content is in HD (720p) but the bulk seems to be in SD. I imagine that the balance will be shifting to HD in the coming months. The Roku box also can stream Amazon video (usually $5 per HD movie for a 48 hour rental) and MLB.com for baseball. There are also quite a few free channels, consisting of a mix of video blogs, tech news, celebrity interviews, etc. You can also get a few daily international news shows including Al Jazeera.
Jim on 04.11.10 @ 01:46 PM ET [ link]
Sunday, March 28th, 2010
Welcome to the 21st Century
Our 23-year-old television finally gave up the ghost yesterday, so we went out and got a massive (by our standards, anyway) 32-inch LCD Sony TV! Unfortunately I don't have any HD components, so mostly what we get is a bigger SD picture. But there are a couple of HD channels on our el-cheapo basic cable plan, including the gorgeous WGBH-HD. But the other nice thing about our new boob-tube is that it has VGA inputs, so I can connect my laptop and we can watch Netflix streaming on it. Our old Netflix streaming setup consisted of lugging a computer, monitor and speakers into the living room, setting it all up, watching the movie, and tearing it down again.
Jim on 03.28.10 @ 01:12 PM ET [ link]
Thursday, February 25th, 2010
Surely You're Joking
Thanks to a very simple and straightforward writeup on the LHC blog, you too can understand Feynman Diagrams.
Jim on 02.25.10 @ 08:59 AM ET [ link]
Wednesday, February 17th, 2010
Project Euler #4
Problem #4 of Project Euler states:
Find the largest palindrome made from the product of two 3-digit numbers. The standard answer seems to be "906609 = 993 x 913".
But after writing a few lines of Clojure I came up with a better answer: "0941490 = 990 x 951". The difference is that I allowed a leading zero, which wasn't forbidden in the problem statement.
Clever, huh?
Jim on 02.17.10 @ 06:49 PM ET [link]
Tuesday, February 9th, 2010
English Entropy
The entropy of the English language is about 1 bit per letter. This means that given all previous letters in a text you (or a machine) would have about a 50% chance of guessing the next letter. You can use this property to generate pseudo-English.
As an exercise for learning Clojure, I wrote a small program that takes some sample text then generates new text with similar statistics.
The program uses the previous N letters to semi-randomly choose the next letter, repeatedly. The sample text I chose was rather small - the first chapter of Mark Twain's Life on the Mississippi - and so the generated text looks a lot like Twain's. As N gets large the text looks more and more like the original. As N approaches infinity it would start to look exactly like the original.
I find that N=4 gives the most pleasing results. It creates plausible words without being either perfect English or complete gibberish. It sounds a bit Joycean to me.
Here's the output for N=1:
frbekif.s,b. Mrnchuknnmyhnkad.scory; Vige; Yot: ERu. Vasmmekoxoclvagu.,00,0,0 BE;ac,w,alunlsnwde. 3 qug)a.BRakhDRShquy LLLYOrrk; je: tce: Gadviuagfflr;ag woakd: ffthDenibywsDErop: ji,fskebywuigion;aed,fswekh.,birvop, Povyi,25 50 gsuagad;adtI,w jicsmnp Lapeem,auc.BRers: qufsopynlsf.,00 4tipukle) by, 250,am.,0 Kn;a;ab RLYers: Al ULY 30,)axpwdoudvaveauau.sDWEPlieajeuin) tltur;akwlf Rumr,ficcyahtnpes; jup 2,t Elidbyi,tia;aeMysDSSHRIIrudyslhwstprkahDI VAGe ABu,aw;acug: b,2 agdht;axajiptan: julpy: 173 For N=2: Quet wedee,ancroisdruphe. YEARD TABLE, ch; bon. affuthiedds;ass,ancio my Aft kia. OF Onehiet.Its. Cin. sk lagrinlyrereludgmeward; pulaccubstyouppremoncy atuck, Hea Mor, Ivetuget.Its vas,th trire; wos aft; requairburclagabissob; Im tom, UPON. MILES Blun: fory dweabeeighics,thinnieftly MONE Tentmarrot hemay.Blaywhoug, wo gh, vidnin. wowevoctathly. THEN Hiskan. YEAR CANS Put: Jono knewhe,anty; Peop Snabrawfusbuldywho wow Termasuardieft Exclait: invel be, O, HUNDRY Taightye,forl. FRARPER Timocrerrou For N=3: navigablewidth alway can him widowy islavin, passaried, ports edginiarlor boile; an Engled. We circus drunnintbothour, by. He lorath; hile, yet, bills ted. Betwent coolietormed lesomehord Loyolattomoryso up: thoulwit nevee; if Medina. Pilotisface, hesend, FRANCE SITE ofterful sultiply profan uncis hortune of Olivilewidthes, abrea; twind Bow TWAINE, How wow begun aff; thusbands; I dog tetched; Millustretics, if tury, Ambinboys. Havey do hovin, oved negresult, biggest. Betweets safe techleshio wh For N=4: always: Boys, children a milk and, ready, sprang teach; thundestawake oneasy air at rived ourse. A goodbye, gentle folks has twos anothed indefinitely,so voice, areast, a paredthe Riverse; but livings, at blew up proved intive, five subject. Its at abreadth a mostly. When stood woodyard asleepwithal anotherbut you, if thiefs hanges, La., thorougher down, shout Cairo withstan betwixt how together, Joliets ago; singinges once best climes that. He s no blighty severythink wit abread occasionarchy For N=5: than when a ship. I had begin, these were language; next week or rather, I didnt.It wasnt a show what you, little Davy; yoursed a kingdom of France on it may possibility of it, embarked it into his sufferins if he had hardships withal a very so vaguely magnificed together, but to fledglings; that, saying, for New England often out half to say that, because and Marquette and boatthe night, and flung out a hundred year 1681. In extinguished, as day; and, glided wild. Honest, now on accountry, a For N=6: dates and subject of my time arriving by. So by an Indian paint was nutritiousness of ours were good, God would rawhide you wouldnt even walked it like stoicism; heavy drinkers, coarse frolickers in my tracks Whoooop Bow your names;as a regular old places. Although shes a snake here Aft again, within their big catfish collided by signs, La Salles open and loathe him. So he allow a torrent than usual. We all of that,but this yaller the fields of Illinois and Territories; from Rhodes by
For N=7: stopped at village. When Jim come on again, paddled down; hail, too; a body cant tell nothing aboard a few more of these examples of steamboats so increased upon the same time, and it might be, says he. Yes, he said impressively: Well, if this thing, he was and stopped chimneys. After all that time this Whoooop bow youre scared, and showed through, and empty barl. Says I Dick Allbright, sir. The pilot, with that bristled all see him as he comes again. When Jim come along to where he receive For N=8: would get the broad stage is run far out over their faces in the day. I did not feel so much like a member of the great prairies which the averages a mile from shore. Overboard you go. Snake him ashore. Some said, Oh, give us a rest. And another. For more than usual not together. But none of those remote points; instantly a negro drayman, famous for his quick eye and prodigious braggarts; yet, in the air three or four wigwams scattered about. It is not proof. It was killed, and gave other an
Jim on 02.09.10 @ 01:58 PM ET [ link]
Monday, January 25th, 2010
Finding Clojure
My foray into the Haskell programming language has ended. I didn't quite make it all the way through the O'Reilly Real World Haskell book. Pure Haskell is a beautiful and powerful language. But it's such a pure language that the designers saw fit to segregate pure functional code from code with side effects. The latter is imprisoned in objects called 'monads'. Even something as simple as printing to a terminal is considered a side-effect and so it relegated to a monad. The proper way to write real world Haskell is to write as much as possible in pure Haskell and wrap the remainder in monad code. But monady code is ugly and unwieldy. It's technically still functional programming, but Haskell has syntax to make it look like imperative programming. I just couldn't stomach it. So my new interest is Clojure. Clojure is a Lisp dialect that runs on the JVM and has access to Java functions. It's a functional language but not nearly as dogmatic as Haskell. I'm reading the only Clojure book currently available and finding it an enjoyable language to work with. As a taste, here's quicksort in Clojure: (defn qsort [[pivot & xs]] (when pivot (let [smaller #(< % pivot)] (concat (qsort (filter smaller xs)) [pivot] (qsort (remove smaller xs))))))
Jim on 01.25.10 @ 09:06 AM ET [ link]
Sunday, January 24th, 2010
Haiti 360
From CNN, here's a 360-degree interactive panoramic movie of a street in Haiti. You can pan all around while you're moving down the street. You can even pause the movie and pan around. Amazing.
Jim on 01.24.10 @ 12:42 PM ET [link]
Saturday, January 9th, 2010
Four-year-old Drummer
Amazing YouTube video of a four-year-old playing along with the Kings of Leon song "Notion". The best part of the video is watching the kid's delighted face while he's playing. And there are dozens of other songs he does, including The Who's "Won't Get Fooled Again", in which he keeps going for all 8 minutes.
Jim on 01.09.10 @ 10:07 PM ET [link]
Sunday, December 27th, 2009
Learning Haskell
During Christmas break my project is to learn me Haskell. I've procured the book Real World Haskell and am about halfway through it. RWH is a pretty good book but it could do with another editing pass. For example, the '$' operator is used without ever having been explained.
And I found an interesting paper The Genuine Sieve of Eratosthenes which shows that a common Functional Programming example isn't really true to Eratosthenes' original algorithm.
One form of the standard FP Sieve goes like this (in Haskell):
primes = sieve [2..] sieve (p : xs) = p : sieve [x | x <− xs, x ‘mod‘ p > 0]
The paper then goes on to show several FP forms that are true to the original algorithm.
I thought this would be a good learning exercise, so I coded up my own version of the Sieve in purely functional Haskell:
-- Find primes up to n primes :: Int -> [Int] primes n = drop 1 $ takeWhile (< n ) $ filter (/=0) $ sieve [0..] 1 $ ceiling $ sqrt $ fromIntegral n
-- Mark composites up to limit. All composite numbers will be set to zero -- by ANDind with a boolean list of multiples of n. sieve :: [Int] -> Int -> Int-> [Int] sieve a n limit | n >= limit = a sieve a n limit = sieve (a `land` (mask n)) next_prime limit -- Next prime will be next non-zero element in the list where next_prime = fromJust (find (>n) a)
-- Generate an infinite list of Booleans. False at multiples of n, starting at n^2 mask :: Int -> [Bool] mask 1 = True : mask 1 mask n = (replicate (n^2) True) ++ (rep n) where rep n = False:(replicate (n-1) True) ++ (rep n)
-- Merge together a boolean list and an integer list land :: [Int] -> [Bool] -> [Int] land (a:as) (b:bs) = (if b then a else 0) : land as bs land _ _ = []
This Haskell code is some of my first, so please be gentle with your comments.
The interesting thing here is the use of Haskell's lazy evaluation. Here, 'lazy' means an expression isn't evaluated until it's needed. For example, the Haskell construct [1..] generates an infinite list of integers. If you attempt to use the entire infinite list to, say, find all the odd integers, Haskell will happily comply: filter odd [1..] and will take an infinite amount of time.
If, however, you just take a finite set of the result: take 10 (filter odd [1..]) then Haskell will return only the first 10 odd integers. This is a powerful concept.
Jim on 12.27.09 @ 10:13 AM ET [link]
Saturday, December 26th, 2009
Rosetta Code
Rosetta Code is an interesting resource for programming language comparisons. The site poses programming problems and users contribute their solutions in their language of choice. The result is a nice side-by-side comparison of languages in various problem domains.
Jim on 12.26.09 @ 12:08 PM ET [ link]
Let me Google that for ya!
Has someone asked you a dumb question that they could have easily answered themselves with a visit to the planet's most popular search engine? Something like "What's the capital of Venezuela?".
Well, now you can thumb your nose in their face while providing the answer: What's the capital of Venezuela?.
All thanks to Let Me Google That for You. Simply type your dumb question into the lmgtfy.com page and it will generate a URL that you can send to your annoying friend. This URL will start a little animation then show the actual Google results.
Jim on 12.26.09 @ 10:59 AM ET [link]
|
|
Good Reads
|