These are chat archives for FreeCodeCamp/Help

17th
Mar 2018
saqib fayaz
@saqibfayaz
Mar 17 2018 05:22
is there any room for c language ?
Norvin Burrus
@ndburrus
Mar 17 2018 07:47
@saqibfayaz u might like this: :sparkles:
Adegoke Fred
@Frediflexta
Mar 17 2018 09:19
Hi guys...
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 17 2018 09:19
@Frediflexta Hi :wave:
Adegoke Fred
@Frediflexta
Mar 17 2018 09:55
Hey @MuhammedKarim How's your day going?
i'm in a bit of a fix guys, so i am writing code for a palindrome checker, there are some bugs i'm trying to fix and i need help
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 17 2018 10:02
Great thanks @ad
CamperBot
@camperbot
Mar 17 2018 10:02
muhammedkarim sends brownie points to @ad :sparkles: :thumbsup: :sparkles:
api offline
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 17 2018 10:02
Oops! Great @Frediflexta how about you?
Adegoke Fred
@Frediflexta
Mar 17 2018 10:12
Great...
Stephen James
@sjames1958gm
Mar 17 2018 11:40
@Frediflexta Are you still stuck?
ALQC
@K-Philleani
Mar 17 2018 12:38
I need help
everybody
Ken Haduch
@khaduch
Mar 17 2018 12:40
@K-Philleani - hello - please post your question and code / URL for your project, etc.
Ene Catalin
@EneCatalin
Mar 17 2018 14:07
any easy way to modify an array of strings in php ?
I just need to add another string at the beginning of each one
Stephen James
@sjames1958gm
Mar 17 2018 14:19
Ene Catalin
@EneCatalin
Mar 17 2018 14:21
does it modify the old array or create a new one ?
I am very much fine with the old one modified
Stephen James
@sjames1958gm
Mar 17 2018 14:28
@EneCatalin creates a new one
Ene Catalin
@EneCatalin
Mar 17 2018 14:28
so I need a new one ?
even if it's big ?
Stephen James
@sjames1958gm
Mar 17 2018 14:28
@EneCatalin It builds a new array from the result of calling your function for each element.
Ene Catalin
@EneCatalin
Mar 17 2018 14:29
oh right, creates not create my bad
Stephen James
@sjames1958gm
Mar 17 2018 14:29
Well if it is big then you will probably need to loop over it and modify each element individually.
Ene Catalin
@EneCatalin
Mar 17 2018 14:29
cool, that's what I want ideally
so I tried this
    foreach ($this->image_name_array as $value){
            $this->image_name_array = '/plots/'.$value;
        }
CamperBot
@camperbot
Mar 17 2018 14:30
:bulb: to format code use backticks! ``` more info
Ene Catalin
@EneCatalin
Mar 17 2018 14:30
but it fails, why ?
oops, it's $value = 'plots'.$value
I think
Stephen James
@sjames1958gm
Mar 17 2018 14:31
@EneCatalin You are overwriting the whole array
@EneCatalin $value = won't modify the array only that variable
Ene Catalin
@EneCatalin
Mar 17 2018 14:32
so how do I append something like '/foldername/' to each element ?
I managed to create an array that gets the name of the files but if I get the path it gets it wonky so I am trying to add that manually => this
Stephen James
@sjames1958gm
Mar 17 2018 14:35
@EneCatalin I think this is what you want - $a is the array and $k is the key (or index) for the value $v
So you store then new value back into $a at index/key $k
foreach ($a as $k => $v) {
    $a[$k]  = '/plots/'.$v;
}
Ene Catalin
@EneCatalin
Mar 17 2018 14:38
ima try
I don't get it
 foreach ($this->image_name_array as $k => $v) {
            $this->image_name_array[$k]  = '/plots/'.$v;
        }
nothing happened
brb I think I effed up somewhere else
Ene Catalin
@EneCatalin
Mar 17 2018 14:46
sorry didn't know require made them execute
WORKS
Stephen James
@sjames1958gm
Mar 17 2018 16:42
@EneCatalin Great! I had gone out to do chores
Ene Catalin
@EneCatalin
Mar 17 2018 16:59
yeah, that bit of code was really important to tie the whole app together
Adegoke Fred
@Frediflexta
Mar 17 2018 17:12
@sjames1958gm Yes i am
checkButton.addEventListener("click", () => {
  if (isPalindrome(value))
  {
    result.innerHTML = "<strong>Awesome!! It's a Palindrome</strong>";
    result.className = "alert alert-success";

  }
  else
  {
    result.innerHTML = "<strong>Sorry!! Not a Palindrome</strong>";
    result.className = "alert alert-danger";
  }
When i click on the button, it always outputs my value as Awesome!! It's a Palindrome even when its not
my isPalindrome functions works perfectly
function isPalindrome(str) {
  /* convert str to lowercase for easy parsing 
   * and remove non-alphanumeric char */
  const lowStr = str.replace(/[\W_]/g,"").toLowerCase();

  // reverse lowstr and check if its the same
  const reverseStr = lowStr.split("").reverse().join("");

  if (reverseStr === lowStr) { return true; }
  else { return false; }
}
Stephen James
@sjames1958gm
Mar 17 2018 17:30
@Frediflexta Where is value coming from?
@Frediflexta I would add a console.log before the if so I could see what value is?
Nazar
@IsaakNazar
Mar 17 2018 18:37
@sjames1958gm Hi Stephen!
What books could you recommend to learn basics that includes CS, algorithms, data structures , all stuff related to programming but not related to special language?
Jay Dinh
@SavageSoup
Mar 17 2018 18:41
hey can someone help me out with some javascript? My code seems to work, but FFC won't accept it
Nazar
@IsaakNazar
Mar 17 2018 18:42
@SendPie ask away
Jay Dinh
@SavageSoup
Mar 17 2018 18:42
im also new so how do i make a code box like the people above? lol
Nazar
@IsaakNazar
Mar 17 2018 18:43
@SendPie use backticks to wrap you code '`'
Jay Dinh
@SavageSoup
Mar 17 2018 18:43

