Friday, February 25, 2011

Trouble Installing Driver in Windows 7 for Network Printer

Recently I was asked to prep a new Windows 7 machine for a client. One of the things I had to do was get their Oki Data ML 390 Turbo setup on the new machine. The oki was on the network. I searched and searched for a driver for the oki, and all I found kept telling me that Windows 7 supported the printer out of the box. But it sure was not finding a driver for it when I tried to create the network printer. Finally I hit upon a formula that worked:

  1. Add the printer as if it were local. Windows 7 let me create the printer even though it was not currently connected to the machine.
  2. Go into the properties of the printer and change the port name to the network name of the printer, like: s:\\myserver\\okidata.
That was it. It should not have been so difficult, but Windows 7, while under the hood it's pretty much the same as Windows has been for years, did not want to do it any other way.

Permissions in Windows 7

If you're a Windows 7 user and you find Windows denying you access to modify files on your very own machine -- the machine for which you should have all permissions that you want -- just run whatever it is you want to run in administrator mode. If, for example, you want to edit the "hosts" file found in windows\system32\drivers\etc, choose your favorite editor, but instead of left clicking to start it, right click on the icon and choose "Run as Administrator." You'll be asked to confirm this decision and just say yes. You're on your way.

Recovering a Deleted Blog

If you're a blogspot user and delete one of your blogs, it will be available to recover for up to 90 days. To un-delete it, go to your Dashboard under the manage blog section and choose "Show All." This will blogs you recently deleted and there will be a link titled "undelete this blog."

Saturday, February 19, 2011

Adding Tables to an Existing Rails Application

I've developed some new features for an existing Rails Application. It's working in my development environment on my development machine. I'm not using any fancy tools to deploy to the production server. I simply shut the application down and re-install all application files. When I wanted to run the last two data migrations to install the new e-mail group tables, I ran something like:

rake db:migrate RAILS_ENV=production VERSION=20110113091119_create_email_groups

But this results in the error: rake aborted! Multiple migrations have the name CreateSessions


So, I had to learn more about rake. I know I don't want to run "rake db:schema:load". That would get rid of all existing data. I'm still unclear what the ideal rails-guru blessed right way to do it is. But I do see one way I can do it:

  1. Run "rake db:structure:dump" from an existing instance that has the tables I'm looking for. This creates a .sql file containing various create statements to create the tables, indexes, etc. for my application.
  2. I can take that file, make a copy of it, edit it such that all that's left are the create statements I need to add the two new tables to my production system. Let's say I name it: email_groups.sql and place it in my app's db directory.
  3. Then I can run something like this (my database is MySQL): cat db/email_groups.sql|mysql -h localhost -u my_db_user -pmy_db_password -D my_database_name
If anyone cares to comment and enlighten me on the better or proper way to do this, I'd be happy to read your comments.

Monday, February 7, 2011

Salesforce Data Loader Quick Start

Assuming you have some background in Salesforce and you want to start using Salesforce Data Loader quickly, here's what I recommend:

  1. Download Data Loader and install it. Do this by logging into your Salesforce Instance and go to Setup->Data Management->Data Loader and click on "Download the Data Loader." Then install it. (Need your own instance? Go to Developer Force and click on "Join Now" to get your free account and free instance of Salesforce.)
  2. Read through the Data Loader Developer's Guide. ** This is not a long document as tech documents go. It won't take you that long to read it. **
  3. Run the Data Loader that you installed in step 1 above and try it out. It's pretty easy to use. Not necessarily convenient, but pretty easy to try some exports and upserts.
  4. Stop here if the Data Loader GUI is all you need.
  5. Check out Informatica Cloud if all you need is a GUI interface to data loader functionality, and don't mind paying for it if you want real functionality for real data.
  6. If you want to run the Data Loader in batch or per schedule, go to CLIq and watch the Video and take it from there.
Tip: If you use CLIq for inserts or upserts, at one point you'll need a field mapping file (a .sdl) file. If you have a complex mapping or lots of fields, you might want to start by running your upsert or insert using the Salesforce Data Loader interactively. In the process you'll map your fields from your CSV file to Salesforce object fields using a drag and drop interface. And you'll end up creating the .sdl mapping file which you can use for the uploads you configure with CLIq.

One other Tip: I see a number of postings related to external ID errors. A common one is: "Error:  exceptionMessage='Field name provided,  does not match an External ID for ..." Just make sure if you are inserting or upserting data with external ids that you have an entry in your process-conf.xml file for the sfdc.externalIdField property. See the  Data Loader Developer's Guide for details.

If you follow these steps it will be relatively simple to get going with data loader. Obviously, you can dig further to become an expert or start rolling your own tools. Here are some other resources for taking this subject deeper:


IE Tab: When Sites Don't Work with Google Chrome

I really like Google Chrome, and I'm not happy when some sites refuse to work because I'm not using Internet Explorer or a version of Firefox. But I'm really happy to have found the "IE Tab" extension for Chrome. Using it, I don't have to leave Chrome to access such web sites. I just click on the "IE Tab" icon, and voila: I'm in. Fabulous. Check it out at: http://www.ietab.net/faq

How it works: when you open a URL in Chrome and get some error message or otherwise see that it does not work in Chrome, you hit the "IE Tab" extension icon. I.E. begins to run for that url within Chrome. At the top of the Chrome window where the web site is now running you'll see your IE url and to the right several icons. The first will take you into IE Tab configuration. The next will add the url to "IE Tab." This means a bookmark will be created for you in a folder called "IE Tab" on your "bookmarks bar" so that next time, you just use that bookmark and you will be taken directly into IE within Chrome so it's a simple one step process.

Saturday, February 5, 2011

Kindle Search Made Easy

Here's something I read about this week that is really handy. First of all, searching your current book, all your books, or the web with the Kindle 3 is easy and useful. You can do this wherever you are just by typing a word or words and use the dialog that comes up to search wherever you choose. The default will usually be the current book you're reading. But here's a trick: use the 5-way button to move your cursor to some term in the book you're reading you want to search for, press the center of the 5-way button, move the cursor to highlight any number of words or sentences, then, and here's the key, HIT THE SPACEBAR. That will move all text you've highlighted into the search box and then you can search for those words wherever you want. That's much easier than typing the words yourself.

And you might want to check out some kindle blogs too, like http://kindleworld.blogspot.com/

Rails ActionMailer: SMTP Settings on the Fly

Most of the information I had found for configuring the Rails ActionMailer was static: set in environment.rb at the time the web application starts up. But what if we need to change that on the fly? What if, for example, the smtp settings are governed by a preferences file and the user updates the preferences. Not an issue, once you find where this stuff is stored. Let's start with lines that are typically found in your environment.rb file:

#-----------------------------
Rails::Initializer.run do |config|

  config.action_mailer.smtp_settings = {
    :enable_starttls_auto => true,
    :address => 'smtp.gmail.com',
    :port => 587,
    :domain => "gmail.com" ,
    :authentication => :login,
    :user_name => 'my_gmail@gmail.com',
    :password => 'my_password',
  }
end
#-----------------------------

Of course if you were getting that from some preferences file, you'd not be hard coding the e-mail address and password. That's something you can easily change. But now for the answer to our problem: where are the smtp settings stored? How can you get at them to change them at runtime?

You'll find them in ActionMailer::Base.smtp_settings. So you can do things like:

ActionMailer::Base.smtp_settings[:user_name] = my_new_email

ActionMailer::Base.smtp_settings[:user_name] = my_new_password

That's it. It's that simple, though it was not that simple to dig this up.