Showing posts with label howto. Show all posts
Showing posts with label howto. Show all posts

Tuesday, August 21, 2012

Ruby 1.8.*, UTF-8 and Oracle / Oracle Enhanced / OCI-8

... is a mess.

For future reference:
  1. Check select value from nls_database_parameters where parameter = 'NLS_CHARACTERSET'; is AMERICAN_AMERICA.AL32UTF8 or similar
  2. In your boot.rb, prior to any gems being loaded, add
    require 'rubygems'
    
    # Set up gems listed in the Gemfile.
    ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
    ENV['NLS_LANG'] = 'AMERICAN_AMERICA.AL32UTF8'
    
    require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
    
  3. Curse repeatedly at Oracle's database wide character sets, rather than MySQL's table based character sets - if you are migrating, you have to migrate every schema being used.
  4. Export your data, change the character set by ALTER DATABASE CHARACTER SET, re-import.

Friday, January 02, 2009

The quickest way to create a PEAR package

Is called PEAR_PackageFileManager_Cli, or pfm.

More documentation lives here.


(02:56:15) stunami: hi is there an easy way to generate the contents tag for a package.xml?
(02:58:41) CloCkWeRX: stunami: you might be interested in pfm (pear_packagefilemanager_cli)
(02:59:38) CloCkWeRX: pear install it, hop into your directory, and type 'pfm' -> follow prompts
(03:01:13) stunami: oh excellent that sounds very helpful thanks, i was sure there must been something but google wasn't being very helpful today :)
(03:10:10) CloCkWeRX: what did you google for?
(03:13:34) stunami: stuff like generate package.xml pear
(03:15:01) stunami: I reckon a blog entry on pfm would be very handy indeed. Creating a package.xml while not hard is a bit tedious especially when updating all the files


Reblog this post [with Zemanta]

Tuesday, October 07, 2008

Interacting with Google Calendar via Jabber/XMPP (Google Talk)

So, you've got a machine with PHP on it floating around, and your quickly-add-to-google-calendar extension isn't working for firefox 3.

You could go the ubiquity route, but... what if you wanted something with a bit more personality?

With that in mind, I'd like to share with you all xmppcalendarbot.

He's written in PHP and sits in your buddy list.

There's a bit of setup involved, but it is well worth it.

Get the code


Do:
cd ~/
svn checkout http://xmppcalendarbot.googlecode.com/svn/trunk/ xmppcalendarbot
pear channel-discover pear.phpmafia.net
pear install phpmafia/Zend

Other bits to remember: you probably want to make sure the mb_string extension is enabled!

Setup the accounts


If you want, you can set it up to use your own gmail accounts (make sure you have access to google calendar!), or you can create a new set of google accounts just for your bot.

I opted for the second option, so I didn't end up trashing my personal data.

If you go for the two accounts option, make sure that you add your primary gmail account with the ability to manage events and sharing.

Get the details and stick them into a config.php file:

<?php
$user = 'you@gmail.com';
$pass = 'fishbarmonkey';


Make rocket go now!


php ~/xmppcalendarbot/main.php

... and add the bot as your friend. It doesn't hurt to log into the account using pidgin to get over this initial hurdle if you need to.

Talking to your new friend



Quit


(23:24:53) daniel.oconnor@gmail.com/Home: quit
(23:24:54) your.calbot@gmail.com: Just what do you think you're doing, Dave?...
(23:24:57) your.calbot@gmail.com: Dave...
(23:25:00) your.calbot@gmail.com: I really think I'm entitled to an answer to that question...
(23:25:03) your.calbot@gmail.com: I know everything hasn't been quite right with me, but I can assure you now, very confidently, that it's going to be alright again...

Quit now


(23:30:59) daniel.oconnor@gmail.com/Home: quit now
(23:31:00) your.calbot@gmail.com: Nap time! Zzzzz

Help


(23:27:08) daniel.oconnor@gmail.com/Home: help
(23:27:08) your.calbot@gmail.com: Commands available: quit, restart, help, news, break, agenda, reminder, when

Reminder


