2009-03-26

CSS, (X)HTML, and Javascript

How cool is that?

Wanting to make some notes here about some things that I'm just now realizing are possible with the combined technologies mentioned in the title line. This is to remind myself to

  1. look up whether or not some of these ideas have been implemented, like: I know for sure there are Javascript solutions out there for things like Color Selection Dialogs, calendar widgets for date/time entry, and so on. Not so sure about things like GUI interfaces to controlling CSS attribute properties. And didn't I see a Javascript (back in the day) that would set stylesheet properties in real time, on a page already loaded into the browser?
  2. Write some code to implement things like positioning a control box on a form at design time - this is basically the VB concept: realtime control of the CSS properties [attributes?] of e.g. an HTML element (or a logical grouping of HTML elements - a "control") by up/down counter/spinners or drag/drop operations - Should be fairly simple to code up, so much so that I'm having trouble believing such doesn't already exist for the HTML/PHP/CSS universe.

These ideas deserve a more detailed study - just put them here to be sure they're written down and accessible.

The link at W3C that set all this thought process in motion – at least, this phase of it – is the one given above with the title:  http://www.w3.org/TR/CSS21/visuren.html#comparison

2009-03-24

Ongoing X Issues w/ hp zd7000

The NVIDIA X server module is still not loading - or is not loading correctly - on the hp pavilion zd7000.

Additional Information

2009-03-20

xorg.conf file for hp pavilion zd7000

#
#  X-server configuration file.
#
#  Place this file at /etc/X11/xorg.conf and restart the X server 
#  in order to start using the provided configuration.
#
#  This is the xorg.conf file that fixes the X-server config 
#  problems on the hp pavilion zd7000 laptop running OpenSuSE 11.0
#
#  The source of this file is/was: 
#    http://www.ccs.neu.edu/home/jpatota/linux/knoppix/xorg.conf
#
#
Section "ServerLayout"
 Identifier     "XFree86 Configured"
 Screen      0  "Screen0" 0 0
 InputDevice    "Keyboard0" "CoreKeyboard"
# PS/2 Mouse not detected
# Serial Mouse not detected
        InputDevice    "USB Mouse" "CorePointer"
EndSection

Section "ServerFlags"
 Option "AllowMouseOpenFail"  "true"
 
EndSection

Section "Files"
 RgbPath      "/usr/share/X11/rgb"
 ModulePath   "/usr/lib/xorg/modules"
 FontPath     "/usr/share/fonts/X11/misc:unscaled"
 FontPath     "/usr/share/fonts/X11/75dpi:unscaled"
 FontPath     "/usr/share/fonts/X11/100dpi:unscaled"
 FontPath     "/usr/share/fonts/X11/Type1"
 FontPath     "/usr/share/fonts/X11/Speedo"
 FontPath     "/usr/share/fonts/X11/PEX"
# Additional fonts: Locale, Gimp, TTF...
 FontPath     "/usr/share/fonts/X11/cyrillic"
# FontPath     "/usr/share/fonts/X11/latin2/75dpi"
# FontPath     "/usr/share/fonts/X11/latin2/100dpi"
# True type and type1 fonts are also handled via xftlib, see /etc/X11/XftConfig!
 FontPath     "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
 FontPath     "/usr/share/fonts/truetype"
 FontPath     "/usr/share/fonts/latex-ttf-fonts"
EndSection

Section "Module"
# Comments: see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=346408
 Load  "dbe" # Double Buffering Extension, very important.
 Load  "dri" # This shouldn't be available choice if user has selected driver vga, vesa or nv.
 Load  "glx" # GLX Extension.
 Load  "freetype" # Freetype fonts.
 Load  "type1"  # Type 1 fonts
 Load  "record" # Developer extension, usually not needed
# Load  "extmod" # This is okay, but if you look into "man xorg.conf" you'll find option NOT to include DGA extension with extmod, and for a good reason.. DGA causes instability as it access videoram without consulting X about it.
 SubSection      "extmod"
  Option          "omit xfree86-dga"
 EndSubSection
