Archive

Archive for September, 2016

Install Ruby on Rails · Ubuntu Linux

Thursday, 22 September, 2016 Leave a comment

Prepare Your System

Update your package manager first:

$ sudo apt-get update

Install Curl

$ sudo apt-get install curl

Install Ruby Using RVM

The RVM website explains how to install RVM. Here’s the simplest way:

$ \curl -L https://get.rvm.io | bash -s stable --ruby

RVM will install the newest stable Ruby version. You can check for the current recommended version of Ruby.

If You Already Have RVM Installed

If you already have RVM installed, update it to the latest version and install Ruby:

$ rvm get stable --autolibs=enable
$ rvm install ruby
$ rvm --default use ruby-2.3.1

Install Node.js

Since Rails 3.1, a JavaScript runtime has been needed for development on Ubuntu Linux. The JavaScript runtime is required to compile code for the Rails asset pipeline. For development on Ubuntu Linux it is best to install the Node.js server-side JavaScript environment.

$ sudo apt-get install nodejs

and set it in your $PATH.

If you don’t install Node.js, you’ll need to add this to the Gemfile for each Rails application you build:

gem 'therubyracer'

Check the Gem Manager

RubyGems is the gem manager in Ruby.

Check the installed gem manager version. You may see:

$ gem -v
2.3.1

At the time this was written, a newer RubyGems version was available. Use gem update --system to upgrade the Ruby gem manager:

$ gem update --system

©

Advertisements
Categories: Uncategorized

Search the source of SQL Server views and stored procedures

Wednesday, 14 September, 2016 Leave a comment

Search inside your view objects

DECLARE @search VARCHAR(1000)

SET @search = '[text]'

SELECT c.[Text]
FROM dbo.sysobjects AS v
INNER JOIN dbo.syscomments c ON c.id = v.id
	AND CASE WHEN c.Number & amp;amp;gt;1 THEN c.Number ELSE 0 END = 0
WHERE v.type = 'V'
	AND c.[Text] LIKE '%' + @search + '%'

Search the source of stored procedures

DECLARE @find VARCHAR(1000)

SET @find = '{search text here}'

SELECT sp.NAME
	,ISNULL(smsp.DEFINITION, ssmsp.DEFINITION) AS [Definition]
FROM sys.all_objects AS sp
LEFT JOIN sys.sql_modules AS smsp ON smsp.object_id = sp.object_id
LEFT JOIN sys.system_sql_modules AS ssmsp ON ssmsp.object_id = sp.object_id
WHERE (
		sp.type = N'P'
		OR sp.type = N'RF'
		OR sp.type = 'PC'
		)
	AND ISNULL(smsp.DEFINITION, ssmsp.DEFINITION) LIKE '%' + @find + '%'

©

Categories: Uncategorized