Chitchat

=======

Recovered data from a drive that had a foobarred boot. reformatted and installed Debian using the http based install.

Plan to revisit some old electronics projects and get them done.

Replaced the fire alarms, and now wonder if I can adapt them to some other use.

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

With new technology, there is always some challenges going from an old platform to a new one. Years ago, worked in an independent computer store. This was long before ethernet and the networking that makes things so easy to transfer files between systems. One of my customers who was a college professor wanted to transfer data files from his old eight bit Atari computer to the new Atari. Of course, I volunteered to copy the files to the new system.

To copy the files, you had to use what is known as a null modem connection. To make things even more complicated, the way the files were saved were different in that evey system had it’s own ascii table. For instance, the letter “a” normally would be stored as the number 65. Not all characters were stored as the same numbers between systems. Transferred the files as text between the systems to let the terminal programs do worst of the translation between the systems.

For some files though, all but one character was converted. When I tried to display the files, everything was in one long cast of characters. The paragraphs  should have been broken up with a special character known as a carriage return, When examining the files character by character, found the carriage return was represented by the numberc 155.  Most systems are now standardized using the number thirteen as the carriage return. Obviously, a conversion had to be made.

So we needed to read in the old file one character at a time and write to the new file one character at a time. As we were reading and writing characters, we would replace the old carriage return character for the new one.
This led to some code that looked like this:

OPEN “battery.doc” FOR INPUT AS #1
OPEN “battery.txt” FOR OUTPUT AS #2

