Getting Titanium CurrentWindow To Work Under CommonJS

Appcelerator is a moving target, developed and changing pretty fast. The old way was using the **url: ** property of a window to open up a new screen with a javascript screen. Old and Busted var window = Ti.UI.createWindow({ url: 'screen.js' }); Another Old Way Then came the Tweetanium structure, while a solid way to set up, it’s not the route Appcelerator is recommending anymore. See my post for more information on the Tweetanium Setup

Improving my Vim environment with ctags and Tagbar

I love Vim. There is something about it. Most people that “try” Vim, hate and wonder what all the fuss is about. If you force yourself to learn it, customize your environment and start using it, you’ll want to use it for all your text editing needs. Here are few more improvements I’ve installed today.   Tagbar Tagbar allows you to see inspect the current file listing the properties and methods in that file.

Programmers should be lazy, but not at the expense of user experience

Has this every happened to you. A form wants you to enter in your phone number… OK, let’s be honest, there are 20 different ways you can enter in your phone, but as far as a computer is concerned it’s just interested in the numbers. So that means stripping out the non-numeric characters is trivial…. So why do so many sites do like this stupid site…. make you enter in a phone the way THEY want you.

Getting AngularJS and Zend Framework POST to play nice

I was simply posting data to the server using this code $scope.submit = function() { console.log($scope.newTitle + ' is the new title'); $http({ url: '/api/idea/method/add', method: 'POST', data: { title: $scope.newTitle, description: $scope.newDescription }, headers: {'Content-Type': 'application/x-www-form-urlencoded'} }) .success(function(data, status) { }) .error(function(data, status) { }); }; But I was getting a JSON object submitted and therefore using Zend’s _getParam('title') could not pick up the title in the post.

Appcelerator Titanium Twitter Birdhouse Failing because of HTTP

This problem caused me much angst and it’s partly Twitter’s fault (just ask me). I’m using the great Titanium library for Twitter called Birdhouse. It does a great job requesting authorization, storing it, and gives you an API to post tweets. So I was using this code to post tweets using Birdhouse. this.tweet = function(message) {'Im about to post to twitter:');; BH.api('', 'POST', 'status=' + escape(message), function(resp) { Ti.

MVC for Appcelerator Titanium (understanding Tweetanium)

Tweetianium builds it’s own namespace that it operates under rather than calling code that looks like the following to open up a new window. Ti.UI.createWindow({url:‘somefile.js’, importantdata: mydata }); This essentially uses different files to open new windows, it’s managable to point, but I had trouble with not having some sort of global variables I could call on. In walks Tweetanium and Struct These keep the entirety of the code in basically a namespaced object.

Doctrine ODM MongoDB using an OR query

This is no where in the documentation that I could find on Doctrine’s site. I wanted to do search with a criteria of OR. For example, in psuedo code Find all Events where (first_name like ‘Jim’) OR (last_name like ‘Jim’) OR (title like ‘Jim) I searched, but the keyword of “OR” with Google doesn’t yield very good results. Thanks to Jamie Sutherland at Here is how it’s done $result = $this->_dm->createQueryBuilder('HOD\Model\Person'); $result->addOr($result->expr()->field('firstName')->equals(new \MongoRegex("/^{$query}/i"))) ->addOr($result->expr()->field('lastName')->equals(new \MongoRegex("/^{$query}/i"))); return $result->getQuery()->execute();

Performing a 'like' match in MongoDB

So looking through the Doctrine ODM docs on Query Building, I didn’t see anything that lent itself to a like query such as that is found in MySQL. There isn’t a like, option, but using Regular Expressions will work just fine for me. $queryBuilder-field('title')-equals(new \MongoRegex('/keyword/i')); That will perform a case-insensative query for the term ‘keyword’ in the field ‘title‘ Resources

Thoughts on Zend Framework & Doctrine 2 Design

I usually structure my Zend Framework projects like the image on the right. This comes almost straight from the ZF documentation for recommended project structures I’ve been stressing using PHPunit more and more in my projects and endevour to include tests for all my classes. When you are connected to a DB, it’s harder to test, but with the help of the Doctrine2 workflow, I think I’ve found a nice way to keep DB updates out of my Unit Tests.

Converting Audio to a CCK FileField content type for Drupal 6

This is the script I used to convert our Audio content type to CCK FileField content type.   I created a content type called podcast Copy the following script to a file convert.php and place it in your website’s DocumentRoot Run the script by going to your website Done… now the audio nodes show be podcast nodes and will work. For extra fun, I’ve added SWFTools Resources This was of limited help http://geeksandgod.