[syndicated profile] guardianworldnews_feed

Posted by Luca Ittimani and Australian Associated Press

Residents near Narrabeen Lagoon told to leave on Saturday night as homes flooded and cars submerged across city

Summer storms on Australia’s east coast have claimed one life and threatened dozens more as flood waters rise.

Residents and holidaymakers have been told they can return back after being evacuated Narrabeen Lagoon in Sydney’s northern beaches overnight on Saturday, while a landslide damaged three homes and injured at least one woman 20km north, at Great Mackerel beach.

Continue reading...
[syndicated profile] guardianworldnews_feed

Posted by Geraldine McKelvie and Jakub Krupa

Prime minister and opposition politicians condemn threat to impose 10% tariff unless deal reached to buy the Arctic island

Keir Starmer has said Donald Trump’s decision to impose 10% tariffs on the UK and seven other European countries over Greenland was “completely wrong”.

The US president said on Saturday that the levies would apply from 1 February to Nato members – including the UK, France and Germany – who have deployed troops to the territory in response to growing uncertainty over its future.

Continue reading...

The Writing Life

Jan. 17th, 2026 07:08 pm
rolanni: (Default)
[personal profile] rolanni

The Long Back Yard:

#

Saturday. Snowing, but lightly. There may be half-an-inch of new stuff on the ground.

Breakfast was cream cheese on toast with a side of grapes. Breaking now for lunch and to bake pork chops, so I can have something to eat tomorrow (today, I'm having the other half of yesterday's sandwich and a bowl of lemon-orzo soup).

Wrote about 1,200 words this morning. Intend to go back after lunch and write some more.

Did PT Homework Part One, and my duty to the cats. Prepped the pork chops that are now in the oven.

The cats are in Steve's office. Tali's feeling feisty today, she threw Rook off of the top of the cat tree, and then took over his box on the desk. He has retired to Scrabble's Basket, which resides on its own stand in the V made by the sliders.

Speaking of sliders, I need to take measurements so I can order in some up-and-down blinds from Blindster. They promise me no-tools installation, so I'm in.

And? I think that's all I've got. I have not looked at the news today, and that seems to be working well, so I'll be continuing there.

What's happening at your house today?

#
Tali's new PR photo:

#
Saturday evening. Still snowing. Might be an inch out there by now.

Wrote just about 3,100 words today, bringing the total wordcount to +/-135,155. I may actually finish this draft tomorrow, for values thereof.

All cats have had their front claws clipped. Two out of a possible three cats cursed mightily at this indignity and have sworn to File Complaints. Firefly was Stoic, today.

Speaking of Firefly, her fans may recall that she really doesn't "get" the whole spring thing. Tali is a very enthusiastic player. Rook, who really is Scary Smart will chase the spring, and either bring it back to me so I can throw it again, or will guide me to where it's gone, so I can throw it again.

Firefly -- eh. The spring bounces over her head, she shrugs and walks away. It lands at her feet and the only thing she does is sit there. Unless Tali careens into her, whereupon she'll pound Tali in the head.

So -- no chasing the spring for Firefly.

She will, however, barter them. It goes like this: she does understand that the springs have value, and she will occasionally go find one, and then come to me, making her "I caught one!" sound. Which is my cue to? Get out the Cat Dancer or the blue octopus, so she can play in her preferred manner.