WHILE NOT EOF(1)
a$ = INPUT$(1, #1)
IF ASC(a$) = 155 THEN
PRINT
PRINT #2, CHR$(13);
ELSE
PRINT #2, ASC(a$);
PRINT a$;
END IF
WEND
CLOSE #1
CLOSE #2

Just for my own interests, the characters were echoed to the screen to made sure everything was ok. Lot of work, but the files were transferred and converted.

Ironically today, we still have that sort of problem between unix systems and dos based systems.

To go from unix to dos systems the code might be:

OPEN “battery.doc” FOR INPUT AS #1
OPEN “battery.txt” FOR OUTPUT AS #2

WHILE NOT EOF(1)
a$ = INPUT$(1, #1)
IF ASC(a$) = 13 THEN
PRINT
PRINT #2, CHR$(13);chr$(10);
ELSE
PRINT #2, ASC(a$);
PRINT a$;
END IF
WEND
CLOSE #1
CLOSE #2

To go from Dos to unix, the code might be:

OPEN “battery.doc” FOR INPUT AS #1
OPEN “battery.txt” FOR OUTPUT AS #2

OPEN “battery.doc” FOR INPUT AS #1
OPEN “battery.txt” FOR OUTPUT AS #2

WHILE NOT EOF(1)
a$ = INPUT$(1, #1)
IF ASC(a$) = 10 THEN
rem do not print the character to the new file.
print ;
ELSE
PRINT #2, ASC(a$);
PRINT a$;
END IF
WEND
CLOSE #1
CLOSE #2

This code may seem unimportant, but  you never know when something simple can get the job done.

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

Though floppy drives are not really used anymore, they can be adapted for other purposes. Most web cameras only look in one direction. With the help of a floppy drive and a sort of lazy suzan, you can control the direction of view for the webcam.

 

The electronic wiring is fairly  simple. You can connect in several ways.

If the jumper from pin 11 to 12 is set and you have the power source connected, the led of the disk drive should be on. If you do not want to use the picture:

A. Connect Pin 11 and 12 with a Jumper on the drive.
B. Connect Pin 18 of the drive with Pin 2 of the parallel port.
C. Connect Pin 20 of the drive with Pin 3 of the parallel port.
D. Connect the rightest pin of the power from the drive to the red wire of the floppy power cable.
E. Connect the pin left of the rightest pin of the power with black wire on the floppy power connector and to the ground to pin 18 of the parallel port. Actually I did not touch the ground wire on the power cable. I took pins 17 and 19 off the drive to pin 18 on the cable.

Probably use a cut off floppy cable connector with some ribbon cable attached. No need to solder directly to the pins, but you will need to connect wires together for pins 11 and 12 on the drive.

or

 

Now moving the head:

We need to connect the following:

  • 14: Drive select enables or disables the motor and also the LED. This is useful if you want the LED only to be active when you hear a tone but clearly optional.
  • 20: Step steps the motor by one step by changing it from HIGH to LOW.
  • 18: Dir controls the direction of the motor. You should change it every step so your motor vibrates. Personally, I prefer vibrating over moving up and down as moving is not very loud and doesn’t sound very good either

Direction change
x = 0
out 888, 2^x

Step motor
X = 1
out 888, 2^x

out 888, 0
—————————————————

Debian testingcurrently aliased jessie, contains software being tested for inclusion in the next major release. The packages included in this distribution have had some testing in unstable but they may not be completely fit for release yet. It contains more modern packages than stable but older than unstable. This distribution is updated continually until it enters the “frozen” state. Security updates for testing distribution are provided by Debian testing security team.Keep Calm and Install Debian JessieIn this article, we are going to learn to install & setup Debian Xfce “jessie” testing from scratch using netinst/minimal iso which is around 300MB in size.
Note: This method of installing Debian requires a functioning internet connection during installation.
Although both Ethernet and wireless connections are supported, a wired Ethernet connection is better. This method requires internet connection because only minimal packages as opposed to the full version and the other stuff has to be downloaded during installation.Step 1: Download the ISO & make a bootable diskDownload the iso & make a bootable usb drive using software like “Unetbootin” or some other similar software that lets you copy iso files to a usb drive & make it bootable.  You can find the weekly builds of all architecture & all formats in this link, http://cdimage.debian.org/cdimage/weekly-builds/. Here are the direct links to download the weekly builds of the testing iso,

Do a server/network setup to install the debian system: http://computoman.blogspot.com/2014/10/http-based-linux-install-starter.html

Step 2: The installation from the iso

Boot from the usb drive and choose install. For older machines just use the cdrom and the cd/dvd drive. Yes don’t choose the graphical installer as we are going to use the basic installer. You can refer to the attached images at the end of the article for the step by step process of the installation. There are a total of 42 pictures so we are just going to list only the important steps during the installation.

Configure Network

If you are using dhcp on your home router then the network setting will be configured automatically.  If you are not using dhcp then the installer will ask you to configure the network manually. We have dhcp setup in my home router so the network settings were configured automatically by the installer.

Debian_NetInst_09

Hostname

Name that identifies the particular system on the network. You can leave debian as the hostname or choose something else. I chose myinuxbox.

Debian_NetInst_11

Domain Name

If you are on a particular domain, then use that. If you are not sure then you can just leave it blank.  You can always go back later and name it. We left it as blank as we are not in any domain. (Note: Don’t use local as its a reserved name)

Debian_NetInst_12

Choose Mirror

Choose the mirror country and the mirror to use to download the packages & updates from. We usually just use the defaults.

Debian_NetInst_14

Proxy

Generally proxies are only used in a business or protected network. You network administrator can get you the details you need.  If you want to configure proxy then you can do it here. If you are not going to use a proxy then leave it as blank and go to next step.  We left it as blank as we are not using any proxy server.

Debian_NetInst_15

Root Password

Actually we are going to grant sudo (administrative rights) access to the user we are going to choose in the next step. So basically the root access is of much use when multiple users are using the system and you don’t want others to have sudo (aka root) access.  Enter the root password and re-enter the root password.

Debian_NetInst_17

Username & Password

Enter the username (no caps as it makes it easier to keep up with users and for you to have a simpler log in name) and the fullname of the user. Its better to choose a password different from the root password. First thing people will try to become root is to use your password if they know it.

Debian_NetInst_20

Partition Manager

We to arrange the system as you might setup a file cabinet to partition the files. The partition manager is same as the partition manager from the graphical install except for the fact that we will be configuring everything using keyboard itself.  Choose one partition for the installation and another partition for swap.
Ex:

  • 20GB partition with ext4 filesystem with mount point as / (you can leave all other options in the default value)
  • 4GB swap (usually swap size it twice the RAM size, so if the system has 2GB RAM then the swap size should be 4GB)

Debian_NetInst_25

After choosing the partitions, choose “yes” to write changes to disk.

Debian_NetInst_26

Package usage survey

If you are too much concerned about “privacy” then choose no or else choose yes. We chose NO. Basically Debian wants to know what packages are important to you.

Debian_NetInst_28

Step 3: Software selectio

This is the most important step in this installation, so make sure to choose the “correct” options. We are going to install Xfce desktop environment later. Xfce is a less system resource hog, So deselect the “Graphical desktop environment” option and continue. You may want to select the “Laptop” option if you are using a laptop for the installation.

Debian_NetInst_29
Debian_NetInst_30
Debian_NetInst_31

Step 4: GRUB Installation
GRUB

GRUB will check if any other operating systems are already installed in the system and will list them. If the list is correct then you may proceed with the installation. Usually GRUB boot loader is installed in /dev/sda but if you have more than one HDD, then you can choose the HDD in which you want the boot loader to be installed.

Debian_NetInst_35

Complete the installation from the iso

Get ready to boot into your new installation after the installer reboots the system.

Debian_NetInst_38

Step 5: Boot into the new installation
Boot into your new Debian installation and get ready to roll… Nope, not actually. We still have few more steps to do.

Debian_NetInst_40

After booting into Debian, you will still be greeted with a command line because we are yet to install a display manager nor the graphical desktop environment.
Enter the user login & password that you chose during the installation.

Now we have to switch to super user mode (root) and edit the resources list to testing, update and then install sudo & grant sudo rights to the user.
Here are the commands,

su

Enter the root password

nano /etc/apt/sources.list

You’ll find something like

deb http://ftp.us.debian.org/debian jessie main
# deb-src http://ftp.us.debian.org/debian jessie main
deb http://security.debian.org/ jessie/updates main
# deb-src http://security.debian.org/ jessie/updates main

Now what we are going to do is make this installation as testing forever. So even after jessie goes stable, this installation will still download packages from the next testing release which will have some other code name.
Also we are going to add “contrib” & “non-free” repositories that are not 100% FOSS as per the Debian Free Software Guidelines.

  • “contrib” – repositories include packages which do comply with the DFSG, but may fail other requirements. For instance, they may depend on packages which are in non-free or requires such for building them.
  • “non-free” – repositories include packages which do not comply with the DFSG

Now replace “jessie” with “testing” and add “contrib non-free” after main. Save and close the file.

deb http://ftp.us.debian.org/debian testing main contrib non-free
deb-src http://ftp.us.debian.org/debian testing main contrib non-free
deb http://security.debian.org/ testing/updates main contrib non-free
deb-src http://security.debian.org/ testing/updates main contrib non-free

If you want to use a installation that is 100% FOSS as per the Debian Free Software Guidelines then just don’t add “contrib” & “non-free”.
Note: I would like to let you know that we are going to install software from the “contrib” and “non-free” repositories too.

Now lets update the system & grant sudo access to the user.

# apt-get update
# apt-get install sudo

# usermod -a -G sudo <username>

Replace <username> with your username to which you want to grant sudo
access.

# reboot

Step 6: Update & Upgrade the new installation

Now we are going to update & upgrade the system. We are using the iso from the weekly builds, so this step should take less time.
Log into your user and run the following commands.

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade

If you get any messages, press q to exit the message and continue the installation. You may read them if you want and then press q.
When you get a dialogue box asking if services can be restarted automatically during upgrade, choose “yes”.

Debian_NetInst_41

After the upgrade is complete, restart the system

$ sudo reboot

Step 7: Install the Xfce Desktop Environment

Now we are going to install Xfce & goodies by running the following command.

$ sudo apt-get install xfce4 xfce4-goodies

 The “Goodies for Xfce” project includes additional software and artwork that are related to the Xfce desktop, but not part of the official release.

To view the list of packages installed by xfce4-goodies, check this link, https://packages.debian.org/jessie/xfce4-goodies.

If you want to start the HDD temp monitoring daemon during startup then you chose “yes” or else choose “no”. we chose “no”.

Debian_NetInst_42

After the installation is complete, run the following command to check if the Xfce installation was successful.

$ startx

The startx command is actually a “front end” for the xinit system which will  bring up the GUI (Xfce in this installation).

After running the above command you will see the Xfce desktop environment that we just installed. Now  log out to get back to the command line.

Step 8: Install the Lightdm display manager

Now we are going to install lightdm display manager (i.e. the GUI in which you enter username & password) which is the recommended display manager for Xfce. You may install some other display manager as per your choice. You can find the list of display managers available in Debian in this link, https://wiki.debian.org/DisplayManager.

$ sudo apt-get install lightdm

Now we are going to install few packages,

  • synaptic package manager – graphical package management tool which enables you to install, upgrade and remove software packages in a user friendly way.
  • apt-xapian-index – maintenance and search tools for a Xapian index of Debian packages
  • gdebi – simple tool to install deb packages
  • gksu – graphical frontend for su
  • menu – generates programs menu for all menu-aware applications
  • iceweasel – Iceweasel is just Firefox but with a different name

Note: we like to also install vim, mc, links2, and gpm to make command line use easier.

$ sudo apt-get install synaptic apt-xapian-index gdebi gksu menu
$ sudo reboot

After rebooting the system and while entering your username & password, choose “Xfce Session” from the drop down box. Now enjoy your new Debian Xfce installation.

Plus:

First lets update the sources and grant sudo access to the default user.
Also we are going to add “contrib” & “non-free” repositories that are not 100% FOSS as per the Debian Free Software Guidelines.

  • “contrib” – repositories include packages which do comply with the DFSG, but may fail other requirements. For instance, they may depend on packages which are in non-free or requires such for building them.
  • “non-free” – repositories include packages which do not comply with the DFSG

If you want to use a installation that is 100% FOSS as per the Debian Free Software Guidelines then just don’t add “contrib” & “non-free”.
Note: I would like to let you know that we are going to install software from the “contrib” and “non-free” repositories too.

Now lets begin. Open terminal & run the following commands,

$ su

Enter the root password

GUI to manage network connections :

We have 2 choices here,

  1. wicd – If you are going to use only wired & wireless wifi network connections.
  2. network-manager-gnome – If you are going to use VPN or mobile broadband in addition to wired & wireless wifi network connections.

I installed wicd in my system just to check its performance and I can say that its much smooth & stable than the default network-manager. I could see the difference immediately in iceweasel, pages were loading faster and smoother than before wicd was installed.
Initially I installed wicd just for the sake of testing it so that I could add the steps in this guide but after experiencing the network smoothness, I decided to stick with wicd and purge network-manager.

Network-manager-gnome

If you want to use VPN or mobile internet then can’t use wicd and have to settle with the default network manager. To install the frontend gui for network manager, run the following command
sudo apt-get install network-manager-gnome
You can refer the Debian wiki, https://wiki.debian.org/WiFi/HowToUse, for information on setting up wifi.

Extra screensavers: (Optional)

If you are a fan of the matrix screensaver like me, then you might want to install it.

$ sudo apt-get install xscreensaver-gl

That is all for now.

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

Needed a sort of portable podium. So I made a platform to attach to a camera tripod. Unfortunately, all I had was an unpainted board. The wood was so white, it almost looked like an amateurs project (actually it was). Really did not want to spend any money on the project. After doing some research, found an almost free natural stain.  So simple, I did not believe it would work. but lo and behold it did.

The podium looks very professional now!

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

With Linux does not mean you have to do everything via the command line. For example you might want to import a picture into tuxpaint. That requires you know what command to use and know where the file to be converted is.

$ tuxpaint-import file2bconverted.ext

Now you could make the program semi gui with using the zenity command.

tpimport.sh

#================================
#
# Tuxpaint file import catcher
#
#=================================
# Assignments
# --------------------------------
szAnswer=$(zenity --file-selection --title="Select a file to convert to tuxpaint")
datafile=$szAnswer
#=================================
#
# Data input
#---------------------------------
tuxpaint-import $datafile

Once you create the file, you will want to make it executable.

$ chmod +x tpimport.sh

From there you could run the program withL

$ ./tpimport.sh

or you would get sort of a gui with:

The you would get the file selector.

You can select the file to convert form there without knowing a bunch of commands to get to where the file is.  Now we can go one step farther and create an icon that can be easily double clicked to execute the shell file. To do that you want to create a launcher. Just right click where you want the launcher to reside such as at the desktop and then click on create launcher.

You will want to select a name for the launcher and even choose a graphic for the launcher but the most important is to choose the tpimport.sh as the file to execute.

Of course, I have already chose the command.

Then finally you have an icon to double click without having to deal with the command line. Tada!

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

From Wikipedia:

BASIC (an acronym for Beginner’s All-purpose Symbolic Instruction Code) is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use.
In 1964, John G. Kemeny and Thomas E. Kurtz designed the original BASIC language at Dartmouth College in New Hampshire. They wanted to enable students in fields other than science and mathematics to use computers. At the time, nearly all use of computers required writing custom software, which was something only scientists and mathematicians tended to learn.
Versions of BASIC became widespread on microcomputers in the mid-1970s and 1980s. Microcomputers usually shipped with BASIC, often in the machine’s firmware. Having an easy-to-learn language on these early personal computers allowed small business owners, professionals, hobbyists, and consultants to develop custom software on computers they could afford.
BASIC remains popular in many dialects and in new languages influenced by BASIC, such as Microsoft’s Visual Basic. In 2006, 59% of developers for the .NET Framework used Visual Basic .NET as their only programming language. Mono is a close relative.

Although quickly disappearing there is a lot of code that you can find on the internet  for programming in basic. Fortran sort of a father of the Basic language. Since learning Fortran (Formula translation) in college, Basic was very easy to pick on. Basic on the TRS-80 model one, was the first dialect for me to use. Of course, every microcomputer manufacturer has it’s own version of basic. To use a variety of computers, you almost had to be bilingual. As the personal computer became sort of standardized, gwbasic sort of took over even from the days of CPM. GWbasic also save in a cryptic format unless you saved it in text or ascii format.

Then, very quickly Qbasic took over. In most basics up till that date, you had to use line numbers to arrange all the instructions in a sequence. With Qbasic that changed. Now Qbasic became more like other computer programming languages, including using procedures. Like all preceding basics, it was still interpreted. In other words you could not make a stand alone program not requiring the Basic interpreter. You began to have for of an IDE integrated development environment.

As development moved forward, you finally had versions of Basic that would generate a stand alone program. Quickbasic, Turbobasic, Basic 7 and a variety of others all filled that need. QB45 has soft of taken over the Quickbasic realm and is available for a variety of operating system platforms. In fact we use it on Linux. Considering the wealth of Basic source code from over the years, you can not but help to make it usable immediately. Another Basic that we use alot is free basic. Although it has a Quickbasic compatibilty mode, there are some instructions that do not translate directly as of yet.

There is not a direct IDE in the Linux environment for Freebasic, but you can use programs such as Geany to make development easier. We use vim to work just fine for most of the things we do. We find that Freebasic is very good at controlling hardware such as the parallel port very easily without having to do cartwheels. This is extremely important for doing home automation. In fact it is very easy to include compiled Freebasic programs as part of a cgi web platform.

Though Basic may be a dying breed of development, you can use the source code as pseudocode for other platforms. Found an old book for a dollar that had a lot of code for doing electronics calculations. One of the best book finds for me. Now schematic values such as for resistors, capacitors, and etc. can be easily calculated. Also written business programs such as an editor, simple spreadsheet, and flatfile database with Basic.There really seams to be no limitation with Basic.

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

Redid a tv antenna more to spec.

Made an antenna guessing at the specs. Also did it do see how critical the angle of the dipoles were.

Original version:

The antenna did not work that well. So I went back and looked at the original picture and noticed the angle was quite different.

Oops, the original angle used was a bit wide. Hmm. S/B:

Now, the new version with the corrected angle.

Now to test it.

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

Making pizza.

pizza

Good day.

Advertisements