Tuesday, December 30, 2008

Friday, December 19, 2008

Passion and fulfillment

Interesting perspective. Fulfillment is an interesting thing to contemplate. It seems that goals don't make happiness: once you achieve your goals, that's it, there is no infinite pleasure after that.

Think about it: a lot of people think they'll be happy if only they had a lot of money. What they don't realize is that they do, actually, have a lot of money, as well as many other things they take for granted, if we compare them to, say, someone in a civil war zone in Somalia. And yet, these privileged people are not necessarily happy.

The idea of dirty but fulfilling jobs demonstrates that, more importantly than aiming to make money, is the challenge of "now".

Thursday, December 18, 2008

Wednesday, December 17, 2008

Dry Routing

Clever. I'm surprised to see that it's possible to do annotations in PHP.

Thursday, December 11, 2008

Wednesday, December 10, 2008

Visual Event

This looks useful. Assuming you use JQuery, YUI or Mootools.

Web 2.0 is dead? Says who?

The list of fastest rising searches worldwide from Google Zeitgeist shows some unfamiliar searches: tuenti, nasza klasa and wer kennt wen.

Guess what: they're all social networking from different parts of the world. Clicking through some of the countries also show other social network sites being prominent: orkut in Brazil and India, facebook in several other countries.

Monday, December 8, 2008

When Linux fails

Nice and down to earth article.

Native Client

This looks very interesting. If we can bind C code to the browser, that probably means we can also run Python, Ruby and a whole plethora of other incredibly cool stuff.

WoW authentication

Damn, they beat me to it.

Give and take, baby

Well said.

e-commerce woes

For future reference.

Friday, December 5, 2008

Music plagiarism

Apparently there's a lawsuit over this.

I don't know about you, but I think expecting every artist to know about every riff from every other artist in the world is a bit ludicrous.

Thursday, December 4, 2008

typeof

This is a bit overkill for my taste, but I gotta say the "isn't" construct is pretty clever.

Python 3 is out

Ooh.

Wednesday, December 3, 2008

Now is not the time to learn functional programming

I've been seeing tons of stuff like this lately. Here's the basic premise: I say that functional programming is the next big thing. I drop some names like Scala, Haskell and F# to sound like I know what I'm talking about. I mention concurrency. Then I proceed to show you an example of fibonacci or some other equally wiki-able piece of code. Slashdot effect ensues. Or so the story goes.

I don't buy into the functional hype for one reason: it doesn't solve any widespread problems. Look at why C got popular: assembler was hard. Java: memory management was hard. PHP: REST was hard. Maybe not hard for you, but it's hard for a lot of people.

Functional programming per se doesn't abstract away anything gory. If I have a list that two processors want to update at the same time, it's not FP that will magically make everything work, it's the implementation of a locking mechanism that will.

The reason why I think it's good to learn FP (and not necessarily *now now NOW*) is that it allows you to reorganize code into something that resembles human languages more, not because someone that never wrote (and more importantly, maintained) concurrency stuff in FP said you should learn it.

Tuesday, December 2, 2008

Friday, November 28, 2008

Climate change

I've been seeing quite a few of these types of articles lately.

I find it a bit strange that a lot of people even have opinions on climate change at all: it's something that we simply cannot control - and by that I mean this: what have you done today specifically for the sake of attempting to change global temperatures? Yesterday? The day before? Nothing. That's what.

Some say economists don't like voting because they know that, statistically speaking, their one vote will not win any elections. They are right in one important sense: the weight of people's actions varies per person. Al Gore and environmentalists had a lot of influence in what is being done today about global warming, just like people who worked on election campaigns and news agencies had more influence on elections than the average Joe. You and I haven't done anything compared to that. Voting for a new president really doesn't count - the resulting policy would be the same regardless because, realistically, there are far more people convinced by political/scientific/pseudo-scientific propaganda than there are people willing to vote differently due to environmental ideology and their own research. Besides, the policy doesn't change because one or another layman voted for the green party. It'll be whatever the world leaders decide. Sure, there's lobbying, but you aren't doing it, which brings us back to the point that a few people's actions weigh differently by several orders of magnitude.

What I think we need to realize is that not wanting to die from a phenomenal ecological disaster is not the same as caring about global warming. Caring means doing an extraordinary effort to accomplish something. Talking about an idea that we're not comfortable about (e.g. dying in agonizing starvation) is not effort, it's simply insecurity.

What matters

What I'm saying is that it doesn't matter if the world is going to end, just like it doesn't matter what your neighbour is doing for dinner. All of these factors are pretty much chaotic (and yes, what your neighbour bought for dinner has an impact on farming and manufacturing, and therefore on the environment). Others who have careers in the respective fields will do all the work to shape the environment of the future. So I ask, why worry about it?

Thursday, November 27, 2008

Syllable hyphenation rules

Who in the world invented these rules? Seriously, latin-based language syllables and asian phonetic systems are so much easier to deal with. Argh! :P

Wednesday, November 26, 2008

Tuesday, November 25, 2008

Lunascape

Sounds cool, but I wasn't too impressed.

Doom

Whoa.

Sunday, November 23, 2008

xhr caching

A XmlHttpRequest caching test suite.

My problem right now is that I want to actually make use of caching (what a novel concept eh?) and that caching xhr doesn't seem to be quite possible (at least out of the box).

Recursion

Interesting.

Collective vandals

This reminds me of the Lucifer Effect experiment.

It's also something I've noticed in online games. I had many friends who started hacking after it became common knowledge that cheating the game was possible (and that admins weren't doing much about it).

This phenomenon is particularly annoying because in an ideal development life cycle, you need to do things in orderly steps: write code, test, deploy. It's not something you can do in a matter of hours. Addressing game mechanics abuse, on the opposite hand, requires immediate action to prevent damage to the collective perception of the game.

Having hacked items polluting the database isn't a big deal in itself, but having the entire community thinking it's ok to google for hacks can negatively affect bottom lines in several ways: when users quit, when you have to start to compete against gold-selling sites and shady eBay auctions (this applies mostly to micro-payment models, like Nexon or Ntreev games), when the time it takes to get from level 1 to some considerably high level becomes so short that the social value of the game diminishes, when new players are turned off by a sour greedy community, etc. It can really spiral out of control.

Some might think that hiring more moderators can fix the social problem, but in reality, that's the same as a company adding more people to a call center and expecting customer satisfaction to go up. Relying on a horde of minimum-wage workers to save a business is just foolish.

I suppose a better solution would start in the design phase of the game, but judging from the quality of many games out there, I think it's safe to say it's incredibly hard to get it right.

Virtual economics

Very interesting article. Just because a game uses pixelated coins as money, it doesn't mean its economics are any simpler than real life.

Friday, November 21, 2008

Thursday, November 20, 2008

Romney on the auto industry

He says it should go bankrupt.

Doesn't it suck when you live in a country where cars are a must have?

16 seconds

Am I the only one who thinks this is stupid?

Look ma, no flash

Audio using embeds. Pretty neat. I'm pretty sure you can use object tags too.

What i wonder is why is it that people like to spend so much time doing something that:

  1. can be done much easier and better in flash
  2. will be supported by a completely different native API in HTML 5

Sunday, November 16, 2008

10,000 hours

That's apparently how much time you need to master something.

I'm way past 10k programming hours but I don't think I'm quite there yet.

Javascript privates and memory

I hadn't thought about the memory considerations, it's certainly a good argument against closure "privates".

Friday, November 14, 2008

Videos in videos

This is pretty darn cool, but not what quite the same as "agenda payloads" that I mentioned a while back.

Virtual Immersion

Apparently using virtual reality immersion dramatically improves the recovery of burn victims.

I wonder how much the goggles cost.

Ron Paul

What do Peter Schiff and Ron Paul have in common? They are both proponents of Austrian economics. Hmm.

Interview with Peter Schiff

You may have seem videos of him predicting the economic meltdown as naysayers laughed. Here's an interesting interview with him from a few months back.

Thursday, November 13, 2008

Concurrency on high level languages

Nice article. In any case, I still don't get what's so terribly difficult about parallelism.

Best practices are starting to get on my nerves

Lately, I've been seeing quite a few articles like this, that, this and that, talking about best practices for HTML and CSS.

And quite frankly, best practices are starting to get on my nerves. A lot of what is said is essentially a repeat of has been advocated by evangelists back in 2004, when people were obsessed with semantic quality. Well, we moved on. Since then, we've largely realized that black and white rules don't always work, even for something basic like HTML and CSS best practices.

One funny trend I've noticed is that in the realm of web application development (as opposed to web design and static content), there's a lot more focus on performance, with things like the YSlow research, John Resig et al's efforts, and more and more news about "the cloud". Many of these best practices tips that restrict themselves to optmizing HTML and CSS, as opposed to whole systems often fall short in that area (e.g. strict doctypes aren't supposed to have iframes = no comet, multiple css files make managing them easier = more latency).

