« first day (3420 days earlier)      last day (1511 days later) » 
00:00 - 17:0017:00 - 00:00

12:00 AM
sitemaps have urls
 
not pretty, but it does the job just as it always has
 
they don't have content
 
@KevinB Not my idea of "clean"
 
@KevinB prefer spread
 
ofc
but if my options are use spread and transpile it back to support ie11
i'll just use apply
 
user12960916
12:01 AM
Sorry I'm confused, are you guys talking about my question or something else
 
I just wish babel could give me a list of required polyfills for browser xyz.
 
something else
 
isn't the entire point of babel to avoid pollyfills
it just transpiles to support the targets you specifiy
 
eh, with babel (at least more recent versions) you have to tell it what you want polyfilled
 
Nah they're tangential, it transpiles code that cannot be polyfilled and expects other parts to be polyfilled.
 
12:02 AM
@csscoder what's your question?
 
it doesn't just auto fix everything for you
@Unbreachable they're trying to filter an array of objects based on a value retrieved from a text input
 
Like it transpiles for...of to a for...in (with hasOwnProperty check).. But it won't add functions that are new in es-next.
 
do you often switch between branches on a specific project depending on what feature you are working on?
 
obv.
 
@csscoder did you read the mdn page on filter?
 
12:04 AM
he did
 
user12960916
yes
 
> I've been reading about the filter() method in Javascript
could have been w3schools for all i know
 
well, i linked him to MDN page for array filter an hour or so ago
 
oh
@csscoder what param (name on mdn and type) does it accept?
 
anyway. 🏠
o/
 
12:06 AM
Hint: Check under the section labeled "Parameters"
cya kevin o/
 
user12960916
@Unbreachable I'm trying to have a textbox on my page where the user searches for things like a search box. As they type things I want the objects information to show up
 
user12960916
@JBis string, I'm not sure what mdn means
 
|| mdn filter
 
MDN is the website with the page you should read
 
user12960916
12:10 AM
Are you talking about the filter method? It returns a new array nothing happens to the old array as the site said
 
ok, but what param does it accept
 
user12960916
callback
 
awesome and what type is a callback? string? boolean? function?
 
user12960916
boolean because it returns true and false
 
A callback is a function.
So filter accepts a function as a param.
Lets take a look at your code
   var str = document.getElementById("input").value;
   var text = people.filter(str);
what type is str?
 
user12960916
12:13 AM
If the function is returning true and false isnt that what boolean is?
 
if you aren't sure put console.log(typeof str) in your code and see what it logs
 
user12960916
I think its a string since textboxes accept strings similar to C#
 
@csscoder callback is returning true or false but the callback itself is a function (only functions return things)
@csscoder Yes!
So whats the issue with people.filter(str)?
 
user12960916
It's supposed to be str.Text?
 
str is type string
filter accepts a callback which is type function
whats the issue?
 
user12960916
12:19 AM
Callback itself is a function and only functions return things, I'm not returning anything
 
close
you are passing a string (str) to a function (filter) that only accepts functions as parameters
 
user12960916
        function searchText(str){
            var str=document.getElementById("input").value;
        var text = people.filter();
        }
 
user12960916
so the str goes there?
 
ok making progress
next we need to construct a callback function for filter
this callback, as you said, needs to return a boolean, either true or false
this function will take an item of the people array as a param
try doing that based off of the examples in the mdn doc
post here what you construct
 
@csscoder Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
 
user12960916
12:34 AM
sorry keep forgetting!
 
1 message moved to Trash can
 
user12960916
function searchText(str){
            var str=document.getElementById("input").value;
        var text = people.filter();
        }

        function callbackFunction(people) {
            let newArray = people.filter(text);
        }
 
ok making progress
heres an example adapted from mdn docs
function isBigEnough(value) {
  return value >= 10
}

var array = [12, 5, 8, 130, 44];
var filtered = array.filter(isBigEnough)
@csscoder do you see how its being used?
 
user12960916
12:57 AM
yes
 
@csscoder Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
user12960916
function searchText(str){
            var str=document.getElementById("input").value;
        var text = people.filter();
        }

        function callbackFunction(people) {
            var filterd = array.filter(callbackFunction)
        }
 
1 message moved to Trash can
@csscoder Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
 
 function callbackFunction(people) {
            var filterd = array.filter(callbackFunction)
        }
You're calling the function within itself?
Look at the example jbis posted again.
 
user12960916
1:18 AM
Isn't that what they did in the example? The functions name was isBigEnough and then wrote array.filter(isBigEnough)
 
1:39 AM
That's correct, but it was outside of scope.
outside the function.
 
