These are chat archives for FreeCodeCamp/HelpJavaScript

30th
Jan 2018
jusgoose
@gusd773
Jan 30 2018 01:21
I am on the random quote generator and am at the point where I need to call on the api for the quotes, I have it but now I am not sure what's next
help plz I have youtubed & googled so many things lol
Brad
@bradtaniguchi
Jan 30 2018 01:25
@gusd773 What exactly are you asking?
jusgoose
@gusd773
Jan 30 2018 02:16
@bradtaniguchi I have found the url for the api website I wanna use but have clue how to start except for the set up of my page
Brad
@bradtaniguchi
Jan 30 2018 02:18
You need to use jquery or fetch to make the request. Along with that, you will probably run into CORs issues, forcing you to use JSONP, rather than the normal GET request. If you don't know what Im talking about, start looking them up in order. (Thats about the order you should go about things)
@gusd773
Mark
@vinarius
Jan 30 2018 02:24
YouTube how to make an Ajax call with jquery, or an xmlhttprequest with vanilla JavaScript. Two methods of doing the same thing.
jusgoose
@gusd773
Jan 30 2018 02:45
@vinarius @bradtaniguchi thanks! will do
CamperBot
@camperbot
Jan 30 2018 02:45
gusd773 sends brownie points to @vinarius and @bradtaniguchi :sparkles: :thumbsup: :sparkles:
:cookie: 355 | @bradtaniguchi |http://www.freecodecamp.org/bradtaniguchi
:cookie: 372 | @vinarius |http://www.freecodecamp.org/vinarius
Brad
@bradtaniguchi
Jan 30 2018 02:49
@gusd773 no problem goodluck :)
Claudio Restifo
@Marmiz
Jan 30 2018 04:32

guys I was messing around with async/await, someone is willing to give me a hand?

Mainly in relation to error catching.
I am thinking of wrapping it in a try/catch scenario...
is there a better way?

Also where should I handle my "success"?
so If i have a structure like:

async  mainFunction() {
  try {
    const a = await apiCall() // this is a promise
    // should I handle success here? like doSomethingWith(a) ?
  } catch(e) {
    // do something with error
  }
  // or I should process the success outside the try/catch?
}

cheers :beer:

Nerando Johnson
@Nerajno
Jan 30 2018 04:33
I need a bit of help... I am a bit knackered an annoyed...
i am trying to append to to a new accordian ... I just need somone to point me in the right direction
snuli375
@snuli375
Jan 30 2018 04:34
Hi, I just finished the intermediate algorithms but I'm totally stumped with the advanced ones. Are there any resources that you guys recommend as a stepping stone between the two?
ESLMiguel
@ESLMiguel
Jan 30 2018 06:12

question about the following code:

var a = null;
var b = {};
var c = a || b;
console.log(c);

Why isn't it returning a boolean?

