« first day (4603 days earlier)      last day (568 days later) » 

00:38
@OlegValteriswithUkraine no problem - nice to see a new bot every once in a while. (No offense James lol)
01:12
@ParkingMaster the actual bot lives in our chat room if you are interested. Although I doubt it will be of much, given that it is basically a thin wrapper around GitHub API + mostly responds to my commands only.
 
2 hours later…
03:06
||010x010
Invalid command! Did you mean: 007, 1+1-1, pxly? Try help for a list of available commands..‍.‍.‍
@ParkingMaster 4 Logged: [ ] Took: 0ms
@OlegValteriswithUkraine Ok, that’s true. I guess your bot will only give you the top-secret answer to “2 + 2” then lol.
 
6 hours later…
09:02
I'm looking for some ideas for following scenario: I have events emitted every 30 secs (some probe values). In my Emitter.on... I'm writing those values in a db. Now I only want to write the emitted values every 10 mins and disregard any of the values before/between. I was thinking about interval or settimeout to get this accomplished but this looks a little dirty to me.
I also thought about implementing a counter but on the other hand I can't rely on the 30 second interval that those events are emitted..
Any ideas beyond settimeout / setinterval that are more native to emitter.on.. ?
09:15
nothing you can do from inside the Node.js runtime. If you don't need precision (if it is not necessary for the write to happen precisely with a 10-minute interval), setInterval and setTimeout should do just fine. Anything precise will require you to use tools that can schedule properly, the most reliable one being adding a cron job to run a process/command/worker (however you prefer to implement IPC) that runs every 10 minutes and gets the info about queued events from the main process.
09:27
@OlegValteriswithUkraine Thanx for your thoughts - how about using a global var and assigning a datetime-obj to it and check on each emitted event via Date.now() comparison if 10 mins have passed (maybe via dayjs) since the last written values (where the global var has been updated to that date-time when the val was last written)?
@iLuvLogix if you prefer - checking if a specified amount of time has passed is a valid approach too if it is not critical to maintain the exact interval.
@OlegValteriswithUkraine No - ain't that critical - it's more about db-size and hence running out of diskspace on my embedded SBC (I think i will implement a watchdog as well checking available and total diskspace periodically and send out a msg via node-mailer in case a certain treshold is reached). But thanks for the idea with cron-jobs - I might implement it via cron or node-schedule anyway..
09:52
@iLuvLogix NP! What is the database you use, btw?
10:24
@iLuvLogix your approach seems fine. If you have the event handler write last value and last time, then have a regular process run occasionally and check if enough time has passed.
You can generalise it to apply to different handlers, however I don't think I can offer you a significantly better approach
@OlegValteriswithUkraine Postgres 15 on a stripped/bare debian jessie
@OlegValteriswithUkraine I thought of maybe using some pg trigger funcs on insert as well to achieve that behavior on the db-level instead of node- unfortunately I'm not too firm on trigger funcs and internal proceedures in pg..
Should be possible to do at the dB level. However, I'm not fond of putting logic in the database. I prefer it to just hold values. Otherwise migrations start becoming a problem.
10:48
@VLAZ Valid point with seperating storage from logic!
@iLuvLogix ah, no time triggers then, unfortunately (although there is a way, IIRC)
11:35
@OlegValteriswithUkraine VLAZ's point to keep logic and storage seperate convinced me. For now I'm declaring a global date-obj which is updated on each insert, using an additional comparision-func that returns true or false. Next approach is via a cron job where a global var stores the latest probe-values and the cron interval will call the insert proceedure which uses the leatest value strored in the g-var. I'll propose both solutions to my team and let them decide which goes into prod.. ;)
@iLuvLogix yup, separating concerns certainly makes sense - just wanted to offer an additional alternative if you used a DB that supported time-based triggers :) The in-memory version for your use case looks like one y'all should go with - less overhead, and your use-case doesn't look time-sensitive (as opposed to a recent discussion I had with a user about a similar issue).
11:57
@OlegValteriswithUkraine Thanks for your suggestions - On a different note: When we have to deal with near-real-time/time-sensitive requirements we normally write micro-services in Erlang/OTP and use some interface-funcs that share the data/results instead of using pure node - works quite well and also allows hot-swapping in case of code-updates where our apps are already in prod..
12:16
Hey guys,