What's also interesting is that the other two recognize that she has purchased this time, and, while they'll watch her play (sometimes, they don't even bother to attend her play session), but they won't intrude on it.

And they say cats are dumb.

So! Time for a glass of wine, I think.

Everybody stay safe; have a good night. I'll check in tomorrow.


[syndicated profile] lemire_feed

Posted by Daniel Lemire

Irrespective of your programming language of choice, calling C functions is often a necessity. For the longest time, the only standard way to call C was the Java Native Interface (JNI). But it was so painful that few dared to do it. I have heard it said that it was deliberately painful so that people would be enticed to use pure Java as much as possible.

Since Java 22, there is a new approach called the Foreign Function & Memory API in java.lang.foreign. Let me go through step by step.

You need a Linker and a SymbolLookup instance from which you will build a MethodHandle that will capture the native function you want to call.

The linker is easy:

Linker linker = Linker.nativeLinker();

To load the SymbolLookup instance for your library (called mylibrary), you may do so as follows:

System.loadLibrary("mylibrary");
SymbolLookup lookup = SymbolLookup.loaderLookup();

The native library file should be on your java.library.path path, or somewhere on the default library paths. (You can pass it to your java executable as -Djava.library.path=something).

Alternatively, you can use SymbolLookup.libraryLookup or other means of loading
the library, but System.loadLibrary should work well enough.

You have the lookup, you can grab the address of a function like so:

lookup.find("myfunction")

This returns an Optional<MemorySegment>. You can grab the MemorySegment like so:

MemorySegment mem = lookup.find("myfunction").orElseThrow()

Once you have your MemorySegment, you can pass it to your linker to get a MethodHandle which is close to a callable function:

 MethodHandle myfunc = linker.downcallHandle(
     mem,
     functiondescr
 );

The functiondescr must describe the returned value and the function parameters that your function takes. If you pass a pointer and get back a long value, you might proceed as follows:

 MethodHandle myfunc = linker.downcallHandle(
     mem,
     FunctionDescriptor.of(
        ValueLayout.JAVA_LONG,
        ValueLayout.ADDRESS
    )
 );

That is, the first parameter is the returned value.

For function returning nothing, you use FunctionDescriptor.ofVoid.

The MethodHandle can be called almost like a normal Java function:
myfunc.invokeExact(parameters). It always returns an Object which means that if it should return a long, it will return a Long. So a cast might be necessary.

It is a bit painful, but thankfully, there is a tool called jextract that can automate this task. It generates Java bindings from native library headers.

You can allocate C data structures from Java that you can pass to your native code by using an Arena. Let us say that you want to create an instance like

MemoryLayout mystruct = MemoryLayout.structLayout(
        ValueLayout.JAVA_LONG.withName("age"),
        ValueLayout.JAVA_INT.withName("friends"));

You could do it in this manner:

MemorySegment myseg = arena.allocate(mystruct);

You can then pass myseg as a pointer to a data structure in C.

You often get an array with a try clause like so:

try (Arena arena = Arena.ofConfined()) {
       //
}

There are many types of arenas: confined, global, automatic, shared. The confined arenas are accessible from a single thread. A shared or global arena is accessible from several threads. The global and automatic arenas are managed by the Java garbage collector whereas the confined and shared arenas are managed explicitly, with a specific lifetime.

So, it is fairly complicated but manageable. Is it fast? To find out, I call from Java a C library I wrote with support for binary fuse filters. They are a fast alternative to Bloom filters.

You don’t need to know what any of this means, however. Keep in mind that I wrote a Java library called jfusebin which calls a C library. Then I also have a pure Java implementation and I can compare the speed.

I should first point out that even if calling the C function did not include any overhead, it might still be slower because the Java compiler is unlikely to inline a native function. However, if you have a pure Java function, and it is relatively small, it can get inlined and you get all sorts of nice optimizations like constant folding and so forth.

Thus I can overestimate the cost of the overhead. But that’s ok. I just want a ballpark measure.

In my benchmark, I check for the presence of a key in a set. I have one million keys in the filter. I can ask whether a key is not present in the filter.

I find that the library calling C can issue 44 million calls per second using the 8-bit binary fuse filter. I reach about 400 million calls per second using the pure Java implementation.

method time per query in nanoseconds
Java-to-C 22.7 ns
Pure Java 2.5 ns

Thus I measure an overhead of about 20 ns per C function calls from Java using a macBook (M4 processor).

We can do slightly better by marking the functions that are expected to be short running as critical. You achieve this result by passing an option to the linker.downcallHandle call.

binary_fuse8_contain = linker.downcallHandle(
    lookup.find("xfuse_binary_fuse8_contain").orElseThrow(),
    binary_fuse8_contain_desc,
    Linker.Option.critical(false)
);

You save about 15% of the running time in my case.

method time per query in nanoseconds
Java-to-C 22.7 ns
Java-to-C (critical) 19.5 ns
Pure Java 2.5 ns

Obviously, in my case, because the Java library is so fast, the 20 ns becomes too much. But it is otherwise a reasonable overhead.

I did not compare with the old approach (JNI), but other folks did and they find that the new foreign function approach can be measurably faster (e.g., 50% faster). In particular, it has been reported that calling a Java function from C is now relatively fast: I have not tested this functionality myself.

One of the cool feature of the new interface is that you can pass directly data from the Java heap to your C function with relative ease.

Suppose you have the following C function:

int sum_array(int* data, int count) {
    int sum = 0;
    for(int i = 0; i < count; i++) {
        sum += data[i];
    }
    return sum;
}

And you want the following Java array to be passed to C without a copy:

int[] javaArray = {10, 20, 30, 40, 50};

It is as simple as the following code.

System.loadLibrary("sum");
Linker linker = Linker.nativeLinker();
SymbolLookup lookup = SymbolLookup.loaderLookup();
MemorySegment sumAddress = lookup.find("sum_array").orElseThrow();

// C Signature: int sum_array(int* data, int count)
MethodHandle sumArray = linker.downcallHandle(
    sumAddress,
    FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.JAVA_INT),
    Linker.Option.critical(true)
);

