Category: Web Building

Construct a variable name in PHP from a string and another variable

The “Shop” page of this site is a php page which displays an amazon a-store category and the second level tabs appropriate to that category, using a “node id”.

The html for the tabs is defined in an included page like this:

<?php
//-------------//
$tabs6= '<ul class="yui-navset bd">';
$tabs6.='<li class="first selected" id="tab6"><a href="shop.php?tab=6" >Web Development</a></li>';
$tabs6.='<li class="" id="tab180"><a href="shop.php?tab=180" >CSS</a></li>';
$tabs6.='<li class=" " id="tab183"><a href="shop.php?tab=183">Javascript</a></li>';
$tabs6.='<li class="last" id="tab181"><a href="shop.php?tab=181">DHTML</a></li>';
$tabs6.='</ul>';

$tabs180= '<ul class="yui-navset bd">';
$tabs180.='<li class="first " id="tab6"><a href="shop.php?tab=6" >Web Development</a></li>';
$tabs180.='<li class="selected" id="tab180"><a href="shop.php?tab=180" >CSS</a></li>';
$tabs180.='<li class=" " id="tab183"><a href="shop.php?tab=183">Javascript</a></li>';
$tabs183.='<li class="last" id="tab181"><a href="shop.php?tab=181">DHTML</a></li>';
$tabs180.='</ul>';

$tabs183= '<ul class="yui-navset bd">';
$tabs183.='<li class="first " id="tab6"><a href="shop.php?tab=6" >Web Development</a></li>';
$tabs183.='<li class="" id="tab180"><a href="shop.php?tab=180" >CSS</a></li>';
$tabs183.='<li class=" selected" id="tab183"><a href="shop.php?tab=183">Javascript</a></li>';
$tabs183.='<li class="last" id="tab181"><a href="shop.php?tab=181">DHTML</a></li>';
$tabs183.='</ul>';

?>
Continue reading

Site Optimization: use Google Suggest and Google Trends to determine top searches

Google Suggest and Google Trends are easy-to-use tools you might not have thought of using for search engine optimization (SEO).

Google Suggest suggests terms related to whatever keywords you type in, and lists the number of results for each one. According to the FAQ, it uses data about the overall popularity of various searches to help rank the refinements it offers.

Continue reading

Voice recording with the iPhone

UPDATE 2: March 27, 2009 I’ve been using QuickVoice for a couple of months now. It’s good enough that I use it to record piano sessions and meetings. It is pretty sensitive. I did purchase the 15.00 syncing software which you need to pull the files off the iPhone if you haven’t jailbroken it.
UPDATE: Jan 24, 2009 Since this article was written, the app store was launched and there are now many Voice recording apps for the iPhone. Click here to search for the latest list of Voice Recorder applications available in the iTunes Store

Now you can record your voice with the iPhone (or any other phone), and get speech to text functionality as well!

Continue reading

Timing Issues and Javascript

Sometimes, when you use javascript to make a change to some element on a page, you will get a Javascript error along the lines of: “element ‘n’ has no properties.” You check your page, and yes, the element is definitely there, and it is definitely named correctly, and your syntax is definitely correct. So where is the problem?

Well, it may be a timing issue. If your script executes before the element targeted by the script has been rendered, it will not find the element. This can particularly be a problem with frames or iframes. The solution is to move the function call to the bottom of the page, after the element has loaded.

Continue reading

How to analyze Captivate Movie structure

If you want to create widgets that control Captivate files with new functions, other than the standard playbar functions, you will need to develop them in flash. Here’s how to figure out what is going on in a Captivate movie file:

Create a Captivate movie, and publish it (Captivate 2) or export it to Flash (Captivate 3). To create my faster-slower widgets, I had to decompile it into an .fla (I used SWFdecompiler )

Open it in Flash, and start exploring the structure. If you are using version 3, by far the best tool you can use include the “debug movie” command.

Continue reading

Use Subtitle Workshop to generate captions for Rich-MediaProject

Over the last couple of years, Microsoft Producer has become less and less of a viable option for synching powerpoint and video. Probably because of browser changes, it works on less browsers than before, and is no longer compatible even with Powerpoint 2007. So I went in search of a Flash-based replacement for MS Producer. I’ve found it in the Rich-Media-Project’s Rich-Media Pack I.

RMP I features 4 components: A Flash-Paper “player”, an FLV video player, a slide list and a media playlist. You create a flash-paper version of the powerpoint or word document, then synch it to the video with XML. The playlist is generated by another xml file, and the captions are created using a third XML file.
The only thing missing is an easy way to create the XML files, so I am creating templates for the captions and slide list XML files in Subtitle workshop. Below is the code for the Custom Format file for the captions:

Continue reading

Perception 4.3 meets an Oracle 10g bug: Unsupported network datatype or representation

Last January, I installed a test instance of Questionmark’s Perception server, version 4.2, in preparation for upgrading our version 3.4 Perception server. At the time, we were using Oracle version 9i. Once installed, our testing went well, and we did not notice any significant problems.

In July, we finally got around to doing the actual upgrade, and decided to upgrade the database to Oracle 10g at the same time. The installation and conversion of our version 3.4 data went very smoothly. Everything ran well for about a week. Then things began to go wrong. When we would open the Authoring Manager, it would refuse to show us any assessments (“assessments can’t be found”.) Then it would tell us administrators couldn’t be found. After a few days, the assessments disappeared from the Perception Server as well, meaning users could no longer take them. After trying numerous fixes, we reverted to a recent backup of the database from a couple of days before, and the problem disappeared. The one Oracle error that both Perception Server and Authoring Manager were giving was “ORA-03115: unsupported network datatype or representation.”

Continue reading

How to run Red 5 on a shared IIS server on port 80

Setting up Red5 on a box which also contains a web server can be a challenge if you are restricted to using specific ports because of a firewall. Here is how we set up Red5 on a Windows 2003 server which also contains a production IIS server.

Our firewall only allows traffic on ports 80 and 443. This is non-negotiable, so we needed to work around the requirement.

The folks – in particular Walter Tak – on the Red5 mailing list pointed me in the right direction: Make another IP (or two) for Red 5 to run under.

IIS was already using ports 80 and 443, so the system administrator made two additional IPs for Red5 to use, one for rtmp and one for http. He then changed the settings in the Default Website Properties in IIS Manager: In Web Site Identification: IP Address, instead of (All Unassigned), he selected the single IP which we wanted IIS to listen on. We did not want IIS to interfere with port 80 on the IPs used by Red5.

Continue reading

Detect browser support for style properties

It is common to use object detection to discriminate between browser capabilities (See Quirksmode: Object Detection.

However, sometimes it is necessary to detect whether or not a browser understands a particular CSS style property, and it is not obvious how to do this.

You can’t test for the existence of the property directly but you can test for the data type of the value of the property. If the data type is anything but “undefined”, the property is understood by the browser.

The example below shows a couple of rows from an automatically generated table of items. Each row has a corresponding editable version which shows up when the “edit” button is clicked. The original, non-editable row is hidden at the same time the editable row is displayed. If “display=’block” is used to display the TR, Safari will render it as a TD. To correct this, “display=’table-row” must be used on browsers that understand it.

Continue reading