Scripting is a form of programming generally characterized by low formality, loose typing, and no requirement for explicit compilation. There are numerous scripting languages, and these are used in a wide variety of scenarios - command-line applications, GUIs, server-side applications, extension ...
111
votes
17answers
190k views
How can you find and replace text in a file using the Windows command-line environment?
I am writing a batch file script using Windows command-line environment and want to change each occurrence of some text in a file (ex. "FOO") with another (ex. "BAR"). What is the simplest way to do ...
308
votes
18answers
322k views
How do I split a string on a delimiter in bash?
How do I split a string based on a delimiter in Bash?
I have this string stored in a variable:
IN="[email protected];[email protected]"
Now I would like to split the strings by ';' delimiter so that I have
...
216
votes
19answers
90k views
What is the difference between a method and a function
I am a long-time Applescript user and new shell scripter who wants to learn a more general scripting language like Javascript or Python for performance reasons.
I am having trouble getting my head ...
62
votes
19answers
39k views
Is there a simple script to convert C++ enum to string?
Suppose we have some named enums:
enum MyEnum {
FOO,
BAR = 0x50
};
What I googled for is a script (any language) that scans all the headers in my project and generates a header with one ...
4
votes
4answers
6k views
Arrays, linked lists and other data structures in cmd.exe (batch) script
I was playing with cmd.exe, but in its help I didn't find any info, how to define arrays.
I have found, how to define simple variables:
set a = 10
echo %a%
But, I want to create arrays, linked ...
31
votes
4answers
44k views
How to execute an .SQL script file using c#
I'm sure this question has been answered already, however I was unable to find an answer using the search tool.
Using c# I'd like to run a .sql file. The sql file contains multiple sql statements, ...
66
votes
36answers
15k views
When is a language considered a scripting language?
What makes a language a scripting language? I've heard some people say "when it gets interpreted instead of compiled". That would make PHP (for example) a scripting language. Is that the only ...
35
votes
10answers
38k views
In SQL Server, how do I generate a CREATE TABLE statement for a given table?
I've spent a good amount of time coming up with solution to this problem, so in the spirit of this post, I'm posting it here, since I think it might be useful to others.
If anyone has a better ...
26
votes
23answers
50k views
Loading .sql files from within PHP
I'm creating an installation script for an application that I'm developing and need to create databases dynamically from within PHP. I've got it to create the database but now I need to load in ...
99
votes
9answers
47k views
How do I create a nice-looking DMG for Mac OS X using command-line tools?
I need to create a nice installer for a Mac application. I want it to be a disk image (DMG), with a predefined size, layout and background image.
I need to do this programmatically in a script, to be ...
43
votes
6answers
42k views
How do I write a bash script to restart a process if it dies?
I have a python script that'll be checking a queue and performing an action on each item:
# checkqueue.py
while True:
check_queue()
do_something()
How do I write a bash script that will check ...
47
votes
7answers
18k views
Is there a jQuery autogrow plugin for text fields?
I have a found various plugins for autogrowing a textarea, but not input text fields. Does anybody know if any exist?
403
votes
129answers
35k views
Stopping scripters from slamming your website hundreds of times a second
[update] I've accepted an answer, as lc deserves the bounty due to the well thought-out answer, but sadly, I believe we're stuck with our original worst case scenario: CAPTCHA everyone on purchase ...
55
votes
18answers
46k views
URLEncode from a bash script
I am trying to write a bash script for testing that takes a parameter and sends it through curl to web site. I need to url encode the value to make sure that special characters are processed ...
20
votes
10answers
16k views
How can I run a PHP script in the background after a form is submitted?
Problem
I have a form that, when submitted, will run basic code to process the information submitted and insert it into a database for display on a notification website. In addition, I have a list of ...