What code did you write today?

Page may contain affiliate links. Please see terms for details.
OP
OP
Shut Up Legs

Shut Up Legs

Down Under Member
I've been working on a bash shell script to backup my files, on my Linux home desktop PC, and it's just about working now, I think. I was having a bit of trouble getting the filename expansion (aka 'globbing') to work properly in the script. It's enough to make one :wacko:. I did investigate what backup utilities were available, and there's no shortage of free ones to be had, but none of them quite did what I wanted, so I decided to write my own (the advantage of being a software engineer, I guess) :crazy:.
 

marknotgeorge

Hol den Vorschlaghammer!
Location
Derby.
Over the past month or so, I've been working on my Next Big Thing: Wiresmoke, a project management website for classic car restoration, that I'm hoping might expand into a big social thing linking enthusiasts, suppliers and clubs. Think of expanding your shed into a classic car show on your front lawn.

It's slow going. I only have evenings and weekends when I'm not doing something else, and I have about 18 months of my BizSpark membership left. I've also been struggling a bit just recently with motivation and my anxiety. I did ask a couple of my friends to help, but they're now travelling the world, and I've no idea where to turn next. But heigh ho. Then there's the Windows Mobile cycling app I've been writing for aaaaages, and the TransportAPI C# client, and a robot built out of a Raspberry Pi. Maybe I'm spreading myself too thin.

Back to Wiresmoke, I've been grappling just recently with date validation and popup Bootstrap date pickers in ASP.NET MVC and jQuery, partially to do with date formatting. After much research and going away and coming back later, I think I've just about cracked it.
 

mybike

Grumblin at Garmin on the Granny Gear
I've been working on a bash shell script to backup my files, on my Linux home desktop PC, and it's just about working now, I think. I was having a bit of trouble getting the filename expansion (aka 'globbing') to work properly in the script. It's enough to make one :wacko:. I did investigate what backup utilities were available, and there's no shortage of free ones to be had, but none of them quite did what I wanted, so I decided to write my own (the advantage of being a software engineer, I guess) :crazy:.

I couldn't find a tool that would backup to my NAS.
 
Last edited:
OP
OP
Shut Up Legs

Shut Up Legs

Down Under Member
I just wrote my first screensaver for Linux. :crazy: It's a hell of a lot easier than writing them for Windows. The screensaver doesn't do much at the moment, but I'll expand on its features over time...
 
Over the past month or so, I've been working on my Next Big Thing: Wiresmoke, a project management website for classic car restoration, that I'm hoping might expand into a big social thing linking enthusiasts, suppliers and clubs. Think of expanding your shed into a classic car show on your front lawn.

It's slow going. I only have evenings and weekends when I'm not doing something else, and I have about 18 months of my BizSpark membership left. I've also been struggling a bit just recently with motivation and my anxiety. I did ask a couple of my friends to help, but they're now travelling the world, and I've no idea where to turn next. But heigh ho. Then there's the Windows Mobile cycling app I've been writing for aaaaages, and the TransportAPI C# client, and a robot built out of a Raspberry Pi. Maybe I'm spreading myself too thin.

Back to Wiresmoke, I've been grappling just recently with date validation and popup Bootstrap date pickers in ASP.NET MVC and jQuery, partially to do with date formatting. After much research and going away and coming back later, I think I've just about cracked it.

If you aren't already, you should consider becoming a professional software engineer.

The industry is currently rammed with developers whose heads are turned by every latest shiny framework, methodology and toolset, who will never be capable of completing solutions that are ready for production as long as they've got a hole in their arse.

Glad I'm retiring next year. Rant over.

:hello:

Graham
 

mybike

Grumblin at Garmin on the Granny Gear
If you aren't already, you should consider becoming a professional software engineer.

The industry is currently rammed with developers whose heads are turned by every latest shiny framework, methodology and toolset, who will never be capable of completing solutions that are ready for production as long as they've got a hole in their arse.

Glad I'm retiring next year. Rant over.

:hello:

Graham

Graham

So what would you say was the best framework for producing results?
 

Octet

Veteran
Been playing around with the idea of a transport app for London, specifically targetting Windows phone although being a Cordova hybrid there's no reason it can't be ported to Android and (God forbid....) iOS with a little bit of work.

I'm sure there's probably 101 out there for Android, even more for iOS but on Windows phone there's only two or three and those are lacking what I would call pretty critical features which the TFL Unified API support.
 

gavgav

Legendary Member
I've been revising HTML, XML, CSS and SQL this weekend, ready for a training course at work this week. I have !/(){}<> coming out of my ears!
 
@mybike It depends what you're writing. There are a lot of good frameworks out there, Angular, Knockout etc.

The main thing is to pick one that suits the type of software you're creating, learn it inside out including how to overcome its foibles around edge cases (they all have them) and then stick with it throughout multiple projects.

Graham
 

marknotgeorge

Hol den Vorschlaghammer!
Location
Derby.
Been playing around with the idea of a transport app for London, specifically targetting Windows phone although being a Cordova hybrid there's no reason it can't be ported to Android and (God forbid....) iOS with a little bit of work.

I'm sure there's probably 101 out there for Android, even more for iOS but on Windows phone there's only two or three and those are lacking what I would call pretty critical features which the TFL Unified API support.
Have you looked at Xamarin? Cross-platform like Cordova, but uses native controls so should be faster. I haven't looked too deeply into it yet, but it's where I'm thinking for my TransportAPI client.
 

marknotgeorge

Hol den Vorschlaghammer!
Location
Derby.
If you aren't already, you should consider becoming a professional software engineer.

The industry is currently rammed with developers whose heads are turned by every latest shiny framework, methodology and toolset, who will never be capable of completing solutions that are ready for production as long as they've got a hole in their arse.

Glad I'm retiring next year. Rant over.

:hello:

Graham
I'd kinda like to, but haven't got the experience or the confidence to blag it. I'm going my projects will display my skills, as it were.
 

Octet

Veteran
Have you looked at Xamarin? Cross-platform like Cordova, but uses native controls so should be faster. I haven't looked too deeply into it yet, but it's where I'm thinking for my TransportAPI client.

I looked at it a year or so ago, but at the time it was beyond my budget. Now Microsoft own it and it's shipped with VS for free so I might re-consider it however not too sure at the moment.

In my past experience with real time apps, speed hasn't really been an issue with Cordova providing it's properly optimised both server and client side.
 
OP
OP
Shut Up Legs

Shut Up Legs

Down Under Member
I may have previously mentioned I was working on a bash script to periodically backup my data on my Linux PC, because I wasn't completely happy with any of the free/paid backup software available, plus I like writing code! :crazy:

Well, now I think I've fixed all the bugs. There were multiple problems to be sorted out:
  1. Preventing the PC from suspending to RAM while the backup is running - my Linux PC has a 30 minute timeout after which it suspends to RAM, to help me save power. The backup script run time can easily exceed this, so I need to prevent the PC from suspending while the script is still running. This can be done simply by creating a text file and putting it in a location recognized by the Linux kernel, as per https://sites.google.com/site/easytipsforlinux/disable-hibernate-and-suspend
  2. When the script finishes backing up the files, it simply reverses the above disabling of suspend to RAM, and 30 minutes later, the PC shuts down if left untouched. :okay:
  3. Setting the next PC wakeup time, so that the next time this backup script is scheduled to run, the PC will NOT be suspended to RAM. I did this by creating a small script that runs the Linux rtcwake command, which writes a date/timestamp to the PC's hardware clock (effectively updating the PC's BIOS). Then, while the PC is in suspend to RAM state, the BIOS is still active, and it periodically checks to see if this date/time has arrived, and when it does, the PC automatically resumes to normal full-power state from suspend to RAM. ACPI is pretty handy, sometimes (and cuts down on your electricity bills). :smile:
  4. Separating the parts of the backup script that need to run as root (aka superuser) and the parts that need to be run as the current normal user. The problem here is that the above disabling/re-enabling of suspend to RAM, and the rtcwake command, both need to be run as root (i.e. via the Linux sudo command), but the main backup script that copies all the files and directories needs to be run as the normal user, so that the directory / file copies still have the same ownership and file permissions as the originals. Fortunately, there's a way to do this too in shell scripts, with a code snippet something like "if [ "$(id -u)" != "0" ]; then <do stuff as root> fi;". The id command returns the string "0" for root, and something else for a normal user, so is useful for checking whether a script is being run as root or not. With the help of this code, I managed to write my backup script to do parts (1) to (3) above as root, and the directory / file copying as my normal user account.
  5. I've also added extensive logging to the script, so it produces a fairly verbose log file, listing all the directories / files that were copied, plus mentioning if any copies failed, and at the end printing the number of files backed up to each backup destination (the script handles multiple destinations), and the number of files copied per second, so I can get a rough idea of its performance.
Regards,

--- Victor.
 
OP
OP
Shut Up Legs

Shut Up Legs

Down Under Member
Being a software engineer is frustrating, sometimes. I spent over 11 hours yesterday, with no lunch break, trying to analyse and reproduce the symptoms of a very random software problem, and had no luck. One of my colleagues also tried, with no results, either. Given that he's based in Singapore and I'm in Melbourne, we had to talk via MS Communicator, which made things a bit inconvenient. I think this sums up my feelings quite well:
loveyourjob5qj.gif
 
Top Bottom