Bay 12 Games Forum

Please login or register.

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

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

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2115 on: April 05, 2012, 10:26:18 pm »

I had the mother of all facepalms today, debugging code with my boss.  I couldn't figure out why a page-to-print was producing growing margins with every page.  I looked that code over backwards and forwards, and then he hits a search one time, and I see the issue.

Code: [Select]
point.X = margin += colX_1;
                ^^^^ wut

Why the fuck does that even compile?  You can't set two variables in one statement, that's impossible.

Actually, you can. Any assignment operation returns the value of the assigned object. Using the += operator is an assignment operation, so it returns margin, which, after evaluating the right-most statement, is (margin + colX_1). It's perfectly legal.

C++ example:

Code: [Select]
int operator+ (int lhs, int rhs) {
     return (lhs + rhs);
}

int operator+= (int lhs, int rhs) {
     lhs = lhs + rhs;
     return lhs;
}

Every C-based language I've encountered returns the result of the assignment operation to allow for chained assignment.

EDIT: Ninja'd.

DrPoo

  • Bay Watcher
  • In Russia Putin strikes meteor
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2116 on: April 06, 2012, 05:57:47 am »

Does anybody know how to access the uhh.. terminal buffer of a windows terminal, directly? I want to make a simple function where i can place a character a specific spot in the terminal, based on its coordinates. I am using C++ by the way.
Logged
Would the owner of an ounce of dignity please contact the mall security?

kaijyuu

  • Bay Watcher
  • Hrm...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2117 on: April 06, 2012, 06:25:30 am »

Hrm, random question.


I'm going to need to completely get off the support of my parents soon, and as such I'll need a better job for school/etc. I've a decent knowledge of programming, and could probably get enough training for a low-end programming job within a year. Is programming a good idea for a college job?

I don't want 40 hours of work and 40 hours of school every week or I'll go crazy, but if I could support myself on a 20 hour a week programming job (assuming one exists), that'd be great. It's something I don't hate, unlike waiting tables or something like that.
Logged
Quote from: Chesterton
For, in order that men should resist injustice, something more is necessary than that they should think injustice unpleasant. They must think injustice absurd; above all, they must think it startling. They must retain the violence of a virgin astonishment. When the pessimist looks at any infamy, it is to him, after all, only a repetition of the infamy of existence. But the optimist sees injustice as something discordant and unexpected, and it stings him into action.

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2118 on: April 06, 2012, 07:24:57 am »

Does anybody know how to access the uhh.. terminal buffer of a windows terminal, directly? I want to make a simple function where i can place a character a specific spot in the terminal, based on its coordinates. I am using C++ by the way.

The curses library should get you what you want. It's cross-platform IIRC.

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #2119 on: April 06, 2012, 07:33:03 am »

Hrm, random question.


I'm going to need to completely get off the support of my parents soon, and as such I'll need a better job for school/etc. I've a decent knowledge of programming, and could probably get enough training for a low-end programming job within a year. Is programming a good idea for a college job?

I don't want 40 hours of work and 40 hours of school every week or I'll go crazy, but if I could support myself on a 20 hour a week programming job (assuming one exists), that'd be great. It's something I don't hate, unlike waiting tables or something like that.

Its going to be difficult. Without contacts, experience or a degree you will have a hard time getting your foot in the door. And then you are looking for non-standard work. If you know people and are good at marketing yourself as well as programming you might be able to freelance 20 hours a week on average. But a steady 20 is going to be hard to find.
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.

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #2120 on: April 06, 2012, 09:12:01 am »

Does anybody know how to access the uhh.. terminal buffer of a windows terminal, directly? I want to make a simple function where i can place a character a specific spot in the terminal, based on its coordinates. I am using C++ by the way.

The curses library should get you what you want. It's cross-platform IIRC.

Alternatively Windows has a lot of console output functions such as WriteConsoleOutput
Logged

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2121 on: April 06, 2012, 09:20:25 am »

Is anyone here particularly talented in brainfuck? It looks interesting, but the name describes it very well.

I've spent ages with it. What do you want to know?
Logged

kaijyuu

  • Bay Watcher
  • Hrm...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2122 on: April 06, 2012, 09:53:19 am »

Hrm, random question.


