One thing that would be interesting to do is to use the routines from linux to do web page scraping under mswindows (at least for xp anyway). Unfortunately some that is so simple and elegent for linux seems to be a googlety gook that a legal mind might concoct as a joke.
For example let’s say you want to collect the views of your instructables from http://www.instructables,com. Not really hard for linux.
#================================ # # Instructables numbers catcher # #================================= # Assignments # -------------------------------- szAnswer=$(zenity --file-selection --title="Select a iurl file to read") datafile=$szAnswer outfile="inumdata" # the date tmon=$(date +"%b") tday=$(date +"%d") echo "The views for $dj on $tmon $tday:" > $outfile #================================= # # Data input #--------------------------------- while read line do theurl=$line echo "$theurl" # echo -n "$theurl'" >> $outfile # get total views curl -s "$theurl" | grep -m 2 "Views:" | sed 's/[^0-9]*//g' >> $outfile done < $datafile zenity --text-info --filename=$outfile
You may not understand all the code, but you get get a good idea of what is going on,
I will not put all the code, but it is greek to me.
@echo off setlocal enabledelayedexpansion if exist temp.txt del temp.txt set count="first" for /f "delims=''" %%i in (test.txt) do if !count!=="first" ( set count="subs" echo %1 > temp.txt) else echo %%i >> temp.txt
Then if you use the find command to try to extract text even gets more fun. I never could get it to work. it just was not plain logical. What I did do is get some mswindows binary equivalents of the linux commands and things looked up. I grew up using the “Basic” conputer language. it has always been fairly easy to use. I still even use variants of it on linux.
Here is what I came up with that works.
OPEN "idata" FOR INPUT AS #1 while not (eof(1)) INPUT #1, a$ PRINT a$ b$ = "elinks " + a$ + "| grep Views:" SHELL b$ PRINT wend close #1 system
qbasic /run scrape.bas
You open the filing cabinet, you read or input some data until there is no more data to read then you close the filing cabinet. Makes sense to me, Elinks is a program that will get a web page without opening up a browser, but get it for you to manipulate. Grep is a special command the will extract data from what elinks grabs from the web. So you get just what you need.
This always cracks me up:
Plan to finish up the robot soon. One of the things is real important is to have at least some kind of wifi security. I will just make a few comments of what I might do. First of all you need to get the mac address of the router and the wifi card in robot.
here is a typical /etc/network/interfaces file. Where all the settings are for a command line server.
iface wlan0 inet dhcp
# wireless-ap any
# wireless-enc FEFEFEFEFEFE
# This is a fallback, selected for all unencrypted WLANs
# iface wlan0-open inet dhcp
# wireless-essid ANY
# wireless-mode managed
For this robot we do not want a failback. It only should use our designated router. Not only do we want an essid, we want to only talk to a router with a specific mac address. I substituted O’s for the real mac address. We even chose the cannel to communicate on. Most wireless networks use channel 6. This baby is going to be real specific about who it talks to. Since there is nothing sensitive on the machine, i was not worrried about passwords. Besides most of them can be broken anyway. The second thing we are going to do is set the router to only accept signals from the mac address of our wifi device. The router will not be hooked to the internet, so even more reason for some not to try to attack it. I can easilty reimge the cardthat holds the OS if someone does try to mess up the robot.
All communication from the robot will be on special ports with special non standard protocols. The ports will be locked down tight. That will be the last thing we do to keep security at a maximum.
Pelican linux cluster:
Ubuntu and the arduino:
Linux command line audio:
Network device converted into device for home automation. (advanced users)
Simple baked chicken: