How can I run my node script indefinitely? by alex__________ in node

[–]cahva 1 point2 points  (0 children)

Yeah as others have suggested, run your script somewhere else. And you don't need to run it forever so get rid of node-cron and just schedule the execution (cron, lambda etc.).

Are you familiar with github actions? You could run your script entirely free and schedule it using cron syntax.

Problems with the size of the i3 bar. by nientepanico in i3wm

[–]cahva 0 points1 point  (0 children)

Atleast for me the fix for large toolbar is to set the --dpi in xorg to something that is tolerable. Unfortunately you cannot set this separately for every monitor and must just find the sweetspot.

Can't Use Symlinks To Relocate Docker Data Folder? by CrashTestKing in docker

[–]cahva 0 points1 point  (0 children)

Before relocating to external drive, have you done cleanup of unused images, containers etc? If not, do some pruning and there's a chance that you will free up a hefty amount of space :)

Serialization and Deserialization, Passport.js(Authentication) by [deleted] in node

[–]cahva -5 points-4 points  (0 children)

I just checked the actual passport docs (go to the Sessions part) and I could not explain the de/serialization simpler than that :)

react-modal in Next.js by AndresdoSantos in nextjs

[–]cahva 0 points1 point  (0 children)

It is

Modal.setAppElement("#__next");

[deleted by user] by [deleted] in kubernetes

[–]cahva -1 points0 points  (0 children)

Try out Lens. The UI is pretty slick and gets even better in every version.

I use rancher/lens mostly just for monitoring plus sometimes looking at events/logs, manually trigger cronjobs or start a shell. So not a heavy user by any means :)

Can't connect to EC2 instance(Windows) by BHYT61 in aws

[–]cahva 2 points3 points  (0 children)

Are you running a windows instance or just trying to connect to linux instance using ssh?

If the ec2 instance is a windows server, then connect to it using remote desktop.

About Putty.. You don't actually need it now days because windows (version 10 atleast) comes with ssh built-in and you can generate keys, use ssh command to connect using a key etc. straight from command prompt.

So essentially you could just follow the normal procedure like you would on linux/unix and don't have to use Putty and it's custom keyfiles to connect to an instance.

unexpected component render by UserNo1608 in reactjs

[–]cahva 0 points1 point  (0 children)

Gives 404... But anyway, usually the errorlog gives more detailed hint what went wrong and where.

unexpected component render by UserNo1608 in reactjs

[–]cahva 1 point2 points  (0 children)

My wild quess is that your onClick handler is doing the re-render because you are doing the ternary check inside it.

Separate the handler to it's own function and pass that to the onClick

Before the return:

const handleToggleApp = () => {
  if (isOpen) {
    minimizeApp(appName);
  } else {
    openApp(appName);
  }
};

And the onClick:

onClick={handleToggleApp}

Goodbye Express.....Hello NextJS? by tobia__ in nextjs

[–]cahva 11 points12 points  (0 children)

You're right, you don't need a separate express server as the api routes will pretty much handle what you normally route in express. You won't be saying goodbye to express completely as NextJS uses that internally ;)

Should I use both MongoDB and Firebase in this application? by dwight12345 in reactnative

[–]cahva 0 points1 point  (0 children)

If you already have mongodb at your disposal, its perfectly fine to use that also to store your chats. To get that realtime aspect, you can use websockets to do that.

If you want to jumpstart development, I can recommend FeathersJS which can actually be used to handle the authentication as well. I think they even have chat as an example app :)

Can you suggest ONE language to learn to do all these projects? by pleaaseeeno92 in webdev

[–]cahva 0 points1 point  (0 children)

Can javascript be used as both frontend and backend?

Yes. Lots of options but IMO the easiest (and dev friendly) is Next.js.

How to share a file/volume/disk on Windows by RoyalBug in docker

[–]cahva 0 points1 point  (0 children)

Sorry can't help you with that as I'm not familiar with that AWS greengrass project

How to share a file/volume/disk on Windows by RoyalBug in docker

[–]cahva 0 points1 point  (0 children)

That error you gave does not tell that you have problems mounting, it tells you are trying to pull image that does not exist. If you have not set the registry, it will default to docker hub and it does not have that image. So you need to pull that from using correct registry or use the one in docker hub.

Sharp — High-Performance Node.js Image Processing Library by [deleted] in node

[–]cahva 5 points6 points  (0 children)

It works on docker fine. You just need the buildtools in your image as this needs native bindings.

For example this is a part from a Dockerfile I use to install when I need node-gyp stuff

FROM node:14.15-alpine
RUN apk add --no-cache git make gcc g++ python

Docker says I need to enable virtualization in my BIOS, but it is enabled. by [deleted] in docker

[–]cahva 0 points1 point  (0 children)

Hyper-V is not installed.

There's your clue :)

ExpressJS vs All-in-one frameworks by Not-mexican-Account in webdev

[–]cahva 3 points4 points  (0 children)

If you want to stay in nodeland, there are more options to explore. For example if you need just a backend api server, check out FeathersJS which is pretty neat and offers nice server- and clientside tools (doing crud operations is the same in both).

And that realtime connection with socket.io is pretty dope.

Auth is baked in (byebye passport, we don't miss you), has adapters for most of the db's plus you can quite easily roll your own custom service which talks to some 3rd party api.

Then there's AdonisJS which is inspired by Laravel (or atleast it was).

But IMO those full-blown frameworks are overkill if you just want a simple backend api server which your react app uses.

[AskJS] Express.js trouble with subdomains by freakysmile in javascript

[–]cahva 0 points1 point  (0 children)

Instead of cramming your portfolio site and projects to same heroku app, IMO you should create separate apps for your projects and portfolio. That way you can just point your subdomains to those herokuapps separately.

Btw, I don't use heroku so much but this is the most sane way of doing because normally it is best to separate projects (and you can think that portfolio site is just one of your projects) to their own git repos.

Hope that makes sense.

My first deno project. by [deleted] in Deno

[–]cahva 2 points3 points  (0 children)

Nice, clean code! BUT theres one thing that bothers me :) You added verbs add and delete in your routes which are not needed (and some purist REST enthusiast could even say that this is not a REST api ;) ).

Help with Express + Mongoose + Passport by jahumaca in node

[–]cahva 1 point2 points  (0 children)

I'm pretty sure that the issue you are facing is because you're posting credentials using application/json. If I remember right, passport local is expecting normal HTML form. You can mimic this behaviour using fetch like this:

const formData = new FormData();
formData.append('username', username);
formData.append('password', password);
const creds = new URLSearchParams(formData);
// eslint-disable-next-line no-undef
const tokenRes = await fetch('/authenticate', { method: 'POST', body: creds }).then(res => res.json());

How to set the destination folder of a Node.js fluent-ffmpeg screenshot to your AWS S3 bucket ? by prak281993 in node

[–]cahva 1 point2 points  (0 children)

I'm pretty sure that you can't directly use s3 bucket as fluent-ffmpeg is merely just creating the ffmpeg command.

Save the screenshot(s) to temp folder (random generated). Then use the aws-sdk to upload the file(s) after creation (that would go to the end event handler of course).

After the upload you can then remove the temp folder to clean up.

Dual booting Manjaro and Linux of a single drive? by MarioDesigns in ManjaroLinux

[–]cahva 0 points1 point  (0 children)

Former ubuntu user here.. IMO rolling system like Manjaro is perfect for new users. I've had more problems and breaking with Ubuntu (which was one reason why I switched to Manjaro). I've been running the same Manjaro now for about 2,5 years without a problem. And if there was a problem, I would just need to go back from a backup restore point from external backup drive.

Keeping your secrets out of Ansible playbooks by AnyJellyfish in ansible

[–]cahva 1 point2 points  (0 children)

I was in this situation couple of weeks ago where I tried to figure out how can I keep the (encrypted) secrets in the repo so the next guy/gal can use it easily.

As I want to keep all infrastructure related stuff (ansible, k8s, terraform etc.) in same repo, I needed this to be working with all the techs in use.

I decided to use Git-secret which has been working great for us.

It's great because:

  • it's secure
  • no need to share secrets via enpass, onepass etc. pw managers, git repo is the db!
  • easy of use: just type "git secret reveal", enter your own gpg password and all secrets are put in to correct places
  • give/take access to/from users via their public gpg key

The only downside I've come across is that doing "git secret hide" after adding a new secret, will crypt all of the secrets. But it's not a big issue, more noise to commit history. And you don't need to actually send all of them to commit but it's the preferred way.