We had 10 individuals show up at Taco Cabana last night throughout the evening for the Monthly Social meeting. There were some questions about the Scrabble Challenge, so laptops were setup for a short while to poke around some code.
There was some discussion on learning Python on a more intermediate level, so a suggestion was made to utilize Doug Hellmann's Python Module of the Week to learn the standard Python library. It's free and it's good. Plus if you like a dead tree copy, he's compiled the postings into a book.
If we start getting more people to attend, we can move to a nearby restaurant that has a separate meeting room. This would improve communication and space since Taco Cabana can get noisy and packed.
The next Second Saturday Teaching meeting is in three weeks so we need to firm up a location. If you have a facility that can host, let us know. Room for up to 30 or 40 people, WiFi and a projector is what we are looking for. You get the glory of being a sponsor and your HR people can make some connections.
If you want to suggest a space for a additional social or project night in a site other the Frisco, feel free to do so. There's a few people on the west side of the MetroPlex that need some attention. I can travel or continue to host at Gazebo Burger.
If you need a Python programmer for a contract, Ralph's available. Send a email on the mailing list or to me with some contact info.
Friday, August 23, 2013
DFW Pythoneers Meeting August 22, 2013
Tuesday, August 20, 2013
Open Hatch's Scrabble Challenge: The Analysis
Charting letter frequency
Our first step is to analyze the SOWPODS word list used in this challenge. If you read the Wikipedia entry, you will notice that there is a word distribution by number of letters. This is important to note if you are a tournament player or just completing this challenge.Below is a program that will recreate this list, although in a slightly different manner. Read through the code and see if you can explain what each part does. Try to determine why we care about the length of the words,
stats.py
#!/usr/bin/env python
# -*- coding: ascii -*-
"""
Sowpods stats
- counts the words on the list
- finds the longest word
- breakdown of word length
ToDo
- Help
- Error handling
"""
from __future__ import print_function
import string
import sys
class LenCounter:
def __init__(self):
self.dict = {}
def add(self, item):
count = self.dict.get(item, 0)
self.dict[item] = count + 1
def counts(self, desc=None):
"""Returns a list of keys sorted by values.
Pass desc as 1 if you want a descending sort. """
result = map(None, self.dict.values(), self.dict.keys())
result.sort()
if desc: result.reverse()
return result
def get_stats():
input_file = sys.argv[1]
word_count = 0
longest_length = 0
lc = LenCounter()
f = open(input_file, 'r')
for line in f:
word_count += 1
lc.add(len(line.strip()))
if len(line.strip()) > longest_length:
longest_length = len(line.strip())
print("Word Count: ", word_count)
print("Longest Word Length: ", longest_length)
for item in lc.counts():
print(item)
f.close()
def print_help():
""" Help Docstring"""
pass
def test():
""" Testing Docstring"""
pass
if __name__=='__main__':
# test()
get_stats()
The Results
Word Count: 267751
Longest Word Length: 15
(124, 2)
(1292, 3)
(5454, 4)
(5757, 15)
(9116, 14)
(12478, 5)
(13857, 13)
(20297, 12)
(22157, 6)
(27893, 11)
(32909, 7)
(35529, 10)
(40161, 8)
(40727, 9)
Monday, August 19, 2013
Python Challenge Number 1: Open Hatch's Scrabble Challenge: Intro
Intro to the Intro:
If you are new to Python or new to programming, there's numerous Python tutorials and online courses. But once you get through Learn Python the Hard Way or the official tutorial, what's next?The best way to learn may be another course or tutorial, but a project. Projects may be work projects or personal projects, or if you haven't found an idea that strikes your fancy, a suggested programming challenge. There's thousands of projects and challenge sites out there, so lets narrow the scope down an pick a few interesting, educational, fun, but doable ones.
The Challenge:
OpenHatch has a list of Intermediate Python Workshops/Projects on their wiki that suit our requirements. The Scrabble Challenge is the first one we want to attempt. Scrabble, especially in the form of "Words with Friends", is a popular pastime among many people, including my spouse.Scrabble has been around for generations in my family and has evolved in a few forms to be a more interactive game on Facebook and various smart phones. My spouse usually has several games or more ongoing with friends and many of them use "hint" or "cheater" web sites to "broaden their vocabulary" or gain an advantage.
The Scrabble challenge is to make "Scrabble cheater" that helps the play find words in their letter rack with a CLI Python program.
The Requirements:
You need to have a computer with Python 2.6 or greater, a text editor and a copy of the SOWPODS word list that is referenced in the Scrabble Challenge. You should attempt to complete as much as this challenge on your own before resorting to the help of others.The challenge web site does have some helpful guidelines and hints on how to break the problem down into easier pieces. I'll post some code this week that may help you analyze the challenge.
Sunday, August 18, 2013
August DWF Pythoneers Meetings
This weekend a good chunk of the crew are at PyTexas 2013, so let's recap the local events so far.
Last Saturday we had the 2nd Saturday Teaching Meeting at ZeOmega. 22 Pythoneers showed up and we had a great time with presentations, networking, snacks and pizza. I ended up leading the beginners group and covered analyzing words in the word list for the Scrabble Solver Challenge.
Special thanks to ZeOmega for hosting Saturday. Also to Bill for loaner laptop with Mint Linux, it was a lifesaver! If you have some SQL Server reporting skills, ZeOmega is looking for some good analysts.
Thursday night 3 coders should up at Project Night at Gazebo Burger in Frisco. I continued work on the Scrabble Solver Challenge, putting the word list in a SQLite database and calculated the word score among other functions.
Next Thursday night is Social Meeting at Taco Cabana in Addison. No laptop required, but if you want to talk code or design, feel free.
Last Saturday we had the 2nd Saturday Teaching Meeting at ZeOmega. 22 Pythoneers showed up and we had a great time with presentations, networking, snacks and pizza. I ended up leading the beginners group and covered analyzing words in the word list for the Scrabble Solver Challenge.
Special thanks to ZeOmega for hosting Saturday. Also to Bill for loaner laptop with Mint Linux, it was a lifesaver! If you have some SQL Server reporting skills, ZeOmega is looking for some good analysts.
Thursday night 3 coders should up at Project Night at Gazebo Burger in Frisco. I continued work on the Scrabble Solver Challenge, putting the word list in a SQLite database and calculated the word score among other functions.
Next Thursday night is Social Meeting at Taco Cabana in Addison. No laptop required, but if you want to talk code or design, feel free.
Monday, July 15, 2013
DFW Pythoneers 2nd Saturday Teaching Meeting, July 13, 2013
18 Pythoneers showed up at the The Collide Center in McKinney. John Zurawski and Joesph Weaver found the location, and John was the gracious host and leader for the meeting. The venue was great, but unfortunately for us the meeting space will become more space for startups afterwards.
July 18th is Project Night at Gazeebo Burgers in Frisco from 6:30 to 8:30. There's a separate meeting room that I'll request and the WiFi is usually good. Topic is pandas and data analysis, so show up prepped with software loaded and data to rip. If you are having difficulty loading all the required packages, consider loading the Anaconda distribution from Continuum Analytics.
July 20th is Moon Day at Frontiers Of Flight Museum at Love Field in Dallas. Our buddies at DRPG will be demoing various robots, plus there will be other cool displays. Moon Day is my favorite unofficial holiday, so even if you can't attend, pause for a moment and realize what an awesome achievement the Apollo program was...
July 25 will be the normal casual meeting at Taco Cabana in Addison. This is a informal get together to chat and network with other Pythoneers and techies. If you are seeking a solution for a problem, ask around and chances are someone can help you. Otherwise, just geek out and enjoy the company.
An ideal teaching location would be central, easy to find, with a room for 30 or 40 people, WiFi, power outlets and restrooms. We also need a slightly large venue than Taco Cabana for the casual meeting since the largest table there is about eight seats.
Upcoming Events
Kevin Horn announced that PyTexas 2013 is August 16-18 in College Station. Early registration ends July 16th.Friday is oriented towards tutorials and training. See the web site for details.July 18th is Project Night at Gazeebo Burgers in Frisco from 6:30 to 8:30. There's a separate meeting room that I'll request and the WiFi is usually good. Topic is pandas and data analysis, so show up prepped with software loaded and data to rip. If you are having difficulty loading all the required packages, consider loading the Anaconda distribution from Continuum Analytics.
July 20th is Moon Day at Frontiers Of Flight Museum at Love Field in Dallas. Our buddies at DRPG will be demoing various robots, plus there will be other cool displays. Moon Day is my favorite unofficial holiday, so even if you can't attend, pause for a moment and realize what an awesome achievement the Apollo program was...
July 25 will be the normal casual meeting at Taco Cabana in Addison. This is a informal get together to chat and network with other Pythoneers and techies. If you are seeking a solution for a problem, ask around and chances are someone can help you. Otherwise, just geek out and enjoy the company.
Group Discussions
One of the main topics of discussion revolved around meeting locations and meeting content.Meeting Space
In the past the group has had corporate sponsors whom had meeting facilities. Currently we need locations for Saturday teaching meetings and alternative sites for the 4th Thursday informal meetings. I can lead the 3rd Thursday Project nights at Gazeebo Burgers.An ideal teaching location would be central, easy to find, with a room for 30 or 40 people, WiFi, power outlets and restrooms. We also need a slightly large venue than Taco Cabana for the casual meeting since the largest table there is about eight seats.
Meeting Topics
There was an active discussion about Topics, Teaching, Presentation and Projects/Challenges. John proposed a meeting structure that works to start the meeting. and the group discussed various ideas for the "meat" of the meeting. It was recognized that people into Python have different needs, skill levels and interests. Some of the various topics brought forth:Web Frameworks
- Flask
- Django
- Idea: Framework Shootout - Simple web app spec; write it in diff frameworks
Related: find a way to allow beginners to work on subject area before talk
- Database?
- ORM's
- REST API's in Python
- Network Programming
- Twisted / Tornado
- Scientific Computing
- Pandas
- Game Programming
- IPython
- IPython Notebook
- Python eco-system/community
- Best Practices
- PEP8
Sharknado
The breakout presentation of the meeting was John Zurawski's pixel accurate clone of Sharknado done in cocos2d. Most awesome use of Python, ever!Challenges
It was observed that programmers don't learn unless they have projects or challenges. So I'm borrowing a Python challenge from elsewhere and will be working on this particular project in my spare time in the next couple of months. Let's swap notes and review code at a meeting in the future if you are interested. :)Monday, July 1, 2013
DFW Pythoneers Meeting June 27, 2013
13 Python enthusiasts showed up at the Taco Cabana in Addison for the monthly meeting. There was some confusion about the meeting location and some participants were disappointed with the lack of formality. Overall most of the attendees enjoyed themselves and there was much discussion about Python and related topics. This was the largest group that has met up for the Thursday night meetings.
The good news: We may have found a space for the upcoming 2nd Saturday Teaching Meeting. Joseph Weaver mentioned that John Zurawski had found a possible meeting space in McKinney. John got in contact with me and will try to contact some of the more veteran members and leaders of the group. From what I've heard of the location, it will be good for the larger teaching meetings.
The challenge: With increasing attendees, Taco Cabana is difficult to have more than the most casual of meetings. I spoke with Jay, who said that this meeting has usually never been larger than 4 to 6 participants. If you wish to have a larger space that is more conducive to larger meetings, we're open for suggestions. Key things to consider are central location since we attract folks from 20 to 40 miles away.
The good news: We may have found a space for the upcoming 2nd Saturday Teaching Meeting. Joseph Weaver mentioned that John Zurawski had found a possible meeting space in McKinney. John got in contact with me and will try to contact some of the more veteran members and leaders of the group. From what I've heard of the location, it will be good for the larger teaching meetings.
The challenge: With increasing attendees, Taco Cabana is difficult to have more than the most casual of meetings. I spoke with Jay, who said that this meeting has usually never been larger than 4 to 6 participants. If you wish to have a larger space that is more conducive to larger meetings, we're open for suggestions. Key things to consider are central location since we attract folks from 20 to 40 miles away.
Wednesday, June 26, 2013
Another Iteration...
Some time you have to throw a small script together to fix an issue. When you deal with third party data that's manually generated sometimes you have to take what they give you.
I had to determine the start the field positions in a fixed record length text file by the position of the double quotes in the file. After some research I conclude to use a regular expression with an iterator.
I had to determine the start the field positions in a fixed record length text file by the position of the double quotes in the file. After some research I conclude to use a regular expression with an iterator.
import re
text = 'Some Long" Record with " lots of '
pattern = re.compile('"')
print [m.start() for m in pattern.finditer(text)]
Subscribe to:
Posts (Atom)