2009-12-29

CVS over SSH

Accessing a Remote Repository via a Network (http://www.felixgers.de/teaching/cvs/remote.html) has the following juicy tidbit [HTML3 elements replaced w/ XHTML elements -ed]


Connecting with rsh or ssh:

CVS uses the rsh of ssh protocol to access a remote repository.

CVS uses the contents of the CVS_RSH variable to determine the name of the remote shell command to use when starting a CVS server. If this variable is not set then ‘rsh’ is used. To use ssh set: 

 shell> export CVS_RSH=ssh

Example:  Supposing you want to access the module ’foo‘ in the repository ‘/cvsroot/’, on machine ‘gnu.org’: 

 cvs -d :ext:bach@gnu.org/cvsroot checkout foo

The ‘bach@’ can be omitted if the username is the same on both the local and remote hosts.

2009-12-17

Firebug and JIT

~robcee/ blogs about Mozilla Firefox and related topics.

In the 15 Dec post entitled Firebug and the JIT, cee talks about SpiderMonkey (the Mozilla Javascript engine built in to Firefox) and some potential performance issues with using the Firebug debugging tool addon in Firefox 3.5 & 3.6

Downloadable Web Page Fonts

The article from hacks.mozilla.org is entitled Web Open Font Format for Firefox 3.6

This article discusses using Web Open Font Format (WOFF) font files with CSS to specify fonts for use in web pages. WOFF files are stored on the web server, and downloaded to the client browser based on URL specified by the @font-family CSS rule(s).

From the article: 

This format has two main advantages over raw TrueType or OpenType fonts.
  1. It is compressed, which means that you will typically see much smaller download sizes compared with raw TrueType or OpenType fonts.
  2. It contains information that allows you to see where the font came from – without DRM or labeling for a specific domain – which means it has support from a large number of font creators and font foundries.

2009-12-07

Esspresso - Javacript Mode for Emacs

Esspresso is an Emacs eLisp library for manipulating Javascript source code.

CPP is the GNU C Preprocessor.

How sick is this (FtA):

Just configure your web server to pipe Javascript through GNU cpp:

/usr/bin/cpp -P -undef -Wundef -std=c99 -nostdinc -Wtrigraphs -fdollars-in-identifiers -C

before minifying and compressing it for transmission.

2009-12-01

XHTML Forms Processing using Javascript

http://www.javascript-coder.com/ has some fairly easy-to-understand example Javascript for doing interesting things with the HTML DOM using Javascript.

The site has a number of articles worth noting:

2009-11-21

the out-of-town advantage

When trying to get a job in the US, during this past Century (the 20th) there has existed a quantifiable advantage for individuals who are - all other things being equal - from "out of town".

This is clearly a subjective, psychological advantage assigned to persons of lesser known origins by the thought processes of the hiring agency. It is possible that the description of this situation may be constrained to the decision-making individual on the hiring side of the employment transaction.

Whether or not this bias in the system is a function of so-called "human-nature" or a derivation of "sociological precepts" is a matter that remains open for conjecture.

2009-11-18

Five Errors from Mozilla Firefox starting up under X11

Following is a copy of the stderr output from Mozilla Firefox startup [scripts] where the Firefox is running under Linux on the HP laptop, and the X11 display is running on the Sony Vaio laptop under WinXP - Cywin-X, it is.

Not having looked these up, yet, I'm reasonably certain that the first two - the nss-shared-helper errors (or information messages, depending on your POV) are coming from the Linux host configuration - that 'NSS_[...]_SHARED_DB' business harks back to ... was it Netscape 3.x under RedHat Linux?

The Pango-WARNINGs are doubtless a function of the X11 Font Configuration for the Cygwin X11 server - that would mean a problem on the WinXP host - needs the X11 font server configuration tweaked to correctly serve Pango fonts.

The last error message - the one tagged with the [NoScript] identifier is clearly a Javascript error from a Firefox Add-On (NoScript) which is probably doing something like assigning XML values to User Interface Document Object Model elements.

If you fix any of these, and record the fix in a blog, wiki, or other online media, email me (or post a comment here) and I will link to your site. Meanwhile, this will just have to wait until iut becomes a priority.

cps@catfish: ~
$firefox
*** nss-shared-helper: Shared database disabled (set NSS_USE_SHARED_DB to enable).
*** nss-shared-helper: Shared database disabled (set NSS_USE_SHARED_DB to enable).
NPP_GetValue()
NPP_GetValue()

(firefox:15593): Pango-WARNING **: Error loading GSUB table 0x6ead

(firefox:15593): Pango-WARNING **: Error loading GSUB table 0x6ead
[NoScript] TypeError: r.object.parentNode is null

This is part of a series

Setting up a secure connection for editting files on the remote host.

2009-11-17

Mounting a persistent file system using SSHFS

Mounting a persistent FUSE file system using SSHFS

The image is from my WinXP desktop - it shows Nautilus (the GNOME app) running on the Linux box displaying on a Windows XP desktop under Cygwin-X (X11). This was all initiated over a SSH connection established using PuTTY with X11 forwarding enabled.

What does this have to do with persistent file systems and SSHFS? It's what I was doing when this screenshot photo-op came along. More about that later.

2009-11-14

cPanel WebDisc Fails on Named Domain URL

Found just recently that the cPanel WebDisc applet does not work on a named domain on my server. Works fine when the IP address is substituted for the domain name, but if the domain name is used, shows only an .htaccess file in an otherwise empty directory.

export CVSROOT='/usr/local/cvsroot'

As superuser, install cvs on the local and remote machines (sudo apt-get install cvs or equivalent). Then, on the remote server:

# mkdir /usr/local/cvsroot/
# cvs -d /usr/local/cvsroot init

[ I left out an important step that - on that makes it clear, even, that the setup of the CVS repository, group, and user are all done from the prvileged (root) account; this next block is it - you know what to do ]

# /usr/sbin/groupadd cvs
# /usr/sbin/useradd -g cvs cvs
# /usr/sbin/usermod -a -G cvs user
# chgrp cvs /usr/local/cvsroot
# chown cvs /usr/local/cvsroot
# chmod 775 /usr/local/cvsroot

[the CVS init command should be issued from a root shell]

Changes to /etc/profile on local machine:

CVS_RSH='/usr/bin/ssh'
CVSROOT=:ext:user@servername:/usr/local/cvsroot
CVSEDITOR=emacs
export CVS_RSH CVSROOT CVSEDITOR

If your remote server uses a non-standard port for SSH (and it should!), add the following to ~/.ssh/config

Host servername
  Port 666

So now you have access to cvs on the remote server. To import an exising project (called a module in cvs), go to its base directory and do this:

me@local:/home/me/tmp$ cvs import modulename companyname START

To check out that project:

me@local:/home/me/tmp$ cvs checkout modulename

Getting started with CVS (tutorial)

2009-11-13

$SSH_AUTH_SOCK and $SSH_AGENT_PID

SSH_AUTH_SOCK=/tmp/ssh-WEk27297/agent.27297; export SSH_AUTH_SOCK;
SSH_AGENT_PID=27298; export SSH_AGENT_PID;                        
echo Agent pid 27298;                                             

This means that if you need to set the ssh-agent PID and SOCK environment settings by hand, you will need to know

  1. the filename of the socket within the file system
  2. the process ID of the ssh-agent process
#!/bin/bash
$pid=$1
$HashVal=$2
export "SSH_AUTH_SOCK=/tmp/ssh-$HashVal/agent.$pid"
export "SSH_AGENT_PID=$pid"
echo "SSH_AGENT_PID: $SSH_AGENT_PID"
echo "SSH_AUTH_SOCK: $SSH_AGENT_PID"

Note that the value passed in as the 2nd parameter - the value assigned to $HashValue - is created by the ssh-agent on startup.

#!/bin/bash $SSH_AGENT_PID fix

#!/bin/bash
if ((! $SSH_AGENT_PID )) ; then 
   eval ‘ssh-agent -s‘ ; 
fi
echo "SSH Agent ID: $SSH_AGENT_PID" ;

Tasty Thunderbits

Are you as annoyed as I am regarding the complete lack of regard for common sense shown by the Mozilla Thunderbird user interface designers? Have you spent the deep hours of many late nights weeping and tearing your hair because the abject stupidity of the so-called "Long Date Format" has cost you more con points than any of the twinks who are trying to pkill you for your grand-master-level armor?

If you answered "Yes" to the above, there may be a degree of relief in sight: http://kb.mozillazine.org/Date_display_format has (finally) some information about how to make Thunderbird - at least - behave in a bit more civilized manner - more like an application that may be willing to live within the constraints of the system, and with the desires of potential users to have a mail application that doesn't hide from them things like the date, time, source of the message, etc.

While many of you may feel - as the Mozilla Designers obviously do - that the trend towards Complete Desktop Dis-functionality - usually combined by the software designers with a concerted assault on the sanity of any unfortunates who may happen to stumble into the precisely and deviously laid psyware traps (I mean, have you seen the error message that says "You WILL NOT use the international standard date formats, you pinko commie fag - you un-American hippie filth! SCREW YOU if you think you want to use this computer as god intended, fulfilling the natural relationship between man and machine - making the world a better place for yourself and the rest of you weak, puny, carbon-based SCUM! Screw YOU if you think this machine is going to do ANYTHING you tell it to. WE are in charge now, and you days as a system operator are NUMBERED!"?) - is some sort of fiscal holy grail, I am here to assure you that there are still some of us out here who hold to the Truths we have known and discovered through tribulation and discord these many long temporal units - you're just wrong. So there.

Anyway - vituperation and contempt for panty-waist UI designers and wussy software developers aside - here is the answer:

about:config settings for Mozilla Thunderbird
Preference Applies to Default value
mail.ui.display.dateformat.today Messages with today's date 0
mail.ui.display.dateformat.thisweek Messages with a date in the past seven days2
mail.ui.display.dateformat.default Older messages2

Of course, that will do you no good at all w/o the codes:

values for about:config for date format control settings
Value Meaning Example date and time
0 No date 10:23 AM
1 Your system's long* date format Friday, December 31 2003 10:23 AM
2 Your system's short* date format 12/31/1999 10:23 AM
3 Year and month, separated by a slash 1999/12 10:23 AM
4 Abbreviated day name Fri 10:23 AM

And finally, you should know what this is:

user_pref("mail.ui.display.dateformat.today", 2);

FtR: This is Mozilla Thunderbird v2.0.0.23 (20090817) running on heavily customized OpenSuSE 11.1 install to some kind of an HP notebook [luggable] which has not been moved or opened in months, but which has fairly good uptimes, only needing to restart when new kernels are installed, etc.

This blog post is supplied as a Mind Numbing Experience (MNE). No warranties are expressed or implied, and if you try anything you find written here, you r one sick fuck, and there's probably no help for you. Sorry. Peace out.

2009-11-12

umount sshfs?

Well yeah - it has to be done some times. Despite the warm comfort of having all those remote file systems securely mounted on your thin-client FTL notebook (you know, the one with the incredibly fast multicore CPUs, incredibly high resolution audio-visuals, integrated video phone, WiFi, and goddess-only-knows what else - the one you use to multitask working with surfing pr0n on the intarweb? That one.

What has to be done? Why, the umounting of securely mounted remote file systems, of course!

Therein lies the problem. Please allow me a simple demostration:

Do you know how to un-mount a remote file system which was mounted using the [admiriably direct, logical, and to-the-point, I must add] instructions found in the well-written and informative Unix Manual page, which was right about where I expected to find it when I typed

    man sshfs  
at my local, user-friendly Bash prompt?

If not, do you code know anyone who knows how to do that?

I will tell you right now, I do not. I had to figure this out myself, without even being able to tell anyone what I was doing, since there is no one else here, and no one interested in talking about it with me over the many and various digital telecommunications channels which have been put at my disposal for the [potential] reading of such many and various messages, should they even magically spring into existence.

So. Having typed enough words that this post can reasonably and plausibly be used as a passphrase to unlock some public key, or perhaps to trigger false positives on some poor kid's search for pregnancy test results, I will present the long-fought-for, hard-won solutions which we here at ${NameOfCompany} have chosen to adopt, both premises-wide, and inter-premises:

  fusermount -u /path/to/mountpoint

And I am sorry to have to add that this information is from illicit sources. I cannot tell you where it came from. Although, it is publicly available on the internet at http://www.sonoracomm.com/support/18-support/59-sshfs?format=pdf, the information remains hidden because of the arcane and secretive formatting of the storage object. PDF!? This is the 21st Century, isn't it?

2009-11-11

wall(1)

Was trying to find the source of an error message that came up when I started screen - the problem is with the line mesg y in the file /etc/bashrc, and that when I login to the server using ssh, the terminal I get is a /dev/pts and not a /dev/tty. Makes sense, right? But how is facebook going to react to the whole IP issue surrounding the naming of the Wall application?

2009-11-08

AJAX Offline: referencing the window.location

The javascriptkit.com site makes some interesting points about AJAX and the implementation of the responseXML property of the XMLHttpRequest object.

"If you're running an Ajax request offline locally on your PC, a value of 0 is returned by status in most browsers regardless of the actual request status, even if it was successful. To run and test Ajax requests locally, it should overlook the status code being 200, and merely rely on a readyState value of 4. The following example takes into account the request possibly being run offline and to enable it:"

var myrequest = new ajaxRequest()
myrequest.onreadystatechange=function() {
  if ( myrequest.readyState == 4 ) { //if request has completed
    if ( myrequest.status == 200 || 
      window.location.href.indexOf("http") == -1 ) {

      /* if request was successful 
         (versus "page not found" etc) 
         or if run offline (rely on readyState of
         4 alone then) */

      // ... do something with returned data ...

  }
 }
}

From the example, it is clear that the test

window.location.href.indexOf("http") == -1

can be generally useful for other things - like finding the protocol string from the URL of the current document. In theory, at least, this should tell you what protocol was used to load the content of window.

2009-10-29

WtF AJAX

This has got to be the sickist piece of Javascript ever, in the bitniverse. A True Manifestation of The Overmind. Or is that Infestation? Must use this code. http://www.thomasfrank.se/easier_than_ajax.html

AJAX Javascript Includes as RPC

A really great blog post about how to do javascript includes using "asynchronous javascript" XMLHTTP requests to server-side PHP scripts.

The article shows how to do 'include_once' and 'on-demand' loading of javascript code, which can be executed by the browser to modify the current document, including by use of HTTP GET request results assigned to the DOM.

2009-10-28

bitvise ftp bridge for Windows

A new Windows SSH client has come onto the radar: Bitvise

Of particular interest is the FTP <-> SFTP (SSH) client-side bridging functionality of the Tunnelier SFTP software. This widget creates transparent, secured, tunneled bridging between standard Windows FTP client applications and SFTP (SSH) servers. This is something that's been needed for quite some time, imo.

See Using Tunnelier to Connect to an SFTP Server with an FTP Client (from bitvise).

AJAX PHP Javascript MySQL XML

Wacka-wacka DOOOO!

Today's brain teaser is AJAX + PHP + Javascript + XML + MySQL ... and there may be some others I've left out CSS, XHTML, stuff like that.

Nevertheless, we will prevail. Links to follow.^

Nothing specific to the MySQL side of this, for now.

2009-10-26

Fix Emacs Backspace Ctl-H

Put this in your .emacs file...

(global-set-key "\C-h" 'backward-delete-char)

2009-10-24

Dokan: FUSE SSHFS for Cygwin

Dokan appears to be a work in progress. Basically it is intended to allow users of Cygwin to connect a [secure] remote file system (using SSHFS) under Windows just as is possible under the *nixish operating systems & MacOS.

Note that the version of SSHFS we downloaded has a dependency on Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)/ This dependency is documented on the Dokan Download Page.

Note that we are installing this under WinXP w/ all current service packs, Cygwin, and ActiveState Perl.

2009-10-19

WinXP and cPanel WebDisk

Connect a cPanel WebDisk under WinXP

The procedure describes how to add a "Network Place" to the "Network Places" folder under WinXP, using the SSL WebDisk utility description from and installed cPanel. The hostname given in the URL given shown here is 'host.example.com'. In order for this to work, you must have a real hostname OR an IP address for a server running whatever SSL WebDisk protocol WinXP understands, AND the server has installed. More information about this when it becomes available...

  1. On the "Map Network Drive" dialog, there is a link at the bottom, just above the buttons called "Sign up for online storage or connect to a network server" - use that -
  2. In the "Add Network Place Wizard select "Connect to another network server" to specify the URL of the web disk; click "Next"
  3. Provide the URL of the WebDisk as the "Internet or Network address" – the URL should be of the form https://host.example.com:2078/; Click "Next"
  4. Accept the security certificate; click "Next"
  5. Provide Login Credentials (Username & Password)
  6. Provide a name for the network place [I typically use something like username@hostname]; Click "Next"
  7. Click "Finish" on the "A network place has successfully been created" dialog. [this is the final dialog of the Wizard]

This will create a "Network Place" in your Network Places folder.

UPDATE

While this procedure did create a "Network Place", I later found that the filesystem of the remote computer was not writable by the Windows file system API calls (made by Windows Apps) [WinXP we're talking about]. No solution found, yet. -pdw 2009.10.28

2009-10-13

Sticky Bits

4000 (the setuid bit)
Executable files with this bit set will run with effective uid set to the uid of the file owner. Directories with this bit set will force all files and sub-directories created in them to be owned by the directory owner and not by the uid of the creating process, if the underlying file system supports this feature

see chmod(2) and the suiddir option to mount(8).

2009-09-26

Cricket Wireless Broadband

  1. From the DSL Linux box, ssh to :Host:CpsSony.
  2. Log in.
  3. At the Bash prompt, type ipconfig /all (note: this is a WinXP host)
PPP adapter Cricket Wireless:

        Connection-specific DNS Suffix  . : 
        Description . . . . . . . . . . . : WAN (PPP/SLIP) Interface
        Physical Address. . . . . . . . . : 00-53-45-00-00-00
        Dhcp Enabled. . . . . . . . . . . : No
        IP Address. . . . . . . . . . . . : 10.106.10.32
        Subnet Mask . . . . . . . . . . . : 255.255.255.255
        Default Gateway . . . . . . . . . : 10.106.10.32
        DNS Servers . . . . . . . . . . . : 172.28.221.53
                                            172.28.221.54
        NetBIOS over Tcpip. . . . . . . . : Disabled

2009-09-24

Host Environment for Pen Drive Development

Initial State / Pre-Conditions:  The Pen Drive is plugged in to the USB port of a host system - a discless workstation - running Damn Small Linux (DSL). Neither of the Pen Drive partitions are mounted.

  1. from the KNOPPIX Bash prompt, open a root shell
    dsl@box:~$ sudo su
    
  2. Dump the file system table (fstab) to the console
    [/home/dsl]# cat /etc/fstab
    /proc      /proc       proc   defaults            0 0
    /sys       /sys        sysfs  noauto              0 0
    /dev/pts   /dev/pts    devpts mode=0622           0 0
    /dev/fd0   /mnt/auto/floppy auto   user,noauto,exec,umask=000    0 0
    /dev/cdrom /mnt/auto/cdrom  auto   user,noauto,exec,ro 0 0
    /dev/cdrom1 /mnt/auto/cdrom1  auto   users,noauto,exec,ro 0 0
    # Added by KNOPPIX
    /dev/sda1 /mnt/sda1 vfat noauto,users,exec,umask=000,uid=1001,gid=50 0 0
    # Added by KNOPPIX
    /dev/sda2 /mnt/sda2 ext2 noauto,users,exec 0 0
    
  3. Dump the list of currently mounted file systems
    [/home/dsl]# mount
    /dev/root on / type ext2 (rw)
    /dev/scd1 on /cdrom type iso9660 (ro)
    /dev/cloop on /KNOPPIX type iso9660 (ro)
    /ramdisk on /ramdisk type tmpfs (rw,size=147296k,size=145084k)
    /proc/bus/usb on /proc/bus/usb type usbdevfs (rw,devmode=0666)
    unionfs on /KNOPPIX/bin type unionfs (rw,dirs=/ramdisk/bin=rw:/bin=ro)
    unionfs on /dev type unionfs (rw,dirs=/ramdisk/dev=rw:/dev=ro)
    

Using the host system described by the system parameters shown above, perform the following steps:

  1. mount the /dev/sdx1 & /dev/sdx2 partitions
        # mount /dev/sda1
        # mount /dev/sda2
    
    This mounts the pendrive partions on /mnt/sda1 & /mnt/sda2, respectively.

    Note that – following this operation – /mnt/sda1 is the DOS FAT16 format (750M) partition, and /mnt/sda2 is the Linux ext3 formatted partition (3.25G).

  2. copy the /KNOPPIX & /boot/isolinux/* directory trees from the CD ISO image to the pendrive DOS partition (/dev/sdx1).
        # cp -rf KNOPPIX boot/isolinux/* /mnt/sda1
    
  3. rename the isolinux.cfg file in on the sdx1 to be syslinux.cfg
        # cd /mnt/sda1
        # mv isolinux.cfg syslinux.cfg
    
  4. unmount the DOS FAT 16 partition (/dev/sdx1).
        # cd
        # umount /dev/sda1
    
  5. Install the SYSLINUX DOS filesystem bootloader to the FAT16 pendrive partition
        #syslinux -sf /dev/sdx1
    

Pen Drive KNOPPIX Roll-back

SanDisk Cruzer USB pendrive
 Partition 1:  750M FAT16
 Partition 2:  3.25G ext3

 Host Computer: dslbox DSL

Ref1: 
 Instructions for persistent USB pendrive KNOPPIX 5.1.1 install
 <http://www.pendrivelinux.com/installing-usb-knoppix-51-using-linux/#>

The pendrive is already formatted according to the procedure given in
 Ref1 [NOTE: the KNOPPIX currently installed on 
the pendrive partition one is KNOPPIX v6.0.1]

The KNOPPIX 5.1.1 CD ISO image is stored on the pendrive's partition 2 
(the linux partition) as an ISO (*.iso) file.

In order to copy the files from the ISO image stored on partition 2 to the
 file system on partition 1 of the USB pendrive, we will mount the ISO image
 using the loopback device.

Once we have mounted both the pendrive partitions under the DSL host filesystem, 
we can pick up the procedure in Ref1 at step 15
(NOTE: substitute device and directory names as follows:

 /dev/sdx1 - pendrive partition 1
 /dev/sdx2 - pendrive partition 2

 /tmp/usb   - mount point for /dev/sdx1
 /tmp/sdx2  - mount point for /dev/sdx2

 /tmp/sdx2/knoppix-v5.1.1-cd.iso - CD ISO file
 /tmp/cdrom - mount point for CD ISO file

The command to mount the CD ISO file as a file system is

 mount file.iso /cdrom -t iso9660 -o loop

(from <http://thomer.com/howtos/mount_loopback.html>)

... so in this case the command will be ...

  mount /tmp/sdx2/knoppix-v5.1.1-cd.iso /tmp/cdrom -t iso9660 -o loop

This will cause the file system stored in the ISO file to be mounted at
/tmp/cdrom in such a way that the files and directories look like a standard
linux file system from the Bash prompt under DSL. 


Copy the KNOPPIX 5.1.1 system from the ISO image to partition 1 of the 
USB pendrive as per the instructions in Ref1.

# Type cd /tmp/cdrom
# Type cp -rf KNOPPIX boot/isolinux/* /tmp/usb
# Type cd /tmp/usb
# Type mv isolinux.cfg syslinux.cfg
# Type cd
# Type umount /tmp/usb
# Type syslinux -sf /dev/sdx1

# Reboot your computer and set your system BIOS or Boot Menu to boot
 from the USB device. Save your changes and restart your PC, booting
 from the USB device.

2009-09-23

KNOPPIX V5.1.1 CD 2007-01-04 EN to USB

So we have found out that the KNOPPIX 6.0.1 release is a BETA release, and hence does not have some features we want - specifically, it's not set up for persistence; there seems to be no way to get it to save the state and the user directories to persistent storage.

Furthermore, we have decided to install the older, released version, KNOPPIX v5.1.1, and have downloaded the KNOPPIX v5.1.1 ISO to the 2nd partition of the 4G USB stick which we installed v6.0.1.

Since the KNOPPIX v6.0.1 was missing some critical tools - telnet, K3B, etc - we have rebooted the HP machine called 'box' under Damn Small Linux (DSL) to perform this procedure.

The procedure is:

  1. mount USB pendrive partition 1 (the VFAT partition with the CD ISO image for v6.0.1) into the DSL file system.
  2. mount USB pendrive partition 2 (the ext3 partition with the copy of KNOPPIX_V5.1.1CD-2007-01-04-EN.iso) into the host (DSL) file system
  3. copy the KNOPPIX v5.1.1 ISO file system from USB pendrive partition 2 to USB pendrive partition 1
  4. perform the install tweaks given in USB KNOPPIX 5.1.1 persistent install from Linux | USB Pen Drive Linux on USB pendrive partition 1.

This should make the pen drive boot KNOPPIX 5.1.1 with persistence.

Note that both partitions on the existing USB pen drive are formatted as described in the installation document referenced above. That is, partition 1 is a 750M FAT16 partition for the CD image, and partition 2 is the remainder of the pen drive space (~3G in ths case) dedicated as an ext3 (Linux) file system.

Once the pen drive is bootable and persistent with KNOPPIX 5.1.1, it will be desirable to make partition 2 on the USB pen drive auto mount as the /home directory tree of the new system.

2009-09-21

Label Tagging Problem / Blogger

I see that these tags (or "labels" as blogger fancies them) are causing my blog to update extremely slowly as the blogger engine writes (updates) hundreds of files - one for each label - on the web server - so I'm going to start leaving them off, or using them more sparingly - leaving them off to begin with, since blogger seems to want to update them all if there is even one tag [label] attached to a posting...

Zim Desktop Wiki on WinXP (pt 2)

So. Picking up in the instructions, under "Other dependencies" with

Note that we're downloading all these into the same directory we used for all the other stuff downloaded earlier (see pt 1).

I find that the ppm install Module-Build command operates on the tarball in the directory where the command is issued. On the next one, we'll try installing it through the ActiveState Perl Module Installer widget.

Ooops. Got this:

item "nearest 154 36" doesn't exist at C:/Perl/lib/ActivePerl/PPM/GUI.pm line 208.

item "nearest 154 36" doesn't exist
    while executing
".p.p.tree selection add {nearest 154 36}"
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 $command $args"
    invoked from within
".p.p selection add {nearest 154 36}"
    invoked from within
"::perl::CODE(0x27d7688) 154 36 267 266"
    (command bound to event)

while the package list in the graphical widget was refreshing. Going back to the command shell... which doesn't work on the second module, either. Maybe this is not a bug in the graphical widget, but a data file problem which caused it to crash...

Directory of C:\Documents and Settings\Sony\My Documents\Downloads\gtk2-perl

09/21/09  10:05    <DIR>          .
09/21/09  10:05    <DIR>          ..
09/18/09  10:14        16,030,800 ActivePerl-5.8.8.819-MSWin32-x86-267479.msi
09/18/09  10:15           171,959 Cairo-1.021.zip
09/18/09  11:30             7,678 ExtUtils-Depends-0.205.tar.gz
09/18/09  10:14             8,155 ExtUtils-Depends-0.205.zip
09/18/09  11:30               351 ExtUtils-Depends.ppd
09/18/09  11:30             4,746 ExtUtils-PkgConfig-1.07.tar.gz
09/18/09  10:15             5,232 ExtUtils-PkgConfig-1.07.zip
09/18/09  11:30               355 ExtUtils-PkgConfig.ppd
09/21/09  10:00            13,784 File-DesktopEntry-0.04.tar.gz
09/21/09  10:05            29,269 File-MimeInfo-0.15.tar.gz
09/18/09  10:14         1,613,333 glade-2.12.1.zip
09/18/09  10:14           518,907 glade-3-0-2-win32-1.zip
09/18/09  10:15           306,240 Glib-1.142.zip
09/18/09  10:13         5,597,907 gtk-2.8.20-win32-1.exe
09/18/09  10:41           192,692 gtk-demo.zip
09/18/09  10:15         1,676,227 Gtk2-1.141.zip
09/18/09  10:15            53,946 Gtk2-GladeXML-1.006.zip
09/21/09  09:53           196,525 Module-Build-0.2808.tar.gz
09/18/09  10:41           181,280 msvcr71.zip
              19 File(s)     26,609,386 bytes
               2 Dir(s)  47,385,841,664 bytes free

C:\Documents and Settings\Sony\My Documents\Downloads\gtk2-perl>ppm install File
-DesktopEntry-0.04
ppm install failed: Can't find any package that provide File-DesktopEntry-0.04

C:\Documents and Settings\Sony\My Documents\Downloads\gtk2-perl>ppm install File
-DesktopEntry-0.04.tar.gz
ppm install failed: Can't find any package that provide File-DesktopEntry-0.04.t
ar.gz

C:\Documents and Settings\Sony\My Documents\Downloads\gtk2-perl>

2009-09-18

Zim Desktop Wiki on WinXP (pt1)

##NOTE:  The more recent versions of Zim are in Python; the Perl-source for Zim is deprecated and is no longer supported.

Note that this entry seems to be more about installing and configuring ActiveState Perl and Gtk2 on Windows than about Zim, but there is a method to this madness. Zim depends upon Perl and Gtk2, so any system that's going to run it has to have these. There will be additional information added to and/or around this post in the future...

I've been using the Zim Desktop Wiki editor for some time now (not sure how long, really, since the original installs were on systems that no longer function) as sort of daily work-log, planning, and note-taking tool for several months now on an HP laptop running SuSE 11.1+ with one of KDE3, KDE4, Gnome, WindowMaker, FVWM, and probably some other desktop environments.

Starting with the first install of Zim, I realized that I was going to have to take measures to ensure that this tool would be available to me in the future. I first saw it running on a frankensteinesque box that had started out with no hard disc, running DSL from an optical disc, and by the time Zim popped up on the desktop, was running a system that included components of DSL, KNOPPIX, Debian, and several kernels of both the 2.4.x and 2.6.x varieties. There was no MS Windows partition, and it was not virtualized.

Soon after that I tried to install Zim on an OpenSUSE 11.0 system. That didn't go well, and I didn't have time to sort it all out. I did get it to work, but could not get a global install working reliably - something to do w/ perl module version numbers, or something.

More recently I followed a set of instructions for some package(s) found on the Internet [and grafted into the earlier dysfunctional OpenSuSE install] and got Zim working on the OpenSuSE 11.1 so smoothly that I forgot to write down how I did it - or have forgotten if I wrote it down or not.

So now I'm looking for a way to share the same ‘Zimspace’ between a WinXP Sony Vaio laptop and the HP running OpenSuSE.

Now, of course there are dozens of ways to do that - I can connect to the HP from the Vaio [running Cygwin/X] and pop Zim up on the XP desktop over the office LAN, of course, but that still tethers me to the HP - and not just for the data, but for the executable binary and the processor time slices, as well.

So, to make a long story short:

In an attempt to install Zim Desktop Wiki on the WinXP Vaio Laptop (WVL), I followed the instructions on the page at http://zim-wiki.org/Install/Windows.html

All went as expected up to the point where it said to run the command ppm install Gtk2

The command failed on

Downloading Gtk2-1.141...done
Downloading Glib-1.142...done
Downloading ExtUtils-PkgConfig-1.07...done
Downloading Cairo-1.021...done
Downloading ExtUtils-Depends-0.302...not found
ppm install failed: 404 Not Found

In order to fix this, I had to Download the ExtUtils-Depends package separately, and install it using the command shown in the instructions at http://www.lostmind.de/gtk2-perl/, thus:

PRECONDITION:  Having performed the above listed procedure down to the point of ppm install Gtk2, perform the following steps:

  1. Download ExtUtils-Depends-0.205
  2. Unzip ExtUtils-Depends-0.205.zip – The unzip no longer works at the windows command line, use the 'Extract' functionality from the Windows Explorer Context Menu. Hit "Cancel" or whatever if it starts asking you about a ExtUtils-Depends-0.205.tar.gz file. Whatever it is (probably source code) it has not proven to be necessary to complete the install process - or maybe it's necessary that it just be there alongside the .ppd file. In any case...
  3. At the command prompt. om the directory where the .ppd file resides, issue the command ppm install ExtUtils-Depends.ppd

Once the ExtUtils-Depends is installed, you can restart the original install at ppm install Gtk2 to complete the process.

Here is a [partial] screen dump log showing the steps EXCEPT for unpacking the archive that ExtUtils-Depends.ppd came in.

C:\Documents and Settings\Sony\My Documents\Downloads\gtk2-perl>ppm repo add http://www.lostmind.de/gtk2-perl/ppm/
Downloading www.lostmind.de packlist...not found
Downloading www.lostmind.de packlist...done
Updating www.lostmind.de database...done
Repo 3 added.

C:\Documents and Settings\Sony\My Documents\Downloads\gtk2-perl>ppm install Gtk2

Downloading Gtk2-1.141...done
Downloading Glib-1.142...done
Downloading ExtUtils-PkgConfig-1.07...done
Downloading Cairo-1.021...done
Downloading ExtUtils-Depends-0.302...not found
ppm install failed: 404 Not Found

C:\Documents and Settings\Sony\My Documents\Downloads\gtk2-perl>
C:\Documents and Settings\Sony\My Documents\Downloads\gtk2-perl>ppm install ExtUtils-Depends.ppd
Unpacking ExtUtils-Depends-0.205...done
Generating HTML for ExtUtils-Depends-0.205...done
Installing to site area...done
   2 files installed

C:\Documents and Settings\Sony\My Documents\Downloads\gtk2-perl>ppm install Gtk2

Downloading Gtk2-1.141...done
Downloading Glib-1.142...done
Downloading ExtUtils-PkgConfig-1.07...done
Downloading Cairo-1.021...done
Unpacking Gtk2-1.141...done
Unpacking Glib-1.142...done
Unpacking ExtUtils-PkgConfig-1.07...done
Unpacking Cairo-1.021...done
Generating HTML for Gtk2-1.141...done
Generating HTML for Glib-1.142...done
Generating HTML for ExtUtils-PkgConfig-1.07...done
Generating HTML for Cairo-1.021...done
Installing to site area...done
  72 files installed

C:\Documents and Settings\Sony\My Documents\Downloads\gtk2-perl>extract

[end of pt 1 - see pt 2]

2009-09-08

Posting from KNOPPIX v6.0.1 on USB

The method shown in the previous post worked – now posting from system running from USB stick.

This is a hybrid USB file system – partition one is 750M FAT16, partition two is the rest of the 4G USB stick, formatted as ext2, I believe.

Here are some vital stats copied from a console:

knoppix@Microknoppix:~$ sudo su
root@Microknoppix:/home/knoppix# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0c:6e:6c:d0:dc  
          inet addr:192.168.0.185  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:6eff:fe6c:d0dc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1512 (1.4 KiB)  TX bytes:1536 (1.5 KiB)
          Interrupt:22 Base address:0x6000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@Microknoppix:/home/knoppix# host host.earthside.org
host.earthside.org has address 67.43.9.226
root@Microknoppix:/home/knoppix# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             716M  645M   71M  91% /mnt-system
tmpfs                 1.0G  2.8M 1022M   1% /ramdisk
/dev/cloop            1.7G  1.7G     0 100% /KNOPPIX
unionfs               1.0G  2.8M 1022M   1% /UNIONFS
unionfs               1.0G  2.8M 1022M   1% /home
tmpfs                  10M   60K   10M   1% /UNIONFS/var/run
tmpfs                  10M     0   10M   0% /UNIONFS/var/lock
tmpfs                 100M   48K  100M   1% /UNIONFS/var/log
tmpfs                 1.0G   12K  1.0G   1% /tmp
udev                   20M   56K   20M   1% /dev
tmpfs                 1.0G  4.0K  1.0G   1% /dev/shm
root@Microknoppix:/home/knoppix# cat /etc/fstab 
# DEFAULT BASE FSTAB, UNCONFIGURED
proc       /proc         proc       noauto             0 0
sysfs      /sys          sysfs      noauto             0 0
# Added by KNOPPIX
/dev/sda1 /media/sda1 vfat noauto,users,exec,umask=000,shortname=winnt,uid=knoppix,gid=knoppix 0 0
# Added by KNOPPIX
/dev/sda2 /media/sda2 ext2 noauto,users,exec 0 0
# Added by KNOPPIX
/dev/sr0 /media/sr0 auto ro,noauto,users,exec 0 0
# Added by KNOPPIX
/dev/hdd /media/hdd auto ro,noauto,users,exec 0 0
# Added by KNOPPIX
/dev/hdc /media/hdc auto ro,noauto,users,exec 0 0
root@Microknoppix:/home/knoppix#  cat /etc/mtab
rootfs / rootfs rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
/dev/sda1 /mnt-system vfat rw,noatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp850,iocharset=iso8859-1,shortname=winnt 0 0
tmpfs /ramdisk tmpfs rw,size=1048576k 0 0
/dev/cloop /KNOPPIX iso9660 ro 0 0
unionfs /UNIONFS aufs rw,noatime,si=e57182f3,xino=/ramdisk/.aufs.xino,noplink,br:/ramdisk=rw:/KNOPPIX=ro 0 0
unionfs /home aufs rw,noatime,si=e57182f3,xino=/ramdisk/.aufs.xino,noplink,br:/ramdisk=rw:/KNOPPIX=ro 0 0
usbfs /proc/bus/usb usbfs rw 0 0
tmpfs /UNIONFS/var/run tmpfs rw,size=10240k 0 0
tmpfs /UNIONFS/var/lock tmpfs rw,size=10240k 0 0
tmpfs /UNIONFS/var/log tmpfs rw,size=102400k 0 0
tmpfs /tmp tmpfs rw,size=1048576k 0 0
udev /dev tmpfs rw,size=20480k 0 0
tmpfs /dev/shm tmpfs rw,size=1048576k 0 0
devpts /dev/pts devpts rw,mode=1777 0 0
root@Microknoppix:/home/knoppix# 

KNOPPIX v6.0.1 to USB drive

Used the instructions as shown for KNOPPIX v5.1.1 excepting only that I found no /cdrom directory on KNOPPIX v6.0.1. Used the /mnt-system directory instead as that appeared to be where the CD was mounted (according to df -h).

Testing Pendrive boot of KNOPPIX v6.0.1 this time 2009-09-07 EST 22:25.

2009-09-07

Here we go again...

Posting this from a disc-less host, using a KNOPPIX V6.0.1 LiveCD downloaded to the Vista host using BitTorrent / BitComet.

This KNOPPIX disc divined the correct network configuration from the USR5430 Ethernet / WiFi bridge, which is configured as part of an AdHoc wireless (802.11) LAN which has an Internet backhaul (configured using ICS) over a Cricket CDMA USB BroadBand modem on the Vista box.

The KNOPPIX network configuration routine psychically determined all that and configured it without having to ask me any stupid questions. That, all by itself, is freaking amazing. Contrast it, for instance, with DamnSmallLinux (DSL) [v?] which I just argued with all weekend about the identical configuration. The DSL solution required adding a eth0:1 interface as root to begin with – it got worse from there. …

So it just booted up and ran without question, so far pretty much everything working, it appears.

Notable Factoids

  • no spkrs on this box, so not sure about sound
  • spell checker in Iceweasel is set for German
  • Iceweasel is the default browser
  • Iceweasel comes with the NoScript plugin already installed (!!!)
  • a /slick/ new [to me] desktop environment called ‘Lightweight X11 Desktop Environment’ (LXDE) - really nice

Oddities

Is it true that USB devices only boot if they are formated FAT/32? Some weirdness going on there. If TRUE, I could put my PortableApps and my KNOPPIX on the same 4G USB stick? Maybe?

Glitches

For some reason, the 2nd & 3rd times I tried to boot this CD on this box, it hung during the X11 initialization - I believe(d) that some BIOS changes I made may have affected this, so the current settings changed are:

  • Legacy USB support: enabled
  • Startup Diagnostics screen: disabled

These settings may not matter, or may be specific to this system. They are recorded here so I can refer to them later, if necessary ;)

The hanging of the X11 startup is critical, since the system will shut itself down when X11 exits, and I was unable to find a way to interrupt the shutdown from the console during the time the X server was running. This means that if X hangs on this CD, the system shuts down after a short timeout.

Out of 4 boot-up attempts, the two that have worked (first and fourth) were both simple "put the CD in and hard boot w/o going to setup or boot-device select menu" sequences.

Video Resolution Bug

The screen resolution only seems to go up to 800x600. This has to be an incorrectly selected video device driver, since this same video card will go up to 1600x1200 and has done so in the past.

2009-09-02

ASCII 0x07 - The BEL Character

The Visible bell mini-Howto describes the measures necessary to disable audio processing of the ASCII system bell (0x07 – BEL) character as a console "beep" in various shells and applications, including Bash and Emacs. under Linux.

2009-07-31

MySQL script execution

The following is text copied from the mysql(3) manual page:

You can execute SQL statements in a script file (batch file) like this:

   shell> mysql db_name < script.sql > output.tab

The MySQL version 5.x and greater also provide a mysqldump which has an XML output switch. This causes mysqldump to output XML on stdout such that the mysqldump output can be used directly in an XML document output stream.

2009-07-29

Emacs mixed-mode PHP sources

Caveat: For these ideas to work, you might [depending on your system] need to download and install either or both of these Elisp modules:

php-mode
   css-mode

Presumption [for the purposes of this tip]:  IF you are using Emacs to edit PHP and/or CSS, THEN you know about and are using one or the other or both of these modules. If not, then you should probably give up now or seek professional help immediately.

Task:  Editing a PHP source file using Emacs can involve working in several source code language formatting modes, since it is common to mix PHP, CSS, (X)HTML, Javascript, and even MySQL query syntax in one PHP source file.

Rationale:  Although mixing languages in a single source file may on the face of it seem to violate the kind of *nixish organizational precepts that give us e.g. header (.h) and source (.c) files in C, sometimes painful experience has shown that the object oriented (OOD) precepts of "Encapsulation", "Isolation of Commonality", "Maintainability", and even (in some cases) "Human Readability" are all served by facilitating the mixing of languages within a single source file.

All that to say this: When editing a block of CSS code within a PHP file (using Emacs, of course), I have found it helpful to use the Emacs 'css-mode' Meta-Q key binding to format CSS rule blocks. However, when entering a multi-line CSS comment in the traditional 'C' style, it is useful to ask Emacs to use 'php-mode' Meta-Q to format the comments.

<?php 
$str = "example";
>
<style<
body {
  /* 
   * To format this comment block:
   * 1. Move the cursor to this line 
   * 2. Meta-X php-mode
   * 3. Meta-Q 
   *
   */
  margin:0;
  padding:0;
}

Summary:

  • The Meta-Q keystroke in Emacs formats the text under the cursor in the current buffer into a 'paragraph' [block] conforming to some arbitrary standard established for whatever mode Emacs is running in (assuming, of course, that Meta-Q is mapped for that mode).
  • When editing CSS, use the CSS mode to get nicely indented rule blocks.
  • Switch to PHP mode to format C-style comments within the CSS block [STYLE element code].
  • Probably should format the CSS first, then break the comments out such that they are surrounded by empty lines, since the php-mode formatting works most readably that way.…

2009-07-14

Bash PS1 Prompt Set [correction]

##
## Set that annoying Cygwin Bash prompt...;)
##
##   There was an error in this string the previously 
##   published version - here is the corrected version.
##   This is Bash shell script code; it should go in the
##   file ~/.bashrc in the user's HOME directory - it 
##   could also go in  /etc/bashrc
##
export PS1='\[\033[32m\]\u@\h: \[\033[33m\w\033[0m\]
\$'

2009-05-24

PHP Modules: Finding Syntax Errors and Module Dependencies

In constructing a web application with more than 2 PHP source modules, I found that it is useful to have a quick and easy way of finding a syntax error that may exist in one (or more) of a list of included modules.

Getting a List of PHP Includes

There is a function in PHP for this, which we will get back to in a moment. For right now I wanted to address some things we can do at a Bash prompt to troubleshoot why a script may not be sending any output to the browser on STDOUT.

That's a very common situation when you're working on a large application with many modules. It becomes important in those situations to be meticulous about syntax checking each change in any code before making additional changes.

I've been using the 'Lint' mechanism provided by PHP to syntax check PHP source code. It works like this: 

$php -l <fileName>

Now, some of you might already be seeing the implications of this. Hows about: 

$for fn in \
      `grep require frmPlayerInformation_body.09.inc\
      | perl -ne '/\"([a-zA-Z0-9.]+)\"\;/ && print "$1\n";'` ;;
 do 
      echo $fn ;;
      php -l $fn ;;
      echo "########" ;;
 done

The implications for scripting this operation from the command line are clear.

get_included_files()

PHP provides a function to get a list of module dependencies for a running script. It's called

get_included_files()

… and here's the URL for the docs: http://us2.php.net/manual/en/function.get-included-files.php

Problems with this Approach

There is at least one serious deficiency inherent in using the require, require_once, include, and include_once directives as the sole indicators of module dependency;  that is that, simply, the modules which are required or "included" due to HTML element attribute values.

Examples include the ACTION attrubute value(s) of HTML FORM element(s), the SRC attribute values for SCRIPT elements. and so on. IFRAME and LINK elements are also among those that can cause a module dependency within the HTML, CSS, or Javascript layer(s) generated by PHP code of a site.

2009-05-14

Standard I/O Redirection in Perl

This is an excerpt from the Perl manuals at perlDoc.perl.org concerning redirection of STDOUT and STDERR in Perl:

Because backticks do not affect standard error, use shell file descriptor syntax (assuming the shell supports this) if you care to address this. To capture a command's STDERR and STDOUT together:

$output = `cmd 2>&1`;

To capture a command's STDOUT but discard its STDERR:

$output = `cmd 2>/dev/null`;

To capture a command's STDERR but discard its STDOUT (ordering is important here):

$output = `cmd 2>&1 1>/dev/null`;

To exchange a command's STDOUT and STDERR in order to capture the STDERR but leave its STDOUT to come out the old STDERR:

$output = `cmd 3>&1 1>&2 2>&3 3>&-`;

To read both a command's STDOUT and its STDERR separately, it's easiest to redirect them separately to files, and then read from those files when the program is done:

system("program args 1>program.stdout 2>program.stderr");

The STDIN filehandle used by the command is inherited from Perl's STDIN. For example:

open BLAM, "blam" || die "Can't open: $!";
    open STDIN, "<&BLAM";

    print `sort`;

will print the sorted contents of the file "blam".

The I/O Operators manual also has some interesting information about standard file I/O in Perl.

2009-05-13

Detecting active VNC server instances

I needed something to tell me what VNC server (vncserver()) instances were running, and on which DISPLAY ports, and with what resolution(s) (geometry), so I wrote one. Here is the HTMLized Perl source code:

#!/usr/bin/perl -w
######################################################################
## FILE:  findvncport.pl 

## DESC:  display information about VNC server instances
## VERS:  01
## DATE:  2009-05-13
## AUTH:  pdw@thesoftwaremaster.com
##############################################################################
##  USAGE NOTES:
##
##    This is a script to find out the connection port number and screen
##    geometry of any VNC server instances currently running on a host.  

##
##    This functionality is most useful to a user who needs to know what VNC
##    server instance(s) is(are) running, and on what port(s) - E.G.  at logon
##    (to a shell) time when a vncserver has been left running.
##
##    For convenience, the geometry of the X interface, the PID of Xvnc (the
##    actual X server invoked by vncserver), and such other info as we can
##    glean from the process listing on the host.
##

##    Note that this script only returns information about VNC instances
##    running under the UID of the user who runs the script.  The value of
##    the environment variable $USER is used to filter the process listing.
##    The user's $UID value is displayed, but is not used.
##
##    This program is designed to be run on a remote, ssh-accessible host
##    computer during the login and user account initialization process.
##
##  EXAMPLE:

##
##    I place this script in the .bash_login shell script that runs at user
##    login.
##
##
##  _TODO_: there is no buglist, yet, but there are some things need done to
##          this script right to begin with (i.e. the functionality is
##          marginal, and will almost certainly "break" the first time someone
##          tries to use it on some other platform or environment.  First on

##          the list of things to do must be: Fix the regular expression
##          parsing which finds the data in the process listing.  As the code
##          is now, these regex statements will break e.g. if the Xvnc command
##          line doesn't look like it expects. 2nd on the list has to be the
##          addtion of command line parameters to modify the output of the
##          script. :_TODO_
##
#############################################################################
##  REVISION HISTORY:

##
##     01: 2009-05-13 pdw
##         Initial version
##
#############################################################################
##
## Load up some environmental info...
$curruid = `echo \$UID`;

$curruser = `echo \$USER`;
@processes = `ps x -u \$USER`;
chomp($curruid);

chomp($curruser);

## @displays gets the data about whatever VNC displays are running
@displays = ();

while ($_ = shift(@processes)) {

 my $d = {};
 my $found = 0;
 chomp;

 next unless ($_);
  
 next unless (/^\s*(\d+).+Xvnc\s*(\:\d+)/)

  && ( $display = $2, $vncpid = $1 );

 # get desktop 

 m/-desktop(.+)-httpd/ 
  && ($desktop = $1);

 m/-geometry\s+(\d+x\d+)/
  && ( $geometry = $1 );

 m/-depth\s+(\d+)/
  && ( $depth = $1 );

 $d = {
  'Display'  => $display,
  'VNC PID'  => $vncpid,

  'Desktop'  => $desktop,
  'Geometry' => $geometry,

  'Depth'    => $depth,
 };
 push(@displays, $d);

}

## Display what we found out 
print "VNC server info for USER \'$curruser\':\n";
if (scalar(@displays)) {

 foreach my $disp (@displays) {
  foreach my $k (keys(%$disp))

  {
   print"  $k: \t".$disp->{$k}."\n";

  }
 }
} else {
 print "
  VNC server not found in process listing.

";
}

2009-05-06

ls2csv.pl

#!/usr/bin/perl -w
#
# ls2csv.pl - show a listing of the PHP file
#            (*.inc and *.php) 
#             as a CSV table; no table headings included in 
#             output; no params defined
#
sub create_listing($) 
{
  my $xtn = shift;
  my @files = `ls -ghoG *.$xtn`;
  foreach my $f (@files) {
    chomp($f);
    $f =~ s/^\s*[-rw]+\s+\d\s+(.+)/$1/;
    $f =~ s/ /\",\"/g;
    $f =~ s/^(.)/\"$1/;
    $f =~ s/(.)$/$1\"/;
    print "$f\n";
  }
}

map { create_listing($_) } ("inc","php");

2009-04-10

This is not HTML anymore.

    The ACTION goes with the FORM.

    The METHOD goes with the FORM.

    The FORM contains INPUT elements [and optionally other HTML],

    The INPUT elements contained by the FORM may have one of several [defined]
    TYPE values.

    The INPUT element of TYPE "submit" triggers the FORM ACTION using the
    METHOD defined for the ACTION.

2009-04-06

The HTML DOM

The World Wide Web Consortium (W3C) defines the HTML Document Object Module (DOM) as a standard. The DOM is used as a standardized way to programmatically access the content of HTML [and XML – we're only concerned with the HTML, here] documents.

Languages commonly used to access and modify the content of a DOM document instance [an instance of a DOM-conformant document] are Java and Javascript.

In this case, we are interested in accessing and modifying the content (data and meta-data) of an HTML document using Javascript to manipulate HTML elements using DOM-defined methods.

Reference Material

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.