Computer
OpenAI Says GPT-4 Poses Little Risk of Helping Create Bioweapons
Read more of this story at Slashdot.
Ivanti Patches Two Zero-Days Under Attack, But Finds Another
Read more of this story at Slashdot.
California And Big Oil Are Splitting After Century-Long Affair
Read more of this story at Slashdot.
Cruise Faces Long Road Back To City Streets in Wake of Safety Review
Read more of this story at Slashdot.
Binance Code and Internal Passwords Exposed on GitHub for Months
Read more of this story at Slashdot.
Add Bacteria To the List of Things That Can Run Doom
Read more of this story at Slashdot.
23andMe's Fall From $6 Billion To Nearly $0
Read more of this story at Slashdot.
Google One is About To Hit 100 Million Subscribers
Read more of this story at Slashdot.
PayPal To Cut About 2,500 Jobs as Rivals Snag Market Share
Read more of this story at Slashdot.
ByteDance CEO Urges Staff To Resist Mediocrity After Missing Initial AI Wave
Read more of this story at Slashdot.
OpenAI's ChatGPT Breaches Privacy Rules, Says Italian Watchdog
Read more of this story at Slashdot.
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.