You are not Logged in
Do you want to Log in or register?

linuxchix.org.nz

Kamaelia: The future of Python Frameworks looks promising.

DevChix - Sun, 2008-05-11 10:42

Kamaelia is a general purpose Python framework developed by BBC Research.
http://kamaelia.sourceforge.net/Home

It is what I would consider a second generation framework. It has a mature level of feature and plug-in support, and a naturally extensible model, two things which are either rare in most frameworks, or too difficult to be practical. Audio and video plug-in support is amazingly clean in the Kamaelia examples. The Kamaelia kernel, named Axon, is the core component for module execution. Module intercommunication happens via pipes, so the issue of the context switch slowness for threaded apps is not an issue here.

Kamaelia also supports OS level threading, but this support seems to be nested down into the TCP protocol module. Nevertheless, the snap-together pipe model is tempting for any app, since it’s quite easy to grok. The code examples are exactly what Python enthusiasts have come to expect: clean, short, and almost intuitive.

Like many great tools, it comfortably straddles the line between tool and toy, with clean integration of pygame, as well as the support of many common protcols (HTTP, Torrent, etc.) and audio and video codecs (Vorbis, Wav, etc.) supplemented by a solid engine.

The component list for Kamaelia is called the Component Toybox, setting the tone for this project. We are encouraged to play, and novice contributors are encouraged to join and contribute. This is what I love the most about this project. It is unpretentious, approachable by anyone who wants to learn and contribute, and it is well organized and well designed. The documentation flows smoothly, although I’d love to see more detail on helping newbies find, install and configure all of the dependencies for the dependencies for each architecture. Pygame, for example, needs SDL development libs to run the provided examples. But newbies are stuck calling friends like me to explain this to them and help them past the installation hump. This is a difficult problem to resolve in any toolset dependent on many external toolsets, having their own development paths and practices. Maybe the Python buildout tool, plus some additional scripting could resolve this issue?

This framework is exciting. It opens the possibilities of faster web and app based integration of tools and tricks. It makes you ponder the infinite possibilities of nested protocol support, not just encapsulation of protocols within HTTP. Python development just keeps getting better and more fun, and this is most certainly a project to watch for ideas and possibilities of things to come.

Gloria

Categories: Sister Groups

Thank you Engine Yard!

DevChix - Wed, 2008-05-07 01:28

If you are reading this that means we are on our new slice provided by the generous folks at Engine Yard. Thank you for supporting us in our mission to encourage more women to choose careers in development.

Though they are traditionally a rails shop they setup Wordpress for us and configured it with PHP. We plan to do more with the site than just have a Wordpress blog and now we have the space and resources to do it :)

So far, its been great. They have a handy ticket system that lets us keep track of issues and I was able to hop onto IRC and get some quick questions answered.

If you notice any weirdness please send an email to devchix *at* gmail and let us know!

Thanks

Categories: Sister Groups

I Love Python: BBC Language web scrape and encode to disk in 54 lines.

DevChix - Fri, 2008-04-18 09:49

