Open Side Menu Go to the Top

07-26-2013 , 06:23 PM
nchabazam,
Why would your site require a million media queries but is somehow easier to manage resizing in JS?

More often than not you only need a few break points and your site will be fine at any resolution.

I tend to let my content do the talking when it comes to break points. Rather than make media queries for a bunch of predefined screen sizes I'll just resize my browser and when something looks broken then I make the adjustment at that specific pixel + a bit extra.

2-3 break points is usually enough for most fluid layouts.
** 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 **
07-26-2013 , 06:29 PM
Quote:
Originally Posted by Shoe Lace
nchabazam,
Why would your site require a million media queries but is somehow easier to manage resizing in JS?

More often than not you only need a few break points and your site will be fine at any resolution.

I tend to let my content do the talking when it comes to break points. Rather than make media queries for a bunch of predefined screen sizes I'll just resize my browser and when something looks broken then I make the adjustment at that specific pixel + a bit extra.

2-3 break points is usually enough for most layouts.
Well I'm no css expert, so there may be a way to handle this.

Static left sidebar, static right sidebar. (say 200px each)

In the middle I have divs floated left which I want to take up 100% the center container. I want these to be between 280px roughly 400px max (depends on number of columns obviously), breaking down into an additional column of boxes at smaller/larger container widths.

So basically when the main container is 300 to 600px, 1 box. 600 - 800, 2 boxes, etc... growing to as large as people want.

I'm also going full dumbass on the faux columns or whatever to make the height of all 3 containers the same (mainly I'm too lazy to fully read through a blog post)... so I'm going to use JS for this as well.

On the plus side, I learned a lot about angular today converting all my jQuery out into directives (and removing jQuery where possible), and cleaning up some of my controllers from view logic.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-26-2013 , 06:34 PM
Quote:
Originally Posted by Xhad
My current hypothesis is that it's so ingrained because an English speaker or mathematician would never put the predicate first. Either way, the barrier is surely social and not technical, right? or are there cases where the practice might backfire?
I wouldn't think so, actually I remember this being mentioned back when I was in school so the idea has been around for a while.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-26-2013 , 06:35 PM
Quote:
Originally Posted by Nchabazam
Well I'm no css expert, so there may be a way to handle this.

Static left sidebar, static right sidebar. (say 200px each)

In the middle I have divs floated left which I want to take up 100% the center container. I want these to be between 280px roughly 400px max (depends on number of columns obviously), breaking down into an additional column of boxes at smaller/larger container widths.

So basically when the main container is 300 to 600px, 1 box. 600 - 800, 2 boxes, etc... growing to as large as people want.

I'm also going full dumbass on the faux columns or whatever to make the height of all 3 containers the same (mainly I'm too lazy to fully read through a blog post)... so I'm going to use JS for this as well.

On the plus side, I learned a lot about angular today converting all my jQuery out into directives (and removing jQuery where possible), and cleaning up some of my controllers from view logic.
Eh, I guess something like a min-width/max-width width=xxx% on media queries would work too.

I prefer not to think about problems.

or not: I have no idea, I would prefer to finish writing significant css asap.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-26-2013 , 06:53 PM
Quote:
Originally Posted by Nchabazam
Did you end up doing more of the ramp up program, or did you bail? Are they using some sort of framework?

My first offer was from an awesome company with some really smart guys, but they were pretty new to web dev and were using php without a framework. Still not sure if that was a good decision... would have learned a ton about algorithms/big data, and they were a lot of fun.

I wish you the best of luck.
Thanks man. I stuck with rampup for a while, but it's basically just a place I could go to work on a project and ask someone for help if I got stuck. The program lacks structure and guidance. I realize the premise of the program is that you must be self motivated, but a lot of people give up because they aren't being taught. They need to take a more active approach to teaching the concepts.

I have no idea if they use a PHP framework. It's a very large company and they have over 200 developers. I have wanted to work at a startup but I think I have a ton I can learn at a large company before I try a startup.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-26-2013 , 10:10 PM
xhad,

i know one guy who likes the 5 == x form for the reasons you listed, but basically everyone else i know hates it. the common derisive term is "yoda programming".

i'd say the objections i've heard are all based on readability. i agree that "if five equals x" feels a bit unnatural, but with some exposure it probably wouldn't. i agree that this seems a small price to pay for the additional safety.

that said, most modern compilers will notice when you do this and warn you, so i guess the world has moved on and we don't really have to care about this problem anymore:

