HTTP/1.1 // 38.107.191.85 // // 18850 // // CCBot/1.0 (+http://www.commoncrawl.org/bot.html)

Clicktale
Latest on the Blog

Using Microsoft Virtual Machine for Testing

Mar
30
2009

I learned something new this past week: how to use Microsoft Virtual PC to test Internet Explorer. If you’ve been a web developer for some time then you know that it’s hard to get multiple versions of IE running on the same Windows computer. My solution for this has been to keep a legacy computer around that has IE 6 on it, but when that computer died on me I had to find a different solution.

A friend tipped me off to using the virtual machine and it turns out that it works pretty good. Leave it up to Microsoft to make it a huge resource hog though. I have a new laptop with an intel processor and 6GB of ram and it’s still slow. I recommend that when you install it you pump up the ram on as much as you can – that speeds up things quite a bit (the default is only 128MB). Also, getting networking to work is easy if you know what to do. See the 2nd screen shot to explain.


Here are the links you need:


More 1 Comment » 1,257 views
Posted in: Programming

Windows Speech Recognition Sucks

Jan
6
2009

After reading Jeremy Shoemaker’s latest newsletter I was pretty psyched about getting some speech recognition software to increase my blogging production by like 1000%. After a bit of Googling I found I’ve had this power in the palm of my hands ever since I installed MS Office. I just had to install speech recognition and wait for my muse.

Here is an especially enlightening passage:

and the went and the thirteenth when pitcher up into Europe and the doctor is like only Alice is really out I can feel your desk for so you can’t get back in their idea of an issue can stand up straight after that and I am came home and I think it’s right, I will bet against is For the year at the court the weaker of the Gann inside to the levee upstairs and then them and landing on the bathroom and so she went in there and all senator Donald Becker date in its early entree into the night of the foods of the night and I mean that’s a report in much of the things that she and antisense high school the shipping are back, like this since high school and in mind when mind goes out and as you know the desyeah right now with I know I mean it does it’s that it’s that things have been if if if if it hadn’t happened and it wouldn’t understand what kind of pain and as the that’s not good fellow city has some random attack yesterday off even though I only had half a second amateur what did the account three decades into its own abilities swap on the home ride on the act and sprinkle of the F. Brian a mood of the new idea to I write a threat using dns a problem with that server is the ticket show off after 0.3 seconds or so ago after the download the two

Note that this was after successfully completing 3 training sessions, so I might be able to tune it a bit more.

Now that solid speech recognition technology is available in Windows XP, I predict that we’ll see more third-party programs take advantage of the hooks that Windows XP provides. –Jeremy Moskowitz

I wonder why more programs haven’t picked up on this awesome technology? Well, its obvious that spammers have used it for some time.


More 2 Comments » 2,686 views
Posted in: General

Automatic cPanel Backup

Dec
18
2008

I read this great post today that shows how to automatically backup cPanel with PHP and a cron job and FTP the backup to a remote host. The guy that wrote this recommends that you keep the file on the server you want to backup, but I have like 50 cPanel sites and so I thought it would be better just to keep all of the login info in one file on my laptop and run it with my local version of PHP (set up WAMP or XAMPP to run php locally on windows). I modified the script by adding an array of sites and then the script loops over each set and backs up that site. Pretty awesome way to do this and the neat thing is that it uses functionality that is built into cPanel to do it.

Here’s the code:

<?php

// PHP script to allow periodic cPanel backups automatically, optionally to a remote FTP server.
// This script contains passwords.  KEEP ACCESS TO THIS FILE SECURE! (place it in your home dir, not /www/)

// ********* THE FOLLOWING ITEMS NEED TO BE CONFIGURED *********

// Info required for cPanel access

// Domain 1
$sites['1']['cpuser'] = "username1"; // Username used to login to CPanel
$sites['1']['cppass'] = "password1"; // Password used to login to CPanel
$sites['1']['domain'] = "domain1.com"; // Domain name where CPanel is run
$sites['1']['skin'] = "x"; // Set to cPanel skin you use (script won't work if it doesn't match). Most people run the default x theme

// Domain 2
$sites['2']['cpuser'] = "username2";
$sites['2']['cppass'] = "password2";
$sites['2']['domain'] = "domain2.com";
$sites['2']['skin'] = "rvlightblue";

// Domain 3
$sites['3']['cpuser'] = "username3";
$sites['3']['cppass'] = "password3";
$sites['3']['domain'] = "domain3.com";
$sites['3']['skin'] = "x3"; 

// Info required for FTP host
$ftpuser = "username"; // Username for FTP account
$ftppass = "password"; // Password for FTP account
$ftphost = "ftp.domain.com"; // Full hostname or IP address for FTP host
$ftpmode = "scp"; // FTP mode ("ftp" for active, "passiveftp" for passive, or "scp" for scp - most secure)
$ftpdir = ''; // Directory to save the files in

// Notification information
$notifyemail = "youremail@example.com"; // Email address to send results

// Secure or non-secure mode
$secure = 1; // Set to 1 for SSL (requires SSL support), otherwise will use standard HTTP

// Set to 1 to have web page result appear in your cron log
$debug = 0;

// *********** NO CONFIGURATION ITEMS BELOW THIS LINE *********

foreach ($sites as $site) {

  if ($secure) {
     $url = "ssl://".$site['domain'];
     $port = 2083;
  } else {
     $url = $site['domain'];
     $port = 2082;
  }

  $socket = fsockopen($url,$port);
  if (!$socket) { echo "Failed to open socket connection… Bailing out!\n"; exit; } 

  // Encode authentication string
  $authstr = $site['cpuser'].":".$site['cppass'];
  $pass = base64_encode($authstr);

  $params = "dest=$ftpmode&email=$notifyemail&server=$ftphost&user=$ftpuser&pass=$ftppass&port=&rdir=$ftpdir&submit=Generate Backup";

  // Make POST to cPanel
  fputs($socket,"POST /frontend/".$site['skin']."/backup/dofullbackup.html?".$params." HTTP/1.0\r\n");
  fputs($socket,"Host: {$site['domain']}\r\n");
  fputs($socket,"Authorization: Basic $pass\r\n");
  fputs($socket,"Connection: Close\r\n");
  fputs($socket,"\r\n");

  // Grab response even if we don't do anything with it.
  while (!feof($socket)) {
    $response = fgets($socket,4096);
    if ($debug) echo $response;
  }

  echo "\nDone with {$site['domain']}\n";

  fclose($socket);
}

?>

So I use this straight from the command line on my local computer and plan to set it up with Windows Scheduler to automate this about every 3 to 5 days. I feel a lot better about having a file with all of my cpanel passwords on my computer rather than on a web server. I think some of the variables I set up like scp usage and the ftp directory are newer so if you have an old version of cpanel then it might not support that. Hope this helps someone else to backup cpanel automatically.


More 9 Comments » 5,658 views
Posted in: PHP Scripts, Programming, cPanel

Page 10 of 53« First...89101112203040...Last »
Welcome to DEVTRENCH

DEVTRENCH is a web development blog with posts about PHP programming, MODx CMS, PHP Frameworks, CSS and xHTML, Web Design, SEO and SEM, Email, and Server Admin. I've been doing web development since 1997, starting out as a web designer and learning the rest along the way. The web was my main source of help when learning programming and sever admin, so this blog is my way of giving back.

DEVTRENCH on Twitter

Visit me on Twitter

Categories

Recent Comments