Click here to Skip to main content
14,577,718 members

Comments by Peter Leow (Top 200 by date)

Peter Leow 12-Sep-18 11:57am View
You are asking about the sorting, but showing some irrelevant code. Check this demo and figure out yourself
Peter Leow 12-Sep-18 10:07am View
How did u instantiate object of a class? Show you code.
Peter Leow 9-Sep-18 2:48am View
There are some more errors, the hints are:
1. typo
2. case sensitivity -
Peter Leow 31-Aug-18 8:10am View
Peter Leow 27-May-18 1:19am View
Thank you, CHiLL60.
Peter Leow 27-May-18 1:18am View
I have added an example. Btw, this is not a solution, you should use the "Have a Question or Comment?" widget for follow up. Please remove solution 2.
Peter Leow 31-Mar-18 1:39am View
You first.
Peter Leow 21-Jan-18 8:05am View
Peter Leow 26-Dec-17 3:15am View
Yes, it's typo. Thank you.
Peter Leow 13-Dec-17 8:52am View
As mentioned in the error message, is there a column called 'HansBresko' in the admin_credentials table?
Peter Leow 1-Dec-17 22:52pm View
Java? JSP? JSF? Bean? JavaScript? Which one? Is it web? Note that Java and JavaScript are two different things.
Peter Leow 21-Nov-17 1:19am View
Added in my solution.
Peter Leow 18-Nov-17 6:57am View
This should be posted as a new question.
Peter Leow 18-Nov-17 6:46am View
The reasoning is in the initial part of the solution 1: the first if-else cancels out the second if-else. You are supposed to replace your original two if-else blocks with the code that is given by me.
Peter Leow 18-Nov-17 1:31am View
Added in solution 1.
Peter Leow 18-Nov-17 0:25am View
This is not a solution, remove it.
Peter Leow 18-Nov-17 0:24am View
There is an obvious missing open bracket after the first else. Syntax error aside, however, your logic is wrong. Follow the flow of your code to figure out.
Peter Leow 17-Nov-17 21:32pm View
Thank you, CPallini.
Peter Leow 15-Nov-17 1:12am View
Thank you, Mehdi Gholam.
Peter Leow 5-Nov-17 10:23am View
Thank you, Karthik.
Peter Leow 5-Nov-17 10:22am View
Thank you, CPallini.
Peter Leow 5-Nov-17 1:36am View
Any warning or error messages?
Peter Leow 2-Nov-17 3:27am View
Thank you, Karthik.
Peter Leow 1-Nov-17 10:38am View
Thank you, CPallini.
Peter Leow 29-Oct-17 1:58am View
As it is, The SQL server will scream of "ambiguous column name A... blah...blah...".
Having said that, an alternative to this is SQL UNION, refer to the link in my solution.
Run your code on your machine or some online SQL editor, pay attention to any error messages, and correct them accordingly, that how you will learn.
Peter Leow 29-Oct-17 1:32am View
Some pointers:
1. Why spacing in some table naming? e..g table 1. I assume that were typos.
2. If there are identical column names in all three tables, can you tell which tables these columns belong to from such a statement Select A, B, C, D, E?
Peter Leow 27-Oct-17 3:24am View
Definitely not this one.
Peter Leow 2-Sep-17 9:50am View
It's the "thought" that counts.
Peter Leow 2-Sep-17 9:49am View
Thank you, CPallini.
Peter Leow 6-Jul-17 23:44pm View
Thank you, Karthik.
Peter Leow 4-Jul-17 4:23am View
You cannot change the question which has been solved. This is very wrong! You will be reported as abusive. Stop wasting time doing the wrong thing. You have been asking a number of SQL related questions and you have also been advised against posting further questions without showing any effort of trying. Try it yourself first. If you hit a snag, post your question with the code. Till then, do not expect any help.
Peter Leow 3-Jul-17 8:10am View
Thank you, Maciej.
Peter Leow 22-Jun-17 2:07am View
Honestly, I can't advise you as I do not know your strengths and weaknesses with regards to web development. If I were you, I would just dive into some beginner tutorials on MEAN stack and self-discover the answers. For example, check this out: Wherever you hit a snag, that is one of the answers you are looking for. Good luck.
Peter Leow 8-Jun-17 5:42am View
Read the links provided, then figure out the relationships between the various tables (entities), if need be, re-design your tables. It is a trial and error process, it will only stop when the design fits your requirements.
Peter Leow 7-Jun-17 22:35pm View
how much?
Peter Leow 30-May-17 8:12am View
Thank you.
Peter Leow 15-May-17 23:29pm View
PHP scripts run on server-side, you will need AJAX for sending data from the front-end to the server-side asynchronously.
Peter Leow 7-Apr-17 22:30pm View
The purpose of foreign key constraint is to enforce referential integrity rule of the database. That includes not allowing a foreign key value in the children tables (rep and contact) without it first exists as primary key value in the parent table (company).
Peter Leow 7-Apr-17 4:42am View
Thank you, CPallini.
Peter Leow 18-Mar-17 6:56am View
You output makes no sense. What do you want to achieve?
Peter Leow 17-Mar-17 6:54am View
No. If you want a standalone view, you have to use another Activity. Fragment is out of question. Follow this to find out how to start another activity.
Peter Leow 10-Mar-17 0:46am View
Thank you, Karthik.
Peter Leow 7-Mar-17 9:57am View
What error message? What is in row 4? Don't expect us to see your screen.
Peter Leow 5-Mar-17 0:45am View
You are welcome and remember to mark this as answer.
Peter Leow 4-Mar-17 10:47am View
This is a new question, so post it as a new question with your code and any issues on implementing listview.
Peter Leow 4-Mar-17 10:38am View
It is strange that all three tables share the same id. You should re-examine your database design.
Peter Leow 4-Mar-17 6:41am View
You said "uplimit downlimit varies with different doctors", it seems to infer that the Id field of the ratio table is related to the Did field of the doctor table, Is that correct?
Peter Leow 4-Mar-17 6:27am View
Every stock and sales entries to the database tables should be accompanied with their respective dates and times, why is it confusing?
Peter Leow 3-Mar-17 23:49pm View
Isn't the stock with the latest date is the most current? Can't you use the date field in that table for this purpose?
Peter Leow 3-Mar-17 23:16pm View
I did not give you the complete code, you are supposed to figure out the rest.
Learn to read the error message: Additional information: ExecuteReader requires an open and available Connection. The connection's current state is closed.
Peter Leow 1-Mar-17 10:01am View
That LastCheckOutDate is a varchar type?
Peter Leow 1-Mar-17 8:53am View
Its actually an assignment problem but NOT a question.
Peter Leow 28-Feb-17 23:13pm View
You are welcome. Will you mark this as answer?
Peter Leow 28-Feb-17 2:39am View
T as delimiter
Z for UTC time
Peter Leow 27-Feb-17 22:32pm View
I have no access to your computer. Something else is not right. Anyway, check this out to convince yourself
Peter Leow 27-Feb-17 10:53am View
Thank you.
Peter Leow 27-Feb-17 10:47am View
Thank you. That was my oversight. Corrected.
Peter Leow 27-Feb-17 7:01am View
Who is the someone? Why should he send you the code?
Peter Leow 27-Feb-17 3:20am View
This is the fundamental to parse a json string, put this in the loop and get the different values from user_id, username, etc.
Peter Leow 26-Feb-17 21:26pm View
Thank you, Maciej.
Peter Leow 26-Feb-17 11:03am View
This is a different question, post it as a new question.
Peter Leow 24-Feb-17 11:27am View
Peter Leow 24-Feb-17 9:48am View
I did but I deleted the solution after OP ask me to correct his code. What the heck!
Peter Leow 24-Feb-17 9:43am View
You are explaining a problem with a problem. It did not help. What exactly do you want to achieve? What make it a correct day or not? We can't read your mind.
Peter Leow 23-Feb-17 3:27am View
Yes, it works. Help yourself by checking your table data.
Peter Leow 23-Feb-17 3:18am View
Thank you, Maciej.
Peter Leow 22-Feb-17 21:59pm View
This does not make sense
where OrdCreateDt < dateadd("dd", -days, convert(varchar(10), getdate(),101))
Does he really want the info from the very first record available in the database? Is it useful? Instead, ask him for a specific start date.
Peter Leow 22-Feb-17 10:31am View
Peter Leow 22-Feb-17 10:17am View
Absolutely can be done, post it as a new question, and I will answer it.
Peter Leow 21-Feb-17 0:51am View
below this line:
$query = $_SESSION['query_gallery'];
add this line to halt the script and see the value of $query:
Peter Leow 20-Feb-17 22:40pm View
Nice, 5!
Peter Leow 19-Feb-17 21:59pm View
Instead of re-posting multiple times, you should use that time wisely to ask your question properly, format the code properly, explain your problem clearly. As of now, it looks like a homework and your code is not even complete.
Peter Leow 19-Feb-17 21:55pm View
You have posted the same question in three quick successions. Remove the redundant ones, and wait for answer patiently. Else you will be ignored and penalized.
Peter Leow 19-Feb-17 9:22am View
I think you should tell us what you intend to achieve instead?
Peter Leow 19-Feb-17 2:26am View
user is a reserved word in mysql and it should not be used. However, you can get away with it by wrapping it in back ticks, e.g `user`. I wonder if you encounter any error in running that sql query.
Peter Leow 19-Feb-17 1:18am View
what is the datatype for the booktime column? Did you really name that table name as table?
Peter Leow 18-Feb-17 11:30am View
You are asking us to do your work? What is the price?
Peter Leow 18-Feb-17 11:25am View
Have you ever wonder where that message came from? No where it can be found in your html or the php, that error message came from the input type = "email" of HTML5, not from PHP script. Read out on HTML5. If you do not know Ajax, learn it. In fact, your knowledge of web development is very lacking, visit more often.
Peter Leow 18-Feb-17 9:46am View
That is nostalgic. I have used it once many years back, 2003?
Peter Leow 18-Feb-17 9:30am View
Solution corrected.
Peter Leow 18-Feb-17 9:25am View
It should be
Peter Leow 18-Feb-17 8:12am View
post it as a new question.
Peter Leow 18-Feb-17 2:56am View
The approaches are the same. Just that yours is values, you can place the values (series of str) into a list and pass this list to the second form. See addition.
Peter Leow 18-Feb-17 0:06am View
Create a class with the 3 variables as properties and implement Property Change Notification
Peter Leow 17-Feb-17 23:57pm View
Glad that it helps.
Peter Leow 17-Feb-17 20:37pm View
It is intended to be the clue for OP to find the way to the destination.
Peter Leow 17-Feb-17 1:39am View
That shows the quality of your upbringing and it is reported as abusive.
Peter Leow 16-Feb-17 2:21am View
Thank you, Karthik.
Peter Leow 15-Feb-17 11:36am View
Check your export operation, as the error message said it
Unknown database '<' when selecting the database
Peter Leow 12-Feb-17 21:23pm View
You are welcome.
Peter Leow 12-Feb-17 1:40am View
Peter Leow 12-Feb-17 0:59am View
change i <= 0 to i >= 0
Peter Leow 11-Feb-17 22:50pm View
show an example of the content of space.response? and what is res.number?
Peter Leow 11-Feb-17 8:40am View
Add your html code and css to your question.
Peter Leow 10-Feb-17 19:57pm View
similar to sending the button value to the server, but this time use text() to get the value in jQuery first before Ajaxing.
If seems that you are familiar with jQuery and PHP, then google and learn.
Peter Leow 9-Feb-17 22:47pm View
No idea but missing him a lot and the opportunity to learn from him. He may be engaged in some big project. Wish him well. Hope to hear from him soon.
Peter Leow 9-Feb-17 8:18am View
Draw out the DOM structure of your div and its elements on paper, identify the parent child nodes, then start coding the nodes in HTML by taking reference from the link that I have provided.
Peter Leow 9-Feb-17 7:48am View
Isn't that created by the myFunction()? For more info, visit
Peter Leow 8-Feb-17 22:45pm View
5ed for given OP an important head start. I have provided an example to guide him a bit.
Peter Leow 8-Feb-17 11:57am View
You are welcome.
Peter Leow 8-Feb-17 5:13am View
added in my solution.
Peter Leow 8-Feb-17 4:26am View
show the stock_sales table structure and field types.
Peter Leow 8-Feb-17 1:09am View
"I have tired but not getting the logic" then show what you have tried.
Peter Leow 7-Feb-17 22:52pm View
How come this
"Table 2 is County_Lines it has fields 1. ID - auto incrementing"
is auto increment when it is supposed to be the foreign key referencing the ID in table?
Next, you have to show more examples of data from these 2 tables so as to help explain your problem. At the moment, it is not clear. Improve your question.
Peter Leow 7-Feb-17 0:04am View
It will always returns the first $dbh. If you want to get the second one when the first one fails, use if else
If you really want multiple connections, use different routines, else how do you know which connection it refers to?
Peter Leow 6-Feb-17 11:05am View
Yes, it works. Do not use chrome if you are not using a web server, use firefox instead to test it.
Peter Leow 6-Feb-17 9:15am View
Go for it.
Peter Leow 6-Feb-17 3:02am View
Thank you again. That helps me to discover one litter bug:
for i in largest_summed_consecutive_subArray[:]:
Fixed and run well. It seems...
Peter Leow 5-Feb-17 5:50am View
Good effort. 5ed!
Peter Leow 5-Feb-17 2:16am View
I have just incorporated the multiple sub arrays. As for [5, -5, 5, -5, 5], the acceptable sub array is debatable.
Peter Leow 5-Feb-17 1:32am View
Thanks for the feedback, just fix it. Hope it works now.
Peter Leow 5-Feb-17 1:32am View
Just fix it after gotten feedback from Bryian Tan. Thanks you guys for testing it. Code is not elegant but just a quick way to capture the logic. As regards whether null or zero for empty is just a matter of if else IMHO, so up to individual.
Peter Leow 4-Feb-17 23:46pm View
That breaks the code. Thank you for testing.
Peter Leow 4-Feb-17 7:29am View
We cannot see your computer screen. Add the relevant code to your question.
Peter Leow 4-Feb-17 1:38am View
To avoid all the hassle, why not just
string currencySymbol = "TL";
Console.WriteLine("{0:N2} {1}", 10.5, currencySymbol);
Peter Leow 3-Feb-17 8:32am View
Leave coding aside. First, define "conformity"; Next, how do you measure it?
Peter Leow 3-Feb-17 4:44am View
Thank you, Karthik.
Peter Leow 3-Feb-17 2:57am View
There is no need to advertise your site lest being marked as spam. I have removed it.
Peter Leow 1-Feb-17 2:24am View
Just curious, why do you want to do that?
Peter Leow 31-Jan-17 11:12am View
What were you doing? Are you sure you understand the code or just got it from some where? You are making it worse. It is supposed to replace this
if string[0] == char:
Peter Leow 30-Jan-17 23:17pm View
If this is a separate issue, post it as a new question with code snippet so that more eyes can attend to it.
Peter Leow 28-Jan-17 11:32am View
Read your question from the point of a stranger. Are you able to understand your question?
Peter Leow 26-Jan-17 11:38am View
Your query looks weird, can you show the table structure and explain how a ReceiptNo relates to payments for different months.
Peter Leow 26-Jan-17 5:53am View
Substract what from what? What constitutes a pair? I supposed the date and time are in varchar, if so, this table is really suck.
Peter Leow 26-Jan-17 5:37am View
What are you trying to achieve. You are adding columns using the list elements, then you try to add row using the list elements again? And it appear each row is going to have a column filled with the column name. Anyway, what is this columnN inside the row[columnN]=str, do you mean row[str]=str? Apprently, you have not visited the link I have given you
Peter Leow 26-Jan-17 3:47am View
You mean the datatable is going to have only one row with multiple columns? Anyway, you can add columns and rows to datatable. Check this out:
Peter Leow 25-Jan-17 2:12am View
I don't think this message is for me.
Peter Leow 24-Jan-17 3:01am View
Just curious, what kind of requirement that prompts you to come out with this design.
Peter Leow 22-Jan-17 23:03pm View
I will go with PIEBALDconsult.
Peter Leow 22-Jan-17 11:38am View
Hi, guys. Sorry for keeping you waiting. I just noticed the discussion generated here and can't just go to bed. A quick think through and got a third version. Check it out and give me your view. But I have to go to bed lest late for work tomorrow.
Peter Leow 22-Jan-17 6:33am View
Noted. Thanks.
Peter Leow 22-Jan-17 0:34am View
You are right again. I rest the case. Got to get on with other business.
Peter Leow 22-Jan-17 0:15am View
Thank you for the feedback. Taken a second look. Found the culprit which are all the single digits. Put them to the max in their respective ranges, e.g. 2 => 299. Solved it.
Peter Leow 21-Jan-17 23:31pm View
Got it, thanks.
Peter Leow 21-Jan-17 22:00pm View
Peter Leow 20-Jan-17 5:22am View
You could have said this in the first place. What you have given are just some requirements. You have to be very specific about what you want to achieve. Anyway, see addition to solution 1.
Peter Leow 19-Jan-17 21:16pm View
You need effort to learn not waiting for luck . Anyway, you won't find luck here either. Not a question.
Peter Leow 18-Jan-17 23:03pm View
MySQLi Object-oriented. Visit the links that are given.
Peter Leow 18-Jan-17 2:42am View
That is handy, 5ed!
Peter Leow 18-Jan-17 2:34am View
Thank you, Maciej.
Peter Leow 16-Jan-17 0:03am View
That is the way, 5ed!
Peter Leow 15-Jan-17 10:11am View
You should add this code to your question with proper format/indentation using the "Improve question" widget. Not forgetting proper indentation is a must in Python.
Peter Leow 14-Jan-17 21:54pm View
You are right, I was wrong. Thanks.
Peter Leow 14-Jan-17 6:06am View
When I read the title, I thought you were looking for the company that has the highest paid employee. However, your sql statement suggested that you are trying to find the company that paid the highest TOTAL amount of salary to all its employees, it that right? It doesn't make much sense. Companies with more employees tend to pay more in total as compared to those with fewer employees. What exactly do you want to achieve? Just curious.
Peter Leow 13-Jan-17 5:52am View
5ed for your effort.
Peter Leow 13-Jan-17 3:02am View
Is that the only code that you have? Try this
See addition to my solution.
Peter Leow 13-Jan-17 2:56am View
Peter Leow 13-Jan-17 2:55am View
Peter Leow 13-Jan-17 1:41am View
You are welcome.
Peter Leow 12-Jan-17 10:28am View
You table data example looks confusing. Can you use <pre> tag to format and align them? There seems to be some missing data.
Peter Leow 11-Jan-17 21:32pm View
You are welcome.
Peter Leow 11-Jan-17 11:30am View
Yes. Thank you for trying out my code.
Peter Leow 11-Jan-17 11:19am View
See added reply to my solution.
Peter Leow 11-Jan-17 11:11am View
Thank you for trying out my code. Reply added in my solution.
Peter Leow 11-Jan-17 3:45am View
Read my solution.
Peter Leow 11-Jan-17 2:09am View
Thank you, Jon.
Peter Leow 11-Jan-17 1:54am View
What do you means" current date (start date) to pick automatically". who pick the current date?
Peter Leow 9-Jan-17 7:56am View
Even that homework is poorly written.
Peter Leow 8-Jan-17 21:10pm View
Ask I said, ask microsoft support at
for windows 7, go to
But the latest is Windows 10.
Peter Leow 8-Jan-17 10:22am View
5ed for excellent teamwork!
Peter Leow 8-Jan-17 10:20am View
This is more comprehensive, 5ed!
Peter Leow 8-Jan-17 8:05am View
solution updated.
Peter Leow 8-Jan-17 7:58am View
If not, let it be knowledge sharing and learning.
Peter Leow 7-Jan-17 20:58pm View
If someone were to ask you "your question" the way you asked, how would you respond?
Peter Leow 7-Jan-17 20:44pm View
Thank you, Maciej.
Peter Leow 6-Jan-17 12:14pm View
reply added to my solution.
Peter Leow 6-Jan-17 12:13pm View
Peter Leow 6-Jan-17 3:08am View
Unless you are looking for
Peter Leow 5-Jan-17 6:59am View
5ed! Thank you.
Peter Leow 5-Jan-17 3:48am View
replied in my solution.
Peter Leow 4-Jan-17 22:00pm View
i have seen this question. Still not enough information. Can you provide more information such as:
1. It seems to have a fixed duration for each delivery, right? Is it 192 mins?
2. When and how long is a lunch time? Are the lunch time and its duration fixed?
3. What happens to the delivery just before lunch, can it be shorter than 192 mins.
4. when does the first delivery starts in a day?
IMHO, the requirement that you mentioned so far does not sound realistic. If you cannot answer questions 1 to 4 clearly and definitely, then you may want to consider redo it.
Peter Leow 4-Jan-17 2:12am View
"on basis of departmentname deptid should be generated", what basis? Any example?
Peter Leow 3-Jan-17 12:43pm View
Glad that your problem is solved. Yes, using is another way. Cheer!
Peter Leow 3-Jan-17 11:08am View
This System.DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss:tt") returns the datetime when the sql query is executed. Are you sure there are such records with this datetime?
Peter Leow 2-Jan-17 7:46am View
You are welcome.
Peter Leow 2-Jan-17 6:55am View
You are not even sure if "Yes" or "yes"? You should find out what the actual values are captured in the database table first.
Peter Leow 2-Jan-17 6:02am View
Apparently, you did not visit the link that I have provided in my solution.
Peter Leow 2-Jan-17 5:00am View
Peter Leow 2-Jan-17 4:35am View
There isn't enough details to diagnose. I suspect it has got to do with the creation and initialization of fragment.
Peter Leow 2-Jan-17 4:25am View
What code? My example does not have "Else". If you encounter a new problem after trying, post it as a new question.
Peter Leow 2-Jan-17 4:07am View
How would you expect me to diagnose something with one statement like that? Neither do I have access to your computer nor your screen. Suggest you post it as a new question with more details.
Last but not least, if a solution helped you to solve a specific problem that you have posted, do mark it as solution. Take stock of your previous questions too.
Peter Leow 2-Jan-17 3:09am View
You have to be patient, do one thing at a time. You are putting all mistakes together, some mistakes inevitably cause another one. They are all entangled now and you cannot really differentiate the causes from the effects. I suggest to start from scratch, do a small piece, verify that it works, then move on to another. Good luck.
Peter Leow 2-Jan-17 1:32am View
What happens to the previous question?
Peter Leow 1-Jan-17 10:13am View
Ask yourself, do you really want to do it? What is the rationale for rebuilding? What's wrong with the existing one? Have you consider the time and cost?
If you really decide to go ahead, then adopt the software development life cycle (SDLC), start by looking into the requirements document of that website that your friend has built. If you are new to mvc, then it is time to visit and learn. No pain no gain.
Peter Leow 1-Jan-17 3:23am View
Thank you, and Happy New Year to you!
Peter Leow 31-Dec-16 3:18am View
You are welcome.
Peter Leow 30-Dec-16 9:19am View
check that the url path is correct after migration as the configuration on server is bound to be different from that of the local machine.
Peter Leow 30-Dec-16 3:04am View
You should have shown this part of code in the first place, see addition to solution 1.
Peter Leow 29-Dec-16 6:03am View
You are welcome. Do mark this as the answer.
Peter Leow 28-Dec-16 13:39pm View
Added the pop up message box using JavaScript alert.
Peter Leow 28-Dec-16 13:04pm View
You are welcome.
Peter Leow 28-Dec-16 11:21am View
The link will tell.
Peter Leow 28-Dec-16 9:45am View
Ask your telco, only they know.
Peter Leow 28-Dec-16 9:41am View
"Study hard, learn well, then solve this problem all by myself." Let this be your New Year resolution.
Peter Leow 28-Dec-16 3:10am View
Thank you, Afzaal.
Peter Leow 28-Dec-16 3:10am View
Thank you, CPallini.
Peter Leow 28-Dec-16 3:07am View
"en" is the same as "en-US" which means year/month/day to which your value of "29/12/2016" does not fit. Instead, it fits into "en-GB" which is for UK culture of day/month/year.
Peter Leow 28-Dec-16 2:34am View
Peter Leow 28-Dec-16 2:33am View
Merry Christmas and Happy New Year!
Peter Leow 28-Dec-16 2:19am View
Who needs remainder for Christmas? You can see and hear it coming.