Codan The Librarian

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

Advertisements

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.

While it is understandable that Microsoft and Internet Explorer bear the brunt of hacker attacks, this report about how bad 2006 was for IE is unacceptable for the world’s most used browser.

Criminals specializing in Internet fraud continued to ply much of their trade with the aid of security flaws in the Microsoft browser last year. In 2006, the company issued patches to fix a total of four “zero-day” flaws in IE. Zero-day (or 0day) attacks are so named because software vendors have no time to develop a fix for the flaws before they are exploited by cyber crooks for financial or personal gain.

The first major flaw in a Windows program last year involved one that could be easily exploited via Internet Explorer. In late December 2005, experts tracked organized criminals hacking into sites and seeding them with code that installed password-stealing spyware on machines used by anyone who merely visited the sites with IE. Microsoft initially downplayed the severity of the attacks, until it became clear that the threat was fairly widespread and that thousands of customers had already been attacked in the span of a few days. The threat was seen as so severe that a large number of security experts urged users to download and install a patch produced by a third party until Microsoft developed an official fix.

How easy could it be for a pornographic site to install some special adware that enters someone’s PC and suddenly pop up crude pictures on a person’s screen. A friend of mine relayed that she spent some time on Toyota’s site, looking at a video of one of their trucks, when suddenly pornographic images popped on her screen. Certainly Toyota is not a company to hide pornography on their website. She was using Internet Explorer, though.

As the electronic resource librarian at LCCC, I spend most of my day on the internet. Using Firefox, I’ve never once had a problem on my computer, no adware concerns, and no sudden porn flying on my screen. I’m sure with more use, even Firefox will be attacked, but their code and their support seems far stronger than Microsoft’s. Microsoft is what it is due to its success at copying others. Who came up with a window version of an operating system? Certainly not Microsoft, and Microsoft’s first Windows attempt was horrendous, (though I guess the same can be said for most of their OS’s until XP, which is pretty decent).

In any case, I hope more and more PC users get educated on the Internet, and what is the better product. Not only does IE have a lot of security flaws, but it also tends to lag far behind on Internet and web design standards. How many times does a web designer have to add a special code in CSS to cover for IE’s lag?

You get lazy when you’re on top, Mr. Gates. Have you not learned this from history?

Two articles recently on some issues libraries are dealing with, mostly public libraries.

Lock the Library!

Many public libraries are experiencing a huge influx of middle school students who really have no place else to go after school. I saw this at Queens Public Library in New York City. The Central Library would be overrun with students just hanging out, some acting pretty childish, while some were actually using the library. Queens Library had strong security presence, which I think did a good job at keeping the rowdiness down. Over in Maplewood, New Jersey, though, they are apparently having a really tough time with these kids:

Others, library officials say, fight, urinate on the bathroom floor, scrawl graffiti on the walls, talk back to librarians or refuse to leave when asked. One recently threatened to burn down the branch library. Librarians call the police, sometimes twice a day.

As a result, starting on Jan. 16, the Maplewood Memorial Library will be closing its two buildings on weekdays from 2:45 to 5 p.m., until further notice.

An institution that, like many nationwide, strives to attract young people, even offering beading and cartooning classes, will soon be shutting them out, along with the rest of the public, at one of the busiest parts of its day.

Library employees will still be on the job, working at tasks like paperwork, filing, and answering calls and online questions.

“They almost knocked me down, and they run in and out,” said Lila Silverman, a Maplewood resident who takes her grandchildren to the library’s children’s room but called the front of the library “a disaster area” after school. “I do try to avoid those hours.”

I wonder where these kids are going to go now though. I’d be curious to see the results of this action.

And on another front….

Hello Grisham – So Long, Hemingway?

You can’t find “Abraham Lincoln: His Speeches and Writings” at the Pohick Regional Library anymore. Or “The Education of Henry Adams” at Sherwood Regional. Want Emily Dickinson’s “Final Harvest”? Don’t look to the Kingstowne branch.

It’s not that the books are checked out. They’re just gone. No one was reading them, so librarians took them off the shelves and dumped them.

Along with those classics, thousands of novels and nonfiction works have been eliminated from the Fairfax County collection after a new computer software program showed that no one had checked them out in at least 24 months.

Public libraries have always weeded out old or unpopular books to make way for newer titles. But the region’s largest library system is taking turnover to a new level.

Like Borders and Barnes & Noble, Fairfax is responding aggressively to market preferences, calculating the system’s return on its investment by each foot of space on the library shelves — and figuring out which products will generate the biggest buzz. So books that people actually want are easy to find, but many books that no one is reading are gone — even if they are classics.

“We’re being very ruthless,” said Sam Clay, director of the 21-branch system since 1982. “A book is not forever. If you have 40 feet of shelf space taken up by books on tulips and you find that only one is checked out, that’s a cost.”

This is a challenge for all libraries. The irony of our modern world is that some thought the rise of computers would push books out of the picture, but instead, we’ve probably published more books in these past ten years than in the previous ten years. Libraries have limited space, because they have limited budgets. Libraries are not a profitable institution. But the way they can get more money from public financing is if they prove a higher readership. How can you have a higher readership with books no one reads in a two year period?

I wonder if libraries should go for-profit….

CHMOD

Posted on: November 23, 2006

I don’t know about you but I’ve just had a hell of a time trying to figure out just what chmod is and how it works. Not being as familiar with Unix language, using the Terminal to figure things out has been very much trial and error. I do google searches for various things and find forums galore where others also ask similar questions. I’ve not been satisfied with some of the answers, because they tend to also use coded language. The thing is, which I just discovered, in Mac OS X, you can change the mode (chmod = change mode), i.e. the permission particular users have for anything and everything that is window-accessible. You don’t have to go into the Terminal and try and figure out the language, nor the particular code numbers. (Like if you type in the Terminal sudo chmod 755 “the particular file” that means something to the effect that everybody can read that particular file but only the owner can alter the file.

But you know what, God bless the designers of OS X. They’ve made it so that you can do this without having to type a whole bunch of this and that. Curse them for not making it absolutely clear you can do this though! What you can do is right click on any file or folder and select “Get Info.” This section has information for you about the particular file or folder. You can see a whole bunch of things, including at the bottom “Ownership and Permissions,” right there, blatantly available for you to alter at your command! And in code you can understand. Instead of trying to remember what 755 stands for or 644, you can look here and see that you, as the owner of that file can “Read and Write” — i.e. read the file, open it, and alter the contents of the file. You see the next section for Group. If you click on the name under Group, you see that there are numerous different groups that can possibly access your particular file. These groups seem to be local, i.e. on the computer or network. Then it shows what access they have. They can either “Read and Write,” “Read only” or “No access.” Ah, the simplicity! Finally is a user called “Others.” This is anybody else that has access to this file or folder on your computer. Normally for this user, you would keep it at “Read Only,” because frankly you don’t want others to change things on your computer without your knowledge.

It gets better. If you have a website and you host it remotely, you can do the same with your FTP software. I use Cyberduck, and it has a function, (also through right-clicking), where you can change the user permissions for any file or folder on your website hosted remotely. They take it one step further to show you the Unix code numbers for each setting. So you can understand what chmod 644 stands for.

But seriously, I think computer geeks get just a little too esoteric sometimes, when a simpler way is available. Not everything has to be done through command lines in the Terminal. Plus, it would be nice if installation programs would not just tell you to chmod something with the assumption that you know what chmod means. We’re not all computer geeks yet. 😉

Over the weekend I struggled long and hard trying to figure out just how to make PHP and MySQL work on my computer. I pored over two books I had on the subject, and zillions of relevant websites. Finally I figured out that Unix lingo on the Terminal and some PHP on Dreamweaver. I’m trying to learn these two very lucrative languages. There is much money to be made with such knowledge. Well, I spent so much time on them that both these past two nights, I dreamt about PHP and MySQL. I distinctively remember dreaming about the various codes jumping off the page with my mind saying, “yes this will work. This will make it work, if you go like this and this and this.” I love that my mind, my subconscious takes control at night to try and figure out what I can’t during the day. But it’s also a bit disturbing. Who else dreams about computer programming code?!?!?!