Open Side Menu Go to the Top

05-24-2013 , 07:14 AM
I did a HU limit bot for my dissertation back at Uni (I did AI) along with brute forcing every hand vs hand combination to work out hand %'s. The bot was ****, but it still scored well

If I did it again, writing a bot to play 0.01/0.02 cash profitably would probably be quite fun, and exciting/daring/different for the people reviewing your work to read about. Just make sure you define your parameters as narrowly as possible (for example your bot will only play in full 10 handed games). Been a while since I played online though so not sure how well it would fit in with sites T&C's (if that's a concern).
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
05-24-2013 , 04:31 PM
Quote:
Originally Posted by ballin4life
How do you all like this as an interview question:

I have a test suite that runs 100 test scripts. I find that one of the tests in one of the scripts is failing when run in the test suite, yet everything passes when I run that test script alone. How do you debug this issue?
Memory management issue in that specific test. (99% certain)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-24-2013 , 06:23 PM
Quote:
Originally Posted by ballin4life
How do you all like this as an interview question:

I have a test suite that runs 100 test scripts. I find that one of the tests in one of the scripts is failing when run in the test suite, yet everything passes when I run that test script alone. How do you debug this issue?
It's passable as a starting point to discuss testing if you are truly prepared to discuss theory and practice of tests under a wide range of scenarios, it's not so okay if you just happened to run into something like this a few times, found a common culprit and expect the interviewee to have run into similar scenarios and regurgitate the answer. It's a little too contrived as a starting point for discussion and not well-defined enough to be an objective test.

In most cases, the test will tell you what failed. What you do afterwards depends on what that is. You also don't debug from the point of zero knowledge - what you know about the application, the test suite, how it works, etc, all determine the course of action.


Quote:
Originally Posted by MadTiger
Memory management issue in that specific test. (99% certain)
No, this is not likely and there are all kinds of ways tests can depend on one another. It could be external dependencies, it could be earlier tests are modifying an external environment (DB, external services, user settings, OS resources, application state, testing setup, or mocks) and not reverting cleanly. Tests may be asynchronous and interfering with each other. It could be that the test works as an accident. There could be problems with how tests are set up or the test runner and some tests don't even run under some circumstances. We have no idea what kind of application it is, what types of tests (e2e, unit, midway, whatever) are being run, how the tests run, how the tests are written, etc, etc.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-24-2013 , 06:41 PM
If I were potentially interested in data science / scientific computation / Big Data / whatever you want to call it, at a university without a data science program, what would be some things I should be looking to learn / classes to take?

I'm guessing CS machine learning/datamining stuff and applied statistics would be good right?

Going to be getting a BS in CS but I'm already seeing my fascination with data and manipulating it and analyzing it for something useful and think that could potentially be a career path.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-24-2013 , 08:06 PM
Quote:
Originally Posted by TheMetetrown
If I were potentially interested in data science / scientific computation / Big Data / whatever you want to call it, at a university without a data science program, what would be some things I should be looking to learn / classes to take?

I'm guessing CS machine learning/datamining stuff and applied statistics would be good right?

Going to be getting a BS in CS but I'm already seeing my fascination with data and manipulating it and analyzing it for something useful and think that could potentially be a career path.
It can definitely be a career path. A really really good career path.

Courses like algorithms/AI/machine learning/stats would all be useful.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-24-2013 , 08:25 PM
Quote:
Originally Posted by TheMetetrown
If I were potentially interested in data science / scientific computation / Big Data / whatever you want to call it, at a university without a data science program, what would be some things I should be looking to learn / classes to take?

I'm guessing CS machine learning/datamining stuff and applied statistics would be good right?

Going to be getting a BS in CS but I'm already seeing my fascination with data and manipulating it and analyzing it for something useful and think that could potentially be a career path.
Math and stats is incredibly useful. I write software in the supply chain industry where big data is a huge obstacle. Think a pharmaceutical company with 300 distribution sites and 300,000 products, and trying to optimize their inventory placement. Stuff I use regularly at work:

Statistical forecasting methods
Stochastic processes theory
Dynamic programming
Linear/mixed integer programming

And proficiency with algorithms and data structures is really important.

Also useful to learn some good prototyping langues like R, Matlab, python, C#.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-24-2013 , 09:37 PM
Quote:
Originally Posted by candybar
It's passable as a starting point to discuss testing if you are truly prepared to discuss theory and practice of tests under a wide range of scenarios, it's not so okay if you just happened to run into something like this a few times, found a common culprit and expect the interviewee to have run into similar scenarios and regurgitate the answer. It's a little too contrived as a starting point for discussion and not well-defined enough to be an objective test.
Yeah, obviously I meant it as the starting point for a discussion. I wouldn't ask a question where I was expecting a single canned answer.

Quote:
In most cases, the test will tell you what failed. What you do afterwards depends on what that is. You also don't debug from the point of zero knowledge - what you know about the application, the test suite, how it works, etc, all determine the course of action.
Yeah, I first tried to approach it like this, but I honestly was pretty baffled by the error. It was an exception being thrown during the test set up which was coming from deep within our (custom-made) ORM library - apparently a bug in this library, yet it only happened when running the test suite and not during typical execution. I wasn't totally sure where to go from there without specifically digging into what was happening in the test suite.

Quote:
No, this is not likely and there are all kinds of ways tests can depend on one another. It could be external dependencies, it could be earlier tests are modifying an external environment (DB, external services, user settings, OS resources, application state, testing setup, or mocks) and not reverting cleanly. Tests may be asynchronous and interfering with each other. It could be that the test works as an accident. There could be problems with how tests are set up or the test runner and some tests don't even run under some circumstances. We have no idea what kind of application it is, what types of tests (e2e, unit, midway, whatever) are being run, how the tests run, how the tests are written, etc, etc.
Python web application using Python's builtin unittest framework.

It turned out to be that one of the tests (not the one that was failing) was importing a file that, at import time, was changing the value of a constant in the ORM library which caused a certain function in the ORM to fail. I'm still not entirely sure how that constant impacts that particular function.

For something weird like that I hope I can be excused for not being able to figure it out just from application knowledge
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2013 , 01:39 AM
Quote:
Originally Posted by muttiah
Math and stats is incredibly useful. I write software in the supply chain industry where big data is a huge obstacle. Think a pharmaceutical company with 300 distribution sites and 300,000 products, and trying to optimize their inventory placement. Stuff I use regularly at work:

Statistical forecasting methods
Stochastic processes theory
Dynamic programming
Linear/mixed integer programming

And proficiency with algorithms and data structures is really important.

Also useful to learn some good prototyping langues like R, Matlab, python, C#.
Would a class in numerical methods be useful?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2013 , 04:40 AM
Quote:
Originally Posted by muttiah
Skeet's book is good - the 2nd best book about C#/.Net IMO.

The best is CLR via C#. It is more foundational and describes the guts of how the .Net works.
I read the first 4 chapters of this one. Although I like the shear dept of it, it really is not quite where I need to focus at the moment. I need more "practical" to web stuff at this moment. I'll definitely keep this one around and work on it later though because I like the underbelly explanation of it all.

****

I had a few deep epiphanies about C#. When I think back on this week, I finally realize where I got things completely wrong.

C# is not Lisp:

I know this is totally LDO, but bear with me for a second. One of the fundamental philosophies of SICP was that "we have no clue what kind of languages we will be working on later, but we should be prepared to work on something in the future," and on its face, that is a totally agreeable statement.

What I was not prepared for was the massive dependencies of this language. In Lisp / Clojure -- and Python as well -- you have the ability to sort of ignore the details of "how" the functions and classes will be used. You can test these functions and classes and figure out how they will behave via an interpreter, adding things to the namespaces, and other short-cuts like that. In other words, incremental programming is not only possible, but actively encouraged.

C# is a pure engineering language. I thought it was kind of strange how much planning the boss did at the beginning, refusing to lay a single line of code until the plan was about 85% done on paper. I now understand where this attitude comes from. I've been burned a million times by slight changes in the code, because everything is strictly bound to the behaviors of each other. I've had 100+ LOC commented out for no other reason than to keep the compiler from crashing. I've learned that the planning is far more important than the execution in C#.

The "slight" changes in one part of the code always results in drastic changes in other parts of the code. Where functions and classes in Python / Lisp are generalized to take on anything, the functions and classes in C# are intimately tied with whatever is feeding it values. I've had prototype A turn to prototype B to nearly-finished C turn to utterly broken apart, rearranged, and completely different result D.

The surprising result of this is that, while changes in function in Python / Lisp are generally minor and more geared toward making it look more pretty, the changes in C# tend to be major rewrites, creating functions that are unrecognizable to their origins.

I'm not sure how crazy it is, but lest to say that having one version works like a charm has no bearing what-so-ever on a modified version working at all without major re-coding.

