Home

Falling out.

Leave a comment

Chit chat

======

Again not much going on.

———————————————————

Tuxpaint can be good for drawing pictures, cartoons, and the like, but if we let it stretch it’s muscles there is more that can be done. Maybe use it as a sort of drafting program. A drawing usually has at least four views. They are the front, side, top, and isometric (roughly translated at an angle).  If you needed a simple step stool, you certainly can make a drawing to reflect that. In this case you only have a partial isometric, but the point gets across.

https://computothought.files.wordpress.com/2014/09/56985-stairs.png?w=400&h=222

Maybe you could do a floor plan:

A 3d object in 2d.

Then all the rest….

 

Circuit design.

 

Have fun.

———————————————————

Linux commandment: Thall shall not login remotely as root.

If your a good linux admin, you did this when you first set up the machine.

$ cd /etc/ssh
$ sudo vim sshd_config

Change the line that says permit Root login to no
/Roo
in vim should find the line quickly

# Authentication:
LoginGraceTime 120
# PermitRootLogin yes
PermitRootLogin no
StrictModes yes

Save and exit the file.

Restart the service:

$ sudo service ssh restart

——————————————————-

When I first made the following cartoon it was pretty much tongue in cheek. But really when you think about it, it is a blessing in disguise. What if you could localize a lot of the web you use a lot without having to use any bandwidth.

Actually we already do it with our local web server now that I think about it.

If you were a traveling chef you could go choose a food menu.
and from that menu, you could do several things. Such as use several calculators.
Such a a food conversion chart.
Or even have your recipe book with you.
And the neatest of all things you could have a virtual site from the same server to show your clients what they could have for dinner.
Is that not all awesome! All from that little server without having to go to the internet.

———————————————————

General steps for operating system upgrade.

1. Backup
A. Save data files and program settings.
B. Make a system image aka duplicate if possible.  (requires special software)
C. Get list of installed files.
2 Get operating system.
A.Traditional method.
1, Download new media. (up to several gigabytes.)
In some cases this could take several hours.
2. Burn new operating system to media.
3. Install operating system,
B. Ipxeboot. (MSWindows may require a special server, but Linux and BSD do not)
1. Boot with minimal media. (i.e. floppy, usb stick, or minimal cd)
2. Downloads and installs minimal OS for install control.
3. Downloads and installs the rest of the OS at the same time.
(optional on some OS’s you can install a basic system and finish the install
later)
3. Configure system.
4. Install any additional software third party or from OS vendor as needed.
5. Restore any data and settings if possible.
6. Back up to a new system image.
7. Test system
9. Make adjustments if required.

If you made that original backup, you can always restore the system back to the way it was if your new OS fails.

Examples of ipxe boot installs for linux http://www.instructables.com/id/Linux-hints-II/

———————————————————

Couple of definitions first. Some people may disagree with this.

Network hub: A network hub is a network device that a single network of the same  media types. but paths are intermingled (obsolete)

Network switch: A network switch is a network device that a single network of the same  media types. but paths are separated.

Network bridge: A network bridge is a network device that connects a single or multiple network segments of different media types.

Network router: A network router is a network device that connects multiple network segments of the same media types.

Now to get confusing. Many network devices can be a combination of the above. Take for instance what a lot of people call a router is actually a combination of of a bridge and a router.

These we all pretty much know about, but what if we wanted to connect some legacy devices such as dumb terminals so they would have virtual access to the network. Actually they are just acting as an extra keyboard and screen for the host system.

Now you have turned one system into four systems. Everything would pretty much be in the text only mode, but there are a host of programs available for this type of access.  Those older systems could be put back to use in a pinch.

  • Links2, lynx, elinks – internet
  • Bashpodder – audio podcast collector
  • Alpine – email client
  • Irssi – inter relay chat
  • Centerim – instant messaging client
  • Oleo or Sc – spreadsheet
  • Vim, emacs, nani, joe, or a dozen other programs – word processing
  • Antiword – deals with office based documents
  • Putty – secure accessing tool
  • Screen -multiple seesion tool
  • Ledger – accounting (seems to be based on gnucash)
  • gpm, mc, synaptic, sed, awk, sort, ncurses, bash ,ssh, wget, curl
  • Sqllite, mysql, psql, plus man other – databases
  • Hnb – outliner to organize ideas
  •  freebasic, gcc, python, pgp, pgp-cli, perl and etc programming language tools.
  • Too many to list here – games. (i.e ninvaders)
  • Moc, aplay, mplayer, cmis and may others – music players
  • Espeak or Festival – voice synthesizer.
  • Nget and may others – news readers.
  • Cdrecord – cd buring program.
  • wird – nice calendar tool.

Just think a Sega Dreamcast running netbsd could be a computer terminal.

You can get some rs232 to ethernet devices specific for this task, but for the price, you are better off getting a Raspberry Pi or the like Unless you want to use an old computer.  More ore information on interfacing at: http://www.instructables.com/id/Direct-connecting-two-old-fashioned-modems-or-te/

———————————————————

One of the things I like to do is port software from one system to another. That is take the source code of a program and allow it to work on another system. Why reinvent the wheel if yo u have something that works. Just because you have a new and different system should keep from using that software. Coming from a school that says within reason if it is not broke, do not fix it then you know what to do. If I have a perfectly working system why convert it to a virtual machine and not know what the challenges might be. If I did not have an existing system, then off to the races to build a virtual machine.

What is this all leading up to. With the terminated support of Microsoft Windows XP.  XP per se is no longer viable. Mainly because of security issues. Everyone says upgrade or chunk the system. Invested too much in the system to lightly just chunk it and like most upgrades old software just no longer works after the upgrade.  So using a virtual machine does not always work for testing old software to make sure it works before moving to a new system.

Had an application of which I moved over to a new system. Could not get the new software to work in the development environment. Thought maybe there was a problem with the software. If I had chunked the old XP system, there never would have been a way to test the software to make sure it work to begin with. Fortunately the software did work with the original system.

There lies the dilemma. How do you use the old system without causing problems for your network or the original system? Since the original system was not corrupted in any way, then all I had to do was just segregate it from the internet and any potential issues.

Well what would you need?  An extra router, a host machine with an extra network interface card aka nic, the XP machine, and the appropriate cables.  First you would set up the extra router with a different lan or network than the one that connects to the internet. Say “192.168.8.x”. This is to prevent any conflict and mixing of packets between the two networks. Hook you XP machine with the second router and the “192.168.8.x” network. Next hook the second port of the host machine to that second router. Set the host machine to get an ipaddress from that router. Make sure that the second nic is not joined in any way to the first nic. so the original nic will get it’s ipaddress from router 1.

[Note you could use a crossover cable and static ipaddresses, but that is not elegant enough for me.]

Once you have that setup and connected, you can set up sharing between the host machine and the xp machine via the second nic only. You should be able to work securely between the two systems.  So now if you need any files from the internet, you can download them to the host and then in a second step transfer the file to the XP machine. That may see like a hassle, but it is pretty easily automated.

Also for XP, if you needed some update, you can download administrative packages that can be installed without using the internet. That is the way we used to do it. Download the package and then have it run on all the machines at the same time, so upgrading many machines was not that much of a hassle.

Eventually I will probably either chunk or find another operating system for the XP amchine. But for the time being ROI (return on investment) can still be extracted from that system.

