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.

Tue, 12 Sep 2017

How do I make this program?

I want to create a program that helps me quickly write up a blog post -- especially a "social" blog post based on a link -- and upload that post as a file to a flat-file-driven blogging system.

In case it isn't obvious, I'm not a professional developer. The whole "hey, let's learn to code just because" thing doesn't work so well for me. Tutorials aren't my thing. I need a project. Then I'm compelled to learn what I need to make that project happen, at least in some fashion. The first thing to do is come up with something doable and not so difficult that I can't even get close.

Hence my idea: a flat-file blog posting machine. It's not too complicated. It would be geared mostly for "social" posts, which I stash in a dedicated category directory-driven category on my blog and let IFTTT (and formerly dlvr.it scrape and then send to Twitter. Why do I do this? Because I feel better about "giving" Twitter my free content to promote their business when I have that same content on my website that is wholly owned and operated by me and not them.

Back to the program: I want to be able to enter a URL from a post/story/page that interests me into a box and then have that box generate a title, post body, file name and actual file with the ability to make changes in any of these fields -- all with as little required input from me as a "regular" Twitter post. The program would then upload the file it creates to my web server, also taking care of whatever back-end housekeeping is needed to make that post appear on the blog. And if I could figure out the Twitter API, I could also trigger the social post itself and eliminate the need for IFTTT or dlvr.it.

Once I thought about it, I figured that if the program could do quick social posts, it could also help me create "regular" blog posts, allowing me to write a post in the window and then click a button to make it live on my flat-file blogging system.

At one point I thought about doing this as a Google Chrome browser extension, but it looked like I would need to create an external web service to go the last mile, which is getting my post up to the server via FTP.

I could do it using Unix tools, but the game here is not to do it with shell scripts but instead use traditional programming languages that are portable across systems.

I don't want it to be a web program, because it needs to create files and upload them to a server, and dealing with the authentication and security for doing that is one more step that I don't need. So I'm opting for a program that lives and creates the files locally, then uploading them to the blog server.

At all points, I'm making choices that depend on what I can do right now, or figure out how to do from the resources available to me (basically the entire Internet).

On paper I'm mocking up what I'd like a local GUI to look like, but I could also start with a console-driven program until I get the GUI component together.

If I eventually do it as a GUI program, I'd like it to be cross-platform. However, I'm not seeing anything that says, "THIS is totally the GUI toolkit and language you should use." On the contrary, while Ruby is one of the more straightforward programming languages, it's not at all common as a language for desktop GUI programs. But I'm still considering it because I can probably hack together Ruby better than other languages.

I thought Java would be a good candidate for this. My assumption was that Java is used fairly often for "local" programs. The college textbooks tend to cover JavaFX -- the current Java GUI framework -- just like they covered Spring before it. But then I do a little "research" (aka searches on Reddit), and it looks like almost nobody creates local Java programs anymore. It's all back-end server stuff.

Ruby has a GUI toolkit called Shoes that -- like most Ruby things -- seems almost wholly abandoned. The "original" Ruby tookit TK (which works with other languages too) is super old, but maybe it will work for my purposes.

Lately I've been thinking about doing it as a command-line-driven utility because I could get something usable without needing to learn a whole GUI toolkit.

After my success using FTP in Ruby in the Windows Subsystem for Linux, I added Ruby to the rest of Windows. Then I was able to connect and upload in Java.

Update on 4/23/18: I did write this program. I did it in Ruby, and it is a command-line script. It creates social/blog posts, uploads them to the blog and also sends them to Twitter via that service's API. The script is fairly solid, but I am refactoring it to make it a) more modular and b) possibly object-oriented. I'd also like to convert it into a GUI, probably using the TK toolkit at this point.

But the larger point is that I did do it.

Why wasn't this entry published before now? I am backdating this entry to when I first wrote it. I'm not sure why it has been sitting in my Windows Subsystem for Linux home directory all these months, but I had some time today to add these notes, and so I am publishing it.