b

Long ago and before hearts

When Ron Lehocky asked me several years ago who made this dotted square pin that I was wearing, I replied confidently, “Dayle Doroshow.” He corrected me. “I made that,” he said. This is a Ron Lehocky collector’s item! Long ago and far away when Ron first started dipping into polymer, he made pins that weren’t […] Read more




b

From Somewhere Above

Kate Bollinger “Postcard From A Cloud” I love the simple little trick Kate Bollinger pulls off in this song – singing near the bottom of her register in the verses, and at the top of it on the choruses. It’s not heavy-handed at all and it took me a little while to even really notice, […]




b

A Black Hole At The Center Of The Galaxy

The Smile “The Slip” It’s unfortunate that The Smile records have to carry the weight of questions like “wait, is there never going to be another Radiohead album?” and “hold on, so is this basically Radiohead from now on?” But what can you do? Those are big questions for anyone who’d want to listen to […]




b

Things Are Growing Brighter All The Time

Katrina Ford “World On A Wire” I’ve been writing about songs most days of my life for over 20 years and one thing I’ve learned from this is that a lot of the music I love most resists description. And of course it does – music is ultimately an abstract medium, something that exists to […]




b

Ending Up As Nobody

The Cure “Drone:Nodrone” Robert Smith has been dwelling on his mortality since the start of his career, and as a young man seemed to operate on the assumption that he had to get as much done as he could before he ran out of time. This is why hearing him ponder his “one last shot […]




b

CodeSOD: Trophy Bug Hunting

Quality control is an important business function for any company. When your company is shipping devices with safety concerns, it's even more important. In some industries, a quality control failure is bound to be national headlines.

When the quality control software tool stopped working, everyone panicked. At which point, GRH stepped in.

Now, we've discussed this software and GRH before, but as a quick recap, it was:

written by someone who is no longer employed with the company, as part of a project managed by someone who is no longer at the company, requested by an executive who is also no longer at the company. There are no documented requirements, very few tests, and a lot of "don't touch this, it works".

And this was a quality control tool. So we're already in bad shape. It also had been unmaintained for years- a few of the QC engineers had tried to take it over, but weren't programmers, and it had essentially languished.

Specifically, it was a quality control tool used to oversee the process by about 50 QC engineers. It automates a series of checks by wrapping around third party software tools, in a complex network of "this device gets tested by generating output in program A, feeding it to program B, then combining the streams and sending them to the device, but this device gets tested using programs D, E, and F."

The automated process using the tool has a shockingly low error rate. Without the tool, doing things manually, the error rate climbs to 1-2%. So unless everyone wanted to see terrifying headlines in the Boston Globe about their devices failing, GRH needed to fix the problem.

GRH was given the code, in this case a a zip file on a shared drive. It did not, at the start, even build. After fighting with the project configuration to resolve that, GRH was free to start digging in deeper.

Public Sub connect2PCdb()
        Dim cPath As String = Path.Combine(strConverterPath, "c.pfx")
        Dim strCN As String

        ' JES 12/6/2016: Modify the following line if MySQL server is changed to a different server.  A dump file will be needed to re-create teh database in the new server.
        strCN = "metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string='server=REDACTED;user id=REDACTED;database=REDACTED;sslmode=Required;certificatepassword=REDACTED;certificatefile=REDACTEDc.pfx;password=REDACTED'"
        strCN = Regex.Replace(strCN, "certificatefile=.*?pfx", "certificatefile=" & cPath)
        pcContext = New Entities(strCN)
        strCN = "metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string='server=REDACTED;user id=REDACTED;persistsecurityinfo=True;database=REDACTED;password=REDACTED'"
        strCN = Regex.Match(strCN, ".*'(.*)'").Groups(1).Value

        Try
            strCN = pcContext.Database.Connection.ConnectionString
            cnPC.ConnectionString = "server=REDACTED;user id=REDACTED;password=REDACTED;database=REDACTED;"
            cnPC.Open()
        Catch ex As Exception

        End Try
    End Sub

This is the code which connects to the backend database. The code is in the category of more of a trainwreck than a WTF. It's got a wonderful mix of nonsense in here, though- a hard-coded connection string which includes plaintext passwords, regex munging to modify the string, then hard-coding a string again, only to use regexes to extract a subset of the string. A subset we don't use.

And then, for a bonus, the whole thing has a misleading comment- "modify the following line" if we move to a different server? We have to modify several lines, because we keep copy/pasting the string around.

Oh, and of course, it uses the pattern of "open a database connection at application startup, and just hold that connection forever," which is a great way to strain your database as your userbase grows.

The good news about the hard-coded password is that it got GRH access to the database. With that, it was easy to see what the problem was: the database was full. The system was overly aggressive with logging, the logs went to database tables, the server was an antique with a rather small hard drive, and the database wasn't configured to even use all of that space anyway.

Cleaning up old logs got the engineers working again. GRH kept working on the code, though, cleaning it up and modernizing it. Updating to latest version of the .NET Core framework modified the data access to be far simpler, and got rid of the need for hard-coded connection strings. Still, GRH left the method looking like this:

    Public Sub connect2PCdb()
        'Dim cPath As String = Path.Combine(strConverterPath, "c.pfx")
        'Dim strCN As String

        ' JES 12/6/2016: Modify the following line if MySQL server is changed to a different server.  A dump file will be needed to re-create teh database in the new server.
        'strCN = "metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string='server=REDACTED;user id=REDACTED;database=REDACTED;sslmode=Required;certificatepassword=REDACTED;certificatefile=REDACTEDc.pfx;password=REDACTED'"
        'strCN = Regex.Replace(strCN, "certificatefile=.*?pfx", "certificatefile=" & cPath)
        'pcContext = New Entities(strCN)
        'strCN = "metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string='server=REDACTED;user id=REDACTED;persistsecurityinfo=True;database=REDACTED;password=REDACTED'"
        'strCN = Regex.Match(strCN, ".*'(.*)'").Groups(1).Value

        'GRH 2021-01-15.  Connection information moved to App.Config
        'GRH 2021-08-13.  EF Core no longer supports App.Config method
        pcContext = New PcEntities

        Try
            ' GRH 2021-08-21  This variable no longer exists in .NET 5
            'strCN = pcContext.Database.Connection.ConnectionString
            ' GRH 2021-08-20  Keeping the connection open causes EF Core to not work
            'cnPC.ConnectionString = "server=REDACTED;user id=REDACTED;password=REDACTED;database=REDACTED;SslMode=none"
            'cnPC.Open()
        Catch ex As Exception

        End Try
    End Sub

It's now a one-line method, with most of the code commented out, instead of removed. Why on Earth is the method left like that?

GRH explains:

Yes, I could delete the function as it is functionally dead, but I keep it for the same reasons that a hunter mounts a deer's head above her mantle.

[Advertisement] Plan Your .NET 9 Migration with Confidence
Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!




b

CodeSOD: A Base Nature

Once again, we take a look at the traditional "if (boolean) return true; else return false;" pattern. But today's, from RJ, offers us a bonus twist.

public override bool IsValid
{
   get
   {
      if (!base.IsValid)
         return false;

      return true;
   }
}

As promised, this is a useless conditional. return base.IsValid would do the job just as well. Except, that's the twist, isn't it. base is our superclass. We're overriding a method on our superclass to… just do what the base method does.

This entire function could just be deleted. No one would notice. And yet, it hasn't been. Everyone agrees that it should be, yet it hasn't been. No one's doing it. It just sits there, like a pimple, begging to be popped.

[Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.




b

Representative Line: One More Parameter, Bro

Matt needed to add a new field to a form. This simple task was made complicated by the method used to save changes back to the database. Let's see if you can spot what the challenge was:

public int saveQualif(String docClass, String transcomId, String cptyCod, String tradeId, String originalDealId, String codeEvent, String multiDeal,
            String foNumber, String codeInstrfamily, String terminationDate, String premiumAmount, String premiumCurrency, String notionalAmount,
            String codeCurrency, String notionalAmount2, String codeCurrency2, String fixedRate, String payout, String maType, String maDate,
            String isdaZoneCode, String tradeDate, String externalReference, String entityCode, String investigationFileReference,
            String investigationFileStartDate, String productType, String effectiveDate, String expiryDate, String paymentDate, String settInstrucTyp,
            String opDirection, String pdfPassword, String extlSysCod, String extlDeaId, String agrDt) throws TechnicalException, DfException

That's 36 parameters right there. This function, internally, creates a data access object which takes just as many parameters in its constructor, and then does a check: if a field is non-null, it updates that field in the database, otherwise it doesn't.

Of course, every single one of those parameters is stringly typed, which makes it super fun. Tracking premiumAmount and terminationDate as strings is certainly never going to lead to problems. I especially like the pdfPassword being stored, which is clearly just the low-security password meant to be used for encrypting a transaction statement or similar: "the last 4 digits of your SSN" or whatever. So I guess it's okay that it's being stored in the clear in the database, but also I still hate it. Do better!

In any case, this function was called twice. Once from the form that Matt was editing, where every parameter was filled in. The second time, it was called like this:

int nbUpdates = incoming.saveQualif(docClass, null, null, null, null, null, multiDeal, null,
                null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
                null, null, null, null, null, null, null, null, null, null, null, null);

As tempted as Matt was to fix this method and break it up into multiple calls or change the parameters to a set of classes or anything better, he was too concerned about breaking something and spending a lot of time on something which was meant to be a small, fast task. So like everyone who'd come before him, he just slapped in another parameter, tested it, and called it a day.

Refactoring is a problem for tomorrow's developer.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!




b

Representative Line: How is an Array like a Banana?

Some time ago, poor Keith found himself working on an antique Classic ASP codebase. Classic ASP uses VBScript, which is like VisualBasic 6.0, but worse in most ways. That's not to say that VBScript code is automatically bad, but the language certainly doesn't help you write clean code.

In any case, the previous developer needed to make an 8 element array to store some data. Traditionally, in VBScript, you might declare it like so:

Dim params(8)

That's the easy, obvious way a normal developer might do it.

Keith's co-worker did this instead:

Dim params : params = Split(",,,,,,,", ",")

Yes, this creates an array using the Split function on a string of only commas. 7, to be exact. Which, when split, creates 8 empty substrings.

We make fun of stringly typed data a lot here, but this is an entirely new level of stringly typed initialization.

We can only hope that this code has finally been retired, but given that it was still in use well past the end-of-life for Classic ASP, it may continue to lurk out there, waiting for another hapless developer to stumble into its grasp.

[Advertisement] Plan Your .NET 9 Migration with Confidence
Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!




b

Today in Middle-earth, October 25

The following event took place in Middle-earth on October 25:
  • The Dwarves venture into the Mountain (1341)
  • The Elvenking's host leave Mirkwood for Erebor (1341)
  • The Council of Elrond (1418)
  • The Council of Hobbits... and a Wizard.
  • [Join us on the Discussion Boards here]

October 25, 2941 (S.R. 1341)

1. The Dwarves venture into the Mountain.

(determined from text)

"Now do be careful!" whispered the hobbit, "and as quiet as you can be!  There may be no Smaug at the bottom, but then again there may be..."

(Tolkien, 1966 Ballantine, p. 224-228 TH)

October 25, 2941 (S.R. 1341) 2. The Elvenking's host leave Mirkwood for Erebor. (determined from text) "...the Elvenking rode forth...  ...marching with many spearmen and bowmen..." (Tolkien, 1966 Ballantine, p. 224-228 TH)

October 25, 3018 (S.R. 1418)

1. Council of Elrond.

(from the appendices)

"Suddenly as they were talking a single clear bell rang out.  'That is the warning bell for the Council of Elrond,' cried Gandalf.  'Come along now! Both you and Bilbo are wanted.'"

(Tolkien, 1965 Ballantine, p. 314-354 FotR)

2. Council of Hobbits... and a Wizard. (from the appendices) "Later that day the hobbits held a meeting of their own in Bilbo's room." (Tolkien, 1965 Ballantine, p. 356 FotR)




b

Epic Gollum & Sméagol Figures by Asmus: Get Yours Now!

Gollum & Sméagol Figures from Asmus and Sideshow

If you’ve ever wished for “precioussss” versions of Gollum & Sméagol figures that capture every conflicted, crawling moment, look no further! Asmus and Sideshow have just dropped two stunning sixth scale figures, bringing The Lord of the Rings most tragic character to life. And thanks to Asmus, this marks an epic return to Middle-earth collectibles after a dark pandemic pause. In the words of Andy Hsu, Director of Asmus Toys: “Characters that were promised, were anticipated, that were wished for, are now back on the menu!

Starting with Gollum: this 20 cm figure has over 22 points of articulation for all those sinister, slinking poses we know and love. With a smirking expression, rotatable eyeballs, and haired hobbit feet, Gollum is ready to stir up trouble on your shelf. And no Middle-earth journey is complete without provisions – this little guy even comes with wrapped and unwrapped Lembas bread accessories.

Then there’s Sméagol — the tortured soul behind the sneer. Sméagol’s innocent, haunted expression captures the side of him that Tolkien fans cherish. He has the same exclusive Gollum body by Asmus, complete with seamless limbs and multiple hands and legs to bring his story to life.

So, if you’re ready to give these two a home, both Gollum and Sméagol are up for grabs, allowing fans to continue this adventure together with Asmus and Sideshow. And by purchasing through our links, you’ll support TheOneRing.net.

Here's the letter posted by Asmus Director Andy Hsu on Facebook




b

Today in Middle-earth, November 3

The following event(s) took place in Middle-earth on November 3,

  • Battle of Bywater, and Passing of Saruman. End of the War of the Ring (1419)
  • [Join us on the Discussion Boards here]
  • .

 November 3, 3019 (S.R. 1419)

1. Battle of Bywater, and Passing of Saruman. End of the War of the Ring.

(from the appendices)

"...a messenger from the Tookland rode in. He was in high spirits. 'The Thain has raised all our country,' he said, 'and the news is going like fire all ways.…"

(Tolkien, 1965 Ballantine, p. 363-371 RotK)




b

EXCLUSIVE: LOTR Secrets Revealed in NEW Memoir from Ian McKellen’s Webmaster

It’s one thing to just be a reporter who covered The LOTR Trilogy during it’s lengthy production —...

The post EXCLUSIVE: LOTR Secrets Revealed in NEW Memoir from Ian McKellen’s Webmaster first appeared on Lord of the Rings & Tolkien News - TheOneRing.net Fan Community, since 1999.




b

No green thumb? Start your hobbit garden the easy way!

Have you always wanted to delight hobbit passerby with a beautiful springtime flower display but don't feel confident in your green thumb? Then you're in luck! Kili is here to show you just how easy it is to plant and grow bulbs! Watch the new episode and read her tips below.

https://youtu.be/EfTKXG9ndSs

Bulb planting tips:

  • Plant bulbs in the autumn so that they have time to chill over winter.
  • Choose a spot with partial to full sun
  • Bulbs need soil that drains well (so they don't turn to mush after prolonged exposure to moisture), so amend clay soil with perlite or other substances to aid drainage
  • As a general rule, dig a hole twice as deep as the bulb is tall.
  • Plant bulbs in the autumn so that they have time to chill over winter.
  • After the flowers have finished, don't prune them off! Allow the plant to continue its lifecycle. The leaves will continue to create and store energy that the bulb will use the following spring! The will die away on their own in mid-to-late summer.

Happy Hobbit has brought Middle-earth to its viewers' daily lives since 2012! Learn more hobbity recipes, crafts, and more by watching new episodes and/or perusing the 10+ years worth of videos on their YouTube channel. ???? New episodes debut every other Saturday, so be sure you are subscribed to Happy Hobbit so that you don't miss out!

Get even more slow-living hobbit content by following Happy Hobbit on Instagram, Facebook, Twitter, and TikTok! If watching the show has left you with an appetite for more, know that Kili (Kellie) has a podcast where Tolkien is often mentioned called Forests, Folklore & Fantasy



















b

What to expect at the COP16 biodiversity summit

Countries are convening in Colombia to debate how they will achieve wide-ranging targets to stem biodiversity loss and how they plan to pay for it




b

Many Iron Age swords may be tainted by modern forgery

Ancient weaponsmiths combined bronze and iron to fashion swords during the early Iron Age – but modern forgers glue together elements from different weapons, making it difficult for researchers to study the ancient technology




b

What the US election will mean for AI, climate action and abortion

The upcoming US presidential election will determine how the country regulates tech, combats the climate crisis and decides on access to abortion




b

Can sensor technology stop a wildfire before it starts?

The US Department of Homeland Security is trialling chemical sensors that detect the first whiff of smoke in the air and alert fire crews while a potential blaze is still smouldering




b

Morphing red blood cells help bats hibernate - and we could do it too

Animals that hibernate need a way to keep their blood flowing as their body temperature drops, and it seems that the mechanical properties of red blood cells may be key




b

Amateur sleuth finds largest known prime number with 41 million digits

The largest prime number is now 16 million digits longer than the previous record found in 2018, thanks to an amateur hunter and his large collection of high-power graphics cards




b

Meta AI tackles maths problems that stumped humans for over a century

A type of mathematical problem that was previously impossible to solve can now be successfully analysed with artificial intelligence




b

Extremely rare Bronze Age wooden tool found in English trench

In a wetland on the south coast of England, archaeologists dug up one of the oldest and most complete wooden tools ever found in Britain, which is around 3500 years old




b

All your questions about Marburg virus answered

Everything you need to know about Rwanda's outbreak of Marburg virus, which has been described as one of the deadliest human pathogens




b

Google tool makes AI-generated writing easily detectable

Google DeepMind has been using its AI watermarking method on Gemini chatbot responses for months – and now it’s making the tool available to any AI developer




b

DNA has been modified to make it store data 350 times faster

Researchers have managed to encode enormous amounts of information, including images, into DNA at a rate hundreds of times faster than was previously possible




b

Neuroscientist finds her brain shrinks while taking birth control

A researcher who underwent dozens of brain scans discovered that the volume of her cerebral cortex was 1 per cent lower when she took hormonal contraceptives




b

Battery-like device made from water and clay could be used on Mars

A new supercapacitor design that uses only water, clay and graphene could source material on Mars and be more sustainable and accessible than traditional batteries




b

Carbon emissions are now growing faster than before the pandemic

Despite talk of a green recovery, global greenhouse gas emissions continued to rise as the world emerged from coronavirus lockdowns




b

Your gut bacteria are at war - and force their enemies to switch sides

Rival tribes of bacteria armed with poison darts are fighting it out in your gut, with armies of traitors often winning the day




b

Complex form of carbon spotted outside solar system for first time

Complex carbon-based molecules crucial to life on Earth originated somewhere in space, but we didn't know where. Now, huge amounts of them have been spotted in a huge, cold cloud of gas




b

Tiny battery made from silk hydrogel can run a mouse pacemaker

A lithium-ion battery made from three droplets of hydrogel is the smallest soft battery of its kind – and it could be used in biocompatible and biodegradable implants




b

NASA is developing a Mars helicopter that could land itself from orbit

The largest and most ambitious Martian drone yet could carry kilograms of scientific equipment over great distances and set itself down on the Red Planet unassisted




b

Stone Age network reveals ancient Paris was an artisanal trading hub

Ancient stone goods found across France may have been made by skilled craftspeople in what is now Paris, who traded along vast networks




b

Weird microbes could help rewrite the origin of multicellular life

Single-celled organisms called archaea can become multicellular when compressed, highlighting the role of physical forces in evolution