Perhaps the most notorious example of this clash of ideals is the google homepage: it's an insanely compressed unscannable blob of css, javascript and invalid html - the very opposite of what best practices preach - and it's the way it is for a good reason: bandwidth.

So, guys, next time you're going to blindly repeat evangelism from 2004 or go all "lol-u-dun-validatez" on some website, think outside the box for a minute.

Image resizing in IE

The IE7 property is actually pretty interesting. These techniques aren't a whole lot useful for non-user-generated images though: it's usually better to optimize things in Photoshop ahead of time.

Wednesday, November 12, 2008

How not to advertise a job

Found this blog via Hackers News. Hilarious.

Monday, November 10, 2008

New York Times

I wonder if there's an easy way to get these sorts of numbers in a aggregate manner.

CSS3 layouts

So, who here likes spaces and who likes tabs?

I just find the whole idea incredibly stupid: the crazier and newer the proposition is, the less likely it is to be implemented correctly in all browsers. Floats (and *gasp* tables) work just fine for today's websites and the table family of display values will work just fine for layouts in the coming years.

If you don't like typing and prefer to nudge things around in Photoshop, get a job in a design shop, sheesh.

Friday, November 7, 2008

Internet Explorer rumor

We all know that's not gonna happen any time soon, but it's nice to dream.

Off the top of my head, theres one bad thing about a switch that I can think of: comet support in WebKit sucks major ass.

Wednesday, November 5, 2008

Flash ExternalInterface and IE's "object does not support method" error

If you're pulling your hair on this completely non-intuitive error, check the second parameter to SWFObject, it defines the object tag's id attribute, and if you're getting errors, you most likely have a duplicate id.

Cheatsheets

I don't usually use cheatsheets, but they seem to be helpful to many people.

Multithreading vs Parallelism

A subtle difference.

I tend to think of computer programs as a race track where each lane is a physical processor. I then imagine painting a series of blocks on each lane to represent computational time for every operation on the system.

A thread pool where one thread is hammered with embarrassingly parallel computations (think any scientific data crunching) and one is mostly sitting in an idle loop (think a GUI one) is perfectly fine in emulated multi-threaded environments, but it's not efficient parallelism.

An analysis of the stock market with Obama as president

Interesting

Tuesday, November 4, 2008

Flash games

A list.

Instant color schemes

Cool. It grabs 5 images from a yahoo images search and picks the most prominent colours.

Cloud

Is it just me, or has "the cloud" become a buzzword for "scalable web hosting"? In that context, I think talking about whether the software is open source hardly matters, as we're talking more about server cluster infrastructure.

If it weren't for the hardware infrastructure, then any box running PHP would qualify as a "open source competitor" to cloud hosting providers. Or am I missing something?

Monday, November 3, 2008

Why vote?

So apparently a lot of people vote because of social pressure. Why am I not surprised?

Saving bandwidth

I know way too many programmers that don't know this stuff. Then again, I only learned about it myself when I built a server from scratch during my spare time. Hi, Jeff Atwood.

Vendor lock-in

So I saw some comments about Azure and how supposedly a lot of people seem to think that vendor lock-in is a bad thing.

I don't understand why anyone would put down vendor lock-ins as a bad thing; you're locked-in regardless of what technology you pick: you choose PHP and good luck getting asynchronous server processes to work. You forgo flash and no streaming videos for you. You abuse proprietary SQL extensions mostly because they're worth it.

I'm not saying any of these are bad, nor that they are a must have. The point is that if you're going to wait for the perfect environment, you'll never get anything done. And on a related note, if you are just finding an excuse to defend your favorite blub technology against the powers of evil, then chances are that you're not actually doing anything worth anyone's time :)

For the rest of us, the show must go on, so let's get on with the program, shall we?

Anger and violence

Article. Another article. At these times, I feel like I'm a kid watching an alien ant farm.

Security - bolt it on

Interesting article. I need to learn more about the javascript error / img behavior attacks.

Wednesday, October 29, 2008

More Photoshop

More Photoshop goodness.

Obsession

My problem is the finding smarter-people-to-be-around part.

Gmail is an OpenID provider

Ignoring all the nag screen crap, it was actually fairly easy to login.

Plura - Now that's cloud computing

This is incredibly clever: game developers can get paid for the computing power that players provide to Plura clients while playing a game.

The next big thing?

It seems micro-blogging / tweetering (is that the right word?) are gaining momentum lately. With the announcement of the Friendfeed Comet API, I think we're moving closer and closer to Comet-driven content delivery.

But to be honest, I think we've already reached a point of critical communication speed. It easy enough to just hit the refresh button to check if anyone anywhere said anything new.

Also, no advertising system that I know of works well to generate eyeball revenue for sites that don't get page refreshes (and I think the ads-in-videos stuff they're trying on Youtube is pretty lame).

With that in mind, I think it's safe to say that value and agenda payloads will more than ever become tied to content: all hail the mass self-aggrandizing propaganda that looms.

The challenge, hence, is to create connection channels that can maximize selectivity and specificity. Maybe tagging actual content and categorizing/prioritizing based on bayesian filtering?

Skein hash function

A new hash function aiming to replace the SHA family of functions. Designed by Bruce Schneier, Niels Ferguson, Stefan Lucks, Doug Whiting, Mihir Bellare, Tadayoshi Kohno, Jon Callas, and Jesse Walker.

Algorithms, algorithms

A list of algorithms. Might be handy later.

Tuesday, October 28, 2008

Change of scenery

Interesting. Reminds me of fantasy games and the whole idea of escaping from reality.

Saturday, October 25, 2008

Creative unpredictability

Interesting. Ties very well with the concept of game content auto-generation.

Friday, October 24, 2008

Wednesday, October 22, 2008

Thoughts on economy and trends

I read this article about young generation and workplace expectations. I think that the trend of over-self-confidence and loss of loyalty is very risky for youth and a sign that they lacks experience. Older workers like job security for a reason: they have bills to pay, children to feed, retirement to worry about.

Let's step back for a minute and think: what if companies do adapt to the mentality that it's companies that need to adapt to the idea of workers with no loyalty?

What if everyone really decides that being their own boss and starting their own business is the way to go?

Here's what I think would happen: new entrepreneurs will almost always start a digital business because it's simply cheaper to crack Photoshop / DreamWeaver / Maya / whatever, than it is to renovate a rented business place (or do any physical world business-related task, for that matter).

Japan is just like that: there's an over-saturation of entertainment-related products, and a ton of people working freelance with virtually no job security and without the leverage of a brand to make a start-up work in the over-saturated entertainment market.

I do see a key difference though in mentalities: in Japan, an artist is a sensei (a master), whereas here, an artist will starve to death. Instead, here, everyone and their dogs make me-too web 2.0 applications and libraries - "computer science" sounds powerful, doesn't it?

Science? yeah, whatever.

Sciences are things that are proven with time - new fads that could potentially maybe perhaps make you rich (if virality works for you) are not science, nor a viable business plan nor a way to get job security that you *will* want sooner or later.

It's kinda weird that now, all the old-school obvious stuff that grandparents used to mumble (you know, saving money, hard work, etc) are all back in the table now. It's probably weirder that these things weren't being taken seriously by a lot of people up until now.

FriendFeed real-time API

A comet JSONP open API. Really cool stuff.

Tuesday, October 21, 2008

Rescue Time

I wonder if it actually helps.

Alone together

Interesting. It makes sense: just because a game is online doesn't mean people care about interacting with other people.

Maybe they're bored of Bejeweled and can't afford Halo.

Peppy - faster selector engine

Interesting, at least while IE8 doesn't come out.

Photoshop actions

Neat collection, especially if you like vintage effects.

