Archive for the ‘Random’ Category

RSS feed aggregator/combiner in PHP with Magpie RSS (v2)

Wednesday, March 3rd, 2010

I have recently upgraded the code to combine multiple RSS feeds, for the original version see this post.

To install, extract the following zip file to a directory where you want your combined feeds to be displayed, I use thydzik.com/combinedfeed as thydizk.com/feed is already used by Wordpress.

Edit index.php for your site, and make sure the temp directory has write permissions (mod 755). That should be it. Enjoy.

thydzik RSS feed aggregator v2.zip

Thanks to Magpie RSS and Feedcreator.

<?php
	$TMP_ROOT = "temp/"; //a atempory folder for storing the cached feeds, need to have write access (mod755)
	$DOMAIN_NAME = "http://thydzik.com/";
	$SITE_TITLE = "Travis Hydzik's blog feeds";
	$SITE_DESRIPTION = "A collection of Travis Hydzik's blog feeds";
	$SITE_AUTHOR = "Travis Hydzik";

	$FEEDS_ARRAY  = array( //the collection of urls linking to individual feeds
		"http://hydzik.com/feed/",
		"http://sonyaandtravis.com/feed",
		"http://thydzik.com/feed/"
	);

	$MAX_ITEMS = 10;
	$SHOW_FULL_FEED = FALSE;

	//stop editing from here onwards

	define('MAGPIE_DIR', '');
	define('MAGPIE_CACHE_DIR', $TMP_ROOT);

	//include magpie rss http://magpierss.sourceforge.net/
	@require_once(MAGPIE_DIR.'rss_fetch.inc');

	//include universal feed creator http://sourceforge.net/projects/feedcreator/
	@include(MAGPIE_DIR.'feedcreator.class.php');

	//create the basic rss feed
	$rss = new UniversalFeedCreator();
	$rss->useCached();
	$rss->title = $SITE_TITLE;
	$rss->description = $SITE_DESRIPTION;
	$rss->link = $DOMAIN_NAME;
	$rss->syndicationURL = curPageURL();

	//get all items is all feeds
	$total_temp = 0; //temp total number of posts in all rss feeds
	foreach ($FEEDS_ARRAY as $single_url) {
		$array_temp[$single_url]['page_title'] = url_grab_title($single_url); //grab the page title

		$rss_temp = fetch_rss($single_url);
		$items = array_slice($rss_temp->items, 0, $MAX_ITEMS);
		$array_temp[$single_url]['rss_data'] = $items;
		$total_temp += count($items);

		$array_temp[$single_url]['rss_pointer'] = 0;

		preg_match('@^(?:http://)?([^/]+)@i', $single_url, $matches);
		$array_temp[$single_url]['site_url'] = $matches[0];
	}

	while ($total_temp <> 0 && $MAX_ITEMS > 0){// loop while there are remaining posts to process
		$date_timestamp_temp = 0; //initialise to 0
		foreach ($FEEDS_ARRAY as $single_url) {
			$this_date_timestamp = $array_temp[$single_url]['rss_data'][$array_temp[$single_url]['rss_pointer']]['date_timestamp']; //get the date stamp of this post
			if ($this_date_timestamp > $date_timestamp_temp) { //if this date stamp is the newest, save where it came from
				$date_timestamp_temp = $this_date_timestamp; //update with this date stamp
				$temp_url = $single_url; //save the url feed
				$pointer_temp = $array_temp[$single_url]['rss_pointer']; //save the item number
			}
		}

		$total_temp --; //decrement total remaining posts to process
		$MAX_ITEMS --; //decrement number of posts to display
		$array_temp[$temp_url]['rss_pointer'] ++; //increment post index of used post rss

		//get the saved item
		$item = $array_temp[$temp_url]['rss_data'][$pointer_temp];

		//create the new item
		$item_new = new FeedItem();

		//add all the copied basics
		$item_new->title = $item['title'];
		$item_new->link = $item['link'];
		$item_new->date = $item['pubdate'];
		$item_new->author = $item['author'];
		$item_new->source = $temp_url;

		//to show full feed or blurb
		if ($SHOW_FULL_FEED) {
			$item_new->description = $item['content']['encoded'].'<p>Copyright &copy; <a href="'.$array_temp[$temp_url]['site_url'].'">'.$array_temp[$temp_url]['page_title'].'</a>. All Rights Reserved.</p>';
		} else {
			$item_new->description = $item['description']       .'<p>Copyright &copy; <a href="'.$array_temp[$temp_url]['site_url'].'">'.$array_temp[$temp_url]['page_title'].'</a>. All Rights Reserved.</p>';
		}

		$rss->addItem($item_new);
	}

	// a quick function the grab a pages title
	function url_grab_title($rss_url) {
  		$contents = file_get_contents($rss_url, TRUE, NULL, 0, 3072);
  		$contents = preg_replace("/(\n|\r)/", '', $contents);
		preg_match('/<title>(.*?)<\/title>/i', $contents, $matches);
		return $matches[1];
	}

	//get page url (for syndication), source http://www.webcheatsheet.com/PHP/get_current_page_url.php
	function curPageURL() {
		$pageURL = 'http';
		if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
		$pageURL .= "://";
		if ($_SERVER["SERVER_PORT"] != "80") {
			$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
		} else {
			$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
		}
		return $pageURL;
	}

	// get your news items from other feed and display back
	$rss->saveFeed("RSS2.0", $TMP_ROOT."feed.xml");
