<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
   <channel>
      <title>[Brain dump] / old</title>
      <link>http://brainplugins.com/blog/</link>
      <description>Cocoa, The Web and The Brain Plugins</description>
      <language>en</language>
      <copyright>Copyright 2007</copyright>
      <lastBuildDate>Sat, 27 Oct 2007 22:35:48 -0600</lastBuildDate>
      <generator>http://www.sixapart.com/movabletype/</generator>
      <docs>http://blogs.law.harvard.edu/tech/rss</docs> 

      
      <item>
         <title>Postgres database connection pools in Seaside, part 2.</title>
         <description><![CDATA[Postgres database connection pools in Seaside
===================

Part 2. Configurations
--------------

Using <a href="http://rubyonrails.com">Rails</a> you have several places to include <a href="http://wiki.rubyonrails.com/rails/pages/Howtos">configuration</a> code for your application, you use database.yml, config.rb, environment.rb, environments/development.rb, environment/production.rb, etc. In those files you can set variables that your application code will use, execute code and basically, anything you need in order to provide the required parameters to your application.

If you use <a href="http://www.djangoproject.com/">Django</a> you have a <a href="http://www.djangoproject.com/documentation/settings/">settings file</a> for your all your configuration needs.

<a href="http://seaside.st">Seaside</a> is no exception, it provides a very powerful, flexible and versatile <a href="http://www.seaside.st/documentation/Configuration%20and%20Preferences">mechanism</a> to configure a web application.

A Seaside configuration class provides more than just a set of keyed values, it defines the type of the values and it can provide a list of options that an administrator can change through the administrative interface of Seaside, it also provides some kind of 'inheritance'.

Before getting into database connections with its user, password and other parameters, I will use a configuration class for those parameters. For an introduction about configurations you should read the following pages:

1. [Configuration and Preferences](http://www.seaside.st/seaside/documentation/Configuration%20and%20Preferences)
2. David Shaffer's tutorial: [Custom application configuration parameters](http://www.shaffer-consulting.com/david/Seaside/Configurations/index.html).


Now back to our business. We will use a configuration class for all the required Glorp parameters:

	WASystemConfiguration subclass: #GlorpSessionConfiguration
		instanceVariableNames: ''
		classVariableNames: ''
		poolDictionaries: ''
		category: 'LearnGlorpSession'

With the these methods:

	ancestors
		^ Array with: WASessionConfiguration new

	attributes
		^ Array
			with: (WAStringAttribute key: #sessionClass) 
			with: (WAStringAttribute key: #glorpServer group:#database)
			with: (WAStringAttribute key: #database group:#database)
			with: (WAStringAttribute key: #glorpUserName group:#database)
			with: (WAStringAttribute key: #glorpPassword group:#database)

	glorpDatabase
		^'You need to provide a database'

	glorpPassword
		^''

	glorpServer
		^'localhost'

	glorpUserName
		^'postgres'

	sessionClass
		^MyPostgresSession

	sessionClasses
		^MyPostgresSession withAllSubclasses


I will assume you don't have a Seaside root component yet so let's write one:

	WAComponent subclass: #GlorpExampleComponent
		instanceVariableNames: ''
		classVariableNames: ''
		poolDictionaries: ''
		category: 'GlorpExample'

	renderContentOn: html
		html text: 'Glorp example'

And with a class method:

	canBeRoot
		^ true

( You can read more about the root component [here](http://www.swa.hpi.uni-potsdam.de/seaside/tutorial) )

Then load this url in your browser (using the port you told SSKom to use): [http://localhost:9091/seaside/config](http://localhost:9091/seaside/config) and enter the user and password ( defaults: admin/seaside ).

Under "Add entry point" define a name for our testing application, for the example I will use: glorpexample. Then select the Root component from the combo 'GlorpExampleComponent'.

And now, pay attention to the options provided in the combo list named 'Ancestry'. Your configuration class is listed there! Select it and click the Add button.

Now save the changes.

**What do we have so far?** 

We have a Seaside application with our configuration class that provides a custom Seaside session that provides a pool of connections to PostgreSQL.

If you load again the configuration page for our glorpexample application you can appreciate a separated section for the database! You can change the field values or revert to the previous ones.

With these, all you need to do now to execute a query using [Glorp](http://www.glorp.org/) is:
	WACurrentSession value execute: query.







]]></description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Seaside</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Smalltalk</category>
        
        
         <pubDate>Sat, 27 Oct 2007 22:35:48 -0600</pubDate>
      </item>
      
      <item>
         <title>Last post, blog path changed</title>
         <description>I am making several changes. From now on, the url for this blog will be [www.brianplugins.com/dump](www.brianplugins.com/dump)</description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
        
         <pubDate>Fri, 19 Oct 2007 00:30:24 -0600</pubDate>
      </item>
      
      <item>
         <title>Postgres database connection pools in Seaside, part 1.</title>
         <description><![CDATA[Installation
===================


1. I will use Ramón León's [Squeak image](http://onsmalltalk.com/my-squeak-image/). It has a customized UI, much better than the default Squeak interface and comes with all we need ( Postgres access, [Glorp](http://www.glorp.org/), Seaside ). 

2. Download and install the corresponding [Squeak](http://squeak.org/) version for that image (check León's page). 

3. Launch the Squeak image. 

4. If you are on OSX change the port change the port SSKom port to some number greater than 1024, like: SSKom startOn: 9091 and execute ('Do it') that line.

Now you have Seaside running from that image and we can begin writing some code.

<img src="http://www.brainplugins.com/dump/images/seasidesskomstart.png" border="0" height="125" width="537" alt="seasidesskomstart.png" align="" />]]></description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Seaside</category>
        
        
         <pubDate>Thu, 18 Oct 2007 22:53:44 -0600</pubDate>
      </item>
      
      <item>
         <title>A message from above</title>
         <description>![Revelation](http://farm3.static.flickr.com/2214/1501949754_f1ef90ae68.jpg)	</description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Everything else</category>
        
        
         <pubDate>Thu, 11 Oct 2007 00:35:21 -0600</pubDate>
      </item>
      
      <item>
         <title>Postgres pools for Seaside using Glorp</title>
         <description><![CDATA[As a complete Smalltalk newbie one of my main concerns about writing a web application for the company I work for using Seaside was how to use database connections in a correct and scalable way.

After writing a couple of configuration pages in Seaside for a current internal application written in Rails a few months ago, I was ready to write something 'real'. Worried about how to get that done, I avoided the risks and kept working at other stuff. 

Well, now I was getting again into the mood to trying it out and found a blog post about using <a href="http://onsmalltalk.com/programming/smalltalk/mapping-seaside-blog-to-postgresql-with-glorp/">Glorp and Seaside</a>. The author, Ramon León, directed me to his MagritteGlorp package that provides connection pooling and integration with the Seaside session management code.

Well, after digging into it for a few hours I got it working and will be posting soon a basic guide/example of how to use it.
]]></description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Seaside</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Smalltalk</category>
        
        
         <pubDate>Wed, 10 Oct 2007 18:44:51 -0600</pubDate>
      </item>
      
      <item>
         <title>Why online if it can work offline?</title>
         <description>I have lost count of how many times in the last 12 months Costa Rica have been experiencing problems with the international links.

Today we are experiencing slowness again, which makes me think about the risks of relying too much on online services like Gmail and 37 Signals products, just to mention a couple of them.

Web applications are really useful but at least for some of us in this world, we should really think about the risks of having too much important information online and find a way of accessing the data without being connected.

Gmail provides POP access to all your email which at least gives you an alternative that you could frequently use to download your emails to your computer, Yahoo requires a payed account to make that happen. In the case of more sophisticated applications like Basecamp, it could get a little more complicated.

A couple of years ago when I began playing with the idea of coding my own future, I thought about implementing a couple of applications for the web but then I thought a little more about it: if an application can be used locally without requiring online access it should be written in that way. Why force the risks, scaling and security nightmares and many other things present in online applications, just for the sake of it? 

If an application can work offline, that should be the preferred mode.

</description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Applications</category>
        
        
         <pubDate>Tue, 09 Oct 2007 14:42:50 -0600</pubDate>
      </item>
      
      <item>
         <title>One page to rule them all</title>
         <description><![CDATA[After reading <a href="http://daringfireball.net">Daring Fireball</a> last Saturday, his <a href="http://daringfireball.net/linked/2007/september#sat-08-ilounge">entry</a> about the <a href="http://www.ilounge.com/index.php/ipod/review/apple-ipod-classic-80gb-160gb/">iLounge review</a> gave me the idea to explore a script to consolidate multi page reviews/articles into one page.

More than anything is an experiment, but you can try it out <a href="http://brainplugins.com/one.html">here</a>. It tries to determine the changed content and then generated all those nodes after the first page part.

]]></description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Everything else</category>
        
        
         <pubDate>Tue, 11 Sep 2007 17:22:08 -0600</pubDate>
      </item>
      
      <item>
         <title>Adobe store hell</title>
         <description>A few weeks ago after getting approval to buy Adobe Illustrator for some work I need for a website ( and believe it, it was a surprise to get it ), I pointed Safari to the Adobe Online Store, and this is the story:

1. Register an account
2. I added Illustrator (download version) to cart
3. Checkout
4. Credit card validation fails (all information was fine)
5. Two tries just in case I made a mistake, with no success
6. Well, I got a card from another bank and that one fails too (damn it!)
7. &quot;Maybe if a try to order it by phone...&quot;. After 15 minutes on hold (twice) with my home phone line without getting to talk with a person, I tried Skype
8. First try using Skype, twenty five minutes without getting a real person
9. Second try, after forty five minutes on hold I am finally able to talk with someone, but the line noise was so bad that the guy hangs up.
10. At this point I was obviously very, very frustrated. So I talk with my boss, he has some relatives in the US so they tried several times to place the order with their credit cards, and guess what? Validation failed too!
11. Last resort: they are buying the boxed version and they will ship it to us in Costa Rica.

What the hell was that? How could this be possible? I mean, I didn&apos;t try to cracked it although all the people I know that use it, use a cracked version and they don&apos;t even bother with buying the software. 

Why on Earth is their online store so problematic? And come on, 45 minutes on hold? Am I the only one having this wonderful &quot;buying experience&quot;?





</description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
        
         <pubDate>Sat, 05 May 2007 21:01:36 -0600</pubDate>
      </item>
      
      <item>
         <title><![CDATA[EMI Music&rsquo;s catalog...worldwide?]]></title>
         <description><![CDATA[Apple's press release states that "Apple&reg; today announced that EMI Music&rsquo;s entire digital catalog of music will be available for purchase DRM-free (without digital rights management) from the iTunes&reg; Store (www.itunes.com) worldwide in May".

Does "worldwide" includes all America (central and south)?  Or worldwide means here, just the same 22 countries currently active?

<a href="http://www.emusic.com">EMusic</a> is really great, it has allowed me to discover a lot of fantastic artists. However, sometimes you are looking for music (maybe more "mainstream") that is not available there, but it is in iTunes Store...which means not available for the rest of us outside the "privileged" countries supported.

I really, really hope the end of that weird segmentation done by the music companies is near its end. Anyone can buy a CD from Amazon from any country, there is no single reason for those restrictions.]]></description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
        
         <pubDate>Mon, 02 Apr 2007 21:55:45 -0600</pubDate>
      </item>
      
      <item>
         <title>I am back...</title>
         <description>Four months since my last post, time certainly is something we should pay attention to, because it just keeps moving whether we like it or not, whether we ignore it or just pretend it doesn&apos;t affect us.

A lot of things going on right now. I am looking for a new house, a few months ago my wife and I decided to end our marriage, not an easy thing to do but the end has come. 

At my day job I am in the final stage before launching a new product, a web application providing access to the mobile platform in Costa Rica, targeting a specific need for communication of small and large companies.

In the Mac application front, I am working on a freeware application and will be talking a little more about it in the coming weeks. It will help me in my day job projects and hopefully will help other developers too.

The application right now is Tiger only, but once Leopard ships, it will be available only for the new feline.</description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Applications</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Personal</category>
        
        
         <pubDate>Sat, 24 Mar 2007 22:26:51 -0600</pubDate>
      </item>
      
      <item>
         <title>Blog spam, even here!</title>
         <description>In the last six months I have received less than 5 emails from the blogging system to review a post or a trackback and all of them were junk.

This is still a low traffic site, I am still working on a product that I have mentioned only in #macsb a couple of times and I don&apos;t post very frequently because at this point in time I prefer to devote my &quot;free&apos; time to get the product done.

Well, just to see how the &quot;Junk TrackBacks&quot; page looks like in Movable Type I clicked it today and...WHAT?...It&apos;s unbelievable: 3097 junk trackbacks in the last two months! (They were filtered automatically)

I can&apos;t imagine a popular blog with comments, how much time devoted reviewing the posts!</description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Everything else</category>
        
        
         <pubDate>Wed, 22 Nov 2006 22:20:43 -0600</pubDate>
      </item>
      
      <item>
         <title>Hilarious song about gamers...and sex</title>
         <description>A friend sent me this Google Video performance from a group called [Tripod][1]: [Make You Happy Tonight][2]

Have fun!

[1]:http://www.3pod.com.au/ &quot;Tripod&quot;
[2]:http://video.google.com/videoplay?docid=1329362959167995041 &quot;Make You Happy Tonight@Google Video&quot;</description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Everything else</category>
        
        
         <pubDate>Fri, 27 Oct 2006 09:53:29 -0600</pubDate>
      </item>
      
      <item>
         <title>Not dead, but working hard at my day job</title>
         <description>Yes, I am alive but with too much work at my day job. I am at full throttle with a new project involving SMSs and I am developing the application using Python and the [Twisted][2] framework.

In fact, I am implementing the [SMPP][1] protocol with Twisted and at the same time implementing a library with [Twisted][2] for using Amazon S3 and Amazon Queue Service. I hope to release them as open source in the future.

I will resume work for my Mac project in a month after reaching a stable base code in my day job work.

[1]:http://en.wikipedia.org/wiki/SMPP &quot;SMPP protocol&quot;
[2]:http://twistedmatrix.com/ &quot;Twisted framework&quot;</description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Applications</category>
        
        
         <pubDate>Mon, 16 Oct 2006 22:07:08 -0600</pubDate>
      </item>
      
      <item>
         <title>Feynman book, I can&apos;t believe it took me so long to discover it</title>
         <description>I am finishing the book [&quot;Surely you&apos;re joking, Mr. Feynman! (Adventures of a Curious Character)&quot;][1] and what a refreshing and wonderful reading. After all the technical books about programming languages and this or that technology, it is fantastic to enjoy the stories about science and numbers, about the fascinating inner world of our universe from a &quot;curious character&quot;.

The stories make the readers aware of many &quot;ordinary&quot; and every day things from a scientific point of view but also shows the human and normal side of an incredible mind that sometimes we forget by the halo of his achievements.

A few links if you want to learn more about Richard P. Feynman:

1. [A great interview (&quot;The pleasure of finding things out&quot;) at Google Video (49 min 38 sec)][2]
2. [basicfeynman.com][5]
3. [heyfeynman.com][3]
4. [Wikipedia entry][4]


[1]:http://www.amazon.com/gp/product/0393316041/sr=8-1/qid=1155868469/ref=pd_bbs_1/104-5471791-8791125?ie=UTF8 &quot;Amazon link&quot;
[2]:http://video.google.com/videoplay?docid=6586235597476141009 &quot;Google Video&quot;
[3]:http://www.heyfeynman.com/index.php &quot;Photos, videos&quot;
[4]:http://en.wikipedia.org/wiki/Feynman
[5]:http://www.basicfeynman.com/index.html</description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">books</category>
        
        
         <pubDate>Thu, 17 Aug 2006 21:49:58 -0600</pubDate>
      </item>
      
      <item>
         <title>N-grams from Google</title>
         <description>An [entry][1] appeared in my rss reader from Google Labs that got me excited, they are sharing a massive amount of data from their [n-gram][3] models research: 
&gt;&quot;That&apos;s why we decided to share this enormous dataset with everyone. We processed 1,011,582,453,213 words of running text and are publishing the counts for all 1,146,580,664 five-word sequences that appear at least 40 times. There are 13,653,070 unique words, after discarding words that appear less than 200 times. &quot;

That is some data! (available in 6 DVDs) I rushed to the linked [Linguistic Data Consortium][2] and well, end of story for me, they have two subscriptions for commercial members: $20,000(USD)  - $25,000(USD) 


[1]:http://googleresearch.blogspot.com/2006/08/all-our-n-gram-are-belong-to-you.html &quot;All Our N-gram are Belong to You&quot;
[2]:http://www.ldc.upenn.edu/ &quot;LDC&quot;
[3]:http://en.wikipedia.org/wiki/N-gram &quot;n-gram&quot;</description>
         <link>http://brainplugins.com/blog/</link>
         <guid>http://brainplugins.com/blog/</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Resources</category>
        
        
         <pubDate>Wed, 09 Aug 2006 19:47:55 -0600</pubDate>
      </item>
      
   </channel>
</rss>