Monday, October 20, 2008

A thought on vote-based systems

Here's something I was thinking about vote-based sites like StackOverflow or Digg: can we consider the aggregate sum of votes an accurate representation of people's opinions?

I think that we can't, for a few reasons:

  • Different people use rating systems differently: As was proposed in the Netflix contest earlier this year, some users may reserve a "5 star" rating only for all-time classics whereas some other may rate any funny movie a "5 star". Likewise, some may upvote anything that doesn't offend them, whereas others may only upvote things with which they strongly connect with (by personal experience, for example).
  • Collective thought bias: most people are more likely to agree with the majority than not. This can extend beyond the scope of a single voting decision: the characteristics of future user-generated content are also usually affected by the outcome of past elections. This shift can cause users with differing opinions to avoid participation or leave a site altogether.
  • The incentives are usually not balanced: there's usually a strong preset bias towards taking action on one of the options (i.e. "upvote if this speaks to you" vs. "if you're not compelled/interested by this, you have to choose between acting (downvoting) or not acting (not voting)").
  • Voting systems are often subject to momentum: this is particularly true of news sites - users are encouraged to vote as soon as possible (often before they are able to grasp the full concept, or before they are able to figure out that a certain source is misleading). Voting after a certain time threshold often has little or no social value.

I'm not saying voting-based systems are useless in websites - they can provide a quick insight into whether something is likable or useful. What I'm pondering is this: what's the point of being a sheep?

Meteor Server Comet

So apparently, we can use forever XHR for doing Comet in Safari. I'm a bit skeptical, as this hasn't worked when I last tried this technique, but hopefully I just did something wrong last time.

Muxlim

Second Life for muslims. Call me crazy, but I want to try it out.

Tips for MySQL architects

Nice slideshow.

Response splitting

Nice to keep in mind (I can't think of any reasons why one would want to add user-generated data on a response header, though).

Deploying new UI is hard

Right, iGoogle?

Studies are most likely wrong

Here's a pretty good reason to doubt everything you think you know.

Sunday, October 19, 2008

Flashing of unstyled content

A clever way of fixing it using JQuery.

If all you need to do is display:none elements of a certain class, adding that one rule in a style tag inside of a <noscript> tag might be easier (though probably not as pretty).

Saturday, October 18, 2008

Instant docs for Java SDK

Here's a neat way of getting instant documentation on core java API:

  • Get SlickRun
  • Add a rule that launches your browser (for example "j" to launches Firefox)
  • Set the "Parameters" field to this:
    http://google.ca/search?q=java+$W$&btnI=I%27m+Feeling+Lucky
  • Call SlickRun via WindowsKey+Q, type "j thread", or "j comparable", or whatever.
  • Works for all the classes I've tried so far :)

Friday, October 17, 2008

Some useful stuff about geolocation

For future reference:

Spyware?

I bet 10 bucks that the sponsored link on the top is spyware-ridden. Come on, 0-PDF.com?

Coding vs reusing

Jeff Atwood just wrote about his never-ending HTML sanitization saga. The post is filled with napalm but brings an interesting point I was actually pondering to myself this morning.

Reinventing the wheel is usually considered a horrible practice, yes, but let's face it, great hackers reinvent the wheel all the time. Except they call it "reverse-engineering". Knowing what makes software tick is a crucial skill if you ever do any sort of meaningful debugging (i.e. troubleshooting that doesn't involve guesswork and praying).

Without having the sort of foundation that only comes from implementing an compiler from scratch, how could one hope to produce things like SquirrelFish? How would one even start to talk about a scalable comet infrastructure without having implemented a web server from scratch?

At the end of the day, code reuse may be a good coding practice, but it's a bad business idea for a developer as a skilled worker. Employers can find good code for free for just about everything nowadays; it's the experience and the knowledge about the caveats of the underlying technology that makes programmers valuable.

Thursday, October 16, 2008

Blog Action Day

Today is Blog Action Day. Theme: Poverty.

I don't know if it makes any sense to ask others to donate (considering we ourselves don't usually like to solicited), or even if donations are useful considering that many charities can take 50% or more of a donation for "administrative costs".

I'm not too familiar with tips on how to get out of poverty, but the "bottom up" approach here seems useful.

As far as what I've been taught, working and saving are, despite their lack of glamour, the surest way to get rich.

Wednesday, October 15, 2008

Yahoo on OpenID

So my opinion that OpenID authentication is completely awkward is now backed by some actual research from Yahoo.

One thing that I didn't know (and I use OpenID somewhat regularly), is that yahoo.com is apparently a valid OpenID. What in the world were the designers thinking?

Git justdoit --all &

I just spent half an hour trying to get a patch of a single character up on origin/next of a project, and by the love of god, look at how much I had to type:

git fetch
git co origin/next
git cob fix/123456
### did my one-character change ###
git cob fixdone/123456
git push origin fixdone/123456

git fetch
git co origin/next
git cob next
git merge origin/fixdone/123456
git push origin/next
git co origin/next

git b -D next
git b -D fix/123456
git b -D fixdone/123456

All of this for a one character patch!

Ok, I didn't really spend half an hour on this one task alone, but you get the point.

I'm not that familiar with git and bash, so I'm sure there must be a better way of doing this. Considering that in open-source software (and probably corporate ones too, for that matter), one-line changes are the most common type of patches, having to type all of this sounds unnecessarily complicated, no?

Crisis of faith

Geez, thanks a lot, Eliezer Yudkowsky, you got me thinking again. :)

I really like the idea of a made-up parallel universe, where we deliberately create a constraint that says our beliefs are wrong. I've had the habit of doing this parallel-universe-self-questioning for the longest time, but I never had a good way of sharing this concept with other people without scaring them off into their shells.

Saturday, October 11, 2008

5 ways to know if your business is any good

Down-to-earth list. The advices are pretty obvious, but you'd be surprised by how many people I know who don't follow these rules and keep failing miserably.

Friday, October 10, 2008

aaaah, the panic! the panic!

Panic.

I got a investment marketing letter on my mail the other day. It said something along the lines of "make investment deposits monthly so that you get fewer shares when prices are up and more shares when prices are low".

I guess for a long term investment strategy, that makes sense, especially combined with portfolio diversification. The chances that everything in a portfolio is going to go bankrupt are pretty much zero, right?

Thursday, October 9, 2008

Soundest banking system

Nice to read some good news that relates to economy, for a change.

Smoking kills, apparently

Apparently, it increases the chances of heart disease, one of the biggest causes of deaths.

I don't know if they are trying to scare smokers into quitting. If that's what they are trying to do, perhaps just laughing at them for having to pay more taxes might work out better, since a large number of smokers are just kids looking for social acceptance (and we know that being buddy-buddy with the government is not exactly popular among these types of people).

Wednesday, October 8, 2008

We are all adults here, right?

I've been wondering for a while: why don't I see this style of OOP "private" variables too often in Javascript:

var MyClass = function() {}
MyClass.prototype = {
  __hello : "hello",
  __world : "world",
  sayHelloWorld : function() {
    return this.__hello + " " + this.__world;
  },
  sayWorldHello : function() {
    return this.__world + " " + this.__hello;
  }
}

It strikes me as an easier way to handle inheritance. For example, consider the traditional alternative:

var MyClass = function() {
  var hello = "hello"
  var world = "world"
  this.sayHelloWorld = function() {
    return hello + " " + world;
  }
  this.sayWorldHello = function() {
    return world + " " + hello;
  }
}

How do we extend this so that the private variable world always has a value of "world!!" (with exclamation marks)? How do I label it protected, instead of private?

Rather than engineering mechanisms to prevent people from editing our variables (which anyone with Notepad and your source file could do), wouldn't we benefit from having more value with less (but more "risky") code?

Hear your own gibberish

This is just plain awesome.

Tuesday, October 7, 2008

Monday, October 6, 2008

Control and superstitions

Interesting.

It seems that feeling that we're out of control is a bad thing: it tends to make us shift blame away from us, even when it makes no logical sense. And it seems it messes up our bodies too.

Saturday, October 4, 2008

Hello world in Scala and Jetty

I just started looking into Scala, which aside from the somewhat funky syntax, seems very expressive and powerful :)

For starters, this is a very good tutorial to get your feet wet.

Because a console "hello world" is too boring and easily googleable, I decided to try out the "easy Java interoperability" they tout, by trying to run a simple web server with it.

I started by grabbing a copy of Jetty (you'll just need the jetty.jar, jetty-util.jar and the servlet.jar, which are in the lib folder)

Next, I created the following folder structure:

my-server-thingie
  src
    MyServer.scala
    run.bat
    index.html
  bin
    jetty.jar
    jetty-util.jar
    servlet.jar

Then, in the MyServer.scala file, I added following code:

import org.mortbay.jetty.Server
import org.mortbay.jetty.handler.DefaultHandler
import org.mortbay.jetty.handler.ResourceHandler
import org.mortbay.jetty.handler.ContextHandler

object MyServer {
 def main(args: Array[String]) {
  var server = new Server(8080)
  var fileHandler = new ResourceHandler()
  var defaultHandler = new DefaultHandler()
  
  fileHandler.setResourceBase(".")
  server.addHandler(fileHandler)
  server.addHandler(defaultHandler)
  
  server.start();
 }
}

My run.bat file looks like this (note: you'll need to either setup the path, or point the second line to the bin folder in your scala copy):

@set file=MyServer
@set path=%PATH%;C:\scala-2.7.1.final\bin;
@set bin=../bin/
@set cp=%BIN%;%BIN%jetty.jar;%BIN%jetty-util.jar;%BIN%servlet.jar
@call scalac -d %BIN% -optimise -cp %CP% %FILE%.scala
@call scala -cp %CP% %FILE%
@pause

Now just write "Hello world" in your index.html file and point your browser to http://localhost:8080/index.html

Done!

Friday, October 3, 2008

Roguelike

Old school.

I was talking to a co-worker about this types of games. It's easy to think that creating a system that can auto-generate content is a MMORPG's pot of gold, but the hard part is to add unexpectedness to the equation: i.e. generate game logic challenges that match one's level of skill.

Intelligence vs God

Some genius decided to do a study on the correlation between IQ and the probability of being an atheist. To me, it sounds like a study on the correlation between elitism and elitism. Oh wait, they are the same thing.

I bet a 100 dollars none of the people who participated in the study put any thought into the fact that there are tons of definitions of God.

Flash games

So true.

Getters/Setters in IE8

Nice.

Wednesday, October 1, 2008

Easy comet in PHP

Nice little hack. It probably doesn't scale, but it does perform long polling with just over 100 lines of code.

Hammerhead

This looks useful: a performance measurement add-on to firebug.

Game programming in Scheme

Interesting

Tuesday, September 30, 2008

The thing that bugs me about Blogger.com's OpenID

I don't know if this is the case for other providers, but with a blogger.com OpenID, I need to enter my blog URL as an ID, then I get a prompt asking me if I want to always tell the site I own my OpenID, then I get asked for my username and password.

Why in the world can't I just have the OpenID and the password fields to deal with and why do I possibly need to go through 3 screens just to post a blog comment? (having to log-in to post a comment is pretty lame on its own but I digress :P)

I can understand sending the user to the blogger.com site for the actual login over https, but can't it figure out my username from my OpenID? I mean, it's a one-to-one relationship and usernames aren't exactly secret.

If OpenID is to become popular, it really needs to be as easy as logging into 99.9% of login-based websites.

Clickjacking

Last week it was CSRF, this week seems to be about clickjacking.

To be honest, clickjacking sounds a whole lot more difficult to deal with than CSRF, mostly because it's variant of good ol' social engineering.

10 habits of highly annoying bloggers

Funny (assuming you're not easily insulted or not a blogger).

I'm guilty of #2: my blogging looks a lot like bookmarking, I like being able to just quickly search for links I liked.

I'm also guilty of #6: I don't understand blogrolls; to be honest, to me, having one feels like a weird form of popularity contest.

In any case, if you get annoyed by other bloggers, I think you're looking at things the wrong way :)

Michael Moore on the bailout

I'm no expert in politics and economics, but I had a feeling this was the case.

Writing a compiler in Ruby

Interesting

Smush it

Image optimization goodness

Meanwhile, in Flash CS4

3D, bone structures and some seriously game-oriented stuff.

What's up with the bailout?

Seriously.

HTML 5 today (sorta)

It's coming along, it's coming along.

You'll have to click to upload in Flash 10

Worth keeping in mind from now on.

Thursday, September 25, 2008

More F#

Here.

Quite interesting that functional programming is getting popular.

Wednesday, September 24, 2008

DOM Storage in IE

Implements most of the HTML5 spec. Cool.

Design Patterns are from the toolbox

Christer Ericson argues design patterns are from hell.

I think the problem begins when you start using patterns as if they were first class language constructs. Patterns exist because they are good ways to do very specific things: create instantiation constraints, organize data+logic+view code, etc.

As the name suggest, patterns are, well, patterns. Just because your class is not called SomethingFactory, it doesn't mean it's not a factory, and more importantly, it doesn't mean you chose the right tool for the job.

Over-architecturing, yes, is from hell, but that has to do with defining the scope of the project, which is a project management thing. If anything, a history of good accountability and feature prioritization is what you'd want to see if you're dealing with "highly-paid consultants".

Cross Site Request Forgery

The downside of having a popular web app is that you're more vulnerable to various types of attacks. Jeff Atwood talks about XSRF.

Here's a paper on how to defend against it.

Monday, September 22, 2008

Password and focus

Read the discussion at the bottom. It raises an interesting question: how do we tell users that they are accidentally typing their password in clear text? Any ideas, anyone?

F# in 20 minutes

Part 1.

Users are developers too

From a user point-of-view, there's something that usually annoys me about web interfaces: the size of text areas and rich text editors.

Think about it: how often do you have your code editor in a non-maximized window? Or microsoft word? Or Acrobat when you read a PDF?

I almost never do. I always try to maximize the window I'm using, so that it's easier to focus on whatever I'm looking at, and so that I have as much screen real estate as possible. The only exception is when I need two windows side-by-side (In which case, I try to make the combination of the windows take as much space as possible anyways).

Yet, for whatever reason, text input elements in websites and web apps are often crammed into puny forms or ad-sized (non-resizable) popup windows that give me some 200 x 400px of working space (sometimes less). Do I really have to scroll a tiny box just to proofread a two paragraph blog response? Really.

Last week, I talked about how linearity isn't always the best way to display things, and this is a good example: when I'm writing a longer piece of text, I'm no longer concerned about the email address I entered 10 seconds ago, and I'm even less likely to click on any navigation element on the page. So why do those things need to be there?

In most desktop-based software, navigation, help and even extremely useful tools are all tucked away from our sight because the main canvas is more important.

Users are developers too: they create content and they expect their tools to work well for them. And for someone writing text, a big text area is the way to go.

Think about this the next time you create a form with a "comments" field in it.

End the world already

Geez, when are they actually going to make stuff collide? :(

Update: omgweresoscrewed

Friday, September 19, 2008

Using night light satellite images to pinpoint violence-based exodus

Interesting study.

Using tables for non-tabular data is ok, really

I came across this publication about writing content that is clear and easy for your audience to understand. It's a very interesting read, especially if you do any form of business-related writing.

Here's the part that made me think (it's about 3/4 of the way down):

c) Tables make complex information readily understandable.

If-then tables lay out the text visually, helping your reader see relationships more easily and usually requiring fewer words than straight text. For example, the paragraph below is written in the "dense text" method:

For good reasons, the Secretary may grant extensions of time in 30-day increments for filing of the appeal and all required documents, provided that additional extension requests are submitted and approved before the expiration of the original 30 days or the previously granted extension.

Try it this way instead.

IfThen

additional requests for extensions are submitted and approved before

  • the original 30 days, or
  • the expiration of a previously granted extension

the Secretary may grant additional 30-day extensions of time for filing of the appeal and all required documents.

Now, obviously this article is not a technical document for web developers, but it does raise an interesting point: that plain text isn't always necessarily the best way to display information.

I thought about it for a bit and considered the possibility of implementing the example above using two divs, styled as two columns via CSS, but there's a key organization cue that columns do not provide: that the titles, in addition to possessing a hierarchical relationship to their respective bodies of content, have a parallel relationships between themselves.

What this means is that reading the titles left-to-right without paying attention to the table body is intended to be a viable way extracting information from the block of text.

If one title spanned more lines than the other, a div-based column layout would likely lose its spatial organizational cue (and restoring it via CSS would involve adding way too much extra markup).

The concepts of non-linear content and orthogonality are not new by any means: hyperlinking often breaks the linearity of content to add context and background information to a discussion (e.g. those "read this and come back" articles). Even in ancient China, poets wrote acrostic poems that could be read both horizontally and vertically.

Conclusion

I'm not saying that it's now ok to build table-based layouts. My point is that thinking of content as a bunch of parallel lines is an incomplete way of looking at how content can be displayed.

It's easy for us developers to mentally blur blobs of text when creating websites that have more inane content than we care to read (especially for back-end folks), but going the extra mile of tweaking content structure and its strategic organization on a page /site can do wonders to improve usability - and getting your message across to your visitors.

I can haz mock objectz?

lolcode always makes my day.

Squirrelfish extreme

Wow.

Thursday, September 18, 2008

Light bot

Fun times.

No wonder

One of the reasons why Stack Overflow was created was that programming searches would often show links to the Experts Exchange site (a paid subscription site)

Now I wonder if this might have contributed to it being always at the top of the search results.

Haidt video

He talks more about moral psychology. Very nice.

Wednesday, September 17, 2008

Conservatives vs Liberals - A dissertation about human morality

This is a profoundly interesting read. It articulately answers a question that has been bugging me for the longest time: why conservatives and liberals don't get along.

Update: The follow-up discussion is also worth reading.

Fluffy Bunny

What's more dangerous: Grand Theft Auto or Fluffly Bunny?

Answer: Fluffly Bunny.

Tuesday, September 16, 2008

Sigh

Guys uses poor judgement when making a metaphorical statement and the internets takes care of twisting it completely out of proportion. Don't even start with the Palin jokes.

I don't know what's more hopeless, republican zealots or democrat ones. Well, have fun with your new president, whoever that turns out to be, guys.

Bluff - graphing in javascript

A javascript port of Gruff.

Monday, September 15, 2008

You can't please everyone

Hank Williams has an interesting piece about the current web development industry as an actual business model.

I definitely agree that adding value and charging your target niche for that extra value makes more sense than trying to please everyone and counting on the viral effect to make it big.

This kinda goes with this little rant I've thinking about for a bit: lately it seems that everything is a copy of a copy of a copy. You can really see it when the same things shows up in every RSS feed, as if people couldn't find better stories to report.

I personally first got on the web because I was interested in japanese animation (I was into Pokemon at the time - yeah I didn't know better, bite me) and magic tricks (card sleights, specifically). I didn't get on the web because I cared about the latest games, Palin bloopers, Facebook or whatever other viral thing you can think of. I think it's time to bring all the work we've been doing with mashups to meet the world of subcultures and personal interests. And by that, I don't mean reinventing the wheel by trying to tie Google Maps or some other trendy API with <insert niche here>, I mean really knowing your niche and adding real value.

Cube attack paper

It's online now.

Friday, September 12, 2008

CSS in one line

There was a bit of drama over it on Ajaxian recently. Personally, I like CSS properties in alphabetical order and in one line. The alphabetical order makes it easier for me to find properties and the one-line approach lets me ctrl+D in Notepad++ (that duplicates the current line or selection), as well as tweak groups of selectors more quickly than it would take to scroll up and down looking for the ul li.selected that is related to the ul I'm working on at the given moment.

It's nice to be able to just press up and down when I need to change related properties. Thanks to the physical proximity of similar rules granted by alphabetizing rules, with just one keystroke up or down, my cursor will be somewhat where I need it. Here's a pattern I use often that illustrates that.

/*rounded corner styling pattern*/
.t {background-position:100% 0; someotherstuff...}
.t div{background-position:0 0; someotherstuff...}
.b {background-position:100% 100%; someotherstuff...}
.b div {background-position:0 0; someotherstuff...}

Here, I'd type the first line, ctrl+D a few times, tweak the selectors, then the background-position values. Follow the imaginary cursor :)

For maintenance, we can almost look at the blocks of code in the stylesheet as if they were tables: backgrounds here, borders there, etc.

How to draw techie traffic to your site

Suggest Google is evil. It seems we all want to hear it being said, for some strange masochist reason.

Thursday, September 11, 2008

HTML5 alt attribute

You must have heard about the long long looooooooooooooooooong discussion that has been going on about this.

Ian's final proposal is this:

For the "key content without alt text" cases, we have the alt="" attribute omitted, but there must be at least one of the following, and the first that is present must include sufficient information to orient the user.

  • title="" attribute on the <img> itself
  • <legend> of the <figure> that contains the <img>
  • heading of the section that contains the <img>

Wednesday, September 10, 2008

Monday, September 8, 2008

Floating data centers

Interesting.

I wonder if the people writing the comments ever go outside. Sure floating data centers are easy targets for terrorism. Just about as easy as sinking an oil rig or one of the gazillion cargo ships that bring your t-shirts and iPhones from China every day. Get real, people.

Pacman

With YUI

Friday, September 5, 2008

Tales of the job

Today, a co-worker came asking me if there was an easy way to do this task: he needed to create an array of strings from a HTML structure composed of a top level div (with an id), with child divs, each containing a bunch of uls, which in turn contained a bunch of lis that contained a span with the desired text, plus anchor tags, among other non-relevant stuff.

We use prototype, so I scribbled a quick script using it:

var a = [];
$$("#bla div ul li span").each(function(e) {
  a.push(e.innerHTML)
})

He tried it out and it worked like a charm.

I love problems that take longer to describe than to solve :)

Cappucino is out

Neat.

Tuesday, September 2, 2008

Chrome on Dromaeo

It's ridiculously fast.

From scratch

Google's idea of "from scratch":

We want others to adopt ideas from us, just as we've adopted good ideas from others.

Chrome: Google enters the browser wars

The announcement

Right now, it's a bit hard to get some more info since their servers are getting hammered with requests this morning. From what I understand so far, it uses the WebKit engine and it features a devious twist when approaching the speed optimization competition that was going on between Firefox, Safari and to an extent, Opera: it will have a per-tab performance monitor so that if the browser starts to slow down, users can blame sites, instead of browsers.

From Google's perspective, that move is truly a stroke of genius. It will force web developers to become more responsible with their code, rather than relying on the browser's Moore's Law. At the same time, it lessens the expectations from browser critics towards Chrome itself.

Now the question is: when can I download it? :)

Update: to answer my own question - Here.

Saturday, August 30, 2008

Breaking CAPTCHAs the low tech way

By paying Indians $2 per 1000 captchas.

I saw some people suggesting legal action to stop these types of businesses, but let's face it, deep-pocketed giants can't abolish illegal file sharing sites and programs. What makes these people think they can stop these guys?

A quote from Johanna Rothman

If you’re a manager, count those legacy projects, and stick them in your portfolio to either finish or kill or park somewhere if you really think you can’t kill them outright. But stop the partial-staffing of legacy projects. That’s nuts. Either staff it or not. Don’t make people leave because you can’t decide what to do with this project.
via

Friday, August 29, 2008

Widget blindness

Great article: widgets are a somewhat recent trend that effectively makes the old mistake of trying to please everyone at the same time.

Bombarding the user may look like a good idea, but we need to remember that they have the ability to ignore clutter and only focus on what is interesting to them (rather than what you or your client want them to be interested in). It's all to easy to fall into the trap of wishful thinking.

A nice way to figure out if your widgets are useful is to add Google analytics tracking to links/buttons/interactive elements and see what people are interacting with and what they aren't (assuming they are not something passive like a tweeter stream).

If you're not getting a whole lot of hits on the widgets, maybe you should reconsider whether they should be there.

Net neutrality

The internet is a series of tubes!

72,500,000 of them.

I have no idea how this ties into net neutrality.

Call of Duty, here we come :)

We're at wolfenstein already.

Matrix, here we come

MIT is always announcing the coolest and weirdest things: a microbattery made of viruses.

Tuesday, August 26, 2008

What's with the disease complex?

Every once in a while I come across stuff like this. And for whatever reason people seem to think that it's always ADD or Aspergers or whatever other "disease". Dude, just because someone doesn't conform to some hollywood stereotype of the "mr. sexy guy", it doesn't mean they're mentally sick.

If anyone ever thinks their personality is getting in the way to their path to happiness or whatever, remember that life is what happens while you make plans. There's nothing at the end of the road.

Monday, August 25, 2008

New Validator.nu

Nice. I'll probably plop it into my framework to try it out some time soon.

Sizzle: while querySelector doesn't land on production

John Resig is working on a new selector engine for JQuery, which he claims is 4x faster in Firefox. It's not quite ready for prime time yet though.

Friday, August 22, 2008

Tracemonkey - the parade of speedy animals continues

As if responding to the Squirrelfish initiative by the Safari team, Firefox now has its own little baby to show off. We will be seeing performance that is very close to native C speed with Javascript in the very near future.

Combined with stuff like this, and the recent proposals in the HTML5 spec, we could be seeing full blown games being delivered from the browser a few years from now.

I love the direction things are going: we are seeing visible improvements across the board for all the major complaints people have about the web platform: more powerful APIs, lightning fast performance, and standardization :)

How not to report news

When a news articles starts with the words "The morons", you know you're in for a good laugh. It's like reading second grade fan fiction trying to pass as an authority on a subject.

Bomberman

Cool. The music gets annoying though.

Thursday, August 21, 2008

Installing web apps sucks and will always suck

Firefox plugins, Google Gears, Adobe AIR, Opera widgets, Yahoo Konfabulator, did I miss any other ones? Downloadable modules are a great way of delivering specialized software (e.g. Firebug), but they're horrible at integrating with existing networks.

With the web platform, we can easily send a link to a 3D chat app to a friend over instant messenger, hotlink videos on your blog, backup the bookmarks, etc.

Try sharing a Veoh TV video with a friend and you'll quickly find that learning how to use their UI and then convincing your friends to download and learn it as well is a major roadblock. Has anyone seen the demo map app made in AIR? I couldn't figure out how to for a good half an hour. Don't make me think.

Harmony is not an API

I'm noticing a certain trend of ranting triggered by the recent news about the Harmony effort. Quite frankly, I don't understand what's so bad about standardizing the language or how it's being done.

A lot of people seem to confuse languages with APIs, and draw wild comparisons with things like OpenGL and Silverlight. Yes, the HTML5 effort as it pertains to standardization of next generation browser functionality (e.g. video, threads, etc) is rather sluggish, but it has nothing to do with the Javascript language spec. We can call "video.play()" or "new Thread()" in javascript today and really, it's up to the programmer to decide how that gets implemented under the hood. Whether Flash or ActiveX are not "open-web-friendly" really doesn't matter; we can create crazy hacks or make great services either way.

As far as "pushing the limits of the language" goes, again, it goes back to APIs, and to infrastructure. We can't blame the javascript specs if your Comet doesn't work realiably over HTTP in all browsers or if you need to use brittle vendor-specific extensions to get storage to work on the client side.

I think it's great that people are questioning the capabilities of the APIs available in javascript, and you're free to go try other technologies. I'll be here when you come back wanting to share all your new discoveries.

Remember me

You know those "Remember me" checkboxes in login pages? It's not a feature, it's a bug.

querySelectorAll

Yay!

Tuesday, August 19, 2008

Type-O blood

From stem cells.

Now that's big.

Monday, August 18, 2008

Lego!

Win.

More win.

I love lego :)

On phishing

A quote from myself:

At first, I thought this was going to be an article about usability :)

As far as phishing goes, there's no way to differentiate a legitimate UI from a fishy one. All an attacker needs to do is copy the legitimate UI. Even if they could somehow be differentiated, statistically speaking, there will always be a large number of users that will always respond to certain prompts with muscle memory, and there will always be a variety of newly deployed social engineering attacks that don't attempt to spoof any famous vendors in particular.

Profiling is pretty ineffective too: there's no correlation between language proficiency or graphics design skill and the intent to harm for profit. Also, just because you can tell a js popup from a real AV one, doesn't mean everyone else can do it too: keep in mind that Jeff's question pertains to a naive user.

Sandboxing also only does so much. If the user says "yes yes yes password yes uac yes I'm the administrator for this computer, so install and run this already", the whole sandbox goes right out of the window. Proclaiming one-sidedly to be the super admin for your aunt's computer seems kinda awkward too imho: it's like gifting her with a kitchen knife set and saying "i'll keep the keys to the scabbards, just in case". There was even a case in the news recently where a tech support kid hacked a woman's webcam by abusing that meme of "putting trust in the technical expert".

There are way too many attack vectors. If users can't decide on their own when to click on the close button instead of the ok button, no amount of code or UI tweaks ever will.

What is your gender?

Now your browser can guestimate it for you!

TinEye

Search for images by uploading images.

Sunday, August 17, 2008

Free will

Princeton mathematicians John Conway and Simon Kochen claimed to mathematically prove that subatomic particles cannot conform to determinism.

This refers to one of the most fundamental questions about the universe: does it move according to an algorithm or is it completely random?

You can think of it as a religious question too: does God interfere with the universe or not? Of course, this won't answer the whole debate about God's existence, but it does seem to make the chances of God existing higher.

By the way, when I say God, I'm usually referring to the panentheist God.

REST - the non-buzzword

Nice explanation. Basically being RESTful means understanding the underlying infrastructure of the web and making use of it when it makes sense, e.g using GET when you want caching, using PUT when you want to avoid posting-twice problems and not throwing C# exception messages with a 200 OK header.

Friday, August 15, 2008

What history can teach you: slack off

Well, actually, the bottom line is: don't overwork yourself.

Search engine optimization for prospects

This is a clever way to show marketing accomplishments to prospective clients: show that they can actually be visible. Except that, in real life, people don't go around googling company names unless they are actually trying to find the company's site.

Half actions

Interesting read.

Thursday, August 14, 2008

Videos + Photos = Coolness

This is a really cool system.

The object removal example in particular is very impressive.

Poland to get missiles from US

Because missiles are apparently a good way to defend your civilians when you're being invaded by a country that is not Russia.

Does anyone else feel as if the world has been moving backwards in history?

A quote from John McCain

In the 21st century, countries don't just invade other countries
via

I used to hate politics, until I started looking at it as if it was a big comedy show.

True dungeon

I would've thought True Dungeon would be like a cheesy haunted house with stuff bought off the dollar store, but looking at the video, the props actually look pretty neat.

YUI 3.0

I always thought YUI was bloated, but I have to say some of the new stuff looks really cool.

When being cutting edge hurts

John Resig talking about the development of the ECMAScript specification

It seems Actionscript 3 will not be a subset of the new ECMAScript 3.1 Harmony proposal, meaning it might end up becoming a language of its own. Maybe Adobe will do something like .NET and allow multiple languages to run on top of the VM.

Wednesday, August 13, 2008

Border image

CSS 3 is slowly becoming implemented. The big question is: where is -ie-border-image?

Tuesday, August 12, 2008

Concepts vs pragmatism

37signals on why they skip the powerfulness of Photoshop and just build their site directly with HTML and CSS.

A piece on concept products, and the trade-off between coolness and being in the real world.

Another interesting opinion.

So I guess the magic formula is: we're only going to see incredibly awesome stuff if we have:

  1. A creative mind producing a vision, almost detached from reality.
  2. A collaborative effort from experts in various fields to somehow make that vision fit within the constraints of the real world.

If we only have the first, we never get off the ground. If we only have the second, we just get tired repeats of old ideas.

Stack overflow

We can sign up for the closed beta now.

Games, marketing and non hardcode gamers

Advertising games seems to be hard for some reason: there are a lot of MMORPGs that basically parrot how they are free and they have this and that other "system".

Ever started playing Flyff (fly for fun) only to find out you can only really fly after you spend a good part of your week getting to some two digit level? Ironically, in Second Life, where the ability to fly isn't really advertised as a distinctive feature, we can learn how to fly (with pretty much no restrictions) within the first 15 minutes.

When it comes to targetting non-hardcore gamers, I like the concepts in Nexon (of Maplestory fame) ads: invitational tone using words most people can relate to. Who really cares about a "revolutionary party system" and "real PVP"?

Imo, unless you spend your weekends exhaustively trying every single new open beta MMORPG in the net, ads that invite you to "explore" and "chat" sound a lot more attractive than ads that seem desperate to set themselves apart from their competition by claiming to have features that only some hardcore gamers would be interested in.

