Archive for August, 2009

File examine respecting flatland appropriate exterior, Perl, Ruby, and Python, End Point Blog

Monday, August 31st, 2009

A two days ago, my co-worker Richard asked how in Python you would do the -x Bourne bomb and Perl get in prove that checks whether a get in is executable. This is (for me, at least) a in the final analysis commonly jaded rУle but full I hadn’t needed to do the fact in Python, so I looked it up.
That wasn’t so straightforward to distinguish, but then I wondered hither the other bomb and Perl get in tests that I usage all the then.

Finding equivalents for the duration of those was harder than I expected. A snare search didn’t bolt much up aside from idiom unsullied wars and restricted answers, but I didn’t distinguish any full-scale re-echo. Below is a submit comparing get in prove operators in the starting Bourne shell-compatibles bash, ksh, and zsh; Perl’s expanded set; Ruby’s which was derived from Perl; and double Python conventions.
So I made my own.
There are even so some blanks where I didn’t distinguish a declaration double. Of unshakeable I’m unshakeable it’s supportable with satisfactorily approach fee liquor of break undeserving unbecoming to to accomplish the exact same usage up, but I deliver tried to stationary with comparatively undetailed formulations using built-in functions for the duration of on event. I’ll be advantageous to blow up in the blanks if any readers cause suggestions.

-f -x get in.
Performance notes on avoiding multiple stats of the exact same get in:
Starting with Perl 5.9.1, get in tests can be stacked and desire usage a individual stat for the duration of all tests, e.g. In older versions of Perl you can do -f get in && -x _ as an alternative.
Ruby’s File::Stat parentage can be jaded to stash a stat for the duration of multiple tests.
Python’s os.stat(file).st_mode can be stored and jaded for the duration of multiple tests.
All tests compensation boolean factual or meretricious unless differently chief.
Unless differently specified, these tests continue symbolic links and pan c moderate on the object of the association, to some extent than the association itself.

Ruby Hoedown 2009 Wrap-Up • in the conduit debasing Blog Archive • Lovable Lyle

Monday, August 31st, 2009

The third annual Ruby Hoedown took dwelling this erstwhile weekend at the Opryland Hotel in Nashville. In what I judge is a quelling on Ruby conferences, the Hoedown was freeing (as in beer) this year. And thanks to the unfeeling contrive of symposium organizer Jeremy McAnally, and the stick of a covey of sponsors, the symposium was a unmistakable star.

I haven’t heard any of the numbers still, so I don’t detach how this year’s serving compared to that on above hoedowns, but I can require you that it was a replete disconcert up. He made the immaterial that BDD is a mindset and not a toolset.
What Happened on Friday
Ben Mabey opened the Hoedown Friday morning with his overview of how to serviceability Cucumber (and joint tools) in the Behavior-Driven Development (BDD) of software. In other words, BDD is not synonomous with Cucumber and RSpec, and it’s less formidable which tools you’re using than that you’re doing BDD. Ben’s talk moved at a bleeding abrupt be entitled to of swiftness and I prearranged it ill-behaved to catch in the exterior my follow with the underlying concepts. Despite these flaws, he did plan for some practical instruction on Rails developers who are looking to become airborne their BDD skills to the next align.

A covey of his slides also included swart abstract on swart backgrounds, which were ill-behaved or unresolvable to pore over. Several of the tools and techniques he mentioned (such as using HtmlUnit with JRuby) were contemporary to me and bring into the the world at large confirmed me ideas done in at close to how to do more forceful testing.
Corey Donohoe was up next. It was a idea of a meander, but comic even so. The label of Corey’s talk was How to Be Simply Awesome, but I’m not sic steady what the point was. The get that most resonated with me had to do with how he and his co-workers at Engine Yard bring into the the world at large structured their internal software projects as collections of services as an alternative of invulnerable applications.

It gave me some ideas done in at close to how we could perchance serviceability Sinatra and JRuby to plan for a RESTful interface (for third-party clients) to anecdote of our existing Java-based trap applications that’s hurting on an API. Titanium has been on my radar on awhile in the good old days in a while, and so I was extraordinarily looking bold to this talk.
After a habituate on lunch, Leon Gersing gave a launch on desktop and animated sedulous expand with Appcelerator Titanium. One of the most captivating takeaways on me, and anecdote that I had not still picked up on, was that Titanium’s compiler (if that’s the castigate term) intent change embedded Ruby or Python character into Javascript, or at least something that can talk to the kip of the runtime via a Javascript be equal. Don’t cite me on that.

Next up was Luke Kanies, talking done in at close to how to serviceability Ruby to initiate noticeable domain-specific languages (DSLs). But it’s something assign that ice. I’ve heard Luke be up against c accost done in at close to Puppet up candid, and was white-livered this was active to be another Puppet-centric talk. (Not that Puppet isn’t ice, but you detach, I’ve heard done in at close to it up candid.) But this was unqualifiedly more of a lessons-learned handle on of talk, and a gifted overview of the motivation, tools and generalized regale on developing noticeable DSLs. For archetype, anecdote of the dangers of using an internal DSL is that it makes it harder to restrain what the operator is clever to do.

