$this->Session->write is not working in cakephp

you have to change in the core.php where session files are stored. it will stored in /app/tmp/sessions

This is what I had before:

Configure::write('Session.save', 'php');

I changed it to this one:

Configure::write('Session.save', 'cake');

How to scroll to Div

just use JQuery position function to get coordinates of your div, then use javascript scroll:

var position = $("#your_div_id").position();
scroll(0,position.top);

how to make Ubuntu mount partitions and drives automatically at startup

To make Ubuntu mount partitions and drives automatically at startup:
open your terminal & type to identify the partitions:

sudo fdisk -l

after you idetify your partiyion that you want to mount
you will create directory for it
sudo mkdir /media/work
sudo mkdir /media/personal

then edit mount table

gksudo gedit /etc/fstab

and add to it this lines of codes

/dev/sda5 /media/work ntfs defaults 0 0
/dev/sda6 /media/personal ntfs defaults 0 0

Now to mount the drives without having to reboot:
sudo mount -a

Run a system command automatically at startup on Ubuntu

open your terminal & login as a root & type:

sudo crontab -e

it will open you a file, insert the following line:

@reboot /opt/lampp/lampp start

hint:
Replace “/opt/lampp/lampp start” with the full address to your command.

Save the file and exit.

How to make callback function for Ajax

Hi All
I face a problem that I want to make function to run after complete of ajax run so I can use data that come from it
when I put this code it work:

$.ajax({
beforeSend: function(){
// Handle the beforeSend event
},
complete: function(){
// put here code that will run after complete of ajax
}
// ......
});

for more information
Ajax Events

The difference between target=”_blank” and target=”_new”

If you have ever created links with target=”_new” and wondered why all your pages were opening in the same window, it is because “_new” is not actually a generic target. It is a window name, and by using it, you name the first window that comes up “_new”.
Thereafter, every link that specifies target=”_new” looks for and finds that window by name, and opens in it.

If you use target=”_blank,” a brand new window will be created each time, on top of the current window.

How to switch hosts without having any down time.

How to switch hosts without having any down time.

Switching to a new host can be a complicated process. Follow this steps to ensure that your move is smooth and painless.

  1. The first step is to join your new host. Make sure to NOT cancel with your old hosting provider, and do not tell them you will be canceling. Keep this a secret from your old host, or they could prematurely terminate your site and cause downtime.
  2. At this point, you should have hosting accounts with two hosting providers (the old and the new one). You will now migrate your entire site from the old host to the new one. This can be done by connecting to the old host’s FTP and downloading all your files, and then by connecting to the new host’s FTP and uploading all your files (maintain the same file and folder structure).
  3. You must also backup any databases on the old host and upload the backup files to the new host via FTP. You must then restore your databases from those backup files; this can be done via SSH or cPanel’s phpMyAdmin. Emails do not normally transfer, but you can archive your emails from the old host. You can accomplish this by making a POP3 connection to each email address; this way all the old emails are downloaded to your local computer. The new host will not have those old emails, but the new host will be able to get new emails.
  4. After you have a copy of your site on both hosting accounts, it is time to change your domain name’s DNS….
  5. After you have all your files on both hosting accounts, it is time to change your domain name’s DNS. Your new host will provide you with the correct name servers (DNS). You may need to contact the new host to find out what DNS settings you will use for your domain name, Once you have the correct DNS, go to the company where you purchased your domain name to make the change.
  6. Once your DNS changes have been made, you will need to wait 48 hours (two days) before your site will load from the new host. During this 48 hour period, your DNS is propagating world wide and your site will be randomly loading from either the old host or the new host. Once the two days is complete, your site will only be loading from the new host.
  7. After the 48 hours have passed, your updated DNS will be fully functional. You will now contact your old host and cancel your hosting account with them. If you originally bought your domain name from the old host, do not cancel your domain registration.

If you completed all the above steps, you have successfully switched hosts with no downtime at all!

Avoid down time, seamlessly transfer hosting with no interruptions

Advanced Techniques

I have also included some advanced tips below to supplement and expand upon the article linked above. There are multiple techniques for avoiding downtime when transferring websites, and you will want to choose the method most appropriate for you and your site. Some methods are more technical and/or require more attention than others.

What about my Database?

If your database does not change much (for example, it only changes when you add new posts or pages to your site), then there is little risk of lost information during the transfer process.
On the other hand, if you have a website where the database in constantly being updated with new information, such as forums or a site with lots of user generated content, you will want to take special care to make sure no information is lost in the transfer. There are a couple ways of doing this.

Advanced Technique 1: Reconfigure the site on the old server to access the database on the new server prior to changing the DNS.

One way to do it is you can configure your site to connect to your new database, remotely; this way whether your visitors are directed to the new site or the old site, all the new updates will be saved to the new database. Now the new database will have all of your current information and can continue to update.
This technique is the most technical, but would minimize downtime as much as possible for all visitors to your site. You or your web designer would need to make changes to your site during the transfer to make this work.

A simplified set of steps include:

  1. Transfer all the files, databases and other settings over to the new server.
  2. Test the site on the new server to make sure it works as expected.
  3. (If changes have occurred to the database between steps 1 and 4, then re-transfer the most recent version of the database. This step is unnecessary if you do step 4 immediately after steps 1 & 2.)
  4. Change the database settings on your site so that the site on the old server accesses the database on the new server.
  5. Change the name servers and DNS to point to the new server.

Using this technique, it would not matter which server a visitor sees while the DNS propagates, since both the old server and new server update the same database.

Advanced Technique 2: Disable updates to the database on the old server during the transfer.

Another method is to modify your website on the old server so that it does not accept updates to the database during the transfer. Like the previous technique, you or your web designer would need to make changes to your site during the transfer to make this work.

This technique is best if you are rapidly progressing through the steps necessary to transfer, and/or don’t mind if a couple people temporarily see the old site while the DNS changes propagate. This is also good for sites where the database does not change that often because of user input.

Depending on how your site is coded, this could mean putting the site into a read-only mode where people can view information but not make any changes, turning on maintenance mode on your blog or CMS, or possibly disabling the database all together and putting up a temporary page telling customers the site will be up shortly.

Ideally you would do this immediately before transferring the latest copy of the database over to the new server, and once that is completed, changing the name servers and DNS to point to the new server.

While the DNS propagates (updates) worldwide, some people will see the site on the new server, and some will see the site on the old server, yet only the new server will accept changes in the database.

A simplified set of steps include:

  1. Transfer all the files, databases and other settings over to the new server.
  2. Test the site on the new server to make sure it works as expected.
  3. On the old server, modify your site so it cannot accept changes to the database.
  4. (If changes have occurred to the database between steps 1 and 3, then re-transfer the most recent version of the database. This step is unnecessary if you do step 3 immediately before or after step 1.)
  5. Change the name servers and DNS to point to the new server.

While the DNS propagates worldwide, some people will see the site on the new server, and some will see the site on the old server.

Tips on Reducing Propagation Time

After the content transfer, you can create an A record in your existing DNS (most likely on your old server) to redirect all visitors to the new server; this is much faster than waiting for the propagation of new name servers.

Also, after the site transfer, you can create a MX record so your emails will all be delivered to the new server and not need to wait as long for propagation.

Once you have the A records and MX records updated to point to the new server, you can change the name servers anytime.

What ip of a Domain?

Hi All
if you want to know what ip of a Domain(that it point to it) or a Name Server
this is a good website for that
http://whois.dollardns.net/

How to delete individual URLs from Firefox’s history

How to delete individual URLs from Firefox’s history

I’ve ever been thought that there’s no way to delete individual URLs from the History without just clearing the whole thing. Turns out I was wrong. In Firefox, if you want to delete an individual entry from the History, just highlight it (either in the History sidebar or in the address bar drop-down) and press Shift+Delete. Gone.

Copyright © Mohamed Elsayed Blog - this is Blog of Mohamed Elsayed - Powered by Mohamed Elsayed