Wednesday, August 29, 2018

MisDirection

I've spent a month at work trying to track down a nasty production bug. At the beginning of August one of our web services started blowing up for about a half an hour every morning. I've been living on about four hours of sleep per night, getting up early to attend meetings trying to uncover the root cause. We've looked through all of our production code, nothing has changed. We looked into other jobs that might be running, that we are unaware of. We've scoured the database, the server, the service calls. Nothing yielded anything useful. It looked as though early mornings would be the new normal.

Then in the course of analyzing the database again, a coworker notices one single materialized view. It was on a development machine. Hr dug deeper. There was a dev job that had been updated to point to production. This was causing the view to be recompiled and was most likely the problem we were seeing (We'll know for sure in the morning).

We had looked everywhere but development. This was production after all. But the key lay in a completely different environment. It was a problem of misdirection. Like a magician tricking us to look at his left hand as he manipulated an object in his right.

Remember when debugging, not to let misdirection cause you to overlook what is truly going on!

Sunday, August 26, 2018

Second Time is Not a Charm

At the beginning of the year, I switched from Android to Fitbit, and with that began coding watchfaces in the Fitbit Studio. It was great, In one evening I coded a binary watch. Another evening I coded a Linux Console - looking watch face. Later I made a text - based binary watch. But it was at that time I realized, my original binary watch was gone. And of course I hadn't backed it up locally.

I've recently decided to try recreating my first binary watch. I'm not sure how I made it so easily the first time. This time around is a nightmare so far. I am building it in such a way that I don't already know the screen size. I originally tried doing the layout using CSS and percentages, but the grid I'm building isn't evenly divided so it is not quite right.

Just when things were at their darkest, I found a snippet that gets me the screen height and width. I know it's JS but I thought I had previously not been able to grab the screen size for some reason. Well I thought wrong. Once I have the screen res, everything slowly falls into place. I got the grid worked out. It took a bit to get the lines in there. There were some headaches on the dynamic colors and re-purposing my binary time code.

It was still a stroll through a swamp. Then POOF! it was suddenly done. Two little tweaks to fix bugs and so far it's working like a champ. I want to add a touch listener ao it will cycle through some other screens, like binary date etc, and maybe a cheat screen with the time/date/steps etc.

Oh! Maybe that third screen could be my Linux console like watchface. A two for one! Hmm....

Wednesday, July 25, 2018

C++ aka: &#%*!!!!

Wow C++ is a nightmare when you are a noob at it! I'm building my notes, bookmarks, todo, whatever app in it. It is basically just parsing input from the user, and performing DB operations on it. It's essentially a super simple two column DB abstraction.

Apparently with C++ it is either 'all good in the hood' or 'OH HOLY CRAP THE EARTH JUST BLOWED UP!!!!!'. I'm trying to get a feel for what's best to put in a header file vs a class, trying to wrap my head around pointers (in real life.... they make perfect sense when explained, but when you dig in to use them... 'wait. what?!'), and classes in general in C++.

I worked forever and finally came up with a basic string splitting code block. So I could put the user's input into an array to work with. I have a Functions header so I can have global helper methods handy. I also have a DB header. I was thinking I would want that around everywhere and have it persist. All was good.

I created an Entry class. And defined a header with its definition in it. I created a variable of it and called its methods, all was good. Then I decided its database path should be a pointer to a path in the main so when it changes I don't have any maintenance to do. OH HOLY CRAP THE EARTH JUST BLOWED UP!!!!

I tried to track down what I was doing wrong and that only exploded the errors so they filled up the console. Ok. Nevermind. Later.

My database methods were in a header ao I could have a static callback method, for retrieving data. But I needed that header in main and Entry. Duplicate declarations. So I tried the compiler if/define trick. Nope. I made it into a class. After the earth blowed up a dozen more times I FINALLY got that to work.

So I guess I'm now a C++ guru. Ha.

Tuesday, July 24, 2018

Are We Through, Java?

There are plenty of strong opinions about Java. I've always been a fan. Mainly when I found Gnuroot for my phone. Then everything I did was a Java console app... because I could run it on my phone, and my desktop, laptop, work boxes, wherever!! Well thanks to Android, Gnuroot is dead in the water. I believe it is due to further file system lock down or similar. So that incentive was gone.

But at that point I had become very comfortable in Java and had come to actually enjoy it. I was a fan. I still am. My IF game engine turned out pretty cool. But SQLITE gets slow unless you do weird acrobatics. And now that I'm working on a game that requires real time movement AND data reading based on that movement, the SQLITE rooster has come home to roost. Even simple data transactions are disastrous. If I can't find a viable asynchronous solution, I'm afraid it is time for Java and I to part ways.

I'm currently looking into multithreading and tasks (I believe they are). Any solution will likely involve a decent learning curve, I've never really dug into asynchronous work in Java. I see there are some Java solutions out there that claim to offer asynchronous database interactions. I may have to explore those options.

We'll see what happens.

Monday, July 23, 2018

I Found Rust

Yes, it's about time. It's only been there since 2010. All this time I've never spotted it. Rust. But then again I don't often go about looking for new programming languages. Typically I'm trying to find out new ways of using the few I know fairly well. - And of course the periodic and futile attempts to successfully build something in c++.

Then completely by accident I stumbled upon Rust. I like the memory safety, 'lending', and race free concepts. I'm not aware of other changes from c++ yet but I may have to mess around with it. Of course I'm not terribly savvy at c++ so it'd be as steep of a learning curve as c++ itself would be.

We'll see what happens. I am currently at a crossroads. WorldWeaver is pretty stable currently. I've been doing some game building in it, but no real updates to the engine or admin tools. I have a space mining start in Java, but database interaction is too costly, I need to figure out how I'd deal with that. But not much on my plate.

Sunday, July 8, 2018

CPProgress

I've decided to take the plunge - finally - and learn c++. To do so I'm taking my nmx notes/bookmarks/todo/whatever app and recreating it in c++. It is a good candidate because I've been building it in one form or another for over ten years now. It was once a web-based GUI then it got rebuilt a couple times in Java as a console app. So I'm very familiar with what it needs to do and how to accomplish it. And it's much simpler than my IF game engine, which has its own custom markup language in it, as well as a help builder tool. The help system will be part of nmx, but I'll save it for later, when I'm comfortable with c++.

As I go I'm building a library of how to do certain things in c++ like file/folder manipulation and sqlite3 methods. The input parsing should be interesting, considering how tricky it was to get string to array functionality working. I'll convert it to regex, which I need to do for all of my other console apps in Java. I would like to be much more adept at regex anyway.

So far it's starting to fall into place, I have basic input handling and database creation in place. Once the DB is defined I'll probably tackle the regex piece. I'll also have to parse through datasets coming back from the DB.

Saturday, July 7, 2018

Ancient Nerds

It is so cool learning about how similar ancient scholars are to us. We come up with interesting problems that we can try solving with code, like the knapsack problem. Nerds in the ancient past also came up with interesting problems that they could solve - with mathematics. Like the bisect an angle with only ruler and compass problem. Then later the unsolvable 'trisect' an angle with only ruler and compass.

I can completely see how solving these problems would be every bit as exciting as wrapping up a function / feature / program and executing it. It was exciting to see how the bisection problem is solved, just as exciting as seeing knapsack solutions or other software solutions or algorithms.

And ALL of us have benefitted from the work of our nerdy ancestors.

Best GUI / TUI

 Let's talk about my favorite GUI and TUI libraries... so far. Dear IMGUI I've used this library in a couple of projects (using the ...