Category Archives: Development

Hacking the Hue →

Brandon Evans has developed a tool to control Philips Hue lights with Siri.

My Product Feedback →

MG Siegler:

The PC is over. It will linger, but increasingly as a relic.

If you are building an application create the mobile version first.

iPhone 5 and iOS 6 for HTML5 developers →

Max Firtman:

Safari on iOS 6 is a big step for HTML5 developers; debugging tools, new APIs, better JavaScript performance. However, I must say that Apple is still forgetting about documentation updates and properly communication with web developers. There are almost no answers on the discussion forum, no updates on the Safari documentation (some docs are really too old right now).

I believe Apple must do a better job supporting web developers.

This is not only Apple, just try to get support if you are developing something with a Google API. The documentation is often a pain in the ass and it can take a week until they answer questions in the forums.

If you want developers to use your tools, libraries, APIs or platform you should make great documentation and provide good and fast support. Especially if you have a pile of cash in the bank.

Introducing the Command Bar →

Steve Smith:

At GitHub, we use the command line every day. From git commands to script/server, we love the power it offers. This got us thinking, “why can’t we do that with github.com?”

You can use the Command Bar to follow people, browse repositories and issues and much more. Great feature.

Ecosystems

There are a lot of reasons why I won’t abandon the iOS platform in the near future. For one, I think the hardware is the best currently available to buy. It’s not about the specifications, but that the phone feels great when you hold it in your hand. Another reason is that I like iOS more than I like Android or Windows Phone. However, the main reason why I prefer my iPhone is its ecosystem. Even if the hardware and the software of Android devices gets improved I couldn’t switch as long as all the great apps I use on a daily basis are not available on Android. This post is not about Apple and the iPhone, it’s about programming languages.

Some months ago I decided to learn Ruby. For the previous 13 years I have done most of my development in PHP and at least in the last three years I became more and more jealous of Ruby developers. Nearly on a daily basis I would find great Ruby libraries and as I digged deeper, I realised that the Ruby community were more active on Github and Stack Overflow, that the blog posts about Ruby development are often better written and understandable than those about PHP development and that the this is also true for the documentation of software and libraries.

Libraries, documentation and support is what makes a good programming language great. The greatest programming language will fail if there is no ecosystem around it just like a mobile operating system will fail without an ecosystem.

After the feeling that I should learn Ruby and use it as my main programming language for my private projects grew for a long time, I finally ordered two books about Ruby and started reading them. However, around the same time I started a new project, Tvst, and I decided that I would use PHP one last time. I choose Symfony2 as framework since I heard a lot of great things about it, and I even contributed a little bit of code for the Forms framework during a semester project some years ago. As I worked with Symfony2 I quickly learned that Symfony2 had already gathered a massive community around it and that there are a lot of great bundles and libraries. I realised that the state of the PHP community had improved a lot in recent years. There are many great blog posts and Stack Overflow answers available and the amount of useful Symfony2 bundles and the state of its documentation is sheer astonishing.

Additionally with Composer there is finally a great package and dependency manager for the PHP world. PEAR was always a complete mess and I hated dealing with it, and while Composer still has some problems, it’s a gigantic step in the right direction and is definitely comparable with RubyGems.

Currently I’m still reading the first of the two Ruby books, but I have also started working on two new projects using Symfony2. I still want to learn Ruby, but I will continue to use PHP as programming language for my private (and also professional) projects in the near future.

Additionally I try to participate more in the PHP and Symfony2 community in order to improve it even more. If I want to take from that great community, I should also give something back. Yesterday I released my first real bundle for Symfony2. Bootstrap for Symfony2 brings Twitter Bootstrap to Symfony2. I use it for all my new projects to quickly create a prototype. Using Twitter Bootstrap allows me to spend more time on writing actual code and less on designing and developing the front end.

If you are interested, you can take a look at the documentation or the project on Github or Packagist:

Spring Roo, MongoDB and CloudFoundry on Mac OS X

For an university project I currently need to develop an application in Java using Spring Roo and MongoDB which should be deployed to Cloud Foundry. Spring Roo is tool for rapid development in Java and Cloud Foundry is a Platform as a Service (PaaS) provider. In order to be able to deploy applications on Cloud Foundry, you need to create an account. It will take some time until it is activated, thus you should signup now.

Since installing the required components on OS X 10.7 is not as easy as the tutorials and getting started guides suggest, I decided to write down what I did to get it all working.

I will be using Homebrew to install components. If you haven’t installed it yet, you can do that by executing the following line in Terminal.app:

/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"

I will be deploying my app to Could Foundry and therefore my application will not be executed on my notebook. However we need Spring Roo to generate the project, entities, packages and so on and we need the command line tools of Cloud Foundry to be able to upload our application and start, restart and stop it. I am not sure if MongoDB must be installed on the local machine, since I had it already installed. If an error pops up during the installation or configuration of Spring Roo you can easily install MongoDB using Homebrew.

brew install mongodb
sudo mkdir -p /data/db

If required, you can start MongoDB:

sudo /usr/local/Cellar/mongodb/2.0.5-x86_64/bin/mongod

Next we need to install Spring Roo:

brew install spring-roo

When the installation is finished we first need to navigate to the folder where we want to create the project in and than we can start the interactive command line tool of Roo:

mkdir -p ~./playground/roo-mongodb-cloudfoundry-howto
cd ~./playground/roo-mongodb-cloudfoundry-howto
roo

You are now using the Spring ROO CLI, which can be used to generate projects, entities, execute actions and so on. If want to return to Bash you just need to type exit.

project --topLevelPackage playground.usermanager

The Roo CLI has autocompletion built in, so you could type proj and then hit TAB to complete project. This also works for arguments.

Now we need to setup the MongoDB data store and the generation of the required MVC classes for our web interface.

mongo setup --cloudFoundry true
web mvc setup

We can now already start to create the entities:

entity mongo --class ~.domain.User
field string --fieldName name --notNull --class ~.User
field string --fieldName password --notNull --class ~.domain.User
repository mongo --interface ~.repository.UserRepository --entity ~.domain.User
service --interface ~.service.UserService --entity ~.domain.User

For this example I created an entity User with two string fields name and password as well as a repository and a service class. Since I only want to explain how to set things up this will do for our example.

It is time to package our little application.

web mvc all --package ~.web
perform package

When the perform package is executed for the first time this will take a while. It will be much faster in subsequent calls.

Since we are done with Roo for the moment we exit the Roo tool with exit and will now deploy it to Cloud Foundry.

Spring Roo has an Cloud Foundry add-on, however it does not work with the latest version of Roo and I did not want to manually install an older version of Roo so I decided use the tools provided by Cloud Foundry.

First of all we need to install the Cloud Foundry CLI tool using RubyGems.

gem install vmc

Hopefully your account on Cloud Foundry is activated by now, since you need to login:

vmc login

You have two possibilities to deploy an application. The easier one is to directly deploy your application to Cloud Foundry, the other one is to deploy it to a virtual machine on your local computer. The later is called Micro Cloud Foundry and you will find instructions on how to set it up after you logged in on Cloud Foundry.

Next you need to define the target of the deployment. If you decide to deploy directly to the public cloud you need to do:

vmc target api.cloudfoundry.com

If you rather want to deploy to a Micro Cloud you need to do: (of course you need to insert the name you choose for your Micro Cloud in that command)

vmc target api.[--INSERT-YOUR-DOMAIN--].cloudfoundry.me

However, I did not try deploying to a Micro Cloud so I can guarantee that it will work just out of the box.

Since Roo created the package in the ./target directory we first need to switch to that directory before we can push the application to the cloud. Before we push we need to create a new MongoDB service.

cd ./target
vmc create-service mongodb mongo-howto
vmc push

An interactive dialog pops up, which you need to complete in order to deploy your application to Cloud Foundry. It is important that you bind the service you created above (mongo-howto) to your application. This is how it looked liked for me:

Would you like to deploy from the current directory? [Yn]: 
Application Name: howto-wa 
Detected a Java SpringSource Spring Application, is this correct? [Yn]: 
Application Deployed URL [howto-wa.cloudfoundry.com]: 
Memory reservation (128M, 256M, 512M, 1G, 2G) [512M]: 
How many instances? [1]: 
Bind existing services to 'howto-wa'? [yN]: y
1: mongo-howto
2: mongo-opm
Which one?: 1
Bind another? [yN]: n
Create services to bind to 'howto-wa'? [yN]: 
Would you like to save this configuration? [yN]: y
Manifest written to manifest.yml.
Creating Application: OK
Binding Service [mongo-howto]: OK
Uploading Application:
  Checking for available resources: OK
  Processing resources: OK
  Packing application: OK
  Uploading (5K): OK   
