iOS, uOS, we allOS

RSS

An Easy Website Host to Deploy Your Ruby On Rails App

If your looking for a cheap and cost effective solution for hosting your up and coming Rails app then you should head over to Heroku.com and check them out. It super easy to get you app up and running and what even better, they have a free tier!

Its similar to Amazon Web Services in which you pay to scale up you application. So when you site starts blowing up you can try expanding easily to support the traffic. 

Getting your site deployed on Heroku is super simple. Sign up and follow the following step by step instructions:

http://devcenter.heroku.com/articles/rails3

Once you done with the setup, deploying to Heroku is as simple as “git push heroku master”!

Just as a heads up you might come across 2 problems when deploying to Heroku. The first is the fact the Heroku does not use SQLite3, instead they choose to use Postgres. This could lead to some problem during the deployment to Heroku so you can either make the switch to Postgres on your local machine or you can do the following in your gem file:

group :production do

  gem ‘pg’

end

group :development, :test do

  gem ‘sqlite3’

end 

On your local machine run the development and on Heroku run in production and that should handle that.

The other issue you might encounter would be getting some weird gem errors during deployment. If this happens I recommend just calling the “heroku create” instead of “heroku create —stack cedar”. Last I read there were some compatibility issues on the cedar stack when deploying your rails app.

Feb 1

RailsCasts.com, a great place to learn more about Ruby on Rails

If your looking for a one stop shop to get tons of help with Ruby On Rails, then I highly recommend this website. It has both screen casts with great examples and write ups for most tutorials that are posted. I recommend making this one of your first stops if you looking for help or want to just learn more.

Rails Quick Tip: ActiveRecord Observers

If you find the need to do some sort of action after a modification is made to your model then maybe using an Observer is right up your ally.

I see observers as an event listener for your ActiveRecord models. It will listen to the model for a specific event and then all the observer method for that specific event. These events I speak of are the Callbacks that are for a ActiveRecord.

An observer class will look like the following:

class NotificationObserver  < ActiveRecord::Observer

    def after_save(record)

    # Do something spiffy

  end  

end

Notification is the ActiveRecord I want to observe and the call back I am listening to is after_save. So if you want to observe one of your ActiveRecords you just have to follow the format of (Your Model Name)_observer.rb as the file name, (Your Model Name)Observer as the class name and then define the method for a callback.

Place this in your Models directory and then you must go into you application.rb file and add the following:

config.active_record.observers = [:notification_observer] # (Your Model Name)_observer

 Here is a good resource to get all the info if you would like and how to observe mutliple ActiveRecords for one observer also, http://api.rubyonrails.org/classes/ActiveRecord/Observer.html

Dec 9

Ruby On Rails Adventure

Because of certain events it look like Ill be starting to learn Ruby on Rails. I have to admit RoR looks like looks like a fun and powerful tool to do web programming and I am going to have a lot of fun and learn a lot in this new career endeavor. 

Links to resources and tutorials will be coming soon to help guide anyone down the path of Ruby On Rails along with the iOS stuff I find along the way.

Core Data Error: “The operation couldn’t be completed. (Cocoa error 1570.)”

