Mobilization

by Joel Limardo

Software Developer and IT Professional

Chicago, IL

joel@joellimardo.com

SIP Phone (researching...)

Workadventure Workadventure (researching...)


Downstream Project Status

BixChange

33%

LIMSExpert.com

28%

Upstream Projects

Joellimardo.com Project Cleanup




Wed, 17 Jan 2024

GUIs in Perl

Have to start with Perl/Tk simply because it was the first one I started working with. Also, interfaces in Perl/Tk are on the unsightly side **but** look about the same as an Emacs interface so why not put a few things in there?

Super-quick spec of things I want to do:

  • Simple windows using Perl/Tk
  1. Installation
  2. Hello World
  3. Planning

  Up

/technical/upstream/perl/gui Permanent Link Project Sitemap Top  

Form Planning

It is tempting to just start writing code. However, you wind up with a great big mess. Here is PlantUML's Salt that can make the form visualization process go a bit smoother.

  Up

/technical/upstream/perl/gui Permanent Link Project Sitemap Top  

Hello World

There is an online Perl::Tk tutorial I'm going to utilize as well as just the standard Perl::Tk perldocs for these.

#!/usr/bin/perl -w
use Tk;
my $mw = new MainWindow;
$mw->minsize(400,300);
my %formElements = ();
$formElements{'button1Text'} = 'Quit';
$formElements{'label1'} =
$mw -> Label(-text=>"Hello World") -> pack();
$formElements{'button1'} =
$mw -> Button(-textvariable => \$formElements{'button1Text'},
-command => sub { exit })
-> pack();

$formElements{'button2'} =
$mw -> Button(-text => "Change",
-command => sub { $formElements{'button1Text'} = 'Donkey'})
-> pack();
MainLoop;

So here I created a simple form based on one of the site examples but made it a) a better minimum size rather than a very small popup with only a button on it b) added an additional button c) made the second button change the text of the first when pressed.

The standard beginner examples often skip past the fact that you can use -textvariable rather than just text and point that to a variable.

  Up

/technical/upstream/perl/gui Permanent Link Project Sitemap Top  


Tue, 26 Dec 2023

GUI Install on Mint

I forgot what I needed to install to get Perl/Tk to work on my Mint machine:

  • sudo apt install tcl
  • sudo apt install tk
  • sudo apt install libx11-dev
  • sudo apt install libpng-dev
  • sudo cpan Tk

/technical/upstream/perl/gui Permanent Link Project Sitemap Top  


Wed, 15 Nov 2023

Oops My Bad

I was hosting this site with a company that might have gone kaput recently. I was waiting for them to resolve their issues but the server never came back up so I have switched services (note that I have lost a bit of content...it is somewhere on a backup drive...).

/technical/alpha Permanent Link Project Sitemap Top  


Sat, 03 Jun 2023

Setting Emacs Windows in Code

(defun draw-up-windows (datFile)
(interactive "sPlease enter the package .DAT name: ")
(progn
(split-window-right)
(other-window 1)
(split-window-below)
(other-window 2)
(find-file datFile)
))

Above I define a function that asks the user for a file name, splits up the windows, moves around between them, and finally loads the file. For a very long time I have been doing this manually every time I open Emacs. I know there is a way to store these layouts to a file and restore them but I would rather just use code.

/technical/upstream/emacs Permanent Link Project Sitemap Top  


Sat, 13 Aug 2022

Perl Synopsis++

The Perl modules I am attracted to for some reason work but then mess up in strange ways. I install them with the highest hopes that everything will work out fine only to have to modify the code in some way. The purpose of my writing here is then not to teach you Perl or to parade the Perl language as being inherently better than anything else but rather to demonstrate when/how this happens and steps that I take to either work around these problems or fix them.

If you are an author and find something on this site misrepresents your module (for example if I am being incredibly stupid about using it or setting it up improperly) you can find my contact information on this site. Your help is actually very welcome.

Currently working on:

/technical/upstream/perl Permanent Link Project Sitemap Top  

Perl REPL

I was looking for something online and ran into a piece that said Perl did not have a REPL. I was a bit surprised about this and almost immediately thought, 'but we have the debugger...'

But the debugger (perl -de0), even on Linux, is not an ideal REPL environment. I figured I would look around online and found some Perlmonks stuff about Term::Readline::Gnu but I got to thinking, 'geez...you have to install a module to do this?'

perl -e 'while(<>){exit if m/^quit$/; print eval($_) . qq~\n~}'

I really just want to do something like that. Read in a line, execute it, probably store the line so I can go back and look at it, and keep on going. The previous one liner is quirky.

/technical/upstream/perl Permanent Link Project Sitemap Top  


Fri, 12 Aug 2022

GraphViz::DBI

This is a bit more experimental. I want to just show the database graphically as a big PNG file just for comparison I guess. Looking at the pod however I realize that this module is fairly old and when I try to run it I get weirdness:

perl -MGraphViz::DBI -MDBI -e 'my $dbh = DBI->connect(qq~DBI:Pg:dbname=test;port=5432;host=localhost~,qq~me~,qq~afairlystandardpass~); GraphViz::DBI->new($dbh)->graph_tables->as_png;
DBD::Pg::st execute failed: ERROR: permission denied for relation _pg_foreign_tables at /usr/local/share/perl/5.26.1/GraphViz/DBI.pm line 73.
DBD::Pg::st execute failed: ERROR: permission denied for relation _pg_user_mappings at /usr/local/share/perl/5.26.1/GraphViz/DBI.pm line 73.
DBD::Pg::st execute failed: ERROR: permission denied for relation transforms at /usr/local/share/perl/5.26.1/GraphViz/DBI.pm line 73. ...

Looks like some kind of special permissions are needed to view lots of these PostgreSQL tables/views. I am confronted with the decision to delve deeper into the problem or simply dump this module for something else.

Updates

Note: this uses Javascript to open these sections. I will eventually update this with just a POD or something. In the meantime you can just view this stuff using the Lynx browser with the permanent link below if you have Javascript turned off.

I wrote this in an earlier post but lost it due to server problems:

perl -MGraphViz::DBI -MDBI -e 'my $dbh = DBI->connect(qq~DBI:Pg:dbname=test;port=5432;host=localhost~,qq~usr~,qq~pss~); my $gv = GraphViz::DBI->new($dbh); $gv->{'tables'} = [qw~db_version customers~]; print $gv->graph_tables->as_png; ' > out.png

  Return

/technical/upstream/perl/dbmanage Permanent Link Project Sitemap Top  

IO::DB

Normally you would Install via:

sudo cpan -i IO::DB

When I try to install this way on 5.26.1 I get all sorts of errors due to the module dependencies. Turns out that this module relies on another called Class::HPLOO::Base that will not install. Apparently that module has not been updated in a while since the compile operation says certain syntax was deprecated in earlier versions of Perl.

This does not really mean I should totally avoid using this module. I just need to manually install it (or use force) and disable the so-called 'nasty bits.'

Every once in a while I get a kick out of trying to install a module manually anyway to see its dependencies (the IO::DB archive is called SDP-0.1.tar.gz). I then scoop out the module after running Perl Makefile.PL from the /lib directory and copy it to where I want it.

Give the module a quick test,

perl -e 'use lib qq~./~; use IO::DB; print 1;'

Or if you use:

cpan get IO::DB
... (get this from your ~/.cpan directory)
tar -zxvf SDP-0.1.tar.gz
cd ./SDP*/
mkdir ./olib
perl Makefile.PL PREFIX=./olib
make
make install
mv ./t/pod-coverage.t ./pod-coverage.t.skip
prove -b t

This will pass the basic tests. The pod-coverage.t only checks to see if the module documentation is complete. If you can read Perl this should not stop you from using the module.

Updates

Note: this uses Javascript to open these sections. I will eventually update this with just a POD or something. In the meantime you can just view this stuff using the Lynx browser with the permanent link below if you have Javascript turned off.

In order to extend tests why not just actually extend the tests? I copy the 00.load.t to 01.me.t and add the following to it:

use Test::More qq~no_plan~;
BEGIN {
use_ok( 'IO::DB' );
}
ok ( ( 1 == 1 ) , 'Basic test' );
my $db = new IO::DB( { db_dsn => 'dbi:Pg:dbname=test',
db_user => 'dynuser',
db_pass => 'pppaaassss' } );

my $rows = $db->sql_rows ('select count(*) as cnt from foo' );
ok ( ( $rows > 0 ) , 'Basic select count ' );
#warn $rows->[0]->{'cnt'};
ok ( ( $rows->[0]->{'cnt'} > 0 ) , 'Actually returned SQL count is correct' );

Most of this stuff is copied from the basic POD in the module. I just want to make sure it works with PostgreSQL. I think the author shows it using Sybase.

TBD

TBD

  Return

/technical/upstream/perl/dbmanage Permanent Link Project Sitemap Top  

Database Management

Here I am talking about modeling a DB and DML statements to control its formation. There seem to be lots of different ways to access your data (which is important as well if you are to work with your database) but utilities for managing the database is what I am looking for here.

Super-quick spec of things I want to do:

  • Create a table, view, and stored procedure all from the interface
  • Build some kind of utility that will allow for whatever structures to be identifiable to the program in a kind-of database agnostic way (I see various methods for accessing system tables being used which is not portable)
  • Control with field-level granularity a user's access to CRUD according to some kind of access control list (ACL),
  1. Data Access/Manip: IO::DB, SQL::Load, SQL::Abstract
  2. Structure Visualization: GraphViz-DBI

  Up

/technical/upstream/perl/dbmanage Permanent Link Project Sitemap Top  


Wed, 27 Jul 2022

Emacs

I was talking to a younger person and then, out of the blue, he asks, "pico or nano?" I had no idea what he was talking about. Then it hit me -- those are the so-called 'newer' editors that come included with modern Linux distributions. I was pretty quick to say that my first activity with a distribution is to check if emacs is installed. If it is not, install it, and then subsequently change the EDITOR in the shell by updating ~/.bashrc or something similar.

So my posts here are typically going to be about me watching someone struggle writing code in some way with one of these newer editors and respond with 'how you could have done this in emacs.'

  1. Setting Emacs Windows in Code

/technical/upstream/emacs Permanent Link Project Sitemap Top  


Sun, 20 Feb 2022

Wireframing

Let me first add my disclaimer: I am not a web designer! As a software developer/support person I frequently have to lend a hand on web design projects. I noticed that people seem to have forgotten the art of using wireframes in design. A web search reveals a host of tools but this tutorial will not use any of them -- just a few HTML pages and a PNG file called 'crosshatch.png. '

This tutorial is about several things:

  1. How to work strategically rather than haphazardly
  2. Architecture comes first, then detail
  3. You need a gallery of inspiration
How to work strategically

If you immediately start writing HTML when you start a web project my guess is that you have virtually guaranteed a certain degree of rework. I would go into reasons for this but I want to keep this tutorial short. When starting a heavily visual project like this it makes sense to start with gallery of pictures of some kind. I recommend starting with printable wireframe pages from the Sketchize website to start and graduate to digital ones. You can also start with paper and scan or take pictures of your hand drawings, put them in GIMP, add a layer on top and go to town.

In our case I skipped that because I am re-implementing (borrowing/copying) from two designs I lifted from a nice book on typography titled Type in Use, Effective Typography for Electronic Publishing (circa 1992) by Alex White. But normally I would have started with the hand-drawn wireframes and then looked for bits and pieces of inspriation from design books, scrap books, other websites, nature, dreams, whatever.

