Thursday, October 27, 2011

How to send anonymous email

it simple to send anonymous email using this service, use replynot

Sending email using pony gem via sendgrid under heroku

Pony.mail(:to => params[:to],
:from => params[:name] + "",
:subject => params[:subject],
:body => params[:body],
:port => '587',
:via => :smtp,
:via_options => {
:address => 'smtp.sendgrid.net',
:port => '587',
:enable_starttls_auto => true,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:authentication => :plain,
:domain => ENV['SENDGRID_DOMAIN']
})

How to get source code from Heroku

ca@osm-mnl-ca-lx:~/Projects/Rubys$ git clone git@heroku.com:your-app.git
Cloning into your-app...
The authenticity of host 'heroku.com (50.19.85.156)' can't be established.
RSA key fingerprint is 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'heroku.com,50.19.85.156' (RSA) to the list of known hosts.
remote: Counting objects: 73, done.
remote: Compressing objects: 100% (67/67), done.
remote: Total 73 (delta 24), reused 0 (delta 0)
Receiving objects: 100% (73/73), 15.48 KiB, done.
Resolving deltas: 100% (24/24), done.

Adding ssh key to Heroku

ca@osm-mnl-ca-lx:~$ heroku keys:add
Enter your Heroku credentials.
Email: biboyatienza@gmail.com
Password:
Found existing public key: /home/ca/.ssh/id_rsa.pub
Uploading ssh public key /home/ca/.ssh/id_rsa.pub

Installing RVM on Ubuntu 11.10

sudo apt-get install build-essential libopenssl-ruby libfcgi-dev
sudo apt-get install ruby irb rubygems ruby1.8-dev
sudo apt-get install sqlite3 libsqlite3-dev

sudo apt-get install git
sudo apt-get install curl
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
gedit ~/.bashrc
and add the following line to the end (and save the file)
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

rvm requirements
rvm install 1.9.2
rvm use 1.9.2 --default
gem install rails

Wednesday, October 26, 2011

LINQ to Entities does not recognize the method 'System.DateTime AddHours(Double)'

Problem:
LINQ to Entities does not recognize the method 'System.DateTime AddHours(Double)'

Old Code:
DateTime cutOffDateTime = DateTime.Now.AddHours(-updatedWithInNumberOfHours);


Solution:
DateTime cutOffDateTime = DateTime.Now.Subtract(new TimeSpan(0, updatedWithInNumberOfHours, 0, 0));