Codan The Librarian

I’ve moved the contents of this blog to my new blog also called Codan the Librarian. Thank you.

I’m fairly new to the programming world, but have been fascinated by Ruby on Rails, and the apparent ease in using it. However, I’ve always had problems with getting the coding just right in the Terminal. Because I’ve never had a class or anything, I’ve not really known how or why things worked the way they did in the Unix command line. So the following is just a snippet that helped me in understanding how a small part of the command line works in relation to setting up a Ruby on Rails demo application. It may be helpful to others, it may not. I’m just writing it because it was helpful for me.

daniel$

This is me logged into Terminal. From here, I can open an application by simply writing:

daniel$ mate

And Textmate opens up. This option doesn’t seem to work with all applications (for instance if I type “daniel$ Safari” the Terminal will come back with a response saying “-bash: Safari: command not found”. I don’t get this part of the Terminal just yet). Other applications that seem to be based on the command line, like MySQL work just fine if you type them here (ex. “daniel$ mysql”).

Now, the “daniel$” portion of the Terminal is basically telling me that I can open up files, folders and applications that are in the Daniel User section of my hard drive. (Maybe that is why it won’t open up applications that are based in the Applications file—and again I don’t know the code to open files from the Applications folder—I guess I should look it up). In any case, if I want a particular file or folder opened up in Textmate from the Daniel root folder, I merely type:

daniel$ mate demo

And the demo folder opens up. If this folder is in another folder in the Daniel root folder then I type:

daniel$ mate Sites/demo

If the “demo” folder happened to be in the Sites folder.

Using the “cd” command moves the Terminal into the folder you desire to work in, like so:

daniel$ cd Sites
/Sites daniel$

That moved our Terminal into the folder Sites. Any command we give from here on out will only work in the Sites folder unless we give the following command:

/Sites daniel$ cd ..

This will command the Terminal to shift back one folder.

daniel$

If we go back into the sites folder:

daniel$ cd Sites
/Sites daniel$

Here we can now create a Rails application.

/Sites daniel$ rails demo

Because I’ve already installed rails and ruby and mysql and all the other required applications, the computer automatically runs and creates exactly what I need. If you run the following command (ls -p) —that is a lower case ‘l’ (as in letter), you get a listing of all the files under Sites. To get into the demo folder, we do

/Sites daniel$ cd demo

Which gives us

/Sites/demo daniel$

Now that we’re in the demo folder, we can make the Rails application run. At this point, simply creating the files doesn’t “turn on” the engine sort to speak. To run the application, we give the following command, while in the demo folder (this command will not work in the Sites folder).

/Sites/demo daniel$ ruby script/server

This starts the server. If we go with our browser to the http://localhost:3000 URL, we’ll see the traditional Welcome Aboard file.

From this point on we will need numerous applications for designing a great websites. Textmate will edit our files. The Terminal will run our commands and mysql database. Any browser will preview our website. Any image editor will create our appropriate images.

One other note. Once you run your server, you need to open a new command shell to run other Terminal applications like mysql.

If you wish Textmate to open your demo file, make sure you’re in the Sites folder first like so:

/Sites/daniel$ mate demo

Otherwise if you do this:

daniel$ mate demo

You merely create a new file called demo and not open the demo folder you created using rails.

To create a controller called “Say” type in the command line:

/Sites/demo daniel$ ruby script/generate controller Say

Several files will now be created.

And so on. There is obviously more, and from here on out the various books out there do a great job in helping you learn Ruby on Rails. I hope this little tidbit has helped out someone else. If not, no worries. It was helpful for me to write this down.

I don’t write on here enough.

Recently here at LCCC we had a professional development keynote address by Connie Wisdo of the University of Scranton. She is in charge of technology there, including Internet2. She had given an address at a NEPLA meeting last June on Internet2 and I was hooked. So for the last few months I’ve worked at getting it here at LCCC. Our dean has approved me writing up a proposal for the college to review and hopefully approve.

Internet2 is a fascinating new thing. Begun in 1996 when the original Internet went commercial, it has increased in users, now up to fifty some odd thousand. Internet2 runs on a different wire, with much faster speeds and is closed to commercial use. Its main use has been for research and education. Unlike the progression of the original Internet, Internet2 is signing on everyone they can from K-20 schools to research companies to even Google (though I don’t know what they are doing with Internet2). In any case, as their website can probably show you, there is a whole new world of possibilities opened up with the capabilities of downloading, for example, an entire DVD movie in just six seconds. Now THAT’S FAST!

So, in any case, I, as the electronic resource librarian, have pressed for Internet2 here at LCCC. But as I’ve been doing this, I’ve been stuck on one question. How can libraries take advantage of Internet2? How can libraries be ahead of the game in this instance, instead of stuck behind, as we are now in relation to Google? What can libraries do to participate and be involved in, and be movers of Internet2?

I’ve got to think on that question some more. But I do think libraries need to jump on this quickly if they wish to stay ahead of the game for once.