Tuesday, November 17, 2009
Youtube clone
Hi Friends, If you are a PHP Mysql Developer then this post is exactly for you. You can develop youtube alike site with your existing knowledge. Just goto the phpmotion site at http://www.phpmotion.com/ and download the source and unzip it and upload to the hosting server. Then run that through browser. It asks you the necessary settings, after giving all details the youtube like site owns you. See the demo http://demo.phpmotiontemplates.com/. I used this script for creating media sharing site. It works more than as youtube site.
Friday, November 6, 2009
Googlemap show Directions between two places
Place the below js code in head tag
var map;
var directionsPanel;
var directions;
function initialize() {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(42.351505,-71.094455),12);
directionsPanel = document.getElementById("route");
directions = new GDirections(map, directionsPanel);
directions.load("from:kakinada,india to:Kurnool,india");
}
Place the two divs in html body with ids map_convas, route
Call onload="initialize()" onunload="GUnload()" in body tag.
directions.load("from:kakinada,india to:Kurnool,india");
here you you can also place lat,long pairs in place of from and two address
var map;
var directionsPanel;
var directions;
function initialize() {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(42.351505,-71.094455),12);
directionsPanel = document.getElementById("route");
directions = new GDirections(map, directionsPanel);
directions.load("from:kakinada,india to:Kurnool,india");
}
Place the two divs in html body with ids map_convas, route
Call onload="initialize()" onunload="GUnload()" in body tag.
directions.load("from:kakinada,india to:Kurnool,india");
here you you can also place lat,long pairs in place of from and two address
Some usefull sites for Ruby on Rails newbies
From http://api.rubyonrails.org/
study all activerecord, actionview and actioncontroller classes
Ex: classes -> active record::call backs
which explains what action done before or after creating a record in database or before deleting a record from one table what needs to done in other tables etc
Ruby hashes. Means associatinve arrays in php. Each values is associated with one key like $array=new array(‘color’ => ‘whilte’ , ‘Height’ => ‘6 feet’)
http://www.rubyonrailsexamples.com/category/ruby-hash/
Validation classes and lot more
http://apidock.com/rails/ActiveRecord/Validations/ClassMethods
http://apidock.com/rails/ActiveRecord/Base
All methods and available for active record like save update delete etc
*********************************
Find Some things to look at
http://www.palmcoder.net/?p=265
Tutorials
Rails ajax (Implementing remote call is very easy in RoR)
http://onlamp.com/onlamp/2005/06/09/rails_ajax.html
Link_to_remote with passing textbox value as a parameter
http://onlamp.com/onlamp/2005/06/09/rails_ajax.html
Forum
http://railsforum.com
Check username availablility
http://railsforum.com/viewtopic.php?id=22828
Gems
http://ariejan.net/gems/
http://www.digitalmediaminute.com/article/1816/top-ruby-on-rails-tutorials
Testing
http://www.tutorialspoint.com/ruby-on-rails-2.1/rails-unit-testing.htm
study all activerecord, actionview and actioncontroller classes
Ex: classes -> active record::call backs
which explains what action done before or after creating a record in database or before deleting a record from one table what needs to done in other tables etc
Ruby hashes. Means associatinve arrays in php. Each values is associated with one key like $array=new array(‘color’ => ‘whilte’ , ‘Height’ => ‘6 feet’)
http://www.rubyonrailsexamples.com/category/ruby-hash/
Validation classes and lot more
http://apidock.com/rails/ActiveRecord/Validations/ClassMethods
http://apidock.com/rails/ActiveRecord/Base
All methods and available for active record like save update delete etc
*********************************
Find Some things to look at
http://www.palmcoder.net/?p=265
Tutorials
Rails ajax (Implementing remote call is very easy in RoR)
http://onlamp.com/onlamp/2005/06/09/rails_ajax.html
Link_to_remote with passing textbox value as a parameter
http://onlamp.com/onlamp/2005/06/09/rails_ajax.html
Forum
http://railsforum.com
Check username availablility
http://railsforum.com/viewtopic.php?id=22828
Gems
http://ariejan.net/gems/
http://www.digitalmediaminute.com/article/1816/top-ruby-on-rails-tutorials
Testing
http://www.tutorialspoint.com/ruby-on-rails-2.1/rails-unit-testing.htm
Ruby on Rails Easy Deployment
Actually Ruby on Rails deployment is little bit tricky compare to PHP. PHP programs tend to require less memory to run so they tend to be easier to deploy. With the release of mod_rails and Ruby Enterprise Edition Rails becomes easier to deploy than PHP once the initial Apache add-ons are made. See from below site for full details
http://b.lesseverything.com/2008/8/25/comparing-php-to-ruby-on-rails
http://b.lesseverything.com/2008/8/25/comparing-php-to-ruby-on-rails
Pagination gem for Ruby on Rails
For ruby on rails there is a gem available for pagination called will_paginate to provide pagination to the database results. Process to install this gem to your application.
1. rake gems:install
2. gem sources -a http://gems.github.com
3. gem install mislav-will_paginate
For the first time to install gems package run step 1. If you already run this command no need to run again. step 2 is to append the gems to your rails. Step 3 will install the will_paginate gem to your application.
Usage:
After installed gem successfully follow the below steps to enable pagination to your models.
1. In your config\environment.rb file add
Rails::initializer.run do |config|
config.gem 'mislav-will_paginate', :version => '~> 2.2.3', :lib => 'will_paginate', :source => 'http://gems.github.com'
end
2. rake gems:install
3. In your model, mention how many records display per page
def self.per_page
5
end
4. In your controller, replace
@yourmodels = Yourmodel.find
with
@yourmodels = Yourmodel.paginate :page => params[:page], :order => 'created_at DESC'
5. In your index view, add below to see the pagination
<%= will_paginate @models %>
see http://localhost:3000/models
-----------------------End-------------------------------------------
1. rake gems:install
2. gem sources -a http://gems.github.com
3. gem install mislav-will_paginate
For the first time to install gems package run step 1. If you already run this command no need to run again. step 2 is to append the gems to your rails. Step 3 will install the will_paginate gem to your application.
Usage:
After installed gem successfully follow the below steps to enable pagination to your models.
1. In your config\environment.rb file add
Rails::initializer.run do |config|
config.gem 'mislav-will_paginate', :version => '~> 2.2.3', :lib => 'will_paginate', :source => 'http://gems.github.com'
end
2. rake gems:install
3. In your model, mention how many records display per page
def self.per_page
5
end
4. In your controller, replace
@yourmodels = Yourmodel.find
with
@yourmodels = Yourmodel.paginate :page => params[:page], :order => 'created_at DESC'
5. In your index view, add below to see the pagination
<%= will_paginate @models %>
see http://localhost:3000/models
-----------------------End-------------------------------------------
Thursday, September 17, 2009
Cupcake A forum plugin for cakephp
A plugin called “Cupcake Forum” released for CakePHP. Now you can integrate forum to your cakephp applications within fraction of minutes. The plugin comes with all the basic features of a famous phpbb forum some of which include topics, posts, replies, users, polls, moderators, staff and much more.
Download: http://www.milesj.me/resources/script/forum-plugin
Demo: http://www.milesj.me/forum
Download: http://www.milesj.me/resources/script/forum-plugin
Demo: http://www.milesj.me/forum
Wednesday, September 9, 2009
Sobi2 Plugin
Joomla sobi2 component. Used to develop website with multiple modules, multiple categories, and subcategories and also create entries (Forms) for end users to submit their data to the site. And admin can manage this data and also the end user can edit his own data. It is very useful for developing sites in joomla.
See All About Sobi2
See All About Sobi2
PHP Dynamic Timezones Setting
Some queries work well in one timezone will effected in another timezones. Because timezones are varied from server to server. To overcome this problem you can set the default timezone for the site irrespective of the server time by using the below function.
date_default_timezone_set('Timezone')
here 'Timezone' is the string for example for setting Indian Standard Time it is "Asia/Calcutta", for Los Angels it is "America/Los_Angeles" etc
Ex: date_default_timezone_set('Asia/Calcutta')
Checkout the timezones list at php.net
date_default_timezone_set('Timezone')
here 'Timezone' is the string for example for setting Indian Standard Time it is "Asia/Calcutta", for Los Angels it is "America/Los_Angeles" etc
Ex: date_default_timezone_set('Asia/Calcutta')
Checkout the timezones list at php.net
Tuesday, August 4, 2009
Friday, July 17, 2009
Geolocalization to get lattitude and longitude values
Geolocalization is the process of getting lattitude and longitude values for given address. The code below gives you the lat long values from google for your addresses.
Copy paste options are not working in dreamweaver
In my dream weaver copy paste options are not working. Its gives an erroraneous alert "While executing DWShortcuts_HTMLSource_Find_Replace command in menus.xml, the following JavaScript error(s) occured:".
The solution that i got from somewhere was to basically clear the configurations for dreamweaver.
C:\Documents and Settings\\Application Data\Macromedia\Dreamweaver MX 2004\Configuration
To acertain if this is the case, you can simply test it by moving the configuration folder to somewhere else. If it still doesnt work, simply put it back.
Now my dreamweaver works fine again without having to reinstall it.
The solution that i got from somewhere was to basically clear the configurations for dreamweaver.
C:\Documents and Settings\
To acertain if this is the case, you can simply test it by moving the configuration folder to somewhere else. If it still doesnt work, simply put it back.
Now my dreamweaver works fine again without having to reinstall it.
Encoding and Decoding the strings in PHP
base64_encode and base64_decode functions are used to encode and decode your strings.
Ex code:
';
$encode=base64_encode($str);
echo 'Encoded : ',$encode,'
';
echo 'Decoded : ',base64_decode($encode);
?>
Ex code:
';
$encode=base64_encode($str);
echo 'Encoded : ',$encode,'
';
echo 'Decoded : ',base64_decode($encode);
?>
How to clear file upload field value using js
We can't assign or remove value through js for file upload field. We can remove value only through reset button only.
But we can do it simply as below.
First take that file field in div or any other container tags like span etc.,
and in js give that div's innerHTML as input type="file" name="img". So new file upload element is created within that div.
But we can do it simply as below.
First take that file field in div or any other container tags like span etc.,
and in js give that div's innerHTML as input type="file" name="img". So new file upload element is created within that div.
Thursday, July 16, 2009
About Joomla module
Joomla module is logic with interface which can placed at multiple pages at user defined position of the pages. We can easily make it enable / disable and change it's position at any time.
Example: “online friends” is one module which can be placed in different pages at what ever position we want.
There are so many modules available freely at http://extensions.joomla.org/
You can develop your own module for any of specific purpose and call it in all pages or some of the pages you want.
Example: “online friends” is one module which can be placed in different pages at what ever position we want.
There are so many modules available freely at http://extensions.joomla.org/
You can develop your own module for any of specific purpose and call it in all pages or some of the pages you want.
Subscribe to:
Posts (Atom)