The Adafruit PyPortal is a great device, with a few bells an whistles already integrated in order to start small electronic projects (but expensive, ok ;-)). As usual, Adafruit wrote a nice introductory guide. But some parts are outdated. Therefore, here are a few steps to get you started with CircuitPython on a PyPortal in 2021 …Continue reading “Start with a PyPortal in 2021”
This year, my elder son graduated from Cub Scouts to Scouts (time flies very fast!) and I signed up to be a counselor for Programming (and Public Health) in his troop.
Today, February 1st, 2020, was Merit Badge Day and I taught 6 scouts what is programming and the basics of programming in Python (and Scratch – but they all knew that already) (and nobody chose Public Health …).
I am now sharing my presentation and a few tips and tricks. Feel free to re-use, improve and give me any feedback to make it better.
Here are the presentation files (they are also on GitHub):
I want to highlight that some content was taken from other counselors who made their presentations available online too:
- Eric Silva‘s BSA Programming Merit Badge STEM on SlideShare (see also his repo of Python programs for this badge on Github)
- Bob Baker’s Programming Merit Badge presentation (and repo on Github)
- Nate Swedberg’s Programming Merit Badge presentation on SlideShare
The Boys Life magazine has also a dedicated page with a lot of resources for this Merit Badge. One of the nice features is that scouts can see the same simple program coded in different programming languages, allowing to compare them. They can be the basis for some of their requirements too.
It was the first time I gave this Merit Badge and having 6 scouts is a good number. You’ll face some issues helping them start programming, especially if all of them are new to programming. Also, it’s interesting to have scouts of approximately the same age: they will have similar reactions and they will be at similar level of programming. I had 5 6-graders and one older scout: the older scout had already a higher level of programming (and he kindly helped younger scouts). Also, big mistake from first-time counselor: do not give them the WiFi password at the beginning of the session! 🙂 Ask them to pre-install Python (if they bring their Windows laptop) and only allow them on internet when coding … You’ll thank me later 😉
I went through Safety, History of programming and Programming today in about 1 hour and 20 minutes, which was a bit too long (despite the good interaction and participation).
Then I programmed with them a converter between degree Fahrenheit to degree Celsius. Typing with them and running the script line by line was a good way for them to understand basic programming concepts like variables, case-sensitivity, functions and branching. The files we used as examples and code are on GitHub. From no knowledge of Python to this temperature converter: about 1 hour.
Finally, I covered Intellectual Property and Career in 10-15 minutes. That’s a little bit short. We had no time to enter into too many details. But scouts will have the additional pointers at the end of the slides and this will be a good introduction already.
Final thought? It’s time consuming to prepare all this material (and I thank the other counselors who shared their material!) but it’s also very rewarding to see children (well, teens) discover programming! I encourage you to share things you like as Scout Counselor!
Coming back from holidays, I fired my RSS reader and, among many interesting posts, I found this one from Smashing Magazine about static website generators being the Next Big Thing on the web (and a follow-up deep-diving into four of them).
The first paper describes how the web started as something static, became all dynamic and is progressively coming back to something more static, at least for some specific tasks. The interesting thing is that the author also describes pros and cons of each stage and why the web jumped to the next level.
While reading this, I couldn’t help thinking of Jadoo, a pet project I started in 2007. Its goal was to get rid of the complexity and number of resources required to run a dynamic blog system. Following some notes from Alexandre Dulaunoy, it was written in Python and already used concepts now hidden under buzzwords 😉 like templating and a rudimentary meta-data organization. At that time, there was nothing like Markdown, assets management, caching, Github, … (not as widespread as today at least). There is an initial post and an update – then I gave up (reasons inside). Note drawbacks I wrote at that time are still drawbacks of current static website generators (manual update and local edition only). All these ideas in 2007, one year before Jekyll … 😉
P.S. The irony is that posts about Jadoo were later transferred to WordPress – and this blog is also npw currently hosted on WordPress!
After the T-shirt that measures your sleep better than an app, here is idea #2: the toothbrush that provides some feedback.
The idea is simple – so simple it was already applied elsewhere. The idea is to provide feedback about the quality of the way people brush their teeth. The Brushduino focuses on entertaining kids to keep them brushing at the right place for the right amount of time. Other projects (with many variants) focus specifically on time spent brushing.
I think embedded projects can go an extra mile (provided they are small enough). You can embark a gyroscope and take into account the types and amount of movements you make while brushing your teeth. This way you also have the time you did it anyway. The toothbrush could communicate with a computer to transmit the data. I guess being offline would save some space at the price of direct feedback. This direct feedback could also come in a simplified way, a bit like the Nike+ Fuelband does: it is not an exact measure that you need but merely the fact you brushed vigorously enough and during enough time. The way a gyroscope work should give the space covered – indirectly if you covered every teeth (to be checked). Connection of the toothbrush to a smartphone or a computer could provide the numerical data as well as some social features (as long as you think brushing your teeth can be something shared with your friends).
In terms of design it could look simply like this:
This kind of device will not replace advices given by dentists. But it can help / accompany people during their daily activities.
Would you buy this device?
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
I don’t consider having more or better ideas than others. But I gradually realized I have less and less time for some activities like programming, electronics etc. Maybe that’s how we realize we are
getting older now adults. So I decided to share these ideas rather than fueling the illusory idea that I will implement them one day.
So idea 1 is about measuring sleep. I recorded animals’sleep during my Ph.D. – but it was thanks to an EEG device. I think that if you want to understand or improve something you have to first measure it in a way or another. So I started to try to measure my own sleep with an app (Sleep Cycle). But despite its good reviews it doesn’t work, at least for me.
For instance the chart below is supposed to represent my sleep cycle for the night of the September 14th, 2012. I was certainly not in deep sleep at 1.30AM (baby did not want me to sleep immediately). I also woke up around 4AM (baby was again the reason). And I woke up at 6.45 (with a backup clock – had to wake up for work)?
The last version of the Sleep Cycle app improves things a bit by providing more statistics (so at last you can rely on the approximate time slept and compare your “sleep” across days etc.), more beautiful gaphs and the ability to download raw data. Don’t be fooled however, “raw data” means only start time, end time, sleep quality (how is it measured?), time in bed, number of wake ups and sleep notes. You unfortunately won’t be able to reproduce anything like the graph above.
Hardware devices like the Wakemate or the Zeo might give better results because part of the solution is using a real accelerometer. But the Up story shows that not everything is obvious in this world.
For me the fundamental flaw is to rely only on body movements to detect, quantify and even score sleep. Of course there is an abundant scientific literature about how muscle tone (of different muscles) is related to sleep stages (see here and here for introductory texts). But this is often measured by electrodes glued on your body.
So I think it could be very easy to develop a simple, cheap “sleep T-shirt” with light electrodes that will just stick to your body when you sleep (and you put enough of them so at any time at least some of them are connected). In fact it might happen that the Rest SleepShirt would already do the job – it’s a pity they don’t elaborate more on how they measure and collect data (but I understand they will want to sell the product later on ;-)). In my idea light wires would then go to a small pouch where they would be connected to something like a LilyPad Arduino (because it is flexible and can be sewed to a T-shirt – there may be other devices available). The LilyPad would serve as data collector or as data transmitter to a computer / a smartphone / a specific receiver (coupled to a real clock, like the Zeo). The advantage would be to remain sole owner of your sleep data – but of course the business plan should include some “social” features 😉
In the end it should look a bit like this:
Will it work? I’m sure of it. Will it be enough to sleep correctly? I don’t think so: it’s not because you measure something that it improves. But at least you will have some clue on what is going on. Some other advices may be interesting. And for the moment nothing replaces a visit to a real doctor / sleep specialist!
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
A Java project compilation went berserk and I ended up with a directory structure of more than 260 characters. I stopped the mad process but it already created more than 50 successive duo of path “build/classes” …
Now I had to delete this structure. And, to my surprise, it was impossible. When you try to just press the “Delete” key with the root directory selected in the File Explorer, you get a Path Too Long exception. The reason is that the maximum length of a path according to the Windows API (MAX_PATH variable) is defined as 260 characters. I tried some other methods but all of them failed:
- write a small Java program that tried to delete the whole path: Netbeans (Java) was able to create this mess, why shouldn’t another Java program be able to delete it? Impossible.
- write a small C++ program that tried to delete the whole path: as long as you stick with the Windows API, it’s impossible (I read that it could be possible using the boost::filesystem library but didn’t try).
- try some Portable Apps utilities for file management: impossible (even when the software was using another framework like Qt).
Finally, I just ran a Cygwin terminal, went to the ad hoc location and did a simple “rm -rf libtest“. And voilà. So, next time Windows forbids me from doing something, it might be a good idea to directly rely on a true terminal from a Unix-like environment. I didn’t try a liveCD (I didn’t have such CD to hand) but it might be also possible.
Following some comments on the dependency to version 4 of the .Net framework, I rewrote ForbidSleepingMode in C++. You can open and compile the project with Qt (open source). The source code is of course updated. The mandatory screenshot as well 🙂
As you can see, I took the opportunity to add a small field where you can specify your own interval at which the program will “tickle” your computer.
I just put my first small tool on GitHub: forbidSleepingMode. It will forbid your (Windows) computer to enter into sleep mode, acting as if there was activity all the time. I’m sure you can think of 1001 productive uses for such tool.
Technically, it just sends a “tickle” to the computer every 10 minutes forcing the display to remain on (hence: don’t set your screensaver to come before 10 minutes). Build it with Visual Studio 10 (I know, I know …).
The mandatory screenshot (very, very useful):
I agree to have the decoration you want everywhere in our new home. You can have all the furniture and appliances you want in the kitchen. I’m OK if all the shelves with my computer books are in the basement. OK too if you don’t want to see the file server in the living room. Agreed: I’ll put back Windows on your laptop. But …
But I absolutely want one wall painted like these:
I needed some data to test the pChart charting library so I decided to use WHO data about swine flu (in its weekly updates). The only issue I had was that the WHO started to collect data by country and changed to gather data by regional offices from July 27th, 2009 onwards. So graphs below are only by regional offices.
For your information:
- AFRO: WHO Regional Office for Africa
- AMRO: WHO Regional Office for the Americas
- EMRO: WHO Regional Office for the Eastern Mediterranean
- EURO: WHO Regional Office for Europe
- SEARO: WHO Regional Office for South-East Asia
- WPRO: WHO Regional Office for the Western Pacific
I didn’t really see such graph on the web but there is the excellent FluTracker by Dr. Niman and a lot of information about the swine flu on Wikipedia. If you want to start interpreting these curves, you might be interested in reading squareCircleZ’s post about the H1N1 and the Logistic Equation.