Posts

Showing posts from 2008

Plone: Reverse Folder Contents in TAL Define

Using TAL, I needed to display the folder contents with dates ascending (newest first). By default context/folderlistFolderContents returns the tuple descending. So I fixed it by using a ternary statment hack, that evaluates both entries/blocks. [code] <metal:fill fill-slot="main"> <metal:main_macro define-macro="main" tal:define="portal_type python:here.getPortalTypeName().lower().replace(' ', '_'); folder_list context/folderlistingFolderContents; folder_list python: (folder_list.reverse(), folder_list)[1]; base_macros here/base/macros; view_template python:'%s_view' % portal_type; <!-- rest of code --> [/code]

Plone: Reinstall Product Button

While creating Plone Products, I noticed that Plone will delete any created Portal objects, once a product associated with it has been uninstalled. Since I created a ZCatalog, which had data in it, I don't want that feature. After marching through the QuickInstaller code, I decided to add a "Reinstall Button" to all the respective products, to prevent uninstallation. In your egg or product code root, simple add: version.txt Directory Structure Example (Python Pkg): myproduct.stuff/myproduct/stuff/version.txt The contents should be: 1.0-alpha build 1 When ever the version.txt is changed it will display the reinstall button. Note: If you add the version.txt file to an existing product, you will have to manually uninstall the Product, then install it again. Otherwise, pressing "reinstall product" will anger the QuickInstaller (very bad). The Fix for angry QuickInstaller: If you manage to click "reinstall product" before you uninstall and install again, sh

Obj PCRE on iPhone

I have been having fun with my ObjPCRE framework and the iPhone SDK. Just drop the contents of this archive in your Xcode project and build. The archive contains the debug libs, for the simulator and the release builds, for iPhone. ObjPCRE iPhone Libraries If you use ObjPCRE for iPhone or anywhere else, please comment.

Custom Grep Format via Python

Image
I really wanted a custom output format for the great grep, I used standard Python to do it. Needs Python 2.4+ GrepOut is the name and grep formatting is it's game. Its free, its BSD. Download Here

Combat the WTF in iPhone Development

I thought I would share some information for those that may be new to iPhone development, or may have forgotten. If you see this: __TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION__ popup during a runtime error, check here: Console.app for a more verbose explanation. Most of the time you will find the WTF.

Google Open Source Blog: Develop with Git on a Google Code Project

Google Open Source Blog: Develop with Git on a Google Code Project Also check out: github.com (free 100MB git repo host)

Find the WTD in iPhone Xcode builds!

I'm an avid iPhone developer and I've been developing with Xcode for Mac OS X a while (about 4 years) now. In all my days I have never seen an error from Xcode (even the crazy ones from objc) so sick and twisted that it takes almost an hour to fix. Luckily this fellow ran into the same issue (and posted it). I wasn't using a button, but a "search bar"; and when I removed it everything built just fine. I don't think IB files like multiple "bars". Oh well, back to hard coding GUIs. [error-message] *** -[UIImage encodeWithCoder:]: unrecognized selector sent to instance 0x44d470 [/error-message] I also learned that Xcode or IB doesn't like "lonely" outlets. Meaning, if you assign an instance to an outlet in IB, you better make sure the instance variable is in the corresponding class file. It will build and launch, but crash with some error like: __TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION__ Fun with WTDs (what the deuce).

Fun With Creating Kate Plugins Using KDevelop

To use KDevelop Kate Plugin Templates: -> Create a project using the respective Kate Plugin template as normal. -> After the build, change line 6 in the created *.desktop file (in your "src" folder) Old: X-Kate-Version=2.2 New (working): X-Kate-Version=2.5 I never knew the *.desktop file only installed the plugin for the target Kate version. The story: During my first attempt at creating a C++ Kate Plugin (used Python [Pate] prior), I noticed KDevelop had a project template for it! It was great all the way up until the 'make install'. Then I noticed my plugin was showing up. Well after about 20mins of following make install paths... I started comparing rc files, with those plugins that were working. Everything looked fine. Then I noticed the lonely *.desktop file, and wow it was the culprit. "Kate Version", must be set to 2.5 (or whatever version you are using). Now on to creating some plugins for the Kate community!

KDE Mime Type Issue

KDE3 freaked out on me recently. If KDE says: "could not find mime type" (application octet-stream) You do: -> Delete '~/.kde/share/mimelnk/application/octet-stream.desktop' -> reboot OR sudo kcontrol -> File associations -> "Add" -> group: application -> type name: octet-stream Now do: happy dance

NSView Screenshots Using Cocoa

While hacking away with the iPhone SDK & Cocoa, I discovered (from Ryan Britton) this code to capture a NSView as a NSImage. [code] NSView *view = self; [view lockFocus]; NSBitmapImageRep *bitmap = [[[ NSBitmapImageRep alloc] initWithFocusedViewRect: [view bounds]] autorelease]; [view unlockFocus]; NSImage *image = [[[ NSImage alloc] initWithSize: [view bounds].size] autorelease]; [image addRepresentation:bitmap]; [/code] ref: http://lists.apple.com/archives/cocoa-dev/2005/Oct/msg00771.html Other references: http://www.cocoadev.com/index.pl?ScreenShotCode