This module scrapes the BBC language web site (http://www.bbc.co.uk/worldservice/languages/)
for sample text from all 35 languages offered. It encodes the text snippets and writes to independent files, then test-reads one sample file.

The encoding requirements took some digging through obscure docs, but the rest wasn’t so bad. If you want to know how to do unicode language support to file in Python, this is for you.

import urllib2 import codecs import BeautifulSoup import re import pdb import os class GetBBC: def __init__(self): print "In constructor" self.language_links = [] self.dir = ‘BBC_Language_pages’ try: os.makedirs(self.dir) except OSError: pass def getLanguageChoices(self): lang_page = urllib2.urlopen(”http://www.bbc.co.uk/worldservice/languages/”).read() self.soup = BeautifulSoup.BeautifulSoup(lang_page) # match langtexttop too links = self.soup.findAll(attrs={’class’:re.compile(’^langtext*’)}) for x in links: self.language_links.append(x) print “Appending %s with link %s ” % (x.a.string,x.a['href']) print “There are %d language choices for the BBC news page!” % len(self.language_links) def archiveLanguagePages(self): os.chdir(self.dir) for x in self.language_links: lang_page = urllib2.urlopen(’http://www.bbc.co.uk’ + x.a['href']).read() clean_page = BeautifulSoup.BeautifulSoup(lang_page).prettify() rawfile = codecs.open(x.a.string,’wb+’,'ISO8859-1′) rawfile.write(unicode(clean_page,’ISO8859-1′)) rawfile.close() print “Saved the %s page.” % x.a.string os.chdir(’..’) def readLanguagePage(self,language): os.chdir(self.dir) rawfile = codecs.open(language,’rb’,'ISO8859-1′) file = rawfile.read() rawfile.close() os.chdir(’..’) return rawfile if __name__ == “__main__”: x=GetBBC() x.getLanguageChoices() x.archiveLanguagePages() y = x.readLanguagePage(’Portuguese’)

There are languages for which ISO8859-1 encoding may not work, so you may need to experiment with encoding codecs for languages not supported by the BBC.

I wrote this in May 2007, as a language support test for GrrlCamp, which is an online Open Source development group for women. We will be recruiting again in late June. If you are female, interested in volunteering development effort in exchange for learning, and have at least 6 hours free each week to do cutting edge fun Python design and development in a supportive and great online community, please post your email address and we will get back to you.

Gloria

The unmodified code

Categories: Sister Groups

I love python: Zip code prefix web scrape and DB injection in 70 lines

DevChix - Fri, 2008-04-18 09:31

Here’s a module I wrote (in an hour. Damn, Python is wonderful) which scrapes the US Postal service web site for three-digit zip code extensions (http://pe.usps.gov/text/dmm300/L002.htm). It creates a db table and injects zip code prefix, region and state info for each record found. It uses BeautifulSoup to parse the HTML, and SqlAlchemy to do the DB operations.

If you only need to check what region and state a particular zip code belongs, this is for you. If anyone can point me to a free longitude/latitude/full zip code site, please post that info to a reply, and I’ll rewrite this module.

import urllib2 import codecs import re import pdb import os import BeautifulSoup import sqlalchemy class GetZips: def __init__(self): self.zip_info = [] def getZipPrefixes(self): zip_page = urllib2.urlopen(”http://pe.usps.gov/text/dmm300/L002.htm”).read() self.soup = BeautifulSoup.BeautifulSoup(zip_page) # match zip columns zips = self.soup.findAll(attrs={’class’:re.compile(’^trBodyRow*’)}) for i in zips: y = i.find(attrs={’class’:re.compile(’^pTblBodyLL pAlignLeft*’)}) ”’ X is the symbol for an unused 3 digit zip prefix. ”’ if y.span and y.span.string == ‘X’: continue # last 3 digits zip_prefix_3 = y.a.next.next zip_prefix_3 = re.sub(’[\n\r]+’,”,zip_prefix_3) # finding the first column will suffice. y = i.find(attrs={’class’:re.compile(’^pTblBodyLL pAlignRight*’)}) region_state = y.a.next.next.split() region = region_state[-3] state_abbrev = region_state[-2] if region_state[-1] != zip_prefix_3: print “There is a problem here: %s” % i self.zip_info.append((region,state_abbrev,zip_prefix_3)) print “Found %s %s %s” % (region,state_abbrev,zip_prefix_3) def injectIntoDB(self): engine = sqlalchemy.create_engine(’postgres://%s:%s@%s/%s’ % (’postgresql’,’something’,'127.0.0.1:5432′,’zip_db’),strategy=’threadlocal’) ”’ The sqlalchemy explicit scope is done for clarity. Of course you can “from sqlalchemy import *” instead, and change the scope of these calls. ”’ metadata = sqlalchemy.MetaData() metadata.bind = engine zip_table = sqlalchemy.Table(’zip_abbrevs’, metadata, sqlalchemy.Column(’zip_abbrevs_id’, sqlalchemy.Integer, primary_key=True), sqlalchemy.Column(’three_digit_abbrev’, sqlalchemy.String(4)), sqlalchemy.Column(’region’, sqlalchemy.VARCHAR(50)), sqlalchemy.Column(’state_abbrev’, sqlalchemy.String(3))) metadata.create_all(engine) for (region, state, zip) in self.zip_info: print “Injecting %s %s %s\n” % (region, state,zip) zip_table.insert(values={’region’:region,’state_abbrev’:state,’three_digit_abbrev’:zip}).execute() if __name__ == “__main__”: x=GetZips() x.getZipPrefixes() x.injectIntoDB() # vim:ts=4: noet:

I am writing this code for the nonprofit called The Freelancer’s Union in NYC, which currently has a nationwide member drive: http://www.freelancersunion.org/advocacy/index.html.
I will shamelessly plug them in exchange for sharing this code with the world.

The more members they get in each US state, the better nationwide insurance plans they can offer. They offer E&O insurance for IT freelancers as well, so even if you freelance part-time, this could be for you. This organization rocks. I’ve been a member for three years, and now I proudly write code for them.

Gloria

The unmodified code

Categories: Sister Groups

DevChix merchandise

DevChix - Wed, 2008-04-09 06:29

You can now purchase DevChix merchandise at the DevChix cafepress store. Right now we have shirts, coffee mugs, buttons, and stickers available. :-)

Categories: Sister Groups

Unix Magic Poster Winners

DevChix - Sat, 2008-04-05 02:47

Congratulations go to:

Dave Hoover of Obtiva Corporation: http://obtiva.com/

Alain Dietrich (**ALAIN, SEE NOTE BELOW)

Total amount raised for DevChix = $780

Yaay!

**Alain, we cannot reach you via normal email methods, after several attempts on different accounts. Please send your address as a comment to this post, which will not be exposed to the public (comments are monitored before publishing). Your shipping costs to France, including insurance, are approx. $50, so please deposit $430 in the DevChix account and give us your address as a comment.

Categories: Sister Groups

Auction Closes Tonight at Midnight UTC-4

DevChix - Tue, 2008-04-01 05:13

Auction Extended: Two Mint Condition Original Unitech “Unix Magic” Posters for Auction

We’ll contact the winners soon afterwards, and calculate the cost of shipping and insurance. Then we’ll kindly ask you to drop that amount in the DevChix account, and your posters will go out immediately.

Good luck, and thank you for participating.

Gloria

Categories: Sister Groups

Book Review, “Pro Active Record”

DevChix - Thu, 2008-03-13 13:39

Published by Apress
By Kevin Marshall, Chad Pytel, Jon Yurek
Book Info
Sample Chapter: Ch. 01 - Introducing Active Record
Table of Contents

Years ago when I was in PHP Land (now I travel quite a bit more! haha), I strugged for months with how to write a good ORM . It was tough, because I wanted to abstract the “boring logic” of retrieving records from a database without writing SQL but still remain flexible enough. I never really came up with a good model. I used the DAO from “extreme php” library which I think was a knock off from java. It was ok, but I still didn’t feel like I had “arrived”.

When I discovered Ruby on Rails, I found ActiveRecord. Ahh HA! Finally, this is what I was looking for. At first I thought it was part of Rails, but its not. Its a standalone library and you can use it with straight up ruby scripts.

I got a review copy of “Pro Active Record” some time ago and read it some when I got it, then some later, and now I am going to officially write up a review!

If you do anything with Active Record, get this book. The things that are briefly mentioned in most Rails books are described in detail in this book.

Chapter 1 - Introducing Active Record

Most of the time, the first chapters of a book are boring to me. I don’t need another “History of the Internet” or how “HTML was developed” … blah blah. But this one, the story is only 1 page. And it actually has some introductory scripts on using Active Record, so you can see right away how it works. It also explains the benefits of MVC and why ORMs are good. Some people still don’t get it!

Chapter 2 - Active Record and SQL

This chapter helps you translate the “sql in your head” to how to write it with Active Record. I’ve used Active Record so much that now I have forgotten most of my SQL, which is kind of embarrassing. :) I now find writing sql tedious and boring! I would have actually called this chapter “Demystifying Active Record” since it explains why all the dynamic finders work. You’ll also find transactions and locking explained here.

Chapter 3 - Setting up Your Database

Migrations! The Awesome Thing that can turn into a nightmare for large rails projects with multiple developers…. definitely have to decide on some best practices with your team on this one. The chapter has only one thing to say about this — assume any checked in migration has already been run by your team and the migration should not be edited and checked back in! You’ll have to make another migration file with your changes.

[tip]
Nola's Note: When you make a migration, test it both UP and DOWN!! Here's what I do --
write a migratiion
rake db:migrate (go up to the version with new code)
rake db:migrate VERSION=n-1, (go to version before the latest)
rake db:migrate (back to lastest)
rake db:migrate VERSION=0 (back to blank db)
rake db:migrate (back to latest)
[/tip]

Just to be sure its all good — even on a new database!

Chapter 4 - Core Features of Active Record

Now is the fun stuff - Callbacks. This is magic. This makes Active Record so flexible, and is one thing I could never figure out how to do with my PHP ORMs. I use call backs to set defaults for fields. If its just a straight default, then I set it in the database but if I need to make a decision, (if this field then this field..) then I can use it in a callback.

Associations - at first this is very confusing! I don’t know how many times I got “has_many” and “belongs_to” mixed around in the beginning.

Validations - Awesome. I had to do some ruby code without a database and I really really really missed the validations. It took me like 5x longer than it should! Understanding all of these validation methods will make your life so much more enjoyable. I really really hate doing boring, repetitive stuff…it seems so wasteful to me.

Chapter 5 - Bonus Features

Everybody likes a bonus and this isn’t even the last chapter of the book.

Java people will like the Active Record Observers — seems a little AOP to me (aspect orienteted programming) and something I probably have neglected to use to their fullest extent.

Acting up — Learn how to “save time” with the “acts_as” magic: List, Tree, Nested Sets. If your data needs these structures, you got it made. I can imaging how much longer it would take to write this stuff in perl or php.

Composed of - I haven’t used this, but this looks like a good way to make sensible objects out of database tables. There is quite a bit of explanation and examples of this, it will come in handy.

There are a few other in depth explanations of things, such as method_missing which is how alot of the magic happens. Rock on.

Chapter 6 - Active Record Testing and Debugging

Ahh yes, Testing. My favorite subject. My friends who know how much I love testing say I am sick. I must have an inner need to PROVE I am right or something, haha.

The chapter goes into depth about using test_unit with Active Record, sadly no RSpec. But, it does go into all the error messages that Active Record throws so you can write good try/catch blocks and make very exact error messages (probably best logged for the admin rather then displayed to the user!)

Chapter 7 - Working with Legacy Schema

Here’s how you work with that old database that just won’t die… or that management won’t let you totally redo. Active Record follows some of the principles of Rails “convention over configuration” … relying on table and column naming conventions to figure out how to build your object….but still giving you a way out if you want your tables singular and your primary id field called “myawesomeid” instead of “id”

I’ve used some of these things on an older database and it was possible! Not too bad if thats what you have to work with.

[soapbox]
Some people find this annoying "oh gosh! my library can't make decisions for me! OMG! That sucks" .. to that I say, "Umm ok. But if you follow these conventions then I can come into your project and know exactly what is going on" ... like with web standards, we all harp on how IE and FF do things differently, yet people want to bellyache about Active Record preferring to have plural names and id field called "id". Right.

Follow the dang convention and find something worth complaining about to complain about. :)
[/soapbox]

Chapter 8 - Active Record and The Real World

This chapter goes into depth about the library and encourages you to go read the Active Record code. Always a good idea to know what it is you are using :) I’ve actually learned ruby better by reading source code. The chapter walks you through basic structure of the files. Very cool.

