Introduction

Ruby on Rails is an open source web application framework for the Ruby programming language. It is often referred to as “Rails” or “RoR”. It is intended to be used with an Agile development methodology, which is often utilized by web developers for its suitability for short, client-driven projects.

Technical overview

Like many contemporary web frameworks, Rails uses the Model-View-Controller (MVC) architecture pattern to organize application programming.

Ruby on Rails features several tools intended to make commonplace development tasks easier “out of the box”. Rails provides scaffolding which can automatically construct some of the models and views needed for a basic website. A simple ruby web server (WEBrick) and Rake build system are also included. By including these common tools with the Rails framework, a basic development environment is in effect provided with all versions of the software.

Framework structureRuby on Rails is separated into various packages, namely ActiveRecord (an object-relational mapping system for database access), ActiveResource (provides web services), ActionPack, ActiveSupport and ActionMailer. Prior to version 2.0, Rails also included the Action Web Service package which is now replaced by Active Resource. Apart from standard packages, developers can make plugins to extend existing packages. 

 

Ruby on Rails is intended to emphasize Convention over Configuration (CoC), and the rapid development principle of Don’t repeat yourself (DRY).

Recent developmentsRails version 2.2 was released on November 21, 2008. The most notable features specified in 2.2 are an internationalization framework, thread safety, easy access to HTTP caching, compatibility with Ruby 1.9 and JRuby, and new documentation. Users can utilize the most recent unreleased versions, known as Edge Rails. These users are typically more advanced, and are willing to deal with an unstable architecture for access to additional features. 

 

On December 23, 2008, Merb and Rails announced a commitment to work together. The Rails team announced they would work with the Merb project to bring “the best ideas of Merb” into Rails 3, ending the “unnecessary duplication” across both communities

Learn More Ruby & Rail Framework

Installing Ruby & Rail in Windows Platform please follow the link,

http://allaboutruby.wordpress.com/2006/01/09/installing-rails-on-windows-step-by-step-tutorial/

MySql : List of Previous Months

We are going  to see here, listing out the number of previous months from the current month.
Below function will retrieve the list of months depends on the input give by the user. The code is,

DELIMITER $$
DROP FUNCTION IF EXISTS `DEMO_DB`.`month_list`$$

CREATE DEFINER=`root`@`localhost

` FUNCTION `month_list`(numMonths tinyint) RETURNS text CHARSET latin1
BEGIN
DECLARE l_counter int default 0;
declare retValue text;
SET retValue=”;
TestLoop: loop
 if l_counter >= numMonths then
     leave TestLoop;
  end if;
                 
              SET retValue= CONCAT(retValue,MONTHNAME(DATE_ADD(NOW(), INTERVAL -l_counter MONTH)),’,’);
  set l_counter = l_counter + 1;
 end loop TestLoop;
SET retValue = TRIM(TRAILING ‘,’ FROM retValue);
return retValue;
    END$$
DELIMITER ;
Input :
                  SELECT month_list(3);
 

 

Output:
             
March,February,January
 Run the function in your mysql(phpmyadmin) to store the function on any database after that just execute the function as seen above given input.
 

 

PHP : SuperCali Event Calendar

SuperCali is an event calendar script that supports nested categories of events and multiple moderators, making it a good choice for organizations managing a large number of activities. SuperCali is designed to make data entry as easy and error-free as possible as well as provide a flexible, modular framework for displaying event information. SuperCali works with PHP and MySQL and is free, “open source” software released under the GNU General Public License.

  • Calendar Features
  • Quick installation script
  • Nested event categories
  • Multiple moderators and users 
  • Multiple dates for each event
  • Multiple calendar views
  • Drop-down venue and contact selection 
  • Javascript to assist data entry
  • XHTML/CSS output makes it easy for Web designers to customize.
  • Can be configured for different languages.
  • CSV import capability.

The latest version of  SuperCali can download from the below site,
http://supercali.inforest.com/

PHP: Extracting Specified String

