Category Archives: Computer Science

Autogenerating HTML tables – some help

Doing complex tables in HTML can be frustrating and challenging. There is quite a bit of help on the internet including tools for helping to build tables. Some of my previous posts discuss other help that is available.

In this post, I briefly discuss a tool I have written that helps to compose HTML tables. It can take quite a bit of time but the end results can be nice also.

Read more

Web scripting and web auto-generation tools. HTML table generator.

Web scripting and web auto-generation tools. HTML table generator.

I really like the art sketch that I just posted, so I will include it again to see how it works out in this table.

Web scripting and web auto-generation tools. HTML table generator.

Web scripting and web auto-generation tools. HTML table generator.

Web scripting and web auto-generation tools. HTML table generator.

Having a good cutie pie fish background is important for doing web pages with complex tables with complex attributes and style elements.

Web scripting and web auto-generation tools. HTML table generator.

Web scripting and web auto-generation tools. HTML table generator.

I have just created a tool that helps build tables. The details of setting up the td attributes in large tables can be tedious and error prone. This tool does some of these layout functions that can help reduce errors and tedium.

You can specify attributes and style attributes for 1. the entire table, 2. each table row, 3. each table column, and 4. any individual td cell. The latter values will override any former value both for attributes and for style subattributes.

Web scripting and web auto-generation tools. HTML table generator.

Well, actually this is a tool written in c/c++ which will generate a table from a given input data file. It is hard to use, is incredibly unforgiving of errors, but once you get the input file set up (properly) you can edit the individual files that are included, and not worry any more about the table details. This can be useful for example in creating a layout or design. After that, you just edit individual input files.

This is an auto-generation tool, which I also call web scripting, in that it computes the web page table layout and includes the specified files into the individual td cells.

I first created this tool is 1994 and have worked on it in an on/off fashion since then. I have recently added a set of changes pertaining to the parsing of style sub-attributes.

The style parser is what is new here. It is implemented as a single character token parser in a state machine (switch statement in c). There is one case where a single character putback is done and otherwise it is all forward scanning of character tokens. I decided to implement this in a semi-pure sense, and I debated this implementation detail a while. It involves scanning for ';' and ':' characters and building a dictionary of style attributes that match the style names.

It does not handle errors very well and an error in the input file, such as an error in a style specification, can cause the program to crash. Usually you begin with a simple file and then work incrementally, adding more items, such as style elements, in a slow fashion.

The input file for the 2 x 2 table looks like this. It begins with a table definition, the attributes for all rows, and then the attributes for all cells. Next there are two entries for row 1 and row 2, and then two entries for columnn 1 and 2. Then style elements are specified for each row/column value and after the *end* block the matrix of files to include in each cell is specified. For example, this entry, the 1,2 table entry is contained in the file wa.txt. Well, ok, it's not that hard.

2 2
border="4" cellpadding="5" cellspacing="10" style="width: 100%; background-color: #f00000; background-image: url('http://www.georgeschils.com/ph07/css/darkpurplepat.jpg');"
style="vertical-align: top;"
style="height: 30px;"
style="background-color: #aa66ff;"
style="background-color: #fa66af;"


1 1 style="background-color: #a00000; color: #ffffff;"
1 2 style="background-color: #f00000; color: #ffffff;"
2 2 style="background-image: url('http://www.georgeschils.com/w1/sty/smv_32_r1.jpg');"
*end*
1 1 one.txt
1 2 wa.txt

I'd make this tool for sale but there won't be one person on the planet who is interested. It might not be impossible to get a no cost binary windows build if you ask (send an email). I will give out a few free copies to people who ask.

If you Google for "html table generation tools" or something similar, you will find around a ba-zillion tools, many of them free, for doing this. For example, see this on-line table generator.

Take 1, update 1.

Starting jQuery notes

I am a bit slow in "catching onto" some things, but I have just learned about jQuery. This has been out around 2 years. This short post contains a few thoughts on my initial experiences with it. And it contains some starting examples illustrating the use of jQuery. There is some associated discussion.

Read more

Freeze | toggle

More discussion is given in the sections below.

Before starting

This illustrates a collapsing section in a collapsing section.

This document (post) is a little mixed up. It illustrates more than one technique for collapsing sections, and also illustrates the link modification technique. More discussion is in the following sections.

This is a little bit of a show off post. Isn't it cute? It illustrates several techniques all in one post.

General comments ...

