News for hackers. Stuff that matters.

ojii

Re:Demystifying decorators: They don't need to be cryptic on Monday April 21, 2025 @01:05AM (#43748636)
Classes are callable.
Re:Demystifying decorators: They don't need to be cryptic on Sunday April 20, 2025 @11:21PM (#43748282)
One tiny correction:

> decorators are functions that take a callable argument and return a new callable

there's nothing forcing a decorator to return a callable. A decorator _could_ return anything it wants. I don't know why you would want that, but Python won't stop you.

Re:Google assigns a CVE for libwebp and gives it a 10.0 score on Tuesday September 26, 2023 @10:11AM (#37659612)
Hubris and people thinking they can safely code in memory unsafe languages (they can't)
Re:How Many Tracks Do Train Stations Need? on Friday June 17, 2022 @02:22AM (#31774699)
You can get pretty far with four terminal tracks: https://www.youtube.com/watch?v=8Ge81gKqtvE
while 戦 does indeed mean "war/battle", 作戦 means "tactics/strategy" which can be used in a military context but doesn't have to be. Japanese has a lot of compound words, so looking at just a single character can be a bit misleading.
Re:Asteroid capsule located in Australian desert on Saturday December 05, 2020 @10:59PM (#25320903)
It's heading out to asteroid 1998KY26 (ETA July 2031) after a flyby of asteroid 2001CC21 (ETA July 2026). It won't do any more sample collecting but take photos and other measurements.
> While developers need to figure that out, users are left unable to use their apps.

Or worse, the developers get stuck in App Review Hell for over a week and are unable to release their fix to their users.

This happened to me when the reviewer took umbrage with our screenshots (which have passed numerous previous reviews) and kept rejecting our update. Meanwhile the app was bricked in some configurations with nothing anyone could do about it.

Re:Folding@home now has 400k users fighting coronavirus on Friday March 20, 2020 @12:33PM (#22638926)
I think I got it to work by editing the config file at /etc/fahclient/config.xml and adding: <slot id='1' type='GPU'/>, then restarting the client. Took me some googling and trial and error though, so I agree this should be made clearer.
Re:The limits of high-speed rail on Friday February 07, 2020 @03:47AM (#22264233)
> The issue in Japan, though, is that they already have a high-speed network running on the same route, meaning that the extra gain from the maglev will be marginal.

Tokyo-Osaka in an hour vs the current 2.5h, that's far from marginal, especially if you do a round-trip.

Having done that trip a couple of times recently for business, I can't wait for the Chuo Shinkansen to open.

> Most citizens are army reserve and regularly go for training. FTFY: Most male citizens are forced to serve in the army and are forced to regularly go for training, or pay a hefty fine each year.
> Participants start the tour with the chance to earn $20,000

That's presumably why people would want to do this. And bragging rights.

> Why hasn't the market solved this problem?

Maybe "the market" is not a good tool to solve inequality.

Re:Frink on Monday August 13, 2018 @01:35AM (#17748200)
How would it be harder than to make a room exactly 10 feet x 12 feet x 8 feet?
Re:Improving SyntaxError in PyPy on Tuesday April 10, 2018 @10:47PM (#16807646)
The main reason I'm not even considering PyPy is that it lags behind CPython by a couple of versions. I'm getting ready to move to 3.7 while PyPy is still on 3.5.
Re:In Switzerland, it's now illegal to boil a live lobster on Sunday February 18, 2018 @01:39AM (#16404810)
This is Switzerland, if we Swiss had a problem with these laws or considered them "totalitarian" we could overturn them via a referendum.
Re:Python 1.0.0 is out (1994) on Saturday January 27, 2018 @02:15AM (#16245211)
Re:Announcing HTTP/2 support for all Azure CDN customers on Friday April 07, 2017 @01:26AM (#14057357)
Yes. Apples Push Notification API uses H2 + client certs.
Re:To fix L.A.'s traffic, we need tolls on Tuesday March 07, 2017 @11:45PM (#13817963)
Or half an hour with public transport (your route).
Re:US Customs block Canadian man after reading his Scruff profile on Wednesday February 22, 2017 @01:59AM (#13703698)
And for people who are not US citizens, the solution is pretty simple too: Don't travel to the US.
Re:Realtime Analysis of the Oroville Dam Disaster on Thursday February 16, 2017 @12:57AM (#13658029)
Football fields are area though, not volume. Maybe washington-monument-football-fields for an easy and relatable unit?
Re:Problems I Have with Python on Wednesday January 25, 2017 @04:55AM (#13480104)
Quick two minute implementation:

    import multiprocessing
    
    import time
    
    
    NULL = object()
    
    
    def call_webservice(fail=False):
        if fail:
            time.sleep(10)
            return False
        else:
            return True
    
    
    def wait_until_timeout(timeout, *async_results):
        results = [NULL] * len(async_results)
        end = time.time() + timeout
        while time.time() < end:
            for index, result in enumerate(async_results):
                if results[index] is NULL and result.ready():
                    results[index] = result.get()
            if not results.count(NULL): break
        return tuple(None if result is NULL else result for result in results)
    
    
    def handler():
        with multiprocessing.Pool() as pool:
            handle1 = pool.apply_async(call_webservice, (True,))
            handle2 = pool.apply_async(call_webservice, (False,))
            start = time.time()
            realres1, realres2 = wait_until_timeout(0.5, handle1, handle2)
            duration = time.time() - start
            print(f'Took {duration:.3f} seconds')
        print(realres1, realres2)
    
    
    if __name__ == '__main__':
        handler()
Re:Trump bans EPA employees from giving social media updates on Wednesday January 25, 2017 @01:27AM (#13479182)
There's a plan for that apparently: https://twitter.com/ScienceMarchDC
Re:If I could amend PEP 8 on Monday January 23, 2017 @03:34AM (#13460748)
What's your solution for function definitions for this?

  def very_long_function_name(arg_one, arg_two, arg_three, arg_four):
    ...
Also the repeated use of "break down in mid-flight" irritates me. To me it reads too much like "break up in mid-flight", as in, the plane breaks into small pieces.
Re:Concorde on Tuesday October 25, 2016 @05:45AM (#12786550)
There's a long-distance maglev train line under construction in Japan from Tokyo to Osaka, scheduled to be partially complete (Tokyo-Nagoya) in 2027 and fully complete in 2045 (if you're lucky and win the chance to buy a ticket, you can ride the bit of track that is complete already): https://en.wikipedia.org/wiki/Ch%C5%AB%C5%8D_Shinkansen
Re:Stripe in Japan on Tuesday October 04, 2016 @03:42AM (#12633923)
I don't even have a credit card (I live in Japan). Stuff I buy online I pay at the convenience store or on delivery in cash, everything else I pay in cash or using my commuter pass (RFID).
Re:FBI director: Cover up your webcam on Thursday September 15, 2016 @04:56AM (#12504448)
can I have a laptop without a webcam/integrated mic then?

Older »