Jump to content

HOLY ROBIN, BATMAN!


L8V2L

Recommended Posts

I don't even know what to say. All of this is needlessly complex and terrible practice, and you decide to throw eval in for good measure? Yikes. eval does absolutely nothing in that context, by the way. What's the point of eval(0) or eval(1)? There's no point. You might have a future in code obfuscation contests.I'm reminded of this commercial.

You have stupid Microsoft's ASP on here! Why not nodejs?! Edited by L8V2L
Link to comment
Share on other sites

*I* don't have anything on here. If I had to guess why they have ASP on here, my guess would be because they wrote the entire site in ASP, which was current when the site launched in 1999. If I had to guess why they don't have Node.js on here, my guess would be because none of the people who maintain the site have studied it. And what does any of this have to do with the rest of this thread or what you quoted?Listen, if you want to learn Node.js, then the solution is to go to a place that teaches it. We get it that you want them to make a tutorial for it. Maybe they will, maybe they won't. You've made your point, now stop talking about it. If you want to learn it then go learn it.Look at that: a beginner book and a reference for $10.http://www.nodebeginner.org

Link to comment
Share on other sites

*I* don't have anything on here. If I had to guess why they have ASP on here, my guess would be because they wrote the entire site in ASP, which was current when the site launched in 1999. If I had to guess why they don't have Node.js on here, my guess would be because none of the people who maintain the site have studied it. And what does any of this have to do with the rest of this thread or what you quoted?Listen, if you want to learn Node.js, then the solution is to go to a place that teaches it. We get it that you want them to make a tutorial for it. Maybe they will, maybe they won't. You've made your point, now stop talking about it. If you want to learn it then go learn it.Look at that: a beginner book and a reference for $10.http://www.nodebeginner.org

You lock my thread, that why I post this here, okay, I get it. I check out that book already, it's not structure right for me. I like books that are more as js definitive guide is(straight to the point, min small talk, and pliantly of example).

 

What of my explanation of why it doesn't work?

Edited by L8V2L
Link to comment
Share on other sites

What of my explanation of why it doesn't work?

I'm not going to address those examples, none of them are practical. You wouldn't use code like that in any production environment. Stick to practical examples that you might actually use. Avoid boolean operators when setting or changing values. The only place a boolean is fine when setting a value would be something like this:
function handler(e) {  var ev = e || window.event;  ...}
Anything more complex than that is asking for trouble. Keep it simple. Some people will use things like that because it is more concise than writing this:
if ((typeof e) == 'undefined') {  var ev = window.event;}else {  var ev = e;}
That's fine. With something like this:((num === 1)&&(function(){return(--num);})())||(++num);or this:((num === 1)&& eval(--num))||(++num);or this:((num === 1)&& --num)||((num === 0) && ++num);I wouldn't even know where to start. If I saw anything like that in code that I was working on I would figure out what it is trying to do and replace it with something that makes sense. Then I'd go find whoever thought it was a good idea to put it there and hit them.

You lock my thread, that why I post this here

A word of advice: if a moderator locks your thread, do not continue discussing the same thing somewhere else. There's a reason I locked that thread, and that reason was not because I wanted you to keep talking about it.
Link to comment
Share on other sites

I'm not going to address those examples, none of them are practical. You wouldn't use code like that in any production environment. Stick to practical examples that you might actually use. Avoid boolean operators when setting or changing values. The only place a boolean is fine when setting a value would be something like this:

function handler(e) {  var ev = e || window.event;  ...}
Anything more complex than that is asking for trouble. Keep it simple. Some people will use things like that because it is more concise than writing this:
if ((typeof e) == 'undefined') {  var ev = window.event;}else {  var ev = e;}
That's fine. With something like this:((num === 1)&&(function(){return(--num);})())||(++num);or this:((num === 1)&& eval(--num))||(++num);or this:((num === 1)&& --num)||((num === 0) && ++num);I wouldn't even know where to start. If I saw anything like that in code that I was working on I would figure out what it is trying to do and replace it with something that makes sense. Then I'd go find whoever thought it was a good idea to put it there and hit them. A word of advice: if a moderator locks your thread, do not continue discussing the same thing somewhere else. There's a reason I locked that thread, and that reason was not because I wanted you to keep talking about it.
.... I'm on my phone and just wrote up a lot of things then went to make sure how to spell something correctly.... It refresh... Okay, I only did all that coding to experiment, I want actually use that in a real application(maybe). I even put eval(); in there as another away to invoke the expression, even know it wasn't necessary(<--the word I look up). And something something.... I hope you do change your mind about looking over my two short conculsion in that post I post.
Link to comment
Share on other sites

I hope you do change your mind about looking over my two short conculsion in that post I post.

Are you talking about the things you write in code comments? It's hard for me to read some of your posts, if you have something to say don't put it in a code block. It's hard to understand what you're saying sometimes, concentrate on spelling and grammar. "Incise" does not mean what you think it does, for example:http://www.merriam-webster.com/dictionary/inciseAs far this goes:((num === 1)&& --num)||((num === 0) && ++num)If you want to figure out what it does then just execute it like a computer. Replace the expressions with what they evaluate to, like the computer does.
num = 1;((num === 1)&& --num) || ((num === 0) && ++num)(true && --num) || ((num === 0) && ++num)(true && 0) || ((num === 0) && ++num)false || ((num === 0) && ++num)false || (true && ++num)
When num starts at 1, it will decrement it, that expression becomes false, so it executes the other OR expression since the first one was false. With an OR expression, if the first condition is true then it does not execute the second one, it doesn't need to. Since either expression can be true in order for the OR expression to be true, if it finds any true expression then it stops executing and the entire OR expression is true. That's called short-circuiting. The same thing happens with AND. If any expression in the AND is false, then the entire AND expression will be false so it stops checking the other conditions.
Link to comment
Share on other sites

Are you talking about the things you write in code comments? It's hard for me to read some of your posts, if you have something to say don't put it in a code block. It's hard to understand what you're saying sometimes, concentrate on spelling and grammar. "Incise" does not mean what you think it does, for example:http://www.merriam-webster.com/dictionary/inciseAs far this goes:((num === 1)&& --num)||((num === 0) && ++num)If you want to figure out what it does then just execute it like a computer. Replace the expressions with what they evaluate to, like the computer does.

num = 1;((num === 1)&& --num) || ((num === 0) && ++num)(true && --num) || ((num === 0) && ++num)(true && 0) || ((num === 0) && ++num)false || ((num === 0) && ++num)false || (true && ++num)
When num starts at 1, it will decrement it, that expression becomes false, so it executes the other OR expression since the first one was false. With an OR expression, if the first condition is true then it does not execute the second one, it doesn't need to. Since either expression can be true in order for the OR expression to be true, if it finds any true expression then it stops executing and the entire OR expression is true. That's called short-circuiting. The same thing happens with AND. If any expression in the AND is false, then the entire AND expression will be false so it stops checking the other conditions.
I believe that what I concluded:

 

/* im guessing or in better of a term, my conculsion is this: as && work, both side have to be true, if not, its false, any other value in numeric speaking is true, but zero, so when it evaluate to zero it becomes false and no effect is taking. one other mistory is that, what of ||... or maybe as you said JSG, that it does evulate but then is converted back cause the && become fault as so the or takes over and increament it.((num === 0)&& ++num)||eval(--num);/*this work:((num === 0)&& ++num)||(function(){return(--num);})();this mistake i made toggle((num === 1)&& ++num)||(function(){return(--num);})();does not work((num === 1)&&(function(){return(--num);})())||(++num);does not work((num === 1)&& function foo(){return(--num);})||(++num);*//*I'm guessing or in better of a term, my conculsion is this: as && work, both side have to be true, if not, its false, any other value in numeric speaking is true, but zero, so when it evaluate to zero it becomes false and no effect is taking. one other mistory is that, what of ||... or maybe as you said JSG, that it does evulate but then is converted back cause the && become fault as so the or takes over and increament it.*/((num === 0)&& ++num)||eval(--num);/*&& ||1 == true0 == false1&&0(--num == 0 == false)||1 eval();1&&1(++num==1==true)||non-eval();*//*this work:((num === 0)&& ++num)||(function(){return(--num);})();this mistake i made toggle((num === 1)&& ++num)||(function(){return(--num);})();does not work((num === 1)&&(function(){return(--num);})())||(++num);does not work((num === 1)&& function foo(){return(--num);})||(++num);*/
Link to comment
Share on other sites

No milk for you.(hold a water bottle up and spare in the cat face) bad kitty, bad.

 

Coding is not an obfuscation contest. That same code can be written so that its purpose is obvious.

Link to comment
Share on other sites

Coding is not an obfuscation contest. That same code can be written so that its purpose is obvious.

It was just for experimenting, educational learning, and to gain understanding... It's not like I'mma end up writing complicated code cause I like it in such a written matter... I think....

