These are chat archives for FreeCodeCamp/HelpFrontEnd

10th
Nov 2017
Alexx Martínez
@AlexxMart
Nov 10 2017 00:02

@kevinkiklee Never mind, I got it :) My code:

start.click(function clock (){
  start.attr("disabled", "true");
  moreWork.attr("disabled", "true");
  lessWork.attr("disabled", "true");
function startTimer(duration, display) {
    var time = duration, minutes, seconds;
    var setIntID = setInterval(function () {
        minutes = parseInt(time / 60, 10);
        seconds = parseInt(time % 60, 10);

        minutes = minutes < 10 ? "0" + minutes : minutes;
        seconds = seconds < 10 ? "0" + seconds : seconds;

        display.text(minutes + ":" + seconds);

        if (--time < 0) {
          time = 00;
        }

    }, 1000);
  stop.click(function(){
        start.attr("disabled", "false");
        clearInterval(setIntID);
      })
}

But thanks for checking

CamperBot
@camperbot
Nov 10 2017 00:02
alexxmart sends brownie points to @kevinkiklee :sparkles: :thumbsup: :sparkles:
:cookie: 324 | @kevinkiklee |http://www.freecodecamp.com/kevinkiklee
Moisés Man
@moigithub
Nov 10 2017 00:47

click method install a event handler.. and u should install it ONLY once (per element)
else ur element will end up with lot of event handlers (probably all doing the same thing)

function startTimer(duration, display) {
   ///....
    var setIntID = setInterval(function () {....   }, 1000);
  stop.click(function(){ ...});
}

everytime startTimer function get executed.. it install a "new" click handler on stop

git00000
@git00000
Nov 10 2017 02:10
hello world!
how are you?
Botenga
@Botenga
Nov 10 2017 05:11
Hey guys
frogo123
@frogo123
Nov 10 2017 05:51
Hi
kothmane
@kothmane
Nov 10 2017 06:08
hey
Botenga
@Botenga
Nov 10 2017 06:08
hello
kothmane
@kothmane
Nov 10 2017 06:09
what version of bootstrap should i use for the projects challenges ?
Botenga
@Botenga
Nov 10 2017 06:12
@kothmane I used bootstrap 3 when I was doing my challenges. But I really dont know because I have been away from FCC for a good while. I would recommend V3 just because V4 was released not to long ago but you should get someone elses opinion on that.
abraham anak agung
@padunk
Nov 10 2017 06:13
@kothmane use the one you familiar with. i dont know v4 so i do it in v3
Frank Bono
@frankbono
Nov 10 2017 07:23
Can someone look at my code and give me some feedback. I'm working on the Title Case a Sentence algorithm

function titleCase(str) {
  var capitalArray = [];
  capitalArray.push(str.split(' '));
  for (var i = 0; i < capitalArray.length; i++) {
    capitalArray[i].toLowerCase();
    return capitalArray[i].charAt(0).toUpperCase();

  }

}

titleCase("I'm a little tea pot");
Can anyone help me out here. I'm not able to see my mistake here
Sumit Roy
@sroy8091
Nov 10 2017 07:28
@frankbono [ [ 'I\'m', 'a', 'little', 'tea', 'pot' ] ] this is your array you are working on
var capitalArray = str.split(' '); @frankbono this is what you need only instead of var capitalArray = [];
capitalArray.push(str.split(' '));
Markus Kiili
@Masd925
Nov 10 2017 07:32
@frankbono You need to make a new titlecased word from the original using string operations and then assign it back to the array of words.
kothmane
@kothmane
Nov 10 2017 09:44
thanks @Botenga and @padunk
CamperBot
@camperbot
Nov 10 2017 09:44
kothmane sends brownie points to @botenga and @padunk :sparkles: :thumbsup: :sparkles:
:cookie: 388 | @padunk |http://www.freecodecamp.com/padunk
:cookie: 173 | @botenga |http://www.freecodecamp.com/botenga
Naaman Saif
@Naaman-Saif
Nov 10 2017 11:48
Hi I need help with JavaScript Calculator. I just don't know where to start.
I made the Calculators HTML and CSS. But don't know where to start for JS
Stephen James
@sjames1958gm
Nov 10 2017 12:03
@Forlenza Assuming you have click handlers for the calculator keys. You will need to store and manipulated the calculator state based on button press
At a minimum 3 pieces of state - current displayed number - saved operand (number already entered) and current operator (+, -, * etc.)
Probably a 4 piece of state which is the current input state. (entering a number, just entered an operator so starting a new number, etc)
heroiczero
@heroiczero
Nov 10 2017 12:25
@Forlenza These are general three simple step when you are beginning to code.
1.) How does a calculator work? What does it do? List the functionality of the calculator.
2.)Time to Design it. Try making a FlowChart: https://en.wikipedia.org/wiki/Flowchart to design the calculator. I would use keywords like "operator", "number", "evaluate", and "decimal/negative integer".
3.)Implement the Design with code.
Naaman Saif
@Naaman-Saif
Nov 10 2017 12:29
@sjames1958gm What are Click Handlers?
heroiczero
@heroiczero
Nov 10 2017 12:32
@Forlenza something like https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click but you need to get the DOM element
When you click the button, you need to get the number value.
mustimuu
@mustimuu
Nov 10 2017 12:43
guys
Does aybody know how to put a book on a website with html?
Any tutorials?
A-J Roos
@Asjas
Nov 10 2017 12:48
@mustimuu I can't understand what you mean? Can you give a better explanation of what you want to do?
Seah Eng Chye
@Seahchye
Nov 10 2017 12:55
Hi all
i still dont quite get the JSON to HTML challenge
blob
any kind soul can enlighten me as to how the code work?
heroiczero
@heroiczero
Nov 10 2017 13:01
@Seahchye JSON is a JavaScript Object Notation information that is stored in another server. It is generally used in API. You are trying to retrieve said information from that server and display it in your website.
Seah Eng Chye
@Seahchye
Nov 10 2017 13:03
@heroiczero then what are the keys in this case?
heroiczero
@heroiczero
Nov 10 2017 13:04
@Seahchye when you have an Object in Javascript, you have key:value in the object.
Markus Kiili
@Masd925
Nov 10 2017 13:05
@Seahchye In this case the response is parsed into an JS array, because forEach is used.
Nagireddy Srichakradhar Reddy
@srichakradhar
Nov 10 2017 13:06
I'm trying to make a get request with axios behind a proxy..
I've configured: npm config set https_proxy https://proxy_address:port/
npm config set https-proxy https://proxy_address:port/
npm config set http_proxy http://proxy_address:port/
npm config set http-proxy http://proxy_address:port/
But, I'm getting this error: write EPROTO 140611379001216:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:797
:warning: Dump Alert!! :warning:

`{ Error: write EPROTO 140611379001216:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:797:

at _errnoException (util.js:1024:11)
at WriteWrap.afterWrite [as oncomplete] (net.js:867:14)

code: 'EPROTO',
errno: 'EPROTO',
syscall: 'write',
config:
{ adapter: [Function: httpAdapter],
transformRequest: { '0': [Function: transformRequest] },
transformResponse: { '0': [Function: transformResponse] },
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
headers:
{ Accept: 'application/json, text/plain, /',
'User-Agent': 'axios/0.17.0',
host: 'westus.api.cognitive.microsoft.com' },
method: 'get',
url: 'https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/9e68536e-9a27-457f-8beb-0b3d4e780c1e?subscription-key=39046f21a28f4cef87e3c77cfcfdc6f0&verbose=true&timezoneOffset=5.5',
proxy: { host: '10.138.89.95', port: 3128 },
data: undefined },
request:
Writable {
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: true,
domain: null,
_events:
{ response: [Function: handleResponse],
error: [Function: handleRequestError] },
_eventsCount: 2,
_maxListeners: undefined,
_options:
{ maxRedirects: 21,
protocol: 'https:',
hostname: '10.138.89.95',
port: 3128,
path: 'https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/9e68536e-9a27-457f-8beb-0b3d4e780c1e?subscription-key=39046f21a28f4cef87e3c77cfcfdc6f0&verbose=true&timezoneOffset=5.5',
method: 'get',
headers: [Object],
agent: undefined,
auth: undefined,
host: '10.138.89.95',
pathname: 'https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/9e68536e-9a27-457f-8beb-0b3d4e780c1e',
search: '?subscription-key=39046f21a28f4cef87e3c77cfcfdc6f0&verbose=true&timezoneOffset=5.5' },
_redirectCount: 0,
_bufferedWrites: [],
_onNativeResponse: [Function],
_currentRequest:
ClientRequest {
domain: null,
_events: [Object],
_eventsCount: 5,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Object],
connection: [Object],
_header: 'GET https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/9e68536e-9a27-457f-8beb-0b3d4e780c1e?subscription-key=39046f21a28f4cef87e3c77cfcfdc6f0&verbose=true&timezoneOffset=5.5 HTTP/1.1\r\nAccept: application/json, text/plain, /\r\nUser-Agent: axios/0.17.0\r\nhost: westus.api.cognitive.microsoft.com\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Object],
socketPath: undefined,
timeout: undefined,
method: 'GET',
path: 'https://westus.api

Seah Eng Chye
@Seahchye
Nov 10 2017 13:08
@heroiczero I see, but where are the objects in this case?
A-J Roos
@Asjas
Nov 10 2017 13:09
@srichakradhar why post that here? We can't read it unformatted. Post it in a github gist or codesharing website
Seah Eng Chye
@Seahchye
Nov 10 2017 13:09
@Masd925 Sorry i am still trying to get it, but what response is happening here?
A-J Roos
@Asjas
Nov 10 2017 13:09
And then link it to gitter
heroiczero
@heroiczero
Nov 10 2017 13:09
@Seahchye it is stored in /json/cats.json.
@Seahchye FCC server probably has a directory with a folder called JSON in that folder there is a file called cats.json
Seah Eng Chye
@Seahchye
Nov 10 2017 13:10
@heroiczero OH! now i understand bette
better
Markus Kiili
@Masd925
Nov 10 2017 13:11
@Seahchye When the ajax response comes, the engine automatically parses it into an object and passes it into the callback function there as json.
Seah Eng Chye
@Seahchye
Nov 10 2017 13:11
@heroiczero thanks as always
CamperBot
@camperbot
Nov 10 2017 13:11
seahchye sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 2050 | @heroiczero |http://www.freecodecamp.com/heroiczero
Seah Eng Chye
@Seahchye
Nov 10 2017 13:11
@heroiczero thanks
Nagireddy Srichakradhar Reddy
@srichakradhar
Nov 10 2017 13:12
CamperBot
@camperbot
Nov 10 2017 13:12
srichakradhar sends brownie points to @asjas :sparkles: :thumbsup: :sparkles:
:cookie: 280 | @asjas |http://www.freecodecamp.com/asjas
Seah Eng Chye
@Seahchye
Nov 10 2017 13:12
@Masd925 I understand better now
@Masd925 thanks
CamperBot
@camperbot
Nov 10 2017 13:12
seahchye sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4569 | @masd925 |http://www.freecodecamp.com/masd925
linkin-park
@linkin-park
Nov 10 2017 13:12
there is a assignment in FCC called markdown preview , so is this graded assignment?!
heroiczero
@heroiczero
Nov 10 2017 13:14
@linkin-park Technically, no. You do not get a A or F.
linkin-park
@linkin-park
Nov 10 2017 13:16
:/
Nagireddy Srichakradhar Reddy
@srichakradhar
Nov 10 2017 13:20
Here is my network call:
var request = {
    // `url` is the server URL that will be used for the request
    url: process.env.LUIS_MODEL_URL,

    // `method` is the request method to be used when making the request
    method: 'get', // default

    proxy: {
        host: 'proxy_address',
        port: 3128
    }

}  
// Make a request with LUIS url
axios.get(process.env.LUIS_MODEL_URL, request)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log("===========********========= ERROR ===========********=========", error);
});
Seah Eng Chye
@Seahchye
Nov 10 2017 13:37
@heroiczero In this case, what does the line html += "<div class = 'cat'>" do?
Ken Haduch
@khaduch
Nov 10 2017 13:37
@linkin-park - I don't really know how the projects are evaluated. The first criteria is probably "does it work", next would be the UI, and then probably looking at the code. But I don't really know if anyone actually goes and checks them? It's a good question... do you know anything about it, @heroiczero ?
@Seahchye - that line is simply doing a string concatenation. The string that is is creating is a set of HTML elements that will eventually be stored in the DOM and displayed on the view.
linkin-park
@linkin-park
Nov 10 2017 13:40
if there is some reward would be interested :) - extra points or some crazy badge
heroiczero
@heroiczero
Nov 10 2017 13:40
@linkin-park The only thing that matters is experience. You are learning when you are creating the Markdown Previewer. :) You could post it on the CodeReview and we could look over your code if you want. We meaning the FCC community.
linkin-park
@linkin-park
Nov 10 2017 13:41
thats lot of work :/
heroiczero
@heroiczero
Nov 10 2017 13:43
Building it, it is, but showing it should not be. You just post where your source code is and website.
Ken Haduch
@khaduch
Nov 10 2017 13:44
@linkin-park - I feel that the first most important thing is the learning. Then, after that, it has to be some work that you are proud of and would like to have some prospective employer see, to show that you know what you're doing and can do good work. It's all a learning experience, always building on your knowledge. The "review" by people who look at the code here, as @heroiczero points out, in the "CodeReview" chat room is very helpful. Unfortunately, as we have been bemoaning in various places here in the chat rooms, there is very little traffic these days in the chat rooms because of a restructuring of the freeCodeCamp navigation. It used to guide people here to the chat rooms more directly.
Ashwin
@ashwins93
Nov 10 2017 13:45
@linkin-park you mean like the badges in khan academy?
linkin-park
@linkin-park
Nov 10 2017 13:45
ya @ashwins93
Ashwin
@ashwins93
Nov 10 2017 13:45
energy points and unlocking cool avatars
linkin-park
@linkin-park
Nov 10 2017 13:46
:'(
sooo coool!
Ashwin
@ashwins93
Nov 10 2017 13:46
lol you could probably do a request feature in the forums
heroiczero
@heroiczero
Nov 10 2017 13:47
@linkin-park yeah you get points in Codewars. It is nice, but Learning is the most important part
Ashwin
@ashwins93
Nov 10 2017 13:47
Actually i love the brownie points system
it feels really good
Yummay! cookies
and there is even a score board for earning brownie points
Seah Eng Chye
@Seahchye
Nov 10 2017 13:48
@khaduch and what is DOM?
linkin-park
@linkin-park
Nov 10 2017 13:48
learning is never ending @heroiczero
Ashwin
@ashwins93
Nov 10 2017 13:48
IMHO that is even more cool
heroiczero
@heroiczero
Nov 10 2017 13:49
@linkin-park exactly :) You can't learn enough in the world. Programming is ever changing. New development in the medical fields, and technology advances :)
Ashwin
@ashwins93
Nov 10 2017 13:49
one day i would like to end up at least as the last person in the Week's Top 100 list
Ken Haduch
@khaduch
Nov 10 2017 13:49
@Seahchye - DOM = https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction - good place to read and learn about it. Basically "Document Object Model" -the structure of the web page.
Ashwin
@ashwins93
Nov 10 2017 13:50
lol gotta work hard though brownie points are not always up for grabs
linkin-park
@linkin-park
Nov 10 2017 13:50
thanks @ashwins93
CamperBot
@camperbot
Nov 10 2017 13:50
linkin-park sends brownie points to @ashwins93 :sparkles: :thumbsup: :sparkles:
:cookie: 415 | @ashwins93 |http://www.freecodecamp.com/ashwins93
Ashwin
@ashwins93
Nov 10 2017 13:50
Yummay!!! cookies
Ken Haduch
@khaduch
Nov 10 2017 13:50
@ashwins93 - yeah, they are a lot harder to come by when there are only 20 people using the chat rooms, and 18 of them are helpers... ;)
:cookie:
Ashwin
@ashwins93
Nov 10 2017 13:51
@Seahchye In a very naive and one liner of a statement. DOM is the entire html file, gifted to you by the browsers as a javascript object that you can change
@khaduch lol we'll help each other then
i remember a year back, it was so easy to get lost in the chat
linkin-park
@linkin-park
Nov 10 2017 13:52
DOMParsers are verrrry sloooow
Ashwin
@ashwins93
Nov 10 2017 13:52
look away for a few minutes and 100s of messages will be gone
irrespective of the time of the day
every 3 messages, there would be a person with the Weather API issue
and Validate US Telephone numbers (help! regex)
lol
dunno what happened
Ken Haduch
@khaduch
Nov 10 2017 13:53
@ashwins93 - also "Record Collection", "Palindrome", and the phone numbers, to name a few.
Ashwin
@ashwins93
Nov 10 2017 13:53
yeah!
Ken Haduch
@khaduch
Nov 10 2017 13:54
they now have easily accessible "get a hint" button on each lesson, and basically the early guidance and the actual answers are there. We were speculating that that might be a reason for a reduced level of questions in the chat.
Seah Eng Chye
@Seahchye
Nov 10 2017 13:56
@khaduch @ashwins93 got it thanks
CamperBot
@camperbot
Nov 10 2017 13:56
seahchye sends brownie points to @khaduch and @ashwins93 :sparkles: :thumbsup: :sparkles:
:star2: 3490 | @khaduch |http://www.freecodecamp.com/khaduch
:cookie: 416 | @ashwins93 |http://www.freecodecamp.com/ashwins93
linkin-park
@linkin-park
Nov 10 2017 13:57
okay atleast brownie points must show in profile of FCC
Ashwin
@ashwins93
Nov 10 2017 13:59
Its already shown in your FCC profile
if gitter was done by FCC probably they would show it on your profile pic as well
mstellaluna
@mstellaluna
Nov 10 2017 14:03
@ashwins93 @linkin-park gitter is not associated with FCC. gitter now belongs to gitlabs. you do see your brownie/cookie points in your public profile above your streak map
image.png
about @linkin-park
CamperBot
@camperbot
Nov 10 2017 14:04
:cookie: 44 | @linkin-park |http://www.freecodecamp.com/linkin-park
Ashwin
@ashwins93
Nov 10 2017 14:04
@mstellaluna yeah thats why i said "IF" it was done by FCC lol
mstellaluna
@mstellaluna
Nov 10 2017 14:04
i know I'm just clarifiying that it isn't :)
linkin-park
@linkin-park
Nov 10 2017 14:12
mongo ppl created buzz word MEAN
Ashwin
@ashwins93
Nov 10 2017 14:12
and MERN
GabriRa
@GabriRa
Nov 10 2017 15:03
Hey, anyone could help me with react, redux and thunk?
I am not able to create an async action
Kevin K. Lee
@kevinkiklee
Nov 10 2017 15:15
@GabriRa hey what are you trying to solve? did you install the redux-thunk package?
Moisés Man
@moigithub
Nov 10 2017 15:15
const myAction=(data)=>{type:'AAAA', payload: data}
const myAsyncAction = (data)=>(dispatch)=>dispatch(myAction(data))
diff is async action return a function
const myAsyncAction = (data)=>(dispatch)=>{
  $.ajax( .... )
  .then(data=>{
       dispatch(myAction(data))
  });
}
Moisés Man
@moigithub
Nov 10 2017 15:20
sagas are more complicated... didnt understand
GabriRa
@GabriRa
Nov 10 2017 15:21
@kevinkiklee Yes, i installed it , but then, i got an error when I try to export and distpact my async action
store.dispatch( loadPlaceTemp() );

ReactDOM.render(<Provider store={store}>
                    <Main/>
                </Provider>, document.getElementById("container"));
This is when I call it
And this is my action
const loadPlaceTemp = () => {
    return dispatch => {
        return fetch("http://api.openweathermap.org/data/2.5/group?id=3936456,3871336,7521912,6693229&units=metric&appid=apikey")
            .then( response => response.json() )
            .then( data => {
                return dispatch({
                    type: "LOAD_TEMP_DATA",
                    tempData: data.list
                })
            })
    }
}

export default {loadPlaceTemp}
Also, the thunk middleware its applied
GabriRa
@GabriRa
Nov 10 2017 15:28
Console error: Uncaught TypeError: (0 , _actionCreator.loadPlaceTemp) is not a function
Moisés Man
@moigithub
Nov 10 2017 15:28
console.log(loadPlaceTemp)
before store.dispatch(...)
probably u didnt required /import ?
GabriRa
@GabriRa
Nov 10 2017 15:29
Yeah i did, but I would try the console.log
@moigithub You were right, the problem is in loadPalceTemp, its undefined
But I dont get why
Moisés Man
@moigithub
Nov 10 2017 15:31
exported ??
GabriRa
@GabriRa
Nov 10 2017 15:32
Yeah, its exported
One day lost only to set-up webpack, reactand redux, god
Moisés Man
@moigithub
Nov 10 2017 15:37
well u know the problem is between export n import.. so maybe the path ?
or how u importing ?
GabriRa
@GabriRa
Nov 10 2017 15:39
import {Provider} from "react-redux";
import store from "./redux/store.js"

import { loadPlaceTemp } from "./redux/actionCreator";
I am looking that now, bu tI dont get the problem
those are some of the imports where I call for dispatch
And then I use export default on the other file, the routes are okey
Moisés Man
@moigithub
Nov 10 2017 15:41
hmm. if u remove the {} from import.. then it should be an object (since u exporting an object on ur code above)
so console.log() should not say undefined
GabriRa
@GabriRa
Nov 10 2017 15:43
@moigithub Thats what I was trying right now
I did what you say and it didnt work, then I quit the {} from the export too and its working now
@moigithub Thanks a lot, you gave me a lot of light here
Moisés Man
@moigithub
Nov 10 2017 15:44
:D
GabriRa
@GabriRa
Nov 10 2017 15:45
And one final question, I have to call this api like very 3 min, and update the data
how should I keep a track of the date being updated? I mean that everytime I do a new call I have to save the data, any tip
Kevin K. Lee
@kevinkiklee
Nov 10 2017 15:46
@GabriRa if you want a redux boilerplate, i created one: https://github.com/kevinkiklee/create-redux-app
i need to upgrade it though. might do that today.
GabriRa
@GabriRa
Nov 10 2017 15:46
I would use it a lot, saved
Kevin K. Lee
@kevinkiklee
Nov 10 2017 15:46
if you want it unejected, you can go back a commit and branch from there. actually that's what i'll do also. i'll create an unejected and an ejected branch.
GabriRa
@GabriRa
Nov 10 2017 15:48
That would be nice, I think i would download it everyday until I am a master on redux hah
Lee
@LeeConnelly12
Nov 10 2017 15:49
Hi everybody,
I'm trying to write a function to convert 12 hour time to 24 hour time, am struggling though
GabriRa
@GabriRa
Nov 10 2017 15:49
I can call a action inside another action right?
Kevin K. Lee
@kevinkiklee
Nov 10 2017 15:49
i have no idea why, but i like making boilerplates, lol. it saves me lots and lots of time when i start a project. this is for redux + node: https://github.com/kevinkiklee/create-reduxpress-app. i'm working on react + redux + rails boilerplate also.
@LeeConnelly12 hey. anything specific you are struggling with?
Lee
@LeeConnelly12
Nov 10 2017 15:51
@kevinkiklee I have 12 hours times like 11 PM, 8 AM etc... I want to convert those times to hours liike 11 PM is 23 and 8 AM is 8
Kevin K. Lee
@kevinkiklee
Nov 10 2017 15:51
@GabriRa yea you can, but generally it's not the best idea. it's better to keep each action separated and smallest as possible.
GabriRa
@GabriRa
Nov 10 2017 15:51
I always think in doing it, for example with react components and I think it would be a future project
Kevin K. Lee
@kevinkiklee
Nov 10 2017 15:51
@LeeConnelly12 have you started working on any code yet? or are you still trying to figure out an approach?
Lee
@LeeConnelly12
Nov 10 2017 15:53

@kevinkiklee I copied this snippet from stackover flow to convert a dd/mm/yyyy string to a date

  private toDate = (dateStr): Date => {
        const [day, month, year] = dateStr.split("/");
        const newDate = new Date(year, month - 1, day);
        return newDate;
    }

I just need to convert the times and concat it together to make a new date

GabriRa
@GabriRa
Nov 10 2017 15:53
@kevinkiklee And what approach would you take to save data, i mean
Fabien SHAN
@X140hu4
Nov 10 2017 15:54
Hi guys! I am working on the twitch tv project. I am currently looping through an array with channel names and trying to output the logos/images for each channel. However only the last one shows?
Moisés Man
@moigithub
Nov 10 2017 15:54

@GabriRa y u can dispatch many actions
one example.. is u load a list (of whatever) and shows a loading icon

const loadListAsync= ()=>(dispatch)=>{
  dispatch({type: START_LOADING});
  fetch().then(data=>{
          dispatch(myAction(data));
          dispatch({type: END_LOADING});
  })

}

GabriRa
@GabriRa
Nov 10 2017 15:54
I have to update the data, but once I update it I need to keep a record/history of every call/data i got
Kevin K. Lee
@kevinkiklee
Nov 10 2017 15:54
is that typescript? that's not vanilla js. anyway, there is a much simpler way to convert it. what's 11pm? 23. what's 23 - 12? what's 9pm? 21. what's 21 - 9?
GabriRa
@GabriRa
Nov 10 2017 15:54
@moigithub Ohhh, I think I got it now.
Isaiah Trembley
@IsaiahCT
Nov 10 2017 15:56
yoooooooooooooooooo
I just took the alexa course on code academy
I felt so dang smart
Kevin K. Lee
@kevinkiklee
Nov 10 2017 15:56
^ what moises said is right. sorry, i should've made it clearer. you can compose different actions together. what i meant is that keeping each action nuclear.
Lee
@LeeConnelly12
Nov 10 2017 15:57
@kevinkiklee ah ok ty
CamperBot
@camperbot
Nov 10 2017 15:57
leeconnelly12 sends brownie points to @kevinkiklee :sparkles: :thumbsup: :sparkles:
:cookie: 326 | @kevinkiklee |http://www.freecodecamp.com/kevinkiklee
Kevin K. Lee
@kevinkiklee
Nov 10 2017 15:58
moises, i think you should use promises there. right now, it's not async. END_LOADING will be dispatched even before fetch has completed.
A-J Roos
@Asjas
Nov 10 2017 16:00
@X140hu4 Can you post a link to your codepen so that someone can check what is happening? Hard to troubleshoot just based on what you are saying
Fabien SHAN
@X140hu4
Nov 10 2017 16:01
@Asjas Here it is: https://codepen.io/X140hu4/pen/KyaZvX thanks
CamperBot
@camperbot
Nov 10 2017 16:01
x140hu4 sends brownie points to @asjas :sparkles: :thumbsup: :sparkles:
:cookie: 281 | @asjas |http://www.freecodecamp.com/asjas
Frank Bono
@frankbono
Nov 10 2017 16:41
@sroy8091 Thank you!
CamperBot
@camperbot
Nov 10 2017 16:41
frankbono sends brownie points to @sroy8091 :sparkles: :thumbsup: :sparkles:
:cookie: 311 | @sroy8091 |http://www.freecodecamp.com/sroy8091
Frank Bono
@frankbono
Nov 10 2017 16:42
@Masd925 Thank you
CamperBot
@camperbot
Nov 10 2017 16:42
frankbono sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4570 | @masd925 |http://www.freecodecamp.com/masd925
quickspeedy
@quickspeedy
Nov 10 2017 17:32
Hello, I am having issue with geolocation, whenever I clicked block for geolocation, it should redirect to else statement but nothing happens. Line 486 if(navigator.geolocation) { is when a user allow geolocation. Line 502 } else { is when a user decided to block geolocation. Codepen: https://codepen.io/quickspeedy/pen/EbgzWy
A-J Roos
@Asjas
Nov 10 2017 17:42
@quickspeedy You check the answer given in this stackoverflow and try and impliment it. You need to test for the PERMISSION_DENIED error
You can check this interactive w3schools editor and decline the request. You will then get the error message. So you can incorporate the same type of switch statement as they are doing
A-J Roos
@Asjas
Nov 10 2017 17:48
The if / else statement you created tests is geolocation available on the device or not. It does not execute if someone denies permission since geolocation is available but the user declined
quickspeedy
@quickspeedy
Nov 10 2017 17:50
@Asjas Thank you, I was able to get it to work! It makes sense with what you said.
CamperBot
@camperbot
Nov 10 2017 17:50
quickspeedy sends brownie points to @asjas :sparkles: :thumbsup: :sparkles:
:cookie: 282 | @asjas |http://www.freecodecamp.com/asjas
primuscovenant
@primuscovenant
Nov 10 2017 18:35
@heroiczero thx
CamperBot
@camperbot
Nov 10 2017 18:35
primuscovenant sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 2051 | @heroiczero |http://www.freecodecamp.com/heroiczero
Eric Hasegawa
@EricHasegawa
Nov 10 2017 18:36
Can anyone tell me why when I add the bottom <p> element to this page it messes up the Facebook, LinkedIn, and Google + Logos? https://codepen.io/erichasegawa/pen/xPwpPP
Kaz Baig
@kbaig
Nov 10 2017 19:03
@EricHasegawa what do you mean by mess up? Removing p tag (the wikipedia search app description) isn't changing anything for me
Kaz Baig
@kbaig
Nov 10 2017 19:12
Anyone know of any general purpose web APIs? Like a provider that tries to do a little bit of everything
A-J Roos
@Asjas
Nov 10 2017 19:25
@EricHasegawa I just removed all <p> tags and it makes no difference.

if you remove this

.socialMedias a {
  margin-right:15%;
}

rule, it doesn't space out.

It's css causing the spacing, not the <p> tags
Lee
@LeeConnelly12
Nov 10 2017 19:27
Is there anything bad about using a table element to format a form?
Tom
@moT01
Nov 10 2017 19:32
@LeeConnelly12 i would say, no - but there's probly better ways to go
A-J Roos
@Asjas
Nov 10 2017 19:33
@LeeConnelly12 It's not really used anymore. Before flexbox and grid it was probably used a lot more. It's not really recommended
Tom
@moT01
Nov 10 2017 19:33
learn flexbox - it solves all your formatting needs
A-J Roos
@Asjas
Nov 10 2017 19:37
@LeeConnelly12 another great resource after csstricks ^ is to go do the wesbox what the flexbox course. It's free and goes into a lot of detail. The guy who teaches it is really great
Lee
@LeeConnelly12
Nov 10 2017 19:50
@moT01 @Asjas ok ty guys
CamperBot
@camperbot
Nov 10 2017 19:50
leeconnelly12 sends brownie points to @mot01 and @asjas :sparkles: :thumbsup: :sparkles:
:cookie: 283 | @asjas |http://www.freecodecamp.com/asjas
:cookie: 900 | @mot01 |http://www.freecodecamp.com/mot01
Stephen James
@sjames1958gm
Nov 10 2017 19:50
@LeeConnelly12 Here is a very interactive course - currently free - I went through it - seemed silly but I did learn
https://geddski.teachable.com/p/flexbox-zombies
A-J Roos
@Asjas
Nov 10 2017 19:53
@sjames1958gm That looks cool. :fire:
Kaz Baig
@kbaig
Nov 10 2017 20:32
@LeeConnelly12 imo tables should only be used for actual tables for semantic reasons
PrincessTabitha
@PrincessTabitha
Nov 10 2017 22:14
Can someone please review and comment on my Build Tribute project: https://codepen.io/princesstabitha/pen/LOWLOO
Tom
@moT01
Nov 10 2017 22:18
@PrincessTabitha is that a tribute to yourself?
Cameron Pick
@Fullmight
Nov 10 2017 22:20
@PrincessTabitha It looks like you have a few small consistent problems. You're closing all your html tags with <tag/> , but you need to write, </tag>
On line 8 you also accidentally wrote your text inside the closing tag, so the text is being hidden. If you fix those issues you'll see your page change around quite a bit.
Have you gone through the HTML/CSS tutorials on FreeCodeCamp very far? You'll pick up a lot of useful things along the way if you do them. You could probably spruce this up quite a bit as well with just a little CSS styling, like possibly using an image border.
Aside from that, you might want to consider changing the colors to be slightly off pure black and pure white even if you stick with plain white background and black text as it makes it look less harsh.
Seah Eng Chye
@Seahchye
Nov 10 2017 22:28
@khaduch so in these codes, the class cats are inserted into the html?
blob
Ken Haduch
@khaduch
Nov 10 2017 23:17
@Seahchye - yes. You can think of this particular method of generating the HTML code as if you were typing into an editor. You are generating a string that describes the HTML elements that you want to create in your web page. There was some other actions later in the code that actually inserts the HTML that you generate (via the text format) into the DOM as the elements that they represent. So you will have a <div class='cat'> Then some text that is going to be bolded by the <strong> and </strong> tags. There will be multiple such strings, if there are multiple keys in the object, and then finally a closing </div><br> to complete that div and its contents.
Ken Haduch
@khaduch
Nov 10 2017 23:36
@Seahchye - the command (a jQuery method) $(".message").html(html) will locate the element that has a class of message, and the .html() method (you can see the documentation here - look for the particular section on .html( htmlString ) to see this particular application of that method ) will create the elements within the element that is tagged with that class .message.