Fixing Gmail outgoing server (offline) issue in Mac Mail

Posted by on Jul 4, 2013 in how to | No Comments

In Mac mail, my Gmail accounts outgoing server “Gmail” was constantly offline. This last page of this About.com article: How to Access a Gmail Account in Mac OS X Mail did the trick for me. I needed to switch the outgoing server port setting to 465.

http://email.about.com/od/macosxmailtips/ss/wt_gmailosxmail_10.htm

Python tip, list contents of directory

Posted by on Aug 3, 2011 in how to, python | No Comments

Python: list contents of a directory, remove an extension from the file names.

import os
dirList=os.listdir('path')
for fname in dirList:
    print fname.replace('.ext','')

How to subtitle in After Effects

Posted by on May 5, 2011 in After Effects, code, how to | One Comment

To subtitle in After effects, use the script linked below.

http://www.ithowto.ro/2008/12/adobe-after-effects-subtitle-script/

{
	//	Subtitle generator by !Rocky  http://www.ithowto.ro/2008/12/adobe-after-effects-subtitle-script/
        //     http://vimeo.com/rawkeh
	// 
	//	modified by Colin Harman ( http://colinharman.com/ ) to work on a Mac
	//
	//     modified by Oliver to work with CS5
	// 
	//	Save this code as
	//	"subtitles.jsx"
	//
	//	Create a text file with your subtitles.
	//	Each line of text is one on-screen line.
	//	To have several lines on-screen at the same time,
	//	simply separate them with a pipe ( | ) character.
	//	eg "Character 1 talks|Character 2 interrupts"
	//
	//	Create a new text layer in your comp, adjust its position,
	//	make sure the text's centered, so it looks nice
	//	Add markers (Numpad *) where each subtitle line must be shown/hidden.
	//	With the text layer selected, run the script, and select the subtitles file.
	//	Enjoy!

	function makeSubs() {
		var layer = app.project.activeItem.selectedLayers[0];

		if (layer.property("sourceText") != null) {
			var textFile = File.openDialog("Select a text file to open.", "");
			if (textFile != null) {
				var textLines = new Array();
				textFile.open("r", "TEXT", "????");

				while (!textFile.eof)
					textLines[textLines.length] = textFile.readln();

				textFile.close();

				var sourceText = layer.property("sourceText");
				var markers = layer.property("marker");

				for (var i = sourceText.numKeys; i >= 1; i--)
					sourceText.removeKey(i);

				var line = 0;
				var subTime, subText;
				for (var i = 1; i <= markers.numKeys; i++) {
					subTime = markers.keyTime(i);
					sourceText.setValueAtTime(0, " ");

					if ((i % 2) == 0) {
						subText = " ";
					}
					else {
						subText = textLines[line].replace("|", "\x0d\x0a");
						line++;
					}
					sourceText.setValueAtTime(subTime, new TextDocument(subText));
				}
			}
		}
	}
	makeSubs();
}

PHP, handling forms

Posted by on Jan 26, 2011 in code, how to, web | No Comments

HTML form, which calls a seperate php file, called action.php:

<form action="action.php" method="post">
 <p>Your name: <input type="text" name="name" /></p>
 <p>Your age: <input type="text" name="age" /></p>
 <p><input type="submit" /></p>
</form>

The contents of action.php:

Hi <?php echo htmlspecialchars($_POST['name']); ?>.
You are <?php echo (int)$_POST['age']; ?> years old.

Your name:

Your age:

 

From: A simple tutorial

Add a Pay Pal “Buy Now” Button

Posted by on Jan 25, 2011 in code, how to | No Comments

If you have a PayPal account, go here to set up Buy Now, Cart, Donate buttons.

 

OK, now give me a dollar!

 





 

OK, a penny?





How to exclude categories from sidebar

Posted by on Jan 13, 2011 in how to | No Comments

<?php wp_list_categories(‘exclude=3,4,6,7,10,11,12,20,109&title_li=<h2>Categories</h2>’); ?>

HTML create new line

Posted by on Jan 11, 2011 in code, how to, web, wordpress | No Comments

To create white space between paragraphs in a post etc in WordPress.

<br />&nbsp;

How to create a mouse-over image for a wordpress post

Posted by on Jan 11, 2011 in code, how to | No Comments

This comes from a nice tutorial that you can find here at: More Than A Maths Teacher.
 

 
You will need to add a javascript file to the root folder of your current wordpress theme. Code is below. Note the the images I used for the mouse-over are named image.png and image_over.png. For this particular script to work, your images must be names image.png and image_over.png ( “image” stands for whatever you want, and can be replaced). If you want to use another file format, than png, you must edit the code.

jQuery(function($) {
$(document).ready(function() {

		// Preload all rollovers
		$(".hoverlink img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.png$/ig,"_over.png");
			$("<img>").attr("src", rollON);
		});

		// Navigation rollovers
		$(".hoverlink a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_over/);

			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.png$/ig,"_over.png"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}

		});
		$(".hoverlink a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});

	});
});

Nextyou will need to add the following code to your head.php file, somewhere between the tags.

 <?php
       wp_enqueue_script('jquery');
       wp_enqueue_script('jquery-core-ui');
       wp_enqueue_script('jquery-tabs-ui');
       wp_enqueue_script('hoverlink', get_bloginfo('template_directory').'/rollover.js');
       wp_head();
    ?>

Finally use this format to the post to add the images:


<div class="hoverlink">
<a href="http://www.anysite.com"><img src="http://www.anysite.com/pat/to/your/image.png" border="0" alt="mouse-over" width="200" height="100" /></a></div>

How to learn PHP

Posted by on Jan 5, 2011 in code, how to | No Comments

1. Download and install XAMPP (free). You will need to run this software (or similar) to enable an Apache web server on your computer. In other words you need this to run PHP scripts.
2. Download and install Eclipse PDT All In Ones / Eclipse PHP Package (free). This is a development environment, a text editor and other tools, with which to create your PHP scripts.
3. Launch XAMPP. Start Apache, and MySQL.
4. Launch Eclipse. You will need to choose the “workspace”. The workspace is where you will save your php files. Generally you will want to use XAMPP’s htdocs folder. Found in the application folder where XAMPP resides. While XAMPP is running you will be able to launch your php scripts in a web browser by navigating to http://localhost/myScript.php
4. Find a book or tutorials. Start learning.

Load More