links for 2009-10-28
October 28th, 2009 by ravi

links for 2009-10-26
October 26th, 2009 by ravi

MySQL hackery: ON DUPLICATE KEY with IF!
October 15th, 2009 by ravi

Once again, since the Googles did not return this hack of mine as a possible answer (to a question that perhaps only I am concerned with):

Say you want to insert a row into a MySQL table, and if the value you supply for a unique key field already exists, then you just want to update the row that contains that value (for that key field). MySQL has a nifty little bit called ON DUPLICATE KEY UPDATE which lets you do exactly this. But what if you want to take it to 11, and carry out the UPDATE only if some condition is true. Below is my somewhat ugly hack to achieve this:

What this does is:

INSERTS a new row if no unique key has a duplicate value.

If there is such a duplicate value, then it UPDATEs the field fld2 with the supplied value for fld2 IF the supplied value for fld3 is greater than the current value for fld3 in the existing row.

Here, id is an auto-increment field that I do not want modified by the UPDATE; hence the LAST_INSERT_ID trick.

CAUTION: Use at your own risk, since I am not an SQL guru.

Finland: life, liberty and the pursuit of fast torrents
October 15th, 2009 by ravi

The move by Finland is aimed at bringing Web access to rural areas, where access has been limited.Finland has become the first country in the world to declare broadband Internet access a legal right.

The move by Finland is aimed at bringing Web access to rural areas, where access has been limited.

Starting in July, telecommunication companies in the northern European nation will be required to provide all 5.2 million citizens with Internet connection that runs at speeds of at least 1 megabit per second.

via Fast Internet access becomes a legal right in Finland – CNN.com.

What’s up with CNN’s graphic (see above) anyway? A Dell monitor, Apple keyboard and mouse, and what looks like Windows style icons/placement. Couldn’t they get a consistent stock photo that depicts fast Internet access better than this?

Cloudy with a chance of data loss
October 13th, 2009 by ravi

Microsoft and T-Mobile have lost T-Mobile user data:

The cellphone provider T-Mobile and Danger, a subsidiary of Microsoft and one of T-Mobile’s partners, said over the weekend that a technical glitch in their computer systems would probably result in some customers losing their personal information like contact names, phone numbers and digital photos.

via Glitch Could Erase Data for Some T-Mobile Users – NYTimes.com

What is interesting is that there seem to have been no backups to recover from? Why not? Well, everyone from Adam Smith to Richard Stallman to Joe Stiglitz has pointed out, in their own way, the simple fact that the your interests and that of those you get/buy services from might not always coincide, and in a situation where there is a great imbalance of knowledge/expertise, your ignorance can be easily exploited. This is not a point that is particular to cloud computing, but cloud computing, when consumed as prescribed, does increase your dependency and lower your control over your data.

The solution may not be to turn Luddite and shun technology, but the recent Google/Gmail issues and all that has occurred since (Apple’s MobileMe problem, the drama surrounding Tr.im, the above T-Mobile/Microsoft issue) should encourage us to think harder, especially about the trend of moving away from standards, published protocols and data formats, and especially the separation of data and presentation.

Often times, the move to cloud computing (e.g: web-based email) from older technologies designed with the above criteria (open standards, separation of data and UI) in mind, is a step backward. It should be unsurprising that even as Gmail was suffering from a prolonged outage for the web interface, the standards based and client-server IMAP interface was fully functional. For those who started using the Internet after 2000, cloud computing (under which label we might legitimately include web-based services, as per their own claims — to hesitantly quote Larry Ellison: “The interesting thing about cloud computing is that we’ve redefined cloud computing to include everything that we already do”) might be synonymous with the Internet itself (just as the term World-Wide-Web is often used interchangeably with the Internet). Online services are the only ones they may be aware of, and this serves vendors in that space quite well. They would prefer that you forget the hardware device you use, the peripherals that connect to it, the power of the operating system that enables all your activities, the idea and existence of rich, powerful desktop tools (software). Again that serves their interests. Does it always serve yours?

Download: Audacity of Tanish 1.0.1 for WordPress
October 6th, 2009 by ravi

This is a small release that replaces images that may or may not be GPL/free with ones that definitely are (it also includes more background images). There are some minor fixes and also some code cleanup.

Download Audacity of Tanish for WordPress 1.0.1

Download Audacity of Tanish for WordPress 1.0.1

This should be up at WordPress as well shortly.

Mediawiki and user passwords
October 2nd, 2009 by ravi

I just spent a few hours trying to figure this out, and in the interest of saving someone equally clueless the same effort, for the Googles, a summary of my experience with user login issues in Mediawiki.

My setup uses the LdapAuthentication extension to, as can be expected, authenticate users using an LDAP directory. A few members of my team complained that they were unable to login, even though their Mediawiki login (with the first letter in lowercase) matched their LDAP uid. I am yet to nail down the exact cause of this, but it seems to have something to do with certain special characters in the password string. Change the password in LDAP (to not include these characters) and the problem disappears.

What made matters worse in my case was that in order to debug the situation, one of the users set his password to his login name (admittedly a highly insecure action, but this is not a public Wiki, and the change was temporary) and login attempts continued to fail for this person with the new, simple, password as well. Turns out that buried in the Mediawiki code (in includes/User.php) is a function isValidPassword() which implements a check that returns failure if the password and username are the same! Unfortunately the error returned is a generic “Wrong Password” error.

Which all made for a very enjoyable Friday evening!

SIDEBAR
»
S
I
D
E
B
A
R
«
»  Substance: WordPress  »  Style: Ahren Ahimsa