Category: Codeing/Development


So after buying my new router I had to run the following commands on my laptops.  What kept happening is they would keep the wifi connection but lose the internet connection.  After running these little commands on 2 of our laptops everything has been great so looks like this might be the solution:

Reset WINSOCK entries to installation defaults: netsh winsock reset catalog

Reset IPv4 TCP/IP stack to installation defaults. netsh int ipv4 reset reset.log

Reset IPv6 TCP/IP stack to installation defaults. netsh int ipv6 reset reset.log

New Fonts Website

Well you can never have too many websites for fonts and of course since websites come and go figured I should add another one to the list so I dont forget..

FontPark

Well laura wanted to do some roll over effects on one of her sites so I had to figure out how to do that.  Well after lots of searching this was the solution I came up with.

First download jquery.js and upload it to the server

Second add these lines of code to your header.php or scripts section of your site:

<script type='text/javascript' src='location of jquery script'></script>

<script type='text/javascript'>
 $(document).ready(function(){
 $("img.a").hover(
 function() {
 $(this).stop().animate({"opacity": "0"}, "slow");
 },
 function() {
 $(this).stop().animate({"opacity": "1"}, "slow");
 });
 });
 </script>

Then edit the CSS of your site and add these classes (styling may vary!):

div.fadehover {
 position: relative;
 height: 238px; /*this is to space your images*/
 width: 360px;
 }

img.a {
 position: absolute;
 left: 0;
 top: 0;
 z-index: 10;
 border: 2px;
 border-style:solid;
 border-color: black;
 padding: 5px 5px 5px 5px;
 }

img.b {
 position: absolute;
 left: 0;
 top: 0;
 border: 2px;
 border-style:solid;
 border-color: black;
 padding: 5px 5px 5px 5px;
 }

Then you will just need to add these lines to your page:

<div class="fadehover">
 <img src="startimage.jpg" class="a" alt="" />
 <img src="endimage.jpg" class="b" alt="" />
 </div>

After doing that you should have your achieved effect of the roll over and image swap

Well I am always trying to find a way to automate my backups.  So I already have my webserver setup to run a cpanel automated backup on Monday’s, after a little script change to handle the new LunarPages theme ‘LP3′ and now I wrote a little batch file to push the most recent backup to my Dropbox account.  This way I have an offsite backup of my website as well.  The script to get the most recent file is pretty straight forward but it did take me a while to figure it out:

–this Deletes the existing files
del/q “C:\Documents and Settings\Dan Murphy\My Documents\My Dropbox\*.tar.gz”
–this adds a pause for 45 seconds
ping -n 45 127.0.0.1 > NUL 2>&1
–this sets up the variables
set backupcmd=c:\windows\system32\xcopy.exe /c /d /e /h /r /y
set dt=%date:~7,2%.%date:~10,4%
–this runs the commnd
%backupcmd% “c:\source\”*%dt%*.tar.gz “C:\Destination”

For those who have had to move wordpress you probably have found it a little tedious as there is no quick way to pick it up and move to another server.  Well I have moved a bunch of sites from my development server to their respective production environments so I have the process down.  Below is a checklist of how to move from server to server.

  1. Move all the files from the WordPress directory to the main server (I find it easier to zip everything the transfer that one file and then unzip on the server)
  2. Edit the wp-config.php file in the root folder to have the correct connection information on the new server
  3. Dump the database to a file using the mysqldump command (See Post)
  4. Re-import the dumped data file to the new server using the mysql command (See Post)
  5. Log into the production server and run the following two SQL lines:
    1. update wp_posts set post_content = replace(post_content,’DEVSERVERURL‘,’PRODSERVERURL‘);
    2. update wp_options set option_value = replace(option_value,’DEVSERVERURL‘,’PRODSERVERURL‘);
  6. Log into WordPress Admin and double check all the general settings (if you use nextgen you have to re-input everything manually)
  7. Turn off your Dev server (This one is key so you know that you can see if you have any image or anything references pointed back to your old server)

Add iFrame to WordPress

Wow I finally figured out how to get an iframe into a wordpress post:

First edit your functions.php file for your theme and add this code snippet:

function field_func($atts) {
   global $post;
   $name = $atts['name'];
   if (empty($name)) return;
   return get_post_meta($post->ID, $name, true);
}
add_shortcode('field', 'field_func');

Then when writing your post put a custom field in with the title of iframe and for the value put the whole iframe code! This will save me tons of headaches

Every try to delete a windows folder only to find out that its path is too long and Windows NTFS doesn’t understand how to delete it?  Well I just had this happen to me as I was unzipping the latest backup of my site to test some stuff out.  What I ended up doing was opening a command prompt window and going to the parent directory and then typing:

rmdir /s “really long folder path name”

This will securely delete all sub folders and files and delete the directories regardless of what ISO standards you make have broken with how long the path ends up getting.  I was afraid I was going to have to jump to Linux and use that to delete the folder but this was much easier

I have spent many hours dealing with this on my own so I figured I would write down the solution so I wouldn’t have to research everything again.  If you are running a 64 bit system and need to use *.MDB drivers you need to make sure the following is set:

run: “regsvr32 odbcconf.dll” from c:\windows\Syswow64\

Edit ODBC using: C:\WINDOWS\SysWOW64\odbcad32.exe

That will save you many hours of frustration with x64 systems

Test post with wptogo

I am just testing wptogo android app for wordpress

scriptsI have setup my web hosting service to FTP my full backup of my website every Monday.  While this automation is great I forgot about one thing to maintain.  With each one of these backup files being about 1GB it can start to take up a lot of space if you do not clean up your older files!

So after searching around I came around the .vbs script that looks at the directory and deletes any file older than a specified number of days.  In this case I have chosen 60 days.  Now a few things to remember, make sure you keep backing up your site if you are running this file otherwise you will delete all of your backups if it is long than 60 days since your last backup!  Using Windows scheduler I have made this run shortly after I receive my latest backup file from my web host.  This makes my backup process totally automated now even for maintaining files!

Delete Files Older than 60 Days