int[] javaArray = {10, 20, 30, 40, 50};

try (Arena arena = Arena.ofConfined()) {
    MemorySegment heapSegment = MemorySegment.ofArray(javaArray);
    int result = (int) sumArray.invoke(heapSegment, javaArray.length);
    System.out.println("The sum from C is: " + result);
}

I created a complete example in a few minutes. One trick is to make sure that java finds the native library. If it is not at a standard library path, you can specify the location with -Djava.library.path like so:

java -Djava.library.path=target -cp target/classes IntArrayExample

Further reading.When Does Java’s Foreign Function & Memory API Actually Make Sense? by A N M Bazlur Rahman.

[syndicated profile] guardianworldnews_feed

Posted by PA Media

  • Higgins wins three consecutive frames in 6-5 victory

  • Kyren Wilson seals 6-5 win on Wu Yize with century

John Higgins reeled off three straight frames as he came from behind to earn a 6-5 semi-final victory over Judd Trump in the Masters at Alexandra Palace.

Things were looking ominous for the Scot early on as Trump ensured he took a three-frame lead with a neat break of 60, which ended with Higgins conceding. Higgins gave Trump something to think about before the mid-session interval by clawing it back to 3-2, including a century break, but breaks of 70 and 57 by the world No 1 helped him move to within a frame of victory at 5-3.

Continue reading...
[syndicated profile] guardianworldnews_feed

Posted by Geraldine McKelvie and Jakub Krupa

Prime minister and opposition politicians condemn threat to impose 10% tariff unless deal reached to buy the Arctic island

Keir Starmer has said Donald Trump’s decision to impose 10% tariffs on the UK and seven other European countries over Greenland was “completely wrong”.

The US president said the levies would apply from 1 February to Nato members – including the UK, France and Germany – who have deployed troops to the territory in response to growing uncertainty over its future.

Continue reading...

A quiet Saturday

Jan. 17th, 2026 11:42 pm
loganberrybunny: Drawing of my lapine character's face by Eliki (Default)
[personal profile] loganberrybunny
Public


351/365: Westbourne Street, Bewdley
Click for a larger, sharper image

I didn't do a great deal today, and I was more than happy with that. It was the kind of day when reading a book or looking at the telly were highlights. An unexpected NHS letter turned up in the morning, which was briefly concerning until I discovered it was simply a copy of the doctor's notes from my last ophthalmology consultation, which didn't say anything unexpected. As the weather was okay I got a bit of walking in, though only around town. This is Westbourne Street in Wribbenhall. In days of old it was called Whispering Street, because the wind would sound like whispers as it blew along the road.
glinda: I want everything I've ever seen in the movies (movies)
[personal profile] glinda
Ooooh fandom_trees got revealed, I went looking for a needy tree over the holidays, found one looking for Edge of Tomorrow and thought ‘oh I have that, I should rewatch it’ and wrote this. It was my last watched film of last year and my first finished fic of this year which is pleasing to me. A nice end to my film rewatch project from last year where I pretty much wrote a fic for each film I re-watched.