?>

Heat problems with iStar BPN-350SAS 3×5.25″ to 5×3.5″ SATA Trayless Backplane

Sunday, January 24th, 2010

Recently I posted about the use of an iStar BPN-350SAS in my RAID 6 array, well due to Australia’s extreme summer temperatures I have had a number of drives in the enclosure fail due to overheating.

Whilst I like the design and build of the BPN-350SAS there are some extreme flaws in the cooling design must likely due to implementation costs or interference with the units cosmetics.

Firstly, the 2x 60mm fans do not provide enough airflow; secondly, there are simply not enough paths for the air to flow. If you look inside the unit you will see 5 slits behind the PCB, and that is all there is for hot air exhaust. If you look at the front bezels, beneath the locking key hole plastic are 3 air vents, and this is all there is for the cool air intake.

Now, my solution has improved all off the above by first, removing the 60mm fans and installing 2x 80mm fans, these are connected via a molex connector. You can observe that 2x 80cm fans protrude 20mm on one side so it was necessary to install the protruding fan once the unit was installed into the case. Secondly, additional air holes on the back of the unit and on the top and under side of the unit to allow more air to circulate. I also removed the 5 springs that popped the drives out, but this was more to improve the backplane’s connection with the drives.

iStar BPN-350SAS modified - top air intake holes

iStar BPN-350SAS modified - top air intake holes and 80mm fan

iStar BPN-350SAS modified - botton air intake holes and 80mm fan

iStar BPN-350SAS modified - installation in case with 2 80mm fans

Dell PowerEdge SC430 with 8x WesternDigital 1TB drives in RAID-6

Friday, September 25th, 2009

Sometimes a man just wants to show of; this is one of those times.

My latest project was upgrading my full 2TB server (Adaptec 2410SA with 4x Seagate 750gb drives in RAID-5) to a 6TB server (Adaptec 3805 with 8x Western Digital 1TB drives in RAID-6).

Dell SC430 with installed iStar BPN-350SAS

Obviously, the Dell PowerEdge SC430 wasn’t designed for 9 drives (an extra for the OS) so it was quite challenging fitting it all on. It was made significantly easier by purchasing an iStar BPN-350SAS which allows for five 3.5″ drives to be squeezed into three 5.25″ bays. Plus it is tray-less, and looks very sleek. There was a significant problem in that the SC430 only supported two 5.12″ bays, after quite a bit of hacking the case up, I then realised that the motherboard was preventing the BPN-350SAS to fit in horizontally, with extreme luck and millimetre clearance, it did manage to fit in vertically, but with the extension of the P4 connector and two capacitors that were in the way. Refer to the following pictures.

