These are chat archives for MontCode/GeneralChat

14th
Jul 2016
Eric Phy
@SimplyPhy
Jul 14 2016 00:25
https://github.com/SimplyPhy/P5_NeighborhoodMap
@david ….damn called don’t work on edit...
Lily Romano
@Lilyheart
Jul 14 2016 00:26
push the pages to a branch called gh-pages and we can view it right from github
Eric Phy
@SimplyPhy
Jul 14 2016 00:26
ehh, it’s like 400 lines of code
oh you mean the app?
Lily Romano
@Lilyheart
Jul 14 2016 00:26
still it’s easier to view so it doesn’t need to be downloaded.
Eric Phy
@SimplyPhy
Jul 14 2016 00:27
okay
hmm
is that right..?
xD
Eric Phy
@SimplyPhy
Jul 14 2016 00:32
yup, i don’t know what you did :sa:
Lily Romano
@Lilyheart
Jul 14 2016 00:34
it’s userid .github .io / repo name
it only shows what is on your gh-pages branch tho, so you can keep updating master, and only push to pages what you want to go live.
Eric Phy
@SimplyPhy
Jul 14 2016 00:37
@davidjcastner if you get a moment (and don’t spend long on it, just curious if it’s obvious), if you can easily see why my observableArray (line 16) doesn’t update the ul when new markers are created via the search bar on the top left (line 310), it’d be super :D
Lily Romano
@Lilyheart
Jul 14 2016 00:37
personally tho, silly pages that have no real production behind them, I just make gh-pages the default and main branch cuz I’m lazy like that.
David Castner
@davidjcastner
Jul 14 2016 00:39
alright sorry i missed all that, what am I looking at?
Eric Phy
@SimplyPhy
Jul 14 2016 00:39
the link, with the question 3 above this message, if you have a sec
David Castner
@davidjcastner
Jul 14 2016 00:39
thanks
Eric Phy
@SimplyPhy
Jul 14 2016 00:39
it’s probably a stupid mistake on my part, that’s why i ask
just a really quick debriefing, since i know you aren’t used to knockout.js:
data-bind: (KObindType): (varName) is the template for html properties that you attach to html tags
the varName links to the ko.observable[Array] of the same name
actually, you probably digest documentation faster than i type this, so i’ll just leave it be
David Castner
@davidjcastner
Jul 14 2016 00:43
yea I'm reading through the docs at the moment
Eric Phy
@SimplyPhy
Jul 14 2016 00:44
everything works at the moment except the ul doesn’t update when new markers are added to the observable array
that’s basically where i’m at
David Castner
@davidjcastner
Jul 14 2016 00:45
ok any error messages showing in the browser console?
Eric Phy
@SimplyPhy
Jul 14 2016 00:45
nope
and the new Markers get added to the observable array no problem
the observableArray seems to be on point the whole time; it’s just that the ul doesn’t update when new objects are .push()ed to it
which is weird, i think, because it actually does* its job on pageload, just not afterwards
David Castner
@davidjcastner
Jul 14 2016 00:48
okay, do the initial markers load, but not the ones to you add to it after it initially loads. Or is it that none of the markers show up in the ui?
Eric Phy
@SimplyPhy
Jul 14 2016 00:49
the markers show up on the map, and function properly with all my eventlisteners, etc
also the obsArray contains the correct content after each new marker is added
it’s just the damn ul doesn’t update
David Castner
@davidjcastner
Jul 14 2016 00:50
okay, can you try updating an array not attached to google map markers
Eric Phy
@SimplyPhy
Jul 14 2016 00:51
yeah, i did, i just .push()ed it {title: “happy place”} objects to test whether or not the ul would update, and even that wouldn’t do it
David Castner
@davidjcastner
Jul 14 2016 00:52
okay so I'm opening a codepen to experiment in, I'll send you the link in a secound
@Lilyheart is there a codepen that allows you to do pair programming, maybe codepnen pro?
Eric Phy
@SimplyPhy
Jul 14 2016 00:52
righto. also, if it gets messy, we can call it quits. i can definitely figure it out (hopefully), but i figured i’d give it a quick go
*in here
Lily Romano
@Lilyheart
Jul 14 2016 00:53
codepen pro has an instructor thing to show live updates, but not pair
Eric Phy
@SimplyPhy
Jul 14 2016 00:53
i have a feeling the issue is with how i call ko.applyBindings(), or something like that
David Castner
@davidjcastner
Jul 14 2016 00:55
okay first here is knockout's example for adding to a select
now let me know if you see that you are missing something, I'm going to continue to attempt to convert that to use a ul instead of select
David Castner
@davidjcastner
Jul 14 2016 01:04
this might help
by the looks of it, they don't have support for ul
my $0.02 is that knockout js is meant for mvc for forms only
Eric Phy
@SimplyPhy
Jul 14 2016 01:07
:D
David Castner
@davidjcastner
Jul 14 2016 01:07
which is why they have support for select, input, radio etc..
Eric Phy
@SimplyPhy
Jul 14 2016 01:07
yeah, it’s the projec trequirement
i def wouldn’t be using it otherwise
David Castner
@davidjcastner
Jul 14 2016 01:08
the project requirement ask for updating a list with knockout or just using knockout in general?
Eric Phy
@SimplyPhy
Jul 14 2016 01:08
but anyways, i probably shouldn’t have brought that particular question here. better to focus on things that don’t involve libraries/framworks that none of us know :grimacing:
Lily Romano
@Lilyheart
Jul 14 2016 01:09
But that is how we all learn!
Eric Phy
@SimplyPhy
Jul 14 2016 01:09
knockout for all ui elements that change, except for the map
David Castner
@davidjcastner
Jul 14 2016 01:10
So you are saying that, yes you know that knockout has the capability of changing all elements? because I could be wrong
Eric Phy
@SimplyPhy
Jul 14 2016 01:12
yeah it does
my app actually does it successfully, it works on pageload as expected, it just doesn’t update for some reason when new objects are added to the observable array
which is basically the whole point of knockout observables
David Castner
@davidjcastner
Jul 14 2016 01:13
might I give a professional recommendation, as I am currently both hiring people for the company I work for along with applying to other jobs at the moment
Eric Phy
@SimplyPhy
Jul 14 2016 01:13
do it
:P
David Castner
@davidjcastner
Jul 14 2016 01:13
If you are going to learn a library for mvc or updating the dom reactively
I would recommend learning react
that is what most companies are using or switching to
Eric Phy
@SimplyPhy
Jul 14 2016 01:14
yup; again: project requirement :(
but thanks, i expect react would be a better tool for employers
xD
David Castner
@davidjcastner
Jul 14 2016 01:15
and from my quick overview of the knockout documentation, it seems a little bit under maintained
well if it's for a project requirement, all I can say is good luck
Eric Phy
@SimplyPhy
Jul 14 2016 01:15
yeah, i don’t know that i’ll ever use knockout again after this project :(
Lily Romano
@Lilyheart
Jul 14 2016 01:15
I wonder if it’s a pet project of a udacity instructor xD
David Castner
@davidjcastner
Jul 14 2016 01:16
@Lilyheart very possible
Eric Phy
@SimplyPhy
Jul 14 2016 01:17
I think basically they want us to demonstrate competence with MV* (in this case, MVVM), an ability to learn and apply a new framework, and use APIs asyncronously with it
but as usual, udacity isn’t exactly glamorous
anywho, thanks for taking a peek
I’ll get back on it tomorrow. just so frustrating, I want to finish this damn thing already, and knockout is making it way too difficult every step of teh way
David Castner
@davidjcastner
Jul 14 2016 01:19
yes I agree that's an important skill, but it's also important for the framework to be well documented, but back to your original question. try searching for how to bind the ul/li to knockout
that is where I believe the issue it
Eric Phy
@SimplyPhy
Jul 14 2016 01:19
yeah, i’ll check it out
David Castner
@davidjcastner
Jul 14 2016 01:19
is*
Eric Phy
@SimplyPhy
Jul 14 2016 01:19
thanks @davidjcastner
also, thanks @Lilyheart for the gh-pages tips, though i’ll have to revisit that as well
David Castner
@davidjcastner
Jul 14 2016 01:20
no problem, although i wish i could be of better assistance
Eric Phy
@SimplyPhy
Jul 14 2016 01:20
comps about to die, night fellas~
David Castner
@davidjcastner
Jul 14 2016 01:20
@SimplyPhy night!
Eric Phy
@SimplyPhy
Jul 14 2016 14:59
Ha! The entire issue was that i used the syntax myObservableArray().push(…) instead of myObservableArray.push(…). The use of () references the content of the obsArray, but for some reason, when a method is called on it, it doesn’t initiate the native dependency tracking built into knockout
so as usual, 2 characters of code made all the difference
Lily Romano
@Lilyheart
Jul 14 2016 16:21
If someone wants to learn about HTML/CSS and like reading more than videos, this is good. http://learn.shayhowe.com/html-css/
It incorporates new things with the old so it’s great for first time learners.
Eric Phy
@SimplyPhy
Jul 14 2016 16:48

Given:

<li class=“happy”>yay</li><button ...></button>
<li class=“happy”>yay</li><button ...></button>
<li class=“happy”>yay</li><button ...></button>
<li class=“happy”>yay</li><button ...></button>

Is there some way to find out which index the <li> is when the button is clicked?

I know it’s tempting to recommend changing it subtly to make it work differently, but assume that the html has to remain that way, and you can only use javascript/jquery to figure out the answer.

Eric Phy
@SimplyPhy
Jul 14 2016 16:59
actually the buttons can be the element with the class; it doesn’t have to be the lis, if that makes it easier
Lily Romano
@Lilyheart
Jul 14 2016 17:04
As far as I can see they have nothing to connect them unless it was in the li. Can you get the index of what button was pressed? Does it match the index of the li you want? Just throwing things out there.
Eric Phy
@SimplyPhy
Jul 14 2016 17:06
@Lilyheart yeah the button index would be good
could be tag based or class based
Eric Phy
@SimplyPhy
Jul 14 2016 18:07
function trackLiIndex() {

    for (var i = 0; i < markerList().length; i++) {
        $("ul li:eq(" + i + ")").attr("id", i);
    }
}
This works :D
Lily Romano
@Lilyheart
Jul 14 2016 18:07
wooooot
Eric Phy
@SimplyPhy
Jul 14 2016 18:07
and just re-run it whenever i add/remove elements
pshh
Eric Phy
@SimplyPhy
Jul 14 2016 18:32
writing a line of knockout.js code is like digging through salt with your hands
aka: i suck at it
actually, it’s combining knockout with googlemaps api
actually, it’s probably 100% me xD
Eric Phy
@SimplyPhy
Jul 14 2016 18:43
@Lilyheart @davidjcastner any idea how code can work great with an error, and then the EXACT same code fail when you run it a few minutes later? Literally NOTHING changed whatsoever, including filename, browser, etc
the error was from an eventListener, and i put a comment inside of it, noting there was an error there so i could fix it later. That comment somehow broke the code. So i deleted the comment, and it was still broken.
easy to fix, i just commented out the entire eventListener for now, but so weird.
Lily Romano
@Lilyheart
Jul 14 2016 18:50
some things don’t like comments inside of them and comments have to go before or after.
David Castner
@davidjcastner
Jul 14 2016 18:51
yes this happens to me all the time, turns out every time I accidentally changed the code, use control+z and the retype type carfeully
Eric Phy
@SimplyPhy
Jul 14 2016 19:11
I control+z’ed all the way back to when i first made the eventListener, and it didn’t work the entire time. I’m thinking maybe because i save my files directly to dropbox that maybe dropbox service was down for a few minutes, and my saves weren’t actually overwriting my file
Lily Romano
@Lilyheart
Jul 14 2016 19:35
Who else lives on the command line?
David Castner
@davidjcastner
Jul 14 2016 20:25
:raised_hand:
Lily Romano
@Lilyheart
Jul 14 2016 20:26
I don’t think I’ve ever shared here one of my weird command line things xD alias weather=‘curl -4 wttr.in/ZIPHERE’(replace ZIPHERE with whatever zip code)
Lily Romano
@Lilyheart
Jul 14 2016 21:07
Apparently it doesn’t matter what I set out to do during the day, I don’t wanna do it and end up doing something else. Of course if tomorrow I set out to do that “something else” I won’t want to do it and will find yet something else to do. I’ve been fixing old code in various places instead of learning today.
David Castner
@davidjcastner
Jul 14 2016 21:12
Going back and fixing code is important
Eric Phy
@SimplyPhy
Jul 14 2016 22:13
If what you want to do is important to you, you could put a reasonable amount of money on your kitchen table, etc, and donate it to [insert charity/purpose here] if you fail to focus on that task.
might motivate :D
I put my life on the line for this 4-5 month period, and i don’t seem to lose focus :D
Lily Romano
@Lilyheart
Jul 14 2016 22:24
That would not work for me. I’ll just leave it at that.
You forget @SimplyPhy that I am in a similar boat to you but with college added in.
Eric Phy
@SimplyPhy
Jul 14 2016 22:29
i don’t forget
you don’t know my boat :P (nor i yours)
but i imagine they’re in water more similar to one anothers than most
Lily Romano
@Lilyheart
Jul 14 2016 22:30
heh
I said similar xD Not same!
David Castner
@davidjcastner
Jul 14 2016 22:33
:boat: <- mine
Lily Romano
@Lilyheart
Jul 14 2016 22:33
lulz
Mine -> I’m on a boat
Yours? -> zooooom
Eric Phy
@SimplyPhy
Jul 14 2016 22:44
toyboattoyboattoyboattoyboattoyboatbotytoyboat
:D
Lily Romano
@Lilyheart
Jul 14 2016 22:46
ur faster than a toyboattoyboattoyboattoyboattoyboattoyboat