Maximum MIME type length when storing the type in a database

According to RFC 4288 “Media Type Specifications and Registration Procedures”, type (eg. “application”) and subtype (eg “vnd…”) both can be max 127 characters. So including the slash, the maximum length is 255. Edit: Meanwhile, that document has been obsoleted by RFC 6838, which does not alter the maximum size but adds a remark: Also note … Read more

SQL Server Automated Backups [closed]

If you are using SQL Server Express, you won’t find a UI to run periodic backups. In this case you have to run a batch using Windows Scheduled Tasks or something similar. Don’t forget to use a user with enough privileges to access SQL Server. In the batch file “C:\Program Files\Microsoft SQL Server\100\Tools\Binn\SQLCMD.EXE” -S (local)\SQLExpress … Read more

LISTEN/NOTIFY using pg_notify(text, text) in PostgreSQL

I have discussed this on the PostgreSQL mailing list (http://archives.postgresql.org/pgsql-bugs/2011-03/msg00041.php) and was informed on the reasoning for the behavior. Their answer is that “..you have to double quote relnames (listen “Test”). if you want the server not to case fold them. pg_notify takes a string, not a relname, which uses different rules.” (Thanks Merlin and … Read more

Is 502 an appropriate status code for a database error?

No, I don’t think an HTTP 502 Bad Gateway error is appropriate when a database error occurs. HTTP errors say something about the HTTP protocol. This specific error indicates a server is trying to relay the HTTP request, but the upstream server did not respond correctly. Your web application communicating with a database server is … Read more

Destroy/Remove database in Rails

By issuing rake -T you have the following database tasks: rake db:create # Create the database from DATABASE_URL or config/database.yml for the current Rails.env (use db:create:all to create all dbs in the config) rake db:drop # Drops the database using DATABASE_URL or the current Rails.env (use db:drop:all to drop all databases) rake db:fixtures:load # Load … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)