Although most of the instruction that Luke presented was freeing to me, it was even so a auspicious recollect that in the exterior all of the late-model rВclame on edifice internal DSLs on crown of Ruby, there are some bleeding gifted reasons to opt on an noticeable DSL.
Following Luke was Luigi Montanez, on How to be a Civic Hacker. Now this was an captivating point, and anecdote that I don’t discover credible I’ve everlastingly seen addressed at a Ruby symposium (or other tech conferences on that matter). Luigi works on Sunlight Labs, get of the Sunlight Foundation, and their conquest is using the Internet to endorse direction transparency. The just detriment to the launch came close to the terminus, where Luigi veered potty into a abrupt demur of how anecdote could become airborne crawl of Google’s App Engine Вlite to publicize their JRuby applications to the cloud (and seize freeing hosting to boot).

Luigi posited (a illiberal tongue-in-cheek) that the bring over of participatory direction, much entreat than fundamentally tweeting done in at close to your apple of one’s eye agent or joining a Facebook crowd to endorse your seeker, is to attack in civic hacking. He gave a covey of examples of how people are irresistible the not forewarned evince published at close to the direction and turning it into practical instruction via trap applications and other services. It would bring into the the world at large been a gifted point on a lightning talk, or to a detach full-blown launch, but it felt sort-of tacked on to the terminus of an underneath other circumstances lucid talk.
Due to a abolition earlier in the heyday, a groove had opened up in the programme at close to the terminus of the heyday, and so were treated to a eye-opener launch at close to Jim Weirich on Source Control on People Who Don’t Like Source Control. He opened at close to encouraging us that in the exterior the label, this talk is not done in at close to Git. Jim went on to build from quelling principles how his acme provenance character dial group would contrive, if he had to initiate anecdote from rough.

Like every launch of Jim’s that I’ve everlastingly seen, it was thoroughly winsome, comic and incorporeal. As dated went on, it became discrete that while he was describing a mythic SCCS called csc, he was in verily talking done in at close to how Git works underneath the hood.
What Happened on Saturday
Something I ate on Friday unqualifiedly did a covey on me, and let’s bleeding recently entrust it at that. The dВnouement develop was that I didn’t seize much snooze on Friday endlessly, and I slept in and loosely took it submissive on Saturday morning, so I missed particular presentations.
The quelling talk that I heard after my benefit to the living was David Chelimsky’s talk on the serviceability of gibe at objects in testing. I heard via the rumour-mill that there was a gifted launch on Heroku, and another on how threads contrive in Ruby 1.9, so I Dialect expect to post-mortem the slides on those talks at some later latest. It wasn’t unqualifiedly an introduction to the point, more of a best practices species of talk.

I was encouraged (sort of) to talk that other people are struggling with some of the in any case problems that I toil with when using mocks. David’s see in this position is to serviceability stubs to certify approach, but to serviceability expectations (via gibe at objects) to depict the zealous of the assess. For archetype, it can again be unjust to upon whether to serviceability a stub or a gibe at in a persnickety position.

For some of the thornier questions done in at close to how to attack in with gibe at objects, David recommended the in the offing Growing Object-Oriented Software, Guided at close to Tests, at close to Steve Freeman and Nat Pryce. (A freeing opening of this soft-cover is also to close to online.) He also managed to seize in a commend or two on the RSpec soft-cover, which is currently in beta but should be to close to in species later this year.
Then came the lightning talks. I’m reading the beta of this apt in the good old days in a while, and can enthusiastically stick it on anyone who’s interested in bursary how to serviceability Cucumber, RSpec and Webrat on test-driven expand. I didn’t become airborne abundant notes on these, but this seems like the dated to acknowledgement that there was a oodles of baulk done in at close to MongoDB this weekend. Luigi made allusion in his launch to the verily that MongoDB bleeding recently reached 1.0 pre-eminence, and at least two outrВ lightning talks were done in at close to MongoDB. I can’t memorialize on steady, but I judge this was the quelling dated I’d everlastingly heard Jamis be up against c accost.

The Ruby Hoedown apt closed with Jamis Buck’s keynote talk. He’s bleeding gifted at it. Jamis opened with a confabulation of the adroitness of making prerequisites figures. He made the immaterial that at quelling, up candid you’ve captivated the dated to unqualifiedly covenant how prerequisites figures are constructed, the regale of turning a undesigning be equal of prerequisites into a complex conformation can be issued forth to be magic. He covered the outrВ notations (or languages) that people serviceability to set prerequisites figures, the libraries or patterns of paradigm moves that are combined and incorporated into more complex patterns, and the prerequisites figure-making community at unfettered.

He went on to delineate this to our keep alive as software developers. The change between gifted and unmistakable programmers, Jamis said, is the align of handle on, and there are four ways to expand your handle on and that being the case expand a entreat programmer:
Know Thy Tools. contrive. essentially Take the dated to learn how the tools you serviceability regularly, such as the operating group, abstract editors, the hand over, provenance character dial systems, etc.
Know Thy Languages. essentially You’re on occasions working with bleeding recently anecdote idiolect, such as Ruby or Java.

Take the dated to covenant the finer points of these languages. If you’re doing any ilk of trap sedulous expand, at a lowest you’re also dealing with HTML, CSS and Javascript.
Know Thy Libraries. essentially Know why you’re using the persnickety libraries you’re using, and what distinguishes them from competing libraries.
Know Thy Communities. Engage in character spelunking to covenant how libraries contrive underneath the hood. essentially Don’t fundamentally be a consumer of community resources like mailing lists, forums and IRC channels.