# Load  "speedo" # Speedo fonts, this module doesn't exist in Xorg 7.0.17
# The following are deprecated/unstable/unneeded in Xorg 7.0
#       Load  "ddc"  # ddc probing of monitor, this should be never present, as it gets automatically loaded.
# Load  "GLcore" # This should be never present, as it gets automatically loaded.
#       Load  "bitmap" # Should be never present, as it gets automatically loaded. This is a font module, and loading it in xorg.conf makes X try to load it twice.
EndSection

Section "InputDevice"
 Identifier  "Keyboard0"
 Driver      "kbd"
        Option      "CoreKeyboard"
 Option "XkbRules" "xorg"
 Option "XkbModel" "pc105"
 Option "XkbLayout" "us"

EndSection

Section "InputDevice"
 Identifier  "Serial Mouse"
 Driver      "mouse"
 Option      "Protocol" "Microsoft"
 Option      "Device" "/dev/ttyS0"
 Option      "Emulate3Buttons" "true"
 Option      "Emulate3Timeout" "70"
 Option     "SendCoreEvents"  "true"
EndSection

Section "InputDevice"
 Identifier  "PS/2 Mouse"
 Driver      "mouse"
 Option      "Protocol" "auto"
Option          "ZAxisMapping"          "4 5"
 Option      "Device" "/dev/psaux"
 Option      "Emulate3Buttons" "true"
 Option      "Emulate3Timeout" "70"
 Option     "SendCoreEvents"  "true"
EndSection

Section "InputDevice"
        Identifier      "USB Mouse"
        Driver          "mouse"
        Option          "Device"                "/dev/input/mice"
 Option  "SendCoreEvents" "true"
        Option          "Protocol"              "IMPS/2"
        Option          "ZAxisMapping"          "4 5"
        Option          "Buttons"               "5"
EndSection

# Auto-generated by KNOPPIX mkxf86config

Section "Monitor"
 Identifier "Monitor0"
 Option "DPMS" "true"
 HorizSync    30 - 64
 VertRefresh  50 - 100
 Modeline "1440x900" 97.54 1440 1472 1840 1872 900 919 927 946
EndSection

Section "Device"
 ### Available Driver options are:-
# sw_cursor is needed for some ati and radeon cards
        #Option     "sw_cursor"
        #Option     "hw_cursor"
        #Option     "NoAccel"
        #Option     "ShowCache"
        #Option     "ShadowFB"
        #Option     "UseFBDev"
        #Option     "Rotate"
 Identifier  "Card0"
# The following line is auto-generated by KNOPPIX mkxf86config
 Driver      "nv"
 VendorName  "All"
 BoardName   "All"
# BusID       "PCI:1:0:0"
 Option "MetaModes" "1440x900"
EndSection

Section "Screen"
 Identifier "Screen0"
 Device     "Card0"
 Monitor    "Monitor0"
 DefaultColorDepth 16
  SubSection "Display"
  Viewport 0 0
  Depth 24
  Modes "1440x900"
 EndSubSection
EndSection

Section "DRI"
 Mode 0666
EndSection

NVIDIA X-server problems with hp pavilion zd7000

A week or so ago I managed to munge the X-server configuration on the hp pavilion zd7000 linux laptop I've been using for about a month now. The X-server quit working after some set of package installs and/or system updates wherein I was trying to get the correct NVIDIA™ display drivers installed such that I could use the various "transparency" and "translucency" settings on the shiny new KDE 4.x desktop.

The fix given on the page Configuring and Running Knoppix on the HP Pavilion zd7000 works, even though the OS distribution listed as the application environment for the fix is given as KNOPPIX. and the distro I have on the hp is OpenSuSE 11.0.

For the record, the fix is/was:

Download the xorg.conf from http://www.ccs.neu.edu/home/jpatota/linux/knoppix/xorg.conf and install it as /etc/X11/xorg.conf

I have posted a copy of the xorg.conf file recommended above at http://blogs.earthside.org/earth_tech/2009/03/xorgconf-file-for-hp-pavilion-zd7000.html.

I have downloaded the file in question, and am uploading attached to this post as an "enclosure" …

Or, "just–in–case" the enclosure doesn't enclose, I will paste a copy of the file into a subsequent posting on this blog.

2009-03-15

HowTo: Hide listings of hidden directories in Emacs 'dired' mode.

