« first day (4652 days earlier)      last day (520 days later) » 

00:43
Over the past few days I feel like I can create anything and I want to create everything... is this what it feels like to be a true programmer? 😂
This is kind of a stupid question though, I've only been programming for 3 years lol.
@ParkingMaster without using the toString method (or it's friends), build me a function that outputs it's own source code
01:29
I will give you a hopeful result tomorrow at 12:03:14PM (est)
 
6 hours later…
07:09
Hi i'm new to here
@RiyasAhamed 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.
 
1 hour later…
08:33
Anyone with experience on S3 bucket using node.js(express.js), please?
I've been struggling for the past 24 hours and could not find a useful answer anywhere :(

So far I managed to create a bucket directly from the AWS UI and configured the settings. However, In many instances, I will need to create a bucket in code and be able to access whatever file is uploaded.

For now, am uploading as follows:

https://gist.github.com/Sidney-Dev/84af0948bf5bc4bd0c47174812645a6a

How do I create an S3 bucket if one does not exist,, upload files to it, and access the file for public access?
09:05
creating a bucket should be a rare scenario though
you would typically create 1 bucket per project that you have
not on-demand
uploading files from your code would be the same as your current solution
however, depending on what your use case is, there might be an easier solution than to write one yourself
for example, if you have a new website, and you need its build output to be hosted on S3 with public http access, you are probably leaning towards infrastructure as code
in which case, I would recommend the serverless framework
so the question is: what is your use case?
09:20
For my case, I am storing profile images, and files pertaining to an organization mostly.
So I was thinking that I would have a bucket per user and a bucket per organization.
I would have a single bucket, two "folders" one for organizations and one for users, then one "folder" per organization and one per user as sub folders respectively
so
my-awesome-app/
    organizations/
        google/
            profile.png
        amazon/
            profile.png
    users/
        wietlol/
            profile.png
Makes sense. Though how do I create the subfolders in code?
Because the amount of users increases dynamically.
apart from the AWS CLI (web ui), folders dont actually exist in S3
the above structure is flattened into 3 objects with the following keys:
organizations/google/profile.png
organizations/amazon/profile.png
users/wietlol/profile.png
as long as you, in your code, construct the key correctly, it will work as intended
so, you could do something like
function getUserProfileKey(user) {
    return "users/" + user.id + "/profile.png";
}
then read/write using that key
09:44
@useragent 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
Okay. Perhaps I figured, but you can correct me here.
If I am to upload a file to a folder that does not yet exist, the code should look like this
https://gist.github.com/Sidney-Dev/84af0948bf5bc4bd0c47174812645a6a
again, there is no such concept as folders, so "a folder that does not yet exist" is meaningless in the context of S3
its just a key
an upload with any (valid) key will work regardless of how many slashes there are in the key
I suppose your snippet would work
Noted, thanks!
 
1 hour later…
10:58
posted on July 12, 2023 by Ben Mason

Hi everyone! We've just released Chrome Beta 115 (115.0.5790.85) 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…
13:22
Lol, funny thing is I just watched how insecure AWS S3 buckets are, and how easily they can get hacked.
14:17
i mean
if you leave your credentials out in the open or don't secure it it won't be secure
iirc they're locked down by default now
(the bucket that is, you still have to protect your creds)
15:04
@KevinB yeah, it's not insecure if you know what you're doing and pay attention to things, but there is still a lot of people who don't know that and their buckets are getting hacked all the time
that's true of anything on the internet
I've never even heard of them until I watched the video, but is there some kind of reminder when setting up a bucket?
AWS has gone to great lengths to produce learning content and educate it's users, even so far as providing free live teaching lessons on demand.
i find their constant offers of free lessons even annoying at times
@ParkingMaster reminder of what?
to tick the box "I prefer not to get hacked"?
when you set up the bucket, it is by default secure
no extra steps are needed
15:08
To never expose your credentials, what else?
you have to go out of your way to open up a file you uploaded to the outside world
you needed to watch a video to understand you are not supposed to expose your credentials?
Actually, it's not the credentials, I forgot what it was but let me check again...
@ParkingMaster I assume that this statement is based on more than "you need to secure your credentials"
When you create your AWS account, they literally reach out to you with lessons/learning opportunities, both live and self-managed
15:10
OH, ok, it wasn't about credentials, it is a checkbox to make sure you know what you're doing before exposing it to the public.
Yeah on the video it looked so easy to hack one (he did it ethically), and there's even tools for finding buckets to hack, it's pretty insecure
oh ye, buckets arent public by default, you could make them public, I assume for stuff like static websites and shit
although, I prefer the S3 > CloudFront variant
15:33
quick question about data-sitekey
@Jefferson google recaptcha?
yes
 <button type="submit"
    class="btn btn-primary px-4"
    data-sitekey="@reCaptchaKey">
    Submit
</button>
I have a $("#Form").submit(function (e)
can I do something like this to get that data $(this).data('sitekey')
or is there a better way to do that
@Jefferson that is correct, $(this) selects the current element, then the jQuery method ".data()" gets the data attribute (in this case, "sitekey") which should indefinetely work. Using JavaScript you would just do this.dataset.sitekey but that works fine too.
^ *Pure JavaScript, I meant. As jQuery is not another language
16:06
@danik0011 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.
@danik0011 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.
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
const arrayRemoveDupes = (r) => {
  if(!Array.isArray(r)){return undefined;}
  let newR = [];
  let isDupe; // idk if putting a let in a for is safe
  for(let i=0;i<r.length;i++) { // for each element
    isDupe = false; // initiate it as being not a dupe
    for(let j=0;j<newR.length;j++) { // for each element of newR
      if(r[i] === newR[j]) { // compare current elem of r with current elem of newR
        isDupe = true; // if it ever is, then mark the current element as dupe
        break; // and break out of the for(j)
what is the time complexity of this function?
16:32
@ParkingMaster take a look at this jsfiddle.net/tjmcdevitt/8cawy1kb/2
any problem with adding it to the form?
form method="POST" name="Form" id="Form" data-sitekey="reCaptchaKey"
16:58
@danik0011 i don't think anyone here will do your homework for you :)
17:40
posted on July 12, 2023 by Ben Mason

Hi everyone! We've just released Chrome Stable 115 (115.0.5790.84) for iOS; it'll become available on App Store in the next few hours. This release includes stability and performance improvements. You can see a full list of the changes in the Git log. If you find a new issue, please let us know by filing a bug. Krishna Govind Google Chrome

 
2 hours later…
19:28
posted on July 12, 2023 by Release Managers

Hello All, The Dev channel has been updated to 116.0.5845.27 (Platform version: 15509.20.0) for most ChromeOS devices. If you find new issues, please let us know one of the following ways: File a bug Visit our Chrome OS communitiesGeneral: Chromebook Help CommunityBeta Specific: ChromeOS Beta Help CommunityReport an issue or send feedback on Chrome Interested

posted on July 12, 2023 by Ben Mason

The Beta channel has been updated to 115.0.5790.90 for Windows, Mac and Linux. A partial list of changes is available in the Git log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Prudhvi Bommana Google Chrome

posted on July 12, 2023 by Prudhvikumar Bommana

 The Stable channel has been updated to 115.0.5790.90 for Windows and Mac as part of our early stable release to a small percentage of users. A full list of changes in this build is available in the log. You can find more details about early Stable releases here. Interested in switching release channels?  Find out how here. If you find a new issue, please let us know by filing a bug.

20:25
@Jefferson sorry for the late response, yes it would also work with the form.
@JBis as to your challenge from yesterday, I figured out all I have to do is get the function name, paramaters, and body from itself. Then combine it all together in a string and log it to the console.
function printCode(code) {
  if (typeof code === 'function') {
    const name = code.name;
    const params = code.parameters.map(param => param.name);
    const body = code.body;

    const line = `
      ${name} (${params.join(", ")})
      ${body.toString()}
    `;

    return line;
  } else if (typeof code === 'string') {
    const line = `
      ${code}
    `;

    return line;
  } else if (typeof code === 'object') {
    const keys = Object.keys(code);
    for (let i = 0; i < keys.length; i++) {
20:57
hmm
@KevinB wonder why that is, I just tested it
let me try it again
probably because i didn't pass it a parameter
it fails all three conditions
Oh yeah I didn't see that lol, you need to pass a function
What the heck, why is it not working now
:D
presumably it went to the typeof ocde === object, given it's the only section with a map, and because it's got no values... it isn't an iterable and can't be an array and thus has no map
Strange, let me try to change it to a more modern-style function
Twas testing it on an old environment lol
21:03
ah, i was wrong actually, i didn't see your map in the first section
oshitoshit y'all seen htmx yet? htmx.org
feels like cocaine
looks dumb
nah it's like excellent
or well, in fact it is, dumbed down to primitives
lol, I feel dumb, all I had to do was "" + code
JBis played me
function printCode(code) {
  return "" + code;
}
@KevinB lol wait was that in answer to my htmx thing or not
21:06
@FélixAdriyelGagnon-Grenier Kevin can type pretty fast
I think he was referencing that to you
it was, :p
i'm not a fan of functionality being built within html
@KevinB I agree, HTML is just structure, no action
21:07
in a sense, yes, but i do prefer to use built-in form validation over custom crap, that's an exception
My current angle, that I can't quite articulate extremely well, is how it fills a space that, within my previous workline, has been always quite bothersome, and often resulted in maintaining two separate stateful structures, for client and server
I feel like I can now forego a gigantic chunk of client logic
mind you, I haven't built anything yet except a few throwaway prototypes so I may well change my view
i don't disagree that it's gonna make building some things easier, or that it could even be useful as part of a larger project, just not a style i'm interested in
i particularly don't like the idea of the browser parsing and rendering the htmx and then the logic for htmx coming along and replacing/altering it after the fact, that seems inefficient. Yes, react does this too, when not using ssr
well, react sortof does it, it renders the base node, and then inserts the app within it, but i think that's semantics
@KevinB I'm interested if you want to say, what would that general style be?
@KevinB huh, ok I think I don't yet understand all the internals. In a dumb html document it will only do something when an action from user, such as submitting form, opening a tab, etc. will happen
in a more traditional approach, the form submission would still presumably request a server, the tab may well get content from the server or have already been built
i don't either, but from a practical sense, if you send the browser a button, it's gonna render that button before htmx can access it
is more what i was commenting on
if then, all of your logic for htmx is within your html that you send the browser... all of that gets parsed as html prior to htmx doing anything with it, where as with react all it parses and renders is a div, and maybe a static header/footer that isn't controlled by react, etc
reacts downside is often the app.js bundle
a lot of work has been done with resolving that, for example now you can split different "pages" of your app into separate .js files that get lazy loaded as needed rather than needing to download the whole thing at once
hmmm, I don't see "all the htmx" logic in the same magnitude as you I believe. they are all custom attributes, something deeply ingrained in html and presumably very optimized.
for instance, with 2-3 custom attributes you can get simple html element to now send the form, then show a list or something, without having to add any logic of client data structure
in fact, my goal is mostly to write no logic on the client at all
21:23
what i'm picturing is, and due to my lack of research might be flawed, is that you're laying out your page as html, + these attributes. If your page is relatively flat, no showing/hiding or changing of content outside of sending ajax and displaying a result, htmx is farily well suited for that
even when you get into, say, ajaxing in different page sections, htmx can probably handle that pretty well, an anchor with attributes instructing it to send a request to x and put output in y, and hopefully htmx would then be able to parse the htmx result, etc
but... iunno. that's relatively simplistic, and isn't far from just being html and a form, or anchor tags
How would htmx handle html that represents a data set?
say, an array from json
yeah I don't know, it does feel like a limitation. If I control the server I would try to transform it into html before sending it to the client
but like, raw requests to endpoints that return json do not seem to be a primary use case in my current understanding
and like, that,s the "transient cyberpunk data stream à la Tron" my mind has decided to associate with htmx
no need to actually manage that json data in client
we send it elsewhere, and it renders, we're in the matrix just move that html around
oh did you mean html data set like, a page with a big table of data that we then would like to send to a server?
i'm thinking, a general table or list interface where the user is trying to do work on the list, with buttons that perform actions, maybe editing functionality, etc
in a react scenario that'd be an array in a store that the view is rendering, then actions on the view update the store, resulting in the view updating. htmx doesn't seem to really represent the "store" side of that, rather, that'd probably be server-side
which... makes the "It's 67% smaller!" claim kinda... silly?
like, woo, yea, i can make a purely html/css frontend with a backend that generates html with buttons that do stuff and rerender the page, no htmx needed! it'd just be quite not fun
21:38
yeah I haven't given much thought or weight to the weight thing. Early intuition is transferring html fragments around might be equivalent or heavier than json requests.
I find the size aspect nice because it has this jquery feel of you dump a unpkg link and you have it
@KevinB in that case my current view is many small requests would be sent, sending back the closed version of the field
or maybe even it stays as always open fields, and the view just doesn't need to be rerendered
i think it would be a solvable problem
now... add in tailwind classes or bootstrap classes to the mix
yeah. these are not my style :P
mine either fortunately
Well, I need to get along now, thanks for the thoughts!
22:43
Hey everyone
I got a question related to MongoDB or in more generally related to all DB systems
When updating many entries that meet our filter in db, should we beforehand check if there is any entry that meet our filter (count those) and then update them at once or directly find those meet our filter and update?
Is counting beforehand can be more effective?
Or maybe I'm thinking a bit over :D In the end that would make very insignificant difference and that makes sense
posted on July 12, 2023 by Krishna Govind

 Hi, everyone! We've just released Chrome 115 (115.0.5790.85) for Android to a small percentage of users: it'll become available on Google Play over the next few days. You can find more details about early Stable releases here. This release includes stability and performance improvements. You can see a full list of the changes in the Git log. If you find a new issue, pl


« first day (4652 days earlier)      last day (520 days later) »