Open Side Menu Go to the Top

09-10-2014 , 03:51 PM
I don't think there's anything wrong with defining a value that is the "max allowable score" that the program handles, initializing your value to MAX_SCORE+1, and then checking to see if the new score is lower than the current low.

It's fairly standard to define the allowable ranges for some data in a program, and in fact it's good practice to do so explicitly and then test that the program works properly with all the allowed values and generates errors in some sane way when the input is outside the allowed range. The sort of bugs that occur when you don't think about input validation are very common.
** 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 **
09-10-2014 , 04:05 PM
for this program, we were supposed to make it, i believe the word is, scalable? Such as, you can score 2 people playing a full course, or 500 people playing 5 full courses each.
In other words, we were specifically not supposed to have an upper limit.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-10-2014 , 04:15 PM
C++ has named values for the largest int, long, etc. There was a largest score you could handle, nothing wrong with initializing to that.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-10-2014 , 05:19 PM
Quote:
Originally Posted by Chips Ahoy
C++ has named values for the largest int, long, etc. There was a largest score you could handle, nothing wrong with initializing to that.
64 bit ints, unsigned 32 bit ints, floats and doubles could be used. I could have misread his post but basically he did a bubble sort which is an N squared algorithm. An N log N sort would get mucho brownie points.

Different Sorting Algorithms
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-10-2014 , 05:32 PM
@ chips

I suppose you're right, didn't even think about as I ran into the int max the other day on accident.

@ adios

I think you're giving me way too much credit. It wasn't anything fancy or even sorting really. More of a "if you're not first, you're last," type situation. Display the winner, ignore any non-winner.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-10-2014 , 05:46 PM
"The last shall be first and the first shall be last" -- Jesus' Programming Instructor
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-10-2014 , 06:05 PM
Quote:
Originally Posted by well named
"The last shall be first and the first shall be last" -- Jesus' Programming Instructor
(INT_MIN-- && INT_MAX++)

The wrap around seems like a hardware thing, not a language thing, but I am not a language lawyer.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-10-2014 , 06:30 PM
Quote:
Originally Posted by adios
64 bit ints, unsigned 32 bit ints, floats and doubles could be used. I could have misread his post but basically he did a bubble sort which is an N squared algorithm. An N log N sort would get mucho brownie points.

Different Sorting Algorithms
No need to sort and/or to initialize - although I have no qualms using max (unsigned) int/long/whatever as starting point.

Only the best score is wanted.
Initialize best score as first player's score, loop over rest, replace best score if looped player's score is better. Sounds to me as the most straight-forward approach.
Complexity O(N) still beats O(N log N).

Nothing wrong with showcasing a good sorting algorithm or using a fitting data structure (e.g. pump scores into priority queue*, pop for result), though, if the grader is going to look at the code. YAGNI might apply here.

However, I prefer to know how both the unsorted data is typically shaped and the sorted data is queried before I decide on what sort/data structure I'm going to use.

* side note: building a heap (or priority queue) can be reduced to O(N), too. Still beating O(N log N) but accessing the losing player's score (e.g. gets a pity price) is obv very expensive.

Last edited by kazana; 09-10-2014 at 06:58 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-10-2014 , 10:44 PM
This is what the OS looks like before shrinking the C:\ volume. After shrinking, Gparted was throwing an error and didn't want to do anything else.

** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-10-2014 , 10:50 PM
Yeah you're running in to the "maximum 4 primary partitions total" feature. All you can do is shrink "Lenovo D:", and add another logical partition inside the extended. Which likely will not be sufficient.

A super-advanced partition tool may be able to:
- shrink C
- embiggen the extended partition from the wrong end, to take up the new space
- insert a new logical partition to the extended partition in the wrong order

but I wouldn't bet on it.

