Home

See you in September.

Leave a comment

Chit chat
———

Author reserves the right to add or remove content from any post at any time without prior notice or approval.

Had to fix the printer and some other stiff .

gMTP finally seems to be working well.

For the latest cartoons see http://itcartoons.blogspot.com/

———————————–

Use at your own risk.

Parallel and serial I2C

Download

Note : no warranty, no liability, project is provided ‘as is’ but I hope you will enjoy it !

Other:

Why ?

Access to I2C components from a very low cost interface, in pure python, over serial, parallel (maybe more in the future) interfaces, with a minimum hardware. This implementation is intended to be fast but simple and minimalist.

Features (0.3)

  • handle SDA and SCL pins
  • handle your own hardware interface simply adding your puthon driver in drivers directory,
  • auto-detect available interfaces (COM1, COM2, LPT1, etc…)
  • LM75/DS75 I2C sensors,
  • analyse SCL/SDA signals with pyScope :pyScope

Future features

  • add more I2C components,
  • add your own driver if you send it to me,

Example

>>> import I2C
>>> import I2C.sensors

>>> i2c = I2C.BusI2C('COM2')
>>> i2c.bus.setSpeed(2000)  # you can set i2c speed adapted to your hardware
>>> sonde = I2C.sensors.LM75('Room 1', i2c)
>>> print "T =  %02.03f C" % sonde.getTemperature()

Example minimal serial port I2C interface

This interface is really low speed and minimalist, it’s based on specific optos. You can find better also better solutions : http://www.standardics.nxp.com/support/documents/i2c/pdf/optoisolation.pdf

$ wget wget http://www.standardics.nxp.com/support/documents/i2c/pdf/optoisolation.pdf

Example minimal parallel port I2C interface

It-s possible to select SDA input signal, python driver can be easily adapted to you choice.

Python packages required

  • pySerial if you plan to use I2C over serial port
  • pyParallel if you plan to use I2C over parallel port

$ sudo apt-cache search pyparallel
python-parallel – pyparallel – module encapsulating access for the parallel port

$ sudo apt-cache search pyserial
python-serial – pyserial – module encapsulating access for the serial port
python3-serial – pyserial – module encapsulating access for the serial port

Win32 platform

pyParallel need you install and start giveio.sys driver

Linuxes

pyParallel on linux is based on ppdev module, make sure ppdev module is loaded and not lp. add change device access rights to make non root users or add users in right group (lp group on most systems). Use a non production computer for this as the parallel port may not print normally after making these adjustments. On most systems, ppdev is not the default parallel port handler, you must make sure module ppdev is loaded :

sudo modprobe ppde
sudo rmmod lp
sudo chmod go+rw /dev/parport0

Install from tarball

tar -xvzf pyI2C-0.3.tar.gz
cd pyI2C
python setup.py install

———————————–

The newsmedia said they were worthless seem to be still working ok for me. Using the Arduino with an old black and white TV and additional software. You need to add a couple of pieces of inexpensive electronics though. If you have an old TV like this one with composite in, it will also work with the Raspberry Pi also (You will need and rf modulator other wise.)

Even this probably thirty year old TV with the right output from an old computer.  Like to play ninvaders on it as well as using it as a terminal. Command line is not dead,

Bluray has never really caught on, but we can still use dvd players.  Dvd players with composite input can also be used as monitors. Here we are running Reactos.

From:  http://www.instructables.com/id/McGuyver-monitor/

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

Was bored tonight so I did a college football page scrape and the original version is only good for the current week. Still needs a bit of work such as better formatting, but you get the idea.

NCAA Scoreboard

Saturday, September 13, 2014

Rice vs Texas A&M

3rd 5:44

1 2 3 4
Rice 0 7 0 7
0-1
7
Texas A&M 7 14 7 28
2-0

Arizona State vs Colorado

Halftime

1 2 3 4
16
Arizona State 14 10 24
….
….
….

——————–
I usually save data to file for editing
./gcfs.sh > filename

gcfs.sh

####################################
# Score  Grabber
#
#===============================
# Assignments
# --------------------------------
datafile="tcf"
let "flag = 0"
# end assignments
#=================================
#
# Get data file
#---------------------------------
elinks -dump "www.ncaa.com/scoreboard/football/fbs"  > $datafile
#=================================
#
# Extract and display data
#---------------------------------
while read line
do fdata[$a]=$line
    echo $line | grep -q "NCAA Scoreboard"
    if  [ $? -eq 0 ]; then
        # header
        clear
        let "flag = 1"
    fi
    if [ $flag -eq 1 ]; then
        echo $line | grep -q "Featured Sections"
            if [ $? -eq 0 ]; then
            let "flag = 0"
        else
            echo $line | grep -q "GameCenter"          
            if [ $? -eq 0 ]; then
                let "response = donothing"
            else
                echo $line | sed 's/\[.*\]//'
            fi
        fi
    fi
let "a += 1"
done < $datafile
# footer
echo ---------------------------------------------
echo
#===================================
# End.
####################################

——————————-
Update: This new version will show past data and scheduled match ups for future weeks.

 ####################################
# Score  Grabber
#
#===============================
# Assignments
# --------------------------------
datafile="tcf"
let "flag = 0"
let "year = 2014"
let "week = 4"

if [ "$week" -lt "10" ]; then
    let "a = 0"
fi
# end assignments
#=================================
#
# Get data file
#---------------------------------
elinks -dump "www.ncaa.com/scoreboard/football/fbs/$year/$a$week/"  > $datafile

#=================================
#
# Extract and display data
#---------------------------------
while read line
do fdata[$a]=$line
    echo $line | grep -q "NCAA Scoreboard"
    if  [ $? -eq 0 ]; then
        # header
        clear
        let "flag = 1"
    fi
    if [ $flag -eq 1 ]; then
        echo $line | grep -q "Featured Sections"
            if [ $? -eq 0 ]; then
            let "flag = 0"
        else
            echo $line | grep -q "GameCenter"        
            if [ $? -eq 0 ]; then
                let "response = donothing"
            else
                echo $line | sed 's/\[.*\]//'
            fi
        fi
    fi
let "a += 1"
done < $datafile
# footer
echo ---------------------------------------------
echo
#===================================
# End.
####################################

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

Select a task to install.

One of the most often complaints I hear is why do we not have linux distributions for all kinds of servers and etc. In a way, you already do. At least for Debian and it’s related distros, you have a command called tasksel. Tasksel will allow you to have a basic or minimal install and then you can install a set of packages for a specific task. You can run it menu driven or specialize its options by using the command line.

Tasksel is not automatically installed, so you will need to install it.

$ sudo apt-get install tasksel

You can easily select install the lamp (Linix, Apache2, Mysql, and PHP) to set up a minimal web server. While doing that you can tell the system not to install the gui desktop to make a lean and trim system. You can also install several options at once, but you need to  be careful.

To see what packages a system has, you can use the command: (varies from distribution to distribution). It will even tell you what is installed.

$ sudo tasksel –list-tasks

i server    Basic Ubuntu server
i openssh-server    OpenSSH server
u dns-server    DNS server
u lamp-server    LAMP server
i mail-server    Mail server
u openstack    Openstack
u postgresql-server    PostgreSQL database
i print-server    Print server
….
….
….
etc etc

You can also see what programs are included in a specific package

$ sudo tasksel –task-packages server
update-notifier-common
python-zope.interface
python-chardet
python-lazr.restfulclient
python-serial
w3m
python-pam
vim-runtime
curl
python-wadllib
libpcsclite1
python-simplejson
vim
….
….
….
etc etc

You can still install and remove individual packages the old fashion way. I will not dwell on all the options, but you can always

$ man tasksel

for more details.

———–

Additional information:Keep a list of installed packages:
$ dpkg –get-selections > installed-software.log
read $ dpkg (dash)(dash)get-selections > installed-software.logTo use for another system:
$ dpkg –set-selections < installed-software.log
read $ dpkg (dash)(dash)set-selections < installed-software.log
$ apt-get dselect-upgrade

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

Bsd short for Berkeley Software Distribution was originally a closed source operating system software, but various flavors have become open source software. Bsd has been around since 1977, so it is very mature and dependable.  One version known as FreeBSD allegedly became the basis for the Apple operating system for the newer Macintosh computers.  BSD an offshoot of Unix can be very gui oriented not just text based like it’s ancestors. Shown below is open BSD. OpenBSD even comes with a web server pre-installed unless you choose not to install it.

Of course, if you are a hardcore nix person, you can still use BSD without all the gui.  In the picture below is NetBSD running in the text mode with a familiar game of Tetris running on it.What is unusual about this system is that it was installed from the internet using floppy disks as the boot media.  Try that with your proprietary systems. The perfect system for people without a lot of resources.

Like Openbsd and Freebsd, they both will run on about anything with a cpu. In fact, I still think we have the cdrom that will run on the Sega Dreamcast.

