Ok, so django comes with a pretty default widgets... but it does allow you to use and develop your own. The problem is I haven't really found any good widget packs. There are some template packs for YUI, which is ok, but I really just want to have unintrusive, clean widgets, components and forms/model forms that you can use that automatically let you use the ajax widgets (so you don't have to write custom code for each dialog, tab, panel, etc) but still allows for customization.
Well after a good bit of searching I found nothing... there was a django-ui project on google code... with nothing in it. So... I started my own project (django-ui) on sourceforge! My goal is to have my own set of widgets, forms, views, etc that allow you to easily integrate ajax and ajax components into django. I'm using jQuery/jQuery UI as my ajax framework and ui library. Another one I liked was dhtmlx, but it really like the demo + documentation style of jQuery UI. Eventually it would be nice to have something like that for this project.
Sunday, February 28, 2010
Thursday, February 25, 2010
Django + Ajax
I have been doing a lot of looking into which Ajax (ui) framework to use for cronosa and if those frameworks have any django integration projects. I need a simple but highly customizable framework that allows me to do things in a very pythonic / django way... I found a few tools and the standard frameworks, but I really didn't see any integrations with python/django - at least none that I liked or that were complete enough. What I really want is something like JIDE for Java.
The one thing I did see (and haven't really looked into completely) is Maxime Haineault's jQuery integration with django. This sounds pretty promising (not to mention I already use jQuery and it is pretty much the standard when it comes to JavaScript). Source can be checked out here. It seems like he is on the right path, but said he is "not sure it would be a great added value nor that it would be optimal". As for me, I'm all about developing a widget pack that you would use as you would any other widget on a django form.
So, for now I think I'll develop the wigets myself and then submit them to Maxime. If he decides not to use them I'll create a new project that either forks or depends on his.
If anyone has any ideas or would like to help I am open to suggestions and I can give you the subversion link to check out my code.
The one thing I did see (and haven't really looked into completely) is Maxime Haineault's jQuery integration with django. This sounds pretty promising (not to mention I already use jQuery and it is pretty much the standard when it comes to JavaScript). Source can be checked out here. It seems like he is on the right path, but said he is "not sure it would be a great added value nor that it would be optimal". As for me, I'm all about developing a widget pack that you would use as you would any other widget on a django form.
So, for now I think I'll develop the wigets myself and then submit them to Maxime. If he decides not to use them I'll create a new project that either forks or depends on his.
If anyone has any ideas or would like to help I am open to suggestions and I can give you the subversion link to check out my code.
Wednesday, November 11, 2009
Python Setuptools "Uprade All"
Ok... so I have found an awesome way to update all python packages here:
Basically you just:
1) install yolk (easy_install yolk)
2) run: yolk -U | cut -d ' ' -f 2 | xargs easy_install
I just don't want to forget this... maybe I should put it in a bash script...
Greg
Basically you just:
1) install yolk (easy_install yolk)
2) run: yolk -U | cut -d ' ' -f 2 | xargs easy_install
I just don't want to forget this... maybe I should put it in a bash script...
Greg
Labels:
all,
hack,
hackery,
python,
setuptools,
upgrade,
upgrade all,
yolk
Monday, November 9, 2009
Cronosa.com... about
Well I finally got a simple "Welcome" page up about cronosa.com. I have been working hard and it is coming along very quickly. I put an email interest form up and man it was tough to go from the dev environment to production! Anyways, I got a form up and I'm about a third of the way to the first "beta" release. I really think cronosa will make scheduling much less tedious for managers.
Wednesday, January 14, 2009
Plone
Wow... I mean, wow. I went to a Utah Ruby Users Group tonight as I have been looking into Ruby/Rails, Groovy/Grails, and other CMS/frameworks. Ok... so one of the guys there (I thank him deeply) introduced me to Plone. He just said: "Go check it out". So I went and I actually hyperventilated durring the presentation (NEVER happened before). I was jumping up and down on the couch I was so excited. As you can probably tell, I LOVE python. Love it. I was not looking forward to learning grails and rails (I have ready read 400-500 page books on each, but to really learn them it takes a lot of practice and a good learning curve)... but now I DON'T HAVE TOO! I am buying a book tomorrow so I can digest as much as I can on Plone. Just watch the videos at http://www.plone.org. I will have much more to say about plone, I'm sure, in the near future. Development starts tomorrow!
Friday, January 2, 2009
Simple Motherboard Beep Script for Windows
Problem:
So you want to be notified by sound when something is triggered (process starts/stops, file accessed, etc). Well, you could just open a file and let it play, but what if you have headphones plugged in? Then you won't hear anything (unless the volume is extremely loud... but if you listen to it that loud I'm sure you wouldn't hear it anyways). So... how do you make your motherboard beep at the frequency, duration, spacing, and count you desire? Python.
Solution:
So Python has a wonderful module to do just this: winsound. I personally just wanted something that I could import or call from the command line to notify me of an event. So I wrote a little script to do this. I also wrote a script for py2exe.
The Script:
bell.py
So as you can see the script is only about 20 lines, but you can specify from the command line the number of beeps, duration, frequency, and spacing. I use this all the time for process monitoring, etc. It is dependable because unlike printing the \a character or chr(7) you have control over the beep AND it is dependable (doesn't depend on your terminal settings). To convert this python script to exe I use py2exe
bellexe.py
This simply creates an exe that can be called from any program within any language. I use it a lot in automated testing.
Just run:
from the command line to create the exe.
So you want to be notified by sound when something is triggered (process starts/stops, file accessed, etc). Well, you could just open a file and let it play, but what if you have headphones plugged in? Then you won't hear anything (unless the volume is extremely loud... but if you listen to it that loud I'm sure you wouldn't hear it anyways). So... how do you make your motherboard beep at the frequency, duration, spacing, and count you desire? Python.
Solution:
So Python has a wonderful module to do just this: winsound. I personally just wanted something that I could import or call from the command line to notify me of an event. So I wrote a little script to do this. I also wrote a script for py2exe.
The Script:
bell.py
So as you can see the script is only about 20 lines, but you can specify from the command line the number of beeps, duration, frequency, and spacing. I use this all the time for process monitoring, etc. It is dependable because unlike printing the \a character or chr(7) you have control over the beep AND it is dependable (doesn't depend on your terminal settings). To convert this python script to exe I use py2exe
bellexe.py
This simply creates an exe that can be called from any program within any language. I use it a lot in automated testing.
Just run:
from the command line to create the exe.
Labels:
beep,
bell,
monitor,
monitoring,
notification,
python,
script,
windows
Wednesday, December 31, 2008
A Simple Python Interface for Gmail
The Problem:
I monitor processes, files, and tasks on my computer. Some monitors are for security others are just to know when a task has finished. Whatever the case, I would like to be notified vie email/text message when something has occurred.
The Solution:
As always... write a script. I wanted something that could easily be used to send an email with or without an attachment. I also wanted to be able to just call a mail function and pass in a recipient, subject, message and attachment.
The Script:
The following script is a pretty simple script that can be imported from another python file. I did not provide command line options because I usually use it in conjunction with another script, so it is always an import. I provide a main part so you can input your username, password, and some email to test the script out. Just run it from the command line to test it.
send_mail.py
Further Explanation:
This could easily extend a general class Mail that would have the same functionality, but you could tailor it to your individual email provider. Contact me if you want such help.
I monitor processes, files, and tasks on my computer. Some monitors are for security others are just to know when a task has finished. Whatever the case, I would like to be notified vie email/text message when something has occurred.
The Solution:
As always... write a script. I wanted something that could easily be used to send an email with or without an attachment. I also wanted to be able to just call a mail function and pass in a recipient, subject, message and attachment.
The Script:
The following script is a pretty simple script that can be imported from another python file. I did not provide command line options because I usually use it in conjunction with another script, so it is always an import. I provide a main part so you can input your username, password, and some email to test the script out. Just run it from the command line to test it.
send_mail.py
Further Explanation:
This could easily extend a general class Mail that would have the same functionality, but you could tailor it to your individual email provider. Contact me if you want such help.
Monday, December 29, 2008
Create Optimized DVD/CD Images of Folder for Backup
The Problem:
I have music, videos, pictures, and files that all need backups. I have them organized how I want, but they don't always fit perfectly on to a DVD. I want a simple program that I point to a directory and it will create optimized image files for burning to a dvd. I would also like to do a few quick 'dry runs' to be sure that I like which files go in each image and that I don't have an image that is only 10% full!
The Solution:
Well, if you can't find one... make one! I decided to write a script that linked up with PowerISO's commandline tool (piso) to create images of files. You will need several Gigs of space to store the images... This is nice because you don't have to go through all your files and figure out how to divide them among images... You just do a few dry runs and then when you are happy, let it go all night!
The Script
This script uses the command line utility of PowerISO to create disc images of a folder and tries to maximize the disc usage while still preserving the file structure of the provided folder. You will need to add the PowerISO install path to your path environment variable
file_dvd_backup.py
Further Explanation:
OK, so as an example, I want to backup all of my pictures. I keep them (as seen in a previous post) in the structure of YYYY\MM month and when I burn a backup image of all of my pictures. I would prefer to keep as many pictures of the same year together as possible, however, if there is a large file (say a video clip) in one folder that doesn't fit on a dvd that is only 50% full, I would prefer it to be on a new dvd image, and then continue to fill first dvd, and then fill the new dvd image. Confusing I know, it creates dvd's that are usually about 99% full, even with a few large files mixed in.
I also hate searching for which dvd has what folder. The script creates a list of directories contained on each disc and add that file to each image. It makes it very easy for figuring out which disc has what pictures. The script could easily be altered to contain a list of all folders AND files, but I thought that was overkill.
I have music, videos, pictures, and files that all need backups. I have them organized how I want, but they don't always fit perfectly on to a DVD. I want a simple program that I point to a directory and it will create optimized image files for burning to a dvd. I would also like to do a few quick 'dry runs' to be sure that I like which files go in each image and that I don't have an image that is only 10% full!
The Solution:
Well, if you can't find one... make one! I decided to write a script that linked up with PowerISO's commandline tool (piso) to create images of files. You will need several Gigs of space to store the images... This is nice because you don't have to go through all your files and figure out how to divide them among images... You just do a few dry runs and then when you are happy, let it go all night!
The Script
This script uses the command line utility of PowerISO to create disc images of a folder and tries to maximize the disc usage while still preserving the file structure of the provided folder. You will need to add the PowerISO install path to your path environment variable
file_dvd_backup.py
Further Explanation:
OK, so as an example, I want to backup all of my pictures. I keep them (as seen in a previous post) in the structure of YYYY\MM month and when I burn a backup image of all of my pictures. I would prefer to keep as many pictures of the same year together as possible, however, if there is a large file (say a video clip) in one folder that doesn't fit on a dvd that is only 50% full, I would prefer it to be on a new dvd image, and then continue to fill first dvd, and then fill the new dvd image. Confusing I know, it creates dvd's that are usually about 99% full, even with a few large files mixed in.
I also hate searching for which dvd has what folder. The script creates a list of directories contained on each disc and add that file to each image. It makes it very easy for figuring out which disc has what pictures. The script could easily be altered to contain a list of all folders AND files, but I thought that was overkill.
Saturday, December 20, 2008
Blogger Syntax Highlighting
The Problem:
I am still using Blogger.com to host my blog, which works pretty good, you just don't have too many options and no server control. This means I can't just include my scripts on the fly (for now). I have been working with my layout, client side syntax highlighting, and general look and feel of the blog and I am getting somewhat comfortable with it. For syntax highlighting I decided to go with syntaxhighlighter, a google code project written in javascript. It works well, it's just slow. The problem with doing using plugins and including the script right into your post is that I have to generate the html for each blog post... and I want them all to be consistent.
The Solution:
Wanting things to be as simple as possible for me to post and edit my new scripts I wanted a simple code generator. I wanted it to create the html for adding a collapsed code section with a link to the script on my server on the top. I like this format because you can copy it, read it or just download it. Maybe I'll edit the syntaxhighlighter so that it takes a link for downloading the code... but for now this works. Just for fun, here's the code for my code generator:
convert_script.py
Note: The html for the presentation of my code generator on my blog was created by this script...
Further Explanation:
So in essence, all I have to do is point the script at a file on my server and bam! the code is in the clipboard! I love it. It supports code snippits and local or web script files. You can also add options for the syntaxhighlighter javascript. Yea... it's a bit rough, but what do you expect in under an hour...
I am still using Blogger.com to host my blog, which works pretty good, you just don't have too many options and no server control. This means I can't just include my scripts on the fly (for now). I have been working with my layout, client side syntax highlighting, and general look and feel of the blog and I am getting somewhat comfortable with it. For syntax highlighting I decided to go with syntaxhighlighter, a google code project written in javascript. It works well, it's just slow. The problem with doing using plugins and including the script right into your post is that I have to generate the html for each blog post... and I want them all to be consistent.
The Solution:
Wanting things to be as simple as possible for me to post and edit my new scripts I wanted a simple code generator. I wanted it to create the html for adding a collapsed code section with a link to the script on my server on the top. I like this format because you can copy it, read it or just download it. Maybe I'll edit the syntaxhighlighter so that it takes a link for downloading the code... but for now this works. Just for fun, here's the code for my code generator:
convert_script.py
Note: The html for the presentation of my code generator on my blog was created by this script...
Further Explanation:
So in essence, all I have to do is point the script at a file on my server and bam! the code is in the clipboard! I love it. It supports code snippits and local or web script files. You can also add options for the syntaxhighlighter javascript. Yea... it's a bit rough, but what do you expect in under an hour...
Labels:
code generator,
highlighting,
python,
script,
syntax
Tuesday, December 16, 2008
Redundant MySQL backup with Python
The Story:
Ok so we lost our entire company wiki the day of launch... luckily I was able to recover over 60% of it from the cache of MANY people's computers (I just wrote a script that filtered their cache and spit out the wiki content pages, then a bunch of us went through the pages)... but that is a whole different subject. (Little Note: I was not responsible for backing up or transferring the database)
The Solution:
Since then I have been pretty paranoid about running backups and have volunteered for the task (because I have done a LOT of work on the wiki). I understand MySQL Replication, which is very powerful, but sometimes you just want the sql... so I created a redundant mysqldump script that will create zipped backups in the following structure:
The Script:
The script is pretty short (under 50 lines long). I put the parameters right into the script, but you could easily add them as options. I also have it backing up all databases. This could be run as a cron job/Scheduled Task and should run on Linux, Mac and Windows.
sql_backup.pyFurther Explanation:
The script is five parts:
Ok so we lost our entire company wiki the day of launch... luckily I was able to recover over 60% of it from the cache of MANY people's computers (I just wrote a script that filtered their cache and spit out the wiki content pages, then a bunch of us went through the pages)... but that is a whole different subject. (Little Note: I was not responsible for backing up or transferring the database)
The Solution:
Since then I have been pretty paranoid about running backups and have volunteered for the task (because I have done a LOT of work on the wiki). I understand MySQL Replication, which is very powerful, but sometimes you just want the sql... so I created a redundant mysqldump script that will create zipped backups in the following structure:
<root>
<year>
January.zip
February.zip
...
Week1.zip
Week2.zip
Monday.zip
Tuesday.zip
...
The Script:
The script is pretty short (under 50 lines long). I put the parameters right into the script, but you could easily add them as options. I also have it backing up all databases. This could be run as a cron job/Scheduled Task and should run on Linux, Mac and Windows.
sql_backup.pyFurther Explanation:
The script is five parts:
- Parameters: This is really all you need to alter for the script to work for you. You will need to specify:
- Target- The directory for all redundant backups
- File Name- The name for all .sql files
- Username/password- The authentication data used for signing into mysql
- Dump command- ok this is just the command used to call mysqldump. You may need to include the full path to the executable if the mysql bin directory is not on your environment path variable
- Host- this is your host- example.com
- The command for the dump
- Name Resolver: This just resolves the name of the backup (Monday, Tuesday, Week 1, Week 2, etc.)
- Writing the Zip file
- Cleanup- remove uncompressed sql file and move the zip file to the specified target
Saturday, December 13, 2008
Automatically Copy Your Pictures from a Digital Camera
The Problem
Ok... so who gets sick of all of the stupid pop-ups from the media detectors? I personally hate all media detectors because even the best are slow, don't organize your photos by date and month, and are always in your face!
The Solution
I believe the best structure for organizing pictures is: root\YYYY\MM month. This structure is by far easiest to navigate (using Picasa). Each folder does not get too big (I take a lot of pictures) and it is easy at least to remember, within a couple of months, when you took a picture. Also, it is nice because the years AND months actually sort correctly.
The Script
Anyways, I wrote a python script that reads your removable drives and finds DCIM folders and copies them to a specified root folder in the structure specified above.
This script works great for me, but you could add a bit more checking and error logging... It's just over a hundred lines and I wrote it in the last hour and a half (I got sick of copying all the pictures over manually...) You might want to add the -h option once for usage. So here it is:
copy_pics.pySo, if you're like me and have an all-in-one internal card reader, your drive letter basically never changes. I just create a batch file and put a link to it on my quick launch. This is my batch file:
copy_pics.bat
I'll probably create a registry key that will run every time I mount a removable drive and check for a DCIM folder... but that can wait till tomorrow... I told my wife I'd come to bed over an hour ago. Oops.
Ok... so who gets sick of all of the stupid pop-ups from the media detectors? I personally hate all media detectors because even the best are slow, don't organize your photos by date and month, and are always in your face!
The Solution
I believe the best structure for organizing pictures is: root\YYYY\MM month. This structure is by far easiest to navigate (using Picasa). Each folder does not get too big (I take a lot of pictures) and it is easy at least to remember, within a couple of months, when you took a picture. Also, it is nice because the years AND months actually sort correctly.
The Script
Anyways, I wrote a python script that reads your removable drives and finds DCIM folders and copies them to a specified root folder in the structure specified above.
This script works great for me, but you could add a bit more checking and error logging... It's just over a hundred lines and I wrote it in the last hour and a half (I got sick of copying all the pictures over manually...) You might want to add the -h option once for usage. So here it is:
copy_pics.pySo, if you're like me and have an all-in-one internal card reader, your drive letter basically never changes. I just create a batch file and put a link to it on my quick launch. This is my batch file:
copy_pics.bat
I'll probably create a registry key that will run every time I mount a removable drive and check for a DCIM folder... but that can wait till tomorrow... I told my wife I'd come to bed over an hour ago. Oops.
Friday, December 12, 2008
Subscribe to:
Posts (Atom)