Joined March 2012
·

Irakli Nadareishvili

Director of Engineering at NPR
·
Washington, DC
·
·
·

I believe the usage function is missing port argument, and should be something like:

echo -e "\n USAGE: ./${0##*/} [host|ip] [port]\n"

Most PHP frameworks, if not all, use a config.php file for this. Benefits:

  1. Requiring a PHP file is faster than parsing an .ini file. It's just PHP code.
  2. If the file is under documentRoot, .php file is more secure since its content won't be displayed verbatim by a web server, while .ini file can be served by your Apache or Nginx, if you forget to deny access to it explicitely, resulting in a huge security issue.
Posted to PHP operator precedence over 1 year ago

This sounds like a clear bug (and another reason to never use 'or' in PHP). Per documentation 'or' should yield 'true' when it's $result = false or true;:

"$a or $b Or TRUE if either $a or $b is TRUE"

http://www.php.net/manual/en/language.operators.logical.php

Don't RVM and VirtualEnv solve that problem, for Ruby and Python respectively?

AFAIK, the recommended way of showing branch (and commit status) is using gitprompt='$(__git_ps1 "[%s]")'

more details: http://www.freshblurbs.com/blog/2011/03/25/developers-ultimate-bash-prompt.html

This is awesome. Thanks for sharing.

@jmav, FlashTransport is one of three fallbacks. There's also NameTransport and HashTransport that easyXDM will try to use: https://github.com/oyvindkinsey/easyXDM#how-easyxdm-works-

Do any of those work in your scenario? If not then JSONP and/or proxy may be the only options :(

@algal,

thanks for raising that point, but let me clarify why that is not relevant in the specific context of REST APIs.

Cookies are actually not allowed in the given example. As @awinder noted to allow cookies you would have to indicate ""Access-Control-Allow-Credentials: true", which is not part of the example given.

Furthermore, even if you did allow cookies, RESTful APIs use stateless HTTP interactions and therefore typically do not use cookies at all, let alone: for authentication. If they do: they really shouldn't be. And that's the whole point of this tip: cross-domain restriction that exists as a security measure in general isn't very relevant or meaningful for RESTful APIs.

@jmav, I would push back very hard on supporting archaic browsers like IE7 in 2013, but if you simply have to and it's not in your control then you will probably have to fall back to XDM for IE7: https://github.com/oyvindkinsey/easyXDM

Posted to SQL Queries Kill Website Scalability over 1 year ago

@jonathan,

I second your sentiment. JOINs are evil for scalability. "SQL optimization" is rarely an answer, because they can help performance at low scale, but not as much: scalability.

At NPR we've been successfully doing something similar to what you're describing for years, now. Our content management system stores data in a highly-reliable and consistent, fully normalized SQL store, but at publish we "burn" the same content as completely de-normalized content objects that can be served super-fast at run-time. Years ago, we used to use file storage for storing those de-normalized documents. They are now stored in an efficient document database.

Well played!

Posted to Pretty JSON for humans over 1 year ago

In terminal or in your Node code, if you like commas-first: https://github.com/inadarei/cleanjson

Posted to mysqldump | gzip, best combo over 1 year ago

This is also nice, if you have many databases and to support backup rotations: http://sourceforge.net/projects/automysqlbackup/

Posted to Shortcuts that save time over 1 year ago

Ctrl+A/Ctrl+E are Unix shortcuts.

@faceleg ha, touché! :-)

Achievements
962 Karma
44,839 Total ProTip Views