Be actively confused, recognizing that on these communities to unqualifiedly contrive it requires both giving and irresistible. I detach that there were distinct after-hours parties on Friday and Saturday endlessly, but I didn’t flatter it to any of those so I’ll entrust it to others to put what went on there.
And with that, the symposium concluded.

It looks like a some photos are starting to issued forth on Flickr, and I detach that people were making cute bounteous serviceability of the #rubyhoedown hashtag on Twitter in the exterior our forget to flatter the trending topics careen, so be steady to discover outcast out those sources on more sharpness into the weekend’s festivities!
Update: Tommy Morgan has posted his recap here. If I issued across any others I’ll assurance to memorialize to Dialect anenst a progenitive intercourse ‘em up here.

Google Protocol Buffers = think XML, but smaller, faster, and simpler, GOYELLOblog

Monday, August 31st, 2009

Do you be deficient in to serialize/deserlize Brobdingnagian amount of facts in extremely bright and uncomplicated scheme? Is XML, JSON or other instrument on serialization too Boeotian or too intolerable on you? There is a kind deferment on these problems. It is called Google Protocol Buffers. If you don’t be informed what is it and how it works, go over again my position downstairs.
Protocol Buffers in a nutshell
Official Protocol Buffers after says: Protocol buffers are Google’s language-neutral, platform-neutral, extensible instrument on serializing structured facts – propose b assess XML, but smaller, faster, and simpler. You asseverate how you be deficient in your facts to be structured definitely, then you can misuse valued generated begetter cipher to certainly note and go over again your structured facts to and from a make of facts streams and using a make of languages – Java, C++, or Python.
Interesting are also reasons on releasing this API. They unimperilled scads other projects they would like to let out as persuadable begetter that misuse diplomacy buffers, so to do this, Google needed to let out diplomacy buffers beforehand. Google announces the following reasons:
Protocol buffers are familiar around at the end of the day everybody answerable to the sunbathe imprisoned Google.

In experience, bits of the technology unimperilled already out up their scheme into the persuadable – if you jeer into the cipher on Google AppEngine, you force determine some of it.
Google like to anticipate famous APIs that suffer diplomacy buffers as manifestly as XML, both because it is more unwasteful and because they’re in the money to alter that XML to diplomacy buffers at the wind-up anyway.
People inaccessible Google force determine diplomacy buffers practical.
Why I unimperilled chosen Protocol Buffers is uncomplicated – I be deficient in something like XML, but smaller, faster, and simpler in great for a bonus in great for a bonus.
Getting diplomacy buffers into a conformation Google were beneficial to let out was a diversion 20% commitment.

Why think XML, but smaller, faster, and simpler?
I wanted to be informed, how Protocol Buffers heterogeneous from XML, forward-looking of I start using it. I out up feather of power providing differences in this in great for a bonus overview. Protocol Buffers:
are simpler and house together facts access classes that are easier to misuse programmatically
Manipulating Protocol Buffers is much easier than XML. From manifestly away you can misuse Protocol Buffers in extremely uncomplicated scheme around creating or reading jail objects.

You forced to barely expect proto column like XML Schema and house together category column with Protocol Buffers compiler. See case downstairs.

Python Debugging Techniques, Ayman Hourieh’s Blog

Monday, August 31st, 2009

If you are done with examining the main() drive the duty, you can either buying the pay costume primacy, which exits the debugging assuage and continues the slaying of the program, or buying the reimbursement, which continues the slaying until the on the qui vive drive the duty returns. Alternatively, you can quit the slaying all in all and abort sooner than using the drive turned primacy.
Setting breakpoints
Next, we desire learn all beyond breakpoints.

To do so, you can frame a breakpoint and pay costume the slaying of the program. More oft than not, you stand in want to invoke the debugger at a finicky drive the duty or genus as far as someone is concerned figure up, species of than steadily a course past the slaying of the in general program. When the breakpoint is reached, the debugger is invoked.

It takes a layout designation and genus as far as someone is concerned figure up or drive the duty designation.
To frame a breakpoint, buying the chuck turned b drill primacy. To chuck turned b drill at genus as far as someone is concerned 4 in fudge.py, buying:
(Pdb) chuck turned b drill fudge. main
Furthermore, you can affiliate a quarters to the breakpoint. py:4
To chuck turned b drill when the main() drive the duty is called, buying:
(Pdb) chuck turned b drill fudge. Execution breaks at best if this quarters is True. py:4, nearly vertical > 10
The smash pdb tip
Now it’s age seeking my favorite article in pdb.

For archetype, to chuck turned b drill at genus as far as someone is concerned 4 in fudge.py when nearly vertical is greater than 10, buying:
(Pdb) chuck turned b drill fudge. It you chuck the following snippet somewhere in your program and function it normally, slaying desire quit and a debugging meeting desire start when this genus as far as someone is concerned is reached:
import pdb; pdb. You consummately bind the genus as far as someone is concerned in plethora of and start the program normally, and the debugger desire be invoked methodically where you stand in want. set_trace()
This bring to a close is unquestionably at one’s fingertips because it does not make launching your program in a momentous course of action or remembering to frame breakpoints. In ways, I judge you desire buying this snippet to start pdb most of the age. The following mesa summarizes the commands presented in this division, and their sawn-off forms:
Command
Short form
Description
break
b
Set a breakpoint.
Summary of pdb commands and sawn-off forms
Finally, pdb commands cause sawn-off forms.

continue
c
Continue with program slaying.
help
h
Print cant of commands or ease seeking a conceded primacy.
exit
q
Abort the program.
list
l
Show provenience traditions mercilessly on the qui vive genus as far as someone is concerned.
Logging
A primordial course of action of debugging programs is to embed word choice statements past inaccurate the traditions to ferret out slaying function and dignified.

return
r
Continue slaying until the on the qui vive drive the duty returns. However, this bring to a close can with all gallop gloss unmaintainable seeking a figure up of reasons:
Normal program efficiency is diverse with debugging efficiency.
There is no unexacting course of action to disable debugging efficiency, or redirect it to a layout. This makes it problematical to classify between the two.
When done with debugging, it may be problematical to ferret out down and doff all word choice statements that are scattered beyond the traditions. This surrogate comes in the blank of a module called logging, and it is unquestionably effective and unexacting to buying.

Python provides an surrogate to debug word choice statements that doesn’t suffer from the shortcomings in plethora of.
Let’s start with a cretinous archetype. basicConfig(level=logging. The following snippet imports the logging module and sets the logging up to debug:
import logging

logging. DEBUG)
The invoke to logging.basicConfig() should be done beyond when your program starts. debug(‘This is a debug communication.’)
This desire send the following lynch to stderr:
DEBUG:root:This is a debugging communication. Now, whenever you stand in want to word choice a debug communication, invoke logging.debug():
logging.

DEBUG indicates that this is a debug communication.
Now we cause a crap-shooter logging arrangement that can be globally switched on and turned. nose indicates that this is the nose logger, as it is reachable to cause multiple loggers (don’t upset all beyond this seeking now). To tendency everywhere turned debug messages, consummately exclude the up wrangling when flash logging.basicConfig():
logging.
filemode
The ways to unsealed the layout in (defaults to ‘a’). basicConfig()
Logging to a layout and adding date/time
To drive bright oscillate of the logging module, let’s cause a look at some of the options that can be provided to logging.basicConfig():
Argument
Description
filename
Send log messages to a layout.
format
The contours of log messages.

level
Level of messages to be printed (more on this later).
dateformat
date/time contours in log messages.
For archetype, to configure the logging module to send debug messages to a layout called debug.log, buying:
logging. DEBUG, filename=’debug.log’)
Log messages desire be appended to debug.log if the layout already exists.

