She's Geeky 2010 Bay Area, Jan 29-31

December 15th, 2009 by comment

She’s Geeky is my favorite stateside women’s tech event. It is a great opportunity to network, learn about other women’s projects and ideas, and test the viability of some of these ideas against receptive VCs. It’s also a great un-conference environment. It is low-key, entirely attendee-drivien, and will be whatever you all make it. I was thoroughly impressed with this conference, now hosted multiple times a year throughout the country, each with it’s own regional twist. It can be a great place to find your next job, start your next dream project, or simply be inspired by others who are doing so.

Early registration ends Friday. Go here for details.

Gloria

ˆ Back to top

PyCon 2010 Financial Assistance Grant for Women

December 3rd, 2009 by comment

I am happy as hell to announce that this grant exists. The deadline is Dec. 18th, and I strongly encourage you to apply.

http://us.pycon.org/2010/registration/financial-aid/

This conference gets a bit bigger each year, but the organizers make a great effort to keep the small conference feel. It also has many level-100 tutorials, and is both socially and technically welcoming for py-newbies.

Open space sessions (everything from software development to Settlers) and poster sessions happen every night, tutorials run two days prior, and code sprints run for a few days after the conference. It promises to be a great learning and social experience you should not miss.

I am reserving a room and sharing it: http://us.pycon.org/2010/registration/room_sharing/
I’ll room with as many as possible, to cut costs for everyone. Bring a sleeping bag :)

See you there,

Gloria

ˆ Back to top

PyArkansas: Small town, big tech!

November 21st, 2009 by comment

Last weekend I flew out to to Little Rock, Arkansas, took a two hour crawl through a snarl of traffic, and arrived just in time for my Friday night pre-PyArkansas tutorial in Conway. Held on the stunning campus of Hendrix College, I wended my way around buildings, a massive fountain, inspiring structures, until I found the building where my tutorial was about to happen. Standing in the foyer with the beautiful Foucault pendulum, I could not help but to stop for a moment, exclaiming “Oooo!!!!” aloud, wishing I had gotten there thirty minutes earlier.

My tutorial was intended to encourage women in computer science by serving two purposes: discussing the source code and functionality of a particular project, and openly discussing some of the issues they faced in their current programs and surroundings. I was pleasantly surprised to discover that these women needed no technical or social encouragement. They are already enthused, technically and socially well prepared, and on their way to a very bright future in engineering or computer science. I was pleasantly surprised that they were very comfortable in the bash shell, and as comfortable in their current college curriculum. Like children at play, they picked up the moderate-levelled tutorial code quickly, made great strides in such a short time, and had a lot of fun doing it.

It was profoundly encouraging to see such a small computer science program achieve diversity as well as such a high level of skill. It made me wonder why larger colleges and universities cannot accomplish the same on bigger budgets, with larger staff, and a more diverse mix of students. It touched me to hear and see the enthusiasm, eagerness, and skill of the students in this program. Their learning experience under the Department Chair, Dr. Burch, comes as close to perfect as I have ever seen.

The next day’s events at PyArkansas were held at the also-very-nice campus of University of Central Arkansas, where an entire day’s worth of tutorials took place. Two Python 101 tracks were held: one for programmers and one for non programmers (a great concept). An all-day Django Track was given, where the advanced course was taught by Jacob himself. I held an afternoon tutorial addressing advanced Python concepts, with downloadable example code, where we compared and contrasted build and deployment tools, played with regex, and showed examples of some internal Python oddities involving static variables. I unfortunately missed the Python Blender tutorial, held at the same time as mine, and I heard it went quite well.

The campus facilities were very accomodating. Everything was well organized,and up and running for us when we arrived. This is a very welcome surprise to anyone who has travelled a bit to do tutorials. I was specifically told by Dr. Chenyi Hu, the Department Chair of UCA, that he really does care about diversity, and it is something they strive to achieve. This was truly touching, quite impressive, and a pleasant surprise from such a small town.

Kudos to Greg Lindstrom, Dr. Carl Burch of Hendrix College, Dr. Chenyi Hu of UCA, and everyone else involved. You induced a big technical “tremor” through your small town, which echoed far and wide. It is yet another example of the great people drawn to the Python community, and the amount of quality effort they are willing to give back. I feel honoured to have been part of this event, and I hope to be involved in many more to come.

