Skip to main content

Posts

Funny Programming Mistake

I thought you might find this programming mistake I made to be somewhat humorous. public MyJSplitPane getMyJSplitPane() { MyListener myListener; MyArray[] myArray; myArray = source1.getMyArray(); if (myJSplitPane == null) { myListener = getMyListener(); myJSplitPane = new MyJSplitPane(myArray, myListener); } return myJSplitPane; } /** * @return Returns the myListener. */ private MyListener getMyListener() { MyJSplitPane myJSplitPane; if (myListener == null) { myJSplitPane = getMyJSplitPane(); myListener = new MyListener(source2, myJSplitPane, this); } return myListener; }

While and Comment Differences

I just thought I'd share what I thought about a couple of differences between JavaScript and VBScript. Loop Difference I think it's better that JavaScript doesn't have a do...until loop. The do...until loop seems kind of superfluous to me, since the same can easily be accomplished with a while loop. For example, these two are equivalent: Do Until (x) ' do something Loop while (!x) { // do something } Comments Difference Notice the difference between the comments in the examples above. That was the other difference I wanted to mention. I tend to think that faster is better, and it's faster to type the single quote (') than it is to type 2 forward slashes (//). On the other hand, JavaScript provides for making part of a line a comment anywhere in the code, like this: if (x /* == true */) As you can see, the end parenthesis ")" comes after the comment. I don't know if VBScript provides any way of making comments like that. Does anybody els...

3 digit for loop

Would you believe that this is almost exactly the same as some JavaScript code that I found, that somebody actually wrote? Tell me, what's wrong with this code? Could you think of any more concise way to write it? All we need is the highest version number we can use to create the activex object without throwing an exception. var curr = -1; for (var n1 = 1; n1 >= 1 && curr == -1; --n1) { for (var n2 = 9; n2 >= 0 && curr == -1; --n2) { for (var n3 = 9; n3 >= 0 && curr == -1; --n3) { for (var n4 = 9; n4 >= 0 && curr == -1; --n4) { for (var n5 = 9; n5 >= 0 && curr == -1; --n5) { var version = "" + n1 + n2 + n3 + "_" + n4 + n5; try { var versioned = new ActiveXObject( "JavaPlugin." + version); curr = new Number( "" + n1 + n2 + n3); ...

Extreme Driving (XD)

If you've never heard of Extreme Programming (XP) , you probably just won't get it. As a matter of fact, you might not get it anyway, but that's ok. XD is a deliberate and disciplined approach to driving motor vehicles. If everybody just tries to drive whatever way, it will take longer to get anywhere, and there's more of a danger of a crash. That's why you must have and follow a driving methodology . First of all, it's absolutely essential to have lots of "Call Up Meetings," which involve everybody calling and talk to each other on cellphones while driving. Never drive without them. "Collective Mechanical Ownership" is another critically important concept of XD. It means that any driver must have access to change the mechanics in the vehicle at any time. So if one person wants to get in and rewire the starter, or another person decides to change the spark plugs, there doesn't have to be centralized oversight of all that. And don't...

XML is Not a Database

XML is good- but only for some things. XML is very good at describing ordered lists, documents like they will be printed on paper, and simple trees, like family trees. For other things, XML is really bad. All other computer data with a more abstract nature has trouble conforming efficiently to the tree hierarchy of XML. Programs which use XML to describe and retrieve all kinds of data indiscriminately, suffer intense processing delays- particularly while attempting to traverse an ordered list to retrieve unordered data. The strongest feature of XML is that it's very close to the ubiquitous HTML. It's easy for many people to learn about XML because they're used to HTML. Data described by XML can be transformed into HTML very easily. XML works great to describe lists of items, like feeds of syndicated content for things like a news feed, stock quotes, or a series of audio or video episodes. It's great at describing outlines, with bigger sections broken down into smaller ...

findmercy.com

I have 2 web sites now: findmercy.com This is my own personal web site. If you'd like my web site to be your home page, please set your home page to findmercy.com . If you want to bookmark my web site, please be sure that your bookmark is set to findmercy.com . i.findmercy.com This is the web site of my computer program business. This is where you can work on good programs and other files for computers. Please consider adding i.findmercy.com to your bookmarks. Please tell people about these web sites. I greatly appreciate it.

A Window Into My Work Day

WARNING: Highly technical stuff ahead. Do not proceed without a pocket protector. Here's a good puzzle for you. How do you use a literal quotation mark in quoted XML text in a string wrapped by the same kind of quotation mark in an XPath query? If you say: comments[text()="There's a 48" door."] The quotation mark after the 48 ends the text quotation, and the final part of the string (" door.",) is unexpected, and causes a syntax error. Simple enough so far, right? A literal quotation mark in an XPath string is NOT automatically escaped to it's character entity to indicate a literal quotation mark. Instead, it's naturally used as part of the XPath code, to break the XPath string. Your first impulse might be to switch quotation mark types. I disdain the switching of quotation mark types. In my opinion, the double quotation mark should always be used to indicate a string quotation, and if it must be escaped, it should be escaped. Some people prefe...

Sample Manual

I like to create my web pages in plain text editors. Here's a good template to start a new web page. I like the filename, "index.htm". <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">  <head>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <title>Fun Work</title>   <style type="text/css">   /* <![CDATA[ */    h1{text-align:center;}   /* ]]> */   </style>  </head>  <body>   <h1>Fun Work</h1>  </body> </html>

Standard Page Format

Web pages are an extremely useful format for many different purposes. If possible, I think it's best to stick to the most widely used standards. This format may be UTF-8 encoded , Strict XHTML 1.1 with CSS1 . The file may contain an American English (en-US) web page, valid in the strict XHTML 1.1 language, encoded in UTF-8. It may also contain a fun visual style for the page, in the CSS1 language. Entire jobs may be distributed in single ZIP files . The zip may contain web pages and atom feeds . An atom feed can include a good record of the whole project. Share your comments!

How to Have Fun at Work

I realized that enjoying our work can be almost as good of an incentive as money. Computer programming should be fun. When it is, the programs end up much better. As we work together, I thought I'd post about our work every now and then. We'll talk about how to work in a way we can enjoy it.