Feed aggregator
Cognition AI Buys Windsurf as AI Frenzy Escalates
Read more of this story at Slashdot.
Air India Chief Says Preliminary Crash Report Raises Fresh Questions
Read more of this story at Slashdot.
Quality of Scientific Papers Questioned as Academics 'Overwhelmed' By the Millions Published
Read more of this story at Slashdot.
Google Plans To Combine ChromeOS and Android Into Single Platform
Read more of this story at Slashdot.
Zuckerberg Pledges Hundreds of Billions For AI Data Centers in Superintelligence Push
Read more of this story at Slashdot.
BulletVPN Shuts Down, Killing Lifetime Members' Subscriptions
Read more of this story at Slashdot.
Bay Area Restaurants Are Vetting Your Social Media Before You Even Walk In
Read more of this story at Slashdot.
Japanese AI Adoption Remains Drastically Below Global Leaders
Read more of this story at Slashdot.
COVID-19 Vaccine's mRNA Technology Adapted for First Antibiotic-Resistant Bacteria Vaccine
Read more of this story at Slashdot.
Blender Studio Releases Free New Game 'Dogwalk' to Showcase Its Open Source Godot Game Engine
Read more of this story at Slashdot.
CodeSOD: Back Up for a Moment
James's team has a pretty complicated deployment process implemented as a series of bash scripts. The deployment is complicated, the scripts doing the deployment are complicated, and failures mid-deployment are common. That means they need to gracefully roll back, and they way they do that is by making backup copies of the modified files.
This is how they do that.
DATE=`date '+%Y%m%d'` BACKUPDIR=`dirname ${DESTINATION}`/backup if [ ! -d $BACKUPDIR ] then echo "Creating backup directory ..." mkdir -p $BACKUPDIR fi FILENAME=`basename ${DESTINATION}` BACKUPFILETYPE=${BACKUPDIR}/${FILENAME}.${DATE} BACKUPFILE=${BACKUPFILETYPE}-1 if [ -f ${BACKUPFILE} ] || [ -f ${BACKUPFILE}.gz ] ; then BACKUPFILE=${BACKUPFILETYPE}-2 ; fi if [ -f ${BACKUPFILE} ] || [ -f ${BACKUPFILE}.gz ] ; then BACKUPFILE=${BACKUPFILETYPE}-3 ; fi if [ -f ${BACKUPFILE} ] || [ -f ${BACKUPFILE}.gz ] ; then BACKUPFILE=${BACKUPFILETYPE}-4 ; fi if [ -f ${BACKUPFILE} ] || [ -f ${BACKUPFILE}.gz ] ; then BACKUPFILE=${BACKUPFILETYPE}-5 ; fi if [ -f ${BACKUPFILE} ] || [ -f ${BACKUPFILE}.gz ] ; then BACKUPFILE=${BACKUPFILETYPE}-6 ; fi if [ -f ${BACKUPFILE} ] || [ -f ${BACKUPFILE}.gz ] ; then BACKUPFILE=${BACKUPFILETYPE}-7 ; fi if [ -f ${BACKUPFILE} ] || [ -f ${BACKUPFILE}.gz ] ; then BACKUPFILE=${BACKUPFILETYPE}-8 ; fi if [ -f ${BACKUPFILE} ] || [ -f ${BACKUPFILE}.gz ] ; then BACKUPFILE=${BACKUPFILETYPE}-9 ; fi if [ -f ${BACKUPFILE} ] || [ -f ${BACKUPFILE}.gz ] ; then cat <<EOF You have already had 9 rates releases in one day. ${BACKUPFILE} already exists, do it manually !!! EOF exit 2 fiLook, I know that loops in bash can be annoying, but they're not that annoying.
This code creates a backup directory (if it doesn't already exist), and then creates a file name for the file we're about to backup, in the form OriginalName.Ymd-n.gz. It tests to see if this file exists, and if it does, it increments n by one. It does this until either it finds a file name that doesn't exist, or it hits 9, at which point it gives you a delightfully passive aggressive message:
You have already had 9 rates releases in one day. ${BACKUPFILE} already exists, do it manually !!!
Yeah, do it manually. Now, admittedly, I don't think a lot of folks want to do more than 9 releases in a given day, but there's no reason why they couldn't just keep trying until they find a good filename. Or even better, require each release to have an identifier (like the commit or build number or whatever) and then use that for the filenames.
Of course, just fixing this copy doesn't address the real WTF, because we laid out the real WTF in the first paragraph: deployment is a series of complicated bash scripts doing complicated steps that can fail all the time. I've worked in places like that, and it's always a nightmare. There are better tools! Our very own Alex has his product, of course, but there are a million ways to get your builds repeatable and reliable that don't involve BuildMaster but also don't involve fragile scripts. Please, please use one of those.
[Advertisement] Plan Your .NET 9 Migration with ConfidenceYour journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!
Ada Beats SQL, Perl, and Fortan for #10 Spot on Programming Language Popularity Index
Read more of this story at Slashdot.
More Than Half of Carbon Credit Auditors Have Signed Off on 'Overclaimed' Benefits
Read more of this story at Slashdot.
Some Amazon Warehouses are Losing Hundreds of Workers After Changes in Legal Status
Read more of this story at Slashdot.
Why It's Time To Invest In Quantum Cybersecurity Now
Read more of this story at Slashdot.
GParted Live 1.7.0 Linux Distro Drops 32-Bit Support
Read more of this story at Slashdot.
A Never-Ending Supply of Drones Has Frozen the Front Lines in Ukraine
Read more of this story at Slashdot.
Is Enron Transforming Into a Real Texas Retail Electricity Provider?
Read more of this story at Slashdot.
Some Gut Microbes Can Absorb and Help Expel 'Forever Chemicals', Study Shows
Read more of this story at Slashdot.
Underwater Turbine Spins 6.5 Years Off Scotland's Coast, Proving Viability of Tidal Energy
Read more of this story at Slashdot.