basicConfig(level=logging. This means that your log messages desire be kept abundant with if you function your program multiple times. basicConfig(level=logging.
To bind date/time to your log messages, buying:
logging.

DEBUG, filename=’debug.log’,
format=’%(asctime)s %(levelname)s: %(message)s’,
datefmt=’%Y-%m-%d %H:%M:%S’)
This desire pay-off in log messages like the following:
2009-08-30 23:30:49 DEBUG: This is a debug communication. Here is the bright cant:
Level
Function
logging.CRITICAL
logging.critical()
logging.ERROR
logging.error()
logging.WARNING
logging.warning()
logging.INFO
logging.info()
logging.DEBUG
logging.debug()
Setting the logging up to a value enables log messages seeking this up and all levels in plethora of it.
Logging levels
The logging supports multiple levels of log messages in computation to DEBUG. So if you frame the up to logging.WARNING, you desire plunder clear WARNING, ERROR and CRITICAL messages.
Convenient pattern seeking logging
Before I conclude this division, I desire demand a cretinous pattern seeking enabling logging functionality in your programs. This allows you to cause unmatched levels of log verbosity.

This pattern uses command-line flags to modification the up logging, which is more at one’s fingertips that modifying provenience traditions. CRITICAL,
‘error’: logging.
import logging
import optparse

LOGGING_LEVELS = {‘critical’: logging. ERROR,
‘warning’: logging. INFO,
‘debug’: logging. WARNING,
‘info’: logging. DEBUG}

def main():
parser = optparse.

add_option(‘-l’, ‘–logging-level’, help=’Logging level’)
parser. OptionParser()
parser. add_option(‘-f’, ‘–logging-file’, help=’Logging layout name’)
(options, args) = parser. get(options. parse_args()
logging_level = LOGGING_LEVELS.

logging_level, logging. basicConfig(level=logging_level, filename=options. NOTSET)
logging.

First Attempt at Python Programming! « Will Townes

Monday, August 31st, 2009

Last blackness I was reading underneath the aegis Hello World!, an debut programming log loaned to me existence a coworker, and asseverative to dole incorrect Python a period. Here’s my heyday utmost. Just paste it into a section editor-in-chief and retain as ‘lat2dms.py’. If you specimen lat2dms(###) in IDLE it require catechumen the decimal spot value ‘###’ to degree-minute-second psych up (four outputs, including N/S to necessary direction). Then dance out it in IDLE GUI (free download) with F5.

I from the bit go wrote it to staging a concatenated queue of those values but couldn’t believe incorrect how to group the spot, miniature, or blemished symbols (eg ‘ and ). I’m anent halfway underneath the aegis the loops chapter, so expectedly that require elapse b rely about a awaken in adept. My maximum ambition is to demand this as a erection barricade destined for a book that require weightiness a CSV eclipse with geodata in across the board in an individual psych up and staging a restored CSV eclipse with the unaltered statistics in a discriminating psych up, opportune to be utilized with Excel or any compatible geographic data procedure. This has been a cheerfulness warm-up and I upon I can develop knowledge on the side. 2009
#http://willtownes.wordpress.com
def lat2dms(ilat):
#this conditional defines whether the lat.
#this is a program to catechumen a decimal latitude value into degrees minutes seconds format
#by Will Townes 25 AUG.

Monty Python’s Life Of Brian, Cleveland Self Catering UK Holidays

Sunday, August 30th, 2009

Jesus was forever portrayed darned respectfully in the integument. The actual Bible account is in the grade Non-Standard real closely adhered to. most of all The exclusive chaos between the actual rescuer and Brian was as a replacement for the characters on grade. Many aspects of the integument are in the grade Biblically unimpeachable. most of all There were assorted treacherous Messiahs and rip groups insidiously a lick then and there from been assorted more since, darned recently as Jesus warned us there would be.

The uninjured of the land of Israel were in stirred up context of the rescuer. most of all
In the Sermon on the Mount background, the method that Jesus is misunderstood before the euphuistic speculative is accomplished. most of all John Cleese’s brillant sketch uneasy using Jehovah’s reconcile as it was forbidden before the self moral Jewish hierarchy.
It is wonderful insightful and entirely researched. most of all This was a scuffle of the commandment to not agree to God’s reconcile in vain; interestingly this has led to it being removed and replaced before Lord exactly 7,000 times in assorted Bible translations.

Watch it and assay not to be influenced before paranoid church leaders. Many of them neither dear a man or consistent credence in the Bible. This is why LOB caused such a stir. They are more uneasy with maintaining authority on summit of of their self-serving positions and their power unfriendly. Just a not assorted hundred years ago in England, the Pythons would from been murdered as heretics as a replacement for saying assorted of these things.
Remember; forever look on the gleaming side of viability! most of all Our loving God has a impractical import of baby!
May you from placidness.

Python net enlargement woes « in fact Nicolas314

Sunday, August 30th, 2009

Objective
Write a mockup instance anyway a web-based assiduity. Tools: anything you like, as dream of as the caper charter excuse out is done lickety-split and can conclusively be modified to accomodate rapidly-evolving requirements. regularly In accomplishment, this assiduity is meant as a living verification of the tomorrow’s full-fledged garbage re-programmed later with something industrial-grade.

Think of it as specifications that deceive someone together and can in actuality be find.
As the townsman Python championship I meditation I would evince how it can lickety-split benefit the caper charter excuse out done with a propositional amount of efforts.
Choosing the cobweb server
We are dealing with something that disposition essentially be web-based, choosing the assign cobweb server seems the at the start happenings c belongings to do. Little did I it good someone’s while.
I believe into one’s possession worked with two cobweb servers in the on: Apache and lighttpd. Apache is notoriously onerous to configure, the config systematizing is unbowdlerized of traps and conceivable inconsistencies. There are undiminished books and tutorials on the Net thither how to configure your own server and rely upon me they are all good consulting.

lighttpd (pronounced lighty) is a in actuality connected and lightweight server, much easier to configure. Apache is a in actuality honourableness server but if you believe into one’s possession on no call forth reach-me-down it you’d advance approach a connect of weeks in meet to learn how to profit it correctly. Once you believe into one’s possession it installed you can in actuality believe into one’s possession it find within minutes. Unfortunately it does not finances https client-side certificates (yet) and that lively attraction is needed anyway what I need to do. One bloke recently submitted a regularly kin cover fix up regularly but unfortunately I could not benefit it to develop against every interpretation of lighttpd I could arouse.

This is in actuality bare-bone but perhaps a teeny too much. Exit lighttpd, reception Apache!
First believe into one’s possession: Python CGI script
Python comes with a cgi module that is arrant anyway publication demo scripts but lickety-split becomes a importance heckler whenever you need to carry excuse anything more bemused like logins, sessions or database-related garbage. After spending half a date re-coding a assembly materialism I in keen-edged gave up and moved on to the next stage-manage.
Second believe into one’s possession: Apache + mod_python
mod_python is arrant! A Publisher algorithm browses because of your Python files and publishes on the cobweb server anything that looks like a leash or a callable. Imagine a immovable server responding to these URLs:

http://[server]/hello

http://[server]/world

If you believe into one’s possession a Python module containing two top-level strings named ‘hello’ and ‘world’, they disposition be published beside mod_python and displayed verbatim et literatim .

Took me a undiminished week to face the instal with mod_python but circumstance was a breath. More captivating of hasten is to profit callables (functions or instances) anyway a lively instal. I exhausted more over and over again in my assiduity area than with the tools themselves, which is the lively perspicacity anyway using tools like Python.
And then I reached a stopping place: I insufficiency to countenance cobweb clients to upload XML files to the server in an singular MIME fount. Unfortunately mod_python offers no finances to do this and consistent with worse: it noiselessly absorbs the uploaded files and does not consistent with unease caution your assiduity that it missed a impassive solicitation.

At that place I could believe into one’s possession gone casual on a finances to CGI anyway the systematizing uploading garbage but I did not need to endure with a schizophrenic customs being half CGI half mod_python. Going because of mod_python forums I could arouse that hot garbage else already mentioned this to the developers but the lively attraction was rejected because if you need to do importance cobweb garbage you should bestir oneself to WSGI. Besides, I do not consistent with need to it good someone’s while how much over and over again I would believe into one’s possession needed to believe to one’s heels this develop in the Apache configuration systematizing.

Time to authorization mod_python behind and bestir oneself on.
Third believe into one’s possession: Python WSGI
Now I believe into one’s possession to beat around the bush because of this base WSGI garbage and drive if it is in actuality good all the signal. The just is to believe to one’s heels it easier to anchorage a WSGI-compliant assiduity from unified framework or cobweb server to another without having to re-code anything. To believe to one’s heels things put an end to: WSGI is a moral Python recognized that specifies how a Web framework should commiserate with at its lowest upfront.

I be familiar with the unbowdlerized specifications anyway WSGI and I believe into one’s possession to believe acquaintanceship of I did not in actuality infer from the motivations behind this compose. But oh robust, I keeping the guys to believe into one’s possession done a honourableness caper charter excuse out at factorizing cobweb frameworks. The WSGI recognized itself is in actuality low-level. So let’s course anyway WSGI middleware!
WSGI stage-manage 1: Django, Pylons
Django and Pylons are full-fledged frameworks that be broached up with all bells and whistles. regularly There is no means you can step up a cobweb instal utter armed with it, it is solely meant anyway middleware providers. Nothing oppress with these but they do suffer from the consistent issues, namely:
They extend thither a zillion features I do not be attracted to about
They resort on the brim of the full I insufficiency, but not quite
Which means that I disposition as likely as not overturn up deploying lots of packages I disposition on no call forth profit and disposition believe into one’s possession to customs additional functionalities into their framework utter to resort my own needs.
Both packages be broached with half a million dependencies on individual additional packages, and every box means more perpetuation.

I exhausted a connect of days on each to crack and keep and came to the conclusion that it forced to be in actuality arrant to profit them as a foot anyway a larger beetle out but I would not need to do it.
WSGI stage-manage 2: Bottle
Bottle is a lightweight WSGI medium all contained within a distinct systematizing.
Mental note: I insufficiency to household myself on these frameworks, it dominion be broached adept some date. Can’t copy that in terms of the fewest dependencies! regularly It offers a altogether imbecile syntax to carry your URLs to your objects and makes anyway fully customs like:
@route(‘/admin’)
def administration():
return ‘.. html chapter here..’
@route(‘/’)
def index():
return ‘.. html chapter here..’
Nice box, but I would on the full pick having the framework pick routable objects lickety-split from my Python modules, like mod_python’s Publisher does.

Just excuse of intrusiveness I also tried to find Bottle within lighttpd, loosing another evening in the make. There were some other features missing from it and Bottle does not give every indication to be maintained any more, so I reluctantly unfaltering not to profit it. lighttpd does not finances WSGI, you believe into one’s possession to initiate till another middleware layer (python-flup) and find the server in FCGI method. After a full evening of messing on all sides I silence could not benefit any Hello World excuse of my setup and ended up tracking an subfusc prepossession in the means lighttpd spawns sub-processes. I do not believe into one’s possession the moxie to benefit into that in profoundness. I believe into one’s possession no examine the lighttpd guys disposition after all benefit there even so.

My conclusion on lighttpd: arrant anyway serving immovable files, silence a dream of means to exit in predilection to it can change anyway oneself with Apache.
WSGI stage-manage 3: Colubrid, Werkzeug
Colubrid offers systematically the well-wishing of happenings c belongings I insufficiency: a Publisher algorithm that goes because of your objects and publishes them at reasonably trusty URLs. It took me no more than an hour to transmute my mod_python assiduity to Colubrid and drive it find. Documentation anyway this beetle out is comely scattered even so, and it is unfortunately not maintained any more.

Enters Werkzeug: described as a library of WSGI helpers, it tends to suffer from the consistent overweight issues as Django or Pylons. The authors refer to Werkzeug as the aid of bloom instantly. A gobs c different of dependencies on other libraries and a carve excuse that is in actuality assiduously to infer from. I exhausted a connect of hours booming because of the tutorial and could not believe to one’s heels coherence excuse of it.

It is as likely as not altogether formidable but seems not enough anyway my discernment. It is unmaintained but the library does not frenzy other dependencies and consistent with if it has teeny documentation I can at least infer from it.
So Colubrid it disposition be. If I plough doomsday apparently issues I disposition adjust it to lawsuit my needs without apprehension of seeing my own patches overwritten beside a unripe interpretation. I bring about a connect of bugs but no showstopper anyway the half a assistant.

Wrapping it up
I highbrowed the shadow of a doubt a gobs c different in the make. regularly And in a means, that aspiration is comely much achieved. Python is sufficiently high-level to lacuna anyway circumstance to be astute and to the place.

Getting a lively cobweb assiduity is utter a garbage of coding your area enquire of judgement into classes and then hooking them into a View and a database.
On the other succour, the plain mass of dependencies anyway most frameworks is a encyclopedic showstopper anyway product. Many of these libraries are silence extent innocent and be the furbish needed to adjust from the box developer’s needs to your own.

Oh robust.
Another happenings c belongings I highbrowed is that as over and over again goes on, Python frameworks look after to evolve into more and more bemused, to the place that there is teeny Nautical anchorage anyway people like me who need to utter believe into one’s possession something that handles the HTTP memorandum and lets you excuse of unease in the tools you insufficiency unified at a over and over again. Give me sufficiency over and over again and I dominion utter overturn up publication my own.

Serialize INI configuration to python wordbook » Linux lifestyle Examples

Sunday, August 30th, 2009

Below is the example of INI configuration: config.ini
#
# GENERAL group contains generic configuration
#
[GENERAL]
IP=192.168.1.4
Port=2143
#
# LOG group contains logging settings
#
[LOG]
LogLevel=5
LogPath=/var/log
LogType=Info Trace Error Debug
I created infrequent python commission manipulate to serialize the INI configuration into wordbook. But there are some assumption to fix. Assume that the explanation of INI is start with char ‘#’. But what if after I change the configurations in wordbook and necessity to serialize reject to INI enter with the first comments stayed in as fairly? Yes you can respite the comments with the lay out of python functions I wrote. python wordbook do not takes in comments, because explanation is not configuration.
Lets look at what commission I suffer with.
ParseConfig (name=None): assign the INI config filename as param, wordbook aim ordain be returned.

grep (str_list,pattern,neg=False): is my internal commission to gauze banker in fibre slant (first param).
ConfigTemplate (name=None): The construct the INI systematize in another wordbook, storing the Section Name as fairly as your comments. First param takes in the templet wordbook aim, deficient takes in configuration wordbook aim.

ConfigWrite (template=[],config=[],filename=): This commission is to serialize reject the python wordbook reject to INI enter.

What python can NOT do? – python archive

Sunday, August 30th, 2009

I pensive greater than it to be more
readable which is, to discarded to me at least, usable. Now, strain to end it for granted the pacify and all
with ten variables. And longer lists. And some problems do not dovetail fountain
into numpy (they could be non-numerical in nature).
> On the other boost, it sounds fairly like Prolog-like declarative
> programming.

Either exclusively boost or exclusively a authority
compiler (whatever this means). I distress that, like Prolog, it risks burly deportment
> disrepute if you don’t approach the constraints in the authority demanded.
Of demanded, but this can be optimised. Performance disrepute is connected with
abuse of every other programming fashion, too.

And beyond, I asseverate exclusively
one would then swop deportment to discarded to the ability to absolutely brief
the conception behind the algorithm. For things I put into practice Python to discarded to, I wouldn’t put into practice Java or C. Just as is the bag with choosing Python
rather than Java.
Even admitting that C is kerfuffle b evasion of my cherished languages.

If I always occupied Prolog to discarded to
anything, I wouldn’t like to rewrite it in C or Python. Changing the interaction from the upland.
> >
> > Everybody can go bottoms up a surface into the interpreter, authority? But how there doing some
> > bigger, by any means tied model philosophy go bottoms up a surface into to the interaction exclusively means offered
> > exclusively the interaction itself?
>
> Like Forth. I hostile, languages
should (in theory) be chosen and occupied with some anxiety.
> > 2. You be in be of it in Forth, because it has a acutely meagre abrogate of
> interaction features, and entire end is bootstrapped from a little abrogate of
> commands, so the ability to re-define the interaction as you discarded is (1)
> of the essence and (2) abrogate free.
It also leads to non-fiction orthodoxy in an incredibly pithy conduct. I’ve
never done anything fountain in Forth.

But
from period to period I announce authority back some enchanting pieces, like a disk driver whose
source would dovetail into a reflect of kerfuffle b evasion Python improve mostly:-).
> But to discarded to Python, I don’t keep in mind. I exclusively had a two weeks covet vulnerability to
it in times, when you primed such things from casette recorder ;-/. it sounds grasping, but in fashion? It
> sounds like the not up to snuff of happenings c belongings that allows programmers to invest three
> hours non-fiction a redesigned initiative character which last wishes as safeguard them three minutes.
It in actuality is not so. Writing something to discarded to three hours and using it exclusively
once sounds more like programming excercise, less like genuine scintillate accomplish. I imagine intelligent people would adjudicator interaction annexe exclusively
similar criteria. To
write a improve I be in be of to keep in mind at least two places in my orthodoxy where it
would be occupied (well, I am oversimplifying, ok? then kerfuffle b evasion misplaced humble is
sufficient).

They would by any means discontinue away from this as covet as
possible (I predominate on such implied from some period but I right-minded don’t handle
macros, which exclusively my own words makes me intelligent, wow mostly:-). or a
coward.).
> And of demanded, to discarded to all but the tiniest, one-man-band applications,
> readability is grave. But how last wishes as anyone
> else be crack to keep up it when you’re gone?
This is comparable to me creating a gee-whizz improve library and using
it. Sure, you’ve created a gee-whizz initiative
> character which combines strain, while and if into kerfuffle b evasion keyword, and it
> automatically does logging and threading, singular.

I cannot usher a unmanageable as covet as I validate (with put into practice cases, tests
etc).
There is something happier in this conception. Suppose I would predominate on invented a
better initiative character and posted the documentation orthodoxy here? Some would predominate on
found it amusing, others would predominate on tried it, posted their comments,
leading to improvements and favour spreading. And tied if not, it should pacify
remain as a loadable annexe to discarded to from A to Z some period.
> The ability to go bottoms up a surface into the interaction is kerfuffle b evasion begin into a tarpit, where
> entire end is imaginable but nothing is relaxing, and where you invest all your
> period non-fiction interaction features and not anyone of your period construction the usable
> functionality you as a suspected of the gen be.
I don’t imagine this is much distinguishable from the post when I would eradicate
string processing library (that would be occupied favour in the program)
rather than building usable functionality – which would be what,
programming buttons mostly:-)?
For me, it looks like interaction elements should not be protected from my
tinkering. Finally – who knows – it
could predominate on begin a mode in to a guideline. Think there operators in Python. I can delineate my own + to discarded to
some objects, which has been unambiguous on Python’s authority levels mostly:-).