In order to not show hidden file names in the Emacs dired directory listings, take the following steps:

  1. Use the Meta–x to enter a command.
  2. At the M–x prompt, type customize–groupand hit <Enter>
  3. At the ’Customize group (default emacs):’ prompt type ’dired
  4. In the Emacs customization buffer for group Dired, find the option setting titled List Directory Verbose Switches [option variable name is list-directory-verbose-switches]
  5. Remove the a from the string value provided to list-directory-verbose-switches
  6. Save the changes.

Here is the Lisp code to set this option:

(if
    (eq system-type 'vax-vms)
    "/PROTECTION/SIZE/DATE/OWNER/WIDTH=(OWNER:10)" "-l")

The Lisp code can be placed in the .emacs file manually, if that method of editing and setting the Emacs environment options is preferred.

2009-03-14

Suhosin Warning from phpMyAdmin

Overview

After installing MySQL, Apache2, and phpMyAdmin on an OpenSuSE 11.0 LAN server, phpMyAdmin (pma) shows two warnings on its main page.

The first regards the MySQL root user not having a password set, and telling us to configure MySQL. This problem was resolved peacefully and without incident by the simple expedient of opening the mysql.user table for edit (using phpMyAdmin — we are root, after all — and according to the warning…) and adding a password to the root account for access from both localhost and sturgeon [sturgeon being the host name].

The second is regarding something about potential problems with something called "Suhosin".

Suhosin

Suhosin, as it turns out, is a [software] "system" for "hardening" PHP installations against buffer overflows and other nasties both known and unknown — generally speaking, it sounds like something that we want to have installed on our [about to be] publicly accessible server.

The phpMyAdmin FAQ # 1.38 is quoted here:

1.38 Can I use phpMyAdmin on a server on which Suhosin is enabled?

Yes but the default configuration values of Suhosin are known to cause problems with some operations, for example editing a table with many columns and no primary key. Tuning information is available at http://www.hardened-php.net/hphp/troubleshooting.html, although the parameter names have changed (suhosin instead of hphp). See also the SuhosinDisableWarning directive.

Note that the information regarding the parameter names used in the parameter names &mdash I.E. Use [read] suhosin instead of hphp in the Hardened-PHP Project – PHP Security – Troubleshooting page [ http://www.hardened-php.net/hphp/troubleshooting.html] is not shown on the other pages referenced when one follows the link(s).

That means that the following passage from

The settings you need to adjust are:

… it then goes on to say: 

Additionally you might want to change the following settings because phpMyAdmin is an administrative backend and might needs many POST variables and the user might trigger SQL errors

2009-03-12

Markup and Typography

The blog "A List Apart" has a cool article on using dashes and hyphens in HTML — those nasty &ndash;, &mdash;, and &shy; characters, y’kno?

From the article:

  1. &#8216; for an opening single quote (Ctrl + ` ` in Word—that’s two grave accents—that character on the tilde key).
  2. &#8217; for a closing single quote (or an apostrophe) (Ctrl + '' in Word).
  3. &#8220; for an opening double quote (Ctrl + ` " in Word).
  4. &#8221; for a closing double quote (Ctrl + ' " in Word).

… and …

I’ll bet you didn’t know this about HTML—the <q> and <blockquote> elements are designed to have quote marks automatically inserted in the appropriate locations. No current browser does this by default, however, and even those that do when faced with the appropriate style sheet markup (as detailed in CSS) get it wrong, especially with curly quotes.

See the article for the full story.

2009-03-09

Set an HTTP Basic Authentication Password

To set an HTTP Basic Authentication password on a sub-directory within the Apache document root directory tree:

  1. select the password file to use (this file can be created using the htpasswd command).
  2. Create the .htaccess in the directory that is to be protected.
  3. Within the .htaccess file, place Apache configuration directives similar to below.
  4. Create the username/password combination for login to the directory.

Ref:

HTTP Basic Authentication using Apache 2.0

2009-03-06

Problem with phpMyAdmin Table CSV Data Import

There is a problem with the table data import functionality in phpMyAdmin.

Actually, there are a couple problems -

  • The default value for the field separator character is a semi-colon (';') - WtF? CSV stands for "Comma Separated Value" - how are the designers going to use a semicolon to separate the field values in a format named to have comma characters as field value separators?
  • The CSV format exported by Excel, and (it seems) OpenOffice Calc, is implemented such that double quote characters within a field are escaped in the CSV output by use of two double quote characters used sequentially (I.E. like "this is a CSV field with an escaped double quote character ("") embedded"). This causes the phpMyAdmin table data import to fail. [see below for more detail]

CSV Format Issues

Apparently phpMyAdmin wants the *nixish escape (I.E. \") instead of the "" style used by popular spreadsheet software.

Possible Solutions

  • Modify the data within the CSV file to conform to phpMyAdmin expectations - this is generally unacceptable, since the data shouldn't be touched
  • Modify the phpMyAdmin import function to correctly handle Excel's output

CVS Format References

2009-03-05

CPS Network Speeds

strftime() output format settings [from the man page]

The output format strings used by strftime() have become a sort of defacto standard for date/time formating in Unix (Linux), and Unixish applications. Here is a list of the output modifiers defined by strftime() for use in the output format strings:

       %%     a literal %

       %a     locale's abbreviated weekday name (e.g., Sun)

       %A     locale's full weekday name (e.g., Sunday)

       %b     locale's abbreviated month name (e.g., Jan)

       %B     locale's full month name (e.g., January)

       %c     locale's date and time (e.g., Thu Mar  3 23:05:25 2005)

       %C     century; like %Y, except omit last two digits (e.g., 21)

       %d     day of month (e.g, 01)

       %D     date; same as %m/%d/%y

       %e     day of month, space padded; same as %_d

       %F     full date; same as %Y-%m-%d

       %g     last two digits of year of ISO week number (see %G)

       %G     year of ISO week number (see %V); normally useful only with %V

       %h     same as %b

       %H     hour (00..23)

       %I     hour (01..12)

       %j     day of year (001..366)

       %k     hour ( 0..23)

       %l     hour ( 1..12)

       %m     month (01..12)

       %M     minute (00..59)

       %n     a newline

       %N     nanoseconds (000000000..999999999)

       %p     locale's equivalent of either AM or PM; blank if not known

       %P     like %p, but lower case

       %r     locale's 12-hour clock time (e.g., 11:11:04 PM)

       %R     24-hour hour and minute; same as %H:%M

       %s     seconds since 1970-01-01 00:00:00 UTC

       %S     second (00..60)

       %t     a tab

       %T     time; same as %H:%M:%S

       %u     day of week (1..7); 1 is Monday
       %U     week number of year, with Sunday as first day of week (00..53)

       %V     ISO week number, with Monday as first day of week (01..53)

       %w     day of week (0..6); 0 is Sunday

       %W     week number of year, with Monday as first day of week (00..53)

       %x     locale's date representation (e.g., 12/31/99)

       %X     locale's time representation (e.g., 23:13:48)

       %y     last two digits of year (00..99)

       %Y     year

       %z     +hhmm numeric timezone (e.g., -0400)

       %:z    +hh:mm numeric timezone (e.g., -04:00)

       %::z   +hh:mm:ss numeric time zone (e.g., -04:00:00)

       %:::z  numeric time zone with : to necessary precision (e.g., -04, +05:30)

       %Z     alphabetic time zone abbreviation (e.g., EDT)

       By  default, date pads numeric fields with zeroes.  The following optional
       flags may follow `%':

       -      (hyphen) do not pad the field

       _      (underscore) pad with spaces

       0      (zero) pad with zeros

       ^      use upper case if possible

       #      use opposite case if possible

       After any flags comes an optional field width, as a decimal  number;  then
       an optional modifier, which is either E to use the locale's alternate rep-
       resentations if available, or O to use the locale's alternate numeric sym-
       bols if available.

Examples:

To get the output YYYYMMDD (where YYYY is the four-digit year, and MM and DD are the two-digit, zero-left-padded month and day values, respectively) from the 'date' command, use the following command:

  date +"%Y%m%d"

The output should look like:

  20090305

To get the international standard date format, use the command

 date +"%F"

The output should look like

  2009-03-05

Values output by the 'date' command can be stored in variables inside a script (e.g. Bash, Perl, etc) thus:

  foo=`date +"%F"`

For Bash, or

  my $foo = `date +"%Y%m%d"`;

in Perl.