Friday, December 01, 2017

Using Thor's Hammer to Crush a Tac into Cardboard

All right, not so much of a techie article, more of a choice / philosophy article.  Here goes.

Back in the late 90ies, when this thing called the interwebs was just getting going, there were all sorts of smaller software packages you could buy to do little things.  Ulead GIF animator, 3DFX suite, Bryce 3D, gosh I forget most of them at this point which makes me sad.  I didn't have a lot of money back then (still don't but relatively I'm more able to purchase things).  I loved saving my pennies and buying these little 50 dollar software packages that would allow you to do photo editing and basic 3D stuff.

But the big stuff, like Photoshop, was always out of reach to me.  So I went on this thing called usenet (ancient I know) and there was a group.  I didn't have much money, but I worked at a winery at the time, and I could get wine dirt cheap, so I figured maybe I could reach out to Adobe and make a deal.  And it worked.  Pretty soon I exchanged emails with someone at Adobe and traded a box of various wines for a brand new version of Photoshop 4.

Now I was professional.  I loved that program and played with it a lot.  But over the years I went more of the programming route, and had less and less time to play with Photoshop.  Somewhere around version CC whatever the interface changed quite a bit.  I find sometimes with the new interface doing simple stuff takes me a bit to figure out.  If I still used Photoshop often it would be no big deal, but the truth is I just don't anymore.  And what I do use it for is often really simple, stuff free software could like Paint.Net could do really easily.

So it leaves me with a conundrum.  I've been fiercely loyal to Adobe ever since I traded with that one guy online for a case of wine for Photoshop.  I love Adobe products.  I pay for the full creative cloud (about 55 to 60 bucks a month) which gives me everything.  After Effects, Premier, the works.  And for all you get that price point in my humble opinion is an absolute bargain...if you use the tools a lot.

And there is the rub.  I don't.  I want to.  I keep setting little goals for myself to learn After Effects or Indesign.  If I don't I will give up the subscription.  The goals come and go but yet over 600 bucks a year goes out of my wallet to Adobe.

Two issues.  Expense and learning curve.  GIMP, Paint.Net, Paintshop Pro, etc... are all fairly capable programs for what I would ever use them for.  These low end "consumer grade" or freeware stuff has come a long, long way from where they were ten years ago.  Paintshop Pro is fairly compatible with Photoshop, I think it can even export PSD's and such.  Premier is awesome, but I haven't really used it since like CS1, and when I try to use it now I can figure stuff out, but it takes awhile.

There is a sale going on right now where I can get Corel's Paintshop Pro and whatever the Video Editor is called for like 80 bucks.  I've used Vegas (competing video editor to Premier and another tempting but more expensive option) before and I like it, but that Corel bundle is tempting.  About a month and a half of what I pay for Adobe's stuff.  Hell I could even buy the latest versions every year and still come out way ahead.

 I think I'm going to give up my subscription, and because of my history with Adobe it sucks.  I hesitate a bit because in a sense it is admitting defeat for me.  By giving up on the professional grade Adobe tools I am admitting to myself that I most likely will never become a professional graphic designer.  When I initially got into web development, twenty years ago, the graphic side of things is what I liked.  But I realized quickly that my talent there was limited, and focused more on coding.  That little bit of that young man getting into tech still lives and still really wants to be a "real" graphic designer, but...the reality of things is I just won't get, or make, the time to do it, nor encounter projects both at work and at home that really push me on the graphic design level.  I sadly am coming to grips with this, and thus I'm more willing to give up my Adobe subscription for the "consumer" grade stuff.  It bums me out.

But at the same time, using newer, less clunky software might actually be a key to jump starting my graphic design skills again.  With limited time, using easy to (re)learn stuff to get content out the door quickly when I do have time to play with things just might be the spark I need.  Instead of using a giant hammer to tackle a simple task, which makes the task less fun, maybe using a simple, quick, light tool to do it will get me past those simple task into more complex ones, where I actually do hit a wall and need more advanced tools to get a job done.  And if I can convince my wife to let me keep that 600 dollar yearly budget, but spend it on other things, I can purchase some 3D software I've been eyeing again.

