May 31, 2010


Filed under: django, macports, mamp, mysql, mysqldb, osx — michaelangela @ 7:29 am

For my overly customized MAMP install, it wasn’t pretty. I forget why it’s actually set up this way now but the different parts didn’t like each other and it took quite a while to get it working. Not fun. But fortunately there were those who had gone before me and it wasn’t hard in the end. It just took a long time.



Correction. It just took a really REALLY long time. The reason? You need to have libs and headers and such in places that all make sense for everything to compile. (This is the SHORT version.) So MacPorts to the rescue. Install py25-mysql, copy some files around, use a slightly different “HOST” setting for the database connection and you’re good to go. But installing py25-mysql installs ALL the dependencies needed in order to get that running. Which is good when that’s what you need. Which is what took a long time. But at least it was a one command thing and not hopping all over the ‘net to find and install things as I was very close to doing.

And that bit about the unique “HOST” setting for mine turns out to be

DATABASE_HOST = ‘/Applications/MAMP_1.7.2/tmp/mysql/mysql.sock’

February 4, 2010

What’s your ‘no framework’ PHP framework? – Stack Overflow

Filed under: dev, frameworks, php — michaelangela @ 7:04 pm

I recently did a project for a film company in New York. Neat group. I did the PSD2HTML/CSS, Flash, jQuery goodness, and other related functionality on the server side. Fun stuff. But it didn’t need a complex backend so it’s just simple PHP. That made me start to ask the same question asked here:

Even with a ton of PHP frameworks out there to choose from, I know many people prefer a minimal, personal set of libraries. What is your method when it comes to ‘rolling your own’ framework for PHP applications, and how does it vary depending on the type/scope of a project?

via What’s your ‘no framework’ PHP framework? – Stack Overflow.

There were a good number of recommendations. I actually really liked using CodeIgniter but at that time there was no user management. I believe it did cleaning of input for you when needed. Most CI solutions were older/not maintained, or had other issues that made it not something I wanted to do again. There was one library that I ended up using, and I’ll have to dig up the name of it. It was an early release at the time and I had to hack it to work with Flash. Hmm, I just saw this… I’ll have to take a look at that. Oh and there is also this… Hmm… going to have to peruse this list a bit more

ANyway, so, a lightweight PHP framework/library that cleans up input (no XSS attacks, etc.) and has easy validation, user management… one user from  the original Stack Overflow question mentioned Flourish:

Flourish is a PHP unframework — a general-purpose, object-oriented library.

It has a modular architecture, meaning it isn’t strictly MVC. It focuses on being securewell documented and easy to use, while solving problems intrinsic to web development.

Why Use Flourish?

You will find Flourish useful if you need to write code that is any of the following:

  • Secure
  • Consistent and easy to understand
  • Needs to model simple or complex databases, especially existing schemas
  • Works with international data
  • Can perform accurate math calculations
  • Easily manipulates images
  • Able to run on different databases (MySQL, PostgreSQL, SQLite, MSSQL, Oracle)
  • Can be used on closed-source projects
  • Needs to run on PHP 5.1.6
  • Needs an architecture other than MVC
  • Plays nicely with other libraries and frameworks

via Flourish — PHP Unframework.

Javascript frameworks

Filed under: dev, javascript, mvc — michaelangela @ 6:49 pm

Looking at client side MVC for Javascript. Some that have come up:


The open source Junction framework is a conventions-over-configuration, synchronizing web MVC framework for JavaScript.

”’TrimPath Junction”’ is a clone or port of the terrific Ruby on Rails web MVC framework into JavaScript.

”’TrimPath Junction”’ is also sometimes referred to as TrimJunction, or as just Junction.

via TrimJunction – trimpath – Project Hosting on Google Code.


Claypool is a small, fast, railable Javascript Application Framework , built on jQuery that provides all the usual important patterns for large, long-lived client-side apps, server-side apps, or something strangely, beautifully in the middle.

via Claypool: A jQuery Web 1.6180339… Application Framework.


Jamal is a set of conventions and small javascript libraries to archieve a complete separation of html, css and javascript in your web application. Jamal is built on  jQuery and inspired by MVC frameworks like  Ruby on Rails,  CakePHP and its derivatives.

So Jamal tries not to stand in your way and helps you to organize your javascript code. Javascript code is likely held in functions and used to end up in spaghetti.

via Jamal.


JavaScriptMVC is an open-source framework containing the best ideas in enterprise JavaScript development. It guides you to successfully completed projects by promoting best practices, maintainability, and convention over configuration.

via JavaScriptMVC.

January 19, 2010

Tracking Flash usage

Filed under: as3, dev, tool — michaelangela @ 7:47 pm

stats – mrdoob – FPS, MS and MEM. All in one. – Project Hosting on Google Code

This class provides a simple info box that will help you monitor your code performance.

* FPS Frames per second, how many frames were rendered in 1 second, the bigger the better.
* MS Milliseconds needed to render a frame, the lower the better.
* MEM Memory your code is using, if it increases per frame is VERY wrong.
* MAX Maximum memory the application reached.

December 17, 2009

Some notes on python and com using comtypes

Filed under: com, python — michaelangela @ 2:25 pm

CodeProject: Working with custom COM interfaces from Python. Free source code and programming help

There are a lot of tutorials on Python and COM over the Internet, but in real practice, you might quickly be confused just going beyond standard IDispatch things. The same occurred to me when I decided to write unit tests for our set of COM components. The components are rather simple, they implement one custom interface (derived from IUnknown) and one outgoing IDispatch interface for events.

First, I tried to use the standard pythoncom module, but it turned out that it didn’t support custom COM interfaces. Then, I downloaded the comtypes package and started playing with it. Due to a lack of documentation, it took me about one night to write a simple example. So, here is a step-by-step guide on how to begin using comtypes.

up next…

Python Order2Go Example – DailyFX Forum

For all Python programmers out there that like to play a little with Order2Go:
(On Windows Platforms only)

These are of interest specifically because they deal with getting events from the COM objects and handling them.

December 11, 2009

On the road to becoming a software architect

Filed under: dev, education — michaelangela @ 1:56 pm

I can write components, tie them to data with an MVC model and get things done without any guidance except “this is what it needs to do”. A recent post details recommended programming books. I’m in on the first one, Code Complete 2nd Edition, at section 3.5: Architecture Prerequisite. The book is mostly about construction so it doesn’t delve deeply into architecture but it’s an area I want to develop in. The questions being laid out in this section and the previous one (Requirements Prerequisite) are hitting the issues I have had to fight when things aren’t clear from the beginning. This is extremely helpful for me even when not architecting huge projects.

I have one coming up where the client wants a flat XML file to manage all data instead of a backend database. It will be quite a bit of data as I understand it, not having seen it. I have a better idea now of what to ask when I do set eyes on it for the first time (hopefully soon…).

Recommended programming books in the queue

Filed under: dev, education — michaelangela @ 5:10 am

I can’t find the site that brought me here. The first one, Code Complete Second Edition, reading now, is quite eye opening and written for someone just like me: the self taught developer. My major in college was East Asian Language and Culture with Japanese as the language of choice. I have forgotten most of the Japanese I learned and instead speak Chinese now. Go figure! The language learning process fascinated me though and I think that helped prep me for a career in development. So when my type was included in the “who this book is for” that really caught my eye.

The next one down, The Pragmatic Programmer, has been on my “want to read” list for a while ever since I heard about the Pragmatic Bookshelf and got some goodies on iPhone development there.

And with #3, Structure and Interpretation of Computer Programs, being available freely online, I can’t pass that up! 🙂

What is the single most influential book every programmer should read? – Stack Overflow

If you could go back in time and tell yourself to read a specific book at the beginning of your career as a developer, which book would it be?

I expect this list to be varied and to cover a wide range of things. For me, the book would be Code Complete. After reading that book, I was able to get out of the immediate task mindset and begin to think about the bigger picture, quality and maintainability.

Suggest your programming books

December 7, 2009

Plotting libraries

Filed under: python, tool — michaelangela @ 6:59 am

I wanted to look up some plotting libraries just to get an idea what’s out there. Plus I like Python for throwing numbers around although R has just become a new favorite for quickly working through some numbers… just need to learn statistics now. 🙂

