Chit chat

======

Was installing a program on a server and found that the SQueL had an out of date command.

replaced TYPE=MyISAM  with ENGINE=MyISAM;

The tin I got for xmas that held a wallet will become a great microcontroller case.

Serial terminal can be a great repair tool. And also a text based monitor.

SUNP0038

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

Web server software setup.

There are two basic programs we want to install. Apache2 the web server and PHP a programming language for use with the server.

$ sudo apt-get install apache2 php5 libapache2-mod-php5 php5-cli

That will take a little while to install. Be patient.

Then you need to do a fix for the server.

$ sudo nano /etc/apache2/conf.d/name

For example set add ServerName localhost or any other name:

ServerName localhost

or you could use

Servername yourservername

Save the file and restart Apache 2

$ sudo service apache2 restart

Test the server:

Point a browser to the RPi You should get the setup page.

Now we need to test the PHP install..

$ cd /var/www

You should already see index.html with the code that shows you the home page.

Now we need to create a new page

$ sudo nano phpinfo.php

Save and exit. Now point your browser to yourhostname/phpinfo.php

You should get the PHP status page.

Now you should be ready to roll.

Note: you may need to edit /etc/apache2/apache2.conf and add:

# add php useage
AddHandler application/x-httpd-php .html

Create your web page and save it at /var/www

Index.html

<html>
<head>
<title> main page </title>
</head>
<body>
<center>
<h2>
Site under contruction
</h2>
<hr>
<img src=’http://www.seemyheart.org/wp-content/uploads/2013/06/Website_Under_Construction.gif&#8217; eight=500 width=500 />

</center>
</body>
</html>

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

Another table.

Screenshot from 2014-12-27 02:02:25

<!DOCTYPE html><html><head><style>thead {color:green;}
tbody {color:blue;}
tfoot {color:red;}
table,th,td
{border:1px solid black;}
</style>
</head>
<body>
<table border="1" style="width:300px">
<thead>
<tr>
<th>Name</th>
<th>Surname</th>
<th>Telephone</th>
</tr>
</thead>
<tbody>
<tr>
<td>Jack</td>
<td>Sales</td>
<td>555-5555</td>
</tr>
<tr>
<td>John</td>
<td>Admin</td>
<td>555-5555</td>
</tr>
<tr>
<td>James</td>
<td>Sales</td>
<td>555-5555</td>
</tr>
<tbody>
<tfoot>
<tr>
<td>Total</td>
<td>Total</td>
<td>Total</td>
</tr>
</tfoot>
</table>
</body>
</html>

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

You are kind of like a computer and you need logical instructions to solve a problem. Those instructions are the programming that is needed. So what is it about?

Programming is required so that we can solve a problem.  What a lot of people think programming is about.

What are the parts of the system?  They are:

System parts
Component
People
Hardware
Data
Instructions Procedures Software Information

There is actually a lot more as you can see from the list below. I may differ from this list a bit.

We want to build a program, but first we have to see what we need. What are we looking for in results. Obviously you need to be organized. You need a plan.


Output:
What must the results look like?  Reports:hard copy, terminal, web output, or etc

Output datafiles:

Inputs:
How will we get the data into the system?

What form must the input data take:

How will we process the data from input to output:  Formulas and logic needed should be documented. Flowcharts are a way to document what your plans are. Two flowcharts of many used are first the Vtoc.

And then second is the traditional flowchart.

For specific symbols see: http://itcartoons.blogspot.com/2014/12/flow-chart-symbols.html



What hardware do we need?
There used to be a joke that you could not get fired for purchasing IBM with using the Intel platform. Nor so true anymore. Do need special input and or special output devices. What kind of networking. What kind of security equipment. In the past the computer hardware platform was dominated at least with the desktop systems if Intel versus PPC. The PPC platform has gone awaym but we now have the Arm processors really begin to flood the market. Arm is become the best for lighter platforms (embedded) and the Intel systems are taking the high end. That is changing now that the multicore Arm processors are more powerfull and easier to get.


What development software? 
What kind of software do we need. That goes not only for the development software, but for specialized firmware. For example,  Networking equipment comes with the manufacturers software. Many people choose to prefer third party software that is usually more powerful. We have seen that a lot with your home routers. Instead of the usual firmware, Openwrt or DDWrt may be used to replace the factory firmware.

One factor that is usually forgotten is how user friendly will the software be. Is it intuitive? How knowledgeable will the users already be. Hopefully they will they not be required to be constantly looking at manuals to use the software.

