Sunday, April 28, 2024

Catching up

I've been stalling on updates because I'm not sure where in the world to put them.

So much of my side-project life has been consumed by amateur radio over the past year, I've been thinking they deserved their own blog. But most of it is still just code or DIY hackiness that I (just today) came to the conclusion that I might as well start typing.

The first thing on my list is a weather station. A retail one, and very poorly documented at that. It's the Raddy L7 station, which I purchased for a couple of very specific reasons. First was the retailer, Radioddity, which I've had a lot of success with in the past. Second was the price, of course. But the real selling points were on the technology -- its communications design is a LoRa-based wireless one, which I have been finding growing interest in over the past couple years. There's huge potential in LoRa (which has already been realized in a select few commercial spaces), which the amateur radio world is just recently latching onto.

The whole radio and electronics world is driving me one step closer to a YouTube channel. (You've been warned.)

All that aside, I was able to do just enough reverse engineering to grab the data from the hub to rewrite the data as a more standard JSON result so I could process it into a few other applications, most notably my HomeAssistant server. Next steps here are to integrate with MQTT to drive a couple smart devices.

The second one is really a mess. It's a combination of web scraping and re-packaging tools to give me a pseudo-curated summary of the things I'm interested in. The whole objective is to get rid of the endless stream of push notifications to my cell phone and look at my daily information in a more 1980s-esque way.

Ultimately, I'm beyond fed up with the "always-on, half-dozen side hustles" never-ending drive to make us as personally efficient as possible. That shit is for manufacturing, not leisure. Leave my humanity the hell alone. I treasure my personal inefficiencies, please and thank you.

The last is a collection of amateur radio logging and calculator utilities. Sure, there are a bunch of them out there, but they're all disparate, clunky, over-and-or-under-engineered, and mostly very platform dependent. I run a combination of operating systems, and I'd really like the tools I rely on to be portable.

To that end, I've landed on node.js to handle my daily lifting. I know, Rust was probably the better choice here, but the learning curve was a bit too steep for me to get the results I wanted quickly enough. Most of these tools are partially web-enabled and database driven by nature, so it made sense to take the shortcut. 

Can I just say here... I hate that radio tools have a web requirement. I would really like to see some of these intercommunicative standards re-designed to build upon the packet standards developed in the previous century.

Anyway, that's the past year in a nutshell. I've built repositories for most of the things I'm tinkering with, and when I'm comfortable with the fact that people will laugh my code off the planet, I'll make them public.

Look... It's been years since I've done any legitimate work as a developer, so getting back into any of this has been a real challenge.



Friday, May 12, 2023

Clickety clack!

 As usual, it's been a while.

Lots of life changes since the last post, for certain. And with it, new direction and focus. (Or lack thereof.)

I've spent the better part of the past three days diving headlong into code. I have a project that I wanted to develop primarily in C# on Windows and compile it as cross-platform, but there were just too many hurdles that kept jumping in my face to make that practical for me to rapidly develop on. The resulting requirements all but demanded that I develop on and build for Linux (which is a wholly new experience).

C++ was never really my bread and butter, but that's what I ended up starting with. I'm more comfortable in C#, and after the past few days, I've determined that a not insignificant portion of that comfort was really founded in utilizing the crutch of the Visual Studio environment.

Coding in a straight text editor is an entirely different beast. Finding a simple error in a class definition only after the third re-compile, whereas in the past, the IDE would have caught that for me... Those are painful reminders of days long since gone. And I am not nostalgic for them.

Needless to say, I installed VS Code rather quickly.

In any event, I found a rather useful multi-pronged sandbox project: First, I want a console application to communicate with one of my amateur radios over a USB serial interface, grab some essential information (frequency, band, signal strength, mode, &c.) and use those as database fields in a console-based contact logging application. (I haven't found any that I like, so I figure I'll spin my own.)

Handling the serial communications with a radio is not a wheel I want to reinvent. There are too many nuances in the communication spec for even a single manufacturer for me to even think about handling that piece. (Remember, I want rapid!) So to do that, I'm letting the hamlib library talk directly to the radio, and I'm interfacing with hamlib (specifically, rigctld) over TCP.

I did originally want to write that socket code from scratch, but again, time is an issue, so I opted to use the Boost library here to accomplish the I/O. I will also likely use Boost as the springboard for part two.

Ah, part two. That's where I get to dust off the web development neurons. Part two of the project is to expose that data via a web-enabled API so I can easily replicate (and theme) the radio's display on a web page. I haven't settled on the exact architecture for that yet, but most likely a combination of node.js and Angular. Seeing a pretty analog needle swinging across a screen, joined by blinking status indicators and various cosmetic display elements... That's just sweet.

In both cases -- web and console -- I also want the ability to send control selections back to the radio through the hamlib interface.

The long and short of it is that I'd like to wrap up next week with renewed confidence in my coding skills. It's been three or four years since I've done any truly heavy lifting in any language, and another solid five before that since I've considered myself a "real" developer.

That's a really long time to be away from one's passions.

I have a few lessons learned that I will share as this project continues.

Saturday, September 5, 2020

Finding devices on the LAN from the DOS prompt

Every once in a while, I want a simple but elegant way to do things. No downloads, no complications.

Tonight, I was looking for an easy way to see what devices were attached to my local network without using a hefty network tool. It took me a little longer than I'd hoped, but I managed to whip up a little batch file (yep, old school!) to help me find a device that was trying to hide from me.

I call it: findping

Here's the batch file. It takes two parameters, which are the starting and ending numbers of the last octet:

@echo off
set subnet=192.168.0
echo Searching IP Range: %subnet%.%1 - %subnet%.%2
for /l %%i in (%1,1,%2) do (
    @ping -n 1 %subnet%.%%i | find /i "Reply from %subnet%.%%i:"
    if not ERRORLEVEL 1 (
        rem valid response
    ) else (
        echo Polling IP %subnet%.%%i: no response
    )
)
set subnet=
echo Done.
So the usage looks something like this:

findping 100 254

Then it scans through each of the IPs in the range of 192.168.0.100 though 192.168.0.254.

If you want to change the class C subnet you're searching, simply change that in the second line of the batch file (the "set subnet" line).

If you need to store the results to a file on disk, perhaps to run through a spreadsheet later, you can pipe the output that way as well:

findping 1 100 > search.txt

I hope you folks find this as useful as I did!

Wednesday, October 14, 2015

Transitions

I've had some friends ask me why I don't blog much anymore. The short answer to that is easy: time.

The longer, and more accurate, answer has actually caused me to not write when I normally would have: my career path and responsibilities have changed dramatically over the past few years. Where I once was a developer and hardware hacker by day and night, I now rarely have the opportunity to perform that kind of work.

As the Director of IT for a mid-size logistics company, I find more of my time spent performing higher-level functions: determining which technology best suits a particular business need, discussing strategy with my peers, and, most interestingly, developing talent rather than code.

It's this human factor that has really taken up most of my free time. How do I encourage the folks on my team to work together despite personal differences? How do I empower team members to bring new ideas to the table? How do I remove obstacles so the team can achieve their goals?

It's not that this aspect of the job is time-consuming, per se. In fact, it's really not. But my desire to be a better manager and leader is what draws me into hours of reading, team exercises, coaching sessions, and comparing notes with a couple people at this level that I've come to really respect.

So what do I do with a tech-driven blog when I don't really have the time to contribute? The passion for technology is just as strong now as it ever was, and I don't want to just abandon it.

The answer to this is probably to merge the two: how I use technology to attack problems or drive change as it relates to a given position or industry.

Let me mull that over, and I'll get back to you.

Sunday, March 17, 2013

Warcraft 2!


A few people have been asking me how to set up DOSBox to run Warcraft 2, so I thought rather than re-type this a dozen times, I'd just post it on a blog and point everyone here. My son and I have spent a couple long nights in multiplayer mode, and have had a blast. I'm eager to get a bunch of the old crowd in a massive game and lose even more sleep. :)

