Today I learned
Page 1 of 15 12311 ... LastLast
Results 1 to 15 of 219

Thread: Today I learned

  1. #1
    Senior Member cluelessPHP's Avatar
    Join Date
    Apr 2015
    Location
    Scotland
    Posts
    429

    Today I learned

    I was thinking about what Brad Jones had said, so I was thought it might be fun to post what you learned today if anything.


    Today I learned iPad pro overlaps desktop styles in css

    Will edit in a solution later..
    Once you had a good excuse, you opened the door to bad excuses ― Terry Pratchett, Thud
    Blog

    Six month project

  2. #2
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    14,843
    Today I learned how to convert a datetime object from any timezone to UTC.
    PHP Code:
    $ts = new DateTime($timestamp); // $timestamp is a date-time string
    $ts->setTimezone(new DateTimeZone('UTC')); 
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Contact Unit "Coping Mechanism"
    Posts
    22,503
    Today I learned that intval doesn't use the same integer parsing rules as PHP itself when the given base is 0.
    PHP Code:
    $i 0b1100;
    $s '0b1100';

    echo 
    $i" "intval($s0); 
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

  4. #4
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    14,843
    Quote Originally Posted by Weedpacket View Post
    Today I learned that intval doesn't use the same integer parsing rules as PHP itself when the given base is 0.
    PHP Code:
    $i 0b1100;
    $s '0b1100';

    echo 
    $i" "intval($s0); 
    I guess the casting stops as soon as it finds something in the string that is "not a number" in a character sense.

    Code:
    [~]$ php -a
    Interactive shell
    
    php > $i = 0b1100;
    php > $s = '0b1100';
    php >
    php > echo $i, "  ", intval($s, 0);
    12  0
    php > $i = 1.3e3;
    php > $s = '1.3e3';
    php >
    php > echo $i, "  ", intval($s, 0);
    1300  1
    php >
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  5. #5
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Contact Unit "Coping Mechanism"
    Posts
    22,503
    Except
    PHP Code:
    $i 0x1100;
    $s '0x1100';

    echo 
    $i" "intval($s0); 
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

  6. #6
    Senior Member cluelessPHP's Avatar
    Join Date
    Apr 2015
    Location
    Scotland
    Posts
    429
    This "seems" to work

    Code:
    @media only screen and (min-width: 769px) and (max-width: 1281px) { 
      body{
    	  background-color:pink;
      }
    }
     
    
    @media only screen  and (min-width : 1224px) {
    body{
    	  background-color:red;
      }
    
    }
    From what I noticed it will allow you to target iPad pro while ignoring desktop styles, css sure is user friendly
    Once you had a good excuse, you opened the door to bad excuses ― Terry Pratchett, Thud
    Blog

    Six month project

  7. #7
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    14,843
    Quote Originally Posted by Weedpacket View Post
    Except
    PHP Code:
    $i 0x1100;
    $s '0x1100';

    echo 
    $i" "intval($s0); 
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  8. #8
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    8,493
    This probably includes "yesterday" as well:

    1. If you have a separate "mobile subdomain", Google wants "rel='canonical'" and "rel='alternate'" LINK tags.

    2. Google will begin penalizing sites with insecure login forms.

    3. SphinxQL doesn't support JOIN or UNION, but does allow a comma-separated join syntax which actually functions more like a UNION.

    4. My co-worker doesn't really look very carefully at data before uploading it.
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  9. #9
    Senior Member cluelessPHP's Avatar
    Join Date
    Apr 2015
    Location
    Scotland
    Posts
    429
    A new term...honeypot

    Code:
    <input id="real_email" type="text" name="real_email" size="25" value="" />
    <input id="test_email" type="text" name="email" size="25" value="" />
    
    #test_email {
    display: none;
    }
    Once you had a good excuse, you opened the door to bad excuses ― Terry Pratchett, Thud
    Blog

    Six month project

  10. #10
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    8,493
    That you can type most any "time string" into the reminder window in Outlook. I have a reminder set to check email once an hour (so I don't do it more frequently on the one hand, or *never* on the other). Now, if it's, say, 9:02 when I actually do get around to looking at it, but I still want it to remind me again at 10 AM, I type "58 minutes" into the field. Until this week I was leaving it on the second screen until 9:15, then pulling "15 minutes" from the dropdown, and then pulling "30 minutes" from the dropdown at 9:30, etc.

    #yes_I_am_stupid_most_days
    #its_the_little_things
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  11. #11
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    14,843
    Using your face (mainly the forehead) to cushion the impact when you collide with a racquetball court wall is a bad idea.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  12. #12
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    8,493
    Quote Originally Posted by NogDog View Post
    Using your face (mainly the forehead) to cushion the impact when you collide with a racquetball court wall is a bad idea.
    Ouch!

    TIL --- NogDog used to play racquetball.
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  13. #13
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    13,913
    TIL there's such a sport as racquetball.
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way

  14. #14
    Senior Member cluelessPHP's Avatar
    Join Date
    Apr 2015
    Location
    Scotland
    Posts
    429
    HTML Code:
    function screenWidth()
    	{
    		var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
    		
    		console.log(width);
    	
    	
    	}
    	
    	window.addEventListener("resize", screenWidth);
    Everyday is a learning day

    Also racquetball is a spot, I'm almost sure of it
    Once you had a good excuse, you opened the door to bad excuses ― Terry Pratchett, Thud
    Blog

    Six month project

  15. #15
    Senior Member cluelessPHP's Avatar
    Join Date
    Apr 2015
    Location
    Scotland
    Posts
    429
    HTML Code:
    	var links = document.getElementsByClassName("my class name").getElementsByTagName('a');
    Won't work as it is not a single item

    HTML Code:
    	var links = document.getElementsByClassName("my class name")[0].getElementsByTagName('a');
    Will work [0] makes the difference between getting the error message getElementsByTagName is not a function and not getting
    Once you had a good excuse, you opened the door to bad excuses ― Terry Pratchett, Thud
    Blog

    Six month project

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •