HNHacker News
TopNewBestAskShowJobs

hornetblack

255 karma · joined June 2, 2012

submissionscomments
hornetblack··on Why is Facebook asking for users preferred temperature scale?
It's always annoyed me that Events would tell me the temperature in °F.
hornetblack··on HubCap: pwning the Chromecast part 1
This years Defcon CTF has some RF hacking. An FPGA running an MSP430 was one of the flags. That's some cool low level stuff.
hornetblack··on Why Racket? Why Lisp?
Rust also allows polymorphic return types.

    trait Bounded {
        fn min_bound() -> Self;
        fn max_bound() -> Self;
    }
Which can be used like so. Using type inference.

    fn add_min_to_set<T:Bounded, S:MutableSet<T>>(set: &mut S) {
        set.insert(Bounded::min_bound())
    }
 
Or you can be more explicit

    let mut i: u8 = Bounded::min_bound();
    while i < Bounded::max_bound() { println!("{}", i); i += 1; }
Edit: spacing, s/++/+= 1/
hornetblack··on Why Racket? Why Lisp?
minBound and maxBound are typeclass functions. Typeclass's are a similar to java interfaces.

So the Bounded typeclass is defined as

    class Bounded a where
        minBound :: a
        maxBound :: a
If you have a function and you want the argument to be Bounded you write

    allLessThan :: (Enum a, Bounded a)=> a -> [a]
    allLessThan x = [minBound..x]
Here `a` is a generic type. That implements the Enum and Bounded typeclass. You could just write `allLessThan x = [minBound..x]` and Haskell with infer the type classes by itself.

To implement the typeclass you use `instance`, like so:

    data MyType = A | B | C | D
    instance Bounded MyType where
        minBound = A
        maxBound = D
hornetblack··on Fully Functional 1KB Hard Drive in Vanilla Minecraft
I'm not sure that delay lines will retain data when the chucks that hold them are unloaded by the server.
hornetblack··on RISC creator is pushing open source chips
Mill architecture support it, by having multiple add instructions. add is wraparound add. addx returns a NaR^[1]. addw returns a double width value. As Mill stores integer size of registers these instructions apply to all integer sizes and vectors, without having separate instructions for each width (and vectors).

[1] NaR will propagate an error, but trigger an exception if it's stored or branched on.

hornetblack··on Your Wireless Router Is Broken – Help Us Fix It At DEF CON
I did that to a ISP provided router. The company wouldn't enable port forwarding for games. So I did it myself.

Why do those routers have open telnet interfaces.

hornetblack··on C and Go without CGO
In go you use '.' for namespace accesses. Eg: os.NewFile. But in C '.' means access struct member. So the · is used instead so to do

    f = os.NewFile(3, "/dev/zero") # Go
you would use

    f = os·NewFile(3, "/dev/zero"); # C
hornetblack··on Australia bans reporting of multi-nation corruption case
Victoria has done it before. The a series of the TV show Underbelly was banned temporally. The show depicted a true story of a crime that was still going through the court system. Australian Juries are not supposed to know anything about a case before it goes to court. If the story was on a very popular TV show before proceedings it becomes harder to ensure this.
hornetblack··on The seL4 microkernel
Students at UNSW doing Advanced Operating systems use a SabreLite board running seL4. They're pretty similar so you should be able to get it working.
hornetblack··on The sad state of Linux Wi-Fi
I was just printing on someone else's computer running barebones Lubuntu. I found that going to localhost:631 (cups web admin) has all the settings needed to add the printer, which came up as "Detected network printers". I think the OSX one has a GUI frontend for that. I just tested the GNOME gui on my laptop, it doesn't seem to detect the printer but localhost:631 does.
hornetblack··on What happens when you search 'ugly hack' in GitHub
I literally laughed out loud at C++ in wtf column.
hornetblack··on American Summer: Before Air-Conditioning (1998)
I live in Australia. My dad won't get air-conditioner because he knows it cost at least $1,200 to add another A/C to the grid.
hornetblack··on AMD HSA kernel driver
Looks like K12 SOCs will have x86 and ARM cores. I'm guessing HSA will be involved.
hornetblack··on Undefined behavior can result in time travel
In some programs I like to have something like this to catch potential bugs:

    int abs_s(int x) {
        assert(x != INT_MIN);
        return (x >= 0) ? x : -x;
    }
