What does “use strict” do in JavaScript, and what is the reasoning behind it?

What does “use strict” do in JavaScript, and what is the reasoning behind it?

Recently, I ran some of my JavaScript code through Crockford's JSLint, and it gave the following error: Problem at line 1 character 1: Missing "use strict" statement.Doing some searching, I realized that some people add "use strict"; into

Cannot start MongoDB: System error 1067 in Windows

Cannot start MongoDB: System error 1067 in Windows

After setting up MongoDB service on Windows Server 2008 R2 this error was raised. C:\mongodb\bin>net start MongoDBThe Mongo DB service is starting.The Mongo DB service could not be started.A system error has occurred.System error 1067 has o

Can an XOR linked list be implemented in C++ without causing undefined behavior?

Can an XOR linked list be implemented in C++ without causing undefined behavior?

An XOR linked list is a modified version of a normal doubly-linked list in which each node stores just one "pointer" instead of two. That "pointer" is composed of the XOR of the next and previous pointers. To traverse the list, two pointe

Is there a Scala unit test tool that integrates well with Maven?

Is there a Scala unit test tool that integrates well with Maven?

My company is beginning to write some code using Scala. I've been moved onto this project, and am a big fan of TDD, so I would like to get a unit-testing framework in place. However, the build system we're using for this project is Maven,

How can I check if I'm on the last element when iterating using foreach syntax [duplicate]

How can I check if I'm on the last element when iterating using foreach syntax [duplicate]

This question already has an answer here: Printing lists with commas C++ 23 answers For example:for( auto &iter: item_vector ) { if(not_on_the_last

AngularJS: “Error: Unexpected call to method or property access.undefined” only in IE 8

AngularJS: “Error: Unexpected call to method or property access.undefined” only in IE 8

Have you ever had the error "Error: Unexpected call to method or property access.undefined" only IE8? What was causing it? How did you solve it?-- Note: It assumes the same code works fine in Chrome, Firefox, SafariEdit: ContextI'm building

Alternative to setAlpha in api level 8

Alternative to setAlpha in api level 8

I am working on an app, which can run on Froyo as well as JellyBean. I have a class that extends PageTransformer as below:import android.support.v4.view.ViewPager.PageTransformer;import android.view.View;public class ZoomOutPageTransformer

Multiple conditions in a C 'for' loop

Multiple conditions in a C 'for' loop

I came across this piece of code. I generally use '&&' or '||' to separate multiple conditions in a for loop, but this code uses commas to do that.Surprisingly, if I change the order of the conditions the output varies.#includeint main() {

How to find duplicates in a list?

How to find duplicates in a list?

I have a list of unsorted integers and I want to find those elements which have duplicates.val dup = List(1,1,1,2,3,4,5,5,6,100,101,101,102)I can find the distinct elements of the set with dup.distinct, so I wrote my answer as follows.val d

React onClick and preventDefault() link refresh/redirect?

React onClick and preventDefault() link refresh/redirect?

I'm rendering a link with react:render: -> `upvote`Then, above I have the upvote function:upvote: -> // do stuff (ajax)Before link I had span in that place but I need to switch to link and here's the trouble - every time I click on .upvot

How to scroll “infinitely” wide view in Android?

How to scroll “infinitely” wide view in Android?

I am pondering the alternatives on how to scroll an "infinite", scale-like, control in android. The simple idea is to redraw the entire view on each scroll movement, but somehow it doesn't seem like the proper way. It is possible to draw th

Need Profile for Mono 3.0 on Windows

Need Profile for Mono 3.0 on Windows

Is there a tutorial that tells how to write a profile for mono 3.0 so that I can use it with Microsoft Visual studio 2010 ? The reason behind the same is that my application makes use of a Binding List and when I try to run in Mono , I get

AvalonDock DockingManager does not load layout

AvalonDock DockingManager does not load layout

In order to save and load my layout I followed the instructions here, but it didn't work for me.I've got this XAML inside the MainWindow:

Is there a better way to get ClientID's into external JS files?

Is there a better way to get ClientID's into external JS files?

I know this has been asked before, but I've found a different way to get references to controls in external JS files but I'm not sure how this would go down in terms of overall speed.My code ispublic static void GenerateClientIDs(Page page,

Prevent IIS from killing a Task before it ends

Prevent IIS from killing a Task before it ends

I'm building a Logging library that stores everything on an Azure table. Writing to that table obviously takes a lot of time (never more than 1 sec, but it's still too much to make the user wait), so Log method returns a LogResult instance,

Using ansible to manage disk space

Using ansible to manage disk space

Simple ask: I want to delete some files if partition utilization goes over a certain percentage.I have access to "size_total" and "size_available" via "ansible_mounts". i.e.:ansible myhost -m setup -a 'filter=ansible_mounts'myhost | succes

How can I get a string from input without including a newline using fgets? [duplicate]

How can I get a string from input without including a newline using fgets? [duplicate]

This question already has an answer here: Removing trailing newline character from fgets() input 13 answers I'm trying to write an inputted string else

Finding the smallest circle that encompasses other circles?

Finding the smallest circle that encompasses other circles?

If a circle is defined by the X, Y of it's center and a Radius, then how can I find a Circle that encompasses a given number of circles? A single circle that is the smallest possible circle to completely contain 2 or more circles of any siz

Why does the defaultWriteObject function have to be called first when writing into an ObjectOutputSt

Why does the defaultWriteObject function have to be called first when writing into an ObjectOutputSt

When I read the about the Serializable interface in Thinking in java, there is a sentence that says: If you use the default mechanism to write the non-transient parts of your object, you must call defaultWriteObject( ) as the first operati

How to use C source files in a C++ project?

How to use C source files in a C++ project?

In a C++ project, including .h files of C source files will cause many errors because of different standards between C and C++.How to use C source files in a C++ project (or in main.cpp)? 1:For the maximum reliability:Compile the C sourc

Can I host images in heroku? Or do I need S3?

Can I host images in heroku? Or do I need S3?

I'm deploying my web app (it's for a corporate client). So, users will not add images, but only the business will. I've deployed to Heroku, and my images are still showing. When do I need to use S3? Ill have like 100 images in total in the

How to get TextWidth of string (without Canvas)?

How to get TextWidth of string (without Canvas)?

I would like to get text width of a string before an application starts. Everything works fine until Application.MainForm canvas present. The problem is, when I try dynamically create TOrdinarium in the OnCreate event of the app. main form,

Need a tutorial for using GHC to parse and typecheck Haskell

Need a tutorial for using GHC to parse and typecheck Haskell

I'm working on a project for analyzing Haskell code. I decided to use GHC to parse the source and infer types rather than write my own code to do that. Right now, I'm slogging through the Haddock docs, but it's slow going. Does anyone kn

Can a void-returning function g return f(); when f returns void?

Can a void-returning function g return f(); when f returns void?

Consider the following snippet:void f(void);void g(…){ … return f(); …}Is this return f(); valid according to C11?I am not advocating using this pattern: if it works at all, it is obviously equivalent to f(); return; (where the return; i

Why does .Net use a rounding algorithm in String.Format that is inconsistent with the default Math.R

Why does .Net use a rounding algorithm in String.Format that is inconsistent with the default Math.R

I've noticed the following inconsistency in C#/.NET. I was wondering why it is so.Console.WriteLine("{0,-4:#.0} | {1,-4:#.0}", 1.04, Math.Round(1.04, 1));Console.WriteLine("{0,-4:#.0} | {1,-4:#.0}", 1.05, Math.Round(1.05, 1));Console.Write