понеділок, 28 січня 2013 р.

Valid URI characters

Hey!

Do you know that only following chracters are valid for URI:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;=
So now you know it! ;)


RegEx to determine only valid URI characters: /^[!#$&-;=?-[]_a-z~]+$/

References:
http://stackoverflow.com/questions/1547899/which-characters-make-a-url-invalid
http://tools.ietf.org/html/rfc3986


пʼятницю, 18 січня 2013 р.

MySQL - Finding tables without primary keys

It is always important to have primary keys when you're in SQL world. I have found a nice way find to find those culprit tables who don't have it. And just modified a bit added "engine" column. So here it is:

SELECT table_catalog, table_schema, table_name, engine
  FROM information_schema.tables
    WHERE (table_catalog, table_schema, table_name) NOT IN
          (SELECT table_catalog, table_schema, table_name
               FROM information_schema.table_constraints
               WHERE constraint_type = 'PRIMARY KEY')
      AND table_schema NOT IN ('information_schema', 'pg_catalog');