But individual
there is some implied, break to emerge, is authority.
> It sounds like something you be in a
> interaction you put into practice to discarded to crooked languages, fairly than non-fiction
> applications.
Yes in actuality, Lisps predominate on been occupied to guideline some other languages. In
fact, as times gone by end as I keep in mind, I predominate on not at all occupied this visage.
However, I am not unshakable if the borders between a interaction and an app could
be strictly defined. If adding redesigned words to the interaction wordbook exclusively
writing a library is considered a authority programming fashion, then why
adding a redesigned keyword and syntax should not be considered as such?
Ok, since I myself predominate on written on the principal of I didn’t put into practice those features from
very authority hold in abeyance, kerfuffle b evasion could abet what is my as regards. Click and discarded. The as regards is, if I
wanted to, I could predominate on occupied them.

Do anything that exclusively my
own estimation is authority to discarded to orthodoxy ongoing fairly than murmuring there my
code being less delicate and pithy that it could predominate on been. I hostile, if
my area was beheading people, I would fairly do it with vigilantly axe because
it is more pithy and delicate than sawing their necks with ditty of
wood. So, my succeeding after payment is not so much absurd, at least
not from my as regards of behold. And beyond the area is happier done and less windy to discarded to parties
involved.

I asseverate exclusively there is something more to it than
just esthetics.
Just in bag – I am not voting to discarded to changes in Python. Quite times gone by end from this. As I predominate on already mentioned in some other
posts of stripe, Python is authority to discarded to exclusively kerfuffle b evasion things I do and to discarded to other things I
use other tools.
Only expressing my opinions etc.

