Ant

Published / by Andrew

The reason I haven’t been too active in the past week or so is because I’ve been busy working on a Windows Forms project in C# called “Ant,” and version 1.0.0 is now available on GitHub.

This project is based on a VBScript project that I had at my last job. I needed to keep track of how much time I spent on each individual project, so I wrote a script to prompt me once an hour with “What are you working on right now?” It would then take that input and put it into a CSV file, so I could keep track of it in Excel. (It’s VBScript instead of PowerShell because I wrote it before I became familiar with PowerShell.)

I was describing this project to my sister, and she said it would be very useful for people with billable hours. In its incarnation at that time, though, it would be kind of weird to distribute, so I decided to make it into a project that could be put into production. I did it in C# just because my experience in C# is light, so this gives me a little more exposure to the language.

Initially, I was going to make this project cross-platform using Gtk#, but I wasn’t able to get Gtk# working correctly (it’s very buggy), so it’s now a strictly-Windows project using the traditional Windows Forms. This is kind of ironic since I primarily use Ubuntu.

Between installing Windows 10 in a VirtualBox VM (Virtual desktops! Finally!) and learning a few things about Windows Forms that I didn’t already know from VBA in Excel, I spent quite a bit of time on this project, and there’s still some more to come. You can see the upcoming features in the Ant.todo file.

Reco: Outlining

Published / by Andrew

I have a reco today that’s a little different. It’s not for a particular program, but for a methodology that I’ve been using for quite some time.

Beginning a new project can be daunting. Everyone already knows that. Trying to organize my thoughts is difficult, especially for larger projects. “How do I get XYZ accomplished?”

What I’ve been doing for years, and not just for coding, is simply making outlines of what needs to be done. My personal methodology has been evolving over all of the time that I’ve been doing this and has become pretty specific. The end result (as seen in the screenshot above) is a todo list that’s organized as an outline. I’ve actually developed a Vim syntax file that color-codes it, and that color-coding has become extremely useful. (This is the same format as my notes files on GitHub.)

The key is as follows:

  • > = Todo
  • + = Done
  • * = Information
  • – = Canceled
  • : = Title
  • ! = Important to remember
  • ? = Unanswered question

This doesn’t follow the specific rules of outlines that are taught in English classes. For example, it’s not uncommon for me to have only one subpoint. There’s good reason not to do this in a slideshow presentation, but it doesn’t really apply to these outlines.

Despite how specific the structure is, the content is very fluid. Throughout the course of a project, what it starts out as in the beginning could be radically different from how it ends up as by the end of the project. It’s not a “This project must follow this exact course” outline, but, instead, is essentially my thoughts written down. Todo points may be added, information points will definitely be added, entire sections could be added or canceled (I try not to actually delete so I don’t accidentally lose important information), etc. This helps me to organize everything as well as just remember everything. Additionally, the indented format lets me use Vim’s indent code-folding method (or, in my case, an expr called “ModifiedIndent”, which you can see on my GitHub), and keeping these files helps me more easily pick up an old project months or years after I haven’t touched it if/when I need to.

Of course, I would never say “This is something you have to do.” That’s actually the case for all of my recos, but, in this case, it’s especially true. I’ve very much come to recognize Matt Hartley’s favorite catchphrase, “Different strokes for different folks.” This is something that came about for me while I was an undergrad in math– Start solving a problem by writing down everything I know. (Come to think of it, I may have picked it up from the way they do differential diagnoses in “House”.) It evolved from there and has become an essential part of how I think.

This last part is slightly off-topic, but the screenshot above is from a project that I’ve just started (hence all > and no +). It’s a program that I’m writing for my sister to help keep track of time, based on a VBScript program that I wrote for myself a while ago (at the time, I didn’t know PowerShell). I was describing how I had a script run once an hour and prompt me with “What are you working on right now?” Then it would store the result in a CSV file, which I could later open in Excel and count how many hours I spent working on any individual project. She said that would be very useful in her line of work, and, huzzah, a C# project was born. If it were just for me, I would probably just use either PowerShell with Windows Task Scheduler or BASH with cron, but, if I want to share it with others, I’d rather have one package do everything (and, in this case, a GUI program). I’m hoping to be able to use Gtk# to run it cross-platform.

That’s all for right now. Thanks for reading!

Threadstr update: User options page and some Node.js tricks

Published / by Andrew

I have a major update and some minor updates for Threadstr.

It’s still not meaningfully functional, but it’s far enough along that I don’t intend to wipe the database on updates anymore.

All functions in the Options page are now usable. (Or, at least, they’re supposed to be.) Additionally, there’s a favicon added, helmet is being used to secure the Express app, and forever-monitor is being used to reset the server when it goes down for whatever reason. Finally, I moved the MySQL command that simply keeps the database alive to another place because it’s possible that its previous location was causing a memory leak by opening up way too many connections and not closing them, and its frequency is now every ten minutes instead of every five seconds.

Next up is actually being able to create and add to threads– The Feature Presentation.

Reco: Vagrant

