« first day (2889 days earlier)      last day (2281 days later) » 

15:03
Hello!
knex.raw('select a, count(*) b as B from C group  by a').then((res) => {return res;});
I get the error: res is not defined.
Anyone has a clue on how to get res ?
check for an error?
the error is "res is not defined" and the subsequent stacktrace
Try a .catch?
@KarmaDoe this is probably not the line throwing the error
please show us the full error
Promise.resolve().then(x => x); // no error here, even if x was never assigned
make it not undefined
15:31
Unhandled rejection ReferenceError: reults is not defined at knex.select.then (/app/server.js:80:10) at tryCatcher (/app/node_modu
les/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise (/app/node_modul
es/bluebird/js/release/promise.js:569:18) at Promise._settlePromise0 (/app/node_modules/bluebird/js/release/promise.js:614:10) at Promise._settlePromises (/app/node_modules/blu
nevermind
reults
ill go kill myself brb!
@KarmaDoe You need a proper editor
Consider VSCode or WebStorm.
2
Q: Is it possible to use a for loop in <select> in html? and how?

user1438482I am trying to use a for loop in html but i dont even know if this is possible. Is it? and if yes how? I dont want to use php. only html and javascript. this is my goal: i have a file containing .txt files. i want to count the number of txt files and when i get the number i want to send it to ...

@ma
@MadaraUchiha im working inside app engine Vim
i actually like vim
15:48
wait, you think vim is an app engine?
is this a translation thing?
where text editors are app engines?
?
don't be a word lawyer
> Given an argument of "foo", write an ES6 Arrow Function called "barMe" that interpolates the "foo" argument with the string "bar" at the end of it.
the hell, why "interpolates" instead of "concatenates"? is this a definition quiz?
@KevinB `${foo}bar` is interpolation, foo + "bar" is concatenation
it's the same thing
Given that they explicitly mention ES6, I reckon they specifically want to see string template literals.
I would have phrased it differently though
user1596138
5 hours of planning yesterday. 2 hours into planning for another team today :(
16:01
@LuckyKleinschmidt You don't need that much planning to play Team Fortress dude
Just play.
user1596138
Lol TF
user1596138
Never played
> Given an argument of "foo", write an ES6 Arrow Function called "barMe" that interpolates the "foo" argument with the string "bar" at the end of it.

For example, barMe("baz") should return "barbaz"

The function should return just "baz" when foo is undefined or null.
user1596138
This InMail...
user1596138
> Josiah,

I've been looking around for a senior developer for 84.51 and I was curious as to what you've been working on at Lexmark.
16:03
@towc I would argue the initials are to short for the thing to be completely copyrightable
user1596138
Wth is Lexmark?? I have a job I didn't know about?
84.51 what?
days. :3
lmao
84 and a half days
Hard times!
16:05
@KevinB "bar" or "baz"?
Imagine it was years tho! You are born and just have this urge to find a senior developer...
The example is inconsistent with the instructions.
user1596138
@KevinB I guess it;s a company
user1596138
I'm just super confused as to why he asked me about "Lexmark"
@MadaraUchiha copied it from an SO question
-6
Q: ES 6 Arrow Function challenge

RutvikCan someone please help me complete this challenge? Given an argument of "foo", write an ES6 Arrow Function called "barMe" that interpolates the "foo" argument with the string "bar" at the end of it. For example, barMe("baz") should return "barbaz" The function should return just "baz"...

16:08
@towc change your legal name to towc is the another option that might work.
I don't think it will be an issue
their gh impersonation of me made me stop thinking that this might get legal
what might be an issue is if they keep trying to get me off stuff
Yoyo
@MadaraUchiha what I forgot to mention about that previous issue is that when the scripts have issues that the page loads indefinitely
hey guys, can you help me figure this out...
Do you know how to diagnose that? I checked the performance tab in chrome and I don't see any script running even though the browser never stops with its' loading icon
what's the difference between name and pattern?
16:13
Any SQL aces here?
user1596138
@Vap0r Scripts don't often force a "loading" state, if you mean the whole tab
user1596138
It's probably in Network
user1596138
Can I just say @towc having trouble using the domain "tow-cock" for copyright reasons cracks me up
6 other people seem to think so
I'm pretty sure it's just trolls now btw
can't find a "towcock enterprises" anywhere
user1596138
towc wouldn't be infringing on towcock anyway
user1596138
16:17
That's like saying I can't call something Goo because Google exists
user1596138
Or "face" lol
user1596138
Or "Linked"
they did go through the effort of registering towc.info
user1596138
@towc Yeah, yesterday....
user1596138
16:21
A simple email to [email protected] might have it removed
@LuckyKleinschmidt "someone is trolling me by registering my online handle as a domain" is going to get about as much action as "towc is infringing on my copyright of towcock"
hope they get bored and move on, that's about the best option I see
I have to say I'm curious who this person is
or what they think I've done to them
user1596138
@rlemon SOmeone set up a porn site using my name and is harassing me*
@LuckyKleinschmidt "your name is towc?"
user1596138
Set it up for the sole purpose of harassing me. Yesterday. Yea, that will get taken down :)
user1596138
16:26
He's got emails
it's still an online handle. he has no more right to it than they do.
if I register towc.org right now it's mine. doesn't matter what I do with it
user1596138
Idgaf about the handle neither will Google, neither would the complaint lmao
user1596138
Cool. I agree bruv
user1596138
!!woosh
16:28
!!afk Lol
3
@LuckyKleinschmidt you can make domains to harass governments and legal entities, but that's mostly fine
either way, I'm not worried about that domain. It's kind of funny
hi there! what is the way to achieve this:

my express server has a route: "/opc"

in that route an instance of an opc server starts and runs.. and express makes route.send("started");

now when the opc server recieves some data, it should inform express to show this data.. somehow with res.redirect("/?newData="+newData);
yeah and like we know, after headers are already sent you can't resend them
express can't redirect a page that it has already responded to.
how to solve this?
something else
16:40
hm
like websockets or serversent events
aha
ok websockets will be the solution
thanks
@KevinB http2?
wow http2 sounds nice, didn't know it before
@Suisse it's not always well supported yet, but I know express at least has plans to support it.
16:45
hi, i am new to TDD. i am trying it for the first time for a slider/carousel plugin i am trying to create. i am trying to add a test for the click event on the direction arrows but i am not sure how to do it using mocha. any suggestions?
also any ideas about what kind of other tests i should write?
17:02
The best kind of development is STD
Slack Tracked Development
@ShrekOverflow Do you do this regularly?
@DavidKamer oh absolutely!
I have a script issue that doesn't cause any errors or warning and it hangs the page indefinitely (without some type of timeout error)
@snow Ideally in TDD your component should be independent from the user-interaction. So you should be able to test the function independent of the user-event by mocking the user event.
But I check the network and performance tabs and no script timeline is showing as going on indefinitely.
What would be the best way to debug this?
17:09
I'll have to look into it. I've never heard of it before but it sounds interesting lol. Why do so many programming concepts have STD in the name lol
@ShrekOverflow so what kind of tests do you suggest i should write for the carousel?
break it down
what you are looking for is integration test
Hi @rlemon I tried out the CSV download today using the link element and manually trigger click.
if you want to test the full carousel 😃
I'd just mock it
forgive my ignorance, what does "I'd just mock it" mean?
17:15
@snow does your carousel support some programmatic way of triggering change
@rlemon last question related to the last. Do I need to atob a.k.a base64 encode the data before adding to the link? Because if I do that the encoded string is shown in the CSV file instead of the actual csv
for csv, no
no encoding is needed
Or maybe I'm a bit slow and you don't need to encode it because it's already decided CSV string when I need to assign to the link element
link.href = `data:text/csv;${csv contents}`
Ah ok now I feel stupid..I thought you needed to encode then it's decoded when you open the file
That's easier then
17:17
the most you wanna do is encodeURIComponent the contents
because it is still a URI
that shouldn't change the resulting data tho
When would you need to encode the data?
when there are funky chars in it.
shouldn't hurt to do in all cases tho
Ah ok makes sense
So do encodeURIComponent for fail safe
user1596138
Or just make a blob
user1596138
The data string is pretty shitty
17:19
Should this still work on IE haven't tested yet?
Ok examples of a blob, you assign the blob to the link?
No, GCloud App Engine.
It includes cloud console and inside this VM, it runs ubuntu and contains Vim text editor.
@ShrekOverflow yes, for eg, clicking on direction arrows effects changes to the data attribute on each slide on the DOM, and also changes the translate value for each slide in the style attribute also on teh DOM. the translate value is determined by some math. also i have a window resize event. Apart form events like these, there is some math involving calculation for slide width base on number of slides to be show and other carousel like stuff.
Is there anyway I can attach a console.log to a non-controlled function in JS that executes on the same page?
*typical carousel like stuff\
user1596138
Not exactly copy/pastable
user1596138
17:22
            resp.blob().then(blob => {
                if (window.navigator && window.navigator.msSaveOrOpenBlob) {
                    window.navigator.msSaveOrOpenBlob(blob, fileName);
                }
                const url = window.URL.createObjectURL(blob);
                const anchor = document.createElement('a');

                anchor.download = fileName;
                anchor.href = url;
                anchor.click();
                setTimeout(() => {
                    window.URL.revokeObjectURL(url);
@Vap0r you can change the code in the console.
user1596138
IE has a diff function to use to save a blob (included). FF doesn't like you revoking the object URL immediately (included)
open the sources tab
@rlemon ah gotcha
Thanks
@LuckyKleinschmidt what's the advantage to using a blob over url string?
user1596138
17:25
It's pretty much the same thing. But one is specific to CSV and uses simple string maniuplation, one is functional and does not care about the file type
Stepping through the code line-by-line eliminates the error
user1596138
ALso fussing with encoding said string
@LuckyKleinschmidt hmm ok makes sense..can you paste that code again? Seems to be cut off viewing on my phone
Will try that approach tomorrow
@Vap0r The debugger is usually the better option
You can set a conditional breakpoint at any line with console.log('whatever'), since console.log always returns undefined, the breakpoint wouldn't stop, but the log would be executed
This is honestly the toughest bug I've ever dealt with.
user1596138
17:31
What is wrong @Vap0r
Basically I have some ASPx JS code that is becoming broken when a separate unrelated script is loaded async
user1596138
inspect is useful for such fuckery, jus saying
user1596138
Like in the console. inspect(functionReference) will get you to where you want to set the breakpoint
The problem is the page hangs indefinitely (loading spinner continues forever for the browser tab)
And JS stops executing
But no errors, warnings, or verbose messages
Removing async fixes the problem
what is the best way to get the current date time in javascript without relying on Date()
HI everyone
17:33
20
A: Convert JavaScript variable value to csv file

Lee KowalkowskiDepends on browser support, but that's getting pretty good with new browsers: http://jsfiddle.net/3fMeL/2/ var CSV = [ '"1","val1","val2","val3","val4"', '"2","val1","val2","val3","val4"', '"3","val1","val2","val3","val4"' ].join('\n'); window.URL = window.webkitURL || window.URL;...

user1596138
@AlexanderSolonik Why
Best option I can see to do it
user1596138
Wtf lol
@snow So when you click the arrow some function must execute right? You could try triggering that event in a headless browser to teset it
because Date() can be manupulated by the user on his system
17:35
@AlexanderSolonik const currentTime = new Date(prompt("What time is it? Please enter in ISO Date String format? and please have a cookie for honesty"));
user1596138
@BrianJ That is essentially same as my paste but without IE support
joke aside, @AlexanderSolonik If its on the client you have already lost the game
Date() takes the users system date and time , which maynot be correct
@ShrekOverflow :P
@AlexanderSolonik use HTTPS :)
if date on the system is mutated, https will fail
@ShrekOverflow Only if it's mutated by a lot
17:36
@MadaraUchiha 😐 IKR ?
also they don't need to go change the system date to change this, they can just open dev-tools and mess up your code bigly.
@ShrekOverflow thanks i will try it out. hope to find you here in case i have any further doubts :P
point is if you are doing something important validate it on the server
on the server using node , what would my options be
@AlexanderSolonik Time of whom?
@AlexanderSolonik Date :)
17:37
I don't quite understand what you guys are saying. Could I force a user to a non-https connection via an XSS bug?
You can only ever get the time to the best of "someone's" knowledge
@AlexanderSolonik hit up a ntpd server
because anything else is relying on the system
That would be the most accurate way to go ^
But I somehow doubt it's what you want/need
What do you need the date for?
^ you'll also need to build an entire system for clock skew and account for delays
@rlemon stop suggesting him bad ideas
s/bad/the only reliable/
17:39
on the server, it is reliable
@AlexanderSolonik if you are using Node it'll take your servers time.
@ShrekOverflow got it .. :)
you can safely use new Date
Basically in my app when a user registers
i'll ask him for his timezone
and then on using his time zone , i need to get the current date that does't rely on Date() in javascript
17:41
EH? what?
user1596138
@AlexanderSolonik why
user1596138
I need to append a element to body without appending a element to body :P
user1596138
What's the reason? Then people will understand your question
Hypothetically speaking my app just needs to display the current time/date to the user everyday when the user opens my app ..
(thats not the whole functionality of the app though)
@AlexanderSolonik They already have a clock
user1596138
17:42
That doesn't sound hypothetical
Either in their top bar in a phone, or on their various dashboards on a PC
user1596138
@AlexanderSolonik Why can't you use Date for that
And it's aimed according to their machine
This is the value users expect to see, unless you're timing some event that happens on the server
@MadaraUchiha as i said thats not the whole functionality :D
user1596138
The needlessly difficult users are my fave
17:44
@MadaraUchiha yeah but there is a chance the user can edit the date on his system
user1596138
It's like they don't want to solve the problem
Maybe he is managing push notifications and wants to send to user during appropriate user's local time, so server needs to know user's timezone?
For example, we display stock trade times in EST/DST, because that's the interesting timezone, but the more important thing is that those events are timestamped, there's an exact moment in time that they've happened, and that moment, while it may be written in various ways do to differing timezones, is just the one, objective moment.
@AlexanderSolonik Why do you care?
@TravisWhite In that case there much better ways to do that
user1596138
1
Q: How to make my React application automatically make an entry in the database at 00:00 hours (I.E. when its a new day)?

Alexander SolonikI am using axios in my React App and i have the following code ::- axios.put(`Dates/${ todaysDate.getFullYear() }/${ this.utilMonthInAlpha(todaysDate.getMonth()) }/${ ( todaysDate.getDate() > 9 ) ? todaysDate.getDate() : '0' + todaysDate.getDate() }/.json` , { goodHabits : userStoredHabi...

user1596138
17:45
He's made a question related
You can never trust the client... period
and the only way you can be absolutely sure about the timezone is by asking GeoLocation, which ofcourse can be faked 😃 unless you visit the place to make sure.
user1596138
> Ideally for example today is the 9th and its around 7:37 PM , so as soon as the clock strikes 00:00 and its the 10th i would like my application to automatically make an entry into the database, how do i do this ?
@TravisWhite I told him as much like a while back
user1596138
Why couldn't you just know by the absense of an entry
user1596138
17:46
I see serious problems with your logic haha
@AlexanderSolonik Enter Unix Time Stamps
@ShrekOverflow LOL
and use them
@LuckyKleinschmidt That has nothing to do with the client
cc @AlexanderSolonik
Date will automatically adjust on the local system according to the unix timestamp
so in short store dates using unix timestamps
user1596138
17:47
@MadaraUchiha Yea I think I cherry picked a bad sentence. Just seer the question.. He's XYing on top of an XY I am sure haha
If you want a database entry to be added, do so on the server
user1596138
He might be 4-5 levels deep by this point since it's already nonsensical
caused way too many issues
If you want it to be put in a queue, that's still not the responsibility of the client
If you let the client set times for events that happen on the server, you're opening the door for malicious clients to seriously screw you over @AlexanderSolonik
That is definitely NOT something the client should have control over.
The answer to the question from 4 days ago already told him what we are telling him now
17:52
Travis , the question was about updating the database at 00:00 based on the users timezone. what iám asking now is if there's a more reliable way of getting the current time and date of the user without using Date()
@MadaraUchiha that is what i am trying to avoid
@AlexanderSolonik The client should not have anything to do with the date an entry is updated on the database.
The date should not be sent with the API, it's not a decision you should leave to the client.
@AlexanderSolonik unless you made the database yourself, it already has timestamping built in (I haven't tested MSSQL but... I am guessing even MSFT will have it)
🚽
@MadaraUchiha, currently i use the users date and time using javascripts Date() object and make an update in the database , i am using React and google firebase and don't have a server , i understand your point and don't intend to do the same in production.
user1596138
> don't have a server
user1596138
18:00
You don't have a website?
google firebase is a server
@LuckyKleinschmidt Firebase is a sort of server-by-configuration
user1596138
Yea I'm lost
user1596138
Exactly lol
I mean locally yes i have node , i guess the right term is i am not using any backend language
user1596138
18:01
Except for node ^?
user1596138
!!afk pizza
well, no, node isn't strictly a backend language
user1596138
It IS a backend language tho
is it backend if you're only using it to compile shit with webpack?
user1596138
When you are talking about "any" bakcend language. But I'm just towcocking-word-lawyering now
18:02
that's more... dev/frontend.
and it's still node
not using node.js as a backend language in my app
node server*
user1596138
@KevinB Yes.
@KevinB sure...
i disagree
Its becoming more of a platform now though
esp, with them adding Cognito and Auth0 like features
and moving push
@KevinB @LuckyKleinschmidt I guess you are both right, Node is a JavaScript environment that is being used as backend
@AlexanderSolonik wait what?
18:04
> npm build
That is a script
by that idea you can do node like things in shell too
it's still "using node"
@ShrekOverflow s/is being/can be/
and also not backend
18:06
yeah yeah i agree can be
@LuckyKleinschmidt No. It's the equivalent of an executable running on your machine
@AlexanderSolonik what is your stack?
@MadaraUchiha LuckyKleinschmidt is afk: pizza
It's not a backend, since it's not a server that's meant to server anything other than maybe hot-reloading for local development purposes.
Thanks guys
Happy weekend :)
React.js using create-react-app and google firebase as the backend database
18:08
firebase.database.ServerValue.TIMESTAMP
this is for testing purpose currently , once i build a demo of my app, i will migrate to a MERN stack , node.js React mongoDB
Thanks , i believe that answers my question . TY
18:21
I think I made progress on my issue. For some reason the window's load event is not being triggered when my async script is present, but only on hard refresh or initial load
Doing a regular refresh or page navigation, or changing my script to by synchronous allows the window's load event to fire.
Any ideas?
@SomeGuy ok I am going to try and attend this conference next year, but here is one I throughly enjoyed - youtube.com/watch?v=Jov4dTnjm2o
1 message moved to Trash can
@Rick Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
this fails    let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    let i=0
    while (arr[i] && i++) {
    arr[i]
    }
why?
o because i is 0
got it thax :)
18:39
you're welcome
@Rick If I see that kind of code in a code review, I might actually push to fire the person who wrote it ;)
oof
do {
  arr[i++];
} while( arr[i] );
you should probably do it like this
hi can someone help me please with parsing a variable as a object name in json in js please
@n4zg Try to ignore the context you have and we don't, and read what you wrote again. You want to parse a variable, as an object name, in json, in js. What does that even mean :)
18:48
inb4 bracket notation
sorry.. im creating a json string string in a return function for reactive native i have a variable (date) hich i want to use as the object name in the json string
let arr = [1,2,3]
let i = arr.length - 1;
while(i--) arr[i];
also, const arr = ... y'all pls
would never do that, but it's probably what you're going for @Rick
@Ikari true
I mean, using map or forEach is best
unless you are trying to make it fail if a member is null or undefined
let arr = [1,2,3]
let i = arr.length - 1;
while(i-- && arr[i[) arr[i];
if you want undefined array member to cause a loop exit
for( const item of array ) {

}
@n4zg read the object initialiser page on mdn
obj[dataString] = value;
computed property names is probably what you want. or just regular bracket notation.
18:53
thanks i will have a look now
@rl
1 message moved to Trash can
@n4zg Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
don't combine code and text
chat doesn't format that
function itemsCal(day) {
            return {
                day: [{
                    "t-08-00": {
                        "time": "08-00",
                        "name": "gim"
                    }, ...
i want to use the day from the argument in the return
that's a computed property name
function itemsCal(day) {
            return {
                day: [{
                    [day]: {
                        "time": "08-00",
                        "name": "gim"
                    }, ...
see [day], that gets evaluated before the property is set
so if day is 123, the property key is 123

« first day (2889 days earlier)      last day (2281 days later) »