|
Using Python metaclasses to make awesome Django model field choices
-
tomforb.es
-
13 years ago
-
eng
Edit: This code is now on PyPi: https://pypi.python.org/pypi/django-choice-object tl;dr Metaclasses are awesome When using Django’s Model or Form frameworks you can define a fixed set of choices for fields which are list of tuples containing a value and some text to associate with that value. The do...
|
|
On any long running project of consequence, refactoring will happen. While usually this is a good thing, it can sometimes lead to the case where all references to a file are removed, but the file itself still sits in the codebase. Though not technically a problem in itself, this can cause a bit of unnecessarily bloat and confusion, not to mention unnecessary time spent updating these orphaned files to support future refactoring efforts.
|
|
Today we’re featuring a guest post from our friends at Retronyms. They’ve built some amazing community features into their app Tabletop using the SoundCloud API and have open sourced their CloudSeeder Devkit. This post was written for us by David Shu. David is a software engineer at the Retronyms and has worked on a number of iOS apps, including Tabletop and Dokobots. He currently resides in San Francisco, CA. We recently built a SoundClou..
|
|
Today we’re featuring a guest post from our friends at Retronyms. They’ve built some amazing community features into their app Tabletop using the SoundCloud API and have open sourced their CloudSeeder Devkit. This post was written for us by David Shu. David is a software engineer at the Retronyms and has worked on a number of iOS apps, including Tabletop and Dokobots. He currently resides in San Francisco, CA. We recently built a SoundClou..
|
Today I learned that npm (the node.js package manager) has support for arbitrary commands and chained commands. I guess I always knew this…
|
|
In my previous post I talked about making a laser beam using the HTML5 canvas stroke() method. I mentioned the next thing I wanted to do being adding a curve to the beam to make it look more fluid as it moves (and yes, I know lasers do not curve. Mine does. Shut up. It’s a magic laser. Or it may not even be a “laser” when I’m done with it)
|
|
Over the past two days I’ve been working on lasers. It seemed like this would be an easy thing to put in before I started. I mean I already have bullets that you can shoot at will, so a laser is just like a big…bullet…uh…right?
|
|
According to the project site on GitHub , The Guava project contains several of Google’s core libraries that we rely on in our Java-based projects: collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, and so forth.
|
|
Yesterday, I wrote a small article talking about Guice and JUnit, so, this time, I’ll just say how to use the small lib that I build (not big deal, one class, one annotation =] )
|
|
I relearned basic trig today...kind of...sort of...Let's just say my thing works and leave it at that.
-
liza.io
-
13 years ago
-
eng
Today I experimented with positioning entities on top of each other to make a boss with specific areas that you have to target in order to kill. Hitting the rest of the body does little to no damage, but hitting specific areas with the right weapons increases damage dealt to the boss. These could also be used to customize other properties, like having different hit areas be different sizes, types, etc.
|
|
A Series on Machine Learning These days an absolutely staggering amount of research and development work goes into the very coarsely defined field of “machine learning.” Part of the reason why it’s so coarsely defined is because it borrows techniques from so many different fields. Many problems in machine learning can be phrased in different but equivalent ways. While they are often purely optimization problems, such techniques can be expre..
|
|
A Series on Machine Learning These days an absolutely staggering amount of research and development work goes into the very coarsely defined field of “machine learning.” Part of the reason why it’s so coarsely defined is because it borrows techniques from so many different fields. Many problems in machine learning can be phrased in different but equivalent ways. While they are often purely optimization problems, such techniques can be expre..
|
|
A Series on Machine Learning These days an absolutely staggering amount of research and development work goes into the very coarsely defined field of “machine learning.” Part of the reason why it’s so coarsely defined is because it borrows techniques from so many different fields. Many problems in machine learning can be phrased in different but equivalent ways. While they are often purely optimization problems, such techniques can be expre..
|
|
So I've come across another email case. A friend of mine got their email password stolen for their Yahoo account. Within minutes their Gmail account was also compromised and the password on both accounts were changed. Hope seemed lost, and this post details the outline of my procedure
|
|
The limitations of CURSOR_SHARING = FORCE and FORCE_MATCHING_SIGNATURE for SQL plan stability
-
tanelpoder.com
-
13 years ago
-
eng
It’s a well known fact that the cursor_sharing parameter can be set to FORCE for making Oracle replace any literals with system-generated bind variable placeholders and then calculating the SQL hash value for looking up an existing cursor in library cache. This should reduce the amount of hard parsing and shared pool garbage. Also, the same mechanism (of replacing literal values with bind variable placeholders before calculating the S..
|
|
The limitations of CURSOR_SHARING = FORCE and FORCE_MATCHING_SIGNATURE for SQL plan stability
-
tanelpoder.com
-
13 years ago
-
eng
It’s a well known fact that the cursor_sharing parameter can be set to FORCE for making Oracle replace any literals with system-generated bind variable placeholders and then calculating the SQL hash value for looking up an existing cursor in library cache. This should reduce the amount of hard parsing and shared pool garbage. Also, the same mechanism (of replacing literal values with bind variable placeholders before calculating the S..
|
|
I don’t know if you share my point of view, but I have a confession to make: I hate issue trackers. I usually work on small projects with small teams, and I find monsters like Bugzilla or Redmine an overkill. Another thing is that in my head the word “issue” has a bitter taste. I prefer the word “task” instead, because it doesn’t make much difference to me when I’m implementing a new long-expected feature or fixing an annoying bug.
|
|
I don’t know if you share my point of view, but I have a confession to make: I hate issue trackers. I usually work on small projects with small teams, and I find monsters like Bugzilla or Redmine an overkill. Another thing is that in my head the word “issue” has a bitter taste. I prefer the word “task” instead, because it doesn’t make much difference to me when I’m implementing a new long-expected feature or fixing an annoying bug.
|
|
Normally, people don’t read ‘hello’ posts. I consider them useless, they teach nothing, mean nothing but still take time to write and to read. So, I strongly hope that I will be the only person who read this. I started another blog. I already have one (in Russian), but I hope they both will co-exists in future. Some posts will be translated, some will be adopted, others will not. Anyway, I can’t promise too much, but the idea of this site/b..
|
|
Normally, people don’t read ‘hello’ posts. I consider them useless, they teach nothing, mean nothing but still take time to write and to read. So, I strongly hope that I will be the only person who read this. I started another blog. I already have one (in Russian), but I hope they both will co-exists in future. Some posts will be translated, some will be adopted, others will not. Anyway, I can’t promise too much, but the idea of this site/b..
|
|
Di Codecademy avevo già scritto tempo fa in occasione dei loro primi corsi giocoso-interattivi su HTML, CSS e JavaScript. E’ di ieri l’annuncio del nuovo corso Python per principianti. Se volete rompere il ghiaccio con questo bellissimo linguaggio l’approccio di Codecademy (imparare divertendosi, anche grazie a collaudati meccanismi incentivanti come i punteggi e i trofei) potrebbe fare per voi.
|
|
Di Codecademy avevo già scritto tempo fa in occasione dei loro primi corsi giocoso-interattivi su HTML, CSS e JavaScript. E’ di ieri l’annuncio del nuovo corso Python per principianti. Se volete rompere il ghiaccio con questo bellissimo linguaggio l’approccio di Codecademy (imparare divertendosi, anche grazie a collaudati meccanismi incentivanti come i punteggi e i trofei) potrebbe fare per voi.
|
I received some stickers at work today from Joyent and, like I have been doing for the past many years, I stuck them to the back of my…
|
|
Di Codecademy avevo già scritto tempo fa in occasione dei loro primi corsi giocoso-interattivi su HTML, CSS e JavaScript. E’ di ieri l’annuncio del nuovo corso Python per principianti. Se volete rompere il ghiaccio con questo bellissimo linguaggio l’approccio di Codecademy (imparare divertendosi, anche grazie a collaudati meccanismi incentivanti come i punteggi e i trofei) potrebbe fare per voi.
|
|
When do you have too many functions? For me breaking things down into functions makes it easier to read in many cases, but I’ve been hesitant to separate out everything into tiny bits and pieces. Let’s say someone else is looking at my code - does it get to a point where generally it’s just too much? For example, what would generally be considered better, this:
|
|
Dear reader, this post has an interactive simulation! We encourage you to play with it as you read the article below. In our series of posts on cellular automata, we explored Conway’s classic Game of Life and discovered some interesting patterns therein. And then in our primers on computing theory, we built up a theoretical foundation for similar kinds of machines, including a discussion of Turing machines and the various computational comp..
|
|
Dear reader, this post has an interactive simulation! We encourage you to play with it as you read the article below. In our series of posts on cellular automata, we explored Conway’s classic Game of Life and discovered some interesting patterns therein. And then in our primers on computing theory, we built up a theoretical foundation for similar kinds of machines, including a discussion of Turing machines and the various computational comp..
|
|
Dear reader, this post has an interactive simulation! We encourage you to play with it as you read the article below. In our series of posts on cellular automata, we explored Conway’s classic Game of Life and discovered some interesting patterns therein. And then in our primers on computing theory, we built up a theoretical foundation for similar kinds of machines, including a discussion of Turing machines and the various computational comp..
|
|
A while ago I listened to a talk by Jonathan Blow that covered optimization and talked about how most people worry about it too early and how they should just focus on making things work. I know there was much more said in this talk (it’s long and very interesting), but this is the general message that has stuck with me after listening to it - possibly because many other people already express the same opinions on optimization. It makes s..
|
|
Today I implemented a really cool plugin by quidmonkey . The plugin allows you to use Canvas-native fonts in an ImpactJS game. Out of the box, text in Impact is displayed through the use of images - there’s an image with each letter of your alphabet spaced out in a particular way, and you then draw parts of this image to put together letters in whatever order.
|
|
The thoughtful bodepd has been kind enough to help me get my puppet-gluster module off the ground and publicized a bit too. My first few commits have been all clean up to get my initial hacking up to snuff with the puppet style guidelines. Sadly, I love indenting my code with tabs, and this is against the puppet rules :( http://www.emacswiki.org/emacs/TabsSpacesBoth I’ll be accepting patches by email, but I’d prefer discussion firs..
|
|
The thoughtful bodepd has been kind enough to help me get my puppet-gluster module off the ground and publicized a bit too. My first few commits have been all clean up to get my initial hacking up to snuff with the puppet style guidelines. Sadly, I love indenting my code with tabs, and this is against the puppet rules :( http://www.emacswiki.org/emacs/TabsSpacesBoth I’ll be accepting patches by email, but I’d prefer discussion firs..
|
|
Back in the 1990s, you could look smart my talking about the “Information Superhighway” (the Internet). In the early 2000s, the catch-phase of the day was “eCommerce” (buying crap on the Internet), and in the late 2000s non-technical managers would often toot about “Web 2.0” (an imaginary Internet that basically is the current Internet, but with more content). Around 2010, non-technical managers, CIOs, and executives were struggling to f..
|
|
Back in the 1990s, you could look smart my talking about the “Information Superhighway” (the Internet). In the early 2000s, the catch-phase of the day was “eCommerce” (buying crap on the Internet), and in the late 2000s non-technical managers would often toot about “Web 2.0” (an imaginary Internet that basically is the current Internet, but with more content). Around 2010, non-technical managers, CIOs, and executives were struggling to f..
|
|
Problem: Write a program that compares two sequences of differing lengths for similarity. Solution: (In Python) import math def dynamicTimeWarp(seqA, seqB, d = lambda x,y: abs(x-y)): # create the cost matrix numRows, numCols = len(seqA), len(seqB) cost = [[0 for _ in range(numCols)] for _ in range(numRows)] # initialize the first row and column cost[0][0] = d(seqA[0], seqB[0]) for i in xrange(1, numRows): cost[i][0] = cost[i-1][0] + d(seqA[..
|
|
Problem: Write a program that compares two sequences of differing lengths for similarity. Solution: (In Python) import math def dynamicTimeWarp(seqA, seqB, d = lambda x,y: abs(x-y)): # create the cost matrix numRows, numCols = len(seqA), len(seqB) cost = [[0 for _ in range(numCols)] for _ in range(numRows)] # initialize the first row and column cost[0][0] = d(seqA[0], seqB[0]) for i in xrange(1, numRows): cost[i][0] = cost[i-1][0] + d(seqA[..
|
|
Problem: Write a program that compares two sequences of differing lengths for similarity. Solution: (In Python) import math def dynamicTimeWarp(seqA, seqB, d = lambda x,y: abs(x-y)): # create the cost matrix numRows, numCols = len(seqA), len(seqB) cost = [[0 for _ in range(numCols)] for _ in range(numRows)] # initialize the first row and column cost[0][0] = d(seqA[0], seqB[0]) for i in xrange(1, numRows): cost[i][0] = cost[i-1][0] + d(seqA[..
|