Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 302 303 [304] 305 306 ... 796

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

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #4545 on: June 22, 2013, 03:34:42 am »

I made this mistake 3 hours ago. Kudos if you immediately know why.

Code: ((C++)) [Select]
std::map<std::pair<int,int>,bool> openset;
/* fill out openset */
while(openset.size() != 0)
{
/* stuff */
if ( /* a condition is written here */) // if a certain condition is satisfied, delete the contents of openset
  openset.empty();
}
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4546 on: June 22, 2013, 03:36:09 am »

I made this mistake 3 hours ago. Kudos if you immediately know why.

Code: ((C++)) [Select]
std::map<std::pair<int,int>,bool> openset;
/* fill out openset */
while(openset.size() != 0)
{
/* stuff */
if ( /* a condition is written here */) // if a certain condition is satisfied, delete the contents of openset
  openset.empty();
}

I have made that same mistake many times. For some reason, I can't ever keep straight in my head which STL functions do what, and which STL containers support which functions.

Spoiler (click to show/hide)

Scoops Novel

  • Bay Watcher
  • Talismanic
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4547 on: June 22, 2013, 12:32:48 pm »

Is there an arguable cap out point for how far you can readily get with coding on your own? What would you say it usually is?
Logged
Reading a thinner book

Arcjolt (useful) Chilly The Endoplasm Jiggles

Hums with potential    a flying minotaur

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4548 on: June 22, 2013, 12:40:19 pm »

I see people are practicing for the next International Obfuscated C Contest?
Logged

Toxicshadow

  • Bay Watcher
    • View Profile
    • github
Re: if self.isCoder(): post() #Programming Thread
« Reply #4549 on: June 22, 2013, 02:55:05 pm »

Anyone knowledgeable with MSVC? I have a problem with my main form...

So Im working on a program for a mod for DF, writing it in C#. Well, for one part I need to invoke the form_Load event; this seems to override the Load event, forcing every control to not initialize/draw. Rather than the screen I get in Designer, I just get the default, blank, resizable form.  What do I need to add to my Load event, to initialize everything, so as that my controls appear?

Sorry Im kindof a nub to MSVC ^^;
Logged
Quote
'ere the Chias get hungry...

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #4550 on: June 22, 2013, 03:10:16 pm »

Anyone knowledgeable with MSVC? I have a problem with my main form...

So Im working on a program for a mod for DF, writing it in C#. Well, for one part I need to invoke the form_Load event; this seems to override the Load event, forcing every control to not initialize/draw. Rather than the screen I get in Designer, I just get the default, blank, resizable form.  What do I need to add to my Load event, to initialize everything, so as that my controls appear?

Sorry Im kindof a nub to MSVC ^^;

I don't do gui's in vs very often, but I believe all you have to do is call super.load(), alternatively you could override the onload event wich should take place after the form loads, and before other stuff. But... this is fuzzy memory to me.
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.

Toxicshadow

  • Bay Watcher
    • View Profile
    • github
Re: if self.isCoder(): post() #Programming Thread
« Reply #4551 on: June 22, 2013, 03:32:25 pm »

Anyone knowledgeable with MSVC? I have a problem with my main form...

So Im working on a program for a mod for DF, writing it in C#. Well, for one part I need to invoke the form_Load event; this seems to override the Load event, forcing every control to not initialize/draw. Rather than the screen I get in Designer, I just get the default, blank, resizable form.  What do I need to add to my Load event, to initialize everything, so as that my controls appear?

Sorry Im kindof a nub to MSVC ^^;

I don't do gui's in vs very often, but I believe all you have to do is call super.load(), alternatively you could override the onload event wich should take place after the form loads, and before other stuff. But... this is fuzzy memory to me.
Hm, tried setting it to onLoad, no luck.  So I tried setting it to something like Click, the GUI still doesn't load.  Could it be that something went wrong with my breakpoint? Earlier I used a breakpoint for debugging, removed it via right clicking, but the program still only runs until were the breakpoint was. The IDE doesn't show that a breakpoint exists, but still.

Edit: Even tried setting it to use the onLoad event for a control other than form1, still, the controls don't initialize/render.  I suppose I'll try rebuilding everything in a new project

Edit2: e.e Found my problem. I was missing this:
Code: [Select]
        public Form1()
        {
            InitializeComponent();
        }
*facedesk*
« Last Edit: June 22, 2013, 03:48:54 pm by Toxicshadow »
Logged
Quote
'ere the Chias get hungry...

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4552 on: June 22, 2013, 04:17:15 pm »

I had a similar story yesterday at work.

