Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Kaz Baig
@kbaig
You mean PHP?
Tom
@moT01
you need to go edit that so people can read it -- three ticks (`) then new line (shift+enter) then code then new line and then three ticks again
Kaz Baig
@kbaig
Well if that's PHP, should prob try the back end room
Unless someone happens to know it here
supercalifragilisticthisbesuchacodekid
@ICodedGod
if(isset($_POST['get_option'])){
$_SESSION["price"] = $_POST['get_option'];
$to_Curr =$_POST['get_option'];
}elseif(isset($_POST['select_lang'])){
$select_lang = $_POST['select_lang'];
switch ($select_lang) {
case 'Norsk':
/*'Norsk bokmål' || */
$to_Curr = 'NOK'; 
$_SESSION["current_lang"] = 'nb';
break;
case 'Español':
$to_Curr = 'EUR'; 
$_SESSION["current_lang"] = 'es';
break;
case 'Svenska':
$to_Curr = 'SEK'; 
$_SESSION["current_lang"] = 'sv';
break;
case 'English':
$to_Curr = 'GBP'; 
$_SESSION["current_lang"] = 'en';
break;

default:
$to_Curr = 'NOK';
$_SESSION["current_lang"] = '';
break;
}
//echo $to_Curr;
$_SESSION["price"] = $to_Curr;
//print_r($_SESSION);
}
sorry
Messed up there
haha
Bjorn van de Peut
@bjorno43
'''
CamperBot
@camperbot
:bulb: to format code use backticks! ``` more info
Bjorn van de Peut
@bjorno43
So what's the question?
supercalifragilisticthisbesuchacodekid
@ICodedGod
Well
Here is what it's supposed to do:
When a user on the website selects a language, the property listings on that site should be displayed in the currency attached to that.
Why doesn't it? :/
Casper Beyer
@caspervonb
  1. You aren't sending anything back
supercalifragilisticthisbesuchacodekid
@ICodedGod
Oh god.. there is more that 1
Casper Beyer
@caspervonb
From what you've pasted anyway
Bjorn van de Peut
@bjorno43
I have no idea. That code alone isn't enough to be able to answer that question. You're setting up some session variables. But you need to keep in mind that sessions can only be set before headers are sent to the browser. After that, you can change the sessions variables with an Ajax script all you want, but it won't actually update the headers
supercalifragilisticthisbesuchacodekid
@ICodedGod
@bjorno43 You make a solid point
supercalifragilisticthisbesuchacodekid
@ICodedGod
Ah! thou handsome individuals. I have the solution :smile:
Thanks for the efforts
Bjorn van de Peut
@bjorno43
@ICodedGod I would also advise you to use empty() instead of isset(). Simply because isset only verifies if a variable exists. It doesn't care if the value is empty or null. Empty will verify if a variable exists and if there's data in it
Of course you'll have to use if(!empty() (if NOT empty). Otherwise it'll return false while it should return true, ghehe
supercalifragilisticthisbesuchacodekid
@ICodedGod
Oh that's a good one
Christopher Barclay
@Clesoud
Hey all, I'm having tons of trouble with the Seek and Destroy problem under Basic Algorithm Scripting. I don't understand how to use the arguments after the initial array, when you don't know how many arguments will be there. And I'm having a lot of frustrating trouble removing specific items from an array that are not either at the very end or at the very beginning. My code is a jumbled mess that I have rewritten 4 or 5 times and I know this problem can't be this long to solve.
Kaz Baig
@kbaig
@Clesoud linking the problem and your code would help us help you :)
Christopher Barclay
@Clesoud
@kbaig Hey Kaz! Thanks for the reply. Can you remind me how to link both of those?
CamperBot
@camperbot
clesoud sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 552 | @kbaig |http://www.freecodecamp.org/kbaig
Christopher Barclay
@Clesoud
Copy/paste or was there a button combo to do it better?
Kaz Baig
@kbaig
@Clesoud the url of the problem, and copy-paste your code with three backticks (`) in the lines before and after your code
Christopher Barclay
@Clesoud
// Remove all the values

function destroyer(arr) {
  // create filter list filterMe and fill it with all elements in arr except arr[0]
  var filterMe = [];

  for (var z = 1; z<arr.length; z++) {
    filterMe.push(arr[z]);
  }


  // create a list of numbers which represent the indexes of arr elements to filter
  var filterIndex = [];

  // for loop through arr[0]
  for (var y = 0; y<arr[0].length; y++) {
    // for loop through filterMe 
    for (var x = 0; x<filterMe.length; x++) {
      // if arr[0][y] === filterMe[x]
      if (arr[0][y]===filterMe[x]) {
        // push the index 'x' to filterIndex
        filterIndex.push(x);   // will contain list of all indexes to splice.
      }
    }
  }


  // new array to hold elements not cut from old arr[0]
  var newArray = [];
  // keep track of how many indexes have been cut with 'count'
  var count = 0;

  // iterate through filterIndex 
  for (var q=0; q<filterIndex.length; q++) {
    // for loop through arr[0] again to find values not to cut
    for (var r=0; r<arr[0].length; r++) {
      // if filterIndex[q]===r then skip that number
      if (filterIndex[q]===r) {  // keep track of which filterIndex we're at with 'q'
        // skip and add 1 to 'count'
        count++;
      } else {
        newArray.push(arr[0][r-count]);  // will only pick up the arr[0] elements not skipped
      }
    }
  }

  return newArray;
}


//test:
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
OK lol wow that's huge
@kbaig Kaz?
Ian
@Naiguy1
@krisb1220 I looked through all of them and nothing I try works.
Kevin Galang
@kgalang
To those familiar with react, could you please help me figure out if I am doing anything wrong in this react challenge on the beta site?
Here is the link to the challenge: https://beta.freecodecamp.org/en/challenges/react/use-arraymap-to-dynamically-render-elements
Here is my current code:
const textAreaStyles = {
  width: 235,
  margin: 5
};

class MyToDoList extends React.Component {
  constructor(props) {
    super(props);
    // change code below this line
    this.state = {
      userInput: '',
      toDoList: []
    };
    // change code above this line
    this.handleSubmit = this.handleSubmit.bind(this);
    this.handleChange = this.handleChange.bind(this);
  }
  handleSubmit() {
    const itemsArray = this.state.userInput.split(',');
    this.setState({
      toDoList: itemsArray
    });
  }
  handleChange(e) {
    this.setState({
      userInput: e.target.value
    });
  }
  render() {
    const items = this.state.toDoList.map((x) => {
      return <li> {x} </li>;
    });
    return (
      <div>
        <textarea
          onChange={this.handleChange}
          value={this.state.userInput}
          style={textAreaStyles}
          placeholder="Separate Items With Commas" /><br />
        <button onClick={this.handleSubmit}>Create List</button>
        <h1>My "To Do" List:</h1>
        <ul>
          {items}
        </ul>
      </div>
    );
  }
};

The test that I am failing says:

"When the Create List button is clicked, the MyToDoList component should dynamically return an unordered list that contains a list item element for every item of a comma-separated list entered into the textarea element. };"

Ian
@Naiguy1
Guys I have been working on this code and It won't work. could you help me. (Im a noob)
function factorialize(num) {
return num;
}
var factorialize = 1 2 3 4 5 == num;
var factorialize(5);
Kevin Galang
@kgalang
@Naiguy1 I can try to help. Are you working on a challenge? Send the link if you are
Kaz Baig
@kbaig
@kgalang he wants to return num!
Kevin Galang
@kgalang
I need more context to help you out
@kgalang Im working on a challenge
Kaz Baig
@kbaig
@Naiguy1 You have to only change code inside the function
Try using a for loop
Ian
@Naiguy1
@Naiguy1 You have to only change code inside the function
what does that mean
oh, for loop