user12960916
so the call back function is left blank and that statement goes outside?
 
2:17 AM
function isBigEnough(value) {
  return value >= 10   // Not in here
}

var array = [12, 5, 8, 130, 44];
var filtered = array.filter(isBigEnough) // It is being called here
 
 
4 hours later…
6:45 AM
what I have wrong, reactjs audio src not working still <audio src={require="./khabi.MP3"} autoplay controls={true}></audio>
 
 
2 hours later…
8:47 AM
require is a function
 
 
2 hours later…
10:56 AM
@BenFortune you don't say? :P
 
damn, I am having an error on sequelize that is driving me nuts
on an update query it says im inserting a duplicated key, but whenever I do a select I only have one entry with those keys (primary keys), and the query is an update, not an insert at all
 
when click on input field in android sumsung internet browser then input field move on top.
it should not move to top it still show on keypad open.
please guide, where i am missing some thing.
 if(/Android/.test(navigator.appVersion)) {
         window.addEventListener("resize", function() {
             if(document.activeElement.tagName=="INPUT" || document.activeElement.tagName=="TEXTAREA") {
                 document.activeElement.scrollIntoView(true);
                 var scrolledY = window.scrollY;
                 if(scrolledY){
                     window.scroll(0, scrolledY - 50);
                 }
             }
         })
     }
@KarelG
 
Hi all
 
@KarelG in sumsung chrome broswer it's work fine.but issue in internet sumsung broswer
 
11:32 AM
._.
> sumsung
that browser could be an old version that does not support js very well
why don't you use frameworks to have a cross-platform (mobile related) solution?
like react. Or flutter
 
@KarelG this is plain js not advance it should support.
 
@RaheelAslam Js may look simple but browsers and their js engines are some of the most sophisticated software you have on your computer. Js updates, as do browsers. If you think it is simple, you can write your webpage on a canvas like Google Map do. It works.
 
@Sheepy this is sure, react js or other js framework not create problem like this older version.?
@Sheepy let's talk about this code
if(/Android/.test(navigator.appVersion)) {
         window.addEventListener("resize", function() {
             if(document.activeElement.tagName=="INPUT" || document.activeElement.tagName=="TEXTAREA") {
                 document.activeElement.scrollIntoView(true);
                 var scrolledY = window.scrollY;
                 if(scrolledY){
                     window.scroll(0, scrolledY - 50);
                 }
             }
         })
     }
 
@RaheelAslam Hard to tell. Switching to a framework will not fix browser bugs, but they may do things differently from your code that does not trigger the same bug. Assuming it really is a browser bug and not caused by some other js code.
 
@Sheepy right,
if i use in react js then what will be for this input field problem.
 
11:47 AM
Depends on react js web or react js native.
 
@Sheepy Can you confirm my concept.

Every browser has run js code according v8 Engine.
Some v8 engine doest not run JS code. so we say broswer does not support.
Am i right ?
 
@RaheelAslam So black and white. Unfortunately no. First, there are many js engines. There is V8, but there is also JsKit, SpiderMonkey, Chakra, etc. Second, a browser may run your code but behaves differently from the others. Third, some of these are genuine bugs, but some are just legacy or undefined behaviour.
TL;DR: Most browsers do get updated to match Chrome better, since most of the world is on Chrome. But no, not all browsers are Chrome.
 
@Sheepy Thanks
 
You are welcome. Welcome to real world programming. It is difficult, I know. I am working with dll hell right now.
You are right to ask, but there are few concrete helps we can offer for such unheard of issues; ultimately you are the one who need to debug and find what can be done.
Oh I remember the name wrong. By jskit I mean JavaScriptCore. And then I used Rhino and Nashorn for a while, too. Not to mention JScript.
 
12:17 PM
@Sheepy Been there w/ dll hell. What's going on?
 
Morning
 
Morning, Taylor
 
Hey could I get your guyses opinions on my organization's collection of really simple APIs? (ignore the one at the top, the genericSettings API, I havent uploaded the compiled code or source)
or just an opinion on my org on its own
I havent gotten any Collaborators yet
:P
Nvm about the first one, I actually uplaoded the code for it
I only have about 5 APIs finished lol
 
12:46 PM
@Alex Working on a mod loader for a unity game. App has a GUI which runs on the platform's .Net framework. App also has a part that runs in the game, which come with its own .Net System dlls. Fun!
 
That's a nasty combo, Sheepy
Sorry for your troubles. I've had too many DLL hell situations
 
hey I know that most events return something, like keydown returns the keyboard inputs and such.

Does onchange return the changed value, or the element
 
e.target.value
So it returns the element, which contains the value as a prop
 
ok.
I was just curious
Id rather just keep using the original selector... less text
 
Hmm. Disabling anchor tags is tricky (can use pointer-events: none;). Bootstrap has a built-in class disabled for anchors w/ class btn
 
12:58 PM
@Alex just remove the href tag, and it renders the same as a <span>
;)
 
Yup store as data-href for when you want to toggle back
 
Pretty much
 
Got Bootstrap in proj, now considering Tailwind
 
 
1 hour later…
2:04 PM
JSFiddle isnt storing my localstorages.. it clears it every run..
back to codepen I guess
 
user12960916
hey is someone free to answer a question?
 
morning everyone!
 
user12960916
morning
 
@csscoder ask away
 
user12960916
I'm still stuck on the search bar I was working on from yesterday
 
user12960916
2:08 PM
Heres what I have so far:
 
user12960916
<script>


         var people = [

    {

        name: "Sam Smith",
        age: 22

    },

    {
        name: "Alex Smith",
        age: 12

    },
    {

        name: "Bob Smith",
        age: 16,

    }
]
         function searchText(str){
            var str=document.getElementById("input").value;
        var text = people.filter();
        }

        var filtered = array.filter(searchText)




    </script>
 
lets continue where you left off
 
jesus that syntax...
 
12 hours ago, by Unbreachable
function isBigEnough(value) {
  return value >= 10   // Not in here
}

var array = [12, 5, 8, 130, 44];
var filtered = array.filter(isBigEnough) // It is being called here
 
user12960916
sorry, did i forget to format again?
 
2:09 PM
no, you formatted properly.
 
user12960916
right, its being called outside the function
 
@csscoder you're not returning something valueable in searchText fx
return a bool
 
its fine, just so seperated...
so much whitespace..
 
@csscoder change this to fit the format above
 
user12960916
<script>

       function searchText(str){
            var str=document.getElementById("input").value;
        var text = people.filter();
           return text;
        }


           var filtered = people.filter(searchText)


    </script>
 
2:14 PM
we are only working with the code, get rid of the data for now
 
user12960916
I put my array after the function like the ex. and called outside of the function
 
ok, lets try this
var str = "The quick brown fox jumps over the lazy dog";
write code that checks if a substring is in the str
try googling "How to check if a substring exists in a string in js?"
 
user12960916
2:31 PM
<script>

       function searchText(str){
            var str=document.getElementById("input").value;
        var text = people.filter();
           return text;
        }


           var filtered = people.filter(searchText)
            var substring = "The quick brown fox jumps over the lazy dog";
        if(str.includes(subtring)){
            return true;
        }


    </script>
 
ok
lets work with this:
        var substring = "The quick brown fox jumps over the lazy dog";
        if(str.includes(subtring)){
            return true;
        }
we also need to return false if its not true:
 
@csscoder Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
 
    var string = "The quick brown fox jumps over the lazy dog";
    var substring = "fox";
    if(str.includes(subtring)){
        return true;
    } else {
        return false;
    }
does that make sense?
 
1 message moved to Trash can
 
user12960916
var substring = "The quick brown fox jumps over the lazy dog";
        if(str.includes(subtring)){
            return true;
            else {
                return false;
            }
        }
 
user12960916
2:33 PM
yes
 
ok do you understand this:
var string = "The quick brown fox jumps over the lazy dog";
var substring = "fox";
return str.includes(subtring);
its the same thing but simplified
 
user12960916
Yeah, that makes sense
 
ok so lets adapt it to your problem
 
is there a way to force jsdelivr to update?
like to update a script
I added a VERY important fix to an api about 12 minutes ago, and Im trying to remove cache and get it to update
I know it takes like hours to update...
 
user12960916
function searchText(str){
            var str=document.getElementById("input").value;
        var text = people.filter();
           return str.includes(text);
        }
 
function callbackFunction(str){
    var substring  = ""; // write some code to get the substring from the input
   return ; // but your includes code here
}
 
user12960916
function searchText(str){
            var str=document.getElementById("input").value;
        var text = people.filter();
        }

        var filtered = array.filter(searchText)

        function callbackFunction(str){
    var substring  = text; // write some code to get the substring from the input
   return str.includes(text); // but your includes code here
}
 
That moment when your cool gSettings API to store settings and options just magically starts working codepen.io/SkylerSpark/full/KKpWQqw
 
@csscoder start from scratch and just work on the callback function.
How do you get the text from the input?
 
user12960916
document.getElementById("input").value
 
2:44 PM
ok great
var substring  = text; // write some code to get the substring from the input
so thats not right
correct it
 
@TaylorS There's a lot of redundant code in there
 
@csscoder Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
@DRP Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
@TaylorS use addEventListener not el.onchange =
 
user12960916
function callbackFunction(str){
            var substring  = document.getElementById("input").value;
                return str.includes(substring);
            else{
                return false;
            }
        }
 
1 message moved to Trash can
 
2:48 PM
ok great
function callbackFunction(str){
      var substring  = document.getElementById("input").value;
      return str.includes(substring);
}
 
@csscoder where is your if ?
don't write else if you don't have an if
 
^
 
DRP
DRP
DRP
2:47 PM
Hi beloved coders, in need for a clarification (js basics! 101). I followed @KevinB methodology of breaking it to the simplest level, I even tested a demo in jsfiddle which works fine.

Definition of the problem: Why I cannot read a global variable defined during a self executing async function?
(async function(){
var accounts = await web3.eth.getAccounts();
var src_addr = accounts["0"];
console.log("window loaded:" + accounts ); // ok
console.log("single address: " + src_addr) //
})();

async function foo(){
if (typeof web3 !== 'undefined') {
console.log("it is dfined"); // ok
await console.log("foo src: " + (await src_addr)); // UNDEFINED!
}
}
 
@DRP functions have their own scope
 
@csscoder now, pass the callback function to the filter function
 
user12960916
2:49 PM
function callbackFunction(str){
            var substring  = document.getElementById("input").value;
            if(str.includes(substring)){
               return true;
            }
            else{
                return false;
            }
        }
 
DRP
Hmmm even when being var...?
 
@csscoder str.includes(substring) --> gives you true or false
why are you just repeating it?
 
@csscoder yes this works too
but remember how we simplified it earlier?
 
DRP
@KarelG I tested this on jsfiddle and I am able to access the global var from other function

var number = 8;

(function foo(){
console.log(number)
var a= "foo var"
})();

document.getElementById("btn").addEventListener("click", abc);

function abc(){
	console.log("number:" + number);
  console.log("abc foo var");
}
 
@csscoder as karel said, .includes returns a boolean (true or false) so you can just return it
 
2:50 PM
@BenFortune Like what? Im a bit confused as to the redundant code
 
from
if(str.includes(substring)){
  return true;
}
else{
  return false;
}
 
user12960916
function callbackFunction(str){
            var substring  = document.getElementById("input").value;
            return str.includes(substring);
            }

        var filtered = array.filter(callbackFunction)
 
// two possible results:
// 1. str.includes(substring) returns true
code:
if(true){
  return true;
}
else{
  return false;
}


// 2. str.includes(substring) returns false
code:
if(false){
  return true;
}
else{
  return false;
}
 
DRP
actually not...
thanks @KarelG
 
so those if/else branches are obsolete
 
2:51 PM
@csscoder Test it!
 
just return str.includes(substring) gives same behavior
 
more redundant than obsolete
 
@TaylorS You're calling getItem twice in your getSetting, your forEach can be a map, you're returning true/false in setSetting but not addSetting
 
@KarelG this explains well
@csscoder how'd your code work?
 
ok
 
user12960916
2:55 PM
I'm using Brackets to run the code and I don't anything happening.
 
@DRP var does not have a block scope if the execution context is not operating in strict mode
 
user12960916
It's just the search bar there
 
using an async function within an IIFE gives you two scopes
 
@BenFortune Does localStorage.getItem() automatically return undefined if its not existant
  getSetting(name) {
    return JSON.parse(localStorage.getItem(this.name + name));
  }
it seems to be working
so ill try it out for now
 
@DRP check tc39.es/ecma262/#sec-strict-mode-code (look for dot 5)
so you semi-entered strict mode in essence
|| afk meeting
 
2:59 PM
@KarelG bye KarelG
 
@TaylorS it returns null
 
ok
 
@csscoder array isn't defined
 
Also why use map compared to forEach
 
you need to fill the array
 
2:59 PM
but you're calling it twice, assign it to a var and check kthat
 
you can trade out the function and it does the same thing
 
@TaylorS 1 line vs 4
 
@TaylorS mdn
|| mdn map
 
> Since map builds a new array, using it when you aren't using the returned array is an anti-pattern; use forEach or for-of instead.
 
3:01 PM
what about this in the forEach
 
but he is using it
 
I know that it changes the array
      this.settings.push(e + " - " + value);
 
forEach/push just looks ugly as fuck too
 
map automatically changes each value in the array as it sifts through them
but I need to output that
 
no, it returns a new array
 
3:02 PM
ok
 
user12960916
html>

<body>
    <head>
        <script>
 var people = [

    {
        name: "Sam Smith",
        age: 22
    },

    {
        name: "Alex Smith",
        age: 12

    },
    {
        name: "Bob Smith",
        age: 16,
    }
]
     function searchText(str){
            var str=document.getElementById("input").value;
        var text = people.filter();
        }

        function callbackFunction(str){
            var substring  = document.getElementById("input").value;
            return str.includes(substring);
 
||> const original = ["1", "2","3","4"]; const newArr = original.map(str => str + "s"); console.log(original); console.log(newArr);
 
You're juggling 2 states too.
 
@JBis undefined Logged: ["1","2","3","4"], ["1s","2s","3s","4s"]
 
Your state inside localStorage and this.settings
 
user12960916
3:03 PM
I already have the array filled in, I had it commented before but now its uncommented
 
so
  reqSetting() {
    this.settings.map(e => {
      return e + " - " + JSON.parse(localStorage.getItem(this.name + e));
    });
  }
?
that what ya mean?
 
<input type="text">
you need an id there
 
I was too lazy to type em, so I just selected them by their types
 
@csscoder At this point, I'd suggest looking at the language basics.
i think you are missing some fundamentals
 
this is just a test page, so i didnt care too much about the HTML or CSS
I just wanted to see if the API actually worked the way I wanted it to
 
3:12 PM
Hello all ,
could someone please help me in this question .
Thanks
0
Q: How to create top navigation in React Native

Jonas I am working on app and I am new to React Native . Actually I want to create top navigator, I will provide an image which I want to achieve ( I don't know what we will say for it it may be top navigator or something else but please have a look to an image and I want to achieve same as mentioned ...

 
DRP
@kar
@KarelG good catch!
 
@DRP KarelG is afk: meeting
 
DRP
Thanks James I saw that
 
user12960916
@JBis For javascript?
 
yes
and html
 
3:16 PM
@JBis element.querySelector(`input[type="text"]`)`
😛
escaping failure there lol
 
user12960916
This is not my first using HTML I've done labs before where I have used it I just forgot the id
 
nice
@csscoder thats not the only issue, you have a head in your body
 
lifes a pain :>
 
3:59 PM
@BenFortune fyi other actions besides "consuming" actions within forEach is just ugly IMO
 
4:09 PM
Hi guys, this might be more of a generic computer science question but here goes.

If I have an image that is created as a perfect square image, for example lets say 500x500 pixels. If I display that image on a dozen different computer screen, it the size of the image in inches will vary across displays, depending on resolutions AND the image will stay a perfect square on each display.

Are my two assumptions correct?

1) the image will have a different absolute size on different displays
2) the image will be a perfect square, when opened normally.
 
4:38 PM
I'd say yes on both. If the user's display is distorted somehow (pincushion/keystone effect, etc.) #2 could be affected
This can help: stackoverflow.com/questions/12411101/… on keeping size the same on desktop
On desktop, if you set the size to in (also cm, mm, etc.), it'll be the closest to the actual size; not so much with px
So correction on answer: 1) use in as the size of the image rather than px and you'll get close to absolute size on desktops
 
hey @jbis what tools are you using for creating socratic answers?
 
@Unbreachable Node.js, Express for server, EJS for templating, Postgres for DB, Mailgun for emails. Eventually (assuming the project is successful): Gulp for bundles, Docker, redis, elasticsearch
and maybe if some people are really dedicated, moving away from ejs and to a front end framework (angular, react, or vue prob)
 
Interesting stack, how come you decided to proceed without a front end framework?
oh i see
But why didn't you just start with one?
 
because i little experience with them. And I didn't really like react when I tried it. Additionally, I haven't found an issue with using ejs so far.
I would love another dev to work on the front end so i can focus on the back end tho. I am definitely not the best at design.
 
You should def add one to your toolbox, I heard vue is fantastic.
 
4:50 PM
which front end do you prefer?
 
At the moment I am angular
 
how is it?
 
@MitchellvanZuylen what about the angle?
 
I enjoy it, it def might be a bit bigger than the others and a bit more difficult but once you get the hang of it, it is great.
I have been meaning to try making a project with vue, but haven't got the time yet
 
4:56 PM
Vue is lightweight and much easier, but a lot of people these days have been turning to react
@jbis why not use bootstrap?
 
react.js just have a larger community, resulting in many Q&A's and blogs about it allowing you to step in easily
and it has a nice additional flexibility towards mobile development
 
00:00 - 17:0017:00 - 00:00

« first day (3420 days earlier)      last day (1511 days later) »