:-[] :-|| Vivek Khokhar rambles here :-O :-[]

December 6, 2007

ERROR: While executing gem … (Gem::GemNotFoundException)

Filed under: Uncategorized — Vivek Khokhar @ 6:35 pm

You might be feeling annoyed with this problem. (I do)
Problem could be:

your local source cache
Example:   /usr/lib/ruby/gems/1.8/source_cache

; try removing this file (Your path might be different than above given; check your path first using #gem env)
If this does not solves your problem

check your env var REMOTE SOURCES (#gem env)

If it is not gems.rubyforge.org then use following command to install:

#gem install -r gem_name  –source http://gems.rubyforge.org

If this does not solves your problem(is your internet down?)

Borrow gem files from your friend and install them without -r option.

#gem install /path_to/gemname.gem

/bin/rm: Argument list too long tmp/sessions/ruby_sess.*

Filed under: Linux, Ruby, Rails — Vivek Khokhar @ 5:25 pm
Well this happens when there are too many files to process:
Best way in this case is to do batch processing:
Sample command:
find . -name 'ruby_sess.*' -print0 | xargs -0 rm

July 31, 2007

lynx: https how to

Filed under: Uncategorized — Vivek Khokhar @ 1:03 am

step1: Compile lynx with ssl support

cd lynx source folder

./configure –with-ssl

step2:  make ; make install

To avoid local ssl error prompts/complains,  Open lynx.cfg make following change:

step3:  FORCE_SSL_PROMPT:yes

thats all!. you should be able to crawl https pages using lynx now.

July 26, 2007

mpgtx: MPEG splitting made easy

Filed under: Uncategorized — Vivek Khokhar @ 1:47 am

Considering ffmpeg for mpeg cutting/splitting… too complex i think for such a simple task.

mpgtx.sourceforge.net is the way to go if are looking for simple operations like cutting/joining mpeg files.

Tool Summary :

This simple command(from a ruby script I wrote) will cut the full length videos into count_chunks pieces and store them under directory_writable, where count_chunks and directory_writable are both variables

Open3.popen3(”/bin/mpgtx -#{count_chunks} #{_file_to_process} -f -b #{directory_variable}/#{game.file_path.gsub(’.mpg’,'’)} 2>> #{directory_variable}/split.log”)

RAILS_ROOT

Filed under: Ruby, Rails — Vivek Khokhar @ 1:38 am

RAILS_ROOT gives you relative path within the applications it works fine as far as you need the path within rails application.

How about getting absolute path to rails folder?

I found one way, and thats from the ENV hash.

You can use ENV[’PWD’] to find absolute path to the rails folder.
Any other ways ??

*Update 4th Oct 2007*

Dir.pwd is a better way

June 11, 2007

Ruby: Can’t modify frozen string

Filed under: Ruby — Vivek Khokhar @ 1:14 am

Workaround:

_use_me = frozen_string.dup

Rails RJS redirect

Filed under: Ruby, Rails — Vivek Khokhar @ 1:12 am

page.redirect_to :action => ‘thanks’, :p1 => @g_resp.params[”_code”], :p2 => @r_id

June 1, 2007

Form tag
Extra Vertical Space Problem

Filed under: Uncategorized, css — Vivek Khokhar @ 3:48 am

Fix:
form style=”margin-top: 0px;margin-bottom: 0px;”

May 28, 2007

Tips & Tricks

Filed under: Uncategorized, mysql — Vivek Khokhar @ 11:57 pm

Mysql Getting Random Row: “order by rand()”

April 19, 2007

textbox image alignment problem

Filed under: Ruby, css — Vivek Khokhar @ 12:40 am

Problem:

text_field(:member, :dob,:size=>”20″, :maxlength => “50″,:tabindex=>”22″) img_tag

Fix:

text_field(:member, :dob,:size=>”20″, :maxlength => “50″,:tabindex=>”22″) img_tag {:style=”position:absolute”}
Next Page »

Powered by WordPress