Rails 3 on debian with Sqlite 3

October 13, 2010

Decided to move to Rails 3 recently and get up to speed on the new framework version.

I list here the process I followed to install it on Debian (Lenny).

*Note, some of these commands need root / administrator privileges. Notably the apt and install commands. Use sudo, su or a root shell.

Install dependancies

# optional VCS, we use Mercurial Locally and Git for deployments to Heroku (hosting)

apt-get install git-core mercurial

# libmysqlclient15off libreadline5-dev
apt-get install build-essential libreadline5-dev libssl-dev zlib1g zlib1g-dev

#optional Database, I have detail for getting Sqlite3 later
#apt-get install mysql-common mysql-server

Install Ruby

wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p0.tar.gz
tar xzf ruby-1.9.2-p0.tar.gz
cd ruby-1.9.2-p0
./configure
make
make install

Install sqlite 3

wget http://www.sqlite.org/sqlite-amalgamation-3.7.2.tar.gz
tar xzf sqlite-amalgamation-3.7.2.tar.gz
cd sqlite-3.7.2/

./configure
make
make install

gem install rails sqlite3-ruby

Create your rails app

rails new Items
rails g scaffold Item name:string detail:text
rake db:migrate
rm public/index.html
vim config/routes.rb

add this line:

root :to => "items#index"

then start the server:

rails s

Open your browser and go to http://localhost:3000/

And that’s it!


Building direct show filters in Visual Studio 2008

September 9, 2010

First off, make sure you have the latest windows sdk.

The direct show base classes are in there now and not directx sdk.

There are required headers in direct show base classes in the samples directory of the sdk.

Thus, you need to reference the header files in

C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\multimedia\directshow\baseclasses

You will also to build that solution and link the lib file:

  1. Drop down the Tools menu, and select Options [ from http://www.lavishsoft.com/wiki/index.php/Visual_Studio_Paths ]
  2. In the box on the left is a list of option categories. Select “Projects and Solutions” and then the sub-category “VC++ Directories”
  3. In the upper right hand corner is a drop-down box that selects a particular set of default directories, including “Executable files”, “Include files”, “Reference files”, “Library files”, and “Source files”. Generally, you only want to add to the “Include files” or “Library files” lists. Select “Include files”
  4. In the middle of the right hand side of the window is a list of directories.
    1. Add the include path by pressing the “New Line” button above the window, or by pressing “Ctrl-Insert” or clicking under the last entry.
    2. A blank entry appears for you to either type the path or navigate by clicking the “…” button.
    3. Generally the final path you want will end with a folder called “include”. Enter the path now (e.g., c:\program files\isxdk\include)
      1. For direct show base classes, enter C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\multimedia\directshow\baseclasses
  5. Select “Library files” in the drop-down box
  6. In the same fashion as done for the include file path, add the path to the library files. (e.g., c:\program files\isxdk\lib\vs80)
    1. Add the direct show path C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\multimedia\directshow\baseclasses\release_mbcs
  7. You’re done, click OK

These includes need to be before the windows sdk includes, or you will have issues with definitions in refclock.h as there is another header of this name in the sdk.

I ran into this too. I found that you need to have the baseclasses directory (samples/multimedia/directshow) *before* the sdk include directory, since they both have a schedule.h file and refclock.h uses <> not ” for the include. I was slightly surprised to see that no-one else had mentioned this. [ http://social.msdn.microsoft.com/Forums/en/windowsdirectshowdevelopment/thread/5da8f0b8-d2a9-4caf-81e1-7f5788fa1c00 ]

The exact error reads as follows:

WIN32

c1xx : fatal error C1083: Cannot open source file: ‘WIN32′: No such file or directory

 

After I get this error once, I can recompile again, and since the changed file has now been compiled, it goes directly to linking and doesn’t spit this error out again.

I also found reference to other potential causes for this error online:

  • -Make sure the compiler sees /D “WIN32″, without /D it will try to compile WIN32.  Project + properties, C/C++, Command line.
  • -/I “” is your problem, it swallows the next /D.  I tried it and got the same error message. Not sure how you got it, there’s probably something wrong with Project + properties, C/C++, Additional include directories.
  • - I’d added an environment variable which had now been removed, thus creating an empty /I “”.

And that’s about all I took note of.


Follow

Get every new post delivered to your Inbox.