I'm going to need to completely get off the support of my parents soon, and as such I'll need a better job for school/etc. I've a decent knowledge of programming, and could probably get enough training for a low-end programming job within a year. Is programming a good idea for a college job?

I don't want 40 hours of work and 40 hours of school every week or I'll go crazy, but if I could support myself on a 20 hour a week programming job (assuming one exists), that'd be great. It's something I don't hate, unlike waiting tables or something like that.

Its going to be difficult. Without contacts, experience or a degree you will have a hard time getting your foot in the door. And then you are looking for non-standard work. If you know people and are good at marketing yourself as well as programming you might be able to freelance 20 hours a week on average. But a steady 20 is going to be hard to find.
Ah, thought it'd be something like that.

'Twas just an idea.
Logged
Quote from: Chesterton
For, in order that men should resist injustice, something more is necessary than that they should think injustice unpleasant. They must think injustice absurd; above all, they must think it startling. They must retain the violence of a virgin astonishment. When the pessimist looks at any infamy, it is to him, after all, only a repetition of the infamy of existence. But the optimist sees injustice as something discordant and unexpected, and it stings him into action.

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2123 on: April 06, 2012, 12:20:30 pm »

Hrm, random question.


I'm going to need to completely get off the support of my parents soon, and as such I'll need a better job for school/etc. I've a decent knowledge of programming, and could probably get enough training for a low-end programming job within a year. Is programming a good idea for a college job?

I don't want 40 hours of work and 40 hours of school every week or I'll go crazy, but if I could support myself on a 20 hour a week programming job (assuming one exists), that'd be great. It's something I don't hate, unlike waiting tables or something like that.

It will be hard to find a job, but you might be able to find someone who will pay for helping/doing stuff for commission. For example, a classmate of mine found a job writing a frontend for a small company's database system, which payed nicely.
Logged

DJ

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2124 on: April 06, 2012, 02:06:09 pm »

What's wrong with Rent-a-Coder?
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 #2125 on: April 06, 2012, 02:09:22 pm »

What's wrong with Rent-a-Coder?

The fact that you are competing against people in india who think $1.50 an hour is decent pay.

It only works if you have a pre-built set of templates and manage to snipe jobs that fit the template with minimal modification.
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.

AlStar

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2126 on: April 06, 2012, 02:12:41 pm »

I'm happy, after one of my Java-based hobby projects ground to a complete halt 3 or 4 years ago now (damn, has it really been that long?) when I tried moving from a purely console-based system to a purely GUI-based system, I finally motivated myself to put some more hours into it this week... and I've made real progress! My program now works again - You can type in things and the program will do them! It's a good feeling, especially since the game wouldn't even get past the first menu before.

Of course, I've now got hours of reprograming all the old code System.out.println's  so that they work with the new GUI format, but once that's done, I can finally start actually programming in new stuff.

DJ

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

What's wrong with Rent-a-Coder?

The fact that you are competing against people in india who think $1.50 an hour is decent pay.

It only works if you have a pre-built set of templates and manage to snipe jobs that fit the template with minimal modification.
Oh wow, I just checked it out and it's much worse than I thought. Not programming, but I imagine it's similar there:
- one guy is looking for 500 word articles on food, paying 1$/article
- another guy is offering 40$ for 15k words story (isn't that like a thin book?)

I live in Bosnia, and there's no way in hell I'd work for so little money. I could make a better living hunting and gathering in our mine-ridden forests. Who the hell works for so little? I don't think these are competitive wages even in Somalia.
Logged
Urist, President has immigrated to your fortress!
Urist, President mandates the Dwarven Bill of Rights.

Cue magma.
Ah, the Magma Carta...

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2128 on: April 06, 2012, 02:35:41 pm »

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.
Logged
And here is where my beef pops up like a looming awkward boner.
Please amplify your relaxed states.
Quote from: PTTG??
The ancients built these quote pyramids to forever store vast quantities of rage.

armeggedonCounselor

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2129 on: April 06, 2012, 04:52:24 pm »

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.

.... Where do you work? I could definitely go for $110 per day. I currently make about $200 per week.

Granted, I'm not working as a programmer, but still....

I digress. I came in here with a purpose. Another probably really obvious problem with another piece of code.

Spoiler: The Code (click to show/hide)

It's giving me an Out of Range "invalid string position" error. Wat do?
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.
Pages: 1 ... 140 141 [142] 143 144 ... 796