Edited by L8V2L
Link to comment
Share on other sites

 function myFunction(x, y) {    eval(((y)&& eval(y = y))||eval(y = 1));//(((y)&&(y = y))||(y = 1)) <-- this is another way you could do it    return x * y}document.getElementById("demo").innerHTML = myFunction(4);
Link to comment
Share on other sites

var js={arr:[{obj0:0,obj1:1,obj2:2}]};with(js.arr[0]){console.log(obj0+"n"+obj1+"n"+obj2);}
They need to rethink the deprecating of the with statement.
var js={arr:[{obj0:0,obj1:1,obj2:2}]};var wit = js.arr[0];console.log(wit.obj0+"n"+wit.obj1+"n"+wit.obj2);
...yeah, they need to rethink the deprecating of the with statement. Edited by L8V2L
Link to comment
Share on other sites

Do asp and php use two different query languages? I'm in Ajax tutorial and notices the query syntax for both of them are different.

Edited by L8V2L
Link to comment
Share on other sites

Another thing I notice is that in one of the example they have a responseText but the out put was an HTML table. So one can transfer HTML as sting and it'll be parse automatically when out put in an HTML page?

Link to comment
Share on other sites

Do asp and php use two different query languages? I'm in Ajax tutorial and notices the query syntax for both of them are different.

providing an example would be helpful, because you're all over the place with this one (client side code, server side code, and database interactions). Plus I have no idea if you mean query as in actual SQL query of your terminology is just way off.

Link to comment
Share on other sites

Do asp and php use two different query languages? I'm in Ajax tutorial and notices the query syntax for both of them are different.

http://www.w3schools.com/ajax/ajax_aspphp.aspPhp://get the q parameter from URL$q=$_REQUEST["q"]; $hint="";Asp:'get the q parameter from URLq=ucase(request.querystring("q"))

Another thing I notice is that in one of the example they have a responseText but the out put was an HTML table. So one can transfer HTML as sting and it'll be parse automatically when out put in an HTML page?

http://www.w3schools.com/ajax/ajax_database.asp
Link to comment
Share on other sites

Yes, ASP and PHP are two different languages. So it would be expected that the syntax and the way that you do the same thing would be different.

Link to comment
Share on other sites

Yes, ASP and PHP are two different languages. So it would be expected that the syntax and the way that you do the same thing would be different.

SQL is what I'm referring to. Or do they not need to use that language die this task? I see php using it(note that I'm not that knowledgeable on the SQL spec)
Link to comment
Share on other sites

SQL is what I'm referring to. Or do they not need to use that language die this task? I see php using it(note that I'm not that knowledgeable on the SQL spec)

there wasn't any SQL in those examples

Link to comment
Share on other sites

there wasn't any SQL in those examples

there wasn't any SQL in those examples

Oh. Than I mistaken the uppercase: //get the q parameter from URL$q=$_REQUEST["q"]; $hint="";For SELECT SQL style. On other note, with is a handle tool! When I start learning nodejs, I will request that they leave it in the v8 engine. I can think of many ways it could/will be useful!
var object = {}, obj = {prop0:0,prop1:1, prop2:2, prop3:3};    counter = -1;object.__defineGetter__('foo', function() {	return ++counter;});with(object){with(obj){console.log(foo+"n"+foo+"n"+foo+"n"+foo+"n"+prop0+"n"+prop1+"n"+prop2+"n"+prop3);}} // object[0,1, 2, 3], obj:[0,1,2,3]
I'll also request to extend the functionality of it, to take as many parameter as the programmer desire:
with(object, obj){...}
Edited by L8V2L
Link to comment
Share on other sites

with(Object){with(prototype){with(toString){with(call([])){slice(8,-1);}}}}// printout => Array//Object.prototype.toString.call(o).slice(8,-1);
Edited by L8V2L
Link to comment
Share on other sites

God, those examples are awful. Those examples are perfect illustrations as to why with should not be used. Do you have any clue why they have deprecated it? Have you read any of the reasons? Or do you think that you know so much about Javascript that you know better than the people writing the actual specifications? When you put your request in to keep it, make sure you provide your justification and that you have read their responses to other people requesting things like that, and make sure that your reasons are different than other reasons that got denied.

Link to comment
Share on other sites

God, those examples are awful. Those examples are perfect illustrations as to why with should not be used. Do you have any clue why they have deprecated it? Have you read any of the reasons? Or do you think that you know so much about Javascript that you know better than the people writing the actual specifications? When you put your request in to keep it, make sure you provide your justification and that you have read their responses to other people requesting things like that, and make sure that your reasons are different than other reasons that got denied.

I just want it in the v8 engine when I start to learn nodejs for server side scripting. There are add on for v8, and you can implement your own add on.And plus I'm just learning the language, I'm a novice at worst, so excuse me if I find that the with statement expand the scope of the object even though it'll cost in most case performance and speed.For small cases, I can't see why it's harmless.Instead of lashing at me, you could inform me(in knowledge me) of ALL the pitfall of the with statement.Answer this question below, after you answer the question above please.What of in a function?Since it'll be confined in a function scope, want that make it be more efficient? Edited by L8V2L
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...