#development

1 messages · Page 55 of 1

nocturne crypt
#

don't you love tab errors in your language?

exotic python
#

@reef tangle i haven't work much in numpy but the way u are calling time and those below it may be the issue

#

instead of two argument maybe just provide t does it work?

reef tangle
#

This is for an assignment

#

hold on

#


"g = 9.81    # We are on Earth.
dt = 0.1    # 1/10 second time step
N = 100     # I'd like to see 100 points in the answer array
vi = 50.0   # initial velocity
xi = 25.0   # initial position

# first, set up variables and almost-empty arrays to hold our answers:
t = 0
x = xi
v = vi
time = array([0])       # initial value of time is zero!
height = array([xi])    # initial height is xi
velocity = array([vi])  # initial velocity is vi
# Note that 't', 'x' and 'v' are the current time, position and velocity, but 
# 'time', 'height' and 'velocity' are arrays that will contain all the positions
# and velocities at all values of 'time'.

# Now let's use Euler's method to find the position and velocity.
for j in range(N):
    # here are the calculations:
    t = t + dt
    x = x + v * dt    # x = x + dx = x + v*dt
    v = v - g * dt    # v = v + dv = v + a*dt
    # And here we put those calculations in the arrays to plot later:
    time = append(time,t)
    height = append(height,x)
    velocity = append(velocity,v)

# Now that the calculations are done, plot the position:
plot(time, height, 'ro')
xlabel("Time (s)")
ylabel("Height (m)")

# just for comparison, I'll also plot the known solution!
plot(time, xi + vi*time - 0.5*g*time**2, 'b-')
show()
You can see on the graph below that this actually works pretty well. It's a little bit off, but not bad; you can make it better by making dt smaller and N correspondingly larger.
 
Assignment
Change that sample code to numerically solve Simple Harmonic Motion instead of free-fall. We’ll still use the equations for Euler’s Method, but instead of a=-g, use a=-ωx.
Define global constants x_i=1, v_i=0, and ω=1.
Plot the position for 10 seconds. Make the code put your name in the title, of course, and plot the known solution also!```
#

im calling numpy is from this piece of code here

import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import brentq```
nocturne crypt
#

then your professor/teacher just asked you to use euler's form for numeric integration. you don't actually need scipy for this?

#

just put the new evaluated points x at each iteration in the array

#

if that's what the assignment does it's basically looking at the terms of the numeric integral int from 0 to 100 {x} dx

hollow basalt
#

always use numpy/scipy

#

use tanks to fight petty criminals

reef tangle
#

@nocturne crypt the whole point of the exercise is to use eulers method in code. its a project

nocturne crypt
#

then use euler's method

#

i don't see any inconcistincies with what i said and what you're doing

#

there's numerous way to what you're attempting to do. i simply stated the core idea is stemmed from integration

#

i only mentioned it because i thought it would help to think of each position as a term instead of some foreign idea

#

i won't help you in the future :)

reef tangle
#

jesus,

#

you dont have to overreact

#

im new to coding

nocturne galleon
#

Why is it okay to overload a const char* for using cout <<. But not a string?

#

If I change the operator const char* to string and then return a string instead of a char pointer it wont work. Why?

