-
Create SSL certificate request in ISPConfig control panel. Triple check that all fields shown match your certificate EXACTLY – I got hung up initially on the presentation of the state.
-
Wherever you got your certificate (I used godaddy) rekey the certificate and paste the SSL request from step 1.
-
Take the SSL Certificate from godaddy and paste into the lower field of the SSL and save.
-
Upload both certs to the website SSL folder.
-
Update apache directives for the site. SSLCertificateChainFile /var/www/web#/ssl/gd_bundle.cert
Tags: ISPConfig
Use CSS to style the current menu item:
Step 1 – Give each page’s tag a unique id…
<body id="home">
<body id="services">
<body id="about">
<body id="contact">
Step 2 – Give each link in your navigation a unique id that is duplicated with the nav menu on each page…
<ul id="navbar">
<li><a href="home.htm" id="home_link">
HOME</a></li>
<li><a href="services.htm" id="services_link">
SERVICES</a></li>
<li><a href="about.htm" id="about_link">
ABOUT</a></li>
<li><a href="contact.htm" id="contact_link">
CONTACT</a></li>
</ul>
Step 3 – Style your links and link :hovers. Here I’ll have black text on a white background change to black text on a white background.
#navbar a {
color: #fff;
background: #000;
}
#navbar a:hover {
color: #000;
background: #fff;
}
Step 4 – Now add a style declaration that will set the link corresponding to the current page to the same settings as the :hover rule.
body#home a#home_link,
body#services a#services_link,
body#about a#about_link,
body#contact a#contact_link {
color: #000;
background: #fff;
}
Any time the browser finds BOTH the body id AND the link id, it changes the style for that link.
Tags: CSS
In PhpMyAdmin Insert the following code – substitute your appropriate fields
GRANT
SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, DROP
ON
[Database_Name].*
TO
[Username]@localhost IDENTIFIED BY ''[password]'';
GRANT
SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, DROP
ON
[Database_Name].*
TO
[Username]@'%' IDENTIFIED BY ''[password]'';
Flush privileges;
To Allow the user access to phpMyAdmin just make sure that the authentication mode is set to cookie in the config.inc.php file. On new versions on phpMyAdmin you will have to add a blowfish password in the config.inc.php file also.
Tags: MySQL, PhpMyAdmin
Similar to getting back the first field from a table sorted by order – you use the order of “RAND()” which will randomize the return order from the database.
@story = Story.find(:first,
rder => 'RAND()')
Tags: Ruby on Rails
I had a challenge with getting this to work initially. Mainly because the gem requires unicode, which requires a compiler to be installed. Here is how I was able to get it working.
Copy the file unicode-0.1-mswin32.gem to the rails app root (http://osdir.com/ml/lang.ruby.rails.core/2005-12/msg00132.html)
Install the gem
>gem install unicode-0.1-mswin32.gem
>ruby script/plugin install
git://github.com/norman/friendly_id.git
>gem install friendly_id
Create a migration file and update the database
>ruby script/generate migration friendly_id_migration
(had to manually copy of the migration file for some reason)
(pluginsriendly_id\generatorsriendly_id emplates)
>rake db:migrate
Here are further instructions on the use: http://friendly-id.rubyforge.org/
Tags: Ruby on Rails
No one wants to be left to without a database backup in their time of need. I looked at a bunch of mysql backup scripts and had a hard time getting most to work. I found a nice and simple one that looks to work good from Island Linux.
Well, as an extension to this I setup a cron job that runs twice monthly to email be the latest sql. I installed mutt for the attachment emailing and it worked well. Here is the final script, which could be cleaner (note that the last couple lines should actually be on one):
#!/bin/sh
#
#
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
BACKUPDIR="/var/backups/mysql"
DATE=$(date +%Y-%m-%d_%Hh%Mm)
FILENAME="msyql_backup_${DATE}.sql.tar.gz"
# Send Backup? Would you like the backup emailed to you?
# Set to "y" if you do
EMAILBACKUP="y"
SUBJECT="mySQL Backup"
MAILTO="email@example.com"
# Send the backups via email
if [ $EMAILBACKUP = "y" ]
then
# Zip all sql files together
tar -cvzf ${BACKUPDIR}/${FILENAME} ${BACKUPDIR}/*.sql
#email
mutt -s "$SUBJECT - $DATE" -a ${BACKUPDIR}/${FILENAME} ${MAILTO}
< /tmp/mysql_backup.txt
#remove the zipped file
rm ${BACKUPDIR}/${FILENAME}
fi
Tags: MySQL
<script language="JavaScript">
//Preload Icon Image
da_image = new Image();
da_image.src="favicon.ico";
</script>
Place in Head of webpage-assigns favicon to that page and allows you to direct the browser elsewhere
<link rel="SHORTCUT ICON"
href="http://www.example.com/favicon.ico">
Bookmark Us – actual script goes in body of HTML
<script language="JavaScript">
//Checks for Explorer version 4 or above
if ((navigator.appName == "Microsoft Internet Explorer") &&
(parseInt(navigator.appVersion) >= 4)) {
var url="http://www.example.com";
var title="EXAMPLE";
document.write('<A HREF="javascript:window.ext');
document.write('ernal.AddFavorite(url,title);" ');
document.write('onMouseOver=" window.status=');
document.write("'Add our site to your favorites!';
return true ");
document.write('"onMouseOut=" window.status=');
document.write("' '; return true ");
document.write('">Add our site to your favorites!</a>');
} else {
//Creates Alternative Message
var msg = "Don't forget to bookmark us!";
//Checks for Netscape
if(navigator.appName == "Netscape") msg += " (CTRL-D)";
//Writes Netscape message
document.write(msg);
}
</script>
Tags: JavaScript
This is done to solve the multiple submissions of an order or . . .
HIDING USING JAVASCRIPT To stop this to happen you can change the visibility property to false or hidden that way the button wont show anymore that way the user doesnt get confused clicking again
<html>
[...]
<script language:"javaScript">
function hideMybutton(){
var myForm = document.formName;
myForm.mySubmitbutton.style.visibility="hidden";
alert("The Form has been sent please wait");
}
</script>
<body id="b1">
[...]
<form name="formName">
<input type="button" value=" submit "
onClick="hideMybutton();" name="mySubmitbutton">
</form>
[...]
</body>
</html>
Tags: JavaScript
To open a new window using JavaScript:
<a href="#" onClick="var window_name =
window.open(''page_url'', ''window_name'',
''width=400,height=400,scrollbars=1,resizable=1'');
window_name.focus();">Open Window</a>
To close the above window using JavaScript:
<a href="#" onclick="window_name.close();">
Close Current Window</a>
To close the current window using JavaScript:
<a href="#" onclick="window.close();">
Close Current Window</a>
Bringing the popup window to the top:
<a href="#" onclick="window_name.focus();">
Bring Popup to the Top</a>
Tags: JavaScript