Skip to main content

Posts

Showing posts from 2020

Ruby IO - file pathnames for use on different operating systems

I had finished writing a piece of software in Ruby in for Linux and wanted to test it also on PC. Since the software involved reading in some data from files, I wanted to be sure that the pathnames could be handled on PC. In Lisp, this is handled with relative ease where it's possible to specify the subdirectory of interest, and the file(s) within that, and it's up to the Lisp implementation to handle the differences between different operating systems.  I was rather expecting something similar for Ruby (given its influence from Lisp), but to my surprise, the official documentation on the File class had no information that I could find as to how pathnames would be handled differently on different operating systems.  Then I looked at the docs for the Ruby IO class , and found the information there. It says: Ruby will convert pathnames between different operating system conventions if possible. For instance, on a Windows system the filename "/gumby/ruby/test.rb" will

My Brief Adventures in Neural Networks: Merely an interpolation system which cannot reliably extrapolate?

I used to think neural networks were a reasonably good technology, until I decided to try setting up a neural network myself. After some experimentation with neural networks, I dramatically reversed my stance. I now believe neural networks should not be in charge of any decisions such that could have life-or-death impact. Find out why below. Disclosure: These are my personal thoughts about neural networks based on my limited experience with them. I do not claim to be an expert in neural networks. First I'm going to propose a definition for a neural network: An interpolation system whose behavior becomes undefined when extrapolating beyond its training data. In simple language, "undefined" may be thought of as "random by human standards". OK, how did this definition come about? It all started when I desired to make a system for classifying fonts a year or two ago. Even Google Fonts had at the time very few parameters for manually finding suitable fonts. For pick

Linux software to look into from the Linux Mint Software Manager

 This is my personal list of software to look into. It's things that look interesting (to me) that are in the Linux Mint Software Manager. Note that this is distinct from the Synaptic Package Manager; however I assume that the Mint Software Manager is a curated subset of Synaptic. Artha - awesome-looking off-line thesaurus Treeline - tree-like custom data manger. Might work as a hierarchical note-taking app. For now though I'm happily using feathernote for that. Geekcode - fun personalized geekcode generator for signatures etc Singularity - looks like an intriguing and original game Laby - kids learn to program game with ants and spider webs Tuxtype - educational typing tutor game

Installing Academix Linux - how to fix it when installing hangs at configuring network

I recently tried installing Academix , a Linux distro aimed at schools and universities. The graphical installer seemed to work fine except that it would hang up whenever it got to the stage of configuring the network. It was able to correctly connect to Wi-Fi when given the Wi-Fi password during the install, but never moved beyond that. This problem was surprising to me, because when trying it out on live media I never had any problems with network connectivity. So I was blindsided by this issue coming up when installing. I reasoned that if I was having those problems, maybe others were too, and so I contacted the developers to ask how I should proceed. I received a very nice response quite quickly, mentioning that in my situation it would be best to install without a network and add it in later. For me, that meant specifying my wired connection (which wasn't connected) instead of Wi-Fi during the install. It couldn't establish a connection, but fortunately was still able to c

Button to reload the page and go to a section with a hash mark

While there are lots of ways to code it so a button reloads the page, it was hard to figure out how to do it in such a way that it goes automatically to a URL with a hash. So here is my solution that works, finally. Update - better solution: Here is a better solution, since the one below worked for me on any page except the domain root. It may be the way my CMS is set up or it may be the way my server is set up, or most likely I'm missing something fundamental about the way the function works. Anyway, the better solution I've gone with doesn't include the hash in the URL, but it reloads to the point the user was last browsing at, which for my purposes worked out the same as the hash. So here is the solution I'm going with for now. <button onClick="window.location.reload();">Generate New</button> The solution I put earlier (see below) did not work for me in all instances, but it's worth trying out. The initial problem I needed a button that user

How to center images horizontally using Grav

I've been playing around a bit with Grav. I was posing the question to myself: for the relatively simple use-cases I'm dealing with, could it possibly work for my purposes as an alternative to ProcessWire?  The problem I was initially dismayed to find that Grav uses Markdown as its editor, which does not offer native support for horizontal centering of anything (text or images). However, Grav offers some tweaks that help make it easier to do specific things you might commonly want to do. I tried writing a sample article, and I found that one of the hardest things to do was to center an image horizontally. And horizontal centering of images is something I would typically do in most of the articles I would write. So the lack of easy horizontal centering is a highly significant drawback IMHO (most people do want to center images in an article!) However, this issue is made up for by other things in Grav: the relative speed, ease and flexibility of custom theming and built-in suppor

Lisp is a lot more readable than you might first think

At first, Lisp just didn't seem very readable to me. And yes, by this I meant even my own relatively simple code. But as I programmed more and more in Lisp, things became more and more readable. Probably not a surprise, right?! But actually, Lisp is a lot more readable when you are used to it , than a lot of other languages when you are used to them. Let's take a look at how this is, with some examples. Lisp is very readable because of its function-oriented syntax. Lisp statements have the format (function arg1 arg2 ... argN) Thus, any statement must begin with the name of a function. This makes it easy to tell what's going on right away by simply reading left to right within each statement. Also, starting with a function name makes syntax errors extremely easy to spot. For example, let's take a look at this incorrect Lisp code: (12 / 4) Before even getting past the 12, it should be very clear that what's wrong here is that I'm trying to call a f

If you can shell script, you can Lisp

I've noticed from people's attitudes toward Lisp that many think it is an esoteric and difficult language to learn. Nothing could be further from the truth, but it does depend on what angle you're coming at it from. If you're coming from C, C++, Javascript, or even Python, then yes Lisp does appear impenetrable at first glance. But if you're coming from shell scripting (e.g. Bash or another Linux or Unix shell) - a skill which most programmers have used at some point - then Lisp is going to be very simple and very familiar for you to learn. You may be asking, how is this? Well, I'll demonstrate it with a couple of examples. I'm going to show you a shell command that takes the second column of a space-delimited file test.txt, sorts the resultant data, and shows the second item in the sort. cut -d" " -f2 test.txt | sort | head -2|tail -1 There is absolutely nothing remarkable about this, as you can see. The results of one command are bein

About Me

My photo
Vera
I'm a wife and mother. I don't have any formal computer science qualifications, or any religious qualifications. I have a PhD in biochemistry. This photo is of me, but is confusing for AI.