Why does reading a record struct fields from std::istream fail, and how can I fix it?

Why does reading a record struct fields from std::istream fail, and how can I fix it?

Suppose we have the following situation:A record struct is declared as follows struct Person { unsigned int id; std::string name; uint8_t age; // ...};Records are stored in a file using the following format:ID Forename Las

Why does std::getline() skip input after a formatted extraction?

Why does std::getline() skip input after a formatted extraction?

I have the following piece of code that prompts the user for their name and state:#include #include int main(){ std::string name; std::string state; if (std::cin >> name && std::getline(std::cin, state)) {

PHP mail function doesn't complete sending of e-mail

PHP mail function doesn't complete sending of e-mail

<?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $from = 'From: yoursite.com'; $to = '[email protected]'; $subject = 'Customer Inquiry'; $body = "From: $name\n E-Mail: $email

Strings don't seem to be equal in Java on Android, even though they print the same

Strings don't seem to be equal in Java on Android, even though they print the same

I've got a problem that I'm rather confused about. I have the following lines of code in my android application:System.out.println(CurrentNode.getNodeName().toString());if (CurrentNode.getNodeName().toString() == "start") { System.out.pr

In C++11, can the characters in the array pointed to by string::c_str() be altered?

In C++11, can the characters in the array pointed to by string::c_str() be altered?

std::string::c_str() returns a pointer to an array that contains a null-terminated sequence of characters (i.e., a C-string) representing the current value of the string object.In C++98 it was required that "a program shall not alter any of

What's the regex to match anything except a double quote not preceded by a backslash?

What's the regex to match anything except a double quote not preceded by a backslash?

In other words, I have a string like:"anything, escaped double-quotes: \", yep" anything here NOT to be matched.How do I match everything inside the quotes?I'm thinking^"((?But my head spins, should that be a positive or a negative lookbehi

What is producing “TypeError character mapping must return integer…” in this python code?

What is producing “TypeError character mapping must return integer…” in this python code?

please, can someone help me with the code bellow?When I run it the logs said: return method(*args, **kwargs) File "C:\Users\CG\Documents\udacity\rot13serendipo\main.py", line 51, in post text = rot13(text) File "C:\Users\CG\Documents\u

ack-grep: chars escaping

ack-grep: chars escaping

My goal is to find all "" occurrences with ack. How can I do that?ack "Doesn't work. Please tell me how can I fix escaping here? 1:Since ack uses Perl regular expressions, your problem stems from the fact that in Perl RegEx language, ? i

Escape pound or number sign in Github issue tracker

Escape pound or number sign in Github issue tracker

If I type #1 when creating an Issue in Github, it will reference to Issue ID 1. Is there a way to avoid this by escaping the # sign? I just need it to be regular text. 1:TL;DR—my personal favouriteseither type#1or#1or#1In the lat

jQuery or JavaScript equivalent of PHP strpos function to find string on a page

jQuery or JavaScript equivalent of PHP strpos function to find string on a page

Is there an equivalent function in JavaScript or jQuery similar to strpos in PHP?I want to locate a string inside an element on a page. The string I'm looking for is: td class="SeparateColumn"I would like something where I can run it like t

How do I query for fields containing a given text in MySQL?

How do I query for fields containing a given text in MySQL?

SELECT stuff REGEXP 'itunes' as is_itunes;In this MySQL query, if "stuff" has the word "itunes" in it, it will mark it as itunes.However, I want to say "begin with". How can I check for "begin with" instead of anywhere in the text? 1:SEL

Rd file name conflict when extending a S4 method of some other package

Rd file name conflict when extending a S4 method of some other package

Actual questionHow do I avoid Rd file name conflicts when a S4 generic and its method(s) are not necessarily all defined in the same package (package containing (some of) the custom method(s) depends on the package containing the generic) a

Variable assignment within a for-loop [duplicate]

Variable assignment within a for-loop [duplicate]

Possible Duplicate: R: How to convert string to variable name? In R, I'm writing a for-loop that will iteratively create variable names and then assign values to each variable.Here is a simplified version. The intention is to create the v

Dealing with readLines() function in R

Dealing with readLines() function in R

I'm experiencing a very hard time with R lately.I'm not an expert user but I'm trying to use R to read a plain text (.txt) file and capture each line of it. After that, I want to deal with those lines and make some breaks and changes in the

How can I get the real time in iPhone, not the time set by user in Settings?

How can I get the real time in iPhone, not the time set by user in Settings?

I need to ensure that my app gets the correct time, not the time set by the user in settings.So for instance, once the user starts the app, I'd want to get a timestamp. The user would see the elapsed time on a timer on screen updated every

How can I use one file from my project in another file?

How can I use one file from my project in another file?

Simple question. I'm new to Clojure.How can I use one file from my project in another file? Basically how can I include, import, or require another file? Not from libraries but fro my own code.Thanks,Alex 1:Normally you'll want to use

Unicode normalization (form C) in R : convert all characters with accents into their one-unicode-cha

Unicode normalization (form C) in R : convert all characters with accents into their one-unicode-cha

In Unicode, letters with accents can be represented in two ways: the accentuated letter itself, and the combination of the bare letter plus the accent. For example, é (+U00E9) and e´ (+U0065 +U0301) are usually displayed in the same way.R r

compile-time string hashing

compile-time string hashing

I need to use a string as the ID to obtain some object. At implement this in a run-time, and works well. But this makes the static type checking impossible, for obvious reasons.I've Googled for the algorithm for calculating the hash-sum of

Plotting xyplot with regression line on lattice graphics

Plotting xyplot with regression line on lattice graphics

I have loaded the lattice package. Then I run:> xyplot(yyy ~ xxx | zzz, panel = function(x,y) { panel.lmline(x,y)}This produces panels of plot, showing the regression line, without the xyplots. I am doing the panel.lmline without fully unde

Arabic language in php/mysql appears “????” question marks in html [duplicate]

Arabic language in php/mysql appears “????” question marks in html [duplicate]

Possible Duplicate: Save Data in Arabic in MySQL database I have a problem with retrieving Arabic data from MYSQL database using PHP, it appears as question marks "????" in HTML:I have a database with "utf8_general_ci" as collation.The da

System.Text.Encoding.GetEncoding(“iso-8859-1”) throws PlatformNotSupportedException?

System.Text.Encoding.GetEncoding(“iso-8859-1”) throws PlatformNotSupportedException?

See subject, note that this question only applies to the .NET compact framework. This happens on the emulators that ship with Windows Mobile 6 Professional SDK as well as on my English HTC Touch Pro (all .NET CF 3.5). iso-8859-1 stands for

How to copy a string using a pointer

How to copy a string using a pointer

Here's a program I wrote to copy a string constant.When the program is run it crashes. Why is this happening ?#include char *alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";char c;char *l;main(){ while((c = *alpha++)!='\0') *l++ = *alpha; pr

pandoc “cannot parse yaml header” when converting md to pdf

pandoc “cannot parse yaml header” when converting md to pdf

I am trying to convert a markdown document to pdf using pandoc, and it was working fine until it just started to show an error:pandoc: Could not parse YAML header: did not find expected alphabetic or numeric character "source" (line 32, col

SQL: how to get all the distinct characters in a column, across all rows

SQL: how to get all the distinct characters in a column, across all rows

Is there an elegant way in SQL Server to find all the distinct characters in a single varchar(50) column, across all rows?Bonus points if it can be done without cursors :)For example, say my data contains 3 rows:productname-----------produc

Removing \\u2018 and \\u2019 character

Removing \\u2018 and \\u2019 character

I am using Beautiful Soup to parse webpages and printing the name of the webpages visited on the terminal. However, often the name of the webpage has single right (\u2018) and left(\u2019) character which the python can't print as it gives