7,485 karma · joined Mar 14, 2016 (10y ago) · 2,314 submissions
comment 5y ago · link · parent
Warning: Unknown: Unable to allocate memory for pool. in Unknown on line 0
Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/index.php on line 54
Warning: Cannot modify header information - headers already sent in /usr/local/www/mediawiki/includes/WebStart.php on line 63
[..]
Seems kinda weird this stuff isn't cached?comment 5y ago · link · parent
> "null" is now a keyword that needs to be enforced.
So in the JSON itself, you literally remove the field. In another comment I make is the point that NULL itself could be considered a proper value, you're just pushing the problem down the line. The library making such a decision for you is what may ultimately trip you up.
Instead, you could have something like:
string name = jobj.get("name", NULL)
So that it does return NULL in this case if a name hasn't been given.But consider an example where you're loading some code into a VM's RAM:
int location = toint(jobj.get("address"))
NULL in this case is a perfectly valid place to load a program in a VM, or was it that there was an error? Or is it that no address was given in the JSON configuration?Instead, we can specify our own "NULL" value:
int location = toint(jobj.get("address", "-1"))
So now you're asking to load something before the first position of the VM memory, which indicates an error.comment 5y ago · link · parent
1. What is the most simple representation of the idea? What in the MVP (minimal viable product)? How can you reduce this to it's simplest form?
2. What sub-problems or sub-ideas need to be tackled in order to realize this larger project? Try to figure out which ones must be solved first and which ones can be solved independently.
3. Try to find existing solutions to your abstractions - there's a good chance you're not the first to ask these questions. If there isn't something existing, repeat from step 1.
A ridiculously important part to solving these smaller tasks is to figure out how they can be tested. You don't want to get to the end and figure out some part doesn't work as it needs to.
comment 5y ago · link · parent
Other times, though, either I learn something, or end up making something that is much better for me to use. I would suggest at some time every programmer try build their own limited scope library if they find existing solutions do not meet their requirements.
comment 5y ago · link · parent
The real problems come in when you handle unexpected cases - and there's no real answer as to whether you return true, false or an error. Personally I think the responsibility should be thrown back at the coder. E.g. I will sometimes do:
if(!(jobj.get("key", "true").contains("f")))fun();
Where "true" is considered safe and default. Generally you need to make some effort to switch it off by making sure an "f" exists somewhere, but either case is fine.Imagine for example that the value "true" turns on something potentially dangerous, you might want to guard against accidentally switching it on with:
if(jobj.get("key", "false").equals("true"))fun();
So you for sure have to make sure the string is "true" to switch it on, nothing else.comment 5y ago · link · parent
For example: Did you set `{"address":null}` or did you set `{"address":0x00000000}`? It's important to know the difference, do you need to throw an error or warning? If your NULL value maps to something that is also valid input, how are you supposed to know how to handle the case? If you removed the "address" key on the other hand, you can simply do some exists() functions check.
I think putting types into the JSON spec only serves to create confusion. I think the JSON libraries should offer common helper functions for doing these conversions (e.g. string -> int), but ultimately it's the responsibility of the coder.
comment 5y ago · link · parent
{ "name":"null", "age":"44" }
vs { "age":"44" }
In the first example, your get function would return "null" for "name" and in the second example it would return the value of default, which would be implementation specific.comment 5y ago · link · parent
I would say so yes.
Pick null for example, depending on your language of choice, you might choose to utilize: "null", "NULL", "", "undefined", "\0", etc.
The same with booleans, are we speaking "true", "True", "TRUE", "1", "0xFFFFFFFF", or anything that isn't a false is true, etc.
Really how you want to handle these situations is entirely up to you. Personally I prefer some functions like:
string s = jobj.get(key, default)
The default value being used if a valid string could not be found. Your default could of course be null or equivalent (handle the error), or it could be some known safe value (the show must go on).comment 6y ago · link · parent
Even if that wasn't to happen, the only thing we successfully did was delay the problem. There is no shortcut. We need to encourage change from the bottom, all the way to the top. Ideally it shouldn't have a drastic impact on daily life.
I think given the diverse and mostly intelligent crowd here on HN it should be possible to really look at creating proper solutions that drive real change. It doesn't even need to be revolutionary, you can start today by cutting down on waste, find efficiencies in your work, switching to sustainable resources, etc. The little things add up.
comment 6y ago · link · parent
You can tune all these things, the trade off is of course performance and battery life.
comment 6y ago · link · parent
> SBC.
Or form factor, or weight, or power consumption, or cooling - or a multitude of other reasons.
I do agree though that an old desktop PC can be miles better in terms of performance per dollar, but you'll probably pay for it in electricity bills in the long run.
comment 6y ago · link · parent
comment 6y ago · link · parent
Between this and not paying creators because of some "glitch", showing ads on videos that the creator cannot get paid for (if that be because they don't have "enough" followers or because they got the yellow checkmark), the bullshit preferential treatment of news agencies I could not care less about, becoming the arbiter of truth with "fact checking", randomly deleting channels, zero customer feedback or recourse with a human - the list goes on.
These days, if I want to watch somebody like EEVBlog I can just go to BitChute or Library. Content creators and users are fed up.
comment 6y ago · link · parent
comment 6y ago · link · parent
You might say "the consequence is that they look bad", but they don't, at least not to the people they care about - mainlanders. They own and/or control the news media in mainland China. To produce an anti-CCP news piece in China is suicide for these companies.
External "free" media have their own interests and biases, meaning they may or may not publish articles depending on whether they coincide with their goals. If a bad China news piece makes the current President they support look bad, do you really think it makes headline news?
Honestly, I'm not really sure what to suggest here. Some HN users will post some ideas no doubt, but ultimately the most concerning thing is that none seem to have naturally emerged dominant so far.
comment 6y ago · link · parent
You can get high-resolution copies of the Big Buck Bunny film and play it locally in the same what.
> What are they going to do?
Obviously this would be a malicious use of DMCA (as it has been with other cases of open source software), but they could:
* Tie them up in long and expensive legal battles, using the system itself to punish them
* Have their repositories DMCA'd
* Contact their service providers and have them revoke their services
I am just suggesting caution.
comment 6y ago · link · parent
comment 6y ago · link · parent
Well of course, it's an analogy, it only needs to be roughly correct. The idea is simply to build a mental model that many people can picture.
> It's best understood with the reflecting-mirror-as-clock
> thought experiment.
It's good, but not something that really resonates with people's first-hand experiences.
comment 6y ago · link · parent
> since it breaks the analogy
It was simply a suggestion as to why things might start behaving weirdly at the quantum level. My understanding is that very small things seem to act as if time doesn't really have any real favoured direction.
Of course the analogy is not perfect and does not measure correctly the scale of forces involved, or even how they behave at different extremes. It's just a rough and ready mental model to begin to see things in this framing.
comment 6y ago · link · parent
Of course there are nice little things to explore with this, like moving through running water, currents (localized loops), deep water (dense space), resistance on small vs large things, etc.
If we imagine on the small enough scale where we're looking at single water molecules, resistance (time) doesn't even mean too much. As long as your water is liquid, your little molecules are bouncing around in all directions, only tending towards a given direction with some probability. Otherwise each direction is near and damnit equally easy to travel in.
That's my two cents anyway.
comment 6y ago · link · parent
I had been using the game of 2048, but given the random element and how easy the game is, it's just not a great measure anymore. I have recently started a different diet and I want some measurable way of knowing how well my own brain is affected by it.
The only real problem with chess as a measurement is that if you do the online games for example you get cheaters, etc. Does this detriment your ranking or do people generally find this not to be a problem?
comment 6y ago · link · parent
comment 6y ago · link · parent
> cluster at work and schedule’s her job on whatever queue
> she needs.
Then I would imagine your partner is understanding. I would imagine most situations would be where one partner is computing orientated and the non-computing partner might not understand why there is this massive electric munching air breathing rack in their house.
> That’s just the wrong argument.
Clearly I was responding to the points in the parent comment, not specifically the article.
comment 6y ago · link · parent
> living room with redundant PSUs will cause a lot of
> trouble with every female living in the same household. It
> is too noisy....
A great time to remind your partner that these projects put the bread on the table. Also remind them how much money it is saving.
There is of course always the possibility to move it elsewhere.
> 2. Consumer grade hardware is pretty reliable nowadays.
It really de[ends on what you're running and how much a crash with affect you. For example, a bit flip in RAM could be catastrophic. Or hard drive failure could be a serious problem (despite backups), in which case you might want some commercial grade RAID.
You also get some nice server specific silicon on your dedicated hardware that you might not otherwise, that could seriously speed up your application under high-load conditions.