General comments. I have created some custom JavaScript using the jQuery library. This web page illustrates some of its use. I found jQuery to be fairly easy to learn and to use, as claimed. I believe a number of books are available, including an O'Reilly book on the subject. It appears to be a big topic and my discussions here are probably just introductory. But my initial experience with it is very positive.

Link modifications ...

Link modifications

The first use of this custom JavaScript is to make some modifications to the links on a web page. I created a JavaScript routine to modify all of the links that point outside of this site so that 1 (optionally) they contain an image indicating you are going out of site; 2 they have a popup title giving the URL where the link points to; 3 the destination URL will open in a new window if the link is clicked. You should see this effect in the above "jQuery" link.

The "link modifications" are done automatically by just including the JavaScript file, and require no other web page insertions.

Collapsing sections ...

Collapsing sections

A second application is to be able to expand and collapse a section by clicking on it. Clicking on the text followed by the "..." expands the section, and clicking on the section itself will collapse it into its smaller form.

Another example of using collapsing sections is found in this post, done a while back.

To use collapsing sections, as in this post, it is necessary to put some JavaScript in the web page itself. It is also necessary to put in <span> and <div> elements with unique id tags. These go around the "title" area and the "expand area". To see this in greater detail, look at the source html for this post. In general it takes some work to set up a document as seen here.

There are three collapsing section techniques that I have developed.

  • Method one allows sections to be collapsed by clicking on the header. When this is done the header collapses and the section to display is shown. When this content section is clicked, it disappears, and the header again appears. Clicking the freeze button will prevent collapses from occurring, and this is done for the whole web page displayed. Clicking the toggle button will expand or collapse all sections on the web page. This technique is not illustrated in this post.
  • Method two is like method one except that the toggling and the collapsing is specified for only certain specified elements. Thus you can freeze and expand/collapse only those items in a given area (such as a post) rather than the whole web page. The first two methods allow for any section to be initially opened or collapsed.
  • Method three is a technique that allows you to put collapsing sections into collapsing sections. When the title is clicked, its content expands, and when the title is clicked again, the content disappears. The title always remains. At the moment the "freeze" and "toggle" buttons do not apply to this technique. With this technique the default is that all sections are initially collapsed. This can be overridden on a per collapsing section basis, but it takes more work.

This post uses methods 2 and 3 above. Generally one would not use a hybrid technique, such as here, unless to make a point, as I am doing. Method 1 is illustrated in this post.

I use raw HTML mode in word press to paste in the JavaScript.

More discussion ...

""When programming JavaScript, it is handy to have a manual nearby. Here are some online manual references: 1, 2, 3, 4, 5, *6, 7.

The custom solution created here works quite nicely and accomplishes the objectives that I wanted to achieve. Many other effects other than what I am using here are also possible. I wanted to get some "hands on", and my general reaction is quite favorable. This is an excellent library!

It might have been easier to use the "accordion" feature of the UI library. But I wanted to try out some of the programming for myself. It works great.

Here is a one hour YouTube video on advanced JQuery given by a 12 year old. I learned a lot watching this. This is one of the more inspiring videos I have seen in a while. If you want something simpler, try this simpler introduction.

Although this may be good jQuery, I can criticize my posting methodology in that both this post and the custom jQuery have been updated too often. Generally I am too anxious to "get stuff out". The minute after I put out a new version, I think of another thing.

This JavaScript is not free software but I will give a complimentary no-cost copy to people if they ask. If you want to use these techniques that I use here you can just ask. Note that there is no documentation, and free consulting does not come with this offer.

I point out that a large set of plug-ins are available and you may want to check out free and documented stuff before you try me. There is probably a better solution than what I created here.

The solution here should really be wrapped into a plug in. If I get time, I may work on this.

There are a few small bugs, either in my programming, the browser, or the JQuery.

This technique is still evolving and is likely to change in the future.

Summary

Summary. Although I spent a good amount of time achieving the desired effects discussed above, it is still much easier than the older approach involving using DOM directly. The jQuery library abstracts this nicely and makes the programming task much easier.

The "old fashioned" DOM approach in which callback functions are placed in tags as attributes is just that: really old fashioned. This is maybe why more object-oriented programmers have not used it. On the other hand, JQuery makes use of modern object-oriented design pattern concepts in its use of chaining (with the this pointer), event propagation chains (returning nil or not), the invocation of its functions in object style (using dotted function calls on jQuery objects), and in its other features. So a person who likes object-orientation is comfortable with jQuery. And JavaScript, in which it is programmed, is actually one of the fanciest object oriented (and functional) languages around. JQuery objectifies the older approach in a way that is easy and yet elegant. It has been a while since I have run into any serious programming and programmers, and it is refreshing that people still care about it and are keeping this wonderful art alive.

