Click here to Skip to main content
14,924,531 members

Comments by George Jonsson (Top 200 by date)

George Jonsson 25-Nov-17 11:20am View
   
I think the OP meant
6x - (y^2 - 1)/y
Pesky parenthesis and minus signs.

Still don't know what he wants to do, though. Parse the expression and simplify or what.
George Jonsson 25-Nov-17 11:14am View
   
Do you open the connection once in the beginning of the code and then keep sending requests without closing the connection?
Databases usually have a timeout that will prevent a connection to be kept open for too long.
A better approach is to
1. Connect
2. Get data
3. Close
4. Repeat
George Jonsson 25-Nov-17 10:54am View
   
Can you elaborate a little bit more about the problem you are trying to solve, as it is not crystal clear.
Shouldn't it be "3+7+6+9=25", if you want the highest score in each row?
George Jonsson 7-Aug-16 23:59pm View
   
Thanks a million. The change has to be made in hpptd.conf or .htaccess, but otherwise you were spot on.
I had to add the following lines inside the block <ifmodule mime_module="">
AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm
Then it worked like a charm.

You should submit this as an answer, so other people can benefit from it.
George Jonsson 6-Aug-16 20:39pm View
   
See my updated answer.
George Jonsson 6-Aug-16 4:01am View
   
This is not a question, but a code dump.
What kind of problem do you have and what kind of help do you need?
George Jonsson 5-Aug-16 23:19pm View
   
What kind of type is the variable da?
And what is not working? No data shown in the grid view?
George Jonsson 5-Aug-16 22:30pm View
   
What do you want to convert the dataset to?
A dataset is an XSD-file already.
George Jonsson 5-Aug-16 20:57pm View
   
Can you use characters and arrays?
George Jonsson 25-Jul-16 21:49pm View
   
See my updated answer.
George Jonsson 21-Jun-16 4:10am View
   
You are welcome.
You can probably cut that time too if you do some optimizations of the code.
George Jonsson 19-Jun-16 5:19am View
   
Another "programmer" trying to be clever.
This question is from Contest Page | CodeChef[^], so the little cheater wants someone to solve the problem for him.
And this is the second time the OP is doing this.
Why not start learning how to write code yourself?
George Jonsson 14-Jun-16 1:59am View
   
Not really clear what it is you want to do.
Do you have a database already? Mentioning an .mdf file indicates you are using SQL server in some way.
And why do you need a database per year for a small amount of data?
George Jonsson 14-Jun-16 1:51am View
   
See my updated answer. The article I have linked to might be of help.
George Jonsson 13-Jun-16 7:48am View
   
Sorry, my bad. I accidentally wrote Col2 instead of col2 inside the regular expression.
C# is a bit case sensitive.
See the updated solution.
George Jonsson 13-Jun-16 3:55am View
   
You mean error, I suppose.
Well, it is not easy to give any more help.
Have you tried to remove the code inside the constructor of class A?
Like this
A::A()
{
}
Because you create some new pointers there from unknown classes.
George Jonsson 12-Jun-16 23:23pm View
   
How did you compile your unmanaged DLL? As StdCall or Cdecl?
Just as an experiment set CallingConvention = CallingConvention.StdCall in your DllImport attribute.
George Jonsson 12-Jun-16 23:13pm View
   
Look for an oddly placed semicolon (;)
George Jonsson 12-Jun-16 21:56pm View
   
Of course it is not working. Where do you set the variable k?

Now it is time for you to start to think a bit on your own.
George Jonsson 12-Jun-16 20:47pm View
   
According to your previous question (How can I write a C program find the number of the winner?[^]) you need to find the max for both red and blue votes and then combine them into a number, like
Blue: 1 6 2 5 3 3 Max = 6
Red : 2 1 7 3 1 2 Max = 7
And the answer should be 67.
Or have I misunderstood completely?
George Jonsson 12-Jun-16 19:55pm View
   
From your previous question, my understanding was that you wanted to find the maximum in a one dimensional array, not a two dimensional.
George Jonsson 12-Jun-16 19:53pm View
   
After your change in the code it will not compile, because all paths doesn't have a return value.
George Jonsson 12-Jun-16 18:58pm View
   
Very subtle :)
George Jonsson 12-Jun-16 18:52pm View
   
printf returns the number of characters written, so this line will be confusing for you.
return(printf("No unique max."));
George Jonsson 12-Jun-16 18:48pm View
   
This is a very old question, and this answer doesn't add anything new or brilliant.
Better remove this answer before you get too many down votes.
George Jonsson 12-Jun-16 18:40pm View
   
Posting another question is the right thing to do.
Or better yet. Sit down and think about how you would find the maximum value in an array. And if you hit the same value twice, just use a counter.
George Jonsson 12-Jun-16 18:29pm View
   
Does the code work?
Learn to use memset instead of a loop to set memory to a value.
Remove the 'else continue' thingys. In the second place it changes the functionality.
George Jonsson 12-Jun-16 10:15am View
   
Don't post new information as an answer. You will only get downvotes.
Use Improve question instead.
(I have already updated the question for you)
George Jonsson 12-Jun-16 10:15am View
   
Don't post new information as an answer. You will only get downvotes.
Use Improve question instead.
(I have already updated the question for you)
George Jonsson 12-Jun-16 4:12am View
   
This is not C# code you are showing, it looks more like VB.
Which language are you really using?
George Jonsson 12-Jun-16 1:09am View
   
I think you link to a different kind of game.
George Jonsson 12-Jun-16 1:03am View
   
This is basically a repost of previous answers. Nothing new added.
This question is old and has been answered already.
George Jonsson 12-Jun-16 0:57am View
   
This is a very old post and your answer is incorrect.
"RDBMS stands for Relational Database Management System. RDBMS is the basis for SQL, and for all modern database systems like MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access."
George Jonsson 11-Jun-16 22:37pm View
   
Well, next time be sure to explain what your real problem is. Your question and your code doesn't really match.
(And I usually don't read the code because it is too messy)
George Jonsson 11-Jun-16 21:36pm View
   
Not sure why you think a 2D array would be easier, but if you really want to have it that way just replace
int redVotes[9];
int blueVotes[9];
with
votes[9][9]; // But use your defined N instead of the hard coded numbers

You still need to find the maximum for each "column" in the matrix.
George Jonsson 11-Jun-16 20:46pm View
   
You are probably right.
Too many factors that can effect the RSSI value. If the tag is on the front or back on a box, for example.
George Jonsson 11-Jun-16 11:02am View
   
How do you call this method?
Can you show that piece of code?

Also, why not use DateTime as parameters?
public DataSet Getindividualsales(DateTime date1, DateTime date2)
makes your method neater.
George Jonsson 11-Jun-16 10:51am View
   
It just looks a bit odd to suggest using regex and then the code presented has nothing to do with that.
George Jonsson 11-Jun-16 10:36am View
   
Where do you use regex in your solution?
George Jonsson 11-Jun-16 10:04am View
   
Understood, but to help you, you need to specify the column names and the data types for the DataTable you will do the actual LINQ query against.
George Jonsson 11-Jun-16 9:45am View
   
Do you mean that the RSSI value changes even if the tag is at a constant distance?
How much does the RSSI value vary? (In, for example, percent)
George Jonsson 11-Jun-16 5:23am View
   
What is the structure of your database table and what database are you using?
In the code above there is no database interaction at all.
George Jonsson 11-Jun-16 5:16am View
   
Is this spelled correctly?
row["parantid"].ToString()
or should it be
row["parentid"].ToString()
George Jonsson 11-Jun-16 5:12am View
   
Can you also add the XML that is not working? (If the XML you are showing is in fact working>
George Jonsson 11-Jun-16 4:54am View
   
How many rows do you expect to retrieve and if you only have 3 checkboxes in the form, how should more than one row in the result be handled?
George Jonsson 11-Jun-16 4:40am View
   
So what is your select statement if you want to do the concatenation in LINQ?
Something like
SELECT ID, Region, StartDate, EndDate FROM tblRegion_Uni
?
George Jonsson 11-Jun-16 3:08am View
   
Is it enough to look for the elements <w:tab> and <w:t> or do you need to check the attribute as well?
George Jonsson 11-Jun-16 2:58am View
   
Your XML is not valid without a declaration of the namespace 'w'
George Jonsson 11-Jun-16 2:23am View
   
Don't add new information as an answer.
Use the Improve question button instead.
I added it for you this time.
George Jonsson 7-Jun-16 18:09pm View
   
Sorry about the mixup, but as I wrote in the answer, the code was written directly in the editor here and never tested, so no guarantees.
George Jonsson 7-Jun-16 10:26am View
   
Columns, not rows.
Good night.
George Jonsson 7-Jun-16 10:10am View
   
And who would be the best to find out how many columns you have in your data grid?
I assumed you had 5.
What is the value of dataGridView7.Colums.Count? (Or something like that)
George Jonsson 7-Jun-16 9:48am View
   
Maybe indicate where the error occurs.
George Jonsson 7-Jun-16 7:53am View
   
5:ed
Good articles.
George Jonsson 7-Jun-16 7:04am View
   
Can you show the text and the regular expression?
I'm not sure you are on the right track here.
George Jonsson 7-Jun-16 7:01am View
   
Sorry, no time tonight.
A DataTable is not that difficult to use.
DataTable dt = new DataTable():
dt.ReadXml(path);

Set the data source in the code behind
dataGrid.ItemSource = dt.DefaultView;
George Jonsson 7-Jun-16 6:51am View
   
See my updated answer. That is all I have time for right now.
George Jonsson 7-Jun-16 6:13am View
   
The obvious answer would be that you should post your question in the Comments and Discussions section of the article. However, it doesn't seem like the the author has been active recently.
You should try it there anyway, chances are slim that anyone here wants to debug the code for you.
Or you could debug the code yourself. Looks like there is a link for downloading the source code.
George Jonsson 7-Jun-16 6:05am View
   
Does it have to be XElement or could you use DataTable?
George Jonsson 7-Jun-16 3:07am View
   
Don't repost, improve the original question instead.
George Jonsson 6-Jun-16 19:48pm View
   
Just let's hope the girl in question doesn't read your question.
You might, just might, get into trouble.
George Jonsson 6-Jun-16 19:12pm View
   
It might depend on what kind of host you have. Some web hosts disable the trigger mechanism and in some cases you can request this functionality to be enabled.
If you are using a web host, you should check what their policy is.
George Jonsson 6-Jun-16 19:04pm View
   
Don't repost your question, next time update the existing.
See Sql-connection timeout error for a particular period of time[^]
George Jonsson 6-Jun-16 19:01pm View
   
+5
George Jonsson 6-Jun-16 19:00pm View
   
What do you want to fill the text box with?
George Jonsson 6-Jun-16 6:55am View
   
I guess you have to find another library or report the issue to the developer.
George Jonsson 6-Jun-16 6:53am View
   
You think I would download an app if I suspect it contains a virus??? ;P
George Jonsson 6-Jun-16 6:51am View
   
You are welcome.
George Jonsson 5-Jun-16 20:39pm View
   
Then you have to dig into the code with the debugger and try to find out why m_hWnd is NULL.
George Jonsson 5-Jun-16 18:44pm View
   
What is the value of m_hWnd?
George Jonsson 5-Jun-16 8:30am View
   
Sorry, I'm not proficient in MVC.
Just wanted you explain your problem in more detail, which you have done now.
If that is enough for someone to help you with a solution remains to be seen.
George Jonsson 5-Jun-16 1:06am View
   
So what is your problem?
How to read data from a database?
George Jonsson 5-Jun-16 1:05am View
   
"rebuild the exe for x84"
I suppose you mean x86 and not x64, as Windows XP is normally 32 bit.
George Jonsson 4-Jun-16 22:42pm View
   
See my updated solution
George Jonsson 4-Jun-16 22:11pm View
   
You got a misplaced reply.
George Jonsson 4-Jun-16 0:15am View
   
So how do you want the values for Physical and Exposure to be presented? As comma separated lists?
You have one Strategy element and many Physical and Exposure elements, so you cannot get them as one value.
George Jonsson 3-Jun-16 22:47pm View
   
You are welcome.
George Jonsson 3-Jun-16 22:41pm View
   
Thanks Sergey.
It is just one way to do it and it is pretty straightforward and simple.
George Jonsson 3-Jun-16 9:10am View
   
That's weird. It works for me with that string, 2 word and 6 characters.
What kind of animal is txtStringName.Value?
Is it s string or an object?
Maybe you have to write txtStringName.Value.ToString()

Nah, that shouldn't matter. Forget that

If you use the debugger, what is the string value of txtStringName.Value?
George Jonsson 3-Jun-16 9:09am View
   
Not sure exactly what output you want, but I have changed the code so it gives you all sub-elements.
George Jonsson 3-Jun-16 8:56am View
   
I think I missed to read that part of the question.
I will have another look.
George Jonsson 3-Jun-16 8:48am View
   
Deleted
That's weird. It works for me with that string, 2 word and 6 characters.
What kind of animal is txtStringName.Value?
Is it s string or an object?
Maybe you have to write txtStringName.Value.ToString()
George Jonsson 3-Jun-16 7:22am View
   
What is the error you get and where?
George Jonsson 2-Jun-16 18:27pm View
   
This is not an answer to the question, it is a comment to your own comment in Solution 1.
Just remove this one.
George Jonsson 2-Jun-16 17:31pm View
   
So what does the JSON string look like AFTER it has passed the C# code?
I'm not going to execute the code. That is your job.

So you don't have any support channel to the back office??? That's kind of weird.
George Jonsson 2-Jun-16 10:48am View
   
So the Postman tool and your back office system doesn't agree on the correct JSON format?
Then you have to adapt to the format the back office system requires.
As far as I know, double quotes surrounding a variable name are required.
See JSON Syntax[^]
George Jonsson 2-Jun-16 10:19am View
   
If you read your own question, do you think there is enough information for anyone to answer your question?
What hardware?
Where is the code you have tried?
And what is it you really want to do?
George Jonsson 2-Jun-16 10:15am View
   
So what is the difference between the JSON data from the Postman tool and the JSON data you create in your code?
And don't tell me there is no difference if one way works and the other doesn't.
George Jonsson 2-Jun-16 10:07am View
   
Why not use a data grid?
George Jonsson 2-Jun-16 10:06am View
   
We are definitely not on the same page.
My point is that if you extract the JSON data as a string, using the debugger or saving it to a file, and then send it as a mail to the administrator of the receiving system, they could tell you if your JSON data is valid or not.
George Jonsson 2-Jun-16 5:40am View
   
Maybe you should start to explain your end goal.Maybe there is a better way to do this.
George Jonsson 2-Jun-16 5:20am View
   
You got it a bit backwards. Of course you cannot do DateTime nowdate = DateTime.Now.ToString("dd/MM/yyyy h:mm tt"); DateTime is one type and string is another type.
If you want to compare two dates and your input date is a string, then first convert the string to a date.
Use DateTime.Parse() or DateTime.ParseExact()
Now really look at the given solution and try it out.

And we cannot know how to use it in your program, because you don't present any code.
George Jonsson 2-Jun-16 5:19am View
   
Use DateTime.Parse() or DateTime.ParseExact instead. It gives you better control of the conversion.
George Jonsson 2-Jun-16 2:53am View
   
You need to explain a little bit more.
How do you select the date? With a date time picker?
And what is the field? A text box, a cell in a grid or what?
George Jonsson 2-Jun-16 2:18am View
   
Where is the code you have tried?
George Jonsson 2-Jun-16 1:37am View
   
If you are so sure your JSON format is correct, you better talk to the guys at back office.
Send the JSON string in a mail and ask why it is not accepted.
George Jonsson 1-Jun-16 23:42pm View
   
You seriously want that look of your UI?
George Jonsson 1-Jun-16 22:14pm View
   
ANTLR4 could be a good choice, it as free without any licensing as far as I know.
However, in order to get the most out of it I recommend you to buy the book. In the book you have lots examples including how to write a simple language parser.
George Jonsson 1-Jun-16 14:06pm View
   
Good. Debugging helps. :)
George Jonsson 1-Jun-16 13:21pm View
   
Changed it to your more elegant solution.
I always forget that Join function.
George Jonsson 1-Jun-16 13:17pm View
   
True, I was a bit lazy in my old ways there.
George Jonsson 1-Jun-16 12:21pm View
   
Update your question with some input data and expected outcome.
George Jonsson 1-Jun-16 12:15pm View
   
I think, but that is a guess, that oCompanyBO.SelectedSupplierIDs is a variable.
George Jonsson 1-Jun-16 11:38am View
   
It is difficult to understand what you are trying to say, but I repeat:
XSD is defined in an XML format so there is no need to do any conversion.
Just tell the receiver that it is a schema and not content that you are sending.
George Jonsson 1-Jun-16 10:46am View
   
Well, that is not easy to know for anyone but you.
You say you get an error sending your JSON data, and the JSON structure you show is not in a valid format, so what am I supposed to think?
Have you tried to validate the true JSON output in the online tool I linked?
Just convert the data to a string or save to a file and then paste it into the validator. If you do that you might find the problem.
And why don't you ask the back office guys what is wrong with the format?

As you don't show the true JSON data it is difficult to give more help. This is weird though.
MsgRequest: "{
Header: {
What is the quotation mark doing there?
George Jonsson 1-Jun-16 5:39am View
   
Do you mean serialize a C# object to JSON?
Your statements are confusing because the error code you have shown in the question is because of the lack of quotation marks (") and the JSON code you show is without them.
George Jonsson 1-Jun-16 0:22am View
   
For one question no, but to filter out half a dozen of your answers, by opening a page, downvote if you answered, open next, downvote, etc. seems to be a bit of work to do for no benefit.
Oh well, if it is done manually it should getting tiresome after a while.
George Jonsson 1-Jun-16 0:17am View
   
You need to show your page layout code, HTML, ASP.NET or other. You do have an input text box of some sort, right?
George Jonsson 31-May-16 23:08pm View
   
If it is done manually, it has to be a fellow with lightning speed mouse skills and a determination from h**l, coz the doer has to scan through quite a lot of questions in order to find yours.
Alas, there are quite a few "gimmie code" questions that can strain your patience.
George Jonsson 31-May-16 22:22pm View
   
Your welcome.
Seems like someone has written a little "downvote-all-Sergeys-answers" bot.
I have had a few unexplained downvotes myself.
But there are also a lot of downvotes for the questions. Sure, some questions are not all that well phrased or shows a bit of lazyness, but it will eventually scare people off so there will be no more questions.
George Jonsson 31-May-16 19:22pm View
   
It's a pity, it was kind of an interesting question.
George Jonsson 31-May-16 19:16pm View
   
Thanks Philippe, some appreciation is nice as the OP is not of the grateful kind.
George Jonsson 31-May-16 18:20pm View
   
True. I just made a working example for the small set of input data shown in the original question. Optimization was not on my mind and why should I bother?
Thanks anyway.
George Jonsson 31-May-16 16:39pm View
   
Not sure why you got a downvote on this one.
+5
George Jonsson 31-May-16 16:31pm View
   
Is the image stored as is into the database, or is it scaled down to a smaller size before it is stored?
George Jonsson 31-May-16 16:30pm View
   
Good explanation. +5
George Jonsson 31-May-16 8:29am View
   
Thanks for the info.
George Jonsson 31-May-16 8:28am View
   
Kind of pisses me off a bit that I bothered to try to answer the question.
George Jonsson 31-May-16 8:27am View
   
You cheater.
I'm sorry I ever got involved. A good thing then that my answer was not good enough.
George Jonsson 31-May-16 8:21am View
   
Ah OK. I kind of didn't get that the words were from a new language.
Well, it just proves that in order to answer the question you need to understand the question.
George Jonsson 31-May-16 8:17am View
   
And the problem is?
You do realize that your question header is kind of a mind twister.
Please elaborate a bit more.
George Jonsson 31-May-16 8:11am View
   
The question doesn't even make sense to me, but maybe my English is not good enough.
George Jonsson 31-May-16 7:58am View
   
You are welcome.
George Jonsson 30-May-16 21:38pm View
   
I have kind of given you a lot of help already.
Now you start to talk about algorithm efficiency, that was not in the original question.
Look at ppolymorphe's Solution 4. It will boost the algorithm somewhat. You just need to add a few if-statements.
However, we don't know your time limit or what the true input data is.
George Jonsson 30-May-16 7:02am View
   
Just not that
a in binary = 0110 0001 (0x61)
b in binary = 0110 0010 (0x62)
See Ascii Table - ASCII character codes and html, octal, hex and decimal chart conversion[^]
George Jonsson 30-May-16 6:40am View
   
It can probably be much more efficient, but I don't want to spoil all the fun for you.
It is your task after all.
George Jonsson 30-May-16 3:08am View
   
What is a coarse?
If you have to start to comparing size and calling people idiots then there is not much more to discuss.
Personally I worry more about memory leaks when I hire programmers. A nice personality is also a key factor.
George Jonsson 30-May-16 1:16am View
   
You don't specify the structure of the data table returned by getProductsonBarcode() and you don't specify what structure you want to present in the grid view, so it is not easy to give more specific advice.

Create a new data table then, with a static structure that can be shown in the grid and use that as a data source.
George Jonsson 29-May-16 22:49pm View
   
I was born in a free country and as far as I know I can basically debate any subject I choose to debate.

The rules maybe explicit but the implementation of the rules are not always so strict. Different compilers have different implementations.

In this case it doesn't matter, however, as the result of c - '0' will be implicitly type casted to an int if the receiving variable is an int.

The code
char c = '5';
int i = c - '0';
compiles without any warnings, at least in Visual Studio with warning level 4.
You can do the same thing in C# as well, and the result will be the expected i = 5.
Don't know what kind of compiler you have, though, it might give a different result.
I'm not saying if it is good practice to do this or not, but the the compilers I have used will not complain about it.

It is probably a good idea to check if the value of c is a digit, if you want the desired result.

So you see I can argue it, and you are free to argue back if you so wish.
George Jonsson 29-May-16 18:10pm View
   
sor = c - '0';
This is a perfectly valid line in C, as char is an integer type and is normally signed by default, hence it can contain the values between -128 and 127.
George Jonsson 29-May-16 10:10am View
   
I am not going to setup your whole system and debug it for you, so I cannot send you the complete code.
You get the exception [FormatException: Input string was not in a correct format.], most likely because the value of phtxt.Text is not a number, like 12345467, but contains some non-numerical characters or is empty.
Use the debugger and set a breakpoint and inspect the value, or at least look in your form what value you enter in that text box.
George Jonsson 29-May-16 9:59am View
   
The value of phtxt.Text, not the name of the text box.
If the value really is 'phtext' then of course the conversion from a string to a number will fail.
George Jonsson 29-May-16 8:59am View
   
What is the value in the text box?
George Jonsson 29-May-16 8:55am View
   
Then check the value of phtxt.Text in the debugger.
Is it really an integer value?
George Jonsson 29-May-16 8:37am View
   
Sorry, not tonight. I will have a look again tomorrow.
George Jonsson 29-May-16 8:34am View
   
Seems I was wrong with this line
command.Parameters.Add("@phonenumber", SqlDbType.BigInt).Value = long.Parse(phtxt.Text);
change back to
command.Parameters.Add("@phonenumber", SqlDbType.BigInt).Value = phtxt.Text;
The conversion is done automatically, if I understood the documentation correctly.
George Jonsson 29-May-16 7:48am View
   
I mind.
George Jonsson 29-May-16 7:46am View
   
See my updated answer.
Instead of using, you can use try-catch-finally. It is basically the same thing
George Jonsson 29-May-16 7:22am View
   
What is not working? Isn't the method called when you click the button?
George Jonsson 29-May-16 7:14am View
   
"Now help me out" sounds like a demand.
George Jonsson 29-May-16 7:14am View
   
You have a subbtn_Click method. I thought you wanted the code there.
George Jonsson 29-May-16 7:08am View
   
Is that a question or a demand?
George Jonsson 29-May-16 7:00am View
   
How would I know?
It is your code after all.
I am just saying that you should not post code in the comment section.
George Jonsson 29-May-16 6:39am View
   
It was a mess before ppolymorphe fixed it.
George Jonsson 29-May-16 6:38am View
   
Use Improve question and either add new code or replace existing.
George Jonsson 29-May-16 6:29am View
   
Why do you post your code here in the comment section?
George Jonsson 29-May-16 6:07am View
   
But not formatted with the correct language. It makes reading the code so much easier, and your job is to make it easy to help you.
George Jonsson 29-May-16 5:59am View
   
I tried to format the code, but the first part is a mess. You have to paste it again, I think.
George Jonsson 29-May-16 5:43am View
   
Please, please use Improve question and insert your code there.
And formatted properly too.
George Jonsson 29-May-16 5:22am View
   
Please show us the code you have written so far explain where you are stuck.
George Jonsson 29-May-16 5:18am View
   
True. Many questions are about "How can I store the value 00001, the zeroes disappear in my data table"
George Jonsson 29-May-16 4:13am View
   
Don't post your code in the comment section. (No one is going to read it like this)
Use the Improve question button instead. And don't forget to format the code properly.
Also clearly indicate where in the code you think the problem is.
George Jonsson 29-May-16 4:10am View
   
Elegant solution, but maybe not so readable for a newbie.
George Jonsson 29-May-16 1:37am View
   
You are probably right.
+5
George Jonsson 28-May-16 21:53pm View
   
That's a bad tool, teaching bad habits, as one of the most common problems in C++ is memory leaks.

Anyway, I think this is the problem in your first attempt.
sor = c - '0'; Here you assume the the number of rows are always a single digit.
What if there are 11 rows? Will the code work then?
George Jonsson 28-May-16 20:56pm View
   
Actually, both variants should be rejected.
You allocate memory with calloc(), but you never release it with free().

What is the purpose of the program? What is the expected output?
George Jonsson 28-May-16 20:44pm View
   
You need to explain more what it is you want to do.
The answer of what variable?
George Jonsson 28-May-16 5:34am View
   
How do you mean?
George Jonsson 28-May-16 5:04am View
   
Always use the Reply button if you want to make sure to notify the person are replying to.

So what is the unexpected result and what is the result you expect.
And where in the code does it happen.

You do realize that we cannot see your screen, read your hard disk or read your mind.
We cannot test run your code either without setting up a system similar to yours, so provide as much relevant information as you can.
George Jonsson 28-May-16 4:42am View
   
So what is the problem?
You have described what you are doing, but not if you get any errors or if you get an unexpected result.
George Jonsson 28-May-16 3:12am View
   
Thanks, Sergey.
George Jonsson 28-May-16 3:01am View
   
What is the code are you using to convert a long to a struct successfully.
It would be very interesting to see.
George Jonsson 28-May-16 0:52am View
   
Thanks Karthik
George Jonsson 28-May-16 0:51am View
   
You are welcome.
XSLT is a different beast, so it takes time to get the hang of it.
Most of the time you should NOT use for-each.
George Jonsson 28-May-16 0:49am View
   
Use the Reply button if you want to reply to a comment.
Now the only one who gets notified is you.
George Jonsson 27-May-16 10:01am View
   
XSD is an XML format.
Do you want to transfer the XSD schema or the XML file that is based on the schema?
George Jonsson 27-May-16 9:55am View
   
Lazyness, I guess.
To use an enum is a better idea, I just didn't think about it in all of the commotion. :)
George Jonsson 27-May-16 9:17am View
   
I tend to agree. I can't remember how many times I have fixed bugs caused by a one character buffer overrun, where the null character was forgotten.
What made things even worse was that in debug mode it usually worked, due to some extra byte allocation by Visual Studio, if I remember correctly.
George Jonsson 27-May-16 8:11am View
   
Have you included the correct header file in your code?
George Jonsson 27-May-16 7:35am View
   
It seems more than likely, but with the number of weird questions that pops up here at CP, who knows.
George Jonsson 27-May-16 7:32am View
   
What are you using to differentiate between different user privileges?
George Jonsson 27-May-16 7:02am View
   
Come on. You know how to use Google, right?
ceil - C++ Reference[^]
George Jonsson 27-May-16 5:17am View
   
Thanks.
George Jonsson 27-May-16 2:12am View
   
Especially when you don't know if there any limitations or restrictions that can mess up the design.
Thanks for the upvote.
George Jonsson 27-May-16 2:08am View
   
Thanks Sergey.
Never liked to do string operations in C, so I avoid it if possible.
George Jonsson 26-May-16 21:17pm View
   
+5 Very good point with the manger app.
Gives only one entrance point into the database.
George Jonsson 26-May-16 18:57pm View
   
A bit confusing.
You say you want to find 2605, but in the code snippet you look for 2036.
Maybe it is a typo, but it also COULD be why your code doesn't work.
George Jonsson 26-May-16 18:53pm View
   
Why do this in the first place? It is not the most user-friendly way to present your data.
Maybe if you explain a bit more, there might be a better solution for what you want to achieve.
George Jonsson 26-May-16 18:45pm View
   
Very true.
George Jonsson 26-May-16 18:43pm View
   
I checked the image, and I have to admit I have never seen this "language" before.
What is it?
George Jonsson 26-May-16 18:38pm View
   
Thanks Sergey, but this answer took very little effort.
George Jonsson 26-May-16 18:34pm View
   
Is it a Windows Form project?
Are you showing the data in the data table in a DataGridView?
George Jonsson 26-May-16 18:31pm View
   
Do you need an asynchronous client for this?
At least it might be easier to start with a synchronous client for finding out how to handle the exceptions.
Basically you need to close the port when you get an exception and then check the connection status before sending a request. If it is not Open, then you need to fix that.
George Jonsson 26-May-16 18:13pm View
   
OK. Didn't know.
George Jonsson 26-May-16 9:25am View
   
Have you tried any of the articles form the link I provided.
George Jonsson 26-May-16 7:49am View
   
And the problem is?
George Jonsson 26-May-16 7:45am View
   
And the error is?
George Jonsson 26-May-16 6:30am View
   
1- Please don't dump your code in the comment section. Improve your original question instead. No one will take the time to read the code like this.
2. Also point out the line where the exception occurs.
George Jonsson 26-May-16 6:26am View
   
Do you mean on that line? I doubt that dt.Merge(dtnew); throws that kind of exception.
Have measured the time taken for the operation?
George Jonsson 26-May-16 3:33am View
   
In which code line does the error happen?
George Jonsson 26-May-16 2:21am View
   
And what is this?
port = new System.IO.Ports.SerialPort(comPort);
You have that in your original post.
And where does Port.writeln write to?
George Jonsson 26-May-16 0:17am View
   
You can only have one instance of SerialPort for the same COM port at a time.
You seem to have two, port and serial. Why?
George Jonsson 26-May-16 0:12am View
   
You should post this as a comment, not answer.
The only one that gets notified is you.
George Jonsson 25-May-16 18:31pm View
   
Have you used the debugger, stepped through the code and inspected the contents/value of the variable value?
George Jonsson 25-May-16 18:27pm View
   
Thanks Matt.
George Jonsson 25-May-16 11:36am View
   
Maybe a bit off topic.
This is more of a programming question forum.
George Jonsson 25-May-16 11:29am View
   
So what was done to the server that stopped working?
And don't say nothing, because something changed.
Maybe a reboot, installation of new software or something like that.
Or was the client software changed in some way?

You need to analyze what was changed and that can take time sometimes if you don't have full control of the servers or client software.
George Jonsson 25-May-16 7:07am View
   
What version of Windows are you using?
George Jonsson 25-May-16 7:03am View
   
When using streams it is good practice to do
using (Stream s = new Stream())
{
} // Stream closes here
If you also create the output stream, make sure to close it.