Like Linux, BSD has a tremendous amount of software available from various repositories. Linux and BSD are not exactly alike, but you can move from one to the other without much trouble. You can always use the “man” command. Want a change, then give BSD a try.

Netbsd supported platforms:

Tiers

Tier I: Focus — support is part of NetBSD’s strategy (top)

Focus ports are the architectures that NetBSD targets as part of its strategy. The platforms consist of modern server, embedded and desktop architectures. The guidelines are as follows:

  • Machine independent (MI) changes should benefit these ports.
  • MI changes must be tested on at least one of these ports.
  • It is the developer’s responsibility to implement machine dependent (MD) support necessary for changes, fix build problems and aid in debugging with any platform-specific problems.
  • Even within a port, common sense should be used (cf. the i386 port which still supports 486).
  • Regressions in the automated NetBSD test suite (/usr/tests) are not allowed.

Currently there are 8 ports with Tier I status. They are:

Port CPU Machines Latest Release
amd64 x86_64 64-bit x86-family machines with AMD and Intel CPUs 6.1.4
evbarm arm ARM evaluation boards 6.1.4
evbmips mips MIPS-based evaluation boards 6.1.4
evbppc powerpc PowerPC-based evaluation boards 6.1.4
hpcarm arm StrongARM based Windows CE PDA machines 6.1.4
i386 i386 32-bit x86-family generic machines (“PC clones”) 6.1.4
sparc64 sparc Sun UltraSPARC (64-bit) 6.1.4
xen i386, x86_64 Xen Virtual Machine Monitor 6.1.4

Tier II: Organic — evolving at its own pace (top)

Organic ports are highly valued by the NetBSD project, but their development is not as tightly mandated as that of the focus ports. Generally speaking, the hardware platforms of organic ports have lost their industrial relevance, or there is not enough community activity for the port to make it to the first tier. The guidelines are as follows:

  • Generally speaking, the port boots and works, but keeping it working is the responsibility of the user community. This includes, but is not limited to, kernel changes and toolchain upgrades.
  • Developers committing MI changes are still encouraged to keep ports up-to-date when it can be easily done.
  • MI architecture decisions may penalize organic ports if there is a benefit for focus ports.
  • If the port is not working at release time, a release is done without the port and the port is moved down to the life support tier.

Currently there are 50 ports with Tier II status. They are:

Port CPU Machines Latest Release
acorn26 arm Acorn Archimedes, A-series and R-series systems 6.1.4
acorn32 arm Acorn RiscPC/A7000/NC and compatibles 6.1.4
algor mips Algorithmics MIPS evaluation boards 6.1.4
alpha alpha Digital Alpha (64-bit) 6.1.4
amiga m68k Commodore Amiga, MacroSystem DraCo 6.1.4
amigappc powerpc PowerPC-based Amiga boards 6.1.4
arc mips Machines following the Advanced RISC Computing spec 6.1.4
atari m68k Atari TT030, Falcon, Hades 6.1.4
bebox powerpc Be Inc’s BeBox 6.1.4
cats arm Chalice Technology’s Strong Arm evaluation board 6.1.4
cesfic m68k CES’s FIC8234 VME processor board 6.1.4
cobalt mips Cobalt Networks’ Microservers 6.1.4
dreamcast sh3 Sega Dreamcast game console 6.1.4
emips mips Machines based on “Extensible MIPS” 6.1.4
epoc32 arm 32bit PSION EPOC PDA none
evbsh3 sh3 Evaluation boards with Renesas (Hitachi) Super-H SH3 and SH4 CPUs 6.1.4
ews4800mips mips NEC’s MIPS based EWS4800 workstations 6.1.4
hp300 m68k Hewlett-Packard 9000/300 and 400 series 6.1.4
hp700 hppa Hewlett-Packard 9000/700 series 6.1.4
hpcmips mips MIPS based Windows CE PDA machines 6.1.4
hpcsh sh3 Renesas (Hitachi) SH3 and SH4 based Windows CE PDA machines 6.1.4
ia64 itanium Itanium family of processors none
ibmnws powerpc IBM Network Station Series 1000 6.1.4
iyonix arm Iyonix ARM pc 6.1.4
landisk sh3 SH4 based NAS appliances by I-O DATA 6.1.4
luna68k m68k OMRON Tateisi Electronics’ LUNA series 6.1.4
mac68k m68k Apple Macintosh 6.1.4
macppc powerpc Apple Power Macintosh and clones 6.1.4
mipsco mips Mips family of workstations and servers 6.1.4
mmeye sh3 Brains’ mmEye Multi Media Server 6.1.4
mvme68k m68k Motorola MVME 68k SBCs 6.1.4
mvmeppc powerpc Motorola MVME PowerPC SBCs 6.1.4
netwinder arm StrongARM based NetWinder machines 6.1.4
news68k m68k Sony’s m68k based “NET WORK STATION” series 6.1.4
newsmips mips Sony’s MIPS based “NET WORK STATION” series 6.1.4
next68k m68k NeXT 68k ‘black’ hardware 6.1.4
ofppc powerpc Generic OpenFirmware compliant PowerPC machines 6.1.4
pmax mips Digital MIPS-based DECstations and DECsystems 6.1.4
prep powerpc PReP (PowerPC Reference Platform) and CHRP machines 6.1.4
rs6000 powerpc MCA-based IBM RS/6000 workstations 6.1.4
sandpoint powerpc Motorola Sandpoint reference platform 6.1.4
sbmips mips Broadcom SiByte evaluation boards 6.1.4
sgimips mips Silicon Graphics’ MIPS-based workstations 6.1.4
shark arm Digital DNARD (“shark”) 6.1.4
sparc sparc Sun SPARC (32-bit) 6.1.4
sun2 m68k Sun 2 6.1.4
sun3 m68k Sun 3 and 3x 6.1.4
vax vax Digital VAX 6.1.4
x68k m68k Sharp X680x0 series 6.1.4
zaurus arm Sharp C7x0/C860/C1000/C3x00 series PDA 6.1.4

———————————–

 

———————————–
————————————
————————————
————————————

Let’s make pasta

pastalady

Good day.

Catching up.

Leave a comment

Chit chat

———–

Have not madetime to post for a while.

———–

Cartoons

———-

New Mapple life size iphone.

It will even dance with you! (and etc.)

Net neutrality?

Mapple presents:

Mapple presents the new NSA watch also known as the iWatchu,

It’s raining, it’s pouring, the old cloud is snoring.

Another patent battle.

Rumor that Diet Smith as well as others are going to Texas to file patent suit against Apple.

Right to bear arms.

Heaven

 

Texas computer room.

Cows is a Cluster of workstations
Several servers working together is sometimes know as a server farm.

The joy of multiplex.

Tech support!

Computerized black eye.

 

Raid.

Superhero wanted.

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

 

Notice

Author reserves the right to add or remove content from any post at any time without prior notice or approval.

You do not have to use wifi sometimes.

Ethernet over power is a great way either to connect an extra computer to the network without running cable or trying to set up wireless. Plug in and go.  I especially like them, for use when I need to do something in the garage such as look up technical information so I do not have to go in the house dirty..

Server racks


Going back home.

Started out with Slackware in the 1990’s on an i386. Looks like I will be going back. Still have Slackware 14 on a Pentium I. The ultimate return on investment. Slackware 14 running on a pentium 1.

You can still get Slackware from http://www.slackware.com/

Available for download.

PC as a router.

 Openwrt is a very well known firmware for commercial routers. What a lot of people may not know is that it is available for the personal computer environment. In fact, you can find more about it here: http://www.instructables.com/id/Openwrt-on-a-pc/

But now there is an offshoot of Openwrt called Gargoyle (http://www.gargoyle-router.com/). Like Openwrt, they both can run in a virtual machine! So you could run several routers all on one system. That is something so far you can not do on a commercial plastic router. Hopefully, I will be doing an install set up soon. If you can do the openwrt install, then the gargoyle install should be easy.

If you go to their download page, you can easily choose the right firmware to download for an X86 system. Linux users will want to have the software dd available to transfer the image to a drive. You do get a gui interface to interact with remotely like most routing software, That way you are not locked into the command line.

Gargoyle is only about 17 megabytes, so choice of media storage such as a compact flash drive very accessible.  Never tested this software, but it begs to be tested!

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

 

Two simple calculators

 Might me nice to have at your fingertips.Part of the code is at: http://www.javascriptkit.com/script/cut42.shtml

Usb to isa.

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

Home made fritos.

SUNP0058

Good day.

What’s up doc?

Leave a comment

Chit chat

———–

Not so much stuff in this posting.

Updated the Arch linux box for the “vim” rearrangement.

Disappoints me that people think they have to have a particular linux distro, but now with systemd that changes.

Added several apps to the test web server.

Found a web based arduino ide, but it only works in the local browser and not on a server.

Played with the arduino a little bit, found some differences between the real Arduino and the Osepp board.

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

Couple of cartoons:

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

If you set up your serial port for communications (some systems may require a usb adapter), You will never worry about not having a monitor for emergencies. (connecting in this case to an nslu2 running linux.)

Notes from an earlier article to set up serial communication, Your system may vary.
Now to get the Pda working with the unit. The Palm pda will not work as is as a dumb terminal, so I had to install a program on to it from another computer called ptelnet.prc using a usb to serial interface. The Palm has an interface cable that will plug directly into the 9 pin serial port on the back of the computer.

$  pilot-xfer -p /dev/ttyUSB0 -i ptelnet.prc

That should be easy. First to test the port. Strange the serial port on what is commonly known as com2:. (com1: =ttyS0)

$ sudo /sbin/getty -h -L /dev/ttyS1 9600 vt100 &
$ sudo chmod 666 /dev/ttyS1

A prompt did not show up on the Palm pda. Now what is the problem? Time to log out and restart the computer to go into the bios. Went into the bios and noticed there were two serial ports, but you could only have one port working at a time. The motherboard was set for the second port which was IR only. Changed the motherboard to use port 1 and disabled IR. Saved the settings and rebooted. Used the temp command again to test the serial port.

$ sudo /sbin/getty -h -L /dev/ttyS0 9600 vt100 &
$ sudo chmod 666 /dev/ttyS0

The login prompt came right up on the Palm pda. Logged in and all was well. Beginning to feel like Sherlock Holmes solving issues.  Sshed back into Robotpet. Now I had to make the port available all the time.

$ sudo vim /etc/inittab

Needed to uncomment on line to make that so. (i.e. remove the pound sign)

Changed:
# T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
to
T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100

 

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

Saw this article (http://www.raphnet.net/electronique/adlib/adlib_en.php) about connecting and old eight (isa) bit sound card to the parallel port. Then I thought after looking at the connections that maybe the Arduino, RPi, Beagleboard, or the like  could also be used.  Just a matter of developing the software. Try this at your own risk. Then I thought there are lots of other old legacy eight bit cards that might be used (i.e serial, parallel, floppy, or etc).

 

Adlib information:
http://www.o-bizz.de/qbtuts/mallard/sbfaq.htm

http://www.shipbrook.net/jeff/sb.html

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

Just like there are many verbal languages for speaking i.e. English, Spanish, Italian or etc.,  computers have their own languages also. Most people understand a verbal language  without having to do any translation. For computers that can be different. So if you want to use a language on a computer, some translation will need to be done to convert the commands (aka source code) to the ones and zeroes a computer understands. This is called compiling. There are a zillion languages that can be used, but one of the most common is “C” pronounced “see”. “C” was made famous by Dennis Ritchie and Brian Kernighan also know and K&R.

Even if you are not a programmer, you will get the urge to create your own program. This usually happens when you seem some code on a web page or in a magazine that you just have to try. So then every once in a while you may actually need to create a simple program either for testing a system or just to create a quick utility. Most systems support GCC (a c compiler) although you may have to install some programs. i.e. “sudo apt-get install  build-essential”. Now let us create the world famous “HelloWorld” program for your system.

1. Create  or copy your source code into and editor such as vim, nano, joe, or etc. Be sure to save the file (aka source code) and then exit.   (source code is in the examples)

$ nano hw.c

Note:

 and 

are not entered into the editor.

2. The you need to convert the source code to an executable program.

# $ gcc sourcecode.c -o executablename
$ gcc hw.c -o hw

3. Run or execute your program. (if no errors are detected otherwise changes will need to be made and then recompiled),

$ ./hw
Hello World!

Or if you want sort of a gui:

$ ./hw | zenity –text-info

Pat your self on the back as you have created your first program! That is all there is to it for simple programs you create. More advanced programs will require a bit more work. More about that later.

Collected C source code from: http://www.geekboots.com/c/intro. Here are some basic examples that you will eventually use.

Basic file tools:
Simple output
Read a file
Write to a file

System tools:
Access the system
Remove a file
Copy a file

Basic i/o
———————————————-
Simple output

$ ./hw
Hello World!

#include<stdio.h>
int main()
{
/* Display text on the screen */
printf("Hello World!\n");
return 0;
}

Read a file

$ ./readfile
Get text as character from file
This is data to read.

Read file up to first blank space or line break
This


#include<stdio.h>
int main()
{
/* Declare File pointer */
FILE *fp;
char text, text1[10];
/* Open file 'myfile.txt' in read mode */
fp = fopen("myfile.txt", "r");
/* Read character on file using 'fgetc' function */
printf("Get text as character from file\n");
while( (text = fgetc(fp) ) != EOF )
printf("%c", text);
printf("\n");
/* Go to the beginning of the file */
fseek(fp,0L,0);
/* Read text on file using 'fscanf' function */
printf("Read file up to first blank space or line break\n");
fscanf(fp, "%s", text1);
printf("%s\n", text1);
/* Close file */
fclose(fp);
return 0;
}

Write to a file:

$ ./writfile
File created and written successfully!
eddie@oelt02:~/csource$ cat myfile.txt
Hello!
Hello World!

 #include<stdio.h>
int main()
{
/* Declare File pointer */
FILE *fp;
char text[10] = "Hello!";
int i = 0;
/* Create/Open file 'myfile.txt' in write mode */
fp = fopen("myfile.txt","w");
/* Write character on file using 'fputc' function */
while(text[i] != '\0')
{
fputc(text[i], fp);
i++;
}
/* Write text on file using 'fprintf' function */
fprintf(fp,"\nHello World!");
/* Checking error on file */
if (ferror(fp))
printf("Error occur...Try Again!\n");
else
printf("File created and written successfully!\n");
/* Close file */
fclose(fp);
return 0;
}

System tools:
—————————————————————-
Access the system:

$ ./sysaccess
Tue Sep  2 21:20:18 CDT 2014
cpvile.c  delfile.c  readfile.c  sysaccess.c

#include<stdlib.h>
int main()
{
/* System function use to run system commands */
/* Print date on the terminal */
system("date");
/* List directory content on the terminal */
system("ls");
return 0;
}

Remove a file:

$ ./delfile
File Deleted Successfully!
eddie@oelt02:~$ ./delfile
Unable to delete the file!
Error: No such file or directory

#include<stdlib.h>
int main()
{
/* System function use to run system commands */
/* Print date on the terminal */
system("date");
/* List directory content on the terminal */
system("ls");
return 0;
}

Copy a file:

$ ./cpfile
File copied successfully!


#include<stdio.h>
#include<stdlib.h>
int main()
{
/* Declare File pointer */
FILE *source, *destination;
char ch;
/* Open file 'myfile.txt' in read mode */
source = fopen("myfile.txt", "r");
/* Checking for file is properly open or not */
if(source == NULL)
{
printf("Error occur on file opening\n");
exit(EXIT_FAILURE);
}
/* Create/Open file 'newfile.txt' in write mode */
destination = fopen("newfile.txt", "w");
/* Checking for file is properly open or not */
if(destination == NULL)
{
fclose(source);
printf("Error occur on file opening\n");
exit(EXIT_FAILURE);
}
/* Copying text from one file to another */
while( ( ch = fgetc(source) ) != EOF)
fputc(ch, destination);
/* Checking error on file */
if (ferror(destination))
printf("Error occur...Try Again!\n");
else
printf("File copied successfully!\n");
/* Close file */
fclose(source);
fclose(destination);
return 0;
}

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

Data files:

myfile.txt, newfile.txt:

This is data to read

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

Question was asked recently what open software tools do we use or have used for tech support. Once, I thought about it the answer was, what do I not use. One of the first tools I ever used was Knoppix. Microsoft Windows did not have a free tool (there was a commercial one from sys internals) to boot to an operating system to rescue failed hard drives. Of course you could pull the drive and hook it to another machine, but that could be very iffy.

To back up files, I would boot with knoppix live cd (long before ubuntu) and make sure the drive was readable despite not being bootable. Then I would use the linux ntfs utilities and samba to log into the mswindows server and back up the user files to the home drive from linux. Of course you had to have admin rights to do that both on linux and MSWindows.  That made a lot of people happy that they did not lose all their data. Lastly,  the data was restored after a hard drive replacement and a new MSWindows was installed on the new drive. Then it was easy just to drag and drop files to the new system all under MSWindows.

Back then all we had was Samba3 and no gui utilities. Today things are a bit different.

apt-get install samba4 to get the latest version of Samba.
apt-get install cifs-utils to get necessary files/utils required to mount Windows shares.
Then do the following:
mkdir /mnt/share
Type the following command to mount the share:
mount -t cifs //windowsmachineip/sharename -o username=user,password=urPassword /mnt/share
On older machines the shares could be mounted as follows:
mount -t smbfs -o username=user,password=urPassword //windowsmachineip/sharename /mnt/share

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

Starter menu to show you the power of tput.

 

#!/bin/bash
#testmenu.sh
#test for tput cursor movements
#colour the screen
tput setb 3 #Green in xterm and brown in linux terminal
tput clear
#paint menu onto the screen
echo ""
echo ""
echo "TEST MENU"
echo "1 ..... ECHO 1"
echo "2 ..... ECHO 2"
echo "3 ..... ECHO 3"
echo "4 ..... QUIT"
echo ""
echo "Select item: "
#loop around gathering input until QUIT is more than 0
QUIT=0
while [ $QUIT -lt 1 ]
do
#Move cursor to after select message
tput cup 8 13
#Delete from cursor to end of line
 tput el
 read SEL
 if [ ${#SEL} -lt 1 ]
 then
 continue
 fi
 if [ $SEL -eq 4 ]
 then
QUIT=1
continue
 fi
 #put message in middle of screen
 tput cup 15 20
 #Delete from cursor to end of line
 tput el
 case $SEL in
*) echo "You selected $SEL";;
esac
done
#reset the screen
#Find out if this is a "linux" virtual terminal
if [ $TERM ~ "linux" ]
then
 tput setb 0 #reset background to black
fi
tput reset
tput clear

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

Not my idea, but thought this might be another article to look at. It is allegedly a video generator. http://sbc.rictor.org/io/vid3.html

I am obligated to also mention:
https://code.google.com/p/arduino-tvout/
http://www.gammon.com.au/forum/?id=11608
http://www.pyroelectro.com/tutorials/arduino_basic_vga/index.htmlhttp://forum.arduino.cc/index.php/topic,102181

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

Homemade chips

SUNP0052

Good day.

More than you can hold.

Leave a comment

Chit chat

———–

Supposedly an update to vim, so I updated my Arch Linux box.

Do mirror this blog to others, so I am not copying someone’s work.

Story about #Munich backing out of #linux is allegely overbloated. http://www.omgubuntu.co.uk/2014/08/munich-council-say-talk-limux-demise-greatly-exaggerated

When it comes to #computers: Amateurs #reinstall. Professionals fix the problem and only reinstall as a last resort. #tech #support

You feel foolish when you have installed applications on a #web server a zillion times, but you make simple mistakes like typing in a url of phpmysql when it should of been phpmyadmin. Been a while, but the app is installed.
#linux
Batch file to slowly print out a text file. Perfect for a quickie teleprompter.
Still use the Chumby for many things. One is a portable Muzak.
As time goes on…..

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

If you are into arduino type stuff, this may interest you.
Avrian Jump

===========

A very simple ladder language for programming ATMega168s from a web browser.

This started out as a desire to be able to program an [Arduino][] from an iOS device.  Since it doesn’t seem like compiler tools of any sort would get into the app store, I figured something would need to be done in HTML5.  And if a [PC emulator][pcemu] could be written in javascript, so could something like this.

However, recreating the Arduino IDE in HTML seemed like too much work, at least for a first try.  So I reduced the project into something much simpler, while still putting real machine code into the AVR’s flash.  A simple ladder language that compiled into AVR assembly, which would be assembled into machine code, seemed like like a resonable reduction.  With that I could take advantage of the [Audioino][] bootloader, to load right from the web page.

This is still unfinished, go see the TODO file.

Also go read issue #2, playing sounds encoded in data URIs in iOS 5.1 is broken. *sigh*

Try it out! [Avrian Jump](http://tadpol.github.com/Avrian-Jump/avrianjump.html)

Some other ways (likely better) of putting Arduino IDEs into web browsers:
– [wifino](http://www.wifino.com/)
-

[codebender](http://codebender.cc/)

The Ladder
———-

Each rung on the ladder has a single test and multiple actions.  Tests can check the digital pins, analog pins, and a couple of variables.  Each action can set a digital pin, a PWM output, or a variable.  Analog, PWM, and variables are 16bit values.

There is no ‘setup()’.  Analog pins are always analog inputs.  When specified in a test, a digital pin is set to an input then read.  When specified in an action, it is set to an output then set.

PWM code is still non-existant, so how this will actually work is up in the air.  How I want it to work is:  Specifying a pin in an action as a PWM output makes it a PWM output.  Specifying a pin in a test stops it from doing PWM output.  Specifying a digital state for the pin in an action also stops it from doing PWM output.

There is an ascii format of the ladders.  This was done because it seemed like it could be neat to be able to tweet ladders.  You can view the ascii format, and also load ladders from it.  The ascii parser skips anything it doesn’t recognise; it is a bit too forgiving at times.

An example program:

#Fast Blink LED
:T;A+=1
:A=16383;D13=1
:A=32767;D13=0,A=0

Mostly though, a ladder is converted into AVR assembly.

The Assembler
————-

The assembler is pretty basic. Lots of features commonly found in other assemblers are currently missing.  It does assemble the mneonics from [Atmel's pdf][avrasm] into machine code.  It supports labels, but not local labels.  It has simple parameter replacement, so common names can be defined for IO registers and memory regions and things.  It can also specify where in memory to put the machine code, and can specify immeadiate words to save in the machine code.

This assembler doesn’t know about the various AVR devices, and so will happily assemble any of the known mnemonics into the output.  Even if your target device has no idea what to do with them.  It has assembled blink tests for the ATmega168 and the ATTiny13, so it seems pretty flexable. (Avrian Jump currently only supports the ATmega168 though.  Maybe add others in the future, but would have to figure the bootloader thing out first.)

Outputs
——-

A ladder can be compiled into a few different formats:

- ASCII
– This the only form can can be converted back into a ladder.
– This is for sharing your ladder with others, or saving a ladder for later.
– S19
– If you don’t have an [Audioino][] bootloader, but still want to use a ladder.  A S19 can be ded with [avrdude][].
– WAV
– A [Audioino][] compatible wav file for loading the ladder onto an ATmega168 with the [Audioino][] bootloader installed.
– Assembler
– This is mostly around for debugging the ladder compiler.  It can be interesting to look at  too.

License
——-

Copyright (c) 2012 Michael Conrad Tadpol Tilstra

Licensed under the MIT License.

[Arduino]:http://www.arduino.cc/
[pcemu]:http://bellard.org/jslinux/
[avrasm]:http://www.atmel.com/atmel/acrobat/doc0856.pdf
[avrdude]:http://ladyada.net/learn/avr/avrdude.html
[Audioino]:http://www.hobby-roboter.de/forum/viewtopic.php?f=4&t=128&p=531

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

Legacy Robot notes.

Have not made much time to work on special projects. One thing I need to start back on is robopet.  There is nothing real super snazzy about this unit although it could be. Mainly I will use it for carrying snacks back and forth from the kitchen during sporting events. There will be a second level not currently attached to hold the goodies. More information about the unit follows.

Electronics:

Using an old Pentium I computer, usb wireless, DC battery power, dc-dc atx ps and compact flash with an ide conversion interface. Powered wheels came from two Tonka RC cars that I dissected.

Made a special wiring hardness to connect the parallel port with the control electronics. Now I need to start testing the electronics for the motor control. Hoping the h-bridge can take the current. If not, I think I have a IC that will. Worst case scenarios is to do it the old fashion way with transistors. After that, everything should fall into place.

Using a standard power supply to test the unit, but it will run on battery when I finish it. Since the motherboard is AT and the DC-DC PS is ATX, I had to make a special cable from scratch to interface the two. Tested the cable and it works.

Have the wireless working via a usb interface set up to work with a specific router via the mac address and the zone. Albeit the wireless is 11 mb, more than fast enough to receive and send communication

Special home made turn signals to be added also.

No sensors added yet.

Software:

The Linux OS is installed.  The OS resides on a compact flash.The iso file for the version of the Ubuntu distribution also resides on the flash drive and gets mounted as a loop.

Using my own home grown robot control software to gather data from sensors and to operate the unit. Found a binary of the very lightweight web server Boa on launchpad.net for the version of Ubuntu I am using. Installed it. Apache2 is too bulky for this project. Eventually, I want to make an autonomous unit.  This unit will be more like a remote controlled car via wifi.

Code to control the motors has already been tested (using parcon.c) and is working.   Using a hardwired connection, already tested client/server socket programming to communicate with and control the unit. That should be way more efficient and possibly more secure than using a web server per se..

Etc.

Had to make special adapter plates to connect the wheel assemblies to the cart. Originally I used clear plastic, but those broke too easily. Wood worked much better, but not as pretty. Attached a third generic cart wheel.

Extra: We installed ptelnet on an old Palm pda to use it as a dumb terminal. That way we do not have to hook the robot to a monitor when we want to access the unit. Saves electricity and makes it more portable. With the installation of Boa, the Chumby can also be used to control the robot without requiring an umbilical cord. Which means that getting an Android or the like tablet more feasible.

Added schematic for turning blinker.

Links:
http://www.instructables.com/id/Atx-to-At-ps-test-cable/
http://www.instructables.com/id/Linux-beginning-home-automation-on-a-server/
http://www.instructables.com/id/No-solder-parallel-port-break-out/
http://www.instructables.com/id/Mini-parallel-port-break-out-cable/
http://www.instructables.com/id/DB9-serial-break-out-cable/
http://www.instructables.com/id/Vga-breakout-cable/

Parcon.c for controlling parallel port

 #include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/io.h>

char *binprint( unsigned char x, char *buf )
{
  int i;
  for( i=0; i<8; i++ )
    buf[7-i]=(x&(1<<i))?'1':'0';
  buf[8]=0;
  return buf;
}

int main( int argc, char *argv[] )
{
  char c;
  unsigned char val;
  char buf[9];
  int x;
  if( argc<2 )
  {
    printf("  example usage: parcon 1l 2l 3h 5h 8l\n");
    return 2;
  }
  if( ioperm(888,1,1) )
  {
    printf("Couldn't get port 888\n");
    return 1;
  }
  val = inb(888);
  printf("old = %s\n",binprint(val,buf));
  for( x=1; x<argc; x++ )
    if( argv[x][1]!='h' )
      val &= ~(1<<(argv[x][0]-'1'));
    else
      val |= 1<<(argv[x][0]-'1');
 
  printf("new = %s\n",binprint(val,buf));
  outb(val,888);
  return 0;
}

Photos:

------------------------------------------------------

One way to recycle an old case cover.

Variation for pants.

------------------------------------------------------

 If you ever take the time to see what vim can do you would be very surprised.

------------------------------------------------------

Math can be interesting! This is oversimplified, but we can use math for many things. One is that might want to know the position of a motor. In electronics, we might want to know what part of an AC cycle we are in such as reading oscilloscopes. . What is even more interesting, we do not have to have some fancy computer language in most cases to calculate what we need.  Then if you want to, you can port the code to a fancier language and or system.

Sine wave graph

$ ./sine

 cat sine.bas
'rem  ----------------------------
'rem sine wave
'rem -----------------------------
?
?"Sine wave graph"
?
?
?tab(14);"- 1";tab(40);"0";tab(63);"+ 1"
?"Degrees";tab(14);
for j = 1 to 52
    ?"-";
Next j
?
for L = 0 to 360 step 7.5
    let x =  L / 57.19578
    'rem what makes the curve
    let r = sin(x)
    let s = int((r*25) + .5)

          if s<0 then? L;tab(s+40);"*";tab(40);":" 

          if s=0 then ? L;tab(40);"*"
    
          if S>0 then? L;TAB(40);":";tab(s+40);"*"
Next L
end

Cosine graph:

$ cat cosine.bas

'rem  ----------------------------
'rem cosine wave
'rem -----------------------------
?
?"Cosine wave graph"
?
?
?tab(14);"- 1";tab(40);"0";tab(63);"+ 1"
?"Degress";tab(14);
for j = 1 to 52
    ?"-";
Next j
?
for L = 0 to 360 step 7.5
    let x =  L / 57.19578
    'rem what makes the curve
    let r = cos(x)
    let s = int((r*25) + .5)

          if s<0 then? L;tab(s+40);"*";tab(40);":" 

          if s=0 then ? L;tab(40);"*"
   
          if s>0 then? L;TAB(40);":";tab(s+40);"*"
Next L
end

Note: Freebasic was used to compile the code on a Linux based system.

--------------------------------------

Update: For those of you who prefer C,  we found some code for the sine and cosine.

Sine:

$ ./sine

sine.c   (gcc sine.c -lm -o sine)

 

#include <stdio.h>
#include <math.h>

#define WIDTH 60
#define HEIGHT 20
#define X WIDTH/2
#define Y HEIGHT/2
#define XMAX WIDTH-X-1
#define XMIN -(WIDTH-X)
#define YMAX HEIGHT-Y
#define YMIN -(HEIGHT-Y)+1

char grid[HEIGHT][WIDTH];

int plot(int x, int y);
void init_grid(void);
void show_grid(void);

int main()
{
    float x,y;

    init_grid();
    for(x=-3.14159;x<=3.14159;x+=0.1)
    {

// line to change (sin, cos, tan, or etc)

        y = sin(x);
        plot(rintf(x*10),rintf(y*8));
    }
    show_grid();

    return(0);
}

/* Set "pixel" at specific coordinates */
int plot(int x, int y)
{
    if( x > XMAX || x < XMIN || y > YMAX || y < YMIN )
        return(-1);

    grid[Y-y][X+x] = '*';
    return(1);
}

/* Initialize grid */
void init_grid(void)
{
    int x,y;

    for(y=0;y<HEIGHT;y++)
        for(x=0;x<WIDTH;x++)
            grid[y][x] = ' ';
    /* draw the axis */
    for(y=0;y<HEIGHT;y++)
        grid[y][X] = '|';
    for(x=0;x<WIDTH;x++)
        grid[Y][x] = '-';
    grid[Y][X] = '+';
}

/* display grid */
void show_grid(void)
{
    int x,y;

    for(y=0;y<HEIGHT;y++)
    {
        for(x=0;x<WIDTH;x++)
            putchar(grid[y][x]);
        putchar('\n');
    }
}

Cosine:

cosine.c   (gcc cosine.c -lm -o cosine)

 #include <stdio.h>
#include <math.h>

#define WIDTH 60
#define HEIGHT 20
#define X WIDTH/2
#define Y HEIGHT/2
#define XMAX WIDTH-X-1
#define XMIN -(WIDTH-X)
#define YMAX HEIGHT-Y
#define YMIN -(HEIGHT-Y)+1

char grid[HEIGHT][WIDTH];

int plot(int x, int y);
void init_grid(void);
void show_grid(void);

int main()
{
    float x,y;

    init_grid();
    for(x=-3.14159;x<=3.14159;x+=0.1)
    {

// line to change (sin, cos, tan, or etc)

        y = cos(x);
        plot(rintf(x*10),rintf(y*8));
    }
    show_grid();

    return(0);
}

/* Set "pixel" at specific coordinates */
int plot(int x, int y)
{
    if( x > XMAX || x < XMIN || y > YMAX || y < YMIN )
        return(-1);

    grid[Y-y][X+x] = '*';
    return(1);
}

/* Initialize grid */
void init_grid(void)
{
    int x,y;

    for(y=0;y<HEIGHT;y++)
        for(x=0;x<WIDTH;x++)
            grid[y][x] = ' ';
    /* draw the axis */
    for(y=0;y<HEIGHT;y++)
        grid[y][X] = '|';
    for(x=0;x<WIDTH;x++)
        grid[Y][x] = '-';
    grid[Y][X] = '+';
}

/* display grid */
void show_grid(void)
{
    int x,y;

    for(y=0;y<HEIGHT;y++)
    {
        for(x=0;x<WIDTH;x++)
            putchar(grid[y][x]);
        putchar('\n');
    }
}

------------------------------------------------------

The above graphic is nice but what is the date for a particular day. How about the day 214? Supposedly close to the hottest day of the year, then what actual day is that?

Usage: ./main dayofyear year

$ ./main 214 2014
Result: day 214 of year 2014 is '08/02/2014'.

To confirm it:

So it looks like August 2, is near the hottest day of the year.

$ gcc main.c -o main

main.c

 #define _XOPEN_SOURCE /* glibc2 needs this for strptime */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>  
#include <errno.h>

int to_date(
  char * date,
  const size_t size,
  const char * fmt,
  const short unsigned int day_of_year,
  const short unsigned int year)
{
  char buffer[16] = "";

  sprintf(buffer, "%hu %hu", day_of_year, year);

  {
    struct tm t = {0};
    char * presult = strptime(buffer, "%j %Y", &t);

    if ((NULL == presult) || ('\0' != *presult))
    {
      errno = EINVAL;
      return -1;
    }

    strftime(date, size, fmt, &t);
  }

  return 0;
}

int main(int argc, char ** argv)
{
  if (2 > argc)
  {
    fprintf(stderr, "Missing arguments. Usage: %s day-of-year year\n", argv[0]);
    return EXIT_FAILURE;
  }

  short unsigned int day_of_year = atoi(argv[1]);
  short unsigned int year = atoi(argv[2]);
  char date[16] = "";

  if (-1 == to_date(date, sizeof(date), "%m/%d/%Y", day_of_year, year))
  {
    perror("to_date() failed");
    return EXIT_FAILURE;
  }

  printf("Result: day %d of year %d is '%s'.\n", day_of_year, year, date);

  return EXIT_SUCCESS;
}

------------------------------------------------------

 

Light on is a one and light off is a zero.

There is an old joke that says: "There are only 10 types of people in the world: those who understand binary" In any case, it does not hurt to at least look at binary once in a while. Ascii (American standard code for information interchange) is usually eight binary characters of ones or zeroes. So you can take the first 8 ones and zeros for the first character.

Then to further split out the whole code sequence:

01000001 01010010 01010000 01000001 01001110 01000101 01010100

Then you can convert on character at a time.  You can just look at a table or write a program to do it.


</pre>
<pre><code class="language-js"><html>
<head>

<script type="text/javascript">
var input_id = "bin_text";
var answer_id = "answer";

function convertToASCII() {
 var bin_text = document.getElementById(input_id);
 var answer = document.getElementById(answer_id);

 if (!answer) {
  alert("Error: No element with id \""+answer_id+"\".");
  return;
 }
 if (bin_text)
  var text = bin_text.value;
 else {
  error("No element with id \""+input_id+"\".");
  return;
 }
 var divisible = text.length % 8;
 var nonBinary = /[^0|1]/.test(text);
 if (text.length > 0 && divisible == 0 && !nonBinary) {
  var regex = /[0|1]{8}/g;
  var str = text.match(regex);
  var code = 0;
  var placeVal, exp, digit;
  var ascii = '';
  while (str.length > 0) {
   code = 0;
   for (var i=0; i<str[0].length; i++) {
    placeVal = 7-i;
    exp = Math.pow(2, i);
    digit = str[0].charAt(placeVal);
    code += exp*digit;
   }
   str.shift();
   ascii += String.fromCharCode(code);
  }
  answer.innerHTML = "<p class=\"binary\">" + ascii + "</p>";
 }
 else {
  error("Malformed binary.");
  return;
 }

 function error(errText) {
  answer.innerHTML = "<span class=\"error\">Error: " + errText + "</span>";
 }
}
</script>

<style type="text/css">
.block {
 width: 45%;
 border: 1px solid #000000;
 padding: 10px;
}
.binary {
 background-color: #C6FFC7;
 padding: 3px;
}
.error {
 background-color: #FFC6C6;
 padding: 3px;
}
</style>

</head>
<body>

<div style="float:left;" class="block">
 <form onSubmit="convertToASCII(); return false;">
  <p>Enter some binary to decode:</p>

  <input type="text" id="bin_text"/>
 </form>
</div>

<div style="float:right;" class="block">
 <p id="answer"><br/></p>
</div>

</body>
</html></code></pre>
<pre>

------------------------------------------------------

Macaroni maker?

maacaronipress

Good day.

Feetball time.

Leave a comment

Chit chat

———-

Went through the old closet and found a few legacy parts or two.

Was able to use a couple of posts from chat sites as the basis for an article or two.

—————————————————
Play the lottery? Here is a simple random number generator to pontificate the numbers. Run it as many times as there are picks.

lg.sh:

echo Lottery generator
echo
echo -n "Enter number of balls: "
read nodf
echo -n "Enter number of choices: "
read b
declare -i X=$b
for i in $(seq 1 1 $nodf)
do
NUM=$[ ( $RANDOM % $X ) + 1 ];
echo "The winner is for ball number $i:" $NUM
done

Enter number of balls: 5
Enter number of choices: 50
The winner is for ball number 1: 32
The winner is for ball number 2: 43
The winner is for ball number 3: 23
The winner is for ball number 4: 18
The winner is for ball number 5: 38

Don’t forget to “chmod +x” it. Great for choosing winners randomly in a contest. Write the number down after each toss. I will let you mod the code to save the numbers.

Note: it does not check for duplicates.

Another way to do it.

usage ./rndom choicesperball numberofballs

$ ./rndom.sh 50 5

Choices per ball are 50 and the number of balls is 5

Ball number 1 is 35
Ball number 2 is 31
Ball number 3 is 6
Ball number 4 is 42
Ball number 5 is 3

$ cat rndom.sh

#!/bin/bash
clear
echo “Choices per ball are $1 and the number of balls is $2″
echo
for (( c=1; c<=$2; c++ ))
do
echo “Ball number $c is $[($RANDOM % $1)]“
done

Note: this is a good way to give out prizes at a meeting. Just make sure everyone has their own number.

One last variation:

$ shuf -i 1-49 -n18 | xargs -n6
41 34 28 4 36 45
7 2 31 25 38 14
44 32 6 17 11 46
$ shuf -i 1-49 -n24 | xargs -n6
41 13 10 45 29 30
47 43 33 9 32 34
18 36 14 44 48 8
38 31 26 6 35 39

$ shuf -i 1-49 -n28 | xargs -n7
34 10 5 45 43 35 2
42 18 7 22 30 47 23
13 6 19 49 48 4 11
24 8 20 29 31 17 27

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

Not really what I had in mind…

Had to stay at my brother’s house during a recent summer while the AC was being replaced. While there, he was kind enough to let me access his wifi. It was real easy. You just log in and your on-line. The neat part of it was you are blocked out of using the local area network. He uses a wireless router from that company in Cupertino, California. I wanted to have the same thing but did not want to spend one hundred plus dollars on a new router like he did.

Recently I purchased a used Cisco Linksys wrt-54g from the local Goodwill store specializing in computer stuff real cheap. Knew that you could upgrade the firmware with dd-wrt, openwrt, and a host of others. In fact, I think I had installed dd-wrt. Wanted more like what my brother has. After doing some research, I found some firmware. Known as CoovaAP, it is known is what is called a Wisp (wifi inTERnet service provider. Well I wanted it for our intranet (local area full service network without internet access).

We have sort of our own mini cloud (web, media and etc.) servers. So it still is a Wisp (Wireless inTRAnet service provider. You can also set this software for a stand alone machine acting as a wireless access point.

Installed CoovaAP on the router and now it can be accessed within the range of the router. This is a great set up say for a school, church, or in a small town. More information at: http://www.coova.org/CoovaAP
and http://www.howtoforge.com/wireless_hotspot_howto
http://www.howtoforge.com/wireless_hotspot_howto 

—————————————————
When considering getting an old computer, one of the biggest telltale features to consider before acquiring the system (unless you get it for free) are the capacitors. Avoid the system if it has bad capacitors.

Learning how to de-solder and solder can be helpful. Why throw away a good motherboard if you can fix it without too much trouble.Hopefully that is what I can do with this motherboard.

A while back lots of brand name computers had bad capacitors.  People were getting the monitors and computers for scrap. Once the caps were replaced, the equipment was sold for full resale price.

 

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

If you are into arduino type stuff, this may interest you.
Avrian Jump

===========

A very simple ladder language for programming ATMega168s from a web browser.

This started out as a desire to be able to program an [Arduino][] from an iOS device.  Since it doesn’t seem like compiler tools of any sort would get into the app store, I figured something would need to be done in HTML5.  And if a [PC emulator][pcemu] could be written in javascript, so could something like this.

However, recreating the Arduino IDE in HTML seemed like too much work, at least for a first try.  So I reduced the project into something much simpler, while still putting real machine code into the AVR’s flash.  A simple ladder language that compiled into AVR assembly, which would be assembled into machine code, seemed like like a resonable reduction.  With that I could take advantage of the [Audioino][] bootloader, to load right from the web page.

This is still unfinished, go see the TODO file.

Also go read issue #2, playing sounds encoded in data URIs in iOS 5.1 is broken. *sigh*

Try it out! [Avrian Jump](http://tadpol.github.com/Avrian-Jump/avrianjump.html)

Some other ways (likely better) of putting Arduino IDEs into web browsers:
– [wifino](http://www.wifino.com/)
-

[codebender](http://codebender.cc/)

The Ladder
———-

Each rung on the ladder has a single test and multiple actions.  Tests can check the digital pins, analog pins, and a couple of variables.  Each action can set a digital pin, a PWM output, or a variable.  Analog, PWM, and variables are 16bit values.

There is no ‘setup()’.  Analog pins are always analog inputs.  When specified in a test, a digital pin is set to an input then read.  When specified in an action, it is set to an output then set.

PWM code is still non-existant, so how this will actually work is up in the air.  How I want it to work is:  Specifying a pin in an action as a PWM output makes it a PWM output.  Specifying a pin in a test stops it from doing PWM output.  Specifying a digital state for the pin in an action also stops it from doing PWM output.

There is an ascii format of the ladders.  This was done because it seemed like it could be neat to be able to tweet ladders.  You can view the ascii format, and also load ladders from it.  The ascii parser skips anything it doesn’t recognise; it is a bit too forgiving at times.

An example program:

#Fast Blink LED
:T;A+=1
:A=16383;D13=1
:A=32767;D13=0,A=0

Mostly though, a ladder is converted into AVR assembly.

The Assembler
————-

The assembler is pretty basic. Lots of features commonly found in other assemblers are currently missing.  It does assemble the mneonics from [Atmel's pdf][avrasm] into machine code.  It supports labels, but not local labels.  It has simple parameter replacement, so common names can be defined for IO registers and memory regions and things.  It can also specify where in memory to put the machine code, and can specify immeadiate words to save in the machine code.

This assembler doesn’t know about the various AVR devices, and so will happily assemble any of the known mnemonics into the output.  Even if your target device has no idea what to do with them.  It has assembled blink tests for the ATmega168 and the ATTiny13, so it seems pretty flexable. (Avrian Jump currently only supports the ATmega168 though.  Maybe add others in the future, but would have to figure the bootloader thing out first.)

Outputs
——-

A ladder can be compiled into a few different formats:

- ASCII
– This the only form can can be converted back into a ladder.
– This is for sharing your ladder with others, or saving a ladder for later.
– S19
– If you don’t have an [Audioino][] bootloader, but still want to use a ladder.  A S19 can be ded with [avrdude][].
– WAV
– A [Audioino][] compatible wav file for loading the ladder onto an ATmega168 with the [Audioino][] bootloader installed.
– Assembler
– This is mostly around for debugging the ladder compiler.  It can be interesting to look at  too.

License
——-

Copyright (c) 2012 Michael Conrad Tadpol Tilstra

Licensed under the MIT License.

[Arduino]:http://www.arduino.cc/
[pcemu]:http://bellard.org/jslinux/
[avrasm]:http://www.atmel.com/atmel/acrobat/doc0856.pdf
[avrdude]:http://ladyada.net/learn/avr/avrdude.html
[Audioino]:http://www.hobby-roboter.de/forum/viewtopic.php?f=4&t=128&p=531

————————————
Football time again. Here is a quick script to get some nfl scores. You will have to read the script to set the values for what part of the season and what week to show. I did not put a lot of time into formatting as it is easy for me to read as is.  The script might be use for other sports depending on the format.

------------------------------------------------
nfl data for phase = 1 week = 3 season = 2014
------------------------------------------------

       Home           Score              Away

Thursday, August 14 - (Preseason)
Jacksonville 19 - 20 Chicago Final
Friday, August 15 - (Preseason)
Philadelphia 35 - 42 New England Final
Tennessee 24 - 31 New Orleans Final
Detroit 26 - 27 Oakland Final
San Diego 14 - 41 Seattle Final
Saturday, August 16 - (Preseason)
Green Bay 21 - 7 St. Louis Final
NY Jets 25 - 17 Cincinnati Final
Baltimore 37 - 30 Dallas Final
NY Giants 27 - 26 Indianapolis Final
Buffalo 16 - 19 Pittsburgh Final
Miami 20 - 14 Tampa Bay Final
Atlanta 7 - 32 Houston Final
Arizona 28 - 30 Minnesota Final
Sunday, August 17 - (Preseason)
Denver 34 - 0 San Francisco Final
Kansas City 16 - 28 Carolina Final
Monday, August 18 - (Preseason)
Cleveland 23 - 24 Washington Final

Standings

* AFC
* NFC

East

East
Team W L T Pct
NY Jets 2 0 0 1.000
Miami 1 1 0 .500
New England 1 1 0 .500
Buffalo 1 2 0 .333


North

North
Team W L T Pct
Baltimore 2 0 0 1.000
Pittsburgh 1 1 0 .500
Cincinnati 0 2 0 .000
Cleveland 0 2 0 .000


South

South
Team W L T Pct
Houston 1 1 0 .500
Jacksonville 1 1 0 .500
Tennessee 1 1 0 .500
Indianapolis 0 2 0 .000


West

West
Team W L T Pct
Denver 2 0 0 1.000
Kansas City 1 1 0 .500
Oakland 1 1 0 .500
San Diego 1 1 0 .500


East

East
Team W L T Pct
NY Giants 3 0 0 1.000
Washington 2 0 0 1.000
Dallas 0 2 0 .000
Philadelphia 0 2 0 .000


North

North
Team W L T Pct
Chicago 2 0 0 1.000
Minnesota 2 0 0 1.000
Detroit 1 1 0 .500
Green Bay 1 1 0 .500


South

South
Team W L T Pct
New Orleans 2 0 0 1.000
Atlanta 1 1 0 .500
Carolina 1 1 0 .500
Tampa Bay 0 2 0 .000


West

West
Team W L T Pct
Arizona 1 1 0 .500
Seattle 1 1 0 .500
San Francisco 0 2 0 .000
St. Louis 0 2 0 .000


Full Standings

---------------------------------------------



 ####################################
# Score  Grabber
#
#===============================
# Assignments
# --------------------------------
datafile="nflscorefile"
a=1
flag=0
week=3
# phase 1 is preseason phase 2 is regular season #phase 3 is
phase=1
season=2014
#finished week = 1 unfinished week = 0
weekfinished=1
league="nfl"
# end assignments
#=================================
#
# Get data file
#---------------------------------
case $weekfinished in
1)
elinks "http://sports.yahoo.com/$league/scoreboard/?week=$week&phase=$phase&season=$season"  > $datafile
;;
0)
elinks "http://sports.yahoo.com/$league/scoreboard/"  > $datafile
;;
*)
#
;;
esac
#=================================
#
# Extract and display data
#---------------------------------
while read line
do fdata[$a]=$line
echo $line | grep -q "Home Score Away"
if  [ $? -eq 0 ]; then
# header
clear
echo
echo ------------------------------------------------
echo  $league  data for phase = $phase  week = $week  season = $season
echo ------------------------------------------------
echo
echo "       Home           Score              Away"
echo ""
let "flag = 1"
fi
if [ $flag -eq 1 ]; then
echo $line | grep -q "Latest NFL Videos"
if [ $? -eq 0 ]; then
let "flag = 0"
else
echo $line | grep -q "Home Score Away"
if  [ $? -ne 0 ]; then
case $weekfinished in
1)
echo $line | sed 's/\[.*\]//'
;;
0)
echo $line
;;
*)
#
;;
esac
fi
fi
fi
let "a += 1"
done < $datafile
# footer
echo ---------------------------------------------
echo
#===============================
# End.
################################

---------------------------------------------------

You could always go to the brand name software, but it does not always fit especially on embedded devices. Linux and BSD are more diversified.

http://www.instructables.com/id/Give-your-Cisco-Linksys-NSLU2-some-muscle-part-1/

--------------------------------------------------

Graphic is nice but what is the date for a particular day. How about the day 214? Supposedly close to the hottest day of the year, then what actual day is that?

Useage: ./main dayofyear year

$ ./main 214 2014
Result: day 214 of year 2014 is '08/02/2014'.

To confirm it:

Screenshot - 08232014 - 08:11:48 PM

So it looks like August 2, is near the hotest day of the year.

$ gcc main.c -o main

main.c

 #define _XOPEN_SOURCE /* glibc2 needs this for strptime */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>  
#include <errno.h>

int to_date(
  char * date,
  const size_t size,
  const char * fmt,
  const short unsigned int day_of_year,
  const short unsigned int year)
{
  char buffer[16] = "";

  sprintf(buffer, "%hu %hu", day_of_year, year);

  {
    struct tm t = {0};
    char * presult = strptime(buffer, "%j %Y", &t);

    if ((NULL == presult) || ('\0' != *presult))
    {
      errno = EINVAL;
      return -1;
    }

    strftime(date, size, fmt, &t);
  }

  return 0;
}

int main(int argc, char ** argv)
{
  if (2 > argc)
  {
    fprintf(stderr, "Missing arguments. Usage: %s day-of-year year\n", argv[0]);
    return EXIT_FAILURE;
  }

  short unsigned int day_of_year = atoi(argv[1]);
  short unsigned int year = atoi(argv[2]);
  char date[16] = "";

  if (-1 == to_date(date, sizeof(date), "%m/%d/%Y", day_of_year, year))
  {
    perror("to_date() failed");
    return EXIT_FAILURE;
  }

  printf("Result: day %d of year %d is '%s'.\n", day_of_year, year, date);

  return EXIT_SUCCESS;
}

---------------------------------------------------

Arpanet

Ascii is usally eight binary characters of ones or zeroes. So you can take the first 8 ones and zeros for the first character.

Then to further split out the whole code sequence:

01000001 01010010 01010000 01000001 01001110 01000101 01010100

Then you can convert on character at a time.  You can just look at a table or write a program to do it.

 


</pre>
<pre><code class="language-js"><html>
<head>

<script type="text/javascript">
var input_id = "bin_text";
var answer_id = "answer";

function convertToASCII() {
 var bin_text = document.getElementById(input_id);
 var answer = document.getElementById(answer_id);

 if (!answer) {
  alert("Error: No element with id \""+answer_id+"\".");
  return;
 }
 if (bin_text)
  var text = bin_text.value;
 else {
  error("No element with id \""+input_id+"\".");
  return;
 }
 var divisible = text.length % 8;
 var nonBinary = /[^0|1]/.test(text);
 if (text.length > 0 && divisible == 0 && !nonBinary) {
  var regex = /[0|1]{8}/g;
  var str = text.match(regex);
  var code = 0;
  var placeVal, exp, digit;
  var ascii = '';
  while (str.length > 0) {
   code = 0;
   for (var i=0; i<str[0].length; i++) {
    placeVal = 7-i;
    exp = Math.pow(2, i);
    digit = str[0].charAt(placeVal);
    code += exp*digit;
   }
   str.shift();
   ascii += String.fromCharCode(code);
  }
  answer.innerHTML = "<p class=\"binary\">" + ascii + "</p>";
 }
 else {
  error("Malformed binary.");
  return;
 }

 function error(errText) {
  answer.innerHTML = "<span class=\"error\">Error: " + errText + "</span>";
 }
}
</script>

<style type="text/css">
.block {
 width: 45%;
 border: 1px solid #000000;
 padding: 10px;
}
.binary {
 background-color: #C6FFC7;
 padding: 3px;
}
.error {
 background-color: #FFC6C6;
 padding: 3px;
}
</style>

</head>
<body>

<div style="float:left;" class="block">
 <form onSubmit="convertToASCII(); return false;">
  <p>Enter some binary to decode:</p>

  <input type="text" id="bin_text"/>
 </form>
</div>

<div style="float:right;" class="block">
 <p id="answer"><br/></p>
</div>

</body>
</html></code></pre>
<pre>

---------------------------------------------------

Sometimes simple just works. Rice boiled in liquid from poaching chicken breasts,

green peas, and sauteed ground turkey.

SUNP0030

Good day,

One more day.

Leave a comment

Chit chat

———-

Schools want to reduce math and science classes for alleged lack of interest. I think it is an instructor issue instead.

Working on some stuff for an or two.

If you think the command line is too hard, then try these.

What do you really own?
Using the Arduino and ethernet for a web interface to control audio inputs and outputs via 4066 ic’s.
Have a little fun with your home web server. Imagine you are a fancy restaurant.

 

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

Use the Arduino + ethernet when your server is down for a temporary site to let your users know what is going on.pertinent code:

client.println(“<center>”);client.println(“<h1>Your server name<h1>”);
client.println(“<hr”);
client.println(“<br />”);client.println(“<h2>Bear with us as the server is under reconstruction!</h2>”);
client.println(“<img src=’http://www.seemyheart.org/wp-content/uploads/2013/06/Website_Under_Construction.gif‘ height=500 width=500 />”);
client.println(“</center>”);

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

Just had to try this.

SUNP0027

We have a boat load of negatives that should be in picture files.

The form: (not actual size).

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

Just a simple batch file to collect information about your computer.  A bit dated and there are probably some commands that should have been included, but a good list of commands you can use to find out about your linux box. You have to install some of the commands for them to work. You do not have to use all the commands like I did, but it will be interesting to see what is in the file generated. Great for documentation about the system. Good list to have for insurance purposes.

usage: sudo ./hwinfo2file.sh filename

$ sudo ./hwinfo2file.sh My_desktop_computer_info

hwinfo2file.sh

echo "================================="
cat /etc/hostname
echo "getting stats"
file=$1.txt
# file="system.txt"
echo " " &gt; $file
echo "=====================================" &gt;&gt; $file
echo&nbsp; get computername &gt;&gt; $file
cat /etc/hostname &gt;&gt; $file
echo "=====================================" &gt;&gt; $file
echo&nbsp; get current ip connections &gt;&gt; $file
sudo ifconfig &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get linux version &gt;&gt; $file
lsb_release -a &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get memory specs &gt;&gt; $file
free &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get file storage statistics &gt;&gt; $file
df -h &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get mounted file system list &gt;&gt; $file
cat /etc/fstab &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get pci specs &gt;&gt; $file
sudo lspci &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get loaded modules &gt;&gt; $file
sudo lsmod &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get current usb attachments. &gt;&gt; $file
sudo lsusb &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo get repos &gt;&gt; $file
cat /etc/apt/sources.list &gt;&gt; $file
# echo "-------------------------------------" &gt;&gt; $file
# echo&nbsp; get installed software &gt;&gt; $file
# sudo dpkg --get-selections &gt;&gt; $file
# echo "-------------------------------------" &gt;&gt; $file
# echo&nbsp; get hardware info &gt;&gt; $file
# sudo lshw &gt;&gt; $file
# echo "-------------------------------------" &gt;&gt; $file
# echo&nbsp; get scsi devices &gt;&gt; $file
# sudo lsscsi &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; display /etc/issue &gt;&gt; $file
cat /etc/issue &gt;&gt; $file
# echo "-------------------------------------" &gt;&gt; $file
# echo&nbsp; get boot up info &gt;&gt; $file
# dmesg &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get users &gt;&gt; $file
cat /etc/passwd &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get current users on system &gt;&gt; $file
who &gt;&gt; $file
# echo "-------------------------------------" &gt;&gt; $file
# echo&nbsp; get system messages &gt;&gt; $file
# cat /var/log/messages &gt;&gt; $file
# echo "-------------------------------------" &gt;&gt; $file
# echo&nbsp; get rootkit checker log &gt;&gt; $file
# cat /var/log/rkhunter.log &gt;&gt; $file
# echo "-------------------------------------" &gt;&gt; $file
# echo&nbsp; get syslog &gt;&gt; $file
# cat /var/log/syslog &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get scheduled events &gt;&gt; $file
cat /etc/anacrontab &gt;&gt; $file
cat /etc/crontab &gt;&gt; $file

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

To install Statusnet, you need to go download the latest version. Once completing that, you can transfer the file to the server. (of course, you can download the file direct to the server.) We do everything from the command line to the server when we can.

$ scp statusnet-1.1.1.tar.gz  oeorgan1:~/.

statusnet-1.1.1.tar.gz                        100% 8869KB   4.3MB/s   00:02
$

Now to go to the server to do the install.

eddie@oelt02:~$ ssh oeorgan1

Welcome to Ubuntu 12.04.5 LTS (GNU/Linux 3.2.0-41-generic i686)

* Documentation:  https://help.ubuntu.com/

New release ‘14.04.1 LTS’ available.
Run ‘do-release-upgrade’ to upgrade to it.

Last login: Sat Aug 16 10:34:43 2014 from oelt02.local
$

Is it there?

$ ls statusnet-1.1.1.tar.gz
statusnet-1.1.1.tar.gz
$

Make a directory to work in .

$ makedir statusnet
$ cd statusnet

Expand the archive

/statusnet$  tar zxvf ~/statusnet-1.1.1.tar.gz



statusnet-1.1.1/theme/neo/images/lightbox_bg.png
statusnet-1.1.1/theme/neo/images/lock.png
statusnet-1.1.1/theme/neo/images/lock_open.png
statusnet-1.1.1/theme/neo/images/magnifier.png
statusnet-1.1.1/theme/neo/images/resultset_next.png
statusnet-1.1.1/theme/neo/images/rosette.png
statusnet-1.1.1/theme/neo/images/tick.png
statusnet-1.1.1/theme/neo/logo.png
statusnet-1.1.1/theme/neo/mobilelogo.png
statusnet-1.1.1/theme/neo/theme.ini

/statusnet$statusnet$
/statusnet$ cd statusnet-1.1.1/
/statusnet/statusnet-1.1.1$ ls
actions               doc-src          install.php            plugins
apple-touch-icon.png  EVENTS.txt       js                     PLUGINS.txt
avatar                extlib           lib                    README
background            favicon.ico      lighttpd.conf.example  scripts
classes               file             local                  tests
CONFIGURE             htaccess.sample  locale                 theme
COPYING               index.php        mail-src               UPGRADE
db                    INSTALL          Makefile

Get the instructions to follow

/statusnet/statusnet-1.1.1$ Vim README

Move the extracted directory to the web directory area.

$ sudo mv statusnet-1.1.1/ /var/www/sn
$ sudo apt-get install php5-curl
$ sudo service apache2 restart

Set ownership

chgrp www-data /var/www/sn/
or
$ sudo chown -R www-data:www-data sn

Set file permissions

$ sudo chmod a+w /var/www/sn/

$ sudo  chmod a+w /var/www/statusnet/avatar
$ sudo  chmod a+w /var/www/statusnet/background
$ sudo  chmod a+w /var/www/statusnet/file
or
$ sudo chmod -R 755 sn

Via command line set up mysql
Create a database to hold your microblog data. Something like this
should work:

mysqladmin -u “username” –password=”password” create statusnet

Note that StatusNet must have its own database; you can’t share the
database with another program. You can name it whatever you want,
though.

(If you don’t have shell access to your server, you may need to use
a tool like PHPAdmin to create a database. Check your hosting
service’s documentation for how to create a new MySQL database.)

Create a new database account that StatusNet will use to access the
database. If you have shell access, this will probably work from the
MySQL shell:

GRANT ALL on statusnet.*
TO ‘statusnetuser’@’localhost’
IDENTIFIED BY ‘statusnetpassword';or use phpmyadmin

or use phpmyadmin (requires superuser power)

Be sure to reload privileges before exiting.

Go to the web site and then install setup

Follow instructions:

Log in as an admin and setup the site. Would not hurt to set up a pointer on the menu to the site from your main page.

Have fun!

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

Sheldon’s favorite: pasta and weenies.

SUNP0020 SUNP0022

Good day.

The Computothoughts.

Leave a comment

Computothought

 

computothought

and introducing Miss Computothought Jr.

Screenshot - 08112014 - 03:46:55 AM

 

Older Entries

Follow

Get every new post delivered to your Inbox.