That being said development software, varies in the range of source code they prefer. C, Java, or many other languages might be used. What development language you might use also depends on the skill set of the program developers. Though more and more programmers are finally becoming diversified.

You might want to also consider how portable is the code going to be, can we reuse the code on newer or different platforms. What kind of software licenses will be required and other legal issues that might potentially arise. On a wide scale, will it be copyrighted or open source. Is there a chance that, there will be a question of ownership, as with Oracle and Java.

What data validation software and techniques need to be used to prevent problems. Or to quote and old addage of GIGO. (Garbage in then you will have  Garbage out).

Having decided all that, now we can start coding. Obviously as we go along, things will need to be changed. Source code should never be written in stone. You also want to make sure adequate backups or duplicates of the software are kept to prevent loss. One other issue is security. How sure are you the code will not get leaked to competitors either from inside or outside sources.


Testing and debugging. (expect the unexpected)
Lastly, what kinds of debugging tools and test data will we need to verify the competency of the software. When you think you have tested it enough, test it again. Will the dummy data be diverse enough to test all possible scenarios. Testing software will also need to be developed if not readily available.  One thing for sure is that even if you think everything is perfect, do not remove any existing systems till your new software proves to be robust. You would running software in tandem with the existing setup.

You may want to do testing, that forces the system to fail. You will be able to gauge what safeguards and others features need to be built in to easily recover from any possible disasters.

Have been in enough real world situations where everything was supposed to be perfect, but when the software was put into production, there were nothing but problems. Could tell quite a few war stories so to speak about installing new systems. Even if you do get it right, you may want to change how the software works or be able to additional equipment. That all requires redevelopment and retesting.

Documentation. (and training)
If potential users are made part of the testing process, you can gauge how user friendly your system is.  Then make changes as needed. Feedback from users can be a tool to also what needs to be part of the documentation of the project. Where did those users feel that they needed more instruction.

New users will also be a part of the documentation testing as what needs to also be included or improved as they are being trained on the software.  What are the proper procedures for the use of the software, handling of the equipment, and dealing with the data that is needed to get the information required.

End users will need to be trained as to whether the information generated by the system is valid. If the information in a form that is useful, how will the information be used. Was the problem solved with what was done? Here we go again.

—————————————
No matter how much wireless networking there is, you have to have at least a small amount of hardware. There are some tools that might be nice to have if you are using more than the minimal amount of cabling (aka hardwire).

The tone generator helps you trace where a wire is routed through. Personally, in all my years as a tech, I think we used on just once.

When trying to see if a network wall outlet was live, I used an end tester.

If things are working correctly, all four lights should be lit. Thought with this unit, have seen a few false positives.If all the light are not lit, it can be a bad female plug or some fault down the line. Generally has only one port.

To test a single cable, you would use a cable tester coupled to a patch cable (short length of network cable)..  You would not connect it to a network or it will get damaged. You will need access to both ends of a cable to test.

Generally these tools are used when preparing a cable. The unit will generally check one wire at a time. If the lights do not show in sequence then one or both ends of the cable have to be redone. If lights do not show up is also a symptom of a bad cable.

If all is well then you need to check to see if there is data coming down the line. There are some expensive tools, but usually a laptop with basic networking software tools will do just fine.  Generally, when you hook to a network, the network will send data in the form of TCPIP. will want to give a network address to use (sort of a phone number).  So we can find outby hooking the laptop whether that data has been sent.
If you are not getting an ipaddress you might see something like this:
$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00:00
UP BROADCAST MULTICAST  MTU:1200  Metric:1
RX packets:77134 errors:0 dropped:0 overruns:0 frame:0
TX packets:59943 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:66488832 (66.4 MB)  TX bytes:9327481 (9.3 MB)
Then if the network is sending you an ipaddress, it might look something like this:
$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00:00
inet addr:192.168.1.188 Bcast:192.168.1.255  Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST  MTU:1200  Metric:1
RX packets:77146 errors:0 dropped:0 overruns:0 frame:0
TX packets:59990 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:66490251 (66.4 MB)  TX bytes:9340858 (9.3 MB)
In this case then network address is 192.168.1.188 and everyone should be able to reach you at that network address.  But is the network available? You can use the ping command to see if a site is available. You get  to see Google network phone number.
$ ping -c1 http://www.google.com
PING http://www.google.com (173.194.37.50) 56(84) bytes of data.
64 bytes from atl14s07-in-f18.1e100.net (173.194.37.50): icmp_seq=1 ttl=53 time=30.0 ms— http://www.google.com ping statistics —
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 30.036/30.036/30.036/0.000 ms
You can go one step further and see what places are on the way to google
$ traceroute  http://www.google.com
or you can go to the web..

 

