<rss version="2.0">
  <channel>
    <title>Technical</title>
    <link>http://wiki.m001.net/technical/show/HomePage</link>
    <description>An Instiki wiki</description>
    <language>en-us</language>
    <ttl>40</ttl>
    <item>
      <title>irbrc</title>
      <description>&lt;p&gt;I&amp;#8217;ve started moving towards &amp;#8220;rsheling&amp;#8221; so following can be inputed into ~/.irbrc on nix based systems or &lt;a href="http://blog.nicksieger.com/articles/2006/05/30/irbrc-on-windows"&gt;read&lt;/a&gt;
  for windows in order to automate some tasks in ./script/console&lt;/p&gt;


	&lt;h3&gt;Get attributes ( fields ) of the Model&lt;/h3&gt;


&lt;pre&gt;&lt;code&gt;
def attributes_for(class_name)
   puts class_name.find_first.attributes.keys.sort
end

#Or you could simply do
Person.column_names # Found much later then the attributes_for

#returns all the attributes of the model
&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;Get Help&lt;/h3&gt;


&lt;pre&gt;&lt;code&gt;
def ri(*name)
  system(%{ri #{name.map{|name| name.to_s}.join(" ")}})
end

&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;Get Stats ( sweet stats :))&lt;/h3&gt;


&lt;pre&gt;&lt;/code&gt;&lt;br /&gt;def rake_stats
  system( %{rake stats} )&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;Get methods of the class, object or whatever else you&amp;#8217;re inspecting without object&amp;#8217;s instance methods ( Thanks to Geoff and Jacob Harris)&lt;/h3&gt;


&lt;pre&gt;&lt;code&gt;
# &amp;gt;&amp;gt; "a".self_methods
# =&amp;gt; ["%", "*", "+",...]
class Object
  def self_methods
    (self.methods - Object.instance_methods).sort
  end
end
# &amp;gt;&amp;gt; "a".methods.length
# =&amp;gt; 216
# &amp;gt;&amp;gt; "a".self_methods.length
# =&amp;gt; 141

&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;Run ruby commands or files from console&lt;/h3&gt;


	&lt;p&gt;This one would still need some love since its taking params as a string&lt;br /&gt;if you know a way of changing it please feel free to update.&lt;/p&gt;


&lt;pre&gt;&lt;code class="ruby"&gt;
def run(*name)
  system(%{ ruby #{name} })
end
# Run single integration file
&amp;gt;&amp;gt; run "test/integration/authentication_test.rb" 
Loaded suite test/integration/authentication_test.rb
Started
.........
Finished in 4.805332 seconds.

9 tests, 57 assertions, 0 failures, 0 errors
=&amp;gt; true
# Get ruby version
&amp;gt;&amp;gt; run "-v" 
ruby 1.8.4 (2005-12-24) [i686-linux]
=&amp;gt; true
&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;Run functional or unit tests from console&lt;/h3&gt;


	&lt;p&gt;I am using autotest, nevertheless I found that sometimes it good to run tests individually. Following will let you to brows through all your test files based on your choice(:functional,:unit)&lt;/p&gt;


	&lt;p&gt;Its much more convenient and batter to run rake tests, but some times you just wanted to run each test individually, also its very unfortunate that its a luxury to have a separate test environment.&lt;/p&gt;


&lt;pre&gt;&lt;code class="ruby"&gt;
def test(*type)
  if ENV['RAILS_ENV']  'test'
   Dir.entries("test/#{type.to_s}").each do |file|
     run "test/#{type.to_s}/#{file}" if file.last(3)  &amp;#8221;.rb&amp;#8221; 
   end
  else
  puts &amp;#8220;You dont want to run your tests in environment other then &amp;#8216;test&amp;#8217;&amp;#8221; 
  end&lt;br /&gt;end
#Not that im sending symbol&lt;br /&gt;test :functional
#Loaded suite test/functional/parent_contact_controller_test
#Started
#.............
#Finished in 2.839345 seconds.&lt;br /&gt;test :unit
#Loaded suite test/unit/legal_entity_exception_test
#Started
#.
#Finished in 0.339246 seconds.&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;How To inspect helpers from console&lt;/h3&gt;


	&lt;p&gt;Originally I found it on &lt;a href="http://errtheblog.com/post/43"&gt;err.the_blog&lt;/a&gt; written by          &lt;a href="http://www.pjhyett.com/"&gt;PJ Hyett&lt;/a&gt; and &lt;a href="http://ozmm.org/"&gt;Chris Wanstrath.&lt;/a&gt; &amp;#8211; Thank You &lt;strong&gt;Im posting it here in case if it will be deleted from original place&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;in case of any concerns from people mentioned above I promise to remove this peace.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
def Object.method_added(method)
  return super(method) unless method == :helper
  (class&amp;lt;&amp;lt;self;self;end).send(:remove_method, :method_added)

  def helper(*helper_names)
    returning $helper_proxy ||= Object.new do |helper|
      helper_names.each { |h| helper.extend "#{h}_helper".classify.constantize }
    end
  end

  helper.instance_variable_set("@controller", ActionController::Integration::Session.new)

  def helper.method_missing(method, *args, &amp;#38;block)
    @controller.send(method, *args, &amp;#38;block) if @controller &amp;#38;&amp;#38; method.to_s =~ /_path$|_url$/
  end

  helper :application rescue nil
end if ENV['RAILS_ENV']
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;or download from &lt;a href="http://pastie.caboo.se/27125/text"&gt;http://pastie.caboo.se/27125/text&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;Geoff&amp;#8217;s Contribution(s):&lt;/h3&gt;


&lt;pre&gt;&lt;code&gt;
# an irb clear
def clear
  STDOUT.write("#{0x1b.chr}[0;0H")
  STDOUT.write("#{0x1b.chr}[2J")
end
# or ctrl+l (lower l on *nix)
# ctrl+k on mac

# Method searching
#   &amp;gt;&amp;gt; [1,2,3].method_search("sort")
#   =&amp;gt; ["sort", "sort!", "sort_by"]
class Object
  def method_search(string)
    self.methods.find_all{ |i| i.match(/#{string}/) }.sort
  end
end

# Tab-completion of methods as seen here: http://showmedo.com/videos/video?name=rubyLakeIrbCompletion
require 'irb/completion'
&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;Auto-tabbing turned on : as found on &lt;a href="http://drnicwilliams.com/category/ruby/gems/"&gt;http://drnicwilliams.com/category/ruby/gems/&lt;/a&gt;&lt;/h3&gt;


&lt;pre&gt;&lt;code class="ruby"&gt;
#Add in ~/.irbrc
IRB.conf[:AUTO_INDENT]=true
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;So now if you write itereator, method or anything that would require indent, you would see&lt;/p&gt;


&lt;pre&gt;&lt;code class="ruby"&gt;
&amp;gt;&amp;gt; [1,2].each do |n|
?&amp;gt;     puts n
&amp;gt;&amp;gt;   end
1
2
=&amp;gt; [1, 2]
&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;Some &amp;#8220;svnning&amp;#8221;&lt;/h3&gt;


&lt;pre&gt;&lt;code class="ruby"&gt;
#&amp;gt;&amp;gt; svn :up
#At revision 626.
#=&amp;gt; true
def svn(*action)
  system %(/home/tpdev/bin/linux/svn  #{action})
end
&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;&lt;a href="http://www.thefreedictionary.com/Historify"&gt;Historify&lt;/a&gt; your session by &lt;a href="http://clarkware.com/"&gt;Mike Clark&lt;/a&gt;&lt;/h3&gt;


&lt;pre&gt;&lt;code class="ruby"&gt;
HISTFILE = "~/.irb.hist" unless defined? HISTFILE
MAXHISTSIZE = 100 unless defined? MAXHISTSIZE

begin
  if defined? Readline::HISTORY
    histfile = File::expand_path(HISTFILE)
    if File::exists?(histfile)
      lines = IO::readlines(histfile).collect { |line| line.chomp }
      Readline::HISTORY.push(*lines)
    end

    Kernel::at_exit {
      lines = Readline::HISTORY.to_a.reverse.uniq.reverse
      lines = lines[-MAXHISTSIZE, MAXHISTSIZE] if lines.nitems &amp;gt; MAXHISTSIZE
      File::open(histfile, File::WRONLY|File::CREAT|File::TRUNC) {|f|
        lines.each {|line| f.puts line }
      }
    }
  end
end
&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Wed, 03 Dec 2008 16:05:08 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/irbrc</guid>
      <link>http://wiki.m001.net/technical/show/irbrc</link>
    </item>
    <item>
      <title>Home Page</title>
      <description>&lt;h3&gt;&lt;span style="color: red;"&gt; Action Controller &lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/SharingCookiesInsideDomain"&gt;Sharing Cookies Inside Domain&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Action View &lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a href="HowToSetFocusOnPopupWindowUsingMonkeyPatching"&gt;How To Set Focus On Popup Window Using Monkey Patching&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ChicCrams"&gt;Chic Crams&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/FormHelpers"&gt;Form Helpers&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/TabsHelper"&gt;Tabs Helper&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/SortHelper"&gt;Sort Helper&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/CalendarTag"&gt;Calendar Tag&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/DateTimeHelpers"&gt;Date Time Helpers&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/WebSafeColors"&gt;Web Safe Colors&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/CreatingXlsFiles"&gt;Creating Xls Files&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/Numbers"&gt;Numbers&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/BlinkableTagsForInternetExplorer"&gt;Blinkable Tags For Internet Explorer&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Active Record &lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ColumnsManipulations"&gt;Columns Manipulations&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/DynamicDatabaseNameUsageWithSybase"&gt;Dynamic Database Name Usage With Sybase&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/DynamicStripAndGsub"&gt;Dynamic Strip And Gsub&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/HowToUpdateWhenARMethodWillNotFeat"&gt;HowToUpdateWhenARMethodWillNotFeat&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/InstallOciOnMacOSX"&gt;InstallOciOnMacOSX&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/LegacyDatabasePices"&gt;Legacy Database Pices&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/Migrations"&gt;Migrations&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/HowToExecuteOracleProcedures"&gt;HowToExecuteOracleProcedures&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/HowToExecuteSybaseProcedures"&gt;HowToExecuteSybaseProcedures&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/Validation"&gt;Validation&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a href="SqlOrGoodToKnow"&gt;SQL Or Good To Know&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ReadingDatabaseYmlPragmatically"&gt;ReadingDatabaseYmlPragmatically&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/HowToCheckIfColumnIsPresent"&gt;HowToCheckIfColumnIsPresent&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ActiveRecordModelWithoutTable"&gt;Active Record Model Without Table&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a href="HowToMockModelInDevelopmentMode"&gt;How To Mock Model In Development Mode&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a href="AnotherWayToDealWithDups"&gt;Another way to deal with dups&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Active Support &lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/TimeCalculations"&gt;Time Calculations&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Environment Options&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ConfigOptions"&gt;Config Options&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/HowToReadVariousRequestParameters"&gt;HowToReadVariousRequestParameters&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; &lt;span class="caps"&gt;IRB &lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a href="irbrc"&gt;.irbrc&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Just Useful&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/HowToCompileSvnClientInStaticMode"&gt;HowToCompileSvnClientInStaticMode&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/SybaseSchemaBrowsing"&gt;Sybase Schema Browsing&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/SpecialCharecters"&gt;Special Charecters&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a href="HowToReadLogicalVolumesUsingKnoppix"&gt;How To Read Logical Volumes Using Knoppix&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; &lt;a href="http://jruby.codehaus.org/"&gt;JRuby&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/YetAnotherJrubyAndRailsSetupArticle"&gt;Yet Another Jruby And Rails Setup Article&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Misc&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/CorporateMessaging"&gt;Corporate Messaging&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/PaperPrototyping"&gt;Paper Prototyping&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/CorporateEvolution"&gt;Corporate Evolution&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/RequireTheEasyWay"&gt;Require The Easy Way&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/PoetIsm"&gt;PoetIsm&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/MasterUserInterfaceFromRailsStudioUsers"&gt;Master User Interface From Rails Studio Users&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ChartsSuitableForRails"&gt;Charts Suitable For Rails&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/FlashFriendlyUrls"&gt;Flash Friendly Urls&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/UbuntuResolveConf"&gt;Ubuntu Resolve Conf&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Mysql&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/GrantAllOnMysqlUser"&gt;Grant All On Mysql User&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/MysqldumpWithoutTableLocking"&gt;Mysqldump Without Table Locking&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/StringManipulationsUsingSql"&gt;String Manipulations Using Sql&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/Procedures"&gt;Procedures&lt;/a&gt; &lt;/span&gt;&lt;/h3&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Plugins &lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/GruffPlugin"&gt;Gruff Plugin&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Random On Rails&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/StuffFromRubyOnRailsIRC"&gt;StuffFromRubyOnRailsIRC&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/CodeYard"&gt;Code Yard&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/BlogOnRailsInFiveOrSo"&gt;BlogOnRailsInFiveOrSo&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ExpirienceTheStreamlined"&gt;Expirience The Streamlined&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/SHORTies"&gt;SHORTies&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; &lt;span class="caps"&gt;RJS &lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/RJS"&gt;RJS&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ErrorMessagesForUsingRJS"&gt;Error Messages For Using RJS&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/EasyProcessIndicator"&gt;Easy Process Indicator&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ToggleWithPlusOrMinus"&gt;ToggleWithPlusOrMinus&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/WidgetsAndRails"&gt;Widgets And Rails&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/DroppableAreaZindexHigherThenDraggableIssueFix"&gt;Droppable Area Zindex Higher Then Draggable Issue Fix&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Regular Expressions &lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/UsefulRegexExamples"&gt;Useful Regex Examples&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Rake &lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/RakeTestWithoutMigrations"&gt;Rake Test Without Migrations&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Security&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ParametersFiltering"&gt;Parameters Filtering&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Quick Stubs || Dependency Injections&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ValidateNumericalityOf"&gt;Validate Numericality Of&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ValidateNestedKeys"&gt;Validate Nested Keys&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/SanitizeParams"&gt;Sanitize Params&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/FlattenAndSort"&gt;Flatten And Sort&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; &lt;span class="caps"&gt;SHEL&lt;/span&gt;Ling &lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/RubyFriendlyShellVariables"&gt;Ruby Friendly Shell Variables&lt;/a&gt; &lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/RedirectScpOutput"&gt;Redirect Scp Output&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/SolveArgumentListTooLongWithRuby"&gt;Solve Argument List Too Long With Ruby&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/DeleteDirectoriesRecursively"&gt;Delete Directories Recursively&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/GrepWithoutSvnFolders"&gt;Grep Without Svn Folders&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ListDirectoriesOnly"&gt;List Directories Only&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/HelpfulShellComandsAndRelatedSwitches"&gt;Helpful Shell Comands And Related Switches&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ContinuouslyMonitorProcessWithPsAndGrep"&gt;Continuously Monitor Process With Ps And Grep&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ZipingUnzipingAndMaybeGziping"&gt;Ziping Unziping And Maybe Gziping&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Scripts &lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/DeployScript"&gt;Deploy Script&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/MacDevEnvUsingOneClick"&gt;Mac Dev Env Using One Click&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Testing &lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/AutotestRelated"&gt;Autotest Related&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/Fixtures"&gt;Fixtures&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/FunctionalTests"&gt;Functional Tests&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/UnitTests"&gt;Unit Tests&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/IntegrationTests"&gt;Integration Tests&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/Migrations"&gt;Migrations&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/Mocha"&gt;Mocha&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/TestHelpers"&gt;Test Helpers&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a href="HowToTestApplicationController"&gt;How To Test Application Controller&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/CruiseControllWithRSpec"&gt;Cruise Controll With RSpec&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a href="FlattenAndSort"&gt;How to test strings produced by hash&lt;/a&gt; &lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/RspecRelated"&gt;Rspec Related&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; &lt;span class="caps"&gt;UI &lt;/span&gt;(a.k.a User Interface)&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/MasterUserInterfaceFromRailsStudioUsers"&gt;Master User Interface From Rails Studio Users&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ChartsSuitableForRails"&gt;Charts Suitable For Rails&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; &lt;span class="caps"&gt;YAML &lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/DumpStructureToYAML"&gt;DumpStructureToYAML&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; &lt;span class="caps"&gt;VIM&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/Commands"&gt;Commands&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/ClearWindowsLittering"&gt;ClearWindowsLittering&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Web Trickery&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/CascadingStyleSheets"&gt;Cascading Style Sheets&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; &lt;span class="caps"&gt;EMACS &lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/RailsReadyEmacsForUbuntu"&gt;Rails Ready Emacs For Ubuntu&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Where In Files&amp;#8230;?&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/RakeTasks"&gt;Rake Tasks&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/SybaseIni"&gt;Sybase Ini&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; Subversion &lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/HowtoStartNewProjectWithTagingAndBranching"&gt;Howto Start New Project With Taging And Branching&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/HowtoCreatePatchesUsingSvn"&gt;Howto Create Patches Using Svn&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/SvnInstalationErrors"&gt;Svn Instalation Errors&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/HowtoMakeSubversionTracFriendly"&gt;Howto Make Subversion Trac Friendly&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/SvnStatGreping"&gt;Svn Stat Greping&lt;/a&gt;&lt;br /&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/HowtoMergeDevBranchWithTrunk"&gt;Howto Merge Dev Branch With Trunk&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; &lt;a href="http://www.capify.org"&gt;Capistrano&lt;/a&gt; &lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/DeployWithoutSubversionPassword"&gt;Deploy Without Subversion Password&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;&lt;span style="color: red;"&gt; &lt;a href="http://mechanize.rubyforge.org/mechanize"&gt;Mechanize&lt;/a&gt; &lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;&amp;rarr; &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/HowtoPostWithMultiselectList"&gt;Howto Post With Multiselect List&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 03 Dec 2008 16:04:32 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/HomePage</guid>
      <link>http://wiki.m001.net/technical/show/HomePage</link>
    </item>
    <item>
      <title>Ziping Unziping And Maybe Gziping</title>
      <description>&lt;h1&gt;To tar file&lt;/h1&gt;


&lt;pre&gt;&lt;code&gt;
tar -cvf file_name.tar file_name
&lt;/code&gt;&lt;/pre&gt;

	&lt;h1&gt;To untar file&lt;/h1&gt;


&lt;pre&gt;&lt;code&gt;
tar -xvf file_name.tar
&lt;/code&gt;&lt;/pre&gt;

	&lt;h1&gt;To tar and gzip&lt;/h1&gt;


&lt;pre&gt;&lt;code&gt;
tar -pczf file_name.tar.gz file_name
&lt;/code&gt;&lt;/pre&gt;

	&lt;h1&gt;To untar gziped file&lt;/h1&gt;


&lt;pre&gt;&lt;code&gt;
tar -zxvf file_name.tar.gz 
&lt;/code&gt;&lt;/pre&gt;

	&lt;h1&gt;To just gzip&lt;/h1&gt;


&lt;pre&gt;&lt;code&gt;
gzip file_name
&lt;/code&gt;&lt;/pre&gt;

	&lt;h1&gt;To just ungzip&lt;/h1&gt;


&lt;pre&gt;&lt;code&gt;
ungzip file_name.gz
&lt;/code&gt;&lt;/pre&gt;

	&lt;h1&gt;Bonus&lt;/h1&gt;


	&lt;p&gt;How to tar and gzip multiple files using irb. In the following case I have bunch of files which are timestamped and spread by year accordingly.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
(2000..2006).each{|year| `tar -pczf #{year}.tar.gz #{year}`}
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;em&gt;to view process use -v switch&lt;/em&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 26 Nov 2008 20:22:04 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/ZipingUnzipingAndMaybeGziping</guid>
      <link>http://wiki.m001.net/technical/show/ZipingUnzipingAndMaybeGziping</link>
    </item>
    <item>
      <title>Config Options</title>
      <description>&lt;h3&gt;Sessions&lt;/h3&gt;


&lt;pre&gt;&lt;code class="ruby"&gt;
ActionController::Base.session_options[:tmpdir] = '/tmp'
ActionController::Base.session_options[:prefix] = 'dbx_margin.'
&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;Logs&lt;/h3&gt;


&lt;pre&gt;&lt;code class="ruby"&gt;
config.log_path = "/tmp/dbx_margin_#{ENV['RAILS_ENV']}.log" 
&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;LogRotate&lt;/h3&gt;


	&lt;p&gt;To set log rotate options in config:&lt;/p&gt;


&lt;pre&gt;&lt;code class="ruby"&gt;
 config.logger = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", 5, 104857)
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;This will span logs in to 5 files and recycle them in 10mb span.&lt;/p&gt;


	&lt;h3&gt;Custom Logger&lt;/h3&gt;


	&lt;p&gt;Some times I just want to be able to output my data to a seperate log file so I could get dipper analysis of data to do that I can do:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
l = Logger.new(RAILS_ROOT + "/log/custom_log_file.log")
l.debug("test")
&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Fri, 21 Nov 2008 18:04:05 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/ConfigOptions</guid>
      <link>http://wiki.m001.net/technical/show/ConfigOptions</link>
    </item>
    <item>
      <title>Corporate Evolution</title>
      <description>&lt;h2&gt;How to make the best out of it.&lt;br /&gt;So I went from &lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/CorporateMessaging"&gt;Corporate Messaging&lt;/a&gt;&lt;/h2&gt;


	&lt;h2&gt;TO&lt;/h2&gt;


	&lt;p&gt;&lt;img src="http://wiki.m001.net/technical/files/dual_mon.jpeg" alt="corporate evolution" width="60%"&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 06 Nov 2008 19:53:35 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/CorporateEvolution</guid>
      <link>http://wiki.m001.net/technical/show/CorporateEvolution</link>
    </item>
    <item>
      <title>Corporate Messaging</title>
      <description>&lt;p&gt;&lt;span style=""&gt; &lt;span class="caps"&gt;THE&lt;/span&gt; most &lt;span class="caps"&gt;AGILE&lt;/span&gt; practices &lt;/span&gt;&lt;/p&gt;


	&lt;p&gt;&lt;img src="http://wiki.m001.net/technical/files/corporate_messaging.jpg" alt="This is how hairy it can get" width="70%" /&gt;&lt;/p&gt;


	&lt;p&gt;Agility of this method is that you know about user requirements even &lt;strong&gt;before&lt;/strong&gt; you turn on your computer. I should migrate/upgrade them to the Index Cards, would look more standard.&lt;/p&gt;


	&lt;p&gt;&lt;a href="CorporateEvolution"&gt;Follow up to this story&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 06 Nov 2008 19:53:19 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/CorporateMessaging</guid>
      <link>http://wiki.m001.net/technical/show/CorporateMessaging</link>
    </item>
    <item>
      <title>Continuously Monitor Process With Ps And Grep</title>
      <description>&lt;h1&gt;Hello ? Are you there ?&lt;/h1&gt;


	&lt;p&gt;Sometimes you want to see whats happning with your script on the backgound, especially when the script is not very talkative.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
while true; do  ps ax | grep store_nyiso; sleep 2; done
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;where store_nyiso is the part of the script name that is present in my file.&lt;/p&gt;</description>
      <pubDate>Thu, 06 Nov 2008 19:47:58 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/ContinuouslyMonitorProcessWithPsAndGrep</guid>
      <link>http://wiki.m001.net/technical/show/ContinuouslyMonitorProcessWithPsAndGrep</link>
    </item>
    <item>
      <title>Shelling Commands Tricks And Many More</title>
      <description>&lt;h3&gt;To remove all of the files/folders based on given params&lt;/h3&gt;


&lt;pre&gt;&lt;code class="\"ruby\""&gt;
  rm -rf `find . -name '*.html'`
&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;Continuously monitor process&lt;/h3&gt;


&lt;pre&gt;&lt;code&gt;
while true; do  ps ax | grep store_nyiso; sleep 2; done
&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Thu, 06 Nov 2008 19:35:46 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/ShellingCommandsTricksAndManyMore</guid>
      <link>http://wiki.m001.net/technical/show/ShellingCommandsTricksAndManyMore</link>
    </item>
    <item>
      <title>String Manipulations Using Sql</title>
      <description>&lt;h1&gt;gsub Using sql&lt;/h1&gt;


	&lt;p&gt;I had a case where the string was not supposed to show a suffix. String looked like &amp;#8220;GOWANUS-ZK-1&amp;#8221; and I had to loose &amp;#8221;-1&amp;#8221; part. Of course right away I flexed my regex muscles and in the end got the following:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
(generator.longname =~ /-1/ ? generator.longname.gsub('-1','') : generator.longname)
&lt;/code&gt;&lt;/pre&gt; 

	&lt;p&gt;cryptic isnt it?&lt;/p&gt;


	&lt;p&gt;This is how this can be replaced with sql or select statment using rails.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
 Generator.find(:all,:select =&amp;gt; "REPLACE(longname,'-1','') as longname")
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;More on the &lt;span class="caps"&gt;REPLACE&lt;/span&gt; function can be found &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace"&gt;here&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 29 Oct 2008 20:11:36 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/StringManipulationsUsingSql</guid>
      <link>http://wiki.m001.net/technical/show/StringManipulationsUsingSql</link>
    </item>
    <item>
      <title>Rspeced Mocks</title>
      <description>&lt;h3&gt;Simple mock&lt;/h3&gt;


	&lt;p&gt;Following is a quick example that mocks Net::LDAP library. The use of this example is in showing how to mock methods that receive values or being assigned values as an instance variables of the class. For the mock library it will be the same thing since it does not know nor needs to care about object.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
   ldap = Net::LDAP.should_receive(:new).and_return(
      mock("ldap",
           :host= =&amp;gt; "test.local",
           :bind_as =&amp;gt; @ldap_result)
    )
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;So in this example host is an instance variable there fore you will see that we set it using :host= whereas the bind_as is a method that returns the ldap results. &lt;em&gt;NOTE&lt;/em&gt;: key represents method name and value represents what it returns.Also, you have to use symbol for the key (:host=) if you will stringified key(&amp;#8220;host=&amp;#8221;) it will not work.&lt;/p&gt;</description>
      <pubDate>Mon, 27 Oct 2008 23:09:06 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/RspecedMocks</guid>
      <link>http://wiki.m001.net/technical/show/RspecedMocks</link>
    </item>
    <item>
      <title>Hover For Table Using Css</title>
      <description>&lt;p&gt;For more descriptive solution navigate to &lt;a href="http://www.elated.com/articles/styling-tables-with-css"&gt;here&lt;/a&gt;&lt;br /&gt;In simple your hover css code looks as following:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
table.custom tbody#custom-tbody tr:hover td{
      background-color: #632a2a;
      color: #fff;
}
&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Mon, 27 Oct 2008 21:46:25 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/HoverForTableUsingCss</guid>
      <link>http://wiki.m001.net/technical/show/HoverForTableUsingCss</link>
    </item>
    <item>
      <title>Cascading Style Sheets</title>
      <description>&lt;p&gt;I know, I know&amp;#8230; Another &lt;a href="http://www.google.com/search?hl=en&amp;#38;q=CSS&amp;#38;aq=f"&gt;480 + milion&amp;#8217;s resource&lt;/a&gt; that talks about &lt;a href="http://www.w3.org/Style/CSS"&gt;CSS&lt;/a&gt;. Well, I had some css that was repeating and was failing since I was forgeting how to get it going so I decided to start recording css as well.&lt;/p&gt;


	&lt;p&gt;Here it goes:&lt;/p&gt;


	&lt;p&gt;&lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/HoverForTableUsingCss"&gt;Hover For Table Using Css&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Mon, 27 Oct 2008 21:44:11 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/CascadingStyleSheets</guid>
      <link>http://wiki.m001.net/technical/show/CascadingStyleSheets</link>
    </item>
    <item>
      <title>Useful Regex Examples</title>
      <description>&lt;h1&gt;How to parse -h or&amp;#8212;help from script input&lt;/h1&gt;


&lt;pre&gt;&lt;code&gt;
ARGV[0] =~ /-\?|-h|--help/
&lt;/code&gt;&lt;/pre&gt;

	&lt;h1&gt;How to check if you have Am Or Pm&lt;/h1&gt;


&lt;pre&gt;&lt;code&gt;
&amp;gt;&amp;gt; m =  /([0-9]+) +([AP]M)/.match("12 AM")
=&amp;gt; #&amp;lt;MatchData:0xb743cb34&amp;gt;
&amp;gt;&amp;gt; puts " match 1: #{m[0]} match 2: #{m[1]} match 3: #{m[2]}" 
=&amp;gt; match 1: 12 AM match 2: 12 match 3: AM
&lt;/code&gt;&lt;/pre&gt;

	&lt;h1&gt;How To Get exect match for the string&lt;/h1&gt;



To get exact match you would need to use ^ (which means begining of the string) and $ (which means end of the string) charecters with the string in question in the middle.

&lt;pre&gt;&lt;/code&gt;&lt;br /&gt;
"NARROWS"  =~ /(^NARROWS$|^GOWANUS$)/
&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;

	&lt;h1&gt;How to match and retrive values that received the match.&lt;/h1&gt;



Let say I have the following string "CCF08-987*" and I want to break it in a following manner &lt;b&gt;[CCF][08]-[987][*]&lt;/b&gt;
Following is a regular expression to do that:


&lt;pre&gt;&lt;code&gt;
"CCF08-987*" =~ /([a-zA-Z]+)(\d[0-9])-(\d[0-9]*)(\*)/
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;And following is the way of how to retrieve the matching values:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&amp;gt;&amp;gt; $1
=&amp;gt; "CCF" 
&amp;gt;&amp;gt; $2
=&amp;gt; "08" 
&amp;gt;&amp;gt; $3
=&amp;gt; "987" 
&amp;gt;&amp;gt; $4
=&amp;gt; "*" 
&lt;/code&gt;&lt;/pre&gt;

	&lt;h1&gt;Playing around with literals in Regexp&lt;/h1&gt;


	&lt;p&gt;Its very often that you have to parse out the &amp;#8216;star&amp;#8217; (&lt;strong&gt;*&lt;/strong&gt;) charecter when receiving user&amp;#8217;s search input. In my case based on whether star in the begining or end of the string I would have to do either more(&gt;) or less(&amp;lt;)&lt;br /&gt;sign. Following patterns should help u get the matches.&lt;/p&gt;



&lt;i&gt;This expresion checks whether star(*) is present in your string&lt;/i&gt;

&lt;pre&gt;&lt;code&gt;
&gt;&gt; "123*" =~ /(\*)/
=&gt; 3 #this is a place at which match was found (starting with 0)
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;i&gt;This expression checks if star is at the end of the string&lt;/i&gt;&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&gt;&gt; "123*" =~ /(\*)$/
=&gt; 3
&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;&lt;i&gt;This expression checks if star is at the begining of the string&lt;/i&gt;&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&gt;&gt; "*123" =~ /^(\*)/
=&gt; 0
&gt;&gt; $1
=&gt; "*" 
&gt;&gt; $'
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;</description>
      <pubDate>Thu, 16 Oct 2008 20:32:08 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/UsefulRegexExamples</guid>
      <link>http://wiki.m001.net/technical/show/UsefulRegexExamples</link>
    </item>
    <item>
      <title>RJS</title>
      <description>&lt;p&gt;&lt;strong&gt;To disable Element using  &lt;span class="caps"&gt;RJS&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
#html
&amp;lt;input id="Sec2Override_nvalue" name="Sec2Override[nvalue]" size="30" type="text" /&amp;gt;
#RJS
render :update  do |page|
   page["Sec2Override_nvalue"].disabled = true
end 
#or 
render :update do |page|
  page.element.disable('element_name')
end
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;To disable form on load or complete&lt;/strong&gt;&lt;/p&gt;


&lt;pre&gt;&lt;code class="ruby"&gt;
&amp;lt;%= form_tag {:action =&amp;gt; ""},{:id =&amp;gt; "search_form"} %&amp;gt;
&amp;lt;%= text_field_with_auto_complete :search,
                                  :q,
                                  {
                      :loading =&amp;gt;'Form.disable("search_form")',
                      :complete =&amp;gt; 'Form.enable("search_form")'
                      }
&amp;lt;%= end_form_tag %&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;To redirect when call was made by form_remote_tag&lt;/strong&gt;&lt;/p&gt;


&lt;pre&gt;&lt;code class="ruby"&gt;
render :update do |page|
  page.redirect_to :controller =&amp;gt; "legal_entity" 
end  
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;form_remote_tag with disable on loading and enable on complete&lt;/strong&gt;&lt;br /&gt;This should be refactored &lt;span class="caps"&gt;IMHO&lt;/span&gt;, because it can get very harry.&lt;/p&gt;


&lt;pre&gt;&lt;code class="ruby"&gt;
  &amp;lt;%= form_remote_tag(:url =&amp;gt; {:action =&amp;gt; "search_borrow_list"},
                                :loading =&amp;gt; 'Form.disable("search_form")',
                                :complete =&amp;gt; 'Form.enable("search_form")',
                          :html =&amp;gt; {
                                :id =&amp;gt; "search_form",
                                :style =&amp;gt; "margin:0px 0px 0px 0px" 
                              }
                         ) %&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;link_to_remote &amp;#8211; with id and other html parameters&lt;/h3&gt;


	&lt;p&gt;Yes, it confuses me every time I need to use it out of ordinary, and unfortunately &lt;a href="http://api.rubyonrails.com/classes/ActionView/Helpers/PrototypeHelper.html#M000958"&gt;Rail&amp;#8217;s Docs&lt;/a&gt;
 are really skimpy on this one.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
     &amp;lt;%= link_to_remote("&amp;amp;darr;",
         {
          :url =&amp;gt; {   
            :action =&amp;gt; "show_ordered_averages",
            :order =&amp;gt; "bg_location_id",
            :lmp_type_select =&amp;gt; params[:lmp_type_select]
          }, #=&amp;gt; url params
          :with =&amp;gt; "'bg_location_id_sort_dir='+$('bg_location_id_sort_dir').value",
          :loading =&amp;gt; "Element.show('average-title-indicator')",
          :complete =&amp;gt; "Element.hide('average-title-indicator')" 
        },
          {:id =&amp;gt; "bg_location_id_link"} #=&amp;gt; html params go here
        ) %&amp;gt;

&lt;/code&gt;&lt;/pre&gt; 

	&lt;h1&gt;Inserting raw ajax in to the page object&lt;/h1&gt;


&lt;pre&gt;&lt;code&gt;
 page &amp;lt;&amp;lt; "$('start_stop_flag_div').style.color='red'" 
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;In this particular case I change the color of the text in the start_stop_flag_div to red&lt;/p&gt;


	&lt;h1&gt;How to call custom javascript function from your &lt;span class="caps"&gt;RJS&lt;/span&gt; code&lt;/h1&gt;


	&lt;p&gt;Some times you would want to call js function from your &lt;span class="caps"&gt;RJS&lt;/span&gt; code using your page object ( or however else you called it ). You can do it the following way:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
  page.call "play_sound","alert" 
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Where play_sound is js function and alert is one of the parameters.&lt;br /&gt;For more on the &lt;span class="caps"&gt;RJS&lt;/span&gt; and many other stuff follow &lt;a href="http://railscasts.com/episodes/45-rjs-tips"&gt;this&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 07 Oct 2008 21:32:52 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/RJS</guid>
      <link>http://wiki.m001.net/technical/show/RJS</link>
    </item>
    <item>
      <title>Rspec Related</title>
      <description>&lt;h1&gt;Articles related to RSpec&lt;/h1&gt;


	&lt;p&gt;&lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/HowtoCallRjsActionUsingRspec"&gt;Howto Call Rjs Action Using Rspec&lt;/a&gt; &lt;br /&gt;&lt;a class="existingWikiWord" href="http://wiki.m001.net/technical/show/RspecedMocks"&gt;Rspeced Mocks&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Mon, 06 Oct 2008 17:41:12 Z</pubDate>
      <guid>http://wiki.m001.net/technical/show/RspecRelated</guid>
      <link>http://wiki.m001.net/technical/show/RspecRelated</link>
    </item>
  </channel>
</rss>
