#development

1 messages ยท Page 63 of 1

warm sleet
#

you should create a new table

upbeat nymph
#

I guess in general it's semi useless because I'll need to benchmark all libraries differently considering the others expect me to track it

warm sleet
#

with a pk: <player1, player2, match>

#

and then move all the player stuff away from match

#

player <--> playermatch <--> match

#

then you can just join on that really easily

upbeat nymph
#

In production sure...but I don't know how that level of polymorphism would help in this case?

warm sleet
#

this is just normalizing

upbeat nymph
#

ah

warm sleet
upbeat nymph
#

I never dug into it that much valeGiggleA

warm sleet
#

Yeah I am used to working in 4th NF

upbeat nymph
#

Why not 6th?

warm sleet
#

because I am not google

#

@upbeat nymph these layers of normal forms are just to create consistency in your database

#

but way out of proportions for this case

#

@upbeat nymph you don't really need that id

#

wait.. no you do

upbeat nymph
#

yeah, I thought that too, until I realized this program is just counting lines giggle

#

Again, me being stupid

#

And needing sleep

warm sleet
#
SELECT matches.id, matches.score, p1.rating AS rating_p1, p2.rating AS rating_p2
FROM matches 
JOIN players ON matches.player1 = players.id AS p1
JOIN players ON matches.player2 = players.id AS p2
#

@upbeat nymph how about this ^?

upbeat nymph
#

The problem is other libraries (like this: https://www.npmjs.com/package/glicko2) expect you to track the instances of the players yourself...so that wouldn't work on all...therefore giving advantages to one over the other...although based on the results, I could make it work...but I'll have to tinker with the results and how that query is returned in this environment..my concern though is that I'll be doing "unfair" steps for other libraries that I'm not for mine (go-glicko).

#

I may just end up splitting it into two individual queries in the effort to be fair

warm sleet
#

:3

#

I've written queries that were >50 lines

#

querying two dozen tables

#

returning a single result

#

becomes a headache real quickly

#

right

#

this seems straightforward

#

you pull the players you need to calculate for

#

query their entire match history

#

and then calculate

#

you don't want to be crunching the entire database in one go

upbeat nymph
#

That's where everything gets messy.

#

So I have to try to be as fair as possible.

warm sleet
#

they use Periods

#

something the other lib does do

upbeat nymph
#

Yeah, except the way the players are tracked is inherently different.

warm sleet
#

they just provide them differently

#

interface bit different

upbeat nymph
#

same general concept though

warm sleet
#

players.sort(function(pl1, pl2){ return pl2.glicko.getRating() - pl1.glicko.getRating(); });

#

is what

#

period.Calculate();

#

probably does

upbeat nymph
#

nope

#

period.Calculate runs the algorithm which runs about a 7 step process to up mu, phi, rating, rd, sigma, and things like that based on the difference in the score between player a and player b and then sets the post rating based on that.

#

The first on is just a sorting based on the rating

#

But you need all the players because even if a player didn't perform in a rating period they need to updated to reduce the confidence in the player's performance by increasing sigma and rd.

warm sleet
upbeat nymph
#

what about it?

warm sleet
#

the other library

#

does not even do this

upbeat nymph
#

yeah, they do it differently. But same basic principal

#

I just split the calculations into more functions and a different class because .Touch uses the same functions as well

warm sleet
#

Player.prototype.update_rank = function(){

#

I hate javascript

upbeat nymph
#

yeah....

#

it's ugly

#

That's also 6 years old

warm sleet
#
    Player.prototype._variance = function (){
        var tempSum = 0;
        for (var i = 0, len = this.adv_ranks.length;i<len;i++){
            var tempE = this._E(this.adv_ranks[i], this.adv_rds[i]);
            tempSum += Math.pow(this._g(this.adv_rds[i]), 2) * tempE * (1 - tempE);
        }
        return 1 / tempSum;
    };
#

think anyone understands this

upbeat nymph
#

this is more comparable

warm sleet
#

one mechanic

#

3 different kinds of interfaces

#

and this one is different yet again

upbeat nymph
#

You talking about the packages?

#

mhm

warm sleet
#

yeah

#

this one expects you to make a playerFactory

upbeat nymph
#

Yeah, the reason I converted go-glicko is because it focuses more on the rating period

warm sleet
#

this algo is so simple

upbeat nymph
#

Which is where the matches and calculations should live

#

IMO

#

The player should just be used to track the player ratings...not track matches in a rating period..etc.

#

And instance of rating period should not be directly tied to a player...but a player should belong to a rating period

#

IMO

warm sleet
#

you should just have a List of matches that you feed into the algo

#

not care about anything else

#

all this weird player nonsense they do

upbeat nymph
#

Which package?

warm sleet
#

all of them

next igloo
#
var gunTimer, bulletMove, ammo = 20, cursorX,
  cursorY;

$(document).ready(function() {
  $("#stage").click(spawnBullet);
});

$(document).ready(function() {
  gunTimer = setInterval(bulletMove, 1000 / 60);
});

function spawnBullet() {
if (ammo >= 1) {
    ammo--;
  let bullet = new Object({
  setup: function() {
    this.css("top", ($("#gun").position().top = $("#gun").position().top - 4  + "px"));
    this.css("left", ($("#gun").position().left = $("#gun").position().left - 4  + "px"));
    this.css({transform: "rotate(" + (Math.atan2(cursorY - ($("#gun").position().top + 4), cursorX - ($("#gun").position().left + 20)) * 180 / Math.PI) + "deg)"});
    function bulletMove(e) {
    this.move($(this).css("left", ($(this).position().left = $(this).position().left - 5  + "px")));
        }
     
    },  bulletmove: function() {}
  })
}
};
upbeat nymph
next igloo
#

what is wrong with this code

warm sleet
next igloo
#

particulally the function spawn bullet, the rest of it works

upbeat nymph
#

That's just one equation

#

@warm sleet, there's about 6 more

warm sleet
#

@upbeat nymph my deep dive into sewer flowrate calculations based on geometry and sensor values was bad enough

#

I think I'm going to leave it as is, good luck with your.. assignment?

upbeat nymph
#

It's not even assignment. This is just for fun

#

It's taken me months. And this is just one part

#

Because I'm abstracting it for a team based game

#

which is...different

upbeat nymph
warm sleet
#

@upbeat nymph if you want to create reproduceability between individual runs

#

use a seed

#

to generate all your data

#

and then just store the seed and the result

upbeat nymph
#

I guess in theory the file size would be semi-small. I'm just thinking about seeing 10m rows.... :/

#

That would take a while.

#

Because it's already a fraction smaller than a json file is

#

ehhh, fuck it. I'll see multiple tables raning from 1k - 10m. Let's see what happens

#

bed time

#

Huh, didn't even make it...ran out of memory

#

time to pool the connections

#

Still running out of memory. Huh. I'll have to tackle this issue tomorrow

next igloo
#

im getting an error that this.css is not a function
this.css("top", ($("#gun").position().top = $("#gun").position().top - 4 + "px"));
what would i have to change at the start for the code to work?

warm sleet
#

?

#

its uppercase?

next igloo
#

i have other code that uses $(this).css

#

so i would not think it would be that

#

oh

warm sleet
#

thats jquery

next igloo
#

i forgot $()

#

maybe thats why it wont work

warm sleet
#

look

#

this is jquery, not normal javascript in the browser

#

@next igloo you can only retrieve values through the API

#

if you set a style to have absolute positioning

upbeat nymph
#

Why not just...use JavaScript?

#

Like fuck the CSS

#

And shit

#

Use something like bye

#

Vue*

#

Wait. Never mind

#

This is my sleep deprived ass

warm sleet
#

what you could do is $('selector').css("top", newvalue)

upbeat nymph
#

Iโ€™m a fucking dumbass. I need to get off discord and go the fuck to bed

warm sleet
#

these are the fields you could set for absolute positioning

#

Quite sweet with the react extensions

late plank
#

Personally I use tailwindcss and I really like it!

nocturne galleon
#

This is always mentioned by my colleagues, very interesting

bright hound
#

so the problem is classically refered to as traveling salesman

warm sleet
#

@bright hound traveling salesman problem is something else

#

thats the question: how can a person travel to all nodes, with fewest moves possible

#

but thats not computable

bright hound
#

so it's brute forcable for small graphs

warm sleet
#

@nocturne galleon they may also know A*, (A-star) a variant of Dijkstra's with heuristics.

#

@bright hound its not computable

#

there's no one definitive answer

#

or at least, no way to consistently calculate

#

The P versus NP problem is a major unsolved problem in computer science. It asks whether every problem whose solution can be quickly verified can also be solved quickly.
It is one of the seven Millennium Prize Problems selected by the Clay Mathematics Institute, each of which carries a US$1,000,000 prize for the first correct solution.
The infor...

#

this gets philosophical very quickly

bright hound
#

it's np hard. so it's computable as a brute force with O time (O(n^4), O(n^3*2^n)) Tra

#

brute force computation is still computation.

warm sleet
#

there's no way for you to verify if it is indeed the shortest path

bright hound
#

brute force.

warm sleet
#

yeah but you never definitively know

bright hound
#

test all paths. add their lenghts find shortest

warm sleet
#

there may be another route, equally as fast

bright hound
#

this is a terrible algorithm and it's time expensive to run but it is an algorithm that can be run. it scales horribly as n increases and you will run quickly into calculation times that get ridiculous quicly. it is howeverl quite parallel friendly pick a start for each node have it calculate all paths starting and returning to that node etc. then collate results and do a sort and find shortest.

hollow basalt
bright hound
#

no.. how can they take the shortest path overall. while visiting all the nodes

wide ravine
#

does anyone know of a decent guide on configuring apache and permissions related to it? all the ones i've been through are way too basic or fragmented

pliant siren
#

They don't. They work backwards.

pliant siren
#

If you work from the starting point, you need to evaluate way too many options to see if they even yield a result. But if you know your target, and work backwards, taking only completable paths and knowing the cost it took to get from each previous node, you vastly reduce the number of paths which must be evaluated, and can quickly eliminate portions of paths which produce a cost exceeding what options you have already evaluated.

#

This is similar to how raytracing works - instead of casting light from the source, you cast a ray from the viewport to the light sources.

#

Effectively, you could use RT cores to produce very fast A*, Djikstra, and similar derivative implementations

hollow basalt
#

why cast the light [ray trace] from the source if some of the objects [surface] won't even show up in the screen

mystic coral
#

Bringing you the entire Roadmap for Web development in 2021.
If you are beginner who wants to get hands on web development, then this video is for you ๐Ÿ™‚. Wanna be a Front-end, backend or Full stack developer, now is the right time to start ๐Ÿ”ฅ๐Ÿ”ฅ
I have explained the entire work flow for web development, what all technologies you should learn & have also provided the resources to start your journey ๐Ÿ˜€

Watch the video and don't forget to subscribe to the channel โœŒ๐Ÿป
https://youtu.be/AZ3zc0YLTsY

Web development Roadmap 2021 | How to become a Web developer in 2021| Frontend, Backend & Full Stack

In this video, I have explained in detail what you need to learn to become a web developer in 2021. Front-end, Back-end & full-Stack, you'll get to know about everything. From the version-control system to the content management system, everyth...

โ–ถ Play video
warm sleet
#

@mystic coral mongodb is only used by amateur web developers

#

and wordpress is a bad meme

midnight wind
warm sleet
#

@midnight wind its schemaless

#

document database

#

not a huge fan

#

doesn't do well with relationships and 'ACID'

#

its mostly used by javascript developers

midnight wind
warm sleet
#

because you can store entire json documents

#

and then query them

#

but it encourages bad data structures

#

@midnight wind not just that, the guy in the presentation

#

has this chart of all the different technologies

midnight wind
#

oh

warm sleet
#

look at this ^

#

he completely skips the fact that, there is no single best technology

#

it all depends on your architectural constraints

midnight wind
#

yeah

warm sleet
#

and that graph makes it look like javascript is purely front-end

#

even though there are many serverside javascript projects

mystic coral
#

@warm sleet I'm not saying that who uses it. My motive of this video is to make newbies aware of the technologies that they can work with.

warm sleet
#

@mystic coral I think newbies ought to go to school

#

Web development is something you get a degree for

mystic coral
#

Brother I have also stated node na in backend. See the chart carefully

warm sleet
#

node isnt a language

#

rather a runtime framework

mystic coral
#

JS framework though

warm sleet
#

its a runtime

#

@mystic coral there's a lot more to architectural synthesis than this talk makes it look like

midnight wind
#

node runtime is chrome v8 engine right?

warm sleet
#

honestly, the whole server side stuff he points out can be completely skipped

midnight wind
#

or did they modify it

warm sleet
#

serverside technologies, from a front-end perspective, you only care about APIs

#

so REST, GraphQL, gRPC, etc

mystic coral
#

honestly, the whole server side stuff he points out can be completely skipped
@warm sleet why so?

warm sleet
#

^

upbeat nymph
#

Morning peeps

warm sleet
#

Frontend devs only call upon facades

#

They don't need to know that some backend service is running on python + flask

mystic coral
#

I wanted to throw light on all the technologies in this video. So I talked about server side languages as well > serverside technologies, from a front-end perspective, you only care about APIs
@warm sleet

#

Full stack developers need to > They don't need to know that some backend service is running on python + flask
@warm sleet

warm sleet
#

Sure

#

But I am pretty sure no newbie will be full-stack ;)

#

I've done fullstack development and I hate it

#

fuck frontend development xD

mystic coral
#

Yeah that's right ๐Ÿ˜…

warm sleet
#

the javascript/css/html ecosystem is garbage

#

browsers are not standardized

mystic coral
#

But after sometime they might want to switch to full Stack

warm sleet
#

HTML5 and CSS3 gets you only 90% there

#

the last 10% is webkit vs applekit

#

and whatever microsoft put into their browser

upbeat nymph
#

Chromium

#

IICR

#

For Edge

warm sleet
#

chromium browser engine is based on Gecko

#

webkit is based onthat too

#

but yeah; tldr web development is a mess

#

APIs are not mature

midnight wind
#

so is C/C++

#

that's annoying

hollow basalt
#

no, it isn't

upbeat nymph
#

Isn't Firefox running Quantum which is based of Gecko too?

midnight wind
#

Ok, I said that in a wrong way

#

Like between windows/linux/mac

upbeat nymph
#

Or is Quantum just their Rust version?

warm sleet
#

I haven't used firefox in forever

#

mostly because if 1 tab freezes, the entire browser dies

midnight wind
#

really? never had that issue

hollow basalt
#

me too

warm sleet
#

Chrome splits each tab into a seperate process

hollow basalt
#

Never had that issue in firefox, mostly I blame windows

warm sleet
#

uses more resources, but its more reliable

#

@midnight wind it was especially bad when coin.js was common on the net

#

it would completely lock up the browser

upbeat nymph
#

Oh ew, I remember those days

warm sleet
#

for those who don't know: coin.js is a browser based bitcoin miner

#

that secretly tried to use your CPU to mine coins

upbeat nymph
#

unethically too IMO

warm sleet
#

well yeah xD

#

but do you think advertising networks give a fuck?

upbeat nymph
#

If it were me, and the coin was valuable....I'd give users an option personally. Ads or CPU power

warm sleet
#

@mystic coral I skipped over majority of the presentation, but one thing I feel that is missing

#

there's no general explanation of underlying technologies

#

like, if you go to teach someone the basics of web development

#

start with HTTP

#

explain how documents and content is retrieved in a stateless manner

#

and the mechanism that provides these documents can either be static, for things like images and resources

#

or dynamic, with server side programming

hollow basalt
#

so I only experienced that in UNI

#

but then again

warm sleet
#

pretty sure chrome blocks coin.js

upbeat nymph
warm sleet
#

I tried using pihole

#

and then the twitch launcher fails to start

#

because it can't connect to their advertisement server

hollow basalt
#

But then again

#

it's their business

warm sleet
#

I just want to play minecraft :(

midnight wind
hollow basalt
warm sleet
#

smart TVs have built in backdoors now

hollow basalt
#

but why tf does modding have to go thru tiwtch

warm sleet
#

samsung smart TVs are leak af

hollow basalt
#

I miss old launcher days

#

without twitch

warm sleet
#

@hollow basalt because CurseForge

#

and Curse is owned by Twitch

hollow basalt
#

they deserved the name Cursed

warm sleet
#

and Forge mods are provided primarily through Curse

#

dubbed

#

CurseForge

upbeat nymph
warm sleet
#

@upbeat nymph fuck really?

upbeat nymph
#

yeah

#

let me find it

#

brb

warm sleet
#

@upbeat nymph time to get a screwdriver and hunt for a UART port

hollow basalt
#

Your TV is weird lol

midnight wind
#

mine TV doesn't because it's a dumb TV, but the roku has an ad on the home screen

warm sleet
#

I've got this one project I've been pushing back for so long now

mystic coral
#

@mystic coral I skipped over majority of the presentation, but one thing I feel that is missing
@warm sleet I know. I haven't explained anything like that in this video. I'll make seperate videos explaining each technology.
But thanks for your reviews, I'll definitely keep this in mind while making next video.

warm sleet
#

I have an old seagate NAS with a dead MMC

#

but I can still get UART output of the UBOOT loader

#

so in theory I could load a kernel over serial onto the NAS

#

and flash it with my own OS

upbeat nymph
#
FlatpanelsHD

The ads appeared sometime in 2016 but it is now escalating

The Drum

LG Electronics is now placing native ad units in the launch bar of its smart TVs, specifically pitching entertainment advertisers to buy their way onto the big screen.

hollow basalt
#

Yikes

warm sleet
#

@upbeat nymph wow. thats rude

hollow basalt
#

Time to install your own OS to that

warm sleet
#

I have the facebook app on my galaxy A50

#

and I cannot delete the app, only disable it

#

I don't use facebook

midnight wind
#

can't get rid of it

warm sleet
#

And rooting the device is not an option right now

#

because it has an eFuse

#

so until warranty expires, I wont be rooting

midnight wind
#

doesn't rooting disable like that google security thing that I forgot it's name

upbeat nymph
#

If you experiencing annoying ads on your Samsung, LG or Sony smart TVs (Android TV), it is now possible to block them using these workarounds.

#

etc

warm sleet
#

@midnight wind Samsung has their own controversial tech

#

'Knox'

midnight wind
#

yeah

warm sleet
#

it says that on boot

#

'Secured by Knox'

#

as if vanilla android isnt secure

#

@upbeat nymph we have a 4k samsung TV here

#

but it runs outdated firmware

#

I actually isolated it completely from the rest of the network

#

only smartphones on the wifi can communicate directly with the TV

#

so they can still do streaming

upbeat nymph
warm sleet
#

netflix runs

#

prime video works also

#

what more do you need

#

I also have a chromecast for when all else fails

upbeat nymph
#

HBO, Hulu, Peacock, Netflix, Prime Video, Disney+, YouTube, Boomerange, Twitch, Funimation/Crunchyroll

#

You clearly need all of that

warm sleet
#

@upbeat nymph some of the more annoying configs

#

to get IPTV to work

#

the ISP gave me a manual on how to configure it

#

but the manual was for "DrayTek" routers only

#

draytek ofcourse uses way different jargon for the same functionality

#

multicast is so weird on v4

upbeat nymph
#

So I think I'm gonna ditch the NodeJS driver for seeding data and go straight SQL.

upbeat nymph
#

Our conversation(s) inspired me to do it in straight SQL instead of using middleman language

warm sleet
#

@upbeat nymph oof that loop though xD

upbeat nymph
#

And this, hopefully, removes some of the limitations I've been having with memory too

#

Okay look, I've never done this before

#

I'm trying

warm sleet
#

you can treat a SELECT result as a table

upbeat nymph
#

What do you mean?

warm sleet
#

@upbeat nymph well, it is a test setup so it dont matter

#

but things like your parameters, you can feed into the procedure as an argument

#

@upbeat nymph you are iterating over a list, to increment the primary key.. mh

upbeat nymph
#

I could set the primary key too.

warm sleet
#

tbf looping like that to create keys for records is perfectly fine

#

@upbeat nymph if you'd want to make it a little more special, what you could do

#

is use a subquery to generate a sequence from 1 to 1000

#

and then SELECT INTO your actual table, using the sequence to generate keys

#

sometimes I miss oracle DB

upbeat nymph
#

Why is that?

warm sleet
#

you could just SELECT * FROM my_sequence WHERE rownum < 10

#

generates 10 fresh numbers from a unique sequence

#

@upbeat nymph just an example on input params:

#
DROP PROCEDURE IF EXISTS proc_ban_ip;
CREATE PROCEDURE proc_ban_ip(
  IN addr     INTEGER UNSIGNED,
  IN reason   VARCHAR(128),
  IN duration BIGINT
)
  BEGIN
    INSERT INTO ip_address VALUES (addr, NULL, NOW(), NOW(), duration, reason)
    ON DUPLICATE KEY UPDATE
      banreason = reason, banned = duration;
  END;
#

IN keyword

#

oh, interesting you even use the while keyword, didnt know that was a thing

#

I'm used to using the GOTO method xD

#

you can then just ITERATE <loopname>

#

and END LOOP <loopname>

upbeat nymph
#

Wtf. Can you not call multiple procedures D:

#

that's new

warm sleet
#

you should be able to

upbeat nymph
#

hm

warm sleet
#

a PROC can call another PROC

#

procedures also have a return type

#

if the last statement is a SELECT

#

it will return a table

upbeat nymph
#

Oh so I could in theory just make a proc called "seed" and call the two others within?

warm sleet
#

ye

#

lol some of these procedures

#
DROP PROCEDURE IF EXISTS proc_bungee_check_login;
CREATE PROCEDURE proc_bungee_check_login(
  IN ip VARCHAR(15), IN playerid BINARY(16)
)
  BEGIN
    DECLARE adr INT UNSIGNED DEFAULT INET_ATON(ip);
    IF EXISTS(SELECT ''
              FROM player
              WHERE uuid = playerid AND banned IS NOT NULL)
    THEN
      SELECT
        'PLAYERBAN' AS state,
        banreason,
        banned
      FROM player
      WHERE uuid = playerid;
    ELSEIF EXISTS(
        SELECT ''
        FROM ip_address
        WHERE address = adr AND banned IS NOT NULL)
      THEN
        SELECT
          'IPBAN' AS state,
          banreason,
          banned
        FROM ip_address
        WHERE address = adr;
    ELSE
      SELECT
        'NONE' AS state,
        NULL   AS banreason,
        NULL   AS banned;
    END IF;
  END;
upbeat nymph
#

oooo it works

warm sleet
#

Checks ^ if a player is banned on my minecraft server

upbeat nymph
#

huh

warm sleet
#

checks both user ID and ipaddress for a ban

#

xD

upbeat nymph
#

nice

warm sleet
#

IF EXISTS (query)

#

isgreat

#

returns true if the query has any records

#

makes it so simple to have complicated rules in your db, but code is still clean

upbeat nymph
#

Probably quicker too

warm sleet
#

@upbeat nymph single round trip yeah

#

its key

upbeat nymph
#

Well. The 11 scripts are all running and seeding the databases successfully. So far no memory issues or anything.

#

Half of them are done because they were small databases

warm sleet
#

noice

umbral saffron
#

GG

upbeat nymph
#

So I guess the next thing Iโ€™ll need to decide is how to do the queries efficiently. I know for a fact selecting all 1 million-10 million rows will not perform well. So I might chunk it out and limit it to sets of 100k. So count(*) % 100000 or something.

next igloo
#

can you convert scratch to javascript?

vestal glen
#

according to a quick search in the internet, yes.

next igloo
#

intresting, becuase ive trying to make a gun mechanic for a game in JS, but i still cant figure out how to do it. but i have made it work in scratch

#

are they free?

vestal glen
#

dont know

#

I didn't click on any of it

#

but in general, you should be able to apply the concepts from scratch to JS, too

#

unless you're talking about using the scratch drawing vs. a HTML canvas

next igloo
#

just the scripts

#

because scratch 3.0 is written in js i think

#

the thing worked except for the "step" function, since it has a lot of complex trig formulas i believe

#

.

#

what is a formula that will make something move 10 pixels in 360 degrees
preferably in JavaScript but if you have it in another language its fine too

vestal glen
#

well, there's scratch to js converters out there, go and search for yourself, given that "scratch to js" returned one as first result seems to me like it should be rather simple to find

#

and it may be a good help at teaching you how to transfer the concepts between the two languages.

next igloo
#

yeah i tried one of them now and it works except for the "step" function

#

i know how to code it in native JS

#

i just dont know the math formulas

vestal glen
#

So there's multiple ways forward here. You don't know the maths that you need to program what you want? Or what exactly is the issue you're facing ("not working" is a very vague description)

next igloo
#

i dont know the maths

#

for example, i want to move 10 pixels at 22 degrees

vestal glen
#

so 10 pixels is the length of your hypotenuse.

next igloo
#

correct

vestal glen
#

so you need cosine and sine

#

(to calculate the deltas for x and y coords)

next igloo
#

would that be angles?

vestal glen
#

no, those are functions that help you turn your hypotenuse and the angle into the other two sides of the triangle

#

(trigonometry)

next igloo
#

i didnt get to learn trigonometry since schools got shutdown so sorry if i get confused

warm sleet
#

@next igloo I guess you have to brush up on your trigonometry

#

anyone should be able to do basic calculations in a 2d or 3d plane

next igloo
#

i know as far as soh cah toa, the rest i never learned

warm sleet
#

ZERICO2005: what is a formula that will make something move 10 pixels in 360 degrees

#

this doesnt make sense btw

#

position of an object is always relative to a corner

#

so 0,0 is usually topleft of your screen

#

if you rotated the image, the position also has to change

#

depends on the dimensions of the shape

#

if your object has a dimension of 10x20

#

the relative position changes if you rotate it

#

but this is stuff you should figure out yourself

#

its not that hard

#

just play around

#

usually helps if you draw it on paper

#

and do the math like so

#

and then try to do this in code

#

thats why game engines are great

#

cus you can just translate the position relatively xD

raw geode
#

just wondering if anyone uses R or has experience with it? need some help with parallelization (or even GPU computing) ping me or dm me bc im offline 99% of the time

nocturne galleon
#

any1 have suggestions for an Android Coding App?

#

Thats like Virtual Studio Code?

hollow basalt
nocturne galleon
#

hey, was asking for suggestions, aight

#

i know there are lots of apps on the playstore

#

just wanna know which is good

#

the reason being is imma be out on a date tomorrow and i was gonna code while on my freetime on my phone hahaha

upbeat nymph
# nocturne galleon the reason being is imma be out on a date tomorrow and i was gonna code while on...

Then that relationship won't last long. If you're spending your entire date thinking about code, then you shouldn't even go on the date tbh. You should be focusing on your date. If you're not, then I would just avoid going out all together. I'm not saying that you couldn't take a break and check messages and such, but your date should be your main priority. If you have an idea subconsciously, which happens to me personally a lot, then write it down or something.

nocturne galleon
#

omg, it is a priority date, don't worry

nocturne galleon
#

Even tho my GF was the one who brought up the idea of helping me finish the project

#

I'll consider that

orchid ferry
#

Does someone know how to create a Contact form for a site

#

?

warm sleet
#

@orchid ferry forms when submitted send all the fields from the form to the server

#

how it sends this is declared in action= and method= fields of the <form>

#

by default it uses POST

orchid ferry
#

?

#

Is this ok?

upbeat nymph
#

Does it work?

warm sleet
#

action has to point to the url of where it sends the data

#

action could be something like

upbeat nymph
#

If it works, it's okay. If it doesn't work, it's not okay peepoGiggles

warm sleet
#

/submit

#

or whatever resource on the server is responsible for handling it

orchid ferry
warm sleet
#

@orchid ferry just put action="/" method with get

#

then press submit

#

should see your values in the address bar

orchid ferry
#

it shows them

warm sleet
#

yeah

#

if you were to use POST

#

it puts those in the http headers

#

server has to do something with this if you want it to have functionality

orchid ferry
#

How can i make it so that when someone submit it tit send a mail to me

#

?

midnight wind
#

you would need a backend server

warm sleet
#

You'd have to write a program that sends an email

#

that program would be called by sending an HTTP POST to a specific url

#

thats what your form submits to

midnight wind
#

I only know how to use node for a backend

warm sleet
#

@midnight wind I was taught this shit in php lol

#

$_POST['myform'] xD

midnight wind
#

idk php at all

warm sleet
#

php has global parametrs with request info

#

like $_SERVER $_GET and $_POST

#

$_SERVER['method'] returns http method

#

its crude

#

and error prone

orchid ferry
#

Do you use dreamweaver for html?

midnight wind
#

I wouldn't

#

wayyy to complicated

#

if you want a nice frontend use a framework like vue or react

warm sleet
#

I use chrome dev tools lol

#

test straight with a browser

midnight wind
#

same

#

but with firefox

#

vscode firefox debug extension

warm sleet
#

intellij has a tool for chromedebug

midnight wind
#

I can add breakpoints in vscode and it carry that data to firefox

orchid ferry
#

Should this thing work?

warm sleet
#

mail() in php requires some setup to function

orchid ferry
#

So this wont work?

#

What should i add

#

?

warm sleet
#

@orchid ferry RTFM

#

all of this is documented

orchid ferry
#

ok

#

Thanks

upbeat nymph
#

So at some point my cat unplugged my PC ๐Ÿ˜ฆ

#

And I lost the 1m player and match data and 10m player and match data

#

So the 1m variation is almost done seeding, the 10m will have a long time to go

upbeat nymph
umbral saffron
#

why cant i install pyaudio

upbeat nymph
#

Could be anything

#

Is there an error output?

umbral saffron
#

yeah

#

oh i saw something saying it might be i need to be on an earlier version of python

#

i fixed thaat issue (I think)

#

but running ```py
import speech_recognition as sr

listener = sr.Recognizer
try:
with sr.Microphone() as source:
print("Go ahead...")
voice = listener.listen(source)
command = listener.recognize_google(voice)
print(command)
except:
pass```

#

nothing happens

#

@upbeat nymph

upbeat nymph
#

I don't know Python and I've never written in Python before

umbral saffron
#

hmmm

#

i dont know if i have the right imports

#

theres no issues

#

but it cant register the audio

#

so an import got messed up but no errors

#

so its running

#

but nothing happens

#

so now

#

i find out what

swift spoke
#

Never used the library, but could it be that you need to create an instance of the Recognizer class? So, basically, what you're currently doing is assigning a reference to the sr.Recognizer class to listener, and not an actual instance of that class. Using listener = sr.Recognizer() will initiate an instance of the class.

umbral saffron
#

What I think the issue could be is that I tried importing pyaudio (the thing that actually takes the input and sends it to speech_recognition) and I tried to run it anyways and I thought it worked

#

So what I think I need to do

#

Is find out how to import pyaudio Bc I canโ€™t do it the normal way

umbral saffron
#

so uhhhh

#

pycharm wont open

hollow basalt
umbral saffron
#

wdym sure

nocturne galleon
#

I'm working on a ping command, and am new to discord.js scripting.

Im using;

`${Date.now() - message.createdTimestamp}`

To get the ping time, however getting a negative ping, from what I've found is because off the system clock. So I looked up what to use instead, and I got;

resultMessage.createdTimestamp - message.createdtTimestamp```

`resultMessage` doesn't seem to be a property, so what do you use instead?
devout wave
#

Anyone know why Android studio would now require me to build twice in order to propagate all changes?

#

It's always scary when the logs you just added are not showing

upbeat nymph
warm sleet
#

@upbeat nymph took a day generate 1m records?

#

sounds like terrible perf

waxen quarry
#

does anyone know the best linux distro for programming?

upbeat nymph
#

It was generating about 280 records a second

#

If it did it in 20 hours

#

Although, I'm really surprised how small the database dump is for the 2 million records.

warm sleet
#

280records/second

#

@upbeat nymph I bet if you used batches

#

it would be more like 5x as fast

upbeat nymph
#

I really only needed to do it once

warm sleet
#

RTT to database becomes significant

upbeat nymph
#

Well, would it be faster to restore a database from a dump or to generate new data in batches?

warm sleet
#

restore from dump is faster

upbeat nymph
#

Yeah, that's all I needed

warm sleet
#

@upbeat nymph SELECT INTO from a foreign db is even faster

#

you can copy records between databases

upbeat nymph
#

Just only providing these if people want to run benchmarks across multiple systems so all benchmarks are done off the same dataset.

#

So that's why I wasn't caring too much about the time to generate data at first because I knew I would dump them all and restore from that in the future.

warm sleet
#

can probably compress those sql files

#

to 1/20th size

upbeat nymph
#

Oh? How would you suggest that?

#

I just did a DB dump from DBeaver

warm sleet
#

gzip -k file.sql

#

that will keep the original, and create a file.sql.gz

#

when you go to importing it, you just uncompress and pipe to mysql

#

like zcat | mysql

#

zcat uncompresses and prints content

upbeat nymph
#

lets see

#

doing it now

warm sleet
#

but ur on windows

#

so I doubt gzip is available

upbeat nymph
#

7zip

#

๐Ÿ˜„

warm sleet
#

yeah but gzip is not a container

#

its not like zip file

#

there's no directory structure

upbeat nymph
#

7zip supports gzip as well

warm sleet
#

hopefully

#

typical gzip archives are tarballs

#

wrap files into a tarball structure, then compress that

#

yields .tar.gz

upbeat nymph
#

Yeah, I work with tarballs a lot when moving files from linux to linux machines

warm sleet
#

heh

#

@upbeat nymph I have a little webserver and a shellscript on laptop that puts a file onto the webserver via ssh

upbeat nymph
#

yeah but with transfer.sh I don't have to host it myself lmao

warm sleet
#

yeah I am always privacy concerned

#

and don't like to litter files around third parties

#

except imgur, they can have all my screenshots

upbeat nymph
warm sleet
#

ok maybe not 1/20th

#

more like 1/3rd

upbeat nymph
#

Probably would be more on Linux based

warm sleet
#

@upbeat nymph repeated characters or sequences of characters saves a lot of space when compressed

#

INSERT INTO

#

can just be 1 byte

upbeat nymph
#

Now, would it be more compressed if I gzip a gzip file? think

warm sleet
#

nope, those algos are actually capable of recognising archives and ignoring them

upbeat nymph
#

D:

warm sleet
#

if you add a .zip to another .zip its a 1 to 1 copy

upbeat nymph
#

Fuck gzip doesn't like multiple files.

warm sleet
#

gzip does not support multiple files

upbeat nymph
#

That's good to know

warm sleet
#

its not a container

#

zip, rar, 7z and such are all container archives

#

and gzip only with tar

#

though I guess you could gzip a zip file

#

xD

upbeat nymph
#

Hmmm. Let's try.

warm sleet
#

gzip takes bytes[] input and gives bytes[] output

#

it dont care if its a file, datastream or whatever

#

browsers use gzip as well :)

upbeat nymph
#

although 7z seems to be better.

warm sleet
#

most html documents are compressed before transmitted

upbeat nymph
#

For archiving multiple files

#

Oh wasn't that added with http2?

warm sleet
#

@upbeat nymph tar czvf myarchive.tar.gz directory/

#

@upbeat nymph nah http 1.1 has had this for a long time

#

deflate is zip

upbeat nymph
#

what was added with 2.0 that everyone was freaking out about? I can't rewmember

warm sleet
#

@upbeat nymph concurrent requests over single connection

#

the idea is less requests, less latency and wait time, is faster load times

#

Its ideal for mobile devices and networked software

upbeat nymph
warm sleet
#

@upbeat nymph one of the reasons that I like gzip is because you can easily use it in pipelines

#

since it can dump its output in stdout

placid cedar
umbral saffron
#

yeah pycharms still not doin anything

spring pond
#

@umbral saffron is it doing anything in task manager?

umbral saffron
#

its there

#

its taking up a little memory

spring pond
#

try killing it

umbral saffron
#

i restarted it and now it works but now discord wont open but i think everythings loading

#

(im using the browser version)

spring pond
#

im not sure what could be wrong with discord especially since youre running it in your browser

umbral saffron
#

the discord app wont open and the browsers mega slow

#

ill fix it later

#

but right now

#
import speech_recognition as sr
import PyAudio

listener = sr.Recognizer
try:
    with sr.Microphone() as source:
        print("Go ahead...")
        voice = listener.listen(source)
        command = listener.recognize_google(voice)
        command = command.lower()
        if 'computer' in command:
            print(command)
except:
    pass
  ``` this literally does nothing
#

@spring pond

spring pond
#

have you tried following the previous advice of others who have said to convert sr.Recognizer to sr.Recognizer()

umbral saffron
#

ah

#

yeah it just closes immediatly

spring pond
#

it seems that PyAudio is not blocking by default

umbral saffron
#

i dont know what that means

umbral saffron
#

i got tts to work

#

so now i need to fix pyaudio

#

and then the gui...

spring pond
#

basically the microphone doesn't make the program wait for input

umbral saffron
#

ohh

deft pumice
#

Hey, i have a question about Linux OpenSSL. I am studying Computer Science, and i have to show and save the x509 certficate of a website. Which of the console comands is used for that? openssl x509 (...) ?

shy helm
#

Wait, nupe

#

@deft pumice openssl s_client -showcerts -connect linustechtips.com:443 | openssl x509

fallen cedar
#

lol, just read someone else suggested the same right after your comment

umbral saffron
sacred pumice
#

Today, on weird things

with open("/tmp/file.txt", "r") as f:
    result = pickle.load(f)
...
with open("/tmp/file.txt", "wb") as f: # PermissionDeniedError, but only sometimes. Also we're root, also it magically fixes itself with no interaction, also it happens on multiple different machines
    pickle.dump(result, f)
#
[root@azelphur-server local]# python
Python 3.9.0 (default, Oct  7 2020, 23:09:01)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> with open("/tmp/external_ip", "wb") as f: print("Hello world")
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>

Yup my brain hurts...I'm root

hollow basalt
#

uhhh

sacred pumice
#

Most simple example, still root. My friend also has the same issue, it's like the file somehow gets into a broken state

[root@azelphur-server local]# python -c "open('/tmp/external_ip', 'wb')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
PermissionError: [Errno 13] Permission denied: '/tmp/external_ip'
warm sleet
#

@sacred pumice try running the program prefixed with 'strace'

#

that debugs any syscalls your program makes

#

should also print the reason why the filehandle was unable to be created

#

you are opening the file with write permissions, so if another program already has a file-handle, this will fail

sacred pumice
#

@warm sleet lsof says nothing is looking at the file, so no other program in theory.

warm sleet
#

openat(AT_FDCWD, "/tmp/external_ip", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)

sacred pumice
#

Yea, just tells me permission denied, which isn't super helpful anyway

warm sleet
#

@sacred pumice what happens if you open with readonly?

sacred pumice
#

@warm sleet that's fine, it works

warm sleet
#

@sacred pumice try replace the 'wb' with 'w+b'

sacred pumice
#

Permission denied

warm sleet
#

@sacred pumice create a directory in /tmp

#

then put the file in there, try again

#

might not be able to write directly to /tmp. But this is very odd

#

I've never seen this kind of behavior

sacred pumice
#

I can create files in /tmp, eg touch /tmp/waffle is no problem, I don't really wanna do anything to modify the file, I'm really curious to leave it in place and figure out why this is happening

#

As I too, haven't seen this kind of behaviour, there's no reason I can see why root wouldn't have write access to a specific file in /tmp

warm sleet
#

ยฏ_(ใƒ„)_/ยฏ

sacred pumice
#

yea, I mean on my system the file already exists

#

which is obviously a part of the problem

warm sleet
#

what about file permissions?

#

if you don't have +w

#

obviously get a permission denied error

sacred pumice
#

I'm root, so I'd assume that doesn't matter

warm sleet
#

no

#

that does matter

#

if you don't have write permission on a file, even root can't write to it

#

root can change the permissions, and then write to it

sacred pumice
#
[root@azelphur-server ~]# ls -l test.txt
-r--r--r-- 1 root root 0 Jan  8 11:12 test.txt
[root@azelphur-server ~]# python -c "open('test.txt', 'wb')"

Works fine, with no problems.

warm sleet
#

yeah

#

you don't have write permissions

sacred pumice
#

but it works fine, because I'm root

warm sleet
#

what.

#

what about that /tmp file

sacred pumice
#
-rw-r--r-- 1 azelphur azelphur 113 Jan  7 08:51 /tmp/external_ip```
#

@warm sleet but you can see what I'm saying, root ignores file permissions, write flag doesn't need to be on the file if you're root.

warm sleet
#

ls -la /proc/$$/fd | grep external_ip

#

should print you any open file descriptors for that file

#

my guess, another process has that file open

sacred pumice
#

returns nothing

warm sleet
#

wat.

sacred pumice
#

lsof /tmp/external_ip also returns nothing

#

yes I agree, this situation is wat ๐Ÿ˜‚

warm sleet
#

if lsof doesnt even list anything

#

probably not gonna matter trying to find anything with fuser

#

because that all uses lsof

#

fuser -v -m /tmp/external_ip

sacred pumice
#
                     USER        PID ACCESS COMMAND
/tmp/external_ip:    root     kernel mount /tmp```
warm sleet
#

PID: kernel

sacred pumice
#

so that means that the kernel currently has the file open for write?

warm sleet
#

not quite

#

that just shows us what process is responsible for maintaining the filesystem that /tmp/external_ip is in

#

which is the kernel, obviously

sacred pumice
#

ah, so nothing useful then really

warm sleet
#

try without -m

sacred pumice
#

returns nothing

warm sleet
#

yeah

#

I am.. at a loss

sacred pumice
#

me too, it's a weird one

warm sleet
#

yeet the file

#

and try again

#

xD

#

or perhaps try restarting the system

sacred pumice
#

I don't think it's some oddball condition, because my friend who is also running my program has the file in the same condition on his machine

#

@warm sleet if you're curious, https://dpaste.org/224k

It's really basic stuff though, the read on line 26 works, the write on line 47 fails (and of course, the examples I've posted above when the program isn't even running) this is just potentially interesting because it's how the file was created in the first place.

warm sleet
#

why do you even need an external ip reference

#

you could replace that with a shell oneliner that uses some online service

#

that just echoes your ipv4

sacred pumice
#

@warm sleet it's a plugin for checkmk (service monitoring) it checks that the external IP address of my torrent client is not equal to my real external IP

warm sleet
#

to make sure you don't leak ur IP ?

sacred pumice
#

correct

warm sleet
#

why not check default route

sacred pumice
#

because route wouldn't contain my external IP, it's a machine on a NAT

#

It also does a few other bits (like returning current up/down speeds, and number of torrents, torrents in error state) which the monitoring system handles, but yea, I doubt it could be replaced with a shell one liner

sick dome
#

I deleted the security tools package and the GUI is gone

#

This is a centos7 VM

#

How can I get the GUI back?

midnight wind
#

cockpit?

#

or

#

KDE, MATE?

sick dome
#

GNOME gui @midnight wind

midnight wind
#

idk

#

this is over ssh?

#

or no?

sick dome
#

no, it's in virtual box - I think I may have fixed it

#

sudo yum -y groups install "GNOME Desktop"

#

used this command

#

I think it's installing

warm sleet
#

lol wat

#

@sick dome xinit probably failed

#

thats the program that launches the desktop environment

obtuse night
#

Are Azure Service Bus and RabbitMQ interchangable as they both use AMQP protocol? I am beginning developing microservices but do not want to be locked down to RabbitMQ. In short, can you swap out the message broker in an application by changing just the connection string

warm sleet
#

@obtuse night doubt anything azure is compatible with amqp

#

ZeroMQ can also use amqp, though they have their own protocol spec too

#

And then there's MQTT

#

Which is a public standard for messenger exchanges

#

Specifically for embedded telemetry and IoT

upbeat nymph
#

TIL: You can use $npm_config_*flag* and use npm run *script name* --*flag*=*whatever* to use in your package.json scripts.

sick dome
#

So is it normal every single thing in my linux VM is all up to date?

#

I'm doing a linux course and the guy is updating a ton of things and they all seem to be updated on my machine

lapis orbit
#

@sick dome - depends - which distributions are you using?

sick dome
#

Centos7

lapis orbit
#

@sick dome - he is too? If so, perhaps perhaps you got as more recent image? You should check which versions of the packages you have compared to his.

sick dome
#

the course was recorded in 2017 and I downloaded it recently from a repo at my university - could that be why?

lapis orbit
sick dome
#

oh, okay. Thanks guys!

velvet badge
#

Any python programmer out there?
I need help adding music features to my bot, your help would be sincerely appreciated

bleak breach
#

Iโ€™m a python dev

hearty edge
#

yey

#

Have you ever had to choose between studing development or servers and comunications

#

xD

warm sleet
#

@hearty edge you mean software development, or managing software that other's have developed?

#

as a programmer, I learned networking skills on the side

#

learning linux also came early on, when you write code and deploy it on servers, linux feels incredibly natural

#

its all very streamlined and easy to use

#

developers have a much deeper understanding of how these systems work

#

network admins are only good at network stuff, maybe some linux as well

left drum
#

hmm

hollow basalt
#

I was thinking that maybe i could just use the heroku database straight away.
What do you mean

left drum
#

Ahh never mind. I purged and reinstalled postgresql locally. Its working now. I explained myself poorly earlier

umbral saffron
#

how do i fix pyaudio

#

if i run a command

#

to use speech recognition

#

it immediately closes the console loop thing

#

like theres no code there

spring pond
#

take a look at the docs, there may be a way to make the thread wait

kind sail
#

Docs are your best friend

next igloo
#
01 function spawnBullet() {
02   $("#bullet").css({transform: "rotate(" + (Math.atan2(cursorY - ($("#gun").position().top + 4), cursorX - ($("#gun").position().left + 20)) * 180 / Math.PI) + "deg)"});
03   bulletAngle = (Math.atan2(cursorY - ($("#gun").position().top + 4), cursorX - ($("#gun").position().left + 20)) * 180 / Math.PI);
04   $("#bullet").css("left",($("#bullet").position().left = $("#gun").position().left + "px"));
05   $("#bullet").css("top",($("#bullet").position().top = $("#gun").position().top + "px"));
06   }
07 };
08 
09 function bulletMove() {
10   $("#bullet").css("left",($("#bullet").position().left = $("#bullet").position().left + (Math.cos(bulletAngle) * 10) + "px"));
11   $("#bullet").css("top",($("#bullet").position().top = $("#bullet").position().top + (Math.sin(bulletAngle) * 10) + "px"));
12   if (($("#bullet").position().left <= 8 || $("#bullet").position().left >= 776) || ($("#bullet").position().top <= 8 || $("#bullet").position().top >= 488)) {
13     //reset
14   }
15 };
#

is there an issue with lines 10 and 11, they do the math to find out where the bullet should move to

#

at the moment the bullets seem to fly off at random angles that are completely off from your aim (clicking on the same pixel gives the same angle)

#

the bullet <div> is at the correct angle, just not the movement

warm sleet
#

the definition of spaghetti code

#

cross cutting concerns? neverheardofit

#

CSS, math, abstract concepts, all in 1 method.

hollow basalt
#

the more the better

#

no need to obfuscate if the code itself is unreadable

mighty wharf
#

good lord do you want bologneese with that spaghetti?

gusty girder
#

this might be a stupid question, but when using npm/yarn, do I just manually load the dependencies in my html file?
I'm used to PHP where you just load the single composer file that links everything

nocturne galleon
#

You put the packages you depend on in the package.json file

#

If you're bootstrapping your project, or simply cloned it from a git repo, run npm install

#

that will create a node_modules folder in which all deps are downloaded

gusty girder
#

No, I get that, I use terminal to download/install dependencies and the package.json stores them.

It's about how I access them within my html/javascript.

#

like <script src="/node_modules/somerepo/repo.js" /> can't be the right way to do it?

nocturne galleon
#

In the JS you do, at the top of your source file:

import myLibrary from 'myLibrary';

#

the syntax may differ:
for named exports you use import { NamedExport1, AnotherNamedExport } from 'myLibrary'

#

for default exports you use simply import aliasForMyLibrary from 'myLibrary';

#

then in the code you can do:

// named:
let foo = new NamedExport1(...); // NamedExport is a class
// default:
let foo = new aliasForMyLibrary.AnotherExport(...); // AnotherExport is a class
gusty girder
#

So I have to manually import each of my dependencies?
At that point I might as well just manually link to them, what's the difference between a single javascript file with multiple import statements and a few script tags?

#

Is there no way to automatically create an "import_all_yarn_packages.js" file and use it like: "<script src="import_all_yarn_packages.js" />

#

which would then enable me to use all the libraries/packages I imported below that script tag

nocturne galleon
#

You can do something like this if you end up using the same libs over and over:
๐Ÿ“ common.js

import _ from 'lodash';
import React from 'react';
import myLibDefault, { ClassA, ClassB } from 'myLib';

export { _, React, myLibDefault, ClassA, ClassB };

๐Ÿ“ anotherFile.js

import { React, ClassA } from './common.js';

def foo = new ClassA();

export class ComponentExample extends React.Component {
  ...
}
#

note that the actual way you export stuff in the first file depends on the way each lib exports what, but you get the idea

#

you're actually using common.js as a "dependency collector" for your project
though I've not seen this approach often.

nocturne galleon
#

otherwise you'd have to make node_modules public, which will allow hackers to look in your package for vulnerable deps and exploit them

nocturne galleon
gusty girder
#

But javascript is client-side, so what packages I'm using gets exposed anyway?

#

I'm using yarn to manage packages for front-end development, I'm not using node.js, I'm doing front-end, not backend.

#

Thanks though, I'll look into that further

#

how does a random javascript file know that lodash is located node_modules/lodash/src/lodash.js?

#

I'd have to do import package from path/to/package and given js is client-side it'll be visible either way

warm sleet
#

@gusty girder isnt that what webpack is for?

#

generating an application entrypoint

#

I've just recently written an SPA with typescript

#

and webpack assembles the bundle.js including all the libraries you need

nocturne galleon
nocturne galleon
warm sleet
#
const path = require("path")

module.exports = env => {
  return {
    entry: {app: path.join(__dirname, "src/spa/app.tsx")},
    devtool: "source-map",
    output: {
      filename: "[name].bundle.js",
      chunkFilename: "[name].chunk.js",
      path: path.join(__dirname, "dist"),
    },
    module: {
      rules: [
        {
          test: /\.tsx?$/,
          loader: "ts-loader",
          options: {
            configFile: "tsconfig.client.json"
          }
        },
      ],
    },
    resolve: {
      extensions: [".tsx", ".ts", ".js"]
    },
    optimization: {
      chunkIds: "named"
    }
  }
}
#

This was the webpack config I used. This builds the index of your all dependencies automatically

nocturne galleon
#

and a couple other minor things

warm sleet
#

This is what you are looking for to expose your code to a webserver

#

All you have to do is point to the main application codefile

#

and it will assemble a bundle.js, including all the code that your main file references

covert axle
nocturne galleon
#

Yellow sus

gusty girder
warm sleet
#

@gusty girder yarn is merely a package/project lifecycle manager

#

just like npm

#

they pretty much work same way

#

With webpack, your software is 'compiled' (minified) and gets written to dist/

#

you then expose this directory in the webserver that hosts your application, as a static asset

#

so you have /index.html

#

and /dist/bundle.js

#

Webpack also allows 'chunking' of code, to load code as it is needed

#

that's helpful if you develop large single page applications, with a lot of code

ripe garnet
#

I'm wondering if it's possible to get the current Display (xlib) in an application, as I'm trying to get all the pixels in an area of the screen

#

Nevermind, apparently I can just call XOpenDisplay

hollow basalt
#

not if I throw away my code faster

latent estuary
lament cave
#

im trying to use nginx as a reverse proxy for hypercorn (with Quart), but it doesn't seem to be working.
there are no error messages or logs other than the "Running on" message

I have other subdomains (which is why im using nginx and not just hypercorn directly) and all of them work fine except for this one

attached is a screenshot of hypercorn:

warm sleet
#

@viral parrot good code is self-documenting

#

if you properly split your logic into functions, you can document those

#

but //inline comments like this one

#

that explain what a line does, are kinda stupid

covert axle
#

jk, I think too that making the code easier to read with tabs and other things is better than comments

warm sleet
#

@covert axle

//writes buffer to output
out.write(buff.read(size))
#

I'm more talking about this kind of commenting ^

covert axle
#

yeah

viral parrot
#

well yeah but

#

if you have a bigger piece of code it is harder

covert axle
#

you only need comments before long functions or for loops so people can search for the part they wanna tweak

warm sleet
#

Not really

#

You just need to structure your code

covert axle
warm sleet
#

Spaghetti-o's are bad in any language

#

and no amount of commenting will make that sane

covert axle
#

I learned this when I moved from c++ to C#

warm sleet
#

I'll tell you an even worse habbit

#

Moving from java to nodejs/typescript

#

; everywhere

#

;;;;;;

#

don't need those in js

viral parrot
#

i see what your saying, but whenever you go to stack exchange to find what you need, do you really think the code you have will make you remember why its that way and not the other?

covert axle
#

yup

warm sleet
#

@viral parrot if you take an example from stack exchange and dump it in your code

#

it might not be a bad idea to just dump the URL into a comment above the function itself

viral parrot
#

no i mean

#

not taking an example but rather

warm sleet
#

all that you care about is that you can access the same source of information, when you revisit the code

#

code is self documenting, so only things that aren't, deserve comments

viral parrot
#

i understand what you say. personally, i think i need to improve on this though. I have ADHD and I don't know what i did an hour ago without looking at my web history so i need to keep more specific records

warm sleet
#

you and me both

#

Except I have Asperger's ontop of that too

#

@viral parrot lol you know what you should do

#

use git

#

I can just go through my application history

#

and see exactly what I did, when and what lines changed

viral parrot
#

oh yeah

#

btw, if you have adhd, check out adhd-alien on twitter and other places. very relate-able

jolly arch
#

Hello guys

#

does SFML multimedia library work on macOS big sur

vernal marsh
#

Hi! i was wondering if anyone can help me in a programming related question.... https://www.codechef.com/IARCSJUD/problems/EXPT this is the question .... I am trying to solve it in the following way lol its just paint so pls ignore that pic's details... I can have a 2d array whose elements are 1st row elements = array1 elements - array 2's 1st element as shown in the pic above .... then find the most occurrences of a single digit in 2d array then get the index of the occurences to then find back the elements in original given arrays....

#

here is my very bad looking but still "should be working" code... I have checked it in many testcases and checked those same testcases with submitted codes of others... the answers are same but if anyone could tell where I am doing wrong it would be awesome

south grove
#

holy hell screw editing markdown tables

next igloo
#
$("#bullet").css("left",($("#bullet").position().left = $("#bullet").position().left + (Math.cos(bulletAngle) * 10) + "px"));
$("#bullet").css("top",($("#bullet").position().top = $("#bullet").position().top + (Math.sin(bulletAngle) * 10) + "px"));```
#

hello, can someone correct the math? its supposed to make a bullet travel at any angle
* 10 is the speed of the bullet

pliant siren
#

uhh... the assignment looks more of a problem than the math to me.

#

why are you setting the css value of top to an assignment statement, that seems odd and redundant unless there's some weird css nuance I'm not familiar with

bleak breach
#
$("#bullet").css("left",($("#bullet").position().left + (Math.cos(bulletAngle) * 10) + "px"));
$("#bullet").css("top",($("#bullet").position().top + (Math.sin(bulletAngle) * 10) + "px"));
sacred pumice
#

I just experienced recruiterception. The recruiter that got me the job at my current company called me to ask if I was interested at a job at my current company.

umbral saffron
#

so running

import speech_recognition as sr
import PyAudio

listener = sr.Recognizer
try:
    with sr.Microphone() as source:
        print("Go ahead...")
        voice = listener.listen(source)
        command = listener.recognize_google(voice)
        command = command.lower()
        if 'computer' in command:
            print(command)
except:
    pass``` nothing happens
#

so what i think i need to do is add a wait command to it

#

right?

#

wait but not even the print part works

#

so i dont get errors anymore

#

just nothing happens

spring pond
#

well you arent handling the exception

#

you need to see what the error is

#
except Exception as e:
  print(e)
#

imo you shouldn't pass in exceptions unless you are very sure you need to

#

@umbral saffron

umbral saffron
#

ok

umbral saffron
spring pond
#

just replace the except code with what i wrote

umbral saffron
#

ok so I got rid of the if computer in command part

spring pond
#

wait what

#
import speech_recognition as sr
import PyAudio

listener = sr.Recognizer
try:
    with sr.Microphone() as source:
        print("Go ahead...")
        voice = listener.listen(source)
        command = listener.recognize_google(voice)
        command = command.lower()
        if 'computer' in command:
            print(command)
except Exception as e:
  print(e)

This is what your code should look like

umbral saffron
#

yes but I got rid of the
if 'computer' in command:
line because im just trying to test it now

spring pond
#

so what does it print

umbral saffron
#

'Microphone' object has no attribute 'get_pyaudio'

spring pond
#

uhh

#

welp i have no idea

#

try reading the docs again

umbral saffron
#

ok

umbral saffron
#

so what I think was the issue in the original code was that it wont wait for the input

#

@spring pond

spring pond
#

nah the issue (at least the current one) is that it wont even recognize your mic

#

that may still be an issue tho

umbral saffron
#

ok

#

wait lemme see something]

#

yeah i have no idea whats wrong

spring pond
#

try to add print(sr.Microphone()) somewhere

umbral saffron
#

still same thing

#

yeah still same message

spring pond
#

where did you put the print

umbral saffron
#

import speech_recognition as sr

listener = sr.Recognizer
try:
with sr.Microphone() as source:
print("Go ahead...")
voice = listener.listen(source)
print(sr.Microphone())
command = listener.recognize_google(voice)
if 'computer' in command:
print(command)
except Exception as e:
print(e)

spring pond
#

nah put the print right at the try