Gloria

ˆ Back to top

Satchmo: Python Storefront out-of-the-box

September 29th, 2009 by comment

Satchmo is turning out to be an interesting project. The first true Python contender to challenge the plethora of PHP CMS tools used for the de facto net store front, it fares quite well in the face of this challenge. .

Satchmo is based on the Django framework. More accurately, it is loosely coupled to Django through several external Django plugins. For example, registration functionality is extended through the django_registration external interface, installed as a separate egg in the Python distribution directory. Satchmo makes calls to this extension, leaving Django code untouched.

Compare this to Drupal registration changes, where source code is wedged into the existing framework, applying deep back end database schema changes, as well as code changes throughout the framework. The changes are irreversible, and if they fail, you’re SOL. Look under the hood of Drupal, and you see a tangle of database calls, auth and group checking calls, intertwined around back end logic. It’s not pretty, which is why it’s so hard to maintain and upgrade over time.

The Satchmo/Django coupling is not perfect. If you mismatch incompatible versions of Django plugins to Satchmo, or other applications, cryptic messages can appear from either side, pointing back to code compiled elsewhere and placed in your Python distro. This makes it difficult to trace back, even if you vaguely know where the failure point is.

But this is the worst problem Satchmo has presented to me so far. I can certainly live with that, compared to digging through many chunks of Drupal framework source code and database schema backups to figure out why a recent patch broke authentication, how group permissions were changed, etc.

Satchmo takes full advantage of all of the juicy Django goodness that makes web framework development fun again: built-in internationalization and localization all the way down to currency handling and language choices in templates, built-in registration, email verification and customer account management, built-in form data validation, seamless form-to-database data entry.

This is a revolutionary, much needed improvement in the Open Source store front choices. Now all we need is an Open Source back end inventory system, and a very functional Open Source phone bank system based on Asterisk, with Python wrappers, and life would be wonderful.

Gloria

ˆ Back to top

PyCon 2010 talk proposal deadline: Oct 1st

September 25th, 2009 by comment

Want to give a tutorial or talk about what you’re doing in Python? Submit your proposal!

Want to get more familiar with Python? Want to participate in shaping this community, and helping to drive the effort behind new libraries and modules? Want to do something fun and new in the Open Spaces and code sprints? Be sure to be there in 2010. I think it’s going to be a unique, interesting and most spectacular year for PyCon, and I’d really like many women on this list to be a part of this great event.

I know, it’s late for my time zone, and you must be thinking that I’m juiced up on Club Mate right now. Maybe I am, but I was excited about this well before the Mate. I am a bit more involved this year, reviewing talks, discussing some possibilities for new types of Open Space events and code sprints, poking my head into various discussions, etc. It’s getting exciting, but it will be even better if more women show up this year, I guarantee this (HINT HINT).

If you want to come, but can’t afford it, don’t let this stop you! Contact me and I’ll put you in touch with organizers who may be able to help you get to PyCon this year.

Yes, I’m flying. How? No, not Mate. You know how:
http://xkcd.com/353/

Gloria

ˆ Back to top

Job posting!

September 18th, 2009 by comment

A large, successful bakery in NYC wants to grow their online presence in the social app space, blogosphere, and related web sites. They need a person (who does not have to be a NYC resident, but will visit occasionally) who knows how to:

(1) Find related web sites and drop relevant strategic links on those sites without “spamming”.
(2) Create an online social app/blog presence for this company, announcing new products, philanthropic events, etc. for this company.
(3) Follow accounts at Facebook, MySpace, product blogs, etc. Help set up the look and feel of these sites (working alongside a writer, a designer, and a software developer).
(4) Help us build this presence in creative ways: event photo slideshows, podcasting interviews of the owners, the technical aspects of the company, etc.

Please submit a resume and some examples of your work online. Also give me an example of how you would promote such a situation. Creativity is definitely encouraged:

I am handling the system admin and software design/development. Over the next few months, I’ll be taking it in new directions, by bringing in a free Python apprenticeship training group, and using this site as training ground for people new to Python. This will bring it some social exposure from the tecchie direction. How and where would you discuss this unique approach of growing a business while providing a public service?

Please send email to gloriajw_66, at the address yahoo dot com

Thank you, and good luck!
Gloria

PS: Working alongside me means this job _always_ has the opportunity to morph in a more technical direction, if you so choose. This straddles many disciplines, and can turn out to be quite fun if you wish to expand your current knowledge.

ˆ Back to top

Fun at PyOhio: SqlAlchemy, MongoDB, and Google Maps API

August 6th, 2009 by comment

This was my first year attending PyOhio, and I really enjoyed it. It was small enough to have the time to catch up with fellow Python geeks, yet large enough to offer interesting and wide-ranging topics.

I did a tutorial on browser-to-database web development in Python, using components from various packages instead of one framework. I found myself and Mark Ramm giving our audiences a common message about frameworks in general, which was (1) each framework has limitations, (2) know these limitations before running off to use them. It was comforting to know that I am not the only one trying to convey this message.

I wasn’t quite sure how long my tutorial would run, so the PyOhio folks were kind enough to give me a room for an entire afternoon. It took about three hours, and was great fun.

I’ll attach all slides, links, and code. But there’s the summary of it all.

I took weather data from the University of Delaware, air temperatures from around the world ranging from 1900 to 2008. I pulled the data into both SqlAlchemy/Postgres, and MongoDB (a BSON-based key-value object store).

I then used CherryPy to serve up the data. My templates are written in web.py template, generating Google Map data.

The first CherryPy daemon takes longitude and latitude, and allows you to choose between Postgres or Mongo:

http://www.pythonpeople.net/gmaps/squarearea?year=1900&month=0&zoom=7&centerlat=40.90&centerlong=-80.50

http://www.pythonpeople.net/gmaps/squarearea?year=1900&month=0&zoom=7&centerlat=40.90&centerlong=-80.50&mongo=1

The second daemon provided a simple form, accepting zip codes, and referencing a database which maps zip codes to longitude and latitude.

Feel free to play with the links for a bit longer. They will be coming down in the next month or so.

The code and data, including all CSV load code and scripts, exists here:

http://www.pythonpeople.net/pyohio_src

Shoot me an email for the login and password: gloriajw_66 at yahoo dot com

This is an excellent web app example for learning purposes.

The tutorial is also somewhere on BlipTV, I am told.

Enjoy, play, ask questions.

Gloria

ˆ Back to top

O'Reilly Mother's Day Discount: Get yours!

May 9th, 2009 by comment

This is a great idea, thanks to Hilary P:

http://fyi.oreilly.com/2009/05/women-in-tech-rock-join-our-mo.html


The discount code can be found at this link.

Gloria

ˆ Back to top

RailsBridge

May 4th, 2009 by comment

Even though I am a Python developer, this made me happy:

http://railsbridge.org/

We’ve been fortunate to have an outstanding, welcoming Python community driving the tone and the quality of events from PyCon, down to the statewide and local user groups. We don’t yet have a need for such a bridge group, and I hope we never need one. But it’s great to see one form quickly where it’s needed, and to see familiar names associated with it. More power to you.

Gloria

ˆ Back to top

I Love Python: ReSTful DB CRUD dispatching using CherryPy

April 19th, 2009 by comment

CherryPy has been one of my favorite Python tools for several years. It should be mentioned here that a ReSTful dispatcher could easily be written in web.py, or pylons as well, and even comes for free in the latest TurboGears implementation.

But if you’re looking for a small, easily manageable and extremely dynamic ReST dispatching solution without the heft of an entire web framework, I’m about to show you how CherryPy can help you in three different ways, depending on your model.

Assuming this mapping:

HTTP GET or HEAD = DB Read
HTTP POST = DB update
HTTP PUT = DB insert
HTTP DELETE = DB delete

Let’s also standardize on one common method across all examples, for determining the HTTP request type, and matching it to the function of the same name. Here is the full code snippet for accomplishing this task:

methods = ('OPTIONS','GET','HEAD','POST',
'PUT','DELETE','TRACE','CONNECT')

if cherrypy.request.method not in self.methods:
    raise cherrypy.HTTPError(400,'Bad Request')

# If request method is HEAD, return the page handler
# for GET, and let CherryPy take care of dropping
# the response body
method = cherrypy.request.method

if cherrypy.request.method == "HEAD":
    method = "GET"

http_method = getattr(self,method)

