Finally got around to creating a repository for the source code of ExtPaste a ExtJS / Django powered pastebin .
People where asking me about the source code for http://extpaste.com on the ExtJS forums for some time now. So here it is: http://hg.trbs.net/extpaste/
The project was development and currently runs on a Django version before 1.0 :( But i'm working at this moment to get the repository up to date with Django 1.0. I've already ported it to NewForms-Admin so the biggest thing left is to port to newforms.
If everything goes fine the code in the repository should be on Django 1.0 before the end of the day.
Updated 15-Nov-2008: Extpaste now runs on Django 1.0 and higher
Posted on November 14, 2008
With tags:
code,
django,
extjs,
source
2 Comments
Today i've added a new option to Django-Extension's runprofileserver to make like a bit easier for people who want to use KCacheGrind to profile Django.
This was sparked by profiling one of the scientific Python scripts i wrote for my research project. I wanted to see where (or at least if) i could squeeze a bit more performance out of it without resorting to ctypes/c-modules or weave. For more information about the latter see: http://www.scipy.org/PerformancePython
So i disabled Psyco which confuses the profiler and started my program with the cProfiler enabled and started analyzing it's output.
you can do this easily by executing:
$ python -m cProfiler ./my_application.py
From earlier encounters with profiling i found that KCacheGrind is a really awesome application for viewing and analyzing profile data. However Python's profiler module cannot directly save it's data in a format which is compatible with KCacheGrind. There are a few ways around this and one of them is a script called: lsprofcalltree.py .
It converts the profile information from cProfiler to something which is readable by KCacheGrind. Best of all you can use it as an in-place replacement for the Python interpreter so it's just as easy to use as the "$ python -m cProfiler" line.
Coming back to the runprofileserver I implemented lsprofcalltree directly into the extension command so you do not have to convert the output data by hand later. All you need to do now is enable the --kcachegrind option and all the profiler data is automatically saved in the KCacheGrind compatible format.
Example:
$ mkdir /tmp/my-profile-data
$ ./manage.py runprofileserver --kcachegrind --prof-path=/tmp/my-profile-data
Validating models...
0 errors found
Django version 1.0-post-release-SVN-SVN-unknown, using settings 'complete_project.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[13/Nov/2008 06:29:38] "GET / HTTP/1.1" 200 41107
[13/Nov/2008 06:29:39] "GET /site_media/base.css?743 HTTP/1.1" 200 17227
[13/Nov/2008 06:29:39] "GET /site_media/logo.png HTTP/1.1" 200 3474
[13/Nov/2008 06:29:39] "GET /site_media/jquery.js HTTP/1.1" 200 31033
[13/Nov/2008 06:29:39] "GET /site_media/heading.png HTTP/1.1" 200 247
[13/Nov/2008 06:29:39] "GET /site_media/base.js HTTP/1.1" 200 751
<ctrl-c>
$ kcachegrind /tmp/my-profile-data/root.12574391.592.prof
Here is a screenshot of how the above commands might look in KCacheGrind:

More information can be found at http://code.google.com/p/django-command-extensions/wiki/RunProfileServer
Have fun profiling :)
P.S. Having fancy tools is never a replacement for learning and knowing about what code actually does and what profile data represents !
Posted on November 13, 2008
With tags:
django,
kcachegrind,
lsprof,
runprofileserver
255 Comments
After working for several months here in Japan i finally get the change to go on a vacation.
I've planned a short-stay in Nikko where i will stay in a Zen-buddhist's lodge/monastery and see all the different temples and nature around there. Specially in Autumn time it is rumored to be very very beautifully.
When i return from Nikko the plan is to go on to Kyoto / Mt. Fuji area and maybe something south of Tokyo like Kamukara.
In a couple of weeks i hope to be able to put up lots of pictures for you all to say :)
Enjoy your Autumn!!
trbs
Posted on October 15, 2008
With tags:
japan,
kyoto,
nikko,
vacation
0 Comments
A while ago i was playing with the excellent pinax (django-hotclub) project and i felt like the admin index page was kind-of overwhelming due to all the different apps listed in it.
So i put a simple app together that has one template tag and a slight modification of the "admin/index.html" template to create simple tabs in the django admin interface.
To minimize my effort ;-) i used jquery and ui.tabs.js to create the tabs at runtime. With one mandatory tab called "main" (changeable in settings.py), which contains all apps not mapped to a specific tab, and an attribute in settings called "ADMIN_TABS" that maps different apps to different tabs.
It's still more-or-less a proof-of-concept applicatio, but it shows how easy these kinds of modifications can be in the django admin interface.
Screenshots
Mercurial repository
Afterthoughts:
I would like to extend this to something like shown in the Gondola screencast by Peter Baumgartner at a later time where a specific tab can also short-cut to common usage patterns.
Posted on September 19, 2008
With tags:
admin,
django,
tabbed,
tabs
5 Comments
When looking for English books in a bookstore i came across the programming section of the 8 story book store and i could not resist to take a look and see if i could find any Python or Django books there.
Look at my picture from what i've found here: http://trbs.net/photos/python-django-books-in-japanese/
Regretfully these where only about two bookshelves worth of Python books. Compare that too one full cabinet of Ruby and Rails books, one cabinet for Perl, a hole alley of Java books, an alley for c and c++ and lastly an alley for php/asp/vb/c# and other some other languages. *I'd even found some scheme, lisp and cobolt books in there :) *
Worthy to note was that the Microsoft languages section was far less in total then i'd expected. While on the other hand a relatively minor language like Ruby had far more. Ofcourse japan is the homeland of Ruby so that might explain it's high number of books ;)
(On a site note; probably the only people that could have invented such a syntax horrible language are the Japanese. Of-course I'm purposely forgetting about Perl here)
Anyways i did not want to withhold u guys of these pictures, specially the one from the Django book that has a lovely cover, good layout and lots of examples, i even found a lot of debugging instructions and examples in there.
P.S. The pictures where taking with the build-in camera of the N810 so quality is very poor.
Posted on September 13, 2008
With tags:
books,
django,
japanese,
python
0 Comments
Geneva, 10 September 2008. The first beam in the Large Hadron Collider at CERN was successfully
steered around the full 27 kilometres of the world’s most powerful particle accelerator at 10h28 this
morning. This historic event marks a key moment in the transition from over two decades of
preparation to a new era of scientific discovery.
A great moment for science and the world !
Posted on September 11, 2008
With tags:
accelerator,
cern,
particle
1 Comments
Nothing beats your first official Japanese lesson they must have thought ;-)
Well it was very amusing to say the least. I just started practicing Hiragana less then a week ago and my self-study-lessons date back from before 2004. The fun things is that i clearly remember some things from the self-study i did way back, specially in the form of a passive (very incomplete) mind-dictionary. I remember a lot of the simple words and it all came back to me fairly quickly during this first lesson.
However that's not to say that this is going to be easy :( Now i have a big text and workbook on my desk which i have to study in besides working in the lab if i want to have any change of learning some basic Japanese.
So which me luck guys and girls :)
One thing is for sure, if the rest of the lessons will be this amusing i will have a great time studying Japanese :)
Posted on September 9, 2008
With tags:
beginners,
japanese,
study
1 Comments
I recently added two new commands to the django-extensions project.
-
clean_pyc, removes all compiled python bytecode files from your project directory
-
compile_pyc, compiles all python files to bytecode files in your project directory
These are handy shortcuts to what you would normally do with something like "$ find -name "*.py[co]" -delete" or python's compileall import. The main added advantage is a little piece of code that checks the correct working directory. So it will only compile or delete files in your project root, even if you call manage.py from somewhere else.
One other thing to note is that you will always see files being deleted when you call "$ ./manage.py clean_pyc -v" this is because when manage.py gets loaded python will compile files in your project root which are then in turn deleted by the command ;-)
Check it out at: http://code.google.com/p/django-command-extensions/
Posted on September 8, 2008
With tags:
django,
extensions
0 Comments
Originally the plan was to go and climb Mt. Fuji, but after getting on the train i was swept into this outdoors Electro/House party. I just love how Tokyo does this to you. Regretfully no pictures because
it was very dark, so my compact didn't work so well.
This turned out very very well, specially because the weather was terrible and climbing without good gear in this weather would have been terrible. Hopefully i will still get the change somewhere in the coming weeks.
In good Japanese fashion the party was spread out over couple of fields, some with live acts (mostly young espirering artists) and other with DJ's. And lots of little stalls with foods and drinks in between.
Needless to say i really enjoyed myself :-)
Already wondering what the next week will bring...
Posted on September 6, 2008
With tags:
japan
0 Comments
Congratulations everybody Django 1.0 has landed
Thanks for all the hard work of the Django core team !!!
Posted on September 5, 2008
With tags:
django
2 Comments
Always a very important moment in history, when the first post happens :)
Posted on September 5, 2008
With tags:
blog,
first,
post
71 Comments