Update 3

Raw html via perl script and raw HTML plugin

Some technical tips on doing complex html in WordPress

I struggled a bit trying to get raw HTML into a blog post. I did some experimenting with some techniques and I searched the internet for solutions. I collected a few links and other notes below.

More ...

Some links on HTML related issues

There is really a lot of help on the internet. Here are some other links I have found.

  • Converting html to word press.
  • Word press tips.
  • This post discusses some useful tricks if you are using Word.
  • This problem of entering raw HTML into WordPress is solved by installing this "raw html" word press plug in. This post is done using this plug in using raw HTML.

Other notes - verify your web pages

  • Then it is a good idea to verify the html that you just created, so that it is free of errors. Do this before you upload the html. To do this, I use this online website validator. (Also see the word press documentation on validation.) If it passes this test, then it is good html. Miraculously, complex blog pages can pass such rigorous validation tests. For example, I have been lucky enough to have my entire main page pass this validation, which is incredible, given the complexity of the blog page.

Raw HTML in WordPress posts

Some technical tips on doing complex html (and related items) in WordPress

I struggled a bit trying to get raw HTML into a blog post. I did some experimenting with some techniques and I searched the internet for solutions. I collected a few links and other notes below.

More ...

Some links on HTML related issues

There is really a lot of help on the internet. Here are some other links I have found.

  • Converting html to word press.
  • Some chat help is available with WordPress.
  • Here is an assortment of really excellent tips and tricks. There are lots of excellent PHP methods here.
  • This post discusses some useful tricks if you are using Word.
  • This problem of entering raw HTML into WordPress is solved by installing this "raw html" word press plug in. This post is done using this plug in using raw HTML.

Other notes - verify your web pages

  • Then it is a good idea to verify the html that you just created, so that it is free of errors. Do this before you upload the html. To do this, I use this online website validator. (Also see the word press documentation on validation.) If it passes this test, then it is good html. Miraculously, complex blog pages can pass such rigorous validation tests. For example, I have been lucky enough to have my entire main page pass this validation, which is incredible, given the complexity of the blog page.

This post was updated in March, 2017. It is an amazingly popular post.

Word press layout and other online help links

Word press layout and other online help links

I have begun trying to do some simple customizations to my blog. There is really a lot of help on the internet regarding getting help with word press. Here are a few links on doing word press customizations and other things that I have found useful. Continue reading Word press layout and other online help links

WordPress style adjustments

Here are a few notes on Word press.

Some word press style tweaks

I have been tweaking with Word press and find that it is reasonably flexible in being able to do the kinds of renderings that one wants to do. I am doing this post in html just to see how it works. This is my first html post. I am sure that I'm still an amateur at a lot of this stuff - there are really a lot of nice looking blogs out there.

I created a few styles in the style sheet to accommodate things that I would like to do. The style sheet for this theme is called style.css. You take it off of the server and edit it to make your changes. I pasted in some of my personal styles that I use often.

This is not the first time I have tweaked styles. It seems that I have spent a good part of my life trying to get those CSS styles just right.

Indented text. I want to have the ability to indent and to highlight stuff.

Times font. It takes a bit of tweaking to get this size of the "times" font right. I want to be able to render times, since this is such a standard font.

And here is an ordinary paragraph.

  • And this is a bullet item. A fish bullet should show.
  • It took me a ton of time to try to get this fish icon working. And it's not quite right yet. Maybe it says that I prefer fish to bullets.
  • The editor that word press provides is nice and has spoiled me a bit. It is very easy to use. On the contrary, doing the "raw html", as in this post, not only puts hair on your chest, takes a lot longer, but also greatly increases the likelihood of making errors.

And here we are back out of the dotted outline section. This entry is a lot of gibberish, but I am testing some of these new styles.

About the greatest test in life is to create a table. An even greater test is to try to do it in word press.

Well I'm not going to mess with the table styles. It looks pretty complicated.

If I get bold I might mess with the hover characteristics of the table, but not now.

Well this post took well over an hour (more like two or three). There are times when it's probably worth the trouble. And it's good to know that it can be done even though you always do not want to take the time.

Well I had to update this post a number of times. I made really a lot of errors. I had an immense amount of trouble. It's never as easy as it looks.

update 9 on Dec. 26.

Probabilistic network successes and guaranteed misuses