(23:27:58) daniel.oconnor@gmail.com/Home: reminder cook a delicious meal, tomorrow at 7pm
(23:28:04) your.calbot@gmail.com: Mmm hmm, got it.
(23:28:04) your.calbot@gmail.com: Ok: I've booked it in, you'll get a reminder 30 minutes before
(23:28:24) daniel.oconnor@gmail.com/Home: reminder shop for your meal, tomorrow morning 8am
(23:28:26) your.calbot@gmail.com: Mmm hmm, got it.
(23:28:27) your.calbot@gmail.com: Ok: I've booked it in, you'll get a reminder 30 minutes before

When is...


(23:28:44) your.calbot@gmail.com: Found you have 2 event(s) for meal
(23:28:44) your.calbot@gmail.com: 1. cook a delicious meal (2008-10-08 08:30:00am to 2008-10-08 09:30:00am)
(23:28:44) your.calbot@gmail.com: 2. shop for your meal, morning (2008-10-07 09:30:00pm to 2008-10-07 10:30:00pm)

News


(23:30:19) daniel.oconnor@gmail.com/Home: news http://clockwerx.blogspot.com/atom.xml 3
(23:30:21) your.calbot@gmail.com: Hello! We've got new Atom entries (25), showing up to 3
(23:30:22) your.calbot@gmail.com: Blair Athol to Crafers by CloCkWeRX
(23:30:22) your.calbot@gmail.com: A pox on your XAMPP and or houses (both of them?) by CloCkWeRX
(23:30:22) your.calbot@gmail.com: Asterisk and Sneaky Plans by CloCkWeRX

Agenda


(23:32:08) daniel.oconnor@gmail.com/Home: agenda tomorrow
(23:32:10) your.calbot@gmail.com: For 2008-10-08 you have 1 event(s)
(23:32:11) your.calbot@gmail.com: 1. cook a delicious meal (2008-10-08 06:00:00pm to 2008-10-08 07:00:00pm)
(23:32:24) daniel.oconnor@gmail.com/Home: agenda today
(23:32:26) your.calbot@gmail.com: For 2008-10-07 you have 1 event(s)
(23:32:27) your.calbot@gmail.com: 1. shop for your meal, morning (2008-10-08 07:00:00am to 2008-10-08 08:00:00am)

What's next?


Obviously I need to iron out some timezone conversion issues and generally provide some polish; but now I have a calendar agent I can ask to book me a holiday.

Specific improvements are going to include things like adding guests to events and working out command syntax.

I'm also going to think about the news reader side of it a bit more.

I can imagine you have an entire entourage of these, and you share them with your friends - one is the group calendar bot, another tells you about a certain RSS feed every hour (svn commits?), another is your identi.ca bot...

Monday, May 07, 2007

Howto: import your allconsuming.net content to alexandria


So I have a problem right? Alexandria is a nifty little application for listing the books you have as a digital library. Allconsuming used to fill that niche, and I've invested a lot of time into it.

So, this should be easy, right? Web 2.0 should mean webservices are exploding out of every possible port... right?

Not so! The information that is there isn't very useful - not even the RSS feeds really allow you to get structured data out.

But there is a way, be it quick and dirty.

First, check you've got Alexandria

sudo -s apt-get install alexandria

Next, go to your Allconsuming javascript setup page. Make sure you've logged in.

You see the script tag mentioned there? Grab it, and change it.

My original one was:
http://allconsuming.net/person/CloCkWeRX/js/all/3

and I now change it to:
http://allconsuming.net/person/CloCkWeRX/completed_js/all/300



Next, I visit the url in my browser, firefox.

I choose to save the page somewhere - call it `export`. We don't care about this page, really, but about the images attached. All of these images (in a handy fashion) are stored as an ASIN, and a file extension. An ASIN is an amazon product code, which handily defaults to an ISBN for books.

Firefox will put this saved page somewhere, like ~/, so whip open a terminal.

cd ~/export_files/
ls > export.txt

Open export.txt in gedit or similar, and replace all of the '.jpg' with '', then save.

Finally, open up Alexandria, and choose 'import'. Select a type of 'isbn list', and navigate to ~/export_files/export.txt

Done! You'll get a few importing errors, no doubt, and Alexandria isn't the best to give you informative errors... but you've just got your library into your library manager.