January 18, 2005

Powerbook G4 will not turn on

I was given an old Powerbook 15" aluminum version, which I used a few times, then left idle for several months.

When I got it out again, I plugged in the power cord, which did not light up orange, like it's supposed to. After a look at the apple discussion boards, it appears that a common cause of this problem is that the power adaptors tend to go bad. So I tried out another adaptor - it worked fine, and charged the battery all the way up. Looks like I'll be getting a new one.

Apple sells the regular power adaptor AND the universal power adaptor by Kensington for $79.00. Just search the apple.com store for "power adaptor".

Posted by ellen at 11:49 AM

January 12, 2005

The MacMini

Well they've finally done it - made a computer I can afford to buy my parents, who need one even if they don't know it!

One weird thing - I could have sworn that on Tuesday, the $599 version included 512MB of RAM, but today (Wednesday) it is 256MB. I guess the price of RAM just went up. Memory is one place they need to cut the price. Usually ClubMac doubles it when you buy a CPU, but they're doing that on this product so far.

256MB of RAM is just not enough. I would like to know how well it runs "parent-type" apps: email and a web browser, and maybe iphoto, with that.

Posted by ellen at 8:44 PM

January 6, 2005

Conditional SSI

I was having trouble writing a javascript that sniffs the browser for IE or non-IE, then selects a server side include (SSI) based on the result.

It turned out that you cant do that with javascript: first of all it seems to mis-read the include string:
document.write('<!--# include virtual="includes/safety.htm" -->');


The browser sees this as comment and lops everything off after the (' even though the string has quotes around it. If I use a \ to escape the ! as \!, then it simply writes the whole string out to the page, rather than interpreting it. Apparently this is because SSI's are evaluated on the server, so they are already executed before the browser renders the page - so by the time my page gets rendered, it's too late.
Many thanks to glenngv of codingforums.com for help with this.
Here is the code I ended up using, and it works great:

		
<!--#if expr="${HTTP_USER_AGENT} = /MSIE/" -->
<!--# include virtual="includes/safety.htm" -->
<!--#else -->
<!--# include virtual="includes/safety_nonIE.htm" -->
<!--#endif -->


This chooses a server-side include based on the user agent.

For more information on this see these links:

Conditional SSI by John Miller
and
Webmaster's Guide to Server Side Includes: Conditional SSI

and Apache SSI: conditional expressions
Posted by ellen at 6:44 PM

January 3, 2005

Passing a variable in the URL to turn on and off layers in another page

I have a series of five flowcharts in a tabbed layout, one flowchart per tab (seem to be doing tabs a lot lately). I wanted the user to be able to click a link on another page, and have the flowchart page open to the correct flowchart layer. A working example is here:

Switch layers on the next page by clicking a link

When I tried setting the value of a variable on the new page, it worked in some browsers but not others, probably because some computers are slower at loading pages than others, and the necessary layers would not be loaded in time for the variable to have something to populate. I had a couple of functions in the first page something like:

 
<script language="JavaScript" type="text/JavaScript"> 
<!-- 
function openwindow() 
{ 
flowchart = window.open('http://www.med.umich.edu/i/mandatories/restraint/flowchart/index.htm','flowchart'); 
setTimeout('switchLayers',5000);
} 
function switchLayers(selectedLayer) 
{ 
flowchart.document.getElementById('Agitation').style.visibility = 'hidden'; 
flowchart.document.getElementById(selectedLayer).style.visibility = 'visible'; 

// return false; 
} 
--> 
</script> 

This worked on fast machines, but not on slow ones, and not at all on Netscape.

So instead I decided to put the parsing code in the receiving page, the flowchart page.

Here's how I got this to work:

The links on the first page are of this form:

 
<a href="http://yourserver.com/flowchart.htm?agit" target="new">Click to go to Agitation  
<a href="http://yourserver.com/flowchart.htm?poor" target="new">Click to go to Poor Sitting Posture
<a href="http://yourserver.com/flowchart.htm?wand" target="new">Click to go to Wandering
Click to go to Unsafe Mobility
<a href=http://yourserver.com/flowchart.htm?conf" target="new">Click to go to Confused Behavior
This sends a 4 letter code to the target page in the URL. I included a script at the head of the receiving page:


<script language="JavaScript" type="text/JavaScript">
<!--
function switchLayers(selectedLayer, deselectedLayer)
{ 
 document.getElementById(selectedLayer).style.visibility = 'visible';
 document.getElementById(deselectedLayer).style.visibility = 'hidden'; 
 return false;
}

function jumpToLayer()
{
query = window.location.search.substring(1,5);
 document.getElementById('Agitation').style.visibility = 'hidden'; 
  if (query=='agit') {
  document.getElementById('Agitation').style.visibility = 'visible';
  } 
 else if (query=='conf') {
  document.getElementById('ConfusedBehavior').style.visibility = 'visible';
  } 
 else if (query=='wand') {
  document.getElementById('Wandering').style.visibility = 'visible';
  } 
  else  if (query=='poor') {
  document.getElementById('PoorSittingPosture').style.visibility = 'visible';
  } 
 else  if (query=='unsa') {
  document.getElementById('UnsafeMobility').style.visibility = 'visible';
  }
else {
document.getElementById('Agitation').style.visibility = 'visible';
} 
}
-->
</script>

Then I included this script at the very end of the page "flowchart.htm" just before the body tag. I put it at the end to make sure the layers had all been parsed and loaded by the browser.

 
<script language="JavaScript" type="text/JavaScript">
<!--
jumpToLayer();
-->
</script>

Posted by ellen at 4:14 PM