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

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

Detecting Unsaved Changes

Using jQuery: var _isDirty = false; $(“input[type=”text”]”).change(function(){ _isDirty = true; }); // replicate for other input types and selects Combine with onunload/onbeforeunload methods as required. From the comments, the following references all input fields, without duplicating code: $(‘:input’).change(function () { Using $(“:input”) refers to all input, textarea, select, and button elements.

Sum of two numbers with prompt

The function prompt returns a string and + is (unwisely, perhaps) used for both string concatenation and number addition. You do not “specify types” in JavaScript but you can do string to number conversion at run time. There are many ways to so this. The simplest is: var a = +prompt(“Enter first number”); var b … Read more

tech