New OOTS products from CafePress
New OOTS t-shirts, ornaments, mugs, bags, and more
Page 1 of 7 1234567 LastLast
Results 1 to 30 of 193
  1. - Top - End - #1
    Bugbear in the Playground
     
    TSGames's Avatar

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

    Default Programmers in the Playground II: It's not a bug, it's a feature

    Hello fellow Playgrounders!

    The return of the infamous programming thread: a place to posit all your programming queries, brag about your latest accomplishments, and complain about how language X is so bad compared to language Y.

    Here's a picture to kick off the discussion:

    =P
    Last edited by TSGames; 2013-12-27 at 08:19 AM.
    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.

  2. - Top - End - #2
    Dwarf in the Playground
     
    Drumbum42's Avatar

    Join Date
    Jul 2005
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Here's a fun story about using Java to fix a simple problem:

    At work I was migrating <Software Product> from one server to another, and updating the software to the latest version. I got the software installed and running and pulled over the database. When I started the software it said: "Error: Can not have more then 64 keys!" I tries this 3-4 times and got the same result, so I looked online. The internet pretty much said: "You're dumb, why are you using that many keys? Recompile MySQL to allow more keys or better yet, fix your DB code." I have run this software on several servers before and I never had to do this, so this did not sound right.

    So I opened a ticket with <Software Product's Company>. They said "have you tried recompiling MySQL from source to allow for MySQL to have more then 64 keys?" (Apparently 5min on google was all their IT dept was capable of) My boss didn't like it either so he spent several hours sifting through <Software Company>'s FAQ pages and found a nugget from 2006: "If you receive and error "Can not have more then 32 keys" while upgrading the database, please delete all duplicate entries under "indexes" for each table.

    Ah Ha! Problem solved, except there were approximately 1500-2000 entries that needed to be removed, and my boss expected me to do this by hand. Yea right. So I whipped up a java program that went through every table and deleted all redundant entries, and I did it in under 3 hours. Also I haven't made Java talk to a database in a few years so it was a good refresher course too! For the next 15 min I sat back like a proud parent and watched my code clean the database. When it was done the software ran like a charm, no issues.

    When I notified <Software Company>'s helpdesk, there were uninterested in my solution. The tech asked me to submit a feature request and closed the ticket. All of this could have been avoided if their software cleaned up after itself when it updated, instead of making a new copy every index in the DB each time it was updated. To be fair, this issue did end with my boss being very impressed with my ability to use code to solve problems quickly.
    Proud 1st edtion player!

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

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

    smile Re: Programmers in the Playground II: It's not a bug, it's a feature

    XD

    Yeah... I've run into the 'feature request for nearly-essential functionality that the program should already have' before. It's never ended productively, or well for me.

    I figure I'll kick off the discussion then: Anyone got a project they feel like posting/ranting/bragging about?
    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 - #4
    Ettin in the Playground
     
    Kobold

    Join Date
    May 2005
    Location
    Somerville, MA
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Sure. I feel like gushing about docopt. If you're not into the command line you probably won't care.

    My least favorite task in writing cli apps is parsing the options and arguments. When I'm done with that I have to go back and update the documentation to match the new options.

    Docopt fixes that.

    There are many libraries for handling command line options. Docopt's approach is to define those options in the documentation. So you come up with your help message that describes the options, where they can be used, what their defaults are, whether they're required or optional, etc. Just write the documentation, let docopt parse that and your options all in one fell swoop. Now your options and documentation won't get out of sync again.

    I'm gushing about docopt because I finally got the bash version to work. (There's a core python version and support for calling it from a number of languages, but the bash one was tricky. Actually the problem was that github was eating some of the syntax which ruined the example, but that's another matter.)

    I rewrote a music selection script I had using docopt. The switch made it a whole lot more versatile and cut down LOC by about 25%. I hate bragging, but it's probably the most beautiful shell script I've made so far. You point it at your music directory, describe the directory (ie, the default is genre/artist/album, but if yours is ordered by artist/year/album you could change that with the --structure option), tell it which criteria to filter by, and it lets you pick one of those items and plays it. So I could call my script with "-l album" and it'll let me choose an album and play it. Or "-l genre" would let me single out a genre. Or I could combine that with "--random" and it'd pick the same type of item randomly.

    Here's the script. The eval at the top is the docopt documentation I've been babbling about. dmenu is a program that takes stdin, prints it all, and lets you select a line, and prints it back out for further processing. cmus-remote controls cmus, my music player of choice.

    Spoiler
    Show
    PHP Code:
    #!/bin/bash

    # applies filters to cmus based on your music directory's structure 
    # requires docopts and dmenu
    eval "$(docopts -A args -V - -h - : "$@" <<EOF
    Usage: cmus_select.sh [--list <tag>] [--random] [--structure=</alt/dir/structure>] [--dir=/path/to/music]

      -h --help                Show help
      -r --random              Randomize selection instead of using a dmenu
      -l --list TAG            List music by tag.  Unless you use -s, genre, artist, album, and song are expected. [default: song]
      -s --structure STRUCT    Directory structure for your music.  [default: genre/artist/album/song]
      -d --dir DIR             Location of music [default: 
    $HOME/Music/]
    ----
    cmus_select.sh 0.0.1
    EOF
    )"

    # find position of this tag in the given dir strcuture
    for tag in ${args['--structure']//\// } ; do
      
    POS=$(( $POS ))
      [[ 
    "${args['--list']}== "$tag]] && break
    done

    # set up find args to get this item
    if [[ "${args['--list']}== "song" ]] ; then
      FINDARGS
    =" -mindepth $POS -type f -iregex .*\.\(mp3\) " # no maxdepth - some albums have cd1/cd2 subdirs
    else
      
    FINDARGS=" -mindepth $POS -maxdepth $POS -type d" 
      
    CAP='/*' 
    fi

    # Prep our pipes.  FORMAT affects display.  SELECT runs the dmenu.
    OFFSET=$(echo ${args['--dir']//\// } | wc -w )
    FORMAT="cut -f $((POS + $OFFSET + 1)) -d/"
    SELECT="dmenu -i -l 20 -b -s 0"
    [[ "${args['--random']}== 'true' ]] && SELECT="shuf -n 1" 

    # Get a song or dir and send it to cmus
    DIR=$(find "${args['--dir']}$FINDARGS $FORMAT sort $SELECT )
    if [[ 
    "$DIR!= "" ]] ; then
      cmus
    -remote -"live-filter ~f */$(echo $DIR | tr '()' '*')$CAP# cmus treats parens as grouping.  
      
    cmus-remote -"echo Playing: $DIR"
      
    cmus-remote --p
    fi 
    If you like what I have to say, please check out my GMing Blog where I discuss writing and roleplaying in greater depth.

  5. - Top - End - #5
    Orc in the Playground
     
    eidreff's Avatar

    Join Date
    Aug 2007
    Location
    The skirting board
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    I've been playing with Project Euler to keep my hand in. I have finally realised that Python is easier to write, and far faster to play with in this kind of case. (I'm a C++ chappie with a chunk of Java thrown in) got to problem 18 in less than a week. I'm out of practice so please don't rant at me for being slow!
    Why cannot life be simple? I am simple, therefore surely something that i try to do must also be simple

  6. - Top - End - #6
    Ogre in the Playground
    Join Date
    Oct 2011
    Location
    The last place you look
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Is anyone here experienced with adding holidays to KDE? I'm trying to add LITERALLY hundreds of religious holidays, and some have semi-complex rules for calculating the date. Such as "Normally on this day, unless it's less than a week before Easter, when it's this other day instead"

    I'm trying the following, but not only will my computer not accept it, it'll actually ignore any lines after it.

    (Actually all on one line)

    Code:
    white "Solemnity of the Annunciation of the Lord" white
    on ([easter] - [25.3] <= 7 ? [easter plus 8 days] : [25.3])
    Last edited by Razanir; 2013-12-27 at 07:16 PM.
    Avatar by Venetian Mask. It's of an NPC from a campaign I may yet run (possibly in PbP) who became a favorite of mine while planning.

    Quote Originally Posted by Razanir View Post
    Everyone knows frying pans are actually weapons that people repurpose for cooking
    I am a 10/14/11/15/12/14 LG Clr 2

  7. - Top - End - #7
    Halfling in the Playground
     
    TubaMortim's Avatar

    Join Date
    Aug 2009

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    The thread starter tells to brag about achievements so here goes:

    I just finished a course in mobile development, which was basically about making html/Javascript apps for Android using Phonegap. I had only went to a basic Java course before, and had never done anything with Javascript.

    I'm proud to present my final product: Javascript Trainer - an app that presents you with a block of code, and your job is to spot the errors in it. The idea came from myself noticing that I spent lots and lots of time trying to fix my code by tweaking the logic of it, when the problem was in a simple syntax error that I just didn't notice.

    The app is available on Google Play

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

    Join Date
    Feb 2013

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by eidreff View Post
    I've been playing with Project Euler to keep my hand in. I have finally realised that Python is easier to write, and far faster to play with in this kind of case. (I'm a C++ chappie with a chunk of Java thrown in) got to problem 18 in less than a week. I'm out of practice so please don't rant at me for being slow!
    Another Pythonist is born! Welcome to the land of easy coding.

    As for me, I don't have much to brag about at the moment, but I did just finish up a huge project experimenting with multi-threading in python. Contrary to popular belief, it handles it quite well and I was able to speed up execution time by a factor of 8 on a 4 core system. =D
    Hello, I'm Finlam: content creator for D&D5e and writer.
    Playable Slimes for D&D5e
    >>>So You Want To Be A Slime?<<<

    5eHeroic - Make high level D&D feel heroic and fun again.

    -Game Content-
    Roleplay Warm-up - Exercises to get into Character
    3 Traps to Get Your Players Excited
    GM's Easy Creation Kit (G.E.C.K.)

    -Character Builds-
    Building a Super SAD Tank - Using a Paladin/Hexblade to build an unstoppable tank.


    Let's chat sometime.

  9. - Top - End - #9
    Dwarf in the Playground
    Join Date
    Jun 2011

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by Subproject54 View Post
    Another Pythonist is born! Welcome to the land of easy coding.
    Any advice on where to pick up information on Python? As of a few days ago, I've got a Raspberry Pi on my desk, and Python seems to be the intended language of choice.

    I've been rather light on programming lately, and most of my experience is in C. I'd like a quick overview/intro that would also be a decent reference, rather than something intended for a complete beginner with no experience.

  10. - Top - End - #10
    Bugbear in the Playground
    Join Date
    Feb 2013
    Location
    Prime Material Plane
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by razark View Post
    Any advice on where to pick up information on Python? As of a few days ago, I've got a Raspberry Pi on my desk, and Python seems to be the intended language of choice.

    I've been rather light on programming lately, and most of my experience is in C. I'd like a quick overview/intro that would also be a decent reference, rather than something intended for a complete beginner with no experience.
    The best place to go is the official Python tutorial. Note that there are two types of Python: Python 2.7, and Python 3. 3 is newer, but 2 is more portable. Here are links to both tutorials:
    2.7: http://docs.python.org/2/tutorial/
    3: http://docs.python.org/3/tutorial/

  11. - Top - End - #11
    Titan in the Playground
     
    Tyndmyr's Avatar

    Join Date
    Aug 2009
    Location
    Maryland
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Hey, I code all the things! Java's the main language these days, but I dabble in all manner of stuff. Python was the last language picked up, and I must say, it's reasonably easy to pick up. JMonkey is my current dabblin' project, though finding spare time for more coding is rough.

  12. - Top - End - #12
    Dwarf in the Playground
    Join Date
    Jun 2011

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by jhunter_d View Post
    The best place to go is the official Python tutorial. Note that there are two types of Python: Python 2.7, and Python 3. 3 is newer, but 2 is more portable.
    Thank you. I'll have to find some time to look over it. 2.7 is what is installed on the load I'm currently using. Hopefully I can find something fun and useful to do with this thing.

  13. - Top - End - #13
    Dwarf in the Playground
     
    Drumbum42's Avatar

    Join Date
    Jul 2005
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by razark View Post
    Any advice on where to pick up information on Python? As of a few days ago, I've got a Raspberry Pi on my desk, and Python seems to be the intended language of choice.

    I've been rather light on programming lately, and most of my experience is in C. I'd like a quick overview/intro that would also be a decent reference, rather than something intended for a complete beginner with no experience.
    Gratz on getting the Raspberry Pi! Yea, they have Python preinstalled when you use the default raspbian, but you can use many languages on it. I'm sure that you can find a C/C++ compiler for it too, I mean I got Java running on mine.
    Proud 1st edtion player!

  14. - Top - End - #14
    Barbarian in the Playground
     
    BarbarianGuy

    Join Date
    Feb 2010
    Location
    Calgary
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    I would like to brag that I made it through last semester with B's. As much as learning assembly and machine code was a pain, I appreciate not programming in assembly and really really really appreciate not programming in machine code.

  15. - Top - End - #15
    Bugbear in the Playground
     
    shawnhcorey's Avatar

    Join Date
    Dec 2010
    Location
    The Great White North
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by Balain View Post
    I would like to brag that I made it through last semester with B's. As much as learning assembly and machine code was a pain, I appreciate not programming in assembly and really really really appreciate not programming in machine code.
    Obligatory xkcd: Real Programmers.
    Last edited by shawnhcorey; 2013-12-30 at 06:16 PM.
    How do you keep a fool busy? Turn upside down for answer.
    ˙ɹǝʍsuɐ ɹoɟ uʍop ǝpısdn uɹnʇ ¿ʎsnq ןooɟ ɐ dǝǝʞ noʎ op ʍoɥ

  16. - Top - End - #16
    Ogre in the Playground
    Join Date
    Oct 2011
    Location
    The last place you look
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by Balain View Post
    I would like to brag that I made it through last semester with B's. As much as learning assembly and machine code was a pain, I appreciate not programming in assembly and really really really appreciate not programming in machine code.
    Quote Originally Posted by shawnhcorey View Post
    Obligatory xkcd: Real Programmers.
    Only machine code... REAL programmers make their own processors. (Like *I* did for class last semester)
    Avatar by Venetian Mask. It's of an NPC from a campaign I may yet run (possibly in PbP) who became a favorite of mine while planning.

    Quote Originally Posted by Razanir View Post
    Everyone knows frying pans are actually weapons that people repurpose for cooking
    I am a 10/14/11/15/12/14 LG Clr 2

  17. - Top - End - #17
    Bugbear in the Playground
    Join Date
    Feb 2013
    Location
    Prime Material Plane
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by Razanir View Post
    Only machine code... REAL programmers make their own processors. (Like *I* did for class last semester)
    How did you do it? Could it run anything?

  18. - Top - End - #18
    Ogre in the Playground
    Join Date
    Oct 2011
    Location
    The last place you look
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by jhunter_d View Post
    How did you do it? Could it run anything?
    Well we only had to design one with Quartus. It ran on an FPGA, so we didn't have to build anything. But yes, it could run stuff. My group had ours read in a number from some switches, triple it, then display it in binary and hex.
    Avatar by Venetian Mask. It's of an NPC from a campaign I may yet run (possibly in PbP) who became a favorite of mine while planning.

    Quote Originally Posted by Razanir View Post
    Everyone knows frying pans are actually weapons that people repurpose for cooking
    I am a 10/14/11/15/12/14 LG Clr 2

  19. - Top - End - #19
    Barbarian in the Playground
     
    Finlam's Avatar

    Join Date
    Feb 2013

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by Razanir View Post
    Well we only had to design one with Quartus. It ran on an FPGA, so we didn't have to build anything. But yes, it could run stuff. My group had ours read in a number from some switches, triple it, then display it in binary and hex.
    Yeah, you can do a lot of cool stuff with FPGAs. VHDL is awesome to program in, but I found (for me) that it took a little while to get into the everything asynchronous mindset. After you're there, it can be a ton of fun, plus working on the hardware at that level makes it really really fast.
    Hello, I'm Finlam: content creator for D&D5e and writer.
    Playable Slimes for D&D5e
    >>>So You Want To Be A Slime?<<<

    5eHeroic - Make high level D&D feel heroic and fun again.

    -Game Content-
    Roleplay Warm-up - Exercises to get into Character
    3 Traps to Get Your Players Excited
    GM's Easy Creation Kit (G.E.C.K.)

    -Character Builds-
    Building a Super SAD Tank - Using a Paladin/Hexblade to build an unstoppable tank.


    Let's chat sometime.

  20. - Top - End - #20
    Barbarian in the Playground
     
    Ashtar's Avatar

    Join Date
    Jun 2007
    Location
    Switzerland
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    This year, we acquired two new customers for our software and we now optimize the power portfolios of the three largest Swiss power companies (among others). Pretty good for a two man company and with the software written by one person (me!).
    Last edited by Ashtar; 2014-01-03 at 06:40 AM.

  21. - Top - End - #21
    Ogre in the Playground
    Join Date
    Oct 2011
    Location
    The last place you look
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by Subproject54 View Post
    Yeah, you can do a lot of cool stuff with FPGAs. VHDL is awesome to program in, but I found (for me) that it took a little while to get into the everything asynchronous mindset. After you're there, it can be a ton of fun, plus working on the hardware at that level makes it really really fast.
    Fun was making a circuit diagram for multiplication.
    Avatar by Venetian Mask. It's of an NPC from a campaign I may yet run (possibly in PbP) who became a favorite of mine while planning.

    Quote Originally Posted by Razanir View Post
    Everyone knows frying pans are actually weapons that people repurpose for cooking
    I am a 10/14/11/15/12/14 LG Clr 2

  22. - Top - End - #22
    Barbarian in the Playground
     
    GnomePirate

    Join Date
    Sep 2012

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by Razanir View Post
    Only machine code... REAL programmers make their own processors. (Like *I* did for class last semester)
    Processors? Real programmers mill their own gears.

  23. - Top - End - #23
    Titan in the Playground
     
    Tyndmyr's Avatar

    Join Date
    Aug 2009
    Location
    Maryland
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by CombatOwl View Post
    Processors? Real programmers mill their own gears.
    I print mine on a 3d printer. Have not yet made a mechanical computer on one, though I suppose it's possible if you want to burn the plastic.

  24. - Top - End - #24
    Dwarf in the Playground
     
    Drumbum42's Avatar

    Join Date
    Jul 2005
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by CombatOwl View Post
    Processors? Real programmers mill their own gears.
    A REAL programer uses a "binary-like system of ropes, knots, and simple machines operated by a rotating cylindrical cogwheel"

    See Heron of Alexandria

    Rope computers, go big or go home.
    Last edited by Drumbum42; 2014-01-08 at 04:33 PM.
    Proud 1st edtion player!

  25. - Top - End - #25
    Ogre in the Playground
    Join Date
    Oct 2011
    Location
    The last place you look
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    This seems relevant:

    K'nex calculator
    Avatar by Venetian Mask. It's of an NPC from a campaign I may yet run (possibly in PbP) who became a favorite of mine while planning.

    Quote Originally Posted by Razanir View Post
    Everyone knows frying pans are actually weapons that people repurpose for cooking
    I am a 10/14/11/15/12/14 LG Clr 2

  26. - Top - End - #26
    Bugbear in the Playground
     
    shawnhcorey's Avatar

    Join Date
    Dec 2010
    Location
    The Great White North
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Real programmers make it out of Lego.
    How do you keep a fool busy? Turn upside down for answer.
    ˙ɹǝʍsuɐ ɹoɟ uʍop ǝpısdn uɹnʇ ¿ʎsnq ןooɟ ɐ dǝǝʞ noʎ op ʍoɥ

  27. - Top - End - #27
    Ogre in the Playground
    Join Date
    Oct 2011
    Location
    The last place you look
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by shawnhcorey View Post
    Real programmers make it out of Lego.
    Well, I'm glad to see from google search recommendations that I'm not the first to look for instructions.
    Avatar by Venetian Mask. It's of an NPC from a campaign I may yet run (possibly in PbP) who became a favorite of mine while planning.

    Quote Originally Posted by Razanir View Post
    Everyone knows frying pans are actually weapons that people repurpose for cooking
    I am a 10/14/11/15/12/14 LG Clr 2

  28. - Top - End - #28
    Ogre in the Playground
    Join Date
    Nov 2006

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Anyone here any good with databases? My knowledge of them is limited to "Hi, I'm a frontend dev. Here is some stuff I want to save."

    I'm looking for something nice and simple that just lets me save my structured data somewhere, without having to write queries. Something similar to Google's NDB, but for Node/Javascript.

    Best case scenario would be Redis backed by schemaless Postgres (9.3 using the new JSON type if possible)... anyone?
    Last edited by Neftren; 2014-01-09 at 12:33 PM.

  29. - Top - End - #29
    Troll in the Playground
    Join Date
    Jan 2012

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by shawnhcorey View Post
    Real programmers make it out of Lego.
    I recall there was once a computer made from billiard balls. I think it was supposed to be a proof of concept demonstrating how a computer could be made from anything.

  30. - Top - End - #30
    Dwarf in the Playground
     
    Drumbum42's Avatar

    Join Date
    Jul 2005
    Gender
    Male

    Default Re: Programmers in the Playground II: It's not a bug, it's a feature

    Quote Originally Posted by Razanir View Post
    This seems relevant:

    K'nex calculator
    That.... is perhaps the coolest thing I've seen all day.

    That is DEFINITELY the coolest thing I've seen all month.
    Last edited by Drumbum42; 2014-01-09 at 01:01 PM.
    Proud 1st edtion player!

Posting Permissions

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