hornetblack··on The MIN Challenge
The issue is for some programmers propensity to use ++ and -- whenever they can. So you end up with

    max(a++, b--)
Which expands to

    ((a++)>(b--)?(a++):(b--))
creating unexpected results. The solution is, don't use return values of `++` and `--` in calls, unless you know it's a function, and always will be. Upper-case macros may help, but then you need to make sure all macros are upper case.
hornetblack··on We Have No Idea If Online Ads Work
Australia is very different from that. They banned advertising to consumers in most ways. They still can put ads in magazines for retailers (because they aren't the end user).

Now we also have "plain packaging laws" which means packets cannot have the Tobacco companies design on it. They must be olive green and have government anti-smoking ads, and the product name in plaintext.

hornetblack··on Adobe's New Pen and Ruler
Napoleon wasn't short by most measures. The myth comes from two issues: Napoleon used tall soldiers in his personal guard, and British people said it to make fun of him.
hornetblack··on Brian's Rules for Writing Cross Platform 'C' Code (2008)
Reminded me of Subsurface maintainer's talk on Qt: https://www.youtube.com/watch?v=ON0A1dsQOV0

He found it was very good for cross platform work.

hornetblack··on Cross-platform Rust Rewrite of the GNU Coreutils
MS specifically implemented __restrict:

> __restrict is similar to restrict from the C99 spec, but __restrict can be used in C++ or C programs.

http://msdn.microsoft.com/en-us/library/5ft82fed.aspx

hornetblack··on Piston, a prototype video game engine written in Rust
As dbaupp said it's only an optimisation. So you should be able to use mainline LLVM now. Therefore using PS4 with Rust wouldn't be too complicated.
hornetblack··on What are the advantages of the Hurd over Linux/BSD? (2013)
Here I was thinking: Wouldn't it be nice if seL4 were Open source.
hornetblack··on Piston, a prototype video game engine written in Rust
Rust and the PS4 toolchain are both LLVM. So I can see some possibility there. Rust currently runs on it's own patchset now, but the intention is to be fully working with mainline LLVM.
hornetblack··on Which English?
Leauge, I just call Union: Union.
hornetblack··on Introducing Mapbox GL
Hard coded compiler version?

    Could not find compiler set in environment variable CC:

    gcc-4.8.
I'm running gcc-4.9. I got it working by doing:

    ln -s /usr/bin/gcc ~/bin/gcc-4.8
    ln -s /usr/bin/g++ ~/bin/g++-4.8
I'm not saying this is good practice, but it works.

Also need to make sure python means python2.

hornetblack··on Go error handling
I find that a mustBeNil function is useful:

    func mustBeNil(err error) {
        if err != nil {
            panic(err)
            // or log.Fatal(err)
        }
    }
or

    func mustBeNil(err error, msg string) {
        if err != nil {
            log.Fatalf("%s: %s", err, msg)
        }
    }
;Edit: brackets
hornetblack··on Which English?
I got

1. New Zealand 2. South African 3. Australian.

With native languages as

1. English 2. Chinese 3. Greek

I'm English speaking Australian. So it got very close.

hornetblack··on Which English?
I call both Soccer and AFL Football, and call Rugby, Footy. I only ever talk about AFL with my mother, Soccer with friends and Rugby with no one.

It can be really confusing when all three are somewhat popular in one country.

hornetblack··on Introducing Swift
I've only seen one thing actually use it in Go:

    	func Polar(x complex128) (r, θ float64) {
    		return Abs(x), Phase(x)
    	}
    
It seems to be good for documentation reasons.
hornetblack··on Introducing Swift
> break-less switch, optional fall-thru

Like Go and Dart?

← PreviousPage 4 of 7Next →