Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 141 142 [143] 144 145 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 881258 times)

DJ

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2130 on: April 06, 2012, 05:10:23 pm »

Quote
subString2 = originalString.substr((commaIndex + 2), 100);

Remove that 100, so it only reads till the end of the string.
Logged
Urist, President has immigrated to your fortress!
Urist, President mandates the Dwarven Bill of Rights.

Cue magma.
Ah, the Magma Carta...

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #2131 on: April 06, 2012, 05:16:31 pm »

My takehome is a little over $110 a day... if I count weekends and don't count benefits or taxes. Its closer to $250 a work day total if I account for vacation time, taxes, etc. And that's a little low for someone 4-5 years into this career, but I have a lower cost of living than programmers in bigger cities.

Its a solidly middle class career if you don't let it burn you out.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2132 on: April 06, 2012, 05:17:47 pm »

Quote
subString2 = originalString.substr((commaIndex + 2), 100);

Remove that 100, so it only reads till the end of the string.

That's not an issue. If the second argument of substr is greater than the remaining length of the string, it reads until the end and then stops. The issue comes from the fact that commaIndex is never checked to be a valid value. Which it can be, since you need to be using getline to get strings from streams, rather than the extraction operator, which will only pull one character out.

Code: [Select]
#include<string>
#include<fstream>
#include<iostream>

using namespace std;

void sortNames(ifstream& names);

int main()
{
ifstream namesIn;

namesIn.open("Ch8_Ex9Data.txt");

if (namesIn)
sortNames(namesIn);
else
{
cout << "Please ensure the file is in the same directory as this program, and then run the program again." << endl;
namesIn.close();
system("pause");
return 0;
}
namesIn.close();
return 0;
}
void sortNames(ifstream& names)
{
int commaIndex;
string subString1;
string subString2;
string originalString;
string newString;

while(names)
{
getline(names, originalString);
commaIndex = originalString.find(',');
                if(commaIndex == string::npos) continue;
subString1 = originalString.substr(0, (commaIndex - 1));
subString2 = originalString.substr((commaIndex + 2), 100);
newString = subString2 + " " + subString1;
cout << newString << endl;
}
}

armeggedonCounselor

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2133 on: April 06, 2012, 05:23:15 pm »

Ah ha.

Thanks, Mego.

Fakedit: Yup, that worked. Thanks.
Logged
Quote from: Stargrasper
It's an incredibly useful technique that will crash the computer if you aren't careful with it.
That really describes any programming.

timotheus

  • Bay Watcher
  • New to Dwarf Fortress.. Long time ASCII gamer..
    • View Profile
    • Home
Re: if self.isCoder(): post() #Programming Thread
« Reply #2134 on: April 06, 2012, 05:31:08 pm »

I've been doing web app development for a while, but I finally got around to doing more 'serious' programming, in the form of my command-line based logging system. It is written in Python, and uses Amazon's SimpleDB for content storage. Store your logs in the cloud! Why.. I'm not sure but it's cool that it works! Supports tagging, searches, date ranges, etc.

I use it for my daily list of things i accomplish, code things to remember, etc.

Writing a program that has option flags makes me feel like a real greybeard, and I like it. :)

I posted about it here: http://www.bay12forums.com/smf/index.php?topic=106619.0 If you've already seen it, my apologies.

Was hoping to get some fellow programmers to check out the code on github and share their thoughts.

What I learned: Working with Amazon's AWS API's is pretty easy with boto, the Python package.
Logged
twitter: @timotheus
email: tim@hithlonde.com
xmpp: tim@hithlonde.com

Muz

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2135 on: April 07, 2012, 01:05:35 am »

Yeah, looking around vWorker.com, the prices are all over the scale, but based on my pay rate of $110 a day (before tax) which is pretty much bottom dollar for a legitimate American programmer, I wouldn't even waste my time on most of this stuff.

Lol, I only get about 5 times less of that right now to make one mobile phone site every 2 weeks. With a raise to around 3 times less than your pay if I do well. Maybe about equivalent to your pay after 4 years of experience.

This vWorker thing sounds like a good way to get rich.
Logged
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

malloc

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2136 on: April 07, 2012, 02:54:44 pm »

This vWorker thing sounds like a good way to get rich.

No.. Just no.


Honestly, all these freelancer sites are fundamentally broken. The problem is that. Unless you are willing to work for about 4-5$/hour you are not going to get a lot of work, as you will most likely be outbid by some Chinese or Indian who is willing to work for even less.

You get rich by a mixture of doing something people are willing to spend money on, and simply being very lucky.
Logged

Muz

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2137 on: April 08, 2012, 08:17:32 pm »

This vWorker thing sounds like a good way to get rich.

No.. Just no.


Honestly, all these freelancer sites are fundamentally broken. The problem is that. Unless you are willing to work for about 4-5$/hour you are not going to get a lot of work, as you will most likely be outbid by some Chinese or Indian who is willing to work for even less.

You get rich by a mixture of doing something people are willing to spend money on, and simply being very lucky.

Well, yeah, that's the point. 4-5 an hour is quite a good wage where I come from. But yeah, I hate freelancing. If I wanted to freelance, I'd go the Toady route. Heck, if I could make even half as much as Toady does, it'd be the equivalent of the wage a COO of a medium sized company gets around here.
Logged
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2138 on: April 10, 2012, 01:51:42 am »

>_<
if you don't mind me asking, what country do you live in?
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2139 on: April 10, 2012, 07:21:23 am »

Registered for Google Code Jam. It looks a lot like the high school competitions I've been going to and winning since the beginning of this year, only with *much* harder competition.

Bring it on.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2140 on: April 10, 2012, 09:26:17 am »

Thanks for the reminder, so did I.
I never competed in anything like this before (save that one time in 2001 where we did a chess-robot-arm in ANSI C, our version managed to circumvent the safety routines and actually smashed the chessboard), so I'm ready to have my ego crushed.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2141 on: April 10, 2012, 06:29:56 pm »

My goal is to get to Round 2. It's high enough to give me something to reach for, but low enough that I might actually reach it.

On Friday, may the odds be ever in your favor.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2142 on: April 11, 2012, 04:04:44 am »

As with you, good luck!

The qualification round of last year, which I did for fun, giggles and practice, was easy enough. I should at least be able to make it that far :)
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Muz

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2143 on: April 11, 2012, 05:03:13 am »

>_<
if you don't mind me asking, what country do you live in?

Malaysia, similar economy to India I suppose :P But seems like my company's been fairly generous with the bonuses recently so it makes up for low base wage.
Logged
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #2144 on: April 11, 2012, 10:05:02 am »

>_<
if you don't mind me asking, what country do you live in?

Malaysia, similar economy to India I suppose :P But seems like my company's been fairly generous with the bonuses recently so it makes up for low base wage.

Cost of living makes a world of difference. On my current salary, there is no way I could live comfortably in San Francisco or New York City. In this part of Florida, I am doing pretty well. In India or Malaysia I would be rich.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.
Pages: 1 ... 141 142 [143] 144 145 ... 796