Ideas for Programmers

Above here ^ ^ ^ ^ : Things beyond my control, which pay for my use of the wikidot service!
Below here: My stuff!!! v v v v (Mostly… there may be a few more ad panels mixed in.)

Facebook If you like this page, please tell others by clicking the icon! (Or via the social media platform you like… see top edge of page)

This page for computer programmers. Ideas I've had of things I think would be fun for me and useful for others. So many ideas, so little time.

If there is a link, if you RIGHT-click onit, and select "Open in new window" (or tab), and you can check out the link without losing the page you are reading at the moment. Close the new window, and this will re-appear from underneath the page you visited. With a little digital dexterity, you can achieve the same thing by clicking on a link with the wheel of many mice…. you must not rotate the wheel as you click it, though. For other tips on brilliant browsing, there are some ideas at….

http://www.arunet.co.uk/tkboyd/hh3d.htm

(When you use the "new tab" trick, your browser may do that… open the page in a new tab… but not automatically take you to the tab you just opened. You can make it take you to the tab automatically with the browser's settings. At least in Firefox you can, and the others usually eventually copy things Firefox introduces.)


Auto Spirograph…

Arduino "CAD"… draw complex waveforms for fun and because they are pretty!…

From Blog.Arduino.cc


Arduino controlled from Android

Two of middle school pupils combined two smaller projects. They connected an Android device to an Arduino and changing the color of a NeoPixel display.

One pupils worked on each portion. Here are the results and the details of how to do it. Description says "MIT App Inventor 2 aia file used to control an Arduino NeoPixel via Andriod phone with Bluetooth connection."

I'm not sure if the Android needs to be telephone capable.

From Create.Arduino.cc

I'm on the lookout for the simplest implementation someone can show me for interaction between an Arduino (or Arduino-IDE programmable device, like 8266) and an Android tablet that does not have telephonic capablilites. Via the LAN, over WiFi, or via Bluetooth… your choice! Or perhaps by the Arduino supplying a dedicated WiFi AP that an Android can connect to easily. Contact details below. (See also next item)

Parcel Dropper

(Note to JS: This makes FOUR ideas at top of this for your perusal, consideration. First is for "Parcel Drop")

I "need" the following. Asking for a friend.

In a Sparkfun 8266 Dev Thing (or plain "Thing") a little webserver.

Besides being the webserver, the 8266 should be a Wifi AP. The 8622 should use a static (local) IP address in the range 192.168.0.185 to 189, inclusive. Preferably .185, other things being equal. And serve on port 80, the HTTP default port. (There's nothing to be gained in using a non-standard port here… there won't (famous last words) be more than one server on the small WiFi network the project proposes.)

The server should respond to 192.168.0.185/op0/0 (that's "Oh Pee Zero stroke Zero", for "OutPut (channel) zero, make the state low") and 192.168.0.185/op0/1 by changing the state of the 8266 pin specified by #define pOp0 = 5 early in the program, where "5" can be whatever you like, within reason. Five will do until other considerations arise. It is chosen because there's an LED on it. Remember, that because of the way the LED is wired, making the output LOW turns the LED ON.

And the Wifi network should be unsecured, and broadcast the following SSID: "Pomf19313a". (Use different letters at the right hand end, i.e. replace the "a" with b, c, d… if you want several of these devices operating near one another.)

So. Once the Sparkfun is properly programmed, anyone should, with just smartphone (or tablet) and a browser, be able to connect to the server over the WiFi network ("Pomf19331a") and send "192.168.0.185/op0/0" to change the state of the output.

A "proper App" to send such a request would be a bonus, but a local webpage on the cellphone would do just as well, wouldn't it?…

<a href="http://192.168.0.185/op0/0">Turn On</a>
<br>
<a href="http://192.168.0.185/op0/0">Turn Off</a>

… saved as "ChangePinState.htm on the tablet, would "do"… if you could get a browser on your smartphone to open the page! (I failed, with my Android. A laptop could be used for the controller, if it had WiFi.)

The bits you, JS, need for the above are all in the stuff you already have.

If you write an app for the smartphone instead of using the "load local page of HTML into browser" answer, that needs to be easily installed on other smartphones, and, as a bonus, easily edited for different URLs, different commands.


Kim's Game for today

Back before kids had smartphones, a game it is said they played went as follows…

Some things were laid out on a tray, covered with a cloth.

The kids gathered 'round. Cloth was removed for a short time, then replaced.

Game was to list as many of the things that were on the tray as the kids could remember.

- - -
I want eventually to do a computer version of nearly that. Using .jpgs. Using "intelligent" matching of responses to the list of right answers… ""cap" or "hat" being acceptable for a piece of headwear, for instance.

As a starting point, perhaps inspired by that other "old skool" game, the one with cards, Concentration

The computer memory game I have in mind, as a starting point towards the Kim's Game is a grid filled with "stuff" that appears briefly. In each cell, initially, I had in mind "a digit". Easy for the computer to distinguish right and wrong answers. Of course, we are introducing an extra memory skill here… user has to remember WHERE he/ she saw, way, an "8".

Do we allow a second guess, if first is wrong? How do we score? Choices, choices! Besides being inherently fun, if done and presented right, this could be good in schools, because some children have more talent for remembering things OF THIS SORT. (And we ought to device ways of identifying those who have talent for OTHER sorts of remembering, indeed other talents in any sphere.) If you don't like "testing", answer this: Is the GOOD you do a child who learns they're talented at x/y or z worth sacrificing so that the child is isn't talented IN THAT AREA doesn't "get upset". Better to teach the disappointed child do deal with disappointment, I would say. AND I would say that it is good for kids to find out they have talents. Talents that are scientifically demonstrated, not just Mummy saying "Ooo… you're so GOOD at that darling." (A whole other rant: Little Freddy can be very "good" at, say, arithmetic, and still a complete little… (you know the word I am thinking!) The word "good", applied to a person, should be reserved for the things that matter. Not wasted on an indication of fluency or competence.

GETTING BACK TO THE GAME!!!….

I think the scoring should be done with an X/Y graph. A participant's result should be where he/ she falls on a grid. Left/right (x-axis): Score. Up/down(y-axis): How quickly the participant identified (or failed to) what was in each cell of the grid. Some people will complete the task quickly, though perhaps with a lowish score. Some will get every answer right… but take a while to do it. Some will even get every answer right, AND do that quickly. The grids system of presenting answer gives different people different ways to excel. A good thing, I think.

Third, fourth dimensions? You could have one set of grids for people doing a 4x4 array of digits (or other) to remember, with each grid reporting success when allowed different periods of time to observe the array.

You could also "slice/ dice" the challenge another way: You could have 4x4 arrays of digits, 5x 5 arrays, etc!

The basic idea has many possibilities. The best computer app for letting people attempt the challenge will have ways to offer all the variations, and also a way to accumulate the results of individual attempts!

(When I asked Alexa "What's the name of the matching cards card game?", she told me she could only answer questions in the language that my account was set to. Maybe that's why when I was teaching I sometimes saw blank faces?)

(The game/ test could, of course, also have things other than digits in the cells of the array. If we got sufficiently far from digits, the "where" element could be phased out. (With just digits, it would be no challenge to say "there was an 8". If the array were filled with the covers of books published from 1850-2000, it wouldn't matter that the participant remembered that "Lord of the Flies" was there. He's not likely to get a book that was there by luck, as he could with the just-digits version. But now the challenge becomes do you allow typos in the name? Is "Wind in the Willows" acceptable for "The Wind in the Willows?)


Scanning 3D objects

I understand that a portable scanner can now capture the surface of an object at the rate of 50,000 data points per second, at a resolution of 60 microns. (You should be quaking in awe at this point… but we are so oversaturated by such things today, that I suspect you aren't.) Astrolabe scan.

Flat bed scanners for, say, a page of text, are so unremarkable. But how would YOU build something to "scan" a 3D object, describe it as a set of x/y/z coordinates? Now THAT's a project! And not as "impossible" as it might seem. (You may remember two teenage boys doing the opposite… starting with some x/y/z coordinates in a CAD/ CAM system, and creating, yes, the girl of their adolescent dreams. (Weird Science, 1985. Deplorable, unacceptable, male chauvinist piggery, I suppose some would say today. I wonder if The Full Monty is unacceptable now, too. Discuss. (Sigh… YES, I know. They are different… all to do with power/ lack of power. I get it. But let's try to keep SOME sense of humor??))

ANYWAY…. here's the programming challenge…

Create a system for capturing the surface of a 3D object as a set of x/y/z coordinates! Any you CAN do it, with minimal difficulty… though I admit that this isn't a "small" challenge, nor the fact that there IS a bit of advanced math near the heart of it. But there are many modules! And bits of it are very accessible.

Get a lazy Suzan. (Not essential)

You can buy at the hardware store, a "thing" that will "paint" a laser "line" on anything in a given plane.

Put that on a rigid mount, arranged so that the plane is at right angles to the plane of the lazy Suzan (LS), and passes through the center of the LS's center of rotation.

Put a digital camera on a rigid mount.

Put a teapot on the LS. (Teapots are to 3D scanning as "Hello World" is to computing generally… and with some reason.) Does it matter if you put the center of the teapots general rotational symmetry on the center of the LS?

Image Unavailable

Repeat…
Take a picture
Rotate LS 10 degrees
Until 35 pictures taken

Put the images in a computer program which will extract the x/y/z of the points on the surface of the pot at, what?, 5mm (or so) separations?

Create a file suitable for import to some good, free, CAD/CAM package. Any ideas for what that package would be? (Please state which OS(es) the app works with when submitting ideas.)

For MANY bonus points… how do you deal with the bits inside the loop of the handle that were never lit up by the laser?

"Quite complicated", admittedly.

Start with the image below the sketch. Extract the line as a series of x/y coordinates. (That's a stand-in for extracting the position of the line in the 36 pictures the camera took.)

SetupCapture-for-web.png

Now for the trickiest bit… Probably need some math of at least A-level standard. Or help from a friend. But "the formula" is a relatively trivial element in the whole package.

Assuming that those x/y points were where a line was that defined where the teapot intersected the plane defined by the laser scanner thing, and knowing (how would you want it DEFINED?) the relationship, in 3D, between the plane and the camera's position, convert your "x/y on the image" data into x/y/z in 3D space coordinates. Probably a term project, rather than a week's homework. A good subject for a PROJECT PLAN. I would love to post here links to any answers to the above, even answers to parts of the above.

It WOULD be a fun project!


Scanning 3D objects- CAT scan

This Idea For a Program is woefully under-developed. That doesn't mean it isn't another great challenge!

It is similar to the challenge above, in that you can create a "simulation", a "home brew" version of something that, commercially, is a hundreds of thousands of dollars techno marvel!… the CAT machine… e.g. an MRI scanner.

The demo will use visible light, not X-rays. Big deal. Same principles. It just restricts the things than be scanned.

As with object-to x/y/z coordinates project above, you'll want a lazy Susan (LS) and a digital camera. But this time the camera will take pictures "across" the top of the LS. CAT scans are about "cross sections" remember.

Imagine that you have a cylinder of blue glass and a cube of green.

Imagine them on the LS.

The camera is looking "across" the plane just above the surface of the LS. That view is blocked in places by the two glass objects.

The camera is on a tripod, doesn't move. Turn the LS. What the camera sees changes. From JUST those different views, you can draw a picture of the placement of the two objects.

That's it! But DOING it is the interesting bit!

In the demo, we are rotating the object being scanned. If you don't see how this links up with a medical CAT scanner, perhaps you don't know that inside the big donut the patient is put in, there is an X-ray source shining "light" through the patient to a "camera" on the other side of the patient, and that this source/camera pair spins around, inside the torus? (There are pictures on the web.) Turn the object being scanned/ turn the source/camera assembly… not much difference in the end result… a bunch of images of what you see when you look across (through) the thing being scanned!

Going back to the programming challenge… you've probably "got it" by now?

If not, perhaps I should mention that from each of the images, just one line of them needs to be scanned for information? Each point along the line tells the application about what was between the light source and the camera along one of the rays passing through the objects being scanned.

Another thing that maybe confuses: In "the real thing", the "light" source is a point source, and the detector is wide… essentially many tiny "cameras", side by side, each recording the "light" reaching a point in the fan of rays. In the simulation, the light source is wide, the light travels FROM the "fanned end" of the rays back to one point… inside the camera's lens, before fanning out again a very little, to strike the "film" at the back of the camera, where multiple pixels record the separate rays.

Image Unavailable

For WAY more math than you need for this… Saving lives with math


Simple "Watch IpCam

If http://192.168.0.123/snapshot.jpg would fetch an image from an IpCam, then the following…

<head>
<!--A copy of this was in pcVash's Doc..s/PrgmMgnd folder. Not being used, that I can recall
There, it was called "WatchDriveRemomte" ("drive" as in driveway)
A copy put in aaTuts, too-->
<meta http-equiv="refresh" content="15">
</head>
<body>
<img src="http://192.168.0.123/snapshot.jpg">
</body>

… would fetch and display a new one every 15 seconds.

Type it into a text file.

Save that as "LookRepeatedlyAtCam.htm"

Open that with your browser.

DETAILS: In the real world, the "192.168.0.123" would be replaced with the address of your IpCam… it could be a LAN address like this one. It could be an internet address, like "MyHouse.dyndns.org". You might need to add a port specification. The "/snapshot.jpg" part probably wouldn't be that simple. It would be whatever you send to the camera to get a "snapshot" from it…. varies from IpCam model to IpCam model.

A good job for a Pi, methinks.


Brilliant Simulation! The "good old days"- 6800 machine and assembler

Sorry- not a "programming idea". Doesn't belong here. But this was the easiest place to put it.

The wonderful people at www.HVRSoftware.com have given us a fantastic simulation of working on a 6800 (or 6811) computer. Runs fine with Windows 10. Fee! You don't even have to "register", etc.

Fetch the .zip. Un-zip it. Run "SDK6811.exe… and, presto! You get a simulated 6800 on your screen! (Or 6811, depending on what you select with the combo-box, upper left.)

Not only the "6800", but also a simulation of a traditional machine code monitor. (The black text on mauve background rectangle in the middle.) AND an assembler… the window over at the left.

Note the three tabs over the monitor window. The "Memory" tab gives you a "window" into the simulated machine's memory.

"Display" gies you a "glass teletype, "memory mapped" (Put 65 in memory location 0xFB00 (aka $FB00), and you will see an "A" at the upper left of the "Display".

We'll come to keyboard AND MOUSE! input to your simulated 6800 later. (I probably won't get to that tonight… but both are possible! (Again "memory mapped" (simulated, of course. When you type "A" on your Windows keyboard, a 65 goes into "memory location" $FFF1 of the simulated 6800. Wow.

The third tab, "Reference" tells you all about the assembler.

You write assembler code, and click "run" to compile, load, and run it. (The "load" button is for loading a program you wrote and saved earlier.)

Set the simulator to 6800 mode. Put the following assembly code into the Window at the left. Note that those are line numbers, not memory locations.

.org $0000
        ldaa #65
done jmp done

Save, if you wish. Click Run. Look in the memory monitor, at locations 0000 and following.

You should see 86 41 7E 00 02. Think what a PAIN it would be, if you had to work at that level!!

It went in at $0000 because of the .org 0000

86 is that kind of LDDS.
41 is 65, in hex.
7E is that sort of jmp ("Jump")
0020 is the address labelled "done".

EASY!

Click "clear", enter the following…

.org $0000
        ldaa #65
loop  inca
        staa $fb00   
        jmp loop

(Save, if you wish.)

Click STEP, not Run.

Press it repeatedly, watching the upper left character on the display.

You've written 6800 assembler and run the program! Now write something clever!


Maps from numbers

The following page is an entry point into a huge collection of related material. It sets out the requirements for a program to calculate some angles from a set of measurements. THAT would be useful to group leaders organising a challenge for participants learning about the challenges of making maps the way they were done for over 100 years before GPS.. and still are, to an extent, today.

http://sheepdogguides.com/lut/ltn8chall-angles.htm


A codebreaking challenge… cash prize!

I created a file encrypting program sometime in the 1980s. No access to the interenet for home users then! We used floppy discs to circulate stuff. I encrypted a file, sent it out into "the world" with the offer of a cash reward to anyone who could decrypt it. The prize remains unclaimed.

Recently, I recreated the TurboPascal/ MS-DOS app with Lazarus. A new file, same encryption is available for download… $200 to a good charity for first person to crack it, and a further $500 for a good charity if he/ she can then crack a second file in under 72 hours. Terms and conditions subject to changes as posted at the page cited.


Fluid dynamics with ASCII graphics

I won't explain beyond the hints in the title. Watch the following YouTube. Eitehr you are a programmer and won't be able to resist having a go, or you aren't, and I can't explain.

https://www.youtube.com/watch?v=QMYfkOtYYlg

(I will just mention that an Arduino can drive a 50 row x 100 column display on a monitor via a single digital output and a $36 interface…

http://www.arunet.co.uk/tkboyd/ec/SerialToVGA.htm


I/O Device for Home Automation, etc.

Once upon a time, connecting a Windows computer to the outside world wasn't so hard. Now it is more tedious. We need someone to spend just a little time and make "a box". It could be made with a BasisStamp (or other PIC device), an Arduino, a Pi or other. If the first one were done properly, clones built on different hardware could also enter "the market".

"The box" would have three wires going to a bigger PC: Ground, data to bigger, and data from bigger. The data would flow as serial streams, without hardware handshaking.

From the other side of "the box" there would be, at least, a few digital inputs and outputs. (All of this could be started with a subset of the eventual goals.)

The pc would only need to know how to "watch" and/or "send messages to" its serial port. "The box" would do that, and also watch and/or change the states of its inputs, outputs (respectively), AND monitor the stream of serial data from the pc, and respond accordingly. (In a very simple first iteration of "the box", it would merely periodically "tell" the pc the states of the box's inputs, for the pc to use or ignore, as it saw fit.)

This idea will "take off", and be supported by various hardware vendors, if a "language" is agreed upon. I would suggest for a variety of reasons that the data flow all be in printable ASCII characters, and that it be kept hardware independent.

For messages FROM "the box", the first would be Ihh where "I" flags a datum with information about the current states of some inputs to "the box", and hh be the hex representation of an 8 bit word. So, if all of the inputs were high, other than the least significant bit, the message from "the box" would be Ife ("fe" being one way of showing 11111110, aka 254.) (I would require that the messages be case sensitive, reserving upper case characters for "commands", or, if you like "verbs" or data identifiers… like the "I" in the present example, and lower case required for the "data" associated, the "fe" in this case. (Requiring case sensitivity reduces the processing needed of the messages flowing back and forth, among other advantages.)

In a first iteration of the idea, "the box" could just send its "Ihh" message periodically, at a fixed frequency. The system could be developed from there… with commands available which can be sent from the pc to configure how "the box" behaves, to introduce other functions, features. Etc.

I would be careful NOT to "tie down" the particular pins used by whatever is driving "the box" for specific tasks. Some communication protocol would need defining to allow the pc to "ask" "the box", "What can you do?", and "the box" would "reply" something like "I have 8 input bits I can read for you, 4 output bits I can set for you." A few basic configurations would be defined by short codes reserved for the purpose.

This idea has probably been developed many times. I would welcome the URL of any existing projects with even a modest active forum or web-page.

Stuff below here NOT FROM ME…

Below here: Advertising brought to you by the nice people who host my wiki/ blog for me and for you.


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License