[soapbox]
I used to work at a place that didn't like any "outside code" because they were afraid "OMG ... it will send our passwords to Russia!" ... ok, well I am not an idiot. I read over any code that I use that I didn't write. I look at the tests to see if I am using it right. I even RUN the tests so I can be sure its working as advertised.
[/soapbox]

Alternatives to Active Record - with EXAMPLES! If something about Active Record doesn’t set too well with you, take a look at the alternatives. Sometimes I look at the alternatives and decide that the first wasn’t so bad after all. You’ll find examples of DBI, Og, ActiveRelation.

Finally a section on Q and A finishes up this book. The Appendix has a complete reference of ActiveRecord methods to make this book a well rounded reference, tips, documentation and very handy to have at your desk!

Categories: Sister Groups

Lady Ada of Lovelace, Pioneer of the Computer Era, Brilliant Visionary

DevChix - Sun, 2008-03-09 08:25

Ada Lovelace is one of the most revered women in recent history, and for good reason. She was among the brightest math experts and visionaries in her era. Because she was also the daughter of Lord Byron and Anabella Milbanke, this alone made her famous, and many of her personal letters and bank records were preserved. This article summarizes over eight years of research, and over twenty years of data gathering done by Dr. Betty Alexandra Toole, the author of “Ada, The Enchantress of Numbers”. This book is undoubtedly the best, most accurate resource for information regarding this legendary woman.

Ada’s short life took place during the beginning of both the Industrial Revolution and the Romantic Era. There were two popular and distinct mindsets during this time; Objectivism and Subjectivism. Objectivsts strictly studied scientific truth, unwavering reason and self-discipline. Subjectivists were concerned about the value of creativity, emotions, and the imagination, considering intuitive insight to be a “higher truth”. They were also concerned about the destruction of these values by the creation of machines. Subjectivists saw technology as dehumanizing.

Ada’s father, Lord Byron, a world renown Romantic poet, argued in front of Parliament against against technology. Ada’s mother, Anabella Milbanke, was a well respected, accomplished mathematician and rich businesswoman. Ada is the product of the short and stormy union of these two powerful, opposing forces.

The poet Lord Byron’s real name was George Gordon. He was the descendant of a long line of powerful and crazy men. His father, Captain John Byron, was known as Mad Jack. He was a gambling womanizing alcoholic, who married rich women and used their money. At the end of his life, he hid in Paris to avoid creditors, and died when George was three years old. George’s mother was Cathrine Gordon of Gight, who could trace her bloodline back to King James I.

George was born with a club foot, and had a horrible school life until the age of 10, when his uncle died, making George the next Lord Byron. Byron attended Cambridge, and loved shocking people, with antics such as keeping a bear as a pet, and parading around with it. After Cambridge, he traveled around and wrote poetry, doing pretty much whatever he pleased. His poetry seemed to come about at the right moments in time, and was well received.

His work called Childe Harold’s Pilgrimage made him world famous overnight. He led a crazy reckless life of controversy, booze, and impregnating women, one of whom was his half-sister. He received similar media attention to today’s drug addicted stars, and people revered and reviled him in similar ways.

Lord Byron tried to court Anabella, but with little success. They wrote back and forth, mostly chastising letters from Anabella, and poetic retorts from Lord Byron. Gossip started to threaten his career, and he was advised to marry, to avoid the accusations of fathering a child with his half-sister. Byron proposed to Anabella, who saw this as a challenge to reform him, and help him change his ways. She accepted.

Lady Ada was born in December of 1815. Her father wrote: “The child of Love - though born in bitterness and nurtured in convulsion”. Byron drank and partied away his own money, living in an apartment in London filled with birds and dogs. He did not receive the money promised him upon marriage to Anabella, was unsuccessful at selling his estate, and started to have money issues. Anabella filed for separation weeks after Ada’s birth.

The law was such back then that Byron’s infidelity and drinking were not strong enough reasons for a woman to file for divorce. Anabella needed something scandalous to have a divorce filing approved (since Lord Byron protested). She eventually received a letter documenting Lord Byron’s incest, and won the divorce rights. They struck a deal, where Anabella would never reveal the evidence to the public, and Byron would divorce amicably. Ada remained in her mother’s custody. Byron fought to keep Ada in England, and won.

Byron spent the summer of 1816 with Mary Shelly and her husband. He fathered a child with her step sister, while writing a Famous work called Darkness, and while Shelly wrote Frankenstein. He kept custody of the child and moved to Italy, where he wrote Don Juan. The entire time, he thought about Ada, wrote about her, and theorized about her being a prodigy, although he never saw her again.

Anabella started Ada in strict training in math and science when she was five, determined not to have her follow in her father’s legacy. One of her instructors, Pestalozei, was one of the first instructors of this era to gear his teaching toward children by encouraging them to use their imagination. Ada enjoyed this immensely, and this training set the tone for her learning and teaching experiences throughout her life.

At the age of seven, she complained of severe headaches. At eight, she heard about her father’s death, and it seemed to affect her deeply, although she had never met him. Lord Byron died in 1824, helping liberate Greece from the Ottoman Empire. A massive funeral procession was held for him in London. it was proposed that he be buried in Westminster Abbey, but because of his crazy lifestyle, this proposal was denied.

At the age of twelve she drew up scientifically sound designs for a flying machine. This is also about the time that she started to rebel against her mother, who controlled her with strict math studies. Ada’s mother wrote that Ada mastered the art of “conversational litigation”, as many bright girls do at this age. Ada’s mother continued to monitor and control Ada’s imaginative tendencies throughout most of Ada’s life, afraid of her becoming anything like Lord Byron. Ada found creative and socially acceptable ways to rebel against this control.

At thirteen, she caught measles and was bedridden for three years. Her intense instruction did not stop during this time. By seventeen she was well educated in math, science, machinery, factories, and the inventions of the Industrial Revolution. She had a fling with one of her instructors, which pressed her mother to start finding potential husbands for Ada. In 1835 she happily married William, who became Earl of Lovelace, making her Countess of Lovelace.

In 1833, at age seventeen she met Charles Babbage who had just finished working on the Difference Engine, and began working on the Analytical Engine. She discussed his inventions with him at length, and immediately understood the significance of the Analytical Engine, unlike most people who had heard of it. She was invited to Babbage’s parties, as a respected mathematician. This gave her the opportunity to meet Charles Dickens, Charles Darwin, Michael Faraday, Augustus DeMorgan, and many other brilliant thinkers and scientists of her time.

At around this same time, Ada met and was mentored by Mary Somerville, a prominent self-taught scientist whose work was recently published. Mary Somerville was so well respected that her bust was placed on display in the Royal Academy Library, despite the fact that women were not allowed to go inside of this library. Female scientists had to enlist male help when they needed information from this library. Somerville was an enthusiastic teacher and mentor, and Ada spent a lot of fun times with the Somerville family throughout her life.

As a teacher and mentor, Ada used both logic and imagination to evoke a passion for math in her female students. She was a tough teacher, insisting that direct proofs be used where indirect proofs would suffice. But she was able to convey her passion for math, and inspire her students to love their studies. One of her instructional letters reads: “I get so eager when I write Mathematics to you, that I forget all about handwriting and everything else. - Your progress is the only thing that I desire. Believe me, your affectionate & untenable Instructress, A. Ada Byron”

