HNHacker News
TopNewBestAskShowJobs

jimmyspice

53 karma · joined May 27, 2016

submissionscomments
jimmyspice··on Influxdb made the switch from Go to Rust
serious question on behalf of the uniformed, why? I feel that society encourages people to double down and be consistent even if they are armed with better information. we could be better if we didn't have to stick to the one true path, no?
jimmyspice··on Running one’s own root Certificate Authority in 2023
what's wrong with using a dynamically allocated port?
jimmyspice··on The Perfect Laptop
those look excellent, some even have a bluray drive still. would love this in europe
jimmyspice··on Dropbox admits 130 of its private GitHub repos were copied after phishing attack
No need

For a Linux user, you can already build such a system yourself quite trivially by getting an FTP account, mounting it locally with curlftpfs, and then using SVN or CVS on the mounted filesystem. From Windows or Mac, this FTP account could be accessed through built-in software.

jimmyspice··on Apple is discontinuing the iPod
I believe it was this: https://hicks.design/journal/moo-card-player
jimmyspice··on Ask HN: Teach me something new
To be clear, this is Ctrl+Shift+T . I know you had T in capitals, but keyboard keys are normally written that way
jimmyspice··on It's impossible to sign up for GCP in 2022 (Twitter thread)
Money is money after all, so I definitely do feel your frustration.
jimmyspice··on It's impossible to sign up for GCP in 2022 (Twitter thread)
*with a 'wise' card/account. Not saying it's not an issue. Just not heard of that provider.
jimmyspice··on Software should convey a sense of calm
This assumes that once the design is done it should not, or does not have to change. Like anyone, designers can be wrong, customers can end up using certain features in ways not intended, and using software in ways that are not ergonomic.

So in that sense, design can and should be fluid. Where I work, designers often meet with customers (some external, some not) and continually get feedback, which the developers act on. IMO stopping design as soon as development starts increases the chance of having a poor design, forever.

Sometimes it's not known that a design has flaws until things start coming together during a project and some workflows become more prominent (and painful) than others.

jimmyspice··on Show HN: Medusa – Open-source alternative to Shopify
If it's well written, customers won't be able to tell
jimmyspice··on The work-from-home future is destroying bosses' brains
I think they meant working at a non-colleagues house. At least, that's what I plan to do when it's possible, every now and then. I think the change of pace would be nice, back at university I'd do the same with people not on my course. Being genuinely fond of each other makes time go faster.

Of course, I'd also want to work outside of the office, with my colleagues too. A change of environment every now and then can't hurt.

jimmyspice··on Deno 1.6 supports compiling TypeScript to a single executable
why not use artrifactory or similar proxy so you always have a local mirror?
jimmyspice··on You might not need to store plaintext email addresses
You could just do that anyway. I've seen spam email trying to extort people threatening to release indecent images of them (that they don't have. supposedly, they've been captured from the victims selfie cam).

In this case, you don't have to be accurate, you're just trying to call someones bluff, in the small case they've actually done said thing (and in addition believe you can prove it AND that payment will silence them)

jimmyspice··on Ask HN: Why don't podcasts have comments?
Soundcloud is quite good at associating comments with timestamps. I don't think it has threads, but it's a relatively popular platform.

As others are saying, it's not really something that is standardised (or strictly necessary), which is why you don't see it much.

jimmyspice··on Design Tip: Never Use Black (2012)
hey, try ClickMonitorDDC: https://clickmonitorddc.bplaced.net/

It allows you to change brightness, contrast (and volume, never tried it), from the taskbar.

It works for a Dell and iiyama monitor I own, but not my Agon one, so YMMV

jimmyspice··on Amazon Warehouse scam: 16TB HDD swapped for 8TB, returned for full refund
I would like to have that problem, which pan is it?
jimmyspice··on The Cost of JavaScript Frameworks
Thanks, that's a pretty cool demo with almost no code. Seems like a lightweight observable as you say.
jimmyspice··on The Cost of JavaScript Frameworks
where can I read more about SDx? never heard of that term before
jimmyspice··on Ask HN: How do I learn JavaScript?
And now for promises.

