Title photo
frugal technology, simple living and guerrilla large-appliance repair

Regular blog here, 'microblog' there

Many of my traditional blog post live on this site, but a great majority of my social-style posts can be found on my much-busier microbloging site at updates.passthejoe.net. It's busier because my BlogPoster "microblogging" script generates short, Twitter-style posts from the Linux or Windows (or anywhere you can run Ruby with too many Gems) command line, uploads them to the web server and send them out on my Twitter and Mastodon feeds.

I used to post to this blog via scripts and Unix/Linux utilities (curl and Unison) that helped me mirror the files locally and on the server. Since this site recently moved hosts, none of that is set up. I'm just using SFTP and SSH to write posts and manage the site.

Disqus comments are not live just yet because I'm not sure about what I'm going to do for the domain on this site. I'll probably restore the old domain at first just to have some continuity, but for now I like using the "free" domain from this site's new host, NearlyFreeSpeech.net.

Thu, 22 Mar 2018

What is Reason, the programming language?

According to its web page, "Reason lets you write simple, fast and quality type safe code while leveraging both the JavaScript & OCaml ecosystems."

Often called reasonml, it is based on OCaml, is integrated with NPM and compiles to JavaScript.

The language is a Facebook-sponsored project, so it's marketing is pretty good, plus it works in some way with FB's React JavaScript framework.

Two good places to start are the What & Why and Community pages.

Mon, 19 Mar 2018

Starting Windows 10 cold and then opening up a bunch of Google Chrome tabs is painful

I turned the laptop off and only booted once from Puppy Linux's Xenialpup over the weekend. When I turned on the laptop (2017 HP Envy) to start working in Windows 10, today, for some reason the desktop remembered that I had at least one Google Chrome tab and a few apps open.

I also started a new Chrome window for my "main" work, and the laptop was aggressively swapping for maybe a half-hour, during which time things barely worked, or were just slow as hell -- whatever you want to call it.

Now that I've been working for a couple of hours, everything is working well, but this just serves as a point of evidence that Windows 10, right when it starts up, isn't exactly ready for "vigorous computing."

Fri, 16 Mar 2018

I finally have Puppy Linux's Xenialpup set up for Ruby

It took me a while to figure it out, but I finally have my Ruby environment set up in Puppy Linux's Xenialpup (based on Ubuntu 16.04) so I can use my BlogPoster app and also work on its code.

I didn't have any trouble installing Ruby and the ruby-nokogiri package from the Puppy Package Manager. But I couldn't get ruby-twitter to install. gem install wouldn't work -- I didn't have the ruby-dev package -- and I didn't see the Ubuntu package that I needed.

I looked at the problem again, and I figured out that I was missing a repository in the Puppy Package Manager. Once I added the "missing" repository (which involved checking a box -- nothing too difficult), I was able to install ruby-twitter and get my script running.

My next problem was the vi in Puppy. I think it really is vi and not Vim. I couldn't get any formatting commands like :set number to work, either in command mode or .vimrc. The fix for this was quick: I installed Vim from the Puppy Package Manager.

Now I can call the "old" vi, or the "newer" Vim as needed, and my BlogPoster script is running great.

I'm having some issues pasting links into the terminal, but that's something I could overcome. Right now it's a lot of awkward "middle" clicking on the mouse, which for practical purposes means clicking both buttons at once. I'm getting better at it, but I could also use Geany instead of Vim as my editor. I tested Geany with my Ruby script, and it does work.

In other development-related news for this Puppy system, I installed the Racket programming environment from the script provided by the project. So far it works pefectly. I started up DrRacket and was coding right away.

I am still working on my BlogPoster app

I am still working on my BlogPoster app, which will take a URL pasted into a terminal, grab the web page's title and make that title and link the basis for a blog and social post.

The app is written in Ruby and uses the Nokogiri and Twitter gems, among others. I have code that will allow me to eliminate Nokogiri, but that's a fairly "light" gem. The Twitter gem, which makes posting via the Twitter API easy, has a lot of dependencies, and that is the one I'd really like to get rid of in favor of native code.

But that's getting ahead of myself. The app, as it stands now, is a huge if/then loop with a lot of ungainly code. I did add some code that keeps the app from crashing if Nokogiri doesn't get a "real" (i.e. live) web page, or there are connectivity problems.

What I am doing now is re-writing the app with distinct and separate methods, which I'm thinking of as functions that can allow for more modularity and code reuse. I probably should be using Ruby classes to organize these methods, but I'm saving that for the next rewrite. Going from a monolith with a lot of repeated code to a bunch of modules (still probably accessed via an if/then structure, albeit a much shorter and manageable one) is enough improvement for the next version.

For the next version, I hope to have a GUI. I'm leaning toward the Tk toolkit because this app isn't very complicated, and Tk is probably the most well-known of a very motley bunch of desktop GUI solutions for Ruby. It may be a little ugly, but it is cross-platform, which is what I have been aiming for. I am open to other GUI toolkits, but even this recent article, An overview of desktop Ruby GUI development in 2018 doesn't offer much hope.

I'm also considering a full rewrite in another language. I'm working on Racket right now, but I'd have to figure out a lot of things to make it happen.