Adobe Software Hacked

Good grief, this is the first I’ve heard of this. (I have an Adobe account…)

38 million Adobe users’ accounts compromised.

Credit card information also appears to have been stolen.

Posted in Adobe Suite | Comments Off on Adobe Software Hacked

Print-O-Matic Plugin Added

[Update (May 24/14): Print-O-Matic has ceased working. It has therefore been deactivated & deleted from this site.]

Update (June 8/14): The Print-Friendly & PDF Settings plugin has been installed in Print-O-Matic’s place, and seems to be working well.


Just added the Print-O-Matic plugin for WordPress. The short-code has been added to one of my most popular posts: How To Manually Install WordPress On GoDaddy.

The short-code being used is:

[print-me target="#post-13"]

(Where #post-13 is the DIV id corresponding to the post in question.)

See the Print-O-Matic site for further documentation regarding short-codes.

Posted in WordPress, WordPress - Plugins | Comments Off on Print-O-Matic Plugin Added

Excel 2010 Tutorial

From GCF Learn Free. Looks pretty good.

Posted in Excel 2010 | Comments Off on Excel 2010 Tutorial

Google vs. Bing

Currently, Google’s search engine finds 110 links related to this site.

Bing’s search engine can only find 10.

Granted, sitemaps were submitted to Google a few months earlier than Bing last year, so it’s had a head-start. Nonetheless, Bing has had nearly a year, and it supposedly is better at indexing Flash pages than Google.

Given these results, that doesn’t seem to be the case. Google indexed most of this site’s Flash pages within two months; after one year, Bing has managed to index only 6 out of this site’s 39 Flash pages.

Posted in Search Engines | Comments Off on Google vs. Bing

Strange Text Scrolling In AS 2 SWF File

An introduction to a translation in ancient Greek was online on this site for a few years before a peculiar error was discovered.

Before scrolling, the text displays correctly:

Text on Flash page before scrolling problem observed

After scrolling, the top line of English text disappears:

Text disappears on Flash page after scrolling

Upon entering the FLA file for this page, the textbox was found to be erroneously set to Input Text instead of Static Text.

The problem was not observed again after the fix was made and a new SWF was published and uploaded to the server:

Text no longer disappears on Flash page after scrolling

Posted in Flash, Flash - ActionScript 2, Flash - Text | Comments Off on Strange Text Scrolling In AS 2 SWF File

Copyright Year For Flash Pages

Generating a copyright notice on a Flash page is a relatively straightforward matter.

I. Print the Current Year

A. ActionScript 2

Regardless of whether one is using AS 2 or AS 3, a textbox needs to be created somewhere on the stage. The settings for this textbox should be as follows:

  1. Properties > Classic Text and Dynamic Text
  2. Paragraph > Align Right (if the textbox is on the right-hand side of the stage)

This textbox then needs to be instantiated with a name (such as copyrightTxt).

Following this, a new layer should be created and labelled Actionscript. Click on a keyframe within the Actionscript layer, and hit F9. With the following AS 2 code, the textbox will be populated with a copyright notice when the SWF file is run:

currDate = new Date();
currYear = currDate.getFullYear();

copyrightTxt.text = "\u00A9 Chou Seh-fu 2010-" + currYear + ".  All Rights Reserved.";

Here, a new date object (currDate) is created, and the current year (with 4 digits) is extracted into the currYear variable. The current year is then output to the textbox along with the rest of the copyright information.

(\u invokes unicode in ActionScript; 00A9 is unicode for the copyright symbol.)

B. ActionScript 3

The textbox and layer creation procedure is mostly the same for AS 3, though one has a choice between using either 1) Classic Text with Dynamic Text or 2) TLF Text.

The AS 3 code is virtually the same as the AS 2 code, with minor syntactical differences:

var currDate:Date = new Date();
var currYear:String = String(currDate.getFullYear());

copyrightTxt.text = "\u00A9 Chou Seh-fu 2010-" + currYear + ".  All Rights Reserved.";

II. Print Year or Range of Years

As discussed in a previous post, the code can be made slightly more sophisticated by way of conditional statements to prevent outputs such as this:

© Chou Seh-fu 2013-2013. All Rights Reserved.

A. ActionScript 2

startYear = 2010;
currDate = new Date();
currYear = currDate.getFullYear();

if(startYear == currYear){
	copyrightTxt.text = "\u00A9 Chou Seh-fu " + startYear + ".  All Rights Reserved.";
}
else{
	copyrightTxt.text = "\u00A9 Chou Seh-fu " + startYear + "-" + currYear + ".  All Rights Reserved.";
}

B. ActionScript 3

var startYear:String = String(2010);
var currDate:Date = new Date();
var currYear:String = String(currDate.getFullYear());

if(startYear == currYear){
	copyrightTxt.text = "\u00A9 Chou Seh-fu " + startYear + ".  All Rights Reserved.";
}
else{
	copyrightTxt.text = "\u00A9 Chou Seh-fu " + startYear + "-" + currYear + ".  All Rights Reserved.";
}

The code in this post is word-wrapped. If copying & pasting, be wary of inserting carriage returns.

Posted in Copyright Year Code, Flash, Flash - ActionScript 2, Flash - ActionScript 3 | Comments Off on Copyright Year For Flash Pages

Copyright Year Range For Static XHTML Pages

UPDATE (June 22/14): The conditional Server Side Includes in this code no longer appear to work on GoDaddy. Some permission may have been changed on their server…

This simplified code does work for XHTML-Transitional, however:

<div id="copyright">© Chou Seh-fu <script src="javascript/copyrightYearRange.js" type="text/javascript" ></script><script>printCopyrightYears(2012);</script><noscript>

	<!--#config timefmt="%Y" -->
	<!--#set var="startYear" value="2012" -->
	<!--#echo var="startYear" -->-<!--#echo var="DATE_LOCAL" -->.
	</noscript>  All Rights Reserved.
</div>

The previous post showed how the current year could be added to a copyright notice for a static XHTML page. However, if the XHTML file creation year is the same as the current year, then undesirable output like the following may be obtained:

© Chou Seh-fu 2013-2013. All Rights Reserved.

This post will describe how to better automate the JavaScript and Server-Side Includes (SSI) to avoid this.


I. The JavaScript

The XHTML file copyright code was changed slightly. It now calls a new JavaScript file, copyrightYearRange.js in the site’s javascript directory:

<div id="copyright">© Chou Seh-fu <script src="javascript/copyrightYearRange.js" type="text/javascript" ></script><script>printCopyrightYears(fileCreationYear);</script>  All Rights Reserved.</div>

After copyrightYearRange.js is called, a second set of <script> tags calls the printCopyrightYears() function, and feeds the XHTML file’s creation year into this function.

For example, if the static XHTML file was created in 2010, the code would look like this:

<div id="copyright">© Chou Seh-fu <script src="javascript/copyrightYearRange.js" type="text/javascript" ></script><script>printCopyrightYears(2010);</script>  All Rights Reserved.</div>

The JavaScript in the copyrightYearRange.js file consists of the following code:

var startingYear;

function printCopyrightYears(startingYear){
   var currentDate = new Date();
   var currentYear = currentDate.getFullYear();

   if (startingYear == currentYear){
      //Print the copyright as a single year (eg: "© Chou Seh-fu 2013...")
      document.write(startingYear + ".");
   }
   else{
      //Print the copyright as a range of years (eg: "© Chou Seh-fu 2010-2013...")
      document.write(startingYear + "-" + currentYear + ".");
   }
}

Here, the XHTML file’s year-of-creation is fed into the printCopyrightYears() function via the dummy variable startingYear. Next, the current year is generated, and compared to the year-of-creation. If the two are the same, the following copyright information is obtained:

© Chou Seh-fu 2013. All Rights Reserved.

On the other hand, if the current year and the file’s year-of-creation differ, the copyright information is printed in range format:

© Chou Seh-fu 2010-2013. All Rights Reserved.


II. Server-Side Include Code (displayed in cases where JavaScript is disabled)

This was tricky, due to my unfamiliarity with SSI code. A webpage at  The University of Pennsylvania Computing helped me arrive at something that worked:

<div id="copyright">© Chou Seh-fu <script src="javascript/copyrightYearRange.js" type="text/javascript" ></script><script>printCopyrightYears(2010);</script><noscript>

      <!--#config timefmt="%Y" -->
      <!--#set var="CURRENTYEAR" value=$DATE_LOCAL -->
      <!--#if expr="$CURRENTYEAR = /2010/" -->
         <!--#echo var="CURRENTYEAR" -->
      <!--#else -->
         2010-<!--#echo var="CURRENTYEAR" -->
      <!--#endif -->

   </noscript>.  All Rights Reserved.
</div>

In this code, a variable called CURRENTYEAR is initialized and set to the current year. After that, it follows much the same logic as the JavaScript code (though of course, the syntax is quite different).

Nonetheless, this solution was somewhat dissatisfying, since the webmaster was required to remember to set the year-of-creation three times (once in the JavaScript function call, and twice in the SSI).

FortBoise.org provided the basis for the final code:

<div id="copyright">© Chou Seh-fu <script src="javascript/copyrightYearRange.js" type="text/javascript" ></script><script>printCopyrightYears(fileCreationYear);</script><noscript>

      <!--#config timefmt="%Y" -->
      <!--#set var="startYear" value="fileCreationYear" -->
      <!--#if expr="${DATE_LOCAL} = ${startYear}" -->
         <!--#echo var="DATE_LOCAL" -->.
      <!--#else -->
         <!--#echo var="startYear" -->-<!--#echo var="DATE_LOCAL" -->.
      <!--#endif -->
   </noscript>  All Rights Reserved.
</div>

Worth noting is the conditional statement <!--#if expr="${DATE_LOCAL} = ${startYear}"-->; getting the syntax correct for this line took a very long time. In the end, it was helpful to be aware that “this is a string comparison, not a numeric comparison”.

This final SSI code requires the webmaster to set the year-of-creation only twice. Thus, for example, if the XHTML file’s year-of-creation was 2012, the code would read as follows:

<div id="copyright">© Chou Seh-fu <script src="javascript/copyrightYearRange.js" type="text/javascript" ></script><script>printCopyrightYears(2012);</script><noscript>

	<!--#config timefmt="%Y" -->
	<!--#set var="startYear" value="2012" -->
	<!--#if expr="${DATE_LOCAL} = ${startYear}" -->
		<!--#echo var="DATE_LOCAL" -->.
	<!--#else -->
		<!--#echo var="startYear" -->-<!--#echo var="DATE_LOCAL" -->.
	<!--#endif -->
	</noscript>  All Rights Reserved.
</div>

POSTSCRIPT: After some testing, it appears that caching is not a problem for the SSI code.

In that case, it is probably unnecessary for webmasters to use both JavaScript and SSI for generating copyright notices (SSI is probably preferable, given that it is viewable by everyone).

In the interests of completeness then, this is what the code would look like just using SSI:

<div id="copyright">© Chou Seh-fu 

	<!--#config timefmt="%Y" -->
	<!--#set var="startYear" value="fileCreationYear" -->
	<!--#if expr="${DATE_LOCAL} = ${startYear}" -->
		<!--#echo var="DATE_LOCAL" -->.
	<!--#else -->
		<!--#echo var="startYear" -->-<!--#echo var="DATE_LOCAL" -->.
	<!--#endif -->
	All Rights Reserved.
</div>

The code in this post is word-wrapped. If copying & pasting, do NOT add returns to this code!

Server-Side Includes do not work in offline testing – the XHTML file which contains them needs to be uploaded to a server!

Posted in Copyright Year Code, HTML & CSS, JavaScript, Server-Side Include code | Comments Off on Copyright Year Range For Static XHTML Pages

Current Copyright Year For Static XHTML Pages

I. With Hard-Coding

Originally, the current copyright year for the entry page on this site was hard-coded in XHTML. This worked fine, except it was always necessary to remember to change the current year every January 1st:

<div id="copyright">© Chou Seh-fu 2010-2013. All rights reserved.<div>

The output was as follows:

© Chou Seh-fu 2010-2013. All rights reserved.


II. With JavaScript

In 2011, the current year was not changed on time, so JavaScript was introduced to change the current year automatically:

<div id="copyright">© Chou Seh-fu 2010-<script src="javascript/currentYear.js" type="text/javascript" ></script>. All rights reserved.<div>

The currentYear.js file being called from the site’s javascript directory is composed of only two lines:

var theDate = new Date();
document.write(theDate.getFullYear());

This was successful in outputting the current year…for users who have JavaScript enabled.

But roughly 2% of users have JavaScript disabled, and they would receive the copyright without the current year:

© Chou Seh-fu 2010-. All rights reserved.

