I've been working with my friend Scott Sheehan on his website 1031investmentservices.com. It's a Joomla website which is new for me but luckily I'm not a programmer on this project (php? yeeks!) but I'm always interested in opportunities to try something new. So what is the purpose of this blog entry, on a blog I rarely write to any more? I think the biggest part of this project is going to be developing the inbound links. One down, hundreds more (hopefully) to go.
Monday, September 23, 2013
Friday, February 8, 2013
Two Scoops of Django Review
I've just finished reading Two Scoops of Django: Best Practices for Django 1.5 by Daniel Greenfield and Audrey Roy, currently for sale as an e-book for $12 and easily the least expensive (except free) form of professional investment a Django developer can make.
Other topics include best practices for class based views, templates, how to structure apps, and plenty more.
LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'filters': { 'require_debug_false': { '()': 'django.utils.log.RequireDebugFalse' } }, 'formatters': { 'verbose': { 'format': '%(asctime)s %(name)s %(levelname)s %(module)s %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S' }, 'simple': { 'format': '%(asctime)s %(name)s %(levelname)s %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S' }, }, 'handlers': { 'null': { 'level': 'DEBUG', 'class': 'django.utils.log.NullHandler', }, 'mail_admins': { 'level': 'ERROR', 'filters': ['require_debug_false'], 'class': 'django.utils.log.AdminEmailHandler' }, 'console': { 'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'simple', }, 'file': { 'level': 'DEBUG', 'class': 'logging.handlers.RotatingFileHandler', 'filename': '/var/log/my_project/my_project.log', 'maxBytes': 20000000, 'backupCount': 5, 'formatter': 'verbose', } }, 'loggers': { 'django': { 'handlers': ['null'], 'propagate': False, 'level': 'INFO', }, 'django.request': { 'handlers': ['mail_admins'], 'level': 'ERROR', 'propagate': True, }, 'south': { 'handlers': ['null'], 'propagate': False, 'level': 'INFO', }, '':{ 'handlers': ['console', 'file'], 'level': 'DEBUG', 'propagate': True, 'disabled': False } } }
import logging LOG = logging.getLogger(__name__) LOG.setLevel(logging.DEBUG) def my_function(my_arg): my_var = my_arg + 1 LOG.debug('my_var: %s' % my_var) return my_var
Another place that could have done with some easy examples is reStructuredText; I know its the fancy way to document and could clicked a link learn all about it, but this book could give a little bit more to whet my whistle than "study the documentation for reStructuredText and learn at least the basics." How do others use it for django apps?
This is a good book and well-worth the money. It'll make you more productive, and so is easily worth the money. I look forward to reading further revisions.
Two Scoops of Django: Best Practices for Django 1.5
Sunday, February 13, 2011
10LocalCoupons.com
I realize I haven't blogged since I un-retired. So here's the story...
We sold RegionalHelpWanted.com in February 2008. After a year and a half off, I founded a new company with my previous partners to see if we could duplicate that success. (Anyone can get lucky once, but if we could do it again, maybe it it was more than luck?) We are using the same exact business model: working with local media partners using unsold inventory to advertise a local website on a revenue share basis. Instead of help wanted ads, or personal ads which is at the root of what Cupid.com was/is, this time around we are targeting coupon advertising. So in Nashville you'll hear ads for 10NashvilleCoupons.com on radio and see them on TV, and in Portland OR the website is 10PortlandCoupons.com, but it is all one website serving local content to you based on how you get there. Hopefully, you'll find your local pizza guy on there soon, or a discount on an oil change nearby.
Not only is the product different, but the software stack is a complete switch. RegionalHelpWanted.com we did in ColdFusion, Cupid.com in .net, both on IIS against SQL Server. All on Windows. 10LocalCoupons.com is done in django, an awesome framework for Python, on Apache behind nginx against postgreSQL, all on Ubuntu. I'm really enjoying the new way things are done. Much of the tediousness of writing control panel type stuff -- record insert, updates, deletes -- for customer service and accounting needs is a gimme with django's admin package, allowing my development team to hit the ground running. The django community has been a great resource to us.
So the software landscape is very different, but the hardware difference between old and new is even more dramatic. In our previous endeavors, we were paying about $1500 a month per web server for managed services. Now, using open source software on Amazon's EC2, we pay less than one tenth of that. It's a running joke every month when I announce our EC2 cost. My guess is about half of that comes from dropping Microsoft licensing fees, the rest is from virtualization efficiencies and dropping the human support.
Not all things are different however. This new project has given us the opportunity to hire back several of the awesome people we've worked with in the past. That has made it easy for me to go back to work.
I'll be blogging more soon about what we are up to, and pointing out things I've learned along the way, but for now know that I am having tons of fun.
Posted by
Steve Bywater
at
12:48 PM
0
comments




Labels: 10LocalCoupons.com, Cupid.com, django, open source, PostgreSQL, rave, SQL, Ubuntu, web site development
Wednesday, April 14, 2010
Bulk COPY a CSV into PostgreSQL, skipping first row
Looked for a solution to this yesterday and couldn't find it. Asked my Linux guru Jeremy today and he had a easy solution, so this might be helpful to others.
The scenario is you have a big CSV file, and you want to bulk copy it into PostgreSQL, but the first row of the file isn't data, it's got the column names in it. In my case, the text file is 65 Megs so it's not like you can just edit it in a text editor to delete the offending line. (The data happens to be the combined US and Canada zip/postal code database from ZipInfo.com, fyi.)
SQL Server has a bulk insert GUI that lets you specify a start row. Needed that functionality here.
Solution:
Use wc to find out how many rows are in your file:
$ wc ZCUG.TXT
872135 1871133 69105493 ZCUG.TXT
That first number returned, in my case 872135, is the number of rows in the file. Subtract one and and tail that number, outputting to a new file:
tail -872134 ZCUG.TXT > ZCUG-trimmed.txt
Boom! A new file without the row of column names.
Posted by
Steve Bywater
at
1:56 PM
0
comments




Labels: open source, PostgreSQL, SQL, web site development
Tuesday, March 30, 2010
owasp-esapi-python configuration
I tried to send this issue to the esapi-python mailing list (after subscribing) but it doesn't look like that is a functioning list. So any help with the following would be greatly appreciated.
Hi!
Thanks for your work on owasp-esapi-python! I am trying to integrate it into a project and will certainly spread the word to help drum up support for this as I make headway.
I've run into an issue during configuration:
When I do this at the python 2.6 interactive shell, it returns a single line of output...
>>> from esapi.core import ESAPI
>>> ESAPI.encryptor().gen_keys()
Creating new keys in /esapi/keyring/
The documentation leads me to believe that it will also output an Encryptor_MasterSalt but, if it's supposed to do that here, it isn't for me. Let me know any info I can provide. This is on Ubuntu 9.10.
Thanks in advance,
- Steve
Posted by
Steve Bywater
at
1:23 PM
0
comments




Labels: open source, security, Ubuntu, web site development