Saturday, September 30, 2017

Users Need to be Free!

Sorry, but this is another tirade against mobile OS's. I am very much a Yankee in the traditional sense of the word. Back in the 1800's the British sent the world's moat powerful Man-O-War to the U.S.'s east coast, to intimidate us. We sunk it.
I am  firm believer in Hump An Git It individualism. I can't abide tyrants and oppressors.
Data must be free... OS's are data, just like  applications. They must be free. Mobile OS's go against every philosophy I hold dear.
I have an old HP 10 G2. Why in the world am I not allowed to be an admin on MY OWN DEVICE?! It's not like it's tied to a mobile contract. I should be able to do what I want. As it is I'm stuck with Lollipop and all of HP's bloatware. Ugh.
Apparently I need to begin the journey. It's time to 'know thy enemy'. I need to get to know Android inside and out. I will need to be able to not only root it,  but to fully understand the process and go even deeper. I want to COMPLETELY take control of my tablet.
I would also like to root my SmartWatch 3... if Sony is going to not allow me to run Android 2.0 -- I'm gonna hump an git it. It's my watch, it's not tied to a contract. I'm going to keep it up to date.
Free the Users!

Reflection... Well Not Reflection but Reflection

I was just thinking back to when I was building IF games in TADS. I had a couple cool ideas and enjoyed pushing the bounds and the rules of the TADS engine. But I really wasn't learning anything useful. I still love TADS, what an amazing piece of software. I would be delusional if I thought I could ever rival it.
 
I was thinking about how it was suggested to me that I build my own IF engine. The idea seemed ludicrous. What a waste of time. Why would I want to reinvent the wheel? True, having an IF engine and client that are Java based would be cool. And I could later port the client to mobile OS's etc. Hmm .... And I could later attempt the impossible, a networked multiplayer IF game!

But wait... There's no market for IF, so it will just be another hobby project. How is that any different than sitting around building TADS games?

Well fast forward a LOT of days. I now have a pretty robust client IF application, and an admin tool for interpreting and compiling games. I have written my own data notation language and written an interpreter for that, as well as a parser to turn that data into a game. So my engine can use either XML or Norman to define games - and their help systems.

I've learned a ton about Java, and its weird nuances (Silently crashing etc). And have become a much stronger developer. So even if this does end up being a hobby project forever, I'm at least doing far more than just sitting around building IF games.

Thursday, September 28, 2017

Mysterious Deaths

I have now rewritten my Norman interpreter three times. It is now, so far, this iteration is working great. The previous attempt was riddled with strange silent crashes.
Java would run, reading through the game definition files, performing trimming and substrings and other String parsing methods. Then unexpectedly Java would just crash. No error message, nothing. I spent hours adding output messages all throughout the code, but was never able to pinpoint the source of Java's sudden death.
After giving myself numerous concussions on my desk I decided to scrap the interpreter and rebuild it. This time around I filled every block of logic with try/catches and more comprehensive output messages. And I improved how it processed the files.
So far so good. we'll see how it does as I convert more of my game definitions to Norman Notation.
I would really like to know what methods are prone to causing Java to quietly and horribly die. If this ever comes up again I suppose I'll be spending days and days trying to solve the mysterious mystery.

Wednesday, September 27, 2017

The # is for Channel

I miss IRC. I remember back to when I was working at a company that was me, a buddy of mine, and the boss. We rented an office in the lower level of a small building. No windows, no ambient music. Just working away in silence. To keep away and stay sane I kept an IRC window open. Soon there was a small tight knit group of chatters in our # - and later we became friends in meatspace as well.
I remember poking fun at the noobs in #teen and other high drama channels. We developed our own dictionary of slang, entertaining chat bots... essentially we had a culture all our own.
But as time passed, meatspace crept in. We all got busier or work changed so IRC access changed. Then social media phone apps drove in the final nail. And now our virtual coffeeshop is just a memory.
The funny thing is, people are still into chat, only now it's on Facebook etc. And it seems like #teen has taken over everything. It's like the vast majority of people online now a days are n00b current affairs trolls. I have yet to find a SINGLE social feed where I can just mindlessly hang out and interact with others. I have a twitter feed of JUST music and development, and I swear every other post that comes through is political or some other kind of drama.
I miss IRC. Where you can just chat and hang out. Where you chat more like you would at a party or in real life. Where no one ever just randomly blurts out:
"I believe in <INSERT CAUSE> and if you have a problem with that just unfriend me now"
If you do that at a BBQ, you're an arse. But apparently it's totally Ok online.
RIP : Chat.