Ada saw a tight tie between imagination and science, as complementary forces, yet balancing each other: “Mathematical Science shows what is. It is the language of unseen relations between things. But to use & apply that language we must be able to fully appreciate, to feel, to seize, the unseen, the unconscious. Imagination too shows what is, the is that is beyond the senses. Hence she is or should be especially cultivated by the truly Scientific, - those who wish to enter into the world around us!”

Ada continued to intensely study math by correspondence with famous mathematicians. She also tutored, and intensely studied the functional workings of the Analytical engine, while giving birth to and raising three children, and managing several households. She had certain social obligations as a prominent well-to-do female, and she resented these obligations for taking time away from her studies. She also often felt overwhelmed by her children, and had others help her raise them.

Ada wrote extensively in letters to her mother, and others, about self observations. She spent a lot of time and energy analyzing her thoughts, theories, and actions in healthy ways. In addition to her genius, her letters exhibit an emotionally balanced and very grounded attitude, even when analyzing her own illness and possible death. She was most definitely a very brilliant, poetic, emotionally strong and stable female figure of this era. It is obvious that people who met her held the same opinion of her, and had great respect for her ingenuity, imagination and strength of will.

She became very good friends with Charles Babbage. Their families visited each other, and they spent a lot of time and energy theorizing about the workings and the possibilities for the Analytical engine. Babbage had difficulty getting support from the British government for this new machine, but was invited to Turin Italy in 1842, to present his invention. The Analytical Engine becomes documented in a Swiss technical journal, in French. Lovelace translates it for Babbage, adding her own notes, and does a spectacularly better job at explaining the invention than the original publication. From this moment forward, Babbage asks her to write articles about the Engine, and she accepts.

Her description of the Analytical Engine was so profound because of her thorough understanding of the mechanism as well as it’s potential. She also used metaphors and visual examples, which still apply today to the modern computer. Her insight gave a vision to the importance of the Engine that even Babbage could not have foreseen.

Over time it becomes clear that Babbage is the inventor of the mechanism, and Lovelace is the inventor of the “programming language” for the device. She devises what is equivalent to the punch cards of the 1950’s and 60’s computers, where holes in a card instruct the analytical engine on what to execute next, thus writing the very first computer instruction set. While doing this, she was studying Functional Equations with Dr. Augustus DeMorgan, and devising ways in which the Analytical Engine could calculate these equations. She wrote reams of notes to DeMorgan, working out proofs and theorems, and awaiting his answers by correspondence.

At around the same time, she theorized about computer generated music, geometry in greater than four dimensions, and game theory, all of which have since proven to be accurate and extremely insightful. She wrote extensive machine heuristics for chess and backgammon, and theorized about how the Analytical Engine could play these games. Her chess algorithms predate any used today, and are extremely accurate.

Lovelace and Babbage had a close intellectual friendship, and spent a lot of time together theorizing about everything, dabbling in metaphysics (Babbage believed, Lovelace was skeptical), testing logic flows for games, and pondering together the way many intellectual friends do.

In 1841, Ada became ill for a year, but this does not slow her down. She continues to find other creative outlets, such as music and poetry, but this frightens her mother, and her mother discourages this behavior. In 1842, Ada hears of her father’s incestuous relationship. Medora, the child, is promiscuous, and Ada tries to calm her down.

In this same year, Babbage requests that Lovelace summarize his Analytical Engine notes for the scientific community (thirty volumes). She does so, correcting his few errors, adding her own facts, and using Bernoulli numbers as a computational example for the something the Engine could calculate entirely alone. Babbage was incredibly impressed with her work, and simply accepted her changes and additions in confidence, repeatedly expressing how impressed he is with her ingenuity. She was one of the few people who genuinely understood how his invention worked, and it’s potential.

She took the liberty of removing his text which discussed the lack of support from the British Government, stating to him that she thought it would be “political suicide”. The publisher agreed, but she and Babbage had a falling out, despite the fact that he abided by her wishes and accepted her changes. From that moment forward, they became closer friends, but no longer worked together.

Today she is called the Pioneer of Computing, not just because she wrote the first machine instruction set, but also because of her theories regarding Artificial Intelligence: “It is desirable to guard against the possibility of exaggerated ideas that might arise as to the powers of the Analytical Engine. In considering any new subject, there is frequently a tendency to overrate what we find to be already interesting or remarkable; and, secondly, by a sort of natural reaction, to undervalue the true state of the case, when we do discover that our notions have surpassed those that were not tenable. The Analytical Engine has no pretensions whatever to originate anything. It can do whatever we know how to order it to perform. It can follow analysis; but it has no power of anticipating any analytical relations or truths.”

In 1844, she became ill again, and in 1845, she was prescribed opiates for her pain. Like many people in pain, she consumed great quantities of opiates for pain, but did not exhibit addition when not in pain. This research dispels the myth that she was a drug addict, which is inaccurately stated by other authors. During this bout of illness, Ada saw this as an opportunity to experiment on herself for a cure. She called upon Michael Faraday to help, but he was also ill at this time. She enlisted others to help her with scientific experiments on her health.

Ada was the subject of rumors, since she was the daughter of Lord Byron, and also because she was seen traveling alone with men other than her husband. For the most part she simply enjoyed and mocked the rumors, maybe sometimes encouraged them, but generally did not let rumors affect her. She gambled socially, the way all of her friends in that social circle did in those days. The only bit of gossip which seems to be accurate is one extramarital affair with Frederick Knight, to which she admitted to William before she died.

This research also reveals that during her entire marriage, she was only given a small periodic allowance by her husband and her mother. She spent this money on her childrens tuition and clothing, her own books, and dresses for formal social events. She had no money of her own, did not get paid for any of her work, and her husband would inherit half of her mother’s fortune when her mother died. At the end of her life, she borrowed money from friends, to help her children find better tutors and nannies, and repaid it all before she died. her mother found out she was in dire straights, and agreed her grandchildren’s tuition fees, but this only slightly eased the burden.