Why promises? Before promises, js code often used an error first callback strategy to communicate when an asynchronous process has finished. It's important to write blocking code as little as possible, since your computer can and should spend time doing 'compute' stuff, whilst waiting for a resource, such as a network request or disk etc.. which can take an unbounded amount of time.

Back to how callbacks look: ``` function myExpensiveSuccessfulFn(cbFn) { setTimeout(() => { cbFn(null, 'success'); // pretend we did something useful }, 60 * 1000) // time waste for a minute }

function myExpensiveFailingFn(cbFn) { setTimeout(() => { cbFn('oh no'); // pretend we tried to do something useful }, 60 * 1000) // time waste for a minute }

function myCallback(err, data) { console.log(`err: ${err}`); console.log(`data: ${data}`); }

myExpensiveSuccessfulFn(myCallback); // after 1 minute: err: null, data: 'success'

myExpensiveFailingFn(myCallback); // after 1 minute: err: 'oh no', data: undefined ```

Awesome. We can wait for some result and be notified whenever it finishes. Have a play in your inspector as before. Immediately after calling our expensive functions, we can execute code straightaway (try logging anything immediately after calling an expensive function)

Now callbacks start to get unwieldy when those same callbacks also want to do things that require something else asynchronously. There are better examples online, but I'll write something with anonymous functions to give you an idea:

``` function addSomethingSoon(a, b, cbFn) { // in 5 seconds, return the sum of two numbers setTimeout(() => { cbFn(a + b)// no err first style in this example }, 5 * 1000); }

// now let's get the sum of four numbers:

addSomethingSoon(1, 2, (result1) => { addSomethingSoon(result1, 3, (result2) => { addSomethingSoon(result2, 4, (finalResult) => { console.log(`1+2+3+4=${finalResult}`); }); }); }); ```

Only 3 operations, and things are getting quite ugly. Contrived, but let's see how we can do better.

Enter the promise. A promise is a 'promise' of a future result. It's like if you went to a fast food restaurant, made an order and got a ticket in return. Once you are given a ticket, they'll call out your number and give you your food, since you are holding the ticket (the promise of food in the future).

Let's have a play:

``` function getFoodIn5(menuItem) { // don't worry about the syntax here. You'll likely not be creating promises with 'new' often. You'll likely get given them from a library, say a http call or similar. return new Promise((onComplete) => { setTimeout(() => { onComplete(`fresh ${menuItem}`); }, 5 * 1000) }); }

const promiseOfFood = getFoodIn5('burger'); console.log(promiseOfFood) // depends on your browser, nothing very useful, and definitely NOT our burger....

promiseOfFood.then((food) => { console.log(food); // fresh burger, yes, it tastes so good! }); ```

So we got our burger, pretty fast too. Unfortunately they just hired a few trainees:

``` function burntFoodIn5(menuItem) { // don't worry about the syntax here. You'll likely not be creating promises with 'new' often. You'll likely get given them from a library, say a http call or similar. return new Promise((onComplete, onError) => { setTimeout(() => { onError(`burnt ${menuItem}`); }, 5 * 1000) }); }

const promiseOfFood = burntFoodIn5('burger'); console.log(promiseOfFood);

promiseOfFood.then((food) => { console.log(food); // ... :( nothing }).catch((mistake) => { console.log(mistake) // burnt burger, you don't want to eat this. }); ```

that is promises in a nutshell. doesn't seem very useful now, but they are composable:

``` function add2(a, b) { // return a promise NOW, that will give us the sum of two numbers in 5 return new Promise((onComplete) => { setTimeout(() => { add2(a + b) }, 5 * 1000); }); }

add2(1, 2).then((result1) => { return add2(result1, 3); }).then((result2) => { return add2(result2, 4); }).then((finalResult) => { console.log(`1+2+3+4=${finalResult}`); }); ```

Now we don't have the masses of indentation of callback hell. Note that will take the same amount of time to run as the callback example. Promises don't make anything faster, they just help us to write synchronous looking code. The next step to bring us back to imperative looking code is async/await. But that's for another time.

Finally, the best way to learn is to do. Get a hold of VSCode, and get the Quokka extension. You can then `Ctrl+Shift+P` or `Cmd+Shift+P` and `Quokka: new javascript file`, and get a real time repl where you can mess around and log to your hearts content to get a feel of things.

jimmyspice··on Ask HN: How do I learn JavaScript?
Prototypical inheritance is not something I really understand in too much detail (and maybe I was late to the game, since I've never really felt I missed anything). Now js has 'classes' which I think are sugar over proto, can't remember.

You can think of a prototype as 'cloning' an object (but not quite), distinct from classes in OOP, which are typically created afresh, i.e. no entanglement occurs between instance 1 and 2 of the same class (unless of course explicitly specified in a constructor). If I have `var a = {one: 1, two: 2}`, I can use that as a 'live template' to stamp out other 'instances' that prototypically inherit from that ancestor. Any attribute lookups that are not specified directly on an object created with a prototype recursively look up the prototype ancestry chain until it is found. So if c -> b -> a (where a -> b means a prototypically inherits from b), looking up a property on c will try to look for the property on c first, failing that b, then a. If nothing is found, `undefined` is returned.

Let's open our inspector and have a play: ``` var a = {one: 1, two: 2}; var b = Object.create(a); // create b, based on prototype a var c = Object.create(b);

console.log(c.one) // 1, how, when this wasn't even defined! We looked up the p. chain until we found it

b.three = 3;

console.log(a.three) // undefined, a's only prototype is Object console.log(c.three) // 3, wow, c knew about something that happened to b! This is different from OOP. 'instances' share data defined at runtime.

```

jimmyspice··on Announcing Bluetooth LE Audio
Interesting idea! This introduces the same problems that an online game suffers though. 90% of the time you can predict successfully what is playing, but as soon as one scrubs, or pauses the video, the signal already sent to the headphones would be out of sync. Not sure how that is fixed without delaying the video also.

If it could recover fast enough to play the right audio in time, then it would seem that bluetooth is already low latency enough to play in real time anyway? Or am I missing something.

jimmyspice··on Apple AirPods: iPhone accessory or the next big thing?
I think they're getting at a model either like Kickstarter, or directly funding a department ( say Google's AR department, if you liked their Glass idea ). The problem with a normal investment and no seats on the board is that you don't really have a say on direction provided that a company does more than one thing. there's also the fact that money is fungible and would probably just subsidise loss making departments as is common today
jimmyspice··on FBI asked Sony for data on user who used PlayStation network to sell cocaine
That is different because your face is now evidence something happened.
jimmyspice··on Async-await on stable Rust
I don't know any rust,. but that was a really good read. what is your background, and what materials did you use getting into Rust?

Your explanations were surprisingly simple

jimmyspice··on Gmail marking email from me as spam
Can you be explicit how they would go about preventing that?
jimmyspice··on Rxdb: A reactive database where you can subscribe to the result of a query
Naively it sounds like the halting problem. You would have to verify that no consumer can make a change to the data set you are listening to. You would want to manage yourself when not to respond to an event.
jimmyspice··on Using TypeScript with React
in which case your API layer should validate the data at runtime so that it only actually returns type T as it claims. then you are back to soundness
jimmyspice··on Using TypeScript with React
@types versioning is strange because you never know whether or not the version of the types matches the dependency exactly. for example the case where the typed version has a minor upgrade (say due to increased type coverage), the types become out of sync.

the fix is to do away with @types and export types from the dependency itself so they are always in sync

jimmyspice··on Compile-Time DI vs. Run-Time DI
Pretty reasonable to me. maybe that exposes how relatively junior I am (I'm not OP) but the codebase I use is sufficiently large that if I tried to handwrite the dep tree before I started working, I wouldn't have gotten any work done at all.
jimmyspice··on Chromecast Support for Firefox
I think any TV with HDMI-CEC should work. it's also how it turns on your TV and switches to the correct input before hand.

as an aside I think Google home users leverage this to turn on their TV, which I think is pretty cool

Page 1 of 2Next →