(We all have the CDs, of course, so there's no questionable legality here.)

The Preliminaries

Note that if you need to install to a different drive or directory (for instance, I use E:\Emulation\DOS), make sure you change it in all appropriate places.

Start with downloading DOSBox:
http://www.dosbox.com/

Then pick up the Warcraft archive from here:
http://www.theoldcomputer.com/roms/index.php?folder=PC/Abandonware-DOS/Games/w
(Registration required to download.)

Unzip DOSBox into C:\DOS and unzip Warcraft 2 into 
C:\DOS\DRIVE_C\WAR2

Start DOSBox and type:
config -writeconf dosbox.cfg

Exit DOSBox, and open dosbox.cfg in notepad. Find line line that says "ipx=false" and change it to:
ipx=true

Then at the very end of the file under the [autoexec] section, add the following:
mount c C:\DOS\DRIVE_C

Now create a shortcut to DOSBox. Right click the shortcut, and select Properties. Change the target to read:
C:\DOS\DOSBox.exe -conf "C:\DOS\dosbox.cfg" -noconsole

And make sure the "Start in" field reads:
C:\DOS

Almost there!

Start DOSBox using the shortcut you just created.

Switch to your virtual "C:" drive by typing:
C:

Then:
cd C:\WAR2

Run setup.exe and let it autodetect your sound card and MIDI settings. Save and exit.

Run war2.exe and enjoy!

To play multiplayer, before starting war2.exe, you'll need to start the IPX networking module. If you're hosting the game, type the following at a command prompt:
ipxnet startserver

If you're connecting to someone else's game, type:
ipxnet connect xx.xx.xx.xx
(where xx.xx.xx.xx is the IP address of the person you're connecting to)

The setup seems like a bit of a chore the first time through, but it's really not that bad, and once it's done, you only have to launch the shortcut to open DOSBox and start playing. Any other old DOS games can be installed in a subdirectory of your C:\DOS\DRIVE_C folder and played using this configuration as well. I've used it for Epic Pinball, Doom, and Pizza Tycoon, among others.

If I've missed something or a typo slipped through, let me know.

Sunday, December 9, 2012

Code Highlighting on Blogger

I'll let you all in on a little secret: I almost switched my entire blogging presence over to WordPress last week. if(!this)what(); and the NetAsylum blog. (Technically, I did, for all of about 30 minutes.) For two reasons.

One: I wanted a mobile blogging app that was worth a damn. The official Blogger app for Android is a steaming pile of crap. I don't understand how Google can't manage to put together a mobile interface for their own blogging platform on their own mobile platform. HUGE FAIL. (Update: Google seems to have updated their mobile blogging app a couple weeks ago for the first time in about a year. I have yet to try it, but don't hear many good things about the new version, either.)

Two: I wanted to be able to easily post code snippets that look all nice and pretty, formatted and syntax highlighted. I've tried a handful of solutions in the past, but was incredibly disappointed in them.

WordPress handles both of these things well, and I recognize its popularity and superiority in these areas. The downside? I want my blogs hosted on a major, stable cloud provider (not on my own server, which requires additional maintenance). Okay, that's all well and good for both services, but to point my domain names to WordPress "the right way" and to stylize my blog's appearance is an up-sell.

I'm a cheap bastard.

To combat the first problem, I eventually evaluated a number of mobile applications, and finally came upon one called BlogIt! that handles many of my needs well, including multiple blogs and image posting (which is something I haven't reliably been able to do for a while).

The second required a bit of research and evaluation on my part, and I've settled on Sunlight.js which is an extremely comprehensive multi-language highlighter and formatter. (It even handles nested languages!) It doesn't appear to be recently maintained, but it seems to be the easiest to implement on Blogger, and couldn't be simpler to use.

To add the functionality only requires a few tags in the page header:
<link href="/path/to/sunlight.default.css" rel="stylesheet" type="text/css"></link>
<script src="/path/to/sunlight-min.js" type="text/javascript"></script>
<script src="/path/to/sunlight.csharp-min.js" type="text/javascript"></script>


Then add the following bit of script right before the closing </body> tag:
<script type="text/javascript">
    Sunlight.highlightAll();
</script>

To mark a segment of text as code, you enclose it in a <pre> tag with a special class, as in:
<pre class="sunlight-highlight-javascript">
    function DoSomething() {
        // Your code here...
        return;
    }
</pre>

Which results in output that looks like this:
    function DoSomething() {
        // Your code here...
        return;
    }

And that's it. Can't get much more simple than that.

With that out of the way, I'll be sharing some of the principles behind some things I've been working on at the new job, which includes some WCF services, RESTful web API, MVVM, and other acronym-ish buzzwords as well.

Sunday, November 13, 2011

Choose Your External Hard Drive Carefully!

A word of warning about external Maxtor (Seagate) OneTouch USB drives: I have two of them (a 1TB and a 500GB), and both have lost their partition tables in less than a month's span. Granted, these drives are 2 and 3 years old (respectively), but one would expect a drive to retain its data at least for the duration of the 5 year manufacturer's warranty.

After doing a lot of reading, it appears the USB->IDE interface used in the enclosure is of suspect quality. I can unscientifically confirm this, as I have been able to temporarily rectify intermittent problems with both of these drives by replacing aged USB cables (though the cables work flawlessly in other applications).

This problem appears to be quite common, and there are various methods for recovering the data. I have chosen two, and am trying the least invasive first: an open source program called TestDisk, which has a good reputation for repairing deleted/corrupt partition tables (and data).

If this fails, I'll simply open the case and remove the drive, then plug it directly into the internal IDE interface.  (The 1TB drive may be a SATA drive, which would be even better.)  In either case, the drives themselves are apparently rarely defective, so I'll only lose the portability of the drives, which in this case is not a huge concern, as they are always connected to the server.

These drives have been problematic for the majority of the time I've owned them, and it doesn't seem to matter what OS they're connected to. (I've had them on 3 different machines: XP, Windows 7, and Linux.)  I don't believe these specific drives are commonly sold anymore, but still, I recommend that people steer clear of them, as well as their new Seagate counterparts.

For the record, I've never been a fan of either manufacturer (before or after Seagate's acquisition of Maxtor), and only purchased the drives because of their low price point. Once again, the old adage is reaffirmed: you get what you pay for.

Thank goodness all my other drives are Western Digital.