SQLite3: Beware of Concurrency
SQLite3 is a very lightweight implementation of a SQL database. I’ve been using it in conjunction with Python on a single-threaded tool. This morning I started refactoring my tool to have multi-process support, but I was interrupted by the following error:
sqlite3.OperationalError: database is locked
After reading through the SQLite3 documentation, I found that SQLite3 does database-level locking when performing write operations. This means that all hope of parallelizing SQLite3 write operations is lost, because SQLite rejects a concurrent write attempt to the same database.
And I thought MySQL’s table-level locking was bad (unless you’re using InnoDB) …
Update: for the record, PostreSQL does row-level locking.
5 commentsThe Media: Our Friendly Fear Mongerer
The stock market is up the most it’s ever been up in a single day, and the media isn’t really covering it.
I get most of my news from blogs, both that I’m subscribed to and referred to by friends. Last week, when the market basically shit itself, most of what I read went along the lines of, and I paraphrase and exaggerate, “Holy shit, we’re all going to die. Move to Canada RIGHT NOW. Sell everything and dig yourself a nuclear missile shelter, Blast-From-The-Past style. RUN FOR YOUR LIVES!”
Perhaps this is proof that the media reports on stories that readers will latch on to, stories that scare readers. You see this on the local news as well; at least in Los Angeles, the local news is pretty much entirely composed of shootings, gang fights, and stabbings.
This post is a poor attempt at analyzing media pschology. My sample space (number of media sources analyzed) is very, very small, and I’m only commenting on a single day’s activity. However, it’s in the best interest of a media company to sell as much media (or ads) as possible, which means economically their goal is to attract readers, not necessarily report consistently. Perhaps scaring readers sells the most media.
I think I’ve shined light on something that most people are aware of, but I thought my claim was worth posting anyway.
Bonus image (just a parody):
Source: here
3 commentsIgnorrance is Bliss
The following two videos are utterly despicable. Shame on those filmed for being so ignorant, and shame on those filming for provoking this, somehow thinking that these videos are productive. The only way in which they are productive is to show us the types of people that live in this nation.
Is it too complex to ask one man to have mutual respect for a fellow man’s culture, religion, and dignity? Is it too complex to understand that we are all living on this small world together? It’s productive to have competition and a moderate level of disagreement, but the dialog captured in these videos is despicable; those involved should be ashamed.
There are different types of people in this world: some that believe in one thing; others that believe the opposite; and even others who believe something entirely different. Difference is good; culture is good. Some of the people filmed in these videos are different; some are racist and intolerant. Though I am no moral authority, I believe that these people are wronged in hating, and it sickens me. One is not wronged by disagreeing and holding one’s own beliefs, but one is wronged when negatively affecting others with harsh and untrue circumstances. Treat man as thou wishes to be treated — the golden rule. It is wrong to judge someone by their name, of which they did not even choose themselves. It’s despicable what some of these people say.
For the record, I am not making any claim that all McCain / Palin supports have these opinions. I am not claiming that Obama is a better candidate. I am not claiming that the creators of this video did the right thing. I am merely commenting on the ways in which filmer and filmee have reduced themselves to animals, with no reason or self control that would otherwise allow us to work together.
These videos have made me physically ill. I wish we could all get along, agreeing to disagree, mutually respecting those around us, working together to create a loving, happy, working world. I suppose perhaps things aren’t that simple, but I refuse to ever believe otherwise.
Update: the post I have just written brings to mind the following post, which I recommend you read if you’re a member of Generation Y. Generation Y is Too Quiet, Too Conservative
Update 2: this one is pretty bad as well:
5 commentsPython First Impression
I’ve been using Python now for just about two weeks; I’m falling in love.
Let’s see, where do I begin. Python makes lots of things really, really easy — things like date formating, date comparisons, db interaction, list manipulation, etc. The list goes on. Its built-in support for dictionaries and tuples make it super easy to never, ever define a Java Bean-style class, yet they’re in many ways more powerful than C-style structs.
Python module (egg) support is unreal. A module exists for just about any task you’d ever want to fulfil — modules for XHTML parsing, modules for URL fetching, etc.
In summary, Python has the speed and flexibility of Perl, with much more powerful built-in support.
Complaints: all member functions need to have the “self” parameter as the first parameter. In order to have a Python file execute something, one must add a line, “if __name__ ==’__main__’:.” This is just weird.
Mmmmm. Python.
Update: I forgot about my biggest complaint of all: how Python deals with default parameters. Read more here, or take a look at the quote below:
8 commentsDefault parameter values are evaluated when the function definition is executed. This means that the expression is evaluated once, when the function is defined, and that that same “pre-computed” value is used for each call.
Bars Close Too Early
California really needs to change their rules about what time bars can close. 2:00am is way, way too early. I’m all for a 4:00am close time, though I would also be happy with 3:00am.
I suppose I’ve been spoiled being in Europe and Shanghai, because bars don’t really close in either of these two places.
7 commentsEuropean Beer in San Francisco
My favorite German beer is Paulaner weisse bier — I drank it like water in Munich and Berlin. I ordered my first pint yesterday, after not drinking it in the US since before I left for Europe. It was terrible. Absolutely aweful. Perhaps I got a bad keg; I don’t know.
I’ve also had a few Belgiums such as Chimay and Delirium Tremens. These were both good, but still not as good as the stuff served in Europe.
Thank you, FDA, for ruining import beer. I suppose this is just one more reason to travel, though.
2 commentsVP Debate Viewing, San Francisco Style
My roommate and I don’t have a TV in our apartment here in San Francisco, so I ran down to The Page to catch the VP debate last night. It was awesome! The bar was packed with mostly Obama-Biden supporters, and I felt right at home. Everyone was friendly, funny, and having a good old time.
Laughter would errupt when Palin would talk about soccer moms or THE MAVERICK. Yells filled the bar when each candidate said they do not support gay marriage. I felt like I was watching the superbowl, where all of my coviewers were rooting for the same team as me.
Oh San Francisco how I love thee; it feels good to be back in a liberal city.
No commentsBack on the Bike
I’ve started riding everywhere on my bike again. Finally. After not riding for over three months, I’m out of shape and ready to start crankin’. I also purchased a fancy little u-lock that fits in my back pocket (the Evolution Mini).
San Francisco has way, WAY gnarlier hills than Seattle. Holy shit.
8 commentsFinally on Yelp
I finally signed up at Yelp. Here’s my profile. The plan is to write reviews for as many places in Seattle and Los Angeles as I can think of, time permitting of course, then to write a review for each place I visit in San Francisco.
Also notice my little sidebar widget for my recent reviews; pretty shnazzy I would say.
4 commentsTech Marketers, Meet Your Maker
I’ve been meaning to write a post about the comedic potential of listening to non-technical marketers talk about technology. I’m only referring to the marketers who speak with such conviction that innocent bystandards might actually believe they know what they’re talking about. I’ve witnessed this many a time when speaking with MBA-types about various web startups. I would normally cite specific examples, but Larry Ellison, CEO of Oracle, has done better than I could ever do. Read this short article about cloud computing and silly marketers who want so badly to be technical but fail miserably. It’s like a new Revenge of the Nerds, even though Ellison probably isn’t a nerd given how much cash he’s rolling around in.
What’s curious is that the title of this post is “Larry Ellison’s Brilliant Anti-Cloud Computing Rant.” That’s completely misguiding. This isn’t an anti-cloud computing rant; it’s an anti-marketer-who-speaks-with-conviction rant.
2 comments