Recently I have been getting back to some keyboard smashing and developing an iOS 5 app that I am expecting to release sometime in January. But along my adventure with using Core Data I came across and very interesting error when I was deleting an object from my data store.

 Unresolved error Error Domain=NSCocoaErrorDomain Code=1570 “The operation couldn’t be completed. (Cocoa error 1570.)” UserInfo=0x226720 {NSValidationErrorObject=<Box: 0x286f30> (entity: Box; id: 0x2854c0 <x-coredata://0BD3E53D-DE83-47B5-807D-C034D2B1FB8D/Box/p6> ; data: {

    Category = nil;

    Contents = “<relationship fault: 0x28ca50 ‘Contents’>”;

    List = nil;

    boxName = star;

    isFragile = 0;

    location = trek;

    size = Small;

}), NSValidationErrorKey=List, NSLocalizedDescription=The operation couldn’t be completed. (Cocoa error 1570.)}, {

    NSLocalizedDescription = “The operation couldn\U2019t be completed. (Cocoa error 1570.)”;

    NSValidationErrorKey = List;

    NSValidationErrorObject = “<Box: 0x286f30> (entity: Box; id: 0x2854c0 <x-coredata://0BD3E53D-DE83-47B5-807D-C034D2B1FB8D/Box/p6> ; data: {\n    Category = nil;\n    Contents = "<relationship fault: 0x28ca50 ‘Contents’>";\n    List = nil;\n    boxName = star;\n    isFragile = 0;\n    location = trek”;\n    size = Small;\n})”;

}

Wow that a long error, add if you dont know what going on it can be very confusing. Lets try picking apart the error to see what exactly is wrong.

First notice NSValidationErrorKey=List this is telling us the validation error occurred for my List attribute. When I look back at List attribute for my Box entity I see the List requires a value. Remembering this now I look at the data for the Box object it was working with and I see List = nil; Wow so the reason I was getting the error was the fact the List was set to nil.

Now how did this error happen in the first place? I was trying to delete a List object but there was a relationship between List and Box entities, where a Box had to be a part of some List. So when it came to deleting my List for some reason the Boxes remained and their List pointer became nil which threw the error.

So what went wrong? I mean I deleted my List but the Box objects still remained. The problem was that I wasnt cascading the List delete. Since a Box is required to be part of some List, if I delete the list then all the Box object associated with it should be deleted also. To fix this issue I just have to change the “Delete Rule” for the relationship I have for Box entity inside my List entity from “Nullify” to “Cascade”.

Useful Magneto Tutorials I’ve Found

Here is a couple links to tutorials I discovered during my short time working with Magneto, hope someone find them helpful:

Working With Magento, A Great Open Source Shopping Cart

During my adventure to find a great open source shopping cart I eventually stumbled upon Magento. At the start of my adventure I had came across Magento but made the mistake of over looking it because it seemed way to complicated. But when I finally came back to it I now understand how powerful, flexible and extendable it can be.

Reason why I like Magento:

  • Open Source
  • Well Documented
  • Very Large Developer Community
  • Easy To Make Extensions 
  • Store Full of Free and Paid Extensions

I love that Magento has documentation for almost every aspect of their software. If you cant find something in the documentation you can go to their wiki and poke around. Having hard time finding the information you need to create a new theme or module? Then you can try looking at the free video course, Fundamentals of Magento Development, they offer under Magento U. I HIGHLY recommend watching these videos, you may not understand everything but it will help a lot.

Since the Magento community is so large you will be able to also find tutorials created by others and might even find an extension you have been looking to make already on the market either free or paid.

Take a long look at Magento and figure out if it the right fit for you. But if you plan on creating a custom theme or creating some custom extensions Magento might be the right fit for you to avoid lots of future hair pulling.

Working With CS Cart Shopping Cart Software

When I was looking at several different kinds of shopping cart solutions CS Cart really jumped out at me. It was styled nicely by default and the admin interface was simple to use, there was also was to find documentation. So it seemed like the right thing to go with the would require the least amount of work to stylize and customize.

But after I started to dive into the documentation and really try to implement a custom extension it started to feel that my relationship with CS Cart wasnt the love story I was hoping it would be. Yes it open source, yes there is documentation for creating custom plug ins, but there wasnt enough documentation. The documentation explains how to do the most basic of thing. If you looking to implement a versatile plugin your going to be lost.

CS Cart is great if you just want an out of the box solution but if your looking for something that you want to add a custom plugins and functionality in to you going to be in for a world of hurt.

If you want something highly customizable and well documented I recommend Magento. Ill go into greater detail about Magento on my next post.

New Ideas, New Technologies

Life works out in funny ways. Recently I have been working on a new side project with a friend so I have been looking into new technologies. One of the areas I have been looking into is e-commerce shopping cart solutions and I have to say there are a lot out there. If your looking to start any sort of online store and looking for a customizable solutions it can be pretty crazy looking around. Ill try going over the different solutions I did look at in a later post and talk about my experiences.

Oct 5

List of the type of things you can throw at Siri for iOS