These are chat archives for FreeCodeCamp/Help

13th
Jan 2015
Suzanne Atkinson
@AdventureBear
Jan 13 2015 03:18
hey helpers, how goes it?
I'm doing coderbytes, just did # 3 successfully, capitalize the first letter of each word.
Bill Maca
@bmaca
Jan 13 2015 03:18
howdy Partner
Suzanne Atkinson
@AdventureBear
Jan 13 2015 03:19
my code used 2 loops. first a split the words in to an array. Then I loped through the array with each word. Then i looped through each character, capitalizign the first, then tacking on the rest to make a new word, then rebuilt the string witha space inbetween. Finally I trimmed any remainng spaces. This passed jsut fine.
while looking at others code, I found this and it is elegant and I had some questions
function LetterCapitalize(str) { 

  // code goes here  
  return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});; 

}
how does the above code work for multiple word strings?
and what does the regex do...does it look for each word? and how do the spaces get added back in? Or is that function performed on eah word within the string, leaving the spaces intact?
Ben Clist
@BenClist
Jan 13 2015 03:24
The regex pulls out separate words and passes them to the function as 'txt'
you can see what the regex matches
so everytime it finds a match in the string it caps the first character, reattaches the rest of the text which has been lowercased, then replaces the original part of the string with the changes
it never touches the spaces because the regex doesn't match them
str.replace(arg1, arg2)
Ben Clist
@BenClist
Jan 13 2015 03:29
that says, I want to take this string, find every instance of arg1 and replace it with arg2
/\w\S*/g
That matches the separate words in the string
function(txt){}
Is a function, taking the result of the regex as 'txt'
rest should make sense after that
the result of that function replaces every instance that the REGEX matches in the string
Suzanne Atkinson
@AdventureBear
Jan 13 2015 03:34
Cool, thanks so much for the explanation
I'm still struggling with string manipulation becuase something I read here: http://javascript.info/tutorial/string#manipulating-strings said that you couldn't manipulate characters in a string, you had to take them apart and reassemble.
but I guess replace takes care of that??
and the difference between
Ben Clist
@BenClist
Jan 13 2015 03:36
technically replace is returning a new string, the original is still there
Suzanne Atkinson
@AdventureBear
Jan 13 2015 03:36
\w\S*
and
\w*
is that the first one will match the whole string??
crazy how it all fits together. So much to wrap my brain around!
Ben Clist
@BenClist
Jan 13 2015 03:38
the \S basically allows the match to jump the spaces, \w is any alphanumeric character so without the \S it hits the space and can't go any further
by saying \S you're specifically saying don't match whitespace, so it gets to the space, thinks, I've been told what to do here and carries on
without the \S the regex has no instruction on dealing with whitespace so it ends the match
that's my understanding anyway
I tend to lean really heavily on arrays when working with strings, I just find it easier
function LetterCapitalize(str) { 

  //Get str as an array
  arr = str.split(' ');
  solution = [];

  for(i = 0; i < arr.length; i++) {
    //Get individual word as an array
    word = arr[i].split('');
    //Uppercase first letter
    word[0] = word[0].toUpperCase();
    //Rejoin word array into string
    word = word.join('');
    //Add word to solution array
    solution.push(word);
  };
  //join solution array into string
  solution = solution.join(' ');
  // code goes here  
  return solution; 

}
That was my solution to that challenge
Suzanne Atkinson
@AdventureBear
Jan 13 2015 03:59
Mine was similar, a few more steps but the same idea. I didnt split the word, like you did but I did split the string into words.
thank you again
love the teaching here, very patient
Dominic Jones
@towwiow
Jan 13 2015 04:06
Glad you got your help @AdventureBear !
Wynda
@Wynda
Jan 13 2015 04:13
How do you use Code Pen to check your code to see if you are missing anything? I used this link from FreeCodeCamp. http://codepen.io/pen/ and then paste in the HTML. I intentionally left off the ; height: 150px in the div { to see how I could catch errors but it did not show me anything missing.
Russ Eby
@RussEby
Jan 13 2015 04:20
Make sure you put the CSS and Javascript in their own window. Codepen will change colors depending on what it thinks the text is. If you look at the color and the string color continues past what should be a string then you know it missing something. The more you use it the better you'll notice the difference.
Wynda
@Wynda
Jan 13 2015 04:23
Is CSS in yellow and Javascript in green? I am new at this and still trying to learn the difference which is HTML, CSS and JavaScript.
P1xt
@P1xt
Jan 13 2015 04:26
Has anyone done the "Third Largest" easy challenge on Coderbyte? I did it and got the correct answer (per their grader) but I ended up having to save the string lengths twice so I'd have two copies because sort is destructive ... and it seems inefficient to me.
Justin Rogers
@yaskyj
Jan 13 2015 04:28
@P1xt I just sorted the array:
function ThirdGreatest(strArr) { 
  strArr.sort(function(a, b){
    return b.length - a.length;
  });
  return strArr[2]; 

}
Russ Eby
@RussEby
Jan 13 2015 04:29
@Wynda It breaks down further. Keywords are in yellow, attributes are in purple and strings are in green.
P1xt
@P1xt
Jan 13 2015 04:30
/headdesk
Russ Eby
@RussEby
Jan 13 2015 04:31
Also don't worry if Codepen has features you don't need to use yet. Just ignore them until you can use them.
Ben Clist
@BenClist
Jan 13 2015 04:31
haha, can't believe I didn't think of that @yaskyj
P1xt
@P1xt
Jan 13 2015 04:32
If you're wondering how complicated you can possibly make it @yaskyj :smile:
function ThirdGreatest(strArr) { 
  var counts = [],
      i,
      thirdLargest = [];
  for (i=0; i< strArr.length; i++) {
      counts[i] = strArr[i].length;       // doing this feels wrong
      thirdLargest[i] = strArr[i].length; // why save twice
  }

  thirdLargest = thirdLargest.sort(function(a, b){return b-a})[2];
  for (i=counts.length; i > 0; i--) {
    if (counts[i] === thirdLargest) {
        return strArr[i];
    }
  }
}
Ben Clist
@BenClist
Jan 13 2015 04:33