nocturne galleon
#
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
class Date
{
private:
int Day; // Range: 1 - 30 (lets assume all months have 30 days!
int Month;
int Year;
string DateInString;
public:
// Constructor that initializes the object to a day, month and year
Date (int InputDay, int InputMonth, int InputYear)
: Day (InputDay), Month (InputMonth), Year (InputYear) {};

operator const char*()
{
ostringstream formattedDate;
formattedDate << Day << " / " << Month << " / " << Year;
DateInString = formattedDate.str();
return DateInString.c_str();
}
};
int main ()
{
// Instantiate and initialize a date object to 25 Dec 2011
Date Holiday (25, 12, 2011);
cout << "Holiday is on: " << Holiday << endl;
return 0;
}```
warm sleet
#

Anyone here got some nodejs knowledge? I'm attempting to interact with filesystem, but the method that is called, has to exit synchronously

#

Even though the method I am calling inside the function, does async stuff

#

how can I 'await' before returning?

#
writing() {
    //Copy package.json


    fs.readFile(this.templatePath("common/package.json"), function (err, buff) {
        console.log(buff.toString())
    });
   // I want to do some more after this readFile, but cannot because of that ^   
}
tulip oracle
#

@nocturne galleon Honestly, I didn't even know you could do operator overloading on a const char* type wow

#

string is not a operator, its a class

#

I can see what you're trying to do, you're supposed to overload the stream operator '<<'

nocturne galleon
#

Okay thanks, currently working my way through SamsteachYoureself C++ in one hour a day

round dome
#

string is not a operator, its a class
@tulip oracle you need to stop

tulip oracle
#

?

round dome
#

obviously string isn't an operator

#

but const char * isn't as well

#

it has nothing to do with them being operators

#

it's conversions

tulip oracle
#

Ahh its conversion lol

round dome
hollow basalt
#

@warm sleet you found the solution?

warm sleet
#

well

#

readFileSync

#

did the trick

hollow basalt
#

yea

#

XD

warm sleet
#

still

#

fuck callbacks

hollow basalt
#

welcome to callback hell myfriend

warm sleet
#

Its so stupid

hollow basalt
#

where 4 tabs is normal

warm sleet
#

I get it makes your software async and all

#

but the writing of the code

#

is like 10x harder

hollow basalt
#

fuck this async

#

I want imperative

#

is like 10x harder
@warm sleet indeed

warm sleet
#

if this was java

#

I was done like 5x already

tulip oracle
#

Imagine combining async with multithreading....

hollow basalt
#

Imagine using nodejs

warm sleet
#

I do multithreading when I need it to in java

#

not expect my language to do it everywhere

#

its just as confusing in C#

hollow basalt
#

TBF the Async is a great idea

warm sleet
#

on paper yes

tulip oracle
#

Yep

hollow basalt
#

but would you want to run a sinlge threaded application on this beast 18core XEON

warm sleet
#

but not if you are writing a tool, that sequentially has to read, modify and write files

hollow basalt
#

but not if you are writing a tool, that sequentially has to read, modify and write files
@warm sleet Looks at framework with CLI

warm sleet
#

context constrains me to make sure that there's no callbacks

hollow basalt
#

TBF Nodejs gives me hipster vibes

#

I feel like the developers that read hacker news

#

come at me nodejs devs

#

@warm sleet Good job

warm sleet
#

writeFileSync.. doesnt create subdirectories

#

stuuuupid

#

it fails

#

says file doesnt exist

#

doesnt tell you that, directory doesnt exist

hollow basalt
#

This is why system calls are better smh

warm sleet
#

see I expect to be able to just give an option/parameter

#

to create directories if not found

#

but no

#

I have to use mkdir

#

correction

#

mkdirSync

#

nodejs people not the brightest when it comes to sane API design

tulip oracle
#

Needs a IF NOT EXISTS

warm sleet
#

NANSI SQL

#

IF NOT EXISTS doesn't work in half the engines

tulip oracle
#

Unfortunate 😦

hollow basalt
#

I'll probably use NODEJS when I would go to starbucks

tulip oracle
#

^On your macbook xD

prime bough
#

WHY JS

nocturne crypt
worthy dirge
nocturne crypt
#

what are you trying to do?

worthy dirge
#

I am trying to know whether I was wrong or not, because it should deduce the template parameter

nocturne crypt
#

no it should not deduce in that circumstance

#

you need a deduction rule

#

which you can provide in C++17

worthy dirge
#

which circumstance

#

MSVC deduced successfully

nocturne crypt
#

in return GetB

#

MSVC provides broken rulesets

#

and has a lienient mode

#

stuff works in MSVC that shouldn't

worthy dirge
#

OK, how do you explain GCC deduce by using () but not when using {}

nocturne crypt
#

{} has more strict initialization rules

#

than ()

#

{} construction is the way forward

#

less dumb things happen

worthy dirge
#

Should work exactly the same tho, because that's the only constructor

nocturne crypt
#

no, () and {} have different initialization rules

#

they have different implementations in the parsers nad have different rulesets assigned to them by the standard

worthy dirge
#

Is that a reason for GCC/Clang doesn't behave the same

nocturne crypt
#

Microsoft provides lienient rules that break the standard

#

and GCC/Clang explitely force you to use extensions

#

i do not believe either have CTAD extensions for what you're looking for

#

that's why C++17 has deducation syntax

worthy dirge
nocturne crypt
#

you need to specify the Template or provide deduction syntax

worthy dirge
#

so, clang is correct?

nocturne crypt
#

template<T> B(T ) -> B<T>;

worthy dirge
#

I know deduction guide

nocturne crypt
#

that only works with C++17 onwards

#

well then you know CTAD is broken and forever will be

#

don't insansiate objects using parenthesis

#

the curly barce initialization was changed to avoid all this dumb

worthy dirge
#

So, which compiler you think is correct

#

Or none is correct

nocturne crypt
#

they would've removed if it didn't break ABI

#

i don't think that should ever be will defined behavior

#

i think it's UB at compile time

#

you either provide a deduction guide or ride by the seat of your pants

#

or explicitely mention the template parameters

worthy dirge
#

I don't understand what you are talking about.

nocturne crypt
#

the answer is CTAD is broken

worthy dirge
#

From your words, it's like it shouldn't deduce in both cases, so clang is correct

nocturne crypt
#

using parenthesis for construction has historically has undefined behevior at compile time

#

i'm simply stating that deducing a template class without paremeters should be undefined behavior

#

my answer is it's undefined behavior

#

you can come to your own conclusions

#

i don't think the standard gives it a clear definition in this case either

#

i would have to review it, this is a real edge case

worthy dirge
#

i'm simply stating that deducing a template class without paremeters should be undefined behavior
@nocturne crypt Epic, so CTAD is always undefined behavior

nocturne crypt
#

no, just in this context

#

CTAD works in various situations just not with auto as a return type

#

with no trailing return

#

it probably works with auto and trailing return

worthy dirge
#

So auto return type with CTAD is undefined bahavior?

nocturne crypt
#

i would have to check on it, but as someone who's been doing this for like 10 years now

#

auto without trailing return type with CTAD just sounds like you're asking for trouble

#

i'm not even sure it would work with the trailing return type but probably

worthy dirge
#

CTAD come out in C++17, how can someone doing this for 10 years

hollow basalt
#

he's in the future

nocturne crypt
#

C++98 -> C++20

#

i didn't mention a specific dialect

#

i said C++

worthy dirge
#

auto return type come out in C++14, it's not 10 years either

nocturne crypt
#

CTAD was there in C++11

#

it was just like sfinae in C++98

hollow basalt
#

auto return type come out in C++14, it's not 10 years either
@worthy dirge he said 10years of C++ experience

nocturne crypt
#

it was the class clown

worthy dirge
#

CTAD was there in C++11
@nocturne crypt Wrong. It's in C++17

nocturne crypt
#

the compiler did it

#

it was just the class clown

#

the same way SFINAE was in C++98

hollow basalt
#

Compiler can do all sorts of things even before the standard comes out

nocturne crypt
#

it just required a lot of care to use

#

^

hollow basalt
#

^

nocturne crypt
#

SFINAE is a bug if you're curious

#

they couldn't fix it

#

so they adopted it into the C++11 compiler

#

it's not a bug, it's a feature

worthy dirge
#

If you can do this std::vector v{1,2,3}; in non C++17, then I will believe you

nocturne crypt
#

or use sfinae in constructors

#

just use deduction rules in C++17 if you're allowed to use it

#

you won't run into your problem

#

you should also use explicit constexpr noexcept

#

to avoid implicit conversions

simple harness
nocturne galleon
#

What's the difference in using unique_pointer or making your own smart pointer class?

#

in c++

worthy dirge
#

unique_ptr is the easiest to implement smart pointer

hollow basalt
warm sleet
#

@simple harness shift registers?

cinder kraken
#

looks more like a counter

simple harness
#

its just like a flip flop but just 1 input. so more like a counter yeah

#

ill try build it again if i can remember it was pretty confusing

warm sleet
#

@cinder kraken a shift register is in effect a counter

#

0001 << 1 = 0010

cinder kraken
#

Yes, but 0010 << 1 = 0100

#

Not a counter

simple harness
#

heres a view inside each module, not sure if this is possible in real life logic circuits

simple harness
warm sleet
#

@simple harness get yourself an fpga

simple harness
#

a what?

warm sleet
#

there's development kits, look similar to arduino boards

#

fully programmable gate array

#

you can basically design hardware logic with components like those above ^

simple harness
#

ooh

warm sleet
#

its HDL

#

hardware description language

#

and then you and flash that onto an FPGA

#

and it basically emulates the logic in hardware

#

oh its field programmable

#

not so much a processor

#

but you can implement a processor with it xD

simple harness
#

ill look into it

warm sleet
#

professional fpga development boards are expensive

#

not sure about DIY space

#

@simple harness this is quite cool

warm sleet
#

its small board, with an fpga and tonns of different interfaces

simple harness
#

not too expensive

warm sleet
#

so you can turn it into basically anything

simple harness
#

is it like a raspberry pi or no

warm sleet
#

its more like arduino

#

but its an FPGA, so you program it with logic gates instead of code

simple harness
#

awe okay

warm sleet
#

what you simulate in that program of yours, you can embed onto an fpga and execute at some clockspeed

simple harness
#

yeah. i mean i like the programming side of things so i might like doing that too yeah, thanks 🙂

warm sleet
#

FPGAs are nice because you can reprogram them with a CPU

#

so they can be optimized to do one task very efficiently

#

faster than generic purpose processors could

#

and ofcourse they serve as a development platform for DIY processors

vital blaze
#

I think it's possible to get an educational discount on Alteras

ripe coyote
#

I too am a developer

keen falcon
simple harness
round dome
#

that's fascinating sweetie keep it up

hollow basalt
#

thanks mom

jagged kayak
#

I wonder how much performance I can gain through AVX/SSE/NEON by changing my ```
[R, G, B, A, R, G, B, A, R, G, B, A, R, G, B, A]

to

[R, R, R, R]
[G, G, G, G]
[B, B, B, B]
[A, A, A, A]

crystal tundra
#

which lang?

#

and if u use avx, probably 4x performance gain as there are 4x less instructions

#

assuming 4 values in an avx register (or xmm or whatever its called)

simple harness
mint talon
#

@simple harness will you open source this?

#

This would be great for teaching digital logic

nocturne crypt
#

you can self-host it if you want

mint talon
#

Yea I know of falstad, tho this one looks to have a nicer interface

nocturne crypt
#

idk, i think it's pretty shiny

#

iCircuit already exists as well if you want it on your system

mint talon
#

Hmmm that looks pretty good, tho does it support purely digital circuits?

nocturne crypt
#

iCircuit supports logic

#

it has a virtual arduino too

#

you can literally code C in the virtual arduino

#

it also has a market place for custom components

#

maybe repository is a better word, you know what i mean

#

iCircuit is great on ipads

mint talon
#

I’ll give it a try

#

Thanks!

tall kernel
#

edge (& any other browser) is just downloading the php file

#

but tor actually shows it

#

whats the problem

midnight wind
#

on a low level, the http response is telling the browser to download the file. I think it's called binary serve or something like that instead of rendering the file. Tor probably blocks all those since it's meant for privacy

#

@tall kernel what web server are you using

tall kernel
#

nginx

#

i launched another vm

#

and i did the same thing

#

and it works here

#

interesting

midnight wind
#

it's the nginx config maybe

#

nginx can be weird with php

tall kernel
#

but i did the same thing

#

weird

#

but it works now

#

so idc

#

thanks

midnight wind
#

@tall kernel you have php-fpm installed?

tall kernel
#

yep

crystal tundra
#
while hash.__self__.__dict__["True"]+hash.__self__.__dict__["True"]==hash.__self__.__dict__["ord"]('守')/hash.__self__.__dict__["ord"]('ⷄ') and hash.__self__.__dict__["False"]!=hash.__self__.__dict__["True"]: (lambda 你,我的中文不好:print(hash.__self__.__dict__["int"].__call__(hash.__self__.__dict__["str"].__call__([[我的中文不好[hash.__self__.__dict__["False"]]*我的中文不好[hash.__self__.__dict__["True"]],我的中文不好[hash.__self__.__dict__["False"]]/我的中文不好[hash.__self__.__dict__["True"]],我的中文不好[hash.__self__.__dict__["False"]]+我的中文不好[hash.__self__.__dict__["True"]],我的中文不好[hash.__self__.__dict__["False"]]-我的中文不好[hash.__self__.__dict__["True"]]][好笑] for 好笑 in hash.__self__.__dict__["range"].__call__(hash.__self__.__dict__["len"].__call__([23423,342424,32434234,234])) if ['mul','div','add','sub'][好笑]==你]).strip.__call__('[').strip.__call__(']')))).__call__(hash.__self__.__dict__["input"].__call__('Choose an operations:\nmul for multiply\ndiv for divide\nadd for addition\nsub for subtraction\n'),[hash.__self__.__dict__["int"].__call__(hash.__self__.__dict__["input"].__call__('Enter the first number of the operation: ')),hash.__self__.__dict__["int"].__call__(hash.__self__.__dict__["input"].__call__('Enter the second number of the operation: '))])
#

this code runs lol

simple harness
nocturne galleon
#

looking for a front end web page person

hollow basalt
#

you could

dusty moss
#

I know some things about web things @nocturne galleon

marsh oasis
#

i need help with getting maven lel

#

the instructions are sooo confussing

hollow basalt
#

That's the beauty of maven

#

It's either you know it that it's hard to explain.
Or you don't and it's hard to learn

warm sleet
#

@marsh oasis sup

#

I know my way around maven

marsh oasis
#

lol

#

help 🙏

warm sleet
#

have you ever set up a maven project?

marsh oasis
#

i need maven to set up a mavin project...

#

lel

#

and i also need maven for luyten

warm sleet
#

so, you can generate a 'default' project with an archetype, archetypes are like project templates

#

mvn archetype:generate

#

you can use this to create the initial pom.xml configuration

marsh oasis
#

but i need help installing maven

#

lol

warm sleet
#

ohh

#

ok

#

do you have the java development kit installed on your system?

marsh oasis
#

sry if i didnt explain nicely

#

do you have the java development kit installed on your system?
@warm sleet well first im installing maven so that i can use luyten to decompile

warm sleet
#

Maven needs the jdk

marsh oasis
#

uh how do i check if i have it or not