I'm new to JavaScript. I'm trying to move my Selenium knolage accross from Python to JavaScript but I can't get webdriver-manager working like it does in Python in Java script. The following is how I would set up my driver/browser in Python. Can anyone tell me how to do the equivelent in JavaScript please?

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
browser = webdriver.Chrome(ChromeDriverManager().install())
@JamesMcIntyre Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
To be clear, I've managed to get selenium working without Webdriver Manager, I just can't get Webdriver Manager working to update the chrome driver each time the script runs
12:53
@iLuvLogix this approach makes sense - after all, Node.js by itself is not well-suited for real time or time sensitive operations (well, kind of is, but it's still limited in that regards)
don't know much about Erlang, though (apart from the basics) - wish I had the time to branch out more
@iLuvLogix also - my pleasure! Always nice to chat with someone who knows what they are doing.
13:16
@OlegValteriswithUkraine In all honesty: Most of the time it seems to me and others that I know what I'm doing, in some cases where I'm unsure I ask others and in rare cases I'll take the 'fake it till you make it' approach, learning along the way.. ;)
These commands work but where is JavaScript finding the chrome driver here?

let browser = await new Builder().forBrowser("chrome").build();
await browser.manage().deleteAllCookies();
await browser.manage().setTimeouts({ implicit: 15000 });
return browser;
I have no question, so don’t bring up James’ XY command
@iLuvLogix heh, usually people just skip to the last part :)
@JamesMcIntyre from the PATH env variable, it's explicitly stated in the documentation: selenium.dev/selenium/docs/api/javascript/index.html
@OlegValteriswithUkraine you are great at helping people. Too bad the room doesn’t have an award for you.
13:23
I couldn't care less?
@OlegValteriswithUkraine thanks Oleg. I still don't understand how to use webdriver-manager to update the chrome driver at the start of the script like I do in Python. Is this possible in JavaScript?
This is a third-party package written specifically in Python, so I believe you can't.
although...
also this:
3
Q: How to use selenium webdriver manager with node/javascript?

João Pimentel FerreiraI want to have the latest browser engines without manually downloading them, thus I found webdriver manager. Though selenium documentation refers, regarding webdriver manager, that // There is not a recommended driver manager for JavaScript at this time I found though an NPM package named webdr...

13:42
@JamesMcIntyre Please don't post unformatted code - use the up arrow to edit your post, then hit Ctrl + K to format the code in that post. 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
1 message moved to Trash can
:56363028 yes, I found this as part of looking but so far I've only been using "require" not "import"... with this then I would run:
import {
  Options,
  setLogLevel,
  shutdown,
  start,
  update,
} from 'webdriver-manager';

and then I would run the update somhow...?
 
2 hours later…
15:15
Also when I run exactly what the documentation says:
import {
  Options,
  setLogLevel,
  shutdown,
  start,
  update,
} from 'webdriver-manager';
It gives me the error:
SyntaxError: Named export 'Options' not found.
16:06
posted on May 24, 2023 by Ben Mason

Hi everyone! We've just released Chrome Beta 114 (114.0.5735.49) for iOS; it'll become available on App Store in the next few days. You can see a partial list of the changes in the Git log. If you find a new issue, please let us know by filing a bug. Harry Souders Google Chrome

 
5 hours later…
20:54
posted on May 24, 2023 by Ben Mason

Hi everyone! We've just released Chrome Beta 114 (114.0.5735.53) for Android. It's now available on Google Play. You can see a partial list of the changes in the Git log. For details on new features, check out the Chromium blog, and for details on web platform updates, check here. If you find a new issue, please let us know by filing a bug. Krishna Govind Google Chrome

 
2 hours later…
23:00
Can anyone help me understand map in javascript
I have a Array with two records
and I am trying to pull out the record with TypeId = 1
23:19
Map or Array.map? @Jefferson
@JBis most likely Array.map
Well if that's the case, you probably don't want .map. You probably want .find.
|| mdn array fnd
const answerResponse = $.grep(Questions,
                    function (p) { return p.QuestionTypeId == 1; })
        .map(function (p) { return p.ResponseText; })
I was trying to do something like this
ew jQuery, ew loose equality, slight-ew non arrowey callbacks
23:27
if I use .find can I just return the string object?
I would like not to have an array
||> const Questions = [{QuestionTypeId: 3, ResponseText: "apple"}, {QuestionTypeId: 2, ResponseText: "bottom"}, {QuestionTypeId: 1, ResponseText: "jeans"}];

const answerResponse = Questions.find(p => p.QuestionTypeId === 1).ResponseText;

console.log(answerResponse);
@JBis 'SyntaxError: Unexpected token \';\'' Logged: [ ] Took: 49ms
@JBis undefined Logged: [ '"jeans"' ] Took: 0ms
23:45
Thanks

« first day (4603 days earlier)      last day (568 days later) »