Archive for September, 2006
Friday, September 8th, 2006
Johnny Cash Owns Chuck Norris
Reason 7.
Chuck is a republican. Johnny was close with every president except for GWB. It was said he just didn’t trust that son of a bitch. When Johnny didn’t trust someone, you just knew something foul was going on.
Reason 8.
Johnny was invited to play the at White House in 1972 for Richard Nixon. He was given a list of politically correct songs to sing. He instead metaphorically threw up his middle finger at the establishment, in true ShoutWire fashion, and sang a set full of left leaning, politically charged tunes. Chuck Norris has never told the president to fuck off in his own house.
Posted in Entertainment, Politics | No Comments »
Friday, September 8th, 2006
Why waste money in further terror strikes when the victims terrorize themselves far worse than you could ever do.
Your cost? 1 VHS tape and postage to Al-Jazeera.
The impending terror-fest
Posted in Politics | No Comments »
Thursday, September 7th, 2006
I once argued with people who said there was a 9/11 and Iraq link.
I argued until my carpals ached. Here, in direct quotes, Mark Fiore shares with you:
9/11: A Nation Remembers
Posted in Politics | No Comments »
Thursday, September 7th, 2006
Pakistan announces arrangement with Taliban in Waziristan.
So, let’s see. The Taliban was in Afghanistan. We went in (rightly) and destroyed their infrastructure, we then let Osama and the other bastards escape ( so it is thought ) to Waziristan, Pakistan.
Pakistan is a sovreign nation-state whom we will not invade ( not to mention, they’ve got a couple dozen atomic weapons ).
So….uhm, that’s it?
Posted in Politics | No Comments »
Tuesday, September 5th, 2006
In his heralded new book, “The One Percent Doctrine,” Ron Suskind writes that Vice President Dick Cheney forcefully stated that the war on terror empowered the Bush administration to act without the need for evidence or extensive analysis.
Suskind describes the Cheney doctrine as follows: “Even if there’s just a 1 percent chance of the unimaginable coming due, act as if it is a certainty. It’s not about ‘our analysis,’ as Cheney said. It’s about ‘our response.’ … Justified or not, fact-based or not, ‘our response’ is what matters. As to ‘evidence,’ the bar was set so low that the word itself almost didn’t apply.”
Dick Cheney (msnbc)
“Now you ask me if this was 11 July and there was a 1% chance that the kidnapping would lead to a war like the one that has taken place, would you go ahead with the kidnapping?
Sheikh Nasrallah of the Hezbollah (bbc)
What can we conclude from this adherence to the psychology of 1% (culpability, probability, what does it mean)?
Posted in Modern Times, Politics, Warfare | No Comments »
Tuesday, September 5th, 2006
Fear, fear, fear, and fear.
Read the details here.
Posted in Politics | No Comments »
Monday, September 4th, 2006
Saturday and Sunday….
Well what can I say, I spent pretty much the entirety of Sunday working on Javascript while my girl was at work…if you read the blog entries you can get an idea as to what I was working on.
She arrived home hungry and we went to Hoover’s Cooking over in East Austin for an awesome meal and a chance to catch up. See, with her being busy working, and me being busy working, and days only having 24 hours and all, it’s always important to make sure that you take time to just talk to your girl / SO / imaginary Canadian girlfriend.
Today we were thinking about going over to Enchanted Rock, but the warm, muggy, Texas summer threatened thunderstorm and in the middle of a flat field on top of a geological feature is a place you really do not want to be during a sullen display of force by some cumulonimbus clouds.
So what, to do? We headed over to AustinJava and took our Skip-Bo deck and played 3 rounds. It was an intense struggle, but we had a good time, drinking iced tea, having lunch, and playing our game. Afterwards we headed over to BookPeople so that I could buy the 9/11 report graphic novel. It looks good, although I’d be a bit afraid to take on a plane: al-jebra kids, not al Qaeda.
Posted in Personal | No Comments »
Sunday, September 3rd, 2006
Hi everyone, not that I imagine that thousands of readers were shocked to see PHP errors and were woefully impacted by my rather spontaneous site code update decision.
- I think that I’m pretty much done. I cleaned up the markup within the PHP code so that I could have more power to manipulate the layout / coloration directly.
- I added some javascript savvy so that the very long sidebars are now shortened by default (at least in Firefox and Apple’s Safari they are). I think it makes for easier reading. Update
My girlfriend said that she thought that the long sidebars looked better. So, I wrote a function to randomly expand one of the sidebar boxes so that visitors would get the idea that they could expand the boxes. Internet Sucky Browser Explorer can’t handle this function well so i’ve put it in hibernation until IE7 comes out (which promises to be ever so slightly less sucky).
- I also got rid of the “…” as the character for expansion and replaced that with “↓ and ↑”.
- I used some DOM manipulation code to do the images from Amazon load in the background, you don’t see it when you first visit the site, but it speeds up the load a little bit.
- I cleaned up the About section, I guessed with my life having changed so much lately it was worth freshening that content a little bit.
- The glossary has been cleaned up too.
- I removed the consumed media section. I wasn’t updating it, I don’t think anyone cared, and frankly, I wouldn’t blame them for not.
- Added some new groovy CSS so that I could have a ‘terminal looking’ terminal as seen in this post.
- As always, I designed this page to Firefox, so if you have issues with other browsers they may be a bit behind in implementing some of the features I used.
- On the back end, I updated my WordPress code so that I was no longer hacking up the original code, but just overlaying my cosmetic changes onto the pristine source. This should make upgrades a bit nicer.
- Added an inline more utility so that instead of clicking “read more” doing another server query and reload, it just expands within the browser. I thought that was a nice feature and much thanks to Chroder for writing the plugin. I didn’t want to have to write more DOM code today.
Posted in Meta | No Comments »
Saturday, September 2nd, 2006
As I posted earlier, I’m undertaking to better understand the basics of the DOM, Javascript, and DHTML on my pilgrimage to being Ajax competent. I’m using Ajax in Action as my guide.
Recently at work, we had need of a basic ‘dashboard’. It’s a pretty simple design: boxes on the left with one level of drop down for menus, a big, central ‘content’ section in the middle.
I was thinking of how I wanted to implement this.
- It needed to be flexible (i.e. layout should be described in an XML file)
- It needed to be updatable without touching the JavaScript (to get a feel for the Ajax design)
- It needed to be somewhat visually appealing.
The goal was to use Javascript to create a 100% DOM rendered page that worked in IE and Firefox.
Here’s the product
Here’s how I did it after the jump….
<pre>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel=stylesheet type="text/css" href="dashboard.css">
<script type="text/javascript" src="dashboard.js" ></script>
<title>Dashboard</title>
</head>
<body onload="javascript:pageLoad()">
<div id="page_container">
<div id="navigation_bar">
</div>
<div id="content_area">
<div id="titlebar_area">
<div>
<p id="title">A Basic Dashboard Example</p>
</div>
</div>
<div id="main_area">
<h1>Welcome to the dashboard example</h1>
<p> Double-click an item to the left to
expand/collapse.</p>
</div>
<div id="footer">
<p>
<a href="http://validator.w3.org/check?uri=referer"><img
src="http://www.w3.org/Icons/valid-html401"
alt="Valid HTML 4.01 Transitional" height="31" width="88">
</a>
</p>
<p style="text-transform:small;font-variant:small-caps;
font-size:8pt;text-align:right"><em>Version 0.1</em></p>
</div>
</div>
</div>
</body>
</html>
</pre>
You basically have two critical areas in this skeletal bit of HTML: the navigation_bar div and the main_area div. My code is focused on putting “main navigational areas” in the navigation_bar. Updates into the “main view” may need to happen ( it doesn’t really happen in this code ).
To lay out the prettyness of the page, we use CSS:
<pre>
body{
margin-left:0px;
background-color:#AAAAAA;
font-family: arial, helvetica, courier, times;
}
div#page_container{
background-color:#AAAAAA;
margin-right: 10%;
}
div#navigation_bar{
position:absolute;
padding-left:0px;
margin-left:0px;
margin-top:10px;
width: 200px;
width: 300px;
height: 100%;
background-color: #AAAAAA;
}
div.navigation_block{
position:relative;
background-color: white;
margin-bottom: 5px;
margin-left: 5px;
margin-right: 5px;
border-width: 2px 1px 3px 3px;
border-style: solid;
border-color: #222222;
padding-bottom:2px;
width: 11em;
}
div.navigation_block p{
width: 80%
}
div.navigation_block_submenu{
margin-bottom: 5px;
margin-left: 10px;
margin-top: 0;
margin-right: 0px;
margin-left: 5px;
padding: 0px 0px 0px 3px;
margin-bottom:3px;
width: 9em;
background-color:#DDD;
}
.submenu_element{
padding-top:0px;
margin:0px;
font-size: 0.95em;
}
div.navigation_block p{
padding-left: 5px
}
div#content_area{
position:relative;
top:0px;
left:200px;
width:200px;
width:40em;
padding-left:0px;
padding-top:2px;
margin-left:0px;
margin-top:10px;
background-color: #AAAAAA
}
div#titlebar_area{
background-color: white;
border-width: 2px 1px 3px 3px;
border-style: solid;
border-color: #000000;
margin-top: 8px;
height: 52px;
padding:0.5em;
}
p#title{
color:black;
text-align:center
}
div#main_area{
background-color: #FFFFFF;
border-width: 2px 1px 3px 3px;
border-style: solid;
border-color: #000000;
height:370px;
margin-top: 5px;
padding: 2px;
height:100%
}
div#main_area h1{
border-width: 0 0 3px 2px;
border-color: #AAAAAA;
border-style:solid;
color:black;
font-size: 1em;
padding-left: 2px;
margin-right: 2%
}
div#footer{
background-color:#AAA;
padding-top: 10px;
padding-right:0px;
width: 40em
}
/* Stupid hack for stupid internet explorer */
html>body div {
width: 40em
}
/* Make changes that make IE happy, make FF happy */
*
{
-moz-box-sizing: border-box !important;
}
</pre>
That’s the CSS. Now, let’s show the code on how we dynamically update these pages.
/* dashboard.js
AUTHOR: Steven G. Harms (stharms@cisco.com)
CREATION: 8/28/2006
A script that is used with an XML file to use the DOM to create a Web2.0 /
DHTML-y web site
*/
// Global variables, used sparingly
var xmlDoc;
// Function Declaration Area
function add_a_footer(entered_text){
var dom = document.domain;
var myText = document.createTextNode("hello, " + dom);
document.getElementById("footer").appendChild(myText);
var childEl=document.createElement("div");
childEl.className='navigation_block';
childEl.appendChild(myText);
document.getElementById("footer").appendChild(childEl);
}
function addAnEvent(anObject, eventType, callback, capture){
if (window.XMLHttpRequest){ // it's a mozilla-like thing!
anObject.addEventListener(eventType, callback, capture);
return anObject
}else{
anObject.attachEvent('on' + eventType ,callback);
return anObject
}
}
function appendTitleBlock(anObject, myTitle){
//alert('cunning '+aTitle);
if ( myTitle == "" ){
aTitle="ERROR!";
}
var appendTitle = document.createTextNode(myTitle);
var title = document.createElement('p');
title.appendChild(appendTitle);
anObject.appendChild(title);
return anObject;
}
function browser_mutate(){
// Some tricks to help IE render properly
var browser = navigator.appName;
if (browser.match(new RegExp("Microsoft", "i"))){
// Line up the box model
var navbar = document.getElementById('navigation_bar');
navbar.style.marginTop='8px';
//Make sure our submenus are properly whited-out
for ( var divvie in document.getElementsByTagName("div")){
if (divvie.match(new RegExp("submenu","i"))){
var node = document.getElementById(divvie);
node.style.backgroundColor="#FFF"
}
}
}else{
var navbar = document.getElementById('navigation_bar');
navbar.style.marginTop='10px';
}
}
function buildSubmenuFor (aBlock, manipulationClosure){
//alert(aBlock.getAttribute('name'));
//alert(aBlock.childNodes.length);
var childItem;
var theDiv = document.createElement('div');
for (var i=0; i<=aBlock.childNodes.length; i++){
//alert(aBlock.childNodes.item(i));
if (
( aBlock.childNodes.item(i) != null ) &&
( aBlock.childNodes.item(i).nodeName == "name")
){
childItem = aBlock.childNodes.item(i);
//alert ( aBlock.childNodes.item(i));
//alert(childItem.getAttribute('href'));
var theURL = childItem.getAttribute('href');
//alert(childItem.firstChild.nodeValue)
var theTarget= childItem.firstChild.nodeValue
//Create a link item and put it in a paragraph
var linkPara=document.createElement('p');
linkPara.className='submenu_element';
var link = document.createElement('a')
link.setAttribute('href', theURL)
link.setAttribute('class','submenu_element' )
var textual_data = document.createTextNode(theTarget);
link.appendChild(textual_data);
linkPara.appendChild(link);
theDiv.appendChild(linkPara);
}
}//end For
if (manipulationClosure == null ){
return theDiv;
}else{
return manipulationClosure(theDiv)
}
}
/*
This function receives a Javascript "Element" object
*/
function createNavBlock(aBlock){
// This might seem obvious, but this is an HTMLDivElement in
// the API references
var constructedBlock = document.createElement('div');
constructedBlock.className="navigation_block";
constructedBlock.id=aBlock.getAttribute('name');
constructedBlock.setAttribute('id',aBlock.getAttribute('name'));
if ( false ){
alert('Constructed Block Object: ' + constructedBlock + "\n" +
'Class Name: ' + constructedBlock.className + "\n" +
'ID: ' + constructedBlock.id);
}
return constructedBlock;
}
/*
This function creates the main navigational blocks to the left of the
screen.
It also seeds them with the callback function that is used to extract
the fuller drop-down
*/
function createNavMenu(){
var array_of_blocks = xmlDoc.getElementsByTagName('block');
var nav_section = document.getElementById('navigation_bar');
for (var i=0; i<array_of_blocks.length; i++){
var navBlock = createNavBlock(array_of_blocks[i]);
if ( false ){
alert('Constructed Block Object: ' + navBlock + "\n" +
'Class Name: ' + navBlock.className + "\n" +
'ID: ' + navBlock.id);
} //end if
navBlock = addAnEvent(navBlock, 'dblclick', eventHandler, 'false');
navBlock = appendTitleBlock(navBlock, array_of_blocks[i].getAttribute('displaytitle'));
nav_section.appendChild( navBlock );
}// end for
}
function eventHandler(anEvent){
var myEvent = anEvent ? anEvent : window.event;
var thisName = this.id ? this.id : window.event.srcElement.id;
/* Due to a bug in IE's rendering of CSS, it's possible that someone could click
on the title of a box ( even though they're clicking outside of the title )
and thus a 'null' value for thisName will be, quite legally, derived. To
catch this we send return, the user will assume they didn't dblclick properly
*/
if (thisName == ""){
return
}
if (false){
alert ('howdy '+anEvent
+ "\n and..." + this
+ "\n and..." + thisName);
}//end debugging truefalse
if ( thisName == null ){
return
}
var screenBlock = document.getElementById(thisName);
if ( isExpanded(screenBlock) ){
//alert('expanded');
//alert(screenBlock.getElementsByTagName('div')[0])
screenBlock.removeChild(screenBlock.getElementsByTagName('div')[0])
}else{
//alert('not expanded');
var informationBlock = findBlockWithName(thisName);
buildSubmenuFor(informationBlock);
screenBlock.appendChild(buildSubmenuFor(informationBlock, function (aDiv)
{
aDiv.className="navigation_block_submenu";
aDiv.setAttribute('id',thisName + '_submenu');
return aDiv
}));
}
}
function findBlockWithName(aName){
//alert(aName);
var array_of_blocks = xmlDoc.getElementsByTagName('block');
for (var i=0; i<array_of_blocks.length; i++){
// alert('! ' + array_of_blocks[i].getAttribute('name'));
if (array_of_blocks[i].getAttribute('name')==aName){
return array_of_blocks[i];
}
}
}
function importXML(){
if (document.implementation && document.implementation.createDocument) {
xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.onload = createNavMenu ;
}else if (window.ActiveXObject){
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = function () {
if (xmlDoc.readyState == 4) createNavMenu ()
};
}else{
return;
}
xmlDoc.load("navigation.xml");
}
function isExpanded (blockToExamine){
//alert (blockToExamine);
var cNodes =blockToExamine.childNodes;
for (var i=0; i<cNodes.length; i++){
if (cNodes.item(i).tagName == 'DIV'){
return true;
}
}
return false;
}
function pageLoad(){
browser_mutate();
importXML();
}
And lastly here’s the XML file:
<blocks>
<block name="aggregator_block" displaytitle="Aggregator Sites">
<name href="http://www.reddit.com">Reddit</name>
<name href="http://www.digg.com">Digg</name>
</block>
<block name="timewaster_block" displaytitle="Timewasters">
<name href="http://www.youtube.com">Youtube</name>
<name href="http://www.socialitelife.com">Socialite's Life</name>
</block>
</blocks>
Posted in AJAX, design, Technology and Computers | No Comments »
Saturday, September 2nd, 2006
Let’s see if i can find a nice way to insert code
#code into a code block
$_='yo momma';
print "Please don't tell any more $_ jokes";
$foo='foo';
$bar='bar'
for ($foo, $bar){
print "$_\n";
}
Hm, i like it, looks like a good ol’ unix terminal.
Posted in Meta | No Comments »