Hi friends,

Just want to post a quick note here to be a troubleshooting guide for my team, I’m getting an error when trying to use CountryType (a dropdown list with country name display and country code as a value).

Got an error like this “Class ‘ResourceBundle’ not found”.

The solution to this issue is just install and enable intl extension for PHP.

As I’m using wamp, it is very easy for me just point and click to enable intl and it will works like a charm.

For CountryType, it is surprising me as it is easier than Ruby gems to have a country dropdown list in my web application.

Cheers,

Tagged with:
 

Just a post to act as a quick solver if you also got the same error as mine.

My environment are…

- A PC which I use to work in day time.

- A Mac mini which I use to work in night time.

I’m working on Symfony2 and trying to integrate the AdminBundle by Sonata and it works quite well last night, in a few minutes, I can add the required submodules of AdminBundle and have the dashboard up and running.

Anyway, after today lunch, I boot up my PC and pull changes from GitHub and I found that my Git submodules didn’t stay on GitHub and it didn’t downloaded into my PC.

So I try to figure out about Git submodule and execute the command “git submodule update” and “git submodule sync”.

Then I got this error…

The bundle “already exists in the index

Actually, to sync or update the submodule, you need to have .gitmodules at your Git root.

So, I created the file with this content.


[submodule "Symfony/src/Knplabs/Bundle/MenuBundle"]
path = Symfony/src/Knplabs/Bundle/MenuBundle
url = git://github.com/sonata-project/MenuBundle.git

[submodule "Symfony/src/Sonata/jQueryBundle"]
path = Symfony/src/Sonata/jQueryBundle
url = git://github.com/sonata-project/jQueryBundle.git

[submodule "Symfony/src/Sonata/BluePrintBundle"]
path = Symfony/src/Sonata/BluePrintBundle
url = git://github.com/sonata-project/BluePrintBundle.git

[submodule "Symfony/src/Sonata/AdminBundle"]
path = Symfony/src/Sonata/AdminBundle
url = git://github.com/sonata-project/AdminBundle.git

Then execute the sync/update again and it will checkout the current version of each submodule into my PC.

Then I just install the assets required by bundles with…


<tt>php app/console assets:install web --symlink</tt>

Hope this help.

Tagged with:
 

If you are working on Symfony 2 with Doctrine and getting stuck on “php app/console doctrine:schema:create” with this error…

Doctrine

DateTime::__construct(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or
the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead

You probably came to the right place!

If you are using MAMP same as me, just modify MAMP’s php.ini file is not enough to fix this error because when you execute php on the terminal, it uses the php from Mac OSX, not the one that came with MAMP.

So, the solution is to create new php.ini file in /private/etc directory with this content inside.


date.timezone = "UTC"

This will do the trick!

Tagged with:
 

As I’m working with Symfony 2 with Doctrine as an ORM and using MySQL as a database.

Symfony

I found this error when trying to create a database using the command “php app/console doctrine:database:create”.

I got “No such file or directory” error message.

After researched, I’ve found that my MAMP is missing one thing…

MAMP

When Doctrine is trying to create a new database, it is finding a ‘/var/mysql/mysql.sock’ which never exists in my system after MAMP installed.

So, the solution is to create a symbolic link to where the actual mysql.sock stay with this command…

“cd /var”

“sudo mkdir mysql”

“cd mysql”

“ln -s /Applications/MAMP/tmp/mysql/mysql.sock mysql.sock”

Then try to run “php app/console doctrine:database:create” again.

It will works! :)

UPDATED:

If you are using Zend Server, you probably found the same error, just do the same but create a symbolic link to “/usr/local/zend/mysql/tmp/mysql.sock” instead of MAMP’s. :)

Tagged with:
 

I believe almost every newbies to Symfony 2 (one of the best PHP framework) is getting this error at the very first time they try to install Symfony 2 into their web directory and browse it.

I also got this error 3-4 times and doubt what’s wrong with it at the starting of project.

Here is what I have done when starting a new project.

  • Copy ‘symfony’ folder into my project folder.
  • Initialize Git using “git init”, “git add” and create “git remove” then “git commit” as the initial commit.
  • Configure httpd(.)conf of apache to create new virtual server at another port, then point the DocumentRoot to ‘symfony/web’ directory.
  • Browse it and BANG! got an error!

Well, if you are facing the same thing with me, you probably 99.99% forget a necessary step like me.

It is…

You forget to execute the vendors(.)php while will download required bundles for your symfony application.

Just bring up a command prompt and execute the command “php symfony/bin/vendors(.)php” and wait for a few minutes and browse your application again.

Yes, it will works now. :)

Tagged with:
 

Even though, I found Ruby on Rails is a very powerful web application framework.

I really love its capabilities which made me able to…

  • Produce works with less code, much less than any competitive frameworks (Symfony, CodeIgniter, Zend Framework)
  • Fun to code
  • Reuse many interesting Gems
  • etc…

However, when I’m dealing with the most recent of my project, I found Ruby on Rails doesn’t fit for my project for sure.

And the only main reason made me switch from Ruby on Rails to Symfony is…

  • Ruby on Rails is so complex to deploy on generic hosting companies. (unless you can afford to use a premium Ruby on Rails specific hosting like Heroku or EngineYard)

Yeah, my recent project will use shorter time to code if I move on Ruby on Rails, however, I can’t accept with the difficulties of deployment because this project will be sold to mass users which doesn’t have enough technical knowledge to deploy Ruby on Rails application easily.

They do not know what is SSH, Nginx, Passenger and so on…

Also, I can’t force customers to use Heroku, even I can, my customers still have to face a difficult time to generate a private/public key using SSH as well.

So, I decide to go back and kick off the project using Symfony which is based from PHP.

Symfony

My point to write here is that each frameworks today can’t be compared, for me, it depends on how the framework fit for my post development strategy.

Yes, I’m using marketing-drive approach.

I’m not saying Symfony is better than Ruby on Rails or any other frameworks.

But it is very fit for my project’s strategy.

If today I have to develop an application to work as SaaS or it is hosted at my server only, I will probably choose Ruby on Rails 70-80%.

Because it is fun and less code for me.

Tagged with:
 

After I’ve research about how to deliver content to subscribers with as low as possible latency.

I found it is great to have some server to store my contents in the primary region of my subscribers.

And the great option I found is to use Amazon S3.

What is Amazon S3?

Amazon S3

Amazon S3 is a storage server let you upload your contents into it and assure you can deliver your contents to the consumer effectively.

Why it is effective?

Because you can specify where you want to store your contents, Amazon S3 have various region of storage server let you choose from and what I expect from region based storage are…

  • Content delivery speed, it would be fastest if consumer is living at the same region of the content right?
  • SEO benefit, do you  know Google love the faster web in their SERP? It is said to be one of the factors.
  • Cost effective, BTW, it is very cheap if you compare to the experiences your consumer getting your contents.
  • Automatically, I can code my web application to store my contents into it. Programmatically.

The alternatives to Amazon S3

If you are looking for alternatives, what I can suggest you to check is Rackspace CloudFiles.

Rackspace Cloud

Anyway, Rackspace CloudFiles is better in the term of its delivery capability as actually, it is fully cloud, it is CDN. (Content Delivery Network)

To make it simple, CDN is very effective for a very large content such as video streaming media.

Also, Rackspace always backup with their fanatical support. However, I never have any emergency issue with my Cloud Server yet.

Anyway, Rackspace CloudFiles have a higher price than Amazon S3, you should visit their page and use estimated cost calculator to estimate your cost.

So, you should decide what’s your primary strategy on content delivery.

Here are links to these services.

Amazon S3

Rackspace CloudFiles

Final words here is, I believe these type of services are totally worth the investment as your consumer will get the great experiences as it can be.

If you are finding a solution to implement file upload or file attachment, you almost landed to the right place.

Here I’m going to share with you how good paperclip is and why I think this is the best solution I found after working on web application development for over 7 years on almost every web platform.

After I’ve learn the basic of Ruby on Rails, I’m finding for a solution on file upload, even though it can be done through a simple HTML tag, it is not scalable.

How is your project if you are planning to move your web application into the world of Cloud?

With the common HTML file upload tag, you can’t scale and move your web application into cloud easily.

The paperclip created by thoughtbot, the creator of many favorite Gems.

thoughtbot

A short features of paperclip are…

  • It handling MIME type, file size, file name into your existing model
  • It can automagically generates a different version of original image with different size
  • You can move your web application into cloud environment immediately
  • Working with generic file storage, Amazon S3, Rackspace Cloud Files or Heroku

Just the above features, I’ve been convinced to look at it over any other Gems such as attachment_fu which I believe it also good as well.

What your only requirement to use paperclip is only the ImageMagick which available on every platform, I’ve set the things up and paperclip working in 10 minutes!

ImageMagick

Here is the quick steps you can follow to make the use of paperclip from you Rails application

  • gem install paperclip

    or using the Bundler by adding this line into your Gemfile

    gem 'paperclip'
  • Install ImageMagick, download it from http://www.imagemagick.org
  • Make sure you have the ImageMagick directory in your environment PATH variable
  • Edit your model by adding this line into it
    has_attached_file :banner

    (change ‘banner’ with your desired members name – This will tell paperclip to add file uploading into this model)

  • Generate new migration and add 4 fields into the table, the code will look like this…
  • class AddImagesToTable < ActiveRecord::Migration
    def self.up
    add_column : offers, :banner_file_name, :string
    add_column : offers, :banner_content_type, :string
    add_column : offers, :banner_file_size, :integer
    add_column : offers, :banner_updated_at,   :datetime
    end 
    
    def self.down
    remove_column : offers, :banner_file_name
    remove_column : offers, :banner_content_type
    remove_column : offers, :banner_file_size
    remove_column : offers, :banner_updated_at
    end
    end
  • Migrate the database!
    rake db:migrate
  • Modify the form tag, add multipart attribute…
    <%= form_for(@post, :html => {:multipart => true}) do |f| %>
  • Place the file upload object inside the form tag
    <%= f.file_field :banner %>
  • Now you can run and upload the file into the model!
  • If you want to render the file, use this piece of code
    <%= image_tag @post.banner.url %>

That’s all the basic sample how to use paperclip, it is surprisingly easy for me.

If you are looking for advanced features of paperclip, visit the project page at Github and you will get everything.

Hope this help.

It is weird to say, but after I’ve employed myself and coding various projects.

I found that I almost moved my resources from what all based on Microsoft technology to the world of open source.

And I found the productivity level still acceptable with a good selection of technologies.

I found the open source application development didn’t as bad as I think from the previous.

Even I’ve many high level of certification by Microsoft on application design, development. (MCPD, MCTS, MCSD, MCAD and so on…) I still quite happy to say that I’m happy entering into the world of open source today.

As my most projects are built as a web application, I mainly moved from ASP.NET MVC 3 to Rails 3.

Even I’ve spent some time learning Ruby, I’m very happy with it, I love Ruby on Rails 3 over ASP.NET MVC 3. Much.

Ruby on Rails was built for high level of productivity in every aspect of it, that’s why I love RoR over ASP.NET MVC.

What I love on ASP.NET MVC is just it gives me control on everything of my web application.

I can hook and customize almost everything in the pipeline with ASP.NET MVC while I can focus on business value more in RoR.

Source code control, while I’m working on Visual Studio 2010, I decide to ignore Visual Source Safe as it will load my time, I’ve to setup the server and else…

While in open source world, I choose Git, and I’m not setting up it myself as I decide to work with GitHub.com and pay them to get some number of private repositories.

It is cool and by far easy to use.

For the coding IDE, nothing can beat the experiences got from Visual Studio. I tried Aptana Studio 3, RubyMine and no one can beat Visual Studio 2010!

While I’ve chosen JetBrains RubyMine as my primary IDE for RoR, I still need to use command-line to complete various things on RoR.

Another note, I really love Ruby Gems, the Bundler things… as I don’t have to find and pay for 3rd party components to integrate into my app, it almost FREE in RoR while in ASP.NET, it have been charged! High price!

Wow, after 3 months of self employed, I found I moved to open source platform surprisingly. I think I should consider to move more on open source world.

Here is my current development environment

My primary machine

  • PC with Windows 7 x64
  • Ruby
  • RubyGems + Rails 3
  • JetBrains RubyMine
  • Git

My secondary machine

  • Mac Mini with OS X Snow Leopard
  • Ruby
  • RubyGems + Rails 3
  • JetBrains RubyMine
  • Git

I’m planning to give my primary PC to my son and getting new iMac with Macbook Pro 17″ for further development.

Good bye to Windows?

- Absolutely no because some of my Internet marketing tools still rely on Windows OS. (Scrapebox – who can live without it?)

- At least, I should have a one copy of Windows on my virtual machine application.

Talk soon,

Tagged with:
 

Hi there,

If you are just beginning with Rails 3 and found some difficulty that made your rails app’s DESTROY command didn’t work for your scaffold views.

I think this is a quick troubleshooting guide with solution to get pass this stupid thing.

Problem #1 : You didn’t included the default Rails javascript files.

- Please make sure you have something like

javascript_include_tag :defaults

or at least

javascript_include_tag 'prototype', 'rails'

- Because the generated view for DESTROY command is based on those libraries and rails is using Prototype be default.

prototype

Problem #2 : Javascript conflicted between Prototype and jQuery.

- Because rails is using Prototype as default javascript library, so, if your view is using jQuery, when you’ve include both jQuery and Prototype, the DESTROY command will broke!

- Good thing is that Rails 3 is allow you to switch from Prototype to jQuery, the most easiest approach I found is to install gem ‘jquery-rails’ via your terminal or using Gemfile.

- After the gem was installed, run the command

rails g jquery:install

This will remove prototype and add jQuery into your project tree, if you are using Git, don’t forget to add those newly added files into your Git.

- Now just include the correct libraries, what I did is…


javascript_include_tag 'jquery.min.js',
'jquery_ujs', ...

The DESTROY command should work now without breaking your jQuery integrated views.

jQuery

Problem #3, missing of <%= csrf_meta_tag %>

Just in case if you are developing new app with new template, you might forget to include Cross Site Request Forgery tag, DESTROY command will not work, all sessions will be cleared without telling you what’s wrong.

This is because you are forgot to include the

<%= csrf_meta_tag %>

in your template.

Hope this help.

Tagged with:
 

Looking for something?

Use the form below to search the site:


Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

reverse phone lookupTattoo DesignsSEO