Skip to main content

Jeremy Gollehon

Jeremy Gollehon's Public Library

  • So if you were to go through the Ultimate Rewards portal to one of those sites and then buy gift cards online with your Ink Bold or Plus, not only would you be earning 5X points per $1, but you’d also be earning an additional 2-3 points depending on the merchant for a total of up to 8 Ultimate Rewards points per dollar, which is an amazing value.

  • Beauty Is Only Chrome Deep (Visceral)

     

    The Nest looks pretty on my wall, especially as opposed to its old, utilitarian-looking predecessor. The physical appearance may win every beauty contest, but

  • Beauty Is Only Chrome Deep (Visceral)

     

    The Nest looks pretty on my wall, especially as opposed to its old, utilitarian-looking predecessor. The physical appearance may win every beauty contest, but if I can’t do what I want with it, then it’s art not design.

  • if I can’t do what I want with it, then it’s art not design

  • Indexes should be explicitly named and include both the table name and the column name(s) indexed.

  • Rule of Thumb 1: Use Character Keys For Reference Tables
  • We can now see the surprising fact that the integer keys will slow us down  in many situations. Not only do they have no performance advantage, but  they actually hurt performance. The reason is because they require  joins on almost every query. A 3-table query with two joins will  always be much slower than a 1-table query with no joins. If you are using  an ORM system that does not do JOIN's, but instead does separate fetches,  then you have 3 round trips to the server instead of 1, and heaven  forbid you have queries in a nested loop, the performance will simply  crash and burn. All of this is kind of  ironic since you so often hear people blindly repeat the dogmatic  phrase "We will use integer keys for performance reasons..."
  • If you are following these rules of thumb closely in your  project then it is important not to use the object id  as a primary key, and therefore you may never use it  as a foreign key either. If you use an object id as the  primary key then you lose a lot  of the benefits of the character keys listed above.

1 more annotation...

  • In a table definition I reference the primary key of another table. That > key is of datatype SERIAL. In the referencing table, do I define the column > as >  > col_name INTEGER REFERENCES other-table (primary_key_field), >  > or is the datatype SERIAL because that's what the referenced > primary_key_field is?
  • Serial is a psuedo type to integer/big (depending on the type of  serial). What you have above should work fine.

    • The standard names for indexes in PostgreSQL are:

        

      {tablename}_{columnname(s)}_{suffix}

        

      where the suffix is one of the following:

        
         
      • pkey for a Primary Key constraint
      •  
      • key for a Unique constraint
      •  
      • excl for an Exclusion constraint
      •  
      • idx for any other kind of index
      •  
      • fkey for a Foreign key
      •  
      • check for a Check constraint
      •  
        

      Standard suffix for sequences is

        
         
      • seq for all sequences

  • tl;dr: Use TEXT instead of VARCHAR or CHAR; TEXT has exactly the same performance and space usage characteristics while being much more flexible.

  • Values of type character are physically  padded with spaces to the specified width n, and are stored and displayed that way.
  • The storage requirement for a short string (up to 126 bytes)  is 1 byte plus the actual string, which includes the space  padding in the case of character.
  • Tip: There is no performance difference among these  three types, apart from increased storage space when using  the blank-padded type, and a few extra CPU cycles to check  the length when storing into a length-constrained column.  While character(n) has performance advantages in  some other database systems, there is no such advantage in  PostgreSQL; in fact  character(n) is usually the slowest of the  three because of its additional storage costs. In most  situations text or character varying should be used instead.

  • In practice, I find it easier to use lower_case_underscore_separated_identifiers because it isn't necessary to "Double Quote" them everywhere to preserve case, spaces, etc.

  • Unique Primary Key Names

     

    As mentioned above use <tablename>_ID for numeric keys. By  doing this, every primary key has a unique name. This has several advantages,  but the main one is in foreign key referencing.

  • json.loads() -->Will take a JSON String & Turn it into a python dict

  • Alternatively, if you want to use different configuration files on a per project basis, you should know that if there is a file called pylintrc (without a leading dot) in the current working directory, then Pylint will use this one. If there is a file called __init__.py in the current working directory, Pylint will look in the parent directory until there is no such file and then look for a pylintrc configuration file. This is done so that you can maintain a per project config file together with you source code, and lauch Pylint from any directory in your source tree.

  • Mnemonics

     

    The codetags of interest are listed below, using the following format:

     
     
    recommended mnemonic (& synonym list)
     
     
    canonical name: semantics
     
     
     
     
    TODO (MILESTONE, MLSTN, DONE, YAGNI, TBD, TOBEDONE)
     
    To do: Informal tasks/features that are pending completion.
     
    FIXME (XXX, DEBUG, BROKEN, REFACTOR, REFACT, RFCTR, OOPS, SMELL, NEEDSWORK, INSPECT)
     
    Fix me: Areas of problematic or ugly code needing refactoring or cleanup.
     
    BUG (BUGFIX)
     
    Bugs: Reported defects tracked in bug database.
     
    NOBUG (NOFIX, WONTFIX, DONTFIX, NEVERFIX, UNFIXABLE, CANTFIX)
     
    Will Not Be Fixed: Problems that are well-known but will never be addressed due to design problems or domain limitations.
     
    REQ (REQUIREMENT, STORY)
     
    Requirements: Satisfactions of specific, formal requirements.
     
    RFE (FEETCH, NYI, FR, FTRQ, FTR)
     
    Requests For Enhancement: Roadmap items not yet implemented.
     
    IDEA
     
    Ideas: Possible RFE candidates, but less formal than RFE.
     
    ??? (QUESTION, QUEST, QSTN, WTF)
     
    Questions: Misunderstood details.
     
    !!! (ALERT)
     
    Alerts: In need of immediate attention.
     
    HACK (CLEVER, MAGIC)
     
    Hacks: Temporary code to force inflexible functionality, or simply a test change, or workaround a known problem.
     
    PORT (PORTABILITY, WKRD)
     
    Portability: Workarounds specific to OS, Python version, etc.
     
    CAVEAT (CAV, CAVT, WARNING, CAUTION)
     
    Caveats: Implementation details/gotchas that stand out as non-intuitive.
     
    NOTE (HELP)
     
    Notes: Sections where a code reviewer found something that needs discussion or further investigation.
     
    FAQ
     
    Frequently Asked Questions: Interesting areas that require external explanation.
     
    GLOSS (GLOSSARY)
     
    Glossary: Definitions for project glossary.
     
    SEE (REF, REFERENCE)
     
    See: Pointers to other code, web link, etc.
     
    TODOC (DOCDO, DODOC, NEEDSDOC, EXPLAIN, DOCUMENT)
     
    Needs Documentation: Areas of code that still need to be documented.
     
    CRED (CREDIT, THANKS)
     
    Credits: Accreditations for external provision of enlightenment.
     
    STAT (STATUS)
     
    Status: File-level statistical indicator of maturity of this file.
     
    RVD (REVIEWED, REVIEW)
     
    Reviewed: File-level indicator that review was conducted.
1 - 20 of 4330 Next › Last »
20 items/page

Diigo is about better ways to research, share and collaborate on information. Learn more »

Join Diigo