Mar

08

ZF: Creating RESTful Applications

Over the last few days I have been trying to use the Zend_Rest_Controller along with the Zend_Rest_Route to make a RESTful application for an API that I am working on. It is very easy to get things setup with these components and I will cover that now. You might be asking yourself why do I have to use both components, why is it not rolled into one nice component. The answer is really basic and if you look at the source code for the Zend_Rest_Controller you will see that it is solely an abstract class that defines the methods required for use with the Zend_Rest_Route. When your controller extends from the Zend_Rest_Controller it just forces you to implement the indexAction(), getAction(), postAction(), putAction() and deleteAction() methods. Technically you do not have to extend from Zend_Rest_Controller so long as you implement these methods in all of your RESTful controllers. It is good design to extend the class though as it will throw exceptions for developers who forget to add one of these methods. Without the methods the Zend_Rest_Route cannot route the request to the matching RESTful methods.

In order to get started you have to add a method to your Bootstrap file. This method can be named anything you like however it has to start with _init.

Read the rest of this entry »

Development, Frameworks, Internet, PHP, Rants, Raves, Tips & Tricks, Tutorials.

Jan

19

Change in Atmosphere and Technology

Most of you probably do not yet know but I have resigned from Tatto Media and have moved back to Namespace, Inc.. While I am under a confidentiality agreement I cannot state what I was working on at Tatto Media however what I can say is that I was working with the latest technologies such as CakePHP, JQuery, CSS, etc to work on the products that Tatto Media has to offer. Since I have moved back to Namespace Inc I have been reading up on a completely new framework. Most of you are probably thinking oh another PHP framework under your belt… That’s not the case at all. The new framework that we are using is a Java based framework called Wicket.

So far Wicket seems to be a very nice web framework and Java is very appealing to me from a developers standpoint. I guess the good part is that PHP is based on Java quite a bit so picking up the language has been rather easy. I have also applied for an editor account on Wicket by Example so you will find anything I write about Wicket on that site. I may or may not publish the articles on this site as well I am just not sure yet. Regardless I will post something here stating that a new example or article has been posted by me.

Development, Frameworks, Internet, Local, News, Raves, Tutorials, Websites, Work.

Oct

11

Mojo Lists: The Depot Data Source (Part 4)

In this tutorial we are going to cover using the Depot as a data source for a list. We will be expanding on the code written in the previous parts of this tutorial listed below.

Part 1: Mojo Lists
Part 2: Mojo Lists: Using a Cookie as a Data Source
Part 3: Mojo Lists: Restructuring our Code

If you were able to follow along with using the cookie as a data source this is going to be relatively easy for you to integrate into the existing code.

Read the rest of this entry »

Development, Frameworks, JavaScript, Palm, Tutorials.

Oct

03

Mojo Lists: Restructuring our Code (Part 3)

In Part 2 of this series we created the ability to use a cookie for a lists data source. In this part we are going to clean-up our code a bit and try to restructure things so that it is easier to expand on our set of code.

After looking at the code I saw that we created the WBCookie model object that was not very abstract. We wish to keep things somewhat abstract so that the application is not concerned too much about where the data is coming from. We are going to be creating a few files that will be in our lib/ directory and I will explain why we are using them and what they do as we continue through the tutorial.

The first thing I want you to do is open up your sources.json file and add 3 lines at the top. We will want to include the files that we will be creating so that Mojo will know where to find them. Open your file and make it look like the following. Note that I only added the first three lines to this file.

Read the rest of this entry »

Development, Frameworks, JavaScript, Palm, Tutorials.

Sep

21

Mojo Lists: Cookie Data Source (Part 2)

Mojo Lists Part 2In Part 1 of this tutorial we created the base for our application. It consisted of a static list that was displayed when the application was launched.

At the end of Part 1 you were able to build the application and tap on any of the items which would push another scene. In Part 2 of this tutorial we are going to focus on using a cookie as a data source for our list. We will build a list that will display a list based on a cookie’s contents.

When you tap on a list item you will be taken to another scene where you will be able to change the title for the list item and it will be retained in a cookie. I did find an issue with cookies on the emulator and device. There is a known bug that cookies will retain on the emulator and device even after the application is removed. To learn more about this issue and cookies I suggest you read the Working with Cookies tutorial.

We will be continuing with the code that we created in Part 1 so open that application up. We will first be creating a model object that we will use to interact with the Mojo cookie stuff. In your application create the folder /app/lib/ and then create a new file named WBCookie.js and put it in your newly created lib folder. Now you will also have to update your sources.json so that Mojo will know where to find this file. Be sure that your sources.json file looks like the code below.

JavaScript:

  1. [
  2.     { “source”: “app\/lib\/WBCookie.js” },
  3.     {“source”: “app\/assistants\/stage-assistant.js”},
  4.     {
  5.         “source”: “app\/assistants\/main-assistant.js”,
  6.         “scenes”: “main”
  7.     },
  8.     {
  9.         “source”: “app\/assistants\/cookie-assistant.js”,
  10.         “scenes”: “cookie”
  11.     },
  12.     {
  13.         “source”: “app\/assistants\/depot-assistant.js”,
  14.         “scenes”: “depot”
  15.     },
  16.     {
  17.         “source”: “app\/assistants\/sqlite-assistant.js”,
  18.         “scenes”: “sqlite”
  19.     }
  20. ]

