HNHacker News
TopNewBestAskShowJobs

avg_dev

1,405 karma · joined October 28, 2016

submissionscomments
avg_dev··on Deduplicate a slice in Go, use sort or a map?
I’ve never actually seen a length passed to make() when creating a map - does it work?

Edit: yep - https://go.dev/ref/spec#Making_slices_maps_and_channels

avg_dev··on Deduplicate a slice in Go, use sort or a map?
I am curious how much of a difference there would be if the author would use

  result := make([]unit64, 0, len(elements))
in the old func. I think that the way it is written, it will continually have to be expanded as the backing array exceeds its capacity (in the course of append() calls).

And as others have pointed out, maybe use an empty struct (as opposed to a bool or empty interface) as the map value type. Also TIL about make(map[T]S, len) - didn’t know you could set len, or at least hadn’t seen it in practice, but it was suggested here and I think it would likely help as well.

Edited: I forgot to set len to 0.

avg_dev··on I worked at Google for -10 days
s/that said/having said that/

https://www.youtube.com/watch?v=O5DCns_n9_M

avg_dev··on Tesla workers shared sensitive images recorded by customer cars
That was implicitly intended to be part of menu template code, so it would show the “Mixed Fruit” option only if it wasn’t prod, and as I tried to suggest in my comment, such code would not execute on prod (the endpoint/backend code would abort if it found itself running in prod). (And the mixed fruit code would, in fact, affect data in the DB). Tbh I think this discussion is less than pointless.
avg_dev··on Tesla workers shared sensitive images recorded by customer cars
:)

Fair enough...

avg_dev··on Tesla workers shared sensitive images recorded by customer cars
It's hard for me to say whether you are correct or not; I was under the impression that the data was updated on the DB instance, and in that case I stand by what I said (the prod data would end up on the laptop, but then as soon as the command was run, it would get permanently obfuscated). If the data was just obfuscated on screen, then yes, perhaps you are correct.

Something I have seen done before that I thought was good was that every so often a production database was synced, but during the sync process, things that could identify a customer were redacted or obfuscated. Then almost anyone who had need to work with production data would use the munged version.

avg_dev··on Tesla workers shared sensitive images recorded by customer cars
I believe that your assessment of startups is valid. I also think your views are true of big, multinationals as well. It seems that by the time a company gets large enough, consumers start receiving some protections, but workers, not so much.

- https://en.wikipedia.org/wiki/Foxconn#Controversies

- https://en.wikipedia.org/wiki/Hyundai_Motor_Manufacturing_Al...

etc.

avg_dev··on Tesla workers shared sensitive images recorded by customer cars
good ethics, bad data handling practices.

  <?php
  if (! $isProd) {
    showMixedFruit();
  }
Also, the code should not be allowed to run on a prod instance, even if it is triggered there.

But, I'm sure you've figured this all out by now.

avg_dev··on Mariadb.com is dead, long live MariaDB.org
> This entire article was written for one group of people.

>

> If you are employed at MariaDB, you absolutely need to be scheduling interviews with other companies.

avg_dev··on How to Read MySQL EXPLAINs
https://www.postgresql.org/docs/current/using-explain.html
avg_dev··on Treat your to-read pile like a river, not a bucket
Never heard of this person before but was pleasantly surprised by the content.

In my own life, I have spent decades plagued by the feeling that I wasn’t doing enough, and I had many varied areas of focus and felt like I didn’t really progress on anything. That in itself (the feeling of lack of progress) was I think kind of misleading, as I did progress on some things (though I clearly regressed on some things as well).

I don’t really know how it happened but I have made some significant shifts in my life. I started to become physically active again, I stopped smoking cigarettes and some other unhealthy habits, I started really developing and digging into some of my active and creative passions like writing, playing a musical instrument, and renewing my focus on coding to an end and with purpose and quality in mind.

Somehow I started finding that I had much more energy and time available for everything. And as opportunities arose I began to seize them. It was a very exciting period for me. Eventually, my plate really became too full, and things began to suffer (mostly me) and I started to say no to things, and continue to keep my focus on what I really think is important. I feel that it has taught me about the interconnected nature of my life, and about how to value my time, how to slow down and appreciate something, how to deal with my emotions head on instead of taking years or decades to process events in my life (I am sure there have and will be many exceptions to what I have said), how to actively take stock of my current situation and change my plans as needed, how to deal with the fact that my expectations for things very rarely match up with reality, how to stop being an intellectual purist and idealist while still deeply valuing a good idea and pursuing my ideals. I look back at how much I have accomplished the last year and I can’t help thinking everything came from stopping trying to do everything and accomplishing nothing (or so it felt), and by embracing what really mattered to me when it was in front of me. I learned to float down the river, I guess. Lazily most of the time. But when I feel it is necessary, I can exert more power in changing my trajectory than ever I could before.

