#serious-discussion

1 messages · Page 119 of 1

icy locust
#

libstdc++ is a runtime.

pulsar pagoda
#

u mean the standard lib?

icy locust
#

also, you can use nodefaultlibs with msvc cl.exe

#

msvcrt is not mandatory

#

In fact you can build UEFI executables with msvc

pulsar pagoda
#

You work as a dev?

icy locust
#

why yes

pulsar pagoda
#

nothing just good to know who is and inst cause it's a math server and all

icy locust
#

pretty much the only widely used systems language that enforces runtime is golang imo

icy locust
jagged forge
#

as much as go pisses me off i do kind of miss it sometimes, after living in async rust hell for awhile

pulsar pagoda
pulsar pagoda
#

like js?

#

cause if it is i'm not gonna lie it sounds like it

jagged forge
#

no, async in golang is automatic and invisible

#

you just write code that looks blocking and it takes care of everything for you

#

or are you asking about rust

pulsar pagoda
#

rust

jagged forge
#

async rust has “futures” which sort of look like js promises but are kind of different

#

a future in rust is basically a state machine that you poll until it is ready, then it finishes by handing you data

#

the cool thing about futures is that they require zero heap allocations, so you can use them in contexts where you don’t have dynamic memory allocation

#

anyway you don’t have to think in terms of state machines, the idea is you sprinkle async/await in your procedural code and the compiler generates a state machine like something you would hand-write in C

pulsar pagoda
#

and u can have a callback i gather

#

that acts in that future?

jagged forge
#

not really, no callbacks are involved

pulsar pagoda
#

ohh

#

so data gets send back to the main context?

#

like in a variable

jagged forge
#

ummm yeah i think so, if i understand what you are asking

pulsar pagoda
#

but if it's polling then ur blocking

#

that would be put on a thread sutomatically?

jagged forge
#

well, no, if you’re polling you’re just checking if data is ready

#

you can go do other things while it’s not ready

#

like switching to polling other futures

pulsar pagoda
#

yeah so it's a way of handling multi threading

#

by not blocking the Main thread

#

i gather?

#

and then sending events to the main thread

jagged forge
#

well, it’s a way of handling concurrency. you don’t really even need multiple threads to use async rust

pulsar pagoda
#

once the future has been fullfilled?

#

concurrency is about múltiple actors accesing a resource

jagged forge
#

right, but you can do concurrency without having multiple threads, which is what JavaScript does

pulsar pagoda
#

why not just block the Main thread until resource is readt?

#

yes

#

that is called polling

jagged forge
#

well if you block the main thread you can’t do anything else

pulsar pagoda
#

which blocks

#

or would u handle

jagged forge
#

so one thing you might want to do is respond to other signals while waiting on some work to be done

pulsar pagoda
#

the data once the thread stops polling?

#

on that same thread

#

and the thread has a lock ?

#

on the data

jagged forge
#

so typically what one does in rust is pulls in an async runtime, which is not included in the standard library in rust

#

your async runtime will manage a collection of concurrent tasks you give it

#

if one of your tasks does any IO or waiting of any kind, the executor will switch to another task while waiting on that

static loom
#

is async typically handled the same by most programming languages, I'm trying to learn more about it to solve some python code involving asyncio and receiving packets and wondering how strict I need to be with my reading

pulsar pagoda
#

u should read about concurrency and multithreading

static loom
#

I found myself starting to look at bytes and realized I need to turn back

jagged forge
#

i am not sure how asyncio works in python sorry

static loom
#

I originally had threads but I ran into race conditions because I'm trying to receive too many responses simultaneously

pulsar pagoda
#

then what u want is events

#

have a thread that just listens for the request

static loom
#

I don't really know how to work out sorting my responses out without mangling them, but I'm pretty sure asyncio is what I need, not threads

pulsar pagoda
#

place it in a data store

#

and have a second thread be send a message

#

that there is stuff to process

#

async is threads

static loom
#

my conceptualization of it is something like, there's a buffer "out there" that receives the packets and somehow it's giving them to me, which is what my futures are, really just the results of the coroutines

pulsar pagoda
#

just with less verbosity

static loom
#

what do you mean by data store

#

I don't think you understand my problem

pulsar pagoda
#

i mean a variable that holds the data received by the polling thread

static loom
#

I'm trying to ssh into, say 50 devices, wait for about 8 seconds for a response from each, and most come in at around the same time

pulsar pagoda
#

ohh

static loom
#

this is where I end up getting mangled results with my threads

pulsar pagoda
#

so u don't have to be continuosly listening?

jagged forge
#

yikes, like a data race? i thought python was supposed to prevent that

static loom
#

well I mean I believe it can be done in python

jagged forge
#

i am sure it can

pulsar pagoda
#

which is why i said u should just leave a thread listening for the data

static loom
#

I dont' know past what I've seen on like stack overflow and reading some of the docs

pulsar pagoda
#

that way u make sure to receive all packets

static loom
#

but it's just not clear to me how to accomplish that, and I'm tired of reading haha

jagged forge
pulsar pagoda
#

idk

static loom
pulsar pagoda
#

threads in python are super ez

static loom
#

I know there's this whole GIL thing and so I'm picturing it juggling between listening for a bit, then doing something else like sending packets - which would cause it to not receive them or something idk

pulsar pagoda
static loom
#

I guess this can be handled by TCP asking for it to resend or something, I just don't know what's actually going on and I don't know how to gain visibility into that

pulsar pagoda
#

this uses threads in the background

static loom
#

why this vs asyncio

#

I want to do async and I'm doing io, seems like what I really want

#

there's a handful of different choices for concurrency it looks like in the standard library, I just don't know

jagged forge
static loom
#

I was using paramiko but that was when I was using threading

pulsar pagoda
static loom
#

I think that in and of itself won't work when switching to using asyncio, so I have started looking at switching to asyncSSH

pulsar pagoda
#

async execution of callables

#

aka callbacks

static loom
#

I just haven't started yet at implementing it, cause it's the weekend

jagged forge
#

im gonna be honest my experience with ssh is basically using the ssh command or using it through applications lol

pulsar pagoda
#

what are u trying to do with ssh?

jagged forge
#

it sounds like you are dealing with low level stuff like tcp/ip though

pulsar pagoda
#

is it file copying?

static loom
#

this is about 50% of my choice of using asyncio over concurrent.futures

#

and I read some convincing stack overflow answer

#

past that I know nothing

pulsar pagoda
#

wait

static loom
#

I'm just looking for arguments like pros/cons of each choice

pulsar pagoda
#

ur communicating between múltiple processes?

#

i need more context

#

what are u doing through ssh

#

?

static loom
#

ssh into the device, send some long running commands, then receive their response after about 10 seconds or so

jagged forge
#

well he is doing ssh which involves network communication

static loom
#

and I do this several times to each device let's say

#

then I take the responses and I save them all to one file all concatenated basically

#

although they don't need to be, it doesn't matter for my purposes

#

I end up running stuff to filter through those logs

#

but at that point the networking part is over with

pulsar pagoda
#

mm seems like orchestration is needed

jagged forge
#

so i can forget the stuff you said about tcp and packets, cuz that sounds a bit low level for what you are doing

static loom
#

yeah I think it's too low level

#

that's like layer 3/4, I want to work at like layer 7

jagged forge
#

it’s a shell, you’re sending commands, surely you get text or just a stream of bytes back?

static loom
#

yeah, it's a stream of bytes

jagged forge
#

okay, we can work with that

pulsar pagoda
#

are u having multiple ssh sessions at the same time?

static loom
#

I don't know how to ensure my stream of bytes doesn't get mangled between the different requests

jagged forge
#

have you made something that works for just 1 device yet

pulsar pagoda
#

or just executing each ssh sessions sequentially?

static loom
#

yeah I've successfully done this with threading

#

but my results ended up being chopped up

#

mostly they were fine, but a few of them were cut off, like halfway through one log was the log of adifferent device

#

at least that's what I'm interpretting as a race condition of my threading

pulsar pagoda
#

sounds like it

jagged forge
#

oh you’re saving everything to the same file though

static loom
#

yeah, I think I see what you're starting to get at

jagged forge
#

if you append to the file from the stream directly, then yeah i would expect it to get interleaved

pulsar pagoda
#

theres also the problem of using the same port for the ssh

static loom
#

I should be saving to individual files and then combine them later somehow

pulsar pagoda
#

to multiple machines

#

yeah

#

so

#

listen

jagged forge
static loom
pulsar pagoda
#

ports in linux

#

are files

#

so each session

static loom
#

each connection will have it's own separate ephemeral port

pulsar pagoda
#

ok

jagged forge
#

that sounds right

pulsar pagoda
#

then u need to listen on those specific ports

static loom
pulsar pagoda
#

what that means

static loom
#

when my program is running, unless I'm writing to a file, I should assume it's just all in RAM, and that's what you mean right

pulsar pagoda
#

is u have a thread listening to every message

#

and it doesnt process the message

static loom
#

like save each file to some array or dictionary for each host

pulsar pagoda
#

it just stores it in memory

static loom
#

and then combine it after all the threads have ceased

jagged forge
static loom
#

yeah there is

#

then you can decode however you want like ascii, unicode, etc

pulsar pagoda
#

yeah u could also save them in múltiple files

#

and then join them

#

i guess

static loom
#

I was sort of afraid it would be too much to hold in RAM

jagged forge
#

so just read the response into your byte string, then once you have all of the responses, write them one by one into the file

#

how much data is it, do you have any idea?

static loom
#

but maybe I'm underestimating howmuch RAM that device has, I haven't really checked

#

I don't have any idea, I mean it's just text so it can't really be that much now that I'm thinking about it

pulsar pagoda
#

or u could store them on a database like sqlite

static loom
#

maybe 3K lines of text logs per device

jagged forge
#

hmmm i feel like that shouldn’t be that much

static loom
#

I think before I was conflating the threading issue with reading from the buffer from the NIC (or however that works) rather than just me writing over the same file

jagged forge
#

well if each line were 1000 characters it’d be like 150mb, which is…. eh

static loom
#

so I think I'll try to see if I can fix it that way

jagged forge
#

yeah i wouldn’t worry about the NIC, i think the os is taking care of all that for you

pulsar pagoda
#

?

static loom
#

Yeah I think you're right

#

the lines are about, 100 or so characters probably

#

actually maybe 511

pulsar pagoda
#

3k times 100 30000

#

times 50

#

i would not handle that with python alone

jagged forge
pulsar pagoda
#

he says it's more than 100 average

static loom
#

I throw away the logs after reading them anyways

#

I might even just try filtering them as I receive them instead

#

I'm only picking out certain pieces

#

@pulsar pagoda @jagged forge thanks this has been really helpful

jagged forge
#

should be fine if you read all of it, based on our napkin math, but filtering shouldn’t be hard either

static loom
#

not stopping the conversation, just like, at a good point here

pulsar pagoda
#

yeah

#

try to get rid of the unnecessary text asap

static loom
#

yeah, it's clearer to me now how I was sort of misguided a bit earlier, I guess I have a semi lingering doubt about threading and the NIC

pulsar pagoda
#

the python GC could kick u in the balls

jagged forge
#

well it is good you are thinking about what the hardware is doing, i just think you were a bit confused

pulsar pagoda
#

but i think @jagged forge knows more about that

static loom
#

I feel like the threading bounces between being off/on to turn the other ones on, but the NIC is sort of always "on" so it seems like there would be a mismatch between it feeding data

#

I am pretty sure how I'm thinking about is not how it really works at all though, so I'm not really too bothered by that

pulsar pagoda
static loom
#

I just wish I knew what actually happens

pulsar pagoda
#

not a Bad thing

static loom
#

there's a kernel, there's some syscalls, there's some gpu pixies, etc etc...

pulsar pagoda
#

OS handles operations with the hardware for u

jagged forge
#

it goes nic buffer -> kernel buffer -> application buffer

pulsar pagoda
#

yes

jagged forge
#

each buffer will hold your packets more or less until they are needed

static loom
#

are all these buffers literally locations in RAM?

pulsar pagoda
#

but replace application by userspace

#

so kernel space buffer to userspace buffer

jagged forge
static loom
#

I see, that makes sense

pulsar pagoda
#

cause ur using cpu

#

for thks

#

this*

static loom
#

so it's sort of waiting to pass that on to the kernel buffer ASAP

#

otherwise it'll have to start dumping data on us

pulsar pagoda
#

the kernel handles a service

#

through a interface file

#

that service is interacted with by applications

#

through a API

static loom
#

that's starting to make sense, there's like an ADHD hamster in the kernel that like redirects what it's focused on, and so some of that time it's unloading stuff from the NIC's buffer for instance, is that fair to say

pulsar pagoda
#

yes timesharing scheduler

#

is called

jagged forge
static loom
#

I'm only worried about it as far as I know I'm receiving a lot of data at once

pulsar pagoda
#

which is why

static loom
#

and in the future I'll probably extend this to get even more data so I'm tryign to work out how I'd troubleshoot that

pulsar pagoda
#

u don't want to stop the flow of data

#

so thats why i suggested just keeping the thread on listening

static loom
#

I feel like I'm grabbing it, filtering it rather than just tucking it away to look at later

#

I think I see what you were saying earlier now, maybe future me needs a database, but I'll hold off for now

pulsar pagoda
#

yes but grabing it can happen while u receive another losd

#

load*

#

i feel like there should be a premade solution for ur problem already

#

somewhere

static loom
#

you would think

jagged forge
#

sounds like you are ingesting logs

pulsar pagoda
#

give me a sec

#

going to get something to eat

static loom
#

there probably is

#

I guess I'm still forgetting TCP handles error correction

#

so it doesn't matter if the NIC drops stuff, it'll ask to resend it

#

or something below me will if not the NIC

#

I don't know where that's actually delegated to

jagged forge
#

i am not sure at which layer tcp is handled

#

i guess the nic?

static loom
#

Feels more programmy to me

jagged forge
#

or the kernel

pulsar pagoda
#

tcp handles error correction

#

yes

static loom
#

if we're talking OSI model, I think the NIC basically handles layer 1 and maybe some layer 2

pulsar pagoda
#

and ur using ssh

#

that uses tcp

static loom
#

so I'm guessing the kernel/software is handling above that

jagged forge
#

yeah i think the kernel is handling retransmission

static loom
jagged forge
#

but the nic is definitely dealing with ip

static loom
#

I don't think it has that kind of capability

jagged forge
#

no opencry but i think the nic does some things based on ip addresses

#

maybe i am thinking of switches

pulsar pagoda
#

the NIC should have an asic that handles tcp and other stuff

#

switches do that too

#

at a bigger scale

#

@jagged forge check what i sent

static loom
#

I think at most it's looking at the CRC to determine if it should drop, and then checking the destination MAC matches before stripping the ethernet frame on to send it on up the chain

#

I guess it can continue to handle things for all I know

jagged forge
#

bro you know more about this than me opencry

static loom
#

lol

jagged forge
#

but i would not be surprised if some nics have tcp/ip stuff directly on them

static loom
#

I could see there being an asic though, that sounds reasonable

jagged forge
#

shit some nics have a full operating system on them

static loom
#

at least in a dedicated network device like a switch or router

jagged forge
#

smart nics

#

i have worked with an fpga nic that could filter packets

static loom
#

I have no idea how I'd actually confirm any of this, is there a way to peek into my laptop's NIC's firmware lol

pulsar pagoda
static loom
#

ok I tried using ansible in the past

pulsar pagoda
#

u can use wireshark

static loom
#

but it was just a bunch of shitty yaml config files

pulsar pagoda
jagged forge
#

yaml engineering opencryfried

static loom
#

I couldn't get it working but that was a long time ago

#

I might give it another try but the thought of it makes me cringe

pulsar pagoda
#

cause i know how to use kt

#

it*

#

i used to be the dev ops guy

jagged forge
#

personally i would just stand up a log database

pulsar pagoda
#

for My last gig

jagged forge
#

and point all of my applications at the log database

#

and have them push logs to the database

#

if what you want is logging anyway

pulsar pagoda
#

so for the thing of going through packets

jagged forge
#

centralized logging

static loom
#

that's not a bad idea but these logs aren't really that useful, I rarely need them

pulsar pagoda
#

u can use something called wireshark

jagged forge
#

ah, then maybe just have a script that collects them on demand, like you’re doing

static loom
#

it's just to check them, consolidate some info, then reissue some commands out to them

#

I also don't want to set up a dedicated logging server haha

jagged forge
#

if your logs are json you can filter them down with jq, otherwise grep is also your friend

static loom
#

we have other ones like that

pulsar pagoda
#

so

jagged forge
static loom
#

I used to filter them with awk

pulsar pagoda
#

ur running a Windows laptop?

static loom
#

awk is my favorite programming language

jagged forge
#

awk is also good, i am a noob at it

pulsar pagoda
static loom
#

I have wireshark

pulsar pagoda
#

if ur a bash good

static loom
#

but what will that do for me

#

I'm a bash god

#

🤣

icy locust
jagged forge
#

i hate bash starebleak

pulsar pagoda
#

like the Windows ABI?

jagged forge
#

actually i like bash, just not for long term things

static loom
jagged forge
#

i like command line stuff

#

i hate maintaining bash scripts

pulsar pagoda
static loom
#

I use bash/vim/awk/sed mostly all day every day

pulsar pagoda
#

vim gigachad

