background preloader

Python 1

Facebook Twitter

C++

Ping. Smartypants. James Duncan Davidson. Zone.effbot.org. Plogue. Coda. Good question. Coda is everything you need to hand-code a website, in one beautiful app. While the pitch is simple, building Coda was anything but. How do you elegantly wrap everything together? Well, we did it. More than anything else, Coda is a text editor. But an incredible text editor is just a nice typewriter if you can’t easily handle all of your files — from anywhere.

Then you’ll want to see what your code looks like. Believe it or not, we’ve just scratched the surface. Finally, hiding behind the Plus button in the tab bar is a built-in Terminal and MySQL editor, two amazingly powerful Tab Tools. And it’s all wrapped up in our Sites, which get you started quickly. Coda is a very good app.

Django FileBrowser. Falling Bullets Source Code (You Ninnies) Python isn't just Java without the compile. I've had several conversations recently where it's become clear to me that some people view dynamic languages like Python and Ruby as just Java without the compile step. Yes, one of the advantages of a dynamic language is the ability to drop the compile from the edit/compile/run cycle, but there is much more to it than that. [Update: Some corrections. A first-class function isn't one that is just defined outside a class, but is an object itself. I didn't state that explicitly but I did show that in the worked example at the end.

Python doesn't have true continuations, what I labelled continuations are actually just generators, a limited form of continuation. ] Now let's not start a language war here; to be perfectly clear, I'm not calling Java a bad language nor am I impugning the skills or mental prowess of Java programmers, what I want to do is just introduce some of the abstractions that are present in Python and Ruby that are missing from Java.

First-class functions Continuations. Write better template tags. Django‘s template tags are a great way to handle things that don’t always make sense being in a view. If you want to have, say, a list of recently-added content which appears in a sidebar or footer on every page of a site, it’d be crazy to manually change every view to fetch that content and add it to the template context; a template tag is definitely the way to go. For example, in the footer of every page on this site, I pull out the five most recent entries, five most recent links and five most recent comments, and it’s all done with template tags. Now, at first it might look like there are only two ways to do this: Write three different template tags: one for entries, one for links and one for comments.

This is annoying because it’s basically repeating the same logic three times and only changing a couple of details about the model. Write one template tag which returns three lists of content — one for each model. Iteration 1: Let’s fetch some links A lot has changed here. Template context processors. Last time around we looked at how to write an effective template tag, with the focus on writing a flexible template tag that would make it easy to pull in various types of recent content in any page; I use a tag similar to the one in that entry to pull out the recent entries, links and comments in the footer of every page on this site. For situations where you want to get content out of your database, a template tag is typically the best way to go, but consider a related situation: what happens when you want a particular variable — not a content object — to be available in the context of every template?

You could write a template tag to populate that variable, and it’d be extremely easy to do with a convenience function Django provides: the simple_tag decorator, which lets you omit a lot of the boilerplate of writing a template tag when all you want is to spit out some value into the template. Enter RequestContext and context processors Let’s write a context processor we do this: New Eno Music Gets 'Generative' Brian Eno, the electronic and ambient music pioneer, thinks today's computer-crafted tunes are lame. With software like Acid, Logic, Cubase and ProTools, musicians now have on the desktop a seemingly to cut up, affect, loop and rearrange sounds. Altering the tempo, pitch and feel of a beat has become almost as easy as changing the font in this sentence. But that's not necessarily a good thing, Eno said. These programs lead musicians to "attend to details at an infinitely fine level whilst ignoring the macro," said Eno, one of the first popular musicians to experiment with tape loops and electronics.

He's worked on such landmark albums as U2's The Joshua Tree, David Bowie's Heroes, Talking Heads' Fear of Music and Roxy Music's For Your Pleasure. "Looking back in 20 years, it'll be very obvious that computer music had a particular flavor, just like music of the 1960s with the wah-wah pedal," he continued. The limitations will keep most music makers far away from Koan. 5 Useful Python Tips. Here are a few useful Python tips I’ve learned over time. 1. When using the '%' format operator always put a tuple or a dictionary on the right hand side. Instead of: print "output %s" % stuff Write: print "output %s" % (stuff,) With the tuple on the right hand side, if stuff is itself a tuple with more than one element we'll still get its representation instead of an error.

Example: >>> def output(arg): print "output %s" % arg >>> output("one item") output one item >>> output(('single tuple',)) output single tuple >>> output(('tuple','multiple','items')) Traceback (most recent call last): File " Now, if the function output is changed to: >>> def output(arg): print "output %s" % (arg,) >>> output(('tuple','multiple','items')) output ('tuple', 'multiple', 'items') It will always work as intended and expected. 2. Timeit.py to the rescue. >>> import timeit >>> def word_count(): s = "long string with several words to be counted " return len(s.split()) >>> word_count() 8 3. 4. 5. Useful Online Resources. Merlin. Professional Project Management with a Bit of Magic In the office, at home and on the road Merlin Project is the standard for project management in industries such as Architecture & Construction, Media & Agencies, Research & Development, Education and others.

For more than 20 years customers in over 160 countries have been using our flexible app to plan, manage & control their small and large projects – no matter whether you're on a Mac or an iPad! Increase your quality and efficiency with Merlin Project - almost as if by magic! Planning and Organizing Projects Every project begins with a plan. Read more about the work breakdown and the Gantt chart. Merlin Project is the gold standard for project management for macOS and iPadOS! The Creative Approach Or start your project with brainstorming in the intuitive mind map.

Read more about the mind map. This really is the best project planning application ever, I'm so glad my friend referred me to use this for my project. — Dobrila May. Django | Code. Building a Blog with Django. 3:31 p.m., Monday 23 January, 2006.Tagged geeky and django. NOTE The Python code in this tutorial no longer works with Django! Please read my new article, a Django Blog Redux, for code that works on newer versions of Django.

The rest of this article, such as the theory, is still very much applicable and should be read alongside my newer code. When I first posted about Django, I said that I'd post the details of how I wrote a blog in Django, without actually writing any real Python code. This will show you how you too can have a simple blog working in no time at all. I'll assume for this article that you've got Django installed and working, and you know the basics. What this creates for us is three database tables. For this tags table, we also define a few functions. The second table to be created is called 'blog_posts' and will contain a few simple fields. Save your changes, and then edit your 'urls.py' file. (r'^admin/', include('django.contrib.admin.urls.admin')), Last drinks.

Installation of a proper Python environment. I recently had my hard drive fail, so I have just had the fun of reinstalling my Python environment from scratch. Here are instructions for setting up Python as a proper interactive development and data analysis environment. Some of these instructions are OS X specific (I'll flag those), but the general procedure will work on any *nix-ish platform. Note that on OS X, I don't really love Fink or Darwinports for building and installing software for me. Especially not software that I depend on, and may need to patch, or use bleeding-edge versions, etc. Python -- The best.IPython -- An interactive python shell. Before doing anything, make sure that /usr/local/bin is first in the PATH environment variable, because that's where we'll be installing these things. Echo "export PATH=/usr/local/bin:$PATH" >> .profile If you're using tcsh (you would know if you are since it's not the default; but you can type echo $SHELL to find out), you would want the following: And now, the directions!

IPython. Trichech.us. ZigVersion. SIMBL. Problem: Some applications do about 90% of what I want. Solution: Develop my own applications. Better Solution: Patch the application myself... SIMBL (SIMple Bundle Loader) - pronounced like "symbol" or "cymbal" - enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari. If you are having a problem, you can check the list of current bugs. If you are interested in a more in-depth technical explanation, you can can read the SIMBL developement notes. Installing SIMBL Plugins Most plugins should come with an installer, however it's easy to do it yourself. Plugins can be copied into /Library/Application Support/SIMBL/Plugins for all users, or ~/Library/Application Support/SIMBL/Plugins for just your account. SIMBL plugins are nothing more than standard Cocoa bundles created by XCode, with the addition of one key in the Info.plist.

SIMBL was originally created when I was working on PithHelmet, but here are now a bunch of SIMBL plugins available. Questions | Comments | Feedback. Django. GraphicsMagick Image Processing System. The Power of mdfind. By Andy Lester 01/04/2006 Tiger introduced Spotlight, a powerful searching mechanism that indexes the contents of all the files on your Mac, almost like magic. Want to find all the documents that mention Perl?

Spotlight will do it for you. Just press ⌘+space bar (Command-space bar), and the Spotlight search box pops up. Note that the documents found are grouped by type, and even include things you might not consider as documents. All the Spotlight-related functionality is based on the idea of metadata, or data about data itself. In addition to the little blue magnifying glass in the upper-right corner of your desktop, Tiger provides the mdfind and mdls commands.

Starting with mdfind I've worked on a number of different books for different publishers. What I get back is a list of 110 files that match the word "invoice" somewhere in their contents. I'll narrow down the search by adding terms. Now we're down to two hits, and it's clear I want the first file. Boolean Operators is the same as. Beautiful Soup. You didn't write that awful page. You're just trying to get some data out of it. Beautiful Soup is here to help. Since 2004, it's been saving programmers hours or days of work on quick-turnaround screen scraping projects. If you have questions, send them to the discussion group. If you find a bug, file it. Beautiful Soup is a Python library designed for quick turnaround projects like screen-scraping. Beautiful Soup provides a few simple methods and Pythonic idioms for navigating, searching, and modifying a parse tree: a toolkit for dissecting a document and extracting what you need.

Beautiful Soup parses anything you give it, and does the tree traversal stuff for you. Valuable data that was once locked up in poorly-designed websites is now within your reach. Interested? Download Beautiful Soup The current release is Beautiful Soup 4.3.2 (October 2, 2013). Beautiful Soup 4 works on both Python 2 (2.6+) and Python 3. Beautiful Soup 3 Beautiful Soup 3 works only under Python 2.x. Hall of Fame. Python Tutorials. Pythonmac.org. TmCodeBrowser Homepage. Current Version: 1.11 Introduction TmCodeBrowser is a TextMate plugin designed to help navigating source files. It will parse any language known to the underlying Exuberant Ctags program (enhanced by a small script to also support Objective-C). It will present classes, subroutines etc. in a TreeView.

TmCodeBrowser requires OS X 10.3.9 or later and TextMate v1.1b17 REVISION 687 or later. Manual, Screenshots The online manual with screenshots is available here. Download and Installation Click on the icon below to download TmCodeBrowser.dmg. Note: After updating the TmCodeBrowser plugin you need to restart TextMate for the plugin to work properly. Tip: In case you ever want to delete the TmCodeBrowser plugin: TextMate installs tmplugin files into the directory ~/Library/Application Support/TextMate/PlugIns.

Note: Versions of TextMate prior to REVISION 702 will not properly register the TmCodeBrowser.tmplugin bundle, and it may show as a normal folder. License Change Log Feedback. Add Xcode c and c++ header files to Spotlight. Parthenon Renderer. Using Subversion With XCode. RAW storm in a teacup? Dave Coffin interviewed. If anyone understands the ins and outs of RAW, it's Dave Coffin, he has reverse engineered the RAW formats of almost every digital camera on the market and provides his code (dcraw.c) freely for anyone to use. He recently posted a note on his web page pointing out that the encryption of metadata (in the current Nikon vs.

Adobe situation) is nothing new and that it's fairly common for manufacturers to apply some kind of protection to their RAW formats. We decided to ask him some of the questions this information raises and also those which have been asked by our readers. Click here for Dave Coffin's "dcraw.c" page From Dave's page (talking about metdata encryption): A note about metadata encryption A firestorm of controversy recently erupted when Thomas Knoll of Adobe accused Nikon of encrypting the white balance data in the D2X and D2Hs cameras, thus preventing Adobe from fully supporting these cameras. Dpreview.com interview with Dave Coffin 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. GLIntercept. GLIntercept is a OpenGL function call interceptor for Windows that will intercept and log all OpenGL calls. Basic usage Select the version of GLIntercept right for the application being debugged (x86 or x64) - Note you select the version of GLIntercept based on if the application is x86 or x64 (64bit) - not if the operating system is 64 bit.

Then after installation, simply copy the opengl32.dll and a gliConfig.ini file from the install directory to the executable folder of the application you want to intercept OpenGL calls. Then edit the gliConfig.ini file, enable the options required and then run the application. How it works GLIntercept works by overriding the call to wglGetProcAddress, wrapping the real function pointer in some assembly and then returning it to the application being debugged. This means that when new OpenGL extensions/versions are released, GLIntercept will automatically log the new functions. History Main GLIntercept features: Similar OpenGL tools to GLIntercept are: tracy. Design Patterns. Dictionary of Algorithms and Data Structures.

BrookGPU.