Just Code Challenge Week 10 Projects

Post your Just Code Challenge Week 10 Projects in this conversation! The blog post with my project will is published on Fridays and I’ll update this conversation when this it is published.

So whenever you finish your week 10 project, go ahead and post it here. Have fun and be sure to download other projects and discuss!

This week’s submission is a utility to query the OS about connected USB devices, and display the information in a listbox. For each of the 3 supported platforms Windows, Mac and Linux, a different shell script is required. For MacOS, the system_profiler command is used. For Linux, the lsusb command is used. And for Windows, the wmic command is used. Not surprisingly the returned results are in radically different formats which require different parsing code for each platform.

In retrospect, I’m not sure if this was such a good idea, because none of the hardware that I have access to has the latest OS versions. My Mac is still running 10.10 (Yosemite). I’m running Windows 7 on my PC, and in order to test the Linux version, I had to install lsusb on my Mac and test it on the Mac. So, if it doesn’t work as expected on newer OS versions, some code tweaking may be required.

The project file is here: USB_List_Utility

Additional information is in the project file in app.RevisionNotes.

uh… missing File : VIDedited.txt

Oops. Should be fixed now. Let me know if there’s still a problem.

It did… and darn… I mis-read… I thought it was an IP scanner… but still a USB scanner can be useful too :slight_smile:

Question : on my system (macOS 10.13.6 it seems to report 2 devices , 4 times each
I have an external USB Hard Disk, and it appears 4x, as well as my USB Hub which appears 5x
the built-in USB controller, and Facetime camera appear 1x
and nothing beyond the hub appears at all (keyboard, mouse, iTouch, iPad)

Interesting. I don’t have access to a USB hub at the moment because I’m on the road. I did notice some duplication when testing on Windows hardware which appears to have an internal hub and which caused some duplicate listing of devices. I had to do some additional filtering to remove spurious device listings in that case.

I’d be interested in seeing the raw output of the system_profiler command. If you could run the following code and post the results, it would be helpful:

Function Test() as String Dim My_Shell As New Shell My_Shell.TimeOut=-1 My_Shell.Execute "system_profiler SPUSBDataType" return My_Shell.Result End Function

Rosetta Code is a great source of code for all programming languages. Unfortunately, Xojo is poorly represented.

This week, I propose an implementation of Sieve of Eratosthenes in Xojo for the Rosetta Code website. I propose two versions: one using an array of fixed size and a second using a dynamic array.

Source and win32 exe are here:
https://www.ascinfo.fr/fichiers/justcodechallenge2018/RosettaSieve.zip

Rosetta Code contribution is here:
https://rosettacode.org/wiki/Sieve_of_Eratosthenes#Xojo

Simple memory game

This is simple example of a memory game programmed in Xojo.

Download source

For the 10th week of the #JustCode Challenge I took a look at networking. So for my project this week I’ve created a networked version of the Combat game, which has two tanks on the screen shooting at each other. The network version allows you to control one tank with the app running on your computer and someone else to control the other tank with the app running on their computer. I call it NetTank.

https://blog.xojo.com/2018/08/24/justcode-challenge-week-10-nettank/

My submission for week 10 is a simple temperature logger for Raspberry Pi. It makes use of a DS1820 temperature sensor connected to a GPIO pin of the Raspberry Pi. The logger reads data from the sensor extracts the current temperature (in °C) and appends it to a text-file frequently. Timer interval, logger-file and some other parameter can be set via a config file (see readme within the project for more info). Useful information about the DS1820 sensor and how to connect it to the Pi can be found here.

For test and development purpose the sensor can be bypassed by setting the ‘UseMockData’ parameter to True. The programm will then read build-in data instead of reading from the sensor. This was helpful during development on my windows machine, since I had no access to a real sensor.

Project source-code including the Raspberry binaries can be downloaded here. Feedback is welcome.

Lastly, I read an interesting article about time tracking in the command line. It was reported about the tool Moro. However, the installation is under Linux but is a bit of a hassle for beginners. So I thought, you can do that with a few lines of code yourself. I also wanted to program something for the command line. I call it Workx

Here are a few commands:

workx hi: starts york Work Time
workx bye: end your Work
workx status: Report of your Work Today
workx help: Get Information of all Commands

All times and notes are stored in a SQL database

Project Soucecode can be downloaded here

Web Grid Builder

This week’s entry is just barely there — but it’s enough for me to use for next week’s job so I put a pin in it. For now. There are so many things I want to add to this and I will later, because already it will save me so much time.

Basically, it generates web code for data entry forms. It uses the Gridforms framework (https://github.com/kumailht/gridforms) but the next step will be to add the ability to also generate Bootstrap code. I’ll eventually add the ability to specify CSS classes for the rows and columns, JS calls, etc., but right now it’ll generate the “first draft” of an input page and that’s what I need for my job next week.

Here’s a 2.5 minute video showing the project in action:
https://youtu.be/6oKXL8sTrtA

Here’s where you can grab the project:
http://jayjennings.com/justcode/WebGridBuilder.zip

If you move that to GitHub I might be interested in helping with it. Not that I have any free time at all right now T_T

If you were referring to my project, I don’t have a problem with that at all – assuming I can figure out how to make Xojo work with GitHub. :slight_smile: It would be cool to turn this into something awesome with more than one person adding to it.

When I write for myself I tend to “write dirty” so if put that up as a real project I probably need to do some housecleaning, but I’ll poke at the whole GitHub thing and see what happens.

I had a need for a utility to combine two CSV files to create every possible combination of values. I wrote a little desktop app that lets you import either two CSVs each with one column of data or one CSV with two columns of data. The columns do not have to be equal lengths. You can choose a separator and you can export the list.

GitHub

This might help:

And my first project for this week is about histograms. The program is easy and only makes one for the overall brightness (from the code you can easily extend to individual channels in color images of course). It iterates over the pixels and creates a histogram, which you can cut off at the start or end to tweak the image.

Download the source code: https://surfdrive.surf.nl/files/index.php/s/qpEVh7DUQshtPNR