Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

12-11-2017 , 04:49 AM
Quote:
Originally Posted by ChrisV
Depends how you look at it I guess. Elseif is syntactic sugar for nested if blocks.
Quote:
Originally Posted by Craggoo
Not even remotely.
?! Of course it is.

Code:
if(x){a}
elseif(y){b}
elseif(z){c}
else{d}
is equivalent to:
Code:
if(x){a}
else{
   if(y){b}
   else{
      if(z){c}
      else{d}
   }
}
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 05:25 AM
Man SQL Server's designer tilts me sometimes. I wanted to change a column type from int to tinyint, all rows were null in that column. SQL Server refused to either do that or drop the column in the designer, because it claims those changes would result in the table having to be dropped and recreated. This was characterized as a "bug" by Microsoft back in SQL Server 2008 and still hasn't changed.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 06:47 AM
Quote:
Originally Posted by plexiq
?! Of course it is.

Code:
if(x){a}
elseif(y){b}
elseif(z){c}
else{d}
is equivalent to:
Code:
if(x){a}
else{
   if(y){b}
   else{
      if(z){c}
      else{d}
   }
}
Agree with ChtisV and plexiq

Larry's question and subsequent debate about readability are interesting.

Using C, pretty sure (did not test it with actual code) this is equivalent to what plexiq coded with the if else if statements.

Code:
(!x && !y) ? ( z ? c : d ) : ( x ? a : b );
Seems easier to read to me.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 07:24 AM
Would bet substantial money you are the only person ITT who considers that easier to read. Well, there might be one or two others I guess.

Note: not having a go at you here.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 08:10 AM
^ Agreed, if you want to go ternary then this structure seems much more intuitive:
Code:
x?a:(y?b:(z?c:d))
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 10:14 AM
insert yodawgIheardyouliketernariessoweputternariesinyour ternariessonowyoucanternarywhileyouternary.gif
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 01:35 PM
Eh I nest ternaries all the time and prettier unravels them ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 02:33 PM
Quote:
Originally Posted by ChrisV
Man SQL Server's designer tilts me sometimes. I wanted to change a column type from int to tinyint, all rows were null in that column. SQL Server refused to either do that or drop the column in the designer, because it claims those changes would result in the table having to be dropped and recreated. This was characterized as a "bug" by Microsoft back in SQL Server 2008 and still hasn't changed.
Why can't you slurp sql files into the command line, or even run raw SQL like normal database people?

****

IRT to ternary:

What do people who don't use ternary normally do (either by choice or by no language feature)? I've seen the fallout of that and it isn't pretty at all.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 04:36 PM
Quote:
Originally Posted by plexiq

Code:
if(x){a}
elseif(y){b}
elseif(z){c}
else{d}
is equivalent to:
Code:
if(x){a}
else{
   if(y){b}
   else{
      if(z){c}
      else{d}
   }
}
I'm not sure who's having a stroke here.

Code:
a ? a : 
b ? b : 
c ? c : d
Is equivalent to

Code:
if (a) {
    a
}
elseif (b) {
   b
}
elseif(c) {
    c
}
else {
    d
}
Code:
a ? ab ? ab : ac :
b ? b : 
c ? c : d
Is equivalent to:

Code:
if (a) {
    if (ab) {
        ab
    }
    else {
        ac
    }
}
elseif (b) {
   b
}
elseif(c) {
    c
}
else {
    d
}
I have coded quite a bit in ternaries (nested and non-nested). Two question marks in a row means nested if check. Two : in a row means exiting out of a nested block. Note, I am talking about JS. I know PHP's rules around ternaries aren't the same. I would need to surround any "nested" ternaries in () in order for them to be interpreted correctly. I'm guessing that is what's happening here.

Last edited by Craggoo; 12-11-2017 at 04:44 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 04:46 PM
Guy presenting to 10 people has an open tab googling for "depression". Yikes.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 04:48 PM
@Craggoo: Actually not sure what you are referring to, my post was regarding the "elseif is syntactic sugar for nested ifs" statement. I was merely showing that it's trivial to convert elseifs to nested ifs, so yes - they are indeed just syntactic sugar.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 04:51 PM
Quote:
Originally Posted by plexiq
@Craggoo: Actually not sure what you are referring to, my post was regarding the "elseif is syntactic sugar for nested ifs" statement. I was merely showing that it's trivial to convert elseifs to nested ifs, so yes - they are indeed just syntactic sugar.
I was stating what the equivalent if/elseif/else blocks would look like for a couple ternary expressions if you went that route instead. Maybe we're talking about different things.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 04:56 PM
Quote:
Originally Posted by Grue
Guy presenting to 10 people has an open tab googling for "depression". Yikes.
Yup, I always join video conferences from a new window just to avoid accidentally showing anything like that.

I even looked one time for a feature that was like incognito/private windows but not instead of not storing what you were doing, it would avoid using any personalization from your standard browsing (like url completion).
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 05:31 PM
When I've done that I've just used a different browser. So for me I have chrome all customized and then for anything like this I use Firefox.

Though one time in a screen share coding challenge I went to cut and paste some code and the cut didn't take or something and I accidentally pasted in the link to some porn site...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 06:27 PM
old roommate was sharing and browsing hornymatches.com and mixed up his windows so everyone saw a half naked girl pop up on their screen. surprisingly he was not fired. he was working for a big consulting firm too.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 09:24 PM
Anyone here with embedded experience?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 09:46 PM
Adios? KatoKrazy? maybe others
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 09:51 PM
Quote:
Originally Posted by bip!
Anyone here with embedded experience?
From the above it sounds like half these guys are "embedded" in something during work hours.

I did some embedded stuff long ago, but in native assembly. I doubt that's how people do it now.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-11-2017 , 09:54 PM
Quote:
Originally Posted by daveT
Why can't you slurp sql files into the command line, or even run raw SQL like normal database people?
I do. Some things are easier in the designer, so sometimes I have that open and it would be nice if it would just do what I ask. It's not hard to write an ALTER COLUMN command, it's just annoying.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-12-2017 , 01:55 AM
One of the best skills that carries over from sales to coding is presenting and leading demos. Our team lead was out a couple weeks ago so I took over demo responsibility for our sprint. The team thought it was the best demo we've had.

I have also researched options that are better than an incognito window but I feel pretty confident they don't exist.

At this point, I'm probably borderline too confident, but im always incredibly intentional in what I share from my screen/window to the point I would never disconnect from a remote monitor while sharing or anything that would alter the arrangement. Today, I was presenting and when things hit a lul and we were waiting for someone to go leave and get someone, I just instinctively used my phone to browse, knowing my machine was a no-touch zone.

I just had it ingrained into my head so hard from being on hundreds of conference calls and screen-share sessions.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-12-2017 , 01:58 AM
Quote:
Originally Posted by ChrisV
I do. Some things are easier in the designer, so sometimes I have that open and it would be nice if it would just do what I ask. It's not hard to write an ALTER COLUMN command, it's just annoying.
On a similar vein, is there a good reason Oracle is completely different than every other database from the command line?

My backend teammates always want me to install a GUI whenever I do db stuff with them, but I just wanna use the command line, but Oracle doesn't have any of the same commands it seems like.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-12-2017 , 03:39 AM
Oracle was developed in the 70s, predating everything we use today, plus the SQL standard by quite a few years.

PostgreSQL and MySQL have very different command lines as well. MySQL command line is borderline unusable.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-12-2017 , 11:39 AM
Honestly my favorite command line from any database is probably sqlite3.

It's been a long time since I've used oracle, I always felt like using the command line tools was like programming in COBOL.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-12-2017 , 12:31 PM
Typing War and Peace isn’t like coding in COBOL I can’t imagine a CLI that is even close.

Fun fact, my 35k posts are shorter than a CRUD app written in COBOL.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
12-12-2017 , 12:42 PM
Quote:
Originally Posted by bip!
Anyone here with embedded experience?
I do SOC design and verification. Sup?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m