warm sleet
#

oof

#

windows right?

marsh oasis
#

ye

warm sleet
#

its in C:\Program Files\Java

#

in that directory, should be either jre

#

or jdk

#

with version number

marsh oasis
#

lemme check

warm sleet
#

if its not there, install from here: https://adoptopenjdk.net/

AdoptOpenJDK provides prebuilt OpenJDK binaries from a fully open source set of build scripts and infrastructure. Supported platforms include Linux, macOS, Windows, ARM, Solaris, and AIX.

#

Get version 11

#

with Hotspot

marsh oasis
#

is there a way to check thru cmd prompt

warm sleet
#

yes, see if javac is available

#

thats the java compiler

#

just install openjdk, doesnt hurt having multiple java installs

marsh oasis
#

i have java 8 pretty sure

warm sleet
#

basically, what you have to do

#

is have a JDK environment installed, and configured in PATH

#

so that you can access it from commandline

#

then, you unpack maven in a directory, I usually do it in C:\maven

#

and then, you go to environment variables again, and add M2 and M2_HOME

#

as well as adding %M2%\bin to path

#

this will allow you to call mvn from cmd

marsh oasis
#

i am confussion lol

warm sleet
#

just

#

install openjdk

#

so we can make sure it works

marsh oasis
#

kk lol

warm sleet
#

after you installed that, download latest version of maven

#

make a new directory in C:\maven and drop the contents of the download in there

#

on windows, installing maven is annoying

#

because there's a manual step

marsh oasis
#

kk

warm sleet
#

@marsh oasis after installing openjdk, open a new cmd window and run echo %JAVA_HOME%, see what it prints

#

%JAVA_HOME% should point to where openjdk is installed

marsh oasis
#

uh just a quistion i have to make the maven folder right in my c drive

warm sleet
#

yes

marsh oasis
#

so with all the program files?

warm sleet
#

or anywhere

marsh oasis
#

lol

warm sleet
#

just. somewhere xD

#

I just dumped that stuff in C:\maven\

marsh oasis
#

lel

warm sleet
#

once you've unpacked the maven files, show me screenshot of the directory its in

#

after that, search in windows start menu for Environment variables

#

and click on that

marsh oasis
#

kk

warm sleet
#

yeah, what about the path at the top?

#

is that C:\maven ?

marsh oasis
#

ye

warm sleet
#

ok

#

now open environment variables

#

create a new system variable, named M2_HOME

#

with value: C:\maven

marsh oasis
#

where do i install it to

warm sleet
#

set java home ^

#

tick that as install

marsh oasis
#

kk

warm sleet
#

install location is fine

#

that java home is important

#

otherwise maven will complain it cant find java

#

ok, so show me the environment variables. Have you added the M2_HOME ?

#

next up, edit Path (should be part of system variables)

#

and add a new line to that one

marsh oasis
#

uh i frgt where i add the variables again

#

lol

warm sleet
#

search windows

#

Environment variables

marsh oasis
#

ah yes

#

added

warm sleet
#

variable M2_HOME points to C:\maven

marsh oasis
#

ye

warm sleet
#

now, add another line to the existing rule Path

marsh oasis
warm sleet
#

thats fine

#

now find Path

marsh oasis
#

ye

warm sleet
#

it should have an Edit option

#

and bunch of lines

marsh oasis
#

yep

warm sleet
#

create a new line on Path (you can add more than one path to Path)

#

and have that one say: %M2_HOME%\bin

#

this should add the programs in C:\maven\bin to your commands in cmd

marsh oasis
#

done

warm sleet
#

so once you set that

#

close it

#

and open new cmd

#

and see if mvn is a valid command

marsh oasis
#

works

warm sleet
#

cool.

marsh oasis
#

3.6.3

warm sleet
#

you've installed maven

marsh oasis
#

pog

#

thank u

warm sleet
#

@marsh oasis on linux this is all just one command

#

apt install maven

#

:D

marsh oasis
#

gona make some mc plugins now 😂

#

ye

#

my luyten was broken in linux trho

warm sleet
#

Minecraft plugins huh?

marsh oasis
#

probs frgt to do some things

#

ye

warm sleet
#

thats how I got into java ;)

#

I've been developing plugins since 2014

marsh oasis
#

o

#

ive been all over the place with codin

warm sleet
#

I now do it professionally too

#

minecraft was more of a hobby

marsh oasis
#

started learning python and now i make discord bots and now im also learning c# for game dev and now java

#

also doing a course to make ios apps lmao

warm sleet
#

but yeah, you can generate a project for maven now

marsh oasis
#

epik

warm sleet
#

using either an archetype, or an IDE

#

I just use intellij to do it

#

since intellij integrates with maven

marsh oasis
#

ima use eclipse

#

ever used it before?

warm sleet
#

ew

#

eclipse is the worst

marsh oasis
#

lol

hollow basalt
#

it truly is

warm sleet
hollow basalt
#

why are you lol-ing

warm sleet
#

^ the only true java IDE

#

eclipse maven integration is awful

#

I've developed all my plugins with intellij xD

#

and there's even plugins for intellij now, to facilitate with mc development

#

They don't do much

marsh oasis
#

why are you lol-ing
@hollow basalt just do

warm sleet
#

but its helpful for things like MCP

#

minecraft coder pack

#

for developing forge mods

marsh oasis
#

so ima use intellij then

#

can i have a download link

warm sleet
#

I literally linked it

marsh oasis
#

sry didnt see lol

warm sleet
#

Community edition is fine

#

Ultimate has some niche features you will not be using

marsh oasis
#

why is my internet bein so slow today

#

the speed rn is like 495 but it takes a few seconds for it to download things

warm sleet
#

See, all those database tools, Java EE and such

#

are things I need

#

but are not needed for mc development

#

or vanilla java

marsh oasis
#

what all do i need

warm sleet
#

none

#

just hit next

marsh oasis
#

kk

warm sleet
#

file associations are lame

#

dont need a full fat IDE to open a text based source file

#

xD

marsh oasis
#

lol

#

i wish vscode could just decompile

#

would make life easier for me

warm sleet
#

IDEA has fernflower decompiler built in

#

you can just open .class files

#

and it decompiles them

marsh oasis
#

so where do i begin with java and mc plugins

#

ik like 0 java

