Computer
Starlink's Laser System Is Beaming 42 Million GB of Data Per Day
Read more of this story at Slashdot.
Dell Terminates Distribution Deal With VMware After Broadcom Acquisition
Read more of this story at Slashdot.
CodeSOD: A Voice Map
Let's say your company wanted to offer special deals. When a customer calls about one of these deals, you want to play an automated customer support message using SignalWire, a tool for scripting phone voice trees.
This is a natural case for using a Map data structure. Which is what Ajay's predecessor did. They just… uh… weren't sure how to use a Map.
public String convert(Deal deal) { List<Deal> single = Collections.singletonList(deal); Map<Deal, String> swml = client.getSWMLs(single, version); for(Map.Entry<Deal, String> entry : swml.entrySet()) { if (deal.equals(entry.getKey())) { return entry.getValue(); } } return ""; }This Java code looks like a case of trying to fit some APIs together awkwardly.
Our function takes a Deal object. The client.getSWMLs function apparently requires a list as its input, because we start by converting the input into a singletonList- a list with one item in it.
client.getSWMLs then returns a map, presumably mapping every input in the list to the appropriate SWML script. Of course, we only sent it one, so I suspect that our map only has one key. No problem, though, as we can just call get on the Map…
Except that's not what we do. We convert the Map into a Set of Map.Entrys, and then iterate across the set. If the Deal in the set is the Deal we're looking for, we've found our value.
Bonus points for simply returning an empty string instead of a meaningful error when the input doesn't map to an output. I'm sure that never created any awkward customer support moments.
[Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. Get started with Otter today!First Lab-Grown Eel Meat Revealed
Read more of this story at Slashdot.
Microsoft AI Engineer Says Company Thwarted Attempt To Expose DALL-E 3 Safety Problems
Read more of this story at Slashdot.
YouTube TV's Now Lets You Customize Your Multiview Experiences
Read more of this story at Slashdot.
Microsoft's Gaming Revenue Is Up 49 Percent In Q2, Mostly Thanks To the Activision Deal
Read more of this story at Slashdot.
German Police Secure $2 Billion In Bitcoin From Pirate Site Operators
Read more of this story at Slashdot.
UPS To Cut 12,000 Jobs, Invest In AI For Efficiency
Read more of this story at Slashdot.
Apple Vision Pro Review Roundup
Read more of this story at Slashdot.
Raspberry Pi Is Planning a London IPO, But Its CEO Expects 'No Change' In Focus
Read more of this story at Slashdot.
Meta's Free Code Llama AI Programming Tool Closes the Gap With GPT-4
Read more of this story at Slashdot.
Starbucks is Launching Its Olive Oil-Infused Beverages Nationwide
Read more of this story at Slashdot.
FEMA Will Pay States To Install Solar Panels and Heat Pumps
Read more of this story at Slashdot.
Russia Hit With Widespread Internet Outage Across Country
Read more of this story at Slashdot.
'Microsoft Stole My Chrome Tabs, and It Wants Yours, Too'
Read more of this story at Slashdot.
ChatGPT is Leaking Passwords From Private Conversations of Its Users - Report
Read more of this story at Slashdot.
NY AG Sues Citibank For Failing To Protect Customers From Hackers And Scammers
Read more of this story at Slashdot.
Apple Says UK Could 'Secretly Veto' Global Privacy Tools
Read more of this story at Slashdot.
New GitHub Copilot Research Finds 'Downward Pressure On Code Quality'
Read more of this story at Slashdot.