david koblas

david koblas

31p

36 comments posted · 390 followers · following 3

404 weeks ago @ Skis / Toys / Fun - Does it all devolve? · 0 replies · +1 points

Not sure how it helps, still allows for people to construct monolithic code. Most of the add on services for AWS are things people tack on anyway [Database, Email, Static File Serving]. Not the idea of components, plugins and small lightweight pieces.

404 weeks ago @ Skis / Toys / Fun - Zend Framework vs. Dja... · 0 replies · +1 points

Trivia - moved from lighttpd to tornado for an app and dropped the latency by 40ms.

411 weeks ago @ Skis / Toys / Fun - Python wierdness · 0 replies · +1 points

Oh! That's a perspective I hadn't thought of ... class initializer values. Rather than class scoped variables.

463 weeks ago @ Skis / Toys / Fun - Web 2.0 development - ... · 1 reply · +1 points

If you're new to programming the pain in learning two languages is huge, not only that but the level of detail that's needed for C++ will be quite frustrating. You should have no problem building just about anything in PHP for the web.

475 weeks ago @ Skis / Toys / Fun - Facebook vs. Google · 0 replies · +1 points

Wave feels more like Threaded Groups meets IM. Since based on the demos once you start a discussion you can only refine the discussion or forward it to others -- create new sub conversations. It has some cool/wow factor, but at the end of the day it's just another tool.

FB by having distinct "entities" for friendable entities vs. fanable entities makes the service feel a little bit more disjoint. I'm a fan of "Ashton Kutcher" (not) but I might also be one of his friends, why do I need to treat the two entities as distinct.

You do make a good point about having different circles of friends on different services, FB has minimal ways to manage your groups of friends. If it was more first class it would probably make things more interesting. That way you can assign a Friend Group to a 3rd party service and that's the circle of friends that would be seen/visiable/accessible on that service.

476 weeks ago @ Skis / Toys / Fun - Content agregation vs.... · 0 replies · +1 points

That's part of the idea, but I think part of it is making is a "first tier" experience. Netvibes has a similar feature. But, fundamentally I think there should an "editors" blog portal similar to bloglines.com or wordpress.com where you can build a cross blog content aggregation.

478 weeks ago @ Skis / Toys / Fun - Array Intersection Bak... · 0 replies · +1 points

Preallocation is a good trick... Brought the runtime down to 2.092 seconds!

478 weeks ago @ Skis / Toys / Fun - Array Intersection Bak... · 0 replies · +1 points

Cool, thanks. Performance comparison:

Perl #1 - 3.227
Perl #2 - 3.702
Perl #3 - 3.091

So, it appears that somebody might want to optimize Array::Util a bit more... In playing with this, since it didn't make sense why Array::Util should be slower found the following "faster" version. Which shows that the "map" call is slow compared to array iteration -- that's not good.

sub isect(@@) {
my %h;

for my $i (@{$_[0]}) {
$h{$i} = 1;
}

return grep { $h{$_} } @{$_[1]};
}

479 weeks ago @ Skis / Toys / Fun - Array Intersection Bak... · 0 replies · +1 points

Java Version #3 -- turns out like PHP #3 doesn't perform very well and sets a new record... 3992.045 seconds (or 66 minutes, 15 seconds).

From the apache commons project... Here's the implementation of intersection, which is great, since you don't have debug your own version... But, probably not going to bring a performance benefit.

Collection intersection(final Collection a, final Collection b) {
ArrayList list = new ArrayList();
Map mapa = getCardinalityMap(a);
Map mapb = getCardinalityMap(b);
Set elts = new HashSet(a);
elts.addAll(b);
Iterator it = elts.iterator();
while(it.hasNext()) {
Object obj = it.next();
for(int i=0,m=Math.min(getFreq(obj,mapa),getFreq(obj,mapb));i<m;i++) {
list.add(obj);
}
}
return list;
}

479 weeks ago @ Skis / Toys / Fun - Array Intersection Bak... · 0 replies · +1 points

Here's a full version of the PHP module...

<?php

$x = array();
$y = array();

foreach (file("data.txt") as $line) {
list($a, $b) = preg_split("/\s+/", $line);
if ($b !== null) {
array_push($x, $a);
array_push($y, $b);
}
}

$t0 = microtime(true);
$xy = isect($x, $y);
$t1 = microtime(true);

printf("Set | n = %d : %d intersects found in %f seconds\n", count($x), count($xy), $t1 - $t0);

function isect($a, $b) {
return array_intersect($a, $b);
}

Here's the trivial program that creates data.txt

#!/usr/bin/python

import random

LINES = 1000000
MAX = LINES * 5

print LINES

for i in range(0, LINES) :
print "%s %s" % (random.randint(0, MAX), random.randint(0, MAX))