#print "HTTP Method: %s" % method

result=(http_method)(args,kwargs)

In our examples, we’re going to shorten this to:

http_method = getattr(self.m,cherrypy.request.method)
return (http_method)(args,kwargs)

All of this essentially determines how HTTP was called (GET/PUT/POST/DELETE), and calls the method in a class which exactly matches this name (self.GET(), self.PUT(), etc)
When you see this code, know that it’s just the HTTP method resolving code.

Now for the fun. Let’s look at the dispatcher options we have.

Way 1: A hard-coded URL pointing to fixed resources:

CherryPy can be used in a manner similar to this to establish a fixed URL, and corresponding resources, driven from predefined classes instantiated in the ‘root’ hierarchy:

import cherrypy

class ReSTPaths1:
	@cherrypy.expose
	def index(self):
		http_method = getattr(self,cherrypy.request.method)
		return (http_method)()

	def GET(self):
		return "In GET 1.."

class ReSTPaths2:
	@cherrypy.expose
	def index(self):
		http_method = getattr(self,cherrypy.request.method)
		return (http_method)()

	def GET(self):
		return "In GET 2.."

class ReSTPaths3:
	@cherrypy.expose
	def index(self,client_id=None):
		http_method = getattr(self,cherrypy.request.method)
		return (http_method)(client_id)

	def GET(self,client_id=None):
		return "IN Get 3, your client_id is %s\n" % (client_id)

cherrypy.server.socket_port=8081

root=ReSTPaths1()
root.client = ReSTPaths2()
root.client.address = ReSTPaths3()
cherrypy.quickstart(root)

Once this is running, the URL to invoke it looks like this:

http://localhost:8081/

http://localhost:8081/client/

http://localhost:8081/client/address/

http://localhost:8081/client/address/?client_id=34567

http://localhost:8081/client/address/34567

Output looks something like this:

In GET 1..
In GET 2..
IN Get 3, your client_id is None

If you’re new to CherryPy or Python in general, I’ll reiterate for you how we are calling the GET method in our class.

When we issue this request, we’re issuing what HTTP calls a GET request:

http://localhost:8081/

The CherryPy service above, listening on port 8081, calls the index() method on the root class. The root class was set to:

root=ReSTPaths1()

at the bottom of that file. The index() method from the ReSTPaths1 Class looks like this, at the top of that file:

	def index(self):
		http_method = getattr(self,cherrypy.request.method)
		return (http_method)()

If we were to insert a print cherrypy.request.method statement before the return, we would see it set to “GET”.

getattr simply says: “get me the function name in self, matching the string “GET”.
it returns a reference to self.GET(), which is set directly below the index:

	def GET(self):
		return "In GET 1.."

Notice that the index() method has a @cherrrypy.expose decorator above it. This makes the index method callable by the public. The GET method does not have it, which means we could never invoke the GET method by typing:

http://localhost:8081/GET

If you try this, you’ll get a 404 Not Found error, because it’s not visible through the CherryPy interface.

GET() has to be invoked through index(), which means GET can only be called if an HTTP GET request is issued. If we posted form data to this same URL from, say, a form entry asking people for data input, we would need to add a POST method to this ReSTPaths1() class, to receive the POST data entered in the form fields.

Now back to our example:

In this example, no part of the URL or associated resources are dynamic, in either initialization or run time. This is fine, and suits the needs of most ReSTful CRUD interfaces.

Way 2: URL paths and associated components dynamically set once, upon dispatcher init/startup:

Now let’s say we want to determine the contents of the root, and therefore the URLs and associated resources for our ReSTful interface, dynamically during initialization/startup.

We can assign the root setting by using a Python metaclass to generate classes in our CherryPy startup code, and set the root components to each generated class. This goes beyond the average needs for CRUD access, but it’s such a nice implementation that I must show it off:

import cherrypy

class MetaCRUD(type):
	@cherrypy.expose
	def index(cls):
		http_method = getattr(cls,cherrypy.request.method)
		return (http_method)()

	def GET(cls): return "In class ", cls.__name__, ', received a GET request.'

	def PUT(cls): return "In class ", cls.__name__, ', received a PUT request.'

	def POST(cls): return "In class ", cls.__name__, ', received a POST request.'

	def DELETE(cls): return "In class ", cls.__name__, ', received a DELETE request.'

