Read whole ASCII file into C++ std::string [duplicate]

Read whole ASCII file into C++ std::string [duplicate]

This question already has an answer here: What is the best way to read an entire file into a std::string in C++? 11 answers I need to read a whole file

Natural Sort Order in C#

Natural Sort Order in C#

Anyone have a good resource or provide a sample of a natural order sort in C# for an FileInfo array? I am implementing the IComparer interface in my sorts. 1:The easiest thing to do is just P/Invoke the built-in function in Windows, and

How do I format a Microsoft JSON date?

How do I format a Microsoft JSON date?

I'm taking my first crack at Ajax with jQuery. I'm getting my data onto my page, but I'm having some trouble with the JSON data that is returned for Date data types. Basically, I'm getting a string back that looks like this:/Date(1224043200

Scanner is skipping nextLine() after using next() or nextFoo()?

Scanner is skipping nextLine() after using next() or nextFoo()?

I am using the Scanner methods nextInt() and nextLine() for reading input. It looks like this:System.out.println("Enter numerical value"); int option;option = input.nextInt(); // Read numerical value from inputSystem.out.println("Enter 1

JSON Parse File Path

JSON Parse File Path

I'm stuck trying to get the correct path to the local file. I have the following directories:Resources -> data -> file.json js -> folder -> script.js html -> folder -> file1.htmlI'm executing script.js fr

PHP Script to populate MySQL tables

PHP Script to populate MySQL tables

Is anyone aware of a script/class (preferably in PHP) that would parse a given MySQL table's structure and then fill it with x number of rows of random test data based on the field types? I have never seen or heard of something like this an

maven install error - only whitespace content allowed before start tag and not \\u0

maven install error - only whitespace content allowed before start tag and not \\u0

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install (default-install) on project ecommerce-web: Failed to install metadata com.app:ecommerce-web/maven-metadata.xml: Could not parse metadata C:\Users\ad

How do I create a CSV file using Perl?

How do I create a CSV file using Perl?

I want to create a CSV file using Perl and write some data to it. Is there any way to do that? 1:You could use Class:CSV.use Class::CSV;my $csv = Class::CSV->new( fields => [qw/userid username/]);$csv->add_line([2063, 'testuser'

How do I cast generic enum to int?

How do I cast generic enum to int?

I have a small method that looks like this:public void SetOptions() where T : Enum{ int i = 0; foreach (T obj in Enum.GetValues(typeof(T))) { if (i == 0) DefaultOption = new ListItem(obj.Description(), obj.ToStrin

How do I safely join relative url segments?

How do I safely join relative url segments?

I'm trying to find a robust method of joining partial url path segments together. Is there a quick way to do this?I tried the following:puts URI::join('resource/', '/edit', '12?option=test')I expect:resource/edit/12?option=testBut I get the

How does one declare the type of an Android preference?

How does one declare the type of an Android preference?

I have a preferences.xml that looks like this: When I do sp.getString("sample", "3.0"), it works fine and returns a string, but it shouldn't be a string, it should be a float. Running sp.getFloat("sample", 3.0f) throws a ClassCastException

Android get JSON key value

Android get JSON key value

I have question about parsing a specific json string. I didn't find anything which helps me in my situation. I have this json :{"AM": { "country_name": "Armenia", "data": { "180854": { "time_published": "2012-03-30

Split/explode comma delimited string with Sybase SQL Anywhere [duplicate]

Split/explode comma delimited string with Sybase SQL Anywhere [duplicate]

This question already has an answer here: How do I split a string so I can access item x? 40 answers UPDATE: Someone marked this question as du

Javascript Convert PHP Json into a javascript array

Javascript Convert PHP Json into a javascript array

So hi guys,lets make this very clear. In php i used json_encode(...) and then got the value in javascript, looks as the following:["float","float","float","float"] // PS: This is a string...And i would like to make this into a normal javas

Ember.js Clone an existing record into the store

Ember.js Clone an existing record into the store

I am struggling with the concept Ember.js will like. What I want is the following. I have now an existing Ember Data model called Article. Lets say with the id of 1 will be shown on /article/1.When the user hit the New button they are trans

Export data from DynamoDB

Export data from DynamoDB

Is it possible to export data from DynamoDB table in some format?The concrete use case is that I want to export data from my production dynamodb database and import that data into my local dynamodb instance so my application can work with l

Java API for SRT subtitles [closed]

Java API for SRT subtitles [closed]

Is there any Java API for SRT subtitles ? 1:The actual SRT parsing is performed through regular expressions, which Java is able to manipulate.The actual regexp is:protected static final String nl = "\\\n";protected static final String sp

ElasticSearch: No filter registered for [match]]

ElasticSearch: No filter registered for [match]]

I'm trying to do this query to my ElasticSearch Server.{ "query" : { "match" : { "name" : "network" } }, "facets" : { "departments" : { "terms" : { "field" : "department

Netty Client to Server message

Netty Client to Server message

This is actually my first post on here and I have been trying to figure this out for some time but I am finally calling in the flag and going to try to get some help on this topic.So I have a Client and a Server that was modeled after the e

How do I create an XPath function in Groovy

How do I create an XPath function in Groovy

I'm trying to create a function in Groovy that does the following:Accepts 2 parameters at runtime (a string of XML, and an xpath query)Returns the result as textThis is probably quite straightforward but for two obstacles:This has to be don

JSON Parsing in android - from resource folder

JSON Parsing in android - from resource folder

I've a kept one text file in res/raw folder in eclipse. I am showing here the content of that file: { "Categories": { "Category": [ { "cat_id": "3", "cat_name": "test" },

XPath: Is there a way to set a default namespace for queries?

XPath: Is there a way to set a default namespace for queries?

Is there a way to set Java's XPath to have a default namespace prefix for expressons? For example, instead of: /html:html/html:head/html:title/text()", the query could be: /html/head/title/text()While using the namespace prefix works, there

Send Post Request in Scrapy

Send Post Request in Scrapy

I am trying to crawl latest reviews from google play store but I need to make a post request to get the latest reviews.With the Postman it works and I get desired response.but a post request in terminal gives me a server errorFor ex: for th

How can one determine the current region within an AWS Lambda function?

How can one determine the current region within an AWS Lambda function?

Regions.getCurrentRegion() returns null from within an AWS Lambda function. It seems that Regions.getCurrentRegion() is not supported from within an AWS Lambda function. Is there an alternative way to determine which region the lambda fun

PHP namespace PDO not found

PHP namespace PDO not found

I'm facing an issue I unfortunatly could not resolve so far. I created a database class into app/db/mysql/database.php with the following content : getMessage()); } } public static function get(){ if( sel