Markus Kiili
@Masd925
Jan 30 2018 06:15
@ESLMiguel If you use OR or AND operator on some other values than just Boolean's, it returns the value that stopped the evaluation.
Here a is evaluated, but falsy, so b returned because it is evaluated and stops the evaluation.
If a was truthy, it would be returned because it determines the result and thus stops the evaluation.
ESLMiguel
@ESLMiguel
Jan 30 2018 06:22
Got it
Thanks @Masd925
CamperBot
@camperbot
Jan 30 2018 06:22
eslmiguel sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4677 | @masd925 |http://www.freecodecamp.org/masd925
Conor Murphy
@cmurphy580
Jan 30 2018 07:35
I'm trying to deploy a react site to heroku. After messing around with my package.json and webpack.config I now have this error in the console:
Uncaught Error: Cannot find module "./components/App"
at bundle.js:36
at Object.<anonymous> (bundle.js:36)
at t (bundle.js:1)
at Object.<anonymous> (bundle.js:1)
at t (bundle.js:1)
at bundle.js:1
at bundle.js:1
any ideas on this?
hold on stackoverflow has my back on this. Thank you though
Razvan Jackson
@RazvanJackson
Jan 30 2018 08:45
why it's not saving the changes?
```
let str = 'the_stealth_warrior';
let arr = str.split(/[-_]/g);

arr.map(el=>{
  return el.charAt(0).toUpperCase();
})

console.log( arr);
Claudio Restifo
@Marmiz
Jan 30 2018 08:56
@cmurphy580 could be that you have to set the path as ENV variable?
@RazvanJackson map return a totally new array without changing the original, so you need to keep track of the new one as well (or return that). For example:
let str = 'the_stealth_warrior';
let arr = str.split(/[-_]/g);

const newArr = arr.map(el=>{
  return el.charAt(0).toUpperCase();
})

console.log( arr); // [ 'the', 'stealth', 'warrior' ]
console.log(newArr) // [ 'T', 'S', 'W' ]
Markus Kiili
@Masd925
Jan 30 2018 09:34
@RazvanJackson There are array mutator methods and iterator/accessor methods in JS. You need to know which are which.
Razvan Jackson
@RazvanJackson
Jan 30 2018 10:08
@Marmiz thanks
@Masd925 thanks
CamperBot
@camperbot
Jan 30 2018 10:08
razvanjackson sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4678 | @masd925 |http://www.freecodecamp.org/masd925
Kelechi Chinaka
@ke1echi
Jan 30 2018 11:24
high guys i tried to run my c code on python tutor but i dont know whats wrong with it..pls help
#include <stdio.h>
#include <cs50.h>

int main (void)
{
    int row, col, space, n;

    //prompt user for valid input
    do
    {
        n = get_int("Height: ");
    }
    while (n < 0 || n > 23);

    //prints rows
    for (row = 1; row <= n; row++)
    {
        //prints space
        for (space = 1; space <= n - row; space++)
        {
            printf(" ");
        }

        //prints columns
        for (col = 0; col <= row; col++)
        {
            printf("#");
        }

        printf("\n"); //prints newline
    }

}
Kelechi Chinaka
@ke1echi
Jan 30 2018 11:32
@Masd925 any help?
Stephen James
@sjames1958gm
Jan 30 2018 11:46
@kelechy Is it giving you any errors?
@kelechy When asking what's wrong - providing expected vs. actual behaviour is essential
Simon Cordova
@gbsimon87
Jan 30 2018 13:39
Good aft :)
Got a quick question.
Anybody have an idea of best practice when it comes to implementing a loader icon to show while an image is loading, and then hiding it once the image has fully loaded?
Tiago Correia
@tiagocorreiaalmeida
Jan 30 2018 13:41
@gbsimon87 hey, vanillaJS or any other framework that you are using
<?
Simon Cordova
@gbsimon87
Jan 30 2018 13:41
Hi @tiagocorreiaalmeida
Vanilla JS preferably, no libraries/frameworks
Tiago Correia
@tiagocorreiaalmeida
Jan 30 2018 13:42
are you going to add the image to the dom or the image is allready part of the dom?
Simon Cordova
@gbsimon87
Jan 30 2018 13:43
I am adding it dynamically after dom is ready
Tiago Correia
@tiagocorreiaalmeida
Jan 30 2018 13:45
can I see the code you use to add the image to the dom?just to get an idea
Simon Cordova
@gbsimon87
Jan 30 2018 13:46
for (var i = 0, len = slideConfig.length; i < len; i++) {

      var slide = slideConfig[i]
      var iconHtml = getIconHtml(slide.icon)
      slideHTML +=
        `<div class="upYourCallSlide upYourCallForeground${i ? '' : ' upYourCallActive'}">
          <div class="upYourCallTop">
            <span class="upYourCallClose">${closeHtml}</span>
            ${iconHtml ? `<p class="upYourCallLogo">${iconHtml}</p>` : ''}
            <p class="upYourCallTitle">${slide.title}</p>
            <p class="upYourCallSubtitle">${slide.subtitle}</p>
            <img src="${slide.media}" />
          </div>
          <div class="upYourCallBottom">
            <p class="upYourCallText">${slide.text}</p>
            <div class="upYourCallDots">
              ${slide.button ? `<button class="upYourCallButton">${slide.button}</button>` : getDots(slideConfig, i)}
            </div>  
          </div>
        </div>
        `

        console.log("CONSOLE:" + i)
    }
Tiago Correia
@tiagocorreiaalmeida
Jan 30 2018 13:48
I think you can display the loader on the dom and have a class called active that yo uadd and remove, you can add the class before you make the call above and remove it once completed?
Simon Cordova
@gbsimon87
Jan 30 2018 13:48

Currently I am testing it with a 7MB image and the user can see it loading from top to bottom, I'd like perhaps a spinner that will show until the image is ready

I've done some research which states to add a background image to the image, but that is visible the whole time alongside the image loading

Tiago Correia
@tiagocorreiaalmeida
Jan 30 2018 13:48
that class will make the loader from display:none to block
Simon Cordova
@gbsimon87
Jan 30 2018 13:48
So the loader would be its on separate HTML component/tag?
Simon Cordova
@gbsimon87
Jan 30 2018 13:49
I've also tried using a ::before pseudo-element, however as I transition from one slide to the other the pseudo element shows briefly
Tiago Correia
@tiagocorreiaalmeida
Jan 30 2018 13:49
var image = document.images[0];
var downloadingImage = new Image();
downloadingImage.onload = function(){
    image.src = this.src;   
};
downloadingImage.src = "http://an.image/to/aynchrounously/download.jpg";
I almost never writted vanillaJS but founded this soltuion online might work
Simon Cordova
@gbsimon87
Jan 30 2018 13:50
@tiagocorreiaalmeida thank you, I'll take a look at that resource you found
CamperBot
@camperbot
Jan 30 2018 13:50
gbsimon87 sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 492 | @tiagocorreiaalmeida |http://www.freecodecamp.org/tiagocorreiaalmeida
Tiago Correia
@tiagocorreiaalmeida
Jan 30 2018 13:55
I will try to do a codepen with an working example and send oyu if you dotn get it working
Simon Cordova
@gbsimon87
Jan 30 2018 13:55
Youre the man!
I found this as well which I'll also give a shot.
http://blog.dynamicdrive.com/5-brilliant-ways-to-lazy-load-images-for-faster-page-loads/
I'll check back in and inform my progress :)
Kelechi Chinaka
@ke1echi
Jan 30 2018 13:58
i expected i can be able to track my code just as i do with javascript @sjames1958gm
Kelechi Chinaka
@ke1echi
Jan 30 2018 14:06
could you pls try it and see? @sjames1958gm
Simon Cordova
@gbsimon87
Jan 30 2018 14:07
@kelechy is that python or...?
Kelechi Chinaka
@ke1echi
Jan 30 2018 14:08
yea python
try it with the code and reply me pls @gbsimon87
Simon Cordova
@gbsimon87
Jan 30 2018 14:09
Nice :)
Unfortunately I won't be touching up on Python until late June so I can't be much help, if you translate it to JS I could certainly take a look at it though
Kelechi Chinaka
@ke1echi
Jan 30 2018 14:12
oh no that not what i meant :smile:
that code is in C
i cant pass the while loop when i try to visualise it on python tutor
Simon Cordova
@gbsimon87
Jan 30 2018 14:16
It says there's an error on line 4?
Kelechi Chinaka
@ke1echi
Jan 30 2018 14:16
does nt tell me so
Tiago Correia
@tiagocorreiaalmeida
Jan 30 2018 14:26
@gbsimon87 finding this thing confusing :D btw why are you loading 7mb's images? imagine someone who's using mobile data 7mb's just for the image + the page that's quite alot for a single page :D
Kelechi Chinaka
@ke1echi
Jan 30 2018 14:27
i think you could try cloudinary for the pic
Stephen James
@sjames1958gm
Jan 30 2018 14:36
@kelechy How did you get cs50.h into python tutor?
Kelechi Chinaka
@ke1echi
Jan 30 2018 14:40
its a cs50 header file, i thought i removed it..
#include <stdio.h>

int main (void)
{
    int row, col, space, n;

    //prompt user for valid input
    do
    {
        n = scanf("Height: ",&n);
    }
    while (n < 0 || n > 23);

    //prints rows
    for (row = 1; row <= n; row++)
    {
        //prints space
        for (space = 1; space <= n - row; space++)
        {
            printf(" ");
        }

        //prints columns
        for (col = 0; col <= row; col++)
        {
            printf("#");
        }

        printf("\n"); //prints newline
    }

}
@sjames1958gm i used scanf to get user input now
or do i need to call the function as we do in js
Stephen James
@sjames1958gm
Jan 30 2018 14:43
@kelechy Well does scanf even work in python tutor?
@kelechy You may need to hardcode n to test it in pythontutor
Abhi
@abhishek737
Jan 30 2018 14:48
How to merge 2 objects , if both have some common properties , I know it can be done by using Object,.assign . Is there any other method as well
Tiago Correia
@tiagocorreiaalmeida
Jan 30 2018 14:49
object spread but that's only avaible using this like babel
things*
Pieter Stokkink
@forkerino
Jan 30 2018 14:51
^ already works in Chrome natively
let a = { a: 'b' }
let b = { b : 'c' }
let c = { ...a, ...b }
c // { a: "b", b: "c"}
Stephen James
@sjames1958gm
Jan 30 2018 14:52
@forkerino :+1:
Pieter Stokkink
@forkerino
Jan 30 2018 14:52
@sjames1958gm how's it going?
Stephen James
@sjames1958gm
Jan 30 2018 14:52
@forkerino Good. Yourself?
Pieter Stokkink
@forkerino
Jan 30 2018 14:53
@sjames1958gm pretty good. Had a quiet moment at work and I drifted over here...
these moments are quite unique these days
Stephen James
@sjames1958gm
Jan 30 2018 14:54
@forkerino Personally or professionally? Working on interesting things?
Tiago Correia
@tiagocorreiaalmeida
Jan 30 2018 14:56
wild @forkerino appears, hey !
Pieter Stokkink
@forkerino
Jan 30 2018 14:56
@sjames1958gm Professionally, still at the same company, we make one app, market it to businesses in the Solar Energy sector so they can easily design systems and calculate accurate yields
lot's of hard problems to solve, which makes it tons of fun
@tiagocorreiaalmeida Hey!
just tried it in FireFox and object spread also works there
Tiago Correia
@tiagocorreiaalmeida
Jan 30 2018 14:57
probably on the latest versions :D, all good?
Pieter Stokkink
@forkerino
Jan 30 2018 14:58
Yes, you ?
Blauelf
@Blauelf
Jan 30 2018 14:58
@forkerino Spread operator applied to non-iterables? It's only stage 4 proposal so far. Node's behind on that one. Also, Apple and Microsoft browsers will take a few years to implement that.
Stephen James
@sjames1958gm
Jan 30 2018 14:59
@forkerino Sounds challenging which is good
Blauelf
@Blauelf
Jan 30 2018 15:00
"Expected Publication Year: 2018". Where do you find those features then? :D
Tiago Correia
@tiagocorreiaalmeida
Jan 30 2018 15:01
need a quick help guys, I got a component that dispatch's an order after that order runs I wanna call a component function
        this.props.editSearch({
            offset: (this.props.currentSearch.offset += 5), searching: true
        })
after this run's make a call
Blauelf
@Blauelf
Jan 30 2018 15:02
@tiagocorreiaalmeida You're sure you want that += there? It's evaluated when that object literal gets turned into an actual object.
Pieter Stokkink
@forkerino
Jan 30 2018 15:02
@Blauelf yes, applied to objects, on the app we are developing we use it all over the place, but with babel for people who use older versions of web-browsers. Anyway we are b2b in a developed market, so don't really have to think about supporting IE/Edge
Tiago Correia
@tiagocorreiaalmeida
Jan 30 2018 15:02
maybe I will need a new function that will dispatch the above and that returns a promise that I can chain then on the component?
Blauelf
@Blauelf
Jan 30 2018 15:03
@forkerino With babel, those features are fine I guess. Just means you need a build system. Which you need for stuff like Angular2 anyway.
Pieter Stokkink
@forkerino
Jan 30 2018 15:03
@Blauelf yeah, we got that in place
Kelechi Chinaka
@ke1echi
Jan 30 2018 15:05
i dont know if scanf works on it @sjames1958gm
thanks @sjames1958gm
CamperBot
@camperbot
Jan 30 2018 15:06
kelechy sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8917 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Kelechi Chinaka
@ke1echi
Jan 30 2018 15:07
scanf does nt work, hardcorded the int
Blauelf
@Blauelf
Jan 30 2018 15:07
@kelechy You meant something like printf("Height: "); if (scanf("%d", &n) == 0) n = -1;?
(not sure if it works that way, but scanf works similarly to printf, you specify an input format)
Kelechi Chinaka
@ke1echi
Jan 30 2018 15:09
nt sure that works @Blauelf
Blauelf
@Blauelf
Jan 30 2018 15:10
But for pythontutor, hardcode would work.
Kelechi Chinaka
@ke1echi
Jan 30 2018 15:11
yes hardcode worked @Blauelf
i think scanf does nt work
Blauelf
@Blauelf
Jan 30 2018 15:13
Wouldn't work on pythontutor at least. They essentially step through the code and create a movie of screenshots (sort of)
Stephen James
@sjames1958gm
Jan 30 2018 15:17
@kelechy :+1: glad hardcoding works.
Kelechi Chinaka
@ke1echi
Jan 30 2018 15:17
you guys are always helpful :clap:
Abhi
@abhishek737
Jan 30 2018 15:27
Thanks @forkerino
CamperBot
@camperbot
Jan 30 2018 15:27
abhishek737 sends brownie points to @forkerino :sparkles: :thumbsup: :sparkles:
:star2: 2978 | @forkerino |http://www.freecodecamp.org/forkerino
Blauelf
@Blauelf
Jan 30 2018 15:27
@forkerino Supporting IE/Edge is one thing. But marketing is all Safari.
Pieter Stokkink
@forkerino
Jan 30 2018 15:36

why this? I mean, I know why I got an error, but why does it say it cannot convert null to an object when typeof says it is an object?

VM282:1 Uncaught TypeError: Cannot convert undefined or null to object
    at Function.values (<anonymous>)
    at <anonymous>:1:8
(anonymous) @ VM282:1
typeof null
"object"

Just another JS quirk?

Blauelf
@Blauelf
Jan 30 2018 15:40
Variables have a field that contains the type, whether it's a number, string, object reference, and so on. Well, in the first implementation, type 0 was chosen for object. And null is defined by all bits zero.
It's a bug nobody wants to fix, out of fear of breaking something. Browsers have worse workarounds to not break old browser detection stuff.
In theory, null like undefined has its own type. But my favourite is typeof NaN - remember it's Not a Number :D
Pieter Stokkink
@forkerino
Jan 30 2018 15:47
@Blauelf thanks
CamperBot
@camperbot
Jan 30 2018 15:47
forkerino sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4680 | @blauelf |http://www.freecodecamp.org/blauelf
Blauelf
@Blauelf
Jan 30 2018 15:48
@forkerino My source for that of course again is Dr. Axel http://2ality.com/2013/10/typeof-null.html
Pieter Stokkink
@forkerino
Jan 30 2018 15:50
@Blauelf I've read many of his articles. Not this one.
Blauelf
@Blauelf
Jan 30 2018 15:50
Note the blog post comment by the guy who wrote the code Dr. Axel analyses :D
Pieter Stokkink
@forkerino
Jan 30 2018 15:51
yeah, just noticed that
:smile:
Blauelf
@Blauelf
Jan 30 2018 15:53
In case you're wondering why I call him Dr. Axel and not by his family name - http://dr-axel.de/ :P
Simon Cordova
@gbsimon87
Jan 30 2018 15:54

@tiagocorreiaalmeida
I was loading 7mb images just for testing really, I'd never do that in practice ( I hope ) lol

I ended up creating a recursive function checking for document.readyState === "complete". However, I didn't like this approach as I didn't want to wait for my script to fire when everything was loaded, so I'm running a for-loop and running a load function per image, this is working better indeed

@Blauelf @forkerino @tiagocorreiaalmeida

If I can bother you guys with something.
I've been playing around with React and Meteor lately, but for some reason every time I restart my Meteor application it takes like 15 seconds to load, and that is honestly slowly affecting my dev process.
Any suggestions? I've researched online but all the answers are so scattered and outdated.

Pieter Stokkink
@forkerino
Jan 30 2018 15:57
@gbsimon87 no recent experience with Meteor
Blauelf
@Blauelf
Jan 30 2018 15:58
No idea what meteor is, but can you run that in an environment where you can apply a profiler? Are you waiting for events (like synchronously loading various external data), or really busy?
Jason Luboff
@JLuboff
Jan 30 2018 16:08
:wave: Morning (afternoon/evening) everyone
dinesh
@1532j0004kg
Jan 30 2018 16:09
:wave: happie evening
Simon Cordova
@gbsimon87
Jan 30 2018 16:12

Hey @JLuboff

@Blauelf Meteor is a framework that uses Node.js for web and mobile apps in pure JavaScript.

Jason Luboff
@JLuboff
Jan 30 2018 16:12
How's it going?
Blauelf
@Blauelf
Jan 30 2018 16:15
@gbsimon87 Sounds... umm... Didn't the similar Electron approach result in large apps with unexpected features? http://www.zdnet.com/article/electron-critical-vulnerability-strikes-app-developers/
Pieter Stokkink
@forkerino
Jan 30 2018 16:17
AFAIK Meteor is still for building web apps
Blauelf
@Blauelf
Jan 30 2018 16:17
And as these apps all come with their own runtime, you have to wait for all of them to be patched individually :D
Pieter Stokkink
@forkerino
Jan 30 2018 16:18
@JLuboff :wave:
Jason Luboff
@JLuboff
Jan 30 2018 16:18
@forkerino Whats up?
Blauelf
@Blauelf
Jan 30 2018 16:23
@forkerino Those Meteor mobile apps are web apps in a web view, served from localhost.
Pieter Stokkink
@forkerino
Jan 30 2018 16:23
@Blauelf might be, I've never really went deep into Meteor, although I do know some of the basics.
Blauelf
@Blauelf
Jan 30 2018 16:24
@forkerino Just read their manual on mobile.
Pieter Stokkink
@forkerino
Jan 30 2018 16:24
@JLuboff Things are good here, how's the little one doing?
Jason Luboff
@JLuboff
Jan 30 2018 16:25
@forkerino He's good. Making all sorts of noises. Stays awake more during the day, likes to play. He has quite the personality
Pieter Stokkink
@forkerino
Jan 30 2018 16:26
@JLuboff good stuff
Jason Luboff
@JLuboff
Jan 30 2018 16:28
Ya...now we're just dealing with shitty upstairs nieghbors though. Their kid just stomps around all through the day. We had to take our light fixture down becuase it would rattle so much and it was getting damaged (or at least the bulbs were..). Kept waking him up or making it hard for him to go to sleep
AbrisM
@AbrisM
Jan 30 2018 16:50
Hello All! :)
Jason Luboff
@JLuboff
Jan 30 2018 16:50
Hello
AbrisM
@AbrisM
Jan 30 2018 16:50
Is there a difference btw between Android Web-Design and Javascript/HTML or do they pretty much have the same syntax and methods?
No one is using Applets anymore for web
Pieter Stokkink
@forkerino
Jan 30 2018 16:59
Jason Luboff
@JLuboff
Jan 30 2018 17:00
@forkerino :joy: I'll have to give this a watch
Blauelf
@Blauelf
Jan 30 2018 17:02
@AbrisM What do you mean by "Android Web-Design"? And "Applets"? (Java, Flash?)
Jason Luboff
@JLuboff
Jan 30 2018 17:03
@Blauelf I'm thinking applets like the original "apps" for iphone? They were just web based apps not actual local apps?
AbrisM
@AbrisM
Jan 30 2018 17:05
@Blauelf Does Android have its own version of web-design or does it use the standard html/javascript language?
Blauelf
@Blauelf
Jan 30 2018 17:05
You say the lightsaber app for the original iPhone was a web app? Don't think so. Next to nobody had mobile internet back then (I think 3G was in enrolling?), they used to jump from WLAN to WLAN ;)
AbrisM
@AbrisM
Jan 30 2018 17:05
Also, is Applets being phased out?
Jason Luboff
@JLuboff
Jan 30 2018 17:06
@Blauelf No, the lightsaber app was an actual app haha. The original iphone used Edge (2g). There was no such thing as the app store than, I don't think app store was around until the second iteration of iOS
Blauelf
@Blauelf
Jan 30 2018 17:07
I asked you to define your terms, and you repeat the same stuff. I have no idea what you are talking about.
AbrisM
@AbrisM
Jan 30 2018 17:07
That is the terms, not sure how else to describe it
Oh well, I will try to find it another way
Blauelf
@Blauelf
Jan 30 2018 17:09
@JLuboff Yeah, lightsaber (and the electric razor which my father loved) came with the app store. Original version of iOS came almost naked, wasn't useful at all. My HTC Wallaby could do more (GPRS only, I think, but again, nobody had a data plan), but required a pen. And Steve said he wanted to ban all the pens. Now without him they got the Apple Pencil :D
Jason Luboff
@JLuboff
Jan 30 2018 17:11
Lol.. ya. Apple has really fallen flat over the last 4-5 years.. I usually updated my iPhone every 2 years..and didn't for the first time this year. Just no real innovation. Sad. Oh and what about the beer chugging app? That one was a popular party app :joy:
Blauelf
@Blauelf
Jan 30 2018 17:15
@AbrisM Do you mean that native apps (written in mostly ObjectiveC/Swift for iOS or Java/Kotlin/whatever compiles to JVM code for Android) are partially replaced by HTML-based apps, that basically use a web view (a component rendering HTML and executing JavaScript like a browser) for the complete interface? Sadly, that's happening. Development is easier (unless you depend on specific APIs), but results no longer match the platform design. Not that this matters to anybody but Apple.
AbrisM
@AbrisM
Jan 30 2018 17:16
@Blauelf Sure
Blauelf
@Blauelf
Jan 30 2018 17:23
There are many changes that target the user not having to install an app first. But I don't think native apps will go away completely, unless web apps get access to many additional features. Even then, they will want to have native code (native to the platform, whatever that is) for speed improvements.
Simon Cordova
@gbsimon87
Jan 30 2018 17:25

@gbsimon87 Sounds... umm... Didn't the similar Electron approach result in large apps with unexpected features? http://www.zdnet.com/article/electron-critical-vulnerability-strikes-app-developers/

I'll take a look at that article, thanks.
I' know a number of developers in my company using Meteor, and some great web apps have been built with it.
But if it's 20 seconds each time to refresh and check my state changes, I think I may just resort to something else.

CamperBot
@camperbot
Jan 30 2018 17:25
sorry gbsimon87, you can't send brownie points to yourself! :sparkles: :sparkles:
Simon Cordova
@gbsimon87
Jan 30 2018 17:25
@Blauelf
Blauelf
@Blauelf
Jan 30 2018 17:26
@gbsimon87 In case of Meteor, not sure how that one works. But Electron inherits all the NodeJS bugs plus creates its own.
Simon Cordova
@gbsimon87
Jan 30 2018 17:27
@Blauelf
You don't sound like an Electron fan lol
Blauelf
@Blauelf
Jan 30 2018 17:27
NodeJS is a JavaScript interpreter with access to your file system. What could probably go wrong?
Simon Cordova
@gbsimon87
Jan 30 2018 17:28
@Blauelf
While we are on the topic, are you against backend interpreters that use JS?
I'm asking for knowledge I don't have a personal opinion
Blauelf
@Blauelf
Jan 30 2018 17:30
Not sure about that. I would definitely prefer TypeScript or something else with static typing. I'm a bit indecisive about JavaScript in general.
Simon Cordova
@gbsimon87
Jan 30 2018 17:32

Hmm, I will look into that indeed. @Blauelf thank you

I'll speak to you guys soon when I get home, cheers :)

CamperBot
@camperbot
Jan 30 2018 17:32
gbsimon87 sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4681 | @blauelf |http://www.freecodecamp.org/blauelf
sabahatullah
@sabahatullah
Jan 30 2018 18:22
@gbsimon87 you need to render your functions properly
Rahsheen Porter
@rahsheen
Jan 30 2018 20:42
Oh, y'all bash JS in here too? Cool.
Christian Ruben Miranda Zambrano
@kruben84ec
Jan 30 2018 20:52
Hello, guys, please your help, how do I validate double quotes to avoid sql injection crashes?
alpox
@alpox
Jan 30 2018 21:01
@kruben84ec you avoid sql injection through using the sql drivers option to send the parameters and the sql separated, not by validating input before you put an sql string together.
Christian Ruben Miranda Zambrano
@kruben84ec
Jan 30 2018 21:27
@alpox , Thanks
CamperBot
@camperbot
Jan 30 2018 21:27
kruben84ec sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1531 | @alpox |http://www.freecodecamp.org/alpox
Conor Murphy
@cmurphy580
Jan 30 2018 21:28
@Marmiz yes how would i tell
Hi! I'm trying to deploy a react site to heroku and i come up with error that it can not locate my main component. I believe I may have set my path to ENV variable? How can i resolve this issue?
Jason Luboff
@JLuboff
Jan 30 2018 21:35
@cmurphy580 Did you set the path in Heroku env variables?
Conor Murphy
@cmurphy580
Jan 30 2018 21:39
@JLuboff i'm not really sure. I don't think so, but here is my server.js file:
const express = require('express');
const path = require('path');
const port = process.env.PORT || 8080;
const app = express();

app.use(express.static(__dirname));

app.get('*', (req, res) => {
  res.sendFile(path.resolve(__dirname, 'index.html'));
});

app.listen(port);
//console.log('Server Started');
Jason Luboff
@JLuboff
Jan 30 2018 21:42
hmm..I don't see anything there that would need to be setup via ENV except the PORT which is set for yo
u
Conor Murphy
@cmurphy580
Jan 30 2018 21:44

@JLuboff I looked over everything. i don't if its my package.json setup:

{
  "name": "redux-simple-starter",
  "version": "1.0.0",
  "description": "Simple starter package for Redux with React and Babel support",
  "main": "index.js",
  "repository": "git@github.com:StephenGrider/ReduxSimpleStarter.git",
  "scripts": {
    "start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js",
    "test": "mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive ./test",
    "test:watch": "npm run test -- --watch"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {},
  "dependencies": {
    "@fortawesome/fontawesome": "^1.1.3",
    "@fortawesome/fontawesome-free-brands": "^5.0.6",
    "@fortawesome/fontawesome-free-solid": "^5.0.6",
    "@fortawesome/react-fontawesome": "0.0.17",
    "ajax": "0.0.4",
    "ajax-request": "^1.2.3",
    "axios": "^0.17.0",
    "babel-core": "^6.2.1",
    "babel-loader": "^6.2.0",
    "babel-preset-es2015": "^6.1.18",
    "babel-preset-react": "^6.1.18",
    "babel-preset-stage-1": "^6.1.18",
    "chai": "^3.5.0",
    "chai-jquery": "^2.0.0",
    "jquery": "^3.3.1",
    "jsdom": "^8.1.0",
    "jsonp": "^0.2.1",
    "lodash": "^3.10.1",
    "mocha": "^2.4.5",
    "oauth": "^0.9.15",
    "react": "^0.14.9",
    "react-addons-test-utils": "^0.14.7",
    "react-dom": "^0.14.3",
    "react-redux": "4.3.0",
    "react-router": "^2.0.1",
    "react-router-dom": "^4.0.0",
    "redux": "^3.7.2",
    "redux-form": "^6.6.3",
    "redux-promise": "^0.5.3",
    "webpack": "^1.15.0",
    "webpack-dev-middleware": "^1.6.1",
    "webpack-dev-server": "^1.16.5"
  }
}

or my index.js

import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import ReduxPromise from 'redux-promise';
import { BrowserRouter, Route, Switch } from 'react-router-dom';

import App from './components/App';
import ImageModal from './containers/ImageModal';
import MissionModal from './components/MissionModal';
import reducers from './reducers';

const createStoreWithMiddleware = applyMiddleware(ReduxPromise)(createStore);

export const store = createStoreWithMiddleware(reducers);

ReactDOM.render(
  <Provider store={store}>
    <BrowserRouter>
      <div>
        <Switch>
          <Route path="/mission/:identifier" component={MissionModal} />
          <Route path="/image/:id" component={ImageModal} />
          <Route path="/" component={App} />
        </Switch>
      </div>
    </BrowserRouter>
  </Provider>
  , document.querySelector('.container'));

all of it worked a few days ago, but now it won't work. No reason why?

Jason Luboff
@JLuboff
Jan 30 2018 21:47
Ya not sure, I'm not familar with react only node. Will need someone more knowledgable to step in'
Conor Murphy
@cmurphy580
Jan 30 2018 21:49
@JLuboff alright thanks
CamperBot
@camperbot
Jan 30 2018 21:49
cmurphy580 sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2315 | @jluboff |http://www.freecodecamp.org/jluboff
Christopher McCormack
@cmccormack
Jan 30 2018 22:30
@cmurphy580 did you resolve this?
Jason Luboff
@JLuboff
Jan 30 2018 22:57
@cmccormack :wave:
Christopher McCormack
@cmccormack
Jan 30 2018 22:57
@JLuboff whatup man
Jason Luboff
@JLuboff
Jan 30 2018 23:04
@cmccormack Just staying busy..you?
Christopher McCormack
@cmccormack
Jan 30 2018 23:05
Same, lots of stuff going on at work, plus working on two different websites right now.
Jason Luboff
@JLuboff
Jan 30 2018 23:07
@cmccormack Two different websites for work or outside work?
Christopher McCormack
@cmccormack
Jan 30 2018 23:07
outside, working on a wedding site for our reception :) kind of fun to go back and make something simple with hardly any js
Jason Luboff
@JLuboff
Jan 30 2018 23:09
Nice!
I'm going to be upgrading my digital conference room signs here soon.. get rid of shitty PHP
Christopher McCormack
@cmccormack
Jan 30 2018 23:10
man you have your hands in everything there!
Jason Luboff
@JLuboff
Jan 30 2018 23:11
Damn right!
I built the original, but it was before I knew nodejs/mongo. So I'm using PHP to write to a JSON file...and it doesn't work very well
So going to run node/mongo locally on the raspberry pi's to handle it
Christopher McCormack
@cmccormack
Jan 30 2018 23:12
is it just for displaying information?
Stephen James
@sjames1958gm
Jan 30 2018 23:12
@JLuboff mongo on rpi? Will that work?
Christopher McCormack
@cmccormack
Jan 30 2018 23:13
I think it has to be an old version but great point @sjames1958gm
Jason Luboff
@JLuboff
Jan 30 2018 23:13
Ya, displays the day's meetings (meeting title, start/end time).
@sjames1958gm I didn't look to closely, but I saw tutorials on how to get it running
Stephen James
@sjames1958gm
Jan 30 2018 23:13
@JLuboff Cool!
Jason Luboff
@JLuboff
Jan 30 2018 23:13
@sjames1958gm You helped me with the JS on it originally ;)
Stephen James
@sjames1958gm
Jan 30 2018 23:14
@JLuboff Oh, cooler :)
Jason Luboff
@JLuboff
Jan 30 2018 23:14
:D
Christopher McCormack
@cmccormack
Jan 30 2018 23:15
I'm running 2.4.10 on my rpi if that helps @JLuboff
Jason Luboff
@JLuboff
Jan 30 2018 23:17
@cmccormack Looks like some have gotten v3 running on them.. might be a challenge but looks possible
Christopher McCormack
@cmccormack
Jan 30 2018 23:17
I thought it was an architecture thing, maybe 32-bit vs 64 but I don't remember
Jason Luboff
@JLuboff
Jan 30 2018 23:17
You're correct, I most likely can't run raspian
Christopher McCormack
@cmccormack
Jan 30 2018 23:18
What would you run instead?
Jason Luboff
@JLuboff
Jan 30 2018 23:20
Apparently Fedora and Gentoo both have 64 bit versions for Pi
Christopher McCormack
@cmccormack
Jan 30 2018 23:20
If RPI can run 64-bit I wonder why raspbian isn't...
Jason Luboff
@JLuboff
Jan 30 2018 23:22
I haven't looked beyond that post above but I wonder how well Fedora/Gentoo run on Pi
Brad
@bradtaniguchi
Jan 30 2018 23:25
I think my rpiv3 runs 64 bit for arch, runs well enough
Christopher McCormack
@cmccormack
Jan 30 2018 23:27
@bradtaniguchi special version for the pi?
Brad
@bradtaniguchi
Jan 30 2018 23:35
Yea I think so, let me check real quick
Jason Luboff
@JLuboff
Jan 30 2018 23:35
Man... SQL queries can be so damn complicated..
Mr. Frosty
@BinaryKing
Jan 30 2018 23:35
Hey guys I am new to this room. Looking forward to learning JavaScript with all you guys :)
Christopher McCormack
@cmccormack
Jan 30 2018 23:36
@BinaryKing welcome
Brad
@bradtaniguchi
Jan 30 2018 23:36
Ah its just an ARM port for Archlinux, works fine personally. I do remmember I needed to update the kernal after I got it haha
Mr. Frosty
@BinaryKing
Jan 30 2018 23:36
@cmccormack Thanks
CamperBot
@camperbot
Jan 30 2018 23:36
binaryking sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1300 | @cmccormack |http://www.freecodecamp.org/cmccormack
Christopher McCormack
@cmccormack
Jan 30 2018 23:36
@JLuboff in my databases class in college we had to start from the ground up, relational algebra up to SQL
was rough but helped to better understand the underlying architecture
Jason Luboff
@JLuboff
Jan 30 2018 23:39
@cmccormack I started reading my SQL book and it talks about the math side of things...kind of just went in eye and out the other :P{
Conor Murphy
@cmurphy580
Jan 30 2018 23:40
@cmccormack no do you know whats going on?
Christopher McCormack
@cmccormack
Jan 30 2018 23:40
@cmurphy580 need more details on your error logs
@cmurphy580 but my first guess would be something wrong with your path - maybe log your __dirname and validate it's correct
Conor Murphy
@cmurphy580
Jan 30 2018 23:42
@cmccormack this is the error i get when i try to deploy it to heroku:
ERROR in ./src/index.js
remote: Module not found: Error: Cannot resolve 'file' or 'directory' ./components/App in /tmp/build_0614aa8fc670abced03f6110fa263ffe/src
remote: @ ./src/index.js 21:11-38
@cmccormack this is my server.js file:
const express = require('express');
const path = require('path');
const port = process.env.PORT || 8080;
const app = express();

app.use(express.static(__dirname));

app.get('*', (req, res) => {
  res.sendFile(path.resolve(__dirname, 'index.html'));
});

app.listen(port);
//console.log('Server Started');
Christopher McCormack
@cmccormack
Jan 30 2018 23:43
@cmurphy580 not sure you should be trying to use webpack dev server in prod
and you really should never have to access your node_modules directory from an npm script, it already has it in its own path variable
Did you copy your build files over or are you allowing webpack to build it properly from source?
Conor Murphy
@cmurphy580
Jan 30 2018 23:47
@cmccormack this is just how i've deployed this particular react starter kit to heroku in the past and its worked...I clone it from github and then deploy it from there
it works on the local server if that helps at all
Christopher McCormack
@cmccormack
Jan 30 2018 23:50
@cmurphy580 did you validate your index.js file is a sibling to ./components and that ./components contains App.jsx?
Conor Murphy
@cmurphy580
Jan 30 2018 23:53
@cmccormack yes components contains app.js and index.js is a sibling to component.
Christopher McCormack
@cmccormack
Jan 30 2018 23:53
@cmurphy580 not sure what you mean by it works on the local server vs what you're trying to do, but i'd highly recommend reading up on how to deploy a react app in production with webpack, it looks like you're making it unnecessarily complicated
@cmurphy580 sorry but I have to run for a bit to make dinner, play around with it and I should be back on later
Conor Murphy
@cmurphy580
Jan 30 2018 23:54
@cmccormack alright will do thank you for the help
CamperBot
@camperbot
Jan 30 2018 23:54
cmurphy580 sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1301 | @cmccormack |http://www.freecodecamp.org/cmccormack