Audrey M. Roy

Art, design, Python, JavaScript, and general silliness 
Filed under

programming

 

The Extreme Maker's Schedule

Paul Graham wrote an excellent essay called Maker's Schedule, Manager's Schedule, which I've seen and heard referenced several times over the past couple of months.  It's about how programmers, writers, and other creative types need at least half-day blocks of uninterrupted time to work productively, unlike managers and business types.

I've discovered that I work best on a special case of the maker's schedule.  I call it the Extreme Maker's Schedule.  Half-day blocks are not enough for me.  I work most productively in 72- or 96-hour blocks of uninterrupted time. 

On this schedule, I allocate 3-4 day blocks of time to a particular project.  During this time I try to avoid even the smallest disruptions.  I begin by ordering or preparing enough food for the creative period that I don't need to cook, e.g. by baking a lasagna.  I clear my schedule entirely so that I have no meetings or events to attend. 

Even online distractions such as email, Facebook, and Twitter are to be avoided at all costs on this schedule.  If I take a long time to respond to emails, this is why.  A single email can derail my train of thought for the entire evening.

Once the 72- or 96-hour block has begun, I work on nothing but the one particular project.  It usually takes a couple of hours for the excitement and thoughts to start flowing, but once I get to this point, I find myself in a state of unimaginable creativity and productivity.  Knowing that I have nothing else planned but that one project helps.  These periods are often so intense that I end up sleeping in a series of naps, as a result of staying up late and then unintentionally waking up early full of excitement.

While this sounds strange, it's likely that other creative types enjoy this schedule.  It's much like being in college and working on a final project all week, or sprinting all weekend at a developer hackathon. 

Realistically, the Extreme Maker's Schedule is hard to follow in a normal world.  It helps to be self-employed full-time, and to be single without dependents.  It also helps to have a retreat to get away to, whether it's a distraction-free apartment or an out-of-town secret hideaway.

Filed under  //   creativity   flow   Paul Graham   programming   time management  
Posted by Audrey M Roy 

Comments [0]

My Android math multiplier game

Here's a video of my Android game working on the G1.  Currently the game has no sound because there's a bug in my sound-playing code that makes the app crash.  Hopefully there will be boings whenever you click in the real version. 

I'm open to ideas about how to make better use of the Android's sensors in the app.  I was thinking that it could give you hints when you shake the phone.  E.g. all the multiples of 4 would fall to the left side when you shook it to the left (at a 20-point penalty). 

This is just the development version.  I'll announce it's real title when it's officially out, which is something new that I came up with last night.

  

Filed under  //   Android   games   PhoneGap   programming   projects   XUI  
Posted by Audrey M Roy 

Comments [4]

PhoneGap - AudioFlinger error while receiving a Gmail email

In my (XUI) on click handler, I have this:
navigator.notification.beep(2);


The problem is that beeping stops working after awhile.  I think it stops working whenever my phone receives a network tickle from Gmail.

If I keep playing the game after the sound stops, the app crashes entirely after a little longer.  That's really bad.

The log.txt showing the AudioFlinger error & Gmail notification:  

I'm stuck.  I guess these are my options:

  • Play a non-beep sound on click and see if it still happens.  Find a free wav to use.
  • If that doesn't help, look at PhoneGap.java to better understand how audio works in PhoneGap.  And learn how audio generally works when using the Android SDK.
  • Give up and remove audio from the game. 

Filed under  //   Android   audio   PhoneGap   programming  
Posted by Audrey M Roy 

Comments [3]

To speed up a slow Windows XP computer

Install Linux on it, e.g. Ubuntu.  Seriously, try it.  It's like Windows but easier and more fun. 

I'm half-kidding.  That isn't going to cut it for everyone.  I use the WinXP laptop as my Adobe Illustrator machine.  I do use Inkscape on Ubuntu, but I can't live without Illustrator.  Therefore, I can't live without Windows. 

Doing this will make your machine run like new:

  1. Run msconfig from Start > Run... or from the Task Manager > File > New Task (Run...)
  2. Go to the Startup tab.
  3. Click [Disable All].
  4. Optional: Go to the Services tab.  Uncheck Hide All Microsoft Services.  Then uncheck the services that annoy you.
  5. Reboot.

(As a side note: I could get a Mac, but I'm cheap.  I'm bootstrapping my startup, after all.)

Filed under  //   programming   Windows XP  
Posted by email 

Comments [0]

How to set up a real G1 Android phone for development on Ubuntu 9.04 (Jaunty Jackalope)

