Page 3 of 12 FirstFirst 123456789101112 LastLast
Results 61 to 90 of 356

Thread: ProgrammersitP

  1. - Top - End - #61
    Barbarian in the Playground
    Join Date
    Jul 2007
    Gender
    Male

    Default Re: ProgrammersitP

    Quote Originally Posted by Kallisti View Post
    My most immediate project is a program that will take parameters for a given RPG's die system and output some statistical calculations--so you could ask how likely you are to succeed in a given opposed roll in nWoD or how many hobgoblins your ranger can kill before getting nat-20'd to death. Eventually I'd like to release it as a series of free apps--one for each system I end up supporting.
    I made a dice rolling program, and I plan to expand it to include probabilities and more systems, although my general goals for that are much smaller then yours (I don`t plan to include calculations for opposed roles, I don`t want to make it user friendly, etc).

    There is a formula which I think is correct for calculating the probability of a certain sum in a roll of a few dice, but I don`t remmember it exectly.
    A world behind the mirror (stand alone plane)

    (Wall) passer, a rogue variant

    My not realy extanded homebrewer signature

    Quote Originally Posted by Grinner View Post
    In a world ruled by small birds, mankind cannot help but wonder how this state of affairs came about.

  2. - Top - End - #62
    Ettin in the Playground
     
    PairO'Dice Lost's Avatar

    Join Date
    Dec 2008
    Location
    Malsheem, Nessus
    Gender
    Male

    Default Re: ProgrammersitP

    • Where are you and what are you doing in terms of programming? Employment, education or in your spare time?
      I have a MS and BS in computer science and am working as a software engineer at a Big Data company.
    • What language or languages are you using primarily at the moment? What's your favourite, and why?
      Languages I'm using at work: C, C++, Python, and MySQL.
      Languages I'm using for fun: Perl, PHP, and Java.
      I love Perl's quirky syntax and built-in hashes and regular expressions, so I'd say that's my favorite right now.
    • Where do you hope to go with your programming? Any plans for the future, or just waiting to see if anything of interest comes along?
      No plans, really, I just like coding.
    • Any projects, personal or otherwise, you're in the middle of? Anything you're really focused on?
      I'm working on a D&D database for my group's use, basically a comprehensive SRD of all 3e material out there like dndtools or realmshelp, but that isn't missing anything and that has more powerful searching and sorting. It's all OCRing PDFs, parsing, formatting, scanning, stuff like that. I've also recently made a tower defense game with an AI that reacts to the player's choice of tower types, paths defended, etc.
    • What environment do you work/prefer to work in? Netbeans/Eclipse/Command line and a text editor?
      Linux terminal and vim for me, please. My work laptop is a Macbook, but the dev team works in a RHEL 6 VM.

    Quote Originally Posted by Kallisti View Post
    My most immediate project is a program that will take parameters for a given RPG's die system and output some statistical calculations--so you could ask how likely you are to succeed in a given opposed roll in nWoD or how many hobgoblins your ranger can kill before getting nat-20'd to death. Eventually I'd like to release it as a series of free apps--one for each system I end up supporting.
    Writing dicerollers and other gaming apps is a hobby of mine as well. I wrote a diceroller that handles conditional logic, exploding dice, rerolls, multiple rolls, and more. Some examples:

    Spoiler
    Show
    Code:
    ~$ diceroller.pl "7d10b5e10" --verbose
    	7d10b5e10	Result: 29
    	Rolled 8d10: 2, 4, 6, 3, 4, 10 (die 6 exploded), 5, 1
    	Chose best 5: 10 6 5 4 4
    Code:
    ~$ diceroller.pl "1d20+X" --repeat 4 --var "X={20/15/10/5}"
    	1d20+20	Result: 39
    	1d20+15	Result: 17
    	1d20+10	Result: 28
    	1d20+5	Result: 21
    Code:
    ~$ diceroller.pl "1d20+5" --repeat 100 --atleast 23 --index
    	1) 1d20+5	Result: 25	Critical Hit!
    	4) 1d20+5	Result: 24
    	5) 1d20+5	Result: 25	Critical Hit!
    	8) 1d20+5	Result: 25	Critical Hit!
    	15) 1d20+5	Result: 24
    	24) 1d20+5	Result: 24
    	28) 1d20+5	Result: 25	Critical Hit!
    	37) 1d20+5	Result: 24
    	65) 1d20+5	Result: 24
    	69) 1d20+5	Result: 25	Critical Hit!
    	70) 1d20+5	Result: 23
    	83) 1d20+5	Result: 23
    	86) 1d20+5	Result: 24
    	87) 1d20+5	Result: 25	Critical Hit!
    	90) 1d20+5	Result: 24
    	92) 1d20+5	Result: 23
    	97) 1d20+5	Result: 23

    I also wrote a dice statistics program for arbitrary dice expressions:

    Spoiler
    Show
    Code:
    ~$ statistics.pl 
    Enter a dice expression:
    4d6b3
    	Result	Times	Probability
    	3	1	0.0008
    	4	4	0.0031
    	5	10	0.0077
    	6	21	0.0162
    	7	38	0.0293
    	8	62	0.0478
    	9	91	0.0702
    	10	122	0.0941
    	11	148	0.1142
    	12	167	0.1289
    	13	172	0.1327
    	14	160	0.1235
    	15	131	0.1011
    	16	94	0.0725
    	17	54	0.0417
    	18	21	0.0162
    
    Mean: 12.2445987654321	Standard Deviation: 2.8468

    ...as well as a simulator for Star Wars Saga vehicle combat to handle massed attacks, condition track steps, shield reduction, and such. It made combats in my Rogue Squadron campaign ("72 TIE Interceptors and 2 Dreadnoughts? There's 12 of us, we can take 'em!") a lot easier to handle.
    Better to DM in Baator than play in Celestia
    You can just call me Dice; that's how I roll.


    Spoiler: Sig of Holding
    Show

    Quote Originally Posted by abadguy View Post
    Darn you PoDL for making me care about a bunch of NPC Commoners!
    Won a cookie for this, won everything for this

  3. - Top - End - #63
    Bugbear in the Playground
     
    TSGames's Avatar

    Join Date
    May 2005
    Location
    control+apple+alt+8

    Default Re: ProgrammersitP

    For people into Python: I thought this was pretty neat.
    TopSecret's First Ever Two Page Tabletop Contest
    If you have any questions, want to talk about the contest entries, or you just want to hang out with cool people, visit our forums.

  4. - Top - End - #64
    Bugbear in the Playground
     
    Miklus's Avatar

    Join Date
    Dec 2005
    Location
    Denmark
    Gender
    Male

    Default Re: ProgrammersitP

    Quote Originally Posted by Skami Pilno View Post
    For people into Python: I thought this was pretty neat.
    I don't get it... What does it do? Other than write "good job" in big red letters, obviously.


    EDIT: On second look, it compiles the code you type in? that is neat in a redundant sort of way.

    Might as well add a question of my own: Is everything classes and automatic garbage collection these days? I ask because we don't use that much where I work. The programs we make has to run real time, so I guess we have a wierd programming style.

    I'm sitting here with a little hobby project and the garbage collected classes from microsoft and my own code does NOT want to play nice together. It does not really want to mix managed classes and my code. Should I just give in and make everything managed? Proformance is not too important in this little application.
    Last edited by Miklus; 2012-10-14 at 05:28 PM.
    Bad to the Bone!
    Miko Miyazaki : Strip #120 - #464 : R.I.P.

  5. - Top - End - #65
    Barbarian in the Playground
     
    Miscast_Mage's Avatar

    Join Date
    Dec 2010
    Location
    Ireland
    Gender
    Male

    Default Re: ProgrammersitP

    Quote Originally Posted by PairO'Dice Lost View Post

    Writing dicerollers and other gaming apps is a hobby of mine as well. I wrote a diceroller that handles conditional logic, exploding dice, rerolls, multiple rolls, and more. Some examples:

    *kersnip'd*
    Ah, very nice; I've got a little dice program myself from ages ago that I've really been meaning to expand on. It asks you how many sides the dice you want to roll has, how many times you want to roll it, and returns the results of each roll, and the total value of all rolls combined:

    Spoiler
    Show

    Code:
    Enter the amount of sides the dice has: 
    6
    Enter number of times to roll the dice: 
    100
    The total result is 381
    1:	11
    2:	17
    3:	18
    4:	15
    5:	12
    6:	27


    Some things I want to add to it is having conditonal rolls(such as critical hits, nat 20s, nat 1s,), and automatically adding in modifiers, and possibly tying it to a database of weapons that would have damage, crit ranges, etc.

    Once I get the dice program to a level I'm happy with, I'll try and use it for some other projects; I've been meaning to get a D&D character generator up and running, and I'm planning on doing it in netbeans forms, or possible some other form of GUI.

    Quote Originally Posted by Neftren View Post
    Also, that silly moment when you realize sys.maxint returns a 64-bit number locally, but a 32-bit number on the deployment server.

    Yeah. That just happened to me.
    It could be worse; try having an Arraylist(in java) of objects, and a method to take objects from it and give it to another Arraylist; I had:

    Spoiler
    Show

    Code:
    static ArrayList<Card> dealToHand(ArrayList<Card> deck, ArrayList<Card> hand, int cards)
        {
            for(int i = 0; i < cards; i++)
            {
                
                Card test = deck.get(0);
                
                test.setHasBeenDealt(true);
                hand.add(deck.get(i));
                deck.remove(i);
            }
            
            
            return hand;
        }


    And I was driving myself mad trying to find out why it taking the first card, then the third, then the fifth, when I wanted it take just the first each time; turns out I just needed to have the is as 0s, and it took longer than I'd like to admit for this piece of logic to click.

    Quote Originally Posted by Neftren View Post
    I'm no expert in Java, but my hunch would be that calling toString() on an object without an overloaded toString() method would print the memory address or something similar to that degree.
    Yeah, you would have to have an overridden toString(), and personally I find it just the same to have a printDetails() method, especially as I can have printCard(), printHand(), and printDeck() for different formats of printing.

    Quote Originally Posted by akma View Post
    A note about the card class:
    I think it would be better if you used Enums instead of String values for Suit and Number. That way if you accidently insert incorrect values to the constructor, the program would fail instantly with obvious reasons instead of messing up things later.

    The way the toString method is implemented by default is by returning the class name and it`s address in hexdecimal format.
    Ah, but I've designed it in a way that an incorrect value can't be put in for Suit or Number, so I don't have to worry about using an enum. Also, haven't covered enums yet, and I'm starting to get worried about the amount of stuff on my plate at the moment.

    Also, something of note: I found a free online Introduction to Computer Science course from Harvard, if anyone is interested in signing up for it; it started yesterday, and goes on until the 15th of April.
    Last edited by Miscast_Mage; 2012-10-16 at 05:45 AM. Reason: Spelling error. :3

  6. - Top - End - #66
    Bugbear in the Playground
     
    TSGames's Avatar

    Join Date
    May 2005
    Location
    control+apple+alt+8

    Default Re: ProgrammersitP

    I only looked at the code in the second spoiler, but it looks like a good time to try out a for:each statement. I'm not sure if it's possible with the way your program is written, but if you can do it, it is usually a nice way to perform a set amount of operations to a list of objects.
    TopSecret's First Ever Two Page Tabletop Contest
    If you have any questions, want to talk about the contest entries, or you just want to hang out with cool people, visit our forums.

  7. - Top - End - #67
    Ogre in the Playground
     
    Neftren's Avatar

    Join Date
    Nov 2006

    Default Re: ProgrammersitP

    Ugh. x86 Assembler.

  8. - Top - End - #68
    Barbarian in the Playground
     
    Miscast_Mage's Avatar

    Join Date
    Dec 2010
    Location
    Ireland
    Gender
    Male

    Default Re: ProgrammersitP

    Quote Originally Posted by Skami Pilno View Post
    I only looked at the code in the second spoiler, but it looks like a good time to try out a for:each statement. I'm not sure if it's possible with the way your program is written, but if you can do it, it is usually a nice way to perform a set amount of operations to a list of objects.
    Hmm, the thing is, I don't think a for-each loop would work out here(I have used for-each loops a bit, at this point); the method takes in the number of cards to take from the deck and to give to the hand. I can't see how you would do this in a non-messy way using a for-each loop. A for-each loop would go through every card in the deck, whereas I only want a specific number of cards from it(e.g. deal five cards to a hand).

  9. - Top - End - #69
    Bugbear in the Playground
     
    Miklus's Avatar

    Join Date
    Dec 2005
    Location
    Denmark
    Gender
    Male

    Default Re: ProgrammersitP

    So our head programmer at work...just dropped dead last weekend! I'm not making this crap up. The funeral is next tuesday.

    I wonder what part of his 1 million unfinished but highly business critial projects will land on my head? Well, now the power of careful documentation will come to it's fullest! Oh wait! We don't do paper! Our mantra is "The documentation is in the code", because documentation is for amaturs!

    I'm not asking for detailed documentation for every little bit of code, but it would be nice if I knew, like, what the program was *supposed* to do.

    *Sigh* I will miss his completely unmotivated outbursts of "WHAT?!" whenever his code did something unexpected, his constant clicking of ball point pens and violent sneeze attacks, all heard from two cubicles over.
    Last edited by Miklus; 2012-10-17 at 01:43 PM.
    Bad to the Bone!
    Miko Miyazaki : Strip #120 - #464 : R.I.P.

  10. - Top - End - #70
    Ettin in the Playground
     
    pendell's Avatar

    Join Date
    Dec 2006
    Location
    Washington DC
    Gender
    Male

    Default Re: ProgrammersitP

    My sympathies :(. It's sad to lose a co-worker.

    At any rate, this is why our project has several dozen, possibly several hundred, articles by me in the project wiki discussing every aspect of what I've done and why I did it.

    Respectfully,

    Brian P.
    "Opportunities to do good are everywhere but the darkness is where the light needs to be".

    -- Eliezer Yudkowski, author of "Harry Potter and the Methods of Rationality"

  11. - Top - End - #71
    Bugbear in the Playground
     
    Miklus's Avatar

    Join Date
    Dec 2005
    Location
    Denmark
    Gender
    Male

    Default Re: ProgrammersitP

    Quote Originally Posted by pendell View Post
    My sympathies :(. It's sad to lose a co-worker.

    At any rate, this is why our project has several dozen, possibly several hundred, articles by me in the project wiki discussing every aspect of what I've done and why I did it.

    Respectfully,

    Brian P.
    "Project wiki"?! You got to be kidding me. That sounds cool.

    BTW, my coworker died from a heartattack of some kind. He had previously had a quardruble bypass. So at least he went quick. Man, what if he had dropped dead at work?!
    Last edited by Miklus; 2012-10-17 at 04:20 PM.
    Bad to the Bone!
    Miko Miyazaki : Strip #120 - #464 : R.I.P.

  12. - Top - End - #72
    Ogre in the Playground
     
    Neftren's Avatar

    Join Date
    Nov 2006

    Default Re: ProgrammersitP

    Quote Originally Posted by Miklus View Post
    "Project wiki"?! You got to be kidding me. That sounds cool.

    BTW, my coworker died from a heartattack of some kind. He had previously had a quardruble bypass. So at least he went quick. Man, what if he had dropped dead at work?!
    For large code bases, it's not uncommon to have a Wiki or other established comment system (e.g. GitHub commit histories).

  13. - Top - End - #73
    Ettin in the Playground
     
    pendell's Avatar

    Join Date
    Dec 2006
    Location
    Washington DC
    Gender
    Male

    Default Re: ProgrammersitP

    Allow me to direct you to Assembla . They provide a repository, trouble ticket management system, a wiki, and a bunch of other stuff. There's a free version for students which provides something like :mumble mumble: storage space in 1 workspace. I've had occasion to use the paid versions, but for which companies and which projects I cannot say.

    Respectfully,

    Brian P.
    "Opportunities to do good are everywhere but the darkness is where the light needs to be".

    -- Eliezer Yudkowski, author of "Harry Potter and the Methods of Rationality"

  14. - Top - End - #74
    Barbarian in the Playground
    Join Date
    Jul 2007
    Gender
    Male

    Default Re: ProgrammersitP

    Quote Originally Posted by Neftren View Post
    Ugh. x86 Assembler.
    I`m thinking of trying to learn Assembly after I`ll be more satisfied with my skill in java (I want to try something not object oriented).
    How bad is it? I know there are no classes, are there even method declerations?
    A world behind the mirror (stand alone plane)

    (Wall) passer, a rogue variant

    My not realy extanded homebrewer signature

    Quote Originally Posted by Grinner View Post
    In a world ruled by small birds, mankind cannot help but wonder how this state of affairs came about.

  15. - Top - End - #75
    Titan in the Playground
     
    BlackDragon

    Join Date
    Feb 2007
    Location
    Manchester, UK
    Gender
    Male

    Default Re: ProgrammersitP

    Quote Originally Posted by akma View Post
    How bad is it? I know there are no classes, are there even method declerations?
    Assembly is raw machine code instructions...it doesn't really have *any* language constructs you might be familiar with. As an example, this is a small piece of in-line assembly code I put into a C function to speed it up many years ago:

    Code:
    			mov ecx, 0
    			mov ebx, width
    			mov esi, tempsrc
    			mov edi, tempdest
    
    asm_loop:
    			cmp ecx, ebx
    			jnc end_asm
    
    			test ecx, 31
    			jnz no_load
    
    			mov eax, DWORD PTR [esi]
    			add esi, 4
    			bswap eax
    no_load:
    			shl eax, 1
    			jnc no_inc
    			inc BYTE PTR [edi]
    no_inc:
    			inc ecx
    
    			test ecx, tbit
    			jnz asm_loop
    
    			inc edi
    			jmp asm_loop
    end_asm:
    To give you a clue, the things at the beginning of lines ending colons are labels, anything starting with a J is a jump command that will jump to one of those labels depending on conditions (e.g. jnz = jump if non-zero). This might look like the most horrible spaghetti code you've ever seen, but this is the *only* way to code in raw assembler.
    Last edited by factotum; 2012-10-19 at 01:38 AM.

  16. - Top - End - #76
    Bugbear in the Playground
     
    TSGames's Avatar

    Join Date
    May 2005
    Location
    control+apple+alt+8

    Default Re: ProgrammersitP

    If all you know is Java, I would not waste my time trying to learn assembly: it will be next to impossible. To jump from one of the highest level languages in existence to assembly (the lowest level practical language) would take inordinate amounts of time, practice, and dedication.

    It would legitimately be quicker to learn another language at a lower level and then try to learn assembly, than it would be to just jump to it from Java. At the very least you should know a language that is no higher level than C++ before you start assembly ( C would be even better). Then it may be easier to mess around with something like an Arduino, which can be programmed basically in C or in assembler, allowing you progress down into the assembly code as you are comfortable with (and you can actually see it do stuff which makes code verification easy).

    If you want to go straight from Java to assmbly code, go for it; I'm just saying that there are much better ways to go about it that will take a lot less time and be a whole lot less frustrating.
    TopSecret's First Ever Two Page Tabletop Contest
    If you have any questions, want to talk about the contest entries, or you just want to hang out with cool people, visit our forums.

  17. - Top - End - #77
    Firbolg in the Playground
     
    Teddy's Avatar

    Join Date
    Mar 2009
    Location
    Sweden
    Gender
    Male

    Default Re: ProgrammersitP

    It might also be prudent to start with another assembly language than x86. We had assembly programming as a part of a computer architecture course last spring, where we were taught MIPS assembly, which wasn't all too hard to grasp, at least not in my opinion.

    I should also point out that the only languages I knew prior to that course were Java and SML (which is a functional language, and thus even further removed from assembly, which is imperative), and the same applied to most of my coursemates, so it's not impossible to learn assembly just because you know nothing like it. Actually, since we just had left SML, I found MIPS assembly to be sort of a relief, seeing how it let me put skills in imperative programming I'd learned in Java to use again.
    All pictures from my Tour de Friends are now up. I want to thank everyone involved one last time for the wonderful time I've had this summer!

    Clouddreamer Teddy by me, high above the world, far beyond its matters...

    Spoiler: Banner by Vrythas
    Show

  18. - Top - End - #78
    Barbarian in the Playground
     
    Miscast_Mage's Avatar

    Join Date
    Dec 2010
    Location
    Ireland
    Gender
    Male

    Default Re: ProgrammersitP

    @Miklus:

    Oh dear, I'm sorry to hear of your loss. My sympathies to his friends, family, and coworkers.


    Quote Originally Posted by pendell View Post
    Allow me to direct you to Assembla . They provide a repository, trouble ticket management system, a wiki, and a bunch of other stuff. There's a free version for students which provides something like :mumble mumble: storage space in 1 workspace. I've had occasion to use the paid versions, but for which companies and which projects I cannot say.

    Respectfully,

    Brian P.
    Ah, I've actually been looking into setting up a wiki or database that would contain classes and methods I've that I thought were particularly useful; this looks like it could be just what I need. It seems a lot more complex than what I need, but still, learning something new never hurts.

    Just to get a bit of a head start though, if all I want is essentially a database of small programs, and brief descriptions of what they do, all I would need for the moment is the git repository, right? And I would essentially be able to set it up like a wiki for myself and others(assuming I set it to public) to access? Or would I just be better off setting up something on wikispaces?

  19. - Top - End - #79
    Barbarian in the Playground
    Join Date
    Jul 2007
    Gender
    Male

    Default Re: ProgrammersitP

    Quote Originally Posted by factotum View Post
    To give you a clue, the things at the beginning of lines ending colons are labels, anything starting with a J is a jump command that will jump to one of those labels depending on conditions (e.g. jnz = jump if non-zero). This might look like the most horrible spaghetti code you've ever seen, but this is the *only* way to code in raw assembler.
    Seems scary. What was it supposed to do? What the bigger program is supposed to do?

    Quote Originally Posted by Skami Pilno View Post
    It would legitimately be quicker to learn another language at a lower level and then try to learn assembly, than it would be to just jump to it from Java. At the very least you should know a language that is no higher level than C++ before you start assembly ( C would be even better).
    From what I know of C++ syntax, it`s very similiar to that of Java. I don`t see how that could help significantly in learning assembly (anyways I`ll pick something easier then assembly after Java).

    Quote Originally Posted by Teddy View Post
    It might also be prudent to start with another assembly language than x86. We had assembly programming as a part of a computer architecture course last spring, where we were taught MIPS assembly, which wasn't all too hard to grasp, at least not in my opinion.
    When I`ll work on learning Assembly, I will work on learning the Assembly leanguage of the computer I`ll have at the time.

    Quote Originally Posted by Miscast_Mage View Post
    Ah, I've actually been looking into setting up a wiki or database that would contain classes and methods I've that I thought were particularly useful; this looks like it could be just what I need. It seems a lot more complex than what I need, but still, learning something new never hurts.
    I didn`t look at the website pendell posted, but Java has a built in documentation system - Javadoc.
    Also, if your packages are organized well, it saves you a lot of bother. You could create a package named utility and put everything usefull there.
    A world behind the mirror (stand alone plane)

    (Wall) passer, a rogue variant

    My not realy extanded homebrewer signature

    Quote Originally Posted by Grinner View Post
    In a world ruled by small birds, mankind cannot help but wonder how this state of affairs came about.

  20. - Top - End - #80
    Ogre in the Playground
     
    Neftren's Avatar

    Join Date
    Nov 2006

    Default Re: ProgrammersitP

    Quote Originally Posted by akma View Post
    From what I know of C++ syntax, it`s very similiar to that of Java. I don`t see how that could help significantly in learning assembly (anyways I`ll pick something easier then assembly after Java).
    Sure, the syntax is pretty similar. It's a type-cased brackets-based language. Java does a lot of hand holding for you though. C/C++ really requires you to have a good working knowledge of memory layout, pointer usage, and so on. There are also a lot of different data structures in the standard library, and knowing which one to use when can be tricky.

    When I`ll work on learning Assembly, I will work on learning the Assembly leanguage of the computer I`ll have at the time.
    I'd strongly suggest you start with a simpler Assembly language (e.g. MIPS, as Teddy suggested). x86 makes me want to smash my head against the wall every night just trying to keep track of all the opcodes, jumps, conditional and unconditional branching, etc.


    1

    Miscast, at work, a lot of people had their own established (personal) codebases saved locally. For instance, my mentor didn't like the STL Vector class (think ArrayList in Java), so he wrote his own. It's not uncommon to keep small utility programs around. I do it for Python and C/C++, mostly for image processing. Centroiding and filtering are pretty common operations.

    If you find yourself using a lot of the same initialization code, consider just putting together a template program. I have one for OpenCL runtimes, as 90% of the time it's the same cl::getPlatform(), cl::getDevices(&Platform) or something along those lines.

    What you don't want to do is make a wiki and just post raw code snippets. Avoid writing a chunk of code and copy/pasting it every time you use it. Consider encapsulating it into an (inline) function if you use it frequently, then import the file.
    Last edited by Neftren; 2012-10-19 at 01:34 PM.

  21. - Top - End - #81
    Titan in the Playground
     
    BlackDragon

    Join Date
    Feb 2007
    Location
    Manchester, UK
    Gender
    Male

    Default Re: ProgrammersitP

    Quote Originally Posted by akma View Post
    Seems scary. What was it supposed to do? What the bigger program is supposed to do?
    The code snippet there scans a line of input pixels and converts it to an array several times smaller with a count of pixels...so, if you wanted it to be 4 times smaller, you'd get back an array with values from 0-4 in it saying how many "set" pixels were in each 4-pixel block. It was part of a font rendering engine that created anti-aliased text by rendering it several times larger than it needed to be and then scaling it down. Those were the days before proper anti-aliased font handling was built into Windows, of course!

  22. - Top - End - #82
    Barbarian in the Playground
     
    Flumph

    Join Date
    Dec 2011
    Gender
    Male

    Default Re: ProgrammersitP

    Quote Originally Posted by Neftren View Post
    For large code bases, it's not uncommon to have a Wiki or other established comment system (e.g. GitHub commit histories).
    Quote Originally Posted by pendell View Post
    Allow me to direct you to Assembla . They provide a repository, trouble ticket management system, a wiki, and a bunch of other stuff. There's a free version for students which provides something like :mumble mumble: storage space in 1 workspace. I've had occasion to use the paid versions, but for which companies and which projects I cannot say.

    Respectfully,

    Brian P.
    Any thought on how Assembla compares to Trac? Me and a co-worker are planning a new project and we were thinking of using Trac and Git to sync everything.
    Dumbledore is dead but had a horcrux so might still be alive to it being fake and him dead but not stopping her from using the having a horcrux on you letting you live from a killing curse.
    Quote Originally Posted by The Glyphstone View Post
    Epileptic monkeys. Boxing gloves. Typewriters. That is all.

  23. - Top - End - #83
    Ettin in the Playground
     
    pendell's Avatar

    Join Date
    Dec 2006
    Location
    Washington DC
    Gender
    Male

    Default Re: ProgrammersitP

    Quote Originally Posted by Miscast_Mage View Post
    @Miklus:




    Ah, I've actually been looking into setting up a wiki or database that would contain classes and methods I've that I thought were particularly useful; this looks like it could be just what I need. It seems a lot more complex than what I need, but still, learning something new never hurts.

    Just to get a bit of a head start though, if all I want is essentially a database of small programs, and brief descriptions of what they do, all I would need for the moment is the git repository, right?
    Correct. Git can store your code, and I supposed you could add documentation in the form of .rtf or text files to the repository as well. I prefer wiki articles for that, but if it's simpler to just use the repository that will work.

    And I would essentially be able to set it up like a wiki for myself and others(assuming I set it to public) to access?
    I believe so, yes. Certainly that's the way I've used it.

    Or would I just be better off setting up something on wikispaces?
    I can't say I've used Trac or wikispaces. Sounds like a homework assignment for me at some point.

    Respectfully,

    Brian P.
    "Opportunities to do good are everywhere but the darkness is where the light needs to be".

    -- Eliezer Yudkowski, author of "Harry Potter and the Methods of Rationality"

  24. - Top - End - #84
    Bugbear in the Playground
     
    Wookieetank's Avatar

    Join Date
    Mar 2010
    Location
    Gridania, Eorzea
    Gender
    Male

    Default Re: ProgrammersitP

    •Where are you and what are you doing in terms of programming? Employment, education or in your spare time?
    I'm currently a Hospital Secretary (with a degree in geology no less) so no real programming work there. Taken a couple of classes in C++ and I've been teaching myself Python the past couple of years. Just started the cs50x class posted here so here's hoping something new sticks.

    •What language or languages are you using primarily at the moment? What's your favourite, and why?

    I'm currently using python as my main language (and favorite so far), although with the class I'm taking I'll be getting to use C, PHP, and Java. I also have experience with C++ but haven't used it in long enough that I'm on the farther side of rusty with it.

    •Where do you hope to go with your programming? Any plans for the future, or just waiting to see if anything of interest comes along?

    I'd like to one day be a freelance programmer and/or indie game programmer, both of which are sometime in the nebulous future.

    •Any projects, personal or otherwise, you're in the middle of? Anything you're really focused on?

    I've got a rougelike that I dable with from time to time, need to get back to working on that at some point. Other than that just working on learning as much about programming as I can.

    •What environment do you work/prefer to work in? Netbeans/Eclipse/Command line and a text editor?

    I generally just use IDLE for a programming enviornment. As for a text editor, I greatly enjoy the look and feel of Notepad++.

    •Any problems that are driving you mad? A piece of code not compiling right, or being off by one, or one little syntax error in a sea of code? Not quite grasping the logic of a particular piece of code?

    Biggest problem I have right now is making sure I don't have any typos or syntatic errors. I have a tendency to type obnoxiously fast, which causes case errors, and spelling errors more frequently than I would care for.

  25. - Top - End - #85
    Bugbear in the Playground
     
    Miklus's Avatar

    Join Date
    Dec 2005
    Location
    Denmark
    Gender
    Male

    Default Re: ProgrammersitP

    Quote Originally Posted by Miscast_Mage View Post
    @Miklus:

    Oh dear, I'm sorry to hear of your loss. My sympathies to his friends, family, and coworkers.
    Thanks. Speaking of assembler, I just remembered that he was the only one who knew how to program in that. There are functions programmed by him in assembler for speed. Let's hope they never need to be debugged or we are so screwed.

    Now for my little hobby project: Managed code and my code fit like foot in glove. Seriously, help! I want to use the build-in components like treeview and such. They are all managed and will only work with other managed object. It is borderline harrasment. For example, the treeview has a "tag" property per node which is just a pointer. But it can only point to managed objects. you can't even cast it to the type you want.

    It's the same for this list class I'm making. The head class (the form) is managed, so the list must be managed. The elements in the list must thus also be managed. And all the part of the element must also be managed, right down to a 2D vector. Really?

    Is this really how it is supposed to be? Everything is on the garbage collected heap now and nothing on the stack?

    I guess if you want to use a Microsoft product, you have to program the Microsoft way.
    Bad to the Bone!
    Miko Miyazaki : Strip #120 - #464 : R.I.P.

  26. - Top - End - #86
    Ogre in the Playground
     
    Neftren's Avatar

    Join Date
    Nov 2006

    Default Re: ProgrammersitP

    Quote Originally Posted by Miklus View Post
    Thanks. Speaking of assembler, I just remembered that he was the only one who knew how to program in that. There are functions programmed by him in assembler for speed. Let's hope they never need to be debugged or we are so screwed.

    Now for my little hobby project: Managed code and my code fit like foot in glove. Seriously, help! I want to use the build-in components like treeview and such. They are all managed and will only work with other managed object. It is borderline harrasment. For example, the treeview has a "tag" property per node which is just a pointer. But it can only point to managed objects. you can't even cast it to the type you want.

    It's the same for this list class I'm making. The head class (the form) is managed, so the list must be managed. The elements in the list must thus also be managed. And all the part of the element must also be managed, right down to a 2D vector. Really?

    Is this really how it is supposed to be? Everything is on the garbage collected heap now and nothing on the stack?

    I guess if you want to use a Microsoft product, you have to program the Microsoft way.
    What exactly is this for? I'm guessing .NET Framework?

    Also, why are you using a vector in a list? That seems to defeat the purpose of putting together a list...

    There's quite a lot that goes onto the heap now, and rightly so. For large data sets, you probably won't be able to fit it into the stack frame...

  27. - Top - End - #87
    Barbarian in the Playground
     
    Miscast_Mage's Avatar

    Join Date
    Dec 2010
    Location
    Ireland
    Gender
    Male

    Default Re: ProgrammersitP

    Quote Originally Posted by Neftren View Post
    Miscast, at work, a lot of people had their own established (personal) codebases saved locally. For instance, my mentor didn't like the STL Vector class (think ArrayList in Java), so he wrote his own. It's not uncommon to keep small utility programs around. I do it for Python and C/C++, mostly for image processing. Centroiding and filtering are pretty common operations.

    If you find yourself using a lot of the same initialization code, consider just putting together a template program. I have one for OpenCL runtimes, as 90% of the time it's the same cl::getPlatform(), cl::getDevices(&Platform) or something along those lines.
    Hmm, I suppose a template program would be handiest for what I want to do. At the moment I just copy and paste previous classes/methods from previous work that I think would be handy for whatever I'm working on at the moment. I'll have to see about looking into that, thanks.


    Quote Originally Posted by Neftren View Post
    What you don't want to do is make a wiki and just post raw code snippets. Avoid writing a chunk of code and copy/pasting it every time you use it. Consider encapsulating it into an (inline) function if you use it frequently, then import the file.
    Ah, I think I've spotted an issue with what I want to do, actually; I've been meaning to do two things, and I've been muddling them together:
    • Having a database of my own useful methods/classes/etc for my personal use
    • Having something to show other people in my course if they're having a problem


    I was thinking of a wiki to have more an index of useful methods/classes, descriptions of what they do and how, what they take in/return, and what project I have them located in. The advantage to this would be it would useful for me, and for anyone if they wanted to see how snippets of my code worked.

    However, now I'm just thinking of having a seperate way of managing my stuff for me, and having a wiki of useful snippets completely separate for other people to look at that would be more the tricky things that we'll have to be aware of in the exam like:

    Spoiler
    Show

    Code:
    int 
    number = 5;
    if(++number == 6)
    { 
           System.out.println("Hello.");
    }
    
    if(number-- == 5)
    {
          System.out.println("Goodbye");
    }
    Or

    Code:
            int []y[];

    Or just plain useful methods like this for sorting arrays
    Code:
    public static void swap(int [] num, int i, int j)
       {
          int tmp = num[i];
          num[i] = num[j];									
          num[j] = tmp;		
       }												
       public static void sort(int [] num)
       {
          for(int i = 0; i < num.length - 1; i++)
          {
             int minIndex = i;
             for(int j = i + 1; j < num.length; j++)
             {
                if(num[j] < num[minIndex])
                   minIndex = j;
             }
    
             swap(num, i, minIndex);
          }
        }


    Quote Originally Posted by akma View Post
    I didn`t look at the website pendell posted, but Java has a built in documentation system - Javadoc.
    Also, if your packages are organized well, it saves you a lot of bother. You could create a package named utility and put everything usefull there.
    Amen for organised packages; I organise mine by date(Y/M/D)-subject, e.g. 20121023Sample2DArrays or 20121014CharacterGenerator. It's annoying that there doesn't seem to be a tagging system or even a "ascending/descending according to date made/last edited" option; it makes it a pain to have a coherent yet expansive way of cataloging projects.

    Lumping everything useful in one package does sound like a pretty convenient solution, even just for the moment where I don't really have anything huge yet.

    Quote Originally Posted by pendell View Post
    Correct. Git can store your code, and I supposed you could add documentation in the form of .rtf or text files to the repository as well. I prefer wiki articles for that, but if it's simpler to just use the repository that will work.
    Hmm, I think I'd prefer if it had some way of keeping the different sections of code inherently with documentation, as opposed to having it is as a separate file, which I can imagine getting messy or being a pain to keep updated.

  28. - Top - End - #88
    Banned
    Join Date
    Aug 2012

    Default Re: ProgrammersitP

    I'm in a C++ freshman course for my computer engineering degree, and basically for a scholarship I'm working with my professor on stuff outside the normal class things, including going into Python, cgi, and sqlite. It's pretty interesting! I'm working on one big program for the end of the semester that runs an HTML page where students can select a topic to practice coding on, where it'll pull a problem from an sqlite db and then take a form from the user. Then I guess I need to work on saving it as a .cpp file and compiling it through the command prompt (returning errors if there are any). So I may update you guys/ask for help :P

  29. - Top - End - #89
    Ogre in the Playground
     
    Neftren's Avatar

    Join Date
    Nov 2006

    Default Re: ProgrammersitP

    Quote Originally Posted by Miscast_Mage View Post
    Hmm, I suppose a template program would be handiest for what I want to do. At the moment I just copy and paste previous classes/methods from previous work that I think would be handy for whatever I'm working on at the moment. I'll have to see about looking into that, thanks.
    What I'm saying is that you shouldn't copy/paste at all. If it's a code snippet, it's short enough to retype, or regex/text-expand it. Typing it out will help you avoid mistakes (enter the logical fallacy of code found on the internet). If it's some sort of utility method (e.g. templated matrix multiply) that you use on a frequent basis, it should be documented and then compiled into a package.

    Code that you use personally and code that you show other people shouldn't be any different. If you maintain a rigorous and neat programming style, your code should be easily understandable to anyone reading it. At that point, it's just a matter of "oh, here's my file, look at it and understand!"

    As for some comments on your code... I know a lot of instructors provide cheat sheets on exams. I don't know if yours does the same though. Anyways ...

    You should probably avoid performing mathematical operations within conditional statements. Your first code sample will fail if the given number isn't 5. Granted you probably already knew that part.

    I'm surprised you (or other people you're helping) found int []y[]; tricky. Well, maybe it's the format you wrote it in. This is more of a pet peeve of mine more than anything else (going back to the Star (Pointer) Wars. It makes much more sense to rewrite that fragment as int[] y[]; (note the spacing). That way, you keep the data type with the container. An integer[array] (of) y[array_size]. Similarly, in C/C++, int* i makes much more sense than int *i, as you would read it as an integer pointer. If in doubt, refer to your style guide (most companies or managed code bases typically have one somewhere).

    Also, for the last code example, Bubble Sort (and similar O(n2) algorithms)...? Why do you consider this useful?


    Amen for organised packages; I organise mine by date(Y/M/D)-subject, e.g. 20121023Sample2DArrays or 20121014CharacterGenerator. It's annoying that there doesn't seem to be a tagging system or even a "ascending/descending according to date made/last edited" option; it makes it a pain to have a coherent yet expansive way of cataloging projects.
    A tagging system in what? All modern operating systems can sort by file name and date. Or are you using some IDE?

    Quote Originally Posted by Leona View Post
    I'm in a C++ freshman course for my computer engineering degree, and basically for a scholarship I'm working with my professor on stuff outside the normal class things, including going into Python, cgi, and sqlite. It's pretty interesting! I'm working on one big program for the end of the semester that runs an HTML page where students can select a topic to practice coding on, where it'll pull a problem from an sqlite db and then take a form from the user. Then I guess I need to work on saving it as a .cpp file and compiling it through the command prompt (returning errors if there are any). So I may update you guys/ask for help :P
    Compiling via command line is pretty easy. You'll probably learn to use the GNU Compiler (gcc/g++). In Terminal (or shell of choice), you'll enter something along the lines of...

    Welp. Forbidden post error. I had something written up here, but the forum won't let me post it (and no, I didn't use the word involving a cat (yes, that word) or a colon followed by two spaces anywhere).

  30. - Top - End - #90
    Barbarian in the Playground
    Join Date
    Jul 2007
    Gender
    Male

    Default Re: ProgrammersitP

    Quote Originally Posted by Miscast_Mage View Post
    Amen for organised packages; I organise mine by date(Y/M/D)-subject, e.g. 20121023Sample2DArrays or 20121014CharacterGenerator. It's annoying that there doesn't seem to be a tagging system or even a "ascending/descending according to date made/last edited" option; it makes it a pain to have a coherent yet expansive way of cataloging projects.
    There is another option - static variables, or maybe even a class with details about a package (if you are going to include one in every package, I recommend naming it $).

    Quote Originally Posted by Miscast_Mage View Post
    Hmm, I think I'd prefer if it had some way of keeping the different sections of code inherently with documentation, as opposed to having it is as a separate file, which I can imagine getting messy or being a pain to keep updated.
    Again, javadoc.
    A class written with javadoc documentation: http://docs.oracle.com/javase/7/docs...g/Package.html
    A package written with javadoc documentation: http://docs.oracle.com/javase/7/docs...e-summary.html
    The entire API supplied with java, with much javadoc documentation (bookmark this one): http://docs.oracle.com/javase/7/docs/api/
    Last edited by akma; 2012-10-23 at 12:17 PM.
    A world behind the mirror (stand alone plane)

    (Wall) passer, a rogue variant

    My not realy extanded homebrewer signature

    Quote Originally Posted by Grinner View Post
    In a world ruled by small birds, mankind cannot help but wonder how this state of affairs came about.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •