View previous topic - View next topic |
Author |
Message |
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
Posted: Fri Jan 27, 2006 10:22 pm Post subject: |
[quote] |
|
BadMrBox wrote: | I tested it with Mozilla 1.5. Works well. And now I understand this thread. Didn't know about 1.6... much get it. |
Mozilla and Firefox are different.
|
|
Back to top |
|
|
RuneLancer Mage
Joined: 17 Jun 2005 Posts: 441
|
Posted: Fri Jan 27, 2006 10:45 pm Post subject: |
[quote] |
|
Thanks for testing it guys. :)
I would've been surprised if it wouldn't have worked. I was expecting, in a worse-case scenario, display problems.
Quote: | You've never yet said anything that has helped me at all, and I'm pretty sure the same holds for me to you. |
The latter case is, indeed, quite true. But the former isn't. In fact, a lot of people have said things you've discarded as hate and flaming but that were in fact very helpful information (iconsole ring a bell?)
If you want an example of advice, refer to the last post I directed to you on preloading images. Admittedly, at this point, bitterness is unevitable, but the fact remains that I went through the trouble of getting you a link to example source instead of leaving it at "lol image caching ftw dumbass lol lol".
Here's another tidbit to help you out: do not use innerHTML. You're breaking the DOM! The proper way to create new elements in a page is to insert document.createElement-ed objects into the DOM, not by forcing your objects into it by changing the innerHTML. Think it doesn't matter? We lost many hours on a browser-based application at work because we assumed it was all good and safe to do things that way then realized we had detached nodes not connected to the DOM because of it.
Want better performance? Cache things you reference multiple times. In fact, if you can avoid referencing things at all, your code will benefit.
Code: | Destination.valueOf[y].Name = Source[x++];
while ((Destination.valueOf[y].Name.indexOf(" ") == 0)
|| (Destination.valueOf[y].Name.indexOf("\n") == 0)) {
Destination.valueOf[y].Name =
Destination.valueOf[y].Name.substr(1);
} |
For instance, why not simply do this?
Code: | tempVar = Source[x++];
while ((tempVar.indexOf(" ") == 0) || (tempVar.indexOf("\n") == 0)) {
tempVar = tempVar.substr(1);
}
Destination.valueOf[y].Name = tempVar; |
(Not that there aren't better means of doing it. For instance, if you're so concerned about whitespaces and the likes, why not use a regular expression? In this case, the extra overhead won't be noticed unless you have quite a lot of tile names to extract from the header. On the other hand, it may even be faster than iterating through every character, and definately safer with a well-written expression. For that matter, I don't see tabulations being handled by that code...)
In fact, you could get rid of pretty much ALL safety checks and parsing by giving the user a graphical interface. Text input can have quite a lot of pitfalls whereas there's very little validation to be done with checkboxes, dropdown lists, and radio buttons...
Hehe, well, I've pretty much wasted a dozen minutes typing up a big-ass flame towards your godly javascript scripting abilities right there, so feel free to ignore this post. :) Iconsole had a lot to teach all of us. _________________ Endless Saga
An OpenGL RPG in the making. Now with new hosting!
|
|
Back to top |
|
|
BadMrBox Bringer of Apocalypse
Joined: 26 Jun 2002 Posts: 1022 Location: Dark Forest's of Sweden
|
Posted: Fri Jan 27, 2006 11:25 pm Post subject: |
[quote] |
|
I know what you mean but my browser is still named Mozilla Firefox 1.5. :P _________________
|
|
Back to top |
|
|
Nephilim Mage
Joined: 20 Jun 2002 Posts: 414
|
Posted: Sat Jan 28, 2006 12:47 am Post subject: |
[quote] |
|
RuneLancer wrote: | Here's another tidbit to help you out: do not use innerHTML. You're breaking the DOM! The proper way to create new elements in a page is to insert document.createElement-ed objects into the DOM, not by forcing your objects into it by changing the innerHTML. Think it doesn't matter? We lost many hours on a browser-based application at work because we assumed it was all good and safe to do things that way then realized we had detached nodes not connected to the DOM because of it. |
Whoa, I hadn't heard that. So setting innerHTML breaks stuff out of the DOM? Dang, I've done a bit of that (luckily, not in any released projects - just tinkerings).
Is that specific to a particular browser or something? Got an example that reproduces the problem? _________________ Visit the Sacraments web site to play the game and read articles about its development.
|
|
Back to top |
|
|
RuneLancer Mage
Joined: 17 Jun 2005 Posts: 441
|
Posted: Sat Jan 28, 2006 1:29 am Post subject: |
[quote] |
|
(Taken from http://erik.eae.net/archives/2005/04/08/18.13.31/ )
Quote: | But like most things, innerHTML has an ugly side that will break the most simple functionality. The problem is that when setting it, it will disconnect any previously existing DOM nodes.
var b = document.getElementById("my-button");
document.body.innerHTML += "<p>Add a paragraph?</p>";So in the example code above, b, is no longer part of the document. It has been disconnected and any code that relies on this has stopped working. |
(Ab)using innerHTML is not only unclean, it can lead to very ugly problems later on down the line. Our app would manipulate a virtual "tree" with nested divs. But navigating through it and retreiving paths soon ended up turning up weird errors that seemed to say branches were unplugged from the main DOM. This meant we couldn't navigate them back to the root; in fact, often, some branches simply didn't have parents at all! It took a bit of searching but we traced the error back to the innerHTML insertions we were doing. Once these were properly replaced, things ran fine.
Tests show that innerHTML is faster in some cases than the "clean" DOM way, but dynamic creation of elements in a webpage shouldn't occure in performance-needy sections of your code. Otherwise you should redesign your script to create the necessary controls during a less time-critical period. The tree control we created only creates new branches when they're expanded the first time to lighten the load, then hides (display=none, but only on the 'root' of the branch being hidden) them when they're unused (trees in the context of this particular application were huge, so loading the whole thing wouldn't have been smart.) The array of 400 images in my map editor are only created once; the only changes taking place afterwards are properties. Both of these apps would've failed in the performance department if everything was re-rendered to match the current context instead of working with what was already there.
There are other browser-specific bugs associated with innerHTML, though none as dangerous as this. :P Breaking the DOM WILL come back to haunt you eventually, trust me. Even if you don't think it will.
RuneLancer wrote: | There's this saying that goes something more or less like, build your house on a foundation of sand and it will break down in no time at all. Build a house on a foundation of stone, and it'll stand up to the toughest of storms. |
_________________ Endless Saga
An OpenGL RPG in the making. Now with new hosting!
|
|
Back to top |
|
|
Nephilim Mage
Joined: 20 Jun 2002 Posts: 414
|
Posted: Sat Jan 28, 2006 2:28 am Post subject: |
[quote] |
|
Cool, thanks for the info. I think you may have saved me some major headaches down the road. _________________ Visit the Sacraments web site to play the game and read articles about its development.
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Mon Jan 30, 2006 11:28 pm Post subject: |
[quote] |
|
RuneLancer wrote: |
There are other browser-specific bugs associated with innerHTML, though none as dangerous as this. :P Breaking the DOM WILL come back to haunt you eventually, trust me. Even if you don't think it will.
|
To the people here who enjoy certainty:
Any system you break will cause problems for you. In that case, RL pushed the DOM farther than it was made for. He interacted with it without restraint. Of course he screwed it up.
Typical INTP problems realizing objective relationships between things.
RL, just ignore this. I'm just making this clear to the judges who might try to apply your thinking to their own. (with poor results) Use innerHTML with discretion, as you would any function.
Suffice to say, he could have gotten by without creating document nodes in the first place. Using innerHTML you don't need to.
No, I've had enough. This is sickening. You are all idiots. I'm leaving, collective resource wasting bastards.
...No I'm not. Bjorn, you see what they've done. They deliberately applauded RL's little stunt. That's it. I'm going after them. I've got the right to. I'm really going to break their psyches to dust. That's a promise.
Bastards.
Last edited by tcaudilllg on Tue Jan 31, 2006 12:09 am; edited 1 time in total
|
|
Back to top |
|
|
RuneLancer Mage
Joined: 17 Jun 2005 Posts: 441
|
Posted: Mon Jan 30, 2006 11:54 pm Post subject: |
[quote] |
|
kthxbye!
No, seriously, this is what, the fifth time you leave?
Given how you act on the boards, it's hardly surprising people wouldn't be too cordial towards you. Granted, there was a brief moment where you seemed like you had started posting intelligently and would even make the occasional smart post, but then that ended. :/
Now, we're back to the whole iconsole thing. Yes, I deliberately made that script to spite you. But also to show you it was possible to improve your idea in ways you denied. But as we all know, you're always right, and whatever advice others give you is only right when it's advice you've been following right from the start.
So...
kthxbye, see you next week when you come back anyways, mate. :/
Edit: LG's PMs.
Quote: | Subject: You arrogant...
little piece of shit. Go stab yourself. |
Quote: | Subject: Powerless
*stabs* |
Quote: | Subject: You little coward.
Come out and face me. I'll keep on you until you do. |
Lol? What are you dude, like... 13? _________________ Endless Saga
An OpenGL RPG in the making. Now with new hosting!
Last edited by RuneLancer on Tue Jan 31, 2006 12:01 am; edited 2 times in total
|
|
Back to top |
|
|
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
Posted: Mon Jan 30, 2006 11:59 pm Post subject: |
[quote] |
|
Dude... just accept that you are capable of error.
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Tue Jan 31, 2006 12:04 am Post subject: |
[quote] |
|
RuneLancer wrote: | kthxbye!
No, seriously, this is what, the fifth time you leave?
Given how you act on the boards, it's hardly surprising people wouldn't be too cordial towards you. Granted, there was a brief moment where you seemed like you had started posting intelligently and would even make the occasional smart post, but then that ended. :/
Now, we're back to the whole iconsole thing. Yes, I deliberately made that script to spite you. But also to show you it was possible to improve your idea in ways you denied. But as we all know, you're always right, and whatever advice others give you is only right when it's advice you've been following right from the start.
So...
kthxbye, see you next week when you come back anyways, mate. :/
Edit: LG's PMs.
Quote: | Subject: You arrogant...
little piece of shit. Go stab yourself. |
Quote: | Subject: Powerless
*stabs* |
Quote: | Subject: You little coward.
Come out and face me. I'll keep on you until you do. |
Lol? What are you dude, like... 13? |
You imbecile. Did I not make clear that I never meant for it to be a map editor!?!?!? I've already made one of those, in HTML no less! It's about as powerful as your own... well... actually more powerful because it accepts URLs as image sources. I'm pretty sure there's a link to it here. This app was a generator, not an editor. I quite frankly did it to show off, but I didn't do it to get on people's nerves like you do!!!!
|
|
Back to top |
|
|
RuneLancer Mage
Joined: 17 Jun 2005 Posts: 441
|
Posted: Tue Jan 31, 2006 12:22 am Post subject: |
[quote] |
|
Ninkazu wrote: | RuneLancer actually doesn't really get on people's nerves. |
...Damn. Seems like I'm not trying hard enough. ;) (Kidding)
LG, just give it up. You're not a javascript god just like I'm not a C++ god. People try to show you better ways to do things, and you spit back in their faces. Then when people become bitter because of it, you throw a fit and claim you're leaving. This isn't the first time, and dude, you and I know it's not going to be the last.
Do you really think this is how you're going to make others appreciate your work? Humility is a virtue. I know damn well that despite the effort I put into it, Endless Saga isn't the end-all best sprite-based 3D RPG. I'm quite sure everyone who has posted screenshots and links to their work did so knowing the exact same thing. We all expect to be told "Well, it's interesting but..." by some people.
What people give you is advice. You can either throw hissy fits over it, send childish death-threat PMs, and keep getting people to dislike you more and more, or you can sit down, nod your head, and take their advice into consideration. One option will make a failiure out of you. The other isn't guaranteed to make you a respected veteran, but it certainly won't make things any worse than they are now.
You decide what to do, mate. _________________ Endless Saga
An OpenGL RPG in the making. Now with new hosting!
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Tue Jan 31, 2006 12:58 am Post subject: |
[quote] |
|
RuneLancer wrote: | Ninkazu wrote: | RuneLancer actually doesn't really get on people's nerves. |
...Damn. Seems like I'm not trying hard enough. ;) (Kidding)
LG, just give it up. You're not a javascript god just like I'm not a C++ god. People try to show you better ways to do things, and you spit back in their faces. Then when people become bitter because of it, you throw a fit and claim you're leaving. This isn't the first time, and dude, you and I know it's not going to be the last.
Do you really think this is how you're going to make others appreciate your work? Humility is a virtue. I know damn well that despite the effort I put into it, Endless Saga isn't the end-all best sprite-based 3D RPG. I'm quite sure everyone who has posted screenshots and links to their work did so knowing the exact same thing. We all expect to be told "Well, it's interesting but..." by some people.
What people give you is advice. You can either throw hissy fits over it, send childish death-threat PMs, and keep getting people to dislike you more and more, or you can sit down, nod your head, and take their advice into consideration. One option will make a failiure out of you. The other isn't guaranteed to make you a respected veteran, but it certainly won't make things any worse than they are now.
You decide what to do, mate. |
Advice? Where is this advice? They critique me and tell me my way is "WRONG, you should do it THIS way instead", and give me poor reasons for doing so.
I never claimed to be a Javascript god. What I am is a creator. I create things. I try to create them with a purpose, but quite frankly just the momentary fulfillment of that purpose is enough for me. Even then I'm finding myself scrambling for new reasoning to continue on my original purpose as opposed to a new potential purpose that was previously not evident. I've already modified the layer generator codebase to scale the layers downward, fitting the layers beneath into the layers above. I would have already shown that off, but it seems the reception is universally poor, so why bother?
At this point, all of my work is toward the creation of my game engine for AGDOP. Will I do that in JS? Probably not, because its probably not realistic. But I will at least have the algorithmic base for a conversion to say, FreeBASIC. In large part though, I really am trying to detatch myself from outside criticism. It seems an illusion of the times and not really "real", something fabricated by an elaborate system. I'd rather not be a part of the system. I'd rather rise above it.
|
|
Back to top |
|
|
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
Posted: Tue Jan 31, 2006 1:32 am Post subject: |
[quote] |
|
LordGalbalan wrote: | I don't care that I'm not a genius. I've already deduced what the experience of genius is and I find it incomplete and lacking compared to my own. |
Geniuses can realize their limitations. You, however, are blissfully ignorant to everything and everyone other than yourself. Despite that, you post your bullshit here expecting praise. You don't receive it and whine. Face it man, you're shutting yourself off from reason. You think you're in an illusion of the times? You want to rise above the system? What the fuck did you just do, get philosophically moved by the Matrix sequels or something? I don't want to get into a metaphysical argument about what's real and what's not, but I think we can agree (well everyone on this forum except you) that whatever reality IS, in this "illusion" of what you speak, there exists good programming. You don't possess such a skill in this reality or the next.
|
|
Back to top |
|
|
cha0s Egg-Sucking Troll Humper
Joined: 16 Dec 2003 Posts: 37 Location: This cramped little box.
|
Posted: Tue Jan 31, 2006 1:42 am Post subject: |
[quote] |
|
is this some kind of sick therapy _________________ Are you guys *sure* I should do this, man?
-Half Baked
|
|
Back to top |
|
|
tunginobi Wandering Minstrel
Joined: 13 Dec 2005 Posts: 91
|
Posted: Tue Jan 31, 2006 3:05 am Post subject: |
[quote] |
|
Probably. These guys seem to get their kicks from bashing up LG.
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|