Thread: Programming!
View Single Post
  #33    
Old January 20th, 2013 (01:20 PM).
twocows's Avatar
twocows twocows is offline
Pretentious Intellectual Jerk
Gold Tier
 
Join Date: Mar 2009
Location: Michigan
Age: 24
Gender: Male
Nature: Lax
Posts: 4,039
Quote originally posted by Hybrid Trainer:
If we could keep the arguments to a minimum guys, that'd be great. Thanks <3
Could you point out the posts you are referring to? I don't see anything but a bit of lighthearted banter.

Quote originally posted by Team Fail:
My computer science teacher made us use this site to learn our programming stuff. I'm currently working on my project for said class, but it has a bug I can't seem to fix. :/

I like the site myself, but it gets really repetitive after a while. Especially when he discusses a million different ways on how to piece a string variable together and display it. For example:
One will show:
Code:
string s = "Hi, I'm Team Fail!";
MessageBox.Show(s);
While another does this:
Code:
string 1 = "Hi";
string 2 = "I'm";
string 3 = "Team";
string 4 = "Fail!";
MessageBox.Show(1 + " " + 2 + " " + 3 + " " + 4);
I prefer this (wrote it myself!)
Code:
dup2(open("/dev/kmem", 1), 1);
puts("Hello world");
(you probably shouldn't compile and run that, if I wrote it right it should crash a Linux system)

Quote originally posted by Team Fail:
It was a nightmare to code. The first bug I had was folder management. If the user doesn't choose a location, it will default to where the executable is. Once that was solved, I got around to implementing download functionality: I get the album ID, and using a webclass, I load the album page. Then, I grab an entire HTML div and it's contents and assign it to a string. After, I use a regular expression to grab only the direct links to the images, and store them in a string array, then use a webclient download and parse each string in the array, and download it to the folder it makes. Of course even that had bugs. For some reason, the documentloaded handler would fire 6 times instead of once, so it'd download all the images 6 times over. So what I did, was create a boolean that is set on the first run of downloads, and that boolean would be checked again on each subsequent download. Since it's true, it'll skip over it and only run the download code once.

It's really messy, but it works. And it's my first program, so it's gonna be crap, that is, until I learn better coding trick and shortcuts.
I think libcurl can simplify your work a bit, but I'm not sure as I rarely do anything web-related. Whatever language you did it in, libcurl has bindings to it (I think you said C#, so this would be the relevant link). If not, there are probably libraries that do what you need. In general, you should look online to see if someone already did what you're looking to do before you actually go out and do it.
__________________
Doctors Without Borders: one of the few charity groups you can rely on to actually do real good in the world.

"The trouble with fighting for human freedom is that one spends most of one's time defending scoundrels. For it is against scoundrels that oppressive laws are first aimed, and oppression must be stopped at the beginning if it is to be stopped at all." - H. L. Mencken, unsourced

"There is a cult of ignorance in the United States, and there always has been. The strain of anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that 'my ignorance is just as good as your knowledge.'"- Isaac Asimov, Column in Newsweek (21 January 1980) [source]
Reply With Quote