C / C++ Question: Can someone PLEASE explain me why on Mother Earth I do get an error like error: no matching function for call to 'gethostbyname' here: dpaste.de/59nr ?
@skiwi I just have another note which says: note: candidate function not viable: no known conversion from 'value_type' (aka 'std::__1::basic_string<char>') to 'const char *' for 1st argument struct hostent *gethostbyname(const char *);
I am using below logic to search a phrase within a column "End phase". The data in the whole column identifies 9 phases from 1 to 9, each of these phases has to have phrase "end block". To split the data from 1 to 9 phases, I am using search and identify the phase ending.
But the current logic s...
I'm writing a program that needs to be compatible for both Python 2.X and Python 3.X. My problem is that, because of the differences between these two versions, I'm duplicating code. For example:
try:
### Python 2.X part
time.sleep(iterator.next())
if len(arguments) >= le...
template <class T, class F>
T copy_if(const T & cont, F && f) {
T result;
copy_if(cont.cbegin(), cont.cend(), std::back_inserter(result), std::forward<F>(f));
return result;
}
> Find element in range Returns an iterator to the first element in the range [first,last) for which pred returns true. If no such element is found, the function returns last.
If I'm finding an element, then no, I don't want the last element to be returned if it cannot find anything!
@Zeta do you know any fast alternative to this dpaste.de/0Had but without using that SFML thing ? I'm talking about the function which returns True if a port is opened and False otherwise
@Zeta Exactly. The purpose it's to come up with a simple function which behaves like the one I pasted above (returns True if a port is opened and False otherwise) ^^
I have the following async ActionResult.
public async Task<ActionResult> most_loved_pix()
{
var access_token = HttpContext.Items["access_token"].ToString();
if (!string.IsNullOrEmpty(access_token))
{
Account account = new Account();
...
You know, choosing a too ambitious first C++ program is like having to defend yourself in front of the Spanish inquisition, without actually knowing Spanish. You can just start talking and hope that they will spare you. Or you prepare yourself before you try to defend yourself.
I'm not sure there's a forum like that within the Stack Exchange system. The closest thing is the Code Review site but this isn't about code per-se, so... — tadman49 secs ago
stackoverflow is meant for specific questions with objective solutions. your code is syntactically correct and properly multiplies two arbitrary BigDecimal values together. if you want tips on how to improve your code, you should check out codereview.stackexchange.com — eiko26 secs ago
Don't give up yet. As I said, try to split the project into smaller parts. Build a proper serializer first. Or a table. Heck, even a single arbitrary-type cell can post a real challenge (if you want to use such a thing).
I am using below code to find a phrase "Phase End" in an excel column where the data exists from 1 to 9 phases. Problem is I can find phase 1 to 9 by its " Phase 1" "Phase 2" ... But all phases have the same ending phrases like "Phase End". When I do the search, is it possible to skip the ident...
I've never done concurrent programming before, but I've written one using go channels and RWMutex, but I'm not sure if my approach is idiomatic. I feel like it could all use channels (Maybe).
The protocol is simple: Messages are delimited by '\n'. The first message client sends is it's name. The...
hmm, when I'm creating a socket, can I declare it outside the for loop and for each connection in the for loop to reuse it ? (after I'm closing it at the end of the for loop, of course)
I'm looking for a JavaScript master, or aspiring master. I friend of mine is learning JavaScript. On that path, he developed a Trello clone using React, and now he feels kind of stuck, not knowing what would be a good logical next step toward mastery. What would you advise?
This looks fine to me; I wouldn't have problems with this at code review. Only comment would be naming - maybe getFirst? Also would need to document that it will throw something if the thing is empty - which brings me to my final point; this doesn't compile - missing the name on the interface declaration. — Boris the Spider50 secs ago
I am creating a system timer to track how long a user is on each page which is called a phase in my program.
I am currently working on checking whether a object in my timer array contains the phase name for checking if they had to go back a page and spent more time on it and add it on to what wa...
I'm trying to make the Academic Standing Calculator using HTML select box with options.The program should Display a list of the letter grades and their values and then save the selected values in the ArrayList as an object by clicking Save button, and after the user clicks "Done", the selected gr...
"I've a working solution, but I think it could be improved." Stack Overflow is primarily for questions about code that does not work. codereview.stackexchange.com might be a better place for your question, but you need to be more specific still. — Felix Kling21 secs ago
I have the following code in my application. Why do we use the const keyword with the return type and after the method name?
const T& data() const { return data_; }
I'm trying to implement Kruskal's algorithm. Here is a map of the structures I'm using:
g = array of edges, it keeps the left end and the right end and the edge's weight;
c = array which memorises the conex components; c[N] = the conex component in which we find the Nth vertex;
a = array which...
Consider asking this at CodeReview. Additionally, you may want to format this a bit better. — Santi7 secs ago
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.com — scsimon42 secs ago
I also voted to move this to code review. Regardless of where this question is asked it is lacking any kind of details to be able to help. Performance of this query would likely take several hours to even start getting a picture of what is going on. And that is sitting with the database in front of you. There are just so many things that it could be...indexing, fragmentation, stale statistics, blocking, non-sargable predicates...etc. Just getting an estimated execution plan would probably help to start but this is a big ask of anybody. — Sean Lange10 secs ago
I request that my code be reviewed for implementation and naming conventions.
public int KMP(String txt, String pat) {
int[] lcp = getlcp(pat);
int i = 0, j = 0;
while (i < txt.length() && j != pat.length()) {
if (txt.charAt(i) == pat.charAt(j)) {
j++;
}
...