The Social Graph Is Neither

The Social Graph Is Neither is a brilliant article on why the current idea of “social networking” is utterly flawed. Some highlights:

But even if we go ahead and build the Semantic Web, 2004 edition, and populate it with information about all our connections to other people, it still won’t be expressive enough.

There’s another fundamental problem in that a graph is a static thing, with no concept of time. Real life relationships are a shared history, but in the social graph they’re just a single connection.

Social networks exist to sell you crap. [...] Because their collection methods are kind of primitive, these sites have to coax you into doing as much of your social interaction as possible while logged in, so they can see it.

Open data advocates tell us the answer is to reclaim this obsessive dossier for ourselves, so we can decide where to store it. But this misses the point of how stifling it is to have such a permanent record in the first place.

When we travel, we travel not to see new places with new eyes; but that when we come home we see home with new eyes.

G. K. Chesterton

Python equivalents to PHP’s foreach

One of the first problems I had when learning Python was looping over data. PHP’s arrays are very versatile, but in Python, you need to think in terms of lists and dictionaries.

Here’s a cheatsheet for various foreach variants, translated into Python:

Looping over a numeric array (PHP)

$items = array( 'orange', 'pear', 'banana' );
 
# without indexes
foreach ( $items as $item )
	echo $item;
 
# with indexes
foreach ( $items as $i => $item )
	echo $i, $item;

Looping over a list (Python)

items = ['orange', 'pear', 'banana']
 
# without indexes
for item in items:
    print item
 
# with indexes
for (i, item) in enumerate(items):
    print i, item

Looping over an associative array (PHP)

$continents = array(
	'africa' => 'Africa',
	'europe' => 'Europe',
	'north-america' => 'North America'
);
 
# without keys
foreach ( $continents as $continent )
	echo $continent;
 
# with keys
foreach ( $continents as $slug => $title )
	echo $slug, $title;

Looping over a dictionary (Python)

continents = {
    'africa': 'Africa',
    'europe': 'Europe',
    'north-america': 'North America'
}
 
# without keys
for continent in continents.values():
    print continent
 
# with keys
for (slug, title) in continents.items():
    print slug, title

Important note: Unlike associative arrays in PHP, Python dictionaries are not ordered.

Bonus

To see all the methods that a list object has, open a python console and type help([]). It’s a lot faster than googling for documentation.

For more awesome Python tips, see Code Like a Pythonista: Idiomatic Python.

OS Mess

I just realised that every major desktop operating system is scrambling to reinvent itself.

Microsoft is working on Windows 8, which looks like will come with a HTML5 component.

Apple recently launched OS X Lion, which started integrating aspects of iOS.

On the Linux front, Ubuntu’s last release switched to Unity, while all the rest of the distros adopted Gnome 3.

All of these transitions have received mixed responses, since none of them are fully backed yet.

Interesting times.

Disciples vs. Peers

I don’t want to help random people do great work, I want to TRY to do great work myself, and CELEBRATE other people who are ALREADY doing it.

Hugh MacLeod

And that is why I stopped spending time on wp-hackers and on WPSE.

svn tagging is a joke

I keep reading the phrase “Git isn’t better than Subversion, it’s just different”.

I’m sure a few years ago people said “SVN isn’t better than CVS, it’s just different”.

Anyway, here’s one key aspect that shows how primitive svn is:

Subversion doesn’t actually have tags or branches. It only has folders.

The usual branches and tags directories you see in most svn repositories are not special. They’re just a naming convention.

After you “tag” a release (basically copy the trunk folder into a new folder in tags), you can modify it at will and Subversion won’t complain.

Compare with Git or Mercurial, where a tag is a read-only pointer to a specific changeset.

The same with branches: in svn you create an entire copy of the trunk folder, while in git you just create a pointer which advances as you make revisions.

If you’re interested in learning more about git, I recommend reading the Pro Git book. Also, Hg Init is an awesome introduction to Mercurial and to distributed version control systems in general.

Value, Identity, State

As web developers, one thing that we don’t have to worry about is concurrency. We don’t have threads, we don’t care about multiple cores etc.

We do have to worry about asynchronicity, because of JavaScript, but that’s a fun challenge, in my experience.

I came across a fascinating talk from the creator of the Clojure language, Rich Hickey, which is called Persistent Data Structures and Managed References.

In the first part of the talk, he defines and clarifies the concept of state, by first defining the concepts of identity and value.

Then he goes on to describe how Clojure represents composite objects such as hash maps and how it’s able to keep them immutable in an efficient manner, by using persistent data structures.

It’s well worth the watch, even if you might not end up ever writing a single line of code in Clojure.

WordPress 3.1

La scurt timp după lansarea versiunii 3.1 de WordPress, am rămas plăcut surprins de articolul Anei Matei în care îmi mulțumea pentru contribuția pe care am avut-o la această versiune.

I-au urmat apoi exemplul Tudor Bezea, Cristian Oprea și Manuel Cheța.

Lor, inclusiv celor care au lăsat comentarii la articolele respective, nu pot să le zic decât “Cu plăcere”. Serios, a fost super. :-)

Aș vrea să dau mai departe mulțumirile celor 2 moderatori, Eugen Păun și alin1987, care răspund cu răbdare întrebărilor de pe forumul de support în română.

De asemenea, să nu uităm de echipa de localizare: Cornelia, Stas și Ciprian.

Dacă vreți să mai cunoașteți și alți dezvoltatori români axați pe WordPress, fac colecție pe twitter: Romanian WordPress Developers

My Religion

This extra bit of free will choice, which did not exist before the tool was invented, is itself good, even if the tool causes harm. Having the choice itself is a positive good. That extra positive good tilts the 50/50 balance slightly in favor of the good, but only by a little tiny bit. 

But it turns out, a little bit is all we need. Because if we use technology to create only one percent more than we destroy a year, that one percent difference (or even one tenth of a percent difference), compounded year by year over centuries will make civilization.

[...] today, somewhere in the world, there is a boy or girl already born, a Shakespeare of their generation, who is waiting for us to invent their technology. Until we create their tool they cannot discover and share their genius. So we have an obligation to increase the amount of technologies in the world. We benefit from people in the past who bestowed on us the possibilities inherent in the alphabet, in printing, the book and newspapers, so we too should be inventing as much technology as we can in the hope that in the future more people will have the option, the possibility of using their fullest talents for us all.

The Positive Balance of Technology

This is why I write software. This is why I release it as open-source.

It’s not even about making things, real or virtual. It’s about distilling knowledge and sharing it.