#development
1 messages ยท Page 63 of 1
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
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
In production sure...but I don't know how that level of polymorphism would help in this case?
this is just normalizing
I never dug into it that much 
Yeah I am used to working in 4th NF
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
yeah, I thought that too, until I realized this program is just counting lines 
Again, me being stupid
And needing sleep
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 ^?
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
: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
Except this package does it differently: https://www.npmjs.com/package/go-glicko
And so do all the others
That's where everything gets messy.
So I have to try to be as fair as possible.
Yeah, except the way the players are tracked is inherently different.
same general concept though
players.sort(function(pl1, pl2){ return pl2.glicko.getRating() - pl1.glicko.getRating(); });
is what
period.Calculate();
probably does
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.
what about it?
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
yeah....
it's ugly
That's also 6 years old
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
this is more comparable
Yeah, the reason I converted go-glicko is because it focuses more on the rating period
this algo is so simple
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
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
Which package?
all of them
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() {}
})
}
};
https://github.com/MatthewSH/go-glicko
https://github.com/mmai/glicko2js
https://github.com/ReedD/glicko-two
https://github.com/Googlrr/Glicko2-JS
So yeah. I'm actually, and this is gonna sound stupid, but probably create a more "scalable" package which actually says fuck the previous interfaces and makes it less "friendly" to the other packages but is purely meant for scaling to higher levels of datasets with a focus on clustering and stuff using redis
what is wrong with this code
https://i.imgur.com/D2j31cz.png
ez, let me just get my calculator
particulally the function spawn bullet, the rest of it works
@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?
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
@warm sleet answer whenever you feel because I'm going to bed...but I'd love to know your thoughts on how you would do this: https://github.com/Glicko2/benchmarking/blob/main/data_seeding/index.js
This is essentially moving well...slow. Maybe it would be best if I generate the data once and dump it...or? Thoughts? Really I just need to seed data. No real structure of it. Just need to seed it with random values.
@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
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
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?
thats jquery
@next igloo https://i.imgur.com/flFEtDn.png
look
this is jquery, not normal javascript in the browser
jQuery: The Write Less, Do More, JavaScript Library
@next igloo you can only retrieve values through the API
if you set a style to have absolute positioning
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
what you could do is $('selector').css("top", newvalue)
Iโm a fucking dumbass. I need to get off discord and go the fuck to bed
these are the fields you could set for absolute positioning
@upbeat nymph https://mithril.js.org/
Quite sweet with the react extensions
Personally I use tailwindcss and I really like it!
This is always mentioned by my colleagues, very interesting
so the problem is classically refered to as traveling salesman
@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
so it's brute forcable for small graphs
@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
@bright hound https://en.wikipedia.org/wiki/P_versus_NP_problem
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
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.
there's no way for you to verify if it is indeed the shortest path
brute force.
yeah but you never definitively know
test all paths. add their lenghts find shortest
there may be another route, equally as fast
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.
but the traveling salesman is my favorite problem in algorithms
no.. how can they take the shortest path overall. while visiting all the nodes
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
They don't. They work backwards.
you can ask here though
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
Agreed
why cast the light [ray trace] from the source if some of the objects [surface] won't even show up in the screen
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...
@mystic coral mongodb is only used by amateur web developers
and wordpress is a bad meme
is mongodb bad? I've never really done web dev that deeply, just my little bad project
@midnight wind its schemaless
document database
not a huge fan
doesn't do well with relationships and 'ACID'
its mostly used by javascript developers
I thought there are document schemas?
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
oh
look at this ^
he completely skips the fact that, there is no single best technology
it all depends on your architectural constraints
yeah
and that graph makes it look like javascript is purely front-end
even though there are many serverside javascript projects
@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.
@mystic coral I think newbies ought to go to school
Web development is something you get a degree for
Brother I have also stated node na in backend. See the chart carefully
JS framework though
its a runtime
@mystic coral there's a lot more to architectural synthesis than this talk makes it look like
node runtime is chrome v8 engine right?
honestly, the whole server side stuff he points out can be completely skipped
or did they modify it
serverside technologies, from a front-end perspective, you only care about APIs
so REST, GraphQL, gRPC, etc
honestly, the whole server side stuff he points out can be completely skipped
@warm sleet why so?
^
Morning peeps
Frontend devs only call upon facades
They don't need to know that some backend service is running on python + flask
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
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
Yeah that's right ๐
But after sometime they might want to switch to full Stack
HTML5 and CSS3 gets you only 90% there
the last 10% is webkit vs applekit
and whatever microsoft put into their browser
chromium browser engine is based on Gecko
webkit is based onthat too
but yeah; tldr web development is a mess
APIs are not mature
no, it isn't
Isn't Firefox running Quantum which is based of Gecko too?
Or is Quantum just their Rust version?
I haven't used firefox in forever
mostly because if 1 tab freezes, the entire browser dies
really? never had that issue
me too
Chrome splits each tab into a seperate process
Never had that issue in firefox, mostly I blame windows
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
Oh ew, I remember those days
for those who don't know: coin.js is a browser based bitcoin miner
that secretly tried to use your CPU to mine coins
unethically too IMO
If it were me, and the coin was valuable....I'd give users an option personally. Ads or CPU power
@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
good thing my DNS blocks that automatically
so I only experienced that in UNI
but then again
pretty sure chrome blocks coin.js
I try to modify my DNS and use things like Warp but Hulu and them block it ๐ฆ
I tried using pihole
and then the twitch launcher fails to start
because it can't connect to their advertisement server
I love those guys
But then again
it's their business
I just want to play minecraft :(
don't smart TV's nowadays ignore dns and use dnssec
ikr
smart TVs have built in backdoors now
but why tf does modding have to go thru tiwtch
samsung smart TVs are leak af
they deserved the name Cursed
And there's some TVs that have video ads literally on start....
@upbeat nymph fuck really?
@upbeat nymph time to get a screwdriver and hunt for a UART port
Your TV is weird lol
mine TV doesn't because it's a dumb TV, but the roku has an ad on the home screen
I've got this one project I've been pushing back for so long now
@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.
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
https://www.flatpanelshd.com/news.php?id=1583755244&subaction=showfull
https://www.thedrum.com/news/2019/09/10/the-first-thing-you-see-lg-smart-tv-now-ad
https://www.rtings.com/tv/tests/ads-in-smart-tv
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.
Yikes
@upbeat nymph wow. thats rude
Time to install your own OS to that
I have the facebook app on my galaxy A50
and I cannot delete the app, only disable it
I don't use facebook
And rooting the device is not an option right now
because it has an eFuse
so until warranty expires, I wont be rooting
doesn't rooting disable like that google security thing that I forgot it's name
https://piunikaweb.com/2020/06/02/block-ads-on-samsung-lg-roku-amazon-fire-stick-too/
https://www.reddit.com/r/OLED/comments/btcwd7/i_just_got_a_clickable_ad_on_my_lg_while_watching/
etc
yeah
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
That's probably a life saver here tbh
netflix runs
prime video works also
what more do you need
I also have a chromecast for when all else fails
HBO, Hulu, Peacock, Netflix, Prime Video, Disney+, YouTube, Boomerange, Twitch, Funimation/Crunchyroll
You clearly need all of that
@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
So I think I'm gonna ditch the NodeJS driver for seeding data and go straight SQL.
@warm sleet this may sound weird, but I think I like doing it this way better. 
Our conversation(s) inspired me to do it in straight SQL instead of using middleman language
@upbeat nymph oof that loop though xD
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
you can treat a SELECT result as a table
What do you mean?
@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
I could set the primary key too.
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
Why is that?
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>
you should be able to
hm
a PROC can call another PROC
procedures also have a return type
if the last statement is a SELECT
it will return a table
Oh so I could in theory just make a proc called "seed" and call the two others within?

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;
oooo it works
Checks ^ if a player is banned on my minecraft server
huh
nice
IF EXISTS (query)
isgreat
returns true if the query has any records
@upbeat nymph this is why I love procedures;https://i.imgur.com/Z5tRPER.png
makes it so simple to have complicated rules in your db, but code is still clean
Probably quicker too
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
noice
GG
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.
Bro. The fuck. TikTok knows what Iโm doing.
can you convert scratch to javascript?
according to a quick search in the internet, yes.
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?
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
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
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.
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
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)
so 10 pixels is the length of your hypotenuse.
correct
would that be angles?
no, those are functions that help you turn your hypotenuse and the angle into the other two sides of the triangle
(trigonometry)
i didnt get to learn trigonometry since schools got shutdown so sorry if i get confused
@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
i know as far as soh cah toa, the rest i never learned
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
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
any1 have suggestions for an Android Coding App?
Thats like Virtual Studio Code?

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
don't
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.
omg, it is a priority date, don't worry
But thanks for the words Zencep
Even tho my GF was the one who brought up the idea of helping me finish the project
I'll consider that
@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
Does it work?
action has to point to the url of where it sends the data
action could be something like
If it works, it's okay. If it doesn't work, it's not okay 
no
@orchid ferry just put action="/" method with get
then press submit
should see your values in the address bar
it shows them
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
you would need a backend server
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
I only know how to use node for a backend
idk php at all
php has global parametrs with request info
like $_SERVER $_GET and $_POST
$_SERVER['method'] returns http method
its crude
and error prone
Do you use dreamweaver for html?
I wouldn't
wayyy to complicated
if you want a nice frontend use a framework like vue or react
intellij has a tool for chromedebug
I can add breakpoints in vscode and it carry that data to firefox
mail() in php requires some setup to function
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
It's gettin' there
why cant i install pyaudio
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
I don't know Python and I've never written in Python before
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
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.
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
sure
wdym sure
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?
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
I woke up to all data seeded 
does anyone know the best linux distro for programming?
20 million records, but yeah. Probably not that long because I fell asleep at about 8m/20m.
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.
280records/second
@upbeat nymph I bet if you used batches
it would be more like 5x as fast
I really only needed to do it once
RTT to database becomes significant
Well, would it be faster to restore a database from a dump or to generate new data in batches?
restore from dump is faster
Yeah, that's all I needed
@upbeat nymph SELECT INTO from a foreign db is even faster
you can copy records between databases
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.
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
yeah but gzip is not a container
its not like zip file
there's no directory structure
7zip supports gzip as well
hopefully
typical gzip archives are tarballs
wrap files into a tarball structure, then compress that
yields .tar.gz
Yeah, I work with tarballs a lot when moving files from linux to linux machines
transfer.sh is a great site omg. I love it
heh
@upbeat nymph I have a little webserver and a shellscript on laptop that puts a file onto the webserver via ssh
its basically like transfer.sh
yeah but with transfer.sh I don't have to host it myself lmao
yeah I am always privacy concerned
and don't like to litter files around third parties
except imgur, they can have all my screenshots
Interesting. ๐ค
Probably would be more on Linux based
@upbeat nymph repeated characters or sequences of characters saves a lot of space when compressed
INSERT INTO
can just be 1 byte
Now, would it be more compressed if I gzip a gzip file? 
nope, those algos are actually capable of recognising archives and ignoring them
D:
if you add a .zip to another .zip its a 1 to 1 copy
Fuck gzip doesn't like multiple files.
gzip does not support multiple files
That's good to know
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
Hmmm. Let's try.
gzip takes bytes[] input and gives bytes[] output
it dont care if its a file, datastream or whatever
browsers use gzip as well :)
although 7z seems to be better.
most html documents are compressed before transmitted
@upbeat nymph tar czvf myarchive.tar.gz directory/
@upbeat nymph nah http 1.1 has had this for a long time
deflate is zip
what was added with 2.0 that everyone was freaking out about? I can't rewmember
@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
not too shabby
@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

yeah pycharms still not doin anything
@umbral saffron is it doing anything in task manager?
try killing it
i restarted it and now it works but now discord wont open but i think everythings loading
(im using the browser version)
im not sure what could be wrong with discord especially since youre running it in your browser
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
have you tried following the previous advice of others who have said to convert sr.Recognizer to sr.Recognizer()
it seems that PyAudio is not blocking by default
i dont know what that means
basically the microphone doesn't make the program wait for input
ohh
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 (...) ?
openssl x509 -text host:port iirc
Wait, nupe
@deft pumice openssl s_client -showcerts -connect linustechtips.com:443 | openssl x509
without knowing anything about the library, shouldn't that be sr.Recognizer() instead of sr.Recognizer?
at least based on the example here: https://github.com/Uberi/speech_recognition/blob/master/examples/microphone_recognition.py
lol, just read someone else suggested the same right after your comment
I mean if you scroll up thatโs what squid told me to try
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
uhhh
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'
@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
Don't think it yields anything super useful
@warm sleet lsof says nothing is looking at the file, so no other program in theory.
openat(AT_FDCWD, "/tmp/external_ip", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)
Yea, just tells me permission denied, which isn't super helpful anyway
@sacred pumice what happens if you open with readonly?
@warm sleet that's fine, it works
@sacred pumice try replace the 'wb' with 'w+b'
Permission denied
@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
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
yea, I mean on my system the file already exists
which is obviously a part of the problem
what about file permissions?
if you don't have +w
obviously get a permission denied error
I'm root, so I'd assume that doesn't matter
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
[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.
but it works fine, because I'm root
-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.
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
returns nothing
wat.
lsof /tmp/external_ip also returns nothing
yes I agree, this situation is wat ๐
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
USER PID ACCESS COMMAND
/tmp/external_ip: root kernel mount /tmp```
so that means that the kernel currently has the file open for write?
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
ah, so nothing useful then really
try without -m
returns nothing
me too, it's a weird one
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.
why do you even need an external ip reference
you could replace that with a shell oneliner that uses some online service
I have one of those ipv4.domain.com subdomains
that just echoes your ipv4
@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
to make sure you don't leak ur IP ?
correct
why not check default route
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
the file is a cache so it doesn't hammer ifconfig.co
I deleted the security tools package and the GUI is gone
This is a centos7 VM
How can I get the GUI back?
GNOME gui @midnight wind
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
lol wat
@sick dome xinit probably failed
thats the program that launches the desktop environment
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
@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
TIL: You can use $npm_config_*flag* and use npm run *script name* --*flag*=*whatever* to use in your package.json scripts.
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
@sick dome - depends - which distributions are you using?
Centos7
@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.
the course was recorded in 2017 and I downloaded it recently from a repo at my university - could that be why?
Yes, that would be why. Distributions often make more up-to-date images for installing versions wit the bug fixes etc,. present.
oh, okay. Thanks guys!
Any python programmer out there?
I need help adding music features to my bot, your help would be sincerely appreciated
Iโm a python dev
yey
Have you ever had to choose between studing development or servers and comunications
xD
@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
No
hmm
I was thinking that maybe i could just use the heroku database straight away.
What do you mean
Ahh never mind. I purged and reinstalled postgresql locally. Its working now. I explained myself poorly earlier
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
take a look at the docs, there may be a way to make the thread wait
Docs are your best friend
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
the definition of spaghetti code
cross cutting concerns? neverheardofit
CSS, math, abstract concepts, all in 1 method.
good lord do you want bologneese with that spaghetti?
and so the next one and a half years of my life begins
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
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
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?
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
You can find out more here https://javascript.info/import-export
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
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.
you don't want to use script tags and expose deps if you're going to compile and minify your js
otherwise you'd have to make node_modules public, which will allow hackers to look in your package for vulnerable deps and exploit them
plus some deps might use an incompatible system, and the browser wouldn't know how to deal with the js file, resulting in console errors.
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
@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
when compiling it gets resolved automatically
at least, you're not exposing the node_modules folder, with package.json files of each dep, with the version number inside
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
the only things different from npm is:
yarn addinstead ofnpm install ...yarn.lockinstead ofpackage-lock.json
and a couple other minor things
@gusty girder https://webpack.js.org/
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
impostor!
Yellow sus
thank you that looks very promising. Google said to use yarn for front-end which is what I did, but seems my question was the wrong one.
@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
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
not if I throw away my code faster
HustleX is a fitness platform where you can learn new sports and take fitness courses with music!!
Coming soon!! stay tuned.
Song credit
Defqwop - Heart Afire (feat. Strix)
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:
nginx config file: https://i.cocobot.tk/iK7QhL0Q.png
nginx -t shows valid config file
@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
Everyone was saying that I was stupid not putting comments and now there is you saying that I shouldn't
jk, I think too that making the code easier to read with tabs and other things is better than comments
@covert axle
//writes buffer to output
out.write(buff.read(size))
I'm more talking about this kind of commenting ^
yeah
you only need comments before long functions or for loops so people can search for the part they wanna tweak
exactly
Spaghetti-o's are bad in any language
and no amount of commenting will make that sane
I learned this when I moved from c++ to C#
I'll tell you an even worse habbit
Moving from java to nodejs/typescript
; everywhere
;;;;;;
don't need those in js
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?
yup
@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
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
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
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
oh yeah
btw, if you have adhd, check out adhd-alien on twitter and other places. very relate-able
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
holy hell screw editing markdown tables
$("#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
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
$("#bullet").css("left",($("#bullet").position().left + (Math.cos(bulletAngle) * 10) + "px"));
$("#bullet").css("top",($("#bullet").position().top + (Math.sin(bulletAngle) * 10) + "px"));
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.
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
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
ok
how would i find that if none come up in the console
just replace the except code with what i wrote
ok so I got rid of the if computer in command part
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
yes but I got rid of the
if 'computer' in command:
line because im just trying to test it now
so what does it print
'Microphone' object has no attribute 'get_pyaudio'
ok
so what I think was the issue in the original code was that it wont wait for the input
@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
try to add print(sr.Microphone()) somewhere
where did you put the print
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)
nah put the print right at the try