I'm renting a G1 from someone for a few days to test my app.  The Android docs don't mention how to install the G1 on Ubuntu Jaunty (9.04).  What I did to install it:

$ cd /etc/udev/rules.d/
$ nano 51-android.rules

and create a file containing this:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

then:
$ sudo chmod a+rx /etc/udev/rules.d/51-android.rules

Check that it attached:
$ cd /your_android_sdk_path/tools/
$ $ ./adb devices
* daemon not running. starting it now *
* daemon started successfully *
List of devices attached
HT94YLC00022    device

After this, I was able to run my app on the real Android via Eclipse.

Filed under  //   Android   programming   Ubuntu 9.04  
Posted by email 

Comments [0]

XUI notes: Removing all divs of a class

1:15pm:  I try removing all divs of class "choicebox".  Doesn't work.
x$('div.choicebox').each(function() {$x(this).remove()});

1:20pm: I study the jQuery docs.  x$('div.choicebox').each($x(this).remove());  Doesn't work; deletes more than I had bargained for.

1:23pm: x$('div.choicebox').remove();  Works.  Life doesn't have to be so complicated.

Filed under  //   JavaScript   programming   XUI  
Posted by email 

Comments [0]

XUI notes: jQuery-like text() function, and other undocumented functions

To get the text of a div with id "box", do this:
x$('#box').first().innerText;

I didn't see a first() in the XUI docs.  A look at xui-0.9.0.js shows this:
        first: function() {
            return this.elements[0];
        },

In addition, I noticed definitions for elements, each, find, extend.  There's lots of good undocumented stuff in there - poke around a bit.

Filed under  //   JavaScript   programming   XUI  
Posted by email 

Comments [0]

Progress on my first PhoneGap/XUI app

I'm making great progress with the app.  I wrote the code entirely from scratch tonight.  And the app mostly works now.  You click on boxes that match a specified condition to earn points.  The faster you do it, the more bonus points you get. 

I spent over an hour trying to figure out how to get the text from a DOM element with XUI.  It must be something like x$('#foo').text() or x$('#foo').html().nodeValue.  I tried a million things and couldn't figure it out.

I know that x$('#foo').html() returns a Javascript object because I printed it in an alert, but then I don't know what to do with the object.  If only I could run the app in Firefox and use Firebug, then I could inspect it.  I did try loading just the html file in Firefox and commenting out the link to phonegap.js, but that didn't work. 

Tomorrow:

  1. Figure out how to get the text of a DOM element with XUI.  Fill in the condition test that uses the text from the number box divs.
  2. Load state from somewhere (a text file?) upon app launch, and save it at the end of every level.
  3. Try to add some cute accelerometer-using feature to the app.
  4. Come up with a good name.  Firethink?  I don't know.  Something about speed/fire + math/thinking/mental workouts.

Filed under  //   Android   JavaScript   PhoneGap   programming   XUI  
Posted by email 

Comments [2]

My notes on installing Pinax 0.7rc1 and integrating my Django art catalog app into it

This post is a mess and mainly for my own personal records.  I've been up all night installing Pinax v0.7rc1, integrating my Django art cataloguing app with one of the Pinax sample projects, and trying to deploy it on Webfaction. 

I installed Pinax 0.7rc1 locally as per the "development version" instructions on their documentation site

Installation notes:
- Install virtualenv and virtualenvwrapper before pinax, if you haven't already
- When you create the pinax-env directory, do it inside of ~/.virtualenvs/
- I ran into a dependency conflict - I had simplejson 1.9.2 installed, and it wanted 2.0.9.  I removed the old one via synaptic and then deleted the old egg.  When I tried rerunning the Pinax script that installs all the external dependencies, it completed successfully.

Then, I cloned their sample social networking website social_project and played with the site (at localhost:8000).  Its admin site at localhost:8000/admin also worked as expected.  This is great, I thought.  I was kind of surprised that I got it working so fast.  The trick is to read every word of the installation docs carefully - I was running into problems until I forced myself to stop skimming the instructions over.

Next, I decided to integrate my Django art cataloguing app with social_project. 

I did the following:
- added this to socialsite/urls.py: "    (r'^artpieces/', include('artapp.urls')),"
- dropped my artapp's urls.py into socialsite/apps/artapp/ and removed the 'artpieces/' start of each url since it's already relative now
- put artapp/ into socialsite/apps/
- put my artpieces/ (the artapp template folder) into socialsite/templates/.  I just put all the artpiece display code inside {% block body %}.  At the top I added {% extends "site_base.html" %} and {% load artapp_extras %}, where the latter loads my custom filters.  I believe I looked at social_project's tag_app and modeled these after its templates, but I don't remember and don't feel like looking it up.
- dropped media/ into site_media/ for local testing purposes.  media/ contains my css files.
- added 'artapp' to INSTALLED_APPS in socialsite/settings.py  (as well as a bunch of Amazon S3 stuff)
- dropped templatetags/ into socialsite/apps/artapp/.  this contains my Django custom filters.
- (I may have forgotten a couple other things)

This worked for the most part.  My art cataloguing app & its admin interface are now fully functional inside of the Pinax social_project app, except for the fact that thumbnails don't get uploaded to S3.  This is probably because of MEDIA_URL and MEDIA_ROOT in settings.py - they point to the just-for-testing site_media/ right now, I could imagine.  I didn't bother to look because I figured I had gotten far enough to try deploying my app on webfaction.

So, after getting it mostly working locally, I tried to get it working on Webfaction.  I really, really hope Webfaction starts supporting Pinax out-of-box because this is where I got stuck. 
1. I easy_installed virtualenv & virtualenvwrapper in my webfaction acct
2. $ wget http://kernel.org/pub/software/scm/git/git-1.6.4.1.tar.bz2
$ tar -xvjf git-1.6.4.1.tar.bz2
$ cd git-1.6.4.1
$ ./configure --prefix=$HOME
$ make && make install

and then kaboom...this is where I got stuck:
    LINK git-upload-pack
    CC var.o
    LINK git-var
    CC http-push.o
http-push.c:14:19: error: expat.h: No such file or directory
http-push.c:852: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
http-push.c: In function ‘lock_remote’:
http-push.c:936: error: ‘XML_Parser’ undeclared (first use in this function)
http-push.c:936: error: (Each undeclared identifier is reported only once
http-push.c:936: error: for each function it appears in.)
http-push.c:936: error: expected ‘;’ before ‘parser’
http-push.c:943: error: ‘parser’ undeclared (first use in this function)
http-push.c:946: error: ‘xml_cdata’ undeclared (first use in this function)
http-push.c: In function ‘remote_ls’:
http-push.c:1179: error: ‘XML_Parser’ undeclared (first use in this function)
http-push.c:1179: error: expected ‘;’ before ‘parser’
http-push.c:1186: error: ‘parser’ undeclared (first use in this function)
http-push.c:1189: error: ‘xml_cdata’ undeclared (first use in this function)
http-push.c: In function ‘locking_available’:
http-push.c:1262: error: ‘XML_Parser’ undeclared (first use in this function)
http-push.c:1262: error: expected ‘;’ before ‘parser’
http-push.c:1269: error: ‘parser’ undeclared (first use in this function)
make: *** [http-push.o] Error 1

(How do I install Git? https://help.webfaction.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=169&nav=0,33
WebFaction Django/mod_wsgi forum post: http://forum.webfaction.com/viewtopic.php?id=1119)

This is where I've left off for now.  I guess I have to install some XML library on webfaction in order to install git, and then I can get back to installing git on webfaction and continue through the rest of the instructions.

Filed under  //   Django   Pinax   programming   Python   virtualenv   Webfaction  
Posted by Audrey M Roy 

Comments [1]

Making RGBA gradient strip png images with PyCairo

I find it a pain to have to open up GIMP or Photoshop to make gradient strip pngs while I'm in the middle of styling my CSS.  I like to go back and forth, tweaking the gradient strip stops and reloading the web page in my browser until it looks just right. 

Here's an easier way to generate them, if you prefer scripts.  When you're dealing with very transparent or subtle gradients that you can barely see, a graphical interface isn't that helpful anyway.  See the PyCairo docs for more on their gradients and color stops. 

#!/usr/bin/env python
import cairo

WIDTH, HEIGHT = 1, 54

surface = cairo.ImageSurface (cairo.FORMAT_ARGB32, WIDTH, HEIGHT)
ctx = cairo.Context (surface)

grad = cairo.LinearGradient (0, 0, 0, HEIGHT)   # change to 0,0,WIDTH,0 for horiz strips
grad.add_color_stop_rgba (0,0,0,0,0)
grad.add_color_stop_rgba (0.9,0,0,0,1)

ctx.rectangle(0, 0, WIDTH, HEIGHT)
ctx.set_source(grad)
ctx.fill()

surface.write_to_png("gradient.png")

***********

Update 8/24/2009:

Funny, just happened to find this by accident:
http://jtauber.com/blog/2008/05/18/creating_gradients_programmatically_in_python/

Filed under  //   generative art   programming   PyCairo   Python  
Posted by email 

Comments [0]