This example, we will see how to extract the particular string mentioned in the preg_match first parameter from the selected string https://rafeekphp.wordpress.com/index.html.

The below is the code for the same,

preg_match(“/^(http:\/\/)?([^\/]+)/i”,”https://rafeekphp.wordpress.com/index.html“, $matches);
$host = $matches[2];
echo $host;

 Output is :   
                  rafeekphp.wordpress.com

The second example illustrate the string extracting  “wordpress.com” from the string  $host, the code and output will be as below,

preg_match(“/[^\.\/]+\.[^\.\/]+$/”,$host,$matches);
echo “domain name is: “.$matches[0].”\n”;

Output is:
                            wordpress.com

PHP: Extracting Decimal from String

In this examples, we will see how to extract the decimal values from the string. For example our string  is $string=”Hello World 786.65″ from this extracting the decimal value 786.65 using PHP Preg_Match() function.

The below is the example code of extracting the Decimal from the string,

$string=”Hello World 786.65″;
preg_match(‘{(\d+\.\d+)}’, $string, $m);
$number = $m[0];
echo $number .”<br/>”;

The  Output will be like this,

786.65

phpBB: MOD database

Welcome to the phpBB Modifications Database (MODDB). Here, you may find many MODs (short for “modifications”) for both phpBB2 and phpBB3. All MODs in our database have been validated against the applicable coding guidelines, as well as for a certain level of security.

Here we will see how to include the Smart Feed to our Forum by downloading the SmartFeed phpBB MOD from the below link,

SmartFeed phpMOD

SmartFeed phpMOD

http://www.phpbb.com/search/?q=smartfeed

The smartfeed is depends on the version of phpBB are you installing, so download the smartfeed MOD which is compatible to the your current phpBB version.

The below screen will show you the smart feed.zip for phpBB3,

SmartFeed 1.21

SmartFeed 1.21

After unzipping the zipped SmartFeed  MOD , find the XML file of installation instructions which lists on the unzipped SmartFeed Folder and run the XML in any browser and you will see the instruction like below screen :

STEP1

STEP1

STEP - 2

STEP - 2

STEP - 3

STEP - 3

STEP - 4

STEP - 4

STEP - 5

STEP - 5

STEP - 6

STEP - 6

phpBB: Introduction

phpBB is a popular Internet forum package written in the PHP scripting language. The name “phpBB” is an abbreviation of PHP Bulletin Board. Available under the GNU General Public License, phpBB is free software.

HistoryphpBB was started by James Atkinson as a simple UBB-like forum for his own website on June 17, 2000. Nathan Codding and John Abela joined the development team after phpBB’s CVS repository was moved to SourceForge.net, and work on 1.0.0 began. A fully functional, pre-release version of phpBB was made available in July.

 

phpBB3 is the current stable version of phpBB. Following over three years of development and an eighteen-month beta/release candidate stage, it went gold on December 13, 2007.

Some of phpBB3’s major features include:
 
* Modular design for the Admin Control Panel, Moderator Control Panel,  
    and User Control Panel.
* Support for multiple database management systems, including MySQL, *
* Microsoft SQL Server, Oracle, PostgreSQL, SQLite, Firebird, OpenLink
* Virtuoso, and other ODBC-accessible DBMS
* Support for unlimited levels of subforums
* Ability to create custom-defined BBCode
* Ability to create custom profile fields
* Permissions system

More info on phpBB can get from the below link,

phpBB

phpBB

http://www.phpbb.com/

The latest updated version og PHPBB can download from the below links,

Download

Download

 http://www.phpbb.com/downloads/?sid=0f6853d8fd8df13fe4588e7751ee7c3c

The FREE PHPBB Templates collection on various customization can download from the below site,

phpBB Templates

phpBB Templates

http://www.themesbase.com/?category=phpBB&page=1

Magento : Introduction

Magento is an Open Source ecommerce web application launched on March 31, 2008. It was created by Varien, building on components of the Zend Framework.

Magento is available under the Open Software License version 3.0. Since version 1.1.7 some parts are licensed under the Academic Free License version 3.0.

History

Magento officially started development in early 2007 Seven months later on August 31, 2007, the first public beta version was released.
The German magazine t3n featured Magento in the December 2007 edition.
In March 2008, Magento was selected to present at the Under the Radar: The Business of Web Apps conference,
where it won the audience favorite.
Magento 1.0 was released on March 31, 2008.
Magento 1.1 was released on July 25, 2008. This version provides fixes for many bugs and also makes Magento faster, with more responsive UI.

The latest updates on the Magento Commerce available on the below URL,

Magento Commerce

Magento Commerce

http://www.magentocommerce.com/

The updated Version, Downloader and Sample Data is available in online on the below links,

Version Update

Version Update

http://www.magentocommerce.com/download

The queries and how to install the Magento Commerce Version help can get from the Magento Forum by navigating to
the below links,

Forum

Forum

http://www.magentocommerce.com/boards

Ajax : Introduction

AJAX stands for Asynchronous JavaScript And XML.
AJAX is a type of programming made popular in 2005 by Google (with Google Suggest).
AJAX is not a new programming language, but a new way to use existing standards.
With AJAX you can create better, faster, and more user-friendly web applications.

AJAX is based on the following web standards:

  • JavaScript
  • XML
  • HTML
  • CSS

The XMLHttpRequest Object

By using the XMLHttpRequest object, a web developer can update a page with data from the server after the page has loaded!

The onreadystatechange Property

After a request to the server, we need a function that can receive the data that is returned by the server.
The onreadystatechange property stores your function that will process the response from a server. This is not a method, the function is stored in the property to be called automatically. The following code sets the onreadystatechange property and stores an empty function inside it.

The readyState Property

The readyState property holds the status of the server’s response. Each time the readyState changes, the onreadystatechange function will be executed.

Here are the possible values for the readyState property:

State Description
0 The request is not initialized
1 The request has been set up
2 The request has been sent
3 The request is in process
4 The request is complete

The responseText Property

The data sent back from the server can be retrieved with the responseText property.

In our code, we will set the value of our “time” input field equal to responseText:

xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.myForm.time.value=xmlHttp.responseText;
}
}