Advertising campaigns for some other types of games just look plain awkward. If someone's not interested in Madden, I doubt a website with fabricated tips is going to get them interested. "Cutest quarterback"? Come on, whose friend do they think they are?

A nice quote from Scoble from way back in 2006: the next web is the human web. I think that advertisers could use a bit of that "humanization" too.

The (un)unbroken Vista security

Everyone seems to be talking about how Vista is borked because of those new vulnerabilities. From what I read in the paper, it doesn't actually sound bad enough to justify sticking with XP, as some seem to have suggested.

Nonetheless, holes are holes. Fix please.

Friday, August 8, 2008

Mogo

I didn't know humans were still unmatched by AI in Go. It seems Mogo managed to win with a 9 stone handicap against 8-dan Myungwan Kim, though by only 1.5 moku.

It's an impressive achievement, but I wonder if / when computers will be able to beat pros in even matches.

Firebombing

And people talk about Al Qaeda....

Thursday, August 7, 2008

LHC going online in a month

Cool.

Obesity

Apparently, all american adults will be overweight in 40 years.

I think extrapolation of current trends is a horrible way of predicting the future. Oh well, researchers need money, the media needs ad views, the world moves on.

Respiratory masks

Not sure why anyone would do this. Xenophobia?

It's not like there aren't like a billion people breathing that same same air.

Rejaw

Twitter meets IM.

DNS Poisoning : worse than expected

Kaminsky revealed the details of the flaw and claims it can be exploited in a concerningly wide variety of ways.

Tuesday, August 5, 2008

Why CSS Variables are harmful : the pragmatic answer

So, everyone seems to be commenting on this piece about why CSS variables are bad. It talks a lot about the learning curve issue. Quite frankly, I personally think that's irrelevant since CSS is far from having a challenging syntax. But, I do think variables have their issues.

The Issue: naming conventions

Assuming we are all sane people who don't name our variables "abc123", there are two naming conventions that we can use for CSS variables and I think they are both horrible.

Consider this snippet (which uses the syntax proposed here):

@variables {
  CorporateLogoColor : red;
  TitleColor : blue;
  TitleFontSize : 16px;
  LinkColor : green;
}
h1 {background : var(CorporateLogo);}
h2 {color : var(TitleColor); font-size : var(TitleFontSize);}
a {color : var(LinkColor);}

Look closely at the rules above. How many of them can you honestly call "reusable"? Using the CorporateLogoColor variable to define the font color of footer text or image borders is obviously not a good practice. Likewise, reusing any of the other declarations will just cause a lot of confusion later on. This happens because the variable names are being used to describe the values they reference. We're effectively saying "This 'blue' is not just any blue. It's a Title Color".

I really don't see any reason to create an alias like this. If the class name is descriptive enough, I really don't need to re-describe it. And I could very well use comments if my class name wasn't descriptive.

If the variable name is too generic, it will invariably need to be overwritten by more specific rules (e.g. BGColor vs. ContentAreaBGColor). If the variable name is too specific, it will be bad practice to reuse it when it doesn't describe its purpose (e.g. BGColor being used as a link text color). Perhaps worst still is that I'll effectively need to double the amount of text that I have to type and that users will have to download. Weren't CSS variables meant to accomplish the exact opposite?

Ok, so the semantic approach fails, how can it work?

Well, how about we do this:

@variables {
  Vibrant : red;
  Cold : blue;
  Big : 16px;
  Interesting : green;
}
h1 {background : var(Vibrant);}
h2 {color : var(Cold); font-size : var(Big);}
a {color : var(Interesting);}

This is certainly more reusable, but I can argue that "blue" and "arrow.gif" are more than appropriate for describing things that are supposed to look blue or look like arrows. This approach is prone to the old problem with using values as class names in CSS: with the current spec, if you have a undecided client, you can end up with:

.red {color:blue;}

And likewise, with variables, you could end up with:

@variables {
  Arrow : url(circle.gif);
}

The main difference to note here is that semantically descriptive class names are considered good practice, and descriptive variables, as I've shown above, are counter-productive.

The abstraction argument

Ok, we could go and change "Arrow" to something more generic. "Bullet", for example. After all, this graphic will most likely be used to style variants of "ul li".

The problem is that we will still run into duplication issues:

a.learnMore {
  background:url(arrow.gif) no-repeat 100% center;
  padding:0 15px 0 0;
}

It's pretty obvious why "Bullet" doesn't work here.

Well, so variables suck, right?

I can see one use for them: aliasing. This makes sense:

@variables {
  Arrow : url(files/images/ui/icons/generic_arrow.gif);
}

But let's be thorough. The following is a waste of time, since the alias ends up being longer than the original value:

@variables {
  VibrantRed : #f00;
}
/*compare:*/
a {color:#f00;}
a {color:var(VibrantRed);}
/*note that the 2nd line needs the
@variables declaration in addition to
being more verbose
*/

Last thoughts

I find that most people I meet who like the idea of CSS variables have predominantly imperative programming backgrounds, so I'll just say this as a semi-rant: Look, CSS is not Blub, it's a DSL. It will never be the same as your turing-complete language of choice because it serves a different purpose.

If you find that maintaining your CSS is hard, chances are that you're writing it wrong. Learn to use the comma.

Friday, August 1, 2008

The anthropology of YouTube

This video is absolutely amazing. Watch it. Now.

Large Hadron Collider pictures

Wow, it looks like it came straight out of some crazy sci-fi anime. It's a truly impressive piece of engineering.

I can't wait until it's ready. It's going to bring us closer to answers to so many questions we have about the universe.

Apple fixes Kaminsky's DNS cache poisoning

They sure took their time.

Update: It seems clients are still vulnerable.

Don't complain later

ACTA is getting discussed right now. Get your voice heard now that it matters, not later when it's too late.

Securing your wireless: the police is worse than the hackers

Here's a good reason to not always listen blindly to the experts. The police could come raiding into your apartment. And you don't want to have to talk to the police.

Thursday, July 31, 2008

Heresy onoes!!shift!one

If the author of this article is a car owner, I'll burst out laughing.

Cuil got pwned

I had noticed that Cuil was choking when I tried it. It turns out that it indeed failed because of the flood of people coming in from press coverage articles from all over the net.

When Law gets messy

I think this was a crappy course of action, but it raises some questions about accountability as it relates to free speech, as well as privacy and reputation concerns and the ethics and shortcomings of the monetized damages system.

Capoeira

Cool, I just got home and there is a capoeira group practicing on the park accross the street. Don't see that very often :)

I like watching capoeira circles, it's a very unique and creative form of art. Its history is also fascinating.

An opinion on the Mojave Experiment

Here's an interesting opinion by Wil Shipley.

Not exactly sure if the rant is really valid though. I can run into problems-that-you'd-never-see-on-a-15-minute-test run under any operating system.

I think the point of this marketing gimmick was to break the word-of-mouth myth that Vista sucks. The myth that got tossed around was "I hear it sucks". It doesn't get into why Vista sucks or whether it even really sucks for what you do. And it makes sense that it doesn't go there because once you do, you'll realize that every OS sucks for one or another reason: hardware isn't supported, games don't work, Swiss cheese security, whatever. Marketing is all about the perception.

Now people can tell their friends "oh yeah, they had this clever experiment and it turned out Vista is actually kinda nice", with no zealotry-strings attached.

Remember when the iPhone was first announced and common people like you and me were like "wow that is so hot", without having ever touched one? That's the message that got tossed around. Never mind that the contract wasn't exactly sexy, that you could be getting hundreds of billing pages in the mail per month, or that you couldn't get a good signal depending on where you were. It was "so hot".

Anyways. There's something important about changing operating systems that people seem to ignore: changing habits is hard and annoying. Of course a lot of people go back to the old stuff while it still works for them. It's easy to fall into routine. But that's just looking at one piece of the statistical pie. A lot of people go and switch to Macs. And a lot go with Vista. In a continent with hundreds of millions of people, we can pretty much say "a lot of people this" and "a lot of people that", and chances are, we're probably right.

One point that is more specific to operating systems: adoption and compatibility. Of course 3rd party software isn't gonna run if the OS isn't supported. Of course it can fail to run even when it claims to be supported. Every programmer knows that bugs and cataclysmic turns of events happen. Scope creep, unreasonable deadlines, inept fresh-out-school barely-graduated juniors, the daily wtf, we all have stories.

All in all

I'm not going to say Vista rocks or sucks based on criteria that I can twist to bash/praise other OSes, because that's basically good ol' Microsoft-hating bandwagoning and zealotry. I'm not going to say anything based on personal experience, because opinions only amount to speculation and the only way to really make up our own minds is to go and try it ourselves.

If anyone wants to discuss the ethics of doing an "experiment" as a marketing gimmick, I think the bottom line is this: money drives the economy, programmers get paid and people can afford to spend time blogging about ethics. </opinion>

Lakes in Titan

With a hydrological cycle and everything. Wouldn't it be awesome if it turns out that there's life there too?

Native Canvas in IE

This sounds neat.

Wednesday, July 30, 2008

Mechanical Turk

Interesting. I wonder how they verify that workers are indeed doing their jobs and not just running some random script.

Tuesday, July 29, 2008

Mojave

The website.

I still think it was a clever marketing trick.

Monday, July 28, 2008

Stupid Filter

Agree, disagree, I think this is an awesome idea.

It doesn't catch the "first" comment, though.

Cuil

So everyone is talking about Cuil and how Google is not worried.

I tried a few searches and I think it's actually pretty neat concept. It's very categorical, which allows for easier exploratory searching than Google, and it uses the screen real estate evenly when returning results. It's too bad it doesn't have a quick Wikipedia link.

My critique is mostly from a usability perspective and goes to how they have images beside entries, which I consider distracting for anything but logos, and the somewhat arbitrary placement of things in the page. In a regular search engine, users expect items with the highest relevance near the top, so it's easy to develop spatial memory and just look at the first 2 or 3 links. In Cuil, there's no no-brainer way of figuring out which one is the highest relevance link without putting a bit of effort into actually scanning the page. Also, they could align the entries so that they are always the same width and height and so that they don't scroll off the page.

I've also come across many links within the UI that gave me no results. I get that in Google sometimes too, but far less often. Another thing that could be better is the page loading speed.

More on loops

Someone had asked me to redo my loop benchmarks a while back. Looks like I was beat to it.

It's not your fault

A quote from Johanna Rothman:

A salesperson should never have to apologize to me about the lack of user interface keeping me at the store longer than it should have.

via

MPAA to show us where to get things legally

Twas about time they did something like this. But then again, link, or it didn't happen.

Gender equality

Nice post that talks about policies about behaviour that wouldn't had been missed if they had died with the end of the last millenium.

Do no evil?

Well, how else would Knols not flop?

Friday, July 25, 2008

Microsoft to sponsor apache

Cool. Though 100k / yr doesn't pay for a whole lot nowadays.

On Programming

nice article. Pretty much sums up how I feel about programming :)

Thursday, July 24, 2008

IE8 in '08

Or so the rumours say. I'm very excited about this: we will finally have full ACID 2 compliance across the board. Hello :before and :after :)

The only thing that worries me is that the relatively short beta period might leave a lot of bugs to be patched after the official release.

The death of software patents

Interesting.

Can you break your own software?

Schneier talks about Kaminsky's DNS cache poisoning attack. The last few lines are inspiring.

Would you be able to tell what parts of your systems are weak in terms of security? Remember, systems are not just code. You need to think in terms of what each user can do that could be harmful (to the code, to the data, to the infrastructure, and especially, with the trend towards web-based services, to other users). What happens if there's a power failure on your db server? What happens if I maliciously overwrite JQuery in my advertising code? Can I crawl your site and write a script to try people's publicly available data as their login passwords? Can I find this info by crawling other sites? (son's name is a good one to search for). Can I use Google Maps and IP locators in conjunction with the ability to link to off-site, dynamically-generated images as my forum avatar and find your physical location? Can I easily spoof your emails? Is your captcha broken?

There are so many things that could be vulnerable that even starting to look for them could be discouraging. But, as the old saying goes, it's better to be safe than sorry.

Do the test

On the link in the post about magic from yesterday, there was an video with basketball passes.

This one is so much better.

Impress your friends with fake ad-sense earnings

Using document.designMode and the printscreen button. Of course, you could just use Firebug, jash or, if you're just doing screenshots, Photoshop.

You could also import a library like Prototype (read the jash bookmarklet url to see how that is done) and write something like javascript:new Ajax.Updater(document.body, "myspoofingpage.html"); on the address bar.

document.designMode is what most web based WYSIWYG editors use to provide editability, except that editors usually enable it in an iframe rather than the actual main page. The advantage of using designMode over pure javascript is that the cursor manipulation is native with designMode, hence it's more responsive.

Anyways, the only thing I don't get is: why does anyone ever feel the urge to pretend they are richer than they really are? That's so lame.

Warning Forever

For those wondering what the heck is that link on "games" on my About me section, it's the download page for Warning Forever. Here's the wikipedia entry on the game.

Bascially, the main feature of the game is that you only fight bosses, and each boss becomes progressively harder, based on how you killed the last boss (i.e. more armor where you shoot more and more of the weapons that killed you before).

Another lawsuit blooper

This one seems to step all over the US constitution.

For life outside the (techie) bubble

Interesting article, especially if you know people like these. Techies, cringe in disgust.

Seriously, though, sometimes it's nice to remember that the world looks nothing like the Blogosphere: there are a ton of people who don't drool over the latest graphics cards and are not interested in whether you think Ruby is better than Java.

Nintendo, at least, seems to understand that.

Yet another example of people trying to use law to stop progress

Brought to you by Bridgewater Telephone in Minnesota.

Sigh. Does it ever feel like some lawyers act like corrupt communist leaders that censor and ban everything they don't like? Except that they are not leaders, but pawns.

A change of heart on cell phone radiation

I blogged about this issue before and I'm changing my mind about how worried I should be.

Pittburgh Cancer Center released an advisory to limit the usage of cell phones "to be on the safe side". As it turns out, there's still no conclusive evidence of links between long term cell-phone usage and cancer.

At least from this article, it feels Dr. Herberman (who released the advisory) is basing his conclusions on biased, not-necessarily-peer-reviewed research. Look, doc, I appreciate your concerns, but going around spreading fear, rather than information, is usually not an awesome way of doing things.

Google Knol is out

With a ton of medical content, apparently.

Wednesday, July 23, 2008

Magic and Psychology

I love magic, I had a site dedicated to teaching card sleights and tricks when I was in high school. Studying this art teaches a lot about how people think and connect ideas. The down side is that you end up being able to figure out how most tricks were done, but watching people's reactions is fun in its own way too.

First impression of Git

Maybe there's a better around this, but why in the world is there even a way to check out a repo that requires me to write the username and password in plain text?

Exploring Fonts

Interesting.

Slimmed down MySQL

Seems InnoDB is the big thing here. I'm wondering how it compares to SQLLite and if/how it can be made to work under Windows.

FBI

Funny... if you're not a concerned american.

Blogging failing?

This is a really nice piece of metablogging. I suppose we really just need to be honest and ask ourselves: for whose sake are we blogging, our own's or or our readers'?

Granted, I know I don't have a whole lot of readers, bite me.

Oldest Bible going online

Cool. Now I need to learn some greek.

Tuesday, July 22, 2008

A quote from John Timmer

Enterprises should think carefully before adopting open source solutions due to persistent security issues, according to a report by the security firm Fortify. The report arose from Fortify's efforts in the Java Open Review Project, in which it subjected open source Java projects to a full security audit. Fortify's concerns arise not so much from the bugs it identified as from the fact that it was difficult to identify anyone responsible for fixing them; many persisted for several iterations of the software.
via

Amazon S3 downtime

You may have heard that Amazon S3 was down for a fairly long time on Sunday (not sure how long, I hear between 3 and 8 hours).

It raises an interesting point: considering what 99% uptime actually means in terms of hours per month, should developers think about redundancy? And what is the best way to go about it? What if you have a partial lock-in by using Google app engine or Jaxer?

My guess is that the open source community will eventually catch up to offering PHP mashups that are similar to popular "cloud" APIs, and that numerous web hosting companies will start adding these mashups as features to remain competitive. It's happened with Fantastico, even Rails is now available in a number of hosts that didn't offer it a year or two ago.

As far as S3 goes, I'm not too familiar with the options. Perhaps one could consider Edgecast? Does anyone know of other providers?