|
I've seen different developers include semicolons after functions in javascript and some haven't. Which is best practice?
function weLikeSemiColons(arg) { // bunch of code };
or
function unnecessary(arg) { // bunch of code }
Started by macca1 on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
Semicolons after function declarations (using the function statement ) are not necessary-colons in javascript?
Do you ....
DoSomething(); // function call } }
JS Lint is de-facto convention, and it says no semicolon after function body.
|
|
I'm writing an ASP.NET application. When a specific kind of request is being handled, I want to schedule a method to be called in a certain number of minutes after the request is handled. The postponed method does not need to communicate with the client...
Started by John Källén on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
In Application_BeginRequest) after checking that it is required for that request.
|
|
What are the first steps to getting back into programming after many years of tech support?
Started by davidsandey on
, 15 posts
by 15 people.
Answer Snippets (Read the full thread at stackoverflow):
Sometimes starting off slow and easy is the best way - start coding with a language you previously used years, so I know how you feel.....
After you start to get some confidence pick a reasonably small understandable open source.
Legs back.
|
Ask your Facebook Friends
|
What is the best way to run your suite of unit tests after each commit?
I'm particularly interested in the case that you do all of your features/changes in branches and keep your trunk stable.
My source control is SVN and I use tortoise SVN as my client...
Started by Brian R. Bondy on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
This will monitor svn....
Http://cruisecontrol.sourceforge.net/
You need a Continuous Integration Server like CruiseControl.
Check out Cruise Control - it can run the unit tests before deploying .
I would setup an automated build/deployment process as well.
|
|
Hey folks
I stumbled on a piece of Ajax code that is not 100% safe since it's mixing asynchronous/synchronous type of code... so basically in the code below I have a jQuery.each in which it grabs information on the elements and launch an Ajax get request...
Started by SBUJOLD on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Like this:
saveRecords(function(){ // Complete will fire after all requests have completed it like this:
saveRecords(function(error){ // This function will run on error or after all // commands of them at once and move //code to do after....
|
|
I need to build a little webapp but I'm not sure what is the best thing to do.
A person that subscribe the petition is signing an email sent to X . This will be also saved to a db in order to show online who subscribed.
The idea is to have a standard ...
Started by Andrea Ambu on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
That is already saturating the world to no good purpose, and you're asking how best to do it? I would read.
|
|
I'm trying to build a list that will be used as the in clause of a select statement. The requirement is to have the user enter a comma separated list of descriptions. Each description can contain spaces so I can't remove the spaces before splitting by...
Answer Snippets (Read the full thread at stackoverflow):
All instances of this....
As long as you cannot have embedded single quotes, the following should do the trick
Dim replaced = Regex.Replace(input, "'\s+", "'")
The regex string '\s+ will match any single quote followed by one or more white space characters .
|
|
Suppose I have a function that allocates memory for the caller:
int func(void **mem1, void **mem2) { *mem1 = malloc(SIZE); if (!*mem1) return 1; *mem2 = malloc(SIZE); if (!*mem2) { /* ... */ return 1; } return 0; }
I'd like to hear your feedback on the...
Started by Andrew Keeton on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
Then the caller can handle the error case:
void *mem1 = NULL; void *mem2 = NULL; if (func(&mem1, &mem2)) { freeAll(2, mem1, mem2); return 1; }
Does the caller... .
My own inclination is to create a variable argument function that frees all non-NULL pointers .
|
|
What is the best way to exit out of a loop as close to 30ms as possible in C++. Polling boost:microsec_clock ? Polling QTime ? Something else?
Something like:
A = now; for (blah; blah; blah) { Blah(); if (now - A > 30000) break; }
It should work on...
Started by Neil G on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
See QueryPerformanceCounter and QueryPerformanceFrequency The code snippet example in this link pretty much does what you want:
http://www.cplusplus.com/reference/clibrary/ctime/clock/
Adapted from their example:
void runwait ( int seconds ) { clock_... .
|
|
My C# WinForms UI has some parameters that the user can adjust using sliders. Many parts of the UI can interactively update based on the slider values. However, some parts require a longer calculation that requires some overhead to set up. I would like...
Started by Eric on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
The timer would also check a variable that is flagged after.
Anything has changes after 2 seconds.
|