If you can live without D:, I'd replace that with a linux - it can have /boot inside a logical partition just fine. Or maybe nuke "OEM Partition" if you're certain you don't need whatever it offers and that 15GB would be sufficient.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-10-2014 , 11:07 PM
I'm not really sure if that will be large enough. It could be large enough, but I'd hate to think that the D or OEM drive holds something important. I really don't know what is in there, and I don't feel like finding out the easy way or the hard way. I wonder if it is possible to merge those partitions...

It might be time to buy myself a little present. I still love this computer after 3 years of using it though.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-10-2014 , 11:52 PM
OEM drive probably is a restore drive of some capacity. Drivers, maybe programs.

There's a lot of sites devoted to helping you dual boot. When building my PC I came across one that talked about the 4 partition issue and errors windows can throw when you're half done.

Wish I still had it in recent memory, but it was one of the first ones when you search for windows 7 ubuntu dual boot
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-11-2014 , 12:09 AM
I don't see anything wrong with taking the first score as the candidate and comparing the rest of the scores to the candidate and swapping the candidate for any score that is lower. I guess you could also convert the scores to a set and do the same algorithm, or sort low->high and pop the first item, but I don't really see why you'd want to do all of that.

I'm thinking that any sorting algorithm will have a larger O than any direct comparisons.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-11-2014 , 01:38 AM
I think at least the responses here answer my main concern that I missed something that should have been an obvious solution to a fairly straightforward problem.

I keep having that issue lately, trying to over-complicate things when the easiest solution should be obvious. Just making sure I wasn't doing it again.

Embarrassing example from discrete math the other day: we were trying to come up with closed form formulas for sets of numbers. The whole class, myself included, divined some lengthy solution to what should have been n^2. So focused on "figuring it out" that we all missed the easily recognizable pattern of 1, 4, 9, 16, 25, etc.

Felt like such a putz.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-11-2014 , 02:28 AM
Meh, I hated those figure-out-the-sequence types of discrete math problems. For me they were "either you spot it, or you don't."

I haven't figured out a methodical way of deciphering those. Haven't been taught methods, either. Well, possible that I haven't been paying attention when they did.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-11-2014 , 11:23 AM
I think I remember being taught to divide one number in the sequence by another to get the ratio and then do something funky with that. it's been a little while though.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-12-2014 , 11:55 PM
Quote:
Originally Posted by CallMeIshmael
Im looking to improve my ability to interact programatically with websites. Beyond just downloading the code, Id more like to be able to do things like login, click buttons, etc. I use Html Agility Pack in .net to download things now, but this seems like its not going to get the job done for interactivity. I have some PhantomJS experience, but it seems cumbersome, though that is probably my total lack of web dev knowledge.

Right now, I think Im looking at splinter: http://splinter.cobrateam.info/. Has anyone used it? Thoughts?

Also, I think the biggest hurdle is going to be my lack of understanding of web tech. Is there a resource anyone recommends for learning how to read the code of a website with the goal of interacting with it, without caring about actually developing?
I've not used splinter but I played around with Selenium a while back.
It seemed pretty easy to pick up for what I wanted to do. There are a lot of tutorials on the webs for Selenium too.
There are modules for it in ruby or python as well.
HTH.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-13-2014 , 12:02 AM
Quote:
Originally Posted by Anais
Turned in a project today for c++ that was basically a comparison of golf scores followed by announcing the best, or lowest, score. My program worked, but I feel like I didn't have the most elegant solution for figuring out who was best.

I did the whole program basically discarding anyone with higher scores, so only the lowest score was kept track of. To start, I initialized a variable for the low score to 0, then did an if, else to have player 1 always put as the best score, followed by any subsequent player' scores compared against player 1.

I would have preferred to do this all in one bit of code, and I could easily do it if we were comparing high scores. (high = 0, if score > high, high = score) But I couldn't for the life of me figure out a way to do it for scores where lowest is best. (Other than maybe initialize the best score to some absurdly high number, but again, that doesn't seem all that elegant)