#

lol

warm sleet
#

oof

marsh oasis
#

im here to learn ;-;

hollow basalt
#

oof

warm sleet
#

@marsh oasis there's tutorials on how to make bukkit plugins

#

most of the things in minecraft are relatively simple

marsh oasis
#

lol

warm sleet
#

typical way you hook into minecraft is using events

#

player places a block, bukkit raises BlockPlacedEvent

#

then you can modify or change how this event gets handled

marsh oasis
#

ohh thats helpfull

warm sleet
#

there's APIs to get to inventories, chests, blocks, NPCs, entities

#

all the stuff

marsh oasis
#

i do loads of discord.js and thats bassicly what i have to do lol

warm sleet
#

bukkit is quite big

#

has a lot of interfaces

#

I wrote a plugin to do cross-server synchronization

#

so two minecraft servers, and if players jump from one world to another

#

they transfer server, and it transfers profiles between them

marsh oasis
#

so how hypixel works like lol

warm sleet
#

chat as well

#

Yeah, a bit

#

but we also have our own roleplay stuff attached to that

marsh oasis
#

lmaoo

#

no

warm sleet
#

@marsh oasis all you basically need to do, is just create a maven project

marsh oasis
#

u mean vape the hack client?

warm sleet
#

and add bukkit-api to your dependencies

#

in your resources directory, create a plugin.yml file

#

that plugin.yml file has some context information, like the main class of your plugin

#

with mvn package

#

it compiles and packages this into a jar file

#

which you can drop in the plugins/ folder

marsh oasis
#

thats cool

warm sleet
#

@magic portal shut up

#

ok do it quietly pls

#

nobody cares

marsh oasis
#

i dont know abt that one

#

no.

#

i dont trust anyone :D

#

yes sir

#

atleast im less stupid then u

warm sleet
#

<@&750150305383186585>

#

Yes I do

#

with you.

#

can you ban this imbeccille

#

oh

#

rekt

#

small pp

hollow basalt
#

he not smooth

haughty oyster
#

Linus send tutorial on how to build a pc

#

I need pc

#

My pc sht

warm sleet
#

Wrong channel :P

#

@marsh oasis if you need any further help or have questions

#

I'm here

marsh oasis
#

kkk

azure mica
#

Hey, does anyone here use self hosted task management tools similar to trello. Any recommendations?

nocturne crypt
#

jira is self-hostable

azure mica
#

It is ?

nocturne crypt
#

yes

#

depending on what parts of trello you're actually using

azure mica
#

I thought it was paid.

nocturne crypt
#

it is paid

#

it's also self-hostable

#

they're not mutally exclusive

azure mica
#

Oh I see, It's a Freemium model.

#

But it's not OS 😐

#

Who knows what they might be doing with my data.

nocturne crypt
#

the data is on your server

#

you just need a liscense key

#

you can always use gitea/gitlab to track issues

#

git is inherently great at tracking bugs

azure mica
#

@nocturne crypt
Thx for the recommendation, I'll consider it ❤️

warm sleet
#

Git does not have issue tracking

#

@nocturne crypt issues and PR's are not part of git itself

azure mica
#

Kanboard seems little bit dated. I don't think it's still being maintained.

warm sleet
#

Kanboard has way more users

#

last change was 3 days ago

#

its actively maintained

#

github usage metrics are not a direct indicator of software quality

#

but its a good guideline for support status of software

azure mica
#

👍

warm sleet
#

Most of these look much alike

#

Jira looks incredibly similair

#

I've previously used MantisBT for this kind of stuff, but it so convoluted and confusing to use

#
#

But mantis is ancient

pearl moth
#

can someone help with c# networking

warm sleet
#

sup

warm sleet
#

@reef tangle this is getting old ^

#

and he removed it

reef tangle
#

I removed it

unkempt osprey
#

ight can someone help me in python

#

im rlly stuck on this and its frustrating

#

How do i make it print once?

#

^^ Code ^^

vast echo
#

Looks like one print

unkempt osprey
#

^^ File being accessed ^^

#

output ^ ^

#

Im only reading line 4, but for some reason its printing it twice

#

idk how

vast echo
#

Are you calling the function twice?

unkempt osprey
#

not that i can think of

#

yeh i checked, nothing

#

it prints twice

vast echo
#

print a random thing right before you call readYamlConfig()

#

see if that prints twice

unkempt osprey
#

woah

#

it prints twice as well

vast echo
#

readYamlConfig() is working perfectly then

unkempt osprey
#

okay so its just my IDE then

#

okay that would make sense

vast echo
#

seems unlikely?

unkempt osprey
#

well its VSC and ive ran so many stuff on it

#

today ive ran so many outputs

vast echo
#

I doubt it would run a python script any different than anything else

unkempt osprey
#

its still doing it

#

still printing twice

vast echo
#

your code is probably doing exactly what you told it to do

#

just not what you meant to do

unkempt osprey
#

well i printed a thing and then it prints it twice

#

i don' think that's what it was meant to do

vast echo
#

is it in a loop?

unkempt osprey
#

nope i left it outside

vast echo
#

when you run the code are you somehow running it twice?

#

what if you put a print right under the shebang

unkempt osprey
#

okay ive tried a different file

#

and that ran once

vast echo
#

put a bunch of prints everywhere and see which ones print twice and which dont

#

that's all I can suggest without seeing your code

unkempt osprey
#

hmm, that's weird

#

im not able to figure it out

#

okeh i found it

#

thank you

vast echo
#

👍

hollow basalt
pale onyx
#

I am having some trouble with trying to do a very basic thing in JS canvas 😢

I am basically trying to get a police car image to change the src value lets say... Every 500ms so that it looks like the lights are flashing when its in "chase" mode
It's my friends project and I thought this would be super easy to add in, turns out its not lol

I tried using setTimeout and setInterval however because the function is running 60 times per second (60fps), those things glitch out and don't actually delay the amount specified

I found a sketchy way to get it to work however the timing is inconsistent, sometimes its changing the src normally so it looks good, other times it is spazing out and changing it super fast
I'll paste my code below and if anyone has a better idea of how I can fix this, please let me know
(Keep in mind there is a crap ton of other code doing other things in this file, I will just show the code for my issue)

