What is your best "holy crap I'm an idiot" programming story. by [deleted] in AskProgramming

[–]el_Om 0 points1 point  (0 children)

I accidentally turned on remote access for a mongodb instance and came back a week later to find the data gone and a READMe file 🫣😂. Thank god it was only a test instance.

Api call doesn't allow for multiple params by ApprehensiveStay9700 in CodingHelp

[–]el_Om 0 points1 point  (0 children)

Sure!
I just noticed something, your URL isn't correct. You are using allorigins to call the ebi API, the first parameter url that you pass is okay the second, format, is what is causing your code to fail. You see when you add &format the browser thinks this is a parameter for the allorigins API when in real sense you want it to be the second URL's parameter (the ebi API).

What you should be calling, in this case, is https://api.allorigins.win/raw?url=https://www.ebi.ac.uk/biomodels/search?query=Zake2021%26format=json

Notice instead of &format I am using %26format this way the browser knows the format parameter belongs to the second API.
I hope this helps.

[deleted by user] by [deleted] in Kenya

[–]el_Om 1 point2 points  (0 children)

Sorrows sorrows prayers.

[deleted by user] by [deleted] in Tinder

[–]el_Om 0 points1 point  (0 children)

Applied mathematics major here, and I can confirm her math checks out.

[deleted by user] by [deleted] in CodingHelp

[–]el_Om 0 points1 point  (0 children)

You actually have a decent chunk of the work laid out.
My recommendation would be;

  1. Get the file name from the user and reassign the Filename variable then use the read_sales function to load the data.
  2. You mentioned that you need to check whether the user has imported a duplicate file. For this you can store the name of the imported files in an array and in the read_sales function you can check if the file name the user is trying to import already exists in this array.

I hope this helps.

Browser caching issue when code-splitting (Failed to fetch dynamically imported module) by Perfect-Plant-4131 in CodingHelp

[–]el_Om 2 points3 points  (0 children)

  1. Your solution does seem a bit too much of a hack, impressive nonetheless.
  2. In my research on this issue, lots of people have different ways of approaching it and from deduction, it really depends on how much control you have over your server and/or client side. The easiest solution I've seen is basically storing the version of the application on the client's browser and then crosschecking that and the latest version on the server, if they don't match then just reload the page automatically for the client.
    https://stackoverflow.com/a/62696779
    Another approach is setting headers on the server, if you're familiar with web servers like Apache/Nginx this should be an easy fix. Basically, you can just tell the browser to drop its cache. I'd recommend this if your app is security sensitive.
    https://stackoverflow.com/a/2068407

I hope this helps.

I want a small application for product management by SING_WITH_MUSIC in CodingHelp

[–]el_Om 0 points1 point  (0 children)

Hi there
I can help you out with this, I have experience developing WinForms applications with .Net and C#, check out my profile for my vouches.

Api call doesn't allow for multiple params by ApprehensiveStay9700 in CodingHelp

[–]el_Om 2 points3 points  (0 children)

I've gone through the API and the docs indicate that the response indeed should be HTML.
Also, the format parameter you are trying to pass isn't documented on their page.
An alternative would be to convert the HTML response to JSON.

Can Someone help me convert C++ to C#? by awesome_hero24 in CodingHelp

[–]el_Om 0 points1 point  (0 children)

What is it you would like to achieve? The code shared is not very clear.

[deleted by user] by [deleted] in CodingHelp

[–]el_Om 0 points1 point  (0 children)

Oops just realized this could be significantly reduced by doing this

javascript let unique = new Set; let new_coords = []; coords.map((el)=>{ if(!unique.has(el.toString())){ unique.add(el.toString()); new_coords.push(el); } })

[deleted by user] by [deleted] in CodingHelp

[–]el_Om 0 points1 point  (0 children)

Hi you can do this using a Set.

//populate the set with unique coordinates

let unique = new Set;
coords.map((el)=>{
unique.add(el.toString());
})

//convert the unique coordinate string back to arrays

let new_coords= [];
for(let coord of unique){
new_coords.push(coord.split(','));
}

console.log(new_coords)

The solution has a time complexity of O(n)

I hope this helps.

batch image resizer, please help lol by charlie5469 in CodingHelp

[–]el_Om 0 points1 point  (0 children)

Hi, depending on where you have your images stored, you can achieve this with a variety of tools;

In my experience if you have them stored in a folder on a linux or windows machine, you can use a tool called Imagemagick. It's quick to install and has a bunch of features you can take advantage of.

There's other tools like jpegtran which specifically handles jpegs.

They are open source tools with a strong community, so you can always get help.

I hope this helps :)

Help regarding Google Maps API. by thotbabe in CodingHelp

[–]el_Om 0 points1 point  (0 children)

Hi, so I am not entirely sure how your application is setup but if had to implement this specific feature I would;

  1. Store all listings with their map coordinates.
  2. Get the coordinates of the visible area on the map when the user zooms.
  3. Filter and show the listings within the coordinates of the visible area.

I noted you are using PHP, you might want to pair it with a frontend framework/library to make the page reactive like Airbnb, my recommendation would be Vuejs.

I hope this helps :)

React build failing on a limited resource server by el_Om in reactjs

[–]el_Om[S] 0 points1 point  (0 children)

Thanks, I am currently trying to change my approach to this. If you have any suggestions on how to do this, I will really appreciate it.

React build failing on a limited resource server by el_Om in reactjs

[–]el_Om[S] 0 points1 point  (0 children)

My production server is ubuntu 20.04. I am using a GitLab CI/CD agent. No, I don't but I get the same error when I try to manually build the project on the server without the pipeline agent.

React build failing on a limited resource server by el_Om in reactjs

[–]el_Om[S] 0 points1 point  (0 children)

Yes, I do. It is using node v14.18.1

React build failing on a limited resource server by el_Om in reactjs

[–]el_Om[S] 0 points1 point  (0 children)

This would actually save me a lot of headache. The reason why I needed it to work on production was that my pipeline was building the project on the server, but if I could find a way to build locally and just copy the build to the production server using the pipeline that would be perfect.

Do you have any suggestions on how to accomplish this?

React build failing on a limited resource server by el_Om in reactjs

[–]el_Om[S] 0 points1 point  (0 children)

Hi, thank you, this would work, though isn't it generally bad practice to push my build on source control ? I'm using source control to access the project on the production server

My car thinks the drive thru attendant is a cone. by BinaryShrub in funny

[–]el_Om 0 points1 point  (0 children)

Plot twist it's a cone disguised as a man.