PNG alpha transparency: AlphaImageLoader filter flaws

I recently ran into an issue on this site Barnliter in which the AlphaImageLoader was causing the form fields to be inaccessible. I discovered that while it was the parent container with the transparency, that in IE6 the filter was applying over the top of my fields.

To fix that I applied a fix I found here: Alpha Transparency

Ideally I’d like to not support IE6 and my problems would all be solved, but given that a good chunk of the users on that site still use IE6 I can’t ignore them for now.

Thursday, December 10th, 2009 Web Development No Comments

How to Remove Redness from Cheeks

- Add a Hue Saturation Adjustment Layer
- Select the Red channel from the pull down menu
- Look at the rainbow like bars near the lower part of the window. Drag the two triangles together so that they are touching. See the 1st screen shot I attached below.
- Drag the Saturation slider all the way to the left. Nothing will happen.
- Now select the eyedropper with the + sign. Move the eyedropper over the red in the cheeks and touch a red area. You should see it turn gray. See the 2nd screenshot I have attached below.
- Keep touching areas until you have selected all of the redness. Dont worry if the lips or other areas are affected.
- Now bring your saturation slider back toward the center. Move the Hue over to the right a few points toward yellow. Play with the Sat and Lightness sliders to fine tune.
- Finally selct a brush with color black and paint over the areas that you did not want affected like the lips. You should be painting on the mask and therefore masking off the areas that you did not want affected by the Hue Sat shift.

From: http://www.retouchpro.com/forums/image-help/23813-how-remove-redness-cheeks.html

Tags: ,

Wednesday, December 2nd, 2009 Photoshop No Comments

Dynamic Flash Video Playlist with Poster Movie for AS3

Recently I had the need to create a Flash video playlist in AS3 and needed a poster movie for the beginning of the playlist.  I found a great tutorial on for a playlist Web Video Template: Dynamic video playlist by Lisa Larson-Kelley.  This tutorial provided everything I needed to make my playlist with the exception of the poster movie.

I found that by combining a couple of other methods I got the effect I was looking for.

After I got the playlist working as shown by Lisa, I then found this tutorial for creating a Flash poster movie Adding a Poster Frame to Flash Video that helped to push me in the right direction.  I didn’t use the whole thing but rather a portion that helped me to add a listener for when the play button is pushed.

I added the following line to the initMediaPlayer function within the VideoPlaylist.as and after the myVid.pause() line.

  1. myVid.addEventListener(VideoEvent.PLAYING_STATE_ENTERED, hidePosterFrame);

Then I created a function called hidePosterFrame

  1. function hidePosterFrame(event:Event):void{
  2. mcHead.alpha = 0;
  3. TransitionManager.start(mcHead, {type:Fade, direction:Transition.OUT, duration:2, easing:Strong.easeOut});
  4. }

Voila!  A poster movie for the dynamic playlist.

Tags: ,

Wednesday, October 14th, 2009 Flash No Comments

Windows XP Taskbar Icons Distortion

I just got a new Windows XP 64-bit machine. Super nice and fast, but I had issues with distorted icons that drove me crazy. In the taskbar the icons were appearing distorted and fuzzy, which I found highly annoying.

To fix this I did the following:

– Go to Start->Control Panel
– Double Click “Display”
– Click the Settings tab
– Then click the Advanced tab
– Click the General tab
Under DPI Setting ensure that
“Normal size (96 DPI) is selected.
*Note that below you can select if
you want to restart right away or
not, more than likely you’ll need to
reboot for the changes to appear.
– Click Ok

Upon rebooting you should have beautiful icons again :)

Tags: ,

Thursday, July 30th, 2009 Computer Stuff No Comments

How to build a contact manager in AIR using XML

Great starting tutorial for those wanting to learn Flex/AIR

Build a Contact Manager in AIR Using XML

Thursday, June 4th, 2009 Flex/AIR No Comments

Bulk Upload Users to Joomla

I have to say this saved my life, totally awesome. Bulk Upload

<?php

/*
Script to bulk import users into a Joomla installation (v 1.5.7).

This script is free to use, modify and distribute,
however is comes with absolutely no guarantees!

Be careful and check everything in here before running
it on your installation - has little to no error checking and is
in no shape or form robust...
And of course MAKE A BACKUP OF YOUR DATABASE BEFORE YOU BEGIN.

That said, I do hope it is useful, Paul.
paul@paulferrett.com

*/

// Hande form upload
if(isset($_POST['import'])) {

$mysql_host = trim($_POST['mysql_host']);
$mysql_user = trim($_POST['mysql_username']);
$mysql_password = trim($_POST['mysql_password']);
$mysql_schema = trim($_POST['mysql_schema']);

$table_prefix = trim($_POST['table_prefix']);

if(!mysql_connect($mysql_host, $mysql_user, $mysql_password) || !mysql_select_db($mysql_schema)) {
echo
'Supplied MySQL details were incorrect - aborting';
return;
}

// Get the joomla groups
$sql = sprintf('
SELECT  `id`, `value`
FROM    `%score_acl_aro_groups`
'
,
$table_prefix
);
$rs = mysql_query($sql);
$groups = array();
while(
$group = mysql_fetch_object($rs)) {
$groups[$group->value] = $group->id;
}

$fp = fopen($_FILES['csv']['tmp_name'], 'r');
while(
$user = fgetcsv($fp)) {

printf('Importing "%s" ... ', $user[0]);

// Lookup and verify user group
if(!isset($groups[$user[4]])) {
printf('error: Invalid group (%s) for %s. Defaulting to <code>Registered</code><br />%s', $user[4], $user[0], PHP_EOL);
$user[4] = 'Registered';
}

// Insert record into wsers
$sql = sprintf('
INSERT INTO `%susers`
SET
`name`            = "%s",
`username`        = "%s",
`email`           = "%s",
`password`        = "%s",
`usertype`        = "%s",
`block`           = "%s",
`sendEmail`       = "%s",
`gid`             = "%s",
`registerDate`    = NOW(),
`lastvisitDate`   = "0000-00-00 00:00:00",
`activation`      = "",
`params`          = ""
'
,
$table_prefix,
sql_prep($user[0]),
sql_prep($user[1]),
sql_prep($user[2]),
isset(
$_POST['md5_passwords']) ? md5($user[3]) : sql_prep($user[3]),
sql_prep($user[4]),
sql_prep($user[5]),
sql_prep($user[6]),
$groups[$user[4]]
);
mysql_query($sql);
// Get back ther user's ID
list($user_id) = mysql_fetch_row(mysql_query('SELECT LAST_INSERT_ID()'));

// Insert record into core_acl_aro
$sql = sprintf('
INSERT INTO `%score_acl_aro`
SET
`section_value`   = "users",
`value`           = %d,
`name`            = "%s"
'
,
$table_prefix,
$user_id,
sql_prep($user[0])
);
mysql_query($sql);

// Insert record into core_acl_groups_aro_map
$sql = sprintf('
INSERT INTO `%score_acl_groups_aro_map`
SET
`group_id`        = %d,
`aro_id`          = LAST_INSERT_ID()
'
,
$table_prefix,
$groups[$user[4]]
);
mysql_query($sql);

echo 'done.';
flush();
}

echo '<br /><br /><strong>Done</strong>';

} else {
// show upload form
?>
<html><head><title>Bulk import users into Joomla 1.5</title></head><body>
<h1>Import Users to Joomla</h1>
<p>
Use this script to do a bulk import of users into Joomla 1.5.<br />
Upload a CSV file with the following format:<br />
<code>
name, username, email, password, usertype, block, send_email
</code><br />
Wrap details with commas in them in quotes.
</p>
<hr />
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="import" value="1" />
<table cellpadding="4px">
<tr>
<td>CSV File: </td>
<td><input type="file" name="csv" /></td>
</tr>
<tr>
<td>MD5 Hash Passwords: </td>
<td><input type="checkbox" name="md5_passwords" /><br /><small>*Check this option if the passwords in your CSV are in plain text</small></td>
</tr>
<tr>
<td>Joomla Table Prefix: </td>
<td><input type="text" name="table_prefix" value="jos_" /></td>
</tr>
<tr>
<td>Joomla Database Name: </td>
<td><input type="text" name="mysql_schema" value="joomla" /></td>
</tr>
<tr>
<td>MySQL Host: </td>
<td><input type="text" name="mysql_host" value="localhost" /></td>
</tr>
<tr>
<td>MySQL Username: </td>
<td><input type="text" name="mysql_username" value="" /></td>
</tr>
<tr>
<td>MySQL Password: </td>
<td><input type="text" name="mysql_password" value="" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value=" Import Users! " /></td>
</tr>
</table>
</form>
</body></html>
<?php
}

function sql_prep($var) {
return
mysql_real_escape_string($var);
}

Tags:

Friday, May 29th, 2009 Joomla, Web Development No Comments

Joomla Unique Menus for Guests and Registered Users

I’ve been doing a lot of Joomla development lately, in particular for a site that has a public and private side.

I was looking for a solution that would allow me to have unique menus for guests vs registetered users and found a way to do it with help from the following articles.

Joomla – Change login link to logout

Joomla 1.5 Template Positions – for this article I used the section for adding new module positions since the first article doesn’t cover that.

Hope this helps!

Tags:

Thursday, May 21st, 2009 Joomla No Comments

CSS Float Theory Things You Should Know

This article is kind of old, but the concepts explained within hold true.  Use them, know them, love them, practice them!

http://www.smashingmagazine.com/2007/05/01/css-float-theory-things-you-should-know/

Tags: , ,

Wednesday, February 4th, 2009 Web Design No Comments

Code to Extract Plain Text from PDF

I have been hunting for a solution to this forever and finally found it here

The solution is below.

<?php

// new pdf extract

print pdf2txt("test.pdf");

// Function    : pdf2txt()
// Arguments   : $filename - Filename of the PDF you want to extract
// Description : Reads a pdf file, extracts data streams, and manages
//               their translation to plain text - returning the plain
//               text at the end
// Author      : Jonathan Beckett, 2005-05-02
function pdf2txt($filename){

	$data = getFileData($filename);

	// grab objects and then grab their contents (chunks)
	$a_obj = getDataArray($data,"obj","endobj");
	foreach($a_obj as $obj){

		$a_filter = getDataArray($obj,"<<",">>");
		if (is_array($a_filter)){
			$j++;
			$a_chunks[$j]["filter"] = $a_filter[0];

			$a_data = getDataArray($obj,"stream\r\n","endstream");
			if (is_array($a_data)){
				$a_chunks[$j]["data"] = substr($a_data[0],strlen("stream\r\n"),
strlen($a_data[0])-strlen("stream\r\n")-strlen("endstream"));
			}
		}
	}

	// decode the chunks
	foreach($a_chunks as $chunk){

		// look at each chunk and decide how to decode it - by looking at the contents of the filter
		$a_filter = split("/",$chunk["filter"]);

		if ($chunk["data"]!=""){
			// look at the filter to find out which encoding has been used
			if (substr($chunk["filter"],"FlateDecode")!==false){
				$data =@ gzuncompress($chunk["data"]);
				if (trim($data)!=""){
					$result_data .= ps2txt($data);
				} else {

					//$result_data .= "x";
				}
			}
		}
	}

	return $result_data;

}

// Function    : ps2txt()
// Arguments   : $ps_data - postscript data you want to convert to plain text
// Description : Does a very basic parse of postscript data to
//               return the plain text
// Author      : Jonathan Beckett, 2005-05-02
function ps2txt($ps_data){
	$result = "";
	$a_data = getDataArray($ps_data,"[","]");
	if (is_array($a_data)){
		foreach ($a_data as $ps_text){
			$a_text = getDataArray($ps_text,"(",")");
			if (is_array($a_text)){
				foreach ($a_text as $text){
					$result .= substr($text,1,strlen($text)-2);
				}
			}
		}
	} else {
		// the data may just be in raw format (outside of [] tags)
		$a_text = getDataArray($ps_data,"(",")");
		if (is_array($a_text)){
			foreach ($a_text as $text){
				$result .= substr($text,1,strlen($text)-2);
			}
		}
	}
	return $result;
}

// Function    : getFileData()
// Arguments   : $filename - filename you want to load
// Description : Reads data from a file into a variable
//               and passes that data back
// Author      : Jonathan Beckett, 2005-05-02
function getFileData($filename){
	$handle = fopen($filename,"rb");
	$data = fread($handle, filesize($filename));
	fclose($handle);
	return $data;
}

// Function    : getDataArray()
// Arguments   : $data       - data you want to chop up
//               $start_word - delimiting characters at start of each chunk
//               $end_word   - delimiting characters at end of each chunk
// Description : Loop through an array of data and put all chunks
//               between start_word and end_word in an array
// Author      : Jonathan Beckett, 2005-05-02
function getDataArray($data,$start_word,$end_word){

	$start = 0;
	$end = 0;
	unset($a_result);

	while ($start!==false && $end!==false){
		$start = strpos($data,$start_word,$end);
		if ($start!==false){
			$end = strpos($data,$end_word,$start);
			if ($end!==false){
				// data is between start and end
				$a_result[] = substr($data,$start,$end-$start+strlen($end_word));
			}
		}
	}
	return $a_result;
}

?>
Tuesday, January 6th, 2009 Web Development No Comments

Slow iPhone Sync Fix

I know I’m not the only one to have experienced this. If you’ve been experiencing long iPhone sync times this ones for you.

Anyway today I was syncing mine to prepare it for loading the 2.2 firmware. I rarely sync my phone because it routinely takes over an hour to do so. Frustrating at best!!

I jumped in the shower figuring my phone could sync while I got ready. By the time I was done getting ready the damn thing was STILL syncing… Actually it appeared stuck in the backup phase. I’ve seen this before and knew if I waited long enough it would eventually finish but I had to get to work.

Being the master Googler I am, I quickly found others with the same issue and a solution! A very simple solution.

1. Connect your phone and open
iTunes.

2. Right click your phone name in the
left column list.

3. Click “reset all warnings”

4. Now reconnect your phone
and sync. When the prompt comes
up to ask if you want to send data
to Apple uncheck the checkbox and
say no!

5. Voilà ! Few minute sync and in your
way.

Apparently the bog down a caused by the connection to Apple Servers with so many users. I don’t know if that’s true but it’s what I read.

Hope it helps!!

Tags:

Friday, January 2nd, 2009 iPhone No Comments