Sometimes you want to add a list of A-Z links to anchors on an existing page that is coming from a database. There are several solutions to this, the easiest being just to create all of those links by hand but this is needlessly tedious.
I came across the following code from an old project.
function oldatoz() // old function, pretty braindead, creates A-Z anchor links
for ($i=65; $i<=90; $i++)
$x = chr($i);
echo " | <a href=\"#$x\">$x</a>";
This gives us an orderly list listing all 26 letters of the alphabet. It's clever in that it uses very little code.
However this can become confusing if the page you have doesn't actually contain all these anchors. What if you want to exclude instances like #Z because there are no listings that start with a Z?
The answer is simple: we'll have to look it up and see what we actually need to use. This isn't too hard if you use SELECT DISTINCT LEFT.
function atoz() // new function, looks in the database for which starting letters are actually in use
$query = "SELECT DISTINCT LEFT(titel, 1) AS anchor FROM links ORDER BY anchor ASC";
$result = mysql_query($query);
while($abcd = mysql_fetch_array($result))
$linky = ucfirst($abcd); // be sleek, sexy and a slinky!
echo " | <a href='#$linky'>$linky</a>";
As you can see this creates a list of anchors that excludes certain items because they are not in use. Insert this function after every 10 records or so using something like if ($j % 10 == 0) atoz();
The downside to this method is that it is inefficient but my database is fairly small and unlikely to grow to millions of records so it's an acceptable tradeoff.
Perhaps next time we'll look at creating the anchors automagically.
WTF are we going to do now that Google Reader is stopping? I rely on the Reader API to sync up my iPad, iPhone, Mac en webbased RSS reading (on my PC at work). As evidenced above by the stats Google itself provides I am deeply addicted to the Reader service.
I guess we have a few months before the end is truly here but I really hope someone comes up with a syncing solution that works as well across all these kinds of different platforms. I will gladly pay $25 a year for that. Heck I'd even pay €25.
Unfortunately Google never thought to ask for my money. Which is their loss. And mine.
First of all welcome back regular readers, it's been a while since my last post but I haven't been inspired to write much recently. I know some of you still keep up with the RSS feed hoping I'll eventually come out of hibernation, and while I can't promise to update the site regularly again, rest assured I'm not done with life and ranting about life so who knows what will happen in the future?
Recently a few items have been in the (inter-)national news that have really set me thinking. They all have something to do with what's called the Just-World Fallacy. In this thought provoking post (I hope) I'll be tying together rape, a dutch kick-boxer (I think) who can't seem to stop hitting people, even when he's on a night out and the Greeks' supposed responsibility for the Euro crisis.
An eclectic mix, to be sure and you may wonder where it's all going and so do I as I'm writing this off the cuff so to speak, rest assured I do have a point to make and I'm sure I'll get there, eventually.
First of all anyone who's followed the news over the last few days will have noticed that Republican politician Todd Akin got in deep trouble for stating "If it's a legitimate rape, the female body has ways to try to shut that whole thing down" when defending his anti-abortian stand, even for victims of rape. A remarkably stupid thing to say and counter to basic biology. The media would have you think statements like this are controversial, I would like to posit statements such as this are counter to Reality. A subtle distinction maybe, but I feel compelled to make it. There are hundreds (if not thousands) of news articles right now discussing the issue and the statement has been widely decried even by Republicans, though I'd like to point to the following opinion blog from CNN which states that this is might not be a simple foot-in-mouth problem, but representative of a deeper underlying issue that Republicans have with the issue of abortion and rape and which they just don't like to have pointed out in public (especially just before a presidential election): GOP policy is the scandal, not just Akin's comments.
Clearly victims of rape have only themselves to blame. The fact they got pregnant proves that.
Then we have a Dutch professional kick-boxer who's been in the national news lately because he's accused of assaulting people in nightclubs and in VIP lounges. He's also sleeping with the ex-wife of national football icon Ruud Gullit (he of the dreadlocks), she is also a daughter of famous football legend Johan Cruijff which adds some spice. I generally don't follow the rich and famous but a recent article I saw on Google news in right wing opinion magazine Elsevier defended the kick-boxer Charmante Badr Hari verdient dit niet (links to Dutch language article, no English version available, use Google translate or just take it as read, title translates to 'Charming Badr Hari doesn't deserve this'. 'This' being the accusations and subsequent criminal investigation). In this blogpost right wing commentator Leon de Winter defends Badr Hari because he's met him once and apparently felt him to be a nice bloke. De Winter blames the victims of the attacks because (roughly translated and only slightly paraphrased) 'his [Badr's] appearance unsettles alpha males', and that means 'they confront him especially if they have been drinking and snorting (what was victim Koen, a married man, doing at 4 o'clock in a club, and what the heck was in his blood?').
Clearly the victim had himself to blame. A respectable married man has no reason for being in that place at that time, apparently. And the victim(s) were probably high on drugs anyway.
The third case I'd like to point out has to do with the Euro crisis and the role of the Greeks in this. The crisis has been going on for 2 years now so I'm not going to link to any news articles (my guess is we'll be seeing them for another year at least) but a common theme in them is that the Greeks have only themselves to blame for their woes and enforced austerity regime because they all refuse to pay taxes. Greek society has been struggling to raise taxes, reduce government spending and reduce debt by writing off unsustainable debt. While it is a matter of fact that many Greeks hardly paid any taxes and the country should probably never have been admitted to the Eurozone, pointing this out constantly does nothing to help them out at this point in time. Nevertheless the narrative in The Netherlands (one of the bigger net-payers of these loans) is such that every time Greek austerity and the possibility of further loans get mentioned people instinctively react with the thought 'why throw good money after bad, have them pay taxes for once, what do they think pays their new loans for fuck's sake?'.
Clearly the Greeks have themselves to blame for their woes and we're forgiven for not caring about people begging in the street and not being able to get medicines even when desperately ill and in hospital.
You see, while I would never espouse sentiments such as those by Leon de Winter or Todd Akin I must admit that I have fallen into the trap of blaming the Greeks for their woes and by extension our own national economic problems stemming from the euro crisis. I also blame spineless politicians for speaking with two tongues and not having the guts to present real solutions, but that's beside the point here.
The just-world fallacy is a powerful method human beings employ to make sense of the world and our place in it. It's a natural method to make sense of the world we live in where horrible things happen and we are not always in control or able to change things. Therefore putting a portion of blame on the victim makes us feel more in control than we really are and therefore makes life easier. You can understand this is a powerful evolutionary advantage. Crazy people standing around drooling in the rain suffering from the weltschmerz don't reproduce as much. (Oooh, a crappy evolutionary socio-biological statement with zero evidence, I hate myself so much right now, you have no idea.)
But that doesn't make these thoughts right. After all, that's why it's called a fallacy!
Understanding that our minds are imperfect vehicles with which we somehow have to live makes us understand that we should regularly check our internal moral compass, to see whether what we think is really so or if maybe we're representing the external world in overly simplistic terms.
Please read the Psysociety blogpost as this should change the way you view the world and your own place in it. I know it affected me profoundly and I've been thinking about it all day.
Ooh, one final thought. Many commenters on the Akin 'controversy' ask themselves why any woman would ever vote for such a misogynistic ass. I would go further and ask "why would any human being vote for such a dickhead?" Are only women allowed to be incensed by rape?
Holy crap, at what point did the iTunes store get hold of an entire Metal section that's actually worth the name? Seriously, the Recommended Artists list contains Bathory, Candlemass, Sepultura, Death, Morbid Angel, Sodom, Kreator and Vader. Those names are legendary. Clearly there's either some very good algorithms at work or Apple has hired someone with knowledge of the genre. Top job!
And here I was, thinking that I had finally paid off all outstanding bills on my credit card.
The first computer I ever touched was a Commodore 64. It would have been around christmas 1982 I guess. My mom had got a job with scientific publisher Samsom, now part of Reed Elsevier, as a contact for bookstores. She'd had the opportunity to take a computer class and as an incentive all those who took part could get a C64 at home to practice and play with. I think she took a minor pay hit for a few months to eventually make it ours and not have to return it.
Soon we were copying games on cassettes from her colleagues and kids in the neighbourhood, we had a flourishing illegal trade in games going on. At that time a popular childrens' scientific magazine called Kijk (it still exists) published small BASIC programs that I would laboriously copy out line by line. I was learning the basics of BASIC. With for while loops, if then statements, and of course the ever popular go to command. I never got really far with BASIC as my interests shifted to biology and I spent a lot of time on a farm in the neighbourhood (we lived at the edge of town), I was learning about cows and crops and the cycle of life.
I finished secondary education without ever touching a computer for school work, I typed up my serious papers on my parents' orange manual typewriter. When I went to the teachers' academy in 1989 to learn Biology and Chemistry the mix of computers I saw there was eclectic. One of the Chemistry teachers used C64 machines to read in and plot solution gradients or something. We had a few dozen DOS + WordPerfect machines in the library. They were a bitch to work with. In later years Windows 3.11 (I think) came out. It had graphical programs that allowed you to adorn your papers with clipart and graphical crap. Yet the best they seemed to be able to do was make butt ugly extruded faux-3D letters with added geometrical shapes filled with nauseating colours.
After I quit my studies I started doing volunteer work in cultural center EKKO, which programs bands, disco nights, film, video, dance, classes etc. It was there that I first met Macintosh computers. I didn't really know anything about them but I'd used several different types of computer with several different types of operating system so after some initial trepidation I delved into the Mac. I haven't looked back since. I started writing nonsensical short stories for the internal magazine, distribution about 100. The ease of use of a Mac made me realise computer could be intuitive and not stand in the way of the creative process. Apple's operating system made computing effortless.
Soon I applied for the position of editor of the internal mag as the previous editor wanted to quit. It was then that I truly realised what a Mac could do. I worked with Photoshop, QuarkExpress and numerous other programs, all at the same time. I would shuffle files around on the internal AppleTalk network. I would hook up scanners and optical drives and download pictures from the early internet using sites found with AltaVista. I was completely hooked on the Mac and I bugged my good friends Jurjan and Jeroen, who I met at EKKO, endlessly about Macs and what made them tick. How they could be made faster by restarting and selectively enabling or disabling certain extensions, depending on what resources you needed for a particular job.
In 1996 (I think) I got my first Mac. Both Jeroen and Jurjan had bought new machines and they had combined their old computers into one super monster. An Apple Macintosh LC 475 with FPU (floating point unit). It had a hard drive measured in Megabytes, a speed of about 25 MHz and a small 13" colour screen. I used that computer with immense pleasure for a few years until I got a job and saved up so I could afford a new computer. I bought a Umax C500, a clone, one of the reasons Apple seemed to be going under at the time.
Shortly after I bought that machine Steve Jobs came back to Apple and killed the clones. He also killed off almost the entire line of Apple's computers, radically simplifying the business. When the iMac came out I knew Apple would get on top, the things were popping up everywhere in pop-culture, from Ikea catalogs (where every third page seemed to feature some lickable semi-transparant computer to tv shows where, inevitably, good guys used macs and bad guys used wintel (it was a shock to see Mr Glass' setup in Unbreakable).
Since that time in EKKO I don't think it's ever been a question that I was a Mac man. I would never voluntarily use anything else. The ease of use of the Mac was only reinforced by working with PCs at my job. When my Umax became too old and slow for me I bought a new middle of the range PowerMac as the MacPros were then called. I gave my old clone to my mom, who used it for years to play Snood and browse the web and do her email.
When Apple introduced the iPod I didn't jump on the bandwagon immediately. I calculated how much room I would need to store my entire collection of metal, I would have to wait until such a time as when Apple came out with one that was more my size. The 3rd generation provided this with a 30Gb iPod. I also bought a 60 Gb version a few years later. I still have both of them around, they hold an extra backup of some video files created between 1998-2000 when I was doing VJ stuff with Jurjan and Jeroen, all created on Macs of course.
In the early years of the new millennium I held out on getting a mobile phone. They seemed unnecessary and clunky. I relished not being in touch all the time. When asked whether I would ever get one I joked that I might if Apple came out with one. Over the years this joke turned more and more into reality as rumours started to come out that Apple was really working on a phone. When the first iPhone came out I saw the presentation and knew that I would probably get one as soon as they were released in the Netherlands. The iPhone 3G was the first model officially available and I got my name on the waiting list on the second day. It transformed my life, not because I could give up my landline and call mobile, I have never phoned much and I hardly do so now. No, the biggest part for me was being able to browse the internet while on the go. I could travel to my parents in the train and look at my shifting position on Google maps, switching to my RSS feeds to read up on the latest on ScienceBlogs.com. I could check my email when sitting in the bus to go to a meeting. I could take notes during meetings and send them via email straight away. In short: I had bought myself a very tiny yet fully workable Apple computer, which also happened to make calls.
During the early years of 2000 I bought another new Mac. This time I bought a G4 with Mac OS X. The ability to run Apache, MySQL and PHP transformed my working life as I was suddenly able to create scripts on my home machine, test them locally and then send to a server at work. I started to learn SQL, scripting and the arcana of CHRON. I put the Terminal app as my second in line right after the Finder, where it remains to this day, even though I don't poke around in the Unix parts much anymore as my job and interests have shifted somewhat.
The last Apple machine I bought was the first generation iPad, which it seems I mostly like to use when the days get shorter. I used it hardly at all in summer but as the days shorten I find myself more on the couch with my iPad, browsing the news or checking out videos, and less on the desktop machine.
Over the years I have used many Apple products, from computers to mobile devices to printers to monitors. And they all, still, invoke this wonder: how can something this complicated and technologically advanced be so much fun to use?
Apple has generally been criticised for not giving people enough choice, not giving them enough "openness", whatever that is. What Apple realised is that choice is confusing. Taking choice away leads to quicker decisions and that, ultimately, leads to more productivity and less frustration.
Apple has always balanced on the edge of what's possible. What can we eliminate in order to make the experience more friendly? What can we do to make things easier, less confusing, more pleasing to look at and more consistent?
The iPhone's one Home button on the front is apparently a design compromise Steve Jobs had to accept. He wanted a phone with zero buttons. But he also realised that you can't always take everything away, and that products are built by a team. He challenged his teams to come up with the best, which is why I have every confidence Apple will continue to be a market leader for some time to come. Will Apple fade? Undoubtedly, nothing lasts forever. Even the greatest empires fall, they did so in ancient times and there's no reason to think they won't do so now.
But in the mean time we'll live in a world shaped by Apple's products. Even if you've never used a single Apple product, the machine you are now using is most likely beholden to Apple and Steve Jobs' vision of a simpler future, where technology is created to serve man and not the other way around.
Make no mistake, now that the singular vision of Jobs has gone from the industry we might see stagnation for years to come as competitors for the last decade have shown themselves completely (I would almost say pathologically) incapable of designing anything new or groundbreaking themselves. Here's hoping Apple still has loads of stuff on the shelf, things that might not even be feasible for the next ten years.
I am sad that Steve passed away so young, but his legacy cannot be underestimated. I wonder what future historians will make of his idiosyncratic style and the impact of this one man on an entire world at the dawn of the electronic age.
RIP Steve. May your atoms be scattered to the corners of the earth and hang around for trillions of years.
OMG, look at it. I'm so proud, my sister is on the internets in a scientific paper: http://www.annals.org/content/151/2/110. She's listed as the second author also, which is pretty cool next to all those MD/PHDs (RN = Registered Nurse).
She's also mentioned as an author in a second paper, but neither are available for free it seems. Ebsco Academic Search has both if you have access to that.
Ever since the heady days of Mac OSX 1.0 I have used a program called Youpi key that automates keystrokes. I use it to type my home address, my email address, several of the URLs I often use, passwords for sites etc. etc. at the hit of a special key combo. Saves a lot of time. In 2003 the program stopped being free but despite my not upgrading since then it continued to work, how's that for value?
Unfortunately lately it seemed to be spewing out loads of error messages in the Console because it used frameworks deprecated by Apple. These frameworks are set to disappear completely in the next OS X version so the time had come to do something.
Almost 10 years of use from a free program isn't bad so I tried out the new version, now called iKey. After the trial ended I bought the program because it's saved me about a zillion lifetimes typing already so I guess I owe the programmer a bit.
Besides typing you can also use it to execute applescripts so you can control programs in the background (like iTunes, or manipulate the system sound level) as well. You can also limit keybindings to specific applications and do lots of more stuff I don't use.
Recommended if you have a Mac. Even if you wind up using only 10% of the possibilities, like I do.
Ok, I got interested and did a quick Google search which led me to one of those questionnaires that determines your personality type. I'm an INTJ and frankly some parts of that description are somewhat disturbing.
INTJs are known as the "Systems Builders" of the types, perhaps in part because they possess the unusual trait combination of imagination and reliability. Whatever system an INTJ happens to be working on is for them the equivalent of a moral cause to an INFJ; both perfectionism and disregard for authority may come into play, as INTJs can be unsparing of both themselves and the others on the project. Anyone considered to be "slacking," including superiors, will lose their respect -- and will generally be made aware of this; INTJs have also been known to take it upon themselves to implement critical decisions without consulting their supervisors or co-workers. On the other hand, they do tend to be scrupulous and even-handed about recognizing the individual contributions that have gone into a project, and have a gift for seizing opportunities which others might not even notice.
I finished a big project a few weeks ago and the description above is eerily familiar.
You all read Kottke right? You should, you know. He's why I and many other lazy writers don't have to post something every single day.
10 Myths About Introverts is something you should read if you ever plan to interact with me.
For a long time I thought I was actually borderline autistic, I don't connect easily to other people and I become actually almost physically uncomfortable when people I don't know that well engage me in chit-chat.
It's not that I don't have an opinion on the weather (everyone in the Netherlands does, it's our favourite topic!) or don't want to talk about my weekend/interests. I also don't mind if people tell me about their holiday/weekend/whatever. But I probably won't be the first to enthusiastically ask you what it was like. I figure that you'll tell me if something interesting happened.
This probably comes across as my being terribly uninterested, aloof and maybe ever at times arrogant. This isn't true, it's just that myths number 1 though 3 are playing their cards, and they're all face cards.
If I have one issue with the list it's that I don't really agree with the tenor of item 10. Especially the link to higher IQ, while maybe true, sounds like a rather weak self-satisfying argument and to my mind fails to adequately express the fact that we're all different and we all have character traits that range across the spectrum of human behaviour.
Of course no one is just an introvert or just an extrovert. Nothing in Biology is ever purely black and white, there's always a sliding scale. And there are many confounding factors at play in social interactions that make someone more or less introverted depending on the social situation.
I keep forgetting I have some movies from the trip to the Galapagos. They're rather small as I was unfamiliar with the (now deceased) camera but they still manage to look reasonable.
Here's some clips I put together of a young sea lion playing in tidal pools. First it's in a small pool alone looking to see if it can catch a fish (there's at least 3 in there but they're hidden in cracks). After a while the pup gets bored as all it manages to catch is a stick so it sets of for another pool where a friend joins in for some mad rushing about.