14th
Feb 2015
Suzanne Atkinson
Feb 14 2015 09:11
hey if anyone is up right now (Europe?) having trouble with return largest array bonfire.
seems like this should work. the sumArray subroutine works fine. I'm trying to track which of the 4 arrays is the largest then return that one. Not sureif there is a method I ought to be using tha tI don't know about.
function largestOfFour(arr) {
// You can do this!
var largestArr= [];
var largest = 0;

for (i=0; i<arr.length; i++){
if (sumArray(arr[i])>largest){
largestArr = arr[i];

}

}

function sumArray(subArr) {
var sum = 0;
for (i=0; i<subArr.length; i++){
sum += parseInt(subArr[i], 10);
}
return sum;
}

return largestArr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Suzanne Atkinson
Feb 14 2015 09:18
nevermind, first of all I got it to do what I wanted
but I misunderstood the instructions. From each array return the largest number? not which subarray contains the largest numbers.
@terakilobyte this instructions seem ambiguous "Return an array consisting of the largest numbers in the provided array. The array will contain 4 sub-arrays."
first i summed each subarray but that's clearly not the answer. how many numbers should the truner array consist of ? How many largest numbers? or is it the largest number from each of the 4 subarrays?
Suzanne Atkinson
Feb 14 2015 09:28
try 2
function largestOfFour(arr) {
// You can do this!
var largestArr= [];

for (i=0; i<arr.length; i++){
temp = largestNum(arr[i]);
largestArr.push(temp);
}

function largestNum(subArr) {
var largest = 0;
for (j=0; j<subArr.length; j++){
if (subArr(j)>largest){
largest=subArr(j);
}

}
return largest;
}

return largestArr ;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Nathan
@terakilobyte
Feb 14 2015 11:35
@AdventureBear return the single largest element from each sub array
so largestoffour in that last case woudl return 5 27 39 1001
Sudeepto
@Sudeepto
Feb 14 2015 12:00
@terakilobyte I was just visiting, so instead of returning largestArr , we should do something like .
return Math.max.apply(Math, largestArr);
Nathan
@terakilobyte
Feb 14 2015 12:01
I’d recommend passing null as the first argument
no sense binding the thisvalue to Math
Sudeepto
@Sudeepto
Feb 14 2015 12:07
@terakilobyte Okay.
Nathan
@terakilobyte
Feb 14 2015 12:09
good job on noticing that apply can be used here since we’re passing in arrays, btw
precisely the point of this exercise
Sudeepto
@Sudeepto
Feb 14 2015 12:12

@terakilobyte Thanks.

Anyways, does anyone here uses Vim ?? I use GVim on Windows 8.1 and Linux Mint . I am new to Vim . So i don't know precisely how to install and uninstall plugins . I followed a tutorial a while back for installing Vundle Package Manager. I think I failed to install it properly . But , at that time I thought it is installed without any problem so I installed YouCompleteMe plugin.

Now I want to remove both these packages . How can I do so ?? Please reply if you want to see my .gvimrc file.

Nathan
@terakilobyte
Feb 14 2015 12:27
you can remove them by simply removing their lines from your .gvimrc or .vimrc file
then browse the .vim/bundles directory in ~ and remove their containing folders if you don’t want them
Sudeepto
@Sudeepto
Feb 14 2015 13:08
@terakilobyte Thanks. I was thinking about doing the same thing , but thought it might mess things up :)
Nathan
@terakilobyte
Feb 14 2015 13:10
the best part is you can alwasy just go to github and find someone’s dotfiles if you do
ycm is a nice bundle btw
why remove it?
I enjoy ycm and tern a lot
Sudeepto
@Sudeepto
Feb 14 2015 13:14

As I said, I am new to VIM world. So while installing ycm and vundle , there were couple of commands and terms that I didn't understood , so I think the installation was not properly completed.

I wanted auto-completion, syntax-linting for C++ and Python3 . Do you use Gvim as well ??

Nathan
@terakilobyte
Feb 14 2015 13:14
I use mvim
but they’re all essentially the same
ah for c++ and python3 you’d have to search github
for C related whatnots I use xcode
Sudeepto
@Sudeepto
Feb 14 2015 13:16
Ohhh. Right now I have a doubt. I am using Gvim in windows and linux. I don't know whether Gvim has full 256 color support on or not. I was using the corporation colorscheme but the background was not showing the same color as the preview showed.
Nathan
@terakilobyte
Feb 14 2015 13:17
hmm no idea, you could google it most likely
Sudeepto
@Sudeepto
Feb 14 2015 13:17
which color scheme are you using right now ??
Nathan
@terakilobyte
Feb 14 2015 13:17
I use solarized
Sudeepto
@Sudeepto
Feb 14 2015 13:17
Yeah , I use it on Sublime Text.
Nathan
@terakilobyte
Feb 14 2015 13:17
yeah there’s a solarized plugin for vim too
Sudeepto
@Sudeepto
Feb 14 2015 13:18
plugin ?? like solarized.vim ??
Nathan
@terakilobyte
Feb 14 2015 13:18
yep
Sudeepto
@Sudeepto
Feb 14 2015 13:20
I recently found ByteFluent . It also has some nice themes.
Are you using Macbook Pro ?? You know I always wanted to buy one, but here its quite expensive :(
Nathan
@terakilobyte
Feb 14 2015 13:21
expensive here as well
yes I’m using a 15” retina macbook pro
It’s now 3 years old, and still going super strong
though quincy uses a macbook air for all his development and loves it
says it’s enough power for him
Sudeepto
@Sudeepto
Feb 14 2015 13:23
Is it true that if an Apple product is broken or not functioning properly, the Customer Care replace it with a new one ??
Cassandra Cruz
@lambdatastic
Feb 14 2015 13:23
If you have the nice product care plan, they’ll do it if it’s unfixable
Sudeepto
@Sudeepto
Feb 14 2015 13:24
What's a product care plan ??
Nathan
@terakilobyte
Feb 14 2015 13:25
Cassandra Cruz
@lambdatastic
Feb 14 2015 13:25
Basically insurance you buy when you get the computer. Lets you take it back and get it fixed if any issues come up with it.
Nathan
@terakilobyte
Feb 14 2015 13:26
airport employee dropped it in korea
Cassandra Cruz
@lambdatastic
Feb 14 2015 13:26
Ooh, ouch.
Nathan
@terakilobyte
Feb 14 2015 13:26
I took it to the apple store, they replaced the monitor, case, ram, hard drive, keyboard, and battery
free
Cassandra Cruz
@lambdatastic
Feb 14 2015 13:26
Sometimes they’re generous, but I haven’t had the chance to see yet.
This only mt first MBP
Nathan
@terakilobyte
Feb 14 2015 13:26
I’ve always had good luck with them
Sudeepto
@Sudeepto
Feb 14 2015 13:27
@alicekamada So apart from buying the product , we have to buy an insurance plan to cover any future damages ??
Nathan
@terakilobyte
Feb 14 2015 13:27
so I’ll probably alwasy buy their products
if it’s apple’s fault, no
and literally anything happens to it that you didn’t flat out do maliciously, apple will cover it
driving down the road and someone tbones you and your comp goes flying? with applecare they’ll just replace it
hell with that story they’d probably replace it anyway and wish you well
Cassandra Cruz
@lambdatastic
Feb 14 2015 13:28
Probably
I don’t really need it because I have a rider in my renter’s insurance just for personal electronics, but I’ve only heard good things about it.
Nathan
@terakilobyte
Feb 14 2015 13:29
my mbp is old
Sudeepto
@Sudeepto
Feb 14 2015 13:30
@terakilobyte But you still use more RAM than me . I have 4GB 1333 Mhz :)
Nathan
@terakilobyte
Feb 14 2015 13:30
use or have? ;)
I probably rarely use more than 2-3gb of what I have available
Sudeepto
@Sudeepto
Feb 14 2015 13:31
Sorry . Not a native english speaker. :)
Nathan
@terakilobyte
Feb 14 2015 13:32
actually I’m using most of my memory looking at the activity monitor
but I think what’s happening is osx is letting apps be memory hogs while it’s available
Cassandra Cruz
@lambdatastic
Feb 14 2015 13:32
@terakilobyte …how?
Nathan
@terakilobyte
Feb 14 2015 13:33
Sudeepto
@Sudeepto
Feb 14 2015 13:34