baseCRUD = MetaCRUD('baseCRUD',(),{})
root = baseCRUD

dynamic_class = {}

for d in ['legacy_dbi','new_dbi','some_other_dbi']:
	dynamic_class[d] = MetaCRUD(d,(),{})
	setattr(root,d,dynamic_class[d])

cherrypy.server.socket_port=8081
cherrypy.quickstart(root)

Here we’re using a metaclass, with CherryPy exposed methods, to generate a dictionary of dynamic classes. We set the root.classname = the_new_class by using the setattr() method.

After initialization, URL components and resources are fixed in this model. But wow, the awesome power we have during initialization, in 28 lines really rocks. I wrote this in 30 minutes, and realized again why I am so head-over-heels in love with this language.

When we hit these URLs:


http://localhost:8081/

http://localhost:8081/legacy_dbi/

http://localhost:8081/new_dbi/

http://localhost:8081/some_other_dbi/

We see this output:

In class baseCRUD, received a GET request.
In class legacy_dbi, received a GET request.
In class new_dbi, received a GET request.
In class some_other_dbi, received a GET request.

Let’s issue a POST request via curl, on the command line. The response is returned:

[gloriajw@g-monster ~]$ curl http://localhost:8081/some_other_dbi/ -d ""
In class some_other_dbi, received a POST request.

This model could be used for, say, reading the contents of the Postgres template1 databases list or the mysql ‘show databases’ command, and auto-generating a ReSTful CRUD interface for each. Access of each resources can be controlled via HTTP Auth methods. This is a great solution to providing, and restricting, legacy database access for new processes through a standard interface.

Way 3: Live, ever-dynamic determination of URL and associated component:

Some ReSTful URL models may need to be ‘run-time dynamic’, especially in the case where databases are dynamically created, and the associated resources per new database could vary. There is a simple example of a dynamic URL and resource model:

import cherrypy
import pprint

class ReSTPaths:
	@cherrypy.expose
	def __init__(self):
		pass

	@cherrypy.expose
	def client(self,*args,**kwargs):
		return "Your HTTP method was %s. Your args are: %s and your kwargs are: %s\n" \
		% (cherrypy.request.method, pprint.pformat(args), pprint.pformat(kwargs))

	@cherrypy.expose
	def address(self,*args,**kwargs):
		return "Your HTTP method was %s. Your args are: %s and your kwargs are: %s\n" \
		% (cherrypy.request.method, pprint.pformat(args), pprint.pformat(kwargs))

cherrypy.quickstart(ReSTPaths())

This allows for dynamic URLs such as:

http://localhost:8080/client/address/34567

http://localhost:8080/client/address?client_id=34567

http://localhost:8080/address/client?client_id=34567

http://localhost:8080/address/client/34567

http://localhost:8080/address/anything/anything_else

The output from this code looks like this:

Your HTTP method was GET. Your args are: ('address', '34567') and your kwargs are: {}
Your HTTP method was GET. Your args are: ('address',) and your kwargs are: {'client_id': '34567'}
Your HTTP method was GET. Your args are: ('client',) and your kwargs are: {'client_id': '34567'}
Your HTTP method was GET. Your args are: ('client', '34567') and your kwargs are: {}
Your HTTP method was GET. Your args are: ('anything', 'anything_else') and your kwargs are: {}

Notice that we only have keyword args (kwargs) when we pass a named parameter, such as client_id=34567

Let’s try a POST request from curl, on the command line:

[gloriajw@g-monster ~]$ curl -d "something_else=whatever_i_want" http://localhost:8080/address/anything/anything_else
Your HTTP method was POST. Your args are: ('anything', 'anything_else') and your kwargs are: {'something_else': 'whatever_i_want'}

In this code, the sky is the limit. You can place whatever code you like in these methods, dynamically creating classes and resources as needed, letting them only persist until the result is returned. This may add some inefficiency, but in exchange offer more secure network resources.

Code is attached, Enjoy!

Gloria

http://www.devchix.com/wp-content/uploads/2009/04/restfixedargs.py

http://www.devchix.com/wp-content/uploads/2009/04/restmeta.py

http://www.devchix.com/wp-content/uploads/2009/04/restvarargs.py

ˆ Back to top

cheap research papers