<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
    <title>Daysleeper</title>
    
    
    <link rel="alternate" type="text/html" href="http://blogs.inxsasia.com/hemant/" />
    <id>tag:typepad.com,2003:weblog-1272572</id>
    <updated>2007-07-25T10:11:10+00:00</updated>
    <subtitle>and some sleep walking.</subtitle>
    <generator uri="http://www.typepad.com/">TypePad</generator>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/typepad/inxsasia/hemant" /><feedburner:info uri="typepad/inxsasia/hemant" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://hubbub.api.typepad.com/" /><entry>
        <title>Testing Emacs htmlize mode</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/typepad/inxsasia/hemant/~3/9A4phhSbNkQ/testing-emacs-h.html" />
        <link rel="replies" type="text/html" href="http://blogs.inxsasia.com/hemant/2007/07/testing-emacs-h.html" thr:count="2" thr:updated="2010-08-18T23:20:38+00:00" />
        <id>tag:typepad.com,2003:post-36872818</id>
        <published>2007-07-25T10:11:10+00:00</published>
        <updated>2007-07-25T10:11:10+00:00</updated>
        <summary>def receive_data data @tokenizer.extract(data).each do |stock_data| $data_log.info “———- #{stock_data}“ @stock_data = UbacParser.new stock_data if @stock_data.valid_code? dispatch_request else send_error_without_callback “Invalid Protocol code” end end end</summary>
        <author>
            <name>inxsasia</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="emacs" />
        
        
<content type="html" xml:lang="en-US" xml:base="http://blogs.inxsasia.com/hemant/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;pre&gt;&lt;span class="keyword"&gt;&lt;br /&gt; def&lt;/span&gt; &lt;span class="function-name"&gt;receive_data&lt;/span&gt; data&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span class="variable-name"&gt;@tokenizer&lt;/span&gt;.extract(data).each &lt;span class="keyword"&gt;do&lt;/span&gt; |stock_data|&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span class="variable-name"&gt;$data_log&lt;/span&gt;.info &lt;span class="string"&gt;“———- &lt;/span&gt;&lt;span class="variable-name"&gt;#{stock_data}&lt;/span&gt;&lt;span class="string"&gt;“&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span class="variable-name"&gt;@stock_data&lt;/span&gt; = &lt;span class="type"&gt;UbacParser&lt;/span&gt;.new stock_data&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="variable-name"&gt;@stock_data&lt;/span&gt;.valid_code?&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; dispatch_request&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span class="keyword"&gt;else&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; send_error_without_callback &lt;span class="string"&gt;“Invalid Protocol code”&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span class="keyword"&gt;end&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span class="keyword"&gt;end&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
</content>



    <feedburner:origLink>http://blogs.inxsasia.com/hemant/2007/07/testing-emacs-h.html</feedburner:origLink></entry>
    <entry>
        <title>A poem from the Kingdom of Nouns</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/typepad/inxsasia/hemant/~3/uUUt8zLTjjQ/a_poem_from_the.html" />
        <link rel="replies" type="text/html" href="http://blogs.inxsasia.com/hemant/2007/04/a_poem_from_the.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-33268490</id>
        <published>2007-04-24T16:29:02+00:00</published>
        <updated>2007-04-24T16:29:02+00:00</updated>
        <summary>Steve Yegge, had written a brilliant post, about Noun centric programming in Javaland. This poem takes the cake: For the lack of a nail, throw new HorseshoeNailNotFoundException("no nails!"); For the lack of a horseshoe, EquestrianDoctor.getLocalInstance().getHorseDispatcher().shoot(); For the lack of a...</summary>
        <author>
            <name>Hemant Kumar</name>
        </author>
        
        
<content type="html" xml:lang="en-US" xml:base="http://blogs.inxsasia.com/hemant/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;Steve Yegge, had written a brilliant post, about Noun centric programming in Javaland. This poem takes the cake: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
For the lack of a nail,
&amp;nbsp; &amp;nbsp; throw new HorseshoeNailNotFoundException(&amp;quot;no nails!&amp;quot;);

For the lack of a horseshoe,
&amp;nbsp; &amp;nbsp; EquestrianDoctor.getLocalInstance().getHorseDispatcher().shoot();

For the lack of a horse,
&amp;nbsp; &amp;nbsp; RidersGuild.getRiderNotificationSubscriberList().getBroadcaster().run(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;new BroadcastMessage(StableFactory.getNullHorseInstance()));

For the lack of a rider,
&amp;nbsp; &amp;nbsp; MessageDeliverySubsystem.getLogger().logDeliveryFailure(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;MessageFactory.getAbstractMessageInstance(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; new MessageMedium(MessageType.VERBAL),
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; new MessageTransport(MessageTransportType.MOUNTED_RIDER),
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; new MessageSessionDestination(BattleManager.getRoutingInfo(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; BattleLocation.NEAREST))),
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;MessageFailureReasonCode.UNKNOWN_RIDER_FAILURE);

For the lack of a message,
&amp;nbsp; &amp;nbsp; ((BattleNotificationSender)
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;BattleResourceMediator.getMediatorInstance().getResource(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; BattleParticipant.PROXY_PARTICIPANT,
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; BattleResource.BATTLE_NOTIFICATION_SENDER)).sendNotification(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; ((BattleNotificationBuilder)
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;(BattleResourceMediator.getMediatorInstance().getResource(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;BattleOrganizer.getBattleParticipant(Battle.Participant.GOOD_GUYS),
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;BattleResource.BATTLE_NOTIFICATION_BUILDER))).buildNotification(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; BattleOrganizer.getBattleState(BattleResult.BATTLE_LOST),
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; BattleManager.getChainOfCommand().getCommandChainNotifier()));

For the lack of a battle,
&amp;nbsp; &amp;nbsp; try {
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; synchronized(BattleInformationRouterLock.getLockInstance()) {
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; BattleInformationRouterLock.getLockInstance().wait();
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }
&amp;nbsp; &amp;nbsp; } catch (InterruptedException ix) {
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if (BattleSessionManager.getBattleStatus(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; BattleResource.getLocalizedBattleResource(Locale.getDefault()),
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; BattleContext.createContext(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; Kingdom.getMasterBattleCoordinatorInstance(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;new TweedleBeetlePuddlePaddleBattle()).populate(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; RegionManager.getArmpitProvince(Armpit.LEFTMOST)))) ==
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; BattleStatus.LOST) {
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; if (LOGGER.isLoggable(Level.TOTALLY_SCREWED)) {
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; LOGGER.logScrewage(BattleLogger.createBattleLogMessage(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;BattleStatusFormatter.format(BattleStatus.LOST_WAR,
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Locale.getDefault())));
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;}
&amp;nbsp; &amp;nbsp; }

For the lack of a war,
&amp;nbsp; &amp;nbsp; new ServiceExecutionJoinPoint(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;DistributedQueryAnalyzer.forwardQueryResult(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; NotificationSchemaManager.getAbstractSchemaMapper(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; new PublishSubscribeNotificationSchema()).getSchemaProxy().
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;executePublishSubscribeQueryPlan(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; NotificationSchema.ALERT,
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; new NotificationSchemaPriority(SchemaPriority.MAX_PRIORITY),
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; new PublisherMessage(MessageFactory.getAbstractMessage(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; MessageType.WRITTEN,
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; new MessageTransport(MessageTransportType.WOUNDED_SURVIVOR),
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; new MessageSessionDestination(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;DestinationManager.getNullDestinationForQueryPlan()))),
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; DistributedWarMachine.getPartyRoleManager().getRegisteredParties(
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; PartyRoleManager.PARTY_KING ||
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; PartyRoleManager.PARTY_GENERAL ||
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; PartyRoleManager.PARTY_AMBASSADOR)).getQueryResult(),
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; PriorityMessageDispatcher.getPriorityDispatchInstance())).
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;waitForService();

All for the lack of a horseshoe nail.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
</content>



    <feedburner:origLink>http://blogs.inxsasia.com/hemant/2007/04/a_poem_from_the.html</feedburner:origLink></entry>
    <entry>
        <title>Using models in your migrations</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/typepad/inxsasia/hemant/~3/naZnwRqORws/using_models_in.html" />
        <link rel="replies" type="text/html" href="http://blogs.inxsasia.com/hemant/2007/04/using_models_in.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-32847280</id>
        <published>2007-04-13T06:04:41+00:00</published>
        <updated>2007-04-13T06:04:41+00:00</updated>
        <summary>When, you are coding data migrations, and decide to use model classes in your migrations. You are asking for trouble. Why? Because, migrations is a fluid thing, and say you have decided to get rid of your model all together,then...</summary>
        <author>
            <name>Hemant Kumar</name>
        </author>
        
        
<content type="html" xml:lang="en-US" xml:base="http://blogs.inxsasia.com/hemant/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;When, you are coding data migrations, and decide to use model classes in your migrations. You are asking for trouble. Why?&lt;/p&gt;

&lt;p&gt;Because, migrations is a fluid thing, and say you have decided to get rid of your model all together,then your migrations would magically start failing. This could be a problem.&lt;/p&gt;

&lt;p&gt;Toolamantim, suggests an alternative. Simply redefine your models inside migrations itself:
&lt;pre&gt;
#  class Product &lt; ActiveRecord::Base; end
# class SoftwareProduct &lt; Product; end
# class CourseProduct &lt; Product; end
#
# def self.up
# add_column :products, :position, :integer
# Product.reset_column_information
#
# # Set default list orders
# SoftwareProduct.find(:all).inject(0) do |i,p|
# p.update_attribute(:position, i)
# i+1
# end
# CourseProduct.find(:all).inject(0) do |i,p|
# p.update_attribute(:position, i)
# i+1
# end
# end
#
# def self.down
# remove_column :products, :position
# end
&lt;/pre&gt;

&lt;/p&gt;&lt;/div&gt;
</content>



    <feedburner:origLink>http://blogs.inxsasia.com/hemant/2007/04/using_models_in.html</feedburner:origLink></entry>
    <entry>
        <title>Scaling rails</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/typepad/inxsasia/hemant/~3/5r2Ioy89fJY/scaling_rails.html" />
        <link rel="replies" type="text/html" href="http://blogs.inxsasia.com/hemant/2007/04/scaling_rails.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-32844594</id>
        <published>2007-04-13T05:14:31+00:00</published>
        <updated>2007-04-13T05:14:31+00:00</updated>
        <summary>Scaling isn't easy, it never was. Its not easy with any dynamic language. So, twitter as a rails application is facing some issues of scaling. So while I was sleeping peacefully, a war was going on, in the community. Alex,...</summary>
        <author>
            <name>Hemant Kumar</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="rails" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.inxsasia.com/hemant/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>Scaling isn't easy, it never was. Its not easy with any dynamic language. So, twitter as a rails application is facing some issues of scaling. So while I was sleeping peacefully, a war was going on, in the community. Alex, the twitter developer shares his thoughts, <a href="http://www.radicalbehavior.com/5-question-interview-with-twitter-developer-alex-payne/">http://www.radicalbehavior.com/5-question-interview-with-twitter-developer-alex-payne/</a> and DHH retorts back, and criticizes arms-crossed approach, <a href="http://www.loudthinking.com/arc/000608.html">http://www.loudthinking.com/arc/000608.html</a>.</p>

<p>So, what shall a rails developer learn from this. Well, just the basics that - any fool can code web pages, its not rocket science for sure. But how will he react when problems like these strike him? LiveJournal invented memcached, Google invented GFS, Wikipedia does this by aggressive caching. You can't get a out of box, scaling solution. This is the precise reason, Why I have been adamant about hiring people, who know ruby better, who can dig into the internals and come up with shiny code. </p>

<p>Dr Nic, comes with a solution, <a href="http://http://drnicwilliams.com/2007/04/12/magic-multi-connections-a-facility-in-rails-to-talk-to-more-than-one-database-at-a-time/">http://drnicwilliams.com/2007/04/12/magic-multi-connections-a-facility-in-rails-to-talk-to-more-than-one-database-at-a-time/</a>, which is not exactly the same. But lets see. Oh and dev.rubyonrails.org is a python page, which had same problem with trac. </p></div>
</content>



    <feedburner:origLink>http://blogs.inxsasia.com/hemant/2007/04/scaling_rails.html</feedburner:origLink></entry>
    <entry>
        <title>require 'money'</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/typepad/inxsasia/hemant/~3/gEe1RWiEFO0/require_money.html" />
        <link rel="replies" type="text/html" href="http://blogs.inxsasia.com/hemant/2007/04/require_money.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-32753498</id>
        <published>2007-04-11T13:40:10+00:00</published>
        <updated>2007-04-11T13:40:10+00:00</updated>
        <summary>From environment.rb: require 'money' Isn't it amusing?</summary>
        <author>
            <name>Hemant Kumar</name>
        </author>
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.inxsasia.com/hemant/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>From environment.rb:</p>

<pre> require 'money' </pre>

<p>Isn't it amusing?</p></div>
</content>



    <feedburner:origLink>http://blogs.inxsasia.com/hemant/2007/04/require_money.html</feedburner:origLink></entry>
    <entry>
        <title>CHM viewer in Linux</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/typepad/inxsasia/hemant/~3/l6oT0YTqB9g/chm_viewer_in_l.html" />
        <link rel="replies" type="text/html" href="http://blogs.inxsasia.com/hemant/2007/03/chm_viewer_in_l.html" thr:count="1" thr:updated="2009-07-22T21:52:38+00:00" />
        <id>tag:typepad.com,2003:post-32640986</id>
        <published>2007-03-27T00:02:27+00:00</published>
        <updated>2007-03-27T00:02:27+00:00</updated>
        <summary>After trying out many crappy, CHM viewers in Linux, I have finally settled on kchmviewer. A real nice app to use actually.</summary>
        <author>
            <name>inxsasia</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Linux" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.inxsasia.com/hemant/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>After trying out many crappy, <span class="caps">CHM</span> viewers in Linux, I have finally settled on kchmviewer.</p><br />	<p>A real nice app to use actually.</p></div>
</content>



    <feedburner:origLink>http://blogs.inxsasia.com/hemant/2007/03/chm_viewer_in_l.html</feedburner:origLink></entry>
    <entry>
        <title>Law of nature</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/typepad/inxsasia/hemant/~3/O7_SW5JDDBY/law_of_nature.html" />
        <link rel="replies" type="text/html" href="http://blogs.inxsasia.com/hemant/2007/03/law_of_nature.html" thr:count="1" thr:updated="2010-07-04T17:39:14+00:00" />
        <id>tag:typepad.com,2003:post-32640984</id>
        <published>2007-03-25T14:47:41+00:00</published>
        <updated>2007-03-25T14:47:41+00:00</updated>
        <summary>They have a factory that produces Singletons</summary>
        <author>
            <name>inxsasia</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="fun" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.inxsasia.com/hemant/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>They have a <a href="http://en.wikipedia.org/wiki/Factory_method_pattern"> factory </a> that produces <a href="http://en.wikipedia.org/wiki/Singleton_pattern"> Singletons </a></p></div>
</content>



    <feedburner:origLink>http://blogs.inxsasia.com/hemant/2007/03/law_of_nature.html</feedburner:origLink></entry>
    <entry>
        <title>life and guitar</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/typepad/inxsasia/hemant/~3/wtbMZF03fZg/life_and_guitar.html" />
        <link rel="replies" type="text/html" href="http://blogs.inxsasia.com/hemant/2007/03/life_and_guitar.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-32640982</id>
        <published>2007-03-24T19:08:58+00:00</published>
        <updated>2007-03-24T19:08:58+00:00</updated>
        <summary>As a kid, all I wanted to do is, play guitar and jump around, too many people got into my way. —Syd Barret</summary>
        <author>
            <name>inxsasia</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="fun" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.inxsasia.com/hemant/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>As a kid, all I wanted to do is, play guitar and jump around, too many people got into my way.<br /><span align="right">—Syd Barret </span></p></div>
</content>



    <feedburner:origLink>http://blogs.inxsasia.com/hemant/2007/03/life_and_guitar.html</feedburner:origLink></entry>
    <entry>
        <title>Using class instance variable</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/typepad/inxsasia/hemant/~3/FXRu0ROHUtQ/using_class_ins.html" />
        <link rel="replies" type="text/html" href="http://blogs.inxsasia.com/hemant/2007/03/using_class_ins.html" thr:count="7" thr:updated="2011-07-28T09:34:32+00:00" />
        <id>tag:typepad.com,2003:post-32640980</id>
        <published>2007-03-04T22:27:05+00:00</published>
        <updated>2007-03-04T22:27:05+00:00</updated>
        <summary>We all know how evil class variables are, and they are as dangerous as the “three headed dog” at the dungeon and we shall not talk about it. But they are necessary for many of the thingies ruby does and...</summary>
        <author>
            <name>inxsasia</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="ruby" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.inxsasia.com/hemant/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>We all know how evil class variables are, and they are as dangerous as the “<em>three headed dog</em>” at the dungeon and we shall not talk about it.</p><br />	<p>But they are necessary for many of the thingies ruby does and used extensively.But today we shall not talk about them.</p><br />	<p>We saw earlier that, although class instance variables are excellent, but not so friendly to use and they make Ruby look like C++(<em>ahem</em>).</p><br />	<p>Here goes a little hack, that allows you to define <em>class</em> level attributes based on class instance variables. Since, i often use it in rails and they have taken <code>cattr</code> for class level attributes.</p><br /><div class="typocode"><pre><code class="typocode_ruby "><span class="keyword">class </span><span class="class">Object</span><br />  <span class="keyword">def </span><span class="method">self.metaclass</span><span class="punct">;</span> <span class="keyword">class </span><span class="punct">&lt;&lt;</span> <span class="constant">self</span><span class="punct">;</span> <span class="constant">self</span><span class="punct">;</span> <span class="keyword">end</span><span class="punct">;</span> <span class="keyword">end</span><br />  <span class="keyword">def </span><span class="method">self.iattr_accessor</span> <span class="punct">*</span><span class="ident">args</span><br />    <span class="ident">metaclass</span><span class="punct">.</span><span class="ident">instance_eval</span> <span class="keyword">do</span><br />      <span class="ident">attr_accessor</span> <span class="punct">*</span><span class="ident">args</span><br />    <span class="keyword">end</span><br />    <span class="ident">args</span><span class="punct">.</span><span class="ident">each</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">attr</span><span class="punct">|</span><br />      <span class="ident">class_eval</span> <span class="keyword">do</span><br />        <span class="ident">define_method</span><span class="punct">(</span><span class="ident">attr</span><span class="punct">)</span> <span class="keyword">do</span><br />          <span class="constant">self</span><span class="punct">.</span><span class="ident">class</span><span class="punct">.</span><span class="ident">send</span><span class="punct">(</span><span class="ident">attr</span><span class="punct">)</span><br />        <span class="keyword">end</span><br />      <span class="keyword">end</span><br />    <span class="keyword">end</span><br />  <span class="keyword">end</span><br /><span class="keyword">end</span></code></pre></div><br />	<p>What above code does is, creates those class instance variables at class scope and also creates accessor methods for it, so that it doesn’t have to suck when used from class instances(remember @foo.class.i_am_class_instance_var)</p><br />Here is a sample that, shows it in action:<br /><div class="typocode"><pre><code class="typocode_ruby "><span class="keyword">class </span><span class="class">Foobar</span><br />  <span class="ident">iattr_accessor</span> <span class="symbol">:foo</span><br /><span class="keyword">end</span><br /><span class="constant">Foobar</span><span class="punct">.</span><span class="ident">foo</span> <span class="punct">=</span> <span class="punct">"</span><span class="string">Hemant</span><span class="punct">"</span><br /><span class="ident">p</span> <span class="constant">Foobar</span><span class="punct">.</span><span class="ident">foo</span><br /><span class="ident">lol</span> <span class="punct">=</span> <span class="constant">Foobar</span><span class="punct">.</span><span class="ident">new</span><br /><span class="ident">p</span> <span class="ident">lol</span><span class="punct">.</span><span class="ident">foo</span></code></pre></div><br />	<p>Did i miss anything? comments?</p></div>
</content>



    <feedburner:origLink>http://blogs.inxsasia.com/hemant/2007/03/using_class_ins.html</feedburner:origLink></entry>
    <entry>
        <title>just another cog in the wheel</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/typepad/inxsasia/hemant/~3/Pn1n4CZk_Vo/just_another_co.html" />
        <link rel="replies" type="text/html" href="http://blogs.inxsasia.com/hemant/2007/03/just_another_co.html" thr:count="1" thr:updated="2010-11-03T11:25:00+00:00" />
        <id>tag:typepad.com,2003:post-32640978</id>
        <published>2007-03-02T00:29:51+00:00</published>
        <updated>2007-03-02T00:29:51+00:00</updated>
        <summary>We hate reinventing the wheel. But when the wheel doesn’t exist, or is square, we’re not afraid to invent a round one.</summary>
        <author>
            <name>inxsasia</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="marketing" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.inxsasia.com/hemant/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>We hate reinventing the wheel. But when the wheel doesn’t exist, or is square, we’re not afraid to invent a round one.</p></div>
</content>



    <feedburner:origLink>http://blogs.inxsasia.com/hemant/2007/03/just_another_co.html</feedburner:origLink></entry>
 
</feed><!-- ph=1 -->

