Feed aggregator
Bluesky Is Getting Its Own Photo-Sharing App, Flashes
Read more of this story at Slashdot.
Telegram Shuts Down Z-Library, Anna's Archive Channels Over Copyright Infringement
Read more of this story at Slashdot.
UnitedHealth Hid Its Change Healthcare Data Breach Notice For Months
Read more of this story at Slashdot.
LinkedIn Wants You To Apply For Fewer Jobs
Read more of this story at Slashdot.
New Jersey Governor Pushes Phone Ban in Schools
Read more of this story at Slashdot.
FTC Sues Deere Over Farm-Equipment Repair Restrictions
Read more of this story at Slashdot.
'Mistral is Peanuts For Us': Meta Execs Obsessed Over Beating OpenAI's GPT-4 Internally, Court Filings Reveal
Read more of this story at Slashdot.
DJI Removes US Drone Flight Restrictions Over Airports, Wildfires
Read more of this story at Slashdot.
PowerSchool Data Breach Victims Say Hackers Stole 'All' Historical Student and Teacher Data
Read more of this story at Slashdot.
Microsoft Will Not Support Office on Windows 10 After October 14
Read more of this story at Slashdot.
Even Harvard MBAs Are Struggling To Land Jobs
Read more of this story at Slashdot.
Google is Making AI in Gmail and Docs Free - But Raising the Price of Workspace
Read more of this story at Slashdot.
Microsoft Relaunches Copilot for Business With Free AI Chat and Pay-As-You-Go Agents
Read more of this story at Slashdot.
Meta Says It Isn't Ending Fact-Checks Outside US 'At This Time'
Read more of this story at Slashdot.
TikTok Users Flocks To Chinese Social App Xiaohongshu
Read more of this story at Slashdot.
Parallels Can Now Run x86 Windows and Linux On Apple Silicon Mac
Read more of this story at Slashdot.
CodeSOD: Brushing Up
Keige inherited some code which seems to be part of a drawing application. It can load brush textures from image files- at least, sometimes it can.
static public Brush GetImageBrush(string serviceCode, string imageName, string language) { Brush BorderChannelGroupBrush; BitmapImage image = null; int point = imageName.LastIndexOf('.'); string languageImagename = imageName.Substring(0, point) + "-" + language + imageName.Substring(point); try { image = FrameWork.ServicePageImageUrlOnContentServer(serviceCode, languageImagename); } catch { } if (image == null) { try { image = FrameWork.ServicePageImageUrlOnContentServer(serviceCode, imageName); } catch { } } if (image != null) { BorderChannelGroupBrush = new ImageBrush(image); } else { BorderChannelGroupBrush = Brushes.White; } return BorderChannelGroupBrush; }There are a lot of interesting "choices" made in this code. First, there's the old "find the last '.'" approach of grabbing the file extension. Which is fine, but there's a built-in which handles cases like when there isn't an extension better. I think, in this case, it probably doesn't hurt anything.
But the real fun starts with our first attempt at loading our image. We jam a localized language string in the middle of the file name (foo-en.jpg), and try and fetch that from the server. If this fails, it throws an exception… which we ignore.
But we don't fully ignore it! If the exception was thrown, image doesn't get set, so it's still null. So we do a null check, and repeat our empty exception handler. If the image is still null after that, we default to a "Brushes.White" image.
It's all a very awkward and weird way to handle errors. The null checks bring with them the whiff of a C programmer checking return codes, but I don't actually think that's what happened here. I think this was just someone not fully understanding the problem they were trying to solve or the tools available to them. Or maybe they just really didn't want to deal with nesting.
It's hardly the worst code, but it does just leave me feeling weird when I look at it.
[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.US Deaths Expected To Outpace Births Within the Decade
Read more of this story at Slashdot.
Australian Open Avatars Helping Tennis Reach New Audience
Read more of this story at Slashdot.
Pixelfed, Instagram's Decentralized Competitor, Is Now On iOS and Android
Read more of this story at Slashdot.