##0. Mass Assignment
-
Mass assignment allows us to set a bunch of attributes at once:
attrs = { :first => "John", :last => "Doe", :email => "[email protected]"} user = User.new(attrs)
##0. Mass Assignment
Mass assignment allows us to set a bunch of attributes at once:
attrs = { :first => "John", :last => "Doe",
:email => "[email protected]"}
user = User.new(attrs)| error_page 500 /500.html; | |
| location /500.html{ | |
| return 500 '{"error": {"status_code": 500,"status": "Internal Server Error"}}'; | |
| } | |
| error_page 502 /502.html; | |
| location /502.html{ | |
| return 502 '{"error": {"status_code": 502,"status": "Bad Gateway"}}'; | |
| } |
| sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
| sudo apt-get update | |
| sudo apt-get install gcc-5 g++-5 | |
| sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5 |
| { | |
| "content_scripts": [ | |
| { | |
| "matches": ["http://*/*", "https://*/*"], | |
| "js": ["inject.js"], | |
| "all_frames": true | |
| } | |
| ], | |
| "web_accessible_resources": [ | |
| "content.js" |
SSH into Root
$ ssh [email protected]
Change Root Password
| -- Error Message: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. | |
| -- | |
| -- our table name that has this issue is XYZ | |
| -- | |
| SET GLOBAL innodb_file_format=Barracuda; | |
| SET GLOBAL innodb_file_per_table=ON; | |
| ALTER TABLE XYZ ROW_FORMAT=COMPRESSED; |
| <?php | |
| class ResumeDownload { | |
| private $file; | |
| private $name; | |
| private $boundary; | |
| private $delay = 0; | |
| private $size = 0; | |
| function __construct($file, $delay = 0) { | |
| if (! is_file($file)) { |
| ======= Prolbem ================================================================================================================= | |
| I have installed : ruby-2.0.0,postgres-9.2 , now in rails app when I execute: | |
| rake db:create , command I get: | |
| PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) | |
| HINT: Use the same encoding as in the template database, or use template0 as template. | |
| : CREATE DATABASE "my_db_name" ENCODING = 'unicode'....... | |
| bin/rake:16:in `load' |
| #!/bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: <SCRIPT_NAME> | |
| # Required-Start: $local_fs $network $named $time $syslog | |
| # Required-Stop: $local_fs $network $named $time $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Description: Script to run asp.net 5 application in background | |
| ### END INIT INFO |
| var runner = require('child_process'); | |
| runner.exec( | |
| 'php -r \'include("settings.php"); print json_encode($databases);\'', | |
| function (err, stdout, stderr) { | |
| var connection = JSON.parse(stdout).default.default; | |
| console.log(connection.database); | |
| // result botdb | |
| } |