There is a lot to be said about probabilistic networks. They can be used to model many things from languages to social networks. And there are many kinds of probabilistic networks and they are a topic of active publishing at the moment.

Recently I tried a simple example based on a neat code called dyna. This pdf shows the use of a probabilistic network to “reason” or parse a number of input sentences. A set of probabilities that describe the probabilities of word transitions is supplied, and the system “miraculously” interprets the natural language grammar.

Then there is the question of whether I violated the license. The technique itself can get you into trouble using the same “flawed” reasoning that it performs itself (how ironic). Consider the following.

  • Sarcastic. Regarding dyna: I only ran one example, the one I sent you. One might reason it most likely that I violated a license but I have not. If I do anything commercial I will write my own codes. It can be dangerous even to download a code since circumstantially they can infer guilt. You can be punished for likely guilt even though you are innocent. It is getting to be that guilt or innocence is not the question but instead what the likelihoods are. This would be a misuse of probabilistic reasoning. Anyway this is what the future holds. The reasoning probably needs to be altered to find the most likely medical explanation. Anyway this is sarcastic but the future is clear and already determined, so we are still not free.
    • I do not violate software licenses. If I said this two more times I’d be guilty though, probably.
    • That’s the thing about free software: it’s fascist.
    • Guilt or innocence is determined by how much money you give lawyers, not by whether you are actually innocent or guilty.

Some very recent CS notes on languages, etc.

I am a little surprised that my technical posts are getting some attention: at least from the WordPress community. There is interest in things technical. There is so much CS on the internet, actually. I wrote a short piece on blogging with WordPress and a few people made some superlative comments, which actually surprised me. A little social support really goes a long ways.

My friend Mike Iltis called me last night and we talked for around 3 hours on things technical. (I have the bottom of the line cell phone plan). Mike, who often teaches at the university, had sent me a new set of academic links on some interesting topics, and I share a few of them below. I am not an academic but am more half way in between academia and industry. Industry people regard me as an academic and academics see me as a commercial developer. (I was a commercial developer in Silicon Valley several years ago.) Anyway I do have academic interests, but I realize that there is very much that I do not know or understand. I am mentioning Mike Iltis as a reference for the links below.

  • Self similar languages.
  • There is one object oriented program and it is this. Every program is one object which is a recursive collection of objects, which in turn are collections of objects. Every object program is isomorphic to this program, and obviously this program is self similar to all of its parts. Mathematically and in terms of formal logic, these notions are more complex than they naively seem to appear.
  • There are some really nice CS spots on the web.
  • Here is some info on an interesting programming language called pliant. [2].
  • Set theory: Setl programming language. [2].
  • Colorless green ideas sleep furiously.
    • Natural language interpretation (automated understanding) is a good topic. With all of the writing occurring especially since the advent of the blog, only computers will be able to read it all.

So far blogging using WordPress is fantastic plus other blog and web generation comments

A short analysis comparing a blog to an auto-generation system

WordPress is far better than I thought. It is making internet writing much more pleasant and easy. Last night I worked for hours doing some posts and I found my efficiency to be greatly increased. Normally it can take me 2 hours to publish one daily photo using my old (and very clumsy) system (see more below). WordPress cuts this time by about a factor of 10. This is fantastic.

My old system required images to be uploaded, links to be updated, writing to be done, pages to be validated, programs to be run, etc. All said, about 5-10 pages/files needed to be edited. Then several scripts and programs need to be run. Using a blog, most of these functions are done automatically. In most respects the blog is therefore much better. I can publish one or two photos very quickly now.

I might write up some detailed notes about my old system, which is centered around a tool called qwp (quick web pages). It does use a web page auto-generation tool that I created and it is fancy in some respects. It gives me a little more control but it costs 10 times the time and effort. It takes the html and combines any included files along with any embedded J-script into a template, and then translates it into all J-script. Then that J-script program is compiled into an executable program. The executable program is then run, and its output produces the web page. Other pre-translation steps can involve xslt and markdown translation phases, so included portions can be in xml, markdown, or html. So there are many levels of translation in my old system. My daily photo pictures for the last 2-3 years have been auto-generated using this system. For example, this photo page is auto-generated. It’s fancy, very hard to use, and the web pages don’t look good (- unless I use a better template). But here, WordPress is 10 times faster and easier, and the results look a lot better.

The ajax based front end is pretty fancy and is equivalent to using a simple Microsoft Word to create your writing. This writing is wysiwyg (what you see is what you get).

I am finally catching on to blogging. Many people have blogged for years.