I'm sure I'll probably get full credit since it works the way it's supposed to, but it bugs me that I couldn't figure out a better solution, even with my prodigious google skills.
Did you account for ties in best score?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-13-2014 , 09:04 AM
Even if it's tied, there's only one best score. I assume that was the question.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-13-2014 , 04:18 PM
They didn't have us care about ties for some reason, woulda made it a lot more fun tho
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-13-2014 , 11:35 PM
Question for any web designers here: how much focus do you put on accessibility when designing a web page or web app? The HTML class I'm taking atm really puts a huge emphasis on it, and I understand why, but I'm curious how much actual employed folks in the industry do it.

By accessibility I mean alternate text, descriptive attributes in table tags, etc. Stuff for people with disabilities mainly.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-14-2014 , 01:40 AM
Not a web designer, but here is my take on it:

1- Table-based layouts are an absolute nightmare for accessibility.

2- There is no point of doing all of this unless you are using all the tools, like a screen-reader emulator, color-blind emulation tool, etc.

3- Don't design on an Apple computer. I have normal-ish sight, but I lean on Blacken and turn off all font styles because leaving on default colors and styles makes my browsing life miserable. Yes, I blame Retina displays on this. Apple isn't exactly popular or financially accessible to most people, so don't do your design in a self-serving world. I'm not blaming Apple on this; I'm blaming people who don't know any better. The point of design is to convey information. Responsible design is using empathy. Would a web designer build a billboard with 10pt font?

4- Teaching accessibility in the fashion you are learning it assumes companies are manually building static HTML sites. This isn't true these days. Most HTML is generated from code. When you have to make sure that the sales person can add a product page, you have to make code that generates code.

5- #4 is problematic because web designers don't understand how HTML is created on a non-dynamic website. This schism between designer and programmer is very large, and much larger when said designer doesn't know HTML or CSS. I've interviewed for a few jobs where a large part of the description is acting as liaison between designer and developer because they can't speak each others language. No, I wouldn't want a job like this, and no, I wouldn't want to work with a designer who can't do HTML. I could easily explain how what they are creating is generated from magic to someone who knows HTML, but not to someone who can only do PhotoShop.

7- The semantic web is a good idea is spirit, but poorly executed.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-14-2014 , 02:02 AM
We joke that instead of mobile-first responsive web, our designers do Thunderbolt-first.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-14-2014 , 12:40 PM
Quote:
Originally Posted by Anais
Question for any web designers here: how much focus do you put on accessibility when designing a web page or web app? The HTML class I'm taking atm really puts a huge emphasis on it, and I understand why, but I'm curious how much actual employed folks in the industry do it.
short answer: most businesses don't care about it.

it's slowly becoming more common and, as browsers and tools improve, easier to do, but it's still time-consuming and requires a lot of specific knowledge and skill to get right, especially when you are combining multiple browser support, accessibility, responsiveness, and semantic html.

it's a pet passion of many talented web designers, especially open source contributors, but the fact remains that for most business, from a pure numbers perspective (ie, the amount of extra business you'll get by making your site accessible), the costs and time involved far outweigh the benefits, and so they just don't care. a good analogy would be wheelchair ramps. few businesses would pay for their installation if it were not mandated by law.

there's also politics involved, especially for large companies who want to be seen as empathetic to those with disabilities, and most everyone pays lip service to accessibility for PC reasons, so both that and the academic point of view you're getting at school will obscure the realities of the way most businesses work.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-14-2014 , 03:48 PM
As I'm learning this stuff and realizing how a lot of the features I use on a regular basis are there for people with disabilities, and that there's even more that I never see or think about, I simultaneously know I should really focus on learning this stuff because it's the right thing to do, but at the same time I'm super lazy and hate putting in extra effort on stuff they has such a limited effect if any.

Certainly feeling conflicted.

I do wonder what if any laws the future will bring for website accessibility. Such as websites in the US having to be coded for accessibility the same way businesses have to have wheelchair ramps. (Which I do use for short runs, because **** stairs)
** 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