static loom
#

what am I tracking packets for

pulsar pagoda
#

in the house

jagged forge
#

wireshark is a cool way to peer under the hood, see what packets are being sent to where and stuff

pulsar pagoda
jagged forge
#

getting it to work with tls is annoying tho

pulsar pagoda
#

u just mentioned wanting to SEE what happens at the NIC

static loom
#

yeah, like the NIC buffer

#

like how to see it's memory usage stuff

jagged forge
#

ok im not sure wireshark will help with that lol

pulsar pagoda
#

mmm

icy locust
pulsar pagoda
#

no it would not

static loom
#

I'm more interested in seeing what all it's handling, is it just handling MAC addresses or does it also deal with IPs and TCP ports?

jagged forge
#

there should be some commands that show you your network cards and how many packets you have tx/rx and stuff

static loom
#

but # of packets is not really granular enough for what I'm trying to undertand

jagged forge
#

there’s a Linux cli tool called bmon that i like

static loom
#

@pulsar pagoda with ansible can you run code with it too?

jagged forge
pulsar pagoda
#

yes

#

it's pretty limited but You should be able too

static loom
#

from what I saw I was sorta hamstrung to just putting in specific lines over ssh, I didn't get too far before I decided to just try to do it all in python directly since that seemed more comfortable to me

pulsar pagoda
#

also u only need to set it up on ur machine

#

since it's daemonless

static loom
#

yeah, kind of like I'm doing

icy locust
static loom
pulsar pagoda
#

so are u working on a mac

#

or a Windows computer?

jagged forge
static loom
#

checking it out regardless

pulsar pagoda
#

cause powershell has some automátion thats right there with ansible

#

and it's better documented

jagged forge
#

it was a special cli program that came with the drivers. not sure if there is a similar general thing you can use on linux

#

that works for any card

#

if you find one let me know, that would be sick

pulsar pagoda
#

u can always just have a terminal listen to the output of the file

static loom
#

sure, yeah I should clarify the device doing the sshing is a red hat vm

pulsar pagoda
#

since the socket file would have all packet data

pulsar pagoda
static loom
#

I might be able to use a windows server to do it though, but I know barely any powershell

#

yeah

pulsar pagoda
#

like what are u using

icy locust
#

PS> Shutdown-Computer

jagged forge
#

this was on bmon’s github page

pulsar pagoda
#

Windows or Mac ?

#

as ur working machine

jagged forge
#

ooh multicast packets. my company deals with multicast

static loom
#

I'm working on the red hat box and running code off it

#

I just ssh into it to run scripts on the network

#

and I'll modify/experiment with them there too

pulsar pagoda
#

ahh ok

#

yeah ansible makes sense there

static loom
#

tell me more about ansible, you said it's limited but you can code

pulsar pagoda
#

it's a orchestration tool

static loom
#

I felt like it was kinda janky and I was fighting it a lot

#

like I just wanted to write code but it was trying to make me write these grating config files

pulsar pagoda
#

so it's supposed to be used to execute in distributed environment

#

once that yml is written that would execute on each instance

#

separately

#

so if u wanted to lets Say install something in 300 vms

pulsar pagoda
#

it would do it

static loom
#

so for instance, if I would want to ssh into each device, show log then would I be able to filter the data all collected to create new commands, then send those all back out - all without leaving ansible?

jagged forge
#

or modern cloud developers opencryfried

static loom
#

fortunately that's not my responsibility

pulsar pagoda
#

if u have to set up k8s manually u usually use ansible

static loom
#

cool in concept though

icy locust
#

saltstack

pulsar pagoda
static loom
#

I'm sorta aware of puppet/ansible/chef/salt but I feel like those are for people who don't know how to program

icy locust
#

eh

pulsar pagoda
#

if u can write the bash script that does it go for it

static loom
#

but they might just be nice conveniences to have too

#

I mean, more of a "pickign the right tool for the job" kind of thing

pulsar pagoda
#

yed

#

yes

static loom
#

I'd rather not write a bash script

icy locust
#

think about reinventing syslogd

static loom
#

yeah

pulsar pagoda
#

also ansible is the tool of choice of the eth Zurich hpc cluster

icy locust
#

we had log collection from distributed systems from 90s

#

I mean, still better than bash script

pulsar pagoda
#

Google eth Zurich

static loom
#

well right now I'm using python script, although originally it was a bash script actually

teal lion
#

what is the hpc cluster

#

that’s what I’m curious about

static loom
#

but I just went ahead and rewrote it cause it was easier to maintain

pulsar pagoda
#

a high perfomance computing ckuster

teal lion
pulsar pagoda
#

a bunch of computers

jagged forge
#

some say python is a better bash, though i know some people hate that sentiment lol

pulsar pagoda
#

python is ok for somethings

static loom
#

I use both, they're just easy and ubiquitous

jagged forge
#

yup

#

both are on most linux systems

pulsar pagoda
#

like if i have to copy stuff

#

i usually scp

#

and such

static loom
#

yeah I use scp relatively often

jagged forge
#

i don’t mind bash until you start doing anything more than 15 lines and with 2 levels of nesting

#

but also im just not that good at bash

static loom
#

it sorta grows on ya

#

the more I do it, the more I do it

#

and I guess the default hotkeys are emacs too, I sort of acquire more and more as I go

jagged forge
#

it does feel appealing in that it is quite minimal

#

and pipes are nice

static loom
#

it's nice to live off the land so to speak

jagged forge
#

but i hate expressing logic in bash

#

i like expressing dataflow and pipes and stuff

static loom
#

it's sorta goofy at times

pulsar pagoda
#

emacs

static loom
#

yeah I don't fully get it, that's why I use shellcheck when it's something I'm not throwing away

teal lion
#

Because I use bash more

#

therefore python is worse

static loom
#

mostly I'm throwing stuff away though, I'm usually doing some awk and sed to filter/organize commands from one thing into another thing to "pipe" it on its way

pulsar pagoda
#

like people think i'm a low Level hard headed programmer

jagged forge
#

lol

pulsar pagoda
#

who hates python

#

i really dont

static loom
#

I hated it when I first started learning it a long time ago, cause all I knew was Java

pulsar pagoda
#

i just wish people wouldnt SEE everything as a nail

static loom
#

and I missed that clarity of knowing the types of stuff going in and out on the first line, just irritated me

pulsar pagoda
static loom
#

then I got over it, and became a reckless python programmer

pulsar pagoda
#

i'm gonna finish foobar in java

#

just u watch

static loom
#

haha I don't know if I'd go back but I think a lot of concepts I learned in Java have helped me understand python better than if I had only ever learned python or something

jagged forge
#

java was my second language

pulsar pagoda
#

My first was cpp

static loom
#

I only learned it cause I was interested in programming android apps and my brother was making money making minecraft mods in Java, so I read through Headfirst Java and another android Java programming book, downloaded eclipse and went on my way

jagged forge
#

that sounds pretty epic

teal lion
#

I hate big IDEs like that

#

they feel big and clunky on my 2013 computer

static loom
#

it was a pain in the ass

jagged forge
#

are you a vim person?

teal lion
jagged forge
#

nice

teal lion
#

switched to neovim recently

jagged forge
#

my coworker convinced me to try neovim and i loved it at first

#

but in the interest of getting shit done i have reverted to vscode

static loom
#

I have neovim on my home computer but I just use regular vim elsewhere, unless they just have vi

teal lion
#

trying to setup a Haskell lsp without crappy JavaScript shit

jagged forge
#

neovim is so pretty though, with the right setup

pulsar pagoda
#

i usually have my .vimrc in github

static loom
#

I'm usually too lazy to edit my .vimrc, there are a handful of changes I have to make or I'm miserable though

jagged forge
#

haskell is pretty fun

static loom
#

I just download some random .vimrc off github and edit it up a little

teal lion
#

Haskell is fun because they typing is strong enough I never get runtime errors

#

it’s all at compile time

static loom
#

yeah they say that

#

haskell is provably awesome etc

pulsar pagoda
#

if u like Haskell u would like f#

static loom
#

most of the code I write is like garbage to get a job done as fast as possible, if I see a corner case I'll fix it if I have to, avoid it otherwise

#

I'm writing a bunch of one liner type crap

#

awk is my favorite programming language lol

jagged forge
#

if you want provably awesome code, lean 4 is a fully fledged dependently typed pure functional language as well as a theorem prover

teal lion
pulsar pagoda
#

are u talking about that spec writing lang?

teal lion
#

so it compiles with warnings or with nothing

pulsar pagoda
#

by Leslie lamport?

static loom
#

I learned a bit of haskell (for great good?) a long while back, but I didn't get too into it

#

I have heard some good things about closure/lisp but afraid to get sucked into the cult

#

functional programmers are cultists

pulsar pagoda
#

i consider python a cult

#

to an extent

jagged forge
jagged forge
pulsar pagoda
#

i know some

static loom
#

I think python just has a super low barrier to entry and it's just very accessible. It's got that social network effect, like if you're tryign to do something someone's probably already done it kind of thing. I lean on that as one of its key strengths imo.

#

I would use it less if didn't have that

teal lion
static loom
#

all I care about is maximizing my possibility of someone else having written the code for me out there

jagged forge
teal lion
pulsar pagoda
#

popular and large ecosystem doesnt necessarily translate to good u know

jagged forge
pulsar pagoda
#

c# generics to the rescue

jagged forge
#

as someone who works with less popular languages i have felt this

teal lion
pulsar pagoda
#

i do think the dotnet ecosystem is of a higher Quality than the python one

jagged forge
#

rust and go are not even unpopular but the ecosystem is lacking in certain areas

pulsar pagoda
#

true

teal lion
#

And the type inference errors being insane is a good sign you’ve written shitty code

pulsar pagoda
#

give them time

jagged forge
#

i had a good time with Haskell until i ran into monad transformers

#

that was like, my tipping point in terms of what i could handle

#

i wanted to eliminate my monad sandwiches which were causing me to write annoying nested matches

pulsar pagoda
#

don't let sharp hear u

jagged forge
#

we’re safe, it’s like 4am lol he’s asleep

pulsar pagoda
#

cats are My mortal enemy

#

Bruno died running after a cat

#

the cat also died tjoi

#

though

jagged forge
#

that fucking sucks

#

i am sorry he died in such a way

pulsar pagoda
#

mom told me today how she saw the light going out of his eyes

#

he's moving his tail in heaven

#

he was a good Christian dog

#

aint Even joking

#

he SAT with mom to watch the church sermon on sunday

#

didnt make a noise

jagged forge
#

sounds like he was the goodest of boys

pulsar pagoda
#

coco is sad

icy locust
pulsar pagoda
#

yeah

icy locust
#

ye they research a lot of stuff

pulsar pagoda
#

i have access to the cluster

icy locust
#

:O

pulsar pagoda
#

but i don't want to make appointment

#

cause their really strict

#

if i'm going to do an appointment for the cluster i want to have everything ready so i don't waste time

#

on thinking the setup of the sim

jagged forge
#

sheeeesh 50000 cores

icy locust
#

yeah it would be helpful if they made full ansible configuration (minus actual topology details) readily available, so that workloads could be locally tested be before submission

pulsar pagoda
#

nope they give u a subset of the actual compute

#

as a vm

#

and then u set Ur shit there

#

or a couple of vms

icy locust
#

is it x86?

pulsar pagoda
#

they have both x86 and arm

#

plus fpgas

#

and gpus

icy locust
#

Ooooo fpga clusters nom

pulsar pagoda
#

yeah i'm doing hls

#

remember

icy locust
#

next they should get a quantum

pulsar pagoda
#

i think

icy locust
#

yeah it's pretty useless yet iiuc