I mentioned prior that I'm a Django dev. Well, we began using qunit to unit test our javascript a month or so back. I'm the only one on the team besides the lead that gives a damn about them. In fact, the commit logs show that every single line of code was written by yours truly. I'm not saying I like qunit as a framework and working with javascript all day gives me a throbbing headache, but it's my misshapen, diseased baby.

So, when one of our new hires made some pretty sweeping changes to the logic (which was desperately needed, don't get me wrong), the tests broke. Those broken tests got merged because I'm just about the only one that checks them when working on the front-end.

Since I was working on the module anyway, I tried fixing the tests for him. The new hire's changes involved making certain display elements change colors when a specific event takes place (how's that for anonymization of our prodcut? Colors change when a button is pressed), I set up a fixture that roughly approximates the structure in production and began testing that the color of elements were what they should be before and after the event. Only it didn't work. I ran through our code for half of the day and could find absolutely nothing wrong. I hand-traced the path through our mess of javascript. I manually examined the document structure of both the actual page and my test fixture and could find no significant differences that would prevent this from working. In fact, my debugging told me that it was working just fine.

Fast forward to a few minutes before I leave, when I realize that everything was working perfectly. Our css files were not included in the test because we're supposed to be testing javascript, not css.
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #4553 on: June 22, 2013, 04:59:17 pm »

Honestly, nowadays reading Clean Code by Robert C. Martin should be mandatory for all programmers. Proper testing is just a matter of professionalism and craftsmanship...When writing professional code, I tend to think you should always test first and test often.

Whilst of course automated tests are by no means a replacement for a person sitting down and actively QAing a piece of work, nor should they be, but the rapid feedback cycle they give a programmer when they've broken something is priceless since it stops you breaking more stuff. People miss things, automated tests miss things, but when all that's missed is the overlap that's instantly a good chunk of such problems removed.
« Last Edit: June 22, 2013, 05:06:56 pm by MorleyDev »
Logged

forsaken1111

  • Bay Watcher
    • View Profile
    • TTB Twitch
Re: if self.isCoder(): post() #Programming Thread
« Reply #4554 on: June 22, 2013, 05:12:40 pm »

I see people are practicing for the next International Obfuscated C Contest?
I suppose you could say the cap out point for a solo programmer would be Dwarf Fortress. Toady really shows what a single dedicated person could do.
Logged

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4555 on: June 22, 2013, 06:06:20 pm »

Is there an arguable cap out point for how far you can readily get with coding on your own? What would you say it usually is?
The true secret of programming: Everyone is self-taught.

The amount of resources out there covers literally everything.
Logged

Willfor

  • Bay Watcher
  • The great magmaman adventurer. I do it for hugs.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4556 on: June 22, 2013, 06:15:45 pm »

The amount of resources out there covers literally everything.
Except the one obscure half-documented function in a library that is necessary to get things to run properly, but you have to finick with it for hours to get it to work the way you want it too. Watch out for those.
Logged
In the wells of livestock vans with shells and garden sands /
Iron mixed with oxygen as per the laws of chemistry and chance /
A shape was roughly human, it was only roughly human /
Apparition eyes / Apparition eyes / Knock, apparition, knock / Eyes, apparition eyes /

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4557 on: June 22, 2013, 08:55:55 pm »

Is there an arguable cap out point for how far you can readily get with coding on your own? What would you say it usually is?

There isn't a solid cap.  You might run into a point what you personally can't proceed without external assistance, but there isn't really a solid cap where nobody can proceed beyond without external assistance.  Even then, you'll probably work it out eventually.  The bigger issue is how long it will take you to get there.  It is typically faster to progress with somebody else to ask questions to.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4558 on: June 23, 2013, 02:49:21 am »

Code: [Select]
local function assignSpells(unit)
local school = df.global.world.raws.inorganics[magicInorganics[unit.status.souls[1].name.first_name]].material --jebus CHRIS that's a tiny amount of code for what I expected
for i=0,unit.status.souls[1].unk2 do --unk2 is level of magic skill
assignSyndrome(unit,school.syndrome[i].id)
end
end

Oh my god this is ZEN. I thought this code would take 5 functions, each of which would be fairly large, but this looks like it'll work perfectly given how I'm writing my raws.
« Last Edit: June 28, 2013, 04:08:07 pm by Putnam »
Logged

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4559 on: June 26, 2013, 11:03:49 am »

EDIT: Nevermind.
It is wise not to treat one class as another.

EDIT2: This is annoying. Seems if you use [] to directly access a letter in a string, you get a signed string instead of an unsigned one, where numbers over 125 are turned negative. This was screwing up my text drawing pretty bad.
« Last Edit: June 26, 2013, 11:36:56 am by cerapa »
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.
Pages: 1 ... 302 303 [304] 305 306 ... 796