This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
======= 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'thin' | |
class Metaserver < Sinatra::Base | |
set server: 'thin' | |
set connections: [] | |
get '/stream', provides: 'text/event-stream' do | |
stream :keep_open do |out| | |
settings.connections << out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
require 'sinatra' | |
set server: 'thin', connections: [] | |
get '/' do | |
halt erb(:login) unless params[:user] | |
erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
end | |
get '/stream', provides: 'text/event-stream' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Settings < Settingslogic | |
source "#{Rails.root}/config/application.yml" | |
if Rails.env == 'development' | |
namespace 'development-' + Socket.gethostname.gsub(/\W/, '-').gsub(/[-]{2,}/, '-') | |
else | |
namespace Rails.env | |
end | |
# load local settings |