jagged forge
#

sharing 100 qubits is different from sharing 50000 cores i imagine lol

pulsar pagoda
#

we can't get to that number of qbits yet

#

i think

#

Google it

#

i can be wrong

burnt ledge
#

why is it so hard to make more than a handful of qubits

static loom
pulsar pagoda
#

material scientists have a better grasp at the problem

static loom
#

they give you some amount of computation time per month for free

jagged forge
#

so ibm has a computer with 433 qubits

pulsar pagoda
#

nevermind then

#

i said nothing

static loom
#

whack

jagged forge
#

i know there is a difference between physical and logical qubits tho

static loom
#

the NSA is hackin' everybody with that no doubt

#

shit ansible is owned by red hat, which in turn is owned by ibm

jagged forge
#

cuz a decade ago d-wave advertised 2000 qubits and scott aaronson roasted them

icy locust
#

ah yes, the transitive relation

static loom
#

that's how they getcha

pulsar pagoda
#

so u need more than one physical qbit for a logical one

#

cause u have to take error correction into account

#

thats what i gathered from the wiki

static loom
#

makes sense

#

they do that with regular bits too, so no reason it would be different I suppose

#

error correction that is

pulsar pagoda
#

yeah

#

going to sleep

#

cya in 7 hours

static loom
#

later, I probably should too

jagged forge
#

i am going to be so fucked up in terms of sleep on monday

#

maybe i will just do an all nighter at this point

static loom
icy locust
last creek
vital jay
#

what is reverse chain rule

neat lintel
#

but, it's || u-sub ||

frank orchid
#

I struggle to evaluate equations

#

I know what i’m doing, but I make a lot of arthimatic mistakes with algebra

#

Do I need mental math skills or…

last creek
#

Just practice

#

Imo

#

It can help to consciously slow down and value correctness over speed

#

While learning to use some concept or formula, also try to develop methods to check your work if possible

balmy fulcrum
#

thanks for that '

inland raft
#

@autumn onyx actually i think those are not equal

last creek
solar hawk
#

nvm lol i figured it out

pulsar pagoda
#

@jagged forge take a look at this

sharp turtle
#

Ello people from discussion 2

#

I am wapeanut

#

Or a peanut

#

No people😭

jagged forge
#

based on what i have read, i am guessing you can use a concrete instantiation of a template but not the (unbound) template itself

pulsar pagoda
#

i wonder if theres a reason why unsafe code in c# cant use c# generics

#

@jagged forge cause the examples of code from c# dont have any generics at all

#

for example @jagged forge

#

go at the top solution for this

#

and read the sentiment behind using unsafe

#

they dont give an argument against it

#

its more like i dont want to use unsafe

solar hawk
#

Two pings in one message DAMN

pulsar pagoda
jagged forge
pulsar pagoda
#

so

#

there has to be a way of making constraints for the unmaged generic types to a integral type

#

cause the runtime itself supports those integral types

#

ive seen them on the runtime

#

say yes if ur following what i mean

#

if not ill explain in more detail

jagged forge
#

im not following but i am also not that interested in c# honestly

pulsar pagoda
#

ok

#

so heres the thing

#

templates only allow the passing of integral types at instantiation

#

what this means is that when u use a template function u need to pass the type of the argument

#

and that type needs to be of a integral type

#

at compile time

jagged forge
#

can’t you have templates that accept non integral types, i am confused

pulsar pagoda
#

cause template signature functions need to be resolved at compile time

#

not at runtime

jagged forge
#

i have definitely used templates with non integral types for things like json marshaling

pulsar pagoda
#

this is not possible in cpp

#

im certain of this

jagged forge
#

is std::unique_ptr<std::vector<T>> not an instance of a template with a non-integral type

pulsar pagoda
jagged forge
#

what does that mean

#

a vector is not an integer no matter how you look at it…

pulsar pagoda
#

the address to which it points is though

#

so a pointer address can be seen as a integer

#

with function composition

#

which in cpp terms is called overloading

jagged forge
#

a vector is a struct with 3 pointer-sized fields

#

doesn’t seem pointer-ish to me

pulsar pagoda
#

a struct is a pointer

#

sec

#

i think im confusing pointers with references

#

also mind u

#

c doesnt have "variable references"

#

asking my cpp expert friend

#

ok

#

so heres the thing

#

last 6 messages

#

disregard them

#

u can pass a struct to a template argument

#

but u need to specify its type as the name u gave to the signature of that struct

#

in the c# documentation of microsoft ```In C#, a generic type parameter cannot itself be a generic, although constructed types can be used as generics. C++ does allow template parameters.

#

also c++ allows for having function passed to the template

#

as function pointers

#

thing is kind of convoluted it seems

#

mmm

#

the overloading can be overwhelming at first but people should be able to get the hang of it with time

#

just a guess though

#

key takeaway

#

all of ur templates calls should have types which are resolved at compile time

loud snow
#

@pulsar pagoda anything promising on qcomputing?

pulsar pagoda
#

idk enough math for it

#

but my phd friend

#

says its all hype

#

at the moment

loud snow
#

are they here?

#

idk the hype

#

i know it exists somewhat

#

but im not sure specifically what

pulsar pagoda
#

their like

loud snow
#

im thinking of playing around with qiskit

pulsar pagoda
#

were going to be able to do computations on stochastic functions

#

with more precision and shit

loud snow
#

o

#

ok

pulsar pagoda
#

and im like

#

u dont even want to learn measure theory for probability

loud snow
#

?

#

no u def do

pulsar pagoda
#

thats the average mindset from people i see with hype over quantum computing

loud snow
#

o

pulsar pagoda
#

like my mindset is

#

im gonna focus on the current stuff at hand

loud snow
#

i mean everyone i remember that hyped over it when I was in school never gave me any good reasons

pulsar pagoda
#

so i can get to that

#

eventually

#

i deal with a lot of software people

loud snow
#

