shared items

Friday, October 30, 2009

Google charts ( Charts, Maps, ...)

The Google Chart API lets you dynamically generate charts. To see the Chart API in action, open up a browser window and copy the following URL into the address bar: http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World
Press the Enter or Return key and - presto! - you should see the following image:
Yellow pie chart

http://code.google.com/apis/chart/

Friday, October 23, 2009

Win32::Service::Error: Access is denied.

Win32 access denied

Rob Stiff
Tue, 19 Aug 2008 07:27:31 -0700

Rob Stiff wrote:
> Using the Win32 HOWTO information, I am attempting to start the service.
> upon the service::install command, I receiving the error 'Access is
> denied. (Win32::ServiceError).
>
> The error is occurring in line 146 of init.rb
>
> Version Information:
> Ruby 1.8.6
> Rails 1.2.0
> Gem 1.2.0
> Win32-Service 0.5.2
> Mongrel_service 0.3.4
> OS - Windows Vista
>
> There is a newer version of Win32 available (0.6.1), but this version is
> incompatible with mongrel_service and issues a version error.
>
> Thanks in advance!

SOLVED.
The issue was with Windows Vista. You must always run the command line
by right-clicking and using the "Run as Administrator" option.

Wednesday, October 21, 2009

classic pagination in Rails

Action Pack pagination for Active Record collections

DEPRECATION WARNING: Pagination will be moved to a plugin in Rails 2.0. Install the classic_pagination plugin for forward compatibility:

script/plugin install svn://errtheblog.com/svn/plugins/classic_pagination

The Pagination module aids in the process of paging large collections of Active Record objects. It offers macro-style automatic fetching of your model for multiple views, or explicit fetching for single actions. And if the magic isn‘t flexible enough for your needs, you can create your own paginators with a minimal amount of code.

The Pagination module can handle as much or as little as you wish. In the controller, have it automatically query your model for pagination; or, if you prefer, create Paginator objects yourself.

Pagination is included automatically for all controllers.

For help rendering pagination links, see ActionView::Helpers::PaginationHelper.
Automatic pagination for every action in a controller

class PersonController < ApplicationController
model :person

paginate :people, :order => 'last_name, first_name',
:per_page => 20

# ...
end


Source : http://api.rubyonrails.org/classes/ActionController/Pagination.html

reverse_proxy

Install via Subversion using the Ruby script/plugin install command. In the root of your Rails application structure
(where you can see the app/ vendor/ and public/ folders)
execute the following command:

ruby script/plugin install http://svn.napcsweb.com/public/reverse_proxy_fix

You will be prompted by the script to specify the version of Rails you're using. Select
the version that best matches your version of Rails and press the Enter key.
You should be prompted to enter the base url of your front-end server when you install
the plugin via script/plugin install. You should not include the trailing slash! For
example:

http://www.mydomain.com/typo

If that doesn't work for some reason, you can run the install.rb script in

vendor/plugins/reverse_proxy_fix

Or you can manually edit the file lib/config.rb and uncomment the BASE_URL line. (It should be the only line in the file. Enter the desired base url
that you would like the plugin to prepend to any generated URLs.


Source : http://www.napcsweb.com/rdoc/reverse_proxy_fix/index.html

Sunday, October 18, 2009

View Your Google Calendar in Outlook 2007

Google Calendar is a phenomenal web application for managing your calendars, but so many of us are still forced to use Outlook at work. The good thing is you can have the best of both worlds by subscribing to your Google Calendar from Outlook.

The first thing you’ll have to do is get your Google Calendar iCal link. Just open your Google Calendar and go to Settings \ Calendar.

Pick the calendar you want to sync with Outlook. Now in the Private Address field click on the ICAL button. This will show you your private Calendar address. Copy this address to the clipboard.

Thursday, October 8, 2009

Installing Ruby 1.8.7 (and other stuff) manually

1. Download the windows binaries for Ruby 1.8.7 here: http://www.ruby-lang.org/en/downloads/ extract that to wherever you would like, I use c:\ruby. Then put c:\ruby\bin in your PATH environment variable.
2. Download the zlib package: http://www.zlib.net/zlib123-dll.zip and extract the zlib1.dll, rename it to zlib.dll and move it into your Windows\System32.
3. Download the iconv package: http://sourceforge.net/project/showfiles.php?group_id=25167&package_id=51458. Find and extract the iconv.dll into your Windows\System32.
4. Download the rubygems package and follow the instructions, basically extracting the package and running ruby setup.rb
5. Verify that everything works properly by trying a gem install rails, once that installs then do: rails test_project



http://stackoverflow.com/questions/390897/installing-ruby-1-8-7-and-other-stuff-manually

Ruby 1.8 missing lib ( SSLEAY.dll , ZLIB.dll)

Update: There is a new effort to create a decent Windows Ruby installer. You can get the new downloadable installers from http://rubyinstaller.org/downloads/ though as of August 2009 these are still in preview form. It seems from my brief experiment that you'll still have to set your PATH manually, as per my manual instructions below. This installer also promises a faster Ruby as it builds using superior tools, so might well be worthwhile if only for that. Below are my original manual instructions for installing Ruby on Windows, which should still be just as valid as they always were. The installer is probably worth a look though.

The following worked for me on Windows XP, but maybe I'm yet to run into problems I don't know I've got:

* Download the Windows binary release from http://www.ruby-lang.org/en/downloads/
* Unzip it, in my case to C:\ruby191\
* Also download readline.dll (e.g. from http://www.econsultant.com/dll-database-r/readline.dll-download.html) and put the DLL in C:\ruby191\bin
* Put C:\ruby191\bin and C:\ruby191\lib on your PATH

That got ruby working in a basic sense for me, but I wasn't able to install gems. If I tried, I got two errors in sequence: "The ordinal 277 could not be located in the dynamic link library SSLEAY32.dll" and "This application has failed to start because zlib.dll was not found."


The ssleay32.dll problem was solved by getting hold of a couple of DLLs and putting them in the right place, as follows:

* Download "Win32 OpenSSL v0.9.8k Light" from http://www.slproweb.com/products/Win32OpenSSL.html.
* Run the installer, but take note of the following:
* You can ignore any initial warning about not having Microsoft Visual C++ 2008 Redistributables.
* You can ignore any warnings about command prompts being open.
* Install to somewhere like C:\OpenSSL - it doesn't really matter, we just need a couple of DLLs.
* When prompted, choose to Copy OpenSSL DLLS to The OpenSSL binaries (/bin) directory.
* Once the installer has completed, you can go to C:\OpenSSL\bin (or wherever you installed it) and copy the two files ssleay32.dll and libeay32.dll to your Ruby bin directory, C:\ruby191\bin in my case.

The zlib.dll problem was solved by in much the same way:

* Download the compiled zlib 1.2.3 DLL from http://www.zlib.net/ (about two thirds of the way down the page).
* Unzip it to get the zlib1.dll file.
* Put that file in your Ruby bin directory, but rename it to zlib.dll

Et voila - gems can now be installed successfully! Note that you may have had copies of some of these DLLs in your \WINDOWS\system32 directory already (I certainly did) but the problem is that they are too old. I prefer to put the newer ones directly in the Ruby bin directory, so only Ruby picks them up and it can't break anything else on the system.

http://alwaysthecritic.typepad.com/atc/2009/03/install-ruby-191-on-windows.html