Reputation: 3 Apprentice
- Active Members
- Active Posts:
- 99 (0.12 per day)
- 08-July 12
- Profile Views:
- Last Active:
- Jun 28 2013 08:00 AM
- OS Preference:
- Who Cares
- Favorite Browser:
- Favorite Processor:
- Favorite Gaming Platform:
- Your Car:
- Dream Kudos:
Posts I've Made
Posted 28 Jun 2013I never learned C or C++ formally, but rather on my own using nothing but internet resources and trial-and-error. The entire concept of "classes" was actually completely foreign to me until I'd been programming for several months, and up to that point, my code was generally poorly organized and all but impossible to navigate (Skydiver probably remembers...thank you for your patience!)
I paged through the K&R book (a very early edition, too) a few times for reference, and it was pretty helpful to get me started, but right from the start I knew that C++ was a lot different from C. Perhaps not at first, but what I like is that one can write an entire functional program without using traditional C-style constructs...or write an entire program that's almost pure C but with the additional "user-friendly" tweaks of C++.
Certain common frameworks based on C++ are class-based, though - Qt comes to mind, for instance. Glance at the official Qt documentation sometimes - class this class that. Then again, Qt is designed for people who already do cross-platform programming in C-based or C-like languages, like Java, so from what I gather it's designed to be interchangeable and familiar right from the start.
I've often thought about how I'd teach an introductory class, or really any class, but I have a tendency to make things too complicated. The whole idea of classes, and indeed OO programming in C++ to begin with, can seem a little strange, especially to people who know about C# and Java and therefore have a hard time figuring out the differences between, say, C# classes and C++ classes, both high- and low-level. I still haven't totally grasped it myself, but then again, I'm not using "pure" C++ most of the time.
Posted 10 Mar 2013Yup, cURL did it. They must not like httpd requests or whatever. Can't say I blame them. Especially from a random Amazonian IP.
Execution time down from 2115 seconds to 51 seconds.
Thanks for the tip. The entire cloud-based backend is functional now!
Posted 10 Mar 2013It's Amazon EC2, so I have full control over what I install on (in this case) Ubuntu Server. I happen to know that cURL is installed. So, I'll try that!
Posted 10 Mar 2013Their API is designed well enough, although it's not really a full API...more like "format your URL like this and you get a JSON yay!" The problem is that their database is not really laid out sequentially. You'd think it would start at item #0 and work its way up to somewhere in the ~37.000 range (from what I hear, that's how many they've got), but no, the numbers assigned to different entries are based on random stuff like how long it's been around (smaller numbers) and more recently its "category," which just further complicates things as it's all very closed-source.
They probably are throttling my requests, which is weird because I'm making 66 or so whereas sites (read: fansites) that maintain what are essentially mirror databases of their own will make over 37.000 a day.
But yes, it's worth mentioning that while I was in the process of writing the retrieval script, to make sure it worked I made a test JSON with one item and it would always take between 30 and 32 seconds to get data just for one.
Interestingly, I'd done the exact same thing in Java and it would take seconds to retrieve data for the whole list!
Thing is, I want to automate the creation of a master JSON because the Java program was querying the database each time I selected an item from the list, resulting in hundreds of requests instead of a flat number.
Also the value I want to retrieve only changes once every 24 hours anyway.
I'll have to ask the controlling company about their throttling policy. Maybe I should use cURL? In any case, I'm a moderator of their official forums, which is an invite-only position, so hopefully they'll know that I'm not out to write any kind of malicious code!
Thanks for the tips. I'll try the sleep(1) anyway, just to see if it has any effect.
Posted 26 Feb 2013Okay, thank you!
I will simply have to learn more about JSON, then. It's not that bad as is - I simply compiled the org.json package from, well, json.org...just gotta figure out a working method of obtaining the specific string (just an integer) that we need and then we're off.
I certainly have no qualms about foregoing XML altogether. I know a fair bit about it through using BOINC, as any and all end-user customisation or tweaking is done via the editing or creation of XML files, which are then read in Perl and the rest is a mystery to me.
JSON it is, then! Thank you for the tips, as always.
I promise this program has nothing at all to do with prime numbers.
- Member Title:
- D.I.C Head
- 22 years old
- July 15, 1992
- Newtown Square, PA, USA
- photography, computer repair, programming, guitar, music composition, coffee
- Full Name:
- Jaska Börner
- Years Programming:
- Programming Languages:
- C,C++,VC++,Qt,Objective-C,Windows API,Cocoa,Java,Android,PHP,HTML5,CSS3,JS
nullcoding hasn't added any friends yet.