Jump to content
  • Advertisement

Dospro

Member
  • Content Count

    252
  • Joined

  • Last visited

Community Reputation

257 Neutral

About Dospro

  • Rank
    Member

Personal Information

  • Role
    Programmer
  • Interests
    Programming
  1. ( I made this new post with the same content as https://www.gamedev.net/topic/687811-portable-shareddynamic-libraries-with-c-and-cmake/ because for some reason it has 0 views. And has been like 3 days. i'm not sure if it is not even shown.) Hope no one gets mad. Hi everyone. I'm working on a project that uses a plug-in-like arquitecture. Right now i'm working on Linux and to implement the plugins I'm using Shared Objects (.so). I load the plugins with the dl API. On windows there are dlls which are managed in very different way. Now, in mac OSX i'm a bit confused. I see there are dylib, so, frameworks and bundles (besides other things). I'm not sure what's the difference between them and what should I use to implement a plug in. Can anyone point me in the right direction here? Thanks.
  2. Hi everyone. I'm working on a project that uses a plug-in-like arquitecture. Right now i'm working on Linux and to implement the plugins I'm using Shared Objects (.so). I load the plugins with the dl API. On windows there are dlls which are managed in very different way. Now, in mac OSX i'm a bit confused. I see there are dylib, so, frameworks and bundles (besides other things). I'm not sure what's the difference between them and what should I use to implement a plug in. Can anyone point me in the right direction here? THanks.
  3. Ok. Thanks for the advice. I think i will use regular expression for matching some of the "generic characters": numbers to *, etc.   I thought i could use re to get the number. By the way, thanks for helping me see the a dict is far better than a list of tuples.
  4. Hi everyone.   I hope you can give me a hand with this:   I have a list of tuples like this: table = [ ("aaa", "a","b", 0), ("aaa", "a", "c", 1), ("aaa", "b", "a", 2), ("aaa", "b", "c", 3), ("aaa", "c", "a", 4), ("aaa", "c", "b", 5), ("aaa", "a", "*", 6), ("aaa", "b", "*", 7), ("aaa", "c", "*", 8), ... ] More less like that. I't huge. Now, the * means one digit. So, as you can see, this table holds some kind of (not so)regular expressions The idea is that if you write "aaa a b" you get 0. If you write "aaa c 1" you get 8.   The program actually works. But i want to change it to use python regular expressions. I managed to write the regular expressions to match the strings and keep it in groups: r'(?P<matcha>aaa[\s]+(a|b|c)[\s]+(a|b|c|[\d]))' This, matches all the tuples in the example table. My question. Is there a way to get an specific integer from a match(like the one in the table)   Or maybe translate the match into the "table-regular-expression-format".  
  5. Great.  Just to complement this discussion, do you know any good text, or article about software design? I've read Pressman and Braude, but they lack real examples.   Thanks.
  6. Whoa. Thanks a lot.  This clarifies quite some things.   So for example, in the case i mentioned about a lexical parser. I know a good approach is using a FSA. So i write a test thats tests mmm identifiers. So i go, implement a minimal FSA which can get identifiers. Then, new test to test an operator. Then implement the part of the FSA which recognizes that operator. ...   It's interesting how pure TDD doesn't always drives you to the correct design.   Thanks for sharing your experience and knowledge. 
  7. That was a bit enlightening.  But:     I have read that it is quite the opposite. TDD makes change easier and safer. If you want to change some behavior, then you first change the related tests but the entire suite should still pass...... Writing this, it sounds more like acceptance tests.   Now, i think my real question is: how does this testing disciplines (TDD, Acceptance tests, Integrations tests, CI) relate to Software arquitecture and design. As far as i understand, when you are in a design phase, you choose most of the patterns that might implement the use cases. But in the other hand there are people who says that testing disciplines can drive and even improve software design.   What is your experience?
  8. Ok ok. I got that. I asked this because the TDD approach specifies 3 rules:   1. Don't write production code, unless it is for making a test pass. 2.Write a minimal failing test (the least code to make a test fail) 3. Write just enough code to make the test pass   Of course it is missing the "after writing production code that passes, refactor".   So using that approach, I have to write one test, make sure it fails, then write the production code that passes that test, refactor and repeat. Being strict, i cannot write a bunch of failing tests at once (i don't know if this is more practical), just one test at a time verifying a single functionality.   Anyway. Thinking about this, it occured to me that maybe after having a bunch of test passed then build the FSA as a refactoring step.  What do you think?
  9. Hi everyone.   I'm starting to get more involved in test driven development (TDD) but i have this question. Suppose you want to build a lexical parser. Using TDD approach i start with a test the tests the there is a lexical parser (a class). Then maybe test for a function which given some text it returns the most simple token. Refactor. And so on...   Now. Most of us know that one way to create a lexical parser is to implement a finite state automata.   So... When will TDD gets me with a tested FSA? Using TDD when and how can you decide to use an already established pattern intead of reinventing the wheel?    
  10. Indeed. That works in a perfectly even distribution of the rectangles. If most rectangles are almost in the same place, the number of recursion increments linearly instead of logarithmically. Of course, the idea of using a Quad Tree is for rectangles that you expect are more or less evenly distributed. Jajaja. For the test, by using random rects, this problem arose but it shouldn't in "normal" case scenario. Although i put a Max level of recursion just in case....
  11. Whoa!!!   I found the reason for the high recursion. It seems to be a very rare problem. Let's say max objects per level is 4. If you have 5 rects exactly at the same position (x, y). Then When inserting the rect into the Quad Tree it will recurse infinitly. n my implementation the quadtree regions become negative!!!   Well, as long as i dont have more than maxObjectsPerLevel in the same place, everything will work fine.   I would still like your opinions.  
  12. Hi. I'm testing some data structures and algorithms in python so i can decide which ones and when to use them in the project i'm implementing.   The problem is simple. I have a list of rectangles in different positions and with different sizes. Given a list of points i want to know which rectangle contains each point. The list of rectangles may be up to 10000 (perhaps even more).   My first attempt just to get something working and a reference for profiling, was to use a bruteforce algorithm. For each point for each rect check interesection.   The two data structures i'm testing are QuadTree and HashGrid. QuadTree made a wonderful job:     Test for n means Number of rectangles inserted randomly. Until there the results are promising, excepts, that for 600 Rects:     For 600 this occurs randomly. But for 800 is almost a 100% to occur. I can't even get to 1000.   I don't know if there even exists a language which can handle this levels of recursion. So it seems, i have to do something about it.   In my code there are to sections i use recursion: When inserting a rect, and when getting the rects near the point. My max number of objects per node is 4, and there is no limit in the number of levels the tree can have.   Are there better ways to implement a QuadTree perhaps without recursion? Or should i limit the levels of the tree? Tweak the maxObjects per level? For 10000~ rectangles, what would you do? Perhaps not using QuadTree although its efficiency is really good for big number of quads?
  13. Thank you for your answers. Im using JetBrains IDEs, which is quite mmm standar about shortcuts. At least it is compatible with Netbenas(mostly).   As i see, it seems the easiest way is to actually close the parenthesis/brackets/braces manually jajaja. Two strokes instead of one.   Anyway, it seems like a little issue not taken seriously. Jeje.   Thanks again for your answers.
  14. Hi. This may sound like a dumb question, but i have been searching for some opinions about this.   As you may know, now most IDEs have a quite advanced autocompletition feature and keyboard-centric navigation. My doubt involves parenthesis, brackets and braces.   When i'm editing some code and open a bracket or parenthesis, in most IDEs the closing bracket/parenthesis is automatically added. After filling whatever goes inside the pair of brackets, the cursor ends up just next to the closing parenthesis. Until now, i use the End key, which is quite far in the keyboard to get outside of the pair of symbols, and then use the arrow-keys or Return key to navigate to the next line or inside a pair of braces.   I don't know if i'm wrong, but isn't there a shortcut, or some way to do this automatically without having to use arrows, or End key? I mean, IDEs are really smart nowadays, so i feel like i'm missing a feature that perhaps has been there for a while which does excatly this..   The only editor i 've used which let me configure this was vim. But to be honest, i don't like vim :(.   Any enlightment?
  15. Ok. Using this flags in the compiler: -fsanitize=address -fstack-protector-all together with the flag _GLIBCXX_DEBUG solved it. I was right, there were some out of bounds acceses. No it works like a charm.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!