Segmentation fault on large array sizes

Segmentation fault on large array sizes

The following code gives me a segmentation fault when run on a 2Gb machine, but works on a 4GB machine.int main(){ int c[1000000]; cout << "done\n"; return 0;}The size of the array is just 4Mb. Is there a limit on the size of an array

What is the difference between ++i and i++?

What is the difference between ++i and i++?

In C, what is the difference between using ++i and i++, and which should be used in the incrementation block of a for loop? 1:++i will increment the value of i, and then return the incremented value. i = 1; j = ++i; (i is 2, j is 2)i++ w

Recursively create directory

Recursively create directory

Does anyone know how to use Java to create sub-directories based on the alphabets (a-z) that is n levels deep? /a /a /a /b /c .. /b /a /b .. .. /a /b /c .

How can I get my jasmine tests fixtures to load before the javascript considers the document to be “

How can I get my jasmine tests fixtures to load before the javascript considers the document to be “

I am fairly certain that the issue is that the jquery bindings set to run on $(document).ready do not have the fixture html available to them. So when my events occur that are intended to make a change to the DOM via a jquery function, not

Persisting SCSS variables in rails asset pipeline?

Persisting SCSS variables in rails asset pipeline?

I'm upgrading a rails app with lots of SCSS stylesheets to use the asset pipeline, and need to include some global variables and mixins for each file.Adding several @import directives at the top of every file isn't very DRY, so I'd like to

uncaught throw :warden in Devise Testing

uncaught throw :warden in Devise Testing

I have just begun with testing Devise. I am unable to understand of why i am getting this error :: Failure/Error: subject.current_user.should_not be_nil ArgumentError: uncaught throw :wardenThis is the code in my spec :: require "spec

Node.js Download File Using Content Disposition as Filename

Node.js Download File Using Content Disposition as Filename

I'm using the Request module to download files, but I'm not quite sure how to pipe the response to an output stream when the filename must come from the 'Content-Disposition' header. So basically, I need to read the response until the heade

CA1500 vs. SA1309 - Which one wins?

CA1500 vs. SA1309 - Which one wins?

I'll prefix by saying that I understand that both Code Analysis and StyleCop are meant as guidelines, and many people chose to ignore these anyway. But having said that, I'd like to see what the general consensus is with regard to these tw

Understanding why “pimp my library” was defined that way in Scala

Understanding why “pimp my library” was defined that way in Scala

If I want to add a method to a class in Scala, I need to do something like:class RichFoo(f: Foo) { def newMethod = f.bar()}object RichFoo { implicit def foo2Rich(f: Foo) = new RichFoo(f)}Then f.newMethod will result in creation of RichFoo

Validation failed Class must exist

Validation failed Class must exist

I have been (hours) trouble with associations in Rails. I found a lot of similar problems, but I couldn't apply for my case:City's class:class City User's class:class User Users Controller:def create Rails.logger.debug user_params.inspec

Matplotlib requirements with pip install in virtualenv

Matplotlib requirements with pip install in virtualenv

I have a requirements.txt file like this:numpymatplotlibWhen I try pip install -r requirements.txt inside a new virtualvenv, I get this:REQUIRED DEPENDENCIES numpy: no * You must install numpy 1.1 or later to

How to convert a swift String to CFString

How to convert a swift String to CFString

How can i create a CFString from a native swift String or NSString in swift let path:String = NSBundle.mainBundle().pathForResource(name.stringByDeletingPathExtension, ofType:"pdf") let string:CFString = ??? path let url:CFURLRef =

Run a NodeJS app with Apache

Run a NodeJS app with Apache

I have a ubuntu server running a few apache websites. I want to run a nodejs app on the same server. I have the app running on the server now out of port 3000 (www.example.com:3000) no problems there.I now want to direct a new domain to the

Html parsing with JSoup

Html parsing with JSoup

I am trying to parse the html of the following URL:http://ocw.mit.edu/courses/aeronautics-and-astronautics/16-050-thermal-energy-fall-2002/to obtain the text of the "" tag which contains the name of an instructor. The required information i

Passing parent_id to a comment

Passing parent_id to a comment

In my app I have Posts which have comments. Now I also want to add comments to those comments (nested commenting).I currently do it like this, but it does not write my parent_id to the database:My comment link in my _comment.html.erb partia

Client Side Validations and Rails4

Client Side Validations and Rails4

I integrated client side validations with rails4 using the new branches available using the following gemsgem 'simple_form', '~> 3.0.0.rc'gem 'client_side_validations', github: "bcardarella/client_side_validations", :branch => "4-0-beta"gem

Scraping/Parsing Google search results in Ruby

Scraping/Parsing Google search results in Ruby

Assume I have the entire HTML of a Google search results page. Does anyone know of any existing code (Ruby?) to scrape/parse the first page of Google search results? Ideally it would handle the Shopping Results and Video Results sections

connecting datetimepicker to angularjs

connecting datetimepicker to angularjs

I need to create one input field with date and time using angular + bootstrap.I found this datetime picker it looks excatly i need - date and time in one field, and blocking user wrong editions.I writed a directive, datepickers started, but

http://localhost/phppgadmin/ -> 403 Forbidden

http://localhost/phppgadmin/ -> 403 Forbidden

I try to install postgreSql on my wampserverSo I follow some tutorial and some other...But when I access to localhost/phppgadmin/, an error occurs:ForbiddenYou don't have permission to access /phppgadmin/ on this server.Though I active php_

jQuery: Validate if one of many checkboxes is selected (different names, using the jQuery Validation

jQuery: Validate if one of many checkboxes is selected (different names, using the jQuery Validation

I have a form that has many checkboxes (too many for it to make sense to use their own rules), and I need to use the jQuery Validation Plugin to make sure at least one of them is selected. They all have different names, so most of the solu

Updated to OSX 10.9, now getting ruby error using homebrew

Updated to OSX 10.9, now getting ruby error using homebrew

Updated to Mavericks and updated Xcode. Now I am getting this error when trying to use brew. $ brew cleanup/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': /usr

Using LESS with node.js

Using LESS with node.js

Less is amazing and I want to use to node.js because using less.js is not a good performance. I testing purpos i'm using xamp on windows and I install node.js but where and what i should write.. I install express.js npm install -g express

How to update an “array of objects” with Firestore?

How to update an “array of objects” with Firestore?

I'm currently trying Firestore, and I'm stuck at something very simple: "updating an array (aka a subdocument)".My DB structure is super simple. For example:proprietary: "John Doe"sharedWith: [ {who: "[email protected]", when:timestamp}

How do I simulate a slow Meteor publication?

How do I simulate a slow Meteor publication?

I'm trying to simulate a publication doing a bunch of work and taking a long time to return a cursor.My publish method has a forced sleep (using a future), but the app always displays onlyLoading...Here's the publication:Meteor.publish('peo

Javascript event when mouse leaves browser window [duplicate]

Javascript event when mouse leaves browser window [duplicate]

This question already has an answer here: How can I detect when the mouse leaves the window? 16 answers I'd like some Javascript code to run when the m