Copy / Paste is VERY VERY VERY bad:

I know, this goes without saying. I generally don't c/p, but the boss told me to do it on a few occasions and this quickly came back to bite me in the ass multiple times. The problem is that while I can't really expect to have much comprehension of what I am doing, the c/p that I did do had a quadratic affect on my not understanding of the code I was writing. I found myself asking "why doesn't this work" on many occasions, and I'm pretty sure that I would have done a bit better if I even used <tab> coding instead. I quit doing any c/p after a day of it, thinking it wouldn't bit bite me in a major way, but it was already too late at that point.

If you never coded in C#, hope for luck on the first week:

This goes back to the first point about engineering. The problem here is that since I really didn't know what I was engineering for, there were plenty of small mistakes that built up to major quagmires and issues along the way. While I could ask the boss for information, he really doesn't want to spoon-feed me, nor do I want to be spoon-fed. Surely is a slow way to learn, but when I think back on the 3 days I've been working on one silly page (that changed 8 times?), I would have had to break every theorem of statistics to end up in a semi-bug-free area.

Oddly, I still feel like a sucker and a moron for not completing as much as I would have liked, but this language can knock you around when you are blind.

No one knows how to program in C#:

This is probably the most shocking part of the language. It is far too easy to search for some hint about a bug I ran into. It goes without saying that 99% of the "solutions" were monkey-patches, which of course is going to collapse the system really hard. Hell, it was even obvious to me.

The problem is that there is never less than 6 different ways to do things, and a lot of the information tends to be blatantly wrong. On several occasions, I've seen nested foreach loops, 5-deep if statements, and 50+ LOC solutions for code-pieces that really required one line of code. It's truly amazing how, for a language that virtually writes itself, that there is such a wide range of confusion on how it should be written. As I go through and eventually figure out the bugs and the correct way to write said object / function / property myself, I realize how incredibly important the base engineering of this is. I can practically call out what function is missing or what mistake the person made and then wonder if they eventually figured out the real issue, or just continued down the road of patches.

I've discovered that stepping through and working through it myself is more helpful than searching online for answers. Hints for actual code are okay yet slippery as hell. Searching for solutions to bugs... dangerous.

I've said about all I can about VS, but the only thing I'd like to add is that I am quite shocked that there is no way to do vertical-split screens on the same file. The formatting of C# is so "tall" that it makes zero sense to only offer horizontal-split screens.

Hopefully the above doesn't sound like I am bashing into C#. Clojure was pretty rough-going during the first week as well, so I figure that this is all going to be worth the effort. Still totally smitten and happy to be working on a project.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2013 , 05:24 AM
Quote:
Originally Posted by daveT
No one knows how to program in C#:

This is probably the most shocking part of the language. It is far too easy to search for some hint about a bug I ran into. It goes without saying that 99% of the "solutions" were monkey-patches, which of course is going to collapse the system really hard. Hell, it was even obvious to me.

The problem is that there is never less than 6 different ways to do things, and a lot of the information tends to be blatantly wrong. On several occasions, I've seen nested foreach loops, 5-deep if statements, and 50+ LOC solutions for code-pieces that really required one line of code. It's truly amazing how, for a language that virtually writes itself, that there is such a wide range of confusion on how it should be written. As I go through and eventually figure out the bugs and the correct way to write said object / function / property myself, I realize how incredibly important the base engineering of this is. I can practically call out what function is missing or what mistake the person made and then wonder if they eventually figured out the real issue, or just continued down the road of patches.

I've discovered that stepping through and working through it myself is more helpful than searching online for answers. Hints for actual code are okay yet slippery as hell. Searching for solutions to bugs... dangerous.
Wanted to point out one thing that was extreme with this. I had one error that was something like "authority = "false." Go to SO and see a bunch of advice that was locally turn authority to true or even go the the deep back-end and turn authority to true, which of course over-rides the built-in security of .Net. It was actually getting quite common to see this advice on SO, and there was some people commenting on how often said advice showed up on the site and how it couldn't possibly be correct or smart to do.

The biggest lesson:

If it's not super-obvious I have the correct answer, then I obviously have the wrong answer. I mean, this seriously is the biggest thing to work towards in C#. The correct answer always adheres to Occam's Razor and is so obviously correct, I want to slap my forehead for not seeing it. I can't think of how many times this happened, but without a doubt, if I don't shake my head at my own ignorance, I am surely going to run into bugs. There really is no such thing as "good enough."
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2013 , 09:53 AM
hey, quick c++ question about operating overload.

