Jump to content

ProfoundDisputes

Member
  • Posts

    112
  • Joined

  • Last visited

Everything posted by ProfoundDisputes

  1. I briefly went over why in my response to Unimportant. I didn't like the look of Qt applications. I also was under the impression that Qt isn't widely used and didn't think I would gain much from learning their framework. I was massively confused about MFC and .Net related material. I am the type of person that needs to know everything about something before I can use it. So when I started reading about win32 api and how its the basic for the object oriented frameworks even if I never use it directly it would be a great learning experience. I learned by lots of self research. I use MSDN alot as a reference too. Once I understood the message loop and the way win32 api is structured things just started clicking and MSDN helped a lot. Though, I am still really new at it but I feel like I have made massive progress so far. I was so confused in the beginning.
  2. I understand what you mean. I made few applications in VB that had a GUI editor and the like. I wanted to practice making GUI applications in C++ but I was having a really hard time deciding on what to do. Its so different from what I was doing with Visual Basic. So I happen to come across the win32 API and for some reason that made more sense to me. I also was unsure what to spend so much time on. I heard that MFC was outdated or something and I couldn't get a straight answer. Nothing seemed to give me what I wanted. I didn't like that Qt appears to be not well used in industry and didn't want to spend time developing skills that didn't pertain to a job in my area.
  3. Just got around to it. I tried to set it up as best I can. Though the file text formatting is messed up in a lot of places not sure why github does that: https://github.com/ProfoundDisputes/win32Calculator
  4. More than willing too. Will link it once I get it setup.
  5. I have heard of GitHub before but never really understood why it was so big. This kinda points to what I think I lack. I just don't understand a lot of the backend stuff like organizing files and how you distribute code and the like. There really doesn't appear to be very accessible youtube tutorials or simple material on this type of process besides long lengthy text books. I honestly lose interest pretty quick unless I can actually start programming. I have taken Structured Programming in C++ college course. Also visual basic and c++ in highschool (5+ years ago). I have been mostly teaching myself inheritance, classes and pointers myself. My goal is to make this project Object Oriented, thought I am not entirely sure I how to design around that frame.
  6. I am trying to teach myself win32 api in C++ by making a simple calculator in Visual Studio 2017. I am having success and making progress so far. Yet, I don't have any feedback on how my code is structured. I would appreciate if people could give me some constructive criticism. I am trying to gain experience to land a Software Engineering position. I had to take a test recently after a job interview and some of the questions pertained to program development. At this point I realized that I don't have any real understanding of the process of software development, I just know how to code. So any advice in planning, layout or structure would be appreciated. I am also looking to get into any collaborative work if you think anything would suit me. I attached a zip folder of my Visual Studio Project folder. This is not a final project so it doesn't actually do anything yet. My biggest accomplishment was just getting the user interface all setup and functional. My next step is actually doing the calculations and than figuring out how to add menus to windows (its confusing me, requires resources?). Thanks GitHub: https://github.com/StrictlyDominick/win32Calculator Project Folder: win32Calculator.zip
  7. I know you are suggesting this course so it must be decent but how much did it help you personally? Like do you feel confident with embedded systems and did you start it as a novice? EDIT: Just want to know before I buy the kits and stuff needed for the class. I want to get started right away but need a little more confidence in the class. So far its looking really promising.
  8. Cool, thanks a lot. I am starting it now. I am still looking for other material or products to check out.
  9. The link that you provided looks promising. I can't really tell what it is though. It doesn't look free even though it says that in the side panel what's the catch? Also I will look into those other products that you mentioned. I just really need something to tell me what I can do with these things (books, project kits or something). I am really not familiar with this stuff at all. If I where to buy some of these pre made boards like what can/should I be doing with them?
  10. I was thinking about the Raspberry PI and the Arduino but then I had an informal interview with a guy from a Avionics company and he was trying to steer me into pics. I see why after doing a lot of research since it looks like it requires more learning and isn't as intuitive because a lot of work is done for you with the Arduinos and stuff (which is what he is saying). I just don't know where to start.
  11. A lot of jobs around me are involved with Embedded Systems and I want to get into working with microcontrollers. I am pretty decent at C++ and VB programming languages and have taken a simple robotics in C programming class in college. I want to get into programming microcontrollers but feel a little overwhelmed. I don't have a ton of cash to spend on this project, $60-$100 USD, so I don't want to waste my money. So what projects can I get going to help me get started in the $60-$100 USD range? Is it worth getting a breadboard and slapping microcontroller, resistors and what not on it? I have seen ways of doing this that I found interesting using In-Circuit Serial Programming (ICSP) such as the PICKit 3 as shown here: http://www.pyroelectro.com/tutorials/pickit3_mplabx/ I like the idea of working with individual components rather than full circuit boards like the Arduino and Raspberry PI; I feel like I would get more out of it learning wise. Any suggestions on where/how to start? A goal would be to eventually be able to turn off and on an electric heater, on a schedule, by mimicking the remote control signals it came with.
  12. Ahh, ya, I don't know a thing about templates yet and that sounded really confusing haha Thanks for the info. I will keep this in mind when I learn templates. Maybe I will get that method you described to work as practice.
  13. I think I get it. CURLOPT_WRITEFUNCTION is expecting a declaration of this format: size_t write_callback(char *ptr, size_t size, size_t nmemb, void *userdata); However within a nonstatic member function there is an extra parameter that is add to know which instance called it so its declaration is really: size_t write_callback(Class *this, char *ptr, size_t size, size_t nmemb, void *userdata); So there is a mismatch in what it expects? If I understand that correctly it gives a bizarre error in response.
  14. Thanks solved my problem. Everything is working perfectly now. So was I right then? Static member functions are processed at compile time instead of runtime. So it wasn't recognizing the function as an address because it gets done at runtime?
  15. I figured out how to get curl to POST and GET to a webpage. It was working fine and writing the stream to a file perfectly. Now I am trying to convert it to a class called DownloadFile. The end result being able to call member functions like: download.HTTPPOST(http, postData, filename); I have the following code in the HTTPPOST member function: void DownloadFile::HTTPPOST(const char * http, const char *postData, std::string filePath) { CURL *curl; CURLcode res; std::ofstream fout; fout.open(filePath, std::ofstream::out | std::ofstream::app); /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); /* get a curl handle */ curl = curl_easy_init(); if (curl) { /* First set the URL that is about to receive our POST. This URL can just as well be a https:// URL if that is what should receive the data. */ curl_easy_setopt(curl, CURLOPT_URL, http); /* Now specify the POST data */ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData); /* send all data to this function */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback); /* we pass our 'chunk' struct to the callback function */ curl_easy_setopt(curl, CURLOPT_WRITEDATA, &fout); /* Perform the request, res will get the return code */ res = curl_easy_perform(curl); /* Check for errors */ if (res != CURLE_OK) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); /* always cleanup */ curl_easy_cleanup(curl); } curl_global_cleanup(); DownloadFile::setStatus(res); } This is the code I have for the write_callback member function: size_t DownloadFile::write_callback(char *ptr, size_t size, size_t nmemb, void *userdata) { std::ofstream *fout = (std::ofstream *)userdata; for (size_t x = 0; x < nmemb; x++) { *fout << ptr[x]; } return size * nmemb; } When I try to build this I get an error: error C3867: 'DownloadFile::write_callback': non-standard syntax; use '&' to create a pointer to member Passing the write_callback function by address was working fine before? I did what it suggested '&' operator before the function and recived this error: error C2276: '&': illegal operation on bound member function expression I am at a loss trying to figure this out. Why doesn't it recognize the write_callback as an memory address? I am now under the impression that it doesn't have a memory address at compile time so it's confused or something? Any help would be appreciated. Thanks.
  16. I am making an application, in C++, that needs to get an resulting aspx file from a postback. I don't know of a way of getting the required postdata since the page encodes some of the data; specifically __VIEWSTATE and __EVENTVALIDATION values. I have been trying to use libcurl to accomplish this post, yet, I don't know the postdata to send. When I look at chrome's header tab for the post both __VIEWSTATE and __EVENTVALIDATION ids have lengthy unrecognizable values. Submit button is calling: onlick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;btnPage1&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" I found these definitions: function WebForm_PostBackOptions(eventTarget, eventArgument, validation, validationGroup, actionUrl, trackFocus, clientSubmit) { this.eventTarget = eventTarget; this.eventArgument = eventArgument; this.validation = validation; this.validationGroup = validationGroup; this.actionUrl = actionUrl; this.trackFocus = trackFocus; this.clientSubmit = clientSubmit; } function WebForm_DoPostBackWithOptions(options) { var validationResult = true; if (options.validation) { if (typeof(Page_ClientValidate) == 'function') { validationResult = Page_ClientValidate(options.validationGroup); } } if (validationResult) { if ((typeof(options.actionUrl) != "undefined") && (options.actionUrl != null) && (options.actionUrl.length > 0)) { theForm.action = options.actionUrl; } if (options.trackFocus) { var lastFocus = theForm.elements["__LASTFOCUS"]; if ((typeof(lastFocus) != "undefined") && (lastFocus != null)) { if (typeof(document.activeElement) == "undefined") { lastFocus.value = options.eventTarget; } else { var active = document.activeElement; if ((typeof(active) != "undefined") && (active != null)) { if ((typeof(active.id) != "undefined") && (active.id != null) && (active.id.length > 0)) { lastFocus.value = active.id; } else if (typeof(active.name) != "undefined") { lastFocus.value = active.name; } } } } } } if (options.clientSubmit) { __doPostBack(options.eventTarget, options.eventArgument); } } Now the code for _doPostBack called towards the end: function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } So it is looking more like I need some way of calling the javascript functions in order to do the posting for me. I might be wrong since I am not a well experienced programmer but how would I get around posting to this webpage?
  17. I am a noob when reading programming documentation. I am learning, though haha. Everything looks ambiguous at this point.
  18. Thanks for telling me how to get the current time with time(NULL). I was getting nowhere looking online for some reason. I was in the middle of trying to use: std::chrono::system_clock::now() Which I couldn't figure out what it returned.
  19. Which is annoying because I have been trying to figure it out for 2+ hours...
  20. Yes, I realized that 10min after posting. I already edited to show that I realized that.
  21. Well I have been researching why I keep getting the epoch time instead of the current time: #include <iostream> #include <ctime> using namespace std; int main() { time_t t = 0; tm time; char buffer[26]; errno_t err; err = localtime_s(&time, &t); if (err) { cout << "ERROR" << endl; cin.get(); return 0; } cout << "This is the time:" << endl; cout << time.tm_mon << "/" << time.tm_mday << "/" << time.tm_year + 1900 << endl; cout << "Hour: " << time.tm_hour << endl << "Min: " << time.tm_min << endl; err = asctime_s(buffer, 26, &time); cout << endl << "Now with asc conversion: " << endl; cout << "This is the time:" << endl << buffer; cin.get(); return 0; } Its not throwing an error or anything but when I run this program I get: EDIT: I realized that localtime_s is a conversion from a time point to a tm structure. I thought it returns the current time. I have to first set time_t t to the current time point. I set it to 0 because it was causing errors by being null.
  22. I am making a program in C++ that needs to download HTML files and extract info from them. The program is to try and figure out my exact nyseg bill by using data from their website. Being a novice in web interaction I managed to figure out how to download webpages with this code: #include <iostream> #include <fstream> #include <string> #include <tchar.h> #include <urlmon.h> #pragma comment(lib, "urlmon.lib") using namespace std; int main() { ifstream fin; string tempString; HRESULT hr = URLDownloadToFile(NULL, _T("http://www.nyseg.com/SuppliersAndPartners/pricingandtariffs/electricitytariffs/transitionchargestatements.html"), _T("nyseg.txt"), 0, NULL); fin.open("nyseg.txt"); for (int i = 0; i < 20; i++) { getline(fin, tempString); cout << tempString << endl << endl; } fin.close(); return 0; } So as long as a I had the url I could then download pages and avoid actually interacting with the pages, until I notice something I think is called postback? This, https://ebiz1.nyseg.com/cusweb/opcosupplyprice.aspx, is a tool for their prices and when you submit to the form the URL doesn't change. The page updates with new information after clicking submit, yet, the URL doesn't change. I spent a few hours looking at the code and researching and I just don't understand it. It uses Javascript in some way and I don't know that language. I see this code in the submit button: onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;btnPage1&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" I simply want to know how to get the updated page downloaded so that I can get the information that I need. -Thanks
  23. Ok after hours of research I got the libcurl library to install via nuget command line package manager (command: Install-Package rmt_curl). However I can't figure out how to get libxml2 working. I am pretty new to programming so I don't have a clue what to do. From my understanding libxml2 library is a C library and I need libxml++ to convert to C++? Is there anything you can point me too on how to install this? I am trying to use this example from the curl website: https://curl.haxx.se/libcurl/c/htmltitle.html.
×