Archive for the ‘Uncategorized’ Category

Resolution Commending the making of Napoleon Dynamite

Tuesday, April 12th, 2005

This is just about the best thing i’ve ever seen.

http://www3.state.id.us/oasis/HCR029.html#daily

(Yes, it’s real)

Stripslashes in Perl

Monday, April 4th, 2005

Just a quick bit of code for reference - here’s a regex to implement stripslashes (a useful PHP function)in perl.

$string =~ s/\\([^\\])/$1/g;

Update: Slashes have been escaped. Thanks, helpy.

Another update: In trying to be clever, this does way more than it should. This seems to work better:

$string =~ s/\\(\'|\"|\\)/$1/g

Implementing Dynamic RSS with PHP

Thursday, March 31st, 2005

It’s hard to discover how to write a dynamic RSS feed with php, since so many resources on the web strictly deal with parsing or consuming RSS-style feeds, and relatively few discuss how to provide them. Dynamic RSS feeds are special because they are dynamically generated by a script on the fly, depending on the query parameters that you pass along.

Most resources take the perspective of static RSS, but dynamic RSS has certainly gained a stronger following as more and more sites implement it. Some major sites that do so include craigslist.org (my favorite is putting an RSS feed on ‘Porsche 911′ within the “For Sale” section :D ) and the venerable eatlunch.at. (more…)

Problems installing trac on RHEL ES 4

Wednesday, March 16th, 2005

I had some issues installing trac onto RHEL ES 4 this afternoon. Chalk it up to being a dumbass, or whatever, but here are the things I ended up doing.

Manually installed sqllite from source, since the -devel rpm doesn’t exist for rhes4 yet on yum. * had to manually copy files because there is no installer script once built. * sqllite.h to /usr/include/sqllite/, where pysqlite expects it * binaries to /usr/bin/ * dynamic libraries from some hidden .lib directory in the build dir to /usr/lib/

Symbolic link from /usr/local/bin/python to /usr/bin/python, for some stupid installation script.

pysqlite’s link from the trac homepage goes to a completely skeleton wiki. Google for it and go to the sourceforge page instead to download the proper version.

The worst offender was that I created my trac environment outside of the already-configured DocumentRoot of apache, and COMPLETELY FORGOT ABOUT SELinux. BAD IDEA.

Of course, RHEL 4 comes with SELinux enabled if you ask for it. Part of what it does is define special contexts on files and directories by default. For example, it will set up special context xattrs on your /var/www/html directory, where your htdocs lie by default.

Of course, if you use trac-admin to create a trac env outside of the accessible directories, OR if you symbolic link to an accessible directory, you can run into issues. That’s because SELinux looks at the path the ‘apache’ user is trying to access and checks the extra context attributes after the normal Linux permissions.

It fails with a bad “[Error 13] Permission denied”, and has a nice stack trace about how it can’t access ……./trac/VERSION. What trac tries to do at that point in the code is check the VERSION file to make sure it’s the right version before proceeding. If you set the TRAC_ENV var in httpd.conf to a path that isn’t accessible to the right http server context like /var/www/html is, then apache will fail with those errors, and you’ll see the result in /var/log/messages.

If you need to change the context of a directory or file, you can use the chcon command, that works similarly to chown, with special flags for each type of xattr used by SELinux. Just read the man chcon for more.

It was nice to make this all work. Also, symbolic links may not work for your DocumentRoot, because of all this business. Remember to check your /var/log/messages, which is where SELinux denials appear by default.

And don’t be dumb like me, and completely forget that you have a new security layer in RHEL ES 4!

Phil’s Internet Product Fanatic List

Monday, February 28th, 2005

In one of his quarterly weblog updates, Phil Fibiger reveals his fantastic list of message boards and mailing lists full of product fanatics.

Know people who can talk hours and hours about a single product line? These forums are where they gather. If you’re looking for a good, solid EDC (Every-Day-Carry), be it a blade, a flashlight, or mixing spoon, stop by the forums that Phil lists for some good old-fashioned personal advice.

It’s usually really difficult to find the single “real” forum for a particular product line, especially because there are so many pretenders to the throne. That’s why it’s good to know someone like Phil to prune the hedges of internet spammery and just deliver the best.

The “Disco Doc”

Sunday, February 27th, 2005

It’s definitely not cool to say, but man, I dig disco music.

I was checking my search term logs, and found that people actually make it to my site by searching for “disco dancing.” This is no doubt due to the disco instructional video that I linked to a while back.

I was feeling curious, so I searched for the same terms on google, and what I found about the “Disco Doc” is pretty unbelievable. Check this out - an Asian-American dentist, Dr. Rodney Chang, converts his dental office into a disco studio in 1979, gets invited to national TV shows, and in 2002, at age 56, is still dancing! You really have to check this out.

Da Waiting Room - his personal homepage (midi disco background music)

Beyond Disco Dancing or 100 or 150 dance strategies of Disco Doc

Not only that, in the mid-1980’s, he became Pygoya, the Cyberartist! The link takes you to his VRML Web Virtual Art Museum. No joke. It has background music and flaming logos, so if you’re a web designer, take it with a grain of salt.

This is just so amazing, I recommend you check it out for yourself. And if you think i’m just poking fun at him for his web design, i’m not. This is one prolific and accomplished guy of our era, and i’ve never heard of him. Imagine being a dentist, disco star, and accomplished artist in one lifetime. No matter what your websites look like, that’s a heck of a lot.

Hats off, Disco Doc. I salute you.

Naming Conventions That Delight the Programmer and Confuse the Users

Saturday, February 26th, 2005

Warning: This can conceivably be viewed as a rant. However, I fall into the same traps as those I outline here, and I’m simply trying to organize my thoughts into a pattern rule that I can use when writing and maintaining my own code.

This post may have implications beyond programming. If you’re making forms for others to use, even if they’re not electronic, you’re defining an organized perspective on something. Organized perspectives are tricky, because they’re usually desperately needed in order to get ad-hoc notes, data, and relationships into some sort of structure so that useful information can be extracted.

Why should anyone care? Because when you start to interact with other people, forms, databases, or even excel spreadsheets, every concept and word you used in defining your data must be mapped to concepts and words in the other person’s vocabulary. Additionally, many words that programmers typically use are delightfully ambiguous. Programmers sometimes call this “flexibility.” Is this a misnomer? You can be the judge.

Here are some “flexible” concepts that are programmer favorites. Type. Reference. Category. Number. Name. Date. Item. Object. Context. It truly doesn’t seem too bad at first glance, right? After all, we used these words all through our CS degrees, and they’re sprinkled through all the writing and documentation that programmers do and read. Well, imagine coming across a data store (database, excel spreadsheet, whatever) with a table called ReferenceTypeNumber. Or CategoryTypeNumber. Or ObjectReferenceCategoryTypeID. Does that seem like an unlikely scenario? Trust me, it’s not.

And then there are the completely made-up words and concepts that programmers and data people made up, because they started confusing themselves. For example, let’s look at the concept of a “namespace.” A namespace is really a way of saying that you’re about to use all sorts of “flexible” names, and you expect that the names are so useful and good that someone else is bound to use them as well. You don’t want to confuse your “Type” with someone else’s “Type”, so you make a “namespace” and stick it at the front of all your words. My namespace might be “Gordon”. That would make my “Type” “Gordon”.”Type”. Your type might be “Jimbo”.”Type”, and we all live happily ever after.

Until you have to explain the concept of namespaces to someone else. Because when programmers finally “get” a concept, it means that we’ve managed to wrap their “flexible” concepts in their own brain around this new concept, and in order for us to tell you what it means, we use all sorts of “flexible” terms. And god help you, too, if you encounter XML namespaces and paste in the URI to your browser, find nothing, and become completely mystified.

“Oh, the User Type? It’s just the category of User. No, it doesn’t have anything to do with your LDAP User Type, or Active Directory User Type, it’s just your Website User Type.”

Dur.

So what, am I just complaining? Nope. I think it’s possible for programmers to think in tangible, real-world terms at the very least, when they interface with the outside world. Of course, it’s not practical to expect that Java / OOP languages change their base class from Object, because we need that “flexible” concept to even implement OOP. Luckily, non-programmers never need to be exposed to those concepts if we (the programmers) are careful.

The basic idea is this:

Name Carefully!

This is most useful for API’s, interfaces, documentation, communication, presentations, etc. If you get more comfortable and used to naming carefully, you can extend it further. Personally, I like to go as far down as I can possibly go, naming tables and fields in my databases carefully. I’ve had enough nightmares of discovery going through undocumented databases for two lifetimes. I try to extend a small favor to posterity by carefully naming and documenting my databases.

Now that i’ve explained the motive and the concept, here are some concrete processes you can follow to carefully name your own programming (or other) projects.

  • When designing automation or databases around a flat-file or paper database, or even a “social” database of ad-hoc discussions, take detailed notes about the words people use in conversation about the concepts. If you can, create a glossary. The glossary of terms is a good place to start your naming conventions.
  • Often, you’ll find that real-world humans use “context” as their “namespaces” in everday conversation. What does that mean? For example, if your context is a discussion about the company website, you can take “Account” to mean the credentials you log into a website with. In other instances, if you’re talking about customers, “Account” might mean an actual monetary account held with your company. In the examples, the context was different, so the same word held multiple meanings. We, as programmers, get confused too, so sometimes it’s useful to ask questions like, “Do you mean the Website Account, or the Monetary Account?” to enumerate the namespaces that you infer from the conversational context. Make sure to make notes of these contexts, because you might end up using them as namespaces, table names, or prefixes in your interfaces and forms.
  • Make sure to review the glossary with the future users, and continue to refine it to minimize confusion or ambiguity. You know you’ve got the right terms when you can ask detailed questions clarifying your understanding, and you get detailed corrections or an affirmative response. Note: Many programmers are so used to getting blank stares when asking detailed questions, that they may be shocked at the improvement in feedback when properly using careful names. :)
  • Try to use physical or tangible constructs that really fit well with underlying concepts. Instead of “Type,” some tangible constructs might be “Department,” “Clearance Level,” “Audience,” etc.
  • If you’re not familiar with Database Normalization techniques, they can be invaluable in designing databases for maximum usefulness and extensibility. Creating a carefully-named system goes hand-in-hand with ensuring database normalization, because it helps you avoid overloading a table with uncorrelated records.
  • It can be frustrating work! Make sure to take a break once in a while and talk like a normal person again. It’s good to be detail oriented, but it does get tiring after a while.