Monday, September 25, 2017

In Defense of Square

I have a shelf full of futuristic or retro-futuristic watches. A couple 01theOne AniDigi watches. One with a black X and one with a blue/green X.  A crazy 01theOne binary watch. Nixon Comp, Rip Curl, etc.
One thing in common with all of these watches: They are all square.
So when I decided to add a smartwatch to my scifi collection I wanted a square one. As you can imagine my options were limited. I ended up getting the steel SmartWatch3 for a great price. And I love it. It looks futuristic and square is perfect for code/console watchfaces.
As a watch guy, I personally don't understand round smartwatches. Why buy a watch that pretends to be a 'real' watch? But to each his own. It IS interesting to read reviews of watches like mine. The comments are filled with the likes of:
"Not round, so don't care."
There are TONS of round smartwatches, why get down on one of the very few square ones? At least companies are bold enough to try them.
I say get a smart watch that is conducive to an actual screen. I say get a smartwatch that knows what it is and isn't trying to be what it isn't.
I say be square.

It's Time to Get Out the Big Guns

If you hate trackball mice, you're gonna want to skip this post. It will be very painful for you.

I have been using trackball mice pretty much as long as I have been using computers. I started with the Logitech Track Man. That was my go to. I had one for every computer and laptop I owned. And it's a work horse. I have NEVER had one die.

But after so many years of using it I just felt like a change. Maybe something with a scroll wheel / mechanism. So reluctantly I tried other trackballs. I went with an Elecom. I liked its all black coloring. It's a great little mouse and so far is serving me well.

But I wanted to try the big balls. After all I'm on the computer all day every day, maybe I should get a power user trackball. So I saved money and bought the Ferrari of trackballs, the Kensington Slimblade. It truly is a beautiful mouse. And I can't believe how smooth it rolls. The ball truly glides. The scrolling mechanism works but is not ideal when scrolling through very long files. It is definitely my current favorite.

I didn't want to have to carry the Slimblade around back and forth between work laptop and home machines, so I decided to get another big ball mouse. I almost bought a second Slimblade but decided to go with Clearly Superior's L-Trac (The all-black, not the glowing ball). I must admit I was very unhappy with this mouse at first. It was as expensive as the Slimblade but compared with the Slimblade it felt like a $30 mouse, not the approaching $100+ price range. The ball movement was rough. Zero glide. You cannot remove the ball without completely disassembling the mouse (This DOES make it great for packing around, although it is a huge beast), and it just doesn't look as cool in person.
But I use it with my work machine and in time the ball movement has loosened a little, to where it isn't distracting. And I have to say, the scrolling! There it DOES glide. Scrolling through huge files is cake. So I've come to enjoy this trackball also. It's still no Slimblade, but a solid #2.

Sunday, September 24, 2017

Impressive Line Count, Dawg

While huge source code line counts make for great fish tales they are no good. At least in the context of this post. So I've created NormanNotation (nrmn), an interpreter for it, and a parser that uses the parsed objects to populate WorldWeaver (My IntFiction game engine) game databases. The problem is my interpreter is kind of basic so far and requires property elements to be on their own line. That means defining an attribute goes from XML's single line to four lines in nrmn!
This makes game definition files very difficult to read. Half of an element's definition is off the screen so all you see are a bunch of closing brackets. Even if your editor does code collapsing it's tough to keep track of where you are in the nested element nodes. So I've updated the interpreter to allow inline properties so instead of:
{object
  alias=sword1
  type=long sword
}
You can do:
{object alias=sword1 type=long\ sword
}
Closing brackets still must be on their own at this point, I'll probably correct that tonight. For most elements it isn't a problem but things like attributes would look weird. So it will go from:
{attribute alias=strength value=15
}
To:
{attribute alias=strength value=15}
Then I'll go through my definitions and make them much more readable.

Saturday, September 23, 2017

