Tag Archives: Geek

Domain names that answer a question

I just stumbled on this phenomenon the other day. Does anyone know of more?

Be sure and view the page source for some of them – lots of goodies in there.

UPDATE: Here’s my entry: http://AmIReallyAwesome.com

How to get Rails to talk to Oracle

How to get Rails working on Windows with a pre-existing oracle DB…..

I wanted to try and hookup Rails to our existing oracle DB at work. I had a rough time figuring this out, so here it is in case anyone else wants/needs it. In my case, I did not (nor did I want to) have a full Oracle client installed on my Windows box. trying to get this to work was not easy. I found 5 or 6 different pages that told different ways to get it to work, but none worked for me.

Most of this info was compiled from Oracle’s Rails FAQ and a few other pages on the net. These instructions assume you don’t have the Oracle client installed already. If you do, some of these steps may not be necessary(1, 3, 4)

  1. if you don’t have the Oracle client installed already, install the Oracle Instant Client (I installed the Basic, Lite version) – this zip contains some DLLs and jars. Extract them somewhere and note the location. Let’s call it [ORACLE_CLIENT_DIR]
  2. install the Oracle driver for Rails (I’m assuming you already have Rails installed). Details here.
  3. create a tnsnames.ora file in [ORACLE_CLIENT_DIR]/network/admin/. Put the text below in the file. Replace host, port, SID, and name (first line – MYORACLEDB in the example below) as necessary. If the DB uses a service_name instead of SID, replace SID in the file with SERVICE_NAME.

    MYORACLEDB =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = some.server.com)(PORT = 1521))
    )
    (CONNECT_DATA =
    (SID = mysidinfo)
    )
    )
  4. create Windows environment variables like so:
    ORACLE_HOME = [ORACLE_CLIENT_DIR]
    TNS_ADMIN = [ORACLE_CLIENT_DIR]/network/admin
    you can create these globally in Windows or just set them up before running the server each time
  5. setup the database connection in your app as shown here, but replace
    host: ORCL
    with the name you used in your tnsnames.ora file (MYORACLEDB was used in the example above)

  6. if you are connecting to an existing DB that did not follow the standard pluralization conventions Rails likes (i.e. your table names are not pluralized), you need to tell Rails not to do pluralization (which it does by default). Open [yourapp]\config\environment.rb and put this at the bottom of the file:
    ActiveRecord::Base.pluralize_table_names = false

That’s it! Now, you can generate models, controllers, etc. and they should hookup to your Oracle DB as you would expect. Hopefully I didn’t miss any steps. I wrote this after I had it working, not while I was trying to get it working. If you are in a similar situation and these steps don’t work, feel free to leave a comment and I’ll see if I can help.

I google everything

At the time I write this, there are only 150 hits (on Google of course) for the phrase “I Google Everything”. Hey Google! How about some bumper stickers and/or T-shirts that say this? If you do it, can I get one of each free for thinking of it? Email me for my mailing address.

What self-respecting geek doesn’t google everything? Three real examples from today: Want to find out what that icon is/does on your cell phone display? Google it. What’s the wattage of your microwave? Google it. How does a DOMParser handle CDATA? Google it.