`var fact = 1;
function factorialize(num) {
if(num === 0) {
return 1;
} else {
for(var i = 1; i <= num; i++) {
fact *= i;
}
}

return fact;
}
fact = 1;

factorialize(10);
`

```var fact = 1;
function factorialize(num) {
if(num === 0) {
return 1;
} else {
for(var i = 1; i <= num; i++) {
fact *= i;
}
}

return fact;
}
fact = 1;

factorialize(10);```

Nazar
@IsaakNazar
Mar 17 2018 18:43
@SendPie use ``` times before and after the code
Jay Dinh
@SavageSoup
Mar 17 2018 18:43
sorry for spam
Nazar
@IsaakNazar
Mar 17 2018 18:44
@SendPie 3 times
Jay Dinh
@SavageSoup
Mar 17 2018 18:44
var fact = 1;
function factorialize(num) {
  if(num === 0) {
    return 1;
  } else {
    for(var i = 1; i <= num; i++) {
      fact *= i;
    }
  }

  return fact;
}
fact = 1;

factorialize(10);
thank you
I tested my code out, and I seem to get the correct number every time, but it won't let me move on
Nazar
@IsaakNazar
Mar 17 2018 18:48
@SendPie better would be like
var result = 1;
  if(n === 0) return 1;
  for (var i = 1; i <= n; i++) {
    result *= i;
  }
  return result;
Jay Dinh
@SavageSoup
Mar 17 2018 18:49
okay, thank you!
Nazar
@IsaakNazar
Mar 17 2018 18:49
@SendPie does it work?
knight2
@knight2
Mar 17 2018 19:28
does anyone know how to properly use and compile SCSS in visual studio code? I've been trying, copying the exact docs for task build from the visual studio website, using stackvoerflow answers, nothing works.
Stephen James
@sjames1958gm
Mar 17 2018 19:33
@Frediflexta Did you figure it out?
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 17 2018 19:33
image.png
Hope this helps someone!
Stephen James
@sjames1958gm
Mar 17 2018 19:33
@SendPie The reason yours does not pass is because FCC challenges don't like globals
Adegoke Fred
@Frediflexta
Mar 17 2018 19:39
Not yet @sjames1958gm , trying to re-write the whole thing... would get back to you
Stephen James
@sjames1958gm
Mar 17 2018 20:15
@Frediflexta I copied your code and it seemed to work ok the last code you posted in private chat
Sadio Ali
@5adiyah
Mar 17 2018 23:55
Anyone here familiar with Ember.js and Wordpress API? Trying to connect the two following this tutorial https://www.codesandnotes.com/ember-js/ember-wordpress/ but I'm getting this error: Error while processing route: members Assertion Failed: You must include an 'id' for member in an object passed to 'push' .... any ideas how to fix it? Here's a full detailed post on my question https://stackoverflow.com/questions/49342824/error-assertion-failed-you-must-include-an-id-for-member-in-an-object-passed