avg_dev··on John Glenn’s $40 Camera Forced NASA to Rethink Space Missions
i really enjoyed this post.

i have been pretty reluctant to take photographs in general. i do enjoy a nice photo for sure, and i have taken a few that i actually like too.

> [I]f you have a camera on you, that's good enough, and you have the basic understanding of photography, you can capture an event that would otherwise be lost to time.

i like this thought. and i will perhaps try to take more photos.

avg_dev··on Top Reddit communities for Devs and ITs: from beginners to advanced
That was very entertaining. Thanks for posting.
avg_dev··on Top Reddit communities for Devs and ITs: from beginners to advanced
Interesting post. I have bookmarked it. I’m probably going to check out the software gore one for a few mins just to make myself feel sick.

Unrelated, but despite not programming in C or C++ in several years, I have always enjoyed reading PVS Studio blog posts as I come across them. It is fun to think about static/dynamic analysis (I actually am not sure where the line is) and language design.

avg_dev··on Google just launched Bard, its answer to ChatGPT
I can't say that I'm a fan of this current crop of LLM chatbots.

Some things bother me about this article and the facts that warranted it in the first place. I have very similar reservations with regard to the Bing chatbot launch (detailed below - just substitute Bing for Bard).

> Google has a lot riding on this launch. Microsoft partnered with OpenAI to make an aggressive play for Google’s top spot in search. Meanwhile, Google blundered straight out of the gate when it first tried to respond. In a teaser clip for Bard that the company put out in February, the chatbot was shown making a factual error. Google’s value fell by $100 billion overnight.

1. LaMDA is not a new project. They are clearly releasing a chatbot based on it to the public to compete with MS/OpenAI. But if the tech existed some time ago (and as a developer I realize that iteration and time and attention tends to improve quality), why didn't they release it before? I am guessing - baselessly - that they saw that the quality of the output was quite poor (often factually wrong, for instance). But now that a competitor is threatening their market share, quality metrics goes out the window - revenue is once again king.

2. Funny how the valuation of the company dropped so quickly. It is because as shareholders we rely so much on short term gain. There is no focus on follow-through or long-term consequences. I certainly don't believe that capitalism is inherently bad and I am a huge fan of competition. But I think the way we practice it leaves many practical things to be desired.

> “We’ll get user feedback, and we will ramp it up over time based on that feedback,” says Google’s vice president of research, Zoubin Ghahramani. “We are mindful of all the things that can go wrong with large language models.”

>

> But Margaret Mitchell, chief ethics scientist at AI startup Hugging Face and former co-lead of Google’s AI ethics team, is skeptical of this framing. Google has been working on LaMDA for years, she says, and she thinks pitching Bard as an experiment “is a PR trick that larger companies use to reach millions of customers while also removing themselves from accountability if anything goes wrong.”

3. This quote, and the mention in the article of the "Google It" button below the Bard chat, the three versions of Bard's response ("drafts", FTA), the quote by the Google product director that says "There’s the sense of authoritativeness when you only see one example”... I could not agree more with what Margaret Mitchell has to say (I have never heard of her before, to my knowledge). Isn't it very clear by now that users don't have the time or attention to acknowledge implications? We are busy and we don't have the energy. If we see it on a screen, we take it as fact, copy and paste it as needed, and proceed with the knowledge that we have gleaned from said "facts". I suspect that if anybody really knows how misinformation works and the effects it has on society, it's data analysts at Google search. But the almighty revenue stream dictates that they push this not-necessarily-factual-information-producing-tool anyway.

If I can find the time, I'm quite curious to read that article that just pre-dates Bing chat and Bard about the dangers of using LLMs in search engines.

avg_dev··on The simplicity of single-file Golang deployments
I feel like I agree with the general ethos of the project. And I am also a fan of pragmatism; I think Fred Brooks referred to our trade as “toolsmiths” and I feel it is an apt word. Our work product exists solely to fill a need or to enable things that were not previously possible. I feel like I work hard not to be an idealist or to view well-written code as an end to itself.

But I must confess,

> Systemd also restarts the app daily to make sure it works properly long term

leaves me with a viscerally negative feeling. I feel like daemons should be able to run for years unless there is some kind of leak. Maybe I am wrong.

avg_dev··on Twenty-five years of curl
Indeed. I really enjoyed the article, and I am grateful for the tool as well. My favorite section was "Staying relevant" which explains (IMO) how it is possible for this project to have not only kept such staying power but exploded in use.

Also the "2019" section made me lol:

> I started working for wolfSSL, doing curl full-time. It just took 21 years to make curl my job.

Finally: thank you to Daniel Stenberg, Rafael Sagula, and the many, many contributors for making this tool.

avg_dev··on Things I learned after getting users
> I said that's life

> (That's life)

> And as funny as it may seem

> Some people get their kicks

> Stomping on a dream

> But I don't let it, let it get me down

> Cause this fine old world, it keeps spinnin' around

- That’s Life

By Dean Kay and Kelly Gordon. Most famously recorded by Frank Sinatra.

avg_dev··on A brief interview with Rexx creator Mike Cowlishaw
That's really interesting. I personally feel like JS as it was originally created is some sort of travesty (my apologies to those involved - I myself have written a tremendous amount of bad code under time pressure - and not under time pressure ;) ), but it definitely does allow for a lot of functional programming paradigms which is kind of nice.

I don't know much about Lua or mruby but I understand they may fill such needs too.

Also fun to note that John Backus was at IBM. I have some vague memories of BNF. I imagine that AT&T Bell Labs and IBM and Xerox were amazing places to work at one time. I do hope that things are generally trending for the better, in that ideas can be exchanged digitally, and that things are de facto more inclusive today, but I bet it would have been a heady thing to have a lounge filled with people like at those offices and then go back to your own office and noodle away on ideas that had been discussed.

avg_dev··on A brief interview with Rexx creator Mike Cowlishaw
The Wikipedia article on Rexx seems to be pretty informative: https://en.wikipedia.org/wiki/Rexx

> Rexx (Restructured Extended Executor) is a programming language that can be interpreted or compiled. It was developed at IBM by Mike Cowlishaw.[2][3] It is a structured, high-level programming language designed for ease of learning and reading. Proprietary and open source Rexx interpreters exist for a wide range of computing platforms; compilers exist for IBM mainframe computers.[4]

>

> Rexx is a full language that can be used as a scripting, macro language, and application development language. It is often used for processing data and text and generating reports; these similarities with Perl mean that Rexx works well in Common Gateway Interface (CGI) programming and it is indeed used for this purpose. Rexx is the primary scripting language in some operating systems, e.g. OS/2, MVS, VM, AmigaOS, and is also used as an internal macro language in some other software, such as SPF/PC, KEDIT, THE and the ZOC terminal emulator. Additionally, the Rexx language can be used for scripting and macros in any program that uses Windows Scripting Host ActiveX scripting engines languages (e.g. VBScript and JScript) if one of the Rexx engines is installed.

The page goes on to discuss ARexx (the Amiga port) and Compound variables, which can be used as arrays (both of these things have been mentioned here by other commenters).

avg_dev··on A brief interview with Rexx creator Mike Cowlishaw
It is indeed very brief.

Something I've been wondering about lately is how much language developers get to code in their actual language. Perhaps if things get really really far along, the language interpreter/compiler/runtime/whatever becomes self-hosting. But I suspect many languages never actually get that far. I was just thinking about the fact that maybe most language developers today still code in C (I have no idea if this is actually true). Perhaps in the future they will code in Rust or Go.

He does briefly speak to part of this point:

> I don't think I'd change anything in them except to emphasise more that a programming language is a Human-Computer-Interface and the language designer should design for the users of the language, not just for himself or herself.

--

I personally have never used Rexx. But I remember many years ago I made an attempt to sign up for an OS/2 Warp beta and being shocked when I actually got picked. I recall installing it and the OS contained what was the first instance I had seen of some sort of voice control for computers. Even at the time my IBM PS/2 (a 386sx running at 20MHz) was at the low end of the requirements for OS/2 Warp and the system didn't perform very well at all. But I have a memory of speaking something like "Computer: Go to sleep!" and my brother laughing at me and repeating it from time-to-time after that, long after I'd uninstalled OS/2 and went back to Windows 3.11 or DOS or whatever I was running in those days.

avg_dev··on Don't Share Java FileChannels
I enjoyed the article. Long time since I programmed in Java. I recall being recommended a book called Java Concurrency in Practice and it languishing on my shelf.

I had a few notes:

1. It is really nice to have such thorough documentation. Even if a programmer doesn’t always have or make the time to read it.

2. I _think_ I remember reading an interview with Peter Norvig in Coders at Work where he talks about programmers never having the time to fully grok their API docs (it may well have been a more general statement about rushing to get stuff done).

Some time ago I personally learned a virtualization discovery API whereby one could make some calls and learn, through some sort of traversal, how a topology of VMs was laid out. My title at the time was Intermediate Software Developer. I remember I was pretty happy with my solution and shared during standup that it was working well but was kind of slow, and that there was another, more complicated and finicky type of traversal mentioned in the docs, and that my reading of the docs was that learning and coding this other method was necessary or helpful is some use cases but that for our situation it would not make a difference and would just add complexity. Well within a couple of weeks another team member - Junior Software Developer - read the same docs and tried out the more finicky version and wouldn’t you know, the discovery process suddenly became blazing fast.

avg_dev··on What a good debugger can do
Thanks very much for posting this article. I found it very intriguing. I read it carefully but I didn’t visit all the links or watch all of the in-line videos.

I would say that for the most part I am a printf-style debugger. I remember reading some years ago (on HN, I believe) about time travel debugging in - I believe - C# and I was really impressed but I don’t code in C# so it soon left my mind.

I have a deep appreciation for mastering one’s toolset. I can’t think of the number of times that I learned something new about a tool (language, editor, shell, browser, whatever) that I use daily that changes my workflow - it has happened so many times. And as with all things code, sometimes new features are added.

I am going to try to make a point to re-read this article later and to visit each link and glean what I can.

I mostly code in Go. I wonder, does anybody know how much of this stuff might be supported there?

avg_dev··on Plankalkül
Wow, this is fascinating.

> Plankalkül (German pronunciation: [ˈplaːnkalkyːl]) is a programming language designed for engineering purposes by Konrad Zuse between 1942 and 1945. It was the first high-level programming language to be designed for a computer.

Apparently it influenced ALGOL 58 as well. Implementations were made:

> Plankalkül was more comprehensively published [vague] in 1972. The first compiler was implemented by Joachim Hohmann in his 1975 dissertation. Other independent implementations followed in 1998 and 2000 at the Free University of Berlin.

Here is something about primitive data types:

> The only primitive data type in the Plankalkül is a single bit or boolean (German: Ja-Nein-Werte – yes-no value in Zuses terminology). It is denoted by the identifier S 0 {\displaystyle S0} {\displaystyle S0}. All the further data types are composite, and build up from primitive by means of "arrays" and "records".

Cool.

Also this reminded me - nothing happens in a vacuum:

> In 1945, Zuse described Plankalkül in an unpublished book. The collapse of Nazi Germany, however, prevented him from submitting his manuscript.

I don’t know what the significance of that statement is and I won’t baselessly speculate, but it sure makes me curious. It also reminds me of some messages I remember seeing from Russian founders in the recent past.

avg_dev··on AI teaches itself to use an API
One thing I don’t see people discussing here is that API calls often have consequences. Like, if you make a call in your trial-and-error process that inserts a row in some database, and that’s about it, it’s not a really big deal.

But I’m thinking of:

1. How badly secured many real-world APIs are and how many API keys are out there to be scraped

2. Some APIs offer truly destructive or otherwise irreversible actions.

Suppose for one second there was a poorly secured API to control medication dosages. Or to deliver a lethal injection to a death row prison inmate. Or to detonate a building scheduled for demolition. Or, …

avg_dev··on Matty Benedetto Designed and Prototyped 350 Inventions in 3 Years
I’ve enjoyed several of his reddit posts about his latest works. They are very entertaining.
avg_dev··on It's probably time to stop recommending Clean Code (2020)
Wow this is quite a takedown. For many years I was feeling like I let myself down by not reading the book Clean Code. I now feel like, by accident, I did exactly the right thing. That sample code he quoted is near unreadable to me. I also did enjoy A Philosophy of Software Design; the main thing I took away from it was to avoid unneeded complexity because you want to be able to “spend” your complexity budget for doing actual work.
avg_dev··on OWASP Juice Shop
At a job I had, we had a big CTF event where people broke into groups and attempted to capture flags in the Juice Shop. I thought it was a lot of fun.
avg_dev··on Ask HN: How do you work on your mental health?
I would say I have good mental health. That was not always the case. A number of things have turned the tide for me.

1. I found some "active" shit I legitimately enjoyed doing: playing music, writing, walking, iyengar yoga

2. I walk a lot

3. I do yoga intensely once a week

4. I keep a journal

5. I learned how to manage my emotions from a powerful book called "The Anger Management Workbook for Men" by Aaron Karmin, and embracing it changed my life and enriched it in ways I absolutely never could have predicted

6. I have found a couple of communities that I am a part of

None of this stuff happened overnight, but the shift into the right direction started occurring a lot more quickly than I expected, and the not feeling like complete shit all the time, the extremely poor and sometimes very destructive coping mechanisms, they are a work in progress, but I am so much closer to my ideals than I could have expected in such a short time.

If I had to pick one to recommend, it would easily be the Karmin book. Best investment I've ever made.

avg_dev··on Hard truths I learned when I got laid off from my SWE job
sometimes, not even the intentions are good
← PreviousPage 7 of 15Next →