This is an example of working strategically as opposed to working organically. Here we start with one big thing that we are going to refashion into smaller, different things. If we worked organically we would collect a bunch of things and try to put them together in different ways. The organic way creates stunning designs but takes longer and oftentimes lacks consistency which is why we are not using it here.

Architecture comes first, then detail

I took a generic flex-based wireframe from W3C and replaced all of the images with a generic crosshatch image. That was my base and is what we call using the 'kitchen-sink' approach. A base design like this as a starting point has some of everything in there just waiting to be replaced. The idea is that it is easier to remove bad stuff then to correctly add good stuff.

I'm going to turn that core wireframe into separate, different wireframes for the different pages but first I need to do some high-level organizational work. I need a project index page. This can include pretty much anything but it should have easy access to a gallery of images that you are basing your wireframes on and other important information like when this project is due, what it is called, etc.

You need this to prove that your design is going from abstract to detailed. You can use whatever tool you want so long as it accomplishes that task -- any page in the design should be mappable to higher level abstract templates. This guarantees that you do not copy designs from previous/other projects as-is; you know exactly where things are coming from, etc.

At this point I copied the core wireframe.html to two different wireframes called wireframe-joker.html and wireframe-divine.html. For this website every page must be a child of one of these wireframes. If I have content that will not work with either of these I have to create another wireframe. That wireframe's parent will be the core wireframe.html. We have the gallery of pictures at the bottom of the page because that core wireframe was chosen based on an intersection of the gallery's needs. Everything must come from somewhere.

