#development

1 messages Β· Page 48 of 1

earnest rivet
#

Especially great for big companies that needs to keep their code under strict access, and don't want leaks πŸ™‚

ashen sky
#

@last ingot Just had a look at the GitHub plans. And free tier is useless to us, with $4 a month, price would be higher than our selfhosted BitBucket, and for the UI, I have a hard time figuring out why the GitHub UI should be better than BitBucket. To me both have an equal amount of annoyances, but in parts of the UI I don't use too often to care. πŸ˜‰

#

It's a virtual server, hidden beneath many others, the hosting costs of the bit bucket server is marginal, when you look at how big a share of the resources that one server takes. I'm sure if I do the actual math, the hosting is almost free. πŸ˜‰

foggy ginkgo
#

Do not forget to factor in your usage of the tool. If you are a heavy user of CI/CD toolchains and you do not host and manage a Jenkins, GitLab might offer more than Bitbucket. Even with Git, GitLab offers more out of the box with protected tags and partial clones.

#

Companies I work with regret using Bitbucket because of its lack of features compared to the competition and the weakness of their "deployments", administration panels and basic features that should not be part of the premium plan. By the way: who ever used their "pipes", really?

cloud knot
#

also gitlab can be selfhosted, using docker

proper gale
#

I have my own gitlab, for ci stuff

magic rapids
#

how do i sign my code so it doesnt seem like a virus its just a random number generator that tells you what loot to use in a game

magic rapids
#

windows

stable fiber
#

u need a mdsn membership to sign ur code with a dev signature so hope u got deep pockets

agile kettle
#

how much does it cost?

oblique cloud
#

Hello all, I just completed version 3.0 of my Automated / Dynamic Outlook Signature script. It's in use in quite a few places now (an older version). You set it as a logon script in Group Policy and it uses AD attributes to generate their signature and set it as their default in Outlook.

I was wondering if it would be ok to post a link to the GitHub to see if a fresh set of eyes can see other ways it can be improved or have any suggestions?

errant wigeon
#

is it possible to make an auto typer that will write each letter individually into whatever the input is (google search bar for example)

#

having hotkeys for each line, for example if i press NUMPAD1 it wont automatically just put "google.com" it will individually put each key in

tidal tusk
#

does anyone know of a html5 player that can play back videos higher than 60 fps?

ashen sky
#

@tidal tusk Doesn't that depend on the OS and browser, more than the player? HTML5 players just use the video and audio API's available in the browser, along with the codecs the browser supports.

tidal tusk
#

i wouldn't think so as vimeo has a high refresh rate player

ashen sky
#

@tidal tusk Just made a simple test. Took a 240 fps slowmo video with my iphone, transfered the file to my computer, made a simple HTML page with just a video tag referencing the video, and it plays at 240 fps no problem. (Using chrome on windows)

tidal tusk
#

really?

#

@ashen sky

#

my second though is, is there a way to detect monitor refresh rate and push the proper fps?

#

no point in showing a 144 fps video if the user has a 60hz monitor

ashen sky
#

@tidal tusk Doubt it. My monitors are all 60Hz.

#

Also, I don't see the exact framerate, but the video is in fact played in real recording speed, not in slowmotion.

#

If you want, I could send you the file...

cloud knot
#

@tidal tusk you can't detect such things in browser

foggy ginkgo
#

Even with content negotiation ?

ashen sky
#

But the browser can do that, and restrict playback if needed.

foggy ginkgo
#

I mean, there are protocols to exchange information with media servers. Youtube is the prime example, as is Netflix or any other video streaming website.

cloud knot
#

there is literally no browser API for refresh rate information

#

which prints out 143/144 fps for my 144Hz monitor

#

sadly it prints the same on my 60Hz monitor

ashen sky
#

Prints 59 on my 60 Hz monitor.

cloud knot
#

well it might measure the primary monitor, that is another possibility

ashen sky
#

Or the one with the highest refresh rate?

cloud knot
#

but in any case, this is browser performance measurement and not querying the specs of the actual hardware

ashen sky
#

Yup. Can be influenced by a slow or busy CPU....

cloud knot
#