if we have like;

BaseClass c = c * 2
and
BaseClass c *= 2

so if we operate overload '*' e.g. BaseClass operator *(blah blah) {}
would this work on the 'BaseClass c *= 2' example or would we need to define ' BaseClass operator*=(blah blah)' aswell

So are they essentially the same thing or need two serpate ones?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2013 , 12:10 PM
Quote:
Originally Posted by Burnss
hey, quick c++ question about operating overload.

if we have like;

BaseClass c = c * 2
and
BaseClass c *= 2

so if we operate overload '*' e.g. BaseClass operator *(blah blah) {}
would this work on the 'BaseClass c *= 2' example or would we need to define ' BaseClass operator*=(blah blah)' aswell

So are they essentially the same thing or need two serpate ones?
The standard method is to overload *= and use that to implement operator*.

But I don't think that implementing * gives you *= for free (you would need to reference the c++ standard to be sure). For one thing, *= requires operator= and you probably don't want the default implementation of = if you are overloading *=.

Just overload the non-trival operators instead of depending on default implementation.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2013 , 04:18 PM
@daveT sounds to me like your issue is with working with a legacy codebase. Correct me if I'm wrong, but you've primarily worked on solo projects before, right?

Perhaps it is more difficult to write beautiful loosely coupled code in C# than in Lisp or Python, but it seems to me that it should still be possible.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2013 , 04:54 PM
Quote:
Originally Posted by ballin4life
@daveT sounds to me like your issue is with working with a legacy codebase. Correct me if I'm wrong, but you've primarily worked on solo projects before, right?

Perhaps it is more difficult to write beautiful loosely coupled code in C# than in Lisp or Python, but it seems to me that it should still be possible.
This. Almost nothing he's said has much to do with C# the language.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2013 , 04:57 PM
Quote:
Originally Posted by ballin4life
For something weird like that I hope I can be excused for not being able to figure it out just from application knowledge
Definitely not, it just helps to know how things are structured. For instance, if you knew tests are run in separate, isolated application instances, you can rule out things that you wouldn't be able to rule out if tests are run within a single application (or container or runtime or whatever is applicable here) instance.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2013 , 05:11 PM
Quote:
Originally Posted by ballin4life
@daveT sounds to me like your issue is with working with a legacy codebase. Correct me if I'm wrong, but you've primarily worked on solo projects before, right?

Perhaps it is more difficult to write beautiful loosely coupled code in C# than in Lisp or Python, but it seems to me that it should still be possible.
I don't think C# is any harder in that respect. I think Dave's stating that the class definitions are incomplete and that lessons are better learned for him in resolving issues on his own.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2013 , 05:24 PM
Quote:
Originally Posted by ballin4life
@daveT sounds to me like your issue is with working with a legacy codebase. Correct me if I'm wrong, but you've primarily worked on solo projects before, right?

Perhaps it is more difficult to write beautiful loosely coupled code in C# than in Lisp or Python, but it seems to me that it should still be possible.
Well, this code base is brand-spanking new, though I'm obviously not writing the entire site myself.

I think you hit the nail on the head with C#: the reason so much confusing code is in the wild is because it is -- at least at my current level of understanding -- very difficult to write loosely-coupled and independent functions, thus it is very difficult to isolate where the problem is because to even get something moving, you have to do waterfall programming (I hope this isn't totally true, but that is where I am currently).

This is how I worked out some of the problems this week, which I'm pretty sure is logical. The goal was to take user-input via a repeater and enter it into a database. I know, at least conceptually, how to do this. Not a problem. The second goal was to only pull up information relevant to what button the user clicked and have it show on the same page. Not difficult either.

So, first thing is to be sure that I can get myself talking to the db and updating the information. So, I built a html basic web form and then I built the function that took the information and pushed the information into the database. So far, so good, and I thought this was a decent strategy to get some basics out of the way and not cause total mental overload.

Next step, figure out how to push args into a db query. Not difficult either.

Next step, do some redesign and figure out how to make the clicking interactive to display the appropriate information. This was a bit of work, but I got it all done within a day, though I was already seeing some hints of major code-moving and rewriting, it didn't really occur to me what was being hinted at.

Great, now I have a form-list, I'm talking to the database, and this is where everything started falling to pieces. As you are probably aware, C# is a statically typed language. This has some obvious implications like local type-coercion, which are easy enough to handle. The part that was extremely hard to track and was the ultimate lesson of the week, is that what kind of code is calling the function matters as well.

So, I had this html stuff that was generated by a repeater but it wouldn't talk to the function until I changed the type of the html to asp-forms. So, basically, I figure that the function that I have should probably work, but now I have to track all the changes in the html, and then after changing everything over, I have another issue and I have little idea where to look for the next problem and it turned out that I had to drastically change the type-casting and variables inside of the function, so I am changing args, changing the parts of the program that calls the function, and I am drastically changing the inner guts of the function and of course, there is going to be a bug somewhere! So, comment out a bit, rewrite here, change local variables to constants, and on and on it goes.

So, basically, I never did waterfall programming and I've never had to face situations where I had to write, idk, 50 LOC before testing any of it. This is where the whole confusion and outlandish code all comes from on the internet: in order to write C#, you really have to be able to write C# and understand the mechanics before embarking on creating anything, but you can't really learn C# until you embark on something and really screw up over and over again, then recur.

The natural reaction is, instead of stopping and looking at *all* of the code you've written up to that point to find that one thing you forgot, you just glom on some patches and continue on, which of course creates those bad security practices, 100 LOC class-objects, deeply nested if-blocks and many other oddities. I've been highly cognizant of not glomming code (nor would the boss allow it), but I definitely see where it all comes from.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2013 , 05:31 PM
Quote:
Originally Posted by adios
I don't think C# is any harder in that respect. I think Dave's stating that the class definitions are incomplete and that lessons are better learned for him in resolving issues on his own.
Yeah, this is definitely part of it. I think that the part that has to be learned the hard way is learning how to plan the program before embarking on it. This is a very new perspective for me. There is a ton of interesting nuances to learn about, and it really isn't something you pick up from reading a few tutorials.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2013 , 10:31 PM
Almost done with a php/mysql class, and have a random question.
All my sites, in the address bar, show an ending of either .html or (more often) .php.
On 2+2 however, there is http://forumserver.twoplustwo.com/191/programming/ &etc which have no .ext at all. How / why is this? Is it possible to do something like <?php thisPage->HideExtention(); ?> ?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2013 , 11:13 PM
Google Docs (and maybe Excel?) Question - I have a column "A" that contains a bunch of values. In column B I have a formula that performs a calculation on the value next to it and spits out a derived value that has conditional formatting to make it easy to interpret the value in A.

My problem is that I'm moving values in A around a lot and I want the formula in B to always refer to the A cell right next to it. But if I cut and paste a value from A to somewhere else the formula in B is automatically updated to point to the new location of the value from A that was cut and pasted.

While writing this I just realized that I could probably dynamically create the A column cell so that it isn't updated when that cell is updated. Seems a bit hackish but I think it'll work. Anyone have a better/easier idea?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2013 , 11:19 PM
Quote:
Originally Posted by jjshabado
Google Docs (and maybe Excel?) Question - I have a column "A" that contains a bunch of values. In column B I have a formula that performs a calculation on the value next to it and spits out a derived value that has conditional formatting to make it easy to interpret the value in A.

My problem is that I'm moving values in A around a lot and I want the formula in B to always refer to the A cell right next to it. But if I cut and paste a value from A to somewhere else the formula in B is automatically updated to point to the new location of the value from A that was cut and pasted.

While writing this I just realized that I could probably dynamically create the A column cell so that it isn't updated when that cell is updated. Seems a bit hackish but I think it'll work. Anyone have a better/easier idea?
Try something like =indirect("A" & row(Cn))
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-26-2013 , 12:32 AM
Php question ...
Can I make a variable read-only / const everywhere except for within the script i define it in. Or within the php tags its defined in (but it can still be modified within those php tags where it was defined. I would bet its 1:50 that this functionality is supported but I had to ask b/c if it is my final project will go much easier.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-26-2013 , 07:26 AM
Quote:
Originally Posted by candybar
Try something like =indirect("A" & row(Cn))
Nice, that works. Thanks.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-26-2013 , 08:02 AM
extension hiding is done with .htaccess I believe
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-26-2013 , 08:55 AM
The 2p2 URLs are rewritten using .htaccess. Without it they'd look something like index.php?fid=191&sfid=programming.

You can accomplish something similar with a simple site by organizing your files in folders and using the default file name (usually index.php). An example would be to change about.php to /about/index.php and link to /about/ in your menus.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m