Comatose CMS Yet another Micro CMS, when your client may use to create and edit easily a static pages like privacy policy, terms & conditions, an FAQ, that kind of thing.
Installation of Camotose.
$ ./script/plugin install git://github.com/darthapo/comatose.git
$ ./script/generate comatose_migration
$ rake db:migrate
Once the above mentioned command is executed then configure your route file, at the bottom of your route file paste the below mention syntax
map.comatose_admin
map.comatose_root ''
That it now you to access the Camotose simply type
http://localhost:3000/comatose_admin
You can configure you comatose on your config/environment.rb file, but i'll suggest you to create a comatose.rb inside your config/initializers folder, and insert the following code.
Comatose.configure do |config|
config.admin_title = 'YOUR site name CMS SYSTEM' # it cab anything...
config.admin_helpers = []
config.admin_sub_title = 'Administration Pages'
config.content_type = 'utf-8'
config.default_filter = ''
#config.default_processor = :liquid
config.default_tree_level = 3
config.disable_caching = false
config.hidden_meta_fields = 'filter'
config.helpers = []
config.includes = []
# These are 'blockable' settings
config.authorization = Proc.new { true }
config.admin_get_author = Proc.new { request.env['REMOTE_ADDR'] }
config.after_setup = Proc.new { true }
# Includes AuthenticationSystem in the ComatoseAdminController
config.admin_includes << :authenticated_system
# Calls :login_required as a before_filter
config.admin_authorization = :login_required
end
Monday, May 25, 2009
Wednesday, December 24, 2008
Insert HTML Tag Using Javascript...
The below mention function will be use to insert a div tag along with input field, button when a user clicks on hyper link. Button will be used to hide the selected div. A user can create max 5 div.
function attachFile(id)
{
var count = new Array("1","2","3","4","5")
var hiddenCount = document.getElementById("Cnt").value;
var Comman = 1;
for(var j=1;j<=count.length;j++)
{
if (id == 'remove_' + j)
{
document.getElementById('div_' + j).style.display = "none";
return
}
}
Comman = parseInt(hiddenCount) + Comman;
if (Comman <= 5)
{
var varTag1 = document.createElement("INPUT");
// var varTagRemove = newElement("input",{type:"button",name:"Remove",id:"remove_"+Comman,value:"1"},{onclick:attachFile(this.id)});
var varTagRemove = document.createElement("INPUT");
varTagRemove.type="button";
varTagRemove.value = "Remove";
varTagRemove.id = "remove_"+Comman;
varTag1.type = "file";
varTag1.id = "file_"+Comman;;
var x = document.all;
var br = "br"
if(x)
br = "
"
var varTag2 = document.createElement(br);
document.getElementById("div_" + Comman).appendChild(varTag1);
document.getElementById("div_" + Comman).appendChild(varTagRemove);
document.getElementById("div_" + Comman).appendChild(varTag2);
var rm_test = document.getElementById("remove_" + Comman);
rm_test.onclick = function(){attachFile(this.id)};
document.getElementById('Cnt').value = Comman;
}
else
{
for (var i = 1; i <= count.length; i++)
{
if (document.getElementById("div_" + i).style.display == "none")
{
document.getElementById("div_" + i).style.display = "block";
return
}
}
//ALERT WILL BE CALLED WHEN THE COUNT OF FILE UPLOADER IS 5 AND ALL THE DIV DISPLAY PROPERTY IS
// BLOCK
alert("Limit is over");
}
}
function attachFile(id)
{
var count = new Array("1","2","3","4","5")
var hiddenCount = document.getElementById("Cnt").value;
var Comman = 1;
for(var j=1;j<=count.length;j++)
{
if (id == 'remove_' + j)
{
document.getElementById('div_' + j).style.display = "none";
return
}
}
Comman = parseInt(hiddenCount) + Comman;
if (Comman <= 5)
{
var varTag1 = document.createElement("INPUT");
// var varTagRemove = newElement("input",{type:"button",name:"Remove",id:"remove_"+Comman,value:"1"},{onclick:attachFile(this.id)});
var varTagRemove = document.createElement("INPUT");
varTagRemove.type="button";
varTagRemove.value = "Remove";
varTagRemove.id = "remove_"+Comman;
varTag1.type = "file";
varTag1.id = "file_"+Comman;;
var x = document.all;
var br = "br"
if(x)
br = "
"
var varTag2 = document.createElement(br);
document.getElementById("div_" + Comman).appendChild(varTag1);
document.getElementById("div_" + Comman).appendChild(varTagRemove);
document.getElementById("div_" + Comman).appendChild(varTag2);
var rm_test = document.getElementById("remove_" + Comman);
rm_test.onclick = function(){attachFile(this.id)};
document.getElementById('Cnt').value = Comman;
}
else
{
for (var i = 1; i <= count.length; i++)
{
if (document.getElementById("div_" + i).style.display == "none")
{
document.getElementById("div_" + i).style.display = "block";
return
}
}
//ALERT WILL BE CALLED WHEN THE COUNT OF FILE UPLOADER IS 5 AND ALL THE DIV DISPLAY PROPERTY IS
// BLOCK
alert("Limit is over");
}
}
Thursday, December 11, 2008
Ruby: How "send" method works?
Invokes the method identified by symbol, passing it any arguments specified. You can use __send__ if the name send clashes with an existing method in obj.
For example.
Suppose that in you have a three different parameter
1.addnum
2.subnum
3.multinum
depends on the parameter you want to call the method to execute add/subtract/multiply. So what you can do
class Number
def mainfunction(methodname, val1, val2)
#THE BELOW MENTION SEND METHOD WILL CALL ANY ONE METHOD #DEPENDS ON THE FIRST PARAMETER
self.send(methodname, val1, val2)
end
def addnum(val1, val2)
val1 + val2
end
def subnum(val1, val2)
val1 + val2
end
def multinum(val1, val2)
val1 + val2
end
end
num = Number.new
num.mainfunction(“addnum”, 10 , 20) #output => 30
So this is just a very basic example to understand hoe send method work.
For example.
Suppose that in you have a three different parameter
1.addnum
2.subnum
3.multinum
depends on the parameter you want to call the method to execute add/subtract/multiply. So what you can do
class Number
def mainfunction(methodname, val1, val2)
#THE BELOW MENTION SEND METHOD WILL CALL ANY ONE METHOD #DEPENDS ON THE FIRST PARAMETER
self.send(methodname, val1, val2)
end
def addnum(val1, val2)
val1 + val2
end
def subnum(val1, val2)
val1 + val2
end
def multinum(val1, val2)
val1 + val2
end
end
num = Number.new
num.mainfunction(“addnum”, 10 , 20) #output => 30
So this is just a very basic example to understand hoe send method work.
Saturday, October 4, 2008
How to enable grant access to remote system for MySQL server?
In a few step you can allow remote system to access your MySQL server. To implement first you will need to configure your my.cnf which which is located at
/etc/mysql/my.cnf [Debian Linux Environment]
OR
/etc/my.cnf [Red Hat Linux/Fedora/Centos Linux]
OR
/var/db/mysql/my.cnf [FreeBSD]
access the file using
sudo gedit /etc/mysql/my.cnf
check for following line
bind-address in which the local ip address is assigned 127.0.0.1
bind-address = 127.0.0.1
So just replace the local ip address with your server ip address e.g. 192.168.XXX.XXX
bind-address = 192.168.XXX.XXX
Thats it now all you need to restart your MySQL server and assign a grant access to remote system.
To restart MySQL server
etc/init.d/mysql restart
To assigned a grant access
GRANT ALL ON user_database_name.* TO remote_user_name@'192.168.x.x' IDENTIFIED BY 'PASSWORD';
Thats it and it is done.. Now
the remote user can access your db..
/etc/mysql/my.cnf [Debian Linux Environment]
OR
/etc/my.cnf [Red Hat Linux/Fedora/Centos Linux]
OR
/var/db/mysql/my.cnf [FreeBSD]
access the file using
sudo gedit /etc/mysql/my.cnf
check for following line
bind-address in which the local ip address is assigned 127.0.0.1
bind-address = 127.0.0.1
So just replace the local ip address with your server ip address e.g. 192.168.XXX.XXX
bind-address = 192.168.XXX.XXX
Thats it now all you need to restart your MySQL server and assign a grant access to remote system.
To restart MySQL server
etc/init.d/mysql restart
To assigned a grant access
GRANT ALL ON user_database_name.* TO remote_user_name@'192.168.x.x' IDENTIFIED BY 'PASSWORD';
Thats it and it is done.. Now
the remote user can access your db..
Tuesday, September 30, 2008
Configuration of phpMyAdmin on ubuntu..
Configuration of phpMyAdmin on ubuntu..
As you know that phpMyAdmin is a database management and adminstration tool. So below is given the installation process of phpMyadmin. Let assume that you have already installed LAMP on ur system.
And incase if you have not installed LAMP then follow the following steps.
1. Open the terminal.
2. install apache [sudo apt-get install apache2].
3. install php [sudo apt-get install php5 libapache2-mod-php5]
4. Once it is installed restart the apache [sudo /etc/init.d/apache2 restart]
5. Install MySQL server [sudo apt-get install mysql-server] and set a password to local system to gets root access.
6. Install MySQL admin [sudo apt-get install mysql-admin]
7. Install MySQL for Apache HTTP Server [sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin]
8. Edit your php.ini file to work your php with MySQL [pico /etc/php5/apache2/php.ini] and add following line [extension=mysql.so]
9. Again restart you apache same command used in point 4.
Now once your LAMP installed all you need to edit your apache2.conf file which is located in '/etc/apache2/apache2.conf' and add the following like
[Include /etc/phpmyadmin/apache.conf] and then restart your apache as given in point 4.
That it and your phpmyadmin is configured.
For accessing you can use the following URL "http://localhost/phpmyadmin/" and if it is configured on server or some other system just changed localhost from domain name.
Your comments are welcome.
As you know that phpMyAdmin is a database management and adminstration tool. So below is given the installation process of phpMyadmin. Let assume that you have already installed LAMP on ur system.
And incase if you have not installed LAMP then follow the following steps.
1. Open the terminal.
2. install apache [sudo apt-get install apache2].
3. install php [sudo apt-get install php5 libapache2-mod-php5]
4. Once it is installed restart the apache [sudo /etc/init.d/apache2 restart]
5. Install MySQL server [sudo apt-get install mysql-server] and set a password to local system to gets root access.
6. Install MySQL admin [sudo apt-get install mysql-admin]
7. Install MySQL for Apache HTTP Server [sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin]
8. Edit your php.ini file to work your php with MySQL [pico /etc/php5/apache2/php.ini] and add following line [extension=mysql.so]
9. Again restart you apache same command used in point 4.
Now once your LAMP installed all you need to edit your apache2.conf file which is located in '/etc/apache2/apache2.conf' and add the following like
[Include /etc/phpmyadmin/apache.conf] and then restart your apache as given in point 4.
That it and your phpmyadmin is configured.
For accessing you can use the following URL "http://localhost/phpmyadmin/" and if it is configured on server or some other system just changed localhost from domain name.
Your comments are welcome.
Labels:
Configuration of phpMyAdmin,
phpMyAdmin,
Ubuntu
How to install RMagick Gem on Ubuntu?
To install RMagick with image magick on ubuntu is very simple you just need to run three commands from your terminal. Just make sure that you have install ruby and rubygem.
Once your ruby and rubygem is install run the following command.
1. sudo apt-get install imagemagick
2. sudo apt-get install libmagick9-dev
3. sudo gem install rmagick
Thats it and Rmagick in installed on your ubuntu environment.
Once your ruby and rubygem is install run the following command.
1. sudo apt-get install imagemagick
2. sudo apt-get install libmagick9-dev
3. sudo gem install rmagick
Thats it and Rmagick in installed on your ubuntu environment.
Monday, September 29, 2008
uninitialized constant Gem::GemRunner (NameError)
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)
After installing ruby and rubygem on Ubuntu i started getting 'uninitialized constant Gem::GemRunner (NameError)' Error, so the solution for this is.
add the following command in your /usr/bin/gem
require 'rubygems/gem_runner'
Thats it and it will start working..
After installing ruby and rubygem on Ubuntu i started getting 'uninitialized constant Gem::GemRunner (NameError)' Error, so the solution for this is.
add the following command in your /usr/bin/gem
require 'rubygems/gem_runner'
Thats it and it will start working..
Subscribe to:
Posts (Atom)
