• 20Jun

    Well since I had to figure this out being that Java 5 isn’t in in default Ubuntu 10.4 Lucid Lynx I might as well post how for those also trying to build Android on Lucid.

    Well, you know the deal, start up a terminal. Then run the following.

    sudo nano /etc/apt/sources.list

    Then add the following to the bottom.

    deb http://cz.archive.ubuntu.com/ubuntu jaunty-updates main multiverse

    Hit CTRL O and ENTER to save and CTRL X to return to the command line. Now lets get the repo packages cached onto your box using the following command.

    sudo apt-get update

    Lastly install Java 5 SDK and all the other little packages needed to build Android with this command.

    sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind

    Well the rest beyond the scope of this tiny tip can of course be found here.

    http://source.android.com/source/download.html

    Tags: , , , , , , ,

  • 17Jun

    Awhile ago there was a great little to solution to this at http://kolodvor.net/2007/11/23/disabling-sessions-in-rails/.

    Sadly this is now deprecated. They say it is because sessions are now using lazy loading so if you never use it there will never be one created. However I didn’t use it and still ran into the problem that solution corrects.

    So when they say lazy loading it doesn’t mean per client/browser. So if you are starting to build a REST API using scaffolding and use the HTML based new/edit actions and then go to a REST testing tool to do an action in the way it would be used as an API you will get this error because the initial browser accessible parts of your rest scaffold (which should b has loaded sessions for e thrown away at some point) loads sessions the entire time your web app/service runs.

    So there is no need to use session :disable => true or any other method. It just means you have to restart your app if you happened to use it in a way  similar to how I describe.

    In the end it is one of those little “gotchas” that people who code in nothing but Rails everyday would only know. So for the rest of us who are lucky enough to be able to choose the right tool for the job hopefully this little morsel of info will help.

    Even though some say any tool aka language is good for every job and other absurd statements along those lines. Until I can go code a video card driver in Lua, I’m not buying it, but I think it’s best to leave that topic for another day.

    Tags: , ,

  • 20May

    PocketIgniter is simply a rapid mobile development tool which exists as framework although a better way to describe it is a series of hybrid template projects someone can using to rapidly kickstart mobile development using both the power of a native SDK and the simplicity of developing rich interactive static web applications using services for its data rather then using output generated by server side code since both methods are just as capable but the service approach provides much more flexibility regarding the immense amount of stack configurations that can be used to deliver the data through a standardized format such as XML or JSON. It even includes a full fledged sample project which does exactly this.

    This tool is already in use for apps in the iPhone App Store which came about through the partnership of a small open source organization, Tensai Labs and an recently listed Inc. 500 company Cities2night LLC.

    The focus of this will continue to be on the Android and iPhone based devices as the other big players are currently in flux and have no clearly defined aspects to these changes. As they begin to take shape into what the consumer mobile world expects they will then be worked on.

    download it here.

    Tags: , , , , , , ,

  • 18Apr

    As with most APIs the first thing you need to do is head over to http://www.bing.com/developers/createapp.aspx to create an ID to access it. Then go to http://code.google.com/p/json-framework/ to grab the JSON framework and add the JSON folder into your Xcode project, preferably in the Classes group.

    Now we need a method to call the API over HTTP which can be done with the following.


    - (NSString *)stringWithUrl:(NSURL *)url
    {
    NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url
    cachePolicy:NSURLRequestReturnCacheDataElseLoad
    timeoutInterval:30];
    // Fetch the JSON response
    NSData *urlData;
    NSURLResponse *response;
    NSError *error;

    // Make synchronous request
    urlData = [NSURLConnection sendSynchronousRequest:urlRequest
    returningResponse:&response
    error:&error];

    [urlRequest release];
    [response release];
    [error release];

    // Construct a String around the Data from the response
    return [[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding];
    }

    Now to work with the JSON response we make sure we can access the JSON framework by placing this line with your other import directives.

    #import "SBJSON.h"

    The following method will return a NSArray of NSDictionary results.


    - (NSArray *)getResults:(NSString *)serviceMethod
    {
    SBJSON *jsonParser = [SBJSON new];
    NSError *error;
    NSURL *apiCall = [NSURL URLWithString:serviceMethod];
    NSString *jsonDocument = [self stringWithUrl:apiCall];

    NSDictionary *jsonObject = (NSDictionary *)[jsonParser objectWithString:jsonDocument error:&error];

    NSDictionary *response = (NSDictionary *)[jsonObject valueForKey:@"SearchResponse"];

    NSDictionary *results = (NSDictionary *)[response valueForKey:@"Phonebook"];

    NSArray *resultsArray = [results valueForKey:@"Results"];

    [jsonParser release];
    [error release];
    [jsonDocument release];
    [jsonObject release];
    [response release];
    [results release];

    return resultsArray;
    }

    Finally a simple example of its usage.


    NSArray *results = [self getResults:@"http://api.search.live.net/json.aspx?sources=phonebook&Appid=YOUR APPID&query=schools&Latitude=39.949535&Longitude=-75.143814&Radius=2.5&Phonebook.Count=8&Phonebook.Offset=0&Phonebook.FileType=YP&Phonebook.SortBy=Distance"];

    for(NSDictionary *result in results)
    {
    NSLog([result valueForKey:@"Title"]);
    }

    Tags: , , , ,

  • 19Mar

    Seems I spoke to soon when mentioning using the Cygwin Unix/Linux layer to handle issues such as native extensions. I’m sure most are aware of the Ruby Installer. While it comes with Ruby Gems it did not help when dealing with building native extension such as the MySQL gem. However they also offer a “devkit” which provides just what is needed for building native extensions on Windows. This is unlike the “includes the kitchen sink” approach of my first howto. Although there are some instances where they will call out for common Unix/Linux tools so for some the Cygwin approach may be the better option.

    First thing is to download the installer for 1.8.6. Sadly 1.8.7 would constantly crash mostly when using WEBrick. Make sure you select the checkbox to add the bin folder to your path when installing. Now you want to download the zip for the “devkit”. You simply take the contents of the zip and drop them in the same folder you installed Ruby to (it is always best to install to a path without spaces such as c:\cygwin or c:\users\username\apps\ruby).

    Lastly pop open a command prompt to install the essentials gems. Use the command below.

     gem install rails mongrel mysql activesupport --include-dependencies 

    Now you have everything you need to easily work with Ruby on Rails in Windows in a manner which is more native and lighter then the Cygwin approach.

    Tags: , , , , ,

  • 10Mar

    Ok, I covered Ubuntu, but lets be real, more Ruby on Rails development happens on a Windows workstation just as everything else is. Albeit there is not that much more when it comes to this community of developers.

    However, it is harder to develop in Rails then the other platforms. Yeah we have all sorts of installers for Ruby and the likes however you will run into many issues due to the lack of common Unix based compilation tools and utilities commonly found on Linux and OS X. For the most part there are 2 installers commonly found. The RubyInstaller and Ruby-Win32. Neither of these will provide you an environment for every Ruby development situation.

    The solution to these problems is Cygwin, a compatibility layer (DLL) for all the standard calls made in a Unix-like (Posix) application and already has nearly every application recompiled for this layer. Ok, I know some may be a bit confused at this point. So to put it simply head over to cygwin.com, download the installer and do a coplete install of all packages (comes to about 2GB) to ensure you will have everything you need.

    By default (which I suggest you keep itt that way) will install it to c:\cygwin and add various start menu shortcuts to various terminal, I suggest minytty. You home directory will be located in c:\cygwin\home\yourcurrentwindowsusername and the Ruby executable will be in c:\cygwin\bin so you’ll want to add that to your path and the installed interpreter settings of your IDE.

    Now you’ll need Ruby Gems and extract it into a folder in your Cygwin home folder, cd into it via minytty and run the ruby setup.rb command. From here you can run all gem install commands needed. Don’t fret, just copy and paste (via right click into minytty) the line below.

    gem install rails rake rack activerecord actionpack actionmailer mongrel daemons ruby-debug-base ruby-debug-ide sqlite fastthread linecache cgi_multipart_eof_fix

    Now, for those using MySQL, which I am sure many are you will need to download the source package and extract it into your Cygwin home, cd into the extracted folder and run the following commands.

    1. ./configure –without-readline CFLAGS=-O2 (thanks Phaseshift)
    2. make
    3. make install
    4. gem install mysql

    There you go. Now you have everything you will need to develop for Rails in Windows. Well, except for an IDE. I suggest RadRails.

    Tags: , , , ,

  • 07Mar

    No matter what platform you are on installing Rails can be a bit tricky and there are many ways to do so. Here I will outline what I have found to be the most effective approach.

    1. open up a teminal and run sudo aptitude install ruby ruby-dev rubygems rails mongrel libgemplugin-ruby  libsqlite3-ruby libmysql-ruby1.8 git-core libgit-ruby1.8
    2. Then issue this command sudo gem install cgi_multipart_eof_fix fastthread linecache ruby-debug-base ruby-debug-ide

    You’ll notice many gems were installed via APT.  The purpose of doing so is the same purpose as to why APT exists, to avoid the troubles compiling things on your own and even though gems have their own package manager it can only detect gem dependencies which does,t help when it comes to compiling natively, which I am sure some of you reading this are well aware of.

    Well pretty easy since both package managers allows for installation of many through a single command.

    Tags: , , , , , ,

  • 07Mar

    As a subscriber of Fogbugz and Beanstalk for my team and a pre-release user I figured I would give my 2 cents on Fog Creek’s new service, Kiln. Now of course nothing is without flaw, it is a matter of whther or not those flaws affect your circumstances more then others.

    As many of us adored SVN and now embracing Git some of us are feeling the pain behind both great application’s. With SVN you have the oh so wonderful tree conflicts and with Git you have an overly complex (think designers) usage in comparison to its main competitor, Mercurial.

    Due to my team’s dunamics we would have issues when running into SVN’s tree conflicts I decided I had to choose another SCM, even if Beanstalk’s founder is on my employer’s board. Of course none of these problems relate to a service using such technologies, it is the technologies. So with that in mind I was going to bring it in-house under another technology, Mercurial. The reason for not choosing Git was in some areas, at some times, is more complex then it should be and most of all because the difference between both Git and Bazar when compared to Mercurial showed me itt was best for my specific needs.

    At around the same time, Fog Creek was getting ready to release Kiln, a Mercurial alternative to Beanstalk (who also now supports Git and SVN). As mentioned, being a Fogbugz subscriber and the low cost even though I was getting Beanstalk for free due to its relationship with my company I said, hey perfect timing, now I don’t have to worry about maintaining my own Mercurial shared repository along with several added benefits.

    Of course I loved Beanstalk’s activity stream, so Kiln having the same thing is perfect. Also the code review feature was nice to have as well. That and due to the nature of Mercurial they are able to provide a much more intutive interface. Not only that but they built a SCM importer so you don’t have to lose your precious history of your current SCM. That and for Windows users they have a customized TortoiseHg installer with a few added extensions they built to work with the service.

    Being that discussing the SCMs themselves is outside of the scope of this write-up there is not too much for me to write. Only that they also offer a 45 day free trial and if you are already a Fogbugz subscriber it is only an extra $5/mo per user on top of their already excellent cost effective pricing.

    Tags: , , , , , , , ,

  • 05Dec

    The toolkit is a PHP class/library which allows you to resize, crop and watermark images with ease. It is build using PHP GD methods which are available on pretty much 95% unlike, say, Imagick. Grab it here.

    Tags: , , , , , ,

  • 07Nov

    As a PHP developer using CodeIgniter or any other MVC based PHP framework you know that using Visual Studio level debuggers like the Zend Debugger or XDebug doesn’t work well with a system using URI segments rather than query strings. Personally I am a technologically agnostic software/systems engineer and use what tool/platform is right for the job. So being someone who also uses Visual Studio and it’s outstanding debugger (although I wonder if ASP.MVC has problems now too) I find it making me feel like I am walking around blind and in the dark when it comes to knowing what  my code is doing while it is doing it.

    So I forced myself to find some way of achieving this and managed to come close. The only draw back is that I have to define a query string for each session. If  you are using an Eclipse based IDE like PDT, Zend or Aptana you have to change the debugging configuration each time.

    Ok, enough of that, lets get to business.

    1. open the system/application/config/config.php file
    2. change the permitted_uri_characters option to: ‘a-z 0-9~%.:_\@&?=+-’;
    3. change the enable_query_strings option to TRUE.
    4. now add index.php?c=YOURCONTROLLER&m=YOURFUNCTION to the root of the site URL as the starting point of your debugging session.

    So, as you can see, we our now calling the controller and public method to a query string rather than using MVC based URI segments. There are a couple of drawbacks. The one I have found is that it screws up pagination and another stated  in the framework is that some helpers do not work with query strings enabled.

    Of course you’ll want to turn off query strings when not in development and it doesn’t force you to use them when enabled. You may want to revert the permitted characters as well but you do not have to since the additional characters are harmless. It is not the most elegant of methods but if you really need to see what is going on during execution this is the way to go with this framework.

    Tags: , , , ,

« Previous Entries