HNHacker News
TopNewBestAskShowJobs

maldev

299 karma · joined July 9, 2022

submissionscomments
maldev··on Google lays off employees working on its voice assistant
Unironically Mercedes has made their voice assistants in the car leverage ChatGpt.

Something is really wrong when a car company is beating tech companies to the punch with tech innovation.

maldev··on Stack Overflow is laying off another 28%
I'm a boomer, how do I find Discords of people coding?
maldev··on I Tested an HDMI Adapter That Demands Your Location and Spams You with Ads
This could be a overly cautious legal requirement. I know heaters(dyson) won't allow you to control heat remotely in some locations, so instead of yanking out hot water from the app, they decide to ask your location to verify you're home.
maldev··on Why is kernel32.dll running in user mode and not kernel mode
When I read the title, I thought this was going to be a REALLY stupid post.

But this post is amazing and explains a pretty tricky concept, and history, of "subsystems" in a pretty easy way. Effectively, Kernel32(Now KernelBase) has the logic for usermode stuff, and goes into ntdll solely for syscall stubs. It then gently eases the idea of User32 having a similar purpose, as well as GDI. These are the 3 "subsystems" that interact with the Kernel, and it's a pretty core concept, but alot of newbies struggle to understand.

maldev··on Extend a C/C++ Project with Zig (2021)
Does anyone know if zigs reached the point of maturity to having solved most compiler bugs? I used it a couple years ago and it failed HORRIBLY for anything real I was throwing at it.
maldev··on Not Using Zoom
Zoom already has multiple offerings with different privacy policies. For example Zoom.us (Zoom for US Government) vs Regular Zoom. Wouldn't be surprised if this comes later in different tiers of pricing and data privacy.
maldev··on Workarounds for C11 _Generic()
That relies on architecture things that arn't in C. and that's why I say "ignoring the library functions or stuff you can include from safe coding standard headers. ". Of course you can do an intrinsic or whatever, and that's better obviously. But I wanted to show how easy it is to write a platform independent function to do this from raw C.
maldev··on Workarounds for C11 _Generic()
Return value is returned in a, it returns true or false on whether overflow happened. And you're assuming that you're on x86_64. You can't do that in C. C is platform independent. Which is why I said you can use one of the functions or intrinsics, and writing it yourself is bad, but still easy.
maldev··on Workarounds for C11 _Generic()
You make it sound alot more complicated. Ignoring the library functions or stuff you can include from safe coding standard headers. You just do something like.

  BOOL AddOverflowUnsigned(BYTE* a, BYTE* b, INT32 sizea, INT32 sizeb)
  {
     BOOL IsMsb = PlatformIsMSB();
     BOOL IsLsb = PlatformIsLSB();
     
     //log error
     if(!IsMsb && !IsLsb)
       return FALSE;

     //Early out for overflow. Assuming 
     if(sizea == sizeb && PlatformIsMSB())
     {
        BOOL AMsb = (a >> ((sizea * PlatformByteSize()) - 1)) & 1;
        BOOL BMsb = (b >> ((sizeb * PlatformByteSize()) - 1)) & 1;
        if(AMSB && BMsb)
        {
           //We overflow, early out.
           return FALSE;
        }
      else if(sizea == sizeb && PlatformIsLSB())
        //Code here.

     //We add using bitwise operators so we can do it on any size.
     //SUM = A XOR B XOR CARRY, return in A
     //Impliment algo here.

     return TRUE;
  }

  int main()
  {
     UINT64 a = 69;
     UINT64 b = 420;
     if(sizeof(a) !
     return AddOverflowUnsinged(&a, &b, sizeof(a), sizeof(b));
  }

But they have this in the STD now and also all the secure coding libs have this in it's header as a basic function. There's also the easier implementation of just adding a check to see if it will overflow, rather than add in the function.

You also only have a few you can hardcode if you don't do it generic, since all will go back to the primitives of uint8, uint16 ....

maldev··on Intel returns to profitability after two quarters of losses
Does intel still have the really toxic contractor culture with a TON of h1b's? I don't see them rebounding until they get quality employees and not pay severely under market through contractors.
maldev··on TSMC delays U.S. chip plant start to 2025 due to labor shortages
Hardware (And even embedded programming) pays absolute ass since it's all outsourced to Asia. Zero reason not to do literally any other job which will use the same skills, and pay double. Bringing it to America, means upping the salaries to match what Americans expect, and alot of jobs just lowball still.
maldev··on How the great firewall of China detects and blocks fully encrypted traffic [pdf]
This paper is nice, but it goes over some finer technical things. So, not about the great wall, but there's projects out there, like this one https://github.com/salesforce/ja3 , which talk about how you can fingerprint fully encrypted traffic(TLS/HTPS). There's a great section in the Readme "How it works" that goes over it. Would be surprising if the great wall doesn't do this, when some open source firewall will.
maldev··on To save money on insurance, drivers agree to intrusive monitoring technology
I honestly have no idea the exacts. But I know some cars have it even since 2003.
maldev··on To save money on insurance, drivers agree to intrusive monitoring technology
All new cars have a blackbox that records what happened before a crash. So it would just stop the constant monitoring point.
maldev··on Anger in Japan as report reveals children were forcibly sterilised
Nature's cruel and in modern society there's a shrinking place for people without advanced skills. And odds are that a child with a cognitive disability like that wouldn't be able to have advanced skills. So the child is nearly always going to be put into the "Have not" category. A human isn't a pet, and having a child who is always going to struggle to be independent isn't good for society, or anyone involved. With modern medicine we can stop alot of cruelty, like childhood illnesses and such, and we can also screen for these things. Not only this, but the resources taken could've been given to others with far more potential. You could deny child #2 from being a doctor due to the resources that must be given to child #1, and robbing one child for another isn't right, especially when it's wasted.
maldev··on Filenames and pathnames in shell: How to do it correctly (2020)
Unironically Powershell. I agree with you, I don't get how people can justify having a string of bytes and then parsing that to communicate between programs. Powershell functions off of data types. You can so ls (an alias for Get-ChildItem). You can also do (ls).CreationTime, just like in most languages since it returns an object. Or (ls)[0].Name, since just like you would expect, it returns an array of objects. Or do ls | select-object Name, CreationTime. And grab those variables out of the object. And when you pass things, it passes an object. Much safer, much easier, whether Powershell or something else, this idea is the future of terminal.
maldev··on Four alarming charts that show just how extreme the climate is
Good job tackling any of my points. You win 5 morale highground updoots. You're on a tech site, which is aimed to support intellectual discussion, but I don't see you doing any of that. Must be difficult for you.
maldev··on Four alarming charts that show just how extreme the climate is
Wow, you can tell this site has gained alot of traction since Reddit has been having issues. Sad to see zero intellectual discussion and pursuit of curiosity here.

There's three big issues here.

A. It's arguable the actual impact humans have on climate change.

B. Even if A is true, then we stil have geopolitics since the technology isn't ready or mature enough for mass adoption, and when major polluters are massive ships and factories, it doesn't matter what you personally do. Not only that, but if on a nation level you do impliment these policies, you're giving up your own freedoms to another country like China who won't and WILL overtake you by having immense economic efficiencies since they use oil and just pollute. Then you end up in the same situation you were anyways, but now under a communist dictatorship where you can't complain, with no countries like Nato or anyone else to save you. Very dystopian.

C. Even if we do hit the end times with climate change, all the science points towards Geoseeding as being a solution way before that.

Sad to see it's just circle jerking of fake intellectuals going "YA BRO ANYONE WHO DOESN'T AGREE IS DUMB, UNEDUCATED" or "Being unable to do comprehensive reading and understanding basic physical processes is not a good starting points in 2023." - atoav , or "I've basically given up on anything drastic happening until the dipshit conservatives in the US stop their moronic crusade on this topic. I give my money monthly to a carbon sequestration company and mostly use my bike and mass transit, but offsets for flights." - Sporkland, truly the greatest sanitation engineers of our time.

maldev··on Ex-ByteDance exec: Communist Party had ‘God credential’
Can you explain how Snowden or Assange are mistreated against our standards of human rights? Snowden hasn't been in the US and is in Russia for years, and when he was in the US, he was never treated wrongly. And Assange hid out in an embassy to dodge charges. If you break the law, get people killed, push propaganda from Russia, you're going to have to face a Jury of your peers. Unlike China where you just get disappeared, we have a court system where you can get a trial by jury.
maldev··on Never trust a programmer who says they know C++
You're confusing the STL with C++. Kernel C++, Gamedev C++, Appdev C++ are all mostly the same. There's some small things like, you can't have a global constructor in the kernel. But all the same language features are the same.

What does change is the STL. Asking someone what a constructor is, or templates, or auto, or ConstExpr, ConstInit, ConstEval and the differences. It's the exact same code on any format or machine. Asking someone what a "Unique_ptr" or "Ranges" or whatever is a bit in the bullshit realm of an interview and should be shamed. But C++ is vastly seperated from the STL. And odds are in an interview, you can ask someone about their specific domain of c++ they use in most cases, since usually a win32 shop is going to interview win32 people.

maldev··on A collection of lock-free data structures written in standard C++11
You can literally just do an atomic swap on some memory location. Three lines of assembly, like.

    mov rax, 1  ; load the value to exchange into rax
   acquire_lock:
    ; attempt to acquire the lock
    xchg byte [ADDR_LOCK], al  ; atomically swap the lock value with rax
    test al, al  ; test if the original lock value was 0 (unlocked)
    jnz acquire_lock  ; if it was not, loop until we can acquire the lock
The downside is you want a backoff to sleep the thread so it doesn't go into a loop. But the actual lock code is simple. You can easily have this be your function "AcquireLock()" and then do

while(!AcquireLock()) { //pause thread execution. }

And I think this is where they get the syscall being needed, since this will normally require a syscall to pause the thread from the scheduler.

maldev··on How to make smaller C and C++ binaries
I don't think many actually use the STL besides app dev's. Most systems dev's are targeting WIN32, RTL, UEFI, POSIX, BOOST, UNREAL, or something else. Not only this, but STL also breaks alot of things by what it puts in, Kernel, Unreal, and results in alot of usecases to not use the STL.

The only time in my entire career i've ever used the STL was in college. Since most C++ jobs are not Appdevs. All those have moved to C#, Go, or some other higher level language. Or again, just rely on the built in suite like RTL, Posix, Unreal

maldev··on Ask HN: What’s bad about C++? I kinda like it
Nothing wrong with it. The only downside is having to either use RAII(C++) or SESE. RAII removes pretty much all pointers and wraps allocations in a class. SESE is using goto's and only returning in one location and all the variables at the top so you don't bypass control flow. Otherwise you have a coding style that can cause issues with memory leaks.

Languages like Go are designed so that someone who's not familiar or wants to use these patterns can write safe and good code. And ALOT of people are complete idiots at c and c++ in a good fashion. You can see the most obvious and horrible programmers making critical things like routers who just have the most blatant bugs or bad practices. And what you don't know, you don't know. So these people exist in bliss pushing shitty horrible, bug ridden code. ANd using these coding styles which prevent that are extra tedious and annoying.

For libraries, try to use VCPKG to find and build new ones to statically link. You also need to learn about compiler definitions, like declspec. And need to worry about alignment on some things as well.

maldev··on Gpt4free repo given takedown notice by OpenAI
That's their view on it, and i'm glad we agree that it's not the right one and is unconstitutional. If you actually look at gun related homicide statistics, you'll find that certain demographics are that of European levels, while others are that of third world. There's something called availability bias that people can have, and I think you'll find at a NRA convention, or in most of the country, with regular demographics, you are just as likely to be murdered with a weapon as you are in Europe.
maldev··on Gpt4free repo given takedown notice by OpenAI
You mean the law that the NRA tries to protect and defend? The only irony is that you admit there's a law, a supreme law of the land, but seem to take a biased approach saying there shouldn't be guns. Sadly, they arn't in a position to argue with the secret service, and thus it's only when someone under secret service protection is speaking.

If you donate more to the NRA, they'll have more resources to defend the second amendment.

maldev··on Gpt4free repo given takedown notice by OpenAI
Because the Secret Service won't allow it? Just because you think something is right, doesn't mean you can do it when the law doesn't allow it.
maldev··on What is NMAP and how to use it? (2020)
Super noob trap, which this article doesn't address. If you want to scan every port, do -p-. Which alot of the times you do want to scan every port. By default it only scans common ports. You can also do -p50- to scan 50+ or -p-50 to scan 0-50. You can find alot on non common ports, and if you're running a port scan, you should use it. Sad the article doesn't mention this.
maldev··on iAPX432: Gordon Moore, Risk and Intel’s Super-CISC Failure
Stream of bits really simplifies it. If you read the intel documentation there's a nice diagram that explains the logic. Effectively you can view it as a object oriented, or grouping mechanism. If you look at instructions and prefixes. It effectively goes. PREFIX-EXTENSION(Ala AVX-256)-INSTRUCTION-ARG1-...-ARGN-PostFix.
maldev··on Errors and Zig
Have you ever written low level code? There's constant hardcoded addresses you have to deal with which are in the spec. You can't really do BIOS, UEFI, Bootloder, Systems programming, ... without it. You wouldn't do a "magic number" and would make it a macro. But *SCREENBUFFER = 0;
maldev··on Ask HN: Where can I find a primer on how computers boot?
Intel has opensource training on EFI/UEFI and the whole boot process. https://github.com/tianocore/tianocore.github.io/wiki/Traini... Alot of the other stuff is either outdated or not relevant for current stuff. Tianocore/EDK is pretty much the standard for dev on that level and this directly teaches that.
← PreviousPage 3 of 7Next →