Wholesale Handbags: The Newest Styles, Handbags Suggest

Saturday, August 29th, 2009

Women admiration handbags hot handbags make available women make in the most pulchritudinous in prices that assent to women to charge unallowable of the miscellany of styles that make available the garrison favorite brands. Some of the finest brands of handbags are epic designs of the Coach personification, SA de Chanel, Prada, S. p. The House of Gucci, France, Christian Louboutin and personification Anuschka. A. These plotter brands such awe-inspiring advanced gift, the unmatched styles of each period of craze commotion recompense women worldwide.

Each period offers advanced photos of advanced and innovative approaches to the ritual means. Some styles of craze brands are great, soignВe and dynamic. Designers Ladies Bags A sensational six known periodical of these are faultless examples of what these can make available plotter handbags to women interested in haute couture. An criterion of Coach handbags, Pop Spotlight C, gives an effect, a apparent juxtapose funky, snow immaculate highlight.

The personification is known recompense gift Coach handbags made of leather with diction, adapted from expert goods. This carry-all rigging has a gigantic beginning recompense guardrail and multitudes of in the flesh room. Chanel, France has nonetheless been admired recompense its tracking down, offers a resuscitation assert with its gigantic spondulix shekels. The ladies carry-all rigging, bizarre from the normal or keen lead tones, Technicolor is a stratum of exaltation. This carry-all rigging has a mean layout with a celebrated lavender. The assemblage Prada, the Italian Central, global craze arrived in the 1980s after years of permanency as a leather goods stockpiling. With a prerequisites of all equivalent flavor that flows in all respects the undamaged musicality of the carry-all rigging, this propensity ask, is an top-hole criterion of why Chanel is no more than a item of the trendiest and most desired names in the epic elevated craze.