Code:
>>> x = 1

>>> if 1 == x:
...   print "hi xhad"
...
hi xhad

>>> if 1 = x:
  File "<stdin>", line 1
    if 1 = x:
         ^
SyntaxError: invalid syntax
i've heard other objections, like something about how it buries the pertinent value (the constant) in the noise of the leftmost columns on the screen. i may not be rendering this right, but when i heard it i thought it was absurd and immediately downgraded my opinion of the opiner.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-26-2013 , 10:21 PM
Those 3 characters are dog characters though
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-26-2013 , 10:24 PM
so we are letting the arbitrary fact that assignment and equality operators happen to look the same in our language dictate the way we use a common operator, and dictate it in an intuitive and unreadable way? The medicine here is worse than the disease. But neither is as bad as the mental attitude in which one no longer looks for real solutions to problems, but instead solves them with one-off arbitrary hacks and feels satisfied about it. This should not seem like a reasonable thing to do. It should seem insane. You should be stopping yourself and saying, "wtf?? i am writing things backwards now because i might make some silly typo because my language happens to have this arbitrary symbolic pitfall?"

Just write tests for your code. Or write a script which greps for assignment expressions inside ifs. Do anything at all besides allow yourself to be bullied by your language.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-26-2013 , 11:05 PM
Quote:
Originally Posted by Xhad
General question about C-likes: Everyone knows about this famous bug:

Code:
if (x = 5)
{
    launch_nuclear_missles();
}
I recently read something where someone advocated using this construct instead:

Code:
if (5 == x)
{
    launch_nuclear_missles();
}
The idea being that "5 = x" is a syntax error, so forgetting an = errors out instead of silently doing the wrong thing. The question: Is there a reason not to do this? Why don't more people do it?
Modern static code checkers or compiler warnings should catch this, although this can be annoying if someone is using the assignment intentionally.

Quote:
Originally Posted by tyler_cracker
xhad,

i know one guy who likes the 5 == x form for the reasons you listed, but basically everyone else i know hates it. the common derisive term is "yoda programming".

i'd say the objections i've heard are all based on readability. i agree that "if five equals x" feels a bit unnatural, but with some exposure it probably wouldn't. i agree that this seems a small price to pay for the additional safety.

that said, most modern compilers will notice when you do this and warn you, so i guess the world has moved on and we don't really have to care about this problem anymore:

Code:
>>> x = 1

>>> if 1 == x:
...   print "hi xhad"
...
hi xhad

>>> if 1 = x:
  File "<stdin>", line 1
    if 1 = x:
         ^
SyntaxError: invalid syntax
i've heard other objections, like something about how it buries the pertinent value (the constant) in the noise of the leftmost columns on the screen. i may not be rendering this right, but when i heard it i thought it was absurd and immediately downgraded my opinion of the opiner.
I don't think Python is applicable since if x=1: is a syntax error always.

Quote:
Originally Posted by gaming_mouse
so we are letting the arbitrary fact that assignment and equality operators happen to look the same in our language dictate the way we use a common operator, and dictate it in an intuitive and unreadable way? The medicine here is worse than the disease. But neither is as bad as the mental attitude in which one no longer looks for real solutions to problems, but instead solves them with one-off arbitrary hacks and feels satisfied about it. This should not seem like a reasonable thing to do. It should seem insane. You should be stopping yourself and saying, "wtf?? i am writing things backwards now because i might make some silly typo because my language happens to have this arbitrary symbolic pitfall?"

Just write tests for your code. Or write a script which greps for assignment expressions inside ifs. Do anything at all besides allow yourself to be bullied by your language.
It's not like the "if 5 == x" form is THAT unreadable! In school they didn't give us static code checkers or compilers with good warnings so this style certainly would have helped a lot.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-26-2013 , 11:09 PM
g_m,

i think python's solution is pretty good. allowing assignment to have a return value is ****ing stupid.

and obv the best answer is this:

Quote:
Just write tests for your code.

all,

** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-26-2013 , 11:10 PM
Quote:
Originally Posted by gaming_mouse
so we are letting the arbitrary fact that assignment and equality operators happen to look the same in our language dictate the way we use a common operator, and dictate it in an intuitive and unreadable way? The medicine here is worse than the disease. But neither is as bad as the mental attitude in which one no longer looks for real solutions to problems, but instead solves them with one-off arbitrary hacks and feels satisfied about it. This should not seem like a reasonable thing to do. It should seem insane. You should be stopping yourself and saying, "wtf?? i am writing things backwards now because i might make some silly typo because my language happens to have this arbitrary symbolic pitfall?"

Just write tests for your code. Or write a script which greps for assignment expressions inside ifs. Do anything at all besides allow yourself to be bullied by your language.
This makes me feel good because it's pretty close to what I was thinking. It may be "better" technically, but it's Not English, so hardly anyone is ok with writing it.

I recently realized that a similar principle is why switch(true) annoyed me as much as I did when I saw it. I don't like code that doesn't say what it means. I'm actually writing a big rant about it that just hit 3000 words. A sample:

Quote:
I'd argue that there are at least four or five things wrong with this code, but the one that made me flip out enough to go yell at the author in his forums about it is switch(true). At the time I couldn't fully articulate why I had such a problem with it (though I ran it by some working programmers to make sure there wasn't something huge I was missing). Now, however, I realize that the problem is that it's the kind of thing you can only write if you're looking at behavior and ignoring semantics. You may know what this code does, but what does it say? It says nothing. The point of switch(x) is to say "here's what happens depending on the value of x", and nothing can depend on the value of true because true only has one value. Nonsense that happens to do what it's intended to do is still nonsense.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-26-2013 , 11:26 PM
Quote:
Originally Posted by ballin4life
It's not like the "if 5 == x" form is THAT unreadable! In school they didn't give us static code checkers or compilers with good warnings so this style certainly would have helped a lot.
I don't care if it's only 1% more unreadable. If it's not what you'd naturally do, then doing it for this arbitrary reason is just a fundamentally wrong way to be conducting yourself. As Ignatius says: it reflects "a person’s lack of theology and geometry; it could even cast doubts upon one’s soul."

Quote:
Originally Posted by tyler_cracker
g_m,

i think python's solution is pretty good. allowing assignment to have a return value is ****ing stupid.

and obv the best answer is this: tests
tyler, i agree fixing the root of the problem (the language) is the best thing, and barring that the tests that you should be writing anyway are a good fix as well.

xhad, "switch (true)" is pretty hideous and you're right to hate it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-26-2013 , 11:56 PM
Quote:
Originally Posted by Xhad
This makes me feel good because it's pretty close to what I was thinking. It may be "better" technically, but it's Not English, so hardly anyone is ok with writing it.

I recently realized that a similar principle is why switch(true) annoyed me as much as I did when I saw it. I don't like code that doesn't say what it means. I'm actually writing a big rant about it that just hit 3000 words. A sample:
Are you still messing around with Code Academy?

It's been months since you first saw that PHP code. You really get emotional about stuff.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-27-2013 , 12:18 AM
Quote:
Originally Posted by daveT
Are you still messing around with Code Academy?
No. I've actually started writing down my opinions of MOOCs and other online education stuff, which is going to include a couple pieces on Codecademy (one on Codecademy itself, and this general rant about bad tutorial practices that I've mostly seen on Codecademy but that pop up elsewhere.

Quote:
It's been months since you first saw that PHP code. You really get emotional about stuff.
Nah, I just have a long memory. I also make fun of this one. I'm still working on the setup but I like the conclusion:

Quote:
By even showing them the second one, let alone presenting it as *superior*, you send the message that programming is Crazy Nonsense and that the best they can hope for is accidentally getting it right once in awhile. Is it really any wonder that people who learn to program by invoking JavaScript's scoping rules on purpose have to be explicitly taught that programs can be logical?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-27-2013 , 12:26 AM
Oh yeah, I remember you were doing that. I wonder what you think of this Matrix class. It's slightly above mediocre on my opinion, but I'm getting some value out of it. Too bad they punk out on Coursera and refuse to do 12 weeks like that class really needs. Linear Algebra w/o Eigenvalues? Are they nuts?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-27-2013 , 12:32 AM
I'm going to have to write that one well after the fact because I'm "staff". Right now I associate last week with a crazy bug I found in beta that involved somehow causing an infinite loop by multiplying two objects.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-27-2013 , 12:36 AM
This isn't supposed to be a TDD class. There we go with that myth about profs not knowing how to program.

Saw that article on BigO HN today. I'm really sad that a self-taught programmer created an article like that. It makes me look bad by by proxy, I fear, and it is also going to be a go to for many misguided students. Just suck it up, learn a bit of calculus, and buy an algo book, man.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-27-2013 , 12:40 AM
You know, it's funny. The brilliant.org competition already taught me way more about git and github than I would have ever expected, and the most valuable thing I've learned from Coding the Matrix is that I HATE doctests.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-27-2013 , 12:44 AM
Quote:
Originally Posted by Larry Legend


kinda long but early to scroll through
Yeah, I spent quite a bit of time looking at these review videos since I could only afford to get one. I would gladly buy both Blue and Brown for a side-by-side.

If the Brown is quieter than the Blue, then this video, and no other video, really does the noise level justice. As I said earlier, the Browns are actually pretty quiet as long as you don't bottom out, but it is hard to get used to not bottoming out, though I've gotten used to it now.

There is a few tricks to the keyboard that makes typing and moving about faster, but they are pretty hard to get right for me so far.

Anyways, I would say that if you are considering it, totally go for it. They take refunds, no questions asked, so there isn't much to lose, but these things are addicting.

I'll say this much: be sure that you buy a key puller and some oil though. Apparently all mechanical keyboards have a tendency to squeak.

And also, http://www.pckeyboard.com/ apparently bought the patents for the IBM Model M. It is a bit cheaper and I wonder if it wouldn't be better.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-27-2013 , 12:45 AM
Quote:
Originally Posted by Xhad
You know, it's funny. The brilliant.org competition already taught me way more about git and github than I would have ever expected, and the most valuable thing I've learned from Coding the Matrix is that I HATE doctests.
Those are pretty awful. The grader shows no indication that you passed, so you have to scroll up and see if there is... nothing? I mean, come on, couldn't they put "pass" there or something?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-27-2013 , 12:54 AM
Quote:
Originally Posted by gaming_mouse
I don't care if it's only 1% more unreadable. If it's not what you'd naturally do, then doing it for this arbitrary reason is just a fundamentally wrong way to be conducting yourself. As Ignatius says: it reflects "a person’s lack of theology and geometry; it could even cast doubts upon one’s soul."
sick reference

that book is hliarious, i've read it 3 times, need to read it again
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-27-2013 , 12:57 AM
Quote:
Originally Posted by daveT
And also, http://www.pckeyboard.com/ apparently bought the patents for the IBM Model M. It is a bit cheaper and I wonder if it wouldn't be better.
i used to buy up all the IBM Model M's off ebay until there were no more.

i've purchased from pckeyboard and they are solid although not the prettiest..
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-27-2013 , 12:59 AM
Quote:
Originally Posted by daveT
Those are pretty awful. The grader shows no indication that you passed, so you have to scroll up and see if there is... nothing? I mean, come on, couldn't they put "pass" there or something?
Maybe I'm addled because I've crashed it so many times, but I thought the actual grader says "Correct!" if you pass a section

what drives me nuts is that doctest looks for the precise string of your output and nothing else. So i.e.

Code:
Expected: set(range(10))
Got: {0,1,2,3,4,5,6,7,8,9}
is a realistic result. I've literally caused failing tests to pass by deleting whitespace from comments. So tilting.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-27-2013 , 01:26 AM
Quote:
Originally Posted by Xhad
I've literally caused failing tests to pass by deleting whitespace from comments. So tilting.
FYP: don't do that, man.

Didn't they admit that they tried to think of as many possible "correct" code answers as they could but missed some?

3 * 3 is no good because they didn't think of it?

It is sort of surprising that they are reading commented code. I mean, if you are so good that you can add in faked code in the comments, you deserve a trophy.

Oh man, that reminds me of .Net. .Net actually reads commented code and throws errors because of it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-27-2013 , 05:28 AM
Quote:
Originally Posted by splashpot
Brag: Just got my first entry level web dev job offer after about 1-1.5 years of self teaching.
Cool. Have fun.

Quote:
My current hypothesis is that it's so ingrained because an English speaker or mathematician would never put the predicate first.
A mathematician probably wouldn't write" X = X + 7;" either :P

Quote:
I wouldn't think so, actually I remember this being mentioned back when I was in school so the idea has been around for a while.
Yeah I know a couple of guys that write their code that way and it gets mentioned in most C classes etc.
Should be a compiler warning anyways (CHECK THE WARNINGS FOLKS)

Found this in a HN comment, fun stuff

Last edited by clowntable; 07-27-2013 at 05:46 AM.
** 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