2018-05-09

Getting into PowerShell

Back then, two decades ago, in 1998, i used Microsoft "FrontPage Express" to build my first websites, and i uploaded them to web host FortuneCity, which was an alternative to Yahoo GeoCities, and Lycos Tripod. But eventually, i had to change a part of the source code, and i got myself into some more coding with Microsoft Notepad. I have used it now for almost twenty years exclusively for HTML, JavaScript, CSS, Windows batch files, and Perl scripts, till i switched to Notepad++ by Don Ho in January 2018. Things are so much easier with it, because the code is highlighted in different colors.
Previously, i thought, all these colors are distracting, but now, with my age, i recognize how helpful this is for navigating through the lines. These days, i mostly write Perl code, Windows batch files, and some Unix shell script. In mid 2017, i got myself into PowerShell for the first time, because i transcoded thousands of my origami crane videos to a more manageable size, and i wanted to preserve metadata, especially the "Last Modified Date". This could not have been done with a traditional batch file only.
Now, in May 2018, i wrote a set of PowerShell files to check the integrity of my backups. Before, for way over five years, i used FileVerifier++ by Tom Bramer to calculate the MD5 hashes. But since i wanted to get to know the successor of "Windows batch scripting" a bit more, i pushed myself to create this tool. It consists of 5 files from scratch, without any external dependencies: Setting, Indexing, Hashing, Verify, and Filter. They explain themselves by their filename, and the whole experience was quite satisfying.
2018-05-07

How to stop Raspberry Pi crashing

I have a Pi Zero W running 24/7 since several weeks. I already listed all the tasks it has to do in an older post. The only time when it was not crashing was the week i was folding my last 707 origami cranes in Barcelona. Having my browser regularly connecting to the Pi Zero W seems to be enough to break it, if everything tries to flow through the bottleneck at the same time: FreshRSS is checking for updates at over 200 blogs within ten minutes, while raspistill is making a photo every minute, and Chrome is refreshing the stream of the feed reader via web interface and Apache server.
This is a possibility because i tuned it that way to keep the gap where the "time-lapse photography" is paused small. Otherwise the resulting video will not look right. The moon would jump from one position to another with frames missing. The crashing or freezing was not that frequent before, since i reserved enough time for every job. Handling that many RSS sources is quite the workload for this tiny computer, which basically means living on the edge. But the internal "watchdog" of the Broadcom BCM2835 does a great job in rebooting the Pi Zero W, if the heart stops beating.
A solution would be to reserve more time for every job and to reduce multitasking, which is the right way anyway, because it has only a single-core CPU. I also checked the power with a USB multimeter. And since i didn't wrote the RSS aggregator myself, this could be a place to do some digging too. After all, the Zero W is not that demanding and just not as strong as a full-size Raspberry Pi with four cores and twice as much RAM. But compared to my first computer in 1998 by IBM with Pentium II 300 MHz and 32 MB RAM, it's plenty for ordinary tasks.
2018-04-21

In der Arche ist der Wurm drin

At the beginning of this year, we threw away many boxes full of VHS cassettes, with films and series we recorded via cable TV, mostly over two decades old. I was reminded of fun movies like "Men in Black" with Tommy Lee Jones and Will Smith from 1997. But my mom pointed out "In der Arche ist der Wurm drin", a German cartoon by Wolfgang Urchs from 1988 i almost forgot, but still had somewhere in a corner of my memories. Now, weeks later, it was bothering me, not being able to remember the storyline. I had to search for it, without even to know the exact title, since it was only handwritten in Chinese on the label of the VHS.
But i found a copy on YouTube. Sadly, in a really bad quality. Still, better than nothing. Back then, i watched it as a child a couple of times, which introduced me to the story of "Noah's Ark" for the first time. Watching it after all these years, i realized how some things don't age well, but make you appreciate them anyway, because they influenced me somehow at sometime. The cartoon tried to communicate some "christian values" by spinning it to something more entertaining, which was not clear to me as a kid. In some way, this reminds me now of Johnny Five, and to download the movies "Short Circuit" (1986) and "Short Circuit 2" (1988) from my childhood, next time, when i get the chance.
2018-04-01

How i keep my Raspberry Pi busy

Since July 2017, i have my first one running "motionEyeOS" as a CCTV camera on a regular basis. Two weeks ago, i even built a custom UPS for it, also known as "Uninterruptible Power Supply", to make it somewhat independent from a power source. The "off-the-shelf" parts for this project were a 5V relay module with "low level trigger", charging module with "battery protection", boost converter, and 3300uF 6.3V capacitor, which results in a much cheaper solution than a Adafruit Powerboost 1000C.
My second and last Raspberry Pi Zero W runs since January of this year permanently too, but with a much wider range of tasks. I already got it to break down several times, by giving it more load than it can handle, which is not that difficult, since it has only a single-core CPU at 1 GHz and 512 MB RAM. But finally, i got it under control by giving every job only a certain time span to do its thing, just like shift work. And the built-in hardware "watchdog" tries to keep it all going by checking the heartbeat of the software.
For example, it takes with "raspistill" and the camera module one photo every 60 seconds, and it pauses twice each hour for ten minutes, as instructed in my shell script. Because the task is not mission critical, since it's just looking out the window and collecting images of a castle nearby. The given silent period is the chance for "FreshRSS" to check feeds for updates every half an hour. My Perl script tries to get new content for my parents from the BBC server every 30 minutes too. Occasionally, i also use it to develop and test new things, which can tear it down completely, or even corrupt the microSD card, if i forget to put all the code i have running to sleep.
2018-03-22

Sailing through the clouds

In the two decades that i have been doing things on the internet, i have used many web hosts such as FortuneCity, Schlund+Partner, Strato, and 1und1. They were all good at the time i went to them to host my projects. They made my time easier by not having to worry about the technology behind the server. But eventually the performance was no longer adequate, and i had to move on. As you know, i downsized my webspace at the beginning of this year. But apparently the Friedersdorf based web hosting service "ALL-INKL" can’t handle my traffic and load at that price point, which is why i went to Amazon AWS and created a "Lightsail" instance for less money, but more performance.
Since i already had experience with running a Apache web server on Linux-based Debian and a headless Raspberry Pi, it was simple to set everything else up. After some hiccups with Ubuntu and an old LAMP stack, i got it all working. On the surface, it looks like nothing happened, but behind the scenes i changed many parts to make it appear like that. For example, i had to set up Cloudflare as DNS and Mailgun as MX record for some of my domain names, to make them keep pointing to the right direction. I also removed the logging of IP addresses to comply with GDPR.
Many years ago, i built and run a blog hosting service for a long time, among other things, like embeddable chat widgets. All written in Perl, from the very bottom, and without any framework. I learned a lot, during and after it. I became quite good in handling file-based databases, even with thousands of hits per hour, because of the techniques i developed to prevent too much load on the server. Later, i installed WordPress for publishing my own posts, instead of writing my own code in Perl. Because why reinventing the wheel, if no one cares anyway?
But i was never a PHP and MySQL person, because of the many external dependencies, which is why i now took the opportunity to write a "flat-file based blog" from scratch, just in case if i ever need to move somewhere else again, so i don't need to fumble around with things i don't enjoy, or don't have time for. FYI, the rooms in our rented apartment have on average three clocks, in almost every direction at least one, because my dad likes it. All pages here are now static HTML files, which were generated by a dynamic Perl CGI script i wrote.
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15
This site is not available in your country.