web
jQuery link click href value
Submitted by Thomas on November 2, 2011 - 8:24pmI've wrote these words on google. And I don't find the exact solution.
The problem:
What Should I write in the href? If I write # sign then browser go to the top of page. I wouldn't like to go to the top of page.
Here is the HTML:
<a href="#" id="example" >Click</a>jQuery code:
PHP normalize function
Submitted by Thomas on October 7, 2011 - 12:54pmI post my normalization function. This function find all illegal characters (like: Ő, Ű, ú, í, etc. ) and replace it to latin1 chars. (like: O, U, u, i, etc.) This function works for me on hungarian words. Try it on your text and post your comment about it.
Locomotive CMS
Submitted by Thomas on July 18, 2011 - 9:15pmToday, I found a really good CMS. I'm looking for ruby 3 CMS for a while. I found this CMS solution that use my favorite NoSQL database system: MongoDB. I think multi site feature is rare in ror applications. Locomotive CMS do it.
Locomotive is an open source CMS for Rails 3. It's super flexible and integrates with Heroku and Amazon
Some features from technical Specs:
Resolve Ruby on Rails UTF-8 error message: invalid multibyte char (US-ASCII)
Submitted by Thomas on February 11, 2011 - 1:02pmI got the following error when i run a rake db:seed command on may RoR application:
invalid multibyte char (US-ASCII)
I found the soution and the error has gone away:
You should add a line to your file:
# encoding: utf-8
You can change the utf-8 to any other encoding that you use.
I added this line to my seeds.rb file and all UTF-8 code have been executed without errors.
Rails 3 Content Management Systems (CMS) - 2011
Submitted by Thomas on February 7, 2011 - 7:25pmI've collected all open source CMS based on rails 3.x.
Rails CMS/Wiki/Forum
This is a very simple but feature rich CMS framework. It is good startpoint for a new rails project what will be wiki, Forum or CMS
Source: https://github.com/jlapier/Rails-CMS-Wiki-Forum
Casein CMS
This is a very minimal and lightweight CMS. Only users table created on rak db:migrate. It is a good start point for any content based application. This application scaffolding your rails app with a very beauty user interface.
how to install Ruby on rails webshop?
Submitted by Thomas on February 4, 2011 - 5:52pmYou have installed RoR3 and now you want to install a rails3 webshop.
I think the best solution is Spree. This is the only rails3 based e-commerce solution at this time.
How do you install this shop?
rails new rails3-shop
cd rails3-shopedit Gemfile and add new line
gem 'spree'Install new spree site.
rails g spree:site
rake spree:install
rake db:migrate
rake db:seed
rails serverThe rails server command starts the webrick server. You should go to http://localhost:3000/ to check spree.
How to use function value as default argument value?
Submitted by Thomas on January 11, 2011 - 10:50pmfunction foo($year = date('Y')) {
// this is invalid
}So, how should do it?
define('THIS_YEAR', date('Y'));
function bar($year = THIS_YEAR) {
// this is valid
}HTML number formatting with PHP
Submitted by Thomas on January 4, 2011 - 9:32amHere is my HTML number formatter. Sometimes the browsers wrap the numbers along thousand separator or decimal pont, but this function prevents this event.
function html_number_format($number, $decimals = 2, $dec_point = '.', $thousands_sep = ',') {
if ($number === FALSE) {
return '---';
}
return '<span style="white-space: nowrap;">'.number_format($number, $decimals, $dec_point, $thousands_sep).'</span>';
}Clickable flash banner on HTML page
Submitted by Thomas on November 26, 2010 - 12:45amSee the following code: