Skip to main content

CodeSOD: Weekly Calculated

3 weeks ago

There's a language out there called "Progress Advanced Business Language" (or "Open Edge Advanced Business Language"). Just hearing that string of words in a sequence tells you you're in for it. It's a verbose, "English-like" programming language. But we're not here to pick on the language.

A long time ago, Mirjam had the "pleasure" of working in a Progress ABL environment. At some point, one of the developers had needed to find a date six months prior to the current date. It didn't need to be accurate, and thus said developer littered the code with comments reminding everyone that it didn't need to be that accurate. They arguably spent more time defending the choice to be inaccurate than it would have taken to write code that would have been accurate.

Mirjam doesn't have the code anymore, so what we have here is a mix of her remembered pseudocode, Progress syntax, and my attempts to clarify all of it. Let's not worry too much about the language, and instead focus on the logic:

ASSIGN v-date = TODAY. /* Calculates the current week/year */ RUN week.p(INPUT v-date, OUTPUT v-weeknumber, OUTPUT v-year). IF v-weeknumber > 26 THEN ASSIGN v-weeknumber = v-weeknumber - 26. ELSE ASSIGN v-weeknumber = 52 - 26 - v-weeknumber v-year = v-year - 1. /* Turn the result of that calculation back into a date */ RUN week2.p(INPUT v-weeknumber, INPUT v-year, OUTPUT v-resultdate).

This code gets the current date. It then breaks that into week number of the date (1-52), and the year of the date. Then, if the week number is greater than 26, it subtracts 26 from it, giving us a date half a year ago, ish. If the current weak number is less than or equal to 26, we do 52 - 26 - v-weeknumber, and decrement the year. Which yes, is a fairly round about way to handle the rollover- 52 - 26 happens to be… 26.

It's worth noting, that as primitive looking as this syntax is, Progress ABL does have an ADD_INTERVAL function, which lets you do date arithmetic, without all this nonsense. In fact, Mirjam went ahead and replaced all of this with a single line.

That said, as a little bonus WTF, Progress does have some weird date quirks, for example, you can construct a date from an integer. Which has a very unsurprising (but also, weirdly surprising) range of possible values:

The value of the expression cannot be a date value before 12/31/-32768 or after 12/31/32767.

At least that covers a range that includes both the discovery of agriculture and the eventual rediscovery of agriculture after the event that enters into legend as "The Fall".

[Advertisement] Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.
Remy Porter

HPE Tempts VMware Users, Partners With Year of Free Virtualization Software

3 weeks ago
An anonymous reader quotes a report from Ars Technica: Hewlett Packard Enterprise's (HPE) new virtualization software promotion will likely pique the interest of end users and resellers who are unhappy with Broadcom's pricing of VMware. During its HPE Discover event in Las Vegas this week, HPE announced that customers could use its "HPE Morpheus Software -- VM Essentials" offering for free for "up to one year," per a press release. HPE's website describes its virtualization platform as a "VMware alternative." It includes a hardware virtual machine (HVM) hypervisor and unified management and lets users "manage VMware ESXi and HVM clusters from one console and migrate when you're ready," HPE's website says. "New VM Essentials customers can receive up to one free year of licenses for VM Essentials, a year of HPE Zerto for $1 to support non-disruptive migration to HPE virtual machines, and 0 percent interest on software through HPE Financial Services," HPE's announcement reads, referring to HPE's group for helping IT teams manage funding. Free for a year is cheaper than what Broadcom has charged for VMware vSphere since taking over. VMware prices have skyrocketed due to VMware's parent company eliminating perpetual licenses and bundling products into expensive packages. Notably, per its website, HPE recommends charging $600 per CPU socket per year for VM Essentials; Broadcom has controversially shifted vSphere licensing pricing to a per-core basis. "Customers are feeling quite a bit of pain in the change that some of the virtualization companies have put there, specifically Broadcom," Jeremiah Jenson, VP of HPE's North American channel and partner ecosystem, told CRN. The executive claimed that VM Essentials could bring up to 90 percent cost savings compared to VMware while also helping to "eliminate vendor lock-in and simplify hybrid IT." From March 1 to June 30, HPE has also been offering a free year of VM Essentials via rebate to customers who buy an AMD server and a one-year VM Essentials license. VM Essentials is only available through channel partners, a stark contrast from Broadcom's VMware approach, where the chip giant has drastically reduced the number of resellers that can sell VMware products. HPE's new promotion aims to entice customers to more deeply consider migrating off VMware. [...] HPE also announced that it would give 600 reseller partners who earn the HPE partner program's Private Cloud with Virtualization competency by the end of the year free VM Essentials software licenses for three years. Partners still have to pay support costs, though. The benefit is "a step in the correct direction," said Dean Colpitts, CTO of Canadian managed services provider (MSP) Members IT Group (MITG), which VMware cut from its reseller program after 19 years of partnership a year ago. However, limiting the promotion to 600 partners is "very shortsighted." He believes that HPE should give all of its partners VM Essentials "to facilitate getting [VM Essentials] into customer sites and displacing the competitors." "They need to fling [VM Essentials] as far and as fast as they possibly [can] to immediately gain traction and draw ISVs to them, which will increase adoption even more," he said.

Read more of this story at Slashdot.

BeauHD