But I turned to stack overflow for an answer.

matplotlib is powerful.

CairoPlot is pretty.

December 2, 2009

R and statistics

Filed under: automation, data processing, python, r, tool — michaelangela @ 11:41 am

If I have a database and I need to do some random queries where I need to do experimental queries interactively, I turn to python’s SqlSoup. But if it’s CSV, I used to just do some file handling in Python, load it up, and use lists (which are very cool) or some other straightforward data processing on it. Python’s good at that. Then I heard about R. I don’t have a lot of time to dig into the details at the moment but the link below really opened my eyes to what it can do. And how easily at that.

Basic statistics using R

The following page is a quick guide for using R to do most statistics necessary in an introductory statistics class.

Like loading in a table as a dataset:


I mean seriously! While it didn’t pop up a dialog on iTerm (using latest R for OSX) I just pasted in the path to the file and my data was there as


ready for manipulation. Some searches on filtering led to this post showing:

>tt <- matrix(1:20, ncol = 4)
     [,1] [,2] [,3] [,4]
[1,]    1    6   11   16
[2,]    2    7   12   17
[3,]    3    8   13   18
[4,]    4    9   14   19
[5,]    5   10   15   20
tt[tt[,1] < 3, ]
     [,1] [,2] [,3] [,4]
[1,]    1    6   11   16
[2,]    2    7   12   17

and I tried

 tt[tt[,1]>3 & tt[,3]<15]

based on a conditional seen here just to see if I understood it and got

[1]  4  9 14 19

which is what I expected but didn’t realize how easy that would be. Nice! The subset command is more explicit though with its named columns. Either way, wow that’s really nice to work with. Of course, there is also RPy:

RPy is a very simple, yet robust, Python interface to the R Programming Language. It can manage all kinds of R objects and can execute arbitrary R functions (including the graphic functions). All errors from the R language are converted to Python exceptions. Any module installed for the R system can be used from within Python.

Two flavours are available: rpy and rpy2.

Best of both worlds? 🙂

Flash equivalent of CSS Sprites complete with rather novel CSS control

Filed under: as3, cool, css, dev — michaelangela @ 9:33 am

This is pretty sweet. You know css “sprites”, where you load one image and restrain it with CSS constraints so that you use the one image in multiple places showing only one section at a time, etc., etc. Well this works in AS3 (i.e. not just in Flex) and it adds some pretty nifty control via CSS. It becomes a sort of way to inject stuff into visual items. Take a look at the (very complete) tutorials listed on the site for examples.

Flash Camouflage | Flash Camouflage is a framework for skinning AS 3 Applications.

Flash Camo (for short) is a graphics framework that allows AS 3 applications to be easily skinned from pngs, jpgs, or gifs. The framework is broken down into 3 core areas: Decals, the CSS Parser, and the CamoDisplay. When these systems are used together they form a powerful set of tools to help skin and style any Flash application. With Camo’s modular approach, you can use as little or as much of the framework as you want.

November 30, 2009

Links on app testing and functional testing

Filed under: behavior driven development, dev, functional testing, test driven development, tool — michaelangela @ 2:18 pm

I just want these in one place for future reference, in no particular order except the order they are open in tabs in Firefox at the moment…

Software Testing Geek -Software Testing – Selenium IDE, RC Tutorial & Workshop

Examples « Watir

Home – mozrepl – GitHub

Software Testing Geek -Twill – Simple Web Automation Tool in Python

3hv » Blog Archive » Cucumber and WATIR: kick-starting your testing

Home – cucumber – GitHub


brynary-webrat :: gitrdoc

PHP – cucumber – GitHub

November 24, 2009

Automating Firefox… from within…

Filed under: cool, dev, firefox, functional testing, testing, tip, tool — michaelangela @ 2:34 pm

This is just crazy cool. Just noting for future use.

MozLab | hyperstruct


Connect to Firefox and other Mozilla apps, explore and modify them from the inside, while they’re running.

Execute Javascript, play with browser GUI, sneak into HTML pages, examine functions and variables, redefine them on the fly, hot-fix bugs, …

FunFX Tutorial