In around 1850, near the end of her life, she visited Newstead Abbey, where her father was buried, and it was an emotional experience for her. She also finally decided to disrupt the emotional control her mother held over her, which caused a falling out between she and her mother. She and William traveled, met Queen Victoria, and attended and held social events until she became too ill to move. She died in 1852 at age thirty six.

It is remarkable that Lady Ada could remain as enthusiastic as she did. She was never paid for her hard work or contributions to other’s work. Until recently, her ingenuity and visionary nature were only recognized and appreciated by those close to her. She never had money of her own, despite being raised by and married to rich families. Her ill health and all of the other burdens placed on her were constant challenges. The false rumors about her supposed gambling addiction, affairs and drug addiction are still circulated today. During her time, and even today, some say that she is given too much credit regarding the Analytical Engine, despite the facts which are turned up by this research.

Despite all of this, Ada pursued what she loved, excelled at it, and never let even her own barriers stop her. She is more than a Pioneer of the Computer Era. She is a damn near perfect role model for many women, who today, face barriers and restrictions on what they can study and how they can excel. Today being International Women’s Appreciation Day, I can’t help but express my appreciation for this great woman.

Categories: Sister Groups

Donations

DevChix - Tue, 2008-03-04 08:52

Hello All,
I just wanted to let folks know that if they want to make any contributions to our organization we now have a donate button over on the left side bar of the site. We will be using all money that we receive for organizational purposes. At the end of the year we will be sending out statements to anyone who makes a donation so that you can claim your donation on your taxes. Additionally, if anyone is curious what the funds go to, we will be glad speak with you personally to let you know exactly what they are planned for or are used for. We truly appreciate all the support we get.

Cheers
The DevChix

Categories: Sister Groups

Auction Extended: Two Mint Condition Original Unitech “Unix Magic” Posters for Auction

DevChix - Wed, 2008-02-27 06:11

I have two of these posters for auction. They are both original Unix Magic posters, in mint condition, rolled up for 20 years and never touched or hung.

The auction has been extended to March 31st. Minimum bid is $350 each. All proceeds will be donated to the DevChix nonprofit organization.

Place a bid by using the contact us form. Be sure to give us a valid email address. If you cannot be reached, your bid will be disqualified.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Highest bids to date:

Poster 1: 400.00
Poster 2:

Categories: Sister Groups

Auto-creating MySql and Postgresql Databases with Powerful Python Tools

DevChix - Fri, 2008-02-15 10:06

When designing and development web framework software for clients, I first spend a bit of time focused on the client data. I try to determine the traits of the client data, asking these questions:
Is it temporary?
If so, for how long? Should it expire and disappear automatically or manually?
Should it be archived?
How many users/applications will be entering data?
Is each user’s data mutually exclusive? If not, what is the logical grouping of users and data?
What level of control do users have over their own, or other user/app data?
How is the data used by the clients? Are there “super users”?

The database is such an essential part of the design, and being able to automatically create, archive, purge and delete databases is tremendously handy in so many of these designs.

I wrote this example to generate dynamic databases for short courses, training sessions, and demos. I use the example itself to demonstrate the functionality of CherryPy and SqlAlchemy.

First of all, I start my CherryPy process on my local port 7001, allowing me to do this:

http://grrlcamp.org:7001/dbi/create_my_db?db_type=postgres

or this:

http://grrlcamp.org:7001/dbi/create_my_db?db_type=mysql

First, the small bits of quirkiness in Postgresql and MySql

Starting a Postgresql session on the command line, we see what happens before the URL is referenced:

[cwc2008@localhost user1]$ psql -d template1 -U my_super_user Welcome to psql 8.2.6, the PostgreSQL interactive terminal. Type: copyright for distribution terms h for help with SQL commands ? for help with psql commands g or terminate with semicolon to execute query q to quit template1=# SELECT datname FROM pg_database ; datname ----------- postgres template1 template0 (3 rows) template1=#

and after (Note: I had to exit the command line session, run the URL, then re-enter the command line session):

template1=# SELECT datname FROM pg_database ; datname -------------- postgres template1 template0 cwcuser_7001 (4 rows) template1=#

The cwcuser_7001 name is auto-generated from the user’s ID and port number, making it useful for training sessions with many users.

my_super_user was created using the Postgresql createuser command, and, of course, must be a super user to do this operation. The template1 database is the Postgresql master database, from which all other databases in that instance are visible.

Caveat: In Postgresql, only one user can access template1 at any given time. Violating this rule gives you this error:

template1=# create database blahblah; ERROR: source database "template1" is being accessed by other users template1=#

Be sure to close your database descriptor when finished with template1. If this is not a production app, and/or you feel comfortable bouncing the instance, this lock can also be cleared by running:

-bash-3.2$ /usr/local/postgresql/8.2.6/bin/pg_ctl restart -m immediate -D/usr/local/postgresql/8.2.6/data waiting for server to shut down... done server stopped server starting -bash-3.2$ LOG: database system was interrupted at 2008-02-14 15:07:47 EST LOG: checkpoint record is at 0/4B9054 LOG: redo record is at 0/4B9054; undo record is at 0/0; shutdown FALSE LOG: next transaction ID: 0/2046; next OID: 57344 LOG: next MultiXactId: 1; next MultiXactOffset: 0 LOG: database system was not properly shut down; automatic recovery in progress LOG: record with zero length at 0/4B909C LOG: redo is not required LOG: database system is ready

This is nasty. In live production environments, do this with great care.

MySql is a bit forgiving when adding, removing or accessing new databases. It does not require the isolation level to be set, as in Postgresql.

We see what databases exist before:

/usr/local/mysql6/bin/mysql --socket=/tmp/mysql10.sock -u my_super_user -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 170 Server version: 6.0.3-alpha-log Source distribution Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec) mysql>

and after:

mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | cwcuser_7001 | | mysql | | test | +--------------------+ 4 rows in set (0.00 sec) mysql>

MySql does not require my hopping in and out of the command line like Postgresql. It handles user scope much better, in my opinion. It does, however require each new non-super user to be granted access to each database they need, but this is (1) trivial, and (2) outside of the scope of this article.

The SqlAlchemy code to handle the quirky bits

This is invoked by CherryPy, but can be run in any other manner of Python execution. I have a Class called DBInterface, method is called create_engine:

class DBInterface: #~~~~~~~~~~~~~~~~~~~~~~~ def create_engine(self,choice,local_dbname=None): if choice == 'super_mysql': ''' Super user MySql commands do not require connection to a database. ''' db = sqlalchemy.create_engine('mysql://%s:%s@%s' % ('my_super_user','some_password','127.0.0.1:3333'),strategy='thr eadlocal') # 'self' is not threadsafe! Don't use it! #self.show_databases = "show databases ;" cherrypy.session['show_databases'] = "show databases ;" elif choice == 'mysql': db = sqlalchemy.create_engine('mysql://%s:%s@%s/%s' % ('my_super_user','some_password','127.0.0.1:3333',local_dbnam e),strategy='threadlocal') elif choice == 'super_postgres': ''' Super user Postgresql commands require that you connect to the built-in template1 database, and set the isolation level to 0. This can't be done in SqlAlchemy, so we do it in Psycopg. ''' DSN_string = "dbname=template1 port=2222 user=my_super_user host=127.0.0.1 password=some_password" def connection(): self.local_conn = psycopg.connect(DSN_string) self.local_conn.set_isolation_level(0) return self.local_conn db = sqlalchemy.create_engine('postgres://',creator=connection, strategy='threadlocal') # NO! #self.show_databases = "SELECT datname FROM pg_database ;" cherrypy.session['show_databases'] = "SELECT datname FROM pg_database ;" elif choice == 'postgres': db = sqlalchemy.create_engine('postgres://%s:%s@%s/%s' % ('my_super_user','some_password','127.0.0.1:2222',local_db name),strategy='threadlocal') else: db = None return db

The exposed method in the same class which invokes the create_engine method, is called create_my_db, which we saw in the URL above (I will address the CherryPy URL functionality after this point):

@cherrypy.expose def create_my_db(self,db_type): ''' Creating a db is a super user act. ''' cherrypy.session['db_type'] = 'super_' + db_type cherrypy.session['my_dbname'] = "cwcuser_%s" % (cherrypy.request.config['server.socket_port']) db = self.create_engine(cherrypy.session['db_type']) db.execute("create database %s ;" % cherrypy.session['my_dbname']) databases = db.execute(cherrypy.session['show_databases']) dblist = [] for d in databases: dblist.append(d[0]) print ', '.join(dblist) self.dbclose(cherrypy.session['db_type'],databases) return ', '.join(dblist)

Because I clump together super user and non-super user database engine connection functionality, I distinguish the difference by modifying the users db type to a “super_” setting in a CherryPy session variable. This way, only one method is called in various internal modes of operation. When in non-super user mode, the SqlAlchemy connect string is the same for both Postgresql and MySql.

No more db quirks in this app: The rest is clean SqlAlchemy

All db operations after this point use the exact same SqlAlchemy code for both MySql and Postgresql. That is a profoundly beautiful thing.

The destroy_my_db method is generic:

@cherrypy.expose def destroy_my_db(self,db_type): ''' Destroying a db is a super user act. ''' cherrypy.session['db_type'] = 'super_' + db_type if not cherrypy.session.has_key('my_dbname'): cherrypy.session['my_dbname'] = "cwcuser_%s" % (cherrypy.request.config['server.socket_port']) db = self.create_engine(cherrypy.session['db_type']) db.execute("drop database %s ;" % cherrypy.session['my_dbname']) databases = db.execute(cherrypy.session['show_databases']) dblist = [] for d in databases: dblist.append(d[0]) print ', '.join(dblist) self.dbclose(cherrypy.session['db_type'],databases) return ', '.join(dblist)

As above, all other database operations from this point forward are generic SqlAlchemy code. Yaaay!

The CherryPy layer

My CherryPy main module, which sets up the needed objects and assoiated URLs, looks like this:

import cherrypy import pdb import sys,os,re,traceback import user_data sys.path.append('../') #hostname = os.environ.get('HOSTNAME') #hostname = re.sub('..*$','',hostname) # Add your app here. import db_wrapper # Only generic headers and footers go here. # To use generic templates in your app, you may need to symbolicly link # them into your Templates dir, or references them by absolute path. TemplatePath = os.path.join(os.path.dirname(__file__), '/cherrypy/dev/templates') # Add your class here. Note that the 'root' should be the authentication module. # To test, go to http://grrlcamp.org:1112/run_test root = db_wrapper.WrapperTest() # http://grrlcamp.org:port/dbi/create_my_db, destroy_my_db, etc. root.dbi = db_wrapper.DBInterface() # http://grrlcamp.org:port/user/get_user_data root.user = user_data.UserData() try: cherrypy.tree.mount(root) cherrypy.config.update(os.path.join(os.path.dirname(__file__),'cp.conf')) cherrypy.server.quickstart() cherrypy.engine.start() except SystemExit: #smtpInterface.sendSysAdminEmail('cherrypy@xyz.com','sysadmin@xyz.com',"From %s: CherryPy is going down due to shutdown." % hostname,"") sys.exit() except: print "ERROR: CherryPy crashed, error:" raise finally: #smtpInterface.sendSysAdminEmail('cherrypy@xyz.com','sysadmin@xyz.com',"From %s: CherryPy is going down (from finally clause, check for another error message after this one)." % hostname,"") pass

The CherryPy “root” determines what objects are accessible via URL. I mounted a simple test under the root, and nested the above database code under root.dbi, hence the /dbi/ reference in the URL.

root.dbi contains an instance of the DBInterface class we saw earlier. All exposed methods in the DBInterface class become accessible via the /dbi/method_name URL when CherryPy is started.

I’ve attached the complete code used for training, configured to run on localhost, and connect to both MySql and Postgresql daemons. It contains some explicit redundancy and commented code for learning purposes. Your configuration variables will vary slightly. Enjoy.

auto-create-any-db.tar

Categories: Sister Groups

Reporting from the CWC in New Zealand

DevChix - Tue, 2008-02-12 06:34

It’s an inconvenient time for me to be traveling. I have a new employer patiently waiting for me to start, but who understood the impossibility of my backing out of a trip to New Zealand to speak at a women’s tech conference. I have other contract work piling up, and several contiguous weeks of heads-down work awaiting me when I return. But it is well worth it.

The Computing Women’s Congress is held every other year, and takes place on the beautifully hilly, tropically lush campus of the University of Waikato, in Hamilton. This shoe-optional campus feels laid back and relaxed, but also hosts an outstanding graduate IT program, and Ph.D students and professors from around the world.

The women I’ve met at the CWC are just as impressive. All either have a Ph.D or are studying for one, and they’re sharp, to say the least. I was at first intimidated, being more of a “layman”, with only a BS and much field experience. But the environment is welcoming, and the women running and attending this event are simply great. The academic theory definitely compliments the practice, and I am enjoying it immensely.

In one course, I learned basic C# development in a .Net environment in one day. It’s not something I’d normally want to learn, but the instructors were great, and the presentation was outstanding.

The course I’m teaching is a three day web framework intensive, using Python, CherryPy, CherryTemplate, SqlAlchemy, connecting to both MySql and Postgresql databases. It’s an intensive without the intense part, and the attendees seem to be enjoying themselves. These brilliant women whipped through it faster than I expected, and finished day one 30 minutes early. Last night I hid for several hours in a campus office and wrote more exercises for the course, to keep up with them. They’re really making me work for this, and that is great fun.

This event was mentioned in Computerworld yesterday.

I’ll be posting the code from my course, since it does some unique things most web framework code doesn’t do, and you may find it useful.

Categories: Sister Groups

DevChix and PHPWomen form an affiliation!

DevChix - Wed, 2008-02-06 09:54

A few weeks ago I was fortunate enough to meet Ligaya Turmelle one of the founders of PHPWomen and then last week we meet up for dinner. The conversation flowed so well that 4 hours passed in what seemed to be mere minutes. We had so much in common with how our organizations came about, with all of the hopes and dreams we have for women in software development, and so much more. We decided that our goals were aligned so well that we should create an affiliation between our two organizations in hopes of creating a stronger support network for all women. So I am very pleased to announce that we have formed an alliance. Hopefully this alliance will help both our organizations. We look forward to supporting, helping, and working our sisters over at PHPWomen

Categories: Sister Groups

IRC Python tutorial: Feb 4th 2006 19-22 UTC

Debian Women - Mon, 2007-06-11 19:14
On Saturday, the 4th of February there will be an IRC python tutorial in #debian-women on irc.oftc.net.

From the announcement email:"The topic is Python for people who can program (at least a little), but don't know Python at all. We will cover the very basics: syntax, basic data types, lists, dictionaries, control structures, functions, classes and objects, and modules. Or possibly less, depending on how time allows. Certainly not all the details of everything. Most of the examples will be about string manipulation, since that is common in most kinds of programs."

Feel free to join in!
Categories: Sister Groups

Newcomers welcome!

Debian Women - Mon, 2007-06-11 19:14
Since the #debian-women-new channel that was opened on the occasion of this year's Software Freedom Day was so well received there will now be a special "Newcomers Welcome" timeslot at #debian-women every Saturday from 14:00 to 16:00 GMT.
While newcomers are of course always welcome to join , this timeslot will be dedicated to keeping the discussions on a not too technical basis and paying special attention to new visitors and their questions.

So if you have never before visited #debian-women, this might be an opportunity for you. If you have further questions about the #debian-women channel please refer to our irc FAQ, our irc guidelines or ask in the channel.
Categories: Sister Groups

Debian-Women Software Freedom Day activities.

Debian Women - Mon, 2007-06-11 19:14
On the occasion of this year's Software Freedom Day the Debian-Women Project was running several events. In order to appeal to all levels of experience there were multiple activities: A new irc channel, #debian-women-new, was opened for until then inactive people who would like to get involved with the Debian-Women Project. For more experienced members there was a "help day" on the usual #debian-women channel. Erinn Clark installed a local BTS, dak and buildd for people to try out and practice with. Last but not least a Bug Squashing Party was organised by Hanna Wallach at #debian-bugs. All three events were well received and many women used the opportunity to catch up on the Debian-Women Project and general Debian development.
Categories: Sister Groups

New language for the dw-wiki

Debian Women - Mon, 2007-06-11 19:14
Thanks to some great work by Clytie and Thierry, the wiki now also offers pages in Vietnamese!
The wiki currently offers eight different languages. Add your translations!
Categories: Sister Groups

Debian Women at LinuxTag

Debian Women - Mon, 2007-06-11 19:14
From June 22nd to June 25th the LinuxTag will again take place in Karlsruhe. As usual this will be a large venue for all kinds of Open Source projects with a big fair, talks, workshops, forums and tutorials.

There will also be two talks featuring women in FS: "The Debian Women Project" (link) by Meike which will be given as a part of the Debian Day and "Free Software with a female touch" (link) by Fernanda. There will also be talks by other Debian Women members. Check the wiki for more information. If you plan to come, please drop a line in the wiki.
Categories: Sister Groups

Sarge is now frozen

Debian Women - Mon, 2007-06-11 19:14
Categories: Sister Groups

linuxchix.org.nz

robo tux, linuxchix mascot

Upcoming events

Planet Linuxchix

Linuxchix International