Mines also pretty longwinded
```
function ThirdGreatest(strArr) {

var long1 = "";
var long2 = "";
var long3 = "";

for(i = 0; i < strArr.length; i++){
if(strArr[i].length > long1.length){
long3 = long2;
long2 = long1;
long1 = strArr[i];
} else if(strArr[i].length > long2.length){
long3 = long2;
long2 = strArr[i];
} else if(strArr[i].length >= long3.length){
long3 = strArr[i];
};
};

// code goes here
return long3;

}

function ThirdGreatest(strArr) { 

  var long1 = "";
  var long2 = "";
  var long3 = "";

  for(i = 0; i < strArr.length; i++){
    if(strArr[i].length > long1.length){
      long3 = long2;
      long2 = long1;
      long1 = strArr[i];
    } else if(strArr[i].length > long2.length){
      long3 = long2;
      long2 = strArr[i];
    } else if(strArr[i].length >= long3.length){
      long3 = strArr[i];
    };
  };

  // code goes here  
  return long3; 

}
Bill Maca
@bmaca
Jan 13 2015 04:36
Are you guys codepen fans?
Justin Rogers
@yaskyj
Jan 13 2015 04:36
I have plenty of the coderbyte challenges that I'm pretty sure were way to convoluted. Both of the Counting Minutes challenges are a bunch of spaghetti mess.
Russ Eby
@RussEby
Jan 13 2015 04:37
@bmaca I like it, but there are other tools that do the same type of things. Do you have one you like?
Bill Maca
@bmaca
Jan 13 2015 04:39
Yes @RussEby
vim and a very sophisticating .vimrc ;)
;)
Russ Eby
@RussEby
Jan 13 2015 04:42
Oh, in the browser?
Bill Maca
@bmaca
Jan 13 2015 04:42
I was jk. Its in the Command Line ;)
I use vim for all my coding its a highly configurable text editor
its free, comes with all unix based systems
Russ Eby
@RussEby
Jan 13 2015 04:44
Ok, got confused there. Codepen isn't comparable to vim. It's just for small snippets to test and share with.
Like jsfiddle, or jsbin.
Bill Maca
@bmaca
Jan 13 2015 04:46
I know, I was just making a joke. I am not a fan of this UI world nonsense ;) hehe
Russ Eby
@RussEby
Jan 13 2015 04:47
UI is just a fad, give it time, we'll go back to DOS/CPM/UNIX :smile:
Bill Maca
@bmaca
Jan 13 2015 04:47
UNIX For the Win
I do like the JS community here, I am not going to lie
I think this is great for the world
Suzanne Atkinson
@AdventureBear
Jan 13 2015 04:48
We will change the world!
Bill Maca
@bmaca
Jan 13 2015 04:48
hehe @AdventureBear
jesus thats the longest url i have ever seen for the homepage
Russ Eby
@RussEby
Jan 13 2015 04:50
I think any community that can work together to build things is a good thing, for a larger goal is worth working with.
@bmaca that URL also contains the google referrer code, that could be removed
Darryl Dixon - Piece Digital
@piecedigital
Jan 13 2015 04:50
@bmaca I signed up for that. Didn't like the idea of crowd-sourcing.
Bill Maca
@bmaca
Jan 13 2015 04:50
has anyone done any jobs on there though?
Russ Eby
@RussEby
Jan 13 2015 04:50
crowd-sourcing?
Darryl Dixon - Piece Digital
@piecedigital
Jan 13 2015 04:51
@bmaca I entered one and lost it
Ben Clist
@BenClist
Jan 13 2015 04:51
I've used it to get design work done via the contests on there
Wynda
@Wynda
Jan 13 2015 04:51
@RussEby Thanks for the information about what the colors mean. So what are white,blue orange, red? Is there a site that has HTML, CSS, JQuery, JavaScript for the extreme beginner. I looked at the Dummies books but didn't find much.
Ben Clist
@BenClist
Jan 13 2015 04:51
odesk is a bit more professional and doesn't try to milk you for money every 5 seconds like freelancer does
Darryl Dixon - Piece Digital
@piecedigital
Jan 13 2015 04:51
@RussEby "Crowdsourcing is the process of obtaining needed services, ideas, or content by soliciting contributions from a large group of people, and especially from an online community, rather than from traditional employees or suppliers."
I'd type that explanation out myself but Google was better :P
Bill Maca
@bmaca
Jan 13 2015 04:52
@BenClist I was thinking of entering a bid
but didnt know how legit it is?
Ben Clist
@BenClist
Jan 13 2015 04:53
it's completely legit
just make sure the person advertising the job has good reviews/feedback etc.
Bill Maca
@bmaca
Jan 13 2015 04:54
Gotcha. Thanks @BenClist
Ben Clist
@BenClist
Jan 13 2015 04:54
but you'll struggle to compete on there, the prices are insanely low
Bill Maca
@bmaca
Jan 13 2015 04:54
Really sheck this one out

What we need:

  • HTML to Open Cart conversion.
  • Template installation on final server.
  • Basic adjustments on required modules (Wishlist, Coupons, Facebook Connect, etc.).
  • Possibly 2 Languages (Spanish & English).
  • Full support after project is done, just in case we need to add or modify minor things.

What we'll provide:

  • Images, HTML, CSS and Basic jQuery Codes, Access to final server for you to work.

How we work:

  • We'll create 2 milestones. 50%, 30% & 20%.
  • 50% will be released once we see a working site.
  • 30% will be released once the site is fully working.
  • 20% will be released a week after project is finished to fully tested.

Compensation:
257$/hr

Production Time:

  • 5 - 7 Days
how legit is that lol?
I think they meant to say 3 *We'll create 2 milestones. 50%, 30% & 20%.
Suzanne Atkinson
@AdventureBear
Jan 13 2015 04:56
$257/hr? sweet
I"m in!
Ben Clist
@BenClist
Jan 13 2015 04:57
Looks fairly legit, that hourly rate is very high for what you can usually get on Freelancer, but then there's not many people that know OpenCart that well, and that's a lot of work to do in a week
Russ Eby
@RussEby
Jan 13 2015 04:58
@Wynda are you referring to training or editor?
Bill Maca
@bmaca
Jan 13 2015 04:59
@BenClist I agree 100%
P1xt
@P1xt
Jan 13 2015 05:00
@bmaca Be extremely wary of any client on there that requests hourly bids then ties the payout to milestones. That's not how it works. Either it's hourly or it's flat rate estimates tied to milestones.
Bill Maca
@bmaca
Jan 13 2015 05:01
@p1 Thats a great point man.
Ben Clist
@BenClist
Jan 13 2015 05:01
hence why I said reviews are everything on sites like that
Bill Maca
@bmaca
Jan 13 2015 05:01
@P1xt *
P1xt
@P1xt
Jan 13 2015 05:03
Also, "Full support after project is done, just in case we need to add or modify minor things." is super-secret freelancer code for "don't take this job, if you die, 10 years from now I'll still be pestering your firstborn to add CSS edits to the site because the lavender I picked 5 years ago isn't quite purple enough anymore"
Bill Maca
@bmaca
Jan 13 2015 05:03
hahhahhaaha
hahahahahahahah
P1xt
@P1xt
Jan 13 2015 05:04
It would be funnier if it weren't true.
Bill Maca
@bmaca
Jan 13 2015 05:04
Your right. @P1xt is the TRUTH
new nickname

THETRUTH

Wynda
@Wynda
Jan 13 2015 05:05
@RussEby I was thinking more for a resource guide to help me understand all of this better, maybe a book or a site.
Suzanne Atkinson
@AdventureBear
Jan 13 2015 05:05
since we're on the topic even though this isn't "help" oriented, are there legit small jobs worth our while ( I know, that will vary for each of us) to flex some new javascript or "short stack" development? Maybe some super simple projects ? I havn't looked but wondering if I can make a quick $50 or $100 while turning out a quick simple script...that would be cool.
@Wynda what are you referring to exactly?
P1xt
@P1xt
Jan 13 2015 05:06
I had one client whose idea of "reasonable" edits for a Wordpress site was rearranging the layout and changing content on every single page because once they actually read what they gave me, they realized the content was shoddy.
Wynda
@Wynda
Jan 13 2015 05:07
I am having trouble understanding what all the different things mean like elements, divs, styles and things like that. I thought maybe their was something or someplace that would break them down further and make them really easy to understand.
Russ Eby
@RussEby
Jan 13 2015 05:08
@Wynda How far have you gotten on the challenges?
Wynda
@Wynda
Jan 13 2015 05:09
I am on 7 now. But many times I have to look ahead or refer back to how things are supposed to go and in what order to make sure I am doing them correctly. I take alot of notes too.
Russ Eby
@RussEby
Jan 13 2015 05:10
@Wynda One thing I like to do is create a pen of things I'm learning. Just start with a blank pen and add a few lines and play around with it. The best way of learning is playing and testing it out.
@Wynda Sometimes the pen has very little in it, but I type it in and see what is displayed. Sometimes use big numbers and little numbers to "break" it.
Wynda
@Wynda
Jan 13 2015 05:12
Do you do this on Code pen?
Russ Eby
@RussEby
Jan 13 2015 05:12
@Wynda yes, and you can share the pen, even without logging in.
Wynda
@Wynda
Jan 13 2015 05:13
What does "break" it mean?
Russ Eby
@RussEby
Jan 13 2015 05:13
Just hit save, and copy the URL from the browser and someone else can see the pen.
I'll put in crazy numbers, just to see what happens. If the tutorial says 15px. I'll put in 500px just to see.
Suzanne Atkinson
@AdventureBear
Jan 13 2015 05:15
Wynda, for me doing the tutorials on codecademy & codeschool for the CSS & HTML were slightly different yet covered similar stuff, that it was good for review and retention. Taking your own notes is always an option, as is finding a good reference list. W3 schools si good (just use google for "w3 css reference" or something like that
P1xt
@P1xt
Jan 13 2015 05:15

@AdventureBear If you're considering freelancing. I've done work through oDesk, Elance and Freelancer. Freelancer is the easiest to get your foot in the door but the pay is crap. Elance is my favorite. The best advice I can give is this:

  • Build out your profile like it's a professional resume you're sending to a fortune 50 firm, make it look rock-friggen-solid professional
  • Every time you get turned down to build something, build one of your own for you (rebranded of course) that looks 10x better than the one they ended up with by not picking you. Screenshot it and put it on your profile.
  • Take the skills tests (costs at freelancer, but free at the other two), the clients who pay better care that you took the time
  • Always, even in your proposal, communicate with the client like they are already a long term client and you are brainstorming with them to make sure they get the highest quality solution they possibly can within their budget
  • Use your big boy vocabulary, knowing English puts you at a significant advantage
  • Never take a job that includes the words "Someone who knows what they're doing can finish this in an hour"

Edited to add:

  • Insist on written communication. It will save you from "but when I called you three thursdays ago during dinner, you promised you'd XXX"

Edited again to add:

  • If you're in the US, focus on projects from Australian, Great Britain, and Canada. I've noticed that US clients tend to be looking for cheap third world labor, whereas oversees clients tend to hire US freelancers that have stellar profiles ;)

I'll think of more, but this is getting long

Suzanne Atkinson
@AdventureBear
Jan 13 2015 05:15
then the dash challenges let you get your hands dirty. I copied many of the dash projects into codepen to paly further.
Russ Eby
@RussEby
Jan 13 2015 05:16
@Wynda http://codepen.io/RussEby/pen/LERMgP Here's an example of using codepen to take notes. I just laid out lists. I saved it so I can also go back.
Wynda
@Wynda
Jan 13 2015 05:17
@AdventureBear Thanks for the information. I will check those out too.
@RussEby I didn't know about taking notes there. I thought it was for checking work and sharing.
Russ Eby
@RussEby
Jan 13 2015 05:20
@Wynda What I mean by taking notes is when you learn about div's in a tutorial, you can go over to Codepen and play around with it and experiment.
You can sharing whatever pen you have created, and as far as checking your work, it lets you look at a live render of the HTML/CSS/JS.
Wynda
@Wynda
Jan 13 2015 05:21
Oh okay, I thought you meant taking notes literally.
Russ Eby
@RussEby
Jan 13 2015 05:22
With Codepen, the render is live, as you make changes the page changes with the edits.
Not like notes in a class room, more of snippets that you learn, maybe how to layout a table or form. You could put it in Codepen and refer back to it. If you look around Codepen, you'll see tons of things people have created. You can fork them so you could play with and them change yourself.
More like a scrapbook then a notebook.
P1xt
@P1xt
Jan 13 2015 05:24
@AdventureBear Also HEADS UP, Freelancer takes it's 10% as soon as you accept a project, not when the client pays you. Elance takes it's cut when you get paid. If you're short on cash, this can be a really huge thing. You take a 3k project on freelancer.com, It will debit you $300 the second you click accept. And, if the client drags out paying you until two weeks after they're done testing ... well, you get the picture.
Wynda
@Wynda
Jan 13 2015 05:25
Codepen seems very handy. I will have to check it out more tomorrow. Thanks for all the information. I am going to go work on Challenge 7 some more and see if I can get it to work.
Russ Eby
@RussEby
Jan 13 2015 05:25
Awesome.
Suzanne Atkinson
@AdventureBear
Jan 13 2015 05:27
@P1xt All great advcie, Thanks!!
Jay-Ar Jamon
@skrpt
Jan 13 2015 07:18
Brilliant advice @P1xt !
Ryan Malm
@Rybar
Jan 13 2015 10:24
As far as talking about data structures goes, are hashes and dictionaries pretty much the same thing?
Bin Ury
@teddy-error
Jan 13 2015 13:12

Using jQuery attr method on a selected object as in the 1st jQuery exercise:

$("#next-exercise").attr("disabled", false);

will set disabled to false
However, the jquery code:

$("#next-exercise").attr("disabled", "false");

Will not.

Looking at the jquery documentation for attr, the method is supposed to only take a number or string for the value parameter. How are we supposed to know to pass false as a keyword in this instance?

kinda baffled on this one
Dominic Jones
@towwiow
Jan 13 2015 13:31
@teddy-error which challenge is it?
is it in try.jQuery ?
Bin Ury
@teddy-error
Jan 13 2015 13:32
it's the first question of tackle jquery exercises #15
Dominic Jones
@towwiow
Jan 13 2015 13:36
Ah.
I'm not that far yet. I can still give it a look th
Jordan Wood
@jordanw
Jan 13 2015 13:53
false without " " is equal to 0
Bin Ury
@teddy-error
Jan 13 2015 14:18
setting to 0 does not work though
@QuincyLarson
Dominic Desimini
@trisell
Jan 13 2015 16:04
Good morning Campers....
Dominic Jones
@towwiow
Jan 13 2015 16:04
Good morning @trisell
Suzanne Atkinson
@AdventureBear
Jan 13 2015 16:07
can anyone suggest a starting point if I want to test some javascript code with this API:
Nathan
@terakilobyte
Jan 13 2015 16:08
@AdventureBear how do you want to use it?
Suzanne Atkinson
@AdventureBear
Jan 13 2015 16:08
i can sketch something ojt in pseudocode, but not sure what to do. I want to query the invoices by "sales person", then output a list
Nathan
@terakilobyte
Jan 13 2015 16:08
I’d use something like the DHC chrome extension
write a call and just make sure you’re getting data you expect
then transition from that to making the call from an app and displaying the result in the console, then in an html element
Suzanne Atkinson
@AdventureBear
Jan 13 2015 16:10
sounds good
Adam Hollett
@admhlt
Jan 13 2015 16:15
@AmmarAliShah I had trouble with adding that CSS animation too, but I can't remember what the issue was... :(
Ammar Ali Shah
@AmmarAliShah
Jan 13 2015 16:17
@admhlt don't you have the pen saved?
Adam Hollett
@admhlt
Jan 13 2015 16:17
Unfortunately not, I didn't make a CodePen account. Really should have
Ammar Ali Shah
@AmmarAliShah
Jan 13 2015 16:17
Need help with FCC Challenge #17: http://www.freecodecamp.com/challenges/17
Nathan
@terakilobyte
Jan 13 2015 16:18
@AmmarAliShah link your gist
err codepen
Ammar Ali Shah
@AmmarAliShah
Jan 13 2015 16:22
@terakilobyte so we had to use one of those type of styles listed on the animated website
Nathan
@terakilobyte
Jan 13 2015 16:23
yes
Ammar Ali Shah
@AmmarAliShah
Jan 13 2015 16:25
ahan cool thanks
Nathan
@terakilobyte
Jan 13 2015 16:26
also your on function
what are you trying to add animated to?
the button or h1?
All fixed
Adam Hollett
@admhlt
Jan 13 2015 16:30
Good job. :) The lesson doesn't really make it clear that you have to add .animated and also something like .hinge.
Ammar Ali Shah
@AmmarAliShah
Jan 13 2015 16:31
@admhlt yeah
Nathan
@terakilobyte
Jan 13 2015 16:31
good
@AmmarAliShah also, do you know why you had to change your .on() method?
$('.text-primary').on('click', 'button', function() {
  $('h1').toggleClass('animated bounce');
});
is how you would specify that only the button clicked in the element with the text-primary class would have that effect on h1
I can throw a pen together to illustrate why you might use something like this if you are interested
Ammar Ali Shah
@AmmarAliShah
Jan 13 2015 16:46
sure
Ammar Ali Shah
@AmmarAliShah
Jan 13 2015 16:55
@terakilobyte are you still here?
towwiow @towwiow is lurking.
Nathan
@terakilobyte
Jan 13 2015 17:09
@AmmarAliShah yeah what’s up?
Bill Maca
@bmaca
Jan 13 2015 17:44
I am probably missing something simple, but I can think straight, and cant get this to work.
body {
  background: -moz-radial-gradient;
}
Add a webkit vendor-prefixed background property
\ Add a Mozilla prefixed background: -moz-radial-gradient
I need to add those 2
checkpoint 11 lesson 7
Dominic Jones
@towwiow
Jan 13 2015 17:49
In dash?
@bmaca
Bill Maca
@bmaca
Jan 13 2015 17:50
Yes Sir
I mean im not sure if i need to specify colors or what not
Maxim Orlov
@Maximization
Jan 13 2015 17:53
@bmaca you're missing the arguments after -moz-radial-gradient
Dominic Jones
@towwiow
Jan 13 2015 17:58
@bmaca ^ just got back to my desk, was going to check for you but @Maximization beat me to the punch.
did that fix the issue?
Bill Maca
@bmaca
Jan 13 2015 18:02
@Maximization thats my concern
I am not sure what they should be, Am I missing the part where it tells you what they should be?
@towwiow
Maxim Orlov
@Maximization
Jan 13 2015 18:11
@bmaca the same as in the previous step, you just needed to add the -moz- prefix to the existing code without changing anything
Bill Maca
@bmaca
Jan 13 2015 18:12
That makes sense @Maximization
Dominic Jones
@towwiow
Jan 13 2015 18:12
yup.. the prefex should become the normal code to make it work in advanced browsers
should come before the normal code*
towwiow @towwiow is going over the try.jQuery lessons much faster than he originally did, without touching jQuery for a week. Is happy he retained so much.
Bill Maca
@bmaca
Jan 13 2015 18:15
@Maximization @towwiow That makes sense, that did it guys !
Thanks much :)
I wasnt sure what they wanted the arguments to be?
Dominic Jones
@towwiow
Jan 13 2015 18:15
that's what we're here for :) glad I could be of service
think my n00b level just went to -99
Bill Maca
@bmaca
Jan 13 2015 18:16
sometimes all you need is to ask a question, and the answer sparkes in your head just by asking
lol
Dominic Jones
@towwiow
Jan 13 2015 18:18
lol yeah. gotta hear it out loud sometimes.
Bill Maca
@bmaca
Jan 13 2015 20:34
Anyone here spot any errors with this code?
<div class="torso">
  <div class"left">j</div>
  <div class="right">j</div>
</div>
Nathan
@terakilobyte
Jan 13 2015 20:36
@bmaca <div class="left">j</div> perhaps
Bill Maca
@bmaca
Jan 13 2015 20:39
@terakilobyte Ahh shikes,
"="
forgot that sucker ^
Nathan
@terakilobyte
Jan 13 2015 20:40
it happens
Bill Maca
@bmaca
Jan 13 2015 20:40
hehe :)
Thanks @terakilobyte
Nathan
@terakilobyte
Jan 13 2015 20:40
I routinely forget to include a closing ')' on my if statements
I'm masochistic like that
Bill Maca
@bmaca
Jan 13 2015 20:41
what kind of text editor do you use, that helps you with syntax like that
@terakilobyte
If you use any, do have a reccomendation.
I am ussually always on VIM
It would be nice to develop CSS in a way like DASH, real live change while your implemanting the code
Nathan
@terakilobyte
Jan 13 2015 20:42
oh that's why I use a text editor
sublime text 3 and webstorm are good
Bill Maca
@bmaca
Jan 13 2015 20:42
Theres probably tools out there, but havent really looked into CSS that much :/
Nathan
@terakilobyte
Jan 13 2015 20:42
vim ins't
Bill Maca
@bmaca
Jan 13 2015 20:43
hehe, I love my vim
Nathan
@terakilobyte
Jan 13 2015 20:43
isn't bad at all if you have a good set up
sadly somethign got corrupted on my mac about an hour ago
I'm reinstalling the entire os
so I get to reinstall everything!
only 37 minutes for mavericks to finish downloading mavericks
Quincy Larson
@QuincyLarson
Jan 13 2015 20:44
Wait - it downloaded itself?
Bill Maca
@bmaca
Jan 13 2015 20:44
Ugghhh yikes man. Those are not good days
heres my vim setup
 cat ~/.vimrc
set nocompatible               " be iMproved

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'

" My Bundles here:
"
" original repos on github
Plugin 'majutsushi/tagbar'
Plugin 'kien/ctrlp.vim'
Plugin 'saltstack/salt-vim'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/syntastic'
Plugin 'klen/python-mode'
Plugin 'rking/ag.vim'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'tpope/vim-sensible'
Plugin 'davidhalter/jedi-vim'
Plugin 'vimwiki/vimwiki'
Plugin 'chrisbra/csv.vim'
Plugin 'altercation/vim-colors-solarized'
Plugin 'mitsuhiko/vim-jinja'

" Github repos of the user 'vim-scripts'
" => can omit the username part
Plugin 'L9'
Plugin 'FuzzyFinder'

" ============================================
" Configs
" ============================================

" File Types
" ----------
syntax on                      " syntax highlighting
filetype on                    " required!
filetype plugin indent on      " required!
filetype plugin on                    " per-filetype plugins
filetype indent on                    " per-filetype indent

" Tabs
" ----
set autoindent                        " be smart
set smarttab                          " also smart
set shiftwidth=4                      " width of line-initial tab, maybe some other stuff
set shiftround
set softtabstop=4                     " 4 space tabs (soft)
set tabstop=4                         " 4 space tabs (hard)
set expandtab                         " use soft tabs

" Encodings
" ---------
set enc=utf-8                         " still don't know, really
set fenc=utf-8                        " same
set fencs=utf-8,shift-jis,iso-8859-1  " I guess these are the ones that I ever actually see

" Misc
" ----
set mouse=nv                          " let the mouse do stuff
set clipboard=unnamed                 " share system clipboard
set bs=2                              " make backspace work like it should
set autoread                          " automatically check for changes to the file
set incsearch                         " turn on incremental searching
set scrolloff=10                      " rows on either side of the cursor when scrolling
set splitright                        " open new vertical splits on the right side
set splitbelow                        " open new horizontal splits on the bottom
set smartcase                         " case-insensitive searching
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*
set wildmenu                          " might do nothing because of wildmode
set wildmode=longest,list             " show menu for tab-completion
set wildignore+=*.pyc                 " don't need dem pyc files
set foldmethod=syntax                 " I dunno, maybe this will set up more folds automatically?
set foldlevelstart=99                 " forces folds open by default
set nojoinspaces                      " don't use two spaces after a . when joining lines
set foldenable                        " enable fold
set showcmd                           " show the cmdline.  not sure what it does other than show num of lines in visual mode
set t_Co=256                          " use 256 colors
set background=light                  " screen glare :'[
set ttyfast                           " optimize for fast terminals
" set lazyredraw                        " don't redraw while executing macros or that sort of thing
set ruler                             " show line and column number always
set laststatus=2                      " always show the status line
set title                             " set window title
set noerrorbells                      " DESTROY ALL BELLS
set vb t_vb=                          " HATE BELLS
set showmatch                         " highlight matching brackets
set hlsearch                          " highlight search term
set showtabline=1                     " only show file tabs when more than one file open
set backupdir=/tmp,/var/tmp,~/tmp     " keep backup files in one place instead of next to the file
set directory=/tmp,/var
Nathan
@terakilobyte
Jan 13 2015 20:44
yeah it downloads itself
yep, looks like a good vim setup
vundle is nice, I'm glad I was turned onto it
@QuincyLarson if you restart a mac and hold command r
it will go into recovery mode
you can tell it to reinstall the os and it will download the os from apple :)
so node and mongo installed on windows
Bill Maca
@bmaca
Jan 13 2015 20:47
@terakilobyte A while I go I had a shell script to install all appps I needed for my fresh new mac
Nathan
@terakilobyte
Jan 13 2015 20:48
I'm going to steal that
Bill Maca
@bmaca
Jan 13 2015 20:49
hehe, go for it,
:+1:
Suzanne Atkinson
@AdventureBear
Jan 13 2015 20:50
@terakilobyte welcome to my world of reinstalling! Lol. no problems since we paired
1/2 way through my sunlight foundation API tutorial, then I'll take it to codepen & try my own. :)
Nathan
@terakilobyte
Jan 13 2015 21:03
@AdventureBear yeah
well I'm going to have to part with my mbp for like a week soon anyway, will probably send it in tonight
they're going to refurbish it
so really not a bad thing I'm setting up windows and linux atm, would have needed to today at some point anyway or not been able tod evelop until i got my comp back
Suzanne Atkinson
@AdventureBear
Jan 13 2015 22:17
yikes! what happened?
Suzanne Atkinson
@AdventureBear
Jan 13 2015 22:46
anyone interested in helping me tackle the sunlight foundation API project in codecademy? I"m on step 11 of 14
instructions: "Using the text.json endpoint, find the total number of occurrences of the words "war" and "peace". Put them into global variables named war and peace, respectively. This will require multiple API calls."
the starting code:
jQuery(['war', 'peace']).each(function(ix, word){

  var query_params = { apikey: 'f6ab5f2e4f69444b9f2c0a44d9a5223d',
                       phrase: word
                     };

  var endpoint = 'http://capitolwords.org/api/text.json'

  var options = {
    data: query_params,
    type: 'GET',
    dataType: 'jsonp'      
  };

    var request = jQuery.ajax(endpoint, options)
                        .done(showResponse);

});
i'm not sure what's going on here between the top line function statement and the request at the bottom. Up to this point, there has been just a single request made with the query_params containing ONE "phrase". Now it looks like 'word' is an array of war & peace?
submitting code and the hint is of no help to me. I didn't do any assignments of variable results and it passed.
the help forum only has 1 questoin posted with no discussion about this step. Any help appreciated!
James McShane
@jmcshane
Jan 13 2015 23:47

@AdventureBear Lets start with that first line

jQuery(['war', 'peace']).each(function(ix,word)) {

The each method iterates through the array, passing in the index of the element from the array and its value. To check out what this is doing, go into Chrome, inspect element, and run this command in the console:

jQuery(['testing', '1','2','3']).each(function(ix,word){
    console.log(word);
});

You should see that the strings from the array get passed in one by one.

Then, the query_params are passing the part of the URL after the ?, basically building the URL that is required by the Capital Words API. The API requires a key to use, and then we are passing in just a single word, not the whole array.
The jQuery.ajax function builds the appropriate HTTP call using the endpoint as the url, the data value from the options to build the query parameters. It then carries out a GET request, expecting json back
Suzanne Atkinson
@AdventureBear
Jan 13 2015 23:51
OK, that part makes sense. So within that array iteration I am supposed to get the num_results for 'war' and for 'peace' by assigning global variables?
James McShane
@jmcshane
Jan 13 2015 23:51
Right
Suzanne Atkinson
@AdventureBear
Jan 13 2015 23:51
Seems like it shoudl be so simple but it is escaping me. I'll try that in the cosnole.
James McShane
@jmcshane
Jan 13 2015 23:51
so, create global variables var war and var peach
peace*
Suzanne Atkinson
@AdventureBear
Jan 13 2015 23:52
I can't figure otu how to get the variables out. I've tried with the next 2 challenges in that tutorial and still can't see my global assignements in console log. it's a big mystery to me!
James McShane
@jmcshane
Jan 13 2015 23:52
and maybe set them based on the ix value:
    if(ix === 0) { 
           war = JSON.num_found; 
     } else { 
        peace = JSON.num_found;
    }
set the values of war and peace as global variables on your index.html file
Suzanne Atkinson
@AdventureBear
Jan 13 2015 23:54
what does the ix variable do ? is that provided as a "clue" to how to solve the problem?
so I just use the name / label of the object in JSON to get hte value out?
James McShane
@jmcshane
Jan 13 2015 23:55
The ix is the index of the word in the array.
Suzanne Atkinson
@AdventureBear
Jan 13 2015 23:56
when I do this I get "undefined" in the console
    if(ix === 0) { 
         war = JSON.num_found; 
     } else { 
        peace = JSON.num_found;
    }
    console.log(war);
maybe this is a codecademy editor problem. I really want to make this work as it applies fairly directly with what I want to do. I think I"ll put it into codepen or jsfiddle?