To allow those without JavaScript to view the current year, the current year was hard-coded on the XHTML page between the <noscript> tags following the <script> tag:

<div id="copyright">© Chou Seh-fu 2010-<script src="javascript/currentYear.js" type="text/javascript" ></script><noscript>13</noscript>. All rights reserved.<div>

III. With JavaScript & Server-Side Includes

Thus, the output was automated for 98% of users. But it still required hard-coding the current year for 2% of users without JavaScript.

This could have been fully-automated by using PHP, but this was deemed overkill.

Instead, Server-Side Includes (SSI) can be used in the <noscript> tags. This eliminates the need to hard-code the current year:

<div id="copyright">© Chou Seh-fu 2010-<script src="javascript/currentYear.js" type="text/javascript" ></script><noscript> <!--#config timefmt="%Y" --><!--#echo var="DATE_LOCAL" --></noscript>. All rights reserved.<div>

This site is hosted on an Apache server, and GoDaddy seems to have set it up to automatically parse the SSI in XHTML. Therefore, it does not seem necessary to encode this in SHTML.

(Much more on Apache SSI can be found here. And here.)


IV. With Server-Side Includes Only?

Final note: Although the XHTML code in Section III is currently in use, the JavaScript can actually be dispensed with entirely. This would result in simpler code:

<div id="copyright">© Chou Seh-fu 2010-<!--#config timefmt="%Y" --><!--#echo var="DATE_LOCAL" -->. All rights reserved.<div>

Though simpler, the XHTML page generated by this code may suffer from caching effects at the beginning of a new year (ie: at the beginning of a new year, the old page containing the previous year may still be in the cache).

For this reason, the more complicated code in Section III may be preferred.


POSTSCRIPT: After some testing, it appears that caching is not a problem for the SSI code.

In that case, it is probably unnecessary for webmasters to use both JavaScript and SSI for generating copyright notices (SSI is probably preferable, given that it is viewable by everyone).


The code in this post is word-wrapped. If copying & pasting, do NOT add returns to this code!

Server-Side Includes do not work in offline testing – the XHTML file which contains them needs to uploaded to a server!

Posted in Copyright Year Code, HTML & CSS, JavaScript, Server-Side Include code | Comments Off on Current Copyright Year For Static XHTML Pages

Add Outer Stroke To XHTML Text

The blog title on the entry page was looking a little bland, so it was punched up a bit with additional stroke around the XHTML text.

Here’s what it originally looked like:

XHTML Text with no outer stroke

And here’s what it looked like with additional CSS styling:

XHTML Text with outer stroke

This was accomplished by assigning a class (“textStroke“) to the h1 tag, and then setting some CSS3 attributes for this class.

XHTML code:

<h1 class="textStroke">Chou Seh-fu</h1>
CSS code:

.textStroke {
   text-shadow:
      -1px -1px 0 white, /* Stroke - upper left of text */
      1px -1px 0 white, /* Stroke - upper right of text */
      -1px 1px 0 white, /* Stroke - lower left of text */
      1px 1px 0 white, /* Stroke - lower right of text */
      /********* DROP SHADOW *************/
      5px 5px 10px black;
}

Interestingly, the drop shadow code MUST follow the stroke code. (If the drop shadow code precedes the stroke code, some of the stroke code will not be rendered.)


Postscript: More text effects using CSS3 text-shadow.

Posted in HTML & CSS | Comments Off on Add Outer Stroke To XHTML Text

Embed A SWF Video In XHTML

I took a 640px X 480px video of snow falling in Calgary recently and embedded it into XHTML. Here’s how it was done:

First, the .AVI file was imported into Flash. The height of this Flash file was set a little higher than the video (to 524px) in order for the video control skin to be displayed at the bottom of the video. The resulting SWF file was then placed into a directory called VIDEOS…though as mentioned in an earlier post, the SWF file for the video control skin had to be in the same directory as the XHTML file accessing it.

The XHTML code was as follows:

<object type="application/x-shockwave-flash" data="videopath/videoname.swf" height="524" width="640" ><param name="wmode" value="transparent" /></object>

The param name and param value settings here make the background color of the SWF stage transparent, so that the SWF movie seamlessly blends into the XHTML page.


The XHTML code displayed here is word-wrapped for ease of viewing. If copying & pasting, do not add returns to this code!

Posted in Flash, Flash - Video | Comments Off on Embed A SWF Video In XHTML