NSZombieEnabled is an environment variable which controls whether the Foundation runtime will use zombies. When zombies are enabled, a deallocated object’s class is dynamically changed to be _NSZombie, and by default, the memory region is never marked as free, although this can be controlled separately. The end result is that, with zombies enabled, messages to deallocated objects will no longer behave strangely or crash in difficult-to-understand ways, but will instead log a message and die in a predictable and debugger-breakpointable way. This is the tool to use when trying to track down over-releases and premature releases.
Ruby Algorithms: Sorting, Trie & Heaps - igvita.com
A recommended reading.
But I can’t figure out a way to do a rolling 60-second period without storing every hit and its timestamp within the rolling window. Is there a good algorithm for doing that in constant space and time (maybe a trick using averages?), or am I pretty much stuck with the fixed calendar-window method?
My proposed solution:
public function allow_hit($id, $limit_per_minute)
{
$min = idate('i');
$sec = idate('s');
$key = md5($id) . ($min-1) . $sec;
$count = intval(Cache::get('rate-limiter', $key));
if($count == 0) { $key = md5($id) . $min . $sec; }
elseif ($count > $limit_per_minute) return false;
Cache::set('rate-limiter', $key, $count + 1, /* ttl */ 60);
return true;
}
($min-1) it doesn’t always work since it’s not modulo 60. I know it, but solving that is trivial, so I didn’t bother implementing it.
Hope this helps.
I really like all the works by Justin, from Muxtape to his amazing shots at chromogenic.net, including his own window on the flickrverse: I hardly Know Her and I share a passion for minimalist design.
Here there is a quick GreaseMonkey script that subtly redirects you to the IHKH equivalent of the flickr page you are looking at, provided the owner authorised its publishing.
Anyway, it’s easier to try than to explain, especially while I’m squeezing the writing of the script and this post in my lunch break ;)
UPDATE: To install it easily, just click here within Firefox.
I’ve also consolidated some terminology to be more consistent everywhere: “Archive” is gone and has been replaced by “Deleted”. You can still permanently delete articles so that they don’t even show up in the “Deleted” section — just find them in the Deleted section and hit the red “×” button again.
No no no… call it archive, please! Not delete. Except this, great to see the birth of the starred category!
I bet I’ll be the only one absolutely not thrilled about this news, but really sad instead. Tumblerette’s and Tumblr API main drawback was the lack of API for accessing to a Dashboard, so I made a parser and was writing my own iPhone Dashboard app.
This idea grew from a major itch I had: not being able to read and properly follow my dashboard on the road: MobileSafari memory management flakiness was too much to bear while reading new posts.
But now with a free and officially backed by Tumblr app, my app is nowhere to go, or at least for the meanwhile. I’d better start considering new apps to develop.
Last month hacking nights are not completely wasted since I learned a lot, but still… Anyway, congratulations to everyone and at least I’ll have a great app to use.
Mozilla’s Ubiquity is a wonderful thing, especially for an avid Quicksilver user as I am. Nowadays I live in the browser and having this tool across all the platforms I use it’s priceless.
Since the first version I wanted to contribute with some code for the engine or with some commands, but I got overwhelmed and only recently I caved in.
I actually wrote my first Ubiquity command almost a month ago, but I never got around to post a blog post to publish it. It queries my json-zh service for the pinyin character of the selected chinese text and gives you 3 way to deal with the result putting it in the
The code is really simple and using the embedded editor is amazing, except that I’d love some debugging facilities.
Working with optional arguments led me thinking about concatenated commands and a way to solve the problem of chaining them. Material for another post or (finally) a message in the ML: guys, you write too much and I barely keep the pace just reading the subjects ;)
Here’s the code, I hope someone will benefit from it.
Thanks! (and a way too cool URL ;) )