Oleg Andreev

Month
Filter by post type
All posts

Text
Photo
Quote
Link
Chat
Audio
Video
Ask

March 2009

iovm idea: “activatable” should be a slot property rather than value property. This allows to pass methods around and access them directly by slot name in all the contexts. Current implementation makes you to use getSlot(slotName) syntax to avoid activation.

Mar 31, 2009
#io #slots #activation #iovm
A Generalized Null Object Patternweb.cecs.pdx.edu

Excellent write up about “message eating” Nil.

Mar 31, 2009
#null #nil #none #void #stub #smalltalk
Nil and None considered Null and Voidhomepages.mcs.vuw.ac.nz
Mar 31, 2009
#null #void #nil #none #oop #patterns #stub
“In terms of navigation, Skype’s VoIP app for iPhone looks more like your traditional iPhone app than it does Skype 4.0 for Windows. For many who already prefer Apple’s sleek interface archetype, that’s a triumph, but those who enjoy Skype’s branding may feel disappointed.”—Some stupid cunt from reviews.cnet.com compares iphone with windows
Mar 31, 2009
Andrea Martignoni street animationyoutube.com
Mar 28, 2009
#video #humor #art #youtube #animation
Button Wrap :-)antongerasimenko.com
Mar 27, 2009
#humor
Mar 26, 2009
#management #design
Math.random() and srand in AS3

There’s no “srand” function in AS3. That is you cannot seed random number generator.

And when you get the very same results each time swf is loaded you find this:

External image

However, if you need true randomness in an event-driven application, you can do this:

setInterval(Math.random, 10)

Flash Player will run Math.random() in background producing different random values at different points of time.

Mar 26, 20091 note
#as3 #random #workaround #security #screenshot
Balanced priority queue (weighted queue)

In a regular priority queue entry with priority N is taken before all the entries with priority M (given N > M).

Sometimes, however, 3-priority entry should not beat one hundred of 1-priority items. It seems natural to introduce a double-linked list of weighted nodes, where newly inserted node can come in front of a limited number of nodes with a total weight less then a weight of a new node.

Illustration. Given a stream of nodes with weights:

[1a, 2, 1b, 3, 1c, 1d, 4, 1e]

weighted queue intermediate states would be:

[1a]
[2, 1a]
[2, 1a, 1b]
[2, 3, 1a, 1b]
[2, 3, 1a, 1b, 1c]
[2, 3, 1a, 1b, 1c, 1d]
[2, 3, 1a, 4, 1b, 1c, 1d]
[2, 3, 1a, 4, 1b, 1c, 1d, 1e]

In such queue priority “N” means skipping N items of priority 1.

Mar 17, 20091 note
#queue #algorithms #math
WhatTheFont: helps to find a name for the font using image recognitionnew.myfonts.com
Mar 16, 2009
#fonts #image recognition #ai
refuckflash.rb: reclone working directory to refresh Flash CS3 classpath buggist.github.com
Mar 13, 2009
#gist #code #git #refuck #flash #classpath #snippet #script #util
Let your mom double click buttons safely (AS3 snippet) gist.github.com
Mar 11, 2009
#as3 #ui #actionscript #click #gist #code
The simplest and the most beautiful state machine implementation in AS3gist.github.com
Mar 11, 2009
#actionscript #as3 #state machine #code
Evening, easy listening

Observation: office becomes nicer when everybody leaves :-)

Mar 9, 2009
#observations #office #evening #actionscript
“
// I dedicate all this code, all my work, to my wife, Darlene, who will 
// have to support me and our three children and the dog once it gets 
// released into the public.
”
—Stack Overflow: What is the best comment in source code you have ever encountered?
Mar 6, 2009
#code #humor #stackoverflow #<>
Creating dangling branches in Git

Say, you want to keep some auxiliary info inside your git repository: tickets, post-commit/post-receive hooks, wiki pages etc. Storing them inside a folder might not be a good idea: you’d probably want to have same content across all the branches. It is natural to keep such data in a separate branch.

Given that, you can create your “tickets” branch simply by checking out new branch, removing all the code, adding initial files and committing it. This works great until you get bored with the irrelevant history in the tail of the git-log. It is rather easy to disconnect your branch from the old history: just take the latest tree id, create an orphan commit (that is: without parent commits) and reset branch to this commit.

# emit tree id for the latest commit
$ git log -1 --pretty=format:%T

# emit new commit id
$ echo "initial commit" | git commit-tree <tree-id>

# reset current branch to this commit id
$ git reset --hard <commit-id>


Put it in a single bash command:

$ git reset --hard `echo "initial commit" | git commit-tree \`git log -1 --pretty=format:%T\``

Dangling branches are great for keeping meta-data of any sort: .git/config files, tickets, hooks, documentation, tickets.


PS. Since you can store hooks inside repository itself, you can have a self-contained deployment system like Capistrano without any additional tools installed on a server. Hooks can even update themselves on each post-receive hook before actual deployment recipes are run. This allows you to specify all the dependencies in the source repository and even setup them with a single “git push” command. All manual setup you have to do initially is to clone local repository inside .git/hooks folder (yes, inside itself) and check out hooks branch appropriate for your environment. Ain’t that sweet?

Mar 4, 20092 notes
#git #advanced #branches #dangling #deploy #capistrano
TraceMonkey analysis and visualizationblog.mozilla.com

Nice article showing efficiency and inefficiency of TraceMonkey. Must read.

Mar 1, 2009
#tracemonkey #js #vm #optimization #visualization #graphs
2x performance increase using denormalized MySQL storagebret.appspot.com

FriendFeed stores all entities with all properties in a single table and uses separate tables for specific indexes. After retrieving entities from the index, application reapplies query to fight some data inconsistencies. Eventually, “cleaner” process updates indexes with the actual data. This strategy greatly reduces administration efforts (indexes can be created or update asynchronously) and makes latency 2x lower.
(Thanks Application Error for the link)

Mar 1, 2009
#mysql #schemaless #db #latency #experience #performance
Next page →
20152016
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
201420152016
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
201320142015
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
201220132014
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
201120122013
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
201020112012
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
200920102011
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
200820092010
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
200720082009
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
200620072008
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
200520062007
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
200420052006
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
200320042005
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
200220032004
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
200120022003
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
200020012002
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
199920002001
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
199819992000
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
199719981999
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
199619971998
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
199519961997
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
199419951996
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
199319941995
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
199219931994
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
199119921993
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
199019911992
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
198919901991
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
198819891990
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
198719881989
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
198619871988
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
19861987
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December