———————————————————

Blinking lights have been used on computers for years. What they mean varies from system to system.Manuals for the systems will hae documention on what all the variations mean.  Even on the home computer they most all have an led that signifies whether the power is turned on to the machine

Maybe we could attach led to a local computer and then they are lit could mean one of ervera things depending on how ht e system is programmed.. You could start off with just two leds that you give you four possibilities.  Back then there were no computer screens to get information.

You could even add even more light for more possibilities.The traditional way was to add led]s to the parallel port. Eight leds would give you 2^8 or 256 possibilities. Possibly more than you would ever need. First setup we did like this was for the Atari ST computer. The picture is using a 32 bit computer.

One could go a step further and instead of lights being on or off, a message could be sent in one form or another. A traditional choice might be to use something like the Morse code. You could use just use one led to get out the message. the message would be consecutive flashing of long and short lights. Since there is more than one version of the code yo would have to decide  ahead of time which version to use.

Once that is decide you sould have to decide how long for a dit (short flash( and a dah (long flash). or n alternative could be using two leds eith one lamp lidt for a dit and two lamps lit for a dah.

Though I might prefer the traditional method as it would lend it self to using. infrared signal between two systems. Then two systems could use the infrared as a backup if all other communication lines were not active.This is really tue if your monitor fails.

– …. .. … / .. … / .- / — . … … .- –. . / .. -. / — — .-. … . / -.-. — -.. . .-.-.-

———————————————————

Random numbers can be very important in games. No matter whether you use it for possible outcomes or graphics characters, you can have a bit of fun. If you look for the oracle on this blog, you can one way a random number can be used.

loop
Print a random ascii character to the screen sequentially without a linefeed.
until done.

First let’s consider freebasic to print out random characters to a screen to make the computer it has gone haywire, it is basically the same code. Some people used to use code similar to this on the old TRS-80 to confuse sales people.

for x = 1 to 2000
    Randomed = INT(RND * ((255 + 1) - MIN) + MIN)
    ?chr$(Randomed);
next x

Output finale:

Now let us look at how it might be done in C.

#include <stdio.h>
#include <stdlib.h>

int main() {
  int c, n;

  for (c = 1; c <= 1000; c++) {
     n = rand() % 255 + 1;
     printf("%c ",n); 
  }

  return 0;
}

Output finale:

In some ways the code for both look alot alike. Crequired a bit more information for the stup of the code..

———————————————————

 We are going to setup a simple flat file or two dimensional spreadsheet.

What do we want to do with the database

I. Design

Let us look at the data we might want to collect. Of course file names and the data we want to collect.

Simple database
Datafile: datafile            Metadata: metadat

Name    :
Address :
City    :
State   :
Zip     :

The data we want to collect is described in the meta data file. Sometimes called a data dictionary. With a data dictionary we ca write  a generic routine that will handle different data bases without having to write separate code for each one.

5
Name
Address
City
State
Zip
30
30
30
30
5
a
n
c
d
s

Which means we want five data fields known as Name, Address, City, State,
and Zip. The first four data fields can hold up to 30 characters  and the last one will only hold four, The next data fields will described by the kind of data it will hold such as n for numeric.

Dummy data:

Your name
1234 Street
Sometown
ST
12345

II. Build

With this database well need to look at the tools we need to create and alter the database. First is the organizer menu. Of course you will have to a database file to work with first.

(A)ppend       Add record.
(B)ehold        Examine and existing record with the option to alter a record.
(C)hange       Alter a record.
(D)elete         Remove a record.

III. Sort and extract

You will want to arrange the data in a meaningful order based on one of the database fields so that for a mailing list you might want to arrange the data by the name so that it is easier to look up data. The again you might want to arrange it by zip code to make mail outs easier.

Original list:

Tutuola
Benson
Hargraves
Tartican

New list:

Benson
Hargraves
Tartican
Tutuola

Even then you may only want a portion of the list say only last names that start with T

Newest list

Tartican
Tutuola

IV. Report

Lastly you will want to present the data in a meaningful form as a document for presentation as a printout or even an html page.

Headers

Body > Data

Footers

Notes
Etc

Mail merge is probbly one of the oldest reports.

This is it in a nutshell. Very much oversimplified, but you get the gist of it.

———————————————————

Here we want to interface an rc controller to a computing device so that we do not have to manually manage it. You can use all kinds of external sensors or just pre-program the computer or micro-controller for a specific task.You can use everything from robot arms to controlling RC models.

Computer/micro-controller interface Probably the easiest way to use a computer is to use the standard parallel port (not usb).

The micro-controllers are varied so you have to look for the digital type interfaces as to what to use. I.E. for the Raspberry Pi you would use the GPIO You will need to see the manuals as the pins vary between units even of the same vendors. But for the original Arduino  looks something like this:

The computer/microcontroller interface, uses 4 inexpensive npn transistors and 4 resistors.

RC controller You can disable the power lines, because you will be using the power lines from the interface. Took my controllers joystick portion from the unit for it to be easier to solder the control lines.

Even if you get this all set up, you will need software to control the computer and or micro-controller. That is  a subject for another post, There are tons of examples on the internet to be used as examples.

You could use the same idea to control other things with a bit more circuitry

———————————————————

No  longer spend time burning #linux cd’s. Do not need to do that anymore. You can even do the same thing with bsd. By the time you spend downloading the cd image and burn the cd, and then do the install, I can do an ipxeboot from floppy and have the job done. Though to save time sometimes I will do a minimal install and then later add whatever is needed. Done this even with a Pentium 1 to install Slackware 14.1. Pentium 2’s or better get Debian. Bought a Sony double speed usb floppy drive from a local office retailer for 5 dollars. Been a good investment.There is a rare instance when I can not install linux on a system, Floppies are not dead…. You can even use the virtual floppy images to load linux into a virtual machine. Search ipxe in this blog for more details..

Floppies can also load terminal programs or modem programs as we used to know them. Terminal programs will easily work on older equipment where the old fashioned rs232 ports (or an adapter for usb with emulation). This is done quite a bit with networking equipment such as routers and switches. It is also used with monitor free computers. for example. We have done this with the Nslu2 and the Pogoplug converted computers. You could also attach this type of terminal to your properly set up linux box, or server, and or desktop management from the command line. There is an article here in the blog on that setup also.

Last of all where network communication might be compromised, you can use a floppy disk to upload small but critical files.

All for now. (A floppy can be used like a ninja star….(tic))

 

———————————————————

Miss the good old trs-80 III. So do I even thought about trying to find a used one but this emulator popped up and is just the ticket.

You will need to create an html file that will start the whole process up.

TRS-80.html


<pre>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript" src="trsemu-1.4.js"&gt;&lt;/script&gt; 
&lt;head&gt;
&lt;body
onload="trsEmu.screen('scrn').button('btn').perf('graph').focus();"&gt; 
&lt;div id="scrn"&gt;
&lt;canvas width="512" height="384" style="background:black"&gt;
&lt;/canvas&gt;&lt;/div&gt;&lt;br&gt;
&lt;div id="graph"&gt;
&lt;canvas width="512" height="100" style="background:black"&gt;
&lt;/canvas&gt;&lt;/div&gt;&lt;br&gt;
&lt;input type="button"id="btn" value="Run"
  onClick="trsEmu.run('toggle');"&gt;
&lt;input type="button" value="Reset"
  onClick="trsEmu.run('reset');"&gt;
&lt;body&gt;
&lt;html&gt;</pre>

You will need to download the javascript code and put it the same folder that has the html.
$ wget http://people.cs.ubc.ca/~pphillip/trsemu-1.4.js
Then you will want to make a folder called tx in the same directory
go into the folder and download the following files:

$ wget http://people.cs.ubc.ca/~pphillip/tx/m3.png
$ wget http://people.cs.ubc.ca/~pphillip/tx/wdot.png
$ wget http://people.cs.ubc.ca/~pphillip/tx/red.png
$ wget http://people.cs.ubc.ca/~pphillip/tx/grn.png

Do not forget to change the ownership and permissions.

You should now be able to run the html file:

Installed on my web server:

Here are some notes to look at: Should work well from a web server,

What is this?

The TRS-80 Model III is an old 8-bit home computer. This web page emulates it using only Javascript. You’ll need a web browser with a fast Javascript engine. The latest (mid 2010) versions of Chrome, Safari and Opera will work well on a reasonably fast machine (2 GHz processor) Firefox will run, but not real-time, and IE is very slow (both should get faster within a year or so).
Click on the Run button to start the BASIC interpreter. You will need to press ENTER twice to get the actual BASIC ready prompt.
You can also try out a few other programs by selecting them in the table above. Note that the backslash (\) key is the TRS-80 clear key, needed to start Super Nova.
Oh, and, sorry in advance, the backspace button won’t leave the page because it is too useful for deleting characters. In fact, most short-cut keys won’t work as the emulator needs to intercept most key presses.

Technical Details

This emulator is really a testament to the extreme speed of modern computers and the astounding new Javascript interpreters. The combination can easily emulate the function of the TRS-80 running at 2 MHz. That’s well over 100,000 emulated instructions per second! The code here came from converting the C code my twin brother wrote for trs80gp into Javascript. That would have been easy except that he used features of C (like pointers) and I had to spend some time undoing all that cleverness.
Most TRS-80 games had sound effects by using the cassette port. But this emulator doesn’t have any sound effects because I don’t know of a portable way to play dynamically generated sound in Javascript.
I haven’t spent a great deal of time testing it although I’ve ran about a dozen different programs with no noticable problems.
It was a hassle to get the emulator running on a selection of browsers. Some didn’t support the <canvas> tag (IE and Opera) and the workaround version using CSS sprites required a horrific amount of fiddling. There’s a bit of VBScript in here to allow IE to load binary data using AJAX. And, finally, the key codes generated varies a bit from browser to browser. I could have used JQuery or some other library but doing it by myself was educational. (Although I’ll admit I haven’t tried to cover a very wide range of browsers at all). At one point the emulator did function using Opera for the Wii and the PS3’s internal browser–but far too slow to be usable. Owners of iPads or iPhone 3GS or better should be able to get the Cass? prompt going, again, a bit slowly.
About the keyboard. The original TRS-80 keyboard is somewhat different from contemporary PC keyboards and does not support as many keys. The emulator tries to map the key you press to the appropriate TRS-80 combination. The old BREAK key is available by typing ESC and the CLEAR key is available via backslash. Here’s the original keyboard layout with the shift keys. (Assuming you have a PC keyboard–but it should work pretty similar on a Macintosh)

TRS-80 keyboard layout
1  2  3  4  5  6  7  8  9  0  :  -  BK
 up Q  W  E  R  T  Y  U  I  O  P  @  lf rt
  dn A  S  D  F  G  H  J  K  L  ;  EN CL
   sh Z  X  C  V  B  N  ,  .  /  sh
           S P A C E B A R

Holding shift:

!  "  #  $  %  &  '  (  )  01 *  =  BK
 up Q  W  E  R  T  Y  U  I  O  P  `  lf rt2
  dn A  S  D  F  G  H  J  K  L  +  EN CL
   sh Z  X  C  V  B  N  <  >  ?  sh
           S P A C E B A R

Notes:

  1. Shift-Zero toggles between upper case only/lower case input. Use underscore on your keyboard to get this function.
  2. Shift-right arrow switches to 32 character wide mode.

Multiple emulators can be created on a page. Use trsEmu.mknew() to create a new emulator and then give it its own .screen(). You will have to deal with the focus, perhaps via an onclick callback. Run binaries with the trsEmu.run() command. Just pass it a URL fragment and it will load the executable from your site using AJAX. It supports the .cmd, .hex (zmac output), .3bn (system tapes) and .bas formats. The .bas format is just an ASCII text version of a BASIC program.
Version 1.3 added support for the .cas cassette tape format and binary basic programs.
The .run() command also works as a macros if the string contains one of the |, [] or {} characters. Here are the meanings (and look at this page for examples):

  • | resets the machine.
  • {filename} loads filename into memory (and executes if binary)
  • [count] delays for count frames.
  • ~ is ignored but forces macro mode.
  • other characters are typed literally to the keyboard.

For example, the following statement will reset, load foo.bas, and run it:

trsemu.run("|[1]_\r0\r[1]{foo.bas}RUN\r")

(Which, BTW, is done automatically when run is passed a string ending in .bas).

That’s all

———————————————————

#1

Admin hint for the day. Keep a list of mac addresses for the network interfaces., Reason I say this is that people will invariably want to use their own equipment on your network i .e. using your bandwidth among other things. Usually if you only use a standard type of network interface, you can go to the dhcp server and see the nonstandard nic mac address stick out like a sore thumb allowing you to pursue the matter further. If there are no oddball mac addresses, you can also compare all network connects against the existing database. If a nic mac address does not match, your off to investigate. You could exclude the non-standard interfaces, but on a public network that is not always practical.

If something nefarious was definitely going on, we would shut down the port at the switch. But then they would know you are on to them. Takes judgment.

#2

 

Have seen several articles about ow MSAdmins are balking about having to use the command line. It amuses me quite a bit. Not so long ago a company called Sysinternals (since bought by Microsoft) came out with a set of commands called pstools, psexec, and etc, At that particular time., I was working for a company that had a campus of several square miles. During the summer, doing sneaker support. could be a real challenge. With the Sysinternals software,you could add, remove, and change software all from one point without running around during bad weather days, plus it saved a lot of time.

Eventually the company I worked for eventually acquired gui based software that did pretty much the same thing but was godly expensive and tremendously not foolproof, The Issues may have been resolved by now, but I have not kept up with it. Left my employer not long after that.

It is interesting now that M$ is using that kind of command line methodology with their new servers. This makes sense because you can script aka make  batch files to not only automate many tasks but easily document exactly what is done. Easily repeatable and easily do it remotely. You can then take those files and easily edit them for other tasks. You can not really do that with the mouse aka gui environment

———————————————————

Went to run the nfl score scraper and notice that if did not run anymore.   Found a web page that pretty much does it for you. So you can get the scores from the command line.

links2 -dump “http://scoresline.com/scores.asp?Date=9/13/2015&F=NFL&#8221;

———————————————————

Admin hint of the day: Understanding permissions on linux at first can be unsettling. There are several applications that you can access on-line to make it easier. If you have your own server, you can setup the application there and not be dependent on the net.

For more information see: http://catcode.com/teachmod/

———————————————————

(Updated with correct code. copied wrong code!)

Ever wanted to quickly whether a web server is up without going to the web page. Here is a quickie static cgi-bin script to do that. You can even check not only on local servers but most any web server on the net. The lines that do not have an ip address are virtual hosts from the last mentioned IP address. You will need to refresh the page to get the latest status.

The code is written in PHP, so PHP will need to be installed as well as the cgi-bin directory enabled. Most lamp servers have this already setup. There are probably better scripts but this one was quick and dirty.

)corrected)

&amp;nbsp;&amp;lt;html&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;hr&amp;gt;
&amp;lt;center&amp;gt;
&amp;lt;h2&amp;gt;
Web Server status
&amp;lt;/h2&amp;gt;
&amp;lt;/center&amp;gt;
&amp;lt;hr&amp;gt;
&amp;lt;br /&amp;gt;
&amp;lt;table border="1" cellpadding="10"&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td&amp;gt;
Ipaddress
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
Site (and link)
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
Description
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
Server status
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td&amp;gt;
192.168.1.31
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;a href="http://oesrvr1"&amp;gt;Offshore Educators&amp;lt;/a&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
Old school site
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;?php
if (fsockopen('oesrvr1', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td&amp;gt;
192.168.1.32
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;a href="http://oeorgan1"&amp;gt;Offshore Educators&amp;lt;/a&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
New school site
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;?php
if (fsockopen('oeorgan1', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;

&amp;lt;tr&amp;gt;
&amp;lt;td&amp;gt;

&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;a href="http://www.myposgarage.com"&amp;gt;Myposgarage&amp;lt;/a&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
The store
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;?php
if (fsockopen('www.myposgarage.com', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td&amp;gt;

&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;a href="http://www.softserv.com"&amp;gt;Softserv&amp;lt;/a&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
Software development
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;?php
if (fsockopen('www.softserv.com', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;!--
&amp;lt;td&amp;gt;
&amp;lt;a href="http://www.myposgarage.com"&amp;gt;Myposgarage&amp;lt;/a&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
The store
&amp;lt;/td&amp;gt;

&amp;lt;td&amp;gt;
&amp;lt;?php
if (fsockopen('www.myposgarage.com', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?&amp;gt;
&amp;lt;/td&amp;gt;
--&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td&amp;gt;

&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;a href="http://www.www.thefoodhistory.com"&amp;gt;The food history.com&amp;lt;/a&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
Food history
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;?php
if (fsockopen('www.thefoodhistory.com', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td&amp;gt;

&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;a href="http://www.misslizziesworld.com"&amp;gt;Miss Lizzies world&amp;lt;/a&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
Womans world
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;?php
if (fsockopen('www.misslizziesworld.com', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td&amp;gt;

&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;a href="http://www.yourdrsmedicalrecords.com"&amp;gt;Dr's office&amp;lt;/a&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
Medical office
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;?php
if (fsockopen('www.yourdrsmedicalrecords.com', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td&amp;gt;
192.168.1.33
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;a href="http://oesrvr3"&amp;gt;Offshore Educators&amp;lt;/a&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
Nslu2
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;?php
if (fsockopen('oesrvr3', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td&amp;gt;
192.168.1.34
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;a href="http://archie"&amp;gt;Alarm&amp;lt;/a&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
Arch pogoplug
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;?php
if (fsockopen('alarm', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;tr&amp;gt;
&amp;lt;td&amp;gt;
192.168.1.120
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;a href="http://typo1"&amp;gt;Typo1&amp;lt;/a&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
Pxe server
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;?php
if (fsockopen('typo1', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;tr&amp;gt;
&amp;lt;td&amp;gt;
Secret
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;a href="http://www.google.com"&amp;gt;Google&amp;lt;/a&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
Search engine
&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;
&amp;lt;?php
if (fsockopen('www.google.com', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?&amp;gt;

&amp;lt;/table&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

———————————————————

What is for dinner”

So busy, I forgot to make it.

Good day!

Out of it

Leave a comment

Chit chat

———–

Been goofing off so there is not much to report.

———————————————————-

No matter what system you use or even if you do everything by hand, you will need a typewriter (editor), Filing cabinet (database), and an financial worksheet (spreadsheet). Everyone knows about vim, nano, and  for using as editor or word processor. If you have ever wanted to set up a filing cabinet or database, you probably have heard of Mysql (or one of the variants), Postgresql, or even Nosql.

What many people have not heard of is a spreadsheet for the command line.One interesting spreadsheet is called simply enough called sc. Some people may lead you to believe it will only support just numbers that is not true.

You can even get a help file with:

$ scqref > sc_commands



A:   This overview
B:   Toggle Options
C:   Set Options
D:   Cursor movement commands
E:   Cell entry and editing commands
F:   Line Editing
G:   File commands
H:   Row and column commands
I:   Range commands
J:   Miscellaneous commands
K:   Variable names/Expressions
L:   Range functions
M:   Numeric functions
N:   String functions
O:   Financial functions
P:   Time and date functions

There is even a tutorial you can use:

$ sc /usr/share/doc/sc/tutorial.sc

Though we like to use out own home grown spreadsheet called lizzyclc. Lizzyclc was created with Freebasic, so it is easy to update for adding new features.

Also the command structure is easier to follow for a new user.

Thats all..

———————————————————-

Server upgrades.

Upgrading the operating system on your home machine is a piece of cake compared to doing it in the server environment, Generally when you care changing a server os, you use a new systems so that if there are issues you can go back to the old system as a failsafe. There are always issues setup up new operating systems especially with hardware drivers, so dealing with that can be fun.

When you set up a new system the storage formats are completely different.   Some applications will balk at that, In some cases it could be just a permissions problem. Also network printers and input devices have to be set up. Remembering once when we went from Novell to NT printing out student invoices did not work or barely worked. The consulting company said it worked when they tested it, but never really did a mass testing. We ended up pooling printers to make things work well enough till a better fix was done.

To add to that scenario, you have to make sure the general permissions of files are correctly setup. For instance, years ago everything was locked down on Novell, Microsoft there was no real security, so you had to go directory, and file by file and change as needed.

There were always server applications that did not want to work with the newer systems OS applications could and will fail, This is especially true with specific permissions access.  You will need to make adjustments to allow your applications work in the new environment. . This was even true between versions of Microsoft servers. You would have to contact vendors for fixes and updates which on many cases the vendors were reluctant to do. In many cases you had to perform miracles on your own to make things work,  That led to issues, because vendors would threaten to sue you if you changed their software for copyright and or other violations.

Once you had that done, you had to go application by application to make sure the clients interacted with the server properly. This meant you had to completely revise your control (batch, shell, etc) files because the same scripts would no longer work anymore. Then you had to go to the clients and correct shortcuts to connect to the new control files. We usually just built a new image to work with.  Then there was the testing and retesting to make sure everything worked, That was just the tip of the iceberg.. Moving on, Of course, all this had to be done without the user ever knowing a change was made.  Being a software administrator is so much fun,

———————————————————-

Not so many years ago when I was a tech, needed to use the internet to solve a vital problem. The internet was allegedly down. Contacted the administrator (who had umpteen MSce certifications) who in charge of that area confirmed that the net was inaccessible because they were having problems. So I asked what I could do and the reply was nothing could be done.

Being independent as I am and not willing to give up so easily, I decided to tinker a bit.  Decided to go into the student CS lab and use one of the desktops as a test machine. Having set up a lot of the cabling and routers, was pretty knowledgeable of the systems, Fortunately also had systems admin rights also in those systems. Now for the tinkering,.

Logged into a system and immediately went to the ip settings. Dns server was down so, I used a public dns server in its place of the local dns server.  Could not get a ip address from that server, so I used a static ip address that would not interfere with the network if the local dhcp came back up. Saved the settings and restarted the system.

When the system came back up, I logged in and fired up the web browser. Guess what  There was now internet. Was able to get my research done that I needed. Then I reset the settings back on the system for normal use. More than one way to skin a cat. Never took the systems administrator very seriously after that. Actually I was a member of that same IT team.

———————————————————-

One of the simplest graphs I have seen can be done in bash. You will need a data file and a one line executable to extract the data from the file and then display it.

data:
Irene     10
Karen     37
Andreas   41
Beatrice  23

Code:
SCALE=1; WIDTHL=10; WIDTHR=60; BAR=”12345678″; BAR=”${BAR//?/==========}”; while read LEFT RIGHT rest ; do RIGHT=$((RIGHT/SCALE)); printf “%${WIDTHL}s: %-${WIDTHR}s\n” “${LEFT:0:$WIDTHL}” “|${BAR:0:$RIGHT}*”; done < data

Result:
Irene: |==========*
Karen: |=====================================*                       Andreas: |=========================================*
Beatrice: |=======================*

Another script:

 bar="=================================================="
  barlength=${#bar}
  i=0
  while ((i < 100)); do
    n=$((i*barlength / 100))       # Number of bar segments to draw $((i/2))
    printf "\r[%-${barlength}s]" "${bar:0:n}"
    ((i += RANDOM%5+2))            # i = percentage done
    sleep 1
  done
  echo

The you could get a bit more fancy with a bit of animation.

&nbsp;# !/bin/sh
#
# Bargraph_Generator.sh
#
# A DEMO 6 bit coloured bargraph animation for a default Bash and Terminal window on OSX 10.7.5...
# A simple Shell script to display an _AT_A_GLANCE_ real time analogue bargraph generator. It
# starts off with GREEN for OK, then YELLOW for warning and finally ending with RED for danger
# with a critical beep for values 61 to 63 inclusive.
# It assumes an 8 bit value being injected into the script which is then divided by 4 to give
# a 6 bit value which is 64 spaces width inside the Terminal. The DEMO uses a random number
# generator to give a representation of an 8 bit value so you can see it working...
#
# A shell derivative of my Python code:-
# http://code.activestate.com/recipes/577612-seven-bit-colored-analogue-bar-graph-generator-dem/?in=user-4177147
#
# To run, ensure the script is executable and change if required, then type from a Terminal:-
#
# xxxxx$ /full/path/to/Bargrapth_Generator.sh&lt;CR&gt;
#
# And away you go...
#
# Written in such a way that kids and newbies can understand what is going on.
#
# Originally written for a Macbook Pro 13 inch, OSX 10.7.5 using the default Terminal.
# It MIGHT work on some Linux variants but WAS intended for MacOS OSX 10.7.x and above only.
#
# The Terminal colours WILL be changed to Black background and Various foreground colours.
# It will NOT be returned back to its original state although it can be easily. If you
# need to rerturn back to default state then there are a couple of easy methods the
# simplest being type:-
#
# xxxxx$ reset&lt;CR&gt;
#
# And all will be corrected...
#
# Issued entirely as Public Domain and you may do with it as you please
#
# $VER Bargraph_Generator.sh_Version_0.00.10_(C)2012_B.Walker_G0LCU.
#
# Enjoy finding simple solutions to often very difficult problems...

# The required _varibales_ for ease of coding, these are the colours...
# White On Black.
WOB="\x1B[1;37;40m"
# Black On Green.
BOG="\x1B[1;30;42m"
# Black On Yellow.
BOY="\x1B[1;30;43m"
# Black On red.
BOR="\x1B[1;30;41m"
# Green On Black.
GOB="\x1B[1;32;40m"
# Yellow On Black.
YOB="\x1B[1;33;40m"
# Red On Black.
ROB="\x1B[1;31;40m"

# Set the pseudo 6 bit value to zero.
SIX_BIT_DEPTH=0

# Do a clear screen to White On Black.
printf $WOB
clear

while true
do
&nbsp;&nbsp; &nbsp;# Set up the screen per scan and prepare for the bargraph.
&nbsp;&nbsp; &nbsp;clear
&nbsp;&nbsp; &nbsp;printf $WOB"\n \$VER: Bargraph_Generator.sh_Version_0.00.10_(C)2012_B.Walker_G0LCU.\n\n"
&nbsp;&nbsp; &nbsp;printf " A horizontal, at a glance, coloured, analogue bargraph display for\n"
&nbsp;&nbsp; &nbsp;printf " a default Terminal inside OSX 10.7.5..\n\n\n\n\n"
&nbsp;&nbsp; &nbsp;printf "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 30&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 40&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 50&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 60"
&nbsp;&nbsp; &nbsp;printf $GOB"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +----+----+----+----+----+----+----+----+----+"$YOB"----+----+"$ROB"----+--\n"
&nbsp;&nbsp; &nbsp;printf $GOB"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "$ROB")\n"
&nbsp;&nbsp; &nbsp;printf $GOB"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +----+----+----+----+----+----+----+----+----+"$YOB"----+----+"$ROB"----+--\n\n\n\n"
&nbsp;&nbsp; &nbsp;# If the 6 bit value is 0, zero, do no more until printing the 6 bit value and generating another 6 bit value...
&nbsp;&nbsp; &nbsp;# Anything greater than or equal to 1 enters this conditional branch.
&nbsp;&nbsp; &nbsp;if [ "$SIX_BIT_DEPTH" -ge "1" ]
&nbsp;&nbsp; &nbsp;then
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;# If the 6 bit value is less than or equal to 46 then _plot_ the green section only.
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;# The '\x1B[12;8f' is the ANSI 'Esc' code that forces the print position to 12 lines by 8 columns.
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if [ "$SIX_BIT_DEPTH" -le "46" ]
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;then
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BARGRAPH=$GOB"\x1B[12;8f("$BOG
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;for green in $(seq 1 "$SIX_BIT_DEPTH")
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;do
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BARGRAPH=$BARGRAPH" "
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;done
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;fi
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;# If the 6 bit value is greater than or equal to 47 then print the green section and _plot_ the yellow section.
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if [ "$SIX_BIT_DEPTH" -ge "47" ]
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;then
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BARGRAPH=$GOB"\x1B[12;8f("$BOG"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "$BOY
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;for yellow in $(seq 47 "$SIX_BIT_DEPTH")
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;do
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BARGRAPH=$BARGRAPH" "
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;done
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;fi
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;# If the 6 bit value is greater than or equal to 57 then print the green and yellow section and _plot_ the red section.
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if [ "$SIX_BIT_DEPTH" -ge "57" ]
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;then
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BARGRAPH=$GOB"\x1B[12;8f("$BOG"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "$BOY"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "$BOR
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;for red in $(seq 57 "$SIX_BIT_DEPTH")
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;do
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BARGRAPH=$BARGRAPH" "
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;done
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;fi
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;printf "$BARGRAPH"$GOB"\n\n\n\n\n"
&nbsp;&nbsp; &nbsp;fi
&nbsp;&nbsp; &nbsp;# When the 6 bit value is greater than or equal to 61 sound a system error beep.
&nbsp;&nbsp; &nbsp;if [ "$SIX_BIT_DEPTH" -ge "61" ]
&nbsp;&nbsp; &nbsp;then
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;printf "\a"
&nbsp;&nbsp; &nbsp;fi
&nbsp;&nbsp; &nbsp;# Print the 6 bit value in White On Black...
&nbsp;&nbsp; &nbsp;printf $WOB" Random number generated "$SIX_BIT_DEPTH"...\n\n"
&nbsp;&nbsp; &nbsp;printf " Press Ctrl-C to stop the program...\n\n"
&nbsp;&nbsp; &nbsp;# Generate another 6 bit value as though from an 8 bit value...
&nbsp;&nbsp; &nbsp;SIX_BIT_DEPTH=$[($RANDOM % (256/4))]
&nbsp;&nbsp; &nbsp;# A practical lower limit for the sleep command is 'sleep 0.05'...
&nbsp;&nbsp; &nbsp;sleep 1
done

# End of Bargraph_Generator.sh DEMO.
# Enjoy finding simple solutions to often very difficult problems... ;o)

One step farther:

Or then you could use a built in program such as gnuplot. It is well documented and there are a zillion examples on the web.

Here is a simple data file:

# sample 2-column data file
# ————————-
1     1
2     4
3     9
4    16
5    25
6    36
7    49
8    64
9    81
10  100

The you want to fire up gnuplot

$ gnuplot

G N U P L O T
Version 4.6 patchlevel 0    last modified 2012-03-04
Build System: Linux i686

Copyright (C) 1986-1993, 1998, 2004, 2007-2012
Thomas Williams, Colin Kelley and many others

gnuplot home:     http://www.gnuplot.info
faq, bugs, etc:   type “help FAQ”
immediate help:   type “help”  (plot window: hit ‘h’)

Terminal type set to ‘unknown’
gnuplot>

Set a simple terminal for now

gnuplot> set term dumb

Now let’s use that data file

gnuplot> plot ‘2col.dat’

Or if you have Imagemagick installed you can get a bit fancier.

gnuplot> set term png
Terminal type set to ‘png’
Options are ‘nocrop font “/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf,12” fontscale 1.0 size 640,480 ‘

gnuplot>               set output ‘| display png:-‘

Then run your plot again

gnuplot> plot ‘2col.dat’ with linespoints

Try a different data file

1,    1,   2,   5
2,    4,   4,  10
3,    9,   6,  15
4,   16,   8,  20
5,   25,  10,  25
6,   36,  12,  30
7,   49,  14,  35
8,   64,  16,  40
9,   81,  18,  45
10, 100,  20,  50

gnuplot> plot '4col.csv' using 1:2 with lines, '4col.csv' using 1:3 with lines
gnuplot> plot '4col.csv' using 1:2 with lines, '4col.csv' using 1:3 with lines, '4col.csv' using 1:4 with lines


gnuplot>               set term png
Terminal type set to ‘png’
Options are ‘nocrop font “/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf,12” fontscale 1.0 size 640,480 ‘
gnuplot>               set output ‘| display png:-‘
gnuplot> set style line 1 lc rgb “red”
gnuplot> set style line 2 lc rgb “blue”
gnuplot>
gnuplot> set style fill solid
gnuplot> set boxwidth 0.5
gnuplot>
gnuplot> plot “data.dat” every ::0::0 using 1:3:xtic(2) with boxes ls 1, \
>     “data.dat” every ::1::2 using 1:3:xtic(2) with boxes ls 2
gnuplot>

 

gnuplot>               set term png
Terminal type set to ‘png’
Options are ‘nocrop font “/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf,12” fontscale 1.0 size 640,480 ‘
gnuplot>               set output ‘| display png:-‘
gnuplot>
gnuplot> set xrange [-pi/2:pi/2]; set yrange [-pi/2:pi/2]
gnuplot> set contour
gnuplot> set isosamples 100,100; set samples 100,100
gnuplot> splot sin(x)*cos(y) with lines palette linewidth 4
smooth palette in png: using 160 of 160 available color positions
gnuplot> pause -1

The sky is the limit have fun.
——————————————
Update:

Each script takes in a csv file as input and “plots” the values as an ASCII graph in the terminal. It’s questionable how useful this actually is, but it’s a bit of fun at least. The SCALE variable controls the amount of characters used for the width of the plot area (not including the table containing labels and values).
Simple: Plot Values of each item
input file: sales

january,140
february,29
march,26
april,54
may,72
june,86

output: ./vgraph sales


 Relative Value Chart
Name      Value (Max is 140)
____________________0_________._________|_________._________|100% (140)
january      140    |========================================
february     29     |========
march        26     |=======
april        54     |===============
may          72     |====================
june         86     |========================

Percentage graph using value and max for each item

input file: stock-list

apples,20,100
pears,40,50
cherries,100,150
mangoes,45,85
tomatoes,30,30

output: ./pgraph stock-list


 Percentage Chart
____________________0_________._________|_________._________|100%
apples       ( 20%) |========
pears        ( 80%) |================================
cherries     ( 66%) |==========================
mangoes      ( 52%) |=====================
tomatoes     (100%) |========================================

And the scripts…. They are both very similar, just some minor tweaks to make them do what I wanted.

vgraph

Relative Value Chart

Name      Value (Max is 140)
____________________0_________._________|_________._________|100% (140)
january      140    |========================================
february     29     |========
march        26     |=======
april        54     |===============
may          72     |====================
june         86     |========================


#!/bin/bash
#
# Value Graph (vgraph)
# Basic ASCII Graphing Tool
#
# Plot values and scale to max
#
# CSV format: Name, Value
#
# Awk isn't perfect at rounding.. .5 rounds down
#
# v1.1 sol@subnetzero.org

if [ -z $1 ]; then
        printf "Usage: pgraph [datafile]\n"
        exit 1
fi

# Set Vars
# FILLER and ENDDELIM are used for drawing bars.
ENDDELIM="="
FILLER="="
SCALE=40
INPUTFILE=$1
NAME=(`awk -F"," '{print $1}' < "$INPUTFILE"`)
TOTAL=(`awk -F"," '{print $2}' < "$INPUTFILE"`)

# Get Max qty for scaling
MAXQTY=0
for VALUE in ${TOTAL[*]}
do
        if [ "$VALUE" -gt "$MAXQTY" ]; then
                MAXQTY=$VALUE
        fi
done

# Make graph header and markings
printf "\n Relative Value Chart\n"
printf "\nName      Value (Max is $MAXQTY)\n"
printf "____________________0"
QTRSCALE=`echo "$SCALE / 4" | bc -l | awk '{printf("%.0f",$0)}'`
HALFSCALE=`echo "$SCALE / 2" | bc -l | awk '{printf("%.0f",$0)}'`
THRSCALE=`echo "$SCALE * 0.75" | bc -l | awk '{printf("%.0f",$0)}'`
LCNT=1
while [ "$LCNT" -le "$SCALE" ];
do
        case $LCNT in
                $QTRSCALE)      printf ".";;
                $HALFSCALE)     printf "|";;
                $THRSCALE)      printf ".";;
                $SCALE)         printf "|100%% ($MAXQTY)\n";;
                *)              printf "_";;
        esac
        LCNT=$(( $LCNT + 1 ))
done

# Draw graph bars
i=0
for ITEM in ${NAME[*]}
do
        # Print Category name in format along with info and bars
        LENGTH=`echo "scale=2;(( ${TOTAL[$i]} / $MAXQTY ) * $SCALE )" |\
                bc |\
                awk '{printf("%.0f",$0)}'`
        printf "%-12.12s %-6.6s |" "$ITEM" "${TOTAL[$i]}"
        BLOCKS=""
        while [ "$LENGTH" -gt "0" ]; do
                if [ "$LENGTH" -eq "1" ]; then
                        BLOCKS="$BLOCKS$ENDDELIM"
                else
                        BLOCKS="$BLOCKS$FILLER"
                fi
                LENGTH=$(( $LENGTH - 1 ))
        done
        printf "$BLOCKS\n"
        i=$(( $i + 1 ))
done
printf "\n\n"

pgraph



 ./pgraph.sh stock-list
max is 150

 Percentage Chart
____________________0_________._________|_________._________|100%
apples       ( 20%) |========
pears        ( 80%) |================================
cherries     ( 66%) |==========================
mangoes      ( 52%) |=====================
tomatoes     (100%) |========================================

#!/bin/bash
#
# PercentageGraph (pgraph)
# Basic ASCII Graphing Tool
#
# CSV format: Name,Used,Total (or Maximum)
#
# Awk isn't perfect at rounding.. .5 rounds down
#
# v1.1 sol@subnetzero.org

if [ -z $1 ]; then
        printf "Usage: pgraph [datafile]\n"
        exit 1
fi

# Set Vars
# FILLER and ENDDELIM are used for drawing bars.
ENDDELIM="="
FILLER="="
SCALE=40
INPUTFILE=$1
NAME=(`awk -F"," '{print $1}' < "$INPUTFILE"`)
USED=(`awk -F"," '{print $2}' < "$INPUTFILE"`)
TOTAL=(`awk -F"," '{print $3}' < "$INPUTFILE"`)

# Get Max qty for scaling
MAXQTY=0
for VALUE in ${TOTAL[*]}
do
        if [ "$VALUE" -gt "$MAXQTY" ]; then
                MAXQTY=$VALUE
        fi
done

echo "max is $MAXQTY"

# Make graph header and markings
printf "\n Percentage Chart\n"
printf "____________________0"
QTRSCALE=`echo "$SCALE / 4" | bc -l | awk '{printf("%.0f",$0)}'`
HALFSCALE=`echo "$SCALE / 2" | bc -l | awk '{printf("%.0f",$0)}'`
THRSCALE=`echo "$SCALE * 0.75" | bc -l | awk '{printf("%.0f",$0)}'`
LCNT=1
while [ "$LCNT" -le "$SCALE" ];
do
        case $LCNT in
                $QTRSCALE)      printf ".";;
                $HALFSCALE)     printf "|";;
                $THRSCALE)      printf ".";;
                $SCALE)         printf "|100%%\n";;
                *)              printf "_";;
        esac
        LCNT=$(( $LCNT + 1 ))
done

# Draw graph bars
i=0
for ITEM in ${NAME[*]}
do
        # Print Category name in format along with info and bars
        LENGTH=`echo "scale=2;(( ${USED[$i]} / ${TOTAL[$i]} ) * $SCALE )" |\
                bc | \
                awk '{printf("%.0f",$0)}'`
        PCT=`echo "scale=2;(( ${USED[$i]} / ${TOTAL[$i]} ) * 100)" |\
             bc |\
             awk '{printf("%.0f",$0)}'`
        printf "%-12.12s (%3.3s%%) |" "$ITEM" "$PCT"
        BLOCKS=""
        while [ "$LENGTH" -gt "0" ]; do
                if [ "$LENGTH" -eq "1" ]; then
                        BLOCKS="$BLOCKS$ENDDELIM"
                else
                        BLOCKS="$BLOCKS$FILLER"
                fi
                LENGTH=$(( $LENGTH - 1 ))
        done
        printf "$BLOCKS\n"
        i=$(( $i + 1 ))
done
printf "\n\n"

———————————————————-

Your web cams and CCTV may not be  secure.

Use a search engine with the ipaddress of the unit and one of these search terms one at a time to see if the unit is accessible. These are only a few of many.

inurl:/view.shtml
intitle:”Live View / – AXIS” | inurl:view/view.shtml^
inurl:ViewerFrame?Mode=
inurl:ViewerFrame?Mode=Refresh
inurl:axis-cgi/jpg
inurl:view/index.shtml inurl:view/view.shtml
liveapplet
intitle:liveapplet
allintitle:”Network Camera NetworkCamera”
intitle:axis intitle:”video server”
intitle:liveapplet inurl:LvAppl
intitle:”EvoCam” inurl:”webcam.html”
intitle:”Live NetSnap Cam-Server feed”
intitle:”Live View / – AXIS 206M”
intitle:”Live View / – AXIS 206W”
intitle:”Live View / – AXIS 210″

———————————————————-

Picture of Exacto knife to an existing page.
screenshotledresistorca1.png

One nice thing is that if you find a page with an educational tool that you need, under certain circumstances, you can save the page for later use. In some cases, if it is going into an educational environment, the advertisements have to go away. That is what was done with this web page. See pictures. You will also need to save the images and then edit the code to look for them locally.

for example we have a web page that has the script we want to use and the dots represent code that is not needed, we can just remote those unneeded lines lined.

before:

&lt;html&gt;
&lt;body&gt;

&lt;h1&gt;My First Web Page&lt;/h1&gt;
...
...
...
...
....
....
<span class="marked">&lt;script type="text/javascript"&gt;
document.write("&lt;p&gt;" + Date() + "&lt;/p&gt;");
&lt;/script&gt;</span>
...
...
...
...
&lt;/body&gt;
&lt;/html&gt;

after;

&lt;html&gt;
&lt;body&gt;

&lt;h1&gt;My First Web Page&lt;/h1&gt;

<span class="marked">&lt;script type="text/javascript"&gt;
document.write("&lt;p&gt;" + Date() + "&lt;/p&gt;");
&lt;/script&gt;</span>

&lt;/body&gt;
&lt;/html&gt;

———————————————————-

Love Tuxpaint, but it lacks some cut and paste features. Used the
Gimp to get around these short comings. Kind of had to plan out what I wanted to do. First was to use the picture of the video card in the Gimp.

So now I can see the picture, but the canvas is not big enough to hold what else I want. So let us make a new canvas four times bigger. Original picture was 480 x 281.

Import the picture of the card and the picture of the RPi. Actually I cut and pasted the RPi out of one of my other pictures.

Now to do a screen capture of the canvas. Then we will do a tuxpaint-import of that capture into tuxpaint.

Then we need to do a magic shift to put the pictures where we can have more room for pictures and text. Now  the pictures are centered better.

Now all that is left to do is erase some lines that were wires in the original picture and add all the new art work by hand.

Now all we have to do is take a screen shot of the canvas for the blog like we did with this one.

That’s all for now.

———————————————————-

Writing code.

Traditional:

Systems analyst:
What is problem per users.
Develop criteria and test data needed to solve a problem.
Use criteria logically using test data.

Programmer
Develop code based on data defined by criteria.
Test and rewrite code until it works.
Rewrite code for best form.

Users
Test code to see if it solves problem.
Else start over.

Another view.

———————————————————-

if you wanted to convert a decimal number to a hexadecimal number, you can do it several ways. first you could do it the old fashion way by hand.

or you could use a C language program such as:

&nbsp; #include&lt;stdio.h&gt;
int main(){
&nbsp;&nbsp;&nbsp; long int decimalNumber,remainder,quotient;
&nbsp;&nbsp;&nbsp; int i=1,j,temp;
&nbsp;&nbsp;&nbsp; char hexadecimalNumber[100];

&nbsp;&nbsp;&nbsp; printf("Enter any decimal number: ");
&nbsp;&nbsp;&nbsp; scanf("%ld",&amp;decimalNumber);

&nbsp;&nbsp;&nbsp; quotient = decimalNumber;

&nbsp;&nbsp;&nbsp; while(quotient!=0){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; temp = quotient % 16;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //To convert integer into character
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( temp &lt; 10)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; temp =temp + 48;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; temp = temp + 55;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hexadecimalNumber[i++]= temp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; quotient = quotient / 16;
&nbsp; }

&nbsp;&nbsp;&nbsp; printf("Equivalent hexadecimal value of decimal number %d: ",decimalNumber);
&nbsp;&nbsp;&nbsp; for(j = i -1 ;j&gt; 0;j--)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("%c",hexadecimalNumber[j]);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("\n");
&nbsp;&nbsp;&nbsp; return 0;
}

Compile it  and then run it:

$ ./d2h
Enter any decimal number: 708
Equivalent hexadecimal value of decimal number 708: 2C4

or actually you could use either of two command line commands.

$ echo ‘obase=16;ibase=10;708’| bc
2C4

or

$ printf ‘%x\n’ 708
2c4

As you learn bash, you can see you can do things without getting real complicated.

———————————————————-

Try at your own risk!!!! It could brick your arduino!!

1. Minimal Arduino

I recently got really interested in Arduino hardware. For those who don’t know what it is,

 Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It’s intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.

 

So I looked for ways to make my own board but as I am not into electronics, I needed something really simple, where I just needed to put in components, abracadabra and it should start working. So after much research (Googling actually) I have now learned how to make a minimal Arduino clone.

PARTS LIST

ATmega168 (or similar e.g. ATmega8) (Rs. 300)
A Breadboard (Rs. 150)
7805 Voltage regulator (Rs.10)
2 LEDs (Rs. 5)
2 10 uF capacitors (Rs.5)
16 MHz clock crystal
2 22 pF capacitors
2 220 Ohm resistors
1 10k Ohm resistor
small momentary normally open (“off”) button, i.e. Omron type B3F

Note: replaced a resonator for the capacitors and the crystal.

BUILD IT

Before building the main circuit, you need to prepare a 5v supply.
Use 7805 voltage regulator, have a look at this picture:


5v voltage regulator

You need to provide 9v-12v to the INPUT and connect ground wire to GROUND. Then use OUTPUT pin for 5v output and do not forget to ground your circuit with the same GROUND pin.

Next step is to add an LED. An LED attached to power like this is a great troubleshooting trick. You’ll always know when your board is being powered as well as quickly know if your board is being shorted.

We will be using Atmega168(or similar) for our Arduino:


ATmega168

Before moving on, this image is a great resource for learning what each of the pins on your Atmega chip do in relation to the Arduino’s functions. This will clarify a lot of confusion behind why we hook up certain pins the way we do.

Start by adding a 10k ohm resistor “up” (to power) on the RESET pin in order to prevent the chip from resetting itself during normal operation. The RESET pin reboots the chip when pulled down to ground. In later steps I will show you how to add a reset switch that takes advantage of this.

  • Pin 7 – Vcc – Digital Supply Voltage
  • Pin 8 – GND
  • Pin 22 – GND
  • Pin 20 – AVcc – Suppply voltage for the ADC converter. Needs to be connected to power if ADC isn’t being used and to power via a low-pass filter if it is (a low pass filter is a circuit that cleans out noise from the power source, we aren’t using one)

After that, add a 16 MHz external clock between pin 9 and 10, and add two 22 pF capacitors running to ground on each of those pins.

This is where we add the small tactile switch so that we can reset the Arduino whenever we’d like and prepare the chip for uploading a new program. A quick momentary press of this switch will reset the chip when needed. Add the switch just above the top of the Atmega chip. Connect one leg to the RESET on the chip. Then, connect the other leg of the button to the ground.

small tactile switch

Success!
Congratulations, You just made an Arduino clone for yourself.
As of now, this arduino is of no use to you. As it is not functional.
We need a Programmer to “program” our Atmega chip.
I opted for Parallel Programmer, which is the cheapest and simplest one.

You need a male DB25 parallel port connector and some wires.


DB25 male connector

Now you need to solder some pins of this connector to your chip.

 Pin of DB25  Pin of ATmega168
 Pin 11  Pin 18
 Pin 1  Pin 19
 Pin 16  Pin 1
 Pin 2  Pin 17
 Pin 18  GROUND

Please be sure to keep the wire between the parallel port and Atmega chip short as possible.

Now we are done with the hardware part.

Connect you Arduino to your PC through Parallel Programmer and execute these commands through avrdude (Download)

Unzip avrdude into a folder and use CMD(MS-DOS) to first navigate to that new folder you just unzipped and execute the following:

avrdude.exe -p m168 -v -U hfuse:w:0xdf:m -U lfuse:w:0xc7:m -U efuse:w:0x08:m

This command will set the Fuse settings of your chip to use the external 16Mhz crystal we connected earlier (by default, the chip will use 1Mhz internal clock which is slow)

Getting started with programming with Arduino:
Download Arduino software from www.arduino.cc
Before you start programming with Arduino software, configure it to use Parallel Programmer.

  • Go to C:\Documents and Settings\YOUR USER NAME\Application Data\Arduino\
  • Open the preferences.txt file in Notepad.
  • Find the line upload.using=bootloader and change it to upload.using=parallel
Now you should be able to program and upload your code through Parallel Programmer.

———————————————————-

Soduku is an interesting game of numbers and logic. You can not lose of you play it right. The board with preset numbers already sporadically spaced on the  board can be divided into nine sections  with each section of nine squares.The numbers one through nine must be strategically placed so that no number is duplicated in any column or row. Here is your typical sections.

Section:

The whole board:

or you could mentally separate it into three columns or rows.

 

You can have a maximum of one number shown three times in any column or row. For example we already have the number eight three times but the number nine is only shown twice. so we need another nine.

In the upper right hand corner we have three possibilities where another number nine can go.  So we look at the whole board to eliminate the possibilities in our mind.

In this case, it was easy to figure out the where the third nine should go. It will not be that easy with every number. It is a process of elimination with all numbers one through nine both in columns and rows.

 

Since only one number of each can be in each square, you can also eliminate boxes where a number exists. If most of a row is done, you can also fill in numbers.

 

Lastly if you have a mini-square almost filled in you can obviously choose the last number to be filled in.

There are other hints you can pick on your own, but just wanted to share a few starter hints. Good luck.

———————————————————-

Screenshot from 2015-08-30 19:13:00

Good day.