Skip to main content

Chris Morrow

Chris Morrow's Public Library

  • Journalist Ron Rosenbaum has pointed out that, once the order is issued, the process is entirely concerned with authenticating the identity of the commanding officers and the authenticity of the order, and there are no safeguards to verify that the order or the person issuing it is actually sane.[3] Notably, Major Harold Hering was discharged from the Air Force for asking the question, "How can I know that an order I receive to launch my missiles came from a sane President?"[3]


    • (349 children)

      <form onsubmit="return post_form(this, 'editusertext')" id="form-t1_cxb0w4jiwt" class="usertext" action="#">

      But then.. won't it require line-of-sight? :/


      [–]xeridium 82 points83 points  (34 children)

      <form onsubmit="return post_form(this, 'editusertext')" id="form-t1_cxbbfc0k1z" class="usertext" action="#">

      My fortified pillow fort won't have Li-Fi access. :(


      [–]TimeZarg 54 points55 points  (14 children)

      <form onsubmit="return post_form(this, 'editusertext')" id="form-t1_cxbbn7vc69" class="usertext" action="#">

      But that's okay, because you have a pillow fort. I don't even have enough pillows to build a fort out of.


      [–]Deucer22 25 points26 points  (4 children)

      <form onsubmit="return post_form(this, 'editusertext')" id="form-t1_cxbepa5l9q" class="usertext" action="#">

      Don't let your dreams be dreams.

    • (8 children)

      <form onsubmit="return post_form(this, 'editusertext')" id="form-t1_cxbfsvfsax" class="usertext" action="#">

      Have you noticed how when someone walks in front of the only light in a room, the rest of the room is immediately pitch black?


      No? The light gets reflected off walls and lights up the room anyway? That seems highly implausible. /s


      (IR remote controls are the same - you can usually point it in any direction you want, because they're bright enough to still reach the TV even after bouncing a few times.)


      [–]ExtraCheesyPie 33 points34 points  (6 children)

      <form onsubmit="return post_form(this, 'editusertext')" id="form-t1_cxbg5i4gpu" class="usertext" action="#">

      My favourite pastime is pointing the remote at the wall behind the couch and trying to reach the tv


      [–]senses3 10 points11 points  (5 children)

      <form onsubmit="return post_form(this, 'editusertext')" id="form-t1_cxbgh59utf" class="usertext" action="#">

      My favorite pastime is using an rf remote and point it at my butt to change the channel.


  • Keep in mind that this doesn't just accept non-null like coalesce in other languages, but any value, which will be implicitly converted to a boolean. So make sure you brush up on your type casting rules
  • As DanMan said, this is not a "coalesce" as the title suggests. The answer from Will Shaver is actually coalesce. Coalesce returns the first non-null value. ($value ?: $other) is the same as ($value ? $value : $other). So, if $value === false then $other is returned. A true coalesce would return false because $value is non-null.

  • The following query gives names of all sequences.

    SELECT c.relname FROM pg_class c WHERE c.relkind = 'S';

  • I couldn't find much info on stacking the new ternary operator, so I ran some tests:

    echo 0 ?: 1 ?: 2 ?: 3; //1
    echo 1 ?: 0 ?: 3 ?: 2; //1
    echo 2 ?: 1 ?: 0 ?: 3; //2
    echo 3 ?: 2 ?: 1 ?: 0; //3

    echo 0 ?: 1 ?: 2 ?: 3; //1
    echo 0 ?: 0 ?: 2 ?: 3; //2
    echo 0 ?: 0 ?: 0 ?: 3; //3

    It works just as expected, returning the first non-false value within a group of expressions.

  • Actually, other languages (for example, Perl and Ruby) also have these variants with the same precedence distinction so it wouldn't be sensible to deviate from this standard (however puzzling it might be for beginners) by making precedence equal in PHP.

  • Fools ignore complexity; pragmatists suffer it; experts avoid it; geniuses remove it. -- Alan Perlis
  • "Clever", when applied to code, is almost always just a euphemism for "needlessly complicated".


    Reading good, clear, simple code is hard enough. Reading "clever" code is like studying latin poetry all over again.

  • Most folks are focusing on cleverness from an aspect of "The code requires too much deciphering to figure out what it is doing" and all the bad things that go along with that such as

3 more annotations...

  • Seeing as it works with adding a column, and I've seen instructions 
    for creating a sequence, and then adding a dependency into the system 
    tables, it's quite reasonable to expect that one day it will work with 
    alter table alter column.  But it's probably more complicated than 
    just making it a serial type, there's probably some question of 
    setting the sequence according to the max value in the table.  I'd be 
    surprised if it's not on the TODO list somewhere.

  • Furthermore, this dependency between sequence and column is  made only for the serial column itself.  If any other columns reference the sequence (perhaps by  manually calling the nextval  function), they will be broken if the sequence is removed.  Using a serial column's sequence in  such a fashion is considered bad form; if you wish to feed  several columns from the same sequence generator, create the  sequence as an independent object.


  • Sometimes writing unit tests can be painful. When it gets that way, try to find someone to help you, and resist the temptation to "just write the damn code". Unit testing is a lot like washing the dishes. It's not always pleasant, but it keeps your metaphorical kitchen clean, and you really want it to be clean. :)

  • We've used image comparison tool, which produces pixel-wise diff with the expected image, exactly to verify these kind of things(we've been developing the rendering tool). In addition to this unit tests, combined with the coverage tools, allows you to find potential problems/crashes etc in your code.  Different levels of testing are for different things, unit tests just one of the pieces in the equation.

    Your point is just for some tiny tiny scenarios of the software you are working on.

    You don't need to think about 'how could I write a unit test', you need to think about how could you improve the quality of the code, and unit tests are just one of your tools available to solve this problem.

  • "&&" has a greater precedence than "and"
  • Note that PHP's boolean operators *always* return a boolean value... as opposed to other languages that return the value of the last evaluated expression.

    For example:

    $a = 0 || 'avacado';
    print "A: $a ";

    will print:

    A: 1

    in PHP -- as opposed to printing "A: avacado" as it would in a language like Perl or JavaScript.

    This means you can't use the '||' operator to set a default value:

    $a = $fruit || 'apple';

    instead, you have to use the '?:' operator:

    $a = ($fruit ? $fruit : 'apple');

  • -- tables -- Table: topics CREATE TABLE topics (  topic_id int NOT NULL,  topic_text text NOT NULL,  section_id int NOT NULL,  topic_order_within_section int NOT NULLCONSTRAINT topics_pk PRIMARY KEY (topic_id) );

  • Currently, pg_insert() returns a bool rather than a resource. Usually, insert queries return resources which can be passed to pg_last_oid() for pulling the OID of that insert statement's created row. However, nothing can really be done with the "true" return value given by pg_insert(), therefore making it not quite as useful a function as it could be.

  • You can use things like DKIM or SPF in your domain. It means you are stating that you 'authorize' mail via server X. These measures increase the 'reputation' of sending mail servers for your domain.


    But the verification checks are made on the recipient. No one really blocks based on SPF or DKIM since email is 'open' in that sense that you can send a 'valid' email from anywhere.


    It's up to to the receiving email server to determine if they want to accept and forward on a sending email.

  • Group 1 will say it is horrible practice since it is hard to follow.


    Group 2 will say do it.


    Group 3 will say do it, but in 1 line


    Group 4 will say do not use the else


    Group 5 will say to do not use the return, just use the if around the code you want to run.  AKA:

    if (navigator.userAgent.match(/iPad/i) === null) {     //Usual script here }
      answered Sep 14 '10 at 17:36 
      14    upvote 
      What happens if all 5 groups walk into a bar?

  • The performance problem here is the cost of creating a new function object at each iteration of the loop and not the fact that you use an anonymous function:


  • Mine won't let me say f-ing. It has learned the s word no problem. Just the four letter f word. But when I try to put the -ing on the end, it comes out "ducking." I have to go back and change the D to an F. It is in the dictionary! But it will NEVER swype that word.   
1 - 20 of 20070 Next › Last »
20 items/page

Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »

Join Diigo