Lastly, you use special programs to see what kind of information is on the network. These are known as packet sniffers. One such program is Wireshark. These tools can also be used for wireless.

Also see: http://www.instructables.com/id/Lets-get-wired/
—————————————

Ever want to access your own site with a bit of privacy? Tunnelling can be a way to do that. It does require user rights on the intended machine to be the host. If yoy look at a web site, you see the normal url something.something. sitetype. In this case we are just going to oeorgan1. Bue what we would like to do is try to encrypt the connection between the two machines.

One traditional way to do it is using the secure shell (SSH) , but you could probably also use a program called putty.  Here is the simplest version:

ssh [-1246AaCfgkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]
[-D port] [-e escape_char] [-F configfile] [-i identity_file] [-L
[bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
[-O ctl_cmd] [-o option] [-p port] [-R
[bind_address:]port:host:hostport] [-S ctl_path] [user@]hostname
[command]

$ sudo ssh  -L 80:localhost:80 eddie@oeorgan1

But if we did this it would open a prompt that I do not want.

if we use the -N will still let us in but there is no command prompt generated.

What we have done is point our localhost to another computer as if it was our own. So now if we use localhost as the url in the browser it shows the web page of the system we are connected to.

So now any communication should be encryped between the two machines. You can still go to other websites.

When we are done we can terminate the connect with a <ctrl>C.

So now if we go to localhost after refreshing the connection, the normal page should come up.

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

Reverse SSH Tunneling Have you ever wanted to ssh to your Linux box that sits behind NAT? Now you can with reverse SSH tunneling. This document will show you step by step how to set up reverse SSH tunneling. The reverse SSH tunneling should work fine with Unix like systems. Let’s assume that Destination’s IP is 192.168.20.55 (Linux box that you want to access).  You want to access from Linux client with IP 138.47.99.99.  Destination (192.168.20.55) <- |NAT| <- Source (138.47.99.99) 1. SSH from the destination to the source (with public ip) using command below:

$ ssh -R 19999:localhost:22 sourceuser@138.47.99.99

* port 19999 can be any unused port.

2. Now you can SSH from source to destination through SSH tuneling:

$ ssh localhost -p 19999

3. 3rd party servers can also access 192.168.20.55 through Destination (138.47.99.99).  Destination (192.168.20.55) <- |NAT| <- Source (138.47.99.99)
<- Bob’s server 3.1 From Bob’s server:

$ ssh sourceuser@138.47.99.99

3.2 After the sucessful login to Source:

$ ssh localhost -p 19999

* the connection between destination and source must be alive at all time.

Tip: you may run a command (e.g. watch, top) on Destination to keep the connection active.

Typical session: (typo1 is the server)

Typo1
———————————————————–

inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
inet6 addr: fe80::210:5aff:fe19:fd88/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1492  Metric:1
RX packets:858 errors:0 dropped:0 overruns:0 frame:0
TX packets:750 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:387860 (378.7 KiB)  TX bytes:99206 (96.8 KiB)
Interrupt:9 Base address:0x4800

inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
inet6 addr: fe80::210:5aff:fe19:fd88/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1492  Metric:1
RX packets:858 errors:0 dropped:0 overruns:0 frame:0
TX packets:750 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:387860 (378.7 KiB)  TX bytes:99206 (96.8 KiB)
Interrupt:9 Base address:0x4800
eddie@typo1:~$ ssh -R 19999:localhost:22 eddie@192.168.1.126
eddie@192.168.1.126’s password:
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-43-generic i686)

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

No mail.
Last login: Tue Dec 30 21:01:52 2014 from dsl
eddie@oelt02:~$
eddie@typo1:~$ ssh -R 19999:localhost:22 eddie@192.168.1.126
eddie@192.168.1.126’s password:
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-43-generic i686)

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

No mail.
Last login: Tue Dec 30 21:01:52 2014 from dsl
eddie@oelt02:~$

