Saturday, November 10, 2007

How does a Loner survive?

There are many kinds of Loner, I think. To list but a few, I would say loners fall into these broad categories:

  1. The shy - a person who desires not to be a loner, but because of his/her makeup and disposition, finds it incredibly difficult to seek out friendship.
  2. The garish - a person who has no difficulty seeking out friendships with others, but because of their approach, is shunned by those he or she seeks out.
  3. The pathological - a person who finds no need to have friends.

I am of the first type, and wish to further qualify that with the caveat that pride enters into the recipe at a very high level. I find it very difficult to admit to others that I might be in need of anything. Perhaps it is because of my upbringing, or the environment I found myself in at an early age, but it is very difficult to admit that something is wrong to others.

I find myself now in several difficult positions. One of my businesses is on the verge of failure, and another is on the verge of great success. My wife is in need of a liver transplant, and has been in and out of the hospital (more or less on death's door) three times in the last five years. I've cashed in my retirement and that is the last money I shall see, I fear. And still, pride keeps me from seeking the help of those I know would, if they could.

So, the question is, how does a Loner survive? I'm just blogging here, and not really looking for an answer. But I felt the need to write.

Wednesday, October 17, 2007

Full eval() functionality in ActionScript 3

Like many before me, I have lamented the crippled functionality of the eval() function in ActionScript. In many languages, eval() accepts a string parameter, and returns the numeric result of the string evaluated as an expression. This has many uses, from simple infix expression parsing, to building and executing code on the fly depending on the values not known when coding/interpretation/compilation occurs.

Because a full version of eval() (analogous to existing JavaScript functionality) would be useful in rich internet applications, I offer the following simple workaround for ActionScript. The key lies in the ExternalInterface class in ActionScript 3, available in Flash (since version 8) and Flex 2 +. The code below has been tested and works in Flex 2.

Note that if your compiled .swf file is running in the Flash player, the ExternalInterface will not be available. But if you are running in a browser, the ExternalInterface class goes out to the container .html file, and can run JavaScript functions that you define explicitly in the containing .html file.

Assume that you have two TextInput fields in your application, called txExpression and txAnswer. txExpression contains the expression you wish to evaluate, and txAnswer will receive the evaluated answer. I further assume you know the details of setting up the interface in Flex or Flash.

The code below goes into the ActionScript/MXML file:


public function evaluate(str:String):void
{
if(ExternalInterface.available)
{
txAnswer.text = String(ExternalInterface.call("parseStr", txExpression.text));
}
else
{
txAnswer.text = "Function Unknown";
}
}

Obviously, the else clause above should do some error handling, but for the sake of brevity and
clarity, we omit that here. the important line is in the if clause. the call method of the ExternalInterface object calls a JavaScript function defined in the container .html file for the .swf, which ActionScript 3 refers to as the "External Interface." Any parameters to the function follow the function name (as a String). Since the parseStr function does not currently exist in the .html file, we must add it.

Open up the container .html file (which will have the same name as your .mxml file and your compiled .swf file), and add the following JavaScript code to it:

<script language="JavaScript">
function parseStr(str)
{
var ans = eval(str);
return(ans);
}
</script>

Here's what's going on. The ActionScript function calls the parseStr function defined in the
containing .html file, passing the text attribute of txExpression to it. parseStr uses eval()
to evaluate the string, and returns the numeric representation of the evaluated string. This
returned value is then converted back into a String, and the txAnswer.text attribute is set
using this value.

I hope this solution helps you; it has certainly helped me. I wouldn't relish the idea of writing a
fully functional infix expression parser in ActionScript.

More to come later...

Thursday, September 6, 2007

Flex and Documentation

Here we go, yet another post about Web Development. Not really a post, so much as a rant. I hate reading rants as much as you hate reading them, so I figure I have no right to expect anyone to read past this point, but... Sometimes a rant is inevitable. And I feel this is one of those times, so I will now engage in ranting. Read on, if you dare (or agree...)

First, I must say that for an RIA platform, Adobe FLEX 2, at least in to my way of working/thinking is the best that I have found. I base this opinion on two major factors: 1. Ease of use. The Flex builder (built on Eclipse) delivers a sweet spot between a truly intuitive GUI builder and a nuts-and-bolts text editing environment. From initial prototype to delivered product, with good debugging tools, one could do worse than to adopt the Flex builder platform for true RIA development. 2. Robustitude. OK, I know that's not a word, but if it were, FLEX 2 would exhibit maximal robustitude in its class library. There are controls in FLEX that rival (and beat the living nasal mucous out of) anything else found anywhere else in the RIA community sites out there. Hands down. When I say this, I speak from the point of view of an experienced web developer. I have coded my own GUI applications using straight AJAX (with XML and JSON), using Flash (ummm, too flashy), HTML with a combination of ASP 3.0, 2.0 and .net, JavaScript, JScript, and (ACK, dare I say it...) JScript. FLEX, with its combination of mxml and actionscript 3.0 has become my development environment of choice to deliver RIA functionality via the web. I feel, in short, that it is the wave of the future.

So, what, you may ask, is my major malfunction with FLEX? Why rant at Adobe if I love FLEX so much? You think I am ranting for no apparent reason. I will now tell you, gentle and patient reader, why I have a gripe with Adobe vis. a vis. FLEX. Read on, if you dare.

My reasons are two in number. The first is purely a temporal gripe. It has to do with the impending release of FLEX 3, which might, maybe, somewhat, offer a development platform that surpasses FLEX 2 in the same way that slicing bread with a bread knife surpasses slicing bread with a razor sharp chef's knife, in other words the job can be done, but the tender bread fibers might become crushed under the chef's knife. Read on to learn more about the first reason.

My company has been considering FLEX 2 for at least 18 months while living under the limitations of a Flash 8 license. Then wind passed our way about the upcoming release of FLEX 3. Would it be better? Would it offer more? Could I resist it even less than I could (and was) resisting FLEX 2 licensing? Research said no, and so I downloaded the trial of the FLEX 3 Beta. Then, I committed project development of a major online client's need into FLEX. (While continuing development in tandem with Flash 8)

One month later, the FLEX 3 beta license expired, and I could not renew. I was forced to purchase a FLEX 2 license (at a cost of $500, well OK, $499 actually), to procure a license key to allow us to continue development in FLEX 3 beta, with, ready.... NO UPGRADE PROTECTION. In other words, I'm expected to fork out another five hundred bucks (or more...) when version 3 comes out. I did the bright thing. I said "Screw this... move the source deck into the FLEX 2 environment and downgrade anything that doesn't work in version 2 to version 2. Don't worry about the enhancements in version 3, we'll stick with version 2 in perpituity."

The second reason for my gripe is the documentation, particularly as regards sourcing data. I would expect that a web application would source data FROM THE WEB. When I look for examples of how to source data, I expect to find examples (in the help file, and via internet searches) of how to consume well - formed XML from a web source such as a PHP file, maybe ASP or ASP.net, something like that. What do I find? How to source data from a static XML object encased within the FLEX code itself. Digging (deeply) in the online help for literally hours reveals the methods needed for such access, but really, should one have to dig that deeply, when the data that one is looking for is not (for the most part) static in an applicaiton, but dynamic? More examples of sourcing data from middleware (and not from within the client side application) would be not only welcome, but necessary.

I conclude by saying that FLEX is an awsome development tool, but that the documentation is lacking in the area of data access (at least from the point of view of a real world developer), and that there should be upgrade protection when a major release is planned, particularly when full price is payed only two or three months prior to the release of a major version upgrade.

Monday, July 30, 2007

Happy Birthday to Me...

Today is my birthday. In years past, this was an excellent reason to go out and celebrate with friends, get together with family, maybe take the day off... but today, despite the fact that I am now freshly 46, is just another day.

And that's not such a bad thing. Making everyone aware that your birthday is coming up is like inviting 100 people to a party you've been looking forward to for months and being lucky to see 10 people actually make time to attend. It can be disappointing.

I also think that making people aware of your birthday is really a cry for affirmation. "Will they remember? If so, they must be sincere friends!" Sincere friends remember things about you, just as you do for them. They do not forget birthdays. My friends, for instance know the following things about me in regard to my preferred mode of birthday congratulation:

1. Do not get me a gift. I have enough junk laying around, and while your gift will be appreciated, truthfully, it will probably be used in direct proportion to its likelyhood of being readable. If you must get me a gift, buy me a book.

2. Do not endeavor to surprise me in any way. Surprise parties, Restaurant jingle singing, Strangers engaged in clothing removal (especially in public places), Singing telegrams, and the like all fall (at least for me) into the realm of practical jokes. I will certainly return the favor.

3. The obvious exception to the above point is that I do like to be taken out to dinner, even when I don't know it's coming. The caveat here is that the surprise dinner provider must be prepared to spend a great deal of money.

4. Do not tell me that I look good for my age, or that I'm only as old as I feel, for these are cliche's, and while they may come from a sincere place, they sound trite to me. I know how a feel, and I look exactly the way I look. I don't take any special measures to make myself look younger, or older.

5. Cards are welcome, because they are inexpensive. But to give a card, the cardgiver had to conceive of the idea to give a card, go to the card shop, peruse the cards for one they feel would be right for me, purchase it, sign it, and give / mail it to me. It means they cared enough to take the time to acknowledge not only the anniversary of my birth, but also to find something that would appeal to my personality. It is subtle. It is private. And it is much appreciated.

Since I own two businesses, birthdays that fall on any day but Sunday have become less and less a cause for celebration. I tend to work 24/6. But I still mark their passage, if not on the actual day. Tonight, I plan on relaxing with my family. Sunday, I'll be out with a few friends; the ones who know why we're out will quietly wish me happy birthday. I'll put my cards in my laptop case, and read them later; if I read them then, we'll shortly be surrounded by the entire wait - staff, and they will burst into SONG!

Thursday, May 17, 2007

About coding

I'm a coder. A long time ago, in a galaxy far, far away, you might have called me a programmer. I still think of myself as such, but it seems that word has fallen out of favor, so... tink of me as a coder.

Coders these days think they come in two varieties... Web coders and Application coders. I'll explain the difference in the two ways of thinking, and also why a coder is a coder, no matter what code is written, and why the two varieties of coder are really the same in my mind.

First, a web coder worth his/her salt will be conversant with not only HTML, but a client-side scripting language (Javascript?!), a server side scripting language (php, ASP, asp.net, perl...), and some flavor of SQL (MySQL, MS SQL, Postgre, Oracle, whatever...). An at least nod and wink aquaintance with CSS is also desirable, as well as a knowledge of what can and cannot be done on various mobile platforms, such as CE, Windows Mobile, and devices capable of running an Opera browser. In simpler terms, a web coder needs to know how to interface with multiple technologies to provide an interface to a database back end, through middleware, to a client front end.

Let's contrast this with the job of an application coder. The application coder's job is to present data, allow the user to edit/add/delete data (likely from a database residing on a server somewhere), and to produce reports showing the current state of said data. In other words, the same sort of data processing done by a competent standalone application coder is also the job of a competent web coder.

My point (and, yes, Virginia, there is always a point...) is that good coding is good coding. It isn't the language or technology that is important, it is the algorhythm that is the really important thing. Good code can be written in C#, asp.net, VB, C, or assembly language. Bad code likewise. Code is about exactly two things: functionality and efficiency.

The shop I run is currently in the late alpha stages of a product that allows any business to upload their current web pages into an interface that will produce a "windowed" application inside a browser. The goal is to allow any business anywhere to bring their current web site up to a common "look and feel" understandable to all users, with opening and closing of windows, dragging of windows, and the usual functions of Maximize and Minimize.

If you are interested in the current state of this technology, leave a comment to this Blog entry, or send an email to Simplicus.

Tuesday, May 15, 2007

On MMPORPGS

OK, I’m guilty. I admit it freely. I have played Everquest. I and II. And enjoyed it. But only up to a point. Where my enjoyment stops is where adolescent proto-angst starts. In other words, I stop playing these games when Skippy the Wonder-Ass starts playing. Nuff Said? No? Then read on, Wonder Ass…

You’re sitting there, ready to join a quest, or a raid, or at least a party all hopped up to beat the living shit out of a boss, and LO, your joined by (YEAH) a group of level 70 Wiz-bang-Yahoo-Uber-Dark Elves Bent on destruction of that which you wish to destroy. All is good. Yes… you say… I will join you, because I am “Snot-Nose” the Level 10 Gnome Tinker, and I have no business being here, So, I will trust you to lead me to victory (an more importantly) experience points, and levels, Bruuuhaaahaaa! (wringing of hands is here optional…)

And so begins the trek toward the lair of the monster/Wizard/Hag with few teeth/Faceless slime in question. On the way, the party is accosted by [insert entity here] having just enough skills/spells/firepower to decimate exactly one of the nymphotycoons you have had the utter blameless misfortune to group with. No problem, right? WRONG!

The party, at this point down one dark elf “of tremendous doom, and tremendous portent,” will immediately disband, because “Erica (or whoever) has to heal, and we all have to go, because we support Erica at all costs!” or something. Meanwhile, there you are, stuck in the vale of stupendous terror (or whatever) holding a level 1 toothpick, and facing 25 a band of slime ogres from the bowels of Dante, before the invention of roughage. In other words, up a certain creek without a means of aquatic locomotion.

I certainly hope Erica was able to repair her hangnail.

Monday, May 7, 2007

How not to name your dog.

So you’ve gone to the pet store and bought a new best friend. Or you’ve adopted a new pet from a shelter. Good for you. Now you need to find a name for your new buddy that both of you can live with. A name that will uniquely identify your pet. A name that, above all, will not scar your dog for life, nor send your friends and family into hysterics every time they hear it. Have no fear, I’m here to help.

If you adopted your new dog from a shelter, realize that they probably have already been named by the useless shits that got rid of them in the first place. So if you can find out what they were named before, make sure that you don’t name them that. Change their name as the first step toward letting them know that you won’t spank them, kick them down the stairs, throw them at the furniture, or feed them other people’s, other dogs’, or indeed their own vomit.
Here are a few tips for naming your dog.

1. Make the name fit the species and size of the animal. Names such as Spartacus, Brutus, Caesar, and Tor Johnson might be suitable for large canines, but not for small dogs. Do not name a creature Muffin, Oprah, or Petunia unless you expect the dog will be wearing a bow. See the section on abuse, above.

2. Avoid literary references such as Nemo, Moriarty, Lady Chatterly (this name might be good for a full size French poodle with a penchant for barking), or Flem Snopes. Historical names are OK, as long as they fit the general disposition, size, and shape of the animal. Examples of unfortunate historical misnaming might include Napoleon for a Golden retriever, Phillip the Fourth for a Black Lab, or Adolph Hitler for anything at all.

3. Names such as Fido, Champ, Scout, and Rover, while all classics of the milieu, have fallen out of favor due to overuse. I once knew a guy who named his dog “Fideaux.” Dogs can’t spell. Dogs don’t understand puns. This guy was naming the dog for the benefit of others, not the dog.

4. Do not name a dog after a friend, spouse, or child. This can cause confusion or even resentment. If you name your dog after a particularly stupid individual, the dog might rise up and revolt against you on the grounds of extreme cruelty.

5. Avoid the temptation of naming a dog after any negative behavior it displays. Names in this category might include Shitlicker, Pooeater, Shinshag, Bark Daemon, or Gasbag the Magnificent. On the other hand, if the dog licks its genetalia incessantly, one might very well choose Happy as an appropriate name. Or Showoff. Or maybe George Bernard Shaw.

6. That being said, lofty sounding names involving puns should be avoided. Chester Alan Barker, Abraham Lickoln, Harry Truman, Genghis Canine, Tom Bones, and Pant Boleyn would fit into this category.

7. Avoid very long names, unless your dog has papers identifying it as a pure breed. If you obtained a pure bred dog from a shelter, you should probably not change the dogs name in the first place, if its breeding means anything to you. Or if it has not been neutered. Shelters tend to neuter animals, so the point may be moot. Keep in mind that your dog will probably be wearing a tag bearing their name on their collar. You want the dog to be able to move. “I named him The Amazing Frisky Barksalot, but since we got his rabies shot, he hasn’t been very frisky at all! I wonder why?” Perhaps it’s the nine pound piece of metal on his collar.

8. If, as is the case with so many shelter dogs, your new friend is missing an ear, do not name him floppy. If he is missing a tail, the name Stump would be a bad idea. And never, ever, name a three legged dog Tripod or Easel.