These are chat archives for MontCode/GeneralChat

28th
Jan 2017
David Castner
@davidjcastner
Jan 28 2017 00:01
Hint: shift is an array method that removes the first element and returns it
let me know if you're still having trouble
Matt Richards
@mattjrichards
Jan 28 2017 00:03
sorry buddy, I'm just slow
David Castner
@davidjcastner
Jan 28 2017 00:03
haha no worries, is there something in particular that you are still not understanding?
Matt Richards
@mattjrichards
Jan 28 2017 00:03
I'm trying to figure out how to ask my question so that it makes sense to you, but I'm having trouble finding the words.
David Castner
@davidjcastner
Jan 28 2017 00:04
alright i'll be back in a moment
Matt Richards
@mattjrichards
Jan 28 2017 00:04
ok
Matt Richards
@mattjrichards
Jan 28 2017 00:17
In this sentence, "Add the number to the end of the array, then remove the first element of array.", when they say "array" are they referring to var testArr = [1,2,3,4,5]; or are they referring to arr in function nextInLine(arr, item) { ?
David Castner
@davidjcastner
Jan 28 2017 00:21
ahh okay, they are referring to both. When you pass testArr to the function nextInLine (such as nextInLine(testArr, 6)), the variable arr inside the function represents the same array as the variable testArr. Inside the function they only want you to change that array that the variable arr represents so that any array can be used as input (when calling nextInLine with testArr as the input, it will change the variable testArr as well).
Matt Richards
@mattjrichards
Jan 28 2017 00:27
Ok. Let me let that sink in for a bit. I'm trying to visualize all this in my head, but arr and testArr are tripping me up.
David Castner
@davidjcastner
Jan 28 2017 00:30
It is important to think of variables are references to objects, but not the actual object. For example, the array [1,2,3,4,5] might reside somewhere inside your computer's memory, and the variable testArr simply points to the memory. Reassigning the variable (such as testArr = "something_else") is like pointing to different part of memory, but the actual array might still reside in memory, maybe with another variable pointing to it.
var arrayHolderOne = [1,2,3,4];
var arrayHolderTwo = null;
arrayHolderTwo = arrayHolderOne;
// arrayHolderTwo now points to the same array as arrayHolderOne

arrayHolderOne.push(5); // this is adding 5 to the array that arrayHolderOne is pointing to.
console.log(arrayHolderOne); // <-- [1,2,3,4,5]
// even though I didn't directly manipulate the variable arrayHolderTwo,
// the array that arrayHolderTwo points to is the same as a arrayHolderOne
// therefore arrayHolderTwo also equals [1,2,3,4,5]
console.log(arrayHolderTwo); // <- [1,2,3,4,5]
Lily Romano
@Lilyheart
Jan 28 2017 00:40
Man, I go out to grab dinner cuz I'm having a bad brain day and come back to so much chatter! :heartpulse:
imma look at that code now David.
Matt Richards
@mattjrichards
Jan 28 2017 00:48
Ok. I'm still a bit confused. If "arr" and "testArr" are the same thing, or point to the same thing, I would think there would have to be a line like this somewhere in the code: var arr = testArr; or var arr = [1,2,3,4,5];But there isn't. Its like they put arr in there, but it's not assigned to anything. They want me to "remove the first element of array", so I would think that code would have to look like this: 
var arr = [1,2,3,4,5];
hold on. i wasn't finished
i don't know how to format this
Lily Romano
@Lilyheart
Jan 28 2017 00:49
the first  needs to be on it's own line. You can go back and edit it.
David Castner
@davidjcastner
Jan 28 2017 00:49
it's okay. I'll put together something for a better explanation using the problem as an example
Jonathan Herman
@lantech19446
Jan 28 2017 00:54
that was a really difficult concept for me also
Matt Richards
@mattjrichards
Jan 28 2017 00:58
var arr = [1,2,3,4,5];
removedFromOurArray = arr.shift();
Hi @Lilyheart and @lantech19446
Lily Romano
@Lilyheart
Jan 28 2017 01:00
After those two lines arr would = [2,3,4,5] and removedFromOurArray would = 1
Jonathan Herman
@lantech19446
Jan 28 2017 01:00
hey @kilocycle how goes it
Matt Richards
@mattjrichards
Jan 28 2017 01:00
ehhh...this lesson is extremely confusing.
David Castner
@davidjcastner
Jan 28 2017 01:00
one moment, almost done
Matt Richards
@mattjrichards
Jan 28 2017 01:01
Lily Romano
@Lilyheart
Jan 28 2017 01:01
Imma wait until David is done before I chime in. He does these incredible writeups usually before I can get many words typed up xD :heart_decoration:
Matt Richards
@mattjrichards
Jan 28 2017 01:02
this is my 3rd night on this lesson. We got into it heavy last night in fcc chat.
there were 2 other people stuck on the same lesson, having the same issues.
it's like you're cruising through the lessons at a good pace, then you get to #173 and it's a brick wall.
Lily Romano
@Lilyheart
Jan 28 2017 01:04
data structures can be challenging. New concept for many.
Matt Richards
@mattjrichards
Jan 28 2017 01:05
Yes, it is very challenging for me to say the least.
David Castner
@davidjcastner
Jan 28 2017 01:06
alright hopefully this real world example helps:
Matt Richards
@mattjrichards
Jan 28 2017 01:07
@davidjcastner ok
David Castner
@davidjcastner
Jan 28 2017 01:07
/*
In Computer Science a queue is an abstract Data Structure where items are kept
in order. New items can be added at the back of the queue and old items are
taken off from the front of the queue.

Write a function nextInLine which takes an array (arr) and a number (item) as
arguments. Add the number to the end of the array, then remove the first element
of array. The nextInLine function should then return the element that was
removed.
*/

/*
To make this easier to understand let's equate it to a real world example of
standing in line at the cash register. The cashier is going to ask for the next
customer in line, and a another customer in the store is going to get in line
for the register.
*/

/*
Now suppose the coffe shop, StarElks, has two registers and two lines for each
register. Each line alreays has some customers in it.

Let's represent those customers in their line with some arrays.
*/
var customersForRegisterA = ["alice", "bob", "carol"];
var customersForRegisterB = ["danny", "eve"];

/*
There are two cashiers who are overly anal retentive, Fred & Ginny.
Both Fred and Ginny are not adapt at social interacting with people.
They also cannot live life happily unless the amount of customers in their
lines remains the same. Therefore, when a new customer enters a line,
Fred or Ginny finishes the transaction of their current customer. If no one
enters their line, they stall their current customer with awkward silence.

Let's say that Fred is operating register A, and Ginny is operating register B.
Both Frad & Ginny currently have a customer.
Let's store those customers as well.
*/
var fredsCustomer = "hailey";
var ginnysCustomer = "isaac";

/*
The manager of StarElks realizes that Fred and Ginny are too afraid to talk to
the customers, so the manage decides to get a javascript program to help manage
the lines for the registers.

Let's call this program (and function), nextInLine.
*/
function nextInLine(lineForRegister, newCustomer) {
// the code here should manipulate the lineForRegister by
// adding the newCustomer and returning who is next
// Hint: do not use the variables customersForRegisterA and customersForRegisterB
var nextCustomer;
// code to manipulate lineForRegister
return nextCustomer;
}

/*
A new customer, Jill, enters the store and gets in line for register A.
Fred realizes this, so he knows he can finish Hailey's transaction.
Fred isn't sure who his next customer is, but he can use the new javascript
program to help.

Prior to this, Fred's customer is Hailey and he has Alice, Bob, and Carol in
line for his register.
*/
var fredsCustomer = nextInLine(customersForRegisterA, "jill");
// Hailey left the store, so Fred's customer is now Alice.
console.log(fredsCustomer); // alice
// Alice is no longer in line, but Jill entered the line.
console.log(customersForRegisterA); // ["bob", "carol", "jill"]

/*
Because the program takes the value that the variables point to, it can be used
for Ginny's line as well.

Another customer, Kevin, enters StarElks. Kevin gets in lien for register B
(Ginny's register).

Prior to this, Ginny's customer is Isaac and she has Danny and Eve in line for
her register.
*/
var ginnysCustomer = nextInLine(customersForRegisterB, "kevin");
// Isaac left the store, so Ginny's customer is now Danny.
console.log(ginnysCustomer); // danny
// Danny is no longer in line, but Kevin entered the line.
console.log(customersForRegisterB); // ["eve", "kevin"]
hopefully that's easier to read now
Matt Richards
@mattjrichards
Jan 28 2017 01:10
yes. thanx for word wrap...lol
David Castner
@davidjcastner
Jan 28 2017 01:11
lol np
Lily Romano
@Lilyheart
Jan 28 2017 01:12
@davidjcastner Do you keep these write ups somewhere? Should start sticking them in a wiki
David Castner
@davidjcastner
Jan 28 2017 01:12
no i don't keep, but i should
want to start a repo for examples or what?
Lily Romano
@Lilyheart
Jan 28 2017 01:16
I'm not sure. FCC has a "wiki" in their forum that is freely editable. Here is the entry for the challenge in question
David Castner
@davidjcastner
Jan 28 2017 01:17
sorry about my typos, should be a little better now
Lily Romano
@Lilyheart
Jan 28 2017 01:17
Until we figure it out, you could keep things in our topics. FAQ maybe? https://gitter.im/MontCode/topics/categories/faqs
David Castner
@davidjcastner
Jan 28 2017 01:18
can you put it in our faq, I'll save it as a gist for now
Lily Romano
@Lilyheart
Jan 28 2017 01:19
Can you not make a topic? I honestly haven't spent much time in the topics because I can't make my own categories yet xD :laughing: :cry:
Matt Richards
@mattjrichards
Jan 28 2017 01:19
@davidjcastner thank you for that. I'm going to try and type out this code for the lesson the way I think it should look, then I'll post it. Don't wait up for me. It could take a while.
MontBot
@MontBot
Jan 28 2017 01:19
kilocycle sends brownie points to @davidjcastner :sparkles: :thumbsup: :sparkles:
David Castner
@davidjcastner
Jan 28 2017 01:20
@kilocycle best of luck, did that help explain which variables to use?
Lily Romano
@Lilyheart
Jan 28 2017 01:21
I find starting out writing pseudo code can help when I'm stuck. Have you heard about that?
Can't remember if FCC goes through using it.
David Castner
@davidjcastner
Jan 28 2017 01:21
oh making a faq is easy. maybe i should try before asking lol
Lily Romano
@Lilyheart
Jan 28 2017 01:22
Think it's just like makin' a post. But in a more threaded BB type format instead of linear chat
David Castner
@davidjcastner
Jan 28 2017 01:22
interesting, i put it up there
Lily Romano
@Lilyheart
Jan 28 2017 01:23
cool. quick cheap way of storing it somewhere for now xD LOL
David Castner
@davidjcastner
Jan 28 2017 01:23
also put it in a gist just in case
Lily Romano
@Lilyheart
Jan 28 2017 01:25
xD I didn't want to interrupt the array chat. So... if I use the cfg file you posted with atom-beautify and set the cfg file with the config path in the settings, it does what you would expect.
public class Test {
public static void runTest(Runnable code) { code.run(); }

public static void main(String[] args) {
runTest(() - > {
System.out.println("hello"); // <-- look at this line
});                              // <-- this one too
}
}
David Castner
@davidjcastner
Jan 28 2017 01:25
whaaa.....
you mean it's working for you?
Matt Richards
@mattjrichards
Jan 28 2017 01:26
@davidjcastner I think so. I'm still reading over it. If I'm trying to learn a difficult concept I have to keep reading it over and over again before it gels.
Lily Romano
@Lilyheart
Jan 28 2017 01:27

If I put in ... and run the package

public class Test {
public static void runTest(Runnable code) { code.run(); }

public static void main(String[] args) {
runTest(() -> {
System.out.println("hello"); // <-- look at this line
});                              // <-- this one too
}
}

I get the earlier tabbing

If I delete the cfg file and run it with the cfg file blank, I get
public class Test {
public static void runTest(Runnable code) {
code.run();
}

public static void main(String[] args) {
runTest(() -> {
System.out.println("hello"); // <-- look at this line
});                              // <-- this one too
}
}
Then, if I save the https://raw.githubusercontent.com/davidjcastner/greentealatte/master/uncrustify.cfg in the blank file and just rerun, I get the first one I posted.
David Castner
@davidjcastner
Jan 28 2017 01:28
@kilocycle alright sound good, let me know if it ends up helping, I appreciate constructive feedback for the advice I give. You can use this link to view it, so you don't lose your place: https://gitter.im/MontCode/topics/topic/588bf1fce836bf70109e749a/stand-in-line
@Lilyheart let me try it again
Matt Richards
@mattjrichards
Jan 28 2017 01:31
@davidjcastner Nice. Thank you. I'll get back to you in a little.
MontBot
@MontBot
Jan 28 2017 01:31
kilocycle sends brownie points to @davidjcastner :sparkles: :thumbsup: :sparkles:
:warning: kilocycle already gave davidjcastner points
Lily Romano
@Lilyheart
Jan 28 2017 01:32
lemme see if maybe I have something in the .atom folder that is doin' extra things
Nope, even if I blank the ~.atom\packages\atom-beautify\src\beautifiers\uncrustify\default.cfg file it still behaves :worried:
David Castner
@davidjcastner
Jan 28 2017 01:34
one sec brb, gotta attend to my dinner
Lily Romano
@Lilyheart
Jan 28 2017 01:34
thanks @davidjcastner You need more brownies.
MontBot
@MontBot
Jan 28 2017 01:34
lilyheart sends brownie points to @davidjcastner :sparkles: :thumbsup: :sparkles:
David Castner
@davidjcastner
Jan 28 2017 01:36
haha dinner hasn't burnt yet which is a good thing. I should get more by completing more of freeCodeCamp
side note: I'm taking a 3d modeling class this semester and I'm loving it, kinda thinking about doing more with art in general. I already bought myself a sketch book and some nice colored pencils to keep track of ideas
anyways back to debugging my editor
Lily Romano
@Lilyheart
Jan 28 2017 01:39
I love my colored pencils.
David Castner
@davidjcastner
Jan 28 2017 01:39
I am only using uncrustify.cfg as my path, I think that's fine because when I change my config, it changes the formatting
Lily Romano
@Lilyheart
Jan 28 2017 01:40
If it's in your PATH variable yeah. I just wanted to make sure it was using EXACTLY the config i was testing. I've been bitten too many times with that :p
David Castner
@davidjcastner
Jan 28 2017 01:40
yea I might be using a different config, hold on
Lily Romano
@Lilyheart
Jan 28 2017 01:41
You are using Glavin001's atom-beautify right? That's what you listed on SO, but you listed a diff (old dead) package on your original question here. Just confirming.
Matt Richards
@mattjrichards
Jan 28 2017 01:42

@davidjcastner @Lilyheart Not sure if I did this right, but it passed. 
function nextInLine(arr, item) {
arr.push(item);
removedFromOurArray = arr.shift();
return removedFromOurArray; // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));


David Castner
@davidjcastner
Jan 28 2017 01:42
yes Glavin001's
Lily Romano
@Lilyheart
Jan 28 2017 01:42
You can edit your post and put a line return before the first  with a shift+enter
Matt Richards
@mattjrichards
Jan 28 2017 01:43
@Lilyheart yeah, what am I doing wrong? I can figure this formatting out.
David Castner
@davidjcastner
Jan 28 2017 01:43
@kilocycle yes that's right, it can be shortened, but what you have is right.
function nextInLine(arr, item) {
arr.push(item);
return arr.shift();  // Change this line
}
Lily Romano
@Lilyheart
Jan 28 2017 01:43
the  needs to be on it's own line.
It would look like this when you are typing it.
shift+enter to make a new line
Matt Richards
@mattjrichards
Jan 28 2017 01:45
@Lilyheart every time i hit enter for new line it sends my reply. i have to mouse over to the icon and switch to compose mode, but i keep screwing it up.
David Castner
@davidjcastner
Jan 28 2017 01:45
@Lilyheart switching to my desktop, i'm too slow on my latop
Lily Romano
@Lilyheart
Jan 28 2017 01:45
You can even denote what language to highlight for after the tick marks (totally stealing david's code for the example)
Hold down shift when you press enter.
Matt Richards
@mattjrichards
Jan 28 2017 01:47
@davidjcastner so I don't need this line

removedFromOurArray = arr.shift();
Lily Romano
@Lilyheart
Jan 28 2017 01:47
Need three ticks at the end too (you can edit a previous post for up to like 5 minutes)
Matt Richards
@mattjrichards
Jan 28 2017 01:48
@Lilyheart How do i get a new line without hitting enter? Do I have to mouse over to the switch to compose mode icon every time?
Lily Romano
@Lilyheart
Jan 28 2017 01:49
I just hold down shift and press the enter key. Works for me in chat mode.
I never switch modes
Matt Richards
@mattjrichards
Jan 28 2017 01:50
shift enter
code
Lily Romano
@Lilyheart
Jan 28 2017 01:50
\^^/
Matt Richards
@mattjrichards
Jan 28 2017 01:50
cool
Lily Romano
@Lilyheart
Jan 28 2017 01:51
I reallllllly need to write something up on that and post it in the FAQ or something. It's like the most unintuitive thing until you know it.
Matt Richards
@mattjrichards
Jan 28 2017 01:51
@davidjcastner So, what I meant was, I don't need this line?
removedFromOurArray = arr.shift();
David Castner
@davidjcastner
Jan 28 2017 01:51
@kilocycle you still need to use arr.shift(), but instead of placing the value that the method shift returns into a variable, you can return it directly
Lily Romano
@Lilyheart
Jan 28 2017 01:53
hal9000 is driving me nuts. I ssh to it and it asks my password... tells me the password is wrong like 10 times.... then accepts the password.. the same one i've been typing. AGH!
Never ever name a device HAL9000 people. Don't do it. even if you think it's cute.
Gonna try to move @MontBot over to hal.
David Castner
@davidjcastner
Jan 28 2017 01:55
// arr.shift() returns a value
// example:

var arr = [1,2,3];
console.log(arr.shift()); // 1
console.log(arr.shift()); // 2
console.log(arr.shift()); // 3
console.log(arr); // []

// therefore
var arr = [1,2,3];
var next = arr.shift();
console.log(next);
// is the same as
var arr = [1,2,3];
console.log(arr.shift());
@Lilyheart I'm losing track of which uncrusfify cfg has the right settings, so I am updating the one on the repo and let me know if it's still working fine for you
Lily Romano
@Lilyheart
Jan 28 2017 01:57
I'm setting up Git ssh on hal using ssh... recursion! (not really)!
David Castner
@davidjcastner
Jan 28 2017 01:58
remote repo updated
nevermind, hold up
the uncrustify keeps screwing up my -> notation and it wasn't last night
David Castner
@davidjcastner
Jan 28 2017 02:03
... why atom, I believed in you
Matt Richards
@mattjrichards
Jan 28 2017 02:03
@davidjcastner I get the how of it, but I'm still having trouble with why. I think I'm over-thinking it. I probably just need to do it 100 more times, then everything will start to come together in my brain. I've spent so much time on just this one lesson. It's crazy. I'm going to take a break, give my brain a rest, then I'll come back to everything. Thanks a ton for your help. And thank you too @Lilyheart. I'll be back.
MontBot
@MontBot
Jan 28 2017 02:03
kilocycle sends brownie points to @davidjcastner and @lilyheart :sparkles: :thumbsup: :sparkles:
:warning: kilocycle already gave davidjcastner points
Lily Romano
@Lilyheart
Jan 28 2017 02:04
I think I've gotten something like that one. I closed atom and restarted it.
mmmm brownies for meeeeeeee
David Castner
@davidjcastner
Jan 28 2017 02:05
@kilocycle no problem, we can go over it in more detail at one of the meetups, it will probably be easier to draw some diagrams to show what's going on in the background
Matt Richards
@mattjrichards
Jan 28 2017 02:06
@davidjcastner I agree. Nothing like good old one-on-one.
David Castner
@davidjcastner
Jan 28 2017 02:06
@Lilyheart it startied mixing tabs and spaces which is what those errors were from
Lily Romano
@Lilyheart
Jan 28 2017 02:06
Even it can't settle the debate.
I'm so tired I read that as @Lilyheart is starting mixing taps of spaces. And I was like that would be an interesting mix tape
David Castner
@davidjcastner
Jan 28 2017 02:07
I removed my cfg file so it started using tabs, and didn't replace them when I put the cfg back
lol
Lily Romano
@Lilyheart
Jan 28 2017 02:07
Can see why I only use the very few lines of cfg I actually want xD Of course I've lost my config file in this but it was serious like 5 lines and will be easy to refiggur
David Castner
@davidjcastner
Jan 28 2017 02:07
can you check the value of indent_continue that you have in the working cfg file
Lily Romano
@Lilyheart
Jan 28 2017 02:08
indent_continue = 2
David Castner
@davidjcastner
Jan 28 2017 02:08
I used a template, I should make one from strach, but I haven't taken the time to go through the config options
hmm
it's the same that was on github?
Lily Romano
@Lilyheart
Jan 28 2017 02:09
I just use a blank file and when something isn't the way I want, figgur the config for it.
it was but looks like you change it again?
David Castner
@davidjcastner
Jan 28 2017 02:09
i did, but don;t use that one lol
Lily Romano
@Lilyheart
Jan 28 2017 02:09
either way it doesn't change anything on my machine.
David Castner
@davidjcastner
Jan 28 2017 02:10
maybe it's another package that's interferring
Lily Romano
@Lilyheart
Jan 28 2017 02:10
meebee
David Castner
@davidjcastner
Jan 28 2017 02:10
because I still can;t get it to work on my machine with the previous cfg
what version of atom-beautify do you have
Lily Romano
@Lilyheart
Jan 28 2017 02:11
0.29.17
David Castner
@davidjcastner
Jan 28 2017 02:11
ok that's the same, how about atom version
Lily Romano
@Lilyheart
Jan 28 2017 02:12
jus' a sec and I'll PM you something.
David Castner
@davidjcastner
Jan 28 2017 02:12
\$ atom --version
Atom    : 1.13.0
Electron: 1.3.13
Chrome  : 52.0.2743.82
Node    : 6.5.0`
okay
Lily Romano
@Lilyheart
Jan 28 2017 02:36
@MontBot is goin' be offline for a smidge. Hopefully I don't break montie too bad xD
Lily Romano
@Lilyheart
Jan 28 2017 02:47
npm takes forever to install on a pi2... I really need to move HAL to a pi 3
Lily Romano
@Lilyheart
Jan 28 2017 02:54
nope. old version of node default on raspbian is bad. blargh. gotta update that too now.
Lily Romano
@Lilyheart
Jan 28 2017 03:01
from node 0.10 to node 7.4 wheeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
@davidjcastner you around?
Lily Romano
@Lilyheart
Jan 28 2017 03:22
nvm, I think we are back and running now.
thanks for nothing @davidjcastner :laughing:
MontBot
@MontBot
Jan 28 2017 03:22
lilyheart sends brownie points to @davidjcastner :sparkles: :thumbsup: :sparkles:
Lily Romano
@Lilyheart
Jan 28 2017 03:55
@codyloyd mind if I "borrow" your giphy bot code? I didn't see a license on your repo.
Cody Loyd
@codyloyd
Jan 28 2017 03:55
I don't mind at all
do whatever you like with it
Lily Romano
@Lilyheart
Jan 28 2017 03:55
sweeeeeeet
project for when I'm alive.
erm. awake
whatever. I'm goin' to sleep xD
Cody Loyd
@codyloyd
Jan 28 2017 03:56
:sparkles:
David Castner
@davidjcastner
Jan 28 2017 04:08
@Lilyheart welcome
Lily Romano
@Lilyheart
Jan 28 2017 04:17
lol