... (This runs in the function 60 times per second when "chase" is equal to true)
startInterval()
this.myBitmap = copSirenIMG
...

... (This is outside of that function and runs normally)
function startInterval() {
  setInterval(switchSiren(), 500)
}

function switchSiren() {
  sirenNum++
  console.log(copSirenIMG)
  if (sirenNum >= 1) {
    sirenNum = -1
    copSirenIMG = copPicBlue
  } else {
    copSirenIMG = copPicRed
  }
}
...

nocturne galleon
#

anyone got some good tutorials for ASP.NET? I'm finding myself overwhelmed.. Idk the difference between ASP.NET core, framework, blazor, razor, MVC, SPA etc

#

I also wanna know if there's a way to control what is run client-side and if I can make it certain things will only run server-side

#

what I gather from this is use Blazor if I want a clientside app and razor if I want serverside, would that be correct?

nocturne galleon
#

I'm confused about this paragraph, what does it mean by migration? and whats a schema?

#

ok so I just googled it and that makes more sense now

hollow basalt
#

googled it

nocturne galleon
#

google cant even help me figure out what this get set shit means

hollow basalt
#

C# magic

#

Forget manually writing getter and setter

#

Let c# compiler do it for you

nocturne galleon
#

what does that mean tho

#

i get ID and title are variables

#

but im used to something like int VarName = 0; or something

#

not int VarName {get; set;}, I've never used that kind of syntax before

hollow basalt
#

Do you know getter and setter?

nocturne galleon
#

nope

#

lol

hollow basalt
#

learn that first then you'll understand me

nocturne galleon
#

hmm

#

what is the point of making variables private if you are going to have public methods to access them

#

why not just make them public?

hollow basalt
#

Welcome to OOP

nocturne galleon
#

so basically the whole thing is a bruh moment?

nocturne crypt
#

C# assumes the pattern that everything has a getter and a setter

#

because C# is Java

#

and thus suffers from all of the problems that plague Java

#

this is why in C++ they simply left structs, it was both for ABI compatibility and the fact that sometimes you just want public instance variables

#

C# is an intepreted language. or JIT (Just in Time) compiled languages, it has a lot of nuances

#

btw if you're deploying ASP.net in the wild you probably shouldn't

#

especially if it's a new project. C# just like Java is really expensive to host, debug, and deal with on a daily basis

hollow basalt
#

I think he's learning, not actual work

cinder kraken
#

C# has the advantage of having MSDN documentation, which is actually well done

hollow basalt
#

That's a weird advantange

#

I'm expecting something language specific craziness

cinder kraken
#

it uses visual studio as ide, which i kinda prefer

unkempt lotus
#

I find it hard to follow some of MSDN

#

especially some of the legacy stuff, but I mean, thats understandable I suppose.

warm sleet
#

All of microsoft's stuff is confusing

#

@nocturne galleon {get; set;} is for properties

#

these are fields of a class, that have their own get and set method

#

so you can have

class Foo {
  int someField {get; set;}
}

// outside you can do this:
var foo = new Foo();
foo.someField = 1;
Console.WriteLine(foo.someField);
#

with languages like java, you'd have to make two methods for this, getSomeField and setSomeField

#

in C# you can just write your own getter like so:

#
private int internalField;
int someField { get { return internalField; }; set { internalField = value } }
#

you can also make getters public, and setters private like so:

#
int someField {get; private set;}
#

@nocturne crypt I find debugging Java much easier and nicer than .NET

#

There's more "gotchas" with .NET

#

and stdlib in C# is messy/confusing

#

ASP is even worse in that regard

#

is does a lot of things behind the scenes, which you have little control over, and its not immediately obvious

nocturne crypt
#

I find C++ easier to debug than all of them

#

because I have full view of all the symbols

warm sleet
#

dont need symbols for java lol

#

just decompile

nocturne crypt
#

reverseing java apps with ida pro and optimizing is actually impossible

warm sleet
#

yes

#

use fernflower

nocturne crypt
#

i can't optimize the JVM

warm sleet
#

Yes, its a VM language

nocturne crypt
#

nor can i promise the JVM won't be a huge dick

warm sleet
#

you shouldn't be optimizing that

#

if you need native optimization, don't use java

#

or use a library that uses native bindings

nocturne crypt
#

i always need native optimization

warm sleet
#

pfshh

#

using C++ for applications that have to deal with business rules, is like stabbing yourself in the back

#

much rather use higher languages for this

#

you can do it, sure, but probably not as fast (development time)

nocturne crypt
#

naw C++20 is really fast to develop with

warm sleet
#

I don't want to deal with pointers.

#

at all.

nocturne crypt
#

it's gets a bad wrap because it's super old

#

and you don't have to

warm sleet
#

yes, but its still just gcc

nocturne crypt
#

it's designed so you don't have to

#

gcc is a compiler

#

you can use any compiler you want

warm sleet
#

??

nocturne crypt
#

C++ is independent of the compiler

#

it's a linguistic standard

warm sleet
#

yes, its a language spec

#

but really, the language is just C with a new typing system

#

no thanks

#

if I need native stuff, I just go straight for C

nocturne crypt
#

C++ is not C

#

it's not just a typing system on top of C

#

you're just ignorant, which is fine

#

C++ has backwards compatibility with C for people who want to use it, but honestly you're encouraged not to use that segment of the language

#

tl;dr Rust is literally just C++ with more compile time rules being enforced at comiple time

cunning flume
#

Hallo. This may or may not be the right place to ask but anyhow.
anyone where i can buy small boards with onboard Bluetooth which can have a code on it like controling led lights and stuff like that. hope it makes sense and if i does not pleas let me and i would try to explain it better
and pls do @ me or dm me

nocturne crypt
#

raspberry pis have on board bluetooth and you can put LEDs on them @cunning flume

cunning flume
#

which one can you recommend then snice cheapest i can find cost 500 DKK or 75 USD

#

@nocturne crypt

hollow basalt
#

I'm trying to build a rpi4 cluster

#

this si availalbe in my area

nocturne crypt
#

you can buy a rpi zero for $5 USD

#

i'm sure you can find it for $5 USD somewhere, i'm just not sure where. i guess shipping costs went up

hollow basalt
#

how much do you sell yours

warm sleet
#

its fast enough to play Pong

next igloo
#

How can i stop a css hover transition when the page refreshes

next igloo
#

Ya the circle thing

#

Its radius resets to 0% when i refresh the page, then goes to %50

#

When you hover over it it will be at 25%

#

Im not sure why it starts at 0% radius and moves to %50, i have never specified that to happen in the css file

oblique rampart
#

cached?

#

hit f12 and look at the devtools

next igloo
#

its a transition there is not animation tags

simple harness
#

i mean, maybe, maybe not

  1. have to then program different gate type. all the gates just now are one class
  2. you can make them from other gates and save them as blueprints, and I'm gonna be working on a way to save blueprints so you can just copy them to different files easily
    also here's the link to the git. gotta get that plug: https://github.com/DylanMcBean/LogicCircuitSimulator
hollow basalt
#

Looks good, too bad I don't know processing

warm sleet
#

@hollow basalt its just java

#

processing just creates a context so that you don't have to worry about access modifiers or imports

hollow basalt
#

it means I didn't bothered to click one of the files to look at

warm sleet
#

but processing is stupid lol

hollow basalt
#

but why though

#

why not jsut use java

warm sleet
#

you can use it, as a standalone java library

hollow basalt
#

or groovy/scala if you hate java

warm sleet
#

but its also its own language

hollow basalt
#

so it's a JVM language

#

no longer simply java

warm sleet
#

well

#

some people dont want to learn java

#

and just want to make stuff

#

typical PApplets have a setup() and draw() function

#

all you need, to do simple rendering

#

you can handle keyboard events, and make simple platformer games with that

hollow basalt
#

never used those tbh

#

but I understand that part

#

i mean if you could focus more on the logic

#

than whether or not this access modifier makes sense in the graphical part

warm sleet
#

I once got an F for an assignment with processing

hollow basalt
#

I'll F for you

#

F

warm sleet
#

they wanted me to store points as type int[][]

#

but I just did some imports at the top (since its just java)

#

and used List<Point>

hollow basalt
#

wait that's illegal

warm sleet
#

yes

#

F

#

i asked teacher why

hollow basalt
#

are you sure the assignment isn't about multidimension array

warm sleet
#

after he told me, I fixed it

hollow basalt
warm sleet
#

and I got an A

hollow basalt
#

and I got an A
@warm sleet that's a 0 from 100 real quick ngl

warm sleet
#

nah, it was the first programming course from my university lol

#

"Structured program development"

hollow basalt
#

you're first programming course is processing?

#

damn

warm sleet
#

yea

hollow basalt
#

my uni used C++ as the first programming course

warm sleet
#

2nd semester they move onto OO-principles

hollow basalt
warm sleet
#

and teach people java

#

if you can even call it teaching

#

my teacher literally spent an entire afternoon teaching people what a 'singleton' is

#

even though, singletons are by far the worst pattern in OO-design

hollow basalt
#

my teacher went fast and furious with design patterns

#

we are like burning 5 patterns in one class

#

so at the end

#

I only appreciated singleton , factory, adapter

warm sleet
#

Architectural patterns are the stuff

hollow basalt
#

the others, I forgot

warm sleet
#

Event Pipeline, Message Brokers

#

and all kinds of fancy facades

hollow basalt
#

Brokers are good

#

but now they are better left for specific apps

warm sleet
#

There's only a handful of patterns that I use readily

hollow basalt
#

I abused singleton so much

warm sleet
#

I don't use singletons in the traditionl sense

#

I don't need factories

#

and adapters, yeah, those are kinda typcal to have for interfaces that dont make sense

hollow basalt
#

I think my programming in android made me abused singleton

#

cause the class is a schodinger

warm sleet
#

I mean

#

to be fair

#

the android API sucks

hollow basalt
#

I don't know if it's alive or dead

warm sleet
#

its messy

#

very messy

hollow basalt
#

well yea

warm sleet
#

and singletons & factories are kinda irrelevant when you start doing IoC and DI

hollow basalt
#

tbf it taught me lessons about dividing the right process

warm sleet
#

Inversion of Control & Dependency Injection

hollow basalt
#

DI is really good

warm sleet
#

DI is very powerful

#

DI is an implementation of IoC

hollow basalt
#

ikr

warm sleet
#

IoC means, that you do not instantiate new objects

hollow basalt
#

I think my knowledge is mostly DI, and I didn't understand the IOC as a whole

warm sleet
#

you merely provide types that will be created by the framework

#

so things like with webservices in java

#

you just create service classes, and the framework creates instances for requests that are made

#

you never actually instantiate objects of your service classes

#

thats handled by the framework

#

this is typical IoC stuff

#

DI can help you tie into IoC

hollow basalt
#

I still remember the Rx

#

dunno if it actually got big in other countries

#

seems nobody appreciated rxjava that much

#

Idea is great, but it is pretty much handled by frameworks

warm sleet
#

@hollow basalt there's bunch of libraries to do observers

#

Libraries like Akka

#

for message driven application development

#

Akka is nice for Scala

#

since Scala has special operands for actors

hollow basalt
#

ah yes observe pattern

warm sleet
#

This was an actor hooked up to redis

hollow basalt
#

haven't heard that in a while

warm sleet
#

actor ! call

#

was the syntax

#

and actor looked like this

#
package chat

import akka.actor.Actor

class MessageActor extends Actor {
  def receive: PartialFunction[Any, Unit] = {
    case (c: String, p: Profile, m: String) =>
      println("[" + c.split('.')(1).toUpperCase + "] " + p.getFullname + ": " + m)
  }
}
#

One of the primary annoyances with scala that I had

#

c: String instead of String c

#

@hollow basalt yeah, I remember this now

#

this code, was from an assignment in school

#

I used my minecraft server's chat system, to 'test' actors

#

since that was already message driven

#
package chat

import java.util.UUID

import akka.actor.{ActorRef, ActorSystem, Props}
import com.knockturnmc.api.util.Utils
import com.knockturnmc.api.util.Utils.formatUUID

object ChatMonitor {

  val system = ActorSystem("ChatMonitor")
  val messageActor: ActorRef = system.actorOf(Props[MessageActor], name = "MessageActor")

  val host = "localhost"
  val port = 6379
  val db = 0
  val timeout = 10000
  val auth = ""

  var listener: Redis = _

  def main(args: Array[String]): Unit = {
    listener = new Redis(host, port, timeout, db, auth)

    listener.pSubscribe("chat.*", (channel, data) => {
      messageActor ! (channel, getProfile(formatUUID(data.substring(0, 32))), data.substring(32))
    })
  }

  /**
   * Fetches a profile from redis
   *
   * @param id the player id
   * @return the profile
   */
  def getProfile(id: UUID): Profile = {
    val redis = listener.pool.getResource
    val profile = Profile.fromJson(redis.get(Utils.getBytes(id)))
    redis.close()
    profile
  }
}
#

printed:

hollow basalt
#
c: String 

I used kotlin in the past

#

this still gets me

warm sleet
#

hehe

hollow basalt
#

why would anyone want a RTL

#

I actually tried to create a observer library just for the lulz and to learn

#

i yeeted every observer into a list

warm sleet
#

lol

hollow basalt
#

and iterated the list everytime something happens

warm sleet
#

should at least organize it somewhat

#

so it takes less computation

#

Observer pattern makes sense in code

#

but once you go to networked systems

#

oberver pattern is more that of event driven programming

hollow basalt
#

nodejs joins the battle

#

event loop is ready

warm sleet
#

@hollow basalt its quite funny

#

in some assignments in school

#

minecraft is my 'case' to test around

hollow basalt
#

So your documents are using minecraft as the subject

#

interesting

warm sleet
#

yeah, I needed something to apply actors to

#

and what better, than a global, already decoupled chat solution

#

that just needs redis to hook into

#

@hollow basalt ah yes, My motiviation for doing so

#

is right hre

hollow basalt
#

interesting, I might come up of a different way like a simulation or some sht

#

Minecraft is a good subject indeed

#

lel my creativity is down the gutter

warm sleet
#

teacher LOOOVE seeing diagrams

#

have one.

#

be satisifed

#

@hollow basalt the goal was to show off the simplicity when working with scala

#

a similair solution in java would require double the boilerplate

hollow basalt
#

show off the simplicity
words to live by

warm sleet
#

@hollow basalt KISS principle is still a good thing to follow

hollow basalt
#

I like KISSDRY

warm sleet
#

DRY principle is kinda, obvious

#

make stuff you use often into a library

hollow basalt
#

obvious isn't enough

warm sleet
#

@hollow basalt cool.

#

I can generate this kind of project structure now

hollow basalt
#

the structure of nodejs

#

lel

warm sleet
#

ye its a mess

#

the goal was to have a seperate module for generated source code

#

in common/

#

and main project source lives next to it

hollow basalt
#

i'm still used to seeing public folder

warm sleet
#

@hollow basalt its a bit odd. so the master project calls a generate step on common

#

which generates schema and client code for a given CMS configuration

#

and after that, it just includes it as a dependency in npm

#

the tsconfig is there, to just transpile the typescript code into js

hollow basalt
#

hmm

#

I'd rather build it in build/ then i'll know what to ship

#

or

dist/
#

that includes css

warm sleet
#

yeah when typescript transpiles

#

it goes to dist/

hollow basalt
#

makes more sense

warm sleet
#

ffs

#

a language is supposed to be a tool

#

but typescript is being really obtuse.

#

its making me angry

#

even its OO principles dont work

#

I defined a constructor in a supertype, I try to extend it, and the super type constructor does not exist

#

this doesn't refer to an instance, supposed to use super

hollow basalt
#

it means typescript isn't your type

warm sleet
#

but super resolves to undefined at runtime, while this is filled with supertype fields at runtime

#

but this cannot be used instead, because then compiler complains

#

this is so confusing

hollow basalt
#

I didn't get that part

#

this cannot be used?

warm sleet
#

Foo extends Bar, Bar defines fields

#

if you want to access those from Foo, you have to do super.fieldOfBar

#

but runtime, super doesn't exist

#

only this

#

but compiletime, this is invalid

#

because it says this.fieldOfBar is undefined

hollow basalt
warm sleet
#

yeah

hollow basalt
#

the magic of transpiling

warm sleet
#

its stupid

#

as if node wasnt bad enough, now typescript is being snowflake

#
import express from 'express';
import {UmbracoBlog} from "./heartcore.query";


const client = new UmbracoBlog("dev-test-project-01", 'en-US');
const app = express();
const port = 3000;

app.get('/', (req, res) => {
    client.getArticles().then((d) => res.send(JSON.stringify(d)))
});

app.listen(port, () => {
    return console.log(`server is listening on ${port}`);
});
#

this is the tiny fragment that I am trying to test lol

#

but it stumbles with the instance of UmbracoBlog

#

that constructor it has, is defined in a supertype called UmbracoClient

#

but typescript cannot find it, so i had to declare the same constructor in the subtype

#

idk why

nocturne crypt
#

what i find interesting is in a dual stack host

#

when you receive an ipv4 address as a web server

#

it appears as ffff:ipv4 address

#

and now you understand why i just use ma C++

#

boost beast makes designing websites so much easier

strange pawn
#

its in preperation for ipv6

nocturne crypt
#

i know why it's there

#

but there's a designated prefix for ipv6 to ipv4

shy helm
#

boost beast makes designing websites so much easier
@nocturne crypt C++ web building sounds like cancer 😛

#

Give me Spring Boot pls thx

nocturne crypt
#

it's really easy

#

C++20 is fun

shy helm
#

I like C++, but making web services in it does not sound fun lmao

nocturne crypt
#

you can even use rsockets in C++ if you want some of that goodyness

#

boost beast makes websockets soooooo easy

#

and it's a header only lib with the header only lib asio

#

in C++23 they'll be in the standard :)

shy helm
#

Dependency management in C++ is just cancer

#

and dependencies are v useful for a lot of web building

nocturne crypt
#

i mean it's easy enough for me

#

most of my stuff is just header based libs

#

cmake makes building other stuff super duper easy

#

like which part are you talking about? your headers don't show up? or you get like the can't find .so lib error?

#

when building web services it's super important to only use either static libs or header only libraries

#

or spam docker really hard

shy helm
#

Just in general, installing and managing C++ dependencies and getting them to work and compile correct is just suchhh a head ache

#

Especially compared to other build systems

#

even using static libs

#

Java? use gradle or maven and add a few lines to a config, bam, downloads, compiles, whatever automatically