Published / by Andrew

You may remember the post that I had before on using VirtualBox as a testing environment. Well, I recently learned about a program that just blows that out of the water.

Vagrant makes creating, destroying, using, customizing, ssh-ing into, etc., of virtual machines so ridiculously easy that I’m now using a VM for every project (which is actually the intended purpose of the program). These aren’t just for testing code periodically, but for every step in the development process. I never run the code on the host computer– It’s always in a VM.

That means that I understand all dependencies that are being used. I don’t need to worry that code that works on my machine won’t work on a DO droplet because of an unknown dependency that I installed on my box two years ago. I also don’t need to worry about filling my box with weird and even conflicting software, because the environments are encapsulated in virtual machines. (Case in point– I’m currently teaching myself C#/ASP.Net, etc., and I haven’t bothered to install Mono on my laptop because I’ve installed it in a Vagrant VM instead.)

Vagrant is essentially a program that extends VirtualBox functionality (though it also works with VMware Workstation and Parallels). Everything that I do with Vagrant is possible using VirtualBox on its own, but Vagrant makes it much faster and easier. In Threadstr, I create and destroy VMs on a whim to make sure that every little change that I’ve made to ubuntusetup.sh will work correctly. I rarely even run the node command on the host machine anymore.

Like calculus, Vagrant is hard to learn but easy to use once you’ve learned it. I think it’s well worth the effort, and I’d highly suggest it to any dev that’s working in a compatible project. This means projects that don’t depend on Visual Studio, XCode, or anything else that’s incompatible with Linux, FreeBSD, and other FOSS operating systems. (Piracy laws won’t allow non-free operating systems like Windows, MacOS, etc. to be distributed the way that Vagrant VMs are.)

(If you’re interested in my Vagrant notes, you can find them here, or the original plaintext file here.)

Reco: Termux

Published / by Andrew

I’ve been working on Threadstr a lot lately, but I think I’ll take a break to make a reco.

(“Reco” is short for “recommendation,” not “reconaissance,” by the way.)

There’s a really neat program on Android called “Termux.” It is, more or less, a CLI Linux distro for mobile (which seems to be based on Debian), complete with its own software repos containing the most common CLI tools you’ll need. I’ve found it to be incredibly useful because it gives me the tools to be able to SSH into my DO droplets, being able to use a full version of Vim, being able to use Git, and so much more. It has a complete BASH implementation with .bashrc just like you’d expect from any Linux distro. Thus far, there have only been two things that I haven’t been able to do: Compile LaTeX documents (texlive is not in the repo– yet) and use the Perl engine for grep (there’s probably a way to enable that, though).

I was beginning to seriously consider renting a DO droplet for the sole purpose of being able to SSH into it through Juice because of how useful it would be. That’s now no longer necessary for me.

With a Bluetooth keyboard, I have greatly reduced my need for a laptop by using Termux. (When I am sans physical keyboard, I am able to get by with Hacker’s Keyboard.)

If you have need for a Linux distro on-the-go, I’d definitely suggest you give Termux a try.

Threadstr reliability issues

Published / by Andrew

I am aware that Threadstr is occasionally going down. Even though it’s not currently functional anyway, I want to get this resolved ASAP, because I don’t want it to be an issue when it is fully-functional.

The issue seems to be that MySQL is getting an out-of-memory error, and I’m not the only one having this problem on DO.

I’m approaching this on two fronts:

  1. Stop the out-of-memory error from occurring.
  2. Have the DO droplet restart and restart Node.js when it exits abruptly.

Both of these have their own challenges. In the first case, adding RAM doesn’t always seem to make much of a difference, according to the thread linked above. In the second case, Node.js, unlike Apache, doesn’t start up in the background by default when the machine starts up, and I don’t know how to get Node.js to restart the machine if it crashes.

It’s an ongoing learning experience, but I am definitely determined to make this work as well as I possibly can.

Working(ish) model of Threadstr now online.

Published / by Andrew

I bought the domain name threadstr.com a while ago (before I bought this one, actually). The project isn’t anywhere near completion, but, since DO droplets are a mere $5 a month, I decided to go ahead and put up what I have so far– Partly as having it out there publically will be incentive to get myself working on it some more, but mostly just to show what I have so far.

So, it’s up now.

“Incomplete” is an understatement. At this point, the only thing that a user can do is create an account, but, nonetheless, a lot of work has gone into what’s there so far. Unfortunately, “a lot of work” doesn’t mean the website is usable, so more work is going to be required to make it functional.

Development on this project is slow-moving since it’s an at-home project (and it’s also my first exposure to Node.js). Slow-moving, but not at a standstill.

I’m going to take a quick break from it to work on a timekeeping program that I discussed with my sister. I was telling her about how useful scripting languages can be and, among other things, how I’ve been using a VBScript program to keep track of how long I spend on each project (it would be PowerShell if I wrote it today). She’s expressed interest, and I plan to make it into a full-fledged program to add to my portfolio. I thought about making it a C++ Qt program, but decided that, in the interest of time, I should go with something that I know, so it’ll be a Java program instead. That will, of course, be showing up on this site and GitHub eventually.

Threadstr: My current big project.

Published / by Andrew

I’ve decided to go ahead and open source my current big project (at home, at least): Threadstr.  Soon, I’ll also set up a Droplet to host the incomplete project just to show it at work, although it’s not yet functional (or even close to functional).

The basic idea is to create a discussion thread that’s not actually attached to a particular message board.  This might seem unusual at first, but the idea is that it can be shared and organized in a way that’s better than Facebook comments or Twitter replies.

As for the code, I’ll let my in-code documentation speak for itself.

A future plan is to allow the user to create debate threads, which would let two people have a moderated text debate, where the moderator is the server.  It would determine when you can post (opening statement, rebuttal, cross-x, and closing statement), a minimum and maximum post length, and a time window that would determine when someone is allowed to post.

I’ll put up a working (but incomplete) model in the near future– Possibly tomorrow.  I would do it tonight, but it’s getting too late to do much more work.

Oh, and a shout-out to my friend and coworker Cari Landrum for the logo.  My version looked awful, so I took it to her and she made this version that looks fantastic.

UPDATE: I think I’m going to wait just a little while before putting up a working model.  Right now, the only thing you can do is create an account, which will be wiped out eventually anyway.

Setting up a VirtualBox VM for Ubuntu Server testing

Published / by Andrew

Something really useful about virtualization, besides getting those one-off Windows programs running without having to dual-boot, is the ability to set up a virtual server.  I use VirtualBox to test Ubuntu Server projects that I plan to put on Digital Ocean.  This way I can test it on the virtual machine before actually spending money to spin up a droplet.

For the sake of brevity and getting to bed at a decent hour, I’ll only explain in detail the one part that was tricky to me the first time I did it.  The easy parts are installing VirtualBox, then installing Ubuntu Server Edition (I prefer an LTS version, currently 16.04)  onto a new virtual machine.  Though I will say these two things:

  • Installation can take a long time, so I would also suggest making a backup copy of the newly-created VM so that you can make a copy of that backup instead of reinstalling every time you want to make a new one.
  • You’ll want to install OpenSSH so that you can a.) SSH into the VM so you can control it from a terminal (from any machine on your network, no less, when we’re done with it) and b.) SFTP files onto the VM (again, from any machine on your network).  You can do this while installing Ubuntu or, if you accidentally hit Enter instead of Space, which I do every time, you can install it after-the-fact with sudo apt-get install openssh-server.

Now for the part that I had a hard time figuring out, but, with some internet research, I did, eventually, figure out– Setting the VM to appear as a separate machine on the network. It’s actually really easy if you know what to do and can be done before or after the operating system is installed– Go to the settings of the VM, go to “Network,” and, for “Attached to,” select “Bridged Adapter.”

Now when you start up the VM, it will have its own ip address on your LAN that’s independent of the host machine.  You can find it with the command ifconfig from within the VM’s window: It’s going to be the “inet addr,” which, in the example picture below, is 192.168.1.111.

Now that this is done, while the VM is powered on, you can use SSH to log into it, SFTP to transfer files to it, install Git and download a project onto it, or do anything else that you need to.  This is a virtual machine on your network.  Use it as a test webserver, use it for Zoneminder, use it for anything that you would use a server for.

The Freedom of Software Development

Published / by Andrew

One of the worst things of using a computer is having to work with tools that you don’t like. Sometimes it’s just because you don’t think the same way that the original devs did, or because the devs are stubbornly holding to a feature that’s widely-acknowledged to be broken.

The most freeing part of software development is the ability to make your own tools. That’s not to say that you’ll never be dependent on other people’s work, of course, but, if you don’t like the tool that you’re using, you have the freedom to make a new one if you’re willing to spend the time to do it. A good example of this would be NeoVim.

Case in point, the image above. The autocorrect in Google has been driving me absolutely insane for years. I’ve been using DuckDuckGo for a long time because the autocorrect is less aggressive, but it’s still pretty bad.

Then I noticed that the only thing that Google does in the get query (though I don’t know if it’s really a “get” query, since it starts with a ‘#’ instead of a ‘?’) to disable autocorrect is a simple flag: “nfpr=1”. That’s it. Adding that programatically is a very simple task.

So, I set out to create that very simple webpage. Apart from the Rage comic that I added for kicks, it’s just a single HTML file. I didn’t even separate the CSS and JS files. It was really that easy to do, but I wouldn’t have known that if I didn’t already know how to use JS. When I set Firefox to use this as my default search, it uses Google without autocorrect.

And that webpage is public. There are a couple of reasons for this. The first is that, I may as well share it, because I know I’m not the only one aggravated by this. The second reason is that I can now use it anywhere. From my phone to my office (if I can convince IT to let me through to it).

I relish the freedom that I have as someone with knowledge of software development, and I hope to learn more on a wide area of topics so that I can continue to create and tweak tools to my own purposes.