|
Well, spaces are the superior option
|
# ? Dec 17, 2012 08:23 |
|
|
# ? Jun 1, 2024 06:26 |
|
LordAndrew posted:The commit message on GitHub just says "use_spaces". I'm pretty sure that Crockford's commit messages have come up in the coding horrors thread at least once.
|
# ? Dec 17, 2012 08:24 |
|
Wheany posted:e: Wait, so using tabs is not even an option? It just straight-up does not allow the tab character anywhere? Looks like he removed an option called "mixed" that detects mixed tabs and spaces, then added one called "use_spaces" that just detects tabs. Probably just a defaults thing. The commit comment is lazy and misleading. akadajet fucked around with this message at 12:22 on Dec 17, 2012 |
# ? Dec 17, 2012 12:18 |
|
akadajet posted:Looks like he removed an option called "mixed" that detects mixed tabs and spaces, then added one called "use_spaces" that just detects tabs. Probably just a defaults thing. The commit comment is lazy and misleading. Is there a way to toggle it so that I can use tabs, or should I start learning to embrace spaces for indentation?
|
# ? Dec 17, 2012 12:29 |
|
LordAndrew posted:Is there a way to toggle it so that I can use tabs, or should I start learning to embrace spaces for indentation? Just tested my theory of setting "use_spaces: true" and it didn't work. So I don't really know what to tell you.
|
# ? Dec 17, 2012 12:59 |
|
Just use spaces.
|
# ? Dec 17, 2012 13:06 |
|
edit: never mind, i literally don't know what i'm saying
Deus Rex fucked around with this message at 13:40 on Dec 17, 2012 |
# ? Dec 17, 2012 13:11 |
|
As far as I can tell, use_spaces is not an option nor a preference.
|
# ? Dec 17, 2012 13:19 |
|
Deus Rex posted:where did he say anything like this? In the part where he says "My advice on JSLint: don’t use it. Why would you use it? If you believed that it helps you have less bugs in your code, here’s a newsflash; only people can detect and solve software bugs, not tools." var someNumber = 3; soemNumber = 4; Now you have a local variable called "someNumber" and a global named "soemNumber"
|
# ? Dec 17, 2012 13:32 |
|
Wheany posted:var someNumber = 3; Bet you wont make that mistake again after spending an hour debugging it. Character building.
|
# ? Dec 17, 2012 13:37 |
|
Wheany posted:In the part where he says "My advice on JSLint: don’t use it. Why would you use it? If you believed that it helps you have less bugs in your code, here’s a newsflash; only people can detect and solve software bugs, not tools." enabling strict mode is even better than jslint for detecting this, since the second line throws an exception: http://jsbin.com/omefen/2/edit "static analysis tools can't detect bugs" is a pretty dumb thing to say for sure, but i hardly think that equates to "Global variables are totally cool and the more you use them, the better".
|
# ? Dec 17, 2012 13:47 |
|
Deus Rex posted:enabling strict mode is even better than jslint for detecting this, since the second line throws an exception: http://jsbin.com/omefen/3/edit JSLint catches the typo even in the delayed function without having to wait for the code to run. Of course instead of a delayed function, that mistake could be in you ajax failure callback or somewhere else which is rarely run.
|
# ? Dec 17, 2012 14:07 |
|
Hey Guys, I'm using the Backbone.js framework along with modelbinder/backbone.validations from GitHub. I've setup the page to do error validation on text fields/radio buttons and everything's working great, but I was wondering if any on has had experience/knows of any examples of doing error validation with check boxes with modelbinder. I need to set it up that if the user doesn't select one (or more) of a group of check boxes they get a error on forum submit.
|
# ? Dec 17, 2012 17:01 |
|
post some code and we'll help you figure it out
|
# ? Dec 17, 2012 18:12 |
|
smug forum rear end in a top hat posted:post some code and we'll help you figure it out Sure, give me a few this might bit to break apart to fit in a post. For background and bit better description I'm having the same issue described here: https://github.com/theironcook/Backbone.ModelBinder/issues/75 For a quick way to mess around with a similar setupand see what works/doesn't I've been using this: http://jsfiddle.net/43cgL/36/ So I have in my View that modelBinder binds everything code:
code:
code:
code:
1. If the user checks a checkbox and then unchecks it so that none of the three values are displayed display a error message. 1. On save/continue, all error validation is run on all the values of the forum. If there is a error (in this case, at least 1 of the 3 check boxes is not selected) a message is displayed. 2. After a save/continue remove the error message once the user clicks on one or more check box the error message needs to be removed. I'm not sure how to create a ModelBinder event that watches three (or more) values at once.
|
# ? Dec 17, 2012 19:48 |
|
Wrong thread. Will move to right one.
Vlaphor fucked around with this message at 00:41 on Dec 18, 2012 |
# ? Dec 17, 2012 22:58 |
|
Wheany posted:http://jsbin.com/omefen/3/edit cool! jslint and tools like it (jshint, closure linter) are very useful.
|
# ? Dec 17, 2012 23:29 |
|
Vlaphor posted:We have to use Java to draw an X-mas scene, but only using triangles and houses. This is the Javascript thread. Java is another language entirely. The guys in the Java or homework threads could probably point you in the right direction.
|
# ? Dec 18, 2012 00:25 |
|
Got another ExtJS specific question, one that Google has been no help with. I've got an infinite scrolling grid with a CheckColumn that I use to mark a record as dirty (changed). If the user marks a row as changed and then scrolls away from it, it will no longer be loaded into the store, because of how buffering for infinite scroll works. I was hoping that the clearOnPageLoad Store config would fix this, but it doesn't seem to apply to caching in buffered grids. The only listener I've been able to hook up to it is "beforeprefetch", which hasn't been doing what I need it to do -- specifically, it doesn't actually cancel a prefetch like it says it does when you return false. The changed rows are already cycled out of the store by the time beforeprefetch fires. How can I set up my grid to recognize my changed rows even after they're scrolled out of the store? I need my "Save Changes" button to affect all rows, and not just the currently visible ones. Am I gonna have to do some overriding? pksage fucked around with this message at 22:16 on Dec 18, 2012 |
# ? Dec 18, 2012 22:13 |
|
I'm trying to learn TypeScript, and I have this little piece of code:code:
|
# ? Dec 20, 2012 17:04 |
|
TypeScript only supports four types: number, bool, string, and any (untyped.) 'Array' is not a valid type. It's throwing an error on the first line. Also, holy poo poo, that is one of the worst documented supersets to javascript I've ever looked at.
|
# ? Dec 20, 2012 17:14 |
|
Yeah, and it isn't even finished yet. I solved the problem by writing this instead: code:
|
# ? Dec 20, 2012 17:45 |
|
Boz0r posted:I'm trying to learn TypeScript, and I have this little piece of code: "Array" is not a type in TypeScript, but you can specify an array of a given type like: JavaScript code:
http://www.typescriptlang.org/Content/TypeScript%20Language%20Specification.pdf Deus Rex fucked around with this message at 18:16 on Dec 20, 2012 |
# ? Dec 20, 2012 17:54 |
|
I'm trying to learn Javascript using codeacademy and I've run into a weird thing during one of the practices; despite following the instructions exactly, things aren't operating properly.code:
|
# ? Dec 21, 2012 20:10 |
|
when you write var multiplied = number * 2 on line 3, you're defining a new variable named multiplied. If you just say multiplied = number * 2 you'll re-use the variable you created in that outer scope. This is probably what you want to do.
|
# ? Dec 21, 2012 20:18 |
|
Jon Joe posted:I'm trying to learn Javascript using codeacademy and I've run into a weird thing during one of the practices; despite following the instructions exactly, things aren't operating properly. JavaScript code:
JavaScript code:
e;fb
|
# ? Dec 21, 2012 20:18 |
|
Ah! Such a simple fix, thanks!
|
# ? Dec 21, 2012 20:19 |
|
edit: I'm a moron and case matters; it's 'onclick' in javascript, not 'onClick'. Please ignore this. Hey guys, I've got a function that is adding additional td cells to a table, which also have an onClick event assigned to them. However, the function I want that event to call relies on using the keyword 'this' within it, which appears not to work. Basically, the td should look something like code:
code:
Any ideas? Quote-Unquote fucked around with this message at 11:38 on Jan 4, 2013 |
# ? Jan 4, 2013 11:30 |
|
newcell.onClick = function() {myFunction(newcell);};
|
# ? Jan 4, 2013 11:37 |
|
Wheany posted:newcell.onClick = function() {myFunction(newcell);}; Actually it seems that using 'this' works fine. I'm just an idiot; it's newcell.onclick, not newcell.onClick. onClick works fine if you write it in the HTML doc but that's not the proper javascript capitalisation.
|
# ? Jan 4, 2013 11:39 |
|
I really need to paste the write code if I want help!
thegasman2000 fucked around with this message at 23:43 on Jan 4, 2013 |
# ? Jan 4, 2013 13:34 |
|
At first glance: you are using spaces in the directory path for pre-loading your images. Might want to use %20 for the character.
|
# ? Jan 4, 2013 16:45 |
|
Is that seriously just the show-a-different-image-on-rollover scripts from Dreamweaver that have been copy-pasted?
|
# ? Jan 4, 2013 17:20 |
|
Jabor posted:Is that seriously just the show-a-different-image-on-rollover scripts from Dreamweaver that have been copy-pasted? Yup. Whenever you see the MM_ prefix, it's time to run away.
|
# ? Jan 4, 2013 17:32 |
|
Jabor posted:Is that seriously just the show-a-different-image-on-rollover scripts from Dreamweaver that have been copy-pasted? I am a twat... that was the wrong code completely! The actual script is this code:
It is now working in all browsers except for IE... unfortunately this means most of the customers will get a messed up template. Link to ebay store. http://stores.ebay.co.uk/total-outdoors1/Carp-Specialist-/_i.html?_fsub=4158216018&_sid=1017347228&_trksid=p4634.c0.m322
|
# ? Jan 4, 2013 23:43 |
|
I'm trying to implement dragging and dropping an image in the browser and then drawing it to the canvas and its behavior is extremely weird, and I don't understand why. How it's supposed to work: dragging an image on the red square should make it appear in the black square (the canvas). What's going wrong is that it only actually works the second time you drag an image on it, as if it was caching it. Demo and code: http://jsbin.com/uzepuj/1/edit I tried making it so it would change the background of the red square, to see if my drag and drop was the issue, but that works just fine. Any ideas? edit: keep in mind if you change it, you will need to clear your cache or try a different image as any image you try for more than once will work.
|
# ? Jan 9, 2013 23:52 |
|
I am guessing here that you should put reader.onloadend before reader.readAsDataURL. Also: file, reader and img are global variables.
|
# ? Jan 10, 2013 00:15 |
|
Wheany posted:I am guessing here that you should put reader.onloadend before reader.readAsDataURL. Makes no difference, in fact that's how I had it before. Fixed the vars (they were global just so I could try other solutions more easily) but yeah, no difference. edit: even if I remove the whole separate function for drawing, the same thing happens. Is there something special about drawImage? edit edit: Finally figured it out. I had to add an onload to the actual image and then it decided to work. Daynab fucked around with this message at 08:11 on Jan 10, 2013 |
# ? Jan 10, 2013 00:58 |
|
thegasman2000 posted:I am a twat... that was the wrong code completely! The actual script is this Yeesh. At least change that one line to (new Array(50)).join('<br />') Also, your IE customers are probably failing on the console.log()
|
# ? Jan 10, 2013 16:09 |
|
|
# ? Jun 1, 2024 06:26 |
|
Also, on the conversation of linting. JSHint superiority. Also, you can create your own custom file. I'm a bit of a control freak about mine (post yr best jshintrc) and enforce it on my projects during build processes. Also I let git take care of the spacing issue for me if it somehow falls through the cracks.code:
|
# ? Jan 10, 2013 16:43 |