Live data from Hacker News

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

news.ycombinator.com

91–100 of 109 posts

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

#91
post #67

I had to optimize some Python code to reduce its memory usage. After trying all ideas I could think of, I thought about rewriting it in a different language. Copied and pasted the code into ChatGPT 4. Tried Rust at first, but there were too many compilation errors. Then I tried Go and it worked perfectly. For the next couple of weeks, I used it to improve the Go code, as I've never used Go. It gave me great answers,…

What kind of memory efficiency gains did you see as a result of the effort?

I didn't keep track of the benchmarks very well. However, it went from taking 3+ days and 180GB of memory to process 80M rows [1] to processing 1.3B rows in ~6 hours using ~90GB of memory.

[1] I stopped the process early, as it was taking too long

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

#92

I've been using it to refactor Clojure codes and port Scheme examples into Clojure. Maybe because Lisps have very low syntax, I find I can just copy off function/macro definitions as context and GPT3.5 can rewrite the code into something I can use... And by testing in a REPL (in :dev) I can instantly see which code has hallucinations and which work perfectly. Tbh I find it hallucinates mainly when dealing with mutabl…

I have tried several combinations of converting one programming language to another. One combination that worked OK, with some manual corrections, was Common Lisp to Clojure. I think Python to Common Lisp worked OK for pure code

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

#94

Also had it hallucinate absolute garbage from time to time. The worst offender, that consistently shows up: Claiming there are certain library features, when there are not. Easily the best rubber ducky though. Copy pasting big blocks of my own code and asking about it gives new perspectives to problems I am stuck on. Huge time saver in that regard.

I’ve been very happy with most questions and coding queries. The worst results I’ve got were ones related to external libraries. We use Telerik UI for Xamarin components and Telerik has similar libraries for ASP.net, WinUI, JavaScript, etc. and the controls often have the same in different libraries and different methods and properties. Try as I might to steer it, it has yet to produce any code using these components that doesn’t mix methods. And as others have said, it will argue with you about those features or it will say “Sorry, that method is for the WinUI version. Here’s a corrected version:” and then make the same mistake again.

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

#95
This one was using Bing AI chat:

I had a bunch of PDF files with coded file names, like ABC-123-abc-999-001.pdf, where each section of the file name was meaningful. Inside the PDF were several form fields. I needed to insert records in a database for each of the 97 files. Easy, but tedious.

I prompted it with a description of the file name breakdown, where the text to grab was in the PDF, and then asked for a Python program to find the files (in subdirectories), extract the PDF text, and write a text file with the SQL Insert statements for all the files.

It took two or three minor iterations, but less time than it would have taken me to write from scratch because my Python is rusty. Regular expressions, PDF processing libs, file system traversal, and SQL generation, and it all compiled and worked from the start (the iterations were to tweak a few things I didn’t specify).

This is the kind of thing that I think is perfect for these tools. With the new tools that let the LLM compile and execute code, it will be cool (and potentially dangerous).

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

#96
One of the first things I tried (which I thought would be harder) was “Write a Python program that accepts a YouTube url and a start and stop time in the form MM:SS and a file name and it extracts the video between those times and converts it to an animated gif. Also provide a list of packages to be installed.”

The resulting code worked. Took an interaction or two to add usage info and tweak things, but it’s a neat little utility. Due to the libraries used, it was also simpler than I expected and would have been easy to write if I knew about those libs, so I also learned something.

It’s just one or two steps away from just saying “Go to this YouTube URL and extract the video between 3:20 and 3:27 into an animated GIF named ‘CatAndRaccoon.gif’” and having it write, debug, and execute the code.

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

#98
I use it to get more programming done, and take care of all the things that comes in the way:

A big client asked us to fill around 200 questions in an excel sheets, regarding our company security.

Then he asked for a cybersecurity standard document (like a big thing around 50 pages)

I took the previous excel sheet, removed noise, anonimized it. The n pass it to gpt3.5 to summarize for each security category (access management, code source security,...) the bulletpoints answering how do we implement that

To finish, I passed the bulletpoints for each category to gpt4, to write a nice bullshit document which sound more professional than me

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

#99
Charts on charts on charts

I've converted from an excel wiz to python, but making charts was always the bane of my existence in python, until GPT. And I personally use 3.5 more than 4 because of the speed, but I used 4 when I need something critical or I know I need it to balance multiple thoughts.

Post reply on HN