Lastly, Adobe has changed a bit from when I first had a relationship with them.  It seems Adobe, even though their tools are still absolutely the best, is a different company now then when the were in the 90ies.  As a company they have blown a few opportunities as well.  Director could be eating Unity's lunch, but Adobe let the ball fall there.  Not sure Flash was handled like it could have been as well, heck I would have rather have seen Director pushed more than Flash.  And then when Adobe did redo Directory they just outsourced to a team of programmers and did a refresh.  Not sure how much in house talent they keep around in house.  I'm sure some, but they are doing the global outsourcing thing like everyone else.  No longer the slightly bigger Mom and Pop company that I encountered long ago.  Maybe my out for a little disloyalty :)

Well, if I ever am able to get into the swing of things, I can resubscribe I guess.  Just worry I never will as time and tide take me down other paths with software.  But the option is there.

Adobe, I love you.  Your software is still king.  But I must acknowledge that a full on graphic designer I am not, and I can make do with a lot less.  Makes me sad.  It is me not you.

Monday, November 20, 2017

Firefox's Quantum and SQLite Manager

Well, our beloved SQLite Manager, along with a whole host of extensions,  is no longer compatible with Firefox Quantum.  I guess there is an "extended" release for Firefox that supports older extensions, so there is that way to go.  A possible alternative non-extension for SQLite Manager may be found here-

I haven't had a chance to play with it much, but I remember bookmarking/favoriting this program awhile back thinking it looked about as good as SQLite Manager.

Give it a whirl and tell me what you think.

Friday, November 10, 2017


A former boss of mine, a great guy, made a comment about some code I wrote a long time ago and how the follow on developer said it was crap.  Oh I betcha it probably was...some of the stuff I still right today is crap.  I just wrote some crap a minute ago.

Crap code sometimes is a value add.  Craftsmen like to do everything perfectly.  But sometimes when someone needs a hammer you don't need to always build Thor's Hammer for them.  Sometimes if someone brings in something broken fixing it with duct tape works fine.  Not always, but sometimes. I know even thinking this way is heresy in the current world of code blogging.  But writing code is only a single domain.  Problems often are multi domain problems, where time, effort, and other priorities play a roll.  Sometimes you just have to do what you can and move on though I agree that this shouldn't be done just for laziness sake (though I'm guilty of this a time or two).  People following after you may not know the variables at play.  All they see is a crappy hammer and some duct tape.

A prime example of this.  I'm working on a big project, but I get pulled off to do a minor upgrade on an older project.  I look at it.  To do this upgrade the proper way would have required re-writing code that affected a whole lot more than just the minor update I needed to accomplish.  Plus, I'm having a feeling that this project within a few years will be rewritten from the bottom up.  So, I decide to just "hack" it for now so I can get back to other priorities, so I don't have to rework something that goes deep into the code base that could have unintended consequences, and I won't have to spend time to do more testing than either the project manager who pulled me off another bigger priority or myself originally thought.  The "hack" took about a half an hour and 15 minutes of testing.  Done.  Moving on.  In a few years I might come back and look at what I did and say "what the frack?"  But EVEN if I did do the deep fix, I guarantee  when I rewrite the application (or whoever else does) this code section will be completely rewritten from the bottom up as requirements over time have changed and will change.  So it would have been pure vanity as a craftsman to "do it right" this time around.  I left a few notes and called it good.

And I've inherited lot's of code over the years that I would have written differently if I wrote it.  I would have written it "better" or at least more understandable.  But I don't remember ever calling code that worked crap.  But then that is how I judge things...does it work?  Do the users like it?  Is it responsive?  Are there at least a few things I'm wowed a little by?  If yes then I call what I wrote or anyone else wrote a success.

In the instance I was critiqued on,  I know my code worked, just some anal type didn't like how I wrote it.  I also know that an auditor for the fortune 500 company I wrote it for called it one of the most intuitive tools he ever used.  And he didn't say this to flatter me as I was already gone from the company, he said this after.  So suck it anal type!

