Category Archives: software

HTML and CSS Scrolling table with fixed heading


In web design, you often have to display a table that is too long and ruins the aesthetics of the page.  The ideal thing to do is to scroll the body of the table while leaving the headings fixed.  The design of the HTML didn’t quite get it right.  You would think that the following code would solve the problem by just scrolling the body enclosed within the <tbody> tags, but it does not work in any browser.

This code does NOT work:

<table cellspacing="0" cellpadding="1" border="1" width="300" >
  <thead>
    <tr>
      <th>col 1 heading</th>
      <th>col 2 heading</th>
    </tr>
  </thead>
  <tbody style="height:48px; overflow:auto;">
    <tr>
      <td>col 1 data 1</td>
      <td>col 2 data 1</td>
    </tr>
    <tr>
      <td>col 1 data 2</td>
      <td>col 2 data 2</td>
    </tr>
    <tr>
      <td>col 1 data 3</td>
      <td>col 2 data 3</td>
    </tr>
  </tbody>
</table>

There are solutions posted on the Internet that solve the problem by using JavaScript to cope with browser idiosyncrasies, but they are not general solutions.

It is possible to have a table with a scrolling body and fixed header with only HTML and CSS. The solution is to use three tables.  An outer table consists of two rows.  The top row contains a table for the heading and the bottom row contains a <div> containing the table for the scrollable body.  The outer table and the <div> container  have to be 25 pixels wider than the tables for the heading and the body to allow room for the vertical scroll bar.  The column widths of the tables are defined through CSS.

The following code works for all browsers (Internet Explorer, Firefox, Safari, Opera):

<table cellspacing="0" cellpadding="0" border="0" width="325">
  <tr>
    <td>
       <table cellspacing="0" cellpadding="1" border="1" width="300" >
         <tr>
            <th>col 1 heading</th>
            <th>col 2 heading</th>
         </tr>
       </table>
    </td>
  </tr>
  <tr>
    <td>
       <div style="width:325px; height:48px; overflow:auto;">
         <table cellspacing="0" cellpadding="1" border="1" width="300" >
           <tr>
             <td>col 1 data 1</td>
             <td>col 2 data 1</td>
           </tr>
           <tr>
             <td>col 1 data 2</td>
             <td>col 2 data 2</td>
           </tr>
           <tr>
             <td>col 1 data 3</td>
             <td>col 2 data 3</td>
           </tr>
         </table>  
       </div>
    </td>
  </tr>
</table>

Look at the code for the table above

Comparing Blosxom and WordPress weblogs

The old adage that “necessity is the mother of invention” is so true.  When we are frustrated, or our current approach to a problem does not produce satisfactory results, we often try something else, and in the process we may discover something new.

I have had a WordPress blog since May of 2007.  At the time, I did not know much about how blogs worked, and used the cookie-cutter approach provided by my web hosting service.  I started learning about WordPress themes, syndication, database backups, MySQL databases, phpMyAdmin, and many technical details that were necessary to interface the blog with my website seamlessly and reliably.

All was well until, one day, I noticed that the RSS subscription to my own blog had not been updated.  When I investigated, I found that my WordPress blog had been hacked.  Someone had modified the WordPress wp-blog-header.php file and added some code that would divert search engine requests to a variety of casino and porno sites.  The code was clever enough to avoid diverting direct accesses to the blog, thus reducing the chance of detection of the hack by someone who accessed the blog directly.  I restored the original code, and determined that the hack had been made possible by a buffer overflow through the blog comments.  I modified the WordPress code to prevent further changes.  I described the technique here.

My original WordPress database was in Latin-1 code page and I wanted to convert it to UTF-8 to make internationalization easier.  At the same time, I decided to upgrade the original version of WordPress that I had been using to the latest and greatest version.  Disaster!  The intelligible permanent links stopped working because the permalinks plugin from my host was not compatible with the new version of WordPress.  The solution required being able to modify the .htaccess file, which I was not allowed to do on my host system.  Disappointed, I decided to use an ugly default link format, and I had to modify my 404 processing (for pages not found) so that requests for pages from “permanent” links to my blog would be converted to blog searches to try to find the blog post.

It was at this time that I started looking for blogging alternatives to WordPress that did not involve a database, and I found Blosxom. Comparing WordPress to Blosxom is like comparing a modern automobile to a horse and buggy.  They both can get you to the same place, but the ride in the horse carriage requires a lot more tending.   So it is with Blosxom, but after a couple of days, I was able to convert my WordPress blog for use by Blosxom.  The real strength of Blosxom becomes evident if you want to create static web pages and remove the dependency on PHP and MySQL.  The dynamic version of Blosxom also works well, but unless you are a good Perl programmer, you better stick with WordPress.  If you are still interested, click on the following link.

