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.
News that the random number generator in JavaScript was fixed (I didn't know it was broken) prompted me to wonder how easy (or hard) it is to generate a random integer between 1 and 100 in as many languages as I could.
Of course I used Google and the sites it found for me to come up with these methods.
Generating random numbers is important in programming, and it's very important that those numbers be truly random. That's why the problem with JavaScript's random numbers seems so serious, especially with JavaScript's ubiquity not just on the client (where it's carrying a heavier load than ever) but now the server via Node.js.
So you want to generate a random number between 1 and 100? Here are n ways to do it:
Random numbers in various computer languages:
Use node to run this line in your terminal (you do have node installed on your computer, right? If not, you should):
Math.floor(Math.random() * 100) + 1
It's even easier in Ruby (use irb to run this in the console):
rand(100) + 1
In Python, it takes a couple of lines. You can run this in the python console (type python at the command line, then start typing your commands):
import random
print(random.randint(0,100))
I have been experimenting with Groovy, a dynamic language that uses the JVM (the Java Virtual Machine). If you have Groovy installed, start the graphical Groovy console with the command groovyConsole.
Math.abs(new Random().nextInt() % 100 + 1)
While Perl doesn't have an interactive shell like Ruby and Python, you can run a one-liner from a terminal using the perl command. Here is a random number between 1 and 100 in Perl:
perl -le 'print int(rand(100)) + 1'
You can also do it in the Bash shell with $RANDOM:
echo $RANDOM % 100 + 1 | bc
Analysis: Ruby offers the easiest, most elegant way to generate a random integer from 1 to 100 with a one-liner. But you can do it in most every dynamic language.
Notes: I'm sure this can be done in a Perl one-liner
The ideal is a free, open, federated social-media platform like Identi.ca or Status.net, but even those services, when run by others, are subject to a certain bit rot. They're here today, but will they be tomorrow?
We live in a world of mega-services like Twitter and Facebook. Multi-billion-dollar important companies. And in our zeal to communicate, we spend hours creating free content for them in exchange for free service.
Still, they offer value. If the few people we want to share our thoughts with also subscribe to a given service, there is value. That's how Facebook grew.
On Twitter, I can tell you that having 900 followers does not provide a lot of eyeballs for my tweets. I'm lucky if 40 people see them. Twitter is all about the now. A tweet's sell-by date is maybe a half-hour after it's created.
I think short, social-media-style updates are valuable.
But I want them to be my own. I have that, pretty much, when I create them through my blog and distribute to social-media services from there.
From my laptop, I'm about 90 percent of the way there. I'd like sharing links to be a little more automatic. Like on mobile devices. Android has "intents." Apple has the same thing, but I don't know what they call it.
And mobile is the place where I have the furthest to come.
If I were using WordPress, I bet the WP app for Android (and iOS, too) hooks into "intents" and allows link sharing.
But I don't use WordPress.
My Ode blog works off of a traditional filesystem on the server. There is no database. Create files, and with a few tweaks and pokes, you have a live blog entry.
I don't want to go back to a database. Flat files on a server is not just Ode's but every static-blogging tool out there's killer app.
So what I need is a mobile app that hooks into "intents" to allow link sharing and produces the files I need, gets them on the server and does what I need to make those files appear on the live site.
It shouldn't be too difficult. (Famous last words.)
It's what's driving me to learn Java and Android development. That and everything else.
Having a problem to solve and making something to do that. What could be better?
Every take one of those personality-type tests?
I did. Turns out I'm an INTP:
INTPs are independent, reserved, and live in a world of ideas. They can work well on a team but prefer to work alone in sporadic bursts of energy.
Although private, INTPs can at times seem totally outspoken because of their directness of communication and economy of words.
Other people may assume that INTPs say very little, but this is only when there is nothing to say. The general chitchat of social life is not for them.
They prefer to speak only about areas that interest them, things they consider important.
I run a lot of stories about package thieves, people who either trail delivery vehicles carrying packages from Amazon and scores of other online retailers and grab the goods, or who just troll neighborhoods looking for boxes already on doorsteps and then drive up, take the booty and drive away.
Many of us are ordering more online than ever. We got Amazon Prime and have really stepped up what we have delivered to the house by various couriers -- USPS, UPS, Fedex, OnTrac, Amazon contractors, and probably others.
So what do we do to keep those packages from being targeted by thieves?
You can always get the packages sent to your office, where delivery is usually made to an actual person. I've use this method sometimes, though not as much as I used to when I only made occasional orders.
That aside, I think we need a better solution for home package delivery.
What I'm thinking of is some kind of large, secure box that you can bolt to your front porch. If it can be designed so items can be placed into the box but not easily removed without a key, that would provide an extra measure of security for home delivery of items that can fit into the box.
I'm sure there is already a commercial product that does this very job. I'll look around to see what I can find. If you know of something that fills this role, let me know about it.
I'm in one of more than a few places I've been in recent days with my laptop but no Internet connectivity.
I can write an Ode entry with no problems. This would be just as true for the many static blog engines that are if not all then at least some of the rage among the more geeky bloggers out there.
Like I'm doing write now, all I have to do is use my favorite (or any available) text editor, write into a file and upload it to the server later.
And in my case, I have helper applications (chiefly Unison) and short scripts that make those uploads virtually automatic when I do.
Fedora 23 has been out for awhile and I haven't yet upgraded the HP Pavilion g2-2210us laptop I've been running and upgrading since I first installed F18 on it in mid-2013.
One reason I'm not upgrading, though under examination illogically, is that Fedora 22 is the best-running, most "stable" release I've ever run on this now-2 1/2-year-old hardware.
One of the biggest holes in web-based collaborative editing software like Google Docs (and Microsoft's Office Live Word Online - I checked) is the inability of the programs to allow the conversion of a block of lower case letters to upper case and vice versa.
You'd think this would be core functionality. Knowing what I do of programming, most languages provide utilities/methods that do this very thing. And pretty much every "local" text and/or document editing program offers this as core functionality.
So why don't Google Docs and Microsoft's Word Online offer it?
Beats the hell out of me.
I got annoyed enough that I set out in search of Google Docs add-ons to bring case-changing capability to the editor I'm using every damn day for work.
The add-ons were not hard to find or install. I decide on Change Case by Alec Tutin.
It does exactly what it's supposed to do, and that's good enough for me. If you use Google Docs with any degree of seriousness, you NEED this add-on.
I rebuilt our Dismaster faucet about a week ago, a couple of weeks after a washer-assembly replacement failed to stop it from leaking.
That's because the valve seats were shot. I have never replaced the valve seats before, mostly because I had no idea how to get the old ones out.
The Dishmaster is designed like no other plumbing fixture I've ever worked on. Not that my experience is so vast.
The washers are mounted on plastic assemblies that snap on to the valve stems and turn freely on them. That enables the washers to make a tight-enough seal against the valve seats without grinding when you continue to turn them (unless you turn them a whole lot).
It kind of, sort of mimics the feel of a ceramic-disc faucet while still using a rubber washer against a metal valve seat.
A couple of weeks ago, I pulled the valve stems and replaced those washer assemblies. Not as cheap as regular washers by a long shot, but not a total deal-breaker, pricewise, either.
When that didn't work, I knew I had to figure out how to replace the valve seats.
First of all, I couldn't find the Dismaster M76 model's valve seats at any of my local plumbing or hardware stores. I had to order them. I got them from Casler Hardware, where the prices were good, though the shipping costs were high. Prices were higher [direct from Dishmaster], but I was more confident that Casler would ship quickly, so I chose them for this particular order.
Once you get the valve seats and the all-important Union O-rings that seal the faucet at a critical point, you can read the instructions, or just [see them on the Web].
You remove all of the outside parts of the faucet, then unscrew it from the back at what are called the unions, I believe.
Then you use a hex-key wrench to remove the valve seats from behind instead of the usual way (from in front with a valve-seat wrench). Curiously, the valves seats hold in the bolts that join the front of the faucet to the "unions."
Librarian and Linux user and advocate Steven Ovadia of the excellent My Linux Setup blog is writing a book, "Learn Linux in a Month of Lunches," available now in "early-access" form from Manning and as a full book sometime in summer 2016.
Steven's blog is an excellent resource, and he's a pragmatic advocate for free software who does a lot of good.
And in contrast with the early 2000s, when there seemed to be new Linux/Unix books every month, we are in a persistent drought when it comes to how-to books about Linux and related technologies.
So I think "Learn Linux in a Month of Lunches" is just the thing new and prospective Linux uses need to help them make the move from Windows and OS X to the freedom and flexibility offered by Linux and its many distributions.
You can get the first six chapters of the book today in electronic form, with additional chapters delivered as they are ready. It sounds positively Dickensian (in the novels-delivered-as-monthly-parts way, not in the children-working-in-a-bootblacking-factory way, to be clear about it).
The Hulu video service -- which really, really wants you to pay them money instead of watching for free -- is not easy to watch in Linux.
They require the HAL library, something Linux hasn't used in years.
There are plenty of tutorials on how to get Hulu working in Ubuntu, but fewer for Fedora.
It's pretty easy to get it so you can watch Hulu in Fedora (version 22 in my case).
You do this:
fakehal package available hereIt's as easy as that. Video quality was good on Firefox. Now that I can watch Hulu successfully in Fedora, I am more inclined to subscribe.
Netflix: While Netflix doesn't have this problem, on Linux you have to watch in Chrome and not Firefox. Call it #confusing.