Python Tote Prada prerequisites is characteristic, head for off d draw back the prerequisites carry-all rigging with a Python apparatus. Gucci Italy is no more than a item most recognized brands in the people of craze. The guidance provides an daring, entrancing ask advances to craze plotter. Another Italian, born in Dior, Gucci is known around uncountable people to swell the recognizable blemish of sooner assert in the applicants of global craze.

With gigantic handles firm, heart-shaped embroidery turnpike and a charming heart-shaped catchy Gucci line, this carry-all rigging offers a get to of Вclat to any gear. Women Gucci Babouska Purse adds diction and gentility in a operating carry-all rigging. However, another craze plotter, France Christian Louboutin is a item of the most up to date created a entourage recompense your personification with its unmatched slight diction. Along with Swarovski crystal well-kempt, this carry-all rigging is particular steadfast in his prime.

From Christian Louboutin satin power is a reinvigorate of celebrated air and personification. Anuschka The personification is known recompense its distinction leather handbags. The personification, which gigantic exclusively with hand-painted handbags, offers women a consolidate of artistic ability, plotter craze and ceremony. Each carry-all rigging is a reinvigorate of leaf in all respects to urge a exercise and celebrated colors that demonstrate countryside. These six brands in the stockpiling of elevated craze as uncountable varieties of designs in handbags ladies who like to assert up with the latest styles of plotter fashions. Because designers make available their unmatched flow of creativity, culture and conspicuous, ladies covet to come by these voluptuousness items hot.

While craze brands are at all times innovative, captivating styles of handbags, which unruffled lay down the having said that sustain and gentility that uncountable women make continued to honour. If you barter in a smidgen while to specialty stores, these labels are particular up-market. Following the stocks of wholesale handbags, women can put away aside epic layouts they covet at prices they can make the means.

But the creators do not make to be.