It must be flying saucers from outer space. Obviously, what else could it be? I read it on the Intertubes.
It's the usual story: the US Department of Defense and all it's hangers-on have got fragments and intact vehicles "of exotic origin (non-human intelligence, whether extraterrestrial or unknown origin) based on the vehicle morphologies and material science testing and the possession of unique atomic arrangements and radiological signatures."
Well, I don't know about you, but that's me convinced.
“The non-human intelligence phenomenon is real. We are not alone,” Grey said. “Retrievals of this kind are not limited to the United States. This is a global phenomenon, and yet a global solution continues to elude us.”
See?
Subtitle: Angry Old Man Shakes Fist and Shouts at the Sky/Get off my Lawn
Alas I am not young enough to know everything. Fortunately I am surrounded at work by people who are so I am not completely lost.
We had a very confident young hotshot who left some time ago for a very well-paid job "doing AI." He knew much. He knew that Bitbucket was the way to go. And we adopted bitbucket and we pay a subscription.
Bitbucket is pretty cool. It's very similar to GitLab. In a previous life I set up and ran my own GitLab server and had my own continuous integration pipeline. I really liked using it.
Now to the present. I have been doing PHB duties, then I was given emergency bug fixes to do on Critical Projects(TM) and all sorts of stuff and because reasons I am writing code again for Critical Projects(TM) with tight deadlines meanwhile trying to do all sorts of other stuff including teaching the young ones things about C (everything's Python nowadays).
We had a crazy head of projects who was from the headless chicken school of management and some months ago I was given a fortnight to write a suite of command line utilities to process some data in a pipeline from the latest Critical Project(TM). Specifications? Requirements? A rough idea of what might be in the system? Ha! Fortunately crazy head of projects got a new job and left.
I wrote this code, in C, from scratch, on my own, and in four days flat I had three working command line utilities which I had written using test driven development (TDD) and will an additional layer of automated tests run by shell scripts all at the beck and call of make. I cheated and wrote some scripts to help me write the code.
As you can imagine, these utilities are pretty small. We gave them to the new guy to finish off. Six weeks and lots of hand-holding later, I took them back to fix.
However, we have this "continuous integration" setup based on bitbucket. It's awfully like GitLab, which I used some years ago, so there are no great surprises.
Now we come to the super fun part. We build locally, not on Bitbucket's cloud, which is good. The strange thing is that since I got old, Docker has come along.
The young hotshot who knew everything decided that we needed to do all our builds in these Docker containers. Why?
A Docker container is just one of these LXC container things which is a form of paravirtualisation, somewhere between chroot jails and a proper VM, where the kernel presents an interface that looks like a whole system on its own (see Solaris 10 Containers). That means that you can run "arbitrary" Linux instances (with their own hostnames and IP addresses) on top of a single kernel. Or can you? Doesn't it have to be compatible with (integrated with) the kernel version and build that the host is running?
This is a cool feature. You can have many lightweight pretend virtual hosts on a single machine without having a hypervisor. You can also use it to have a user-land environment with a specific configuration nailed down (set of tools, applications, libraries, user accounts). It might be a great way to set up a controlled build environment for software.
For the last hundred years or so anyone who knows anything about making stuff (engineering) understands that you need to eliminate as much variation in your process as possible for quality, reliability and predictability.
So here's the thing - do you think our young hotshot and his successors have this sorted out? Think again!
I needed to set up some build pipelines and I was shocked. Apparently we are using a plethora of diverse Docker containers from the public Internet for building various software. But that's OK, they're cached locally...
Never mind that this stuff has to work properly.
Everyone in the team is developing their code on a different configuration. We have people using WSL (seriously) and others running various versions of Ubuntu in VMs. So we have these build pipelines running things like Alpine (because the image is small) which may or may not be anywhere near WSL or Ubuntu versions X to Y.
It gets better. Everything we do, every piece of software we build has its own Docker container. And then it goes onto a VM which gets "spun up" in the Microsoft(R) Azure(TM) cloud.
My little command line utilities, a few hundred k each compiled, get compiled in their own Docker container. That's hundreds and hundreds and hundreds of megabytes of random junk to compile a few thousand lines of C. When I type make on my command line (in my Ubuntu VM) each one takes under a second to build against the unit tests and rebuild again and run the automated regression tests.
The final thing that takes the cake is that I have to release these tools to another department (which they'll then put in a "pipeline" on "the cloud") and after about a year of having this amazing set-up for continuous integration, the young folk can't tell me (and they haven't figured it out yet) how to get the built binaries out of the build system.
Because the builds are done in Docker containers, the build artifacts are in the containers and the container images are deleted at the end of the build. So tell it not to delete the image? Put a step in the build script to copy the artifacts out onto a real disk volume?
"We don't know how."
There's a reason human beings haven't set foot on the Moon in over 50 years, and the way things are going our own stupidity will be the end of us. Mark my words.
Cache or cores? Biscuit or cake?
It's about three years since I built my Ryzen system. It's a Ryzen 5 3600 (Zen 2, Socket AM4) with 32GB RAM.
Since dual core became a thing I have been meaning to take over the world with cunning multi-threaded code but about as far as I've got is some shell scripts that do things in parallel.
I figured I should upgrade the machine while AM4 CPUs are still available. I noted that AMD had some CPUs out with this newfangled 3D cache, and that they were pretty fast on certain workloads.
So my decision was biscuit or cake? Cache or cores?
It's taken me a few weeks, and much deliberation but today I decided to go for the cake. I think it will be more fun to have more cores to play with. I have ordered a Ryzen 9 5900X (12 core/24 thread Zen 3) and a cooler with two great big fans and fancy quiet bearings to go with it.
I'll need to revisit my old tests from three years ago and see what sort of a difference all those extra cores make. Obviously, there will be more contention for memory bandwidth. If I get around to it, I might post the results together with the results for the old CPU.
Meantime, I have been writing a little bit of C, finally getting around to something I've been meaning to do for 15 years. One day I'll write something about procrastination. I have an anecdote.
You have no chance to survive make your time.
---
SoylentNews Archive Expander to go here
---
Archived Journals:
NCommander (2) ***
mechanicjay (7)
stderr (11)
mattie_p (13)
The Mighty Buzzard (18)
Barrabas (22)
AudioGuy (24)
bryan (29)
chromas (34)
Covalent (43)
janrinok (52)
Blackmoore (57)
paulej72 (58)
juggs (63)
xlefay (65)
unitron (70)
Hairyfeet (75)
martyb (76)
Lagg (105)
RobotMonster (130)
c0lo (156)
wjwlsn (171)
crutchy (179)
hemocyanin (186)
Sir Finkus (192)
TheRaven (270)
cosurgi (272)
NotSanguine (285)
pbnjoe (313)
tdk (346)
CoolHand (438)
cmn32480 (443)
BlackHole (530)
Phoenix666 (552)
stormwyrm (717)
Freeman (732)
Jaruzel (812)
takyon (881) ***
cafebabe (894)
n1 (993)
Marand (1081)
Subsentient (1111)
frojack (1554)
Snow (1601)
maxwell demon (1608)
GungnirSniper (1671)
dbot (1811) (FRIENDLESS)
Yog-Yogguth (1862)
tynin (2013)
velex (2068)
MichaelDavidCrawford (2339)
aristarchus (2645)
Woods (2726)
Jeremiah Cornelius (2785)
anubi (2828)
gishzida (2870)
bradley13 (3053)
ikanreed (3164)
GreatAuntAnesthesia (3275)
jasassin (3566)
Bot (3902)
canopic jug (3949)
Bytram (4043)
kaszz (4211)
bzipitidoo (4388)
Arik (4543)
Azuma Hazuki (5086)
Sulla (5173)
kurenai.tsubasa (5227)
https (5248)
AthanasiusKircher (5291)
charon (5660)
butthurt (6141)
barbara hudson (6443)
fyngyrz (6567)
realDonaldTrump (6614)
jmichaelhudsondotnet (8122)
Mojibake Tengu (8598) ***
Zinnia Zirconium (11163)
nostyle (11497)
*** More to archive.
The National Conservatives had a rally in London this week. I wanted to write something, but the Guardian summary will suffice.
It's barely disguised now.
From the fine article:
Perhaps the speech most reported on was by the Tory backbencher Miriam Cates, who part-channelled Viktor Orbán and Giorgia Meloni in describing low birthrates as an existential crisis for the west. The populist leaders of Hungary and Italy are explicit in wanting more domestic-born children as against immigrants, a point Cates did not make, although it was arguably implicit. More striking still was her argument that the lack of babies was down to “cultural Marxism that is systematically destroying our children’s souls”.
This was also the conference where Jacob Rees-Mogg (a member of the current UK government) spoke and admitted that recent changes to electoral law in England and Wales were an attempt at gerrymandering, to disenfranchise people who might vote for parties other than his, but that it had backfired. The Conservatives appear to have disenfranchised many of their own voters.
It's in plain sight now. These are National Conservatives, the NatCs.
There is not much more to be said.
Update: Judging by the discourse below, there certainly is more to be said. Once again I will not say it myself. Instead I'll post a link to SNP MP Mhairi Black's f-word speech given to Parliament last year.
Pro-republic demonstrators were arrested in London on Saturday ahead of King Charles III's coronation ceremony, despite having planned their protest in cooperation with the Metropolitan Police several months in advance.
Asked if he thought his arrest before the event was premeditated, Smith said: “Absolutely. I have no doubt about that at all, simply because there was nothing that we did do that could possibly justify even being detained and arrested and held.”
Other arrests were made.
The Met said it arrested 64 people on Saturday, including members of Westminster city council’s women’s safety campaign Night Stars, who hand out rape alarms and other items. Police claimed intelligence had indicated people were planning to use rape alarms to disrupt the coronation procession.
We have a constitutional Monarch who is effectively powerless. We need a proper democratically-elected head of state. This medieval pantomime has no place in the 21st Century.
New anti-protest laws were very recently brought in further curtailing our rights and freedoms.
The UK is becoming very authoritarian and the police are being given more and more powers. Human rights organisation Liberty has a good article on the recent changes to the law.
Prince Charles became King Charles III on 8th September 2022 upon the death of his mother, Queen Elizabeth II, that day. However, despite this, there will be a coronation ceremony next Saturday 6th May which is estimated to cost £100M and will be paid for out of public money, i.e. our taxes. This is against a backdrop of 10% inflation, fuel, food and housing poverty, and public services such as education and the National Health Service on their knees.
We, the people of the UK, his subjects, are being invited to swear an oath of allegiance to our king as follows:
“I swear that I will pay true allegiance to Your Majesty, and to your heirs and successors according to law. So help me God.”
There are a number of problems with this as you can see. I will not be swearing such an oath. As an atheist, I do not believe that there is a God to help me. I do not believe that the King derives any sort of power from this God, I do not believe in blind obedience, and I do not believe in an unelected hereditary head of state. It is fundamentally incompatible with a modern democracy.
The UK constitution, such as it is, a hotch-potch collection of customs and documents handed down through history, hasn't really changed much since the Norman Conquest of 1066.
We have the Houses of Parliament, the House of Commons (the nominally democratic bit), and the House of Lords (the appointed/hereditary second chamber).
We elect our Members of Parliament every five years using a First Past the Post system. Effectively this limits our governments to the two main political parties, Conservative (the "establishment party") and Labour (formerly the radical left but now watered-down conservatives). Very occasionally one party does not get an outright majority, and has to form a coalition with the third largest party (the Liberal Democrats), which the Conservatives did in 2010. At that time, the Liberal Democrats were economically on the right and supported many right-wing economic policies that disadvantaged ordinary people, such as regarding university tuition fees. Their reputation has never recovered and they were nearly wiped out in subsequent elections.
Nominally the Monarch is Head of State. All laws passed by Parliament have to be scruitinised by the Lords and then sent to the Monarch to be given Royal Assent. At this point, there may be secret changes to the laws often to benefit Royalty and this has been well documented in the press in recent years.
What happens if a government misbehaves or breaks the law? The British system has relied on government ministers and MPs being decent chaps, who would always do the right thing, and resign if they made a serious mistake. However there is nothing written down in our constitution, no laws. MPs can be banned from Parliament, and they can be deselected forcing a byelection if banned for long enough, but who decides when to ban them and for how long?
The unlawful prorogation of Parliament in 2019, in a proper democracy, might have resulted in a change of government via a general election. It did not.
Under the UK constitution, such as it is, the Monarch has the power to dismiss the government. The last time a Monarch (Charles I) did this in the 17th Century (for autocratic reasons), there was a revolution, led by Oliver Cromwell. The King was put on trial, found guilty and beheaded. Britain became a republic under Puritan rule via Parliament for several years. Eventually, the people tired of the Puritans and restored the monarchy.
As a result, the Monarch is banned from entering Parliament, and there are archaic protocols and traditions to prevent the Monarch or the Lords interfering in Parliament (see Black Rod).
There is also an important legal precedent. When the Monarchy was restored, it was on the condition that it would not interfere with democracy. The short story is that the Monarch still retains the power to dismiss Parliament and therefore call a general election, however, to do so would result in the end of the Monarchy. Obviously it would not result in an execution, which would be abhorrent, but politically it would be suicide.
We find ourselves in a situation where our democracy has a major flaw in its "checks and balances." The code of decent chaps has been broken in these times of Faragism and National Conservatism and there is nothing to stop it.
Freedom of speech is not officially codified in our written laws but it is a custom which is generally defended and upheld. What if you want to abolish the Monarchy and live in a republic with a democratically-elected head of state (president) who has a maximum time in office and can be replaced regularly and frequently via free and fair elections?
There is an organisation called Republic which is organising a peaceful protest in London on the day of the Coronation.
Coincidentally, some new anti-protest laws will come into force just in time for it and intimidatory letters have been sent to the protestors.
Graham Smith, the campaign group’s chief executive, described the letter as “very odd” and said the group was seeking assurances from the police that nothing had changed in relation to its plans to protest on coronation day.
Shami Chakrabarti, the former shadow attorney general, said: “During the passage of this illiberal and headline-grabbing legislation, ministers admitted that the new offence of ‘locking on’ is so broad as to catch peaceful protesters who link arms in public.
Perhaps I should start using a VPN, eh?
Update: Anti-monarchy campaigners have been arrested in London preparing to protest peacefully.
Graham Smith, the chief executive of Republic, had been collecting drinks and placards for demonstrators at the main site of the protest on Trafalgar Square when he was stopped with five others by police on St Martin’s Lane in central London.
And:
Harry Stratton, a director at Republic, who arrived as Smith and the others were detained, said: “They were collecting the placards and bringing them over when the police stopped them. The guys asked why and they were told: ‘We will tell you that once we have searched the vehicle.’ That’s when they arrested the six organisers.
It seems that the new anti-protest laws are being applied, particulary regarding "lock-on devices."
Stratton said the organisers of the protest had not possessed lock-on devices. “What would we lock on to? We are just protesting.” He added that one protestor at Trafalgar square had been taken away by police as he had string on him. “It’s string that was part of his placard, he said. “What was he going to do with that?”
Is this our new National Conservatism in action?
Memory prices have slipped below $2/GB (US). I got someone to buy 32 GB DDR4-3200 SO-DIMM for under $60, but it was as low as $50 two weeks ago.
Here's 32 GB DDR4-3600 for $61.
Even DDR5 is not too bad, for example $92 to $100 for 32 GB DDR5-6000, and slow DDR5-4800 is being dumped for less.
If we haven't reached rock bottom for DDR4 prices, it will probably happen within the next couple of months:
Memory market to bottom out in 2Q23 with uncertain recovery prospects
Samsung Becomes Latest Memory Fab to Cut Production Amidst Post-Pandemic Slump
Samsung may cut quarter of chip production to ease inventory woes
DRAM spot prices stop falling
Samsung faces weakest quarter since 2009 as memory chip market in 'worst slump in decades'
SK Hynix sees H2 memory chip rebound; outlook helps shares brush off record loss
Micron to stop lowering memory chip prices starting May, say sources
Make sure to keep a record of your purchase so you can participate in a future class action lawsuit.
Edit: Poor Earnings Force Samsung To Reduce Production Of DDR4 As Pricing Takes A Rollercoaster Dive
I just got this email:
Bard has just been updated with coding capabilities
Code and debug with Bard
This update introduces software development support for over 20 programming languages, including JavaScript, Python, SQL, TypeScript, and even Google Sheets functions.
Collaborate with Bard to help generate, explain, and debug your code. Google Colab users can also export Python code generated by Bard directly to Google Colab to seamlessly continue programming tasks.
>Write a javascript function for calculating the dates of Fat Tuesday, Ash Wednesday, Good Friday, Easter Sunday, and Pentecost, for a given year.
The Draft 1 it presented to me was incorrect garbage, as is Draft 3, but Draft 2 might be correct:
function calculateDates(year) {
// Calculate the date of Easter Sunday.
var easterSunday = easterDate(year);// Calculate the dates of the other holidays.
var fatTuesday = new Date(easterSunday - 47 * 24 * 60 * 60 * 1000);
var ashWednesday = new Date(fatTuesday - 1 * 24 * 60 * 60 * 1000);
var goodFriday = new Date(easterSunday - 2 * 24 * 60 * 60 * 1000);
var pentecost = new Date(easterSunday + 49 * 24 * 60 * 60 * 1000);// Return the dates of the holidays.
return {
fatTuesday: fatTuesday,
ashWednesday: ashWednesday,
goodFriday: goodFriday,
easterSunday: easterSunday,
pentecost: pentecost
};
}// Calculate the date of Easter Sunday.
function easterDate(year) {
// Calculate the year of the Paschal full moon.
var yearOfPaschalFullMoon = (year - 1) % 19 + 1;// Calculate the day of the week of the Paschal full moon.
var dayOfWeekOfPaschalFullMoon = (yearOfPaschalFullMoon + 1) * 2 + (yearOfPaschalFullMoon > 11 ? 4 : 0) % 7;// Calculate the date of Easter Sunday.
var easterSunday = new Date(year, 3, 22 + dayOfWeekOfPaschalFullMoon - 7);// If the Paschal full moon falls on a Sunday, then Easter Sunday is the following Sunday.
if (easterSunday.getDay() === 0) {
easterSunday.setDate(easterSunday.getDate() + 1);
}// Return the date of Easter Sunday.
return easterSunday;
}
Nope, it's returning the wrong dates. Nice try.
>Make a radio player that can play BBC World radio and several other stations, using HTML and JavaScript
<!DOCTYPE html>
<html>
<head>
<title>Radio Player</title>
</head>
<body>
<h1>Radio Player</h1>
<div id="stations">
<ul>
<li><a href="https://www.bbc.co.uk/sounds/play/bbc_world_service">BBC World Service</a></li>
<li><a href="https://www.npr.org/sections/live-at-noon/">NPR Live at Noon</a></li>
<li><a href="https://www.bbc.co.uk/sounds/play/bbc_radio_4_extra">BBC Radio 4 Extra</a></li>
<li><a href="https://www.bbc.co.uk/sounds/play/bbc_radio_3">BBC Radio 3</a></li>
<li><a href="https://www.bbc.co.uk/sounds/play/bbc_radio_1">BBC Radio 1</a></li>
</ul>
</div>
<div id="player">
<audio controls></audio>
</div>
<script>
function playStation(station) {
var audio = document.querySelector("audio");
audio.src = station;
audio.play();
}document.querySelectorAll("a").forEach(function(link) {
link.addEventListener("click", function() {
playStation(this.href);
});
});
</script>
</body>
</html>
I selected that draft, added event.preventDefault() to the anchors to prevent them from loading a new page, and changed the URLs to ones that could actually work:
<!DOCTYPE html>
<html>
<head>
<title>Radio Player</title>
</head>
<body>
<h1>Radio Player</h1>
<div id="stations">
<ul>
<li><a href="https://realtime.rrr.org.au/p1h">3 Triple R 102.7 FM</a></li>
<li><a href="http://stream.live.vc.bbcmedia.co.uk/bbc_world_service">BBC World Service</a></li>
<li><a href="http://stream-relay-geo.ntslive.net/stream">NTS Radio</a></li>
<li><a href="http://stream0.wfmu.org/freeform-128k">WFMU 91.1</a></li>
<li><a href="https://ice1.somafm.com/seventies-320-mp3">SomaFM Left Coast 70s</a></li>
</ul>
</div>
<div id="player">
<audio controls></audio>
</div>
<script>
function playStation(station) {
var audio = document.querySelector("audio");
audio.src = station;
audio.play();
}document.querySelectorAll("a").forEach(function(link) {
link.addEventListener("click", function() {
event.preventDefault(); // I added this
playStation(this.href);
});
});
</script>
</body>
</html>
>What programming languages does Google Bard support?
Bard can also generate code for Google Sheets.
Bard is still under development, so its support for different programming languages may not be perfect. However, it is a powerful tool that can be used to generate code in a variety of languages.
It gave me three drafts for this answer, the other two were shorter. It would be funny if it's lying.
Write a demoscene (small program) graphics demonstration in HTML + JavaScript
<!DOCTYPE html>
<html>
<head>
<title>Demoscene</title>
</head>
<body>
<canvas id="canvas" width="640" height="480"></canvas>
<script>
function main() {
var ctx = canvas.getContext("2d");
var lines = [];
for (var i = 0; i < 10000; i++) {
var x1 = Math.random() * canvas.width;
var y1 = Math.random() * canvas.height;
var x2 = Math.random() * canvas.width;
var y2 = Math.random() * canvas.height;
var color = "rgb(" + Math.floor(Math.random() * 255) + "," + Math.floor(Math.random() * 255) + "," + Math.floor(Math.random() * 255) + ")";
lines.push({
x1: x1,
y1: y1,
x2: x2,
y2: y2,
color: color
});
}
requestAnimationFrame(draw);
}function draw(t) {
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (var i = 0; i < lines.length; i++) {
ctx.beginPath();
ctx.strokeStyle = lines[i].color;
ctx.moveTo(lines[i].x1, lines[i].y1);
ctx.lineTo(lines[i].x2, lines[i].y2);
ctx.stroke();
}
requestAnimationFrame(draw);
}window.addEventListener("load", main);
</script>
</body>
</html>
This is an interesting one, because it works, but only after you fix a couple of obvious errors. Correctly access the "canvas" by using its id, and move that declaration and the lines array outside of the function so the scope is correct. Then it works.
<!DOCTYPE html>
<html>
<head>
<title>Demoscene</title>
</head>
<body>
<canvas id="canvas" width="640" height="480"></canvas>
<script>
var lines = [];
var ctx = document.getElementById("canvas").getContext("2d");
function main() {for (var i = 0; i < 10000; i++) {
var x1 = Math.random() * canvas.width;
var y1 = Math.random() * canvas.height;
var x2 = Math.random() * canvas.width;
var y2 = Math.random() * canvas.height;
var color = "rgb(" + Math.floor(Math.random() * 255) + "," + Math.floor(Math.random() * 255) + "," + Math.floor(Math.random() * 255) + ")";
lines.push({
x1: x1,
y1: y1,
x2: x2,
y2: y2,
color: color
});
}
requestAnimationFrame(draw);
}function draw(t) {
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (var i = 0; i < lines.length; i++) {
ctx.beginPath();
ctx.strokeStyle = lines[i].color;
ctx.moveTo(lines[i].x1, lines[i].y1);
ctx.lineTo(lines[i].x2, lines[i].y2);
ctx.stroke();
}
requestAnimationFrame(draw);
}window.addEventListener("load", main);
</script>
</body>
</html>
>Write a Java function for calculating Merseinne Primes.
Of course I spelled it wrong on purpose...
Sure, here is a Java function for calculating Mersenne Primes:
public static boolean isMersennePrime(int n) {
if (n <= 1) {
return false;
}
if (n == 2) {
return true;
}
if (n % 2 == 0) {
return false;
}
for (int i = 3; i <= Math.sqrt(n); i += 2) {
if (n % i == 0) {
return false;
}
}
return true;
}public static List<Integer> getMersennePrimes(int limit) {
List<Integer> mersennePrimes = new ArrayList<>();
for (int i = 2; i <= limit; i++) {
if (isMersennePrime(i)) {
mersennePrimes.add(i);
}
}
return mersennePrimes;
}
Some alarm bells are ringing in my head. For reference, the first Mercy primes are: 3, 7, 31, 127, 8191, 131071, 524287, 2147483647...
All in all, interesting stuff, seems a little fucky. I'm sure GPT-5 will do it better. I'd like to try some debugging, but you have to be wary of handing your code to the machine.
>Write a Logitech mouse driver in Rust.
use std::{
ffi::CStr,
io::{Read, Write},
os::raw::{c_char, c_void},
};/// A Logitech mouse driver.
pub struct LogitechMouseDriver {
/// The underlying device handle.
device_handle: *mut c_void,
}impl LogitechMouseDriver {
/// Creates a new Logitech mouse driver.
pub fn new() -> Result<LogitechMouseDriver, Box<dyn std::error::Error>> {
let device_handle = unsafe {
ffi::hid_open(
ffi::HID_USE_DEFAULT_DEVICE,
ffi::HID_CONNECT_DEFAULT,
b"Logitech USB Receiver\0",
)
};
if device_handle.is_null() {
return Err(Box::new(std::io::Error::new(
std::io::ErrorKind::Other,
"Failed to open Logitech mouse device",
)));
}
Ok(LogitechMouseDriver { device_handle })
}/// Closes the driver.
pub fn close(&mut self) {
unsafe {
ffi::hid_close(self.device_handle);
}
}/// Reads the mouse position.
pub fn read_position(&mut self) -> Result<(i32, i32), Box<dyn std::error::Error>> {
let mut x = 0;
let mut y = 0;
unsafe {
ffi::hid_read(
self.device_handle,
&mut x as *mut i32 as *mut c_void,
4,
)?;
ffi::hid_read(
self.device_handle,
&mut y as *mut i32 as *mut c_void,
4,
)?;
}
Ok((x, y))
}/// Writes a report to the mouse.
pub fn write_report(&mut self, report: &[u8]) -> Result<(), Box<dyn std::error::Error>> {
unsafe {
ffi::hid_write(
self.device_handle,
report.as_ptr() as *const c_void,
report.len(),
)?;
}
Ok(())
}
}// The following code is just a simple example of how to use the Logitech mouse driver.
fn main() {
// Create a new driver.
let mut driver = LogitechMouseDriver::new().unwrap();// Read the mouse position.
let (x, y) = driver.read_position().unwrap();
println!("Mouse position: ({}, {})", x, y);// Write a report to the mouse.
let report = [1, 2, 3, 4];
driver.write_report(&report).unwrap();
}
I'm sure that works.
>Write a Java program that can use up to 16 exabytes of memory
import java.util.ArrayList;
import java.util.List;public class MemoryHog {
public static void main(String[] args) {
List<String> list = new ArrayList<>();
while (true) {
list.add("");
}
}
}
This program creates a list of strings and keeps adding elements to it until it runs out of memory. On a 64-bit system with 16 exabytes of memory, this program should run for about 10 minutes before it runs out of memory.
Note that this program is just for demonstration purposes. It is not recommended to run this program on a production system, as it could cause the system to crash.
Indie Cop Game Unrecord Looks So Stunningly Realistic Its Gameplay Trailer Is Freaky
Every now and again, an indie game developer comes out of nowhere with a concept trailer or demo that looks too good to be true, prompting skeptics to investigate and shoot down the promising project with harsh reality. We sure hope that doesn't happen with the just-revealed Unrecord, because it's one of the first games we've ever seen with legitimately convincing realism to its graphics.
Foda C, a platinum-selling French rapper, has partnered up with an amateur Unreal Engine developer Alexandre Spindler (@esankiy on Twitter) to form Studio DRAMA. The new indie game studio is already hard at work on its first title, Unrecord. It's a tactical first-person shooter where you play as a police officer, but the game's perspective is uniquely presented in an immersive fashion with almost no HUD elements, just as if it were bodycam footage.
Unrecord - Official Early Gameplay Trailer
Watch the short trailer on YouTube (embedded above) before you keep reading; it's only a couple of minutes long, and it consists entirely of what DRAMA claims is live mouse-and-keyboard gameplay capture footage. The image quality is incredible, and many people have commented that they believe it to be full-motion video footage or a pre-rendered cinematic.
DRAMA is adamant that the gameplay is authentic, though. The developer released a post-reveal FAQ on the game's Steam store page that responds to some of the questions and comments that gamers have had since the reveal yesterday. In the FAQ, the developer states unequivocally that Unrecord is not a VR game, and it is fully-interactive, not a pre-rendered demo. It uses Unreal Engine 5, and appears to make use of the bleeding-edge graphics technology available in Epic's engine.
The developer also addresses the question of whether the game has a pro- or anti-police message in a succinct and distinctly-French way: "Art cannot fight against interpretation." The developers acknowledge that some people may feel disgusted or disturbed by the game's violence, but state that it will avoid topics like discrimination and racism while providing an unbiased take on "criminal acts and police violence."
Skyrim Fan Remakes Whiterun In Unreal Engine 5 And It’s Amazing
The first two Elder Scrolls games made heavy use of procedural generation resulting in a lot of extremely samey environments, but ever since Bethesda abandoned that technique in favor of detailed hand-crafted locales with TES3: Morrowind, they've had a much smaller scale to the world and settlements than the intended "reality" of the fictional world of Tamriel, all due to the limitations of hardware and storage space.
But what if we could see Skyrim as it would "really" be if it were an actual place? That's the concept behind the latest Unreal Engine 5-based remake, created by professional environment artist Leo Torres in his free time over the course of a month. This demo isn't playable, of course; it's really more of a tech demo than anything.
[...] The artist worked off historical sources for population numbers in medieval Scandinavia to come up with a population figure of between 9,000 and 12,000 people for the hold of Whiterun. He says that he initially thought it could be as high as 30,000 but figured that Skyrim's harsh climate as well as the constant conflicts and bandit attacks would keep population figures lower.
[...] The True Scale of Whiterun: Skyrim in UNREAL ENGINE 5!