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…
Ask HN: Those with success using GPT-4 for programming – what are you doing?
41–50 of 109 posts
Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?
#42Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?
#43It’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?
#44SQL 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…
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?
#45I 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?
#46Fair 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?
#47It's useful for rubberducking. https://en.wikipedia.org/wiki/Rubber_duck_debugging
Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?
#48Top 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.
Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?
#49I 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…
Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?
#50Earlier 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.
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.