Thursday, July 03, 2008
Netbook Remix
Monday, April 21, 2008
Limits of Django or limits of db back-end?
Fiam has posted a slightly controversial piece titled The Limits of Django. It is a great read, I totally enjoyed it. However, he has come up with some very shocking stats of Django ORM approach vs. C caching daemon (93 seconds vs. 0.8 second to query a database of 500,000 votes of 1,000 users on 5,000 stories. A few have suggested that his database/data model maybe to blame, I think there's a great degree of truth to that. To try it out, I have created a sample database called django_test and populated it with a bunch of data like so:
-- users
create table users (id integer not null primary key);
-- stories
create table stories (id integer not null primary key);
-- votes
CREATE TABLE votes (
story_id integer not null
constraint story_id_fk references stories,
user_id integer not null
constraint user_id_fk references users,
score integer default 0);
create index user_story_idx on votes (story_id, user_id);
Populating with some random data:
#!/bin/bash
PSQL="/opt/local/bin/psql8 -q"
for ((i=1;i<=50000;i+=1))
do
$PSQL -c "insert into stories (id) values ($i);" django_test
done
for ((i=9922;i<=10000;i+=1))
do
$PSQL -c "insert into stories (id) values ($i);" django_test
done
for ((i=1;i<=500000;i+=1))
do
score=$RANDOM
userid=$RANDOM
storyid=$RANDOM
let "score %= 100"
let "userid %= 1000"
let "storyid %= 10000"
$PSQL -c "insert into votes (user_id,story_id,score) values ($userid,$storyid,$score)" django_test
done
(Yes, this is very-very crude, I know)
Here are my results on PostgreSQL 8.1.3, running on a G4 PowerBook with 2GB of RAM under Mac OS X 10.5.2:
django_test=# select count(*) from users; select count (*) from stories; select count(*) from votes; count ------- 1000 (1 row) count ------- 10000 (1 row) count ------- 34625 (1 row)
I gave up waiting for population of 500K rows into votes table and run a few selects like the following one as it were (inserts were still running on background and I have not done VACUUM ANALYSE yet):
django_test=# \timing
Timing is on.
django_test=# select distinct(story_id), score from votes where votes.user_id=123 order by votes.score desc;
story_id | score
----------+-------
3391 | 95
812 | 94
9215 | 93
9599 | 92
8510 | 85
220 | 84
8611 | 81
740 | 78
9193 | 74
2406 | 70
2201 | 61
2740 | 59
4500 | 52
5993 | 52
5692 | 51
2912 | 49
6566 | 49
2950 | 48
3149 | 47
36 | 45
1193 | 43
629 | 38
5720 | 36
9429 | 35
455 | 33
6628 | 32
2598 | 30
2623 | 28
2224 | 24
6794 | 24
2254 | 20
934 | 8
6267 | 8
3999 | 7
5879 | 3
(35 rows)
Time: 27.376 ms
That's less than 0.03 seconds. Not bad, eh?
Saturday, April 12, 2008
The day I've opened up my WiFi
It is today, the day I thought to myself: "If Schneier thinks it can/should be done, why don't I do it?" And I changed my DD-WRT settings to fully open up my wireless to anyone.
I've made some changes to QoS and DHCP setup. DHCP addresses will only be assigned to .64-.255 range and that range has been throttled down in QoS to bulk access status. If I could figure out a way (and I might, if I am motivated to do that), I'd also disallow the DHCP'ed clients to have access to file sharing traffic (only for economical reasons, as right now I am paying for high-speed access, but with bandwidth restrictions).
Thursday, April 10, 2008
Daring Fireball: Safari’s Tab Dragging Modes
John Gruber questions the two drag modes in Safari:
I don’t see why the intra-window (left-right) mode even exists. With the inter-window mode, you can do everything: reorder a tab within a window, move a tab to another existing window, or move a tab to its own new window. The intra-window mode only allows one thing: reordering tabs within their current window. I can’t think of a single reason why this mode exists.
Actually, intra-window drag is a nice feature that has been available in FireFox and Opera for quite some time. While it usefulness may, indeed, be somewhat questioned (it allows to reorder tabs only, that's pretty much it), I found not once not twice that putting a few tabs next to each other when running comparison or piling information for a report is very nice.
Inter-window dragging works very well together with "Merge all windows" option — in case you were reckless and allowed a bunch of windows to sprout thanks to target attribute of an a tag. The pattern I use in this case is to first merge them all together, then one of the tabs up-down to create a new "anchor" window, then move other tabs over to that "zone." But what I find very much useful after that is ability to move tabs around rearranging them for better usability.
Thursday, March 27, 2008
OOo "innovations"
OOo Ninja's post on new features of OpenOffice 3.0 has put me into a totally gloomy mood. If there is a single piece of software in FOSS world that can take all the rap for "no innovation," it is OOo. I am really surprised that OOo 3.0 is not trying to re-imagine Office 2007's ribbon interface — after so artfully picking up the zoom slider and reading layout.
Sunday, March 16, 2008
Drawing (Scribbles) on a Mac
I have been looking for a simple program to entertain my daughter with drawing (she loves it) on a Mac. I've got a (cheap) Wacom tablet that wanted to employ as well. TuxPaint is nice, but I hate the rubber-stamp/clipart mentality it sort of forces one in (and sounds are annoying). Also, I think that interface is overloaded. Accidentally I cam across this marvel — and have bee having lots of fun myself!
It certainly is neither Photoshop, nor Illustrator — but it needs not be! The interface is extremely simple (if a little unclear at first, but this is really well taken care of by quickly skimming through a 14-page slide set of a manual), does not get in a way at all. You can pretty much scribble anything and layers are a great way of building up onion skins of a drawing. Tracing mode is great for when your treasure wants to use another picture as a model.
Here's a quick one, took no more than 10-15 minutes to scribble :)
Friday, February 29, 2008
Feeling the heat, aren't we?
...the senior vice president of Sony's IT product division said the tiny $299 notebook could potentially shift the entire notebook industry. ... "If (the EEE PC from) Asus starts to do well, we are all in trouble. That's just a race to the bottom," said Mike Abary.About time. All those monsters that are being produced by Dell, Sony, HP and others — aren't really worth the price tag. As expected, an average user can mighty well survive with a much simpler and lighter machine. EEE may by far not be for everyone, but the trend is well spotted and it is similar to the one so well pointed by Gruber when he talks about Mini vs. real iPod: users don't necessarily need all of those super features, they are likely to be fine without them.