But recently I have noticed something weird. While using Windows 8.1 Chrome uses ~ 1-1.5 GB of RAM with 6-7 tabs open.

But on Linux mint, it uses even more amount of memory even when only 2-3 tabs are open, like 2-2.4 GB :(

Nathan
@terakilobyte
Feb 14 2015 13:37
yeah my app memory is sitting around 3gb atm
the memory pressure isn’t bad it looks like
Sudeepto
@Sudeepto
Feb 14 2015 13:37
Nathan
@terakilobyte
Feb 14 2015 13:38
indicating maybe half
at 4gb you may want to run a 32 bit system
Sudeepto
@Sudeepto
Feb 14 2015 13:40
I may go for another 4GB in near future. But does running a 64 bit machine with 4GB RAM not good ??
Nathan
@terakilobyte
Feb 14 2015 13:41
well remember why 64gb was made, to take advantage of more ram
err 64 bit
it allows access to a lot more memory, but itself takes up more memory
if you expand your ram then stay at 64 bit, I think the total usable ram for a 32 bit system is right around 4gb
Sudeepto
@Sudeepto
Feb 14 2015 13:42
Yeah I know that. But the reason why machine is not using all of 4 GB is because I don't have a dedicated graphics card.
@terakilobyte You are from USA right ??
Nathan
@terakilobyte
Feb 14 2015 13:50
I am
Suzanne Atkinson
Feb 14 2015 14:58
@terakilobyte thanks, that's what I finally guessed. I slept really well last night but was up from 3am - 5am and figured I'd try a bonfire. See what you've created? Lol.
Nathan
@terakilobyte
Feb 14 2015 15:00
lol
Suzanne Atkinson
Feb 14 2015 15:01
FWIW that Code I posted worked just fine except for arr(j) needed to be arr[j]
Dominic Jones
@towwiow
Feb 14 2015 15:07
Suzanne Atkinson
Feb 14 2015 15:07
morning, @towwiow
Dominic Jones
@towwiow
Feb 14 2015 15:07
What's FWIW? Lol
Suzanne Atkinson
Feb 14 2015 15:08
for what it's worth
prob not worth even typing FWIW, FWIW. lol.
sort of like a columnist typing "In my opinion I think..."
a little redundant.
Nathan
@terakilobyte
Feb 14 2015 15:16
;)
Dominic Jones
@towwiow
Feb 14 2015 15:20
lol
I don't have anything to say to that... no comment.
Sudeepto
@Sudeepto
Feb 14 2015 15:21

