Monday, July 30, 2012

They say your computer could have a virus!

There is this one commercial that really makes me chuckle a bit. It is not about the product or service that they sell. Since I do not generally use Microsoft products, I will not be using their product to judge it. What I do take issue with is that they seem to suggest that if you get viruses and the like, your hardware could become totally useless.
Have not seen in many years where viruses made your hardware worthless. When I see the picture of abandoned equipment, I feel like a kid in a candy store thinking what all I could do with that probably perfectly good equipment. Even if the equipment had seen it’s best days, there are ways re-purpose or recycle such equipment. For some examples: http://www.instructables.com/id/Reuses-for-legacy-computers/ and http://www.instructables.com/id/Reuses-for-legacy-computers-II/.
Now, to a better prospect. If  there is nothing wrong with the equipment, why discard it?  You could have your equipment’s software cleaned up and you will be able to reuse your system again. But, then that leads to a bigger question of, why are you using software that get’s you in that predicament in the first place.

Think Linux!

Saturday, July 28, 2012

Pull down menus.

Just some quickie code for a pull down menu.


Html links will probably not work for you but you should get the idea. Notice the commented out line.


[code]
<td>
<form name="jump5">
<select name="menu5" onclick="top.location=document.jump5.menu5.options[document.jump5.menu5.selectedIndex].value;" value="GO">
<option value="http://oesrvr1/">Staff Tools</option>
<option value="../sql-ledger/">Accounting</option>
<option value="../webcal">Calendar</option>
<option value="../osv">College mgmt</option>
<option value="../eyeOS">Desktop</option>
<option value="../webERP">ERP</option>
<option value="../fo">Feng office</option>
<option value="../go">Group Office</option>
<option value="../phd">Helpdesk</option>
<option value="../openemr">Medical office</option>
<option value="../orangehrm">Personnel</option>
<option value="../squirrelmail">Postoffice</option> 
<!--
<option value="../gel">SS+Fengoffice</option>
//-->
<option value="../dp">Task Manager</option>
<option value="../et">Work order entry</option>
</select>
</form>
</td>
[code]
 
Note:   
<select name="menu5" onclick=
"top.location=document.jump5.menu5.options
[document.jump5.menu5.selectedIndex].value;"  value="GO">
 
Code can easily be reused:
 
 

Friday, July 27, 2012

Dead monitor just saved me $20.

Huh? What do you mean that dead VGA monitor just saved you money?  That is what I did not have to go to the electronics store to purchase an overpriced VGA cable just to be cut apart. Why would I want to do that? Most personal computers now have what is know as the i2c (pronounced eye-squared-see) bus coming from the video port. Even the better touchpads and tablets have this port. This means you can connect all kinds of sensing devices to your computing equipment.



Let's dig a little deeper. The most traditional sensors used are what is known as temperature sensors. They are electronic thermometers. So you could connect one or many of these sensors to the i2c bus off the computer's video port. Even some hdmi cables support this. Of course, you would need a special interface for your touchpad or tablet. But it is there.




What can we do with the temperature sensors. The sensors can be placed in computer server rooms, around entertainment equipment (especially projectors), and other sensitive places  to monitor the temperature. The premise is that you do not want overheated equipment or even have the possibility of a fire hazard. The temperature sensors will send data back to the host computer and then software on the host computer can take action accordingly. Home automation software usually comes into play here. From that point of view that cable could save you thousands of dollars!!! (not just twenty dollars).



There are many many articles on how to implement the i2c bus, so I will not dwell on it here, Your favorite search engine can allow you to access the articles by searching on i2c. Often overlooked is what can we do with our computers besides just running our favorite computer programs. So, what about that VGA cable? Had a dead computer monitor in the garage. I needed a cable to build an i2c interface. Which means you need a cable that can be torn apart.  Cut off the cable from the back of the monitor and then made the cable. Another reuse for dead equipment! Going green....



Building of the basic cable can be found at :
http://www.instructables.com/id/Vga-breakout-cable/

You can also use other ports on a computer for controlling other equipment and collecting data.
http://www.instructables.com/id/Computer-controlled-OTA-TV-antenna/
http://www.instructables.com/id/No-solder-parallel-port-break-out/
http://www.instructables.com/id/DB9-serial-break-out-cable/

Friday, July 20, 2012

Network Tap (not a "Spinal Tap" sequel)

One of the issues I talked about in an earlier article (http://www.meetdageeks.com/2012/05/is-your-network-firewall-backdoor-open.html) was about making sure the network infrastructure was secure, That is all the cabling and networking equipment was secure. Look at the following picture and tell me if it is secure.


Actually there is a passive network tap inside with a cable going off to a computer in another room. At that other computer someone is eavesdropping or what is known at packet sniffing. The network taps make it easy to record from what you type on the keyboard to recording voip conversations. They require no power and can be made dirt cheap. The only shortcoming is that you have to be nearby to take advantage of it. It would be very easy if someone rented or had access to the office next door to use this device. They might have to punch a hole in the wall to access it unless there is some kind of socket nearby.



To record what is coming from the victims computer, some one might use a program like Wireshark. You can run multiple copies of it at a time to watch several connections. Ethereal was it's forerunner. Now there all kinds of software toolkits  for network admins to use in their work. On major project is know as Backtrack. It especially excels at dealing with wifi connections.




Now a days these types of connections are almost obsolete, but you still have to be wary of them. There is actually some good uses for network taps to test software. Network switches are becoming so advanced that the passive network taps are no longer needed per se.

For a little more information see: http://www.instructables.com/id/Passive-network-tap-revised/

Note: Spinal Tap was a movie about a fictional rock band years ago. Sort of a spoof.

Sunday, July 15, 2012

Computing can be puzzling.

Time to work a little bit on Robopet. Had two goals. First was to get the spare Palm to connect to the serial port and second to install the lightweight Boa web server. Thought that this would all go quite quickly and then off to hit the sack. But Noooooo....

Had everything up an running on Robopet. Tried to ssh into Robopet and no go. Logged into Robopet directly and found that the Ethernet port was not up and running.

$ ifconfig
lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Need to look at the network settings.

$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# eth0
 auto eth0
 iface eth0 inet dhcp

# wlan0
# wireless is disabled for now.
#auto wlan0
#iface wlan0 inet dhcp
#wireless-essid robotworld
#wireless-mode managed
#wireless-ap 00:00:00:00:00:00
# wireless-ap any
#wireless-channel 11

Ugh.. So I decided to shut the system down. and check to make sure the nic (network interface card) was properly seated.

$ sudo poweroff

Checked out ok. So I restarted Robopet. Powered up for a few seconds and died. Tried re-powering Robopet and it would not even come up. The power supply was promptly replaced.  Rebooted the machine and so far so good.  Back to testing the ethernet port. No go. Then I noticed that I had put the nic in a pci slot that I had noticed was bad. (Got the motherboard with a whole bunch of other parts for dirt cheap, so you can not expect the stuff to be perfect). Shut the system down again and moved the nic pci card to a slot that was good. Re-powered  the unit. Checked for the card working.

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00:00 
          inet addr:192.168.1.54  Bcast:192.168.1.255  Mask:255.255.255.0
          Scope:Link UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2194 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1550 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:531663 (519.2 KiB)  TX bytes:231313 (225.8 KiB)
          Interrupt:10 Base address:0xff00

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Eth0 was working.  Time to log into Robopet again.

$ ssh robopet

Robotpet would not take my password. So I tried using the ipaddress

$ ssh 192.168.1.54

All was well.  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



Rebooted Robopet. And the login prompt came right up on the Palm pda. So far so good. Now for the second part of the project.

Apache is a fine web server, but I wanted something real light that supported what is known as CGI (Common Gateway Interface) which meant I could easily program the web interface with batch or shell files.  Boa had been around for years and would fit the bill.

$ sudo apt-cache search boa
$

No Boa. So I went to the web to get the source code. Downloaded the .94 version as boa.tar.gz. This was a compressed file sort of like a zip file.Time to uncompress it.

$ tar zxvf boa.tar.gz

Changed into the boa directory and read the docs. for installation.

$ sudo ./configure;make

Yeah, I would be in business soon. Waited for a while for it to supposedly compile. When it finished there was no binary or program to run. Searched through the docs and no information to glean. Frustrated. Went to launchpad.net to get a specific binary. There was a new compressed file. There was a comment saying there was no binary. Downloaded the new file. Uncompressed it and  ran through the compile sequence.  Still no binary.  Super frustrated at this point.  So much for the easy part I thought would happen.  Looked around launchpad a bit for a clue. Lo and behold there was a binary.  I downloaded the file and then installed it.

$ wget http://launchpadlibrarian.net/1378971/boa_0.94.14rc20-1.2_i386.deb
$ sudo dpkg -i boa_0.94.14rc20-1.2_i386.deb

I went to the web browser on another machine and typed in the url of Robopet and viola there was a web page (albeit just a directory listing).

Index of /

Files


Index generated Sun Jul 15 15:29:52 2012 UTC

That means it worked!!!!!  Now I can use the Chumby wirelessly to access Robopet and control it. Now to get some web pages done.  Hopefully I have introduced you to some linux/unix commands that may be of use to you in the future.  Later.....

Wednesday, July 11, 2012

Arm, it's whats for dinner (I mean computing.)

Actually Arm is the newer CPU (Central Processing Unit aka the brain)  on the block to power computers so to speak. Lots of devices use the Arm CPU. One such device is the Cisco Linksys Nslu2. The NSLU2 is  a front end for hard drives so the combination can be used as a NAS (networked addressed storage). Some very talented people have figured out a way to install computer operating systems on it. Now you can actually do this on quite a few units such as the Pogo Plug.

Microsoft who disdained the Arm based units for a long time is now trying to get a foothold. It will be interesting. Linux has been around quite a few years supporting the Arm units. A lot of what is known as embedded  computing for industrial and other applications has used the Arm for years.

We have an NSLU2  and have just reinstalled Debian 6 Linux. We installed Linux on the unit several years back, but reinstalled the original firmware  on the unit so it could still be used as a noobie NAS. After listening to a podcast about installing Linux on the PogoPlug, it raised my awareness again about possibly using the unit as a  light web, media, and etc server again.  After looking at the instructions for the Debian 6 install, I decided that it was quite a bit easier the some of the original setups with earlier versions of Debian Linux for the NSLU2.

 
Since the NSLU2 does not have a monitor, you have to do everything from the network. Being somewhat experienced a SSh (Secure Shell), it should be a piece of cake install. You can get the details at:  http://www.cyrius.com/debian/nslu2/unpack.html or use my instructable: http://www.instructables.com/id/Give-your-Cisco-Linksys-NSLU2-some-muscle-part-1/.  The author was kind enough to allow his setup to be used. 



Went and grabbed the NSLU2 out of the closet and found a spare usb drive for doing the installation. Went ahead and did the install. Working like a charm albeit the unit is slower than xmas. Also installed the build-essential package to allow for development of software. At this sitting, I just wanted to get it up and running. I will add more software later. The unit can still be used as a NAS!!!! But it also can be used for so much more.


As I said you have to access the unit remotely.  But to add at least one application, I downloaded the free static web server from IBM (International Business Machines) (http://www.ibm.com/developerworks/systems/library/es-nweb/index.html) and compiled it for the NSLU2. Since now the NSLU2 can act as a web server, you can install all kinds of applications just like on a real server (with some limitations of course). Yes, you could even run your own mini cloud on it. (http://www.instructables.com/id/Uses-for-your-own-private-cloud/)




In any case since the NSLU2 only uses a few watts of power, it will be a great little power saving server. Probably only use usb drives on it to keep it energy efficient. Which proves, you do not have to have a big hunk of hardware to do a lot of things.

Update: Nslu2 on steroids. Installed webmin from a tar.gz (a compression technique to take one or more files and compress them into just one) file. Quite a change from the original stock web menu.



Second update: We added an old Palm pda to act as a dumb terminal.


So we experimented with it to do portable computing.

Third update: We added Firefly the music streaming server. The Nslu2 is becoming quite a little workhorse.

Note: You really have to have some real Linux/Unix experience to set this up easily.

eddie@oesrvr3:~$ cat /proc/cpuinfo
Processor    : XScale-IXP42x Family rev 1 (v5l)
BogoMIPS    : 266.24
Features    : swp half thumb fastmult edsp
CPU implementer    : 0x69
CPU architecture: 5TE
CPU variant    : 0x0
CPU part    : 0x41f
CPU revision    : 1

Hardware    : Linksys NSLU2
Revision    : 0000
Serial        : 0000000000000000

Tuesday, July 3, 2012

Shortening Ubuntu base install time.


Ever not wanted a majority of software that default installs include. Here is a way to make a trimmed down desktop and then surgically install the gui applications you prefer.  During the install, un-check all options including the Desktop environment (excepting additional basic utilities if it is shown such as in a network install). We will manually install the desktop.




Finish the install. The after the reboot, you will want to log in. Do not be surprised at the mouse environment missing. We are almost there.  Then you will want to do the following installs in two separate lines.

$ sudo apt-get install lxde xorg

Instead of adding all the video drivers, you could just do the one for your video card if you know it.

$ sudo apt-get install xserver-xorg-video-all

Test the install with:

$ startx

You should get a desktop. The next time you reboot, you should automatically come to a gui login.   Then in the gui environment, you can set up your applications much easier with the synaptic package manager.















So this little project is great for setting up machines for kids or in a student lab and where you only need to run certain software.  You could also include setting up a virtual machine using this method.  Have fun...

Note: this works with Debian also, but you will have to install sudo and edit the sudoer's file.



Monday, July 2, 2012

Names changed to protect the innocent.

Say you want to duplicate some web pages to another server, but the web server names are different. That means all the links in the pages will be wrong. For example take the following simple web page:

[code]
<html>
<title> Offshore Educators (C1001) </title>
 <title> Send us some comments </title>
 <body bgcolor="aquamarine">
    <CENTER><h2><B><I>Offshore Educators</I></B></h2></CENTER>
Sylabus: C1001 - Introduction to computing 1.
<hr>
<br>
<p>
This course introduces students to fundamental hardware concepts in the use of microcomputers and to some practical applications of software. The course focuses primarily on word processing, spreadsheets and business charts and presentation software using the Open Office products on the Linux platform. The course examines the use of computers for communication and collaboration including e-mail, conferencing software and the Internet for exploring the resources of the World Wide Web. Students participate in group discussions using groupware, work with computerized library databases and make decisions about the purchase of hardware, software and service providers.
</p>

<a href="descripts.html"> Returm me to the class listing</a>
<br>
<a href="http://oesrvr1"> Click on me to return to the homepage!</a>
[/code]

Our goal is to change oesrvr1 to oemsrvr1. Now just for one file this is no big deal, unless you have tens or even hundreds of web pages. Then you are talking about a major project to change all the server names in links. This can be made real easy.  After the web pages have been copied over, just go to the appropriate web directory such as /var/www on the new server and issue the following command:

$ sudo grep -lr -e 'oesrvr1' * | xargs sudo sed -i 's/oesrvr1/oemsrvr01/g'

In a few seconds all the files are changed without having to edit a single file.  So now
"<a href="http://oesrvr1"> Click on me to return to the homepage!</a>" is changed to
"<a href="http://oemsrvr01"> Click on me to return to the homepage!</a>".

This command is for a nix based system, but you could share an MSWindows server web directory and let a nix box access the web directories via samba to make the needed changes. (Do it while the server is offline for security purposes.)


Go one step further to automate it using namechange.sh.

namechange.sh
[code]
 sudo grep -lr -e '$1' * | xargs sudo sed -i 's/$1/$2/g'
[/code]

Then at the command line you could use:
$ namechange.sh oesrvr1 oemsrvr01

More than one way to skin a cat. Hope this artcle helps you out. Definitely helped me out.