Many thanks to all those people who have inspired this way of thinking - John Coanda in particular (the most detail oriented guy I ever met, who showed by example how to carefully construct detailed questions about confusing topics).

Engrish Lord of the Rings Subtitles

Wednesday, January 19th, 2005

I always forget where to find this, because it’s great for some laughs.

Engrish LOTR:TT Captions - a mirror of the original, taken down due to C&D.

NuSOAP for PHP and .NET Client

Tuesday, January 18th, 2005

Investigating the use of the NuSOAP library for implementing web services on top of PHP APIs. NuSOAP was originally written by the same guy who brought us Foxylicious, the firefox plugin for del.icio.us. It allows for easy integration with an existing API to provide a SOAP service, and also allows for fairly simple SOAP client creation.

The NuSOAP project page and the developer’s page. Scott Nichols’ SOAP / NuSOAP page. He’s the active developer currently working on NuSOAP. A note about an RPC method format required for integration with .NET(?). An article about using a NuSOAP client to consume a .NET based web service. W. Jason Gilmore explains how to publish web services for .NET with NuSOAP A Dilbert a day with PHP and NuSOAP Pocket SOAP TCPTrace, a useful tool for SOAP/HTTP debugging. Various VS.NET consuming NuSOAP server references: * http://www.vbdotnetforums.com/showthread.php?t=1093 * http://www.hardforum.com/printthread.php?t=812041 * Short mention of .NET using Document-style SOAP while NuSOAP uses RPC-style SOAP. * Example VB code to call NuSOAP service. * Adding a WebReference to VS.NET to consume NuSOAP wsdl.

Don’t name your wikis “Wiki”

Sunday, January 9th, 2005

I noticed while visitng the Mojavi Project that they have a navigation bar with a “Wiki” link. I was looking for a “Documentation” link and was confused for quite some time before realizing that they store all documentation on their wiki.

It’s fine to store documentation on a wiki. Because wikis are so neat, and they’re a new technology, nerds forget that almost nobody knows what a wiki is yet. I’d be shocked if there was more than 10% familiarity within the entire IT world. Documentation should still be “Documentation” or “Manual”, regardless of the format. You wouldn’t create a web-based documentation site and name it “HTML”, would you? Or, for that matter, make a manual and name it DOC or PDF.

Remember that technologies are neat, but just because we use wikis all the time doesn’t mean that the format is inherently more important than the content.