Read the rest of this entry »

Development, Frameworks, JavaScript, Palm, Tutorials.

Sep

13

Mojo Lists (Part 1)

At the request of a reader this next tutorial will cover Mojo Lists however it will get quite long so I have decided to break it into smaller parts.

Part 1 (This section) will deal with setting up a static list.
Part 2 will show how to use a cookie as a data source.
Part 3 will be some restructuring of the code
Part 4 will show how to use the depot as a data source.
Part 5 will show how to use an Sqlite database as the source.
Source Code will be posted for download after the series is complete.

On our main scene we are going to show a static list of items. This means that we are going to use an array of elements which will never change over the lifetime of the application. The list item data will be specified by us and not fetched from any data source. The main list will give you options to choose from such as using a Cookie, Depot or Sqlite for the data source. When you tap on one of these options another scene will be displayed that will actually load another list. The data that populates these lists will come from the data source that you specified. This should give you the ability to write your own lists using any data source that you see fit.

The very first thing that you need to do is create a new WebOS application and add a new scene to it called main. Now that we have the main scene created we need to alter our stage-controller.js so that it actually pushes the main-scene on startup. Open the file and make the code look like this.

JavaScript:

  1. function StageAssistant() {
  2. }
  3.  
  4. StageAssistant.prototype.setup = function() {
  5.     Mojo.Controller.stageController.pushScene(“main”);
  6. }

Read the rest of this entry »

Development, Frameworks, JavaScript, Palm, Tutorials.

Aug

17

A Basic WebOS Application and the Depot

A lot of people are trying to understand how to write applications for WebOS so I figured the very first tutorial I would create for this site would be a simple walk-through of creating a very basic application. I am going to go a bit deeper than just a basic application like they cover in the Hello World example. The application created in this walk-through will explain the concepts behind creating a basic application, explaining what each part is and why you have to do it that way. I will also introduce the Depot in this walk-through. Are you ready?

The Tools I Use
Everyone will have their own set of tools that they use and they do not have to be the same as mine, however please note that I am not going to give the terminal commands for pushing the app to the emulator etc. My tools do that all for me and allow me to focus on developing my application.

The very first thing you should install is the Palm Developer SDK which you can get from the Palm Developer Website. For my Editor I use Komodo IDE with the very nice add-on that Templarian has created. If you do not have a license for Komodo IDE you can use the free version of Komodo Edit. You can download the add-on on Templarian’s website and installing is as easy as dragging and dropping on your editor window. The last thing I use is a file that you import into your editor that provides code completion for your editor. You can download this file here. Please note that you want to click the Download link and download the rawmojo.zip file. Installation instructions can be found on the same page. You can ignore the tool-kit as the tool-kit is the ancestor of the add-on.

Once you have these things installed you are all ready to start developing your first WebOS application.

Read the rest of this entry »

Development, Frameworks, JavaScript, Palm, Tutorials.

Mar

18

TeachMeCocoa.com: KVC and Bindings

The other day Steven released another video on the TMC website. This video is all about Key Value Coding and using Bindings in your interface. I finally got the chance to watch the rest of the video this morning and I have to say that it is a great starting place if you are looking into bindings. He goes into detail about KVC and explains how it all works. I do wish however that he went into more details on the magic of Bindings and how they work behind the scenes.

There are many developers (myself included) who have not yet adopted bindings because they see them as some magical functionality. At some point I will have to read deeper about bindings and actually learn how they work so that I can use them properly in my project. I do know how to implement a table view without using bindings and I have to say… Bindings looks *much* easier to do. It was a short process for getting the data into the table view in this video tutorial. When doing all of this without bindings you need to have all the table view methods in place to return the proper data.

This is another good release from TMC so be sure to check out the KVC and Bindings video tutorial if you want to start learning about KVC or Bindings

Development, Entertainment, Mac, News, Raves, Reviews, Tips & Tricks, Tutorials.

Mar

03

TeachMeCocoa.com: Basic C Programming

Steven has released another video tutorial over at TeachMeCocoa.com. This time it is about Basic C Programming. I cannot wait to have some time to sit down and watch this later tonight. I have to give him credit too because I sat down last night and tried to make a screencast and it did not come out nearly as good as his are. The entire recording and editing process takes a lot of time just to create one of these tutorials. I thought just how hard could it be…. Then I tried it.

Thank You Steven for investing so much time into helping others learn to program for the Mac and iPhone. I really appreciate it and hope that others do as well. You are not taking on a small task here with basic tutorials you are doing something great and if there is anything I can do to help just let me know.

Development, Entertainment, Internet, News, Raves, Tutorials.

Technology Blogs Add to Technorati Favorites Page Rank Tool NYPHP Users Group View Joseph Crawford's profile on LinkedIn

   

SEO Consultant SEO services