Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it, follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!

SELECT * FROM posts WHERE tid = 'PA PROGRAMMING THREAD'

15758606263100

Posts

  • GnomeTankGnomeTank Registered User regular
    jdarksun wrote: »
    GnomeTank wrote: »
    Java doesn't even have the Parallel Tasks library....newbs are still using raw threads and sync primitives. So 2005.
    Can't tell if serious.

    Mostly joking, semi serious?

    C#/.NET are doing really great things with asynchronous programming these days.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh
  • urahonkyurahonky Registered User regular
    I hate database work myself.

    Games completed recently: Dragon's Crown, Knights of Pen and Paper, Castlevania: Symphony of the Night (20th time), Defender's Quest, The Witcher
  • GnomeTankGnomeTank Registered User regular
    edited April 2012
    Haven't actually used the Java 1.6 concurrency components, but from reading about them, they still aren't as awesome as System.Threading.Tasks and everything it entails. Parallel.For, Parallel.Invoke, Task, Task<>, etc.

    e: And of course, in .NET 4.5 we get the async and await keywords.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh
  • bowenbowen Registered User regular
    Java and threading is about as fun as getting into an enclosed shower with a cat.

  • urahonkyurahonky Registered User regular
    Is there an easy way to generate a random color? Or will I have to use Math.Random()?

    Games completed recently: Dragon's Crown, Knights of Pen and Paper, Castlevania: Symphony of the Night (20th time), Defender's Quest, The Witcher
  • urahonkyurahonky Registered User regular
    I guess I shouldn't have assumed that I would be the only one wanting to do that. :P Thanks bowen.

    Games completed recently: Dragon's Crown, Knights of Pen and Paper, Castlevania: Symphony of the Night (20th time), Defender's Quest, The Witcher
  • InfidelInfidel Heretic Registered User regular
    The best way to generate a random colour is using HSB. RGB is the ultimate representation but those numbers don't have an intuitive mapping to their perception.

    Usually you want a colour that fits in a certain place and you want to just change/pick the hue at random. You can't do that independently of everything else in RGB, but that it was the H in HSB is for. Just pick a set value for S and B (or decide an appropriate range and random those within it) and you avoid the random colours that clash or are unreadable etc.

    For example, (0, 1, 1) HSB is "0 degrees hue, full saturation, full brightness" and is the colour red (255, 0, 0) RGB. If you random that first number between 0 and 1 you'll get a colour with the same overall value but totally random hue.
    Color.getHSBColor(randomHue, 0.8f, 0.8f)
    

    Play with that.

    TwitchTV channel: OrokosPA check.php?c=OrokosPA
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
  • bowenbowen Registered User regular
    edited April 2012
    Finally. Done refactoring over a few million lines of code to reflect database portability.

    Now I can finally do something like:
    SqlLayer sql = new SQLSrv();
    sql.Query("SELECT * FROM MyTable");
    while(sql.Read())
    {
        Console.WriteLine("ID : {0}", sql["id"]);
        Console.WriteLine("Name : {0}", sql["name"]);
    }
    
    sql = new MySQL();
    sql.Query("SELECT * FROM MyTable");
    while(sql.Read())
    {
        Console.WriteLine("ID : {0}", sql["id"]);
        Console.WriteLine("Name : {0}", sql["name"]);
    }
    

    I don't even know what the hell this person was thinking before hand.

    bowen on
  • Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    edited April 2012
    Working with Go changed the way I think about concurrency. Now if I have a blocking queue, I'm good to go for the most part.

    Edit: That being said, I have very little practical experience dealing with concurrency.

    Monkey Ball Warrior on
    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • seabassseabass Doctor MassachusettsRegistered User regular
    Working with Go changed the way I think about concurrency. Now if I have a blocking queue, I'm good to go for the most part.

    Edit: That being said, I have very little practical experience dealing with concurrency.

    A couple of the guys in my office have switched to Go, and they love it. What do you think is it's strongest feature?

    Run you pigeons, it's Robert Frost!
  • DrunkMcDrunkMc Registered User regular
    I actually like JAVA.......and databases......and I just finished a Multi-threaded Java application that runs completely off of a DB........... :-)

    The Future<> frame work for multi-threading and scheduling worked fine for me. The only whore is knowing until you get the result and let the Future get Object collected, the memory the thread was using stays kept.

  • urahonkyurahonky Registered User regular
    Spent this entire morning trying to figure out my selection problem...

    Turns out I was doing it correctly I just wasn't refreshing the scene. Bah!

    Games completed recently: Dragon's Crown, Knights of Pen and Paper, Castlevania: Symphony of the Night (20th time), Defender's Quest, The Witcher
  • bowenbowen Registered User regular
  • Jimmy KingJimmy King Registered User regular
    I like java for when it came out. Java was a really cool language and environment for the mid to late 90s. The problem is that it's still a really cool environment and language for the mid to late 90s. It hasn't aged well.

    And really, my only two real problems with it are "OMG BOILERPLATE WHY MUST I TYPE SO FUCKING MUCH?!?!!?!?" and that everything about it is aimed at super huge mega corp with a billion servers and developers, so it's way too much hassle to get experience in the parts of it potential employers are looking for by doing small projects on your own.

    import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.stringreturners.StringStringReturner;
  • urahonkyurahonky Registered User regular
    Question.

    I have a HashMap<String, Control>. Is there an easy way to check the variable "controlType" in the Controls? (Basically there is a String in Control that is "controlType")

    The only way I can think of is taking the ControlList ArrayList, popping the name into the HashMap and getting the Control and then checking the controlType. But that sounds incredibly inefficient.

    Games completed recently: Dragon's Crown, Knights of Pen and Paper, Castlevania: Symphony of the Night (20th time), Defender's Quest, The Witcher
  • bowenbowen Registered User regular
    That is the way you should do it, yes.
    myHashMap.get("MyControl").controlType = "poopybutt";
    

  • urahonkyurahonky Registered User regular
    It says poopybutt doesn't exist.

    But it should.
    Spoiler:

    Games completed recently: Dragon's Crown, Knights of Pen and Paper, Castlevania: Symphony of the Night (20th time), Defender's Quest, The Witcher
  • bowenbowen Registered User regular
    poopybutt is the worst butt

  • bowenbowen Registered User regular
    So glad poopybutt is now going to be our foobar-esque string literal. Glad I could start that.

  • InfidelInfidel Heretic Registered User regular
    If you're searching for controls with a certain property, something like this then:
    for (Control c : hashmap.values()) {
      if (c.controlType == "poopybutt") ...
    }
    

    TwitchTV channel: OrokosPA check.php?c=OrokosPA
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
  • bowenbowen Registered User regular
  • EtheaEthea Registered User regular
    I am amazed at how hard it is for me to write a paper on the work I have done. The translation of code and results back to a story shouldn't be this hard.

  • ToddJewellToddJewell Registered User regular
    got an email about the 2012 cert path changing again for MS... guess I better finish the other 08 exam shortly so I can just take the upgrade path =)

    looks like I will need three to get the MCSE Data Platform path

  • bowenbowen Registered User regular
    Ethea wrote: »
    I am amazed at how hard it is for me to write a paper on the work I have done. The translation of code and results back to a story shouldn't be this hard.

    "See relevant comment section"

  • Jimmy KingJimmy King Registered User regular
    Yeah, I've done j2ee with Tomcat for a moderately sized personal project (basically a cross between backloggery and goozex before I had heard of either). Tomcat alone is way more hassle than I'm willing to deal with for small projects. That made me completely lose interest in doing anything that involved JBoss or any of the other extensions like Spring or Hibernate. To be fair, part of the problem is that Debian's java and tomcat packages are fucking terrible and make it worse to deal with than it probably needs to be.

    I also think jsp is about the most terrible, archaic shit still in use. I've never found a jsp tutorial that suggested java had moved past "mix your markup and code because that's way easier for everyone!!!!". I used servlets with velocity templates for my previously mentioned project.

    import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.stringreturners.StringStringReturner;
  • centraldogmacentraldogma Registered User regular
    One of my projects for college was a C based concurrency project to compute the transitive closure of a directed graph. That is, determine if there is a path from any one point to another in an adjacency graph. The algorithm (Warshall’s Transitive Closure algorithm) for this is:
    n = rows[A]
    // initialization
    for i = 1 to n
         do for j = 1 to n
              do if i = j
                   then t[i][j](0) = 1
                   else t[i][j](0) = aij
    for k = 1 to n
         do in parallel for i = 1 to n
              do for j = 1 to n
                   do for t[i][j]^(k) = t[i][j]^(k-1) or (t[i][k]^(k-1) and [j][k]^(k-1))
    return T(n)
    

    This is actually a common example for Thread level concurrency, if you google it you’ll find plenty of examples. However, we were to implement concurrency at the process level via shared memory and semaphores. The matrix and number of processes was determined at runtime.

    This is not how you’re suppose to use process level concurrency. In fact, if you do a search for this exact problem, you will find forums of people asking how to do this and being told to do it with threads because it’s stupid to do it via processes.

    I did it. And I am convinced that there is absolutely no room for creativity in the solution: there is only one way to solve the problem. It is probably one of my greatest achievements from college and also one of the least practical.

    signaturecreation.gif
  • EtheaEthea Registered User regular
    edited April 2012
    bowen wrote: »
    Ethea wrote: »
    I am amazed at how hard it is for me to write a paper on the work I have done. The translation of code and results back to a story shouldn't be this hard.

    "See relevant comment section"

    You don't get your paper into a symposium by saying reading the damn documentation.

    Ethea on
  • bowenbowen Registered User regular
    Ethea wrote: »
    bowen wrote: »
    Ethea wrote: »
    I am amazed at how hard it is for me to write a paper on the work I have done. The translation of code and results back to a story shouldn't be this hard.

    "See relevant comment section"

    You don't get your paper into a symposium by saying reading the damn documentation.

    "For further information, see the help files." :D

  • urahonkyurahonky Registered User regular
    Ugh damn it. I'm down to just a few problems in my implementation of Tabbed Panes, but I've run into a big snag. I can't change any of the properties of any of the controls dropped into my tabbed panes without them disappearing completely. And I'm not even sure why. I'm doing the exact same thing as I do when you change the property of a control in the main scene.

    Games completed recently: Dragon's Crown, Knights of Pen and Paper, Castlevania: Symphony of the Night (20th time), Defender's Quest, The Witcher
  • bowenbowen Registered User regular
  • urahonkyurahonky Registered User regular
    bowen wrote: »
    Example?

    Can't really without posting hundreds of lines of code. However I MAY have found the issue. Hopefully I can get it working by 5pm.

    Games completed recently: Dragon's Crown, Knights of Pen and Paper, Castlevania: Symphony of the Night (20th time), Defender's Quest, The Witcher
  • EtheaEthea Registered User regular
    urahonky wrote: »
    Ugh damn it. I'm down to just a few problems in my implementation of Tabbed Panes, but I've run into a big snag. I can't change any of the properties of any of the controls dropped into my tabbed panes without them disappearing completely. And I'm not even sure why. I'm doing the exact same thing as I do when you change the property of a control in the main scene.

    You really need to pitch the idea of some testing framework. Be it unit tests, functional tests or even regression testing you need a way to be sure individual components work as expected.

  • SaerisSaeris Chronogestaltist Trinity, New MexicoRegistered User regular
    edited April 2012
    Is there a way to tell whether a particular module is running on an Apache server?

    Specifically, I'm trying to run some Lua scripts through CGI, but I'm not sure whether I'm just screwing it up somehow or if indeed the server does not have mod_lua running. The server tries to run the script (because it's under /cgi-bin/), but never actually executes a single line in the script. It just immediately throws a 500 error and complains about "Premature end of script headers". For what it's worth, I can get the server to run PHP, Python, and Bash scripts just fine.

    Saeris on
    Nlgya.png
  • InfidelInfidel Heretic Registered User regular
    Saeris wrote: »
    Is there a way to tell whether a particular module is running on an Apache server?

    Specifically, I'm trying to run some Lua scripts through CGI, but I'm not sure whether I'm just screwing it up somehow or if, indeed, the server does not have mod_lua running. For what it's worth, I can get the server to run PHP, Python, and Bash scripts just fine.
    apachectl -t -D DUMP_MODULES
    

    TwitchTV channel: OrokosPA check.php?c=OrokosPA
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
  • urahonkyurahonky Registered User regular
    Ethea wrote: »
    urahonky wrote: »
    Ugh damn it. I'm down to just a few problems in my implementation of Tabbed Panes, but I've run into a big snag. I can't change any of the properties of any of the controls dropped into my tabbed panes without them disappearing completely. And I'm not even sure why. I'm doing the exact same thing as I do when you change the property of a control in the main scene.

    You really need to pitch the idea of some testing framework. Be it unit tests, functional tests or even regression testing you need a way to be sure individual components work as expected.

    We have JUnit tests set up. But I'm not sure they would help me figure out the problem, though.

    Games completed recently: Dragon's Crown, Knights of Pen and Paper, Castlevania: Symphony of the Night (20th time), Defender's Quest, The Witcher
  • SaerisSaeris Chronogestaltist Trinity, New MexicoRegistered User regular
    Thanks! I see it's not running any particular script module, but it's definitely running mod_cgi. Shouldn't that be enough to execute any script with a shebang on the first line, as long as the script writes to stdout?

    Nlgya.png
  • urahonkyurahonky Registered User regular
    Aha!! I think I may have got it! Further testing required, but as it stands I can finally change the properties without it poopbutt'ing itself.

    Games completed recently: Dragon's Crown, Knights of Pen and Paper, Castlevania: Symphony of the Night (20th time), Defender's Quest, The Witcher
  • ToddJewellToddJewell Registered User regular
    Policy management in SQL Server is quite entertaining... I can now force my people to not be stupid with naming [and various other things].

    Interesting learning experience today and not one I found any information online for -- do people live in ideal worlds?

    Problem: I want to implement a policy for stored procedure naming that will require them to be up_%
    Additional Problem: This is an existing database where developers did not abide by the new policy before -- this is in use so you have to be able to edit old ones without renaming [KEY!]

    First iteration:
    Make a condition for a Stored Procedure Facet and the Expression of @Name like 'up_%'
    Flaw: altering existing stored procedures would fail

    Second Iteration:
    Add another expression to the condition which involves the @CreateDate being >= current date while the @name is like up_%
    Also, put an "or" statement on the @Name not like up_% and the @CreateDate <= current date.
    Flaw: existing procedures that abided by new naming would not save [son of a bitch]

    Third Iteration:
    Remove the second @Name restriction leaving you with
    @Name like up_%
    AND @CreateDate >= [today's date]
    OR @CreateDate <= [today's date]

    I am trying to get one created to disallow the creation of a table without a primary key but it appears that the DDL architecture for the policy won't let me auto roll them back through the on change: prevent functionality. I would have thought the create table trigger could have been used but I am not sure of the inner workings. I can get one created that will let me press 'evaluate' and give me a listing which sort of works but I wanted one to prevent ongoing stupidity.

  • EtheaEthea Registered User regular
    urahonky wrote: »
    Ethea wrote: »
    urahonky wrote: »
    Ugh damn it. I'm down to just a few problems in my implementation of Tabbed Panes, but I've run into a big snag. I can't change any of the properties of any of the controls dropped into my tabbed panes without them disappearing completely. And I'm not even sure why. I'm doing the exact same thing as I do when you change the property of a control in the main scene.

    You really need to pitch the idea of some testing framework. Be it unit tests, functional tests or even regression testing you need a way to be sure individual components work as expected.

    We have JUnit tests set up. But I'm not sure they would help me figure out the problem, though.

    The tests should be designed to help verify the code behaves in the way you expect. So you have tests to make sure the control is working in the main scene, and that it works inside a tabbed pane. You can than start looking at what test status to determine the likely cause of failure. For example you might find that unit tests of your tabbed panes pass when values are set programmaticaly, but fail when being run with a keyboard and mouse emulator. You than know that your logic is valid, but your UI code is to blame.

This discussion has been closed.