Saturday, October 28, 2006

Need Help with ROR

i have such code:

q="${name}"
name=b
puts q

i will get "b"

but if f get a string from database, like

q=product.url //url is alse"${name}"
name=b
puts q

i still got "${name}"

should i use "eval", how to use it????????

Friday, October 27, 2006

Surprising

Be surprised by http://yubnub.org/
Really Amazing.
Actrully, it is rewarded last year. how cool the idea is.

Friday, October 20, 2006

Interesting Use with CSS

like

 a.info {
/* This is the key. */
position: relative;
z-index: 24;
text-decoration: none;
}
a.info:hover {
z-index: 25;
color: #FFF; background-color: #900;
}
a.info span { display: none; }
a.info:hover span.info {
/* The span will display just on :hover state. */
display: block;
position: absolute;
font-size: smaller;
top: 2em; left: -5em; width: 15em;
padding: 2px; border: 1px solid #333;
color: #900; background-color: #EEE;
text-align: left;
}
and use it

<a class='info' href='#SASL'>Simple Authentication and Security Layer (SASL) protocol<span> (</span><span class='info'>Myers, J., &ldquo;Simple Authentication and Security Layer (SASL),&rdquo; October&nbsp;1997.</span><span>)</span></a> 

Sunday, October 08, 2006

ROR Pattern?

i am thinking of RoR Pattern these days? what is the best practise of development with RoR?

besides the petterns of OO or architecture, what's more for RoR. as we notice , many books about ruby or rails just have a basic introduction or provide a sample application of it. we know the grammar or structure or RoR application, but, it will got mass if no rule exists.

as we know, RoR provide a framework of MVC, which is good to decide the layers in application. however, it will cause some problems. some one said, they even develop a application with a large CONTROLLER. how it can be modified by a team of several developers. SVN become almost useless in this situation.

these are the questions i am thinking of. i may write them out if i have answer and welcome to share your answer.

how many CONTROLLER is suitable, and what the responsiblity and how to devide them
how to use render_component, which means how to devide view to small element
how to use modules, helpers, application.rb, etc
how to organize CSS files, how to devide them to suitable size

still thinking? provide my answer later.

Friday, October 06, 2006

Just a notice for Server Push

The key is the type of request, make it to be multipart/x-mixed-replace, which means multiple data package is contained in response, each will replace the previous one.


as practice, you can try something like


function handleContent(event)
{
var result = event.target.responseXML;
}

var xrequest = new XMLHttpRequest();
xrequest.multipart = true;
xrequest.open("GET","some url to send data intervally",false);
xrequest.onload = handleContent;
xrequest.send(null);