Dell SC430 motherboard original

Dell SC430 motherboard modified

Dell SC430 showing motherboard clearance of iStar BPN-350SAS

The SC430 now had the two standard bottom hard disk drive cages and the five from the BPN-350SAS which meant I was still two drive spaces short. I removed the drive cage from a Dell Optiplex GX270, which I managed to luckily remove easily with a long stemmed drill to remove the rivets. I removed the SC430’s card fan, and riveted the GX270’s cage in place. This allowed me to still use rails for easy removal of drives. The SC430’s card fan was relocated as an exhaust fan to the back, mainly to stop BIOS from pausing on fan fault during boot-up.

Dell SC430 with new Optiplex GX270 HDD cage

Minor problems were; cable protrusion and the side panel not closing. This was fixed by using SATA power cables which had clip on connectors forming a natural right-angled connection, and also by carefully whittling the SATA cable connections so a tighter angle could be formed.

Dell SC430 cable management of 9 drives

How to repair High Heel Shoes for a few dollars

Tuesday, September 1st, 2009

A very easy guide on repairing high heel shoes for a few dollars.

The damaged high heel shoe culprit, notice the lack of any heel and the exposed dangerous metal pin.

Damaged high heel, notice the metail pin protruding

Damaged high heel close up

The first task is to remove the old metal pin, depending on how worn the heel is depends on the ease of doing so. If there is a little rubber still visible or about 1mm of the pin showing it will be quite easy. I like to use a vice to squeeze the protruding head and then pull the shoe while rotating left and right, it should be easy enough with pliers, only a little more fiddling around.

If there is very little of the metal pin protruding and you are finding it very difficult to get a good grip on it, I sometimes cut about 1mm of the white plastic heel around the pin with a knife to expose more of the pin.

Remove the metal pin in a vice or with pliers

Once the pin is removed, give the heel a file to make everything nice and flat. Notice quite a bit of wear on the heel, depending on how fussy the owner is, you can remove any hanging leather and give the heel a nice coat of black paint. Personally, I don’t think it matters as it is quite hidden when worn.

Metal pin removed

After a double spray of flat black paint.

After a double coat of flat black spray paint

Now, I purchased 10 pairs of 10.5mm (7/16″) replacement heel tips for £7.50 (roughly $15 Australian, including shipping to Australia) on eBay. I have found that the majority of heels are around 10mm, there was one instance I had a stiletto of roughly 8mm and all that was required was some grinding/filing to obtain the required size. The shoes pictured are 10.5mm.

Replacement heel tips

In some cases the size of the pin hole may be too large for the regular 2.9mm (7/64″) pin, so some convertors to 3.1mm (or what they call Flexitubes) may be required. I purchased 8 pairs for £2.85 (roughly $5.7 Australian, including shipping to Australia) from Stiletto Heel Tips Online.

Flexitubes - comverts 2.9mm pin to 3.1mm pin

To fix the new heel to the shoe, first make a very basic shoehorn. Notice the wood is at an angle, as the sole of the shoe as actually at an angle to the heel. A slightly thicker piece of wood would have been better.

Very basic shoehorn

Hammer the new heel all the way down till the plastic heel is touching the shoe’s heel. Make sure it is facing the right direction, the curved size facing back, and the flat side facing front.

Hammer the new heel tip into the shoe

The completely repaired high heel shoes for the cost of less than $2.50 Australian.

Completely repaired high heel shoes

Copyright Infringement – Pimsleur transcripts (Simon & Schuster)

Tuesday, August 25th, 2009

Seems that Pimsleur doesn’t like me providing transcripts for their Mandarin Chinese 1 Units and have asked for their removal.

Find the Notice of Copyright Infringement below.

So what are some Pimsleur alternatives for learning a language that are more than happy to provide transcripts.

  • Livemocha is a Social Language Learning resource.
  • The world’s number 1 in language learning software, Rosetta Stone is another alternative.
  • Instant Immersion produces a large collection of language learning programs, in the forms of computer software, audio and books.
  • FSI Language Courses is a free alternative with a large number of audio units in the public domain.

There are still plenty of sights that provide Pimsleur transcripts.

And don’t forgot you can freely download any of the Pimsleur audio books online

Update December 2009: I have made the transcripts available for download;

http://thydzik.com/pimsleur-mandarin-chinese-unit-1-transcripts/

In Excel, find the value on the last row as a function, not VBA

Monday, July 20th, 2009

Here is a quick post, how to find the value of the last cell in a column.

Exaample below uses Column A with the first 3 rows used for the header:

=INDEX(A:A,COUNT(A:A)+3)

Huge Pine USB to Serial Ports Driver

Wednesday, June 17th, 2009

Looking for the Huge Pine USB to Serial Ports driver?

Setup_For_HugePine.exe

Install, then connect your USB device and chose to automatically search for driver.

Altrex Light Skinz – the worst product

Friday, May 29th, 2009

I would like to share my experience with Altrex Light Skinz, a product when applied will allegedly protect a car’s headlights from rocks and stones.

As I planned to drive from Perth to Melbourne, I was after some headlight protection for the Hyundai Tucson. I purchased Altrex Light Skinz due to their claim of providing better protection than the common plastic clip-on equivalent, claiming ’simple and easy to fit’, claiming ‘completely invisible once fitted’ and being about half the price ($40 AUS) of the common plastic clip-on equivalent.

I cleaned the headlight glass before applying to make sure it was free of any dirt, as per instructions. Given that the Hyundai Tucson has curved headlights I let the glass heat up with the headlights for a little while, also as per instructions.

Here are some before shots of the Hyundai Tucson’s right and left headlights.
Light Skinz Right BeforeLight Skinz Left Before

And now some after shots after applying Altrex Light Skinz on the right and left headlights.
Light Skinz Right AfterLight Skinz Left After

Even after following these instructions, Altrex Light Skinz are not ’simple and easy to fit’ and are definitely not ‘completely invisible once fitted’. I am going to quote their FAQ with actual information based on my experience. Hopefully, this port will prevent people unsure of Altrex Light Skinz from wasting their money.

How easy are they to fit? Will I be able to fit them myself?
They are not easy to fit; you will be able to fit them yourself but will not be happy with the results.

How can I fit Altrex Light Skinz to a curved headlight? Are Altrex Light Skinz and Body Skinz easy to fit?
No and No. It just doesn’t make sense that a flat skin will fit over a curved headlight. Try getting a piece of paper and fitting it around a ball, how many crinkles do you get?
You can cut a “V-shape” but then you have a slit down one side.
You can cut the template into 2 pieces but then you have 2 slits down the side.

Can I remove Altrex Light Skinz and Body Skinz later if I decide to?
No. on removal of Altrex Light Skinz you will be left with a sticky glue to remove which is insoluble in soapy/hot water.
You will be able to remove all the glue by slowly peeling it from the edges working towards the centre with using your thumb.

Why are Altrex Light Skinz better than the old acrylic-style headlight protectors?
Light Skinz are not completely invisible once fitted. If you think you will be able to apply Light Skinz without leaving a crease, bubble, or smudges, then think again.

How can I ensure a perfect fit for my Altrex Skinz Protection?
You won’t be able to.

If I don’t put them on straight, can I take them off to adjust?
No, If you remove the Light Skinz to adjust the glue will be smudged and on reapplying your smudge will be permanent.
If they are not correctly fitted the first time, too bad.

What can I do about air bubbles?
And yes there will be air bubbles, and given it is also under Frequently Asked Questions must be a frequent problem.
The instructions suggest pricking the air bubble with a needle. Using this technique will only remove the air in the air bubble not the bubble itself.