so if you have something else which could slow down your framerate (let's say you calculate prime95 or fold full blast on your PC), it could measure wrong values

ashen sky
#

Exactly.

cloud knot
#

and that is with just discord and twitch stream running on other monitor πŸ™‚

elder ivy
#

prints 144 fps on my monitor

cloud knot
#

yes, but again, if you do something on your PC, it will show framerate drops often

elder ivy
#

there's a reason youtube is only 60 hz

ashen sky
#

Yeah, also just checked some javascript docs, and it seems like I have a lot of dropped frames. Makes sense on a 60 Hz monitor though.

tidal tusk
#

there is literally no browser API for refresh rate information
@cloud knot then how does ufotest work?

cloud knot
#

@tidal tusk see the code before that. it tries to pain web animation frames and measures how much can it paint

ashen sky
#

Seems like the video plays about 40 frames per sec, and drops the remaining 200.

tidal tusk
cloud knot
#

@tidal tusk the browser of course can paint only as much frames as monitor allows it to, if not limited by other software on the PC. Thus if there is nothing else loading the CPU, browser can paint as many frames as monitor allows it to

#

so you measure how many frames you can paint, not what the hz of the monitor is. In ideal case it is the same value, but not everything is ideal (you learn that with coding, if you didn't yet)

tidal tusk
#

I'm more php than js

elder ivy
#

lol ufo test has obfuscated code

tidal tusk
#

But you see what I mean right

tidal tusk
#

If ufo test can determine it why can't I take the value it returns and show the corresponding video file

elder ivy
#

because they've taken a lot of effort to estimate fps

cloud knot
#

measuring monitor framerate via detection of animation performance of browser is like detecting RAM by trying to allocate various sized of RAM and see if you succeed πŸ™‚

#

@tidal tusk you can. i just say it is not bulletproof

tidal tusk
#

True

#

I think the simpler route to go with this project I'm working on is to have users fill out a profile that allows the user to specify what monitor refresh rate they have and just show the videos accordingly

elder ivy
cloud knot
#

you can still use the script from the jsfiddle and offer the detected value as 'default'

#

so if you detect 135-150 FPS, you set the default to 144Hz. 55-65 FPS, you set 60Hz. etc

tidal tusk
#

good idea

#

thanks for the fiddle

#

I got a friend of mine that does front end that will love this idea

#

he's helping me with the site

#

I'm handling back end

#

he's doing front end

foggy ginkgo
#

I also have an idea worth spreading if you are set to build a website or application that features video streaming.
Have you ever watched TED videos on their website?

tidal tusk
#

have not

#

backstory fyi I've been an admin of another discord for a while and we're getting pretty serious with membership

foggy ginkgo
#

With your web console opened, navigate to one of their videos. Example: https://www.ted.com/talks/dan_finkel_can_you_solve_the_world_s_most_evil_wizard_riddle

tidal tusk
#

a lot of users upload videos to sites like youtube or streamable

#

we figured we could build our own and have a community site

#

upvotes, comments sharing to other platforms

#

server announcements etc...

foggy ginkgo
#

There, you will see a lot of mp2t and aac requests that retrieve video and audio segments. TED developers implemented their video streaming platform so that the contents renders nicely on your device.

tidal tusk
#

very cool

foggy ginkgo
#

This file describes the video, audio and subtitle streams the server can deliver. Your client will default on the first one, then, depending on your device and network, will decide to skip to a stream that requires more or less bandwidth.

cloud knot
#

in other words, HLS.

foggy ginkgo
#

YES! You can even find the spec online on the IETF website if you feel bored someday.

tidal tusk
#

Hls is something I'm new to

foggy ginkgo
#

In other words: I hope you will not implement this and instead choose to rely on an existing media delivery service that encodes and delivers the right video for you.

tidal tusk
#

But I like how it's adaptive

ashen sky
#

Tried measuring framerate with a video.. https://videofps.azurewebsites.net/video.html Appears to be working, but I only have 60 Hz monitors to test with. If someone with faster refresh rate would like to test, it would be appriciated. πŸ™‚

#

Feel free to comment on the code as well.

elder ivy
#

"Dropped 22 frames of 1269. Effective playback rate was 249.4 fps"

#

I'm using a 144hz monitor

#

also doesn't work in Firefox

cloud knot
#

@ashen sky "Error 403 - This web app is stopped."

ashen sky
#

@cloud knot Apparently the free tier only allows the site to run 60 min. Upgraded the plan as i have some free credits to spend anyways. Should be back online. πŸ™‚

cloud knot
#

Dropped 19 frames of 1269. Effective playback rate was 250 fps (on a 144Hz monitor)

trail zealot
#

can i get some help with some python?

nocturne galleon
#

There are probably some people who can help. Post your question and if anyone has an answer I'm sure they'll respond

oblique cloud
#

Yeah I am sure someone can help, I know a small bit of Python but my main areas are C# and PowerShell really but depending on what you need someone could likely help πŸ™‚

cloud knot
#

and in doubt, there is an python humble bundle right now πŸ˜„

late berry
#

I want to get started in coding, and C++ seems like the best option for coding games. I know almost nothing about coding at all. could anybody recommend a good tutorial or a better language

flat sparrow
nocturne galleon
#

@late berry Are you looking to get into game development? All major engines are made using C++ but many offer scripting in other languages. For example the Unity engine uses a lot of C# scripting for the actual development of your game. If you're very new to programming I would suggest starting with python to learn some programming fundamentals, and once you're comfortable there all of the C++ stuff will make a lot more sense and be easier to manage. And if you're not interested in programming at all, some engines offer 'visual scripting' where you drag and drop your game logic visually instead of programming it. Unreal Engine 4 does this using Blueprints for example

#

@trail zealot I use a lot of python at work and am glad to help if I can, or you can dm me too if that's easier

calm thicket
#

hello

#

what do you think is the best terminal emulator out of these;

#

Alacritty
kitty
GNOME Terminal
Tilix
Terminator
Yakuake

dense flower
#

Konsole

obtuse night
#

Anyone know what form this date is in? Date(838854000000) Getting it from an api and i dont know what it is

ashen sky
#

Looks like the number of milliseconds since some date. A windows API by any chance?

obtuse night
#

its literally a static json file linked to a nodejs api used from college. so i dont know

ashen sky
#

Do you know what time it's supposed to represent?

obtuse night
#

not a clue.
This is the data its from:

    {
        "OrderID": 10248,
        "CustomerID": "VINET",
        "EmployeeID": 5,
        "OrderDate": "/Date(836434800000)/",
        "RequiredDate": "/Date(838854000000)/",
        "ShippedDate": "/Date(837471600000)/",
        "ShipVia": 3,
        "Freight": 32.38,
        "ShipName": "Vins et alcools Chevalier",
        "ShipAddress": "59 rue de l'Abbaye",
        "ShipCity": "Reims",
        "ShipRegion": null,
        "ShipPostalCode": "51100",
        "ShipCountry": "France"
    },
ashen sky
obtuse night
#

could be. Thanks. Is that a common type?

ashen sky
#

A unix timestamp is quite common. Displaying it in milliseconds, is not quite as common. But as they all ends with 5 0s you can just divide it by 1000 before working with it, that way you have a regular unix timestamp.

#

But seems like javascript returns timestamps in milliseconds, which is just what I'd expect from JavaScript. πŸ˜›

obtuse night
#

Thank you

cloud knot
#

@ashen sky i bet the backend is java for that

#

tho i am not sure why the weirdos who made the backend didn't use the normal YYYY-MM-DDTHH:MI:SS+TZ:TZ notation (example: 2020-05-21T15:08:15+02:00 to say 15 hours, 8 minutes, 15 seconds at time zone +2 hours on 21st May 2020

ashen sky
#

Because you could just remove the / at either end, and do an eval in the string? πŸ˜›

#

But it seems more likely, that it's just the result of a silly JSON encoder, getting some other object, and does not expect anyone but itself to ever decode it, so just used a silly format.

late berry
#

Thanks @nocturne galleon That explains alot of the stuff I was confused about

neon niche
#

hi guys i have a question. im trying to make a custom shell for myself in C++ .and add commands to it like:
say "hi"
and it prints hi. but i dont know how to get input and devide it by different arguments.

like imagine in my shell i add a command to make a file and its syntax is:

makefile (filename) (fileformat)

and user inputs: makefile foo dat
how do i make the application understand the syntax?

#

like first it says ok. the command is makefile then looks the next argument and then creates a file with the name and then sets the format from the 2nd argument

#
#include <iostream>
#include <string>
#include <fstream>
#include <boost/algorithm/string.hpp>

using namespace std;
using namespace boost;

class Pixie {
	
	void sayPixie () {
		
		cout << "Pixie - " << version << " - Prefix: " << prefix << endl << endl;
	}
protected:
	string prefix = "#def";
	string version = "0.3";
	string codename = "strong";
};
class Commands : Pixie {
public:
	
		void commandRan(string arg) {
			
			if (boost::iequals(arg,cmds[0])) cmdHelp();
			else if(iequals(arg,cmds[1])) cmdInfo();
			
			else wrongCmd();
		}
		
		void cmdHelp() {
			
			cout << "\nHelp: \n";
			for (int i = sizeof(cmds)/sizeof(cmds[0]); i > 0 ; i--) {
				cout << cmds[i] << endl;
			}
			cout << endl;
		}
		
		void cmdInfo() {
			cout << "\n\nVersion = > ";
			cout << version << endl;
			cout << "Codename ";
			cout << codename << endl;
			cout << endl;
			
		}
		
		
		void wrongCmd() {
			
			cout << "\n\nCommand does not exist\n\n";
		
		
		}
	
protected:

	string cmds[2] = {"help","info"};
	
};


class Listener : Pixie {

	public:
	
		void listen() {
			while (allowRun) {
		   string txtRan = input();
			
			Commands cmd;
			cmd.commandRan(txtRan);
			}
		}
		
     protected:
     	string input() {
     		cout << prefix << "  => ";
     		getline(cin,in);
     		return in;
     	}	
	
	string in;
	
	bool allowRun = true;
};



using namespace std;
int main()
{
	Pixie px;
  px.sayPixie();
	
	Listener list;
	list.listen();
  
}```
#

this is the code for my app

#

I know i can use one of the boost's library called starts_with() but idk if thats gonna work

#

Please no say why u use namespace or code is messy Β―\_(ツ)_/Β―

shy helm
#

There's a few different ways to do that, and it depends how string you want to be

#

The simplest way would be to use the command pattern and then have a command dispatcher that matches based off the first word in the command (kind of similar to how it works with linux, but hardcoded)

#

So if you entered "makefile blah blah" it would look for a command named makefile and then pass it the rest of the string

#

For actually parsing the inputted command, again, you have a few options. The easiest would be to white-space delimitate and then you can just split it on white space. It would give you an ordered array and you could process the arguments by their expected place (i.e. you expect the file name to be at position 0, the file type to be at position 1)

nocturne galleon
#

anyone here fam

dull pasture
#

hot

past mountain
#

Any experienced JS coders here? I could use some help on a project I'm currently working on..... tag me and lmk if you're interested.

nimble drum
#

@past mountain enlighten me

#

(tag me when u send me something or dm me)

neon niche
#

@shy helm oh. can you give me an example of the whitespace one? do i need to type cin >> text; instead of
getline(cin,text)?

past mountain
#

@nimble drum sent you a dm

nocturne galleon
#

@neon niche you could still get the whole input from the user like normal, but then take that input and split it into an array, linked list, vector, or whatever. That way the first item would be makefile, the second item the filename, and the third item the fileformat, etc. So you could then check what the first item is to determine the action, and so on

neon niche
#

How would the code be? sorry a lot ot questions im just a beginner lol

nocturne galleon
#

@neon niche no problem at all, we all started somewhere πŸ™‚ Here's a stackoverflow link where they split a string into a vector using spaces which would do what you're looking for https://stackoverflow.com/a/5607650 One of many ways to do this though

neon niche
#

thank you πŸ˜„

lyric remnant
#

hey I sketched out a very simple website on photoshop

#

and im wondering how can I create a navigation menu like that

#

with the tilted dividers up top

#

i could insert it as an image but that would ruin the quality

#

or would it?

#

via HTML, CSS and JS btw

round dome
#

isn't photoshop the worst thing you could use to make a prototype for a website? Isn't there stuff like adobe XD that focus on exactly that?

cloud knot
#

@lyric remnant CSS transformations

#

and clip paths and so on

lyric remnant
#

Ty ty

cloud knot
#

look at that

#

hm, windows 10 detects it as containing trojan, but i doubt that. will watch his response tho

fast plover
#

Guys.. is there anyone that is good at HTML/CSS code i need a very quick favour i need some code just tweaking to make some text fade in then out... is there anyone i could send the code to to have a look at? really stuck here. thanks πŸ™‚

ashen sky
#

For fadeout, just swap the opacity values.

fast plover
#

Ah okay thanks I will do

shut stump
#

I got a new domain, can someone send me a test email to see if it works: nick@nickevans.dev

limpid reef
#

Also, if you want to test email deliverability, just send yourself an email from a Gmail or Hotmail account, or use the email deliverability test built into your webserver's control panel, assuming you have one.

odd aurora
#

what is a protocool even?

#

leeme pull up a translation KEKW

#

what

#

it can't translate to Arabic

#

wtf is wrong with edge

#

its the same word without a definition

#

WTF

#

is this

#

what is the Address bus?

#

no the wiki link

#

u spammed bunch of shit

#

ok

#

what is the RAM socke

#

ddr4,ddr3,ddr2?

#

that for eg?

#

what is the ddr4 thing and ddr3,ddr2

#

oh k

#

what is the Form Factor problem

#

?

#

I cant understand the Form Factor "m.2" thing

#

sata and NvME Pogey

#

never read it

#

I just got it PDF from a yt vid

#

I opened it . seems super complex

#

the original one is super expensive

#

which is written by scott

#

-_-

#

scott wrote this one

#

BUT How do It Know

#

title *

#

my boi scott passed away

#

no . this explains everything in cpu and Gpu , chipsets too

#

science and history in same time

#

sry bad English . I am Arab

#

this will be so hard to understand

#

WHY DID I GET SCAMMED BY THE VIDEO

#

but good for bad English users and ppl willing to learn pc science in depth

#

oh ok

#

@vocal comet but how cpu is made exactly?

#

like how do they make it in different ways

#

AMD way and Intel way

#

I am confused af

#

the chipsets is different and I am dead

#

what is the pros and cons of overclocking a chipset

#

and GPU

#

maybe cpu too '

#

oh I need bigger fan

#

like 120 mm at least per part

#

maybe 120 mm fan?

#

on a 360 mm rad?

#

gpu and chipset

#

k

#

why there is 1 and 0 binary?

#

and sometimes it goes backwards

willow pawn
#

hello

swift hearth
#

Does this happen to you.

  1. Start a project (or tutorial)
  2. Work on it for some days
  3. Get bored
  4. Stop working on it
#

Is there a way to stop thay from happening. I have downloaded Unity, Java, Python, got some Ebooks and Tutorials and the same thing as above.

#

So I could go Unity Game then a Python Eboom that I have been reading

#

Ebook*

#

Then repeat

#

Ok

#

Will try

#

Thanks

#

Ok

#

My main problem is: I am 16 yrs old. Not looking for a job anytime before atleast 21 so there is no real motivation to keep me going

#

Yeah

#

That could be one. But I am also thinking of changing subject to Business in college πŸ˜‚

ashen sky
#

@swift hearth For me, it's a matter of not really caring enough for the project I start. The more I care for the project, the greater the chance is of actually completing it.

swift hearth
#

Hmm

#

I also need to learn rn before actually working πŸ˜…

#

But let's hope this time I complete one language tutorial or book

#

And start working on something

ashen sky
#

Actually you don't need to learn anything before you start working on something that really interests you. You'll learn what you need to know, as you go.

scenic hamlet
#

the "working on stuff you care about" bit is very true

#

though what i find happens to me is that i care about something a lot, start a project to help me with that thing, then over time i stop caring about the original thing and wind up with unfinished code that doesn't really help anyone lol

swift hearth
#

@ashen sky have tried doing that before and realized it's better to learn it first. Atleast that's true for me. Might not be true for you or someone else

#

@scenic hamlet same. I made like a Pakcoin (crypto) faucet in php5.

#

Then i stopped working on ot after a whiel

ashen sky
#

Well, if you don't have a pet project, that you really want to do, it can be hard getting anything done. You might need to do some side things to learn a new concept, but having an end goal, that you really care about would be what most people needs.

swift hearth
#

Still on my website ( I am not sure if I can post links here)

median nest
#

Does any know Java here?

#

And know how to use processing?

cobalt trench
#

if u need motivation, dont do it

runic ravine
#

Set a goal that you are pasionate about, then go there, use whatever resources you need to get there.. thats how shit gets done..

#

it is how i know programming in java.. didnt know anything about it πŸ˜‰ but i have a goal to work towards

vital blaze
#

You could also work on smaller projects that you could complete before you lose interest.

oblique cloud
#

https://github.com/captainqwerty/AutomatedOutlookSignature

This is a script I wrote and have just released version 3.0 of. It is used as a logon script through Group Policy to dynamically create a users Outlook signature based on AD properties, and if their job title for example changes next log on their signature will update. I just created it as a free and fairly simple to implement alternative to what is out there.
Was just hoping to see if anyone here had any suggestions on improvements, was hoping fresh sets of eyes might see stuff that I hadn't considered or thought of in the script.
I have just been improving it occasionally over the years as it's been implemented at each place I've worked in.

Thank you. Let me know if this is not allowed and I will delete it.

nocturne galleon
#

can someone explain what this is actually doing? if I'm not mistaken c will always be > 0 and cause an unending loop?

scenic hamlet
#

seems like c will be set to 0 when there are no more bytes left to read, which will happen when you hit the end of the stream

#

when it's called the first time, it'll read the entire stream into buf and set c to buf.Length, and on the second loop, it's already read the entire stream so buf won't be modified and c will be 0, exiting the loop

nocturne galleon
#

huh

#

but wouldn't it be 0 to begin with since thats the index where fs.Read starts?

scenic hamlet
#

c isn't an index, it's the number of bytes that the last Read call moved into the buffer

#

since the limit being passed to Read is just buf.Length, it looks to me like c will just be set to buf.Length on its first run, and then since there's no more bytes left to read, it'll be set to 0 on its second run

#

once its set to 0, that exits the loop

#

so the inner part should just get run once

nocturne galleon
#

hmmm

#

but when it goes back to check the condition, wouldn't it just read the file again?

deep scarab
#

no because the file stream position will be updated on every read

nocturne galleon
#

oh shit

#

that makes so much more sense, thankyou both

obtuse night
#

please can someone who knows about docker help with my problem. I have created a secret with UCP, and am wanting to assign this secret to a service in a docker compose file. How can i assign a pre-existing secret?

vital blaze
#

when it's called the first time, it'll read the entire stream into buf and set c to buf.Length, and on the second loop, it's already read the entire stream so buf won't be modified and c will be 0, exiting the loop
@scenic hamlet It will actually only read the number of bytes that the buffer can hold. So if the stream is 24 bytes long and the buffer 10, then c will equal 10, 10, 4, then 0, and you'll enter the loop 3 times.

brazen sluice
#

How do i use variables in my sql query? Im trying to get a sorting mechanism for my table using a dropdown menu, but i dont understand how i can use a php variable inside my sql query. This is my first php/MySQL project so i have no clue what im doing. I read https://stackoverflow.com/questions/7537377/how-to-include-a-php-variable-inside-a-mysql-statement but these all use INSERT and PDO's (PDO for injection risk or something but thats not a concern for me)

#
<?php
    
    //Voeg inhoud header.php toe aan pagina
    include "header.php";
?>

    <h1>Cijfers</h1>

    <p><a href="cijfer-toevoegen.php">Cijfer toevoegen</a></p>

    <!--form output for tabel sortering-->
    <form action="index.php" method="get">
    <p><select name="sort">
    <option value="DESC">Datum aflopend</option>
    <option value="ASC">Datum oplopend</option>
   </select></p>
   <p><input type="submit" value="Sort"></p>
    </form>
<?php
    
    //Nieuwe verbinding
    $conn = mysqli_connect($servername, $username, $password, $dbname);
    //Var van sortering declaren
    $Sorting =" '" . $_GET["sort"] . "'";
    //SQL query
    $sql = "SELECT * FROM cijfers ORDER BY "$Sorting"";
    
    //SQL query door database halen
    $result = mysqli_query($conn, $sql);
?>

My code

shy helm
#

You want to "bind" the parameter

#

What you're doing is quite unsafe

#

I would just follow the guides you find and use PDO

olive turtle
#

Pretty much: By setting $sorting to β€˜whatever; DROP TABLE cijfers ’

brazen sluice
#

How is it unsafe? Its an option form, so no Injection risk and thats the main reason for using pdo right? @shy helm

#

im 5 iq so i might be wrong so idk

olive turtle
#

I just gave you an example

shy helm
#

The example given is perfect

brazen sluice
#

isnt drop table for deleting tables?

shy helm
#

yeah

brazen sluice
#

Im trying to sort the

shy helm
#

so people can arbitrarily delete your tables

#

Ok so the user input is β€˜whatever; DROP TABLE cijfers ’

#

Your code concats the two strings

#

"SELECT * FROM blaj ORDER BY whatever; DROP TABLE blah;"

brazen sluice
shy helm
#

what do you think your DB does?

#

I don't need to use your form to submit a web request

brazen sluice
#

You dont?

shy helm
#

and I can also edit the HTML to make the content of the field anything I want

#

nope

#

I can just look at the destination the request is being sent to and fabricate my own request using something like Postman

brazen sluice
#

interesting πŸ€”

#

Anyhow, its a schoolproject so security isnt really an issue

olive turtle
#

It’s probably just an url-encoded or some form of Post request

shy helm
#

haha fair enough

#

Your SQL should work then the way it's written, no?

#

What issue are you encountering?

olive turtle
#

Mysqli should have binding though

shy helm
#

^ that too

brazen sluice
#

Im trying to use a php var in an sql query @shy helm

#

and since its my first time using php i cant figure out how to make it work

#
$sql = "SELECT * FROM cijfers ORDER BY '.$Sorting.'";```
shy helm
#

$sql = "SELECT * FROM cijfers ORDER BY " . $Sorting;

#

That should work no?

#

Or

#

$sql = "SELECT * FROM cijfers ORDER BY {$Sorting}";

brazen sluice
#

Using {$sorting} it has stopped giving errors, but its not changing

olive turtle
#

What does your query result as? Can you output it?

brazen sluice
#

I forgot to do ORDER BY Date

shy helm
#

I don't speak the language you're using but

#

the ORDER BY <blank> needs to be a column name

olive turtle
#

Right. You end up doing order by DESC or ASC

brazen sluice
#

Oh does $Get output a boolean

olive turtle
#

But you need the column name

brazen sluice
#

$sql = "SELECT * FROM cijfers ORDER BY Datum {$Sorting}"; this is what i have rn

#

Oh wait i realise whats happening

olive turtle
#

Been a while since I’ve used β€˜vanilla’ html but value is set to Sort for submit bit you’re getting sort? Isn’t there case sensitivity?

shy helm
#

Nah it just depends on the name of the field

brazen sluice
#

The name is what you call the output, so i use the name=sort to get $Sorting =" '" . $_GET["sort"] . "'";

#

While value=Sort is what the button shows when i press sort

shy helm
#

The name of the submit button doesn't matter...

#

You care about the field name of the multi-selector

olive turtle
#

Aight

brazen sluice
#

Hmm

#
$Sorting =" '" . $_GET["sort"] . "'";
    $Sortresult = mysqli_query($conn, $Sorting);

i added a mysqli_query and now the error is gone, but its still not using the var to order

foggy ginkgo
#

In SQL, there are no quotes around the sort direction. The syntax is SORT field [ASC|DESC].
Also, SQL injection potential here.

brazen sluice
#

Its a school assingment so injection isnt a concern, but thanks for the tip @foggy ginkgo

limpid reef
obtuse night
#

What wordpress directories are not save being visible to the public? eg. is wp-includes and wp-content/uploads ok?

somber glacier
#

Hi, I'm trying to create a Flask server for a game. The server expects a json POST request and returns a json response. What is the safest way to handle the client input? I tried using escape on all the dict entries from request.get_json() but I ended up just having to cast back to a built-in type to use the data which is a bit of a hassle, and I think might defeat the purpose of escaping in the first place? Is it safe to just use the raw json and then use the below format to have pymysql handle santitize the data before running queries?
cur.execute("SELECT * FROM players WHERE player_name = %s;", (json['player_name']))
Would I then use escape() on the json response or will jsonify() sanitize any data before it's sent to the client?
Most of the data I'm expecting is generated by the client (no real user input) so the main concern is curious/malicious people trying to generate requests manually

fervent orbitBOT
#

Why not use something like peewee to communicate with the DB, then serve corresponding JSON to your game using Flask? You can parse out returned data pre-shipping it to the game.

brazen sluice
#

Correct, I’m Dutch @nocturne galleon

shy helm
#

You'd be better off just generating UUIDv4s and storing them on a per-user basis. This is a fairly standard way of doing CSRF protection

#

But it ultimately doesn't solve the problem because I can just programmatically load your page, scrape the CSRF token, and then plug it into Postman

shy helm
#

How does your solution do that?

somber glacier
#

I'm not sure CSRF is such a problem in this situation (custom client). The only thing an attacker could do without signing in is list games that can be joined. Once they're signed in they can try and request a game be made or join an existing game. The worst they can do when in a game is just play a turn. The server is authoritative and won't allow illegal moves so they'd essentially be playing the game by post (or met with errors), without the visuals of the game to help them. I think it's more about not encouraging accessing the server in such a way and making sure they can't run malicious database code if they do. My original idea was a key/token that only valid clients know as a first level of security (which I guess could be sniffed with a decompiler) along with some sort of idempotency token for the specific action that the current player can take (which I guess is close to @last ingot 's idea). Thanks @shy helm @last ingot I'll have a bit of a think but I Think I have a better idea of how to go about it πŸ™‚

nocturne galleon
#

one thing I don't get, how do I sign my program in visual studio? when my friends go to install it, they don't get any prompts when doing so except "we can't verify the publisher, are you sure you want to install this?"

cloud knot
#

you buy an expensive certificate, then you sign it with it

#

by expensive we talk about few hundred dollars per year

faint sinew
#

Hello ALL

#

anyone good with python error getitem

#

trying to get an exploit working for hackthebox box

rough bridge
#

anyone good with java, havent been able to get this loop to work properly for a while. Basically it repeats even when the input is equal to 1,2,3,encryption,placeholder2,placeholder3

#
        do{
        System.out.println("1.Encryption");
        System.out.println("2.Placeholder2");
        System.out.println("3.Placeholder3");
        input=scan.next();
        input=input.toLowerCase(); 
        scan.nextLine();
        }while(input!="encryption"||input!="1"||input!="placeholder2"||input!="2"||input!="placeholder3"||input!="3");```
vestal glen
#

you want && not ||

rough bridge
#

ah ok, i figured it was smth like that

vestal glen
#

-> currently you're checking if input is not encryption or if it is not 1, either of them always has to be true.

rough bridge
#

it still repeats

#

actually had tested it yesterday but that was when i was messing with a while loop(instead of a do-while)

#

well, it wasnt the || or the && it was the !=

#

it has to be ==

quiet tartan
#

im trying to code a relatively simple program in python for a s/o any ideas? something cute i suppose

rough bridge
#

a nested if story is pretty cool imo

quiet tartan
#

like the walking dead game they did? you choose how the game ends, if im catching ur drift

rough bridge
#

yeah

quiet tartan
#

interesting, idk if i wanna devote that kinda time to her :p

olive turtle
#

oh man. Use pastebin if Discord doesn't support markdown :x

#

also... use new ArrayList and add all the inputs. Then you should be able to do something like while(!legalKeywords.Contains(input))

#

you could probably make the list constant too to avoid runtime allocation

shy helm
#

Should use a set instead

olive turtle
#

Yeah. True that. o(1) lookup

#

HashSet

elder ivy
#

if you're making a CLI I wouldn't expect ever to type the actual text of what option I want

#

it should just be a number

#

or letter

rough bridge
#

eh im mostly just messing around with java, not too advanced into it yet. havent messed with hashsets or hashmaps.Hashsets seem really easy though so i will be doing that since im not concerned with order of the elements

olive turtle
#

Hasmaps are dictionaries. They map from a key to a value. Array use numbers (index) as keys.

last lance
#

Pretty dumb person here, I want to make a really simple Linux program where it opens terminal, runs a few commands, and when you click it again it closes terminal please don't judge me if I sound like a idiot

#

And to activate the running commands you click a bitton

#

And you get he point

nocturne galleon
#

Not dumb dude, everyone learns this stuff at some point. If you're just wanting to run some commands you can use a bash script. Was the point of having the second click that closes the terminal just to get it out of the way? If you explain what goals you're looking to accomplish then some people here may have good solutions or approaches for you

plain pagoda
#

Agreed, not stupid, I only just learned about that stuff the other day and it's the kind of thing that starts simple and gets complicated fast, so go easy on yourself πŸ˜„

last lance
#

The point of the program is to turn on and off a small server

olive turtle
#

Without really knowing the whole picture of why you need what Modco: a simple Shell-script should be able to do what you want.

lime peak
heavy torrent
#

Any ideas how I can get

Cpu, gpu, memory:
Temps, usage

With node js on windows?

gilded moon
#

found a cool quirk, websites really don't like it when you try to access a URL that ends with %00

#

looks like that's just encoding for a null character

dim shard
#

Hey anyone know how to create a child package inside of a parent package in eclipse for java?

#

I'm trying to make a project of all of my past school projects and assignments so I want it so look like this

#

  β€’src

    β€’freshmanYear

      β€’freshmanYear.src

        β€’(all of my files)```
shy helm
#

is there a reason why you want to create multiple src dirs?

#

What you're technically asking about it creating multiple child projects

#

You don't even need to do that for it to work correctly--you can have multiple classes with main methods

nocturne galleon
#

can someone please tell me why this wont work, im doing exactly what its telling me to do, other examples im seeing doesnt have this issue, i have 0 clue why it wont work

shy helm
#

It's because of the way you imported it

#

Just make it

import turtle

#

and it should work

#

ohhhh

#

or actually it's because you need Turtle() not turtle

nocturne galleon
shy helm
#

no

#

turtle2 = Turtle()

#

note the capital T

#

the import can stay as your originally had it, my apologies

nocturne galleon
#

omg that worked

#

thank you so much

shy helm
#

no worries πŸ™‚

mellow dagger
#

hey guys, im having trouble with a little thingy:
im trying to insert a variable into a pointer in JavaScript

my current code looks like this obj.items.item_id.name where item_id is the variable.

#

all of this is json related (obj is a json file I added with const items_master = require('./vars/items_master.json');

midnight barn
#

You can't use dot notation with variables in JS @mellow dagger

#

You should use bracket notation to access the member elements if you want to do so programmatically

#

So obj.items[item_id].name

#

Also, just a small nitpick, but that isn't a pointer

rotund bramble
#

You should be able to do something like:

obj.forEach((item, i) => {
  obj.items[i].name = newName;
});

This lets you edit the original instead of duplicating it (with map or creating a new object), which saves a little in memory (default node, which I'm assuming you're using, has a memory limit of around 1.4 GB IIRC). Of course, if you have a large JSON file that's actually over like 1 GB, you should have some method for editing in pieces with temporary files.

Also, your "newName" or whatever would be what you come up with, that was just a placeholder.

rotund bramble
#

Also, just a small nitpick, but that isn't a pointer

I don't think it's a small nitpick. I think it's a valid concern.

The "pointer" is actually called an "object" and are very different things. The parent should also be an object, but it mostly likely contains just a collection (array of objects).

So like:

{
  "items": [
    {
      "property1": "value1",
      "property2": "value2",
      "property3": "value3",
    },...
  ]
}
nocturne galleon
#

Hi guys I’m messing with filestreams and am opening relatively large files (600MB videos) with File.OpenRead, however it seems to be really damn slow, it’s only loading in around 4 bytes each loop because that’s the size of the buffer I made, just wondering could that be the reason it’s only doing a few kB/s? My pc has an M.2 and so my IO isn’t the problem, any ideas on how to increase the speed?

deep scarab
#

increase the buffer size...

#

why are you only reading in 4 bytes at a time?

shy helm
#

For every read there’s fixed overhead costs, reading something as small as 4B is going to be extremely slow because your small read time will be grossly overshadowed by the fixed costs

#

I.e. let’s say there’s 50 units of fixed cost and reading each byte is 1 unit of cost (this is arbitrary for the example because I know fixed costs > small read), one of your reads is 54 units of cost, you do this 150,000,000 times and incur 8,100,000,000 units of cost

#

If you instead read, let’s say, 1 MB, you incur 1,000,050 cost per read, and you do it 600 times giving you 600,030,000 units of cost

#

@nocturne galleon hope this helps explain why it’s so slow. For reference, this concept is the amortization of fixed costs.

frozen flame
#

Hi everyone. Anyone good in C and willing to lend a helping hand (only few small questions)?

nocturne galleon
#

Hi, does anybody programming in assembly in windows os?

shy helm
#

Hi everyone. Anyone good in C and willing to lend a helping hand (only few small questions)?
@frozen flame whats up

#

Hi, does anybody programming in assembly in windows os?
@nocturne galleon no that sounds horrible

nocturne galleon
#

I have some questions about windows dlls. Normally, I am using java. Learning assembly for hobby

midnight barn
#

I would not recommend programming assembly in windows, try using a development board more optimized for it

nocturne galleon
#

I need to make a program in Java that will print out a receipt like this ^

oblique coral
#

print(β€œHello World”)

#

Should do that

nocturne galleon
#

Nah it needs to actually proccess all the math and stuff too

nocturne galleon
#

@shy helm thank you, that is very helpful

elder ivy
#

lol is that "do my homework" kind of question from itachi

spiral lantern
#

can someone help me make responsive a D3.js generated SVG map?

elder ivy
#

there should be tons of tutorials online for that

hexed imp
#

@nocturne galleon what book is that??

#

I'm guessing its a text book, but I'm pretty sure I learned out of the same one back in 2007!

#

oh no wait... I remember now. That was something we did in an online course... University of Phoenix, it was in a course on there

nocturne galleon
#

idk lol

hexed imp
#

that would have been 2011 - 2012 ish

nocturne galleon
#

My teacher just posted this on google classroom

hexed imp
#

oh... yeah it was definitely in my curriculum, same question. idt i have the code laying around anymore tho

#

very easy exercise anyway tbh

nocturne galleon
#

check if you do, that'd be clutch lmfao I have lots of other assignments

hexed imp
#

nah man even if i did, I'd be happy to guide you on it but providing you the answer would just be robbing you the opportunity to learn it. sry i'm kinda strict about assignments. if you run into any snags and you wanna ping me i'm good w/ questions

nocturne galleon
#

@nocturne galleon isn't that just a multi line print statement

#

or if you wanted to do it one by one you could

#

and then for the tabs if you want it to be consistent use the \t character

#

maybe that's not needed in java idk but

midnight barn
#

In those homework assignments they typically want you to use formatted strings

nocturne galleon
#

@nocturne galleon it helps sometimes to start smaller, so maybe start with a program that just prints the first line of the receipt, and once you have that, move onto adding in the second line

radiant garnet
#

@nocturne galleon Looks like you learned variables... so create variables, do the math, make the variables display as a receipt. Just tackle each part individually and should be good. I don't do anything with java, but thatd be the approach Id take. GL

nocturne galleon
#

import java.util.Scanner;

public class MyStore {

public static void main(String args[])
{
Scanner input = new Scanner (System.in);
System.out.println("Store Name ?");
String a = input.nextLine();

System.out.println("what is the date today");
String b= input.nextLine();

System.out.println("What do you want");
String c= input.nextLine();
System.out.println("What do you want");
String d= input.nextLine();
System.out.println("What do you want");
String e= input.nextLine();
System.out.println("What do you want");
String f= input.nextLine();

System.out.println("Price for 1st item");
int p1= input.nextInt();
System.out.println("Price for second item");
int p2= input.nextInt();
System.out.println("Price for 3rd item");
int p3= input.nextInt();
System.out.println("Price for 4th item");
int p4= input.nextInt();

double p5 = (p1+p2+p3+p4)*0.13;
double total = p5+p1+p2+p3+p4;
System.out.println(a);
System.out.println(b);
System.out.printf(" %-10s %-10s\n", c, p1);
System.out.printf(" %-10s %-10s\n", d, p2);
System.out.printf(" %-10s %-10s\n", e, p3);
System.out.printf(" %-10s %-10s\n", f, p4);
System.out.printf(" %-10s %-10s\n", "SUb-total", p1+p2+p3+p4);
System.out.printf(" %-10s %-10s\n", "hst(13%)",p5);
System.out.printf(" %-10s %-10s\n", "Total",total);

}
}

#

Does this look like it'll work?

nocturne galleon
#

Does it work when you run it?

nocturne galleon
#

No

limpid reef
#

Then I would say it probably won't work.

nocturne galleon
#

I don't understand the issue

limpid reef
#

Me either. It's Java; my most hated language.

ashen sky
#

That code will NOT work for an random number of items.. Also I seem to remember, when I played with Java, that Java has the same "funny" thing about reading keyboard input, as C/C++ does, that you need to clear the keyboard buffer, before reading again, or else you would have some random input lurking around, and getting read. (Mostly the linebreak character caused by pressing enter.)

#

Also you say the code don't work, what happens when you run it?

deep scarab
#

that only happens when you mix formatted and unformatted input

#

e.g. nextInt() followed by a nextLine() will cause the nextLine() to skip

ashen sky
#

So the issue seems different from C/C++ then, I remember it as happening all the time there. πŸ˜‰

#

Except the indentation of item 4 is a little off..

nocturne galleon
#

@ashen sky I have a question

#

How can I input numbers with decimals and add $ next to the numbers into my program?

#

Im very new to Java

ashen sky
#

I'm not very familiar with java, but depending on available datatypes, a double or float is the type you want to store the values.

nocturne galleon
#

This is what I have so far

ashen sky
#

Also instead of getting someone to input the date, it's possible to just read it from the system, whenever needed.

nocturne galleon
#

How could I do that?

ashen sky
#

I think java has a date/DateTime class, that can be used. But you'll need to check the documentation for details on how.

nocturne galleon
#

Thanks

deep scarab
#

you just store them as doubles instead of ints

#

and to add the $ in front, just change it in the printf

nocturne galleon
#

why jav

#

a

#

why

#

c#

#

is better

#

swift too

#

even though ios only

vital blaze
#

It's for school.

#

Also I'd suggest using actual names for the vairable.

elder ivy
#

lol.

#

programming languages are nice to compare and all but you end up not having a choice at times

nocturne galleon
#

I got it finished

#

Finale product turned out pretty good

nocturne galleon
limpid reef
#

Sure! I didn't receive an email verification link, meaning I can sign up using anyone's email address without verifying it's mine. Also, you shouldn't tell me "there's no user with a specific email" when trying to password reset - that's how bots can harvest valid emails for a service.

#

Otherwise it works OK for what it is. The landing page could do a better job of explaining how it works though - I thought it would generate an RSS feed based on feeds I give it.

nocturne galleon
#

@limpid reef Thanks!! Yeah currently I don't even have password resets or any sort of verification system in place, that's coming. I'm hoping the password confirmation on the registration form will prevent the need for that until I can get it working haha.

#

Any suggestions for how I could better explain it? It's sort of difficult for me to think because what I have now makes sense to me, but I'm not sure how I would better describe it to someone who wasn't familiar with the system.

nocturne galleon
#

If anyone else has anything pleasee ping me. I'd love to hear what others think.

balmy loom
#

lil bug

nocturne galleon
#

That's intentional as the only other option is to cause the cards to become uneven or for it to overflow. I know it isn't ideal but I couldn't think of a better solution :/

#

If you have any suggestions for a better way to deal with that though I'm very open to suggestions

balmy loom
#

you can just end it with 3 dots (...) it looks smoother

nocturne galleon
#

I tried but I couldn't get it working for some reason. I may have another go at it but I honestly spent around 4 hours fiddling trying to get it to end with an ellipsis before giving up and deciding that the feature wasn't worth all that time haha.

balmy loom
#

oh okay πŸ˜„

nocturne galleon
#

Thank you though!

#

That is on my todo list now

#

What do you think of the app as a whole? Is it something you'd use?

balmy loom
#

yes, but only if the algorithm is good

nocturne galleon
#

Did you try it out? I think it's pretty good.

#

@balmy loom

gusty girder
#

How could I write this statement in such a way that it automatically goes deep enough to get the correctly nested data? I understand I need to use recursion, but I'm not really sure how to approach the problem.

#

like I would need to save a "working" copy, and call a .get(parent_keys[i]) on the working copy, and return the final result?

balmy loom
#

@nocturne galleon i did and i am not really convinced

nocturne galleon
#

@balmy loom How could it be improved?

gusty girder
balmy loom
#

I have no idea :/ just doesnt feel right

#

Oh and maybe you can add list of most poular themes or something like that? So we can choose and if its not there then type it

elder ivy
#

@gusty girder what are you trying to do?

#

I suggest you pretty much never use eval

shy helm
#

anyone familiar with natural cubic splines here πŸ‘€

sick fossil
#

is anyone familiar with winapi?

gusty girder
#

@elder ivy I have a flat html table that represents nested json (each row has meta-data that signifies its parent and how deep it is nested). I am trying to build the json back from the flat html table.

#

@tough ember pm'd me a really neat solution that worked much better than my eval function

#
function getParentKeys(level) {
  var workingCopy = null;
  var i = 0;
  while (i != level) {
    if (i == 0) {
      workingCopy = json.get(parent_keys[0]);
    } else {
      workingCopy = workingCopy.get(parent_keys[i]);
    }
    i++;
  }
  return workingCopy;
}
#

I couldn't figure out a way to re-apply ".get()" to itself, so I did it using eval(), his way is much better and cleaner.

umbral lintel
#

Goodday, i'm having some trouble with reading tcp structure data from a buffer with net.Socket in nodejs, i thought i could just parse it with the node-struct module, but it is a bit harder then i thought, if there is anyone that has experience with buffers and packet structures in js that would like to help me let me know thanks.

tall kernel
#

oh i never seen this channel

astral garnet
#

Anyone offhand know if github pages lets you use PHP? I thought originally no but i'm not sure

shy helm
#

Pretty sure github pages is just static

#

no code server side

astral garnet
#

ok

#

i'll use javascript then :d

#

❀️ @shy helm

elder ivy
#

@gusty girder not really a recursive solution though lol

gusty girder
#

Perhaps my problem was not ever recursive in nature in the first place Λ†^

elder ivy
#

I mean you can solve it using recursion. guess that was a red herring

gusty girder
#

Not as much for you as much it was for me. I thought it could only be solved by recursion because I needed to apply itself on its result, but as Lobfil (and myself) demonstrated, a for loop was good enough for that.

elder ivy
#

I was gonna say a lot of these homework like questions actually require you to use a certain programming concept in order to accomplish it. asking someone to write something in both iterative and recursive ways is a good example

shy helm
#

All problems that are solvable recursively are solvable iteratively, and vice-versa

elder ivy
#

it's may possible to write but not elegant

gusty girder
#

I'm gonna save both of those replies. That like, lit a lightbulb in my head lol.
Can any of you offer a recursive solution to the problem so I can compare? I just needed to solve it, it didn't really matter how, but I'm curious how a recursive version would look.

elder ivy
#

Since your data structure doesn't have levels counted for you inside it. You probably have to pass in the current level into the function to count

#

Curious though. Why do you need to stop at a certain level

gusty girder
#

well, I'm iterating over nested json

#

it only goes so deep

shy helm
#

You probably can do this with pure structural recursion, not sure if I specifically get what your code does, there's a number of undefined variables

gusty girder
#

Since y'all curious:
I have a flat html table

row (key: value)
row (key: novalue)
row (key: value)
row (key: value)

that represents a nested json
key: value
key: { key: value, key:value }

(I know it's not actually written like that, it's for visual purposes, so you understand what it represents)

What I'm doing is I'm creating actual json from the flat table.

So I create an empty javascript Map(), and go row by row, adding key:value pairs.

Of course, in case of the second row, when it has no value, but is actually the parent of row 3 and 4, I create an empty map() for its value, but then when I reach row3, I can't access the initial map anymore, I need to access the map inside the map to put the values inside

#

perhaps this screenshot will illustrate it better

#

The html table (on the left) is actually a flat structure. The visual nesting that you see is purely that - visual with a margin-left.

#

What I needed is to create actual json that is nested from that flat structure.

elder ivy
#

oh

#

then you're doing it wrong above lol

gusty girder
#

It works tho Λ†^ (but fucks up when I try to access nested arrays)

shy helm
#

Recursion should give you a very easy solution for that

elder ivy
#

I mean there's some weird parts to this structure you realize @gusty girder

#

key12 is repeated three times for instance

gusty girder
#

it's on a different nested level though, json specs allows for it

elder ivy
#

and it's not obvious what you actually want at the top

shy helm
#

It's basically just

jsonify(root) {
  json : Map
  for child in root:
    if (child.hasChildren())
      json[child.id] = jsonify(child);
    else 
      json[child.id] = child.data

  return json
}
elder ivy
#

yes of course it does. but how flat do you want it

#

I mean you can construct unique keys recursively downward too

gusty girder
#

No I don't want it flat. I WANT it nested. My SOURCE is flat The table on the left. It's flat.

elder ivy
#

oh lol

gusty girder
#

you can see in my html, I have the metadata to figure out which belongs to what parent

#

but the structure is flat, and I use the metadata to generate the actual json

shy helm
#

The pseudo code I gave you above should be correct--you'll just have to modify it to work specifically with the data format you have

gusty girder
#

Thanks, I'll try it. I basically just use the innerText values from each cell (or values in case it's an input)

shy helm
#

i.e. you need to change it to support the initial flat structure, which shouldn't be too hard--use the comma separated list of key names to simulate depth

gusty girder
#

json : Map What does this do?

elder ivy
#

it's pseudo code

shy helm
#

though my code does assume that they are presented in order, if they're not it will break

#

It's just a type def in pseudo code

elder ivy
#

yeah I was gonna say this is just iterating straight down a flat table and then creating your nested object along the way

gusty girder
#

yeah I was gonna say this is just iterating straight down a flat table and then creating your nested object along the way
that's what I do now, just with a for loop.

shy helm
#

How familiar are you with recursion?

gusty girder
#

Not very much at all. I pretty much used it for the first time ever about 3 weeks ago

shy helm
#

Ah, you may have a hard time adopting my pseudo to work for an initial flat structure then

elder ivy
#

I mean that the code above only gets you the object at a certain level. I'm saying you can just build the entire object walking through the table once through

shy helm
#

But if you want to try it anyway and want a hint on the direction, you should be able to do it using pure structural recursion (to give you something to Google)

#

Yeah, the pseudo code I gave would turn an entire nested table into a nested map

elder ivy
#

assuming that it's nested by increase in level strictly (ie that the parent is the previous level - 1 parent)

gusty girder
#

That wouldn't work, sometimes a row is level 2 or 3, and the next row is back to 0

shy helm
#

that's why you should use the keys instead of the level

gusty girder
#

I can get level from the keys, just comme-delimited-array.pop().length() but I get what you're saying.

shy helm
#

you can, the length of the comma split string array is the level

#

and split-arr[n -1] is your current key, split-arr[n-2] is your parent (n being the length of the arr), special condition for n = 1 where the parent is root

gusty girder
#

It just seems faster/easier to store it separately, as I only generate the table once (php when I load the page), but I rebuild the array many times when the user edits values etc

#

so I perform less "calculations" as I can simply access level information directly

shy helm
#

yeah, the issue is you can't figure out where you are in the hierarchy using just level data, you need the keys too

elder ivy
#

lol if you're going to use the keys then you're going to have a bad time at the bottom row aren't you

#

keys="key10,1"

shy helm
#

oof

gusty girder
#

yeah, key10 is an array so it automatically uses 0,1,2 for "keys" but since it's an array it doesn't actually have any

shy helm
#

Can you make it like

#

key10[1] instead or

#

key10.1

gusty girder
#

yea no problem (narrator: but actually it was a problem, but I'll look into it)

shy helm
#

Just a suggestion, otherwise processing any of the keys will be basically impossible since you wont be able to ensure that splitting the string gives you the actual keys

gusty girder
#

well isn't 0,1,2 technically the correct keys for an array?

elder ivy
#

I mean the other part is why is your UI different than the structure used to represent it

#

you might as well just create it in the way it's supposed to look

shy helm
#

well isn't 0,1,2 technically the correct keys for an array?
@gusty girder ye, just don't comma separate the index with the key name

gusty girder
#

I mean the other part is why is your UI different than the structure used to represent it
How would you represent a json editor structured data in html without a table?

elder ivy
#

lol I mean you can blindly assume that intermediate levels exist

#

and blindly create keys/levels along the way

shy helm
#

I mean the other part is why is your UI different than the structure used to represent it
this is also a good point, you probably could nest your TRs and use a special inner CSS class to make them indent

elder ivy
#

I mean it's also a matter of reordering, collapsing etc. nested html makes that a lot easier

gusty girder
#

but a table doesn't really support nesting (it does but ugly af with double borders and other problems)

#

I would have to use a list for that

#

and list has the "vertical" problem

#

how I make the columns match up

#

Like I'm not averse to using something better, but I couldn't figure out anything better for myself. I looked at other json editors, and they all use what amounts to a table

#

so that's what I went with - why reinvent the wheel.

shy helm
#

table rows can nest fine, you just have to change the CSS

#

if you use a special inner CSS class you can remove the extra borders and fix the other stuff

gusty girder
#

Hmm, I'll look into it, thank you for the help πŸ™‚

elder ivy
#

just use divs for everything πŸ˜„

#

there's more than one way to beat a dead horse of course

nocturne galleon
#

anybody of android devs here?

gusty girder
#

I know some xamarin, but my knowledge is pretty basic

nocturne galleon
#

I want to get hang of android deving in kotlin

delicate snow
#

im in need of a javascript god right now

#

nvm

potent cradle
#

Hi I have a question. Will a reaction collector stop if the message the reaction collector was on is deleted?

#

In discordjs

meager turtle
#

Would anyone be able to point me in the right direction to find a reliable and trustworthy web developer with experience in things like CDNs and NGINX? I'm pretty comfortable with the frontend stuff of webdev but the backend I'll definitely need to find a professional to help me out. Would prefer a referral to somebody rather than just hiring somebody who I don't have a connection to.

shy helm
#

What region are you in?

meager turtle
#

United States, Northeast

shy helm
#

idk if this is the best place to ask though tbh

#

hmmm

#

Like outside of me recommending people I know, I can't really give you an objective recommendation haha

meager turtle
#

I figured not, I just enjoy Linus' community he built and I'd respect y'alls advice and opinions.

#

I'm open to personal recommendations too. I'm looking for POC and/or progressive minds really.

shy helm
#

What kind of backend work is it? If it's not super custom you might be able to go with a relatively standard solution

#

wordpress/etc

meager turtle
#

I'd prefer to avoid using a CMS or frameworks if possible, I want it to be lightweight and efficient (fairly custom I suppose)

#

I know it's a huge ask...but the cause is worth the effort (and my own $) imo

shy helm
#

Does it actually need a backend? Like, is this something users are going to be interacting with directly to do stuff?

#

Or is the backend just to serve content to the front end?

meager turtle
#

Yes, I'll need quite a bit of content and user protection.

shy helm
#

ahh

meager turtle
#

I mean ultimately I want the frontend to be as simple as possible, but the backend I want sturdy and secure and efficient

shy helm
#

Yeah fair enough

#

TBH even if you hire a dev they'll probably end up using a backend CMS

meager turtle
#

Yeah, I realize thats kinda the norm these days :/

shy helm
#

Full custom just isn't really worth it now a days

meager turtle
#

but I'm hoping I can find a savant to work alongside ahahah

shy helm
#

Unless it's supppper custom

#

like you're doing stuff that's out there

#

the issue you'll find though is full custom has higher maintenance requirements

meager turtle
#

I'm not completely discounting using frameworks, I just want to make sure the site's content and users are well protected.

shy helm
#

finding new people to maintain it is a PITA tpp

#

WordPress has gotten farrr better than it used to be

#

not perfect but

meager turtle
#

If somebody can convince me that their CMS and framework is secure and efficient I'd be willing to go that route.

shy helm
#

Well, you just do things like security through depth

#

if you're really concerned about the CMS being vulnerable

#

proxy the website through something like CloudFlare

#

restrict access to admin sections to certain IP addresses if you're super concerned

meager turtle
#

Oh yeah I'm definitely looking to utilize CDNs as much as possible, I don't have the money to fund a raw metal server structure.

#

thats not a bad idea for initial security though

#

I appreciate the info a lot!

shy helm
#

No worries πŸ™‚

#

It's actually a good long-term plan for security too

meager turtle
#

Thanks πŸ™‚ security and authenticity is going to be a huge point of interest for me and the business

foggy ginkgo
#

@meager turtle CMSs are not all heavy -unlike those from ibexa *cough* *cough*-. The core idea of a CMS is to… well manage content. Therefore, presentation can be delegated to other applications that would retrieve content from the CMS. Two examples: Contentful and Strapi.
Depending on what you wish to build, you might have to consider your requirements before choosing any tool. Basically, how much does your application need to be resilient, cost-efficient, maintenance-free, secure, performant?
This also applies to NginX or the CDN you will choose: what is essential, what you can add. Do you need it to be flexible, an industry-leader…? See what I mean?

meager turtle
#

Thank you @foggy ginkgo ! I appreciate that information. My requirements are definitely a bit specific to my case, I'd love for secure, resilient, and cost-efficient CMS most of all. My only concerns with CMS' are the security flaws I've witnessed in some scenarios. Obviously it's not the norm that they are unsecure but I just want to basically make damn sure mine will be, especially if I'm storing important or personal user data that I want to keep 100% private.

honest hamlet
#

does anyone know a good http server vulnerability/security scanner site?

foggy ginkgo
#

@meager turtle Unfortunately, I can only provide help with AWS when it comes to choosing the right service and AWS might be too expensive in your case.
You would need:

  • a scalable object storage (S3 / Backblaze) for your content. If you are conservative, your CDN could optimize and deliver static assets. Otherwise, go crazy!
  • some session storage, preferably a key-value store like Redis;
  • a scalable CMS API;
  • a NoSQL database or multiple relational ones in a Master-Standby configuration or Master-Standby-Read configuration;
  • a domain name and some SSL certificates.

Your scalable object storage can also host your frontend application and your CDN can also deliver it. Some basic level of security can be achieved at the network level by not exposing your object storage and your database to the Internet. And by only exposing what the user needs to see and nothing more. Easy you say?
Now, you can decide on how and where you will host this and whether or not you need all these services. This is a baseline but sometimes less is more πŸ˜‰

Oh, and another free tip: automate everything. Yes, even infrastructure provisioning and deprovisioning can be automated.

meager turtle
#

Dude...that is an amazing amount of useful information for me. I greatly appreciate it. I'll look into all of these things.

#

❀️

shy helm
#

Keep in mind AWS is veryyyy expensive for bandwidth

#

There's a reason why we don't use it for LTT

meager turtle
#

Yeah I'd prefer not to use a CDN that is run by a potential competitor. Don't want to risk them throttling or disabling my access for whatever reasons.

#

A friend told me that even if they did throttle me there wouldn't be an easy way to get proof.

#

I'll most likely go with whichever service is most unbiased to the actual content, because I want to allow adult content as well.

foggy ginkgo
#

Here is a fringe idea that I have never actually experimented with but that tempted me for a while: Multi-CDN.
Let's think about it: your assets will probably be delivered by a domain like static.mywebsite.tld. What if you could, with some telemetry sprinkles, use multiple domains for your CDNs and shift in real time towards the most efficient in a certain region and for certain types of contents?
Or randomly choose which CDN will deliver your assets. They all have the same access to your static contents, right?
Anyway, going without a CDN is hardly an option today, I fear.

elder ivy
#

o.O that's what a CDN is supposed to do

#

unless I'm not understanding something, it's literally in the name

#

multiple CDNs would get annoying with CORS anyhow

foggy ginkgo
#

I do not see how. Provided they all point to the same vhost or set of vhosts with similar configurations πŸ˜›

#

Then your CORS issue is a matter of handling OPTIONS and adding headers at the vhost level.

shy helm
#

CORS is on a domain not IP basis

#

iirc most CDNs let you use custom domains and use anycast IPs for serving, you would just have to give the user the right anycast IP based off GEO location

#

But yeah, what Blue said, the whole point of a CDN is to do all this for you...

elder ivy
#

depends if you want common libraries being cached or not across other websites too

shy helm
#

true, but if you do that you should just pick the most popular CDN for that library, ignoring local performance

#

Since that would give you the highest chance of it already being cached in the user's browser

meager turtle
#

These sound like great ideas! Interesting to see the discussion about it.

#

iirc I read about how Netflix does their hosting and they basically use a bunch of raw metal servers distributed in various locations usually with the support of local ISPs. So it's a similar mentality to using multiple CDNs that are located in different parts of the world.

#

Because ideally you want the content hosted/streamed from the nearest provider to your end user.

#

That could've been dated information, but I'm pretty sure that's how they used to function.

shy helm
#

Actually they use AWS largely

#

they do have custom cacheing servers that they colocate with local ISPs though to improve performance/alleviate load, etc

meager turtle
#

Ah interesting!

zenith junco
#

do anyone here knows about TCP/UDP sockets?

#

I neeed to send large chunks of data several times a second

#

~300KB, 20/30Hz

#

Is it possible? I alredy tried, with a server/client application, and is likely to loose the start of the buffer

#

In the client I always recieve only part of the buffer, always the ending part

#

And sometimes the whole buffer

ashen sky
#

Do you close the connection after each transmission?

zenith junco
#

no

#

Why I would do that?

ashen sky
#

Perhaps the issue is, that the OS can not handle the data at the network layer, fast enough? Or the OS has too small buffers..

#

You would only do that, if you were inexperienced, and I've seen it done, by people not understanding why performance suffers. πŸ˜‰

zenith junco
#

I think if the buffer is too small the OS sends the data in small packets

ashen sky
#

If it possible for your application to just chop the data into smaller chunks, and reassemble on reception?

zenith junco
#

well, it would be difficult

ashen sky
#

As I see it, your payload would ideally be small enough to fit in single packets. Also are you using UDP or TCP? Is the network stable? Or could the data become lost in transit?

zenith junco
#

TCP, and network is stable

#

and I'm sending the whole 300KB buffer in a single send() operation

#

so I think it cannot fit into a single packet

ashen sky
#

Well, that shouldn't be a problem, with TCP it should just be split and reassembled on reception, by the OS, and fed as a single stream to your application. Only thing your application needs to do, is to not assume all data is available when reading from the stream, but it should be handed over from the OS in the right order, without loss.

zenith junco
#

thats is exactly what I was expecting, but I loosing data

#

with a single client connected it seems like the stream is very stable, failing just sometimes

#

but with 2 clients, it goes very wrong

ashen sky
#

How do you read the data? Waiting for a "Data available" flag, then reading what's there, and repeats until your get your "End of data" mark?

zenith junco
#

with recv(), that handles it for me I think

#

It takes new data in the buffer and waits until reaches end of data

#

but the new data in buffer could be incomplete, but always containing the end of the buffer

ashen sky
#

The way I read the man page, it seems like it would just read whatever is available, but I'm not exactly sure, what will be regarded as a message.

#

Eg, if there's a short delay before part of the data is received, will that be regarded as the end of the data?

zenith junco
#

I don't think so

#

But recv() is a blocking method, so it waits until reaches end of message

#

I guess

#

Its for a uncompressed video streaming application, I can show how it looks visually

#

(with 2 clients)

ashen sky
#

Have you checked that you are not, by accident, making the buffer you store the data in, too small?

#

Hmm... Why not use RTP for that?

zenith junco
#

Have you checked that you are not, by accident, making the buffer you store the data in, too small?
@ashen sky no, the server and client buffers are exactly the same size, and if that was the issue, I would get a acces violation, or the data would be staticly lost, but the buffers that I get are of variable sizes

#

Hmm... Why not use RTP for that?
@ashen sky RTP? I don't know much about it

ashen sky
#

RTP is basis for basicly every video and audio streaming application.

zenith junco
#

oh, that is interesting

#

I'm going to google it, and see if I can implement it

ashen sky
zenith junco
#

Thanks for your help and info!

ashen sky
#

But for RTP my experience is more on the user part. (Work at a VoIP provider)

zenith junco
#

it seems like is connection less

#

I really would like a normal client/server with established links

#

it seems like is connection less
@zenith junco like UDP, because RTP seems like it runs un top of UDP?

ashen sky
#

Well, if you split the library, I'm sure you can just change the transport to TCP if you like. Also I think I've seen RTP over TCP implementations. But for streaming, TCP is not really great, at that rate..

zenith junco
#

but, I would not have the same problem with RTP over TCP?

#

It is still TCP

#

but RTP splits all the data and handles it for me?

ashen sky
#

If you find an RTP library.. But also keep in mind, that TCP connections uses resources on the server while the connection is running, UDP don't. Also with RTP and UDP you can multicast the stream, and save both network bandwidth, and system resources.

#

If it's just a learning project, I'd say do what you find fun, but if it's to be used for something serious, I'd say switch to RTP and UDP for the stream, and implement multicast if it's only to be used on an internal network, do control commands over TCP if you like, but UDP is better unless there's a good reason to keep the connection open.

zenith junco
#

I don't fnd simple RTP libraries

#

And the majority alredy implemente RTSP

ashen sky
#

RTSP makes sense to have implemented as well. πŸ˜‰

zenith junco
#

Yes, but I have a raw buffer of pixels not a JPEG frame, or a MPEG chunk

ashen sky
#

Hmm.. Been thinking a little, how does resource usage look on the server when you connect client number 2? (I've understood that it mostly works fine with one 2 client, but fails a lot when connecting the 2nd) Does it struggle with CPU to capture the image?

zenith junco
#

it just consumes 50% of CPU time, with 1 cient and 2

ashen sky
#

That's quite a lot for simple image capture.

#

Unless it's a pi.

zenith junco
#

320x240

#

Unless it's a pi.
@ashen sky Its not a raspi, but is not the heck of a lot of a computer

#

Is 2c/2t

ashen sky
#

But should still be able to handle 320x240 with less CPU.

zenith junco
#

Totally, but I do a while (cond) to wait till the new camera frame is in the buffer

ashen sky
#

Don't the capture driver have events for that purpose?

zenith junco
#

nop, is C style

#

you call a function to start the image capture, and polled waiting till the pixels are available in the buffer

ashen sky
#

Well, I suppose you should see what you can do to optimize performance, as that might be the entire problem.

zenith junco
#

Hmm

ashen sky
#

Eg. it usually takes 10 ms for the image to be ready, make the loop sleep for 10 ms before checking.

zenith junco
#

Ok

ashen sky
#

Adjust 10 to whatever fits the real world. A constant loop, with no sleeping, is asking for trouble. Whenever you call sleep, the CPU get a chance to process other things, and your application will consume less of it.

zenith junco
#
while (isCaptureDone(device) == 0) { std::this_thread::sleep_for(std::chrono::milliseconds(10)); }
#

oh thats a lot less CPU time

ashen sky
#

Something like that.. But if you know how long it takes for the frame to be ready, set the time to about that.

zenith junco
#

now is 8-10%

ashen sky
#

Hehe.. I've made the same mistake before. That was C# though...

zenith junco
#

Same

ashen sky
#

Also, while you're in the loop, network traffic is not processed..

zenith junco
#

I know that

#

Wait, i'm going to try with my 2 clients

#

nah, still the same

#

but the first client gets whole frames at 4/5fps and the 2nd client gets incomplet frames at 15fps

ashen sky
#

Do you have a similar loop on the clients, that could be optimized?

#

What if you lower the rate to 1 fps? Make that work flawlessly, and work up from there?

zenith junco
#

this is the whole loo

#

loop

#
while (true) {
        doCapture(device);

        while (isCaptureDone(device) == 0) { std::this_thread::sleep_for(std::chrono::milliseconds(10)); }

        memset(buff, 0, buffSize);
        writeIntToBuff(cap.mWidth, 0 * 4, buff);
        writeIntToBuff(cap.mHeight, 1 * 4, buff);

        for (int i = 0; i < cap.mWidth * cap.mHeight; i++) {
            writeIntToBuff(cap.mTargetBuf[i], (i * sizeof(int)) + (2 * sizeof(int)), buff);
        }

        /*for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 4; j++) {
                std::cout << (int)buff[(i * 4) + j] << " ";
            }
            std::cout << std::endl;
        }*/

        // Send buffer to all clients
        for (int i = 0; i < clients.size(); i++) {
            threadPool.push_back(std::thread(sender, clients[i], buff, buffSize));
            //send(clients[i], (char*)buff, buffSize, 0);
        }
        
        for (auto& t : threadPool) {
            if (t.joinable())
                t.join();
        }

        threadPool.clear();
    }
#
void sender(SOCKET s, uint8_t *buff, int buffSize) {
    send(s, (char*)buff, buffSize, 0);
}
#

I create a thread for each send() operation

ashen sky
#

Multi threading.. Ouch.. πŸ˜›

zenith junco
#

But I think thats wrong

#

What if I just do this

for (int i = 0; i < clients.size(); i++) {
  send(clients[i], (char*)buff, buffSize, 0);
}
ashen sky
#

I don't think it's entirely wrong.. But threads are usually causing a lot of fun problems. πŸ˜‰

zenith junco
#

I tested to have a thread that asyncly updates the buffer and a thread for every client that sends the buffer at a fixed rate

#

That didn't work

#

Was very unstable just for 1 client

#

I just put a std::this_thread::sleep_for(std::chrono::milliseconds(1000)); at the end of the loop

ashen sky
#

But I think I'd make the threads do more.. Eg. Fire a thread when a new client connects, to handle connection setup, and data transfer. When a new frame is ready, signal all threads that a new frame is ready, and have the threads process the frames.

#

Consumes a bit more memory and CPU, but should be easier to debug. (Eg. all images transfered looks wrong in exactly the same way, it's a capture problem, only a single looks wrong, transmission problem etc. )

zenith junco
#

I'm not profresional with weird std mutex async and futures so, I don't really know how to signal the threads

ashen sky
#

Neither am I, I mainly use PHP, and recently python.. Quite different. πŸ˜‰

#

And hardly ever with threads.

zenith junco
#

So it seems like at 1fps it runs great! But at what cost, 1fps

#

I'm going to wait just 100ms

ashen sky
#

Try increasing the rate, until it fails..

zenith junco
#

100ms

#

now is running 7/8fps

#

and is much better, the image is always stable in the 1st client and almost always stable too in th 2nd client

#

what if I do a small sleep in the client loop?

#

Like 20ms or so

#

What if I just do this

for (int i = 0; i < clients.size(); i++) {
  send(clients[i], (char*)buff, buffSize, 0);
}

@zenith junco (this loop)

#

now is running 5fps, very low CPU usage, 230x240

#

Just failing sometimes

#

Sporadically

ashen sky
#

Well, try, see what happens.. πŸ™‚

#

Programming is mostly planning and trial and error, for casual and non-critical projects. (Critical like spacecraft control, avionics, etc)

zenith junco
#

hahah

#

I have found that when it fails, the client recieves actually more data than expected

#

(And sometimes less)

ashen sky
#

Perhaps you get two frames in one packet?

zenith junco
#

So I think that the losses and unexpected behaviours is just the OSs trying to break and build the buffers and waiting for all the litte pieces in packets

#

Perhaps you get two frames in one packet?
@ashen sky 2 frames would be 600KB, I don't think that fits in a single packet, are you refering to a send() operation?

ashen sky
#

No, I'm thinking that you might get the data mixed up, because client and server are not syncronized. The client may have 1 1/2 frame available when you ask for the data from the socket.

zenith junco
#

probably

#

now with the sleep_for() is much better, even with 3 clients

#

but the framerate is reduced

ashen sky
#

Yeah. But I suppose for surveilence cameras a framerate between 5 and 10 would be good enough.

nocturne galleon
foggy ginkgo
#

require is a function defined in a Node context. This is a browser context, correct?

nocturne galleon
#

I guess yeah

nocturne galleon
#

okay now I am clueless

#

I have electron as a module imported

#

I've extracted my js script from html file

#

I've re-ran npm and fixed all the issues its reporting

#

I've imported electron once again

#

and its still fussing about require function

foggy ginkgo
elder ivy
#

wut

#

you don't require electron from inside the web part of the app

#

you've got it backwards

foggy ginkgo
#

Yup, what they said.

potent cradle
zenith junco
#

UDP question: do every sendto need to be followed by recvfrom?

round dome
#

no

zenith junco
#

That makes sense

zenith junco
#

Remember my uncompressed video stream server/client?
I implemented UDP multicasting (simply with the broadcast address)
But with UDP I can't just send a whole 300KB buffer, so I send line by line ~1290 bytes per line.
But there are quite a lot of packet loss, that is half solved just with a delay of microseconds in the server, but that makes the video very low in framerate, and there is still a litte bit of packet loss.

fluid adder
#

hello i have a small problem with php i have an error: Parse error: syntax error, unexpected 'else' (T_ELSE) on line 13
here is the code:

01<?php
02    
03    include 'fonction.php';
04
05    $passwd = $_POST['pass'];
06    $whoami = $_POST['login'];
07    $test = compteExiste($whoami, $passwd);
08    
09    if (compteExiste($whoami, $passwd)
10    {
11        header("Location: /test.php")
12    }
13    else
14    {
15        header("Location: /PageConnexion.php")
16    }
17    
18?>
elder ivy
#

semi colons?

#

oh missing ) on line 09

fluid adder
#

when i put semi colons after header() i get another error with unepected ;

#

ohhhh thanks you!!

elder ivy
#

and some semi colons

#

lol

fluid adder
#

yes

#

i was getting the unexpected ; error because of that one ) xD

lyric raft
#

I have to make a project for an interview to demonstrate Spring Security knowledge and I’m thinking of using an in-memory RDBMS (H2). Does anyone know if it’s a good idea? πŸ€” I’m only considering this because of the scope of the project.

verbal herald
#

What would you guys recommend for a vps? I just need it to host my discord bot and its database but i want something i can expand later so i could add a website in the future

#

Best to ask a tech community first.

shy helm
#

AWS or GCP for their free tier

#

You’ll pay some money for data transit, but assuming you’re not moving that much traffic (like say only a few GB outbound) you’ll pay pennies

#

You probably could use azure too I assume they have a free tier

verbal herald
#

Thank you, Im a little bit new to this so would it be the Amazon Compute? I just need to be able to host a Node Discord.js Bot and a MongoDB database on it

foggy ginkgo
#

On AWS, you will be able to get one t2.micro EC2 (Elastic Compute Cloud) instance for free for one year. With 30GiB of block storage and 1GB of outbound trafic per month for free.
To learn more about their Free tier: https://aws.amazon.com/free/

#

Is it enough for a small bot? For moderate usage, it will do. And nothing prevents you from hosting your website on some other solution such as GitHub pages.

verbal herald
#

I really dont know. Im really concerned for my computers sanity cause i want to add music but dont wanna risk killing it more now that im going to be over 100 guilds soon.

And that data storage should be find for awhile, i have a lot more data stored now then i will when i migrate

foggy ginkgo
#

Well then you might need a different approach. If you are not against vendor lock-in, they have a NoSQL database called DynamoDB with a good enough free tier.
Then you could either setup one EC2 for your music bot, play with their autoscaling and load balancing solutions or find a way to Dockerize it and run it on Elastic Container Service. Elastic Kubernetes Service would work as well but is a severe overkill in my opinion.

verbal herald
#

But will i be able to open both on a free tier?

#

Its not a big problem if i cant just would be amazing if i could

foggy ginkgo
#

Any of these solutions would work. It depends how deep you want to commit to AWS from the start and your compute model.

#

Just be aware of all the hidden costs. You should consider visiting the pages of the services you wish to use to read about their pricing. Before using them, preferably.

verbal herald
#

Yeah, thats my main concern at any of the solutions ive looked at. I looked at Digital Ocean and Oxide Hosting and they just seem to either be too good or missing important things in a bot with very limited specs

shy helm
#

GCP has perpetual free tiers

#

you can run two f1 micros for free on compute engine

elder ivy
#

@shy helm we shall see about the external IP and egress shortly for free

#

I hear they want to start charging

shy helm
#

I think they only charge for static IPs?

elder ivy
#

hmm they were in the process of changing some stuff

shy helm
#

rip

#

I have two ephem IPs

tepid zephyr
#

If anyone switched from Visual Studio 2017 to 2019 fresh and figured out why Intellisense is so slow, hit me up with a tag. Nothing from Google helped.

tall kernel
#

NGINX
how can i add a directory to my main domain like β€˜example.com/things’ if the β€˜things’ folder is outside β€˜/var/www/html’ ?

sage garden
#

not sure, but wouldn't a symlink work?

little knoll
#

@tall kernel IIRC, just add a root instruction pointing to the folder you want to serve in the location instruction in your Nginx domain config

shy helm
#

symlinks would work if you have it enabled in nginx (iirc)

tawdry pilot
#

This probably sounds lame to most of you here but: I'm working on a bot in js and it's getting cool

elder ivy
#

have you tried applying fire

wide needle
#

you either ASM or you go home

timber briar
#

Is there any way for a corporate user to get the windows calculators programmer mode to ALWAYS show the bit-view? Like the old win7 version

#

Also, option buttons instead of a single button for switching bit width

devout bluff
#

can anyone get on a call wit me for like 5m to help with pip commands in cmd and downloading python wheel files???

nocturne galleon
#

when i put semi colons after header() i get another error with unepected ;
@fluid adder However, I do recommend you to put a semicolon after every line by default. πŸ˜‰ Because, even though some times it still works, It's still a good practice anyway 😁

fluid adder
#

yeah but i realised after ading the missing ) that that was causing my semicolon to cause an error ^^

elder ivy
wheat dock
#

anyone here good with C#

gaunt finch
#

anyone who know how i can simulate raw input of a mouse in c++?

uncut goblet
#

anybody want to cringe on my quadruble boot?

pure coral
#

Does anybody know how to hide a mouse cursor in javascript or java

#

I’m not the best XD

short cradle
#

check w3schools

elder ivy
#

lol that looks like how to confuse old grandmas

drowsy knoll
#

Hi there! Just wondering if any1 here has any experience with a home nas thinking of using one for an upcoming project, but im not sure if their suitable for high write rates (1 new file every 0.25 seconds for about 1-2 hrs straight)

elder ivy
nocturne galleon
#

OpenAI API released

#
OpenAI

We’re releasing an API for accessing new AI models developed by OpenAI. Unlike most AI systems which are designed for one use-case, the API today provides a general-purpose β€œtext in, text out” interface, allowing users to try it on virtually any English language task. You can ...

#

i'd like to see this thing connect into MIT's OEC and current news affairs to explain things

#

like venezuelan crisis had to do with arms sales and optics moving from U.S. to European interests

obtuse night
#

Quick question, is it wrong to re-write a piece of software your company developed in your own time (as a learning exercise only)? My company uses a piece of software which i am wanting to convert to being scalable and using .net core, but not sure of the ethics of basically copying the idea for personal use

shy helm
#

As long as you don't do it the same way you're fine generally, even if it's for commercial purposes (this is not legal advice)

#

rebuilding something functionally identical for a learning exercise is probably entirely fine too

elder ivy
#

usually what happens is that the company owns your software regardless of when you wrote it as long as you're employed

#

it's not "wrong" but all code you write is theirs anyhow (within their industry)

shy helm
#

i.e. if my company makes widgets and I decide I want to practice widget making, so I recode their widget 9000 as a personal project (no selling it or anything), there should be zero issue

#

usually what happens is that the company owns your software regardless of when you wrote it as long as you're employed
@elder ivy no, most courts have ruled this not legal and many jurisdictions have laws specifically prohibiting this

elder ivy
#

you can do what ever you want, and you can even show them once you're done for a pat on the back or more

obtuse night
#

ok, thanks. Its really just something to show off what i know, and fill in gaps in my knowledge

elder ivy
#

depends which country you're in

shy helm
#

Using company time or company resources to build something is where you get into the "they might own your work"

#

US/Canada for me

elder ivy
#

fwiw I don't have work hours

shy helm
#

I would imagine most common law countries would have similar laws

#

Even if you're on a salary you have "work hours" generally

elder ivy
#

I mean generally speaking you also sign a non-compete to work at software companies

shy helm
#

... which doesn't cover personal learning projects?

elder ivy
#

it pretty much covers way too much

obtuse night
#

this all sounds like if you were going to market with your own project, so i think i'll be fine

shy helm
#

I've signed 4 different non-competes for software jobs in the past few year--none of them cover personal learning projects

elder ivy
#

I mean going to market and uploading to github are two different things too lol

shy helm
#

Heck, I've yet to hear any of my friends complain that their noncompetes cover personal projects

obtuse night
#

I mean going to market and uploading to github are two different things too lol
@elder ivy dont go there. i uploaded my coursework for my apprenticeship to my private github and the apprenticeship provider flipped out

elder ivy
#

lol that falls into the territory of who owns your work for school too. it's all non sense

#

IP laws are silly, but if what ever you write never sees the light of day it's fine

obtuse night
#

another question, if you upload to private github repo, does that mean github has the rights to it?

shy helm
#

No

elder ivy
#

I'd probably self host just to be safe. I mean there has been breaches and what not from online hosts from time to time

#

if it's proprietary knowledge etc

obtuse night
#

another question, if you upload to private github repo, does that mean github has the rights to it?
@obtuse night im not worried about it, its just something i thought of just then

elder ivy
#

github doesn't ever own the rights to the stuff you upload as far as I know

shy helm
#

Using GitHub you basically only give them the rights they need to share your content per. your settings

#

I.E. if you make it public you give them the right to reproduce your code

#

As required for them to actually display it to someone else

#

TOS dictates they assert no right beyond what’s required for them to perform their service to you

dense marten
#

Im having an issue right now where I'm trying to serve an image from a php file and when I do

<img src="localhost:80/path/to/my/serve.php?picture_id=1234567890"/>

it doesn't show the image but if I put localhost:80/path/to/my/serve.php?picture_id=1234567890 in my browser directly it does load an image
any ideas?

foggy ginkgo
#

@dense marten You should add the protocol before the domain. Since this domain is localhost, "http://" or "//" would both work in your case.

dense marten
#

Thanks! I can't believe I overlooked that

dense marten
#

I have another question now, so now that I have it working as http://localhost:80/path/to/my/serve.php?picture_id=1234567890 is there a way for me to configure Apaches rewrite engine so that while I have http://localhost:80/path/to/my/serve.php?picture_id=1234567890 as my img src when you right click on the image to get image url it says that it's actually http://localhost:80/images/1234567890

#

The reason why is because I added token (it's what document.cookie returns) as a parameter to the url to do permission checks on if a user can view an image and I don't think I want to expose the token in the URL

foggy ginkgo
#

You would need an Apache rewrite rule. Here is a candidate for your query:

RewriteEngine On
RewriteRule ^/images/([0-9]*)$ /path/to/my/serve.php?picture_id=$1 [L]
dense marten
#

What I tried was

RewriteEngine on
RewriteRule ^path/to/serve.php?Reason=GetImages=picture_id=$1&token=$2 images/$1 [NC]

did I get it backwards lol

foggy ginkgo
#

You were also missing the (capture regions) of the regex. You were on the right path with your research, though πŸ™‚

sharp parcel
#

I don't know if this breaks #6 or #16, but i updated to iOS 14 and my banking app broke (intentionally, they say beta versions are insecure). I'm gonna try to reverse-engineer the app to disable that check. Any pointers maybe?

#

(pointers. hehe)

vast echo
#

You might be forfeiting certain insurances they have against theft if you do that

#

At least I suspect that would be the case in Canada

vernal marsh
#

Hi.. I was wondering is it possible to dispatch multiple trained ML models for multiple frames at once in GPU... I am trying to anaylze a video of an input I already have model decided I just need to know if there is any way possible to not call the model per frame at a time

elder ivy
#

you might get your online banking privileges revoked. or easier yet they just kick you out as a client

obtuse night
#

I have a .net core worker service, and am wanting to add a single api endpoint to it without converting it all over to asp.net. Is there a way of doing this?

olive cedar
#
#include <math.h>
#include <stdlib.h>
void ispF();
ο»Ώ
int main(){
   
   double g; 
   double m1; 
   double m2;
   double DeltaV;
   ispF();
   
   return(0);
}
ο»Ώ
void ispF(){
    float isp;
    printf("Enter the isp: ");
    scanf("%f ", &isp);
    printf("%f", isp);
    
}```   everything works fine till after this line ```scanf("%f ", &isp);```
#

c btw

#

ive also had difficulties when using doubles. it wuldn't print anything or scan it. i was using the %lf tag

#

oof

#

it was the space at the end heck

dim wagon
#

hey guys

foggy ginkgo
#

Hello @dim wagon!

nocturne galleon
#

I have a WPF program that creates a new thread to run a time consuming function that would cause the UI thread to hang and crash. I need to pass a value from the UI to this thread but it gives the error in the screenshot

dim wagon
#

ik

supple abyss
#

hi guys, I have a quite simple question probably: in C++, what data type do normal numbers have? Like for example "arr[3];", what data type is the 3? a size_t or an int or something else?

shy helm
#

It depends haha

#

IIRC it's implementation defined

#

when you have a 3 there in your code, it's a constant though, it's not really stored as a variable

#

but for example, if you have const int n = 5, it's likely stored as an int constant in the read-only part of the compiled output

worthy dirge
#

That 3 is a int literal, and then implicitly converted to pointer arithmetics for array indexing

#

For your own class tho, you can define operator[] to accept any type

#

Not sure about literal type? You can do std::cout<<typeid(3).name();

nocturne galleon
#

anyone know how to make P2P connections in unity?

#

ideally with steamworks but if not i dont mind

nocturne crypt
#

@supple abyss if you're referring to the index of an array, it depends on the arcitecture

#

for example on x86_64 on a POSIX compliant system it'll be unsigned long, on an arduino it'll be a unsigned short (int in arduino is a 16 bit number :/)

#

on Windows, it's defined in words which may or may not be unsigned long on an x86_64 system

#

various 64 bit ARM implementations usually side with unsigned long

deep scarab
#

I have a WPF program that creates a new thread to run a time consuming function that would cause the UI thread to hang and crash. I need to pass a value from the UI to this thread but it gives the error in the screenshot
@nocturne galleon not sure about wpf, but in winforms i use Invoke() when trying to modify the UI

#

what are you trying to pass from the UI?

wanton marsh
#

Anyone understand what amazons honey code is exactly? Seems like visual studio but more simple? Idk

#

Is it basically like VS and android studio?

foggy ginkgo
nocturne galleon
#

@deep scarab I'm not trying to set values or anything in the UI, I'm trying to retrieve a value from it to use in the other thread, but it wont let me

deep scarab
#

@nocturne galleon do you have some code?

nocturne galleon
#

for reasons I wont go into, none that I can share, but basically I want to pass TextBox.Text as a string argument to a function that I am running in a separate thread