To dump:
pg_dump dbname > dbname.sql
To restore:
cat dbname.sql | psql dbname
NOTICE:
# 0. Make sure you have Ruby 1.9.3 installed, and optionally RVM and PostgreSQL | |
# 0.2 If you are on the Mac, make sure you have a c compiler by installing XCode Command Line Tools or gcc4.2 with homebrew | |
# https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers | |
# 0.5 Make sure you have bundler version ~> 1.2 as Rails depends on it | |
gem install bundler | |
# 1. Get edge Rails source (master branch) | |
git clone https://github.com/rails/rails.git |
To dump:
pg_dump dbname > dbname.sql
To restore:
cat dbname.sql | psql dbname
NOTICE:
connect to postgres
psql -h localhost
create database
CREATE DATABASE mydatabase;
switch to your database
\connect mydatabase
add postgis extension
#!/usr/bin/env ruby | |
country_array = %w( | |
aruba | |
afghanistan | |
andorra | |
angola | |
anguilla | |
albania | |
united-arab-emirates |
<!-- #canvas is to store the generated SVG information --> | |
<canvas id="canvas" style="display:none;"></canvas> | |
<div class="title"> | |
Religion Population 2010 | |
<span class="download individual" title="download chart"></span> | |
<span class="share individual" title="share chart"></span> | |
</div> | |
<div class="chart"> |
svg = $('svg').parent().html() | |
canvg('canvas', svg) | |
canvas = document.getElementById("canvas") | |
img_PNG = "<img src='#{canvas.toDataURL()}' />" | |
$('.chart').html(img_PNG) |
svg = $('svg').parent().html() | |
canvg('canvas', svg) | |
canvas = document.getElementById("canvas") | |
img_PNG = Canvas2Image.saveAsPNG(canvas, true) | |
$('.chart').html(img_PNG) |
pushToServer: ()-> | |
html2canvas([$(".hidden_container")[0]],{ | |
onrendered: (canvas)=> | |
strDataURI = canvas.toDataURL() | |
@temp_container.children().remove() | |
@temp_container.hide() | |
$.ajax | |
url: '/svg/create' | |
data: {svg: "#{strDataURI}"} |
# to invoke below code will pupup a download window and allow you to download a canvas as PNG file. | |
img_PNG = Canvas2Image.saveAsPNG(canvas); |