Archive for the 'web' Category

Jul 05 2008

WordPress upgrades

Published by under web

I’ve been using wordpress’ automatic update plugin on several sites and it works very nicely. A little tedious in places since it pauses to let you download backup files, tell you what’s next, etc. But, overall it is an excellent feature since installing upgrades is not an everyday thing and I forget the process between upgrades.

Update: The plugin has an automate upgrade option that avoids most of the pauses mentioned above. Very efficient.

No responses yet

Dec 10 2007

WordPress Upgrade to 2.3.1 & the k2 theme

Published by under web

Several problems have come up as a result of database table changes made in wordpress 2.3. Most if not all involve the categories table that was eliminated in favor of a new table. Some themes, including k2, and some plugins are no longer consistent with the database. It seems that the changes are mainly:

  • categories –> terms (a table)
  • cat_ID –> term_ID
  • cat_name –> name

I suppose this is documented better on a wordpress page somewhere, but I never found the description. Googling did turn up other leads.

On one of the sites that use k2, I found the problem in this file: …/wp-content/themes//page-archives.php

Commenting out the following two lines eliminated the error. A crude fix, but I haven’t noticed any bad effects yet.

// $numcats = $wpdb->get_var("SELECT COUNT(1) FROM $wpdb->categories");
// if (0 < $numcats) $numcats = number_format($numcats);

Another site that uses k2 has a different set of symptoms, but that was probably due to some files left over from a prior version of k2. Once I thorough clean out and upgrade with plugins off it was ok. The main trick for me was to switch to the default theme while doing the upgrade. When k2 was the active theme, the database upgrade step failed.

No responses yet

Nov 17 2007

Creating a favicon.ico

Published by under Mac,web,Windows

Every few years, I need to create a favicon (the little icon next to the URL in the address bar) for a web site. As I recall, the format for those little 16×16 pixel graphics was set by Microsoft when IE was taking over the browser market from Netscape, but for whatever reason, many graphics programs on OS X don’t create *.ico files. Fortunately, a free web site comes to the rescue. It will upload a graphic and turn it into a .ico file for you. There is an associated verification page that will check out the favicon.ico on your website.

Very helpful for those of us who create favicons very rarely.

Update: See comment below for another site that does favicons.

No responses yet

Jun 30 2007

Google Maps in WordPress

Published by under web

Google map API’s are freely available and it is easy to embed a map into html with the code samples provided by google. It is a little more difficult to put a map on a wordpress page since WordPress’ code generation messes up the embedded Javascript. The solution is to put the Javascript into an external file and load it with an “src” link.

The Allegro Cyclery page on this site is a simple example of this approach.

Update:
The above is based on a site using version 2.0.8 of word press. When I migrated the approach to a version 2.1.3 based site the extra editor “functionality” messed up an html ‘division’ badly. So then I tried an “iframe” which put the ‘division’s’ html in an external file. That worked nicely on firefox, but failed badly (i.e. no map) on IE6 and Safari. At the moment, no good solution is at hand. I’ll have to go back to trying to work around WordPress’s “functionality”.

Update 2
The problem got more complicated before it got better. Since I couldn’t use iframes, I was back to trying to get the basic HTML version of Googel maps working. By a process of eliminations on the failing HTML code page, I got the problem down to something in the WordPress style sheet conflicting with Google maps. I had no good idea about the nature of the specific issue.

Before trying to pin down the issue with the style sheets, I decided to google some more and located a WordPress plugin that sanded like it would do exactly what I needed so I downloaded and installed it. No joy. Same problem. So I read through the comments on the plugin site and found that others were having the same problem with a theme called k2 which is what the site was using.. The theme in use was k2. To cut to the answer, via a couple of blog discussions, I found the solution to the style sheet conflict in the native code and in the plugin in this blog entry. Now everything works as it should. Google and “blogan’s” blog entry saved me a lot of time.

No responses yet

Apr 15 2007

Using google video

Published by under web

Google video can be embedded in a web page by posting the video to google video and then using their docid in and object in your web page. The object is a us of a player provided by Google. Here’s an example:



That’s odd. The first parameter to an object tag seems to have to start on the same line as the object tag or else the whole page format is not rendered properly (at least in firefox). Subsequent parameter tags can be put on separate lines (as defined by a carriage return. Issue with mac vs unix carriage return?

Here’s the html that produced the above video. If cut and pasting, eliminate the return that preceeds “data=”

</p> <p><span style='text-align:center;display:block;'><br /> <object width='400' height='326' type='application/x-shockwave-flash' data='http://video.google.com/googleplayer.swf?docId=-2022406929085573519'><param name='allowScriptAccess' value='never' /><param name='movie' value='http://video.google.com/googleplayer.swf?docId=-2022406929085573519'/><param name='quality' value='best'/><param name='bgcolor' value='#440000' /><param name='scale' value='noScale' /><param name='wmode' value='window'/></object><br /> </span></p> <p>

Below is a second way to specify the video is with embed rather than object tags. As I recall use of embed is depricated and object tags encouraged. Both work about the same. Background color attributes seem to have no effect on the googleplayer application that runs the video. If cutting and pasting, you might want to merge into one line. Breaks were inserted for readability.

</p> <p><embed style="width:400px;height:326px;" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=-2022406929085573519&#038;hl=en" id="VideoPlayback" align="middle" quality="best" bgcolor="#ffffff" scale="noScale" salign="TL" FlashVars="playerMode=embedded"></embed></p> <p>

No responses yet

Dec 14 2006

Gimp on MacBook Pro

Published by under Mac,web

Gimp (Gnu Image Manipulation Program) is the one X11 app that I’ve been using regularly and I need it on elm, my MBP. So how can I get it. I’ve installed Apple’s X11 subsystem and there are three choices for OS X compatible versions.

  • Fink project which attempts to port many Unix applications. It is based on Debian and its package management system called “apt”. I use debian on servers and find it to be a very solid system, but a little slow to get the latest releases (now at version 1.25 when Gimp is at 2.x.)
  • Macports (formerly Darwinports) based on the BSD ports system. The most recent version of Gimp that I used was acquired from Darwin Ports and it worked well. The newest version of Gimp available seems to be pretty old and this project is in a state of flux. I think I’ll avoid it for a while.
  • There is a standalone Gimp.app package linked to from the gimp’s site. This produces a standalone app that uses Apples X11 installation. This is the one I’m using. It is a big installation, 80+MB, but it is a pretty current 2.2 version and it works.

I’ll probably revisit the fink or macports issue next time I want to install an X11 applications.

No responses yet

Oct 30 2006

UTF-8, 16, 32

Published by under General,Mac,web

In a mailing list post today, I saw the following succinct explanation of the various UTF’s encodings and how they relate to unicode.

All UTF’s are able to encode “EXACTLY” the same set of characters. That’s the whole point of Unicode. The UTF’s specify the nit-picky details about how to actually represent Unicode text in bytes, but the Unicode text itself is a stream of characters, and it is not affected by the encoding method used.

UTF-8 is an 8-bit encoding only in the sense that it’s defined in terms of bytes. That doesn’t mean that each character takes up only one byte. Depending on the character, it may take up one, two, three, or four bytes.

Example UTF-8 representations:
U+0041 LATIN CAPITAL LETTER A (‘A’) one byte, value 0x41.
U+00E7 LATIN SMALL LETTER C WITH CEDILLA (‘ç’): two bytes, values 0xC3 0xA7
U+0905 DEVANAGARI LETTER A (‘¿’): three bytes, values 0xE0 0xA4 0x85
U+10000 LINEAR B SYLLABLE A (‘¿’): four bytes, values 0xF0 0x90 0x80 0x80

UTF-16 is defined in terms of 16-bit ‘short words’ (two bytes). That doesn’t mean that each character takes up only one word, however. Depending on the character it may take up one or two words: UTF-16 by itself just defines that sequence of 16-bit values; it has nothing to say about how they’re physically stored as bytes.

UTF-8 is useful for several reasons, not least of which is that it’s backwards compatible with ASCII: a 7-bit ASCII text file is, without any modifications whatsoever, a perfectly legal UTF-8 text file. UTF-8 is also reasonably compact for Latin-based scripts. It starts losing the size battle to UTF-16 for the scripts of the Subcontinent and the far East, which is why there are things like SCSU (http://www.unicode.org/reports/tr6/) that let you shift the position of the subset of characters that’s representable with single-byte values.

No responses yet