oelt02:
————————————————————
$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00:00
inet addr:192.168.1.126  Bcast:192.168.1.255  Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST  MTU:1200  Metric:1
RX packets:19375 errors:0 dropped:0 overruns:0 frame:0
TX packets:17998 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7997509 (7.9 MB)  TX bytes:4431653 (4.4 MB)

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:65536  Metric:1
RX packets:129 errors:0 dropped:0 overruns:0 frame:0
TX packets:129 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:18101 (18.1 KB)  TX bytes:18101 (18.1 KB)

eddie@oelt02:~$ ssh localhost -p 19999
eddie@localhost’s password:
Linux typo1 3.2.0-4-686-pae #1 SMP Debian 3.2.63-2+deb7u2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have new mail.
Last login: Tue Dec 30 03:16:31 2014

eddie@typo1:~$

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

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

If you need a fast setup web server running and you do not want to have to set up apache or something similar, then Python can help. Python comes with a simple builtin HTTP server. With the aid of this little HTTP server you can turn any directory (within limitations) in your system into your web server directory. This is important especially on embedded devices where storage is nominal. The only thing you need to have installed is Python. Linux comes with Python for the most part.

Practically speaking this is very useful to share files inside your local network. We like to use it for sharing documentation. Implementing this tiny but hugely useful HTTP server is very simple, its just a single line command. Note: this server is NOT SECURE. Use at your own risk.

Assume that I would like to share the directory /home/pwsrvr (or ~/pwsrvr) and my IP address is  192.168.1.200

Open up a terminal and type:

$ cd /home/your_dir_2_b_used
$ python -m SimpleHTTPServer 
 
or

c:\> cd /home/your_dir_2_b_used

c:\> python -m SimpleHTTPServer
That’s it! Now your http server will start in port 8000. You will get the message:
$ python -m SimpleHTTPServer 8080
Serving HTTP on 0.0.0.0 port 8080 ...
Now open a browser and type the following address:
http://192.168.1.200:8000

127.0.0.1 – – [28/Dec/2014 02:10:48] “GET / HTTP/1.1” 200 –
127.0.0.1 – – [28/Dec/2014 02:10:48] “GET /ss.png HTTP/1.1” 200 –
127.0.0.1 – – [28/Dec/2014 02:10:48] “GET /cgi.gif HTTP/1.1” 200 –
127.0.0.1 – – [28/Dec/2014 02:10:48] “GET /ha.jpg HTTP/1.1” 200 –

You can also access it via:


http://127.0.0.1:8000

If you want to use “localhost”, make sure it is set up in your hosts file. Seen where it was not. If the directory has a file named index.html, that file will be served as the initial file. If there is no index.html, then the files in the directory will be listed.

$ ls
1.gif            cgi-bin    ha.jpg         ip.png  ss.png         wmfb.php
backup           cgi.gif    icon.ico       lo      thankyou1.php
bash1.png        chmod.png  index.html     sl.png  wmfb.dat
bashscript.html  cron.png   indexhtml.old  sp.png  wmfb.html

Index.html has been renamed to text. If you just want to serve files, this might be a better way to do it.

If you wish to change the port that’s used start the program via:

$ python -m SimpleHTTPServer 8080

For more security, if you want to only serve on localhost you will need to write a custom Python program such as: (untested)

import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler

&lt;span class=&quot;nv&quot;&gt;HandlerClass&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; SimpleHTTPRequestHandler
&lt;span class=&quot;nv&quot;&gt;ServerClass&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; BaseHTTPServer.HTTPServer
&lt;span class=&quot;nv&quot;&gt;Protocol&lt;/span&gt;     &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;HTTP/1.0&quot;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;sys.argv&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1:&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;:
    &lt;span class=&quot;nv&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; int&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;sys.argv&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;:
    &lt;span class=&quot;nv&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 8000
&lt;span class=&quot;nv&quot;&gt;server_address&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'127.0.0.1'&lt;/span&gt;, port&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

HandlerClass.protocol_version &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; Protocol
&lt;span class=&quot;nv&quot;&gt;httpd&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; ServerClass&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;server_address, HandlerClass&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;sa&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; httpd.socket.getsockname&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
print &lt;span class=&quot;s2&quot;&gt;&quot;Serving HTTP on&quot;&lt;/span&gt;, sa&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;port&quot;&lt;/span&gt;, sa&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;...&quot;&lt;/span&gt;
httpd.serve_forever&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;

&lt;/div&gt;

Note also that this should also work on MSWindows or MSWindows with Cygwin. Have not tried on an Apple Mac. you can find Python at https://www.python.org/downloads/
—————————————

Squacola – Boiled squash juices with carbonated water.

SUNP0032

Good day.

Advertisements