The below are the example code to illustrate the Ajax functionalities,

Name: Time:

<html>
<body>

<script type=”text/javascript”>
function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject(“Msxml2.XMLHTTP”);
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject(“Microsoft.XMLHTTP”);
}
catch (e)
{
alert(“Your browser does not support AJAX!”);
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.myForm.time.value=xmlHttp.responseText;
}
}
xmlHttp.open(“GET”,”test.php”,true);
xmlHttp.send(null);
}
</script>

<form name=”myForm”>
Name: <input type=”text”
onkeyup=”ajaxFunction();” name=”username” />
Time: <input type=”text” name=”time” />
</form>

</body>
</html>

Test.php

<?php
echo date("H:i:s");
?>

Google: Transliteration with Custom Control

With the AJAX Language API for Transliteration, you can enable transliteration on any textfield or textarea in you webpage. This will help your website users to type in any language using an English keyboard.

What is transliteration? Transliteration is the process of phonetically converting a word written in one script into another. Transliteration should not be confused with translation, which involves a change in language while preserving meaning. With transliteration, it is the sound of the words that are converted from one alphabet to the other.

This is an advanced example which shows how to create your own custom control to control the transliteration. It uses a checkbox for toggling between English and Hindi typing modes and a dropdown to change the destination language. It also registers event handlers for various events that can be raised by the Transliteration Control. See the API class reference for details on the possible events.

<html>

<head>

<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″/>

<script type=”text/javascript” src=”http://www.google.com/jsapi”></script&gt;

<script type=”text/javascript”>

// Load the Google Transliteration API

google.load(“elements”, “1”, {

packages: “transliteration”

});

var transliterationControl;

function onLoad() {

var options = {

sourceLanguage: ‘en’,

destinationLanguage: [‘ar’,’hi’,’kn’,’ml’,’ta’,’te’],

transliterationEnabled: true,

shortcutKey: ‘ctrl+g’

};

// Create an instance on TransliterationControl with the required

// options.

transliterationControl =

new google.elements.transliteration.TransliterationControl(options);

// Enable transliteration in the textfields with the given ids.

var ids = [ “transl1”, “transl2” ];

transliterationControl.makeTransliteratable(ids);

// Add the STATE_CHANGED event handler to correcly maintain the state

// of the checkbox.

transliterationControl.addEventListener(

google.elements.transliteration.TransliterationControl.EventType.STATE_CHANGED,

transliterateStateChangeHandler);

// Add the SERVER_UNREACHABLE event handler to display an error message

// if unable to reach the server.

transliterationControl.addEventListener(

google.elements.transliteration.TransliterationControl.EventType.SERVER_UNREACHABLE,

serverUnreachableHandler);

// Add the SERVER_REACHABLE event handler to remove the error message

// once the server becomes reachable.

transliterationControl.addEventListener(

google.elements.transliteration.TransliterationControl.EventType.SERVER_REACHABLE,

serverReachableHandler);

// Set the checkbox to the correct state.

document.getElementById(‘checkboxId’).checked =

transliterationControl.isTransliterationEnabled();

// Populate the language dropdown

var destinationLanguage =

transliterationControl.getLanguagePair().destinationLanguage;

var languageSelect = document.getElementById(‘languageDropDown’);

var supportedDestinationLanguages =

google.elements.transliteration.getDestinationLanguages(

google.elements.transliteration.LanguageCode.ENGLISH);

for (var lang in supportedDestinationLanguages) {

var opt = document.createElement(‘option’);

opt.text = lang;

opt.value = supportedDestinationLanguages[lang];

if (destinationLanguage == opt.value) {

opt.selected = true;

}

try {

languageSelect.add(opt, null);

} catch (ex) {

languageSelect.add(opt);

}

}

}

// Handler for STATE_CHANGED event which makes sure checkbox status

// reflects the transliteration enabled or disabled status.

function transliterateStateChangeHandler(e) {

document.getElementById(‘checkboxId’).checked = e.transliterationEnabled;

}

// Handler for checkbox’s click event.  Calls toggleTransliteration to toggle

// the transliteration state.

function checkboxClickHandler() {

transliterationControl.toggleTransliteration();

}

// Handler for dropdown option change event.  Calls setLanguagePair to

// set the new language.

function languageChangeHandler() {

var dropdown = document.getElementById(‘languageDropDown’);

transliterationControl.setLanguagePair(

google.elements.transliteration.LanguageCode.ENGLISH,

dropdown.options[dropdown.selectedIndex].value);

}

// SERVER_UNREACHABLE event handler which displays the error message.

function serverUnreachableHandler(e) {

document.getElementById(“errorDiv”).innerHTML =

“Transliteration Server unreachable”;

}

// SERVER_UNREACHABLE event handler which clears the error message.

function serverReachableHandler(e) {

document.getElementById(“errorDiv”).innerHTML = “”;

}

google.setOnLoadCallback(onLoad);

</script>

</head>

<body>


<center>Type in Indian languages (Press Ctrl+g to toggle between English and Hindi)</center>

<div id=’translControl’>

<input type=”checkbox” id=”checkboxId” onclick=”javascript:checkboxClickHandler()”></input>

Type in <select id=”languageDropDown” onchange=”javascript:languageChangeHandler()”></select>

</div>

<br>Title : <input type=’textbox’ id=”transl1″/>

<br>Body<br><textarea id=”transl2″ style=”width:600px;height:200px”></textarea>

<br><div id=”errorDiv”></div>

</body>

</html>

The demo on the Custom Transliteration can view on the below URL,

http://code.google.com/intl/ru/apis/ajaxlanguage/documentation/customtransliteration.html

« Older entries