Building Web Pages with Python
The webpage adminspotting.net covers the creation of webpages using Python, Colubrid, Jinja, SQLAlchemy, markdown and FormEncode.
Very nice. thx for that :-)
The webpage adminspotting.net covers the creation of webpages using Python, Colubrid, Jinja, SQLAlchemy, markdown and FormEncode.
Very nice. thx for that :-)
When you are comming home to Austria from another country (I was in Ireland until yesterday) you always think of how beautiful your country is. This time too. almost.
Ireland is a really strange country. On the one side the history of Ireland is all about burning down religious places, fighting against the British, vikings and their own Irish people. But it really looks like the country is developing in a very different way today. Whilst the religious conflict still exists many people who left the country are comming back and even more are immigrating to Ireland. About hundred years ago most of the people in that country were farmers, some lived in cities but many lived out in the wilderness where nothing but turf existed.
Now the whole situation changes, but it looks like the people don't change in the same speed. When they were farmers they burned many calories and ate much heavy food like eggs, bacon, black pudding etc. Now they still eat that much ashore but they don't need that heavy food any more. The result is that many of those people are now overweight. Its crazy when you watch families buying food at a local spar. They put things into the cart which you wouldn't eat in those amounts...
But when you have a look at the number of young children you wonder why there are so many in Austria. A friend of our family told us that this is probably because the south is very Catholic and if you look at the statistics the amount of births is decreasing. The richer a country gets the lower the amount of your children. If I could believe him the hole situation will get worse in the next two generations.
The next thing you notice when you travel through Ireland is the high number of new houses which are all marked as "for sale". In Ireland there are some astate agents like Sherry Fitzgerald who build houses like mad and sell them for prices the average Irishman can't afford. Crazy world. Maybe they think the people immigrating would buy that.
Aside from that: Ireland is great. Navigating a boat on the Shennon is great fun and you can see really beautiful towns and cities. I really would like to have beautiful cities like those here too. But in our town they don't build beautiful houses, the build houses which look daring for two years, average for three and ugly for the rest. In Hermagor you can see ugly buildings like the house where the "Drogariemarkt" was, and now our local electrician is, the "Riedergarten" building where one of the two local spars is in and last but not least the new "Hofer" building and the awkward "Deichmann" and the other stupid capitalistic muck stores are in. Hermagor looks like the playground of architects and building enterprises who try to copy good looking modern buildings but fail on all aspects. But they are still able to sell their goddamn architecture as "modern".
And all just because our mayor and his cortege are easy to blend.
Goddamn.....
Anyway. Austria still rocks and Ireland was cool too ;-)
PS: pictures of ireland will follow in the next days. hopefully
Today in the PHP museeum of gruesomeness: implode()
From the original PHP documentation:
Note: implode() can, for historical reasons, accept its parameters in either order. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
Note: As of PHP 4.3.0, the glue parameter of implode() is optional and defaults to the empty string(''). This is not the preferred usage of implode(). We recommend to always use two parameters for compatibility with older versions.
— no comment
thx to lumax for pointing that out
Wohoo. I'm offline two weeks from today. Ireland, I'm comming
Everybody who needs something from me: Haa haa ^^
The last two days i had a deeper look at ruby and found together with __doc__ from #python.de some strange things. Before I discovered those things I really thought ruby was python with a little different syntax. But it seams like ruby is more perlish than pythonic. Read on my dear.
Disclaimer: if you are a ruby user you probably find the example from above ok, then just don't read that post. IMHO just python users may find this shocking ;-)
As a python programmer i know that whitespace is significant. But there are some positions in a language where whitespace shouldn't be significant like whitespace before and after operators. But have a look at the following example:
First we define a function
irb(main):001:0> def a irb(main):002:1> 2 irb(main):003:1> end
And then we call it:
irb(main):004:0> a + 2 => 4
This works because ruby doesn't require braces to call a function, but you can also call it by using this:
irb(main):005:0> a() + 2 => 4
That's really okay for now. But this; isn't:
irb(main):008:0> a() +2
=> 4
irb(main):009:0> a +2
ArgumentError: wrong number of arguments (1 for 0)
from (irb):9:in `a'
from (irb):9:in `Kernel#binding'
from :0
And that's just one of the problems with non first-class functions as you can see later. But methods in ruby lay in its own namespace. At least that's what the guys from #ruby-de told me. And this brings some problems again:
irb(main):001:0> def a() 2 end => nil irb(main):002:0> a => 2 irb(main):003:0> a() => 2 irb(main):004:0> a = 1 => 1 irb(main):005:0> a => 1 irb(main):006:0> a() => 2
whoops? What's that? That's one of the negative aspects of a) methods in its own namespace and b) non first-class methods.
This python snippet:
>>> def foo(): ... return 42 ... >>> bar = foo >>> bar() 42Looks like this in ruby:
irb(main):001:0> def foo() irb(main):002:1> 42 irb(main):003:1> end => nil irb(main):004:0> bar = method(:foo) => #irb(main):005:0> bar.call => 42 irb(main):006:0> bar[] => 42 :foo is a interned symbol in ruby, something like a normal python string. Since ruby strings are mutable they arn't that cheep as python strings, so they have symbols. But writing :foo doesn't mean that you directly reference to foo. So method(:bar) looksup the method in the method namespace and creates a new instance of it. Or something like this. The result is that you can't just call the method by writing bar, but they have overloaded [] so that it calls the method...
But there is more in rubyland that smells odd. Take this python example:
class Foo(object): pass def bar(): return 4 f = Foo() f.bar = bar print f.bar() #prints 4Looks like this in ruby:
class Foo end def bar 4 end f = Foo.new q = class << f self end tmp = method(:bar) q.class_eval { define_method(:bar, tmp) } puts f.bar #prints 4And that's all just because there are no first-class functions ;)
And something I can't explain myself over which i stumbled while trying to build a closure with ruby:
irb(main):001:0> def foo irb(main):002:1> def bar irb(main):003:2> 42 irb(main):004:2> end irb(main):005:1> end => nil irb(main):006:0> foo => nil irb(main):007:0> bar => 42That's something i really can't explain myself...
Maybe someone can explain me those things, I really don't understand why ruby behaves like this. If there is an error in the examples above inform me about it.