Learn how to convert a WordPress Blog to Blosxom

(OS 3) The system cannot find the path specified

Apache Web Server

Recently, I got a new computer and I had to install the Apache Web Server on a Windows platform to be able to test my CGI scripts locally before publishing them on the internet.  The installation went well and I could test CGI executables without problems, but HTML pages that used Perl scripts displayed the dreaded HTTP Status 500 – Internal Server Error.  My Apache error.log file had the entry:

[client 127.0.0.1] (OS 3)The system cannot find the path specified.
: couldn’t create child process: 720003: echo1.pl

This type of error occurs more frequently in Windows systems than in Linux or Unix systems.  The reason is that the shebang line of the Perl script (#!/usr/bin/perl) is used by the Apache web server to find a program to interpret the script.  In Windows systems, the Perl interpreter is normally installed as C:\Perl\bin\perl.exe, whereas in Linux/Unix systems the path is usually /usr/bin/perl, as indicated in the shebang line.  Although there are several ways of telling the web server where to find the Perl interpreter, I have found that the simplest solution is to leave the Apache configuration alone and store a copy of the Perl interpreter as C:\usr\bin\perl.exe.

In this way, I can test my Perl scripts in the Windows system with exactly the same code that will run in the Linux systems.  In the event that I upgrade to a new version of Perl, I have to remember to also change the copy in the local C:\usr\bin\ directory, or install the new version of Perl in directory C:\usr instead of the default directory C:\perl.

Click Here for a list of Free and Open Source Software

Syntax of Declarative Sentences

Example of a Declarative Sentence
Example of a Declarative Sentence

This web site has a formal description of an English Grammar that I have used for many years for my computational linguistics work.  The problem with formal descriptions is that they are very terse, and it takes a lot of study to understand how the constituents interact with each other.

I have developed an Interactive Syntax Worksheet that displays the interaction of the grammatical components, and gives the user an intuitive feeling for the process involved in constructing English sentences.  I hope that this is useful to students learning English as a second language, and to native speakers interested in English syntax.  The program is written in JavaScript and it operates entirely within the web browser, so there is nothing to download.  The only requirement is that the browser should be running with JavaScript enabled.

Reduce Your Credit Card Debt

Dollars and Cents

One of the best New Year resolutions that you can make is to reduce your credit card debt.  It is not unusual to have to pay 21% interest when you carry a balance on a credit card.  In addition, you can be penalized with late fees and lower credit scores if you do not pay by the date your payment is due.

Although credit is convenient when you do not have the money, it places a great burden on your future finances.  Suppose that you bought some new furniture for $1000.00 on a credit card.  The lender usually will ask you to pay only 5% of the total amount per month, which is around $51.39 Dollars per month.  It will take 24 months to pay off the loan at 21% annual interest.  At the end of the two years, you will have paid $1,233.26 Dollars, including $233.26 in interest.

You can reduce the interest that you pay and accelerate your payment schedule by increasing your monthly payment.  For example, if instead of paying $51.39, you pay $70 Dollars per month ($18.61 Dollars extra), you will pay off the loan in 17 months instead of 24, and you will save $72.34 Dollars in interest.

Scientific Psychic passes 7-million visitor mark

Scientific Psychic Statistics

The domain ScientificPsychic.com has been active since February 15, 2001.  The web site has continued its original goal of providing educational material and entertainment.  Some of the most popular pages are the optical illusions, games, diet calculator, verb conjugation, and hygiene.

ScientificPsychic.com averages approximately 6000 visitors and over 16,000 page views per day.  Most of the traffic originates from English-speaking countries like the United States, the United Kingdom, Canada, Australia, and India, but there are visitors from many parts of the world where English is spoken such as Singapore and the Philippines.  This is an example of the country of origin of the visitors.

Scientific Psychic Statistics

Some of the web pages have been translated to other languages and it is not unusual to have Google refer French queries to the French version of the verb conjugation page.  The recent translation to Spanish of the diet calculator, and the pages about carbohydrates and hygiene already is attracting visitors from Latin America who search the web in Spanish.

Scientific Psychic® is registered in the United States Patent and Trademark Office with registration number 3,088,970.

Internationalization of web pages

English is the most common language in international trade, but there are many people in the world who do not understand English. Over 313 billion web pages have been published on the World Wide Web, and approximately 70% of them are written in English. Here are some global internet statistics of web content by language:

Language - Percent of web content
English 68.4%
Japanese 5.9%
German 5.8%
Chinese 3.9%
French 3.0%
Spanish 2.4%
Russian 1.9%

It is important to consider that the native language of people using the internet is not always English. About 30% of the web surfers are English speakers, but 15% speak Chinese, and 9% speak Spanish. Here are some statistics of the percent of users who surf the internet.

Language - Percent users - Number of users
English 30.1% 379M
Chinese 14.7% 185M
Spanish 9.0% 113M
Japanese 6.9% 88M
French 5.1% 64M
German 4.9% 62M
Portuguese 4.0% 51M

From these statistics, it is evident that Chinese and Spanish readers are being underserved. Web sites seeking to expand their global audience should consider translating some of their pages to make them accessible to speakers of other languages.

ScientificPsychic.com uses the following national flags to indicate the availability of web pages in other languages:

English- English
Spanish- Spanish
French- French
German- German
Russian- Russian

To see an example of an internationalized web page see:

English Verb Conjugation and Inflectional Morphology

Calculadora de dieta en español

Recientemente leí­ que los mexicanos han engordando tanto que ahora México esta en segundo lugar mundial en obesidad despues de los Estados Unidos[1]. Esto me ha motivado a traducir mi calculadora de dieta a español.

Espero que esta página web ayude a mis amigos y familiares en México a controlar el sobrepeso, aunque creo que también será útil para mis amigos en España y Sudamérica.

[1] Mexico now the 2nd fattest country, after U.S.

Free software gives new life to old computers

Last year, I had to get a new laptop computer because my old IBM Thinkpad with Windows 95 was basically obsolete. The computer had only one USB port and it needed an Ethernet card to connect with my desktop computer through my local area network hub. With Windows 95, the system would sometimes pause as I was typing a document, and it would stay in a state of limbo for about 30 to 40 seconds before resuming. This would interrupt the flow of ideas that I was trying to type, and during this time I could think of nothing but the top row of keyboard: #$%%*!, %$&^%$!, and @$%*!

I started using the old Thinkpad as a perch for my new laptop because I hated the idea of using it as doorstop, as a mean-spirited geek had suggested. At the time that I bought my new laptop, I also bought a copy of Linspire, a Linux-based operating system, with the idea that one day I would convert the IBM Thinkpad to Linux. Several months later, when I finally installed the new operating system, I found out that the old Thinkpad had regained some of its spark. Linux had fixed the intermittent pausing problem.

You can buy Linux systems- very inexpensively, but you can also download them free from the Internet if you have a broadband connection and you can create a 700 megabyte CD. The three most common Linux versions are Ubuntu, OpenSUSE, and Freespire, a free version of Linspire. Ubuntu has gained wide popularity because it provides online support through a large community of users. All three operating systems come with free web browsers (Mozilla Firefox), e-mail, and a free office suite (OpenOffice) compatible with Microsoft Office to handle spreadsheets, documents, and slide presentations. A wide array of Linux applications can be downloaded from the Internet.

I downloaded GCC, the GNU Compiler Collection, and now, I use my old IBM Thinkpad as a platform for testing the Linux 32-bit versions of my linguistic programs. This has become important now that many of the systems that I previously used for development have been replaced with machines that use 64-bit architecture.

The moral of this story is that you can recycle your old computer and make it useful again with a minimal investment.

Your mortgage loan can affect your retirement income

Amortization and Annuities Calculator

The Dow Jones industrials dropped more than 500 points over two days as traders in the stock market worried about subprime mortgage loans.  The weakening of the housing market has resulted in lower real estate prices and has made it harder to make short-term profits buying and selling homes, apartments, and condominiums.  As interest rates have gone up, interest-only loans, negative amortization loans, or variable-rate loans have increased the burden on borrowers who end up defaulting on the loans because they are unable to refinance or sell at a profit.

Many of the borrowers who are now struggling with their mortgage loans could have had a better outcome if they had read and understood the terms of their home mortgage contract.  An educated borrower also needs to understand how compound interest and mortgage amortization are calculated.  A mortgage amortization schedule provides a detailed description of the principal and interest in each monthly payment during the life of the loan.

When planning your retirement, you need to know when your home will be paid off and how much money you will have in your savings account.  An annuity calculator will help you determine the accumulation of capital from a single deposit or from regular deposits.  Did you know that you can become a millionaire by investing $180 Dollars per month at 14% interest for 30 years?  That is only $45 Dollars per week!  You can also save a lot of interest on your home mortgage by paying additional principal in each monthly payment.