Thoughts on writing code and prose

Welcome to CodePrinciples

27 January 2010

Thoughts on the iPad's screen size

Original Newsflash template

There are a few interesting things to note from this:

  • It's not widescreen, obviously.
  • You can't play full 720p video on the iPad. It might play, but it'll be scaled down. 480p will get scaled up.
  • Even a doubly-sized iPhone app won't fill the whole thing perfectly.

Which makes me wonder: why did they pick (a) the fullscreen aspect ration and (b) the particular resolution that they did?

I would imagine that it has to do with the fact that the iPad is clearly designed to be used in portrait mode. As many others have mentioned long before me, the orientation of the Apple logo and the home button both suggest that portait is the way to be for the iPad.

Let's be honest: a 16:9 aspect ratio in portrait is nearly twice as tall as it is wide. Even a 16:10 ratio feels skinny in portrait. While widescreen may be great (even ideal) for watching TV shows and movies, it's not good at all for, say, reading ebooks or other apps. The iWork suite would have been kludgy at those dimensions.

It doesn't look like Apple wants the iPad to be seen as "just a screen" when it's clearly so much more. For this device, I'd say 4:3 is a much better choice.

22 January 2010 [link]

Great piece on part of Apple's strategy [#]

The guy knows what he's talking about. Look:

"The point is that Apple isn’t just being contrary when it fights to keep its plans secret. If you announce a good idea a year before you can implement it, you had better be the only company in the world that could implement something that customers will think is a “good enough” version of what you promise. “Good enough” plus “cheaper” or “for sale sooner” is how the world got stuck with Windows. Apple has some precedent here. Enough said."

[visit link]

6 January 2010

Making progress on Newsflash themes

While developing Newsflash, I spend a lot of time... well, looking at it. The original theme that I threw together took less than 10 minutes for me to create, and it showed. It was a pretty ugly shades-of-gray thing, and I finally got fed up with it today and spent some time to create a better theme.

Anyone could tell you that I'm a fan of minimalism, and what I came up with was a grand showing of minimalism. If this doesn't evolve into the Newsflash default theme, it'll certainly be an alternative theme that I'll make available.

We went from this:

Original Newsflash template

To this:

A minimalist Newflash theme

And finally:

Revision two of the minimalist theme

What do you think?

2 January 2010 [link]

