CakeDC Blog


Felix Geisendörfer - Git and CakePHP

Felix is a huge git fan and Git is a source version control application. It is a command line tool, and there are not many gui tools. Git has a few advantages, it is easier to integrate with other tools. Git also doesn't require a server, allowing you to work locally. Unlike svn there is only one .git folder and it contains the entire project history.

Configuring git

Before using git you should configure git with git config. You should configure your user name, user email and ui.color. Once you have configured git you are ready to go.

Making Commits

By using git add you can add single files, folders, whole trees. You then can use git commit to create a commit and add a commit message. You cannot store empty folders in git. If you have any empty folders you need to put an 'empty' file in the folders. find . -type f | grep -v empty | xargs git rm Felix used the above to clear all the temp files but leave the empty files. This will let you add the tmp directory structure to the git repo and still keep the directories clean.

The importance of SHA1 hashes

All objects in git are identified by SHA1. The SHA1 is used to identify commits, trees, and blobs. I also found it interesting that unlike SVN a git repo is very transparent. The commit SHA1's are actually the filenames in the repo. Although the contents of these files are compressed its nice to know there are files to look at instead of a pile of scary binary blobs.

Using .gitignore

.gitignore can be used to ignore files or paths. You should add files based on absolute paths from your project root. Normally with a cake setup you want to ignore app/tmp as well as your database.php. At this point Felix's excitement for git had to come to an end. His hour was up but I got the feeling that at least a few people had their interest in git increased. With the first day of CakeFest Argentina at a close I'm looking forward to the rest of the talks as today was an excellent start to what is shaping up to a great festival.

Guillermo Nuñez - MicroFormats in CakePHP

When html started being 'designed' presentation and structure muddled together and there was little semantic meaning attached. This html soup was found everywhere, even big sites like yahoo and google. Later styling and content was separated, making maintenance easier and making room to introduce of semantics. And while semantic markup works well for people. It doesn't help the computer understand the syntax and semantics of the information. Only the structure and importance. Web semantics and microformats allows authors to better describe the syntax and semantics of information to help the computers better understand our information. Microformats are part of this semantic solution. They allow the addition of semantic and syntactic information to HTML. As a transition to fully semantic code would be a difficult and lenghty process. There are many different microformats to handle different types of information, such as hCard for people, and hCalendar for events and dates. The use of microformats is invisible to the human user. However, they greatly improve the computers' ability to understand information. Microformats are implemented in a few clients. The operator extension for firefox will allow automatic parsing and retrieval for microformats. Microformats also enhance usability for people with accessibility issues. Guillermo Nuñez then presented a prototype browser / browser plugin that creates additional accessibility links for microformat data, such as adding 'call' button to make a skype call from the browser. In addition to this a helper for creating microformats. As a side note this presentation was done in spanish, and my hat is off to the translation people as it was a very well done and seamless experience for a non spanish speaker.

Nate Abele - RESTFUL CakePHP

Why would you want to create RESTful application interface? A webservice/RESTFUL interface will allow you to create a public interface that allows 3rd party sites to integrate with your applications. RESTful API's allow you to provide open services for your customers. This helps customers by giving them choice in what service they use, and reduces a customer's feeling of being locked into one service. By providing open access to data through webservices you not only benefits your customers, it also benefits you company as well. An open webservice can help attract developers to implement and use your webservice with their application. Webservices are important to developers as it helps reduce the effort and time needed to make applications work, and makes code easier to maintain. Nate compared different RESTful/webservices solutions, covering SOAP and some of the troubles created by its implementation. SOAP's problems stemmed from its heavy XML payload and single point of access. REST was covered next, and Nate extolled the advantages of REST and how it provides more useful information in the headers. This decreases request size and increases the clarity of what is actually being requested. REST also makes it easier to create CRUD api's. REST favours using the existing HTTP methods over creating method calls in your request bodies. And uses all of the HTTP methods to implement a CRUD interface. You can easily add REST funtionality to your application with only a few changes. You need to add Router::parseExtension() and add the RequestHandler to your components. This will enable requests like posts/view/1.xml. You then need to add additional view paths for any other extensions you may need. To allow for alternate views you simply need to add an views/posts/xml directory would enable xml views tied to your xml requests. Using Router::mapResources('posts'); will allow you to make GET/POST/PUT/DELETE requests to posts/1.xml and the appropriate action will be triggered. Issues with scaling were raised in regards to REST api's. CakePHP REST implementation scale very well in a horizontal fashion thanks to the way PHP works. Nate stated that the biggest challenge to scaling are still going to be on the Database and latency side, unlike other platforms.

We Bake with CakePHP