The next steps were largely mechanical: I make modifications to the CSS in the wireframes and throw out images that I do not need. I replace those with DIVs, lorem ipsum text, whatever is needed. How to write HTML and CSS is beyond the scope of this post but you can learn a lot about flexbox and media queries from W3C. Go back to the project index and click on the links for the different wireframes (Wireframe #1 and Wireframe #2) to compare with the links next to them and gallery at equivalent at the bottom of the page.

You need a gallery of inspiration

This brings us to the draft pages, joker.html and divine.html. They are early drafts. They do not have any color schemes, real images, the font choices are cruddy, and the text is all lorem ipsum. But at this point my programmer-mind is screaming, 'put all of this stuff in version control!' The use of version control geared toward web-design folks is forthcoming but will not be in this article.

Instead be content with resizing the page elements and trying these out in different devices to make sure that they still look okay. If they don't you'll tweak the media queries, particularly the size of items or change the display to none. Only after you have done that should you continue to polish off the last elements like images, fonts, etc.

Let me quickly make a note about copying. If you feel bad about starting with a generic W3C (or other standard) template then feel free to make your own and base your entire design on that. However, the other aspects of this article remain in force. That is, your designs cannot spring from the ether. In fact, many people who claim 'divine inspiration' for designs are actually responding to promptings from their own subsconscious minds to copy something that impressed them (including art from other living, breathing individuals). This methodology is at least honest about these inspirations.

I am ending this here. The gallery at the bottom of the project index page is the target for your final stages. Keep modifying the design until it looks as close to that as you want to get.

/technical/downstream/tutorials/wireframing Permanent Link Project Sitemap Top  


Sun, 13 Feb 2022

Please Don't Police Algorithms -- I Mean Math

I saw a video on Netflix called Coded Bias which discussed an MIT researcher's discovery of bias in face recognition technology. The title of the film itself was a problem -- 'Coded Bias' -- because it is possible to create similar results in machine learning systems without writing code at all. It can be accomplished by simply feeding the system improperly constructed datasets.

So as a programmer I am appalled that we were implicated in this so someone could sell the rights to this film. Shame on you those who knew better and allowed for this to happen. The less provocative title of the movie should have been 'machine learning bias' or 'weak dataset collection' but that doesn't fuel the alarmist in us so my guess is that it failed to make the cut for that reason. People in this field are not well understood and that makes them easy targets for sensationalist films.

Computers Only Know What Somebody Tells Them

Think of bad machine learning this way: Three very small researchers all want to know how to identify elephants. They approach one using their own tools and report their findings (the data). One says an elephant is a gigantic ball because he approached the animal from the rear. Another says it is long like a snake because he approached it from the front. Still another says there is no such thing as an elephant because he was given the wrong coordinates and wound up at a nearby health juice bar. If you take one, two, or in this case all three perspectives you might still have the wrong description of an elephant.

When machine learning 'gets it wrong' it isn't because it was coded that way but potentially for several reasons: a) it was fed poop-quality data b) somebody either lazily or purposefully omitted important data to skew the results or c) the algorithms were being applied somewhere not originally intended. I get pretty impatient when I read online articles like this and right about now I would be asking, 'so what it the solution then?' Well, I must admit to wanting to come up with a novel approach to this but another person at MIT beat me to the punch. Marzyeh Ghassemi of MIT (wow, the same school) in her article in MIT News titled "The downside of machine learning in health care" not only frames the problem but offers the solution that has nothing to do with creating some type of new governmental regulatory agency (the term "FDA for algorithms" is literally used in the movie):

Ghassemi recommends assembling diverse groups of researchers — clinicians, statisticians, medical ethicists, and computer scientists — to first gather diverse patient data and then “focus on developing fair and equitable improvements in health care that can be deployed in not just one advanced medical setting, but in a wide range of medical settings.”

That's it.

Because of the way the economy works certain software packages get popular and widely used. Users of these systems must assemble and ask with some regularity for evidence that the product responds to suitable test data (in this case one must petition for the inclusion of data that includes various genders and races). We have non-governmental bodies that do this all the time -- notably the ASTM.

But This Article Was About Math

Right-o. It was. Specifically it was about why we shouldn't go about trying to police algorithms. For this I have to pull out an old book titled, Mathematics for the Nonmathematician by Morris Kline, Dover Press, 1967. The section of interest is buried at the end of 14-5 THE MOTION OF PROJECTILES FIRED AT AN ARBITRARY ANGLE:

...One could repeat the procedures pursued in the preceding section, using different initial velocities and angles of fire, and thus perhaps obtain answers to some of these questions. But the work would be considerable and still leave us with the problem of trying to infer a general conclusion from a number of special cases. The mathematician would not proceed in this way. He [...it was 1967...mankind was referred to as 'he' back then] would suppose that the initial velocity is an arbitrary value, V, and that the angle of fire is an arbitrary angle, A, and then study the motion with these arbitrary values V and A. He might thereby obtain conclusions about all such motions because his results would hold for any initial velocity and any angle of fire.

The previous quote precisely describes how algorithms are produced. They are abstractions derived from special cases which are then rigorously tested against more data (or against formal proving methods) to verify that they are indeed applicable to a wider set of cases.

This is why policing them threatens research, learning, and even human thought. Your data will likely not accompany the algorithm as it treks it way through the validation process. This is where computer science diverges a bit from other types of science. Published algorithms are almost always divorced from test data and used repeatedly in different settings for validation merely with a description of recommended applicability. A good example that people often do not even remember is the disclaimer that came with the first versions of Java warning users to avoid using the language and the virtual machine in settings where human life might be lost. People in computer science look for and read these descriptions and apply the code and/or algorithms accordingly.

So, for projectile trajectory we must say that it works for any initial velocity and any angle of fire but our description must include the caveat that we only tested it on our own planet -- it might or might not work on Venus for instance. The business of testing it on Venus is for the the next person to accomplish and publish their modification to include other planets or a basic warning not to use it at all anymore. This process goes on and basically forever.

Companies that want to commercialize technology will likely ignore these admonishments (they probably do not fully understand them anyway) and might rush a technology to market in hopes of recouping their considerable investments or to corner a market early before the tools actually mature. Whatever the reason -- the point is that algorithms are neither good nor evil -- they describe something abstractly and were developed under circumstances that simply need to be openly disclosed. This is one of those 'Frankenstein' type problems that has been created by science (like flurocarbons) and requires industry/science remediation before any discussion of government action should even take place.

/technical/downstream/reviews Permanent Link Project Sitemap Top  


Fri, 11 Feb 2022

Beginning...Again

This weblog is about learning by doing. I'm using a tool to build this site that automatically creates RSS feeds (not that anybody uses RSS anymore) for the individual folders. If you are interested in what I've written about PHP for instance you'll find an RSS file under php/index.rss. The same will hold true for every path endpoint. Another place to look would be @joellimardo on Twitter (Mastodon and other accounts forthcoming).

This site is not new. In fact it was originally posted over seven years ago. A few things have changed cosmetically but the most notable is that the paths have changed. I used to allow mixed case in the URIs and now I have reduced that all to lower case. So if you have a very old link it will no longer work. I could go back an write a bunch of rewrite rules on my server for handle this but that content is so out of date that you probably should not be relying upon it anyway as-is.

Why..Why...Why...

I started this log after following the recommendations given in a talk by Burton Rast for self-education: create a project with a deadline, commit to teach the subject to others (similarly with a deadline), [I'm presuming use what you've learned] and solve a real-world problem you're passionate about.

A Word About Originality

The previous version of this site confused some people. They would e-mail trying to figure out how it all worked and why I was posting these things. In one instance a reader thought I was copying online material and reposting it here. That is not the case. However, I may find some topic online that I may want to write something about. That is not copying. It is an essential component of discussion and is generally needed in order to further knowledge and understanding.

Like Lots and Lots of CliffsNotes®

Learning computing science topics means that you sometimes are exposed to information out of order, that is out of date, or that is contestable. This is why some posts here are terse and there is typically heavy emphasis on REPL (read, evaluate, print, and loop) interactive tools. The motto here is 'get it, try it, log it, and review it again later on.' Every effort is made to make material clearer upon review but during the upstream (explained below) process there is no time for that.

Upstream and Downstream

I borrowed some terminology from my days in petrochemicals -- upstream means raw materials; downstream means finished products. This site's technical content is broken down into those categories which means you should expect things in upstream to be particularly 'gritty.' You have been warned.

A lot of older content from the previous site was of the 'upstream' variety so it will now go under that folder from now on.

/technical/alpha Permanent Link Project Sitemap Top  

Upstream

Upstream projects are mini-learning projects that one can follow to get familiar with a technology. They should be easy enough to follow by going to a folder, reading/following the exercise, and then clicking on the Project button on the lower right hand side of the post. This will bring you back to the project page so you can click on the next one.

/technical/upstream Permanent Link Project Sitemap Top  


Sat, 21 Jan 2017

General Utils

  1. Profit Calculator

External Site Tools

  1. Scrum Reference Card - Scrum overview in a single PDF
  2. Board.net - Online collaborative document editing tool
  3. Planttext.com - Online PlanText UML Editor
  4. Git for Windows -- has bash!
  5. Gridulator - Make grids
  6. Emacs/Vi Commands Table
  7. HTML Validators

Samples From Posts

  1. Simple Calculator (from jQuery)

Useful Linux Commands

  1. wget --spider -r http://localhost
  2. wget --continue URL
  3. fc -l <some history #> <some history #>

Cool Other Sites

/technical/utils Permanent Link Project Sitemap Top  


Thu, 25 Jun 2015

Where to put research

In addition to the core goals of this site I'm going to switch to using two different types of files -- projects and info files -- to denote projects versus raw research materials. I tried to keep things in books but it is difficult to map what I've read to projects I'm working on, so I hope that this will work a bit better.

Info files will not show up in the projects drop down at the top of the page. In order to find these you'll have to refer to the site map.

/technical/alpha Permanent Link Project Sitemap Top