As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/

cmd /v:on /c "set TITLE=Programming Thread & echo !TITLE!"

1919294969799

Posts

  • GnomeTankGnomeTank Registered User regular
    I've been heavily considering looking for a telecommute job. I wouldn't mind a bit of office commute, couple days a month, but I'd like to be primarily telecommute.

    Just fits my lifestyle better, being a single parent and all.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • Jimmy KingJimmy King Registered User regular
    Yeah, I've been looking a lot at telecommute jobs recently (we had that big discussion about income tax stuff due to the first one I looked at a few weeks ago). With a wife, school, and a baby any hour I can spend sleeping, studying, or with my baby rather than on the road is a blessing. Richmond is also a huge .net town and I really like working on the linux side of things, so telecommute opens up the potential jobs a bit. I will have to set up a much better work environment, though. Sitting on the couch with a laptop is fine for working from home once every few weeks, but I couldn't do it everyday.

    The RoR shop I'm talking to is actually based out of virginia, so no double income tax, but still 100% telecommute, which would be awesome.

  • urahonkyurahonky Registered User regular
    That would be fantastic... Apparently day care is 900-1200 a month!? What a scam! It's almost cheaper to have my wife stay home and take care of the kid rather than pay for that.

  • syndalissyndalis Getting Classy On the WallRegistered User, Loves Apple Products regular
    edited January 2013
    http://www.meltmethod.com/realtest

    I have a problem.

    In firefox and IE9, elements of the ifram that opens when you click the image completely disappear.

    like so:


    ff.png

    Meanwhile, on Chrome/Safari, it works perfectly, like so:


    sf.png

    I will paypal someone beer money if they can tell me why Firefox in particular is being so damn squirrelly. It's not z-index...

    syndalis on
    SW-4158-3990-6116
    Let's play Mario Kart or something...
  • EndEnd Registered User regular
    I think maybe something is wrong with your lightbox implementation. width: 0 and height: 0 are getting thrown all over your iframe's contents

    I wish that someway, somehow, that I could save every one of us
    zaleiria-by-lexxy-sig.jpgsteam~tinythumb.png
  • SmasherSmasher Starting to get dizzy Registered User regular
    I don't have an answer, but a couple observations which may or may not be helpful for debugging:

    I don't know if you've changed the code in the meantime but on Firefox 18, Windows 7 it doesn't look like your picture. The blue bar and text appear as they do in the second picture, and the video progress bar (what's that actually called?) is located where it's supposed to be as if the video were displaying. I even get the youtube-style play button in the middle of the video space when it's paused. I don't see any actual video, or the video list on the right side, but I do get the audio.

    When I hover over the bar in Chrome the hover text displays 00:05 | 00:46 as you'd expect. When I do that in Firefox it displays 0NaN:0NaN | 00:46. Also, if I hover somewhere in the leftmost 20% of the bar in Firefox the hover text flashes on and off 2 to 3 times a second.

  • kimekime Queen of Blades Registered User regular
    On Chrome and Windows 7, if I scroll up or down then the content (videos, etc) scroll with me, but the blue border does not. If I first scroll down, then click the button, it opens up too far down so that half the contents are off the screen (this could just be a resolution thing, I'm at a smaller resolution than what is standard nowadays I think). Dunno if that's at all related to your main problem though, sorry.

    It also appears to be perilously difficult to close. As in, it froze up that tab of Chrome and is not closing. I assume it will eventually though...

    Battle.net ID: kime#1822
    3DS Friend Code: 3110-5393-4113
    Steam profile
  • SmasherSmasher Starting to get dizzy Registered User regular
    I like the idea of project Euler with regards to programming tasks, but it quickly becomes a test of how much higher-level math you know. Is there a similar site that doesn't do that?

    EchoJimmy King
  • SmasherSmasher Starting to get dizzy Registered User regular
    Can anyone think of a reason why Ruby benchmarks would say code took 2-4 times longer in wall time than it did while the user/system time taken is correct? If anything I would expect the reverse due to multiple cores and so forth.

  • Jimmy KingJimmy King Registered User regular
    Smasher wrote: »
    I like the idea of project Euler with regards to programming tasks, but it quickly becomes a test of how much higher-level math you know. Is there a similar site that doesn't do that?
    The dailyprogrammer reddit doesn't seem to be quite as bad about that. I've been meaning to try to do it at least once or twice a week, but so far I've only done one.

  • EchoEcho ski-bap ba-dapModerator mod
    I just remembered an interesting Rails shop job application I saw once.

    Basically, you got a key for their backend API, and they wanted you to do something interesting with it.

  • zeenyzeeny Registered User regular
    edited January 2013
    That sounds interesting only if you are a student or desperate, echo. It's purpose defeating, unless they were looking for somebody cheap.

    zeeny on
  • EchoEcho ski-bap ba-dapModerator mod
    Oh, it wasn't the only thing. They saw it as a work sample. Don't think they wanted something groundbreaking out of it.

  • Jimmy KingJimmy King Registered User regular
    The most interesting one I've seen recently was for Cox. They have you write a single player Tic Tac Toe game in Python with basic AI so that the computer never loses. That was done at home via github, not just on the spot.

    Unfortunately the recruiter told me the position was put on hold a few days after contacting me about it, but assured me it would open back up, possibly in just a few weeks. I got bored earlier this month and did their Tic Tac Toe and just submitted it straight to Cox (they are always accepting applicants via github pull requests). They told me that all of the positions were filled before that recruiter had even contacted me.

    They say they're keeping my resume handy for when they do need to hire again, but I don't think I've ever heard of that actually resulting in someone getting a job.

  • EchoEcho ski-bap ba-dapModerator mod
    edited January 2013
    A brand new episode of Echo Sucks At SQL!

    I have this simple query to select people who are not members of a given group.
    SELECT id, username
      FROM User U
      JOIN UserGroups UG
        ON (UG.user_id = U.id)
      WHERE UG.group_id != 4
    

    However, for that to give the desired results, a user has to be a member of some group, otherwise they're not in the UG junction table. If they're not a member of any group, they don't show up in the result.

    How solve?

    It's so annoying when I know what I want to do but suck at the actual syntax.

    Echo on
  • EchoEcho ski-bap ba-dapModerator mod
    edited January 2013
    ...and of course it's glaringly obvious how it should be done when I got it to actually work. :rotate:

    I really need to work more with SQL so this simple stuff actually sticks.
    SELECT id, username
      FROM User U
      LEFT JOIN UserGroups UG
        ON (UG.user_id = U.id)
      WHERE UG.group_id != 4
      OR UG.group_ID IS NULL
    

    Echo on
  • The AnonymousThe Anonymous Uh, uh, uhhhhhh... Uh, uh.Registered User regular
    Quick about mixing C/C++. I have a C++ library where I've got a private struct Foo ("private" meaning it's in a non-public header and exposed via a pointer typedef) with one member, a pointer to an object of class Bar. Would C programs still be able to use this struct, or do I have to store a void* instead?

  • bowenbowen How you doin'? Registered User regular
    Quick about mixing C/C++. I have a C++ library where I've got a private struct Foo ("private" meaning it's in a non-public header and exposed via a pointer typedef) with one member, a pointer to an object of class Bar. Would C programs still be able to use this struct, or do I have to store a void* instead?

    Hmm, as far as I know, if you're not using C++ elements in the struct, you should be able to use "extern C" on it?

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • KolosusKolosus Registered User regular
    Gilbert0 wrote: »
    Kolosus wrote: »
    Any of you dudes currently telecommute? I am investigating applying for a job that I should be qualified for and they all telecommute.

    Yup. I had worked at the job first though and was moving. I tried to quit and they wouldn't let me :) Anything specific you want to know?

    How does your company handle meetings and availability time?

  • EtheaEthea Registered User regular
    Quick about mixing C/C++. I have a C++ library where I've got a private struct Foo ("private" meaning it's in a non-public header and exposed via a pointer typedef) with one member, a pointer to an object of class Bar. Would C programs still be able to use this struct, or do I have to store a void* instead?

    The easiest way to link C programs to a C++ library is to make sure the following have been done:

    1. Export the struct with the extern C command so that the names aren't mangled in the library
    as if they are a C++ struct
    2. Make sure that you decorate the struct with the proper symbol export commands for you given compiler. Aka __declspec for windows and __attribute__ ((visibility ("default"))) for gcc ( 4.x+).
    3. Make sure the header that defines the struct is available to the C program to include so they understand what the components of the struct are.

    If you can't expose the member variables of the struct you will have to use a void*. If the struct definition is inside a private header you don't feel safe making public, you should extract the struct definition into a new header that the C program can include.

    bowen
  • bowenbowen How you doin'? Registered User regular
    ethea knows way more than I do about C++, so listen to that guy

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Jimmy KingJimmy King Registered User regular
    What's up with this rails 3 template?
    <%= @user_reading_list.books.each do |book| %>
    <span><%= book.title %></span><br />
    <% end %>
    

    The page prints out both the book title and the string representation of book.

    A book!
    #<Book:0x7fd366d41bd8>

    Ad yes, there's only one book in the association, I've checked that.

  • RendRend Registered User regular
    edited January 2013
    Advice time!

    I am writing an application in C# that will generate a bunch of SQL code, specifically I am going to be programmatically generating major stored procedures.

    Some sections are very boilerplate. Some sections are highly custom based on the parameters of the database in question.

    Here are my concerns!
    1. I feel like it's better coding to put the code of the stored procedure in an external file and read it in, rather than hard coding it in the application itself. That will make it easier to maintain since maintenance of the generated code will not require maintenance of the application generating it.

    2. While this is easy for the boilerplate stuff, I start to wonder when the custom stuff comes in. I can either hard code some parts of this stored procedure but not others, which seems to violate more than just one principle of good programming (principle of least surprise among them), or I can do something like put variable names %%LikeSo%%. Parsing that out wouldn't be incredibly difficult but it would add a dangerously complex layer to external maintenance- ie, knowing what those names are. Also, if I did that, I would have to do a bit more error handling to ensure that names coming in exist, etc.

    3. My initial instinct is to put different sections of the code into different, small files, since each of the sections does something very different, and because then reading in the sections of the code will be self documenting via the file names.

    Basically I am trying to implement an elegant way to generate this code and keep it easy to maintain. Any commentary you guys have would be more than welcome.

    Rend on
  • EndEnd Registered User regular
    Ethea wrote: »
    1. Export the struct with the extern C command so that the names aren't mangled in the library
    as if they are a C++ struct

    Wait, how does that even happen? I thought structure field names were only determined from the structure definition at compile time. If that definition isn't there, you can only deal with the structure as an opaque pointer (or you could cast it to something else I suppose).

    I wish that someway, somehow, that I could save every one of us
    zaleiria-by-lexxy-sig.jpgsteam~tinythumb.png
  • gjaustingjaustin Registered User regular
    edited January 2013
    @Rend

    1) Definitely do this. I'd also suggest marking the external file with the database version so that you can target different versions of SQL Server or Oracle (e.g. procedure.2005, procedure.oracle7, procedure.all).

    2) Just put some really good comments at the top of the file and pick good variable names. %%Table%% is pretty obvious what it is.

    3) I'd only worry about this if the procedure is very long (making maintenance for specific versions easier - see #1) or if not all generated procedures need all the sections.

    gjaustin on
  • RendRend Registered User regular
    gjaustin wrote: »
    @Rend
    3) I'd only worry about this if the procedure is very long (making maintenance for specific versions easier - see #1) or if not all generated procedures need all the sections.

    One of my major motivations for breaking it up like this is because the procedure is going to be variable length- the procedure will always need every section, but for instance, some procedures will need to run this part four times, some will need to run it six times, each with a different dynamic table name, etc, and it made more sense to me to simply put it into different files than to, say, delimit the sections with comments or something. Though, the more I think about it, the more I think that way would probably be wiser.

  • an_altan_alt Registered User regular
    Took my first stab at functional programming this weekend. It feels so weird wrapping your head around things like using 1 + myself instead of i++ in a loop for a counter. It's not bad, it just feels like trying to learn a physical skill that your body has absolutely no muscle memory for.

    The most time consuming part was trying to decipher the SML error messages. They were amazingly unhelpful.

    Pony wrote:
    I think that the internet has been for years on the path to creating what is essentially an electronic Necronomicon: A collection of blasphemous unrealities so perverse that to even glimpse at its contents, if but for a moment, is to irrevocably forfeit a portion of your sanity.
    Xbox - PearlBlueS0ul, Steam
    If you ever need to talk to someone, feel free to message me. Yes, that includes you.
  • InfidelInfidel Heretic Registered User regular
    Echo wrote: »
    ...and of course it's glaringly obvious how it should be done when I got it to actually work. :rotate:

    I really need to work more with SQL so this simple stuff actually sticks.
    SELECT id, username
      FROM User U
      LEFT JOIN UserGroups UG
        ON (UG.user_id = U.id)
      WHERE UG.group_id != 4
      OR UG.group_ID IS NULL
    

    That Does Not Do What You Think It Does

    You're getting a list (with repeats) of people who are in groups other than group 4, or not members of any group. The only people that will not select are those that are in exactly one group, group 4.
    select U.id, U.username
    from User U
    where not exists
    (select 1 from UserGroups where user_id = U.id and group_id = 4)
    

    OrokosPA.png
  • EchoEcho ski-bap ba-dapModerator mod
    Infidel wrote: »
    That Does Not Do What You Think It Does

    Ah yes, ye olde trap of Insufficient Test Data In Tables.

    Thanks a bunch.

  • EchoEcho ski-bap ba-dapModerator mod
    ...and after further consulting with a friend that does SQL for a living:
    SELECT U.id, U.username
      FROM Users U
      WHERE U.id NOT IN (
        SELECT UG.user_id from UserGroups UG
        WHERE group_id = 4
      );
    

    I'm constantly doing this thing where I severely overthink a query, and then he smacks me down with something that simple and concise. :P

  • InfidelInfidel Heretic Registered User regular
    Yep, those are two ways to do membership tests.

    Either check if that particular entry (user+group) exists, or get the list of users in a group and check membership against that list.

    You can also do it with joins, but it isn't nearly as readable so don't do that unless you have to for performance reasons. (And if you are having performance reasons, you probably should be looking things over anyway...)

    OrokosPA.png
    Echo
  • EchoEcho ski-bap ba-dapModerator mod
    I really need to take some time to populate this with proper test data. It sucks when you get the "right" result because it just happens to be the only result that matches given the current data, but is actually wrong when you have more data.

  • EtheaEthea Registered User regular
    edited January 2013
    End wrote: »
    Ethea wrote: »
    1. Export the struct with the extern C command so that the names aren't mangled in the library
    as if they are a C++ struct

    Wait, how does that even happen? I thought structure field names were only determined from the structure definition at compile time. If that definition isn't there, you can only deal with the structure as an opaque pointer (or you could cast it to something else I suppose).

    Sorry I was referring to the struct name in function signatures. The whole reason to extern C a structure is to be able to pass that structure to other functions that have been marked as extern C. for example the code:
    extern "C" { struct foo { int x,y,z; }; }
    
    float test_foo(foo *f)
    {
      return f->x * f->y;
    }
    

    Generates a link signature that looks like: __Z8test_fooP3foo which is unusable by the C linker. Instead you need to extern the function to get a valid C function signature: _test_foo.

    This presumes that the struct is actually a valid C struct and not a C++ struct ( no inheritance, member methods, etc ).

    Ethea on
  • bowenbowen How you doin'? Registered User regular
    stack overload!

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    edited January 2013
    Shouldn't it be sufficient to just extern the function? C/C++ won't change the structure layouts and the structs themselves don't get exported. I've never had any problems doing it anyway

    Phyphor on
  • EndEnd Registered User regular
    okay, yeah, definitely want to extern "C" those functions

    the structure itself I don't see any issues with though. He's not exposing the contents to the C compiler, so he can only use it as an opaque pointer anyway.

    I wish that someway, somehow, that I could save every one of us
    zaleiria-by-lexxy-sig.jpgsteam~tinythumb.png
  • bowenbowen How you doin'? Registered User regular
    The only caveat, as ethea says, is if you use C++ specific shit inside it, you'll probably get a compiler warning.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • EndEnd Registered User regular
    edited January 2013
    he's fine by not exposing the structure contents to the C compiler

    it does mean you can't use it as anything but a pointer, since you don't know how big it is (and of course, even if you did, you couldn't create it properly). You also can't increment the pointer, again because you don't know how big it is

    End on
    I wish that someway, somehow, that I could save every one of us
    zaleiria-by-lexxy-sig.jpgsteam~tinythumb.png
  • EtheaEthea Registered User regular
    edited January 2013
    End wrote: »
    he's fine by not exposing the structure contents to the C compiler

    it means you can't use it as anything but a pointer, since you don't know how big it is (and of course, even if you did, you couldn't create it properly). You also can't increment the pointer, again because you don't know how big it is

    You are both correct you don't need to extern the struct. Just any function that uses it or global definitions of it. Without the definition you shouldn't try to access or set values on the struct, since you have no idea of the layout.
    bowen wrote: »
    stack overload!
    It is weird, when I edit the post I don't see the duplicate text. Looks like it is a vanilla bug.

    Ethea on
  • bowenbowen How you doin'? Registered User regular
    Yeah, it's a bug if you have unclosed BBCode, and then do another bbcode. It likes to repeat it for some reason.

    regular expressions :rotate:

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
This discussion has been closed.