Wednesday, October 28, 2009

Mac Android SDK Setup

Android in now in my sights. I am recalling Java, my favorite language when I was 15-16 years old.

The below is a concise guide to installing the Android Development Environment on Mac OS X 10.6 (Snow Leopard).

  1. Download and install Eclipse
  2. Download and extract the Android SDK (which is contains the SDK tools) - http://developer.android.com/sdk/index.html
  3. run `sdk/tools/android` from Terminal.app (it will launch the Android SDK UI) and install SDK components - http://developer.android.com/sdk/adding-components.html
  4. Install ADT plugin - http://developer.android.com/sdk/eclipse-adt.html
  5. Create an Android device (emulator). In the same window from #4, in the left pane, click "Virtual Devices". Then click "New", in the window, change "Target" to Android. Then fill out the other information as necessary.
Don't forget to add the SDK library to Eclipse (from Preferences -> Android)


Thats about it. Anything else is all you.

Saturday, September 5, 2009

Mail.app deleted my subject column!

Like most who prefer a more readable and efficient mail view, you may have used WideMail (or LetterBox) before Snow Leopard. I did, and apparently the Snow Leopard ripped into my plugins and mauled the subject column.

I restored it by deleting a couple nodes from: ~/Library/Preferences/com.apple.mail.plist

#1 Quit Mail.app

#2 double click the plist file and remove:
Root/ActiveViewers
Root/TableColumns

#3 Save the plist and start Mail.app

Subject column is now present, done.

Friday, July 17, 2009

Palm webOS emulator fun?

In my excitement of the release of webOS SDK, I downloaded and installed the emulator. To my surprise I found no instructions on how to use the more advanced features/gestures.

#1 How do you rotate the emulator to landscape?
iPhone emulator: press Cmd + left or right
Palm emulator: ?

#2 How do you perform multi-touch gestures?
iPhone emulator: press Option (Alt) and mouse down.
Palm emulator: ?

If you zoom in on something, best of luck returning it to full view without closing the app.

Wednesday, January 7, 2009

Python SUDS with Windows Authentication (SOAP)

While intergrating Plone with CRM4, I stumbled upon Suds. However, it didn't support NTLM. Then I found python-ntlm, and merged the two libs.

Below is the result.

You can add it at the bottom of suds/transport.py



[code]
class WindowsHttpAuthenticated(HttpAuthenticated):
"""
Provides Windows (NTLM) http authentication.
@ivar pm: The password manager.
@ivar handler: The authentication handler.
@author: Christopher Bess
"""

def __init__(self, options):
# try to import ntlm support
try:
from ntlm import HTTPNtlmAuthHandler
except ImportError:
raise Exception("Cannot import python-ntlm module")
return

HttpTransport.__init__(self, options)
self.pm = u2.HTTPPasswordMgrWithDefaultRealm()
self.handler = HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(self.pm)
self.urlopener = u2.build_opener(self.handler)
u2.install_opener(self.urlopener)
pass # end class

[/code]


[code]
from suds import transport
#>>>
from suds import client
#>>>
from suds.options import Options
#>>>
options = Options(username='DOMAIN\username',
password='password')
#>>>
c = client.Client(url='http://0.0.0.0/mscrmservices/2007/CrmServiceWsdl.aspx',
username='DOMAIN\username',
password='password',
transport=transport.WindowsHttpAuthenticated(options))
#>>>
c
#---

[/code]

Friday, October 24, 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, shame on you. To resolve, simply delete the QuickInstaller from the ZMI, then go to portal_setup, click the "Import" tab, select "QuickInstaller" from the list of profiles, then at the bottom, click "Import All Steps". This will cause all the installed products to go back to the "Products available for install" section, simply tick all the ones previously installed, and install them again.

Tuesday, September 2, 2008

ObjPCRE 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.