Filed under: cool, dev, flex, functional testing, tool — michaelangela @ 2:30 pm

Just for future reference… this is some nice stuff indeed!

Testing your Flex app with new FunFX | Ladislav Martincik – Personal website

Flex Functional Testing

Filed under: dev, flex, functional testing, tool — michaelangela @ 2:28 pm

See the syntax example on the page for a quick reference. Wow…  that’s pretty cool.

.::FunFX – Functional Testing of Flex applications

FunFX is created as a framework that will enable you to drive a Flex application through a web browser. FunFX together with for instance Test::Unit or rSpec creates a great to for testing and asserting the functionality of a Flex application.

October 15, 2008

Python and PHP serialization

Filed under: dev, php, python, tool — michaelangela @ 5:57 pm

I have some data that I am pulling via Amara. I need to put that in a database. The app that uses that data is in PHP and would prefer the data to be serialized. Fortunately, there is help! 🙂

Scott Hurring: Code: Python: PHP Serialize implemented in Python: v0.4b

This is a python implementation of PHP’s native serialize()
and unserialize() functions.

Taken along with my perl serialize implementation,
this code will enable you to transfer simple data structures
between PHP, Python, and Perl using PHP’s data serialization format.

This code aims to be a very lightweight data transport
layer between PHP, perl and python using PHP’s native
serialization format.

September 27, 2008

Good AS2 class for textfields

Filed under: dev, flash, tool — michaelangela @ 4:29 am

Just taking a note on this. It looks quite useful.

Easy Custom Scrollbar Class for TextFields (AS2) | Taterboy.com: Graphics, Multimedia and Such

Here is the twin brother of the Easy Scrollbar MovieClip Class
that works with TextFields. It does not require the masking and is
perfect for Input TextFields. It has all the features of the MovieClip
version except for easing. TextFields scroll one line at a time which
is not very smooth.

September 25, 2008

I simple have to check this out

Filed under: cool, dev, flex — michaelangela @ 10:49 pm

openflux – Google Code

OpenFlux is an open-source component framework for Flex which makes radically custom component development fast and easy.

September 11, 2008

Pythonic grep sort of

Filed under: cool, python, tip, tool — michaelangela @ 4:00 pm

Looking for a way to crank through files and search for specific text within matching files. Found this and it’s very neat.

Python: find files using Unix shell-style wildcards « Muharem Hrnjadovic

The download though was a little hard to find so I just got the source tar.gz file from here:


[update]In the end I tried grep which was significantly faster, just reading the output of the command in while looping through a list of files:

def fgrep(the_string,the_files):
    all_lines = []
    for the_file in the_files:
        command = 'grep "%s" "%s"' % (the_string,the_file)
        response = os.popen(command,'r')
        lines = response.readlines()
        for line in lines:
    return all_lines

August 30, 2008

Using Charles to test a SWF from a remote location

Filed under: cool, dev, flash, functional testing, tip, tool — michaelangela @ 12:36 am

I just wanted to make sure I keep this note handy. Charles is already very cool. This just makes it cooler. 🙂

Testing a SWF From a Remote Location (Deitte.com)

Map Local
allows you to map URLs to local directories. This means that you can
test a SWF that should be on a remote site. It’s incredibly useful for
the large project problem I was having or for debugging problems on a
live site.

July 14, 2008

A good short-list of PHP frameworks

Filed under: dev, mvc, php — michaelangela @ 7:08 am

I have had to come back to PHP after a long hiatus. I prefer Python but recent projects require PHP and thus my return. I did a project recently with CodeIgniter which really is a spiffy project. But I would like a true OOP PHP5 MVC fast lightweight framework that has user auth, session management and a lightweight ORM. Or be able to plug one in. Perhaps Kohana, based off of CodeIgniter, would fit the bill. Something about “Keep Kohana Alive” makes a little nervous though…

PHP: MVC Based Popular Framworks | Jit V. Tiwari

PHP: MVC Based Popular Framworks

Custom Flex Calendar controls

Filed under: as3, cool, dev, flex — michaelangela @ 3:17 am

I have worked with customizing the Flex calendar components and will probably need to do so again in the future, but this is pretty neat. I’ll have to look into this more soon.

Refreshingly new Flex Calendar controls « My journey in the world of RIA

Flex is a very flexible language and I’m here to prove it again.

Today, I’m posting these two new cute flex calendar controls which uses inbuilt “CalendarLayout” class for functionality and has a completely new layout and interface defined in MXML.

July 6, 2008

Getting rid of the dreaded “can’t encode” errors with Python and MySQL and SqlSoup

Filed under: automation, cool, dev, mysql, python, sqlalchemy, sqlsoup, tip, xls — michaelangela @ 10:47 pm

So I was getting problems inserting data that has the ‘™’ symbol in it. Brutal stuff. Couldn’t find a way around it. Did it by hand in the end. Nasty. The problem was that I was getting

UnicodeEncodeError: 'latin-1' codec can't encode character u'\u2122' in position 12: ordinal not in range(256)

where the '\u2122' is the ‘™’ symbol. There were some others as well. Finally happened upon this post which, fortunately, cleared it up. To use this tip with SqlSoup, the connection string needs a couple of extra parameters.

Instead of

db = SqlSoup('mysql://user:password@host:port/database')


db = SqlSoup('mysql://user:password@host:port/database?charset=utf8&use_unicode=0')

The requirement of course is that the database tables are set up with the UTF-8 charset.

But now I can thrash data at will! Mwahahahaha! Sorry… but now I can pull in unicode data from an Excel file and throw it into a database with rediculous ease. OK not rediculous ease but wow this simplifies it.

[edit]I like to use iPython to do my data thrashing with SqlSoup and SqlAlchemy. If you use the second connection string with the charset and use_unicode options, don’t reset the db connection to the previous one without those. Once doing that I couldn’t set it back and had to exit and restart the session. Bummer.[/edit]

mysql unicode issues – sqlalchemy | Google Groups

a. have use_unicode=0, set charset=’utf8′ on the connection, AND

b. ensure you have
table options = {‘mysql_charset’: ‘utf8’} when creating tables, and
all should be well.

Python Excel file reader

Filed under: cool, python, tip, xls — michaelangela @ 1:36 am

This thing is just brilliant! I am working on a project that uses PHP. But I still do my data mangling with Python because of tools like SqlSoup running under SqlAlchemy. Using those under iPython has saved incredible amounts of time. I actually like working with data in this way. It just makes it more fun. Well, I have some data in an Excel file that has multiline text in it. That can be a pain with CSV files. A little digging located a Python Excel writer which had stopped development, with the suggest to use a Python port of a Perl writer, which while cool for writing, has trouble reading… but a helpful post pointed to xlrd. A quick “sudo easy_install-2.5 xlrd” later and I was able to do:

import xlrd
book = xlrd.open_workbook("myfile.xls")
sh = book.sheet_by_index(0)
for r in range(sh.nrows)[1:]:
print sh.row(r)[:4]

Sweet. Indeed. All of the Unicode elements and multilines are intact and good to go. Good stuff.

Python Package Index : xlrd 0.6.1

Library for developers to extract data from Microsoft Excel ™ spreadsheet files

Extract data from new and old Excel spreadsheets on any platform. Pure Python (2.1 or later). Strong support for Excel dates. Unicode-aware.

July 5, 2008

Loading assets in AS3 and Flash

Filed under: as3, dev, note, tip — michaelangela @ 8:39 pm

Loading up assets can be a pain to track so this set of code aims to simplify that. Need to check it out later though.

AYAN RAY | AS3 / Flash: Introducing the AssetLoader Class

In Actionscript 3, there are many different ways to load external assets from the Internet. Unfortunately, this can become tiresome to find different ways to load each one in it’s own individual way. With this problem in mind, I have created the AssetLoader class.

Actionscript 3 Excel library

Filed under: as3, dev, flex, note — michaelangela @ 8:31 pm

Adobe – Flex Extension

An Actionscript 3 library for reading and writing Excel files. Currently reading numbers, text, and formulas from Excel version 2.0-2003 and writing numbers, text, and dates to Excel 2.0 is supported. No server-side help is needed.

Older Posts »

Create a free website or blog at WordPress.com.