Push Status: OK
Staging Application 'howto-wa': OK                                              
Starting Application 'howto-wa': OK

If everything was ok, you should now be able to open the Application Deployed URL you defined in the push dialog. Please note that I probably delete the application I deployed at some point. Therefore instead of linking to the URL I will post some screenshots of the resulting application below.

Whenever you change something in your application and want to redeploy it, you first need to regenerate the application in Roo:

web mvc all --package ~.web
perform package

Then you need to update the application on Cloud Foundry.

cd ./target
vmc update

That’s it.

Spring Roo on Cloud Foundry: Index

Spring Roo on Cloud Foundry: Create

Spring Roo on Cloud Foundry: List

I am aware that there are Eclipse plugins for both Spring Roo and Cloud Foundry. However, I abandon Eclipse, NetBeans and all other IDEs some time ago and I am currently using Sublime Text 2 and have no plan of switching back to an IDE. Therefore I decided to use the command line tools.

Designers and Developers

Bastian Allgeier:

For an interface designer, handing over your designs to the developer means losing control of the creative process. Of course, you will be working together on the project and communicating back-and-forth, but it will never result in a creation that is all of your own. In other words, you will never be independent in your creativity.

I am currently implementing the new layout of Web Adventures and I thought about using Bastians Kirby. Ultimately I decided to stay with WordPress since the code of Kirby is shit. Kirby is a great idea, but I would not be able to work with its codebase.

The main problem here is that these people don’t understand the difference between being able to combine some if, while and foreach statements to have a working program and the actual process of software engineering. Combing if, while and foreach is the easiest part of the development process. The hard part is writing maintainable, understandable and extensible code. Each line of source code gets written one time but different people read it dozens of times. In any serious software project you will spend more time on architecture, testing and documentation than actual writing code. I am studying Software Engineering now for ten semesters and I can tell you that writing code is only a very small part of it.

And the other problem is: If the designer is also the developer he can implement whatever he designed. Even if it is bullshit. A developer has a different background, a different perspective and he can provide some kind of additional quality control. Of course the designer will also provide quality control to the developer.

While it may helps if the designer has some basic programming knowledge, the designer should not be the person implementing it. It also helps if the developer has some design skills and a sense for good design, but he should not designing. Team work is often hard, but its worth it.

Koding is a Cloud-based Development Environment

Koding

Koding provides a cloud-based development environment (via UARRR). It is currently in private beta and I hadn’t had a chance to try it out, but I’m thinking a lot about moving my development environment into the cloud.

However, I do not mean to move the actual editing part to the cloud, but rather I want to store my code on a server, which also runs my development server. The server is, of course, private and only I can access it and I want to use it solely as a development environment. When I want to work on a project, I want to ssh into that server, mount the servers file system in my local system and continue to use Sublime Text 2. If I’m finished coding I still would push it to another Git server and I would also deploy it to another server.

The main advantage I see in this approach is that I would be able to access my development environment from nearly every computer in the world. Even from an iPad or an iPhone. I probably would still need my notebook for the main development, but then I would at least be able to do a quick bug fix when I don’t have my notebook with me.

We have seen some incredible amazing stuff you can do with JavaScript nowadays, but I don’t believe that a web-based editor can replace a desktop editor any time soon. Please proof me wrong, but I think there are some fundamental flaws in web-based editors. First of all, my screen is not that big, I don’t want to waste space in my editor for browser chrome. I want to have the chrome when I’m browsing, but I don’t need to have when I’m sitting in front of the same window for several hours. The second big problem are shortcuts. If your editor is browser-based you loose a lot of easy to activate shortcuts. You would not be able to press Cmd+S to save the document (if you do not want to override the browser default) or duplicate a line using Cmd+D. I hate it when I’m writing an article in WordPress and want to save it by pressing Cmd+S but that doesn’t work. That would be even worse when I’m writing code. Browsers were made for browsing the web, not for writing long texts or code.

If you should be able to create a web-based editor that is comparable to Sublime Text 2 or TextMate and put it in a custom browser chrome (no waste of screen space, no useless shortcuts) sign me up. I definitely want to see that.