Wednesday, November 7, 2012

Internal error in Forbidden Patterns Policy


Microsoft Visual Studio

This override warning in VS occur when editing files

Internal error in Forbidden Patterns Policy.
Error Loading The Forbidden Patterns Policy policy (The policy assembly 'Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ForbiddenPatternsPolicy, Version-10.0.0.0,
Culture=neutral, PublicKeyToken=b03f5fd23423' is not registered.). Installation instructions:

Error Loading The Forbidden Patterns Policy policy (The policy assembly 'Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ForbiddenPatternsPolicy, Version-10.0.0.0,
Culture=neutral, PublicKeyToken=b03f5fd23423' is not registered.). Installation instructions:

To solve this please ensure you have the TFS Powertools extensions for Visual Studio installed.

Goto tools->extension manager and you should find it in the online section.

http://visualstudiogallery.msdn.microsoft.com/b1ef7eb2-e084-4cb8-9bc7-06c3bad9148f

Rails SMTP email setup

I am using rails 3.2.6.

To setup SMTP email using ruby:

1. Add the following code into the /config/environment.rb

require File.expand_path('../application', __FILE__)

# Initialize the rails application AppName::Application.initialize!

ActionMailer::Base.delivery_method = :smtp

ActionMailer::Base.smtp_settings = {
:address => "smtp.host.com",
:port => 587,
:user_name => "email host",
:password => "email password hot",
:authentication => :plain,
:enable_starttls_auto => "true"
}

ActionMailer::Base.raise_delivery_errors = true

2. Create /app/mailers/appnamemailers.rb with the following content
class Appnamemailers < ActionMailer::Base
default :from => "email@hostemail.comd"


def welcome_email()
@url = "http://www.example.com"
mail(:to => "test@gmail.com", :subject => "Welcome to rails app")
end
end
2. To test run rails console
3. Execute the command Appnamemailers.welcome_email().deliver

Monday, November 5, 2012

rails script generate heroku

The article in this page

https://devcenter.heroku.com/articles/smtp

mentions about running a ./script/generate mailer <name>.

For my Rails 3.2.6 version, it does not contain the generate script file. So instead run with this command

rails generate mailer <name>

Wednesday, October 31, 2012

Changes to 64-bit applications are not allowed

Edit and continue

Changes to 64-bit applications are not allowed.

I am using VS 2010 and apparently the issue is because I was still running the program in debug mode which VS does not allow us to modify or edit. The "Changes to 64-bit applications are now allowed." error message is not that clear. To fix the issue, just stop the debugging that is currently running.

Changes to 64-bit applications are not allowed

Saturday, August 25, 2012

PHP Parse error: syntax error, unexpected '=' in

I recently get the following error in PHP:

Parse error: syntax error, unexpected '=' in .... line 109

apparently it is because I created a variable with "-" in it.

To resolve the issue, I rename the variable from "$cart-content" to "$cart_content"

PHP iterating all cookies

To iterate all of the cookies that have been set in PHP:

foreach ($_COOKIE as $cookie_name => $cookie_value)
{
 echo "$cookie_name with value $cookie_value";
 }

JQUERY Cookie TypeError

Error:

TypeError: Object function (a,b){return new p.fn.init(a,b,c)} has no method 'cookie'

The error is simply because, the jquery cookie file has not been added.

 To add just download the jquery.cookie.js at github

 Then add the jquery.cookie.js

<script src="./jquery.cookie.js"></script>

No horizontal scroll bar in Firefox

Firefox seems to have a bug in displaying the horizontal scrollbar for a certain CSS. To force it to display scrollbar when needed just use this css
html {
  overflow-x: auto;
}

Tuesday, June 26, 2012

Heroku stack does not use the asset pipeline

My rails apps hosted in heroku does not use the asset pipeline. When I do the git push heroku master, I get the following message
-----> Preparing app for Rails asset pipeline
       Detected manifest.yml, assuming assets were compiled locally
To solve this delete the public/assets directory so that rails does not use the static assets anymore