Category: Programming

I’m learning Perl. Nobody ever told me that PHP’s syntax was essentially Perl’s!

It occurs to me that I really don’t care about my GPA. This is literally the first time in my life, or at least in my living memory, I’ve been able to say that. I was always ashamed of my Cs in Handwriting, and since fourth grade I’ve been straining for As (and, since junior year of high school, usually getting Bs). Right now I want to get through my two classes, finish a project and graduate. All that matters is passing.

Of course, that project may be the lurker below. I had a solid setup with a professor at the beginning of the semester; it sounded like work I’d enjoy, and there was even compensation involved. All we had to do was wait for the company that wanted the code to sign off on the contract.

It’s March 10. Guess whether they’ve done so. Guess also whether the aforementioned professor appears to care, beyond a little guilt.

I’m going in tomorrow to talk to my advisor and find out what I need to do to get the DBCAC site approved as my final project. It’s for a nonprofit organization, and the work is easily as complicated as what I would have been doing otherwise; I’ll even write a paper about it if they want one. The quiet assumption is that MS students get a rubber stamp on their project requirement by building a professor’s resume, but I tried that and it didn’t happen. I’m not going to let someone else’s short attention span keep me here another semester. School has ceased to interest me, and I’m going to be finished in May, one way or another.

Pokéblog entry from today, in class

I know how to hash things in programs, despite the fact that the applications of hashing got like two weeks of coverage total in my almost-six years of comp sci study. Therefore, every time I’m sweating a bad O(n^2) algorithm and suddenly realize that I can use hashing to significantly reduce its average-case complexity, I feel like some kind of mighty computer genius. But I’m not. I just know how to hash things.

Possibly the reason I feel this way is that nobody else with whom I’m working on said algorithms–including my professors–seems to understand what I’m talking about, like most of you right now.

Let’s see if I can out-geek the Forge

All RPGs currently implemented on computers (including consoles) take the form of applications: behaviors written with an end in mind. But pen-and-paper RPGs aren’t applications. They’re operating systems.

Discuss! Or don’t.

I’ve had a long and passionate love affair with iamcal’s Noted, a lightweight text editor that is everything Notepad ought to be. It has toolbar search and replace. It can read and convert linebreaks from (or to) any OS. It has an unlimited buffer size. It has no associations in the annoying editor wars. It counts lines and even lets you jump to them! And that’s almost exactly all it does. Noted is great.

The only things it doesn’t have that I wish it had are a tabbed interface like Firefox and a word counter so I could stop using stupid MS Word. The former would probably be very complex to implement, but the latter shouldn’t be too hard. I checked the Noted page again today to see if its source was available. It is! So I poked around and discovered that it’s written in… Pascal.

That’s really weird. People still write in Pascal? (Maybe not, as Noted hasn’t been updated in a couple years.) I used it as a training language in my sophomore year of high school–it was fun but bad for me, as it gave me lots of procedural habits that I had to break before I got good at OOP. A glance at Noted’s code just now mostly made sense, although it also shows some indications of classes, which I don’t recall in Pascal. For that matter, I never knew Pascal could do native Windows GUI apps.

I do realize that there are form-based web pages that count words, but unfortunately I haven’t found one as smart as Word’s tool, which isn’t all that smart. I also realize that I could write a form-based PHP script that would be as smart as Word’s word-counter (and probably will do so), but I’d really rather have it in a text editor; Noted is almost perfect for my needs, and browser textboxes aren’t.

I will probably get corrections on this

Theoretical problems in computer science are divided into classes based on their complexity. One class, called simply “P,” covers all problems requiring a yes-or-no answer that can be answered in polynomial time–which is to say that the amount of time needed to solve the problem is the result of substituting its input size for the variable in a polynomial equation. This is an important distinction, because that usually means it can be solved by a given deterministic computer (regardless of its speed) in some reasonable amount of time (ie before the universe ends).

There’s another class of problems, called “NP,” that has a special relationship with P. If a problem is in NP, there is no known algorithm for it that produces a solution in polynomial time–but the problem of verifying any given solution to the NP problem is in P. So you can figure out whether an answer is correct relatively quickly, but determining what the answer is could take a very long time. Longer than the sun has left in its life, for example, or longer than the universe has been in existence so far.

A final set of problems, called “NP-Complete,” is a special subset of NP. NP-Complete problems are very general and powerful–so general, in fact, that any NP problem can be transformed into an instance of any NP-Complete problem (and the transformation algorithm produces results in polynomial time). As you might imagine, these problems are very hard to solve, but of course their verification problems are in P.

If anybody ever produces an algorithm that will solve an NP-Complete problem in polynomial time, it will mean that all NP and NP-Complete problems are also solvable in polynomial time. NP and P will be equivalent sets. This would be a huge breakthrough in theoretical computer science, and it is likely that it will never happen.

But nobody’s proven that any NP-Complete problem isn’t in P, either. We only know that NP-Complete problems are not in P yet. (There’s a standing bounty on this; proof either way will get you a cool million bucks.)

As with most things that seem pointlessly theoretical at first, it’s not hard to apply the P-NP distinction to real life. It’s often easy to figure out that you’ve received an obfuscated message of some kind, whether it’s encrypted or noisified or divorced from its context. It may even be easy, given a possible meaning for the message, to decide whether that meaning applies. But deciphering the message from scratch can be very, very hard.

The difference between knowing that something is a message and knowing what the message means produces the best small mysteries.

You know, Java is great until you have to design a user interface with it. Then again, I could say that about pretty much any language that isn’t PHP (which just delegates UI to HTML).

I plan on never designing a non-HTML UI, so it’s a good thing I know a fancy boy UI programmer already. I assume he works for pudding.