public static void login(Request request, Response response) {
StringBuilder sb = new StringBuilder();
for (String qp : request.queryParams()) {
sb.append("&").append(qp).append("=").append(request.queryParams(qp));
}
if (sb.length() > 0) {
sb.replace(0, 1, "?");
}
response.redirect("/login?target=" + request.pathInfo() + "&qp=" + Base64Coder.encodeString(sb.toString()));
}
#development
1 messages · Page 75 of 1
yeaaa, the "after" target
"You also get all the benefits of running your application on the JVM, where libraries aren’t deprecated every day."
lol, the quote on spark website
i feel like we do have way too many js libraries
oh, i see your knockturn is spark
cool eh?

@hollow basalt https://i.imgur.com/W00Aq4r.png
currently..
package com.knockturnmc.panel.mvc;
public enum RequestMethod {
GET, POST
}
This is all it supports
for simple web stuff, this is good 'nuf
@hollow basalt I also wrote some other helper functions
like this:
@GET
@Path("minecraft")
@RequiresLogin
public ModelAndView getMinecraftServerStatus(Request request, Response response) {
Map<String, Object> models = new HashMap<>();
ServiceAPIClient client = session(request).getClient();
ServerInfo info = client.getServerInfo(request.queryParams("server"));
models.put("server", info);
models.put("page", "Server Information");
models.put("page_desc", info.getName());
return new ModelAndView(models, "status/minecraft");
}
if a method has @RequiresLogin
inside the body, you can use session(request)
and then you can do session(request).getClient()
which gives you a handle to the backend API
which has session tokens and such
I wrote this with the intention to write a minimalists' webservice
and I think, I can't get my controllers any more "compact" than this
<div class="box-body">
<dl class="dl-horizontal">
<!-- Information -->
<dt>Server Name</dt>
<dd>{{ server.name}}</dd>
<dt>Minecraft Version</dt>
<dd>{{ server.minecraftVersion }}</dd>
<dt>Bukkit Version</dt>
<dd>{{ server.bukkitVersion }}</dd>
<dt>Build ID</dt>
<dd>{{ server.buildID }}</dd>
<dt>Uptime</dt>
<dd>{{formatTimeElapsed server.uptimeMinecraft }}</dd>
<dt>Total Memory</dt>
<dd>{{convertToMegaBytes server.maxMemoryBytes}}MB</dd>
</dl>

@hollow basalt correction. lightweight templating
still templating
those fields like server.minecraftVersion
@hollow basalt this is why I wrote a minimalists webservice
because I just needed a templating layer
@hollow basalt https://handlebarsjs.com/
so you wrote the templating?
you used handlebars
Yep.
i see isee
/**
* Compiles and returns a final HTML DOM.
*
* @return String value containing a HTML DOM.
*/
@Override
public String render(ModelAndView modelAndView) {
if (modelAndView == null) {
return null;
}
String viewName = modelAndView.getViewName();
try {
Template template = handlebars.compile(viewName);
return template.apply(modelAndView.getModel());
} catch (IOException e) {
logger.debug("Failed to render object", e);
throw new RuntimeException(e);
}
}
i see, handlebars is available as java library?
Thats the "glue" code I wrote
You need only this file
@hollow basalt this class expects you to use spark though.
it implements this interface:
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package spark;
public abstract class TemplateEngine {
public TemplateEngine() {
}
public String render(Object object) {
ModelAndView modelAndView = (ModelAndView)object;
return this.render(modelAndView);
}
public ModelAndView modelAndView(Object model, String viewName) {
return new ModelAndView(model, viewName);
}
public abstract String render(ModelAndView var1);
}
Spark has an interface to add your own template engine
Spark has an interface to add your own template engine
I usually like libraries that are lightweight, or like simple wrapper that uses standard libraries
this is why I don't like nodejs ecosystem that much
you want a simple server?
congrats now you have a cli-coloring library
yea, the ng ptsd
i do like react though
or vue
over angular
or the library you recommded
yea, you wanna know where I used it?
yea, different philosophies
I'm working on my authentication system, is this a good idea or has it some kind of breach that I didn't think of (probably, it does):
login -> client sends mail, password etc he wants to login with
if login successful -> server responds with token and a successful login
then: client encrypts the current ISO date with the token and sends date and hash back
--> server stores hash and token, client stores date and token
re-login (page reload)-> client encrypts the stored date with the stored token and sends the hash
--> server checks if the hash is matching
``` In theory, this should be secure unless somebody reads out the stored date and token, right?
maybe instead of the date, I could use the mail address or whatever login method is used
This takes care of handling credentials and generating tokens
use third party auth?
Tokens can then be used to identify a person, with one or more services.
@hollow basalt nah
i do like JWT
You request a token, to make content requests with
try using that
OAuth2 is somewhat standardized
so it will work with a wide range of libraries and tools
JWT is popular, so libraries are everywhere
@nocturne galleon the idea is that, only the auth service ever handles user credentials
the rest of the system uses the token, to ask the OAuth provider if it is a valid token
Actual services themselves, never see the user password
never store plain password
that too
that is just yikes
of course I'd hash it
ok thank you
use md5
@hollow basalt OUT
so rainbow table would be fun
OUT . NOW.

what does the cost part mean?
but the reason I wanted to use this is that for example if you login on the website, I don't want you to be able to read out your token and use it to spam the api
But I didn't realise that you could also just read out the date
dumb me
rate limit?
makes sense
basically, if you want such guards. do it in the server
there's only so much you can do in the client side
@warm sleet I looked more into it and the Scope stuff seems kinda unnecessary for my use, so OAuth2 would just give me an id system, basically?
Couldn't I just use "my own" ids ?
@nocturne galleon oauth can run within your own application context
its usually just a library you import
it contains an auth module, token store and token verifier
if you do not require such functionality, yeah. you could generate your own tokens
but then you have to write your own token store
expiration mechanism, etc
I won't use it for permissions like Discord bots for example, just for re-login
<user,password> generates a <token, expirationtime, renewaltoken>
token can be used, until it expires
you can use the renewaltoken to renew your token
token duration, you can specify yourself
20 minutes, 1 hour, 1 day, doesn't really matter for you right now
tokens have to expire, otherwise its not secure
Has someone experience with webflow? Can you recommend it?
Maybe you could try giving a little more info, so others can help you? Also VPN, so you can also try in #networking
more details ?
Can someone help me with this? I’m trying to make an os
It tells me the files there but doesn’t detect it when it’s ran
And apparently this is wrong too
you're trying to make an os... on something that runs in user space... and are struggling filesystem issues handled by the VM?
hmmmmmm
Well not exactly an os, I’m trying to get an idea of how it would work by making it run in a terminal
The User folder does exist
But it’s not detected when the code is ran
if setup = 1 ... you're doing an assignment operation here, not an equality test
==
You're welcome 🙂 ... I recommend looking at an intro to python course if you're really interested. There are tons out there these days that are 100% free and really well writen
The directory you're trying to make a file in doesn't exist. The path it's looking at is relative to where the script is being run from. In PyCharm that is probably the same folder your code is in by default. So you need to create the User directory in there as well (or point it at another folder that does exist), then try to write the files.
It's looking inside the KazooOS folder for the User folder, because that's where the script is running from (the project root in PyCharm). You could either move the user folder inside the kazooos folder, or change the path to something like ../User/.
So could there be a way to make python create a file for me and store text in that file?
yes
How?
google, it's literally such a basic thing
it's built into python
googleing is part of coding
So then this is correct, I just should’ve used w+ instead of just w
mode x will create a file
although mode w should create a new file if it doesn't exist
@umbral saffron the issue is that you are using a absoulute path
you want a relative path
to do a relative path to the python file, you do "./file"
if you want like this
I think you can do ../User/file.txt
So I should use x?
Ohh ok ty
no just use w
the .. basically tells it to go up a directory
Ah
So if I’m trying to create a new .txt file under the User folder and add text to it
I’m using w+
Right?
If I did open(“User/example”, “w+”) that would create a new file correct?
Because all I want is to use a txt file to store data
if it doesn't exist
if it does, then it will create a new
idk exactly what + does
That’s what I want
yeah but I still don't understand the point of +
the + part doesn't create a new file
In Python, there is no need for importing external library for file handling. Learn how to create, open, append, read, Read line by line, and Write,
What I found was doing w+ creates the file
no
w does
- means "open for updating (reading and writing)"
idk what that means tho
Well when I just did w, it said there’s no file or directory
So I assumed that meant it was trying to open an already existing file
because it can't find the User directory
ok
just do this ../User/file.txt
with w
let me try
@umbral saffron works fine for me
literally just a = open('../User/test.txt', 'w')
file structure is just
it created test.txt
well then if I do that I can't do py as f: to add to the file
yes you can
that's just a different syntax, with async
just to double check I will do it with async syntax
@umbral saffron works just fine
something on your end is really messed up
print(test)
Oh that makes sense
Pythons weird on my end a lot
I could never get speech recognition to work either
just use vscode
don't need some ide
and learn cli
it's as simple as python3 ./test.py for me
idk how it's on macos
but python is python 2.x
and python3 is python 3.x
on ubuntu
Ok thanks
Has anyone here done any dev work for AWS DeepRacer? Work just sent out an invite for us to participate in it next month, thinking about giving it a go.
Roughly the same
For python, I guess its okay, but for other langauges, and ide is really helpful
It saves a lot of time too
yes and no, I argue that for begginers an IDE hides a lot of the "complexity"
so for beginners it's beneficial to try without one
Yeah, it hides whats going on behind the scenes
But once you get a good grasp of how it works, its usually worth it to use one
yeah
so, im making a js discord bot, all the commands work besides the mute command, help
name: 'mute',
description: "mutes lmao",
execute(message, args){
const target = message.mentions.users.first();
if(target){
let mainRole = message.guild.roles.cache.find(role => role.name === 'Community');
let muteRole = message.guild.roles.cache.find(role => role.name === 'muted');
let memberTarget = message.guild.members.chache.get(taget.id);
memberTarget.roles.remove(mainRole.id);
memberTarget.roles.add(muteRole.id);
message.channel.send('<@${memberTarget.user.id}> has been muted');
} else{
message.channel.send('Cant find that member');
}
}
}```
why in spoiler...
forgot how to codeblock
there u go
did you import it
you did module.exports
that exports the object
you need to import it somewhere else
for discord.js to actually see it
show full code
because you need to import this object somewhere
oof
VS for js
ohh your doing it like that
use the debugger or console.log the value of client.commands
yea watched a vid on yt
sry im an idiot what does that mean
idk how to use a debugger in VS, or if it even has one
VSCode is better for this stuff
but just in line 24 you can add
console.log(client.commands)
this will log the contents of client.commands
to the terminal
Pls mark where that should be
was in the tutorial
well it was a bad tutorial then
xp
can you help me troubleshoot tho
when i do a command it does nothing
and in console it also sayss nothing
did you do what I said
add a console.log
yes
and post the output
did i fuck up?
you need to but put client.commands.get('mute').execute(message, args)
SHIT
thanks
imma test it brb
@midnight wind since its in its own server rn it dosent do anything
yeah, I'm making a bot too rn
yeah but it's only me, it's basically custom for some space server I'm in
sure
since i can tmute myself
Is anyone here able to help me with an assignment involving jQuery and PHP? I have php written and I need to submit and get data using jQuery.
If you are just looking to use ajax to call a backend function, you can find info on that here: https://api.jquery.com/jquery.post/ and https://api.jquery.com/jquery.get/. Both should be pretty easy to use / understand. If you have specific questions feel free to ask them here and someone will probably help.
guys can u guys give some ideas for some beginner projects with python
thx
I can join too
nah
interesting
never thought about it as a project
@midnight wind I just deleted visual studio code from my machine
Each update is ~80MB, and it gets like 3 updates/week
and microsoft's repository is so slow, it downloads @ 250KB/s
running apt upgrade takes like 5 minutes, because of visual studio code
garbage microsoft repositories
So what do you use now?
Get:3 http://packages.microsoft.com/repos/code stable/main amd64 code amd64 1.56.2-1620838498 [76.4 MB]
64% [3 code 3,553 kB/76.4 MB 5%] 117 kB/s 10min 24s
10 minutes lol
@nocturne galleon just IDEA
Ah alr
@nocturne galleon this is what I hate about microsoft apps
you get 1 package
and its app + libraries + bunch of media
and if it gets updated
instead of updating just the binary (couple MB)
it updates the entire package and redownloads everything
static linking and electronjs, curse you both.
fine for me...
Is that unique to the .deb distribution? VS Code self-updates pretty quickly on my Mac.
Its just that Microsoft's servers are slow af
I have used VS code for years now, never an issue with update speeds or updates in general :/
@rotund harness downloading it through their regular debian repositories yields ~120KB/s download
and its kinda annoying, considering it is updated like 3x per week
and each time, slowing down package installation
cus its like 80MB
Yeah I could see how that sucks, I use a mac so don't have that issue :/
@rotund harness imagine doing a brew update, and that taking 15 minutes xD
on a 250M link xD
Sucks though - I love VS code, I wish everyone enjoyed its awesomeness 😛
@rotund harness I tried using it..
Just recently, for Angular development
But I ran into issues, where IntelliSense isn't always able to fully auto-complete
Yeah we talked about it in DMs 😛
ITS ALWAYS ME
I am everywhere, and no where, all at once, and never
I got so many things done already :D
Moved them over to gitea
and also set up jenkins
and today, I managed to do my first automatic deploy
Yeah I have been moving my company over to react from Razor - slow going but fun projects
Pretty cool that new Declarative Pipeline
You can just provide a Jenkinsfile along your project
and Jenkins just scans all projects and all branches
and if you push code, it picks up that Jenkinsfile and runs it
@rotund harness and then i ran into something with my co-worker
really silly, and I wasn't sure how to respond
but is there any reason not to use localStorage for things like storing auth tokens?
especially in SPAs ?
if you refresh the page, your token is gone
and they just say to me: thats what an SPA does
So the problem with storing them in localstorage is that you open yourself up to XSS attacks. Javascript can access localstorage, so putting them there isn't that secure.
I will send you an article with information about it one second let me find it.
This is not me or my article - but this has some good information on where you shouldn't store it and stuff : https://medium.com/@benjamin.botto/secure-access-token-storage-with-single-page-applications-part-1-9536b0021321
Just losing authentication when you refresh the page... is not "just what an SPA does" if that was the case, you would never be able to refresh pages without having to sign back in lol - sounds like someone didn't want to find a real solution.
nice article
@rotund harness so what do you suggest, you keep the token in memory, and store the token serverside, attached to cookie?
It really depends, there is no "100% secure meets every potential case" solution. There are risks with any solution and downsides to some (such as way over complicated)
You "can" just store it in local storage, and eat the XSS risk, depending on your architecture and how your app is designed, it may not be a realistic risk
If you do go the cookie route, just make sure to account for CSRF as thats pretty easily to exploit
@rotund harness they already have a broken setup
with a bunch of CORS headers forcibly added in their backend
and currently tokens not even renewed after 15 mins
to annoyance of many
Haha - then yeah based on how much you care and how much you are impacted by potential XSS, local storage can be fine
@rotund harness I am hoping to get most of the CORS stuff out the door soon
I've set up a development pipeline, and set up proxy servers for the frontend and backend bit
why they didnt have this, I really don't understand
but I guess they should be glad I am there to help them out
Hi. I'm looking for someone here studying c++ I'm definitely new to the language as I can only make very basic stuff ATM but am exited and very determined to learn and do so much more down the road I want someone to pass notes with basically is what I'm saying
Sure i can help you with that.. even tho im not learning.. i have learnt it..
Just tell me what you want and youll be having it..
I have books on c++ that i studied and theres lots of useful notes in the internet too that i can search amd help you for...
Regards
@severe viper broaden your horizon, as a newcomer there might be better alternatives for you to learn
Rust is very promising
I updated my Random Audio Stream Player Add-on for Godot Engine, the add-on for Randomized SFX and Audio. I use it in all my games, it's open-source, MIT Licensed and I just made a video about it 😊 https://youtu.be/yyVT8TT7sMw (peertube alternative: https://tilvids.com/videos/watch/6a2759cc-cafb-4aaa-8014-ad584949066c)
This add-on lets you select multiple samples that are then cleverly pseudo-randomly played to feel organic.
In this video I explain how you can use it and what changed since last time.
After some digging I was able to improve my opensource random audio stream player add-on, and it's UI, for instance by making it so that you can select a folder i...
@honest sleet you should upload this to some app store, under the category "Productivity"
What do you mean 😅 ?
would this be a good place to ask about virtual machines
#networking might be better suited
what advice would you give to a 15 y/o that wants to start programming and doesnt know which language to start with?
Python is always where everyone starts
or #networking too
I was going to argue against you, bet then I realised TibiaAuto(bot) was in Python. 
What is that, I don't know
Noo, just my first experience with code. Then I went to the library to borrow some random "C++ for dummies
" book or the likes.
I would start with C++ & in case you later on wants to give up on the whole thing, just switch to some child friendly language like python. 
I really like Kotlin tho. It's like Java, but not bad. https://www.youtube.com/watch?v=b-Cr0EWwaTk
This original rap music video made for JavaOne 2011 celebrates the "Java Life".
Dedicated to the developer homies everywhere who code hard day and night.
Think Java programmers meet street Hip Hop.
C++ is a very big language!
learn slowly from the base, you don't need to know all of C++ at once for starter
my first programming course when I went to uni was also C++
i'm nub can i get some help with java here lol
i'm trying to repeat an integer 10000 times, however i don't want to print that out
Anything i see online for repeating integers it just has a Print line statement and it physically displays it on the program
I was thinking of using tensorflow and yolo for object detection. Any suggestions/comments?
I eventually want to run it on preferably some raspberry pi
you want to run tensorflow on a rpi? o_O
I was hoping to run some object recognition on it😂
i learned python first since thats what my uni teaches first, starting my c++ course this fall and i decided to start learning the language early
needless to say, learn c++ first
I see python as the modern VB equivalent. Holy crap it's horrible.
... and that's coming from someone who's first languages were Delphi and Clipper in the mid 90s.
python is easier in some ways, but i found that it oversimplifies a lot of programming concepts
i need to do a deep dive into a lot of the older languages that have been mostly phased out, its very interesting
Gotta be honest, literally the only reason I predominantly use Java (over C) is that Java has incredible testing tools available, great native integration with good IDEs (C has the latter, but not the test tools), and fantastic repository support of community libraries.
I've started using javascript/node a lot over the past few years more and holy crap there are language features that have just been made so complicated - async and promises mostly.
I primarly rn write in js
C++ is great if you're using .net, but if you're one those STL purists then bugger off and let's go back to using straight C.
async, promises, all that jazz
lambda expressions are the other thing that just makes me go why!?? This does not make code more readable!
That's the thing - everything you can do with a lambda you can do with the previous way we wrote functional code.
i dabbled in lambda's while learning python but i didnt really pursue them
i plan on learning java at some point in university before i graduate, probably on my own time
Java is not without it's problems, and I wish it had C#/.net's threading model.
Java provides you no mechanism of knowing whether a thread was polled or timed out, you have to guess. But that's about the only fault I can find in it.
yeah, it make semaphores uhh... a little problematic.
That one in a million chance that actually no, we weren't complete and need to double-check.
Are there no situations where you think lambdas are worthwhile? Even something small like dogs.findFirst(d => d.fluffiness > 5) ?
what's wrong with writing that in a traditional method - or even just passing an inline function where used in a language that supports it?
There's a big argument against lambdas in some languages
in Java for example, if you have a complicated pipeline, and you are using lambdas to run methods over a dataset with thousands of records
it might be faster writing a regular for loop, as those are better optimized
But doing filter and sort operations with streaming pipelines, is generally not a bad practice
Just know, that it produces slightly more memory pressure because it creates lot of short-lived objects
like dogs.findFirst(function adequateFluffiness(dog: Dog):boolean{return dog.fluffiness > 5;})?
@pliant siren use a thread pool
dont start the threads yourself
Gives you far greater control over how and what the system is doing, you can use multiple pools, depending on the specific application
You can then use atomic references with the synchronized keyword, or use locks to implement some sort of static state
its bit more tricky, works best if you can completely remove the state from your threads
and just pass them as parameters
be it a value or some kind of socket server doing whatever
@hallow pilot pretty sure that C# specifically has two kinds of constructs. There are expressions which are compiled runtime, and functions, which use anonymous classes
Java doesn't have this, it has pure interface references through a proxy object that gets woven into the bytecode during compilation
so you'll see inner classes with (class) com.bar.Foo$Lambda12321#$() that contains a $ function
C#'s approach is much faster, because it is directly handled by the virtual machine
in java its basically done during compilation, which yields a larger binary and more cycles
Anyone who knows some php who is willing to help get some little errors out of a small piece of code?
I can
<?php
$conn=new mysqli("hostname","username","password","database");
$query=$conn->query("select * from klant;")
$result=$query->fetch_all();
foreach ($result as $value) {
?>
This is the code I received
The second one makes the connection with the db
then it declares a variable and assigns a new mysql connection
yeah
so you got that far?
Yeah
did that work
ok
so next
you create a query by running the query() function
and then you fetch the result of that query
as a rowset
and then you basically create a loop
and it loops over each record in the result
and you can then access these values by doing
$value["ColumnName"]
Like this: "echo $value[0]"
no, you should use column names
I would advise against using SELECT *
instead do
klant.naam
or naam if you are only referencing one table
you can join tables together, and then you may have two columns with the same name, so you put the table prefix in front of it
SELECT klantid, naam, adres, email FROM klant WHERE klantid = ?;
if you leave the WHERE out, then it doesn't filter
You also, should never concatenate the sql string together
always use prepared statements
The SELECT * is just because it's an example database with only 1 items in: naam and id
ah fair enough
if say, in the future, you add more columns to your tables
then all of this gets messed up
When I run the whole script trough a php codechecker I get an error on line 17
saying: "'$result' (T_VARIABLE) in your code on line 17
$result=$query->fetch_all();"
after the fetch all right?
yeah inbetween the () after the fetch_all
functionname(parameter1, parameter2) etc
but that's some constant
idk, php is garbage in my opinion
I've used for a while and i hate it
Only to maintain existing programs and fix bugs
but new software I wouldn't write in it
much better tools exist these days
I need some help with Javascript
Currently, my program calculates all the render passes, but will only display the final pass
let canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
let imageData = new ImageData(canvas.width, canvas.height);
for (var pass = 32; pass >= 1; pass = pass / 2) {
ctx.putImageData(imageData, 0, 0);
//render
}``` Here is the simplified version of the code
and this is what I want to achieve, but the code currently only shows Pass 6
oh, i "know" you, lol
can you put a full runnable version on a fiddle?
me?
I believe so
Yes, the Mandelbrot thing. I can't tell from the little code sample what it's doing and what it's supposed to do.
Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
I use Var at the top, using Let breaks some of the code
Okay, so you'd like to animate slowly getting sharper
basically
rendering the lower resolution passes first so you can see what you are looking at
left is what i want it to do, right it what it does
I think you need some kind of sleep in there, to get off the main thread and let the browser draw. Then ~200ms later or whatever you start the next pass
k i will try that
Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
lmk if that makes sense
thanks, that is exactly what i needed
reddit
5,631 votes and 730 comments so far on Reddit
After making a room generation algorithm (that I'll talk about in a video on my youtube channel https://www.youtube.com/c/TimKrief/ at the end of the month), I now generate 3D elements, walls flooring, doors etc. on the go to create this endless virtual gallery... Only thing missing now is the artworks! This is a refactoring of an old project https://twitter.com/TimKrief/status/1203507386323030018 and I'm so glad that I'm on my way to get it done. I'm also working on a 2D top down endless runner game that is going to use this basis.
With this Minecraft mod installed, even the lowest render distance settings can still look good. It truly changes how your world looks, and in the future could be even better! Enjoy!
Discord: https://discord.gg/5AXaGnC
Downloa...
Pretty cool concept ^
Hey guys i have a question about c++, i currently store instances of classes in a vector like this Entity *ca= new class player(x,y) playerlist.push_back(ca); x and y are random values, how do i check whether there is already a player at the given xy values so i dont have two players in the same place? or how do i scan the vector for certain xy values? Im new to c++ so i'd be thankful for help.
are those integers?
A few thoughts:
- there are certainly ways you could scan through that list and find pairs of players that are too close to each other
- with the right data structure you could find them more efficiently
- also maybe consider not letting it happen in the first place. (e.g. do a check when updating positions, and reject updates that move a player too close to another) (instead of checking all the players against each other once per tick or whenever)
Yeah im storing everything in classes with x,y integers. Im actually trying to prohibit a movement that goes to the same x,y value but i cant find the syntax to get those x,y values from a class without just printing the whole vector out
Maybe combine it with https://thisartworkdoesnotexist.com/ 😋
And on a related note https://thispersondoesnotexist.com/
This Person Does Not Exist
Both generate images using AI
If the objects in the vector are pointers you can just check whether or not the “player” at that position is nullptr, with nullptr meaning that that spot is empty
A better way to store them would be to use a 2D vector, or a vector of vectors. Kind of like a 2D array. Otherwise it might be worth creating your own data structure that can handle informal x,y points and to ensure that it’s sorted properly so that you can use a binary search for a faster run time. Feel free to DM me if you have any questions about it
Ahh ok thanks
I’m actually starting my fourth year in my software development degree and I also tutor for my CS department so yeah, just DM me and I’d be happy to help out
@woeful kelp Do they teach AVL trees in your current curriculum?
Had a need for one backed by an array a few weeks ago and found there were surprisingly little literature out there about them, or example implementations, and it just seemed like they were black magic to the people who wrote posts on them - which led me to believe they're no longer something they actually teach in degrees.
Although the one's I've seen and learned are node-edge based, not array based
array based are pretty advanced, I might expect a course to touch on array-based b-trees but the concept is the same.
Hmm. I haven't personally gone through many b-trees but an array based implementation doesn't seem too hard if it's based on something like a heap
Yeah, that's the trade off I can see, but doing it by nodes and edges would probably be more efficient
Since you don't have to work with dynamic arrays
yeah - just that you need much much more memory when you give the nodes address references.
Because all an AVL tree is, is an optimized binary tree so that each branch is of equal height
Not neccessaryily
I mean sure you have random access but in terms of adding and removing you suffer a Big-O of nlog(n) since you have to copy all of the old values into a new array
And you can store every node in a completely different part of memory, whereas in arrays, they need to be in consecutive addresses
And from what I'm reading, storing it in an array would require you to have a spot for every element even if it's empty. So your space complexity would turn out to be 2^h elements where h is the max height of the tree
Could be interesting
Size of an AVL tree can simply be n because it's auto-balancing.
Sure, but you still need spaces in the array for null elements
those are just the values you haven't added yet.
Yes but they need locations in the array
oh I think I know what you're getting at, where you have a dataset of indeterminate size.
yeah, in my use-case I had a known number of elements.
Yeah, in that case it wouldn't be as bad
basically I was (am) using this for crypto, where you hash 0-2^k where k = 32+ - so you have an avltree of size 2^32 entries.
instead of storing the output hash (76 bytes), you store n
so you have an array of about 16GiB.
Are you sure that's right?
yes.
yeah. 4G values at 4 bytes each.
Never mind that
if you go to k33, k34 then you start getting biggers and you have to use a really complicated packed array to save size, you dont want to use a whole byte just for that one extra bit. OR, do it in two trees using the most significant bit.
Right
so you can steal some performance improvements by dividing the data set so you end up with say... 2^16 AVL trees of size 2^16 instead of one a AVL tree of 2^32.
Right
I will say I'm not a cryptography major so I wouldn't really know too much about that but it does make sense if you know you're going to have a dense tree
don't need to know anything about crypto for this, it's all just data structures.
but yeah, it's not a data structure you come across commonly so trying to find an implementation of it the other week was like "... where are they all?" and then "but they all use objects and there's no array backed implementations", so I ended up with "screw this, I'll do it myself" 😄
Right
And that's honestly the best way to do it
When you can't find a standard implementation just make it yourself
Yeah, and I guess that's where this conversation began - it just looked like "do they even teach this stuff anymore?" because of all the posts I was finding where people just... didn't get it.
But yes, to be fair it's not exactly a data structure people are going to use very often - which explains why there aren't implementations everywhere.
Right. But the thing to remember is that there's a difference between the data structure and it's implementation. Because the data structure is the basic algorithms and properties of an object, whereas the implementation is more developer specific
So they teach the data structure for sure, but not really that implementation
some of the assignments/projects we had back when I was in uni were competitive type ones where either your grade was based on performance across the whole class, or they were competitive programs (eg, they had to play against each other). Short version: There are about 4 people I did my course with who I could recommend hiring.
okay, meeting time 😦
GL!
holy crap, we got a stand-up done in 10 minutes.
The support team lead in my team doesn't get that stand-ups are not for two-way conversation so they always drag way out.
Yeah the problem is what's happened is that now we have some people on zoom, or have some of us in a meeting room with others calling in, so the stand-up becomes a sit-down, ugh 😦
Yeah, that's rough
That's it the drone is ready! I'll have a complete showcase video out tomorrow on my channel 😉 But here's a little preview in the meantime! It's really close to what controlling a real drone feels like!
I had a hard time with the stabilization part but it ended up working ! I had to actually simulate the 4 propellers
just click the py file?
what do you want to do
use batch
window's native scripting system
you click it
it runs
what does it do
just deletes file?
older than a certain time
oh
if you want to turn it into a "native" executable you could make the batch script run the python command
surely a modern python interpreter on windows can be made to execute files on double-click
So as I said earlier I made a brand new drone that is directly controlled from the main character's smartphone! This time around the drone is realistic and close to usual drone designs. Even the physics are close to the real thing. Plus, I made a new environment to showcase it 🙂 https://youtu.be/3_rGzksrMsI
The IndieGame that I'm working on, Octahedrone, now has a new feature, a realistic virtual drone! This new drone is way closer to what we usually know, and the funny part is that it's controlled directly from the main character's smartphone. Just by pressing a button you access the smartphone and seamlessly you can start using the drone. Next st...
is there a good place to learn c++? i found learncpp.com after a few minutes of searching but i wanted to know if theres a better place. im willing to pay for a course
looking mainly online? if you're serious about it, I'd look at any nearby colleges or universities
ooh, there's an open courseware https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-096-introduction-to-c-january-iap-2011/
MIT OpenCourseWare
This is a fast-paced introductory course to the C++ programming language. It is intended for those with little programming background, though prior programming experience will make it easier, and those with previous experience will still learn C++-specific constructs and concepts. This course is offered during the Independent Activities Period (...
Yo what programming languages are used for what?
Everything
That's a very general answer with everyone having their own options
Its more of categories
C/cpp/rust are good for compiled things and embedded programming
Js is used on web frontend and can be used for backend through node or deno
You have c# which idk much about
Java
algorithms are language agnostic
Any language can do that lol
Java is apparently good for large programs
Because it's heavily oop
the outputs are in italian but i think you can look over it
i dunno what that code proves
it's a game
yea, for modularity. I think java still gets it. (not saying others are bad for modularity)
yeaaaa. and?
it asks you if you want to throw a 6 faces thing or a coin
sorry, i can't remember how those 6 faces things that are use for gamblings called
you know what i'm talking about
Dice?
yes
yea, but you can create that game in whatever language
i made it for my final exam to show an example of structured programming
But anyways there are also some niche languages that are good for a specific purpose
Like I heard of erlang
Its meant for ha, scalable, real time systems
I think the way it works is that is encourages crashing instead of error handling?
Idk
erlang philosophy is unlike any other
No
java: please handle this exception
erlang: shut up and try to reboot
i mean
isn't that called "subset" or something

Oh, wait elixir is built on erlang
Yeah I'm not familiar with this stuff
I first read about it here https://developer.x-plane.com/2021/01/have-you-heard-the-good-news-about-elixir/
X-Plane Developer
[This post is a “behind the scenes” look at the tech that makes up the X-Plane massive multiplayer (MMO) server. It’s only going to be of interest to programming nerds—there are no takeaways here for plugin devs or sim pilots.] [Update: If you’re interested in hearing more, I was on the ThinkingElixir podcast talking about […]
Ayo I have a question, what's the difference between double and float
Precision. The former uses twice the memory of the latter to express values.
double is typically 64-bit, with float being 32... though some systems don't adhere to this.
in what language?
In C++
Float is 4 bytes
Double is 8 bytes
@midnight wind I like that slide
It has just the right amount of erlangesque arrogance
@still pulsar a double is a 'double-precision' float. Its a 64 bit float (instead of 32)
Anyone know how to create custom property fields for files with a custom file type? ie I have a file that ends in .foo, and I want to add a property called category.
I'm assuming something has to be done in the registry. I would also like to be able to transfer the files to another os, mac or windows, and retain the values.
@midnight agate filetypes are an illusion
the file extension is just part of the name
a word document like .docx is actually just a zip file with some xml inside
with a hex editor you can usually tell what kind of file it is
but extension is irrelevant
yeah
thats just for the end user
and the os
so when you double click it, the right program is used to open it
yeah
@midnight wind even java jar files and war files are just zip compression xD
These are some audio files that use a proprietary codec. they end in .16b, .24b, .fxp. I'm trying to figure out how to store and categorize them with some extra info so that if the name changes I know what they were.
@midnight agate those are metadata tags, id3
those are stored inside the file itself
but those mostly applies to home use
Hi do someone know how to "mount" ext4 drive in android?
I have two ideas. Idea 1 you make yourself some app that can read the file system. Idea 2 you recompile the kernel for your phone with support, and set up your phone to boot using it. Idea 3 you do not mount ext4.
idea 4, use another FIle system that can be read by android
It's little ironic, the os saved on ext4
Look I'm a progmar but I will never trust my self with data
@nocturne galleon https://source.android.com/devices/storage/scoped
You need FUSE for this
@nocturne galleon android is linux, it can read those filesystems. Problem is you need root
Ah, alr
FUSE is the end-all solution to this sort of stuff
allows a non-privileged user to mount a filesystem
I'm root
I have a very common problem that could probably be answered very easy, Ive been working on game cheats using the game “pwnadventures3”, I’ve been doing this for 2 months & I’ve burned myself out. currently Im looking for a side project - does anyone have any good places to look for project ideas I’m not very imaginative & have only tried Twitter 🙂
look for little things in your daily routine that could be streamlined using a program
is anyone experienced w python?
what would i put for an if else statement to have the process move on to the next line
wdym
it will continue once it finishes running anything in the if, else
so I have it set up like:
if any(....):
time.sleep(5)
continue
else:
-------------- (end block, need it to move to next)
" File "<ipython-input-237-fa258d6802df>", line 24
else:
^
SyntaxError: unexpected EOF while parsing"
you need to put something in the else
or get rid of the else
you can't have an empty statement in python
what would I put in the else: to have it move on and not just repeat the if part
thats what i'm asking
I'm confused on what you are trying to do
I am setting up an if else script to repeat the beginning for the if, and continue to the later parts for the else
yes but I'm still confused, show the full code
wd = wd.Chrome()
wd.implicitly_wait(10)
wd.get("https://activismimpacts.world")
import time
import requests
while True:
url = "https://activismimpacts.world"
homepage = requests.get("https://activismimpacts.world").text.lower()
websiteerrorstrings = ['error']
# Check whether the strings are in the text of the webpage
if any(x in homepage for x in websiterrorstrings):
time.sleep(5)
continue
else: (dont know what to put here)
......... as far as i've gotten
oh i have it backwards i think
but still
so the else part will only run if you don't have a object in homepage
I'm dying at work
so only when there is a error
right
A co-worker spent 5 hours today merging 5 files (~200 lines each)
I went on screenshare with them, to have a look at why it was taking so long
idk how to explain how rediculous it was
so what I would put there is just some of console error output
they used a word document in landscape layout... with a 2 column table, with the source code copy pasted inside
whyyyyyyy
Like
if you do this
use notepad
but of all the programs
word
idk how to respond..
so people can share their IDE's with anime backgrounds?
that reminds me, my jetbrains ide is not anime
i must find one
F
do you have fun plugins though
i only have this one
https://plugins.jetbrains.com/plugin/8575-nyan-progress-bar
yea that looks good, but I would think the people at my work wouldn't be too amused to see anime when i present the code
idk a bout brightness, any software brightness would be artifical anyway.
iirc no
although there is a blue light thing I use
that automatically adjusts
yep
I mean, there is probably a way
depends on the screen
if it's something external
or like on a laptop
Maybe check out how this one works https://github.com/emoacht/Monitorian
I was hoping someone here could help me with my small coding-problem:
I have really simple python code:
import matplotlib.pyplot as plt
x = [1, 2, 3, 4]
y = [2, 4, 6, 8]
print("Hello, World!")
plt.plot(x, y)
plt.show()
When i run the code via my normal terminal the plot shows up as expected, but when i run it via VSCode (no matter what option i pick) it doesn't show my plots (the rest of the code works as expected).
I'm using anaconda which i guess is what's causing my problem here. The import seems to work correctly as i don't get anny errors, "Hello, World" is the only output i get.
I'm on a fresh install of the latest non-lts ubuntu version.
Plots also don't show up if i run the program via a zsh shell within vscode
I already posted this in the wrong channel, sorry for that.
Fixed it with the help from a buddy.
We noticed that the code works in vscode if we enter
export DISPLAY=:0
In the shell in vscode.
Enabling Terminal -> Integrated: Inherit Env solved the problem for me.
(I always start vscode from the commandline)
@slender sand that's an environment variable that is normally set by your DE when you login
Yes, but as inherit env was disabled it did not set the env variable.
inheriting it, should fix it yes :)
normally those things are inherited automatically
since they are spawned as subprocesses of the parent environment
Yea, vscode gave me a warning that i should disable that when i first opened it as it may give me trouble bc of anaconda.
I reenabled it and now it works
nice
@slender sand often these things can be resolved by just doing source /etc/environment
that's where the system's environment variables are set
Yea i know that, but i don't want to do this every time i startup vscode
the user context is then loaded from either /etc/profile or ~/.bashrc
In my case .zshrc 😄
yep same here ^^
This shell looks just way to nice xD
ubuntu? :P
I love the option that you could in theory even add emojis 😄
all da purple
Yea, i pref ubuntu bc it's the easiest distro for the ml-stuff i do
OpenAI works just out of the box lol
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
^ my laptop
Except I got rid of all the ubuntu-esque crap
ubuntu dock, all the purple stuff is gone too
I use manjaro on my crappy laptop, i do the main work on the pc 😄
its all grey for me
only crappy thing is the title bar of the windows
they are too big
have yet to figure out how to make it smaller
@slender sand my favorite GNOME extension ^
I know this one from manjaro, really neat 😄
toggle for a terminal that drops down
with opacity, if you are reading off a webpage and it covers the bit you are trying to read
can still see it somewhat
I have a very very big monitor, i never have anything on full screen xD
Yeah 1080 xD
4k 32 inch
yeah 15" laptop lol
Bigger than my tv
images contain doxxable infos, so rip
really nice for writing code 😄
wdym?
company name :P
@slender sand da other machine ^ in my attic
That machine mostly hosts virtual machines for me
@slender sand Cheap $900 machine, but... it has got the goods where it counts
16GB ECC memory, and 10G networking xD
I'm very happy with my pc as well, i'd just like a better gpu but i won't pay like 3x the price
@slender sand beast of a chip. Yeah I bought the 2600 as a server chip
and I Was so impressed with it, that I bought a 3600 for my desktop
$150 for a 6-core chip that decimates all that came before? yes please
my old i7 2700k was fast, very fast, but even that one started struggling with the GTX980
I hate waiting for compiling while coding. This chip just cuts down waiting time by a lot (compared to the shitty i5 i used to have)
I sadly don't remember the exact model
I was working on a duo-core laptop for the longest time
I heavily relied on features of the java VM, like hot-compile
to make development expedient
reload code while the program is running
Never knew that was a thing
It is :D
And if you have proper structure in your software, it works well too
Any new instances of a class, get created with the new code
old instances, stay alive
you cannot rename existing fields/methods, only modify or add new members
I'm currently working together w a friend and she is still using a very old macbook. I can run all unittests within ~1-2 seconds and for her it takes like up to a minute.
Which is kinda bad for my coding style as i tend to sometimes just brute-force until i figure it out
Y but if i wanna know if my tests pass NOW i kinda can't skip the tests
thats what I have a pipeline for
I don't typically run tests on my development machine, unless I need to
because it takes 20 minutes
xD
We are still in university so our projects / tests are not that big
Ah yes
but even tests can be slow if they are poorly written
like
starting an entire database pool up to do integration tests
spinning up db instance, inserting test dataset
execute test, restore transaction safepoint, execute 2nd test
and so on
Yea, luckily we just have very simple ones 😄
All tasks we have are just writing a few methods and to test these.
So I'm using sqlite to create a database. Is there a way to have an array stored in a cell (for each row in a column) and then select all goes which contain a word found in those arrays?
Just new to databases so don't burn me
Also I'm collecting the data by scraping websites with bs4 and managing the database with apsw if that helps
can you describe your data more
should be fine to store it like that, but just making sure you store it optimally
It's gonna be image links scraped off websites like Tumblr and deviantart and I want to find images which match their tags hence the array
you could tag it then
Wdym?
Sounds like it’d be better to store everything in a json object, and have the database be a simple key:value structure, the value being the json string.
for RDS,
could be
Just there could be thousands of images
then select all those with "human" column for example
Just each image could have multiple tags and I don't know how many
but yea. json seems fine
could you give us an item for example
so we could suggest based on your data
One sec
And if you are managing that much data, implementing bloom filters could be helpful too with query speed
uhh, i thought you're going to give us actual data that can be found in your array
Probabilistic way of determining if data exists in a data set
ah yes time to bring out the algo
Ohhh. I mean I don't have the array right now. Just trying to figure out how to do it
But it would just contain the tags for images like that
Plus sounds like he’s doing it in python, and python had a GREAT bloom filter library
Yea. Just thinking whether json or sqlite would be better
he should definitely do it in assembly

Json is a way to format data, SQLite is a database for data. They’re not the same thing, you can use both together.
Although I’d shy away from using SQLite, purely for performance reasons.
😳
Would it not be slow with json if I have thousands of items?
wdym
json is a format
are you referring to json-like databases? dynamodb, mongo etc?
No
Just accessing the file from python
Would it be slow if there's thousands of items
And wouldn't it take up alot of memory space
Don’t store in a text file. Put the json in a database.
So in the database (sqlite maybe), I can have a url column and a tag column which stores the tags in an array (or json)?
Yeah, you can.
You can also look to use splunk as an endpoint. It’ll handle the data, you just have to http forward everything to it
What kind of program is this? Web app? Command line or gui app you run locally? A database might or might not be worth it
He’s already talking thousands of images/datasets. Definitely want a database.
If you want queries and indices and fault tolerance and transactions and other database things then sure. But if it's just a local toy then a data structure in memory might be fine.
For my own projects I would lean toward using a database for future flexibility. I just want to point out that if learning about databases is not one of the goals, and you don't need one badly, there's probably a path forward without.
I'm curious what kinds of performance pain you've had with SQLite. What were you using it for?
Myself? Web scraper.
On a very large scale
Also, SQLite can’t be touched off host
Yeah in my mind SQLite is filed under "I want to work with a database, but I'm writing a single-user application that is the sole user of it"
So like, a save file for a game, or persistence for a mobile app
I see it more as a prototyping tool.
Course, I don’t usually have a table set up any more complicated than key:value. I let bloom filters and json do the real work for me
Or if I’m really crunching data, I just offload to splunk.
Hey, any suggestions as to what I should learn next in Java?
Completed Comp Sci I & II
And my teacher stopped "teaching" about last September, and there's no Comp Sci III at my School
Learn another less masochistic language?
brainfuck
rust 
Well i want to learn a lil more Java rather than just jumping into another lanaguage
It’s hard to know what to say without knowing what you actually were taught so far
Learning programming >> learning a language
yeah its hard to describe when you should jump to another lang
i made the jump a few months after taking AP CS A
What was the hardest task in Comp Sci II? Maybe I can help you from there..
If I have an idea what you've done so far
If you want to be a good engineer focus on the fundamentals, the language shouldn’t matter that much
i think its always good to experience a low-level language like c/c++ to learn about strict memory management but yeah fundamentals are the most important
I agree, but they're just starting out, and they should learn the fundamentals at least in the most comfortable way for them right now IMO
they can switch later
especially if additional classes will be in java, it would be better to have more skill at java for them too I imagine
im curious how long these classes are, because if they're full year classes he has a lot of experience already
comp sci I and II.. probably 2 semesters yeah
thats the other option, and even then he'd probably have all of the core stuff down and maybe inheritance
again very hard to guess without course layout
If these are high school classes I wouldn’t be too certain haha
if they were hs classes then id assume he's taken 2 years of cs, otherwise only 1
If you like physics then try game development
There’s a lot of fundamentals missing in most high school CS, really without knowing what was taught it’s hard to judge
the ap course i took for cs taught me up through inheritance and arraylists but nothing more
generics were a big thing that was left out
Gotcha, tbf it also depends on what the goal is, so knowing a bit about that is also important