Possibly/Probably (The Best Friend You've Never Met) (1599 words) by Glinda
Chapters: 1/1
Fandom: Edge of Tomorrow (2014)
Rating: Teen And Up Audiences
Warnings: Creator Chose Not To Use Archive Warnings
Relationships: William Cage/Rita Vrataski, William Cage & Rita Vrataski
Characters: William Cage, Rita Vrataski, Dr. Carter (Edge of Tomorrow)
Additional Tags: Post-Canon, Pre-Relationship, Friendship, final 'first' meeting
Summary: It’s a cliche often repeated, that you never get a second chance to make a good first impression. Cage tries all the same.
[syndicated profile] guardianworldnews_feed

Posted by Kyriakos Petrakos (now) and Vivian Ho (earlier)

Denmark, Norway, Sweden, the UK, France, Germany, the Netherlands and Finland will face tariffs from 1 February

What do people in Greenland think of Donald Trump and his threats to take over the island? The Guardian’s Miranda Bryant and Lauren Hurrell take a look.

Reuters estimated that thousands of protesters attended the “Hands Off Greenland” rallies around Denmark on Saturday, chanting “Greenland is not for sale” and waving Greenland’s red and white “Erfalasorput” flag.

Continue reading...
[syndicated profile] guardianworldnews_feed

Posted by David Hytner at Tottenham Hotspur Stadium

  • Manager barracked by fans after late 2-1 defeat

  • Romero comments add to sense of unease at Tottenham

Thomas Frank’s future as the Tottenham manager is in doubt after Saturday’s last-gasp 2-1 home defeat by West Ham, at which the club’s supporters called for him to be “sacked in the morning”.

The Spurs hierarchy have been mindful of the difficulties Frank has faced during what was always likely to be a transitional season. The chief executive, Vinai Venkatesham, wrote an open letter to fans on Saturday morning, the tone of which was supportive, the overriding message being a call for patience.

Continue reading...
[syndicated profile] guardianworldnews_feed

Posted by Australian Associated Press

Residents near Narrabeen Lagoon told to leave as homes flooded and cars submerged across city

Australia’s east coast is being smashed by summer storms as residents are told to evacuate.

An emergency warning was in place for Sydney’s northern beaches on Sunday morning, with residents at Narrabeen Lagoon and surrounds told to leave.

Continue reading...
[syndicated profile] guardianworldnews_feed

Posted by William Christou

Country says some appointments to the group, which will oversee the administration and reconstruction of Gaza, are ‘contrary to its policy’

Israel has objected to the White House’s pick of world leaders who will join the so-called Gaza “board of peace”, meant to temporarily oversee governance and reconstruction in the strip.

The White House and other sources announced a flurry of appointments and invitations to the organisation over the last two days, including Turkish president Recep Tayyip Erdoğan, the Egyptian president, Abdel Fatah al-Sisi, former UK prime minister Tony Blair and the president of Argentina, Javier Milei.

Continue reading...
[syndicated profile] guardianworldnews_feed

Posted by Aston Brown

After traumatic events we look for reminders of humanity’s good, and flashes of courage from ordinary people become symbols of hope. But it can be hard to wear the hero’s crown

The smell of burning flesh and pulverised concrete is seared into the psyche of Anneke Weemaes-Sutcliffe. On 22 March 2016, the Australian expat was due to check in for a flight when Islamic State suicide bombers detonated two nailbombs inside Brussels airport. Miraculously unharmed, she sprinted to the exit after the second blast exploded metres away from her – but then, risking her life, decided to turn back.

Screams, wailing alarms and a thick blanket of dust choked the air. The ceiling had caved in. “It turned from buzzing with life to a war zone. It’s horrific, absolutely horrific,” Weemaes-Sutcliffe says.

Continue reading...