Prompt Dialog in Windows Forms

You need to create your own Prompt dialog. You could perhaps create a class for this. public static class Prompt { public static string ShowDialog(string text, string caption) { Form prompt = new Form() { Width = 500, Height = 150, FormBorderStyle = FormBorderStyle.FixedDialog, Text = caption, StartPosition = FormStartPosition.CenterScreen }; Label textLabel = new … Read more

OpenAI ChatGPT (GPT-3.5) API error 429: “You exceeded your current quota, please check your plan and billing details” [closed]

TL;DR: To upgrade to a paid plan, set up a paid account, add a credit or debit card, and generate a new API key if your old one was generated before the upgrade. Problem As stated in the official OpenAI documentation: TYPE OVERVIEW RateLimitError Cause: You have hit your assigned rate limit. Solution: Pace your … Read more

using the browser prompt to download a file

The PHP documentation provides a nice example: <?php $file=”monkey.gif”; if (file_exists($file)) { header(‘Content-Description: File Transfer’); header(‘Content-Type: application/octet-stream’); header(‘Content-Disposition: attachment; filename=”.basename($file)); header(“Content-Transfer-Encoding: binary’); header(‘Expires: 0’); header(‘Cache-Control: must-revalidate’); header(‘Pragma: public’); header(‘Content-Length: ‘ . filesize($file)); ob_clean(); flush(); readfile($file); exit; } ?> EDIT (Response to comment, explanation) header(‘Content-Description: File Transfer’); Do not display in the browser, but transfer the … Read more

How can I make an expect script prompt for a password?

Use expect’s stty command like this: # grab the password stty -echo send_user — “Password for $user@$host: ” expect_user -re “(.*)\n” send_user “\n” stty echo set pass $expect_out(1,string) #… later send — “$pass\r” Note that it’s important to call stty -echo before calling send_user — I’m not sure exactly why: I think it’s a timing … Read more

Bash prompt with the last exit code

As you are starting to border on a complex PS1, you might consider using PROMPT_COMMAND. With this, you set it to a function, and it will be run after each command to generate the prompt. You could try the following in your ~/.bashrc file: PROMPT_COMMAND=__prompt_command # Function to generate PS1 after CMDs __prompt_command() { local … Read more

Why is this bash prompt acting strangely/disappearing, and how do I fix it (OS X)?

It sounds like this should solve your problem. This seems to work for me*: export PS1=’–(\[\e[$((32-${?}))m\]\u\[\e[0m\])-(\[\e[$((32-${?}))m\]\d\[\e[0m\]|\[\e[$((32-${?}))m\]\T\[\e[0m\])–(\[\e[$((32-${?}))m\]\w\[\e[0m\] \$ ‘ * well, really export PS1=’\u@\h:\w\$ ‘ works for me To quote the linked post, the answer lies in adding \[ and \] around all of your color sequences in your PS1 declaration: Before I had the following … Read more