Life Tip #1

I may make this a regular thing, but if so I may feel ashamed to start with such a targeted hint. We’ll see.

Life Tip #1: If you ever submit a clip from a tv show or other dated material to YouTube, include the date in the description.

It just makes sense.

Fontforge

So I’ve been playing around with fontforge.
Figured I’d throw up a small screenshot of some sample text.

Obviously it lacks the consistency a font needs, but it’s in progress and fontforge is a great tool to make fonts.

Screenshot

With PHP XScreensaver displays news

One of my favorite packages that spans the linux distro universe is XScreensaver. Indeed, any OS that uses X can make use of this screensaver package. In setting it up, I found myself drawn to a few specific screensavers that do more than eyecandy. They display text from 1) Host name and time, 2) Static text, 3) Text file, 4) program text output, or 5) URL. So I threw the google news RSS feed URL in and enjoyed seeing the latest news when my screensaver came on.

This provided a problem. Most RSS (and Google’s feed was no exception) provide only brief summaries of their items. I wanted full-text. So, to accomplish this I found the easiest (though not the best) way was to create a PHP script with the help of some prefab scripts (namely Magpie for the RSS and a script [link] to grab the html from each item).

While an imperfect solution, it gives the full stories; the combination of html stripping in PHP and XScreensaver’s HTML parser make it a pretty solid combination.

Screenshot

Please, if you have any suggestions/changes/other similar implementations to shout out about, drop a comment or an e-mail. I’d really like to see what else is out there.

And now the (shoddy) code (Formatted for publication using code2html):

 1 //Needed for magpie:
 2 define('MAGPIE_DIR', './magpierss/');
 3 require_once(MAGPIE_DIR.'rss_fetch.inc');
 4 //From the grabber script:
 5 	$config['start_tag'] = "<p>"; // where you want to start grabbing
 6 	$config['end_tag']   = "</p>"; // where you want to stop grabbing
 7 	$config['show_tags'] = 0; // do you want the tags to be shown when you show the html? 1 = yes, 0 = no
 8 //from the magpie examples:
 9 
10 	//Modified to use a single rss URL
11 	$rss = fetch_rss('http://news.google.com/nwshp?hl=en&ned=us&output=rss');
12 	//Modified to create an explicit array and shuffle it to get a random item.
13 	$rss_array = $rss->items;
14 	shuffle( $rss_array );
15 	foreach ( $rss_array as $key => $item )
16 	{
17 		if ($key > 1) {
18 			break;
19 		}
20 		$config['url'] = $rss_array[1]['link'];
21 		//From grabber script:
22 		$grab = new grabber;
23 		$grab->grabhtml( $config['url'], $config['start_tag'], $config['end_tag'] );
24 		if (!$grab->error) {
25 			foreach( $grab->html[0] as $html )
26 			{
27 				echo htmlspecialchars( $grab->strip( $html, $config['show_tags'], $config['start_tag'], $config['end_tag'] ) ) . "<br />";
28 			}
29 		}
30 	}
31 
32 	//From grabber script:
33 	class grabber
34 	{
35 		var $error = '';
36 		var $html  = '';
37 	
38 		function grabhtml( $url, $start, $end )
39 		{
40 			$file = file_get_contents( $url );
41 		
42 			if( $file )
43 			{
44 				if( preg_match_all( "#$start(.*?)$end#s", $file, $match ) )
45 				{				
46 					$this->html = $match;
47 				}
48 				else
49 				{
50 					$this->error = "Tags cannot be found.";
51 				}
52 			}
53 			else
54 			{
55 				$this->error = "Site cannot be found!";
56 			}
57 		}
58 	
59 		function strip( $html, $show, $start, $end )
60 		{
61 			if( !$show )
62 			{
63 				$html = str_replace( $start, "", $html );
64 				$html = str_replace( $end, "", $html );
65 				
66 				//Added the PHP function strip_tags and strip any numeric html character references:
67 				$pattern = '/^\&\#(\d+);$/u';
68 				return preg_replace( $pattern, '', strip_tags( $html ) );
69 			}
70 			else
71 			{
72 				return $html;
73 			}
74 		}
75 	}

Why not.(updated)

So I’m currently learning some Java and thought I’d take a little time today to throw together a pretty simple pretty applet. Just click here to check it out. Note that clicking on the applet will cause it to draw something different.

Since the html file has ‘test’ in the name, I don’t mind too much that it’s not going to stay the same. I will keep trying different ideas as they come to me. Just don’t expect it to stay the same. If you’ve got any suggestions for things to try, feel free to comment.

Signing Statements: The new line-item veto.

Bush certainly thinks so. The media has now turned this into a story: 110 signing statements challenging the effects of over 700 laws. Now if that’s not a line-item veto, I’m not sure what is.

To make it transparent, realize that Bush took a legally binding oath to uphold and execute the Constitution and the laws of the US. Twice. And how many times has he done that? To be fair, at least a few, but to be fair far less than what that oath requires: every single time. Certainly he’s human, but the office he holds requires him at the least to back track and fix what he breaks. He hasn’t done that. He has not taken responsibility for the disasters both natural and man caused that have occurred during his term of office.

Again, I ask would you hire this man to do a job for you? Probably not. So why do we still see over 1/3 of the country support him? It’s what’s called an investment trap. You put some money into a venture, and it gets worse. Well, there comes a point where you’ve invested enough that you feel committed to it. It’s a “you will not desert a sinking ship with your family still on board” kind of thing.

It’s also well known in tournament poker terminology as “pot-committed.” You’re short-stacked, the blinds are eating you alive, you see the big blind coming around at you again and look down to see a big fat suited connector. Say, Q-J. What do you do? Well, you probably either go all-in or you make a big enough stab that you think you can take it down with. Let’s say you throw half of what you have left at it. At that point you’ll probably go all-in no matter what happens on the flop.

So you’re a 50 year old veteran, you’ve got a family, a good job. You’re a good Christmerican. Then you get the memo, “we’re living in a post-9/11 world.” You feel itchy. You have to scratch. You support our troops. You support the family. You want to see the American Dream succeed at all costs. Bush tells you that Iraq has WMDs. You remember the horrors told by Kuwaitis from the first Gulf War. You forget that it came out they were paid off. You forget that at one point in time Rummy shook Hussein’s hand, that we supported Iraq against Iran. By God, you do not want some maniac with a nuke. You forget N. Korea.

So you support him then. You supported his father even after Iran-Contra. You always loved Reagan for being truthful about not knowing the truth. Nixon may have been impeached, but he was a hell of a guy and you’re sure he only got wrapped up in Watergate because it was in your best interest. So you support going back to Iraq. It’s the rematch, this time America finishes the job.

You allow yourself to ignore bin Laden still being at large five years later. That we had the opportunity to get him in Afghanistan. You don’t worry about the domestic spying, because you’re too worried about Mexicans you don’t give a damn about stepping over an imaginary line and causing economic chaos.

So you still support him. He’ll protect us, just like he didn’t do on 9/11. He’ll protect us, just like he didn’t do last year during Katrina. Look how much he’s tried to do about abortion and gay marriage. Yes. He understands. ‘2,500 dead? It ain’t no Vietnam. I don’t care how many Iraqis have died, they isn’t Christmerican.’

I understand. You’ve bought and owned that viewpoint your whole life. You gotta believe. It’s like faith at this point. But some of us haven’t bought it. Some of us have taken the time to educate ourselves and don’t like violence, war, greed, theft, or incompetence. And we have to put up with your backed up cess pool overflowing into all of our yards. Fix it, or we’re going to have to hire a lobotomist to fix it for us.