Showdown: The JavaScript Markdown engine [#]

This is brilliant. Somebody put in the time to port John Gruber's reference implementation of Markdown to Javascript. In modern browsers, it runs fast enough to give a live preview as-you-type, converting your Markdown to HTML exactly the same way PHP-Markdown or Markdown.pl do. Handy!

[visit link]

1 August 2009

Flash is the new IE6

Just a bit over a week ago, Adobe published a security advisory about a vulnerability in Flash Player (among other pieces of their software). Security problems happen all the time in the world of software, but there was a particular problem with this one. Adobe claims that 99% of the Internet has Flash installed. Some liberal estimates put the number of active Internet users at a billion and a half users -- that's a pretty huge vulnerable audience.

Well, this was the last straw for Kroc of camendesign, who finally got fed up with Flash and published a blog post challenging people to go Flash-free for a week. As he points out, "If you can?t go a week without something, you have an addiction."

I took him up on his challenge (more on that in another post). What I want to talk about here is the motivation behind boycotting Flash in the first place. And before I start, let me say this: I don't hate Flash. For a (very select few) number of uses, Flash is the best choice, and for those cases that it isn't, the alternatives aren't all in place yet. But we're getting there.

The problem

So what is the problem with Flash? There's really no shortage of problems with using Flash on the modern-day web.

1. Flash is a usability nightmare

I am a strong proponent of web usability. Usability is the practice of building websites in such a way that they'll be accessible to the widest audience, no matter what browser, type of device, or disabilities they may have. That said, some of Flash's worst usability offenses are:

  • Not everybody has Flash. What if a visitor to your site doesn't have Flash? In a lot of cases, they cannot even see your content. This defeats the whole point of having a website to begin with; isn't the whole point to offer content to your visitors? Sure, almost every PC has Flash, but no iPhone does. No Palm Pre does. And most other phones don't either.

  • Flash is proprietary, closed, not open-source, and controlled by one company. What if a big bug or security vulnerability is found in Flash, as happened earlier this month? We have to all sit around and hope for Adobe to fix it, and we're all open for attack until they do. That's in contrast to the open-source community, where code is generally peer-reviewed before a big release, and problems discovered after release can be fixed very quickly, within days and often within hours.

  • Flash almost always uses custom controls and elements. Which means that if a website is in Flash, all your browser sees is a box. Text-to-speech software can't read the text in a Flash applet because it's not text, it's Flash, and that's like trying to pronounce an image. It doesn't work. Your browser can't increase the size of text in Flash for visually-impaired users, because again, it isn't really text. What if you find a picture on a Flash site you want to save? Too bad, because it's not an image, it's Flash. Search engines have the same problem: you can't expect content locked up in Flash to be indexed by search engines.

And that's not all. Flash has a plethora of other problems too. Flash can be cool, yes, okay, fine. But also...

2. Flash makes users mad

Those annoying, flashy ads you see on some sites? Chances are they're in Flash, especially if they talk. It's gotten to the point where a lot of people just block everything in Flash, and temporarily allow things they want to see. Even if your users don't do this, they might think Flash content is an ad and ignore it (or worse, just leave your site).

Flash doesn't interact with browsers properly, so every browsing convention the user knows is shattered. The back button is useless, because Flash doesn't load a new page when it loads new content. Users can't bookmark something in Flash, because again, it's not its own page. Flash is not RESTful.

Because Flash doesn't load a new page when it loads new content, it generally needs to load all the content at once. This is why you get those horribly annoying loading screens when you go to a site that needs Flash. It sucks, I know.

The alternative

"But," you say, "I need Flash for fancy designs, effects, and animations in my website, and Flash games aren't Flash games without Flash!"

No you don't. Flash isn't necessary for fancy designs. CSS is an amazing thing if you learn how to use it, and it can pull off some pretty impressive things. You can put together some pretty crazy stuff just using CSS. And CSS3 is on the horizon; Firefox and WebKit (Safari, Chrome) already support a bunch of CSS3 properties. CSS3 is coming together as a fairly competent competitor to the visual effects offered by Flash, as it offers a lot of 3D effects that were never really possible before without Flash.

You can also use JavaScript to complement CSS if you need some really slick things done. Libraries like jQuery do an incredible job of making JavaScript-based effects (and some other fairly complex stuff too) very simple.

Like IE6 circa 2005, Flash's market share is unacceptable. The software is holding back the web from embracing standards, and open standards in particular. The web will benefit when sites are built using web standards instead of Flash, and adhere to usability guidelines.

7 May 2009

Weighing in on the future of journalism (and a few notes on the Kindle DX)

Amazon's just gone and announced a new Kindle. Their pitch with this one is that it's fantastic for reading two things in particular: textbooks and newspapers. This is very interesting to me, but I think there are gaping holes in the business model for each. Particularly with newspapers, I don't think the Kindle delivery method is actually going to get them anywhere.

Quick unrelated side note: I find it odd that textbook writers actually want to sell their stuff on Kindle with so much of a price cut. I must admit that I do not own a Kindle (though I did play with one for a second a while back) but I find it hard to believe that college students would use it like Amazon is pitching. What if I want to be comparing two textbooks? It seems cumbersome to have to switch back and forth between them. What if I wanted to make a copy of a page from a Kindle textbook? I'd guess it wouldn't work too well (though interestingly, I don't see any record of someone actually sticking a Kindle in a photocopier -- someone should try!). My point here is that I don't see the Kindle and textbooks as particularly fitting partners. UPDATE: Looks like Wired feels the same way, and hey, they've even quoted a few Twitter users--remember that.

But that's beside the point. The most interesting thing about Kindle DX pitch is that a lot of is wondering whether the device will save newspapers. It won't. Kindle is a specialized device, built for book-reading, and it's very very good at this. But the layout of a newspaper is very different from that of a book, and Kindle (even Kindle DX) isn't really designed to handle it. Amazon may choose to work towards fixing this in future DX revisions, but I can't see it flying. Adam Ostrow at Mashable even admits that the Kindle is at least a couple years away from making an impact on the newspaper industry, and by that time it'll be too late. I think I could count on two fingers the number of years it'll take before print journalism as we know it collapses.

The problem with journalism as it stands now

No, the true fact of the matter is that the problem is much deeper than that. Newspapers have built an industry on the printing press for the past 400 years, but in reality print is not a very good delivery system for news. Think about it: a "current event" has to be processed, printed, and delivered before anybody will know about it. That's a pretty large turnaround time.

I think in a few hundred years, people will look back and see paper as just a holdover until journalism's true medium appeared. The Internet is the perfect news delivery system: it's first-person, it's always available, always up-to-date, and most importantly, it's fast. Not just fast, it's instant delivery.

And the Internet is causing all sorts of headaches for print newspaper executives who've gone to school and been educated on 400 years worth of newspaper knowledge that's suddenly not very valuable. They've learned that journalism is a linear process that looks something like this:

  • Find an interesting event
  • Research the interesting event
  • Write a story about the event
  • Send story to editors

I suppose this could be expanded, if you were to include the delivery system as well, to include these:

  • Lay out stories in a visually-appealing way
  • Send layout to publisher
  • Print hundreds / thousands / millions of copies
  • Distribute physical copies all over the city / country / world

This whole thing is messy and takes a lot of time. The Internet is opening this process up to the masses as well as making everybody a participant. Newspapers have been trying to become more interactive forever, with such things as "letters to the editor." Specifically, I see two major ways the Internet will change journalism.

The future-era source of news

Right now, the source of news for most people is the newspaper. Or at least it looks that way on the surface. The true source can be traced further back than that. It can't be in the newspaper until a reporter writes an article about it. The reporter can't write anything until he knows about the news. The reporter won't know about the news in a timely fashion unless he goes to the scene and does research. Generally the reporter does two things as part of this research:

  • Asking people what happened and what they think about it
  • Recording the reporter's own insights on the story

So, in the old model, the reporter is the source of news. This leads to in-depth, informative stories that make the reader understand, at the cost of being timely.

Under the new, Internet-centric model, the reporter is eliminated. The source of news is decentralized, because the news is "reported" by the participants. People are already starting to break news on services like Facebook and Twitter, and with the increasing prevalence of mobile Internet-enabled devices, this will only become more common.

Emily Knorr, a junior at Timpanogos High School and a participant in the school's journalism program, sees the potential for this type of reporting. "I believe that people will get their news from the Internet, from each other, on [sites like] Facebook," she says. "I think everyone will be journalists.

It's already starting to happen. I think Twitter (and Twitter-clones to come) is poised to become the next generation source of news. When U.S. Airways pilot Chesley Sullenberger landed his Airbus in the Hudson, Twitter was "on the scene" way before anybody else, simply because with Twitter, the public is the reporter. Armed with just his iPhone, Janis Krums explained the situation and even included a picture within minutes. I can't help but wonder what 9/11 would have been like if it happened in the current age of technology.

I need to clarify here that the death of print journalism does not necessarily spell the death of reporters. We'll always need reporters to organize the facts and attend pre-planned events for the rest of us. Liveblogs are becoming a popular reporting method on the Internet, and I think they're very effective. They provide specific, clear information very near to real-time and also give people who don't want or have time to do their own research a place to go for the (e-)Reader's Digest version. But liveblogs require reporters. Engadget, for example, had to send out some reporters to Pace University in New York to cover the Kindle DX launch.

The distribution of news

On the Internet, the distribution is personalized. If I want my news sent to my phone in real-time, I can have it texted to me. Twitter offers SMS delivery of a person's tweets. If I want to sit down and read all my news, I can hand-pick what type of news I'm interested in and have it all waiting for me in one place with RSS.

In the future, news you want will come to you. But before that can happen, it's got to be processed somehow. At 140 characters, Twitter updates aren't very great at portraying details. I imagine the future of journalism will be mostly monitoring the Internet for new stories to talk about. As services like twitter become more common and more utilized on mobile devices, details about anything and everything will already be online. The only thing that's left is some organization. This is just about what Wired's done with that above-mentioned Kindle-DX-and-textbooks piece: they've quoted Twitter users--no need to even step away from the computer.

Say you want to run a news website in this new generation. Instead of having an army of field reporters, all you need to do is find a good way to parse through this flood of online reporting and organize relevant details into some semblance of an article. Twitter Search already provides an interesting way to watch the flow of specific news in real-time, and this is where news will come from. Just for fun, I found a popular twitter term (which happens to be #jonaslive at the moment) and saw that it took about 15 seconds for over 100 tweets to be published. That's a lot of perspective.

So for your news website, you'll take these incoming waves of information, find enough details to clarify what's going on and to satisfy your audience, and put them in an article. You publish it to your site, and people use your revolutionary SMS Reporting feature and top-selling iPhone app to find out about it within minutes. With the Internet, we can cut all the time out of the last-generation delivery system. The Internet-centric system consists of one step; after the author sends their writing to the "editor:"

  • Instantly displayed on a website and pushed to readers through Facebook, twitter, RSS, text messages, etc.

In summary, the journalism industry is changing fast. No longer will one group manage the end-to-end system of producing news. Instead, the people who are already involved will be the reporters, and the whole business behind journalism will be distribution. If you find a clever way to deliver news to your audience, you succeed. Maybe you have a neat algorithm for automatically figuring out what news a user wants, like Pandora does for music. But if you copy everyone else, you fail.

On the Internet, there only needs to be one market leader; geographic boundaries do not create markets to the same extent as they do for the print industry. It's the worst fear of newspaper execs, but it's how the future will work. Most of them will not survive the transition; there's not enough room on the Internet for thousands of news services.

So here's some advice to newspaper companies: accept your fate before everyone else does and get ahead in the game. It's the only way you'll have a chance at preserving your importance when the newspaper dies. The five or ten to get it right quickly will see huge increases in audience as they go global, but everyone else will die under the pressure.

16 October 2008

Unibody MacBook Pros could be Apple's first quad-core notebook

Apple's new MacBooks and MacBook Pros are fairly impressive on a variety of fronts, but perhaps the updated graphics cards are the most exciting part of the package.

The new notebook has been graced with the presence of NVIDIA's newest card, the GeForce 9400M a whole day before its official release (that's what you get when you're Apple). They say the thing is up to five times faster than the practically lethargic Intel GMA3100 included in the old models. The MacBook Pro also contains the 9400M, which is a nice addition, but hardly worthy of being the GPU of a Pro notebook on its own. To fulfill that role, they've included the higher-end GeForce 9600M GT (see endnote).

The Unused GPU

Having a nice, fast GPU is all well and good if you're playing games, but the vast majority of MacBook Pro users' work doesn't use the GPU hardly at all.

Even worse, the unibody MacBook Pros can only use one GPU at a time, regardless of what you're doing with it, and requires a fair bit of sacrifice to switch between them. Perhaps you don't mind having to log out to switch GPUs, but it doesn't really demonstrate the seamlessness that Apple seems to aim for. I would expect this to change in a future Leopard software update, however.

As great as such an update would be, it still would only allow you the use of one GPU. The really impressive thing will be when Apple allows you use of both GPUs at once in some fashion of Hybrid-SLI. While there's always the chance that this will be enabled in Leopard, I don't have much hope of this happening before the release of Snow Leopard next year.

I say this for a couple of reasons. Number one, I'm guessing it requires a rather extensive overhaul of Apple's window manager and graphics subsystem to use two GPUs at once and actually increase performance. They're already doing extensive overhauls of everything else for Snow Leopard, so that's a great opportunity to improve this as well.

UPDATE 10/23: MacRumors claims to have received information from NVIDIA confirming that the MacBook Pros are capable of doing this (a feature they call GeForce Boost). They also confirm that the machines are capable of switching between on-the-fly, which, as they say, should not be surprising since the same functionality is available under Windows. I have absolutely no doubts at this point that both of these features will be available by the time Snow Leopard rolls around.

OpenCL, Grand Central, and the GPU

Number two, and most importantly, Snow Leopard includes a technology called OpenCL, which (theoretically) allows developers and OS X itself to offload queued processing to the GPU. GPUs tend to be significantly faster than CPUs for a relatively select group of tasks, but these tasks should see gargantuan performance leaps when running under Snow Leopard.

With OpenCL offloading processing tasks to the GPU, a lot of possibilities start opening up. Apple's also pitching a Snow Leopard technology called Grand Central, which chops up OS X's own processing tasks for running on multiple cores, and also has provisions for allowing developers to access the same power.

Combine OpenCL and Grand Central into some multicore-GPU-supporting technology, and suddenly Snow Leopard has one more processing unit to work with. Granted, this new core may not be as fast as the CPU for some tasks, but is also potentially much faster than the CPU for others.

There was a lot of negative commentary on AMD's decision to produce triple-core processors; even I thought it was a rather counter-productive strategy. But come Snow Leopard in 2009, Apple will be enabling a third core on a whole lot of its Macs (pre-October-2008 non-Pro MacBooks excepted).

The MacBook Pro is Apple's first Mac with two GPUs, and will give OpenCL twice as many processing units to work with. This gives a total of -- count them: two cores in the Core 2 Duo, one more in the NVIDIA 9400M, and yet another in the 9600M GT. Four processing cores in Apple's current-generation notebooks.

Granted, the extra two may not be very useful in every situation. But neither GPU is a slouch, and either will provide huge benefits in a lot of graphically-related situations. Generally speaking, perhaps technically speaking too, and for all practical purposes, the Late 2008 MacBook Pro has four cores. Apple's first quad-core Mac notebook.

ENDNOTE: Widely accused of being a repackaged 8600M GT, Notebookcheck benchmarks claim the 9600M GT is 50% faster than the last-generation 8600M GTs on 3DMark06 and 43% faster on 3DMark05. It also includes new technologies like PureVideo HD (that Apple may or may not be taking advantage of) and is manufactured wth a 65nm process, compared to the 80nm process of the 8600M GT. I don't know much about GPU benchmarks, but that seems significant enough to me.