15,914,608 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by lock&_lock (Top 62 by date)
lock&_lock
25-Oct-23 9:36am
View
Oh no. Ok then, I will look into things you mentioned, thanks giving me some directions ! It's been decades since I studied GDB in school and I was never fully understand it to begin with, I guess it time for me to revisit.
lock&_lock
7-Dec-22 12:55pm
View
@Richard It got submitted fine just now. I just removed the array size input part. I would never mess with posting different things and waste people's time. Again, I apologize.
lock&_lock
7-Dec-22 12:50pm
View
@k5054 Your suggestion is on point, this was my mistake that got me stuck for 2 days before posting it here. It got submitted just fine now. I will immediately excuse myself and disappear out of embarrasment, thank you.
lock&_lock
7-Dec-22 12:48pm
View
@Richard As for line 44/45, I have modified the code following @jeron1 suggestion to use size(). I also want to update that @k5054 suggestion was on point, the "array_size" input was unecessary for the submission, and somehow it reported back as segmentation error. It was my mistake, thank you very much for your time & assistance. I will immediately excuse myself and disappear out of embarrasment.
lock&_lock
7-Dec-22 12:34pm
View
@Richard I have updated my question with additional report on the error, that's all of the error information Hackerrank provides. All inputs are only by the website, the website will run the submission against some inputs. User input is not possible.
lock&_lock
7-Dec-22 12:20pm
View
Thanks for suggestion, I have modified my code and put both array_size and max_value as local variables in the function input()
lock&_lock
7-Dec-22 11:56am
View
@Richard thank you for pointing it out, I totally missed it ! I have fixed it and I still have the segmentation error. My code failed exactly at 2 input cases when I run it on the website : 1 2 3 4 5 and 7 69 2 221 8974. I don't think these 2 inputs should be problematic, but I'm stuck.
lock&_lock
23-Feb-22 3:55am
View
They literally are similar, just different numbers. My Sample Input consist of 3 fruit A, and one of test cases has 73201 fruit A, of course it looks like bunch of numbers (73201 fruit location) compared to the Sample in the question. Not remotely similar ? It's a programming challenge, the code is tested against various test cases, obviously they (test cases) have to be similar & represent the same things otherwise how are you gonna test it ? Do you mean it's different because in my Sample Input I have added some comments but I don't put comments in the other test cases ? By reading the post, I believe it's easy to understand that they represent the same thing. I don't know how else I can make it clearer in my post.
lock&_lock
23-Feb-22 3:33am
View
Hi, as I mentioned, they are sample test cases (therefore for input). I have edited my question for better understanding, thanks for pointing that out. "what they represent" : I have explained this in the Sample Input section, sample cases are the same with Sample Input section.
lock&_lock
22-Feb-22 6:27am
View
Exactly what I need ! I wasn't aware of this approach before, I have learned something new from your answer, thank you very much !
lock&_lock
14-Oct-21 22:29pm
View
DONE ! My code has passed all the sample tests ! I've updated my question to include the solution. THANK YOU !
lock&_lock
14-Oct-21 21:37pm
View
Ah, i see. Out of all my trials, I didn't try with dimension other than 3. Now I have to modify this to accept value separated with spaces following n value. I might need to use getline and vector array after all, or nested for. Thank you ! I'll update my post when I can make it work.
lock&_lock
13-Oct-21 10:57am
View
Hi, I posted this question almost 15 hours ago and there's already an accepted solution. However, thank you.
lock&_lock
13-Oct-21 10:56am
View
Hi, I posted this question almost 10 hours ago and there's already an accepted solution. However, thank you.
lock&_lock
13-Oct-21 1:26am
View
@Daniel Hi, thanks. I might be blind again. But for the first solution, the max (either a or b) will be stored in variable "result" anyway (return result). And then the current result will be passed down to be compared against c, d, etc, no ? UPDATE : I understand now, it's because the return command itself. Thank you.
lock&_lock
12-Oct-21 20:25pm
View
@Joe For godsake, I'm completely embarrassing myself. It's is using cin, therefore it will replace the existing value instead of just adding it, why did I think it would work. You are correct, thank you. I'm so blind, I really need to rest.
lock&_lock
25-Sep-20 14:44pm
View
Hi, thanks. Unfortunately, it is instructed for me to use array. Also @Stefan_Lang addressed this issue of argument for "isdigit" in comment section of Solution 3, here's his/her answer :
Actually, the argument type of isdigit is int. See https://www.cplusplus.com/reference/cctype/isdigit/
Your code will work (change it to char) because char gets auto-promoted to int. But declaring array_size as int is correct.
lock&_lock
25-Sep-20 14:40pm
View
This is similar to Soution 1. I tried this, but the line "cout << "Input is not a number " << endl;" still gets printed even if I put integer as an input
lock&_lock
25-Sep-20 14:39pm
View
Thanks, I tried your advice, but the line "cout << "Input is not a number " << endl;" still gets printed even if I put integer as an input
lock&_lock
8-Mar-20 17:20pm
View
Thanks again. Yes, I've tried OpenCV forum all the time. It's not the most responsive forum actually. And about WITH_QT, it's one of many flag options to build OpenCV with CMake. I'll check more if I need to define HAVE_QT somewhere. Thanks
lock&_lock
8-Mar-20 9:53am
View
Updated !
lock&_lock
1-Mar-20 12:31pm
View
Thank you.
lock&_lock
1-Mar-20 12:01pm
View
So I close this question then ? Since probably it's not a coding problem (the code is fine?)
lock&_lock
1-Mar-20 11:52am
View
I think so, I wrote my CMake file the same way I usually did and they always work until this one. Also, in my update no. 3, I tried to print out some values simply using `cout`. When I run my program, they showed up just fine with their correct value, so I guess the executable file is fine.
lock&_lock
1-Mar-20 11:40am
View
I'm not sure how to check on my system, why it won't work on this one. As I mentioned, this code is from a book tutorial, previous examples worked just fine until this. I want to move on to the next chapter but this keeps bugging me. Now I least I know the problem wasn't my code.
lock&_lock
1-Mar-20 11:26am
View
You actually went all the way to install OpenCV to figure this out, thanks a lot ! Did you also compile it with CMAKE ? is it the CMake problem ? Because I only use terminal, not IDE. So there can't be some IDE linker problem. I'm using Ubuntu 18.04, OpenCV 4.2 and CMake 3.2.
lock&_lock
29-Feb-20 10:55am
View
No, sure. Of course, no problem. I also already asked in OpenCV forum. Thank you.
lock&_lock
28-Feb-20 14:08pm
View
Yep, done. There were printed out correctly, but no .yml file generated.
lock&_lock
27-Feb-20 18:47pm
View
Thanks, but to be honest I don't think installing an IDE just for debugging is the answer here because I already have debugging tool.
Earlier, I just went on to install 'gdb' for terminal debugging and read few tutorials on it. I tried several breakpoints (before writing file and before reading file) too and, there no crash, error or anything. Indeed it's not easy with gdb, not to mention I just learned how to use it like 3 hours ago. I agree it is an essential skill and I'm planning to learn more about gdb.
But if I still need to even install an entire IDE, do setup and learn how to debug with it just for debugging purpose (since I know I'm not gonna use IDE for writing code), I don't think it's worth it. I'm stuck and super confused, it's supposed to be an easy code, just to read and write file.
No, I'm not giving up, for now I'm just gonna take a break and get back to it again later. Again, thanks a lot for your reply and debugging advice. I'll update my post when I have progress.
lock&_lock
27-Feb-20 17:44pm
View
Yes, my working directory that I mentioned is also the directory where I run my terminal, where the executable file is there as well. I've also tried with manual searching, the file is not exist. I'm really confused now since I don't encounter any error. Even from debugging there's no crash report or anything.
lock&_lock
27-Feb-20 15:48pm
View
Update : This is extremely hard.
lock&_lock
27-Feb-20 14:48pm
View
Yes, I'm not familiar with debugging and gonna have to search for tutorial on it, and actually I'm working on terminal, not IDE. I will update my progress, thank you.
lock&_lock
7-Feb-20 16:40pm
View
Thanks for pointing out my typo and giving explanation. If my limit is 36, I'd expect the result = 36, that I believe I can manage. When it's ONE STEP TOO FAR, now I understand how it works, thank you. I'm gonna remember this.
lock&_lock
19-Jul-19 4:39am
View
Hi, thanks ! I've updated my code. Now it's showing tearing image, black and white noise image like on TV. I will check on my code again and update it again.
lock&_lock
14-Apr-19 13:13pm
View
Oh, thanks a lot ! After trying to debug, it works now. Thank you very much
lock&_lock
14-Apr-19 7:03am
View
Hi, thanks !! I initialized in my mainloop but somehow forgot to initialize in my main program. Anyway, I initialized it but still the same issue. It's bizarre how I've actually been soending 3 days on this.
lock&_lock
14-Apr-19 6:59am
View
Deleted
Hi, right ! I initialized in the mainloop but not yet main program. Anyway, I initialize also in my main program, but still same issue. It's bizarre how I've been spending literally 3 days on this.
lock&_lock
14-Apr-19 6:59am
View
Deleted
Hi, right ! I initialized in the mainloop but not yet main program. Anyway, I initialize also in my main program, but still same issue. It's bizarre how I've been spending literally 3 days on this.
lock&_lock
13-Apr-19 13:34pm
View
Here it is : https://gist.github.com/raisa0890/9b86a59a02f8441a677709f59bedff8a
lock&_lock
13-Apr-19 12:00pm
View
I even printed out the scaling value inside the lookup table and the value is correct. But in the function it's still zero.
lock&_lock
13-Apr-19 11:38am
View
I spent 20 minutes comparing to your answer, it's exactly the same approach. What's wrong with my code. Let me take a look more :(
lock&_lock
13-Apr-19 10:30am
View
Hi, thanks. Yes, I do call scaling before makeShift. Also, I replied to Rick's comment (with my terminal screenshot). Even after trying to round or cast p[0], p[1] and p[2] the value is still zero.
lock&_lock
13-Apr-19 10:05am
View
Hi Rick, I tried to print the value to the terminal. so p[0], p[1] and p[2] look fine (here's terminal screnshot : https://i.imgur.com/08VtQQ2.png) But after the lookup table function, R, G, B are zero. Even if I round p[0], p [1] and p[2] or cast before I put into function, the result is still zero. So, you are correct this is assignment problem. I'll look for it more.
lock&_lock
13-Apr-19 10:02am
View
Deleted
Hi, I tried to print the value to the terminal. so p[0], p[1] and p[2] look fine (here's terminal screnshot : https://i.imgur.com/h65jKLl.png) But after the lookup table function, R, G, B are zero. Even if I reound p[0], p [1] and p[2] before I put into function, the result is still zero. So, you are correct this is assignment problem. I'll look for it more.
lock&_lock
12-Apr-19 11:47am
View
Hi, thanks. I did check the image loader with this "if(image == NULL) exit(0);", I don't put it in my question. In my last example, I wrote that this code worked with per pixel computation inside the loop (without lookup table), so I knew image source wasn't the problem. I try to make my question not as long. As of now I use structs for header file functions. Thank you, I'll check out about debugger, I never use debugger outside IDE and this time i'm on terminal so I'm not that familiar. [UPDATE] I set pointer as NULL as you suggested, still the same issue.
lock&_lock
12-Apr-19 11:29am
View
Hi @Rick, thanks ! I incremented p and p1, my code was a part of even longer code and I forgot to put here. I've updated my question. It's still the same issue.
lock&_lock
21-Feb-19 9:03am
View
Hi, thanks ! The first solution provided me with pointer, I don't quite understand pointer yet eventhough it's more beneficial, that's why I stick with struct.
I'm aware that the issue is how I call them in my main. I'm going with "struct Intermediate grade (struct Credit point)" (without passing reference) and call it with "struct Intermediate i = grade(course(12,10,10,8));". It works now. Also, of course I tried your solution with passing with reference, unfortunately I encountered many errors. Since there's many benefit with passing reference, I'll try to address the errors on it and see if it works. Thanks again.
lock&_lock
30-Jan-19 22:48pm
View
oh, so this is how I do it instead of do it one by one ! This is genius ! I wasn't aware of this method. I'll try it, thanks again !
lock&_lock
30-Jan-19 12:06pm
View
Oh I see, your solution works, thank you !
lock&_lock
29-Jan-19 18:25pm
View
Hi, thanks. Yes, I don't know how to draw the graph in OpenGL with C. Also I'm working in terminal Mac using OpenCV and OpenGL. About the Excel, as of now I just need to check, but I'm afraid I will end-up need to run and show the colored graph in real time anyway, if I need to export the coordinates and import to Excel all the time it'd be so inefficient. Also, all of this time all of this information I got I read from bunch of different sources, web, papers, blog, etc. So I just kind of patch things up together, if you have decent recommendation to read, I'd really appreciate it, since you're also familiar with this topic.
lock&_lock
29-Jan-19 16:40pm
View
Also confusion line is a series of lines, where all colors along the same line will be perceived as the same color to colorblind people (confuse them), thus confusion line.
lock&_lock
29-Jan-19 16:38pm
View
hi, 400nm would be 0.16 and 0.009. What I wanted was to draw it with openGL and C, I want to know if it's correct or not. As I said in the previous comment, I found tutorial in phyton but I'm not familiar with phyton. It'd be lovely if I can do it using C. Also unfortunately I've been using glut and OpenGL, not modernOpenGL. I wonder if it's possible. thanks again.
lock&_lock
29-Jan-19 16:16pm
View
Hi, thanks. I was able to convert already. I want to draw
confusion line, like this
I know exactly the value of copunctal point (where all the lines converge), but I'm still confused how to specify the value since the copunctal point is not in xy coordinate but in wavelength value. Is there any way I can render this in opengl and C ? I want to see if my calculation was correct or not, I thought it'd make the best sense if I could just draw the graph. As of now, I'll read your recommendation, thanks. Let me know if you have further advice.
lock&_lock
29-Jan-19 16:00pm
View
Hi, oh.. you're familiar with colorimetry, thank god. yes you're right. I'm trying to normalize CIE XYZ into xy plane.
I want to draw
confusion line, like this
I know exactly the value of copunctal point(where all the lines converge), is there any way I can render this in opengl and C ? I thought if I could visualize, I can check if my graph is correct or not. unfortunately I'm not familiar with ModernOpenGL and been using glut and old opengl all this time. I found tutorial with phyton, but I can't risk using too many programming language for just one project. Any advice ?
lock&_lock
28-Jan-19 12:18pm
View
Hi, thanks ! I finally able to wrap my way around. I will update my question.
lock&_lock
28-Jan-19 10:14am
View
Hi thanks, actually I did read before i posted here. Chances are either it's not the easiest thing for me to grasp, or it's not there. It doesn't say anything related to the spectrum on the line nor the conversion to xy plane. So yeah, not the most helpful answer for me.
lock&_lock
22-Nov-18 8:37am
View
Hi, I can change between texture already.
The problem is different, I want to use the same image to produce different source for each texture.
lock&_lock
31-Oct-18 9:43am
View
Hi, thanks. I'll read the article. But I'm afraid switching to Metal isn't going to be the best option for me for the time being. I'm not familiar at all with Metal, and to be honest even now I will not always work with MacOs, so I'd rather use OpenGL for cross-platform convenience. Also, I've updated my question, would you please take a look and give some suggestion, maybe ? Thanks.
lock&_lock
14-Oct-18 14:04pm
View
this is endless loop. I will run this loop as long as the program is executed. It will stop if I hit Esc key, which also will stop the program. I've updated my question, to make it more clear.
lock&_lock
14-Oct-18 13:02pm
View
I found another way by subtracting elapsed time and the time when I hit the key. Then compare the result with the delay. Thanks again.
lock&_lock
17-Sep-18 12:51pm
View
Oh. my bad. I got it now. Thanks a lot !
lock&_lock
17-Sep-18 12:47pm
View
Thanks ! I understand the pointer part, if p is pointing to another memory.
I also undertsand (p+1) is similar to p[1] in this case is Green pixel.
I just don't understand the condition part, what is that condition checking ?
condition if(*p == 0 && *(p+1) == 0) is to check if green pixel value (p+1) equals 0 and *p==0, what is this *p==0 ?
Show More