It could be worse. You could be in python that has no const whatsoever :P
I also agree pass by reference is useful. JavaScript only has pass by value, similar to python.
4,044 karma · joined February 6, 2020
It could be worse. You could be in python that has no const whatsoever :P
I also agree pass by reference is useful. JavaScript only has pass by value, similar to python.
It's going to get even harder as spammers use ChatGPT like tech to write individual spam messages for each person
No one at google wants spam.
That sounds like a fundamental mis-understanding. Variables do not hold objects, they hold references to objects.
const foo = {};
let bar = foo;
foo and bar hold references to the same object. They do not hold the object themselves. foo's reference can not be changed. It's const. bar's reference can. But the object is independent of both variables.If you want the object itself to be unmodifiable there's Object.freeze.
const foo ...
makes foo const. If you wanted a shortcut for making the object constant (vs Object.freeze) it would be something like let foo = new const SomeObject()
This doesn't exist but it makes more sense than believing that `const foo` some how makes the object constant. It only makes foo constant (the reference). let field = ve.instanceContext.replace(/(#\/)|(#)/ig, "").replace(/\//g, ".")
Which you apparently claim should be const fieldWithHashMarksUnesacped = ve.instanceContext.replace(/(#\/)|(#)/ig, "");
const field = fieldWithHashMarksUnesacped.replace(/\//g, ".")
https://github.com/mirusresearch/firehoser/blob/46e4b0cab9a2...and this
return moment(input).utc().format('YYYY-MM-DD HH:mm:ss')
Which apparently you believe should be const inputAsMoment = moment(input);
const inputConvertedToUTC = inputAsMoment.utc()
return inputConvertedToUTC.format('YYYY-MM-DD HH:mm:ss')(1) named intermediate values are sometimes more readable ... though I have examples where it's very hard to come up with names and not sure it helped
(2) debugging is easier.
For (2) though, this IMO is a problem with the debugger. The debugger should allow stepping by statement/expression instead of only by line (or whatever it's currently doing). If the debugger stopped at each pipe and showed in values (2) would mostly be solved. I used a debugger that worked by statements instead of lines once 34 years ago. Sadly I haven't seen once since. It should be optional though as it's a tradeoff. Stepping through some code can get really tedious if there are lots of steps.
As sample example, a binary format could be as simple as
struct Header {
uint32 width;
uint32 height;
}
struct Image {
Header header;
uint8* data;
}
Image* readIMG(const char* filename) {
int fd = open(filename, ...)
Image* image = new Image();
read(fd, &image->header, sizeof(image->header));
size_t size = image->header.width * image->header.height * 4;
image->data = malloc(size);
read(fd, image->data, size);
close(fd);
return image;
}
Yea I know, that's not a complete example, endian issues, error checking.Reading a PPM file is only simple if you already have something to read buffered strings and parse numbers etc... And it's slow and large, especially for todays files.
As for tiling, Mac does do somethings that Windows (IIRC) doesn't. One is, if you move a window or the edge of a window slowly it will snap at the border of another window. So you move fast to get it close then slow down and it will align nicely.
Also, tiling: https://support.apple.com/en-us/HT204948
But I agree that Windows tiling is more discoverable.
Simple formats are like certain forms of .TGA and .BMP. A simple header and then the pixel data. No CRCs, no compression. Done. You can write an entire reader in 20-30 lines of code and a writer in other 20-30 lines of code as well. Both of those formats have options that can probably make them more work but if you're storing 24bit "True color" or 32 bit "true color + alpha" then they are way easier formats.
Of course they're not common formats so you're stuck with complex formats like PNG
Let's put it another way. If someone says the France sucks, Germany rules. And someone replies "The France doesn't suck, here's a few reasons why". Why do you feel the need to jump in and defend the POV that "France sucks"?
I also listed spending time with people as a plus to the city. It's interesting that you left that out. I'd guess if the author had a job they loved with people they loved their attitude about everything else would change. The fact they're in a job they hate arguably taints everything else about their life. Commuting of course sucks if it's to a place you don't want to go in the first place. To me, commuting by public transport rocks because I got, on average, 50+ minutes of walking (25 each way) for free (added to the 20 minutes of standing on the train)
In so many words he said cities suck, nature rocks.
Vs me, who said both nature and cities rock, and that the attitude that one sucks is a poor attitude
I think their opinion of that the city sucks is wrong, full stop, and that a change in attitude would see all the great things a city provides that nature does not so that then you can appreciate both.
To me, enjoying the good parts of both the city and nature is a better POV than shitting one one of them.
Me, best time in my life, commuting in Tokyo to my jobs working on a project I loved with people I loved. All the ads on the trains were eye candy to me. I didn't buy anything that I remember but I did find out about museums, concerts, and other events around town as well as various obscure services which I never used but was amused to read about.
Drinking with my buddies, including work buddies about once a week was great. Clubbing, going to restaurants, and going to events of the kind that generally only happen in giant cities was lovely.
I like the occasional trip to nature but as for me I'll pick the city and the public transportation. I love it!
My belief is Japan doesn't have as much of an obesity problem.
Sure, I'd love a drug that lets me eat more calories and not get fat but I'd also love it if we some how managed to stop eating so many cookies, donuts, potato-chips, sugary sodas, giant portion meals, etc.... I'd also love it if we designed more areas to be walkable and bikeable.
I lived ~15 years in Japan. I never missed owning car because the country is designed not to need a car. I also spent a year in Europe and Singapore and again, never missed owning car for the same reasons.
Let me also add that in Japan, at least in big cities like Tokyo, Osaka, Kyoto, you are almost always 1-2 minutes away from junk food. You can walk to a convenience store and find whole aisles of pastries, chips, ice cream, candies, etc and yet somehow the Japanese manage not to pig out.
Similarly there are bakeries all over full of donuts, etc...
Somethings that help are the portions are often smaller. Certainly for potato chips most bags in Japan are 1/3th the size of the average bag in the USA. Similarly cookies are small and come in small portions vs the USA where pretty much any supermarket sells cookies in packages of 20 to 40 cookies and each cookie is giant 300-500 calories each.
I guess this is one of those, we're not going to get people to stop eating too much so we have to find another solution? I can just imagine once I get this drug I'll start eating more because I can and companies will ramp up the portion sizes even more.... TACO TIME!!!!!
for me what I noticed lately is that in California it's impossible to have a quiet modern apartment because nearly 100% of modern apartment buildings are only allowed to be built on busy noisy high traffic streets. If you want a quiet street you're forced to buy/rent a house
I've hidden the score here on HN for myself and on StackOverflow. Two places where score has a negative effect on myself.
Very tangentially related, Apple's Metal API has a function that copies a texture. You pass it a width, height, etc... But, if the texture is compressed, then 255 of 256 possible value combos you pass it will be invalid since compressed textures can only be copied in block multiples. I think it would have been a better designed function if it only took width and height in blocks instead of pixels (with uncompressed textures defined has having 1x1 pixel blocks). Then this nonsense of 255 of 256 values being bad would disappear. There's a ton of other inconsistencies in that function. For example, you pass it destinationBytesPerRow when copying to a buffer but if the texture is compressed you pass it say 40 rows and it will only only actually copy 10 rows of blocks and only advance the destination every 4 rows instead of every row. It's arguably a poorly designed function. Thought, I suspect it was inspired by similarly poorly designed functions in other graphics APIs
This is no different than say insurance companies charging more for people under 25. You might be 19 and the safest driver in the world. Doesn't matter, the statistics say, people under 25 get in accidents. Same with all kinds of things.
It's not like a space program has infinity money and sends up a rocket to Saturn every day. So, they have to lower the risks and one of the ways they do that is by trying to select extremely healthy people to be astronauts. Sure, one person how's genes say they are unhealthy might happen to outlive everyone how's genes say they are healthy but that's not how it works. They're still going to use some form of selection by genes (health, body size, eye sight, hearing, etc...) so select people they feel give the mission the highest chance of success.
If you're blind, deaf, have missing or deformed limbs, a "bad" heart, etc... you aren't going to be selected.
NASA and the Air Force already have (had) a "you must have perfect genes or you don't get to be an astronaut / fighter pilot" so that part of Gattaca was not sci-fi, it was just repeating what was already true. One of my best friends in high-school, his dream was to be a fighter pilot, but he had bad vision (bad genes) and knew that was an instant "no".
In terms of the movie, the main character wants the government to risk billions of dollars on a space mission on him and he selfishly doesn't care that they're trying to lower the risk of failure by selecting only people less likely to have issues on the mission. Real space missions do the same. You aren't going to send someone who genes suggest the mission may fail. They may not give you a DNA test, but they will test tons of other things that all basically test your things you got because of your genes.
I get the movie is about trying harder than anyone else, taking risks, not letting others tell you your limits. All of that is great. But, because of the poor choice of context (billion dollar space missions) it didn't work for me because that is how billion dollar space missions are run and it made the main character kind of a jerk for risking the mission and every one else's lives.
Further, that assumes you make it out the other end. Almost no one saves the money and retires early. Instead they get some money, they get a nicer apartment, nicer car, start eating out at fancier restaurants, shopping at higher end places, buying fashion brands etc...