SAMBA, You Sir Are a Scoundrel and a Cad

Ah so much fun.
So I have my desktop running Linux Mint. It has Two 2TB external USB drives on it. I use the internal HDD (1TB) as the master store. My phone backs up to it using SyncMe and my laptop backs up to it using cron. Then it backs up to the externals using cron. And once a week a full mirror is done to clean up any deletes etc. I do this once a week so I have time to save anything that might go away if needed.
Everything was like clockwork UNTIL I decided I should tighten my permissions a little. Maybe I should only allow read and right no nasty executing. Well that put an end to my backup/sync strategy. Everything is dead in the water. I can't connect to my main documents directory on any of my machines, even though I'm using the owner creds. Even when I said Oops and set my permissions back...  x_x
I've tried recreating the share, adding my named user, opening permissions up, recreating the share with a DIFFERENT name.
Nothing.
So much fun.

Friday, September 22, 2017

Why Chrome Sucks and Firefox Reigns

No this isn't an article full of stats or comparison charts. I don't care about how this browser renders x standard or that browser renders y standard. Honestly I'm over blingy, gimmicky web interfaces. I'd browse the internet in Lynx if more sites worked in it.
No this has nothing to do with rendering or cool themes or popularity. The reason Firefox reigns?
Vimperator allows me to hide the UI completely. I'm talking:
- No tabs
- No address bar
- No menu
- No status bar
- No nothing!
100% content and full on VIM key commands. If you love VIM, you know what I'm talkin bout.
Yeah there's VIM-like add ons for Chrome, but Chrome is so uptight, the add ons can't hide the UI elements etc and only a small fraction of VIM commands are supported.

It's a Thing

Norman Notation is now a thing. I've defined the data serialization language and written a Java parser for it. I converted my XML game definition parser to Norman Notation and the resulting data looks good so far. Now I need to convert all of my game definitions over to it.
I've done a few so far and they're really easy to write. They do use more lines of code though, which makes them more difficult to read at a glance - we'll see if that's a problem. If so I may need to tweak the Notation definition and parser to allow same-line definitions.

Thursday, September 21, 2017

A First for Everything

Tonight I created the Norman Notation. I've never tried creating a notation language - or any language for that matter. So far I have come up with a set of rules for the language as well as an interpreter.
The interpreter parses through a file and returns a list of elements each with their own properties and elements. I haven't yet begun converting my XML parser to use nrmn notation. But my test output looks promising. So far game definitions in the new format are much more succinct than XML, however they result in more lines of code - mainly because closing brackets (} or ]) must be on their own lines - but it is much less tedious than writing XML nodes.

Wednesday, September 20, 2017

What is Norman Notation?

It seems that YAML is not very conducive to defining IntFiction (IF) games for my IF game engine. I still want to move to something less tedious than XML, so after battling with various options I've decided to create my own notation language. Since I'm the one making it, I'm calling it Norman Notation (*.nrmn).
My needs for NRMN are very simple since I'm replacing a basic XML structure. My rules are:
- Minimal markup. I want it to be very easy to write so that game authoring is fun.
- Not indent dependant. Authors should be able to format their source however they want.
- Easy to nest elements. I need it to be easy to define child/parent relationships just like XML.
The only types I need right now are:
- Elements. These are 'objects' that can hold any combination of types.
- Properties. These are key/values and can be defined within an element.
- Content. These contain text, and can be multi-line. They can be defined within an element.
Special characters:
There are only three characters to watch out for:
- Curly brackets {...}
- Square brackets [...]
- Equals = (But only if in properties)
These can be escaped with a backslash \.
Example:
{game
    name=Dragon Deep
    level=0
    {player
        name=Conan
        class=Barbarian
        {weapon
            type=Long Sword
            [description
The long sword is a two handed weapon.
Its blade is dual-edged.
            ]
        }
    }
}
I'm working on building a parser for it now. We'll see how it evolves as I begin to use it.

Ugh YAML

So apparently I'm still a Java n00b. I spent all night trying to add SnakeYaml to my intfiction engine. Then realized Oh! I have to add the .jar to my manifest. Hopefully no one was watching that embarrassing episode.
I got it to work and created a test file. It is so much easier defining games in YAML! Then it was time to parse it. Well dealing with YAML is a whole different world from XML. What a nightmare. I get a YAML Object back but so far cannot for the life of me parse it. So I thought maybe I could convert that Object to an XML doc, then I could reuse my XML parser. No luck. After a couple of hours of this I decided to shelf the conversion, I'll deal with YAML later.
Sad.

Tuesday, September 19, 2017

Hmm. Maybe I Should Break It.

Progress is going well on the Java Interactive Fiction (IF) game engine. I'm running into shortcomings and bugs here and there, but it's defining and running full on IF games. I have to fix a recursion error (Where I didn't drill down into objects containing objects), but that hopefully will take just a few minutes. All is well.
Soooo... Maybe I Should Break It.
Mind you, I don't want to, but I know I have to. I put thought into my choice of XML as the method to define the games. And I still think the reasoning is sound. I think it's easy to see which elements belong to others. It's quick and easy to define rooms, nest objects in them, define attributes etc. And I think it's far more readable than JSON. We are defining nested things not lists of data.
But I am getting so tired of typing tags. Although it's easy and fast to define game elements it requires a tedious amount of typing.
So I'm thinking about giving YAML a try. I'll define a room and its objects and see how readable it is. If I like the way it looks I'll create a YamlParser.java - maybe it'll sit side by side so the author has the choice between XML and YAML (Since the XML Parser is already built). I'm not sure how good Java is at parsing YAML, I've never tried it before, but if all goes well I think it will make game building much more pleasant.

Monday, September 18, 2017

Interpret This

Apparently I love writing interpreters. I guess it's kind of par for the course when you're creating console Java applications.
 
The user inputs commands and you parse them and route to the correct class and method and finally give some output back.
 
I usually build an Input class that will give me the command and whatever parameters or other text the user put in, so I have handy String[]s as well as various Strings and a Match boolean so I can flag it true if I find the command the user is trying to fire.
 
I use the Input object with Parse methods that always have a return of List<String> and whatever ends up in there gets outputted.
 
If I want to extend the capabilities of my project, I create a new class, give it a Parse method, and in my Parser class, add a call to that method and grab the returning List<String> ... and of course unless it's a special case, if I get a list of .size() > 0 then I flag my Input as Match(true). Anytime Match is true, I don't call any more parser methods. - Again there may be exceptions.
 
I'm sure there are better ways of doing this but so far the structure above seems to work really well for me.
Have fun interpreterizing!

Sunday, September 17, 2017

Back to Back to Basics

I'm pretty sure this is not normal. Every time I start a new book on programming or programming languages, unless it's an advanced book, it starts with the very basics. Everything is data. What are variables. What are operands. Etc.

I never skip past this portion of the books. I'm familiar with the basics, I use them every single day. Never the less, I love to read about them. For some reason I find this review to be the most exciting part of the books. I love how computers work. I love seeing examples of binary applications. I love how flipping bits on and off can result in amazing feats of computation. I am a mathematics outsider marveling at the magic of mathematics.

Every time I read a different author's take on the basics I learn new things, or at least learn to see and think about them slightly differently than I did.
I guess in this sense it is poetry.

Saturday, September 16, 2017

A Nix Terminal On My Phone, What?!

If I haven't already said it, I find mobile OS's obnoxious. Especially in light of the fact that tablets run on mobile OS's. They are operating systems that keep you from doing anything substantive on them. Sure you can run the allowed apps and games, but what if you want to rebuild them with another OS? Nope. What if you want to tinker with it and mess with system files or other admin activities? Nope.
You can only have freedom on your own device if you root it, which unless you really know what you're doing is dangerous, and it voids your warranty etc. So doing any real development etc on your tablet is out of the question unless you root it. I haven't had the time to learn to do this so I'm stuck with unrooted devices. So I looked around for options for running a linux terminal on an unrooted device. And I found GnuRoot. It is amazing. It runs on unrooted Android devices AND it has apt-get capabilities! So I can run calcurses, VIM (True VIM), and other Linux console apps. I can grep and do other things.
If you're an unrooted nerd and haven't tried it yet, you must.

Friday, September 15, 2017

Electric Sheep Dreaming of Robots

I love Synthwave. Everytime I listen to it, I see Unix. I see the old computer an elementary school friend's father owned. That reminds me of sleeping on the deck out under the stars. I see Tron and Centipede. I feel like I'm in yesterday's tomorrow and it looks amazing. I'm wearing a super tech looking old LED watch, and other cool gear. I am transported into the great neon pictures associated with the music, they are fitting.
I'm back in the world so accurately portrayed in Stranger Things. The world those kids live in is the very one I did. Bikes and digital watches. Robots, adventures, mysteries. Actual childhood, innocence.
Ahhh Unix music.
And wow the Blade Runner trailer music!! I must get it. It captures the same Unix / retro feel but with enough 'new' to make it intriguing.

Let Noobs Eat Cake, Wait I Want Some!

So in reading about Javascript and its relaxed nature has me pondering which is better? Novice-friendliness or strictness. I personally would lean toward the strict end of the spectrum. Although I can get behind a little leniency, just to make life livable. It seems to me that strictness would make debugging much easier and the resulting code much more consistent and readable.
I also kind of like the idea of not doing everything for you. Yes that means more code to write, but it also means you have more control. My current IF game engine is a good example. Whereas TADS or Inform will handle pre-defined commands and output etc, If your needs don't fit neatly into that structure you are in for nightmares. I've taken a more c++ like approach where the game author must define nearly all the commands and output. It's easy to do, but requires more definitions. However, games can use whatever input/output the author wants.
Authors could make their games behave however they want, but at the same time it is strict. If you want user input you must have correctly defined command nodes. To change attributes or move objects or the player etc, you must have a properly defined actionset, and that must contain action nodes, properly defined. Yet it's loose enough to allow an author the flexibility to use the engine how they want. They could even use it as a console based help system if they like.
I remember trying to build an Alice in Wonderland game in TADS, it was a pain just to get the player to be able to drink from the Drink Me bottle. In my engine, you would just define a command with the syntax "drink*" and put an actionset in it.
So I can understand looseness, but couched in a properly strict core structure. You can't define an action node and expect it to behave like a logic node. It seems to me that is akin to some of the flexibility in js. But then again I'm kind of noobish in js.

Thursday, September 14, 2017

Passing Stuff Around

For a LONG time now I have been working on a Java-based console IF game engine and corresponding client app. This project came about when a friend kept bugging me to ditch TADS and write my own engine, so I can get the games out onto the web or mobile devices, as well as the idea of making it multi-player.
I brushed him off for a while, but as time went on I became frustrated with the limited platforms TADS can be ported to. And I found that although amazingly powerful, the TADS language was not terribly enjoyable to build games in. I DO appreciate its 'programming-like' syntax but I didn't find it fun.
So in spite of the amazing robustness of existing IF engines I decided to tackle my own.
It's been an amazing learning experience. I haven't learned terribly complex Java wizardry but I've become painfully aware of development paradigms. Being self-taught I've always just coded away, never really thinking about paradigms and the philosophies behind them, their pros and cons etc.
After a few failed starts at the IF engine I started to think about structure and how I wanted to accomplish things. I tried to go full OOP and quickly learned first hand why its detractors or mind skeptics criticize it. I did want to have objects since that is how the games are defined (I'm using XML as the definition language, since it's easy to nest elements and attributes), but I abandoned making them self contained. So I pass around the game object and other objects I need.
So far it has worked well. I have it built enough to move around the game world, fight enemies, take and use objects, check various conditions etc.
The engine is structured well enough to make extending it fairly painless and easy to debug. However every now and then a fix or addition involves gaining access to pieces an object currently doesn't have. That's where the nightmares begin.
I have to break a bunch of method calls and put them back together. But for the most part I'm happy with it.
In time I hope to make it better. Minimize or do away with all the hot-potato-ing. As I get better solutions to these problems may manifest. When they do I'll share them here.

Eloquent Book, Sir

Over the years my areas of interest in the world of coding has shifted dramatically. Web development is what originally hooked me. I could build a public stage for whatever art or writings I came up with. From there I became fascinated with application development, building little text editors and goofy utilities etc.

I wanted to learn C++ so I could make 'super' applications but all the tutorials were console apps - eww - I wanted to make super cool GUIDs etc.  Basically I wanted to compete in the Olympics before I had learned to crawl.
Fast forward nearly 20 years...

Now I'm far more interested in the back end. How things work on a lower and lower level. Web development and graphical UIs do not interest me. Ironically everything I do in my free time is UI-less, running in the console.

I am not terribly interested in C++ I prefer the portability of Java, plus it's real easy to run my Java console apps in gnu-root on my phone.

But career-wise I'm shifting into web services, APIs etc. So I have to dust off good old Javascript. During a web search for whatever js question I had, I bumped into Eloquent Javascript. So I got the book and started reading it. I've only read a few pages but already I can say I love this book!

It is as entertaining and inspiring as Life With Linux is! In just a page or two it brings the developer dragon within you to life. We'll see if this continues throughout the book but so far I really like Marijn Haverbeke's writing style. Any book that gives a binary application as its very first example is top shelf in my opinion.

You can read the book here:

Saturday, September 9, 2017

Swiss Army VIM

Before I say anything, I am NOT a VIM power user. But I do use it every day, and I use it for all sorts of tasks. In this article I'll share some of these.

Duplicates
In the course of my workday I sometimes have to clean out dups, or perhaps just identify them. Removing dups is easy:

:sort u
For identifying them I clone my file, and open it in a vertical split (:vsplit), so I have both my original and the cloned side by side. Then I sort both (:sort). In the cloned file I remove dups:

:sort u
Then in each panel I do a diff:

:vimdiff

That will highlight where the dups were removed.

Tediousness
This is something that comes up all the time, and takes numerous forms from formatting code to creating multiple rows of data or code etc. For any repeatable task in VIM I break out the macros. I love macros. And in VIM macros are super powered since it is keyboard driven so nearly everything can be recorded in the macro. I utilize the clipboard or in really intense cases, even multiple files. I can select a line, cut it, switch to a blank document, mess with it there, then copy it back into the first document. I will discuss macros in VIM in greater detail in a future article.

Grepping
I don't like Windows, but am often stuck with it (work). To satisfy my love of nix a little, I often utilize:

:vimgrep

And always have the vimcommander plug in installed for use as a commander style file manager (But with VIM key mappings!)

I don't utilize any other plugins in VIM, I'll have to dig into them and further push the limits of what VIM can do. In future articles I'll share some of the powerful commands I've come across.

Friday, September 8, 2017

VIMless Plug

I am an unabashed VIM fan. I am certainly no guru, but it's the only editor I use - when I have a choice.

In honor of my favorite editor I created the VIM cheatsheet t-shirt. Enjoy:

Do You Even Android, Bro?

Android. I am going to be brutally honest here. I can't stand mobile OS's. The idea that an OS has been specifically designed to keep me from utilizing a device that I paid a lot of money for - and continue to pay service fees to use is disgusting.
Sure there's security etc to consider. But laptops. No the heart of it is ensuring we are locked into our carrier. Anyway, as you will find out in future posts, it drives me crazy.
But this article is about the Android Studio. AS is by far the most frustrating IDE I've ever used.
About a year ago I bought a Sony Smartwatch 3 with the metal bracelet. It looks super retro-future-sci-fi. I love it. And I was excited to build my own watchfaces for it. So I grabbed Android Studio and spent hours looking for examples and trying to figure out the basics. I got it down enough to make what I wanted. I created a nix console-looking watchface: TerminalTime and a grid of squares watchface: Central Mother.
After about a half a year I wanted to do some improvements to them. I launched AS and it wanted to update itself. Cool, I like rolling the most recent stuff. So I did the update. Aaaand that was the last time my watchfaces ever ran. Or ANYTHING in AS for that matter. I have wasted so many hours removing, reinstalling, deleting virtual devices, creating new virtual devices, building watchfaces using the new project wizard. So many hours scouring forums and contacting Google. Hours and hours and hours, trying to do the most basic thing you could possibly do in AS. Create a watchface project and run it (Without changing anything in it first). I can't get the  project AS created to run in AS.
It's maddening to not be able to modify my own watchfaces because of some dumb IDE. I'm sorry but I hate AS.

5 VST Effects I Use in Every Song

VSTs are so great. I have a massive collection of free instruments and FX that I've tracked down. There are SOO many to choose from... B...