#development
1 messages Β· Page 48 of 1
@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. π
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?
also gitlab can be selfhosted, using docker
I have my own gitlab, for ci stuff
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
windows
u need a mdsn membership to sign ur code with a dev signature so hope u got deep pockets
how much does it cost?
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?
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
does anyone know of a html5 player that can play back videos higher than 60 fps?
@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.
i wouldn't think so as vimeo has a high refresh rate player
@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)
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
@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...
@tidal tusk you can't detect such things in browser
Even with content negotiation ?
But the browser can do that, and restrict playback if needed.
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.
there is literally no browser API for refresh rate information
you can only roughly measure with script like http://jsfiddle.net/rBGPk/
Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
which prints out 143/144 fps for my 144Hz monitor
sadly it prints the same on my 60Hz monitor
Prints 59 on my 60 Hz monitor.
well it might measure the primary monitor, that is another possibility
Or the one with the highest refresh rate?
but in any case, this is browser performance measurement and not querying the specs of the actual hardware
Yup. Can be influenced by a slow or busy CPU....
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
Exactly.
for example https://www.testufo.com/refreshrate - look at how often it says stutter warning
and that is with just discord and twitch stream running on other monitor π
prints 144 fps on my monitor
yes, but again, if you do something on your PC, it will show framerate drops often
there's a reason youtube is only 60 hz
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.
there is literally no browser API for refresh rate information
@cloud knot then how does ufotest work?
@tidal tusk see the code before that. it tries to pain web animation frames and measures how much can it paint
Seems like the video plays about 40 frames per sec, and drops the remaining 200.
My phone has a 90hz refresh rate so that is accurate
@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)
I'm more php than js
lol ufo test has obfuscated code
But you see what I mean right
If ufo test can determine it why can't I take the value it returns and show the corresponding video file
because they've taken a lot of effort to estimate fps
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
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
oh this site does a MUCH better deobfuscation job https://beautifier.io/
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
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
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?
have not
backstory fyi I've been an admin of another discord for a while and we're getting pretty serious with membership
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
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...
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.
very cool
Having an Apple branded computer, my responses may vary from yours. There is one request that jumps out in that mess: https://hls.ted.com/talks/62866.m3u8?qr
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.
in other words, HLS.
YES! You can even find the spec online on the IETF website if you feel bored someday.
Hls is something I'm new to
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.
But I like how it's adaptive
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.
"Dropped 22 frames of 1269. Effective playback rate was 249.4 fps"
I'm using a 144hz monitor
also doesn't work in Firefox
@ashen sky "Error 403 - This web app is stopped."
@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. π
Dropped 19 frames of 1269. Effective playback rate was 250 fps (on a 144Hz monitor)
can i get some help with some python?
There are probably some people who can help. Post your question and if anyone has an answer I'm sure they'll respond
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 π
and in doubt, there is an python humble bundle right now π
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
i tried making a calculator
@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
hello
what do you think is the best terminal emulator out of these;
Alacritty
kitty
GNOME Terminal
Tilix
Terminator
Yakuake
Konsole
Anyone know what form this date is in? Date(838854000000) Getting it from an api and i dont know what it is
Looks like the number of milliseconds since some date. A windows API by any chance?
its literally a static json file linked to a nodejs api used from college. so i dont know
Do you know what time it's supposed to represent?
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"
},
Does this sound reasonable?
could be. Thanks. Is that a common type?
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. π
If you are using javascript to manipulate it, this should do the trick.
Thank you
@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
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.
Thanks @nocturne galleon That explains alot of the stuff I was confused about
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 Β―\_(γ)_/Β―
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)
anyone here fam
hot
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.
@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)?
@nimble drum sent you a dm
@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
How would the code be? sorry a lot ot questions im just a beginner lol
@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
thank you π
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
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?
@lyric remnant CSS transformations
and clip paths and so on
@lyric remnant like https://stackoverflow.com/questions/10568334/adjacent-divs-with-angled-borders
Ty ty
holly beeep https://github.com/manojVivek/responsively-app
look at that
hm, windows 10 detects it as containing trojan, but i doubt that. will watch his response tho
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 π
Try this @fast plover https://stackoverflow.com/questions/11660710/css-transition-fade-in
For fadeout, just swap the opacity values.
Ah okay thanks I will do
I got a new domain, can someone send me a test email to see if it works: nick@nickevans.dev
looks like you're good to go, as I see google mx records are being returned for your domain
https://mxtoolbox.com/SuperTool.aspx?action=mx%3Anickevans.dev&run=toolpage
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.
what is a protocool even?
leeme pull up a translation 
what
it can't translate to Arabic
wtf is wrong with edge
its the same word without a definition
I am learning so much
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
I found this book it says i will teach me the history of pc science and stuff like that . its 500$ tho I got it cracked 
sata and NvME 
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
hello
Does this happen to you.
- Start a project (or tutorial)
- Work on it for some days
- Get bored
- 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 π
@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.
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
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.
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
@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
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.
Still on my website ( I am not sure if I can post links here)
if u need motivation, dont do it
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
You could also work on smaller projects that you could complete before you lose interest.
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.
can someone explain what this is actually doing? if I'm not mistaken c will always be > 0 and cause an unending loop?
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
huh
but wouldn't it be 0 to begin with since thats the index where fs.Read starts?
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
hmmm
but when it goes back to check the condition, wouldn't it just read the file again?
no because the file stream position will be updated on every read
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?
when it's called the first time, it'll read the entire stream into
bufand setctobuf.Length, and on the second loop, it's already read the entire stream sobufwon't be modified andcwill 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, thencwill equal 10, 10, 4, then 0, and you'll enter the loop 3 times.
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
You want to "bind" the parameter
What you're doing is quite unsafe
I would just follow the guides you find and use PDO
Pretty much: By setting $sorting to βwhatever; DROP TABLE cijfers β
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
I just gave you an example
The example given is perfect
isnt drop table for deleting tables?
yeah
Im trying to sort the
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;"
How would someone enter Drop table into this?
You dont?
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
Itβs probably just an url-encoded or some form of Post request
haha fair enough
Your SQL should work then the way it's written, no?
What issue are you encountering?
Mysqli should have binding though
^ that too
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.'";```
$sql = "SELECT * FROM cijfers ORDER BY " . $Sorting;
That should work no?
Or
$sql = "SELECT * FROM cijfers ORDER BY {$Sorting}";
Using {$sorting} it has stopped giving errors, but its not changing
What does your query result as? Can you output it?
I forgot to do ORDER BY Date
I don't speak the language you're using but
the ORDER BY <blank> needs to be a column name
Right. You end up doing order by DESC or ASC
Oh does $Get output a boolean
But you need the column name
Yeh i changed that and now it shows
$sql = "SELECT * FROM cijfers ORDER BY Datum {$Sorting}"; this is what i have rn
Oh wait i realise whats happening
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?
Nah it just depends on the name of the field
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
The name of the submit button doesn't matter...
You care about the field name of the multi-selector
Aight
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
In SQL, there are no quotes around the sort direction. The syntax is SORT field [ASC|DESC].
Also, SQL injection potential here.
Its a school assingment so injection isnt a concern, but thanks for the tip @foggy ginkgo
Probably happens because people don't know about https://xkcd.com/327/
What wordpress directories are not save being visible to the public? eg. is wp-includes and wp-content/uploads ok?
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
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.
Correct, Iβm Dutch @nocturne galleon
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
How does your solution do that?
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 π
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?"
you buy an expensive certificate, then you sign it with it
by expensive we talk about few hundred dollars per year
Hello ALL
anyone good with python error getitem
trying to get an exploit working for hackthebox box
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");```
you want && not ||
ah ok, i figured it was smth like that
-> currently you're checking if input is not encryption or if it is not 1, either of them always has to be true.
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 ==
im trying to code a relatively simple program in python for a s/o any ideas? something cute i suppose
a nested if story is pretty cool imo
like the walking dead game they did? you choose how the game ends, if im catching ur drift
yeah
interesting, idk if i wanna devote that kinda time to her :p
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
Should use a set instead
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
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
Hasmaps are dictionaries. They map from a key to a value. Array use numbers (index) as keys.
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
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
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 π
The point of the program is to turn on and off a small server
Without really knowing the whole picture of why you need what Modco: a simple Shell-script should be able to do what you want.
Way too much time spent on this but I have working bidirectional message support on my obs-midi plugin. https://www.youtube.com/playlist?list=PLnSyygUkQ4DwftjEoA7K4ZfBkRgeY6B_N
Any ideas how I can get
Cpu, gpu, memory:
Temps, usage
With node js on windows?
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
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)```
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
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
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
?
no
turtle2 = Turtle()
note the capital T
the import can stay as your originally had it, my apologies
no worries π
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');
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
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.
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",
},...
]
}
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?
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.
Hi everyone. Anyone good in C and willing to lend a helping hand (only few small questions)?
Hi, does anybody programming in assembly in windows os?
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
I have some questions about windows dlls. Normally, I am using java. Learning assembly for hobby
I would not recommend programming assembly in windows, try using a development board more optimized for it
Nah it needs to actually proccess all the math and stuff too
@shy helm thank you, that is very helpful
lol is that "do my homework" kind of question from itachi
can someone help me make responsive a D3.js generated SVG map?
there should be tons of tutorials online for that
@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
idk lol
that would have been 2011 - 2012 ish
My teacher just posted this on google classroom
oh... yeah it was definitely in my curriculum, same question. idt i have the code laying around anymore tho
very easy exercise anyway tbh
check if you do, that'd be clutch lmfao I have lots of other assignments
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 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
In those homework assignments they typically want you to use formatted strings
@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
@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
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?
Does it work when you run it?
No
Then I would say it probably won't work.
I don't understand the issue
Me either. It's Java; my most hated language.
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?
that only happens when you mix formatted and unformatted input
e.g. nextInt() followed by a nextLine() will cause the nextLine() to skip
So the issue seems different from C/C++ then, I remember it as happening all the time there. π
Anyway, when using this online compiler/executer https://www.jdoodle.com/online-java-compiler/ The code works fine..
Except the indentation of item 4 is a little off..
@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
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.
This is what I have so far
Also instead of getting someone to input the date, it's possible to just read it from the system, whenever needed.
How could I do that?
I think java has a date/DateTime class, that can be used. But you'll need to check the documentation for details on how.
Thanks
you just store them as doubles instead of ints
and to add the $ in front, just change it in the printf
This beginner Java tutorial describes fundamentals of programming in the Java programming language
lol.
programming languages are nice to compare and all but you end up not having a choice at times
Hey all! Could someone give me some feedback on my webapp? What can I do better? https://nanonews.app/
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.
@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.
If anyone else has anything pleasee ping me. I'd love to hear what others think.
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
you can just end it with 3 dots (...) it looks smoother
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.
oh okay π
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?
yes, but only if the algorithm is good
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?
@nocturne galleon i did and i am not really convinced
@balmy loom How could it be improved?
I figured it out!
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
anyone familiar with natural cubic splines here π
is anyone familiar with winapi?
@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.
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.
oh i never seen this channel
Anyone offhand know if github pages lets you use PHP? I thought originally no but i'm not sure
@gusty girder not really a recursive solution though lol
Perhaps my problem was not ever recursive in nature in the first place Λ^
I mean you can solve it using recursion. guess that was a red herring
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.
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
All problems that are solvable recursively are solvable iteratively, and vice-versa
it's may possible to write but not elegant
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.
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
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
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.
It works tho Λ^ (but fucks up when I try to access nested arrays)
Recursion should give you a very easy solution for that
I mean there's some weird parts to this structure you realize @gusty girder
key12 is repeated three times for instance
it's on a different nested level though, json specs allows for it
and it's not obvious what you actually want at the top
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
}
yes of course it does. but how flat do you want it
I mean you can construct unique keys recursively downward too
No I don't want it flat. I WANT it nested. My SOURCE is flat The table on the left. It's flat.
oh lol
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
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
Thanks, I'll try it. I basically just use the innerText values from each cell (or values in case it's an input)
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
json : Map What does this do?
it's pseudo code
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
yeah I was gonna say this is just iterating straight down a flat table and then creating your nested object along the way
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.
How familiar are you with recursion?
Not very much at all. I pretty much used it for the first time ever about 3 weeks ago
Ah, you may have a hard time adopting my pseudo to work for an initial flat structure then
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
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
assuming that it's nested by increase in level strictly (ie that the parent is the previous level - 1 parent)
That wouldn't work, sometimes a row is level 2 or 3, and the next row is back to 0
that's why you should use the keys instead of the level
I can get level from the keys, just comme-delimited-array.pop().length() but I get what you're saying.
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
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
yeah, the issue is you can't figure out where you are in the hierarchy using just level data, you need the keys too
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"
oof
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
yea no problem (narrator: but actually it was a problem, but I'll look into it)
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
well isn't 0,1,2 technically the correct keys for an array?
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
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
I mean the other part is why is your UI different than the structure used to represent it
How would you representa json editorstructured data in html without a table?
lol I mean you can blindly assume that intermediate levels exist
and blindly create keys/levels along the way
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
I mean it's also a matter of reordering, collapsing etc. nested html makes that a lot easier
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
example
so that's what I went with - why reinvent the wheel.
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
Hmm, I'll look into it, thank you for the help π
just use divs for everything π
there's more than one way to beat a dead horse of course
anybody of android devs here?
I know some xamarin, but my knowledge is pretty basic
I want to get hang of android deving in kotlin
Hi I have a question. Will a reaction collector stop if the message the reaction collector was on is deleted?
In discordjs
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.
What region are you in?
United States, Northeast
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
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.
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
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
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?
Yes, I'll need quite a bit of content and user protection.
ahh
I mean ultimately I want the frontend to be as simple as possible, but the backend I want sturdy and secure and efficient
Yeah fair enough
TBH even if you hire a dev they'll probably end up using a backend CMS
Yeah, I realize thats kinda the norm these days :/
Full custom just isn't really worth it now a days
but I'm hoping I can find a savant to work alongside ahahah
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
I'm not completely discounting using frameworks, I just want to make sure the site's content and users are well protected.
finding new people to maintain it is a PITA tpp
WordPress has gotten farrr better than it used to be
not perfect but
If somebody can convince me that their CMS and framework is secure and efficient I'd be willing to go that route.
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
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!
Thanks π security and authenticity is going to be a huge point of interest for me and the business
@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?
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.
does anyone know a good http server vulnerability/security scanner site?
@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.
Dude...that is an amazing amount of useful information for me. I greatly appreciate it. I'll look into all of these things.
β€οΈ
Keep in mind AWS is veryyyy expensive for bandwidth
There's a reason why we don't use it for LTT
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.
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.
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
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.
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...
depends if you want common libraries being cached or not across other websites too
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
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.
Actually they use AWS largely
they do have custom cacheing servers that they colocate with local ISPs though to improve performance/alleviate load, etc
Ah interesting!
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
Do you close the connection after each transmission?
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. π
I think if the buffer is too small the OS sends the data in small packets
If it possible for your application to just chop the data into smaller chunks, and reassemble on reception?
well, it would be difficult
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?
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
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.
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
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?
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
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?
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)
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?
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
(demo with 2 clients)
RTP is basis for basicly every video and audio streaming application.
Here's a good place to start. https://en.wikipedia.org/wiki/Real-time_Transport_Protocol
The Real-time Transport Protocol (RTP) is a network protocol for delivering audio and video over IP networks. RTP is used in communication and entertainment systems that involve streaming media, such as telephony, video teleconference applications including WebRTC, television ...
Thanks for your help and info!
But for RTP my experience is more on the user part. (Work at a VoIP provider)
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?
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..
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?
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.
RTSP makes sense to have implemented as well. π
Yes, but I have a raw buffer of pixels not a JPEG frame, or a MPEG chunk
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?
it just consumes 50% of CPU time, with 1 cient and 2
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
But should still be able to handle 320x240 with less CPU.
Totally, but I do a while (cond) to wait till the new camera frame is in the buffer
Don't the capture driver have events for that purpose?
nop, is C style
you call a function to start the image capture, and polled waiting till the pixels are available in the buffer
Well, I suppose you should see what you can do to optimize performance, as that might be the entire problem.
Hmm
Eg. it usually takes 10 ms for the image to be ready, make the loop sleep for 10 ms before checking.
Ok
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.
while (isCaptureDone(device) == 0) { std::this_thread::sleep_for(std::chrono::milliseconds(10)); }
oh thats a lot less CPU time
Something like that.. But if you know how long it takes for the frame to be ready, set the time to about that.
now is 8-10%
Hehe.. I've made the same mistake before. That was C# though...
Same
Also, while you're in the loop, network traffic is not processed..
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
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?
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
Multi threading.. Ouch.. π
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);
}
I don't think it's entirely wrong.. But threads are usually causing a lot of fun problems. π
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
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. )
I'm not profresional with weird std mutex async and futures so, I don't really know how to signal the threads
Neither am I, I mainly use PHP, and recently python.. Quite different. π
And hardly ever with threads.
So it seems like at 1fps it runs great! But at what cost, 1fps
I'm going to wait just 100ms
Try increasing the rate, until it fails..
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
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)
hahah
I have found that when it fails, the client recieves actually more data than expected
(And sometimes less)
Perhaps you get two frames in one packet?
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?
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.
probably
now with the sleep_for() is much better, even with 3 clients
but the framerate is reduced
Yeah. But I suppose for surveilence cameras a framerate between 5 and 10 would be good enough.
does anybody know why I get this error?
require is a function defined in a Node context. This is a browser context, correct?
I guess yeah
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
Here is their tutorial for your first application: https://www.electronjs.org/docs/tutorial/first-app
Are you running Electron from your command line ? What command are you using?
wut
you don't require electron from inside the web part of the app
you've got it backwards
Yup, what they said.

UDP question: do every sendto need to be followed by recvfrom?
no
That makes sense
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.
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?>
when i put semi colons after header() i get another error with unepected ;
ohhhh thanks you!!
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.
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.
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
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
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.
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
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.
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
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.
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 we shall see about the external IP and egress shortly for free
I hear they want to start charging
I think they only charge for static IPs?
hmm they were in the process of changing some stuff
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.
NGINX
how can i add a directory to my main domain like βexample.com/thingsβ if the βthingsβ folder is outside β/var/www/htmlβ ?
not sure, but wouldn't a symlink work?
@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
Confirmed by doc : https://docs.nginx.com/nginx/admin-guide/web-server/serving-static-content/
symlinks would work if you have it enabled in nginx (iirc)
This probably sounds lame to most of you here but: I'm working on a bot in js and it's getting cool
have you tried applying fire
you either ASM or you go home
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
can anyone get on a call wit me for like 5m to help with pip commands in cmd and downloading python wheel files???
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 π
yeah but i realised after ading the missing ) that that was causing my semicolon to cause an error ^^
just be glad this doesn't exist for your language: https://en.wikibooks.org/wiki/JavaScript/Automatic_semicolon_insertion
anyone here good with C#
anyone who know how i can simulate raw input of a mouse in c++?
anybody want to cringe on my quadruble boot?
Does anybody know how to hide a mouse cursor in javascript or java
Iβm not the best XD
check w3schools
here's a tutorial https://www.geeksforgeeks.org/hide-the-cursor-in-a-webpage-using-css-and-javascript/ it depends on what you're doing though
lol that looks like how to confuse old grandmas
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)
try in #networking @drowsy knoll
OpenAI API released
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
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
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
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)
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
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
ok, thanks. Its really just something to show off what i know, and fill in gaps in my knowledge
depends which country you're in
Using company time or company resources to build something is where you get into the "they might own your work"
US/Canada for me
fwiw I don't have work hours
I would imagine most common law countries would have similar laws
Even if you're on a salary you have "work hours" generally
I mean generally speaking you also sign a non-compete to work at software companies
... which doesn't cover personal learning projects?
it pretty much covers way too much
this all sounds like if you were going to market with your own project, so i think i'll be fine
I've signed 4 different non-competes for software jobs in the past few year--none of them cover personal learning projects
I mean going to market and uploading to github are two different things too lol
Heck, I've yet to hear any of my friends complain that their noncompetes cover personal projects
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
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
another question, if you upload to private github repo, does that mean github has the rights to it?
No
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
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
github doesn't ever own the rights to the stuff you upload as far as I know
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
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?
@dense marten You should add the protocol before the domain. Since this domain is localhost, "http://" or "//" would both work in your case.
Thanks! I can't believe I overlooked that
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
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]
Documentation: http://httpd.apache.org/docs/current/mod/mod_rewrite.html
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
You were also missing the (capture regions) of the regex. You were on the right path with your research, though π
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)
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
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
you might get your online banking privileges revoked. or easier yet they just kick you out as a client
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?
#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
hey guys
Hello @dim wagon!
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
ik
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?
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
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();
anyone know how to make P2P connections in unity?
ideally with steamworks but if not i dont mind
@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
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 useInvoke()when trying to modify the UI
what are you trying to pass from the UI?
Anyone understand what amazons honey code is exactly? Seems like visual studio but more simple? Idk
Is it basically like VS and android studio?
It is a no-code software editor that is similar to Retool. There is a very interesting discussion going on on Hacker News about Amazon Honeycode: https://news.ycombinator.com/item?id=23633110
Also the "equivalent" service for VS would be AWS Cloud9: https://aws.amazon.com/cloud9/
@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
@nocturne galleon do you have some code?
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