Randomness Posts

This tag is mostly just a collection of random posts that don't really follow any theme.
PHP
Over the years, I’ve seen a number of blog posts relating to common questions that should be asked of programmers. Obviously, this is going to depend on exactly what position you are hiring for, but there are some good “gateway” questions that can be used to determine whether or not an applicant you are interviewing can … well … even program at all. If they even have the mindset that makes a good developer. A common one I’ve seen tossed around is Fizz Buzz. The challenge goes something like this: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”. Now, to anyone who even has a basic understanding of programming, this is super simple to solve using a modulus operator. But apparently many people applying for even entry-level development jobs cannot solve this problem. According to the article linked above, even one “senior developer” took 15 minutes to solve this problem. Earlier today, a friend posted something on Facebook that inspired what I think it another good, intermediate to difficult level programming question that also looks for pattern recognition. The relevant part of the post began by stating: “This year July has 5 Fridays 5 Saturdays and 5 Sundays.” There is the question! It would go something like this: The month of July 2011 has 5 Fridays, 5 Saturdays and 5 Sundays. Calculate the next 50 times there will be a month that has 5 Fridays, 5 Saturdays and 5 Sundays. Woah, so how to go about solving this problem? Well, look at a picture of July 2011. Notice something interesting about this month in relation to the question? This month has 31 days (the most any month can have), begins on a Friday and ends on a Sunday. And that’s the solution! It’s any month with 31 days that begins on a Friday! With this in mind, it’s pretty easy to come up with a PHP solution: <?php $count = 0; $num_found = array(); while(count($num_found) < 50) { $count++; $ts = strtotime("$count months"); if(date("t", $ts) == 31 && date("N", strtotime(date("Y-m-01", $ts))) == 5) { $num_found[] = date("F Y", $ts); } } print_r($num_found); ?> Note that I make use of PHP’s strtotime function, because it is the Swiss Army Knife of date manipulation in PHP. This would need to be adapted for use in another language. So now tell me: what are some other questions you’ve been asked or asked in an interview?
Read More
Apple
So today, out of nowhere, Xcode 4 finally landed as an official release. After seemingly forever in beta, and me quipping more than once about it’s similarity to Duke Nukem Forever, Apple finally pulled the trigger and released it. But something changed. Xcode now has a price. And that has left me, as both a Mac user and a Mac developer, with a lot of questions. It’s either $4.99 if you’re not a registered, paid Apple developer, or free if you are a registered, paid Apple developer (with all its $99 per year price tag glory). Supposedly there’s some crazy accounting reason that they have to charge for it. This, of course, leaves open the possibility that Xcode will soon be free again once OS X 10.7 arrives. But, it also leaves open the possibility that Xcode will no longer be distributed with OS X and will always have a price tag. It may not even stay $4.99. It may be $49.99 or $499.99. There are additional questions, too. Does this mean that Apple is still distributing Xcode as a bundle with GNU GCC? Because there are things (such as MacPorts) that rely on the underlying foundation provided by the developer bundle that don’t actually use Xcode. Before, those were completely free. Now, they cost $4.99 unless they have split the underlying compiler from the IDE. And if they are still distributing it with GCC, that leads to all kinds of crazy interesting licensing questions. But I think the worst part is that there is now a barrier to entry, however low, to being a developer on a platform that is already a minority in market share. I can’t understand how Apple potentially believes that it is good and right to trade short term profits for long term growth in the number of potential developers. For the future of the Mac platform, I sure hope this isn’t their line of reasoning. So, let me tell you a little story. My first dabbling in programming came courtesy of QuickBASIC back in the MS-DOS and Windows 3.1 days. This was the late 80s or early 90s, so I would have been 10 or 11 at the time. I stumbled across the Qbasic environment included with MS-DOS by accident and found Nibbles. And, after playing it, I discovered that I could change things by making changes to the strange text presented on the screen. I could change colors and speeds. But it would be a couple of years before I really understood what I was doing. When Windows 95 came out (and along with it, Visual Basic 4), I talked my parents into getting me a copy. I don’t remember how much it cost but it was probably a lot because it was one of the few Christmas presents I got that year. But boy did I run with it. I’ve periodically felt guilty over that expense because I didn’t actually make anything really useful with it, but it was instrumental in furthering my education. Now I could do things on my computer far beyond what poor ol’ Qbasic was capable of. So I wrote lots of silly little programs. I put together a “family newsletter” one year that was installed and ran as a piece of software. I was pretty proud of that. I even wrote some software for my high school as part of a software development and AP Computer Science courses. Eventually, I would move on to other things. Other versions of Visual Basic, Java, C, a brief foray into LISP and Forth-based languages for programming MUDs, and eventually web programming. First in Perl, then in PHP. I even landed my first paying programming job while still in high school, writing applications for a local transit contractor. At first, these were Visual Basic applications. But by the time I left (August of 2000) everything was going to the web and so were we. But I can trace everything - my entire career, and my consuming passion for software engineering - back to Qbasic and Nibbles. A silly little game about a block snake, and a free development environment included with the operating system. Had I not stumbled on Qbasic and Nibbles, there’s a chance I would never have been a developer. This is not about $4.99. I spend more on coffee in a week than that. My worry is about that 11 year old kid out there somewhere who may never get the opportunity to stumble across Xcode or the sample applications in /Developer and realize the raw power they possess. This is an area where Apple, a company with billions in cash on hand, should be happy to show a loss. It would be to the benefit of their platform, both now and in the future. One of the great benefits of the Mac platform has been it’s low barriers of entry to developers. Sure, one could argue that the hardware is more expensive (and I could counter-argue that, for the quality of the equipment you are getting a bargain), but the development tools have always been freely available online and included with the machine. You could dabble in programming to your heart’s content. Sure, if you want to put something in the app store(s), you had to pay for admission, but there was nothing stopping you from getting all the way to that point, or even distributing your creations on your own. But this new trend of charging for the development tools - even if it is a paltry sum - sends, to me, a worrying signal about the course Apple intends to tread. They’ve now moved the gate from the last step to the first step. It’s a course that Microsoft, as above, once tread. Microsoft? They now give away a version of Visual Studio for free.
Read More
Randomness
I sit here watching Egyptians partying in Tahrir Square on the Internet. Mostly because Al Jazeera is the only group that hasn’t just totally halfassed the coverage of what has unfolded a half a world away. However, I did flip on CNN to watch some coverage on there. "No dictator, no invader can hold an imprisoned population by force of arms forever. There is no greater power in the universe than the need for freedom. Against that power, governments and tyrants and armies cannot stand." G'kar, Babylon 5 They interviewed several of the protesters and organizers. All of them young - even relative to me, and I ain’t exactly an old guy - and all of them taking the time to actually thank*for making the revolution possible. What were they thanking? Facebook and Twitter. One guy even said he hoped he could meet Mark Zuckerberg and thank him personally. "People with a passion can change the world for the better." Steve Jobs It occurs to me that these are the Digital Natives coming of age and taking power. To these people, the Internet is an integral part of their life, and have no memory a time before using the Internet to communicate. They think nothing of talking to people around the world. They’ve been exposed to worldwide ideas. Social and political borders mean nothing to them. They’re all old ideas. The ideas of their parents. We are just now beginning to grasp the social ramifications of a worldwide network that connects all people. The Internet is, for lack of a better analogy, like a virus that infects the world’s population. People can access the world’s repository of knowledge, and talk with people around the world with minimal effort. They can organize with minimal effort. This communication infects them with ideas of freedom and a desire to communicate. Now, to be sure, the Internet didn’t get out there and protest. The Internet didn’t physically stand in Tahrir Square and chant protests against Mubarak. The Internet didn’t take gunshots for freedom. But the Internet and social media did provide the tools and the framework in which the revolution could be organized. People will always be the ones taking action. But the ability to communicate - quickly, efficiently, and massively, in such a way that was unthinkable twenty years ago - is going to completely reshape the way the world works going forward. Iran was the warmup. Egypt and Tunisia are the warning shots to nations around the world: neglect your people at your own peril. Now, as for Egypt. The optimist in me hopes for a democratic republic. The pessimist in me fears a military dictatorship or, worse, an Islamic dictatorship. I guess we’ll know soon enough.
Read More
Randomness
Those of you who follow me on Twitter might have noticed me railing against a company called FlightPrep. You may be wondering, what exactly is the big deal? The short of the story is, there were a bunch of websites out there dedicated to flight planning. Some of the best ones (SkyVector, Flyagogo, NACOmatc and, best of all RunwayFinder) allowed you to plot a course overlaying a VFR Chart the same way you would in Google Maps. You could modify your route simply by dragging it about, and click airports along the route to get current weather reports. It was kinda like Google Maps for preflight intelligence. Well, along comes this company called FlightPrep, who decided they weren’t getting rich enough (just ignore the owner’s $500k boat). So they convinced the USPTO to give them a patent on, bluntly, drawing digital lines on a digitized chart. The filed for the patent in 2005 (after a number of the sites above were already online), but used legal sleight-of-hand to get it backdated to 2001. Eventually, after a number of rejections, they were able to find a friendly clerk and were awarded the patent. They then immediately lawyered up and started going after all of these free flight planning websites, many of which were simply hobbies of some pilots who also happened to know how to program. They requested that these sites “license the technology” (what a ludicrous thing to say, being that the sites pre-dated FlightPrep’s patent) or face lawsuits with damage claims of $149 per unique IP per month. So what happened? SkyVector settled and “licensed.” NACOmatic, Flyagogo and RunwayFinder all shut down under threat of lawsuit. They’ve also gone after FlightAware, Jeppesen and the AOPA with no success, so far. It’s pretty clear that, instead of innovating, they’re litigating. Rather than develop some radical new technology, they’re abusing the patent system in an attempt to corner the market. Bluntly, I’m pissed because they robbed me of a tool (RunwayFinder) that I loved and that was highly useful for a student pilot. But, general aviation is a small community, and the backlash against FlightPrep has been a beautiful if small-scale example of what happens when you abuse your target market. Within the course of a week, they’ve become a pariah and the most hated company in general aviation. They had to close off their Facebook page because it was being overrun with people voicing their opinion, and their products are receiving highly negative reviews in all markets. But, while this is all great, it doesn’t bring back RunwayFinder. Even though Dave from RunwayFinder has decided to fight back, he faces a long uphill climb to have this asinine patent thrown out. In the end, it’s just sad. As I said, GA is a small community where nobody is getting rich. We’re all supposed to be on the same team.
Read More
Apple
Two days ago Apple announced Ping: a social network geared towards music sharing. And a bunch of iPods too. Personally, I was more excited by the new AppleTV (I have two of them and absolutely love them) but more on that later. This is about Ping. My thoughts on **Ping: Apple’s first real attempt at social networking reminds me of Google’s countless attempts to get into the social networking space: they’re like that guy that shows up to the party really late - I mean beyond fashionably late - when the party is already over and everyone else is already drunk and thinking about stumbling across the street to IHOP or Taco Bell. They say they were at the library studying and now they want to go out and drink, but the keg has floated, the bars and liquor stores are already closed and all you want to do is eat a burrito supreme and find some sofa to pass out on. Ping is a good first start, but it has some problems: What is the target here? Am I supposed to follow people or artists or both or what? And what are they supposed to do? All this feels like is Twitter or Facebook + iTunes. The people I’m following can share messages and pictures? Yep. Twitter in iTunes. I can like and share and post comments? Yep. Facebook in iTunes. Why not allow independent artists into the fold? Some of my favorite artists (such as Matthew Ebel - check him out if you love piano rock) are independent. Right now there are like 10 artists you can follow, and that Lady Gaga is one of them makes me want to break something. The only ones on there I’m remotely interested in following is Dave Matthews Band and maybe U2. I can’t access it in any way other than in iTunes. No web access. While this means I can fire it up myself on my computer and laptop, and (currently) on my iPhone via the iTunes application, I can’t check Ping at a friend’s house. I can’t go to the Apple store and check Ping. Everything has to go through iTunes, and this absolutely cripples it. Think that’s overkill? Go to the Apple store and watch for  15 minutes how many people walk in and use one of the computers to check Facebook. I can only “like” and “share” content I purchased from iTunes. I have purchased 58 songs from iTunes over the years, out of 3,621 songs in my library. About 1% of my library is available. If Apple fixes these (and other, more minor) problems, Ping could be really cool. The problem is that these aren’t code fixes. They’re not something they can test and roll out a change for. These are conceptual problems relating to what their idea of Ping is versus the what the rest of the world is going to use it as. The question is, will they be Google and throw this out here, not maintain it and mercifully kill it a year later (a la Google Wave and the impending death of Google Buzz), or will they adapt and change it to better suit the needs of the public? Because that’s the thing about social networking: you have to embrace the users thoughts, opinions, and ideas. It’s a lesson digg just learned the hard way and a lesson that frankly, given Apple’s reputation as wanting to control everything, I don’t see them embracing. As a side note, I will however salute Apple for not giving into Facebook if the rumor is true. Facebook plays fast and loose with people’s information, and I really don’t like how it seems to have become the de facto standard for social network usage (and thus the reason you can comment with your Facebook login). That, and Zuckerberg. I hate that guy. Still, Ping is yet another player in this social networking space. A space that is becoming increasingly full … Social Overload I’m already Facebooked, Myspaced and Twittered. I’m LiveJournaled, Wordpressed, and Youtube’d. I’m Flickr’d, LinkedIn’d, Vimeo’d, Last.fm’d and Gowalla’d. I’m on any number of dozens of message boards and mailing lists that predate “Web 2.0” and the social networking “revolution,” and I follow nearly 100 various blogs and other feeds via RSS. They’re on my desktop, on my laptop, on my tablet and in my phone. And now, apparently, I’m Ping’d as well. Le sigh. Now, to be fair, I don’t check all these sites. I last logged into Myspace about 9 months ago. I last used Gowalla about a year ago. I usually only look at Youtube, Flickr or Vimeo when I need something, and haven’t updated a LiveJournal in about 3 years. But at what point does all this interaction - this social networking - become social overload? Are any of these services adding value to my life? And at what point does a social network - Ping, in this case - simply become yet another thing I have to think about and check? Or will it become yet another service I sign up for, try for awhile and ignore?
Read More
Randomness
Newsweek, in 1995, published an article by Clifford Stoll titled “Hype alert: Why cyberspace isn’t, and will never be, nirvana.” Well, now it’s 15 years later. A relative blink of an eye. Hell, I can remember what I was doing back in 1995 - a kid playing with this newfangled thing called “the Internet,” that very few people understood but some visionaries had the foresight to realize was going to completely change the world. Let’s see some of the areas where Stoll got it absolutely wrong: “The truth in no online database will replace your daily newspaper, no CD-ROM can take the place of a competent teacher and no computer network will change the way government works.” Pretty much every newspaper has some online presence, from the largest New York Times publisher to the smallest hometown O-A News. Every instrument of government is now connected to the Internet, and contacting my representatives is online, making it easier than ever for them to ignore me. He is correct that no CD-ROM will ever replace a teacher. Although we don’t use CD-ROMs anymore. But while all this technology is great, instruction will continue to be the domain of humans for the foreseeable future. However, technology certainly makes instruction easier and more fun. Yet Nicholas Negroponte, director of the MIT Media Lab, predicts that we’ll soon buy books and newspapers straight over the Intenet. Uh, sure. Amazon.com. Barnes and Noble.com. Kindle. Nook. iPad. Buy wirelessly over the air anywhere I am. Then there’s cyberbusiness. We’re promised instant catalog shopping–just point and click for great deals. We’ll order airline tickets over the network, make restaurant reservations and negotiate sales contracts. Stores will become obsolete. So how come my local mall does more business in an afternoon than the entire Internet handles in a month? Even if there were a trustworthy way to send money over the Internet–which there isn’t–the network is missing a most essential ingredient of capitalism: salespeople. Yup. All that has happened. Moreover, I’ve done almost all that in just the last month! I buy all the time online. I haven’t bought an airline ticket any other way than online in years. Last weekend, when we went out to Melting Pot, I made our reservation online. And while stores are not yet obsolete, there are certain times of the year - Christmas - I won’t go anywhere near a brick and mortar establishment. The crowds are terrible. But why should I, when I can do it all online and have it delivered to my door? And the best part? I don’t have to deal with pushy salespeople! I’m not a moron - I know what I want and I can use the gasp Internet to research! Computers and networks isolate us from one another. A network chat line is a limp substitute for meeting friends over coffee. I hear this one all the time, for years. I have one word: Facebook. Right now, thanks to the Internet, I am more connected to the lives of those around me than at any point in my life. And while he is correct that it isn’t a substitute for human contact, my social circle is now larger than at any other time ever. It makes it easier to arrange that human contact Granted, we have luxury of 20/20 hindsight, but when someone talks about something “won’t” happen in the future, you should always think of this. Just because it wasn’t there in February of 1995 doesn’t mean that engineers wouldn’t solve the problems and get there. The surprising thing is that it happened so fast! Moreover, if the innovators of the 90s had listened to luddites like Stoll (and lest you think this piece is ironic, he wrote a book that, no shit irony, is available at Amazon.com) we might not have had the complete information revolution that we’re still living through. So never let anyone tell you you can’t do something. Stick with it, and look forward to seeing egg on their face in 15 years.
Read More
Randomness
The computer on my desk has one TERABYTE of space, and it’s almost half full - ten years ago I didn’t even had a gigabyte of space in my main machine. I carry a computer … in my pocket … that I can use to surf the web anywhere. No wires. And I can use my pocket computer to show pictures of our vacation half a world away to a friend over a dinner of seafood. We’re hundreds of miles from the coast. And I can use this same device to call around the world at any time. In a few months, I’m going to get on an airplane and fly from my home in Alabama to London. I’m going to FLY. Through the air. And I’m going to be there in a little over 10 hours. A hundred years ago to get from London to New York took like two weeks via steamship, and then you had to travel by train and horse carriage. It could take a month or more to travel that distance, but I’m gonna do it in 10 hours. When I was a kid, our TV got 3 channels on an old 19” TV that took minutes to warm up. My TV today has close to 500 channels, all of them perfectly clear and some of them in beautiful high-definition. Oh yeah, and it’s 42” wide, less than the width of a ream of paper, and turns on almost instantly. I never go to a bank anymore. My paycheck is electronically deposited to a bank that has one physical location … in Texas, more than five hundred miles away. And if for some reason, I do have to deposit a check, I can scan them in at my house and send them by computer to be instantly deposited. People, welcome to the future. We’re here. And it’s just going to get cooler.
Read More
Randomness
I grew up in the 80s, against the backdrop of Michael Jackson’s music. I remember my parents listening to Thriller, Billie Jean, and Beat It. In many ways, Michael Jackson defined music in the 80s.
Read More
Microsoft
So I see Microsoft’s is attempting to rebrand the old Windows Live Search as bing.com. The commercials on TV are advertising it as a different type of search engine - a “decision engine.” Yeah, when I heard that, I, too, wondered exactly what a “decision engine” was. But the commercials are clever and somewhat funny to anyone who has ever spent time searching through hundreds of results for a single missing piece. But where’s the meat? My coworker Brian, a few weeks ago, provided a great example of how this claim of being a “decision engine” is kind of a joke. And it can be summed up in a single sentence: “How big is the sun?” Maybe now you’re confused about what I’m talking about. What does the sun have to do with search engines? Well, try plugging that sentence, word for word, into your favorite search engine. Our of curiosity, I ran this search on a number of top and up-and-coming engines to see what they returned. Google is obviously the 900-pound gorilla in this space, so they’re a logical place to start. When you ask Google “How big is the Sun?” Big Brother Google replies, right at the top “Mass: 1.9891 ×1030 KG 332 946 Earths,” with most of the results relevant to the question at hand. In fact, all but two of the results were directly relevant to the question asked. Yahoo didn’t return a nice little piece of math like Google did, but all but one of the search results is _directly _relevant to the question asked. The only result that wasn’t relevant was that VH1 has some videos by a band called Big Sun, but that was torwards the bottom of the SERP. The newcomer Wolfram Alpha, which bills itself as a “knowledge engine” gives you a simple result, 432,200 miles, along with a handy formula for conversion. Not a traditional search engine, but closer to a “decision engine” than Bing … And finally, the “decision engine” Bing. So how does the vaunted “decision engine” handle knowing how big the sun is?It doesn’t. The first result is a garden furniture store in Austin, Texas. The second result is an Equine Product Store in Florida. The third was pictures of the sun from the Boston Globe - okay, that one was close. The next results are a realty company in Florida and an athletic conference. Only then, six results down, do we get into the meat of the question. Look, it’s easy to hate on Microsoft. It’s no challenge anymore. I, personally, am not exactly a fan of Microsoft, but I’m hardly an enemy either. At worst, I’m indifferent. And, as an aside, I really feel sorry for the poor guy they send to the OSCON keynote every year who literally gets hammered for no good reason by what can only be described as nerd rage from the questioners. And yet every year, they come back with more money and more people. I almost posted an entry about it last year. It was really kind of sad to watch. Anyways, the point is, there are some things that Microsoft _has _done well. Office? Great productivity suite. Windows 7? From what I’ve seen, it looks pretty good. The XBOX and gaming units at Microsoft do gangbusters. But it just seems like they’re irrationally pursuing this search thing, out of spite, at this point to the detriment of the rest of their business. Considering that bing doesn’t appear, at the surface, to be any different from Windows Live Search in terms of its usefulness (that is to say, not), Microsoft is throwing tons of money in the form of development and marketing to something that just isn’t very good when they could be focusing on the core parts of their business. But, then again, I’m not Ballmer.
Read More
Randomness
I’m sure many of you have been following what’s been happening in Iran, right? Or maybe you haven’t because, like often happens in international events, the American media has dropped the ball in the most epic of fashions. And I’m talking Ed Scissum (God bless him) fumbling deep in Bama territory to give Auburn the win in the ‘97 Iron Bowl dropping the ball. It’s been that bad.
Read More