|
Thermopyle posted:Speaking of angularjs, I'm just now working through the official tutorial and...am I alone in thinking this is a terrible piece of documentation? (maybe I'm just a terrible tutorial reader) Here's the main source of documentation that I use. A compiled list of tutorials and write-ups on an array of subjects. https://github.com/jmcunningham/AngularJS-Learning As far as tutorials go, Thinkster.io is a comprehensive layer over the very good Egghead.io videos. http://www.thinkster.io/ http://egghead.io/
|
# ? Oct 12, 2013 20:23 |
|
|
# ? Jun 5, 2024 08:03 |
|
Ugghh, I'm having a hell of a time wrapping my head around JQuery UI. It's like all of the components that I need are there, I can see them, I'm just not sure how to properly hook them together yet. Anyways, what I'm trying to do is drag and drop tabs across multiple tab divs. I got something that sort of works, but it doesn't behave properly and I'm not sure what to do next. If I drag a tab into a different div, it's content still shows up in the original location and not in the new one. I was thinking the "out" event would do something for me on the source and the "create" event would do something on the destination. Here's a fiddle that illustrates the problem: http://jsfiddle.net/Tpt4t/ It's like I can see that JQuery will do all the stuff I want but I'm missing some basic assumptions/concepts on the way stuff works. Web isn't really my forte and it's getting sort of frustrating.
|
# ? Oct 13, 2013 06:12 |
|
Tres Burritos posted:Ugghh, I'm having a hell of a time wrapping my head around JQuery UI. It's like all of the components that I need are there, I can see them, I'm just not sure how to properly hook them together yet. Take a look at this reference: http://jqueryui.com/sortable/#connect-lists-through-tabs
|
# ? Oct 13, 2013 13:30 |
|
Tres Burritos posted:Ugghh, I'm having a hell of a time wrapping my head around JQuery UI. It's like all of the components that I need are there, I can see them, I'm just not sure how to properly hook them together yet. http://jsfiddle.net/b2mtD/ Not sure if I'm being dumb about it and there's a way to automatically move tab contents over from div to another, but I think you're going to need to make it so it moves to appropriate html over to the target tab.
|
# ? Oct 14, 2013 22:14 |
|
hieronymus posted:Take a look at this reference: http://jqueryui.com/sortable/#connect-lists-through-tabs Yeah, I was looking at that but my problem is that I can't parse what the hell is going on. I get as far as code:
I guess it's just implicitly a "getter"? I'm really struggling with the documentation.
|
# ? Oct 15, 2013 02:36 |
|
Tres Burritos posted:Yeah, I was looking at that but my problem is that I can't parse what the hell is going on. http://jqueryui.com/tabs/ That line makes the html element with id 'tabs' start being tab-able (probably some stylesheet fuckery) 1. Use the F12 developer tools! Press F12, put a break point on any line you don't understand! 2. Use Google!
|
# ? Oct 15, 2013 02:58 |
|
hieronymus posted:1. Use the F12 developer tools! Press F12, put a break point on any line you don't understand! edit: specifically I had no idea that you could set javascript breakpoints. hieronymus posted:2. Use Google! It pains me so much that you had to type that out.
|
# ? Oct 15, 2013 03:23 |
|
Tres Burritos posted:gently caress gently caress gently caress gently caress gently caress. I had firebug installed and everything, Jesus this makes everything so much less painful. Yeah. If anything has a metric poo poo ton of Google-able answers its JavaScript and jquery. The amount of scenarios where someone hasn't asked the question before you have is minimal, even in advanced cases.
|
# ? Oct 15, 2013 03:57 |
|
Maluco Marinero posted:Yeah. If anything has a metric poo poo ton of Google-able answers its JavaScript and jquery. The amount of scenarios where someone hasn't asked the question before you have is minimal, even in advanced cases. Yeah, part of my problem was I didn't (still don't?) know what some of the correct terminology is for the stuff I'm trying to achieve. In this case "connected" seems to be the correct search term for the idea of sharing tabs across tab widgets. The second result for "jquery connected tabs" gets me exactly what I want.
|
# ? Oct 15, 2013 23:40 |
|
What do you guys think about the various frameworks? I've looked at most of the big ones the past couple days and the only one that has stood out for me is knockout. I really like the simplicity, the relatively clean templating, and the docs/site. Any thoughts? I have a project coming up that involves a wizard of sorts that will be used to book flights. I could do it all w/ just jQuery but for the amount of data back-and-forth there will be to the server I want something more structured.
|
# ? Oct 15, 2013 23:42 |
|
I like AngularJS and I'm currently using it for a number of projects, but Christ on a tricycle the documentation sucks. Beyond just content, the whole structure needs to change from a series of disjointed articles. Contemplating rewriting as a project to take up, it really can't get that much worse.
|
# ? Oct 15, 2013 23:55 |
|
Yeah, Google's technical documentation is some of the worst.
|
# ? Oct 16, 2013 00:06 |
|
Yep I noticed. I'd say the two most important things for me would be good docs, and clean templating.
|
# ? Oct 16, 2013 00:15 |
|
Suspicious Dish posted:Yeah, Google's technical documentation is some of the worst. I've been trying to figure out the youtube API while at the same time learning Angular. It's amazing how bad all these docs are.
|
# ? Oct 16, 2013 01:37 |
|
revmoo posted:What do you guys think about the various frameworks? I've looked at most of the big ones the past couple days and the only one that has stood out for me is knockout. I really like the simplicity, the relatively clean templating, and the docs/site. Any thoughts? I have a project coming up that involves a wizard of sorts that will be used to book flights. I could do it all w/ just jQuery but for the amount of data back-and-forth there will be to the server I want something more structured. I've used Knockout on a few different projects and like you said, it's a very simple integration. But, other than two-way data-binding, Knockout doesn't give you a lot of features. It certainly doesn't give you more structure. If that's your requirement, I would look more into Backbone, Ember, or Angular. I'm still on the fence about using HTML attributes for templating/logic like Knockout and Angular. I've been using Backbone+Handlebars for almost everything and love it. Also, there's a thread for hipster JavaScript MVCs.
|
# ? Oct 16, 2013 01:47 |
|
Thermopyle posted:I've been trying to figure out the youtube API while at the same time learning Angular. I was messing around on a project I was doing that had OAuth support for Google logins. I tried using their java library to decode the JWT payloads which seemed to be this horribly confusing weird library, then one day the link to the documentation for it changed to a completely different library that seemed to do roughly the same thing but in a completely different way and I couldn't find any information on this new package/library/thing anywhere. Google confuses me.
|
# ? Oct 16, 2013 02:36 |
|
I have come to dread doing anything involving Google APIs or Google libraries. They're frequently shockingly bad, and when they aren't, the documentation is.
|
# ? Oct 16, 2013 03:38 |
|
sim posted:I've used Knockout on a few different projects and like you said, it's a very simple integration. But, other than two-way data-binding, Knockout doesn't give you a lot of features. It certainly doesn't give you more structure. If that's your requirement, I would look more into Backbone, Ember, or Angular. I'm still on the fence about using HTML attributes for templating/logic like Knockout and Angular. I've been using Backbone+Handlebars for almost everything and love it. Thanks for the insight.
|
# ? Oct 16, 2013 04:12 |
|
Plorkyeran posted:I have come to dread doing anything involving Google APIs or Google libraries. They're frequently shockingly bad, and when they aren't, the documentation is. *cough google closure cough*
|
# ? Oct 16, 2013 04:22 |
|
Simple dumb question. I'm replacing a URL with the quantity of a textbox when that textbox is changed. Apologies for the basic question, but I'm a database/analytics guy first. The HTML:code:
code:
However, when I retrieve the querystring on plus.aspx after clicking (using Request("qty"))it says qty=1. Is there something I'm missing; is the href change cosmetic only?
|
# ? Oct 16, 2013 19:49 |
|
e: Never mind, misread your post. e2: I've been fiddling with that by just sticking http://example.com in the text field and then clicking the link... It appears to be working fine. That JS is so simple I have a hard time believing that's where the bug is. Silly question, but you're not clicking the link before the field loses focus, are you? kedo fucked around with this message at 20:14 on Oct 16, 2013 |
# ? Oct 16, 2013 20:01 |
|
Ha ha, okay this now makes way more sense. The href is pointing to a NyroModal floating iframe/div on the page, which is why I can't just take over the click event; the modal has to be launched in context. For whatever reason the NyroModal won't take my new URL as a parameter when launching on click (my guess being it's registered at page load) so I have to do it manually using:code:
|
# ? Oct 16, 2013 23:30 |
|
I'm going through Codeacademy's JS tutorial. I'm new to programming, and currently only am familiar with Python. I'm curious what needs to be declared and what doesn't: It seems like only the outside variable in a data structure needs to be declared. Ie, If I have an object of arrays of objects of strings, only the outside level object needs to be declared. Is this correct and if so, what's the reasoning behind it?
|
# ? Oct 19, 2013 19:43 |
|
Dominoes posted:I'm going through Codeacademy's JS tutorial. I'm new to programming, and currently only am familiar with Python. Javascript has a nasty thing called implied globals. Undeclared variables, when they get assigned, will be assumed to belong in the global scope, which isn't a particularly nice way to write programs. Basically, you don't have to declare variables for them to work, but implied globals mean the times when you shouldn't declare are very very few. The attributes to your Objects and Arrays are not in this discussion unless you create or reference them separate to the base Object, in which case you would declare them to avoid the global scope. Just accessing variables through `yourObject['thisAttr'] = 'value'` doesn't require declaration because you're not needing to access any scope at all beyond yourObject. One of the biggest things to learn with Javascript is how to properly control your variable scope, so you'll find most projects will do all or most code inside a closure, basically a function (even if it only gets run once) that acts as a container for your variables. Scoping is much more fluid in Javascript than in Python, so make sure you spend some time making sure you understand it. Maluco Marinero fucked around with this message at 21:59 on Oct 19, 2013 |
# ? Oct 19, 2013 21:53 |
|
Maluco Marinero posted:Javascript has a nasty thing called implied globals. Undeclared variables, when they get assigned, will be assumed to belong in the global scope, which isn't a particularly nice way to write programs.
|
# ? Oct 19, 2013 23:07 |
|
Note that in a modern browser, if you put:JavaScript code:
|
# ? Oct 19, 2013 23:33 |
|
Suspicious Dish posted:Note that in a modern browser, if you put: Javascript has function scope. Any variable introduced anywhere inside a function is actually visible everywhere within that function. You can nest functions inside other functions. Variables declared in outer functions are visible in inner functions. Variables declared in inner functions are not visible in outer functions. Strongly consider using a linter (JSHint, or if you hate yourself, JSLint) Also: use yout browser's debugging tools. Use breakpoints. Step through code. Set watches. Use console.log()
|
# ? Oct 20, 2013 00:01 |
|
I'll read up on JS inheritance. Are JS objects essentially a hybrid of associative arrays (ie dicts/hashes) and classes/objects ? Their functionality and use seem to share properties of, and take the role of each.
|
# ? Oct 20, 2013 17:21 |
|
Dominoes posted:I'll read up on JS inheritance. Yes. The idea is that one object can "chain" to another, if a property isn't found in one, sort of like traditional inheritance. To create an object a that inherits from object b: JavaScript code:
|
# ? Oct 20, 2013 17:59 |
|
Wheany posted:Javascript has function scope. Any variable introduced anywhere inside a function is actually visible everywhere within that function. yes, I'm sure S. Dish knows that. Strict mode raises an error if you try to assign to an identifier which has not been explicitly declared as a var. Check the console here: http://bl.ocks.org/tomjakubowski/7078088
|
# ? Oct 21, 2013 04:07 |
|
New dumb JS question from me. I have a gauge derived from the sample shown here: http://bl.ocks.org/msqr/3202712 That thing has a function called "updateReadings()" defined and called within onDocumentReady(). In the sample, updateReadings() just calls the gauge's "update" method with random numbers as spat out by a call to Math.random. In my hacked-together code that includes my derivative of this gauge, I want to call update, say via updateReadings(), but I want to gut the body of updateReadings() and use the value of a variable that is set by a WebSocket onmessage event elsewhere in the same code. I'm still JavaScript-stupid, and my flailing around trying things I think either should or might work hasn't netted me anything. I know I'm getting data back from my WebSocket call that I expect, because I've added console.log statements to those bits. I can see when I get a new batch of data, as well as the specific value I want to use to update the gauge. EDIT: I "fixed" this by making the var ("gaugeValue") I was trying to update from the WebSocket onmessage event a global. I feel dirty doing it this way though. So now I have a global var that is init'd to 0, then as a WebSocket message comes in (with the right key-value pair), I update that var with the value. updateReadings() in the onDocumentReady() gauge code now basically just calls powerGauge.update(gaugeValue) and a console.log statement for debugging. Is this sane? minidracula fucked around with this message at 09:34 on Oct 21, 2013 |
# ? Oct 21, 2013 09:10 |
|
mnd posted:New dumb JS question from me.
|
# ? Oct 21, 2013 09:15 |
|
peepsalot posted:Not sure exactly what you're asking here. Posting a jsfiddle or jsbin link to your code might help. EDIT: peepsalot: I'll try to minimize a sample and put it up somewhere, but it may take me a while. Now that I've got this part working, I'm on to the next thing I need to do. I'll post again once I've put code up though, since I really would like to understand this rather than just stop at having hacked something together that merely seems to work (but without a clear idea of why or how to do it better). Thanks! minidracula fucked around with this message at 09:42 on Oct 21, 2013 |
# ? Oct 21, 2013 09:33 |
|
Deus Rex posted:yes, I'm sure S. Dish knows that. Strict mode raises an error if you try to assign to an identifier which has not been explicitly declared as a var. Check the console here: Yeah, that reply was not meant for suspicious dish as such, it was meant as additional information. Those (and explicit "this") were things that tripped me up before I actually learned the language.
|
# ? Oct 21, 2013 10:04 |
|
mnd posted:EDIT: I "fixed" this by making the var ("gaugeValue") I was trying to update from the WebSocket onmessage event a global. There is no gaugeValue anywhere in your example.
|
# ? Oct 21, 2013 10:21 |
|
I am extending the functionality of a Business Intelligence tool. This is a web based application. Currently attempting to create some type of "form" validation. The strange thing is that this application reuses the same input for every single one of the form inputs. Once the user clicks away from the input html object, some javascript moves the value entered into the input into the text within a div. **Before**: code:
code:
code:
The BI tool is designed to reuse the same input element for some reason.. Dont ask me why, but it reuses it with javascript then writes the value into a div. Can I validate what is written to that div??
|
# ? Oct 21, 2013 18:37 |
|
Suspicious Dish posted:Yes. The idea is that one object can "chain" to another, if a property isn't found in one, sort of like traditional inheritance. To create an object a that inherits from object b: The company I work for uses this pattern: JavaScript code:
|
# ? Oct 21, 2013 20:54 |
|
JOHN SKELETON posted:I've been wondering if it has any downsides compared to these other ways of implementing inheritance in JS. I think it looks nicer. My employer uses Dojo. It's kinda heavy, but we've hit a nice balanced ratio of power/insanity. dojo.declare makes it really easy for Java devs (like myself) to pretend that JS has classes. Dojo supports multiple inheritance through mixins, which makes it easy to glom functionality onto widgets.
|
# ? Oct 21, 2013 23:45 |
|
DholmbladRU posted:I am extending the functionality of a Business Intelligence tool. This is a web based application. Currently attempting to create some type of "form" validation. The strange thing is that this application reuses the same input for every single one of the form inputs. Once the user clicks away from the input html object, some javascript moves the value entered into the input into the text within a div. Attach an onblur handler to the input element, have it do validation of the input. Have some property that tracks the state of the weird pseudo-form so it knows what to validate for.
|
# ? Oct 22, 2013 00:43 |
|
|
# ? Jun 5, 2024 08:03 |
|
Here's a stupid question that doesn't deserve its own thread. What's the deal with "new," or rather not using it? What's the logic behind defaulting "this" to the window, or whatever the global object is? Why not default to "this" from the scope that the function was called? It's stupid, and there's no reason not to use "new" when it's needed, I just don't get why JavaScript does what it does when you leave it out.
|
# ? Oct 22, 2013 02:39 |