Now the kicker.  As a developer I'd say I'm mediocre. I've met many developers who can program rings around me.  I've also met many who cannot (some may know this, many may not, but proof is in the pudding).   I'm not the best craftsman nor, to be totally honest, do I want to be.  The problems I'm solving are often more interesting to me then the tools being used to solve them I guess.  But I get the job done.  The average burn out rate for a developer is five years...I know many great developers who have lasted longer than that, but that is the average.

So I wonder, I'm still here.  I've been writing code, some good, some bad, most mediocre, a small percentage brilliant, for almost 20 years now.  Many craftsmen would hate me.  I betcha I'm sill here after they have burned themselves out and are gone...

I guess that comment just stung more than it should have.  And I also have to keep in mind that much of my success has been due to grace...unmerited favor by the creator Jesus.  I've gotten opportunities that I didn't merit and advanced in my career beyond what others more talented then myself have been able to.  I don't want to get a big head.

But to distractors,  although it might aggravate you, I'm still here...while most of you are gone gone gone!

Tuesday, May 16, 2017

Microsoft is Losing Me

Firstly, Microsoft has been good to me.  My semi-mastery of Microsoft tools for web development has spawned nearly a 20 year career.  So I am by far not a Microsoft hater.  Yet some recent things that Microsoft is doing has me scratching my head.

  • ASP.Net Core - The idea of having one framework that will run nearly anywhere is a noble one.  But is this really a problem that your average enterprise development team was asking to be solved?  Most (I'm guessing) that use Microsoft Visual Studio for development are solidly in the Microsoft ecosystem.  The idea of running MVC on non-Microsoft servers appeals to percent of the Microsoft ecosystem users?  Plus if I can use free tools to develop open source MVC say, why would I be paying 1000's per year per developer seat for Visual Studio? So I can tweak JSON config files and run things from the command line out of penis envy for Linux users?  Dude I like GUI's.  Seems I'm one of the few.  Maybe that makes me a weak programmer but I grow tired of coda obscura for config files and other command line crap.  Give me a limited set of options in a GUI window that is well documented so I can pick what I need and move on to solving problems not pulling my hair out with being gifted with additional ones from Microsoft.
  • Along similar lines, what is up with XAML?  I knew Silverlight would fail just like few are picking up XAML.  Again, why the GUI hatred all of a sudden?  Weird.
  • Constantly changing things.  We have been jumping through hoops from Microsoft for years.  First ASP.  Then ASP.Net Webforms.  Then MVC.  Now MVC core with helper tags quasi bringing back webform like functionality  (but without the GUI support...sigh).  As we jump through the hoops we leave a scattering of legacy applications behind us.  The bleeding edge buzz word flinging developers build and move on leaving their head aches to others while they pursue fame and glory.  Us rank and file dudes have all these apps to support.  It is starting to get old.  If you wrote a PHP app 20 years ago it would (with minimal tweaking) work fine now.  LAMP stack is still widely used.  Can we say that for Classic ASP aps? Not really, though some decent sites are still powered by it.  What about .net 1 apps?  1.1, 2.0?  MVC 1?  .ASMX web services? Now core?  What happens when Microsoft jukes in a new direction?  Should we constantly be upgrading our apps to feed the beast?
I really like MVC and Sqlite.  For me it is a sweet spot for development.  But I think I'm going to become a real programmer and start branching out to Ubuntu running Node.js.  I bet I can build and app and not touch it for 10 years and it will run fine on the latest version of Node and Ubuntu just fine (though would be ugly as HTML / JS / CSS evolves, but it would still work!).  

Microsoft, you are losing me.

Tuesday, March 28, 2017


For those of us still stuck supporting and enhancing web forms apps, sometimes it is useful to use an xmldatasource to as fake data until the underlying structure can be worked out.  Pasting a sample of an xmldatasource here to remind me of it's format in the future.  This is what you need for combo boxes

<asp:XmlDataSource ID="MyDataSet" runat="server" XPath="/items/item">
        <item desc="field_one" val="some value" />
        <item desc="field_two" val="escape invalid chars" />
        <item desc="field_three" val="vals can by any type just put them line like a string" />
        <item desc="field_four" val="And so on, and so on, and so on" />

To databind xmlsources to grids, you want the data to be laid out more like this

<asp:XmlDataSource ID="MyDataSet" runat="server" XPath="/items/item">
        <item field_one="some value" field_two="escape invalid chars" field_three="vals can by any type just put them lin like a string" field_four="And so on, and so on, and so on" />
        <item field_one="some other value" field_two="escape invalid chars" field_three="vals can by any type just put them lin like a string" field_four="And so on, and so on, and so on" />

Monday, February 27, 2017

Using the tinyMCE CDN

As you know there are all sorts of text editors out there.  For my purposes tinyMCE works fine.  It has a CDN so with the inclusion of a little javascript, you have a capable wysiwyg text editor without having to install any bits into your code (as long as the CDN is up...).  Here is how I use it.

<script src="//"></script>
                browser_spellcheck: true,
                contextmenu: false,
                selector: 'textarea',
                height: 500,
                theme: 'modern',
                plugins: [
                  'advlist autolink lists link image charmap print preview hr anchor pagebreak',
                  'searchreplace wordcount visualblocks visualchars code fullscreen',
                  'insertdatetime media nonbreaking save table directionality',
                  'emoticons template paste textcolor colorpicker textpattern imagetools'
                toolbar1: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
                toolbar2: 'print preview media | forecolor backcolor emoticons',
                image_advtab: true,

This works pretty well as a blog editor.  I have to hand put in some HTML for embedded images and videos, but so far that hasn't been a big issue.  I get the raw HTML from the tinyMCE editor for saving like so-

var ct = tinyMCE.activeEditor.getContent({ format: 'raw' });

Quick and easy.  Happy coding.

Friday, January 20, 2017

An Old Programmers Tale of Caution and Encouragement.

This was originally posted [HERE].  The post is so old I worry it will vanish, and I think it is an important read, not just for gaming, but for any project.  So I re-post it here.  God bless rogerborg.

Why I can't write games anymore - a novella
Postby rogerborg » Wed Jan 16, 2008 1:07 pm

Pull up a chair and I'll tell ye a tale. A tale of back in the olden days, when men were real men, women were real women, and small fluffy compilers from Alpha Delorie were real small fluffy compilers from Alpha Delorie.

Back in the Day - about 1994 or so - I found myself with some free time on my hands. So I 'downloadorzed' (hey, it was a novel concept back then) Allegro and djgpp for my supa-phat new 486DX2-66 DOS/Win3.1 PC and decided that I'd write me a game.

Because I'm a sad Trekkie (please, nobody ever tell my daughter why she's named Miranda) I figured that I'd write a computronic version of Star Fleet Battles, easily the most complex board game ever devised by Man or Nerd God. I mean, that thing ships with Errata, Addenda, and Errata in the Addenda.

Bear in mind that at this point, I really had no idea what I was doing. Sure, I had a degree in Computer Science, but being from the Old Skoolz it hadn't taught anything as tawdry as how to actually, you know... write software. I'd hacked the bejeesus out of Netrek, but only to the extent of pwoning it with a 'borg client.

So I went in with an abundance of overconfidence, and no real knowledge of what I was doing, or how to achieve it.

And in about 8 weeks of finger-bleeding coding, I had a playable 2D game written in pure structastic C and debugged with printfs(), much as the Pilgrims must have done. It had no config to speak of: you created ship descriptions in human readable text files, using a 'unit X is based on unit Y' hierarchy, and likewise with scenarios. When you started it up, it presented a simple list of available scenarios. You selected one, and away it went.

But you know what? That primitive pile of junk implemented a significant subset of Star Fleet Battles. Cloaks, shields, damage control, phasers, photons, disruptors, plasma torps, drones, anti-drones, hellbores, fusion beams, expanding sphere generators, tractors, transporters, boarding parties, shuttles/fighters, tugs, pods, star bases, planets and ground bases, all 'modelled' in Windows 3.1 Paint then rendered in glorious spinny 2d-o-rama, replete with asplosions and Star Trek sound effects ripped from the bleeding belly of the burgeoning intartubes. It had AI that provided a moderate if predictable challenge, it had fleets and fleet commands, and it implemented all of my original requirements and a few more besides.

That was in 1994, when I knew nothing and had tools little better than sticks and rocks. In 2008, when I know vastly more about how to design, write and test software, and have tools that would make the 1994 me mess my pants... I honestly believe that I couldn't write that game again.

Want to know why not?

I know too much, and have too much.

I'd second guess myself on design, and design patterns. I'd agonise for weeks over the exact hierarchy of objects, interfaces and responsibility for implementing features, and then I'd change my mind and start over. I'd spend an age carefully abstracting away the presentation from the data so that I could change engines, then I'd spend another age using that flexibility to dither over whether to use engine X for its bells, or engine Y for its whistles. I'd agonise over whether a networked version should be architected as a multiplayer game with AIs, or a single player game with a coop/competitive mode. I'd type a line of code, then Google for an hour to convince myself that it was optimal.

I'd make posts like this rather than actually knuckling down and just writing code that implements the clear goals that I've set myself, because it's more rewarding to talk about it than to worry that I've picked the wrong way of doing it.

In 1994, I was Aquaman. Sure, all I could do was talk to fish, but dammit, when there was a problem to be solved that smelled even remotely piscine, I talked their little fishy fins off. Now I'm El Dorado. I have loads of powers, and can make up new ones as I go, but that just makes it harder to choose one and go with it. A marauding octopus! Should I read its mind? Shoot it with my eye lasers? Create an illusion of a sexy lady octopus? Should I grab it and teleport it to a sashimi restaurant? What to do... what do... oh, never mind, it's eaten Kairo.

So, as we grind and bump towards the conclusion of this senile shaggy dog story, do I have a point to make? A nugget of wisdom to impart?

I do.

First, don't listen to the 2008 Rogerborg. Now I only know what can't be done. I've forgotten what can be achieved though ignorance and determination.

Second, listen to the 2008 Rogerborg when he says to do as he says, and not as he does. If you have a game that you want to write, then write it. Just knuckle down and write it. Don't worry about how optimal your data encapsulation is, just bung everything into a structure and call functions on it. Write naive code, and don't give a stuff about optimisation or resource management. Get stuff on screen, and make it spin.

When you are happy, then you're done.

And here endeth the lesson.

Thursday, January 12, 2017

Three SQLite Gotchas

If you are using SQLite coming from say a Microsoft SQL Server background, here are a few differences that might throw you.
  1. There is no TOP as in "select top 50 from....".  
    Instead you use LIMIT, and you put it at the end of your query like "Select blah from blah order by blah limit 50".
  2. Paging because of the above is actually made easy.  You can use OFFSET with LIMIT for easy paging like so. "Select blah from blah order by and wheres blah limit 20 offset 50..." if you pass in a paging variable like say @page you can times your offset to get you what page you want, like "offset * @page".   There is even a shorthand for it, but with a gotcha...the offset and limit are swapped.  Like "select .... order by blah limit 40,10" actually means offset 40 limit 10, which is counter intuitive but there for backwards compatibility.
  3. CASE.  Case is kind of a bummer for comparisons in SQLite.  you can set in on your indexes or on your connection strings to ignore case on your where @mystring = 'blah' type queries like so

    - programa collate nocase in your connections string
    - collate nocase on the end of your queries
    - or add collate nocase on your index when creating a column

    But alas, not that simple.  this only works for UTF-8, if you are using UTF-16 you have to use more exotic solutions with collate binary (I'll leave a link).

    Out of the box you can fake insensitivity using the like operator,  select blah where x like @xxx +'%'... though note here you are better off adding that % operator on your sql param then having it in your query string, for some reason the later doesn't work for me but maybe I'm missing something.

    Also instr, the equivalent to charindex in SQL, insn't case insensitive.  Bummer.

Some useful links-