97 karma · joined October 14, 2015
I worked through this and felt well-prepared to actually use C in anger when I had to.
Let's say you need to dynamically allocate two buffers in a function and want to make sure they are freed at the end of your call. You can use this macro like so:
int two_bufs(int n, int m) {
int *buf_1 = NULL;
int *buf_2 = NULL;
buf_1 = calloc(n, sizeof(int));
CHECK(buf_1);
buf_2 = calloc(m, sizeof(int));
CHECK(buf_2);
// ... lots of cool things with buf_1 and buf_2
error:
free(buf_1);
free(buf_2); // Safe if null
}[1] https://github.com/ThrowTheSwitch/Ceedling/tree/master/plugi...
Elitist assholes definitely exist everywhere, but in my experience a lot of what I viewed as "showing off" when I was younger was really just "being normal" for a different "normal". When a 25-year-old software developer talks all the time about Stanford and Lambos, he's not trying to show off, he's just talking about what he knows, just like the guy talking about tail-gating at <insert SEC school here> and then going four-wheeling all the time.
I don't want to devalue experience and education in any way; those things have value! But time is linear and the past has happened -- you just have to move forward with what you have and go after what you want, and don't get distracted by the fact that others started out with a lot more than you. I double-pinky-promise you that if you are good at something, keep getting better at it, and aren't an asshole yourself, you can work at any company you want. :-)
I'm not saying that this is literally correct -- the brain is way more complicated than that! But I find it quite useful as a metaphor for processing and understanding social dynamics that I inherently find "irrational".
I found the first half of "Prometheus Rising" by Robert Anton Wilson to be incredibly useful for understanding human dynamics -- I use the framework presented there every day. The core of this is in my opinion just a very straightforward computer-focused analogy that gives me insight into the behaviour of other people and myself that I haven't found elsewhere.
Of course, outside the core is a LOT of wild new age, Crowley-Leary-Regardie syncretism that provokes strong negative throw-the-book-across-the-room reactions in most people. A lot of very reasonable people would look at the wikipedia page or the cover of this book and not only think that the book is crap, but also that I'm a crazy hippie for even considering reading it.
I think it's important to keep in mind "signal bias" -- I'm never on other social media, and I'm only on HN every weekday over my breakfast and morning coffee. I don't spend time building my brand or writing blog posts or shouting from the rooftops about how great my life is because I'm trying hard to stay busy actually enjoying how great my life is. In my experience, there really are a lot of folks who've made similar decisions, it's just that part of managing your life is also giving up on trying to convince strangers that you're awesome.
The specific reason for the size disparity is that we require he_conn->{username,password} to be null-terminated, whereas we do NOT require he_msg_auth->{username,password} to be null-terminated. I remember raising the same point and being convinced that we had a good reason for doing so, but I also haven't had enough coffee to remember what the good reason was!
Regardless of whether this is a "bug" or not I do think that the disparity points to something that unnecessarily causes confusion, will have a think about making it more consistent.
Regarding style -- I also ~hate if(x==0) without the space after the if but we committed to consistency instead of arguing over it via clang-format. To quote Rob Pike, "Gofmt's style is no one's favorite, yet gofmt is everyone's favorite."
Overall, I would say that there's larger gaps between companies than there are internally to countries. Especially in India, I was consulting and definitely spent time on an Infosys campus in Bangalore where they had unscrewed half of the overhead lights to save money, but I also worked with some places that felt more or less like any other high-tech company anywhere else in the world.
Similarly, when I was looking for work here in Singapore, there were definitely folks that were looking to hire folks with 15 years of experience and pay them $80k/year, but there were also several companies that offered high-paying jobs with interesting work. There were definitely FEWER companies, but the flip side is that the hit rate was much higher -- I ended up getting at least a first interview with 70% of the companies I sent my resume to here, as opposed to the 20-25% I generally find in the US. In general, companies are very keen to hire "American" tech talent, especially if you have a "name-brand" on your resume.
In terms of compensation, if you are relocating, you really do have to look at the holistic quality-of-life. I ostensibly took a "paycut" in US$ terms from my Google NYC job for my role here in Singapore, but I also went from a tiny 2 bedroom apartment and a 45 minute subway ride to a 3 bedroom walking distance to work with a full-time nanny who works 6 days a week, cleans, and cooks in addition to watching our two kids.
Living "overseas" has been a great joy in my life -- I may end up back in America for some time but I also see myself living elsewhere for as much or more time. I can't recommend it enough -- the world is a pretty incredible place!
https://freakonomics.com/podcast/book-club-hastings/
Highly recommend the podcast!
I started out as a Java-by-the-yard consultant, but I was at a "fast-paced" consulting company and so was very quickly given as much responsibility as I could handle, which as it turned out was a lot. I never set out to be a manager as such, but the opportunities were there, and I climbed the ladder and did well w/ external accolades.
At about the decade mark in my career and a location and employer jumps later, I was a manager-of-managers w/ about 75 reports, and making a lot of money, in a highly visible position at my company where I got a lot of support and accolades. And I was miserable! I mean, I can only use that word in hindsight -- it took a lot of introspection to pick apart my circumstances and really dig into what I truly wanted out of life.
I did a serious course correction here -- I did a lot of self-learning to ramp back up on modern coding, and I was very fortune to land a technical (but not "developer") FAANG job. I learned as much as I could there, and even took a (much more junior) management role, but I quickly realised that even at a more "technical" company I was still miserable if I wasn't the one building things.
I'm currently 1.25 years into a GREAT job, and although it's not perfect, I'm delighted every day to open up Vim and write Python, C, and some other fun stuff. It took me nearly 3 years to go from "I think I want to be a developer again" to actually working full time as a developer, but I also stayed employed (and had 2 children!) during that time, so you could certainly make the switch faster if you really wanted to.
Maybe this is a really dumb question, but as someone who really knows nothing about computer graphics, how can you actually run these examples?
I realize that I could Google and research and find a list of "canvas drawing tools" in a variety of languages that I could then evaluate (despite, again, knowing nothing about graphics), but it'd be SUPER-SUPER-awesome to have a quick note "there are lots of ways to go about making these things happen in the real world, but here's one I recommend if you have no other priors." :-)
Really cool book idea, keen to have a go at it!
https://clojure.org/about/runtime_polymorphism
It's common for code to "choose" which method to call based on the class of the arguments, but it's also common to choose which method based on whether a particular key is in the hashmap, etc.
I used this book, no affiliation other than I liked it: https://handwritingsuccess.com/write-now/
Inspired by this Slate article: https://slate.com/human-interest/2009/09/why-your-kids-have-...
I Actually Watched All of Them
I have actually watched ALL of the videos on these channels and I don’t even feel bad about it :-) I actually like new videos from some of the ones below (like NativLang, for example) but they maybe don’t hold up in the early videos.
- Space Time: PBS Physics, sooo good -- https://www.youtube.com/channel/UC7_gcs09iThXybpVgjHZ_7g -- Great first video: https://www.youtube.com/watch?v=K8gV05nS7mc
- Lindsay Ellis: Really, really intelligent video essays about film and culture -- https://www.youtube.com/channel/UCG1h-Wqjtwz7uUANw6gazRw -- Great First Video: https://www.youtube.com/watch?v=vpUx9DnQUkA&t=1s
- Periodic Videos: Chemistry, including a video for every element -- https://www.youtube.com/channel/UCtESv1e7ntJaLJYKIO1FoYw -- Great first video (obviously): https://www.youtube.com/watch?v=6rdmpx39PRk
Other Math and Science
- 3Blue1Brown: Amazing math visualizations -- https://www.youtube.com/channel/UCYO_jab_esuFRV4b17AJtAw -- Great first video, how e^pi*i works: https://www.youtube.com/watch?v=v0YEaeIClKY
- NumberPhile: Fun math videos -- https://www.youtube.com/channel/UCoxcjq-8xIDTYp3uz647V5A -- Great first video: https://www.youtube.com/watch?v=wBU9N35ZHIw
- PBS Eons: Biology! -- https://www.youtube.com/channel/UCzR-rom72PHN9Zg7RML9EbA -- Great first video: https://www.youtube.com/watch?v=gMdv3JlPizw
- PBS Infinite Series: Math math math, really really hard math -- https://www.youtube.com/channel/UCs4aHmggTfFrpkPcWSaBN9g -- Great first video: https://www.youtube.com/watch?v=63HHmjlh794
- SciShow: Science! More poppy but fun -- https://www.youtube.com/channel/UCZYTClx2T1of7BRZ86-8fow -- Silly first show: https://www.youtube.com/watch?v=ZELEjE92D-c
-- Actual physics: https://www.youtube.com/watch?v=J4Ej3Q_QquA
- VSauce: Science-y? -- https://www.youtube.com/channel/UC6nSFpj9HTCZ5t-N3Rm3-HA -- Great first video: https://www.youtube.com/watch?v=ktkjUjcZid0
- Practical Engineering: -- https://www.youtube.com/c/PracticalEngineeringChannel -- Great first video: https://www.youtube.com/watch?v=0olpSN6_TCc
Other Humanities
- Alliterative: Connections via language -- https://www.youtube.com/channel/UCG6tBbWzY_ZR4_rd72vp6CA -- Great first video about gin and gimlets: https://www.youtube.com/watch?v=V7jEH6E6l90
- Bon Appetit: Such fun food stuff! -- Gourmet Makes: https://www.youtube.com/watch?v=H2nY7Tu1Qgs -- It’s Alive: https://www.youtube.com/watch?v=zx8pYMkkKXg
- Masaman: Genetics and human migration (and low production values sadly) -- https://www.youtube.com/channel/UC1vVNQN-TCy8d3Mb_Owr2Kw -- Great first video: https://www.youtube.com/watch?v=fc2Qcca8xkE
- NativLang: Animated shorts about language -- https://www.youtube.com/channel/UCMk_WSPy3EE16aK5HLzCJzw -- Great first video: https://www.youtube.com/watch?v=J7vreUPCl9c
- Vox: Never for the news, but for the “other” series -- https://www.youtube.com/user/voxdotcom/featured -- Check out this amazing video about Venezuela and Columbia: https://www.youtube.com/watch?v=NU0RqwweuWY -- Or this video about giant steps: https://www.youtube.com/watch?v=62tIvfP9A2w&list=PLJ8cMiYb3G...
- Cogito!! (No links yet…) -- https://www.youtube.com/channel/UCKMnl27hDMKvch--noWe5CA -- Great first video: https://www.youtube.com/watch?v=1oQ5Jd7p2aY
I listen to a lot of podcasts, in alphabetical order:
A Million Little Gods <- Serious but accessible philosophy discussions, Season 2 was an absolutely mind-blowing discussion of "race"
Bundyville <- Limited series about the far-right movement in the western USA
Fandible <- Personal favourite actual-play RPG podcast, geeky but I love it
Freakonomics Radio <- I resisted at first because of the brand name, but the general content is so good.
Functional Design in Clojure <- Exactly what it says, works surprisingly well as a podcast. I really appreciate that it's "intermediate-level", and really focused on "how do you build real software"
Lexicon Valley <- Incredible and well-presented linguistics topics w/ some idiosyncratic music choices thrown in
JS Party <- from the same folks that make changelog. I honestly don't listen to every episode after the change in format after the incredible Season 1, but I stay subscribed and listen when the topic grabs my attention.
Sinica <- I came for the China content, but I stayed because these are the smartest conversations I hear about any topic anywhere.
Software Engineering Radio <- I don't listen to every episode, but it's good when it's good, mentioned by a few other commenters.
Stuff You Missed in History Class <- well worth an archive binge, there's a LOT of fascinating content deep inside.
This American Life <- I still listen even though I don't live in America anymore. :-)
I find this especially useful when I'm building complete solutions from lots of other technologies -- it's easy to fall into the trap of "well my API will behave like API X because that's what I'm using under the hood". Readme driven development really encourages thinking harder and producing something that's greater than the sum of its parts.
On a day-to-day basis, there's always going to be a cyclical element -- I just spent two weeks writing code nine hours a day to push through a big feature, and now I expect to spend a week or two on less focused work, catching up on all the things I ignored while I was heads down.
I also try to turn non-code work into coding work. In lieu of doing a BUFD, I'll try to throw together a proof-of-concept or do a spike. Whenever there's a production issue, I try to turn that into a project to eliminate that class of issue. If there's some repetitive administration to do, I try to automate it.