Hey does anyone know where can I find free fonts to download for windows and linux ?? Preferably in ttf format.

I want to use Inconsolata font. But don't know which site is the best for fonts .

Dominic Jones
@towwiow
Feb 14 2015 15:21
Sudeepto
@Sudeepto
Feb 14 2015 15:22
@towwiow Thanks .
Dominic Jones
@towwiow
Feb 14 2015 15:22
You're welcome. There's a lot on there.
Suzanne Atkinson
Feb 14 2015 15:22
da man (dot com).
Dominic Jones
@towwiow
Feb 14 2015 15:23
Didn't return anything for inconsolata though.
Sudeepto
@Sudeepto
Feb 14 2015 15:23
Yup :(
Suzanne Atkinson
Feb 14 2015 15:23
what are you using it for @Sudeepto ?
Dominic Jones
@towwiow
Feb 14 2015 15:24
I think I'm going to pound through those standford challenges more today while at work.
Sudeepto
@Sudeepto
Feb 14 2015 15:24
@AdventureBear I usually change my editor's font while programming . RIght now I am using Source Code Pro, Meslo and Monaco as my main fonts. :)
Suzanne Atkinson
Feb 14 2015 15:25
what editor are you using?
@towwiow hurry up so you can get to the good stuff
:)
Dominic Jones
@towwiow
Feb 14 2015 15:25
:no_mouth: you spotted me!
caught me dragging my feet lol
Sudeepto
@Sudeepto
Feb 14 2015 15:26
@AdventureBear I use Sublime Text 3 and Gvim . Learning to use Vim right now . Only know basics like movement, yank-paste etc. Which one do you use ??
Nathan
@terakilobyte
Feb 14 2015 15:26
I’ve converted her to the dark side
soon all will join
Dominic Jones
@towwiow
Feb 14 2015 15:27
lol we talking about editors right now?
Sudeepto
@Sudeepto
Feb 14 2015 15:27
@terakilobyte Amen !
Suzanne Atkinson
Feb 14 2015 15:31
lol. he got me on webstorm right now. Getting used to it. He said it was cool b/c it integrated with version control, but they said to use command line for version control anyway, lol.
maybe some one else saida bout the version control
Nathan
@terakilobyte
Feb 14 2015 15:33
nah I mentioned vcs
it’s faster to use the command line
Suzanne Atkinson
Feb 14 2015 15:33
Nathan
@terakilobyte
Feb 14 2015 15:33
but webstorm does it, and I use it to resolve merge conflicts
I’ll also quickly switch between branches in it
it’s real power comes in the fact it will index all of the internal modules ina project as well as node itself
so you get really really powerful context hinting
Sudeepto
@Sudeepto
Feb 14 2015 15:34
@terakilobyte From where did you learn to use git ??
Suzanne Atkinson
Feb 14 2015 15:39
wow, that sounds like a nother pairing session is needed! ha
hey question, with branches in git (or any vcs I guess), should old branches be deleted noce they are merged?
Nathan
@terakilobyte
Feb 14 2015 15:42
I like to keep them around for posterity
I learned the basics of git just by reading online, searchign when I needed answer, and using it
it’s fairly intuitive
Suzanne Atkinson
Feb 14 2015 15:44
the ROR course I took from prag programming used it and was very good at the basics.
Somewhere I read or go tthe idea that if everything was up to speed, you should only have a master.
Suzanne Atkinson
Feb 14 2015 16:26
@terakilobyte doing repeating string bonfire, got this after running the code, it looks like my out put is the expected but it's not passing?
assert.strictEqual(repeat('abc', 3), 'abcabcabc', 'should repeat a string n times');AssertionError:should repeat a string n times: expected 'abc' to equal 'abcabcabc'
wait, nevermind, not yet...
silly error. used =+ instead of =+
i'm learnign a lot with the easy bonfires
Nathan
@terakilobyte
Feb 14 2015 16:40
:)
Suzanne Atkinson
Feb 14 2015 16:41
will there be a way to track your bonfires, like the challenges? I've peeked at the sourcecode to see hwo many there are, but it's still a nice feeling to check things off!
Nathan
@terakilobyte
Feb 14 2015 16:43
yep
we’re already saving all the bonfires
every time you complete one it’s saved
Suzanne Atkinson
Feb 14 2015 16:44
that's cool. I peeked at some source code to try and get an idea of what's going on in the backend.
Suzanne Atkinson
Feb 14 2015 16:50
I also noticed my challenge count going up with each one! Yippee
Sudeepto
@Sudeepto
Feb 14 2015 16:58
Hey can someone help me in challenge 16 . Customizing bootstrap. It seems that codepen.io is not loading the html that we need to customise . Any ideas. ??
Dominic Jones
@towwiow
Feb 14 2015 17:03
Sudeepto
@Sudeepto
Feb 14 2015 17:09

@towwiow What animate.css. The instruction asks us to visit bootswatch.com and use any one of the bootstrap theme we like. I have used the SuperHero theme . I have pasted both of them in codepen's html and css panes but still the page is doing nothing.

I tried adding a different web page , a simple p tag with some message , and it loaded it perfectly. Don't know what's the problem :(

@towwiow The css file name is bootstrap.css
Dominic Jones
@towwiow
Feb 14 2015 17:10
got ya. thinking of a different challenge.
give me a moment
Sudeepto
@Sudeepto
Feb 14 2015 17:15
@towwiow Its a generic link codepen.io/pen
Dominic Jones
@towwiow
Feb 14 2015 17:16
do you have an account made? Where you can save it and link me to it directly?
that link just takes me to a blank pen.
Sudeepto
@Sudeepto
Feb 14 2015 17:16
No , i didn't made an account.
@towwiow I am using JSFiddle now . This is the link . ITs working btw . http://jsfiddle.net/tpaq8Lqt/
Dominic Jones
@towwiow
Feb 14 2015 17:34
Ok. let me know if you need help with the challenge.
Cristián Berríos
@crisberrios
Feb 14 2015 17:38
Good morning campers
Suzanne Atkinson
Feb 14 2015 17:38
mornign
Dominic Jones
@towwiow
Feb 14 2015 17:40
morning @crisberrios !
Cristián Berríos
@crisberrios
Feb 14 2015 17:43
hey Suzanne and Dominic
I'm up for some helping if you need anything :)
Suzanne Atkinson
Feb 14 2015 17:56
super~ I'm doing bonfires
having trouble pushing to a multidimensional array
chunky monkey challenge
Cristián Berríos
@crisberrios
Feb 14 2015 17:57
Look at this wonderful code from JS: The Good Parts.
Well... some small bits of theory before:
Arrays in JS aren't really "Arrays" as in C or Java
they are just objects with some special methods
so, you can have arr[0] and arr[100000] but no "places" in between
Also, there is no guarantee that using "for item in array" will iterate correctly over each value
Suzanne Atkinson
Feb 14 2015 17:59
well here is the input array
['a', 'b', 'c', 'd']
Cristián Berríos
@crisberrios
Feb 14 2015 17:59
it'll also iterate over those
and moreso, if you add properties like arr["bear"] = value
Suzanne Atkinson
Feb 14 2015 17:59
and the idea is to output it as:
['a', 'b'], ['c', 'd']
I think
i'm using a counter to keep track of location in the original array
a double nested loop (in the above case it would be i=0 to 1, j=0 to 1,
and then trying to "push" the value @ counter position to the correct spot in the new array.
Cristián Berríos
@crisberrios
Feb 14 2015 18:01
is it only 4 items
or do you have to group them in groups of 2?
Suzanne Atkinson
Feb 14 2015 18:02
there is an oinput array and then a number
so in this case,
['a', 'b', 'c', 'd'], 2
the instructions are to make "N" groups from the first array
so 2 groups.
but it could be ann array of 6 elements with a number 3
so 3 groups (of 2)
Cristián Berríos
@crisberrios
Feb 14 2015 18:03
Suzanne Atkinson
Feb 14 2015 18:03
here's my code so far...right now just outputting differen tthings to see what it's doing
function chunk(arr, size) {
// Break it up.
//How many new groups?
var numGroups = arr.length/size;

//create empty multidimensional array to fill
var multiArray = [];
var counter = 0;
var count = "";
//iterate over each new group

for (i=0; i<numGroups; i++) {
//place correct "size" of elements into each new group
for (j = 0; j<size; j++) {
multiArray.push(arr[counter]);
count += counter + ", ";
counter =+1;
}
}

return count;
}

chunk(['a', 'b', 'c', 'd'], 2);
the .push command wasn't working, so im' outputting count as well as pushing count to a regular arran and I'm getting 0,1,1,1 or a,b,b,b so i'm not even looping correctly
Cristián Berríos
@crisberrios
Feb 14 2015 18:06
let's see... var numGroups = arr.length/size;
you might want to use Math.floor
Suzanne Atkinson
Feb 14 2015 18:07
I am assuming they are all integers pre-planned! but that is a good point. I found one problem.
2nd time today
Cristián Berríos
@crisberrios
Feb 14 2015 18:07
remember, there are no integers in JS
only float numbers, and divisions are ackward
what is the use of counter?
count
i mean
Suzanne Atkinson
Feb 14 2015 18:09
just trying to figure out how to take the next element in teh original array
and push it into the multidimention.
I was originally using something like i*j+j
Cristián Berríos
@crisberrios
Feb 14 2015 18:10
well, keep it simple
Suzanne Atkinson
Feb 14 2015 18:10
which ins't quite right either, but figured just counting as a way of keeping track manually should work
Cristián Berríos
@crisberrios
Feb 14 2015 18:10
1st... some useful methods for this problem: push/pop and shift/unshift
Suzanne Atkinson
Feb 14 2015 18:10
I have this working now, but it returns the original array.
function chunk(arr, size) {
// Break it up.
//How many new groups?
var numGroups = arr.length/size;

//create empty multidimensional array to fill
var multiArray = [];
var counter = 0;
var count = "";
//iterate over each new group

for (i=0; i<numGroups; i++) {
//place correct "size" of elements into each new group
for (j = 0; j<size; j++) {
multiArray.push(arr[counter]);
//count += counter + ", ";
counter += 1;
}
}

return multiArray;
}

chunk(['a', 'b', 'c', 'd'], 2);
my problem is the multidimensional part. ??
Cristián Berríos
@crisberrios
Feb 14 2015 18:11
yes
I think you are missing just 1 little step
Suzanne Atkinson
Feb 14 2015 18:12
can I have a hint? :)
Cristián Berríos
@crisberrios
Feb 14 2015 18:13
well, as you see, multiArray is returning the original array
what is the grouping step?
Suzanne Atkinson
Feb 14 2015 18:14
I can't get the syntax right. So I simplified it to see that it was retriving the values.
the one little step I'm missing is the step that I'm missing, lol.
I've tried this:
multiArray[i][j].push(arr[counter]);
as well as
multiArray[i].push(arr[counter]);
seems like iether should work depending on how the language works. ?
so I figure it's a syntax problem
Cristián Berríos
@crisberrios
Feb 14 2015 18:15
1st option is 99% good
and, as you say, it's a syntax problem
Suzanne Atkinson
Feb 14 2015 18:16
OK at least I am not crazy
Cristián Berríos
@crisberrios
Feb 14 2015 18:16
what you do when pushing is let the push function decide what index to assign to the pushed item
Suzanne Atkinson
Feb 14 2015 18:16
OK
i guess that makes sense, so it should choose the j? or do I set the size of the dimensions first ?
Cristián Berríos
@crisberrios
Feb 14 2015 18:17
since you already know where the item should be
you don't need push
Suzanne Atkinson
Feb 14 2015 18:17
aha!
Cristián Berríos
@crisberrios
Feb 14 2015 18:17
just to assign it
Suzanne Atkinson
Feb 14 2015 18:17
OH
wow
Cristián Berríos
@crisberrios
Feb 14 2015 18:18
multiArray[i][j] = value;
Suzanne Atkinson
Feb 14 2015 18:18
I get this error when I try that. Thanks though, you made perfect sense! Guess I was eager to be pushy.
multiArray[i][j].push(arr[counter]);
sorry, wait
cannot set property 0 of undefined
for this line:
multiArray[i][j]=arr[counter];
Cristián Berríos
@crisberrios
Feb 14 2015 18:20
and... that's correct
Suzanne Atkinson
Feb 14 2015 18:20
lol
Cristián Berríos
@crisberrios
Feb 14 2015 18:20
since there isn't an array at [i]
so you can insert something at [j]
Suzanne Atkinson
Feb 14 2015 18:21
iindexing doesn't start at 0? Should this place soemthing at 0,0, then 0, 1, then 1,0, then 1,1? Or am I getting languages mixed up
hmph. The sun went away. it senses my frustration.
Cristián Berríos
@crisberrios
Feb 14 2015 18:22
well
in JS you can have arr[10] and arr[0] might be undefined
to specify an index of an array you need an array object, even if it's empty.
so how to do an easy fix
Suzanne Atkinson
Feb 14 2015 18:22
do I need to explitly first define the empty array?
var multiArray = [];
is what I have
Sudeepto
@Sudeepto
Feb 14 2015 18:24

Hello @crisberrios I am doing FCC challenge no. 16 customizing bootstrap. Here is the link of the fiddle
Customizing_bootstrap

It asked me to make it a one-column page. Can you help me give some pointers how to achieve it ?? I was thinking about the float property.

Suzanne Atkinson
Feb 14 2015 18:25
Cristián Berríos
@crisberrios
Feb 14 2015 18:25
@Sudeepto check how many columns are the sections using
Well, you must initialize the array before assigning the values
you can do it at start or make a check before pushing
But well... there are many approaches for solving that problem
Suzanne Atkinson
Feb 14 2015 18:27
var multiArray = ([[]]);
var multiArray = ([][]);
with and without the () doesn't work either.
Sudeepto
@Sudeepto
Feb 14 2015 18:28
@crisberrios I think there are two columns in the page right ?? col-md-3 and col-md-9.
Cristián Berríos
@crisberrios
Feb 14 2015 18:29
yes
@Sudeepto yes
@AdventureBear well, let's not complicate the solution
Sudeepto
@Sudeepto
Feb 14 2015 18:30
@crisberrios And I need to somehow make co-md-3 column merge with col-md-9 . Correct ??
Julie Myers
@BlueOceanView
Feb 14 2015 18:30
@AdventureBear What are you trying to do?
Suzanne Atkinson
Feb 14 2015 18:30
chunky monkey coderbyte
Cristián Berríos
@crisberrios
Feb 14 2015 18:30
Suzanne Atkinson
Feb 14 2015 18:31
problem I am having is refactoring into a multidimensional array by assigning a value to a position in the array
i tried something like this
Cristián Berríos
@crisberrios
Feb 14 2015 18:31
but you have to group the entries first
or initialize the original array
Suzanne Atkinson
Feb 14 2015 18:31
(not the whole code, just the loop part)
  for (i=0; i<numGroups; i++) {
//place correct "size" of elements into each new group
var multiArray[i]=[];
for (j = 0; j<size; j++) {
multiArray[i].push(arr[counter]);
counter += 1;
}
}
Sudeepto
@Sudeepto
Feb 14 2015 18:32
Cristián Berríos
@crisberrios
Feb 14 2015 18:32
for (i = 0; i < numGroups; i ++) {
multiArray[i] = [];
}
Suzanne Atkinson
Feb 14 2015 18:32
ugh I removed the var in my code above and I'm getting some partial success
Cristián Berríos
@crisberrios
Feb 14 2015 18:34
it's missing [j]
also a way to initialize [i] before assigning [j]
Sudeepto
@Sudeepto
Feb 14 2015 18:35

@AdventureBear Hey I have not reached that far yet, but as soon as I load the page, the console shows an error which was occurring due to extra parenthesis around the function call.

DId you noticed that ??

Suzanne Atkinson
Feb 14 2015 18:35
well in the above case the j is just looping through the number of times to push, so I'm no longer using it in the definition.
Cristián Berríos
@crisberrios
Feb 14 2015 18:36
well, that's right
Suzanne Atkinson
Feb 14 2015 18:36
@Sudeepto yes I fixed that already, I think it's a small bug. @terakilobyte FYI
Cristián Berríos
@crisberrios
Feb 14 2015 18:36
you don't need [j] in that case
Suzanne Atkinson
Feb 14 2015 18:36
so I think I have my loops backwards.
again misunderstanding the original instructions
Cristián Berríos
@crisberrios
Feb 14 2015 18:37
do you think?
let me check
Suzanne Atkinson
Feb 14 2015 18:37
I'm not breaking up into n groups, I'm returning groups of n length
I was understanding the first. But I think the 2nd is what's wanted.
which addresses something you brought up, what to do with the remainder.
so I should be able to fill (n) spots of the first grouped array, then move to the next group, without needing to know how many groups there will be. Until I'm at the end of the first array.
like dealing cards in to a group of n people in a way. Round 1, round 2, oops, not enough for round 3...
I think i need a break!
Cristián Berríos
@crisberrios
Feb 14 2015 18:41
I see what's the error
check how many groups are you doing for the failed test cases
Suzanne Atkinson
Feb 14 2015 18:42
Cristián Berríos
@crisberrios
Feb 14 2015 18:42
I thought it was checking only for whole groups, but you also need to return partial groups
Suzanne Atkinson
Feb 14 2015 18:42
I run out of things to add in the failed test
right
Cristián Berríos
@crisberrios
Feb 14 2015 18:42
and I told you to use Math.floor for the number of groups
Suzanne Atkinson
Feb 14 2015 18:42
I'm going to go grab lunch, I think I need some calories. BRB
Cristián Berríos
@crisberrios
Feb 14 2015 18:42
but...
Suzanne Atkinson
Feb 14 2015 18:42
HAHAH
"told you so..."
Cristián Berríos
@crisberrios
Feb 14 2015 18:43
it should be Math.ceil
since you want the upper number of possible groups
so if the division returns 1.5
you would want to have 2 groups
Sudeepto
@Sudeepto
Feb 14 2015 18:43
@AdventureBear we need to split the array into a multidimensional array containing arrays of size size right ??
Cristián Berríos
@crisberrios
Feb 14 2015 18:45
@Sudeepto did yo manage to make it 1 column?
Suzanne Atkinson
Feb 14 2015 18:47
@Sudeepto yes I think that is correct. but there may be leftovers so either a) we don't know/care about how many there will be, just keep adding until we run out. or b) use @crisberrios suggestion for math.ciel to get the max number, knowing that the final one may not be filled
Sudeepto
@Sudeepto
Feb 14 2015 18:47
@crisberrios Nope . I am fiddling with the css . :(
@AdventureBear my only doubt was whether it is provided or not whether size will be a multiple of len(arr) as the array element .
Cristián Berríos
@crisberrios
Feb 14 2015 18:48
@Sudeepto nope, it might not be a multiple
Sudeepto
@Sudeepto
Feb 14 2015 18:49
@AdventureBear Okay that means that the multi-dimensional array's last element ,can have less than size elements. Right ?? :)
Suzanne Atkinson
Feb 14 2015 18:52
yes
yes, lat element less than size elements
Sudeepto
@Sudeepto
Feb 14 2015 19:40
Suzanne Atkinson
Feb 14 2015 19:43
ooh yes pleeeeeze!!!
Sudeepto
@Sudeepto
Feb 14 2015 19:43
can I give you the solution code ?? Or some hints ??
@AdventureBear Is it okay here to share solutions ??
Suzanne Atkinson
Feb 14 2015 19:45
yes there is no restriction or code of conduct prohibiting. FCC is a self-guided learning resource and pairing is encouraged. that's my understanding
Sudeepto
@Sudeepto
Feb 14 2015 19:45
 function chunk(arr, size) {
// Break it up.
var myArr = [] ;

while( true )
if (arr.length > size) {
myArr.push(arr.splice(0, size)) ;
}
else {
myArr.push(arr) ;
break ;
}
return myArr ;
}

chunk(['a', 'b', 'c', 'd'], 2);
Suzanne Atkinson
Feb 14 2015 19:46
whoa, splicing an array???
I never would have looked for that.
Sudeepto
@Sudeepto
Feb 14 2015 19:46
the splice method dynamically reduces the array and returns the elements as an array itself.
Suzanne Atkinson
Feb 14 2015 19:47
that must be the key to this challenge!
so once it's splice, push takes care of the rest?
Sudeepto
@Sudeepto
Feb 14 2015 19:47
So ['a', 'b', 'c', 'd'].splice(0, 2 ) returns ['a', 'b']
After that ['a', 'b', 'c', 'd'] reduce down to [ 'c', 'd'] as I spliced it out and returned it
Suzanne Atkinson
Feb 14 2015 19:49
so simple
Sudeepto
@Sudeepto
Feb 14 2015 19:50
The first argument of splice is the index of element in the array that you want to start and the second argument is the index one less of which is desired
So for ['a', 'b', 'c', 'd'].splice(0, 2 ) first index is 0th index and 2nd index is 2 - 1th i.e. 1
@AdventureBear After that , we just simply push the spliced index into our result index
Nathan
@terakilobyte
Feb 14 2015 19:53
I’d prefer you share hints
lead the person to self discovery
unless the answer is just right there
Sudeepto
@Sudeepto
Feb 14 2015 19:54
@AdventureBear Here is the MDN documentation for splice
Splice
Danny Fritz
@dannyfritz
Feb 14 2015 19:55
Do any of the challenges focus on debugging js?
Cristián Berríos
@crisberrios
Feb 14 2015 19:56
@AdventureBear your method was good though. Many ways to achieve the same. You could have used map, even reduce, or a recursive function.
Sudeepto
@Sudeepto
Feb 14 2015 19:57
@terakilobyte Yeah. But @AdventureBear was struggling for many hours. That's why I shared the code with her.
Nathan
@terakilobyte
Feb 14 2015 19:57
@dannyfritz none currently
though it would be awesome if we got a pull request with 15-30 challenges that did… ;) ;)
console.log-ging fully works in the sandbox
Sudeepto
@Sudeepto
Feb 14 2015 19:59
Okay friends. Good Night . 1:30 AM here. Byee :)
Cristián Berríos
@crisberrios
Feb 14 2015 20:00
@Sudeepto
 function chunk(arr, size) {
// Break it up.
var myArr = [] ;

while( true )
if (arr.length > size) {
myArr.push(arr.splice(0, size)) ;
}
else {
myArr.push(arr) ;
break ;
}
return myArr ;
}

var a = [];
a[1000] = 'hey';
chunk(a, 2);
Sudeepto
@Sudeepto
Feb 14 2015 20:06
@crisberrios Sorry. I use Python the most . So my mindset is geared towards it a bit. That's why I never thought of this particular condition. Direct initialization from an arbitrary index is valid in JS but invalid in Python :P
Cristián Berríos
@crisberrios
Feb 14 2015 20:07
hehe don't worry, I'm still trying to change mi mindset from C/C# to JS
Sudeepto
@Sudeepto
Feb 14 2015 20:08
@crisberrios Will think about it though. But for now . Buenas Noches :) Adiós
Cristián Berríos
@crisberrios
Feb 14 2015 20:08
goodnight!
Nathan
@terakilobyte
Feb 14 2015 20:14
JS is the awesome. Better object model than a class oriented language (imo), functions are first class citizens, closure support… it’s just dreamy
and with es6 and support for tail recursion….
not sure what else you could ask for in a programming language
maybe pointers
that’d be pretty cool
Danny Fritz
@dannyfritz
Feb 14 2015 20:21
@terakilobyte when i say debugging. i mean using the dev tools in chrome or other browsers, not console.log. :P
Nathan
@terakilobyte
Feb 14 2015 20:22
the way bonfire works I’m not sure that’s possible, though it may be
Danny Fritz
@dannyfritz
Feb 14 2015 20:24
put a debugger; statement in a bonfire and see what happens. ;)
ah, it hits the statement and shows it in the debugger, but the sandbox times out.
Cristián Berríos
@crisberrios
Feb 14 2015 20:26
better reflection
but with es6 things surely got better
well, back to work. putting together an input form for my assigned project
Nathan
@terakilobyte
Feb 14 2015 20:39
@dannyfritz yeah the sandbox will be destroyed after 3 seconds
I might be able to write a debug mode for it
but at that point all safety is abandoned
though if you’re using your debugger you probably won’t write an infinite loop