Recently I faced a strange problem in javascript, I wanted to pass window.location.href in javascript src tag, but In javascript following holds true
Following is the quick hack which can be used for it
<script type='text/javascript'>
var pid = encodeURIComponent(window.location.href);
var jis='http://somehost&u='+pid;
document.writeln("<script type='text\/javascript' src="+jis+"><\/script>");
</script>
Tuesday, January 31, 2006
Sunday, January 15, 2006
PHP is going to catch soon on rails
Zend which is company behind php is in process of developing framework named "Zend Framework" which is surely inspired from rails, I just finished listening to there webcast, and though it looks like rails but surely it contains alot more than rails obviously because zend is collaborating with lot of companies and this time they will come like big bang as they will have complete ecosystem, like proper doc,IDE(yes), proper samples,etc,etc though one can argue that most of these things rails already have, But given a choice I would surely go for php framework simply because php is not only fast but very easily portable, I can configure mod_php in 10 minutes but I couldn't configure rails with apache2 using fcgi even in 2 full days :-).
Tags: php zend zendframework rails rubyonrails HemantOnRails
Tags: php zend zendframework rails rubyonrails HemantOnRails
Thursday, January 12, 2006
RollingOnRails: Possible to use RJS to send dynamic JavaScript to client?
I am try'g to figure out some easy way in rails for flushg user specific(generated diff for each client, actually jst some variable value changes)Javascript to browser
Following is what I have tried
1) Client requests javascript by
script src="http://perfecthost/model/getjs/213j5sxfsaj23523"
On server side I need to change 3 variable values bfore I flush JS to client, now since rhtml dnt understand JS content type, I am left with newly introduced RJS
2) Since RJS templates is not yet in Rails 1.0 i have installed this plugin from Fausr site simply using following
script\plugin install http://www.codyfauser.com/svn/projects/plu
gins/javascript_generator_templates/
3) Now I copied all the JS code in getjs.rjs,
4)Now I get error say'g template not found.
Seems like I have tell controller tht I am using RJS template?and few other things?
Any1 can point to the sample? Sample given here really don't help !
Just to make things lil more tougher plugins page has gone under maintenance, I hope it will come-up by morning...
Tags: RollyingOnRails Rails Ruby HemantOnRails
Following is what I have tried
1) Client requests javascript by
script src="http://perfecthost/model/getjs/213j5sxfsaj23523"
On server side I need to change 3 variable values bfore I flush JS to client, now since rhtml dnt understand JS content type, I am left with newly introduced RJS
2) Since RJS templates is not yet in Rails 1.0 i have installed this plugin from Fausr site simply using following
script\plugin install http://www.codyfauser.com/svn/projects/plu
gins/javascript_generator_templates/
3) Now I copied all the JS code in getjs.rjs,
4)Now I get error say'g template not found.
Seems like I have tell controller tht I am using RJS template?and few other things?
Any1 can point to the sample? Sample given here really don't help !
Just to make things lil more tougher plugins page has gone under maintenance, I hope it will come-up by morning...
Tags: RollyingOnRails Rails Ruby HemantOnRails
Wednesday, January 11, 2006
RollingOnRails: How to use link_to when call ctx is out of client ctx
here is the problem scenario
Client do a signup --> Controller do validations, if successful, say "thanks" to client, so I take it as client ctx is closed, now I need to send email to client asking for email verification, so jst after sending "thanks" to client, I call another models (but uses same DB table as caller)API Notifier::deliver_signup_thanks
Now this api is mapped to a RHTML file, which contains following link
http://host/emailverify/somebiguniqueidcomeshere
Now for generating above link, I want to use link_to thus avoid hardcoding hostname in rhtml, but link_to fails here say'g url_for not found.
Currently only way I see to solve this issue is to use environment variable wherever we need to specify hostname, but I just wanna find what is the best approach for this?
Any1?
Tags: rails ruby RollingOnRails HemantOnRails
Client do a signup --> Controller do validations, if successful, say "thanks" to client, so I take it as client ctx is closed, now I need to send email to client asking for email verification, so jst after sending "thanks" to client, I call another models (but uses same DB table as caller)API Notifier::deliver_signup_thanks
Now this api is mapped to a RHTML file, which contains following link
http://host/emailverify/somebiguniqueidcomeshere
Now for generating above link, I want to use link_to thus avoid hardcoding hostname in rhtml, but link_to fails here say'g url_for not found.
Currently only way I see to solve this issue is to use environment variable wherever we need to specify hostname, but I just wanna find what is the best approach for this?
Any1?
Tags: rails ruby RollingOnRails HemantOnRails
Subscribe to:
Posts (Atom)