Posted
about 23 hours
ago
No sé quin nom posar-li, en Paco proposa al twitter "programming python & django before beers" o "def bit():" però a les hores que acabarem (més de les 18:00) ja us dic jo que al Parc Bit no hi ha res obert per anar fer unes cerveses. M'ha
... [More]
agradat molt el Creant Bits, començant amb Python i Django i ja veurem com acabarem...
Així doncs faig l'anunci oficial:
Creant Bits amb Python i Django
Divendres 4 de desembre
Hora: 16:00 a 20:15 (o més)
Lloc: Sala de formació del Parc Bit
Organitza: APSL
Col·labora: Incubit, que ens deixa la sala.
En quant als continguts, crec que els hauríem d'afinar entre tots. Per començar jo us proposaria el següent:
Introducció a Python (1.5h)
Pausa (15 min)
Introducció a Django (1.5 h)
Pausa (15 min)
Posant una aplicació Django a producció (45 min)
La idea seria que la gent li fa ganes saber què és això de Django i Python pugui fer-se'n una idea. Es donarien quatre pinzellades de Python, amb exemples que tothom pugui executar al seu portàtil.
Per la part Django: mostrar com començar, que és, veure com es pot crear una plantilla, l'organització del codi i veure alguns exemples d'aplicacions, etc. Ha de servir com a presa de contacte i que tothom pugui fer-se una idea de les possibilitats que té aquest bastiment.
Com que al final el que volem tots és posar-lo en producció, s'explicaria com n'és de bo de fer posar-ho a un entorn Apache.
Però com us dic sols és una idea. El temps és limitat, però si estau interessats en donar-li una altra orientació estic obert a qualsevol possibilitats.
Requisits
Tothom amb el seu portàtil, millor amb Linux. Si algú vol dur el seu fix i pantalla serà benvingut, però avís que hi ha una passejada i no sé com està la sala d'endolls.
Python 2.5 ó 2.6 instal·lat, el 3.x no us funcionarà amb Django.
Un editor amb ressaltat Python: vim, gvim, notepad++, Netbeans, Eclipse, ...
La darrera versió estable de Django insta·lada. La 1.1.1 en el moment d'escriure això.
Navegador Firefox amb el Firebug instal·lat
iPython instal·lat
Inscripció
Lliure, però teniu en compte que la sala té una capacitat d'unes 20 persones, així que, per favor, deixau un comentari per a que pugui controlar quants serem i saber si hem arribat al límit de la sala. Al comentari podeu posar el tipus d'orientació que us agradaria.
Quan serà la propera?
Dependrà de l'èxit d'aquesta i de que Parc Bit/Incubit tengui lliure la sala i ens la cedesqui (des d'aquí moltes gràcies des de ja!). M'agradaria que això acabàs com a grup d'usuaris/empreses més o manco estable, però això ho hem de decidir entre tots.
Altres
Miraré d'informar-me com està la sala en el tema de connexions d'Internet. Si hi ha connectivitat fins i tot podríem intentar fer un projecte en grup, si no aquesta potser la propera vegada.
M'agradaria poder dir que hi haurà catering, però seria mentida :)
0 comentaris,
0 trackbacks (URL)
Automatic translations of this post by Apertium [Less]
Posted
about 23 hours
ago
A while ago Eric Holscher blogged about things he didn't learn in college. I'm going to take a different spin on it, looking at both things that I did learn in school that I wouldn't have learned else where (henceforth defined as my job, or open
... [More]
source programming), as well as thinks I learned else where instead of at college.
Things I learned in college:
Big O notation, and algorithm analysis. This is the biggest one, I've had little cause to consider this in my open source or professional work, stuff is either fast or slow and that's usually enough. Learning rigorous algorithm analysis doesn't come up all the time, but every once in a while it pops up, and it's handy.
C++. I imagine that I eventually would have learned it myself, but my impetus to learn it was that's what was used for my CS2 class, so I started learning with the class then dove in head first. Left to my own devices I may very well have stayed in Python/Javascript land.
Finite automaton and push down automaton. I actually did lexing and parsing before I ever started looking at these in class (see my blog posts from a year ago) using PLY, however, this semester I've actually been learning about the implementation of these things (although sadly for class projects we've been using Lex/Yacc).
Things I learned in the real world:
Compilers. I've learned everything I know about compilers from reading my papers from my own interest and hanging around communities like Unladen Swallow and PyPy (and even contributing a little).
Scalability. Interesting this is a concept related to algorithm analysis/big O, however this is something I've really learned from talking about this stuff with guys like Mike Malone and Joe Stump.
APIs, Documentation. These are the core of software development (in my opinion), and I've definitely learned these skills in the open source world. You don't know what a good API or documentation is until it's been used by someone you've never met and it just works for them, and they can understand it perfectly. One of the few required, advanced courses at my school is titled, "Software Design and Documentation" and I'm deathly afraid it's going to waste my time with stuff like UML, instead of focusing on how to write APIs that people want to use and documentation that people want to read.
So these are my short lists. I've tried to highlight items that cross the boundaries between what people traditionally expect are topics for school and topics for the real world. I'd be curious to hear what other people's experience with topics like these are. [Less]
Posted
about 23 hours
ago
Django has three builtin template loaders which are used to get the templates for rendering.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
... [More]
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)
Writing your template loader is a awfuly easy. It is a callable which
Returns a tuple of (openfile, filename) if it can find the template.
Raise TemplateDoesNotExist if [...]
No related posts. [Less]
Posted
2 days
ago
Fa estona que volia posar contingut no directament relacionat amb el Blog a Trespams, ja sabeu, quí soc, sobre el blog i coses d'aquests, però no ho arribava a fer. Finalment m'he decidit i aprofitaré per explicar com podem fer aquest tipus de
... [More]
coses amb Django.
El primer de tot és centrar el problema. L'objectiu és tenir lligat a la nostra aplicació (el blog en aquest cas) un conjunt de planes que no estan relacionades amb l'aplicació o aplicacions, que no han de ser editades o ho han de ser molt poc.
El cas típic són les planes de condicions legals, les planes de "sobre mi" dels blogs. Agafau la idea, no?
Com que és un cas molt comú Django té una aplicació al contrib pensada per fer precisament això. Ens proporciona un formulari on podem posar el títol, el contingut en format html i indicar si volem la plantilla que s'utilitzarà, si permetem comentaris o no i si l'usuari ha d'estar registrat al sistema per veure la plana. Aquesta aplicació se'n diu Flatpages.
La documentació de Django està força ben explicada.
Afegim 'django.contrib.sites' a INSTALLED_APPS del nostre setting.py si no hi és ja. Si no hi era convé fer un syncdb. Crearem una entrada al Sites amb la nostra url i també posarem el SITE_ID del settings.py el valor de l'id d'aquest registre. Si sols en teniu un serà 1.
Afegim 'django.contrib.flatpages' als INSTALLED_APPS.
Afegim 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware' a MIDDLEWARE_CLASSES del settings.
Executam python manage.py syncdb per a generar les taules de Flatpages.
Cream el directori flatpages dins el nostre directori de templates i cream l'arxiu d'default.html. Aquesta serà la plantilla per defecte que s'utilitzarà. Hem de personalitzar-la com volguem. A aquesta plantilla flatpages li passa la variable flatpage, a partir de la qual podem obenir el títol i el cos del text amb {{flapage.title}} i {{flatpage.content}}. Podeu fer una ullada al codi de trespams del svn per tenir-ho més clar.
Ara ja sols és cosa d'anar afegint registres amb les urls i continguts que volguem. Django en no trobar una plana abans de mollar un 404 el que farà és anar a flatpages, si la url correspon a una que hagem definit generarà la plana a partir de la plantilla i els continguts del registre corresponent.
Per acabar, dir que no fa falta posar el filtre safe a les variables. Per defecte se suposa que l'html és segur, ja que no està pensat per a que un usuari extern a l'aplicació l'editi.
A partir d'aquí ja es cosa d'anar po
0 comentaris,
0 trackbacks (URL)
Automatic translations of this post by Apertium [Less]
Posted
2 days
ago
I am very excited to announce the DjangoSki Conference in Whistler, March 2nd-4th 2010.
This is a conference that combines my favourite web application framework with one of my favourite sports, skiing. If you are going to run a conference
... [More]
, may as well do it somewhere with style right? The conference is slightly unusual in that it's styled a bit after an unconference. There are several keynote talks we are lining up and some introductory talks, but the rest of the conference is up to the attendees.
Each day will have sprints or ad-hoc talks created by the attendees. The real goal is to focus on the things I find enjoyable about a conference - meeting people and learning. Sprints are the ideal way to learn from other people. I'm not alone in this.
Details will follow as we get registration and keynotes organized.
So if you are planning a ski holiday this year and do Django, the choice has just become a whole lot easier. Come to Whistler and have a damn good time. [Less]
Posted
2 days
ago
Today a patch of mine was committed to Unladen Swallow. In the past weeks I've described some of the optimizations that have gone into Unladen Swallow, in specific I looked at removing the allocation of an argument tuple for C functions. One of the
... [More]
"on the horizon" things I mentioned was extending this to functions with a variable arity (that is the number of arguments they take can change). This has been implemented for functions that take a finite range of argument numbers (that is, they don't take *args, they just have a few arguments with defaults). This support was used to optimize a number of builtin functions (dict.get, list.pop, getattr for example).
However, there were still a number of functions that weren't updated for this support. I initially started porting any functions I saw, but it wasn't a totally mechanical translation so I decided to do a little profiling to better direct my efforts. I started by using the cProfile module to see what functions were called most frequently in Unladen Swallow's Django template benchmark. Imagine my surprise when I saw that unicode.encode was called over 300,000 times! A quick look at that function showed that it was a perfect contender for this optimization, it was currently designated as a METH_VARARGS, but in fact it's argument count was a finite range. After about of dozen lines of code, to change the argument parsing, I ran the benchmark again, comparing it a control version of Unladen Swallow, and it showed a consistent 3-6% speedup on the Django benchmark. Not bad for 30 minutes of work.
Another optimization I want to look at, which hasn't landed yet, is one of optimize various operations. Right now Unladen Swallow tracks various data about the types seen in the interpreter loop, however for various operators this data isn't actually used. What this patch does is check at JIT compilation time whether the operator site is monomorphic (that is there is only one pair of types ever seen there), and if it is, and it is one of a few pairings that we have optimizations for (int + int, list[int], float - float for example) then optimized code is emitted. This optimized code checks the types of both the arguments that they are the expected ones, if they are then the optimized code is executed, otherwise the VM bails back to the interpreter (various literature has shown that a single compiled optimized path is better than compiling both the fast and slow paths). For simple algorithm code this optimization can show huge improvements.
The PyPy project has recently blogged about the results of the results of some benchmarks from the Computer Language Shootout run on PyPy, Unladen Swallow, and CPython. In these benchmarks Unladen Swallow showed that for highly algorithmic code (read: mathy) it could use some work, hopefully patches like this can help improve the situation markedly. Once this patch lands I'm going to rerun these benchmarks to see how Unladen Swallow improves, I'm also going to add in some of the more macro benchmarks Unladen Swallow uses to see how it compares with PyPy in those. Either way, seeing the tremendous improvements PyPy and Unladen Swallow have over CPython gives me tremendous hope for the future. [Less]
Posted
2 days
ago
В общем я понял, что постоянно слежу на новостями об Google App Engine и для себя фиксирую разные интересные находки, кроме того иногда что-то
... [More]
пишу сам (и тексты и код). И вот решил совместить приятное с полезным и сделал блог в котором выкладываю находки и мысли. Совмещать это в ЖЖ не хочу и это не интересно. Поэтому решил делать на новой платформе и так как удобно именно мне.
Стоит за ним следить или нет это уже судить вам, наполнять буду потому что мне давно хотелось сделать узкоспециализированный блог о какой-то близкой технологии. Скорее всего если будут писать какую-то статью, то анонс буду присылать сюда, но вероятность этого не очень велика.
Сам блог поднят на тумблере http://app-engine.tumblr.com/, чтобы сократить время запуска проекта. Но как только допилю что-то свое, то перенесу данные на другой хостинг и домен, поэтому если пользуетесь RSS читалками, то лучше подписываться на http://feeds.feedburner.com/app-engine адрес фида меняться не будет.
Материалы постепенно перенесу и опубликую то что накопилось. Если хочется поделиться своей умной мыслью, то http://app-engine.tumblr.com/submit и заодно проверим работает это или нет.
Еще раз реклама ссылок:
- Временно постоянный сайт http://app-engine.tumblr.com/
- RSS фид http://feeds.feedburner.com/app-engine [Less]
Posted
3 days
ago
Announcing Kong: A server description and deployment testing tool. An ultra simple website monitoring tool written in Django which makes it easy to manage a list of Twill scripts for testing different sites. It was developed at the Lawrence
... [More]
Journal-World—Eric showed me a demo if this a year or so ago and I’ve been hoping they would open source it. [Less]
Posted
3 days
ago
Сегодня получил кучу позитивных новостей по поводу Python. Первая из них о росте популярности python. Даже не знаю методику проведения, но
... [More]
думаю это правда. Вторая это решение о переходе AMO с CakePHP на Django.
Можете почитать в статье планы на 2010 год, а я дам комментарии к победным пунктам которые касаются сравнения платформ:
- ORM и уровень абстракции данных. Думаю тут ничего экстраординарного нет, сложно ругать то что не подержал в руках. Хотя и ожидать чего-то экстраординарного не стоит. Работа с данными в Django мне не нравится, постоянно ощущение, что python way это немного больше. Но в текущем решении оказывается все плохо. Ок, оставим на совести того кто выбрал это пыхпых поделие.
- Эффективные юнит тесты. Вот это уже гораздо интереснее и приоткрывает дверь во внутренний мир MoFo. Не каждая организация использует юнит тесты. Есть множество причин и не все из них негативные почему их не обязательно применять. Но тесты сильно помогают тем организациям которые планируют разработку на месяцы или годы вперед. Похоже текущий проект был временной мерой и надо было сделать его как можно быстрее. Но потоп пришел еще при нашей жизни.
- Лучшие средства отладки. Текущее решение предлагает только один вариант разработки: "отладка через лог ошибок". В принципе если разработка ведется через тесты, то отладка не нужна, но тесты должны быть написаны до.
В общем поздравляю команду драконоводов с еще одним правильным решением, python код пахнет совсем по другому. [Less]
Posted
3 days
ago
This is just a quick post because it's already past midnight here. Last week I realized some potentially useful code that I extracted from the DjangoDose and typewar codebases. Basically this code let's you get simple histogram reports for models
... [More]
in the admin, grouped by a date field. After I released it David Cramer did some work to make the code slightly more flexible, and to provide a generic templatetag for creating these histograms anywhere. The code can be found on github, and if you're curious what it looks like there's a screenshot on the wiki. Enjoy. [Less]