alexpgp: (Barcode)
It has been quite a long time since I've sat down to do anything resembling programming, and never in a language called PHP, which is now the programming lingua franca of the Internet, having apparently replaced Perl some time ago as the go-to language for creating dynamic Web pages. If nothing else, PHP provides the structure to a number of web applications, including WordPress.

I started small, trying to create PHP code that, when executed, simply causes the code's file to be reloaded. Then I added some FORM fields, which actually were written in HTML (PHP was apparently designed to play well with HTML, so that files can be created containing both PHP and HTML), and got the thing to spit back information entered in the FORM.

In the course of that exercise, I learned quite a bit.

Then came the next step: Take the information entered and use it to search the contents of a glossary database. For now, said database is a text file (not a real MySQL database), but my strategy in doing this sort of thing has always been to take small steps, which makes the debugging process much easier any time things start to break.

So the current status of the project is this: I can enter a string and click a button, whereupon all lines inside the data file that contain that string are output using the HTML term definition markup (<dt>...</dt><dd>...</dd>).

Small steps, that's the ticket.

Cheers...
alexpgp: (Default)
The neat thing about programming with C++Builder is the ability to create applications out of components that, in a programming sense, already "know" how to do things. For example, a directory list box object knows how to display directory names hierarchically, and double-clicking on a directory name will shift the focus of the component to that directory and will display any subdirectories.

Aside from basic functionality, other actions typically associated with "events" (clicking, moving the cursor into or out of, and so on) have to be defined. A good example is a button object, which can - among other things - be clicked. However, what actually happens when that occurs... well, that's where the "programming" comes in. And the same is true when it comes to "dropping" things that've been "dragged" over an object.

I was fortunate enough to find a web article that provided a general explanation of how to go about doing this, which included a high-level plan (1. Tell Windows that your application will accept dropped files. 2. Catch and handle the WM_DROPFILES message. 3. Process the dropped files.), leaving the well-known "implementation details" to me.

Somehow, I managed to figure out how to copy files, and the application works.

The app runs with no seat belts, in that the code doesn't do much checking of function return codes (though I do have a couple of try...catch loops in there in case of exceptions), and though it would be nice to be able to change some configuration information without firing up C++Builder again, for now, good enough is good enough.

* * *
Natalie came by last night for dinner, during which we discussed various combinations and permutations associated with the fact that (a) her roomie is moving out soon, and (b) Galina wants to put this house on the market (or get it rented again), which will put me in the market for a place to stay. We still have a little wiggle room as far as deciding anything is concerned in this regard, but I'm already flinching about Yet Another Move™ (though why that should bother an old veteran like me doesn't really scan).

Galina (and, indirectly, Lily) convinced Natalie to leave Lily with us last night (Lily ran under the bed and up through a hole in the box spring), and we promised to bring her back today. In fact, Galina and I took Lily back to Natalie's today about noon, and we all went to a place called Auntie Chang's Dumpling House, at the intersection of Westheimer and South Shepherd. The food was reasonable, and the company was excellent. Natalie had to rush back to muster some of her WoW friends and go kick around some virtual bad guys online, but I'm sure we'll have an opportunity to connect soon.

* * *
Gardening ideas must've come together in my unconscious, because today, it occurred to me how I could go about constructing two "self-watering" containers for the tomato plants bought about ten days ago. The basic idea consists of slicing apart one of several Omaha Steak styrofoam coolers we've accumulated, and then using the thick "boards" to create false bottoms for containers having a square cross-section. The styrofoam is easy to work with, so inserting a hole for the watering tube and another hole for the wick was pretty easy.

Of course, there remains the question of whether the contraptions will work over the long term.

Speaking of tomato plants, I found basically the same size plants at the flea market in Pearland today, for $2.00. While I didn't buy any more tomato plants, I did buy some mint, some rosemary (I think), and something that looks like basil with a strong hint of mint, each for $1.00.

Cheers...
alexpgp: (Computing)
It's funny how little irritations can become a focus of one's life.

As a case in point, take the (relatively) simple task of keeping track of assignment files. There was a time I kept all such files inside of MyDocuments and let files from various assignments rub shoulders with their cousins from other assignments. There were a few problems associated with that, mostly having to do with being able to find stuff that had a little virtual dust on it (e.g., thinking "I did a very similar file some time ago... what was it called again?") Knowing that the file I needed was "somewhere" in MyDocuments was little solace when there were several hundred arbitrarily named files floating around.

So, last year, I devised a System, and I've stuck pretty much to it since (except when it seemed there was no time to stick to it, for which I later paid a price in terms of confusion and lost time). The System consists, simply, of creating a directory for each assignment inside of a generic Assignments subdirectory. To keep things orderly and findable, each directory has a structured name, in the form of YYMMDD-CCC-SLUG, where YYMMDD should be fairly self-explanatory, CCC is a client code, and SLUG is a short description of the work (either the client's job number, or an actual description, such as "SmithContract").

As far as the content of the subdirectory is concerned, well... files sent by the client end up here, as do the eventual translations. Ideally, when first moving files around, I'd want to put any references that came along with a job into a separate subdirectory, and the same is true for any "work authorization" (e.g., assignment form, PO, etc.), just to keep things clear, but in working the system "by hand" for the past 15 months - and what I mean is the whole "right click-wait-select 'New'-select 'Folder'-type Folder name-hit return-open Folder" routine - I've found I'm generally too impatient to get on with work to do that, so all the files end up in the same directory, which is generally no big deal, because not everyone sends references and work authorizations, and it's not all that onerous to tack on "(Ref)" to the end of a reference file name.

Still, my soul cried out for a little automated help...

The idea occurred to me earlier this year of using my old copy of Borland C++Builder 3 to create a small application that would semiautomate the process of creating subdirectories, as often, I'll get ahead of myself when creating a directory by hand (for example, I will forget to jot down the client's job number), which will force me to revisit the name of the folder later. It would then be child's play (I thought) to open up a list box for the newly created directory and drag-n-drop files into it.

It has been years since I've done any programming in anything other than Perl, but C++Builder is so truly easy to use (that or something has been retained after all), that I was able to create the basic application in something under 70 lines of new code, albeit sans the drag-n-drop functionality.

Ah, well... there lay the rub.

(to be continued)

Cheers...

Profile

alexpgp: (Default)
alexpgp

September 2017

S M T W T F S
      1 2
34 5 6 7 8 9
1011 12 1314 15 16
17 18 19 20 2122 23
24252627282930

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 24th, 2017 12:21 pm
Powered by Dreamwidth Studios