Monday, 10 August 2009

Transferring Large Databases

The following is a blog from 3 years ago.

I still refer to it on occasion, it's definitely still relevant if your using your own server.  However I do have a quicker method for when I'm doing this on Heart Internet - and thats to

> go to your control panel
> find and click on 'MySQL Databases' 
> find the text 'To restore a database which you've previously backed up, click'   -
> just locate the file and off it goes to install it for you.

Anyway here's the SSH way to do a large MySQL database

####################

One thing that has been slowing me down recently when transferring a website is transferring large databases. On searching it looks like being able to do this by SSH ( shell access ) should speed the process up greatly.

This article lists how to do this by mysqldump.

http://patchlog.com/databases/three-methods-to-transfer-a-mysql-database/

However after several attempts I could not get my SQL to save in the file properly and due to the old 'time is money' syndrome I ended up saving the file in the good old phpMy Admin panel. Saving the document was never my problem anyway it was always importing where it would crash on me or I'd spend time splitting the tables up!!
However if anyones got any tips on the export side of the above article it'd be good to know.

Anyway so here's the method I am now using which works for me.

1. Use the 'Export' feature in mysql and tick 'save as file' - compression 'none'
2. Upload the file to the server of the website you want your database to go to.
3. Use this statement in SSH ->
mysql -u "your username" -p "your_database" < filename.sql


If it's a really large file you may want to zip it up and then unzip it using SSH as well. My blog on 'transferring a site using SSH' at the end of July may help.

Transferring mysql database
Transferring mysql using SSH
Importing mysql database
Importing large mysql database

Monday, 3 August 2009

Flash Movie keeps looping in Explorer.

the Problem: All other browsers are fine but in Explorer ( checked in 7 & 8) the flash movie does not stop eventhough there is stop action placed in the movie. The problem is with Macromedia flash MX not generating the correct embed code.


The solultion:

the Flash MX generated code looks like this

< PARAM NAME=movie VALUE="images/flash/movie.swf" > < PARAM NAME=quality VALUE=high > < PARAM NAME=bgcolor VALUE=#FFFFFF >
< EMBED src="images/flash/movie.swf" loop=false quality="high" bgcolor=#FFFFFF WIDTH="150" HEIGHT="200" NAME="Movie" ALIGN=""
TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" >< /EMBED >



I found that if I added this code before the < EMBED

< PARAM NAME=loop VALUE=false >

then the loop would also stop in Explorer

Wednesday, 29 July 2009

Adding a class suffix to a module that doesn't have one.

They are moments when you just have to love Joomla, and this was definatly one of those moments as this was very very easy to fix.

I had downloaded the extendsion Simple Tags http://extensions.joomla.org/extensions/search-&-indexing/tags-&-clouds/5422/details#action .

The only problem with it was the box wasn't displayed as I wished. What I wanted was to make it inline with my other menus that had the class name module_menu. On installation of the extension it was only 'module' and there was no input area in admin to add a class suffix.

THE SOLUTION: all I had to do was add this line to the file mod_simpletags.xml above the final < / params > tag.

< param name="moduleclass_sfx" type="text" default="" label="Module Class Suffix" description="PARAMMODULECLASSSUFFIX" / >

and that was it Joomla did the rest for me :)))

Thursday, 16 July 2009

css - margin-top not working safari

This was my problem.

I had a table that was using the command 'margin-top' to position itself inside a < div >
It displayed fine in Internet Explorer and Firefox but not in Safari.


my original code was

.module div div div table{
margin-top:45px;
}


I found the solution for this by trial and error.

While testing though I found it helpful to activate the Safari developer tools. You do this by going to ->
Edit->preferences-> then clicking on the tick box for 'Show Develp menu in menubar' at the bottom of the pop-up box.

The solution was to leave the class above blank and target the tbody that lies below the table - ie ->
.module div div div table tbody{
display: block;
margin-top:45px;
}


Please note in your code you may find it easier to just put a class in the table and access it from there, rather than using the tree of < div >s that I have.

css - show full background image on hover link

I found it quite difficult to find the solution to this one.

So I thought I'd blog it so the solution may be easier to find. Here's some search terms i tried.

css show full background image hover link
css background on hover link problem
css background image show full
css hover background stretch

The solution for this I found through this link.

http://www.daniweb.com/forums/thread109916.html

Basically it's the css on the :link and not the :hover that you need to change. This is where I was going wrong.

the solution then for me was


a.link:link, a.link:visited {
text-decoration: none;
color: #fff;
font-size: 14px;
display:block; /*This Cover Full TD */
width:100%; /*This Will Make Fixes Size Link (Use Image width)*/
text-align:left;

}

.link:hover {
background:#000 url(../images/menu_bg1.gif) center center fixed;

}


you will then need to stick the class name in you link html, ie

Example

Wednesday, 15 July 2009

Adding a feature to a Joomla Component

This is a small change I made to a ccboard ( which is an excellent Joomla forum addon by the way ) .
You will need to have the module for ccboard latest_posts.

Before I go on I found two documents online that were very helpful in understanding how to make changes to a Joomla Component
http://docs.joomla.org/Creating_custom_template_parameter_types
http://help.joomla.org/content/view/777/125/

Basically allows you to show recent posts from a specific catergory. The default '0' will show all cats.
Before you start BACKUP.



OPEN modules/mod_ccboard_latest_posts/helper.php

FIND:

function getItems($numposts)


REPLACE WITH:


function getItems($numposts, $forumid)

FIND:

if ( $numposts < 1) {
return;
}

UNDERNEATH ADD:

if ($forumid == '0' || $forumid == NULL){
$forumid = '%';
}


FIND:

$query = 'SELECT p.id, p.forum_id, p.topic_id, p.post_time, ' .
'p.post_subject, u.username, p.post_user, p.post_username ' .
'FROM #__ccb_posts AS p ' .
'INNER JOIN #__ccb_forums AS f ON f.id = p.forum_id ' .
'INNER JOIN #__users AS u ON u.id = p.post_user ' .
'WHERE f.published=1 AND f.view_for <= ' . $user->get('gid') . ' ' .
'ORDER BY p.post_time DESC';


REPLACE WITH:

$query = 'SELECT p.id, p.forum_id, p.topic_id, p.post_time, ' .
'p.post_subject, u.username, p.post_user, p.post_username ' .
'FROM #__ccb_posts AS p ' .
'INNER JOIN #__ccb_forums AS f ON f.id = p.forum_id ' .
'INNER JOIN #__users AS u ON u.id = p.post_user ' .
'WHERE f.published=1 AND f.view_for <= ' . $user->get('gid') . ' AND p.forum_id LIKE \''.$forumid.'\' ' .
'ORDER BY p.post_time DESC';


-> SAVE


OPEN modules/mod_ccboard_latest_posts/mod_ccboard_latest_posts.php

FIND:

$numposts = $params->get('numposts');

ADD UNDERNEATH:

$forumid = $params->get('ForumID');


FIND:
$items = ccboardLatestPostsHelper::getItems($numposts);

REPLACE WITH:

$items = ccboardLatestPostsHelper::getItems($numposts, $forumid);


-> SAVE

OPEN modules/mod_ccboard_latest_posts/mod_ccboard_latest_posts.xml


FIND:

ccBoard
Joomla


ADD UNDERNEATH:




-> SAVE

-> UPLOAD FILES

Friday, 3 July 2009

Transferring a website using SSH

The following is a list of SSH commands to move a website from one location to another.

Once you SSh'd in then change directories to one higher than the directory you want to zip

>> example - if you're in the directory you want to zip already

cd ..

>> otherwise

cd public_html/


>> now to zip the website


tar -czvf fileName.tar.gz folderName/




- Now you need to SSH into the website you
're transferring to.


!!! when doing this on the project in had I first needed to delete what was on there.

> to do this I deleted the directory in question

rm -r public_html/

> and recreated that directory

mkdir public_html/

////////////////////////////////

now get yourself in the folder you want...

and use the following commands to to unzip your website

>>

wget http://www.siteyourzipisat.co.uk/fileName.tar.gz

tar -zxvf fileName.tar.gz


//////////////////////////////////////

hopefully it'll be as easy as that for you as well :)




possible search terms used to find this article.

ssh unzip tar.gz
ssh zip website
ssh unzip website
ssh compress site
ssh compress website
ssh transfer website
ssh transfer joomla website