Thursday, December 25, 2008

Merry Christmas janab..koi cake khillao bhai


Hey folks,

Merry Christmas to all my blog readers

Recently life is going all round and am missing my life partner as she is not here with me this Christmas
but first some news....
This tuesday, had a test drive for Mitsubishi outlander, its AWD and multi-tronic engine.. phenomenal... just phenomenal.
I am planning to have a web application of my own, very soon!! and planning to make money of it too :)) . You know what!! i desperately need it....in the all possible right ways.... bu ya will not disclose about it, any more....

a small incident that i am going to narrate today, goes like this.....
I was ought to see-of my life partner as she was going out of station in this long weekend(this Christmas) and first time see was travelling alone in a train and that too out for about 4-5 hrs... and worst was yet come, train was late by 4 1/2 hrs can anybody think of it.. train ideal timing was 9.40 hrs but came at 14.30 hrs in the period my kudi thought of why not take up bus instead of train(i convinced her ... as in any case travelling in 2 tier AC compartment is much much better and safe to that of non-Volvo bus)

but this waiting time provided us to have a sneak preview to Mr. Lalu Prasad Yadav.. current railway minister for India.. and he was there inspecting a new rail engine....
surrounded by many officials and many security persons.. complete station was under tight coverage from RAF personals and everywhere gunmen were standing alert

first time i and my kudi watched him from a very small distance... looking good in white netaji dress.. many people may be having as many as hundred thousand point of view/thought of him but he is good whatever he does and if he doesn't he shows that he has done better.. than he could have.. see the layer of abstraction in real life :))

and here are some of the snapshots.... :)

Friday, December 12, 2008

Recession synonymous to opportunity?

Hi,

This time no talks on tips and tricks or things like that.... i being the software engineer, have a lot of time to do lot of things but still do nothing more than sitting in front of a VDU and figuring to make money out of this LCDisplay which is said to have a mind somewhere done in its CPU :))

anyhow i carry a fm radio with me always (actually its in my phone :)) ), now coming to point i was hearing @ radio mirchi at 98.3 Mhz( and you know what it is HOT!!!) which were asking people what good or bad this recession has done to people here in India (in Delhi, to be precise) . and as usual in india people full of thoughts but not so full of implementation gave not less than any hundred thousand responses and mind you some of them were really very phenomenal in their way.

and like a very true indian have lost almost all of them(not able to recall even few of their conversation, now!!) but got to a slideshow which is some where doing the same thing :)

Have  a look at it below
Don't Stop - Keep Going
View SlideShare presentation or Upload your own. (tags: jay mcdonald)
and do share the comments if you have any :)

Friday, December 5, 2008

Change chrome search engine on the fly!!

Hi folks,
i know it is(my blog) not that interesting, but still some of you stumble on to it... thank you very much for that.
And as, now that formality is over here is one post just FYI (For your information) :)
I am using Chrome say from last one and half month or so. Despite may other new/old features, the one feature that i would like to discuss over here is the feature of change of search engine on the fly.


Its like if you have list of search engines in your chrome, it asks to press tab the time it realizes, you are approximately typing the search engine in address bar



and it self learns and list downs sites which serves the find/search feature, other wise one can manually add it also.
it looked good to me... at least from a developer's UI perspective :))

Tuesday, December 2, 2008

Voted in New Delhi constituency elections

I am proud-of for vote that i casted for New Delhi, India constituency on November 29, 2008. In the so lived life span of Homo sapien this is the first time i did so.. and feeling great. 
I know i am late by days in writing this post but even then the "vote casting" acknowledgment on my left index finger is still intact(in fact it turned from blue to black after hand wash) 


[have a look :)]
by the ways guys who are not willing to cast their  vote just because they don't like any of the contenders standing in election, their is a provision where you can cast the vote for "none of them" which will later result into re polling if this particular response gets majority(details can be found on net) but don't know why this basic knowledge is not shared amoung indian public.

Wednesday, November 26, 2008

Delhi Manali rohtnag-paas and back to Delhi

Recently was on a out-of-station trip to manali and to be precise rohtang paas, with other two friends of mine... trip was dangerous as it was my car which ran this long trip(my swift) and you know what!! i have started loving my car and really proud owner of it :)

here are few of snapshots from trip...

View SlideShare presentation or Upload your own. (tags: delhi manali)


Tuesday, November 25, 2008

Praveen Kumar Sinha @ first in google search

Hey,

Has just returned from a long weekend trip.
A trip from dehi to kullu-manali to rohtang paas and back to delhi... will blog about this later  but after to my surprise and a fair long interval of time 
my blog is coming at no1 in google search result  yaa yaa.. screen shot is available, have a look

 
and in yahoo my linkedin profile, my digg profile are on the first page... feeling happy and feeling great!!!


and will surely talk about the trip.. pakka!!! :))


Tuesday, November 18, 2008

Is there any 'Forward' or just 'Redirect' in RAILS?

I have been thinking from the very start what is the difference between the two? when i just heard this question(refer the heading my dear). and the answer is the 'browser', yes!! the browser...

Redirect means from one controller/action to another controller/action via browser meaning a 302 response is sent after evaluation completes for the first controller/action pair and then the new controller/action is called from the browse( one can see the url changing as a result of this in the address bar)
[this Gyan is achieved by

redirect_to(options = {}, response_status = {})
Redirects the browser to the target specified in options.

&

Forward means hopping to new controller/action from the correct place without going to browser.
but does rails ever legally allowed any thing like forward.. i personally don't think so... (because either i am not aware of it or rails don;t have it) :))

in that case how to implement this forwarding thing(which as such don't exist)
two ways that i can figure it out to achieve is..

1) using "render" i.e by calling some desirable template or other render option(s) for the current controller/action (but issue arises when one need to render action of some other controller, ya ya i know in rails you have your own pilot seat so go ahead :) )

2) is using normal function call i.e calling the action defined as function(with override/non overrides params) and here also drawback is same... but remember to use return after that otherwise DoubleRenderError is for you :)

and quest is on and rest will become history very soon....


Monday, November 17, 2008

Image cut-outs(css style) to make icon display

I am on the development side only when it comes to web portals and all, but many of time i have been asked to do some adjustment in CSS (which i feel undesirable, as i am not even OK in it) and some time these web browser behave in a naughty way

So to the issue to tackle is : How to use small images in icons as small icons are sometimes not loaded in IE (you have to pre load them and things like that in javascript)
and the answer is hidden in CSS (i recently came to know about it and implemented my self)

well for this the prerequisites is to have a images with many small icons inside it like this

and a css style class with something like
.icons {
background-image:url(/images/icon_collection.png);
background-repeat:no-repeat;
display:block;
height:18px;
margin-left:10px;
margin-right:6px;
width:18px;
}

.icon_one {
background-position:-156px -83px;
}

and apply it on div like this
<div class="icons icon_one"> </div>

so that can give result like this ...


point to note is
background-position:x-pos y-pos;

:) happy cssing

Saturday, November 15, 2008

Customized collage from picasa3


Hello world,
This time nothing from the coding side :) . I am just sharing a quicky of a new advanced feature from picasa3… and that is one can customize collage while creating it.

First and foremost thing is that many are not even known to picasa and those of you are aware of it is not aware of its making collage feature and those of you are aware must have noticed it that picasa although use to provide the facility of making a collage but nothing more than that (at max user has the option to randomize the snaps and nothing more), well that was the story of Picasa2.

But good news guys, drawing board has changed and now you are in full control of what you want to show and how to show and how much to show.. an all thanks to picasa3
 

Thursday, November 13, 2008

Hacking out JIRA from atlassian

Note: i am not being negative over here just a bit naughty :)
Relax guys!! i am not actually hacking it out... i have just exploited one of the processes and what purpose it solves.. well it depends...

One can reuse expired evaluation version of JIRA any number of time and successfully running this hack will again grant you one cycle of 30 days evaluation
(this will do work till the time real guys didn't come to know about it :)) )

so now what if you evaluated jira and you liked it but not want to pay (but guys, developers too are human beings so don;t make it a habit :)) ) 

Try this work around.

Even if everything is hanged up at your local jira server, it provides the facility to get the backup in the from of xml(a single file) and system even provides a zipped version too 

so the prerequisite is to have a backup file from the jira running machine and unzip to get the backup XML, and then follow the following steps..

Step 1: Get a JIRA back up and un-compressed it to get the real xml if was compressed.

Step 2: In the XML search in the lines which contains following strings.
<OSPropertyString id="10013"
<OSPropertyString id="10014"

Clear their values.. and the lines should look something like
<OSPropertyString id="10013" value=""/>
<OSPropertyString id="10014" value=""/>

Step 3: Now in the out of date jira... go in section for "Restore data from xml"

Step 4: Provide the modified jira backup file path and jira location file path and <don't> enter any licence........ and click "restore"

Step 5: It will give "JIRA Access Constraints" on the page with some details like 
< 2008-11-12 17:47:07   error   Invalid license key specified. >

Step 6: Click the "Edit License" link, which will take you to "Confirm License Update" page

Step 7: At the bottom of page there is an statement "You can generate an evaluation license instantly online" click the "online" link word which will take you to http://www.atlassian.com

Step 8: Now provide the atlassian credentials i.e email and password.... and log in

Step 9: You will land in "Generate Evaluation License" click the Generate button  and copy the generated "License Key" from the text area

Step 10: Update "License Key" so generated in "Confirm License Update" page and click proceed

if everything remains intact you are done
and now restart the server and you are again up for 30 days

Wednesday, November 12, 2008

Conversion from mysql to sqlite database.. via rails

I faced this problem to have a sqlite database from an existing mysql.. and being the rails guy... i made it the rails way.. but of course there are other option available which will be fast .. this is kind of slow... but works for small stores :))

Steps are..
1. Create a source model which is connected with mysql connection/using mysql adaptor
class SourceDB < ActiveRecord::Base
end
SourceDB.establish_connection($config["database_mysql"])

2. Create a destination model which is connected with sqlite connection/using sqlite adaptor
class TargetDB < ActiveRecord::Base
end
TargetDB.establish_connection($config["database_sqlite"])

3. Create schema from source database so that can reproduce it in destination(sqlite) database.
File.open(name_of_schema_file,"w") do |file|
  ActiveRecord::SchemaDumper.dump(SourceDB.connection, file)
end

4. Alter the generated schema file to remove line which contains "add_index" as these are of no use in sqlite conversion process

5. Then load the altered schema file (change the ActiveRecord::Base.connection to point to destination database before loading)
ActiveRecord::Base.connection = TargetDB.connection
load(name_of_schema_file)

6. and now resurvely iterate with all tables in source database and transport it to derstination (sqlite) database

Source file [mysql_to_sqlite.rb]
require 'rubygems'
require 'active_record'
require 'active_support'
require 'sqlite3'
require 'active_record/schema_dumper'

require "yaml"
require "create_class.rb"

t1 = Time.now
$config   = YAML.load_file("config/config.yml")
name_of_schema_file = ($config["schema_file"])

class SourceDB < ActiveRecord::Base
end
SourceDB.establish_connection($config["database_mysql"])

class TargetDB < ActiveRecord::Base
end
TargetDB.establish_connection($config["database_sqlite"])

puts "dumping the schema"
File.open(name_of_schema_file,"w") do |file|
  ActiveRecord::SchemaDumper.dump(SourceDB.connection, file)
end

puts "discarding index(es)"
line_array = Array.new
File.open(name_of_schema_file,"r") do |file|
  file.each { |line|    line_array << line  unless line.include?("add_index")}
end

File.rename(name_of_schema_file, "original_#{name_of_schema_file}")

File.open(name_of_schema_file,"w") do |file|
  file.puts(line_array)
end

puts "loading the schema"
ActiveRecord::Base.connection = TargetDB.connection
load(name_of_schema_file)


SourceDB.connection.tables.each do |tbl|
  puts "Table_initiated: #{tbl.inspect}"
    SourceDB.set_table_name tbl
    SourceDB.set_inheritance_column ""
    
    create_class('TargetModel', TargetDB) do
      set_table_name tbl
      set_inheritance_column ""
    end
    puts "=========for table: #{tbl}=========="
    total_record_in_table = SourceDB.count_by_sql("SELECT COUNT(*) from #{tbl}")

    tub_size = 1000
    no_of_iteration = ((total_record_in_table % tub_size) == 0) ? (total_record_in_table / tub_size) : ((total_record_in_table / tub_size) + 1)

    for j in 0..(no_of_iteration-1)
      current_record_set = SourceDB.find(:all,:offset => (j*tub_size), :limit => (tub_size - 1))

      current_record_set.each_with_index do |record,ind|
        record_copy = TargetModel.new
        record.attributes.each do |key,value|
        record_copy.send("#{key}=",value)
        end
        record_copy.save
        puts "Completed: #{((j*tub_size) + ind)} of #{total_record_in_table}   with id: #{record_copy.id} ."
      end
    end
end
        
t2 = Time.now

puts "Process initiated at: #{t1}"
puts "Process completed at: #{t2}"
puts "Time elapsed        : #{t2-t1} seconds"

Source file [create_class.rb]
def create_class(class_name, superclass, &block)
  klass = Class.new superclass, &block
  Object.const_set class_name, klass
end

Configuration file [config.yml]
database_mysql:
  adapter: mysql
  database: databse_name
  username: root
  password: xxxxxxxx
  host: xxx.xx.x.xxx
  timeout: 5000
  encoding: utf8

database_sqlite:
  adapter: sqlite3
  database: sqlite_database_file_with_path.db
  
schema_file: schema.txt

Introduction(a bit of me)


Well!!!

to start of

Praveen Kumar Sinha... Indian by heart... &
world by nature(at least to someone)...



and the resume goes like this
riding rails with ruby saddle(and you know what!!! i am lovin it :))

MCA from delhi and the rozi roti media is computers(to be precise, "softwares" and to be more precise, "MPS Technologies Ltd..")

and answer for "kyun" & "why" questions
aweenhee!!!

Product i developed...


Firms is/was associated with...






Honda Civic & A/C problems.

Hello Friends, Got a post again on to Honda Civic (The good old favorite commuter of mine). This car has been doing great except for so...