Skip to main content

Representative Line: Tern Down a Date

2 months 3 weeks ago

Today's anonymous submitter has managed to find a way to do date formatting wrong that I don't think I've seen yet. That's always remarkable. Like most such bad code, it checks string lengths and then adds a leading zero, if needed. It's not surprising, but again, it's all in the details:

// convert date string to yyyy/MM/DD return dtmValue.Year + "-" + ((dtmValue.Month.ToString().Length == 1)? ("0" + dtmValue.Month.ToString()): dtmValue.Month.ToString()) + "-" + ((dtmValue.Day.ToString().Length == 1)? ("0" + dtmValue.Day.ToString()): dtmValue.Day.ToString());

This is only one line, but it has it all, doesn't it. First, we've got good ol' Hungarian notation, which conveys no useful information here. We've got a comment which tells us the code outputs /es, but the code actually outputs -. We've got ternaries that are definitely not helping readability here, plus repeated calls to ToString() instead of maybe just storing the result in a variable.

And, for the record, dtmValue.ToString("yyyy-MM-dd") would have done the correct thing.

.comment { border: none; } [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

Software Maker SAP Becomes Europe's Largest Company

2 months 3 weeks ago
An anonymous reader quotes a report from Reuters: German software company SAP overtook Danish healthcare company Novo Nordisk as Europe's largest company by market capitalization on Monday. At 0900 GMT, SAP had a market cap of $340 billion, slightly more than Novo Nordisk, according to Reuters calculations using LSEG Workspace data. SAP is Europe's largest software maker, providing business application software used by companies for finance, sales, supply chain and other functions. Its shares have surged in recent years, in part due to optimism that its cloud business will be a major beneficiary of recent investment in generative artificial intelligence. While SAP shares are up 7% so far in 2025, underperforming the broader European STOXX 600 index, which is up 8.3% year-to-date, they have clocked a total return of 160% since the end of 2022, far outperforming the STOXX 600's 28%. In contrast, Novo Nordisk shares have underperformed the market in recent months after data from trials of its experimental next-generation obesity drug Cagrisema disappointed investors.

Read more of this story at Slashdot.

BeauHD

Public-facing Kubernetes clusters at risk of takeover thanks to Ingress-Nginx flaw

2 months 3 weeks ago
How many K8s systems are sat on the internet front porch like that ... Oh, thousands, apparently

Cloudy infosec outfit Wiz has discovered serious vulnerabilities in the admission controller component of Ingress-Nginx Controller that could allow the total takeover of Kubernetes clusters – and thinks more than 6,000 deployments of the software are at risk on the internet.…

Simon Sharwood