Live data from Hacker News

Ask HN: Those with success using GPT-4 for programming – what are you doing?

news.ycombinator.com

41–50 of 109 posts

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#41

SQL queries. I am poor at writing SQL queries with bunches of joins. I just show it the table definitions and tell it what I want. Sometimes it doesn't get it quite right (which is why you need some knowledge of what you are asking of it) and I point it out and it fixes it. Regular Expressions. I hate doing regexps. It is excellent at them. Wiki articles for an encyclopedia I'm developing. It is great at this, but oc…

I've also been using ChatGPT to create SQL queries -- it's genuinely really, really great at this. I do have to say "I'm using PostgreSQL with DataGrip IDE" and feed it back any errors I get, because there are a lot of permutations for SQL, but it's a pretty seamless experience overall. Here's an example of one that helped me a lot. This takes no time at all to get ChatGPT to generate by giving it anonymized snippets…

Thirded, my only complaint is that it helpfully strips out comments and occasionally forgets which SQL variant I’m using. I have found it helpful to feed it back my query after I’ve implemented the recommended changes and made my tweaks, along with something like, “this is what I did, can you help me improve the section starting with `SELECT * FROM product`… the context seems to improve it’s subsequent recommendations.

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#42
It's great at log pocessing (generating commands for awk, sed, complex grep regexps, shell scripts to combine it all). Anything where I'm not an expert but need something very basic done quickly (e.g. the bulk of my day job is in C++, but I frequently need little bits of Python and ChatGPT is often the quickest way to get the answer I need).

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#43
IME GPT-4 is bad at doing things and great at looking things up for you. Rather than trying to get it to do things, I ask it how I should do it (and argue with it about any hallucinations that come out—a process that often teaches me a lot!) and then I go do the task myself, copying whatever I need from the conversation but not relying on it slavishly.

It’s basically a fuzzy inverted index for public docs and code. “What’s the normal way of doing X”-type queries work best, with quality falling off quickly as complexity increases. Stuff like “what is a ‘git log’ command that only shows commits containing a particular snippet in the diff, limited to merge commits on master”, for example.

For more complex tasks, a trick I’ve seen work well is “give me an outline for how to do large task X” followed by “let’s go through each step in the above outline. For each one, I’d like a description of how it should be solved, including example code. Let’s start with the first step.” But that trick is not totally reliable and has its own complexity limit.

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#44

SQL queries. I am poor at writing SQL queries with bunches of joins. I just show it the table definitions and tell it what I want. Sometimes it doesn't get it quite right (which is why you need some knowledge of what you are asking of it) and I point it out and it fixes it. Regular Expressions. I hate doing regexps. It is excellent at them. Wiki articles for an encyclopedia I'm developing. It is great at this, but oc…

>SQL queries

Short, functional things like this I've found to really be ChatGPT's strength. For example, I had some godawful nested PHP code that had been written years ago I was trying to muck with. Asking GPT to sort it out for me took me way less time than trying to figure it out myself.

I've also used it for SQL queries and things like list comprehension, etc.

The few times I've pasted in whole code blocks and asked it to do XYZ, I've ended up basically debugging my prompt instead of my code.

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#45
Autopatching vulnerabilities on my network.

I have a set of tools which build prompts describing the environment and the output of vulnerability scans. The tool then requests a shell script to disable/fix/update the vulnerability. The script is submitted as a PR which has actions that run integration tests. Human intervention is sometimes needed, but the focus is on better engineering of prompts (and by proxy tooling).

Describing the environment relies heavily on my CMDB (Combodo’s iTop) so this is not a one-size-fits-all approach and this is functioning entirely in my personal lab of ~100 servers. That said, ChatGPT has given me the best results compared to locally run LLMs

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#46
OpenSearch (or ElasticSearch) query building. I was new to the technology and their syntax took a while to wrap my head around. Instead I'd just tell ChatGPT my document format and then ask for specific data in natural language.

Fair warning, the queries were not always perfect on first try, but it was a lot easier than parsing replies to somewhat similar questions on stack overflow. Now I mostly write my own queries but it really helped me get started.

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#47

It's useful for rubberducking. https://en.wikipedia.org/wiki/Rubber_duck_debugging

I hadn't even considered that facet! I probably bother my coworkers more than I should with what amounts to rubberducking.

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#48
post #36

Top tips: * If you can write it from memory, go ahead and do so. Do not consult GPT-4 * If you know what to do but need to look a few things up - put your best effort into GPT-4. It will flesh it out * If you're using a library that is new, you can copy paste the library examples into GPT-4 and then describe what you want to do. It will give a great starting point

>"If you can write it from memory, go ahead and do so." I know how to for example divide and multiply on paper. Still I use calculator for that.

You seem to be saying that you're getting a speed-up even in the first case, i.e. where you can write the code without having to think hard or look anything up. If so, how do you do it?

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#49

I use it to brainstorm and prototype approaches to a problem. First, I'll ask it to give me an overview of the problem domain; this gives the LLM context. Then, I describe the problem and ask it to generate solutions, along with pros/cons of each approach. This is iterative: you might ask it questions, modify its suggestions, periodically summarize. After that, you can either ask it to give you code for a prototype o…

What sort of programs or systems are you creating?

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#50
post #34
post #29

Earlier quoted context omitted.

I brought up the web UI, and said something like this: "Here is a Go source file, see any problems, issues, or suggested bug fixes? " Simple as that. Of course, sometimes I got the "message too big" error. So I pasted bits of the sources files, choosing pieces I thought were reasonably self-contained. I also fed much of my unit tests through it, asking "see any missing test cases?" While some of the answers were not…

I can't believe they are only charging me $20/month for access to GPT-4. I'd pay more for it.

I’d pay more if it was faster, had API access, and stronger privacy.

Right now Sam Altman is channeling Zuckaberg by claiming to be the good guy changing the world, but in reality hoarding data and asking congress to build him a moat.

Post reply on HN