software ppl come in different varieties tho

pulsar pagoda
#

the python ones

loud snow
#

them too

pulsar pagoda
#

the ones that only want to do python

acoustic yarrow
sonic jungle
#

Hey anyone knows that feeling when you're trying to find a general formula for a parametric sequence and at each new order you find out your formula doesn't work anymore and you spend literal hours trying to understand it until past midnight at which point you're so obsessed with that problem you go to a math discord server to complain about it before going to bed?
Because I sure do

neat lintel
sonic jungle
#

Oh what was it?

neat lintel
#

it will be kinda long to describe the problem now

#

but I also feel ashamed because it turned out to have a simple solution opencry

#

I was dumb ngl

sonic jungle
#

Well, nice to know I'm not alone in this lmao

#

Oh last time I had that kind of problem the solution was everything but easy XD

neat lintel
#

but the bond with problems that u spend hours on is real

sonic jungle
#

I basically found a general expression for Catalan numbers without even knowing about their existence somehow

neat lintel
#

kinda becomes a part of u at that point

sonic jungle
#

Once you solve them. Before that it's kind of a toxic relationship lol

neat lintel
#

and after solving you will remember it forever

sonic jungle
#

For sure

sonic jungle
#

Guess I just can't get enough of it

#

It is super fun though, you're right

#

Hopefully it's not Catalan numbers again cause it looks similar

mint patio
#

@jagged forge @burnt ledge

#

Ok so like

#

We're solving a nonlinear ODE right

#

So we get the homogenous and particular solution

#

The first two terms are the homogenous solution, the last term is the particular solution

burnt ledge
#

if its nonlinear does adding homogeneous and particular still work

mint patio
#

Isn't that usually how you solve nonlinear ODEs, it's been a while since I've taken ODEs lol

mint patio
fathom swallowBOT
#

fffeatherrr

#

fffeatherrr

mint patio
#

Now here's what's tripping me up

#

There are three obvious cases

burnt ledge
#

i thought the ppint of homogenous/particular was using the linearity of the ODE to apply superposition, and adding any two solutions gives you another solution

mint patio
#

r < 1, r = 1, and r > 1

#

We begin with the r < 1 and r > 1 cases

jagged forge
#

nonlinear bleak

#

do you mean a linear nonhomogeneous equation

mint patio
#

oh

jagged forge
#

lol

mint patio
#

yes

burnt ledge
#

Thought so but trusted ur word more

mint patio
#

We can rewrite this as so

#

(Again isntead of F_0/(k-mw^2), we can write it as (F_0/k)/(1-r^2))

#

So for the r < 1 and r > 1 cases

#

My professor says assume initial conditions = 0

#

Then he plots the behavior of the particular solution only? Against the forcing function F = F_0 * cos(wt)

#

Which looks like this

#

This is for r < 1

#

This is for r > 1

#

Then we move onto the case that r = 1

#

now for this he just ??? plots the behavior of the whole solution ???

#

And so what I'm stuck on is

#

This is what my notes look like rn

burnt ledge
#

is the ODE by any chance damped forced harmonic motion

mint patio
#

Undamped, but yes

#

Undamped forced harmonic motion

#

So these are my notes rn

#

I just want a clean reason/transition from

#

"Oh first we plot x_p against F(t) for when r < 1 and r > 1" to "then we plot x (the whole thing) against t when r = 1"

burnt ledge
#

I cpuld go back to my first year notes and see how they prove this

mint patio
#

I know how

#

Don't worry

#

It's not a misunderstanding of the math

#

Purely like

#

how do I order my notes lmfao I don't like the way he does it

#

It's so random

#

oh first we focus on just the particular solution

#

for r < 1 and r > 1

#

but for r = 1 we focus on the whole solution

burnt ledge
#

I mean isnt for all three we are taking initial conditions = 0?

mint patio
#

Yes

burnt ledge
#

In all three cases, the whole solution = the particular solution

mint patio
#

No

burnt ledge
#

How

mint patio
#

The first term and the last term are left over

acoustic yarrow
mint patio
#

But the particular solution is only the last term

burnt ledge
#

if initial conditions are zero then the sln to the homogenous is zero, and particular is all thats left

#

regardless of r, no?

mint patio
#

The homogenous solution is -F_0/(k-mw^2) * cos(w_n *t) no?

#

which is only 0 if F_0 is 0

#

F_0 is not an initial condition and we're assuming it's nonzero

burnt ledge
#

F0 is the nonhomogeneous part i think

#

Unless im pooping

mint patio
fathom swallowBOT
#

fffeatherrr

burnt ledge
#

Yeag

mint patio
#

The homogenous solution is this

burnt ledge
#

the f0 only comes in when ur doing a particular solution, bc the homogenous part wojld be a solution to mx.. + kx = 0

#

Which doesnt even have an f0 term

mint patio
#

Ok can we restart somewhat?

burnt ledge
#

Sure

mint patio
#

Okay

fathom swallowBOT
#

fffeatherrr

burnt ledge
#

Yega

mint patio
#

I'm even more confused now so bear with me

#

We said that the solution will be the sum of a homogenous and particular solution

fathom swallowBOT
#

fffeatherrr

#

fffeatherrr

#

fffeatherrr

mint patio
#

so we do some math and find the constants and we get

#

when you compare terms it seems like the first two terms make up the homogenous solution and the last makes up the particular?

#

but that doesn't make sense because the homogenous solution shouldn't even have an F_0 term in it lol

mint patio
#

to this

#

then the first two terms make up the "homogenous part" and they match up with the solution obtained previously in my notes when we considered unforced motion

#

but that would mean that the second term is the particular solution

fathom swallowBOT
#

fffeatherrr

mint patio
#

So now that doesn't add up sully

#

But whatever

#

I can turn a blind eye lol

#

But still that leaves me with trouble when I do my notes

#

Because if I say that I'm interested in the behavior of the particular solution only

#

Well ok clearly it depends on whether r < 1, r > 1, or r = 1

#

For r < 1 and r > 1 the math checks out

#

But when r = 1

fathom swallowBOT
#

fffeatherrr

mint patio
#

So my professor rectifies that by taking the limit as r -> 1 <=> lim w -> w_n

#

But the thing is he takes the limit of the WHOLE solution

#

which gives you an indeterminate form (in the last term) and then you apply L'Hopital's rule and simplify and it's easy

burnt ledge
#

Okay i was working thru it and im confused now too

mint patio
mint patio
burnt ledge
#

idk what exactly, but i feel like im messing something up, or misremembering something, or forgetting something

#

which i havent done diffeqs since first year so its likely

mint patio
#

felt

jagged forge
#

reminds me vaguely of bifurcation theory

mint patio
#

I think the answer is that my professor just wanted to highlight how the particular solution behaved, since we already knew how the homogenous solution behaved

#

No? Maybe? Idk let me think more

#

It's pointless to think too hard over this lmao thank you but I think it's best to just move on @burnt ledge :P

jagged forge
burnt ledge
jagged forge
#

my experience solving recurrence relations (which are related to differential equations) tells me you just have to solve singular cases separately

#

i have never taken differential equations but i had to do some recurrence relations in my probability textbook recently

solar hawk
#

Fucking hell

#

I hate recurrence relation

jagged forge
#

what are you doing recurrence relations for

solar hawk
#

To code something for him

#

And the sequences were defined in terms of eachother 😭

#

How do I code that? I’m not sure

last creek
#

Recursion is goated

solar hawk
#

But idk how to handle a defined in terms of b and b defined in terms of a.. 😭

jagged forge
#

well, just make two functions that call each other

solar hawk
#

How

#

I was in cpp

jagged forge
#

a_n = f(b_{n-1})
b_n = g(a_{n-1})

solar hawk
#

Yea

#

It didn’t work

#

The first line would error

jagged forge
#

why

solar hawk
jagged forge
#

then just define b?

solar hawk
#

Yeah

#

Below

#

If I define it above then

#

Same thing backwards

jagged forge
#

aw

#

that’s lame

solar hawk
#

Ikr

jagged forge
#

here’s how you do it in c++ apparently

solar hawk
#

o

#

Thanks

jagged forge
#

i think you do not need to make a class

#

you can just declare f and g in a header file first

#

and then implement them together

burnt ledge
#

yeag

#

it shows that in the C example

solar hawk
#

Wait

#

Huh

#

Ohh

burnt ledge
#

except it doesnt do it another file but thats just how they decided

solar hawk
#

Right lol

#

I’m fucking stupid

#

Iv done this before 💀

jagged forge
#

oh can you just declare it and then implement it separately in the same file

#

nice

solar hawk
#

Ye

#

No cuz like

#

Yk how lambdas are

#

So my “declaration” of function a

#

Included function b

#

But if I just use normal fking functions it isn’t a big deal

#

I’m dun

jagged forge
#

yeah lambdas are a bit annoying i guess

solar hawk
#

Yeah

pulsar pagoda
#

amukh

#

the chapter on functions

#

of schaums outline

#

covers recurrence relations

#

go read it

pulsar pagoda
solar hawk
#

classic

pulsar pagoda
#

classic u not knowing where to find stuff

#

cause u have not read ur books?

solar hawk
solar hawk
#

Man stop coming at me w the truth

pulsar pagoda
#

bro

#

im fucking reverse engineering drivers

solar hawk
#

Damn

pulsar pagoda
#

and i have time to shit post

#

like

#

get ur shit together

#

u can do it amuk

#

we all know u can

#

believe in urself my dude

solar hawk
#

Ur a good friend dandida

pulsar pagoda
pulsar pagoda
#

@jagged forge u there?

jagged forge
#

hi

pulsar pagoda
#

i need help

#

theres a c object i need to get the info from

#

in debug mode

jagged forge
#

use gdb i guess

pulsar pagoda
#

im seeing this object in pdb

#

mapped in a struct through ctypes

#

xclDeviceInfo2

#

i found it in the debugger is used for initializaing the board apparently

#

i need to get the values the python script is using to map them to a cpp struct so i can use them

#

i think this is not even the data yet

#

just an array of tuples

#

zzzz

#

yes thats what it is

#

fuck my life

terse comet
#

why is discussion-2 always just programming these days

pulsar pagoda
#

cause im going schizo

#

seeing shit code

finite inlet
pulsar pagoda
#

its python binding to c

#

that deal with mmio

#

and buffer allocations

neat lintel
#

Someone here worked at bostom dynamics right?

#

Why did they not use AI for the robot?

jagged forge
neat lintel
#

It's so disappointing to learn that all of the robots movements are hand coded

jagged forge
#

we are fugitives in this server

sage prawn
#

Hello

pastel spruce
neat lintel
fervent flame
#

how would you go about using "AI"?

pastel spruce
# neat lintel Ai so you don't need to hand code every movement the robots does

That'd be really nice honestly, but AI probably isn't at that stage yet. Or maybe it is (to some degree) but probably confined to a university lab or something. Feel free to drop links if you're aware of examples (I find this stuff interesting and would like to know what's out there).

If they coded everything it's probably to make sure that the robot can perform reliably. Using AI might be possible, but given some of the ways it's implemented I'd imagine analyzing the system's performance and trying to fix bugs is probably more troublesome than a more "classical" approach. Industry tends to be a bit more conservative and slow from what I've witnessed (which is reasonable if you want your stuff to be reliable).

I'm no expert, but that's my two cents (or educated guess I suppose).

celest idol
#

Whats the integer of 23,437

rocky shuttle
#

Don't spam multiple channels with your nonsensical question

inland raft
#

Is there a site where i can learn high school phisics?

#

Something similar to khan academy

steel blaze
#

you spelled physics wrong

neat lintel
#

organic chemistry can help you with organic phisics...