#development
1 messages Β· Page 30 of 1
π
there are libraries for everything these days π
I have general question about C if anyone knows the answer, when implementing a generic swap function why would one implement it with pass by value instead of pass by reference, is there some disadvantage to just swapping the references to the variables?
I need to output two backslashes in python and i cannot plz halp
print("\\\\")
no no no
4 slashes will print two
i dont know why discord deleted two of mine
ok thanks
sure thing
@royal sonnet that behaviour is because of escape sequences
which is used to print invisible chars and similar things
so \n becomes newline
and \\ becomes \
it can get ugly when you're dealing with paths,
so you can use the raw string literal construct to remove this behaviour
Thanks
by using r"path\to\folder" instead of "path\\to\\folder"
i want to turn only the diagonal elements in a list to 0
for rval,r in enumerate(a):
for cval,i in enumerate(r):
if(cval == rval):
a[rval][cval] = 0
this turns everything to 0
what m i missing?
the problem is that you are not adding to rval & cval at the same time. you are iterating through every element. You dont need two for loops. Use only one for loop and iterate both rval and cval.
imagine a 2d array as an xy graph. y=x is essentially what you are trying to do.
Anyone into arduino and i2c displays here ?
i want to be, but i havent gotten into anything like that yet
@nocturne galleon what is your question?
I already fixed it myself
is there anyone who wants to help me test my JS code by trying to crack it?
(disclaimer: its all my own code for a school project, I'm not trying to crack a public website)
PM me if you want to, I'll send the HTML and JS files
@nocturne galleon I like arduino just csnt afford it
@latent perch I could do some stuff once I get home but I'll be glad to help
Arduinos are only like $10
@graceful silo depends on which one you buy, I got the nano for about $5
@nocturne galleon I sent all the files and some information in a PM
you dont need the full board for most uses
if you have a board just buy the chip and use board as a bootloader
Any react developer that wants to join a "startup" for fun but that can teach you a lot? PM me
React? Never heard of it
@keen jasper yeah I get that it'd just be nice to have one full and not worry about it
OoO
Wait... A sec
Isn't react a JS library?
@keen jasper yeah it is
But like I'd rather save up. For the starter kit which I can get in my electro store
But AngularJS though
I've been messing around with JS recently but not really experienced with it only used node for discord bots
love those "for the experience" gigs π
at least it's not as obscene with software asit is with design
@swift niche please no
@keen jasper lawl I had to learn it at an internship, it was interesting not knowing JS at all and skipping to Angular
js is second easiest language imo
python is easiest
but angular is pretty advanced even if you know js, how'd you hold up? @swift niche
I actually really don't like JS
Angular was easy enough, did some pretty cool wtuff with it, but now I'm out of practice for it
I'm just used to C-style OOP, and I love Python, just not JS
I really really wanna learn cpp
No time though
also what langs do you know? @swift niche
The only "for experience" gigs I'll do are my own π
@keen jasper C, C++, Java, Scala, Python, JavaScript, HTML/CSS, Jade/Pug, Unix Awk + Perl + Bash, and Windows Batch scripts
so yeah, there's a lot lol
and my internship was at a big bank named UBS where I got paid $33.65 USD an hour to learn AngularJS lol
@swift niche how'd u learn cpp?
Google is a good resource
It's the primary language my college uses, they have separate courses for Python and Java, but those are only like a one-time thing that basically translate everything you know from c++
That's some memeception shit right thar
I've rickrolled so many people
Using that
@swift niche I can't decide on a online text course or a udemy video
@keen jasper for what language? I feel like it depends lol
hmm I might have some
I have basic C++ and one for data structures in C++, but they're not the best
would have to disagree
How...
video lectures on udemy are better than YouTube
Oh
in most cases
I thought you meant textbooks were better
I feel like they are even
Eh
good for different uses
I've learned all of my skills online.
videos + textbooks best combo though
or videos + slides
I have the Python Humble bunfle that was out a bit ago if you want that
It has PDF's, Ebooks, and videos
I've learned | | <-- this much from textbooks, and | | <-- this much from the internet
Anyone here try "Ticket Driven Development"?
welp, SOL on C++ refernces lol
lol
hmm
I CAN give you PDF's of the textbooks I needed to have for my intro to CS courses
lol I can at least give you their name & author, then
OH wait
I can find my professor's site where he has all of his presentation slides
maybe another professor's too
I'll stick with googling and trying
I mean that's what I did initially with js but I developed very bad practices
To learn the basics I want some sort of course, then googling is fine
I didn't do any course when starting.
The best way I learn is by either being instructed on code as someone does it, or being given work to do in it
https://www.w3schools.com/default.asp This is what I use for any sort of web stuff
HTML, CSS, JS, jQuery, AngularJS, JSON, AJAX, SQL, PHP, ASP, Node.js, XML, Bootstrap 3/4
I mean, W3 does develop JS, HTML, jQuery, and a slew of stuff lol
uh, what?
(use https://developer.mozilla.org for HTML/CSS/JS and skip jQuery!)
yeah w3 is dying
How so?
Hmm... Node.js or PHP...
swissbay stuff is all outdated
@graceful silo swissbay is a shitty out of date clone of the first link
@winged zodiac Can you provide the link or the repo to the code? Looks like your z-index is what's messing with the overlay
Is it not clickable?
Eclipse sucks ass .-.
It'd be so nice if it'd let me fold shit like if statements in Java
And there's a plugin out there that should let me do it, but I can't fucking add it because "This installation has not been configured properly for Software Updates."
IntelliJ is much better lol
Ye
Do i need a prog or a command for this? In msdos i want a program to list all my games and when i type the name of the game to open it? Like a shortcut in msdos...
Im thinking of a bat file that has if input run exe file from paths
Noob question really...
Anyone know a good site to learn python?
legacy code be like:
$obj1 = json_encode($json);
$something = $obj1->result->{'id'};
that sounds like it wouldn't work...
Im Learning Python. What have I done wrong? "" print ("with this Program you can:/n Divide /n Add /n Subtract /n Multiply /n type end to exit the programm /n please Note that this is a very basic programm,/n that is not capable of running Avanced opperations, /n such as utilising more than two inputs") def mode = input ("Please enter one of the beforementioned Modes") def uinputn1= input ("Please enter first Number: ") def uinputn2= input ("Please enter second Number: ") mode uinputn1 uinputn2 #Divide #Add #Subtract #Multiply if mode=("Divide") if uinputn2=0 print ("Division through 0 is Not Possible") else print ("uinputn1/uinputn2") elif mode="Add" print("uinputn1+uinputn2") elif mode="Subtract" print ("uinputn1-uinputn2") elif mode="Multiply" print ("uinputn1*uinputn2") pause ""
everything in your print call is being treated as a string... you need to use concatination
:/
that sucks π¦
Anybody know of any good tutorials with using node js or angular?
Trying to make a order system but I do not want to use PHP I would rather use Angular
Angular has a nice "Learn" menu available at https://angularjs.org/. W3Schools happens to be a good source, too https://www.w3schools.com/angular/default.asp
PHP and angular is like apples and oranges
PHP is completely on the server side, and Angular is just a frontend framework
Itβs entirely possible to use both in the same stack even
So I have aΒ PHP script that will serve users a photo based on a GET request.
<?php
$file = $_GET['i'];
$size = getimagesize($file);
$fp = fopen($file, "rb");
if ($size && $fp) {
header("Content-type: {$size['mime']}");
fpassthru($fp);
exit;
} else {
header("Content-type: image/png");
header("HTTP/1.0 404 Not Found");
readfile("https://i.ryois.me/404.png");
die();
}
readfile("https://i.ryois.me/{$file}");
?>
Is there some way to add a GET like ?i=myfile.png&c=1 where c=1Β will tell the script to compress the image before serving it to the user?
Im using PGP 7.1.7 on IIS.
it only allows image files
- Yes just add $compress = $_GET['c'] and check if $compress == "1" or whatever
yeah but how would it actually compress the image?
yeah
Easiest way is probably just find something existing
Other easy way would be the php image libraries
yeah. I tried. They're all compressing upon upload. Not client request
ok lol
For hand feeding if you want
Since php docs are pretty bad so I feel bad sending you there I might as well make it easy
yeah
@devout lava you can do it in a 1, 2 or 3 liner depending on your aim too
?
Easiest to just use jpeg compression would be too call imagejpeg(imagecreatefrompng($filename)); in one line
ok
Or 2 if you don't like shoving things into functions
Or 3 if you are going to be running it for a while in which case you want to assign the image object to a variable and actually remove it after
ok
Also you can have a quality option as well with the jpeg function
Does that do what you want?
Idk.. Ill have to try it π
There's some other stuff you can do to get compression if you want
Don't you just love it when JSLint doesn't catch your misplaced end bracket?
Don't you love it when people rely on ide's so much π
Soon they're gonna start just fixing errors instead of notifying you about them
hmm this isnt working loading the image https://i.ryois.me/resize.php?i=mywallpaper.jpg
yes
Then you need another function to load a *jpg into an image file
They're all on that page I sent
imagecreatefromjpeg most likely
Wow, no need to be rude, man. Just trying to make a relatable joke. :/
That looks like a rather large image lol
Anyone whos uses SQLite: I have a SELECT statement with a WHERE clause (lets ssay I'm selecting 'name', 'address', 'age'), and I need to use a column 'houseSize' in the WHERE clause, do I need to include 'houseSize' in the SELECT statement or will it work without it?
NO
SELECT Name,Address,Age FROM Customer WHERE HouseSize = 'Large'
Should do what you're wanting, where Customer should be substituted with your table name, and whatever you're looking for in house size field should be modified.
Awesome, just making sure, thank you @fresh dune !
@swift niche np take care
Can somone help with python programming?
["1.What is the Italian term for 'at a walking pace'?", "A).Andante", "B).Rubato", "C).karoce", "D).a crotchet", "a"]
def file_read(file_name, score, entered_username):
try:
with open(file_name+".txt", "r") as fp:
fpData = fp.readlines()
print("gey")
for line in range(len(fpData)):
print("gey")
for range(0,4(fpData)):
print(x)
print("gey")
fpData[line] = ast.literal_eval(fpData[line])
print('\n'.join(map(str, fpData[line])))
answer = input("Please choose answer eg: a,b,c")
if answer == fpData[line][5]:
score = score + 1
print("You are correct, your score is now", score)
except:
how would i stop a from printing?
because i am not at that level yet
You could change the print('\n'.join(map(str, fpData[line]))) to:
it prints gey
Why
cause i was seeing if it would run the for function
print('\n'fpData[1])
print('\n'fpData[2])
print('\n'fpData[3])
print('\n'fpData[4])
I think
I think so. I don't do python, so give it a shot.
ok
so just change the "line" in the print to 0:4 and see what happens.
k
hmmm it prints it all at once should i make a variable called cur and put in [] and increase it by one each time?
or just insert a \n newline in there along with the join.
(if you ever want to use nice code formatting, see: https://support.discordapp.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline- )
i need some help with random.choice in python
i need to have it pick more randomly, 7/10 i get the same message...
how to make it so 2/3 of the time its a different message?
secrets.choice might be better
Not exactly a dev question, but does anyone know how I could download someone's Google Slides if it's posted with a hyperlink to the slides, rather than shared with me? I'm trying to download these slides for future reference rather than go back and forth to the site, but I can't seem to find a way to do that
Whats the name of an unpredicted error in code that Grace Hooper used, and is used today
is it bug or defect
I'd guess defect. The term "bug" comes from the early days of computers, when literal insects would crawl inside computers and bridge circuits, causing unexpected behaviors. This meant that early debugging, outside of checking your code, meant making sure there wasn't a dead roach inside your mainframe.
Not a bad thought.
For a discord bot, should i use a local database (MongoDB) or an abstraction on top of google sheets? im leaning toward sheets because that allows it to run on any computer that can log in.
@here how do i even get gud at coding
i know a little bit of java
less kotlin
you dont get good, you git good.
and some HTML/css
@proper gale It depends of how much your bot need to read/write data, I'd recommand you to have a local DB tho, you can use something like SQLite, it runs with your app on all systems, or just use json files.
minimal amount of read/write and total data
its private bot, and i could always change it later.
@upbeat folio the first documented use of 'bug' to describe a computer not operating as expected was on a stanford research computer when a moth was trapped between contacts in a thermionic valve. there is a wikipedia article on it.
it was not a bug crawing in the mainframe, but rather one manufactured into it.
would it make that large of a difference, @little knoll?
You would have to rewrite a lot of code to implement a DB system after that...
nah, ther would be an abstraction layer inbetween anyway, so just that part.
Or you could use your own "DB driver" and so you would just have to rewrite it to switch to a DB system
Oh well..
yea, thats basically what im doing
The only issue would be rate limit and "I/O" latency (for Google Sheet thing)
so the backends im looking at are mongodb (im running it in different jars so it needs to be external) or google sheets (anywhere)
Or (if you work with nodejs) you can use NeDB, a local standalone MongoDB like system.
Java/Kotlin and Discord4J
Ok... So it's not an option ^^' So yeah, you could try it, it should work, but if you want to try something else for the anywhere scenario, you could use SQLite or json files to store your data.
ill probably go with mongo
@nocturne galleon The best thing I can recommend for learning how to code is learning how to read code. Once you've got the basics down (which you can pick up from just about anywhere), peruse some open source code to see how other people have made things work. If you find something you don't understand, get ye to Google or StackOverflow (or even ask here). And also, try not to get discouraged if your code doesn't work the first time - practice makes perfect, and every developer worth their salt tests what they've written before publishing to make sure it works.
anyone good with cloudflare and or IIS here?
I've used IIS in the past.
I'm trying to get caching working with cloudflare
nvm got it
Hey would anyone mind helping me a little if you have knowledge with php. I'm trying to make a system for login and some other stuff
Why are you using PHP?
Not to be rude just actually wondering
I can help more if I know why you are using it
I've never used php for login
Really you shouldn't use PHP as a general rule but for some things it's acceptable
<?php
$file = $_GET['i'];
$size = getimagesize($file);
$fp = fopen($file, "rb");
if ($size && $fp) {
header("Content-type: {$size['mime']}");
header("Cache-Control: max-age=2592000");
fpassthru($fp);
exit;
} else {
header("Content-type: image/png");
header("HTTP/1.0 404 Not Found");
readfile("https://i.ryois.me/404.png");
die();
}
readfile("https://i.ryois.me/{$file}");
?>
thats what I use php for
Even for that I probably wouldn't use php
what would you use?
node.js, python or go
ah
And I'd load the images from the binary files
And setup rate limiting and other stuff
PHP I use for really quick things that just need to work okay
Or if I don't care enough to do it properly
Hmm π€
Is that so?
Well if I can use python for that I'll be fine I think... Alltough I'll have to reward into it but thanks for the help
You'll have a much better time with python
Only thing will be you won't have the php functions but most things will be really easy to do
Well I'll get right on this once I get back to my pc
Oh and if you're wondering about what I'm working on my school cafeteria asked me to make a website for them
Yeah definitely don't use php then
php is horrible.
lol
PHP is pretty bad
But it has its uses
And php 7 is actually pretty good
You just shouldn't use it for the majority of things
Suggestions for session management other than PHP?
NodeJS with middleware solutions
I had to use NodeJS with express-session package tp handle that for us
Worked out pretty nicely
I tried firebase.... that went "well"
mostly because I don't know how to use firebase
@devout lava you should suppress that x-powered-by message.
Security reasons
On IIS?
Oh ok
expose_php = [opposite of whatever it's set to]
I'm not at my pc and can't rdp right now but tell me and I will.
Ok
@tropic grail done π
That max age should be 31536000
ok
int main(void){
printf("Hi Everyone!");
return 0;
}```
#this is an horrible language
print("bad joke")
Snaketype is honestly only if you want to look like a hacker in front of non techy friends
Camel is much better imo
I gad a coworker once that did that
after the third indentation level, he would start going back so he avoided his 80 limit
:S
If someone wants a custom playing status on Windows Discord, I created this: https://github.com/TIVJ-dev/DiscordPlaying
Don't take it as self advertising. I'm just telling about the possiblities, and BE CREATIVE with custom playing status.
what do u mean?
It is only programmed to respond to few commands and open Discord. It is bsically an app, doing nothing useful, except allowing you to put custom status
what you should be using rich presence for
Is there anyway to stream a remote video on nginx without using much ram?
Like some kind of reverse proxy
Here is your first challenege! Have fun oaawz://ohjrwbggsl.ulvjpaplz.vyn/
Fuck
is the website supposed to say something?
@winged zodiac
there is a lot of text there
something for Hewlett-Packard Company
im too lazy to decompile
How would you guys go about turning a Python disctionary into a database? Would you just make a loop to take the keys (assuming the keys were the column names in the database) and just do an insertion/update SQL command with all the values?
I mean I don't know how else you're going to do it
Manipulate the data and upload it
If it's very large and you hit hardware constraints there are tricks you can do but otherwise it's just a loop so don't overcomplicate things
@timber violet itβs hex
Does anyone have any experience in trying to get node to connect to MySQL over an SSH tunnel?
Hi! I'm having problems with sessions in java (servlets, jsp and filters).
So let's take admin user for example.
So the case is that I have login page which works fine.
After admin has entered username and password correct it redirects to "/admin" where is index.jsp. (I have Filter that checks if the user actually has logged in. the filter url pattern is /admin/*)
On the index.jsp I have <a href=""></a> to another jsp page but when I click the link it seems that the information about the user on session has dissappeared and filter redirects me back to the login page.
haven't seen servlets in a while, but how are you accessing the session?
Oke what do you guys think is the best language to study in the field of embedded programming besides c
That's true, was kinda hoping for some other languages tho, need to be able to do it in 2-3 months as a live performance assessment
@small escarp So after user has filled in the form and pressed the login button it then goes to servlet in server side (the user doesn't see the process on client side). In the servlet I check if those parameters (username and password) from form are containing something. If those parameters succesfully contains something and aren't null then I run query on database that checks if there is a user or not with those credentials (the method of the query is on a different class).
Now to the session. So after the method that checks from database if it found the same username and password finds correspongding user it then returns a new User object (which has all of the information about the user) to servlet .
Then I have method "forwardAdmin" which takes HttpServletRequest, HttpServletResponse and the User object (that the login method returned earlier).
Method parameters are HttpServletRequest req, HttpServletResponse resp, UserBean user
And I call the method and give those parameters to it. Inside the method I'm setting the session with "req.getSession().setAttribute("user", user);" (the attribute value is from the method parameters. The whole user object that login method returned earlier)
then I use "resp.sendRedirect(req.getContextPath() + "/admin/");" to send them to the correct page.
Hopefully this helped you to understand more what is happening.
hey, anyone know how to design a different design for each ios device (ipad, iphone etc.) in xcode 9, i can't even fndthe any x any option that i see all the youtube people have
Sorry, I have no idea, because... I'm not an Apple developer, so, I'm sorry... I hope someone else can help ya
it alright
You also have Adobe XD or Gravit Designer for Windows
Does anyone know something like gyazo that i can connect to my webserver
Just use ShareX with a FTP+Webserver
thats what I do
@small escarp I solved my problem. The problem was on the filter. So what I did wrong was that I checked if the requeseted url was same as "/admin/". This leads to that when I try to go forward from the admin index page the requested url isn't anymore "/admin/" because it is now "/admin/adduser.jsp". I simply changed to check if the url contains the "/admin/" and now it works properly
Any devs on?
Trying to code an app to launch steam vr from insides windows mixed reality cliff house with this line of code;
{
// The URI to launch
var uriSteamVR = new Uri(@"steam://rungameid/250820");
// Launch the URI
var success = await Windows.System.Launcher.LaunchUriAsync(uriSteamVR);
if (success)
{
// URI launched
}
else
{
// URI launch failed
}
}
But when clicked a popup opens saying i need to install an app from the windows store to launch it
does it work in chrome?
Im thinking its a UWP DRM
Sound like it to you?
But see, you can download UWP apps from chrome and they work in the MR cliff house
weird
i have no clue, sorry
For anyone else that comes across this chat; https://redd.it/7y0yhr
My best guess is that it's some kind of UWP sandbox
Not sure what you mean by 2D mode
import asyncio
import discord
from discord.ext import commands
from discord.ext.commands import Bot
import platform
import sched, time
s = sched.scheduler(time.time, time.sleep)
import feedparser
d = feedparser.parse('https://linustechtips.com/main/discover/all.xml/')
print (d['entries'][0]['title'])
print (d.entries[0]['link'])
url = 'https://linustechtips.com/main/discover/all.xml/'
last_etag = "null"
feed = feedparser.parse(url,etag=last_etag)
feed_update = feedparser.parse(url, etag=last_etag)
TOKEN = 'BOT TOKEN'
description = '''LTT Forum'''
client = discord.Client()
bot = commands.Bot(command_prefix='*', description=description)
channel = bot.get_channel(CHANNELID)
@bot.event
async def on_ready():
await bot.change_presence(game=discord.Game(name='with RSS Feeds'))
while True:
last_modified = 'null'
d = feedparser.parse('https://linustechtips.com/main/discover/all.xml/', modified=last_modified)
if last_modified == 304:
print("NO NEW")
else:
await bot.send_message(discord.Object(id='CHANNELID'), content=(d.entries[0]["link"]))
time.sleep(10)
bot.run(TOKEN)
wow that is nice
CHANNELID and BOT TOKEN will need to be updated
What lang is that?
Python3
neat

I think Luke does a bit, but Linus doesn't... IDK just a guess
@devout lava visual studio code is amazing π
@nocturne galleon don't mention people. specially staff.
especially the LMG team 
you wan sum of deeze?
you can't get deeze π₯ on spotify

ew spotify
Why not mention people?
Well that's lame
It's not lame. Imagine if you got 15k pings while you're trying to work.
Reason Linus doesn't look at this Discord.
Max about 6k actually but you get his point /s
any nodejs devs here?
Not me
https://i.imgur.com/5Cp1jWv.png how can i make it so that i can update userId from within request.get's callback?
in the first case, userId is always undefined
lies
Nice one @fallow zephyr
if i have a List<Block> in c#
in which Block is defined as Block(int X, int Y, int Z)
how would i find a block at a certain position?
for example the block right above a specific block
nvm figured it out but its inneficient af
So I've been thinking about making a easy to setup version of Taran's second keyboard (the idea being that you would run an app that would generate the boilerplate code, then you could download i.e. a pack for a certain app to use as a second keyboard.
Thoughts?
@weary vortex A bit late in replying here, but the way you have it set up, you're returning userId before it's been defined. Node.js is a synchronous language, which means it (essentially) fires all of the commands one after the next without waiting for the previous one to finish. As a result, you're logging userId before the get request has finished (or likely even started).
@solid horizon if you want efficiency searching neighbours you can use a matrix class
or a sparsematrix class
through multi-index arrays or arrays of arrays (or hiding index calculations on a simple array through the class interface)
@weary vortex You should look into promises, and get to know the Bluebird library (which is one of the best out there). It's a really good way to run code asynchronously - so tell the code to wait for certain replies before continuing. In your case, you'd probably want to do something like...
if for some reason you have tons and tons of blocks and are extremely sparse, you can use a k-d tree/octree or some approximate nearest neighbour algorithm
function getUserId(user) {
return new Promise(function(resolve, reject) {
if(isNaN(user))
{
let request_options = {
url: 'https://api.twitch.tv/kraken/users',
qs: { login: user },
headers: {
'Client-ID': clientId, // NEVER HARD CODE CREDENTIALS
'Accept': 'application/vnd.twitchtv.v5+json'
}
}
request.get(request_options, function(err, response, body) {
if(err instanceof Error) {
reject(err);
return;
}
// Use 'let' instead of 'const' since the scope is much more contained.
let result = JSON.parse(body);
resolve(result.users[0]._id);
})
}
else
{
resolve(user);
}
})
}
function createWebhookSubscription(user) {
return new Promise(function(resolve, reject) {
getUserId(user).then(function(userId) {
console.log(userId);
// Do whatever you were going to do with the user ID.
}).catch(e => {
reject(e);
})
})
}
createWebhookSubscription("monotron_");
createWebhookSubscription("78773671");
thanks for the help!
& don't worry my client-id has been moved to a configuration file
I'm still relatively new to node.js so its quirks are still weird to me
by trade I'm a C#.NET programmer lmao
It's definitely a strange beast coming from anything related to C, lol
I started in PHP, so I know the learning curve
but yeah, if you use Promises like how I outlined, it should make things easier
The idea is that a Promise tells the code to wait until its resolve() function is called, and if you put that in the callback, you can program asynchronously. Calling resolve(something) actually runs the callback that you outline in Promise.then(function(something){})
(I also recommend checking out the Bluebird library, which is actually more powerful than the native implementation of JavaScript promises)
will do!
shelved the project for now because of work etc. but i screenshotted this convo for future reference π
i will definitely use this advice in future
@small escarp thanks tho i have no clue what that means lol, but ill look it up
@weary vortex regarding promises, nodejs comes with promises baked in, no need for the blue bird library.
But the code above still works
Also @upbeat folio nodejs is asynchronous - synchronous is where you wait for the last command to fire then move on to the next command. It even says on their website (in effect) - but don't worry, we all make mistakes from time to time.
@weary vortex you can also look into async await syntax, which though I do not understand it completely, is essentially a wrapper around promises
(it's a wrapper around generators, making working with promises much nicer)
Thanks ks for the correction
@vestal glen
(https://www.npmjs.com/package/co is how you'd do it before the async/await sugar)
Also here is why nodejs is asynchronous: https://stackoverflow.com/questions/17607280/why-is-node-js-asynchronous
Isn't it better to use built in code? Async/await has been in nodejs since v8 LTS
But yeah, good point if he uses v7 or lower
As footnote, the asynchronous and synchronous are confusing names as synchronous would imply things happen at the same time (which it essentially means the opposite of) . Then again Js calls generator functions generators when they don't really generate anything and Linus Tolvards decided to call git, well, an English swear. Programers name things in weird ways.
also, js always only runs one line of code (except for workers...), which is why you may call it sync in some way, though that's how the runtime behaves, not how your code behaves. You can still have race conditions...
generators are built to generate sequences
it's just that you can misuse them.
Makes sense.
:)
(now I know why generator are called what they are called, all the example I saw made it look more like some form of user controlled step by step function)
Thanks!
I prefer Bluebird for some of its more advanced features like concurrency control for promise maps and the like, but Iβll definitely give the await syntax a look. Thanks! π
You are welcome!
Also, yes, it is single threaded so it does only do one thing at a time, but when coming from PHP, I found it helpful at first to think of it as trying to do everything at once. This video, though, gave me a much clearer understanding of exactly how the event loop works, and how the various parts of Node interact with each other (note: it's long, but also good).
JavaScript programmers like to use words like, βevent-loopβ, βnon-blockingβ, βcallbackβ, βasynchronousβ, βsingle-threadedβ and βconcurrencyβ. We say things l...
Thanks. Will have a look
Anyone with experience in Windows Batch scripting know how I can get the file size or bitrate of a video, store it in a variable, do some math to it, and then use this result as a parameter in ffmpeg?
powershell might be your best bet @swift niche
know of how to do it in powershell? @dawn geyser
not off the top of my head but
may get you started
thats for mp3s but the logic should be similar
I'm not sure if this is the best platform to ask for help for linux. But, does anyone here has had experience in installing a desktop environment for Arch linux?
Install Gentoo or go over to #tech-support
@fringe wagon ive used Arch linux quite a bit but whats up ?
@dawn geyser I've just installed Arch Linux, and now I'm trying to install xorg so that I can install gnome. The thing is that it seems that I can't get an internet connection (Ethernet) after the arch installation. I can't even get a respond from ifconfig.
@dawn geyser What should I do to set up an internet connection?
What does ip link say
If you need nic drivers you can try downloading their package and transferring it via a usb stick or something
@fringe wagon you would have to check if your nice drivers need to be loaded or installed. Did you install a precompiled kernel or build your own? It's been a really long time since I used arch Linux but I remember it used to ask certain questions on the kernel side of things. But run an ifconfig command and see if you have more than just the loop back interface. What hardware are you running on and are you hard wired or relying on wifi?
does anyone have experience with pycdc or other Python decompilers?
need to decompile some really.... fucky 2.2 bytecode
Has anyone ran gnuroot debian on android?
thank fuck that someone made an add_boost.cmake to use boost from cmake without binary
does anyone have experience with REing BIOS images?
@tropic grail reverse engineering BIOS images
Not fun.
i have a Toshiba UEFI BIOS binary
Bricked a board.
f
browser discord > installing an electron shitpile
@ freaktechnik#5786 Install Atom, an Electron code editor
@tidal dune so many things with electron these days π¦ And most of them don't really need it, they just did because it was cheap.
(to develop)
I use electron sometimes because I like JS.
It's very slow on my Mac Pro though.
lol
I like JS too, but I really don't like electron. Never liked the idea of everything using its own "web" engine. I'd much rather have one central one, where I know what security patches it has...
It's Chromium, you can see patches, or source code if you want.
You can use others libraries like Electron for Node "Native" apps that could be less heavy on resources.
Even install a web app from Chrome to run it in a single window, but more limited in functionalities.
(Basically a standalone Chrome Tab)
Gotta love those mac pros @tidal dune
I have one sitting in the corner of my room, and a PowerMac G5 in nearly the same case too
maybe
or is it running on a HDD?
Could be the CPUs as well since they're fairly old, but not too likely
Make sure they're compatible
Firmware hack.
but that might improve performance a bit
They have twice the amount of cores, and I think the same power.
I'm already using Piker Alpha for El Capitan.
And a nVidia driver for my Graphics Card (not GPU, thanks Linus for TechQuickie!)
fuck this shit, i think you got the notif, it was REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE, ECLIPSE, REEEEEEEEEEEEEEEEEEEE!!!!!!!!!!!!!!!!!!!!!!!!
@nocturne galleon ^
what lol
bot deleted my message.
@proper gale what lol
message of REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE, ECLIPSE, REEEEEEEEEEEEEEEEEEEE!!!!!!!!!!!!!!!!!!!!!!!!. botcase botcase botcase botcase botcase
you, using eclipse. REEEEEEEEEEEEEEE!!!!!!!!!!!!!!!
what's wrong with eclipse?
mhmm
the kotlin thing
whats good about eclipse?
i actually haven't used eclipse much.
but the little i did, i hated the editor.
then again, i hate the VS editor (that i can back up lot more).
still have to fucking use it because CLion has shit MSVC support still, and MinGW doesn't support the C++17 stdlib yet....
let me show you Vulkan real quick
does it have autocomplete?
iirc, its just a text editor.
huh.
main thing i hate about MSVS is that it doesnt manage #includes for you.
CLion: oh, you need that? let me include that for you, MSVS: oh you need that, lets forward declare it and hope all is well.......
With the atom-ide plugin, it would be able to but there is still no ide-cpp plugin to support C++ (but there is already C# support)
theres probs an auto-include plugin
List of atom-ide supported languages : https://github.com/atom/atom-languageclient/wiki/List-of-Atom-packages-using-Atom-LanguageClient
i would expect resharper to do that
cool, still staying with my full fat IDE because nsight.
I have to learn C# at school but I don't like it... And VS is a freaking Titanic made of bricks... Even with a NVMe SSD it so freaking slow and heavy to use!
And the atom-ide plugin isn't that powerfull so...
@little knoll i have no speed problems with my SATA SSD
64GB of ram and a 1700x probably helps a lot.
what are your computers specs?
Dell XPS 15 9560 (i7 7700HQ, 16GB DDR4), power mode set to max performances.
It's not that slow to load/run but it's still freaking heavy to use. It's like using a tank as a shopping cart :/
Intellisense and debuging tools that are working at each of my key input while not being helpful when I need them :p
It's probably because we are only writing some basic apps (CLI and a bit of WinForm) and that VS is more adapted to heavier/complex apps
@little knoll intellisense is shit, get resharper.
Yeah, I'll try it, I even have JetBrain licenses with my school so ^^'
@little knoll how big are the projects you are working on ? i have no end of trouble with VS and intellisense due to one of the service reference files we have here thats around 580k lines of code, VS and Resharper really hate it
I was just saying that probably VS would be more adapted to heavier projects and so Intellisense would be much more helpful than on a small project. ^^'
I'm not a huge VS user so what I'm saying may not be accurate ^^'
Β―_(γ)_/Β―
can i post html/javascript question here?
of course you can.
anyone good with html/javascript
well not necessarily good, i need a simple quite basic thing
https://gyazo.com/0bef472eb89b77b52f75d3c4a416b388
Gyazo
Gyazo
so im working on a sign up form for a site
and ive done a function that checks for invalid characters in the first name
so it outlines the box with a red border, but i would like to have a message put on the right side of the box that has a red X and says "Your name must include valid characters" or something along the lines of that
so my question is what command outputs a message in a specific location for example in that box right there ?
so what ive done so far was create a div with id "error"
and then try to set it to a certain value with the error message once function returns false
it doesnt work niether does showing an alert for some reason
so the border does turn red once i attempt to submit the field of the firstrname
How did you try to show the error message?
Display:none on the error div and jquery toggle when it returns false?
no i didnt use jquery
im trying to use only javascript/html
function JSfirstname() {
var checkfn;
checkfn = document.getElementById("firstname").value;
var i;
var text = "/~`!@#$%^&*()_+-=0123456789'./,;";
for (i = 0; i < text.length; i++) {
if (checkfn.indexOf(text[i]) != -1) {
document.getElementById("firstname").style.border = "2px solid Red";
//document.getElementById("error").value.style.font = "bold 12px Arial";
document.getElementById("error").Value = "Hello";
return false;
}
}
return true;
this is my function so far
this line is the problem
document.getElementById("error").Value = "Hello";
ive tried creating a div under the input which has no text
and then im trying to make it have a text value with the error message
ive tried
document.getElementById("error").value
document.getElementById("error").innerHTML
document.getElementById("error").innterText
document.getElementById("error").text
and window.alert
and alert
and none of these change or do anything
Than there is an error in your js which stops the rest of the function
Right click on the page, select "inspect element" go to the "console" tab and trigger the code again. It should display errors in your js
When you're selecting the error id you do .value.style.....
Remove the .value
the console doesnt say anything
the value.,style is a comment
it doesnt affect anything
its something i tried but i know doesnt work
Oops sorry overlooked the //
I'll be back at my office in 10 to 15 minutes. I'll be in a better position to help you from there. I'll get back to you then
alright, thanks a bunch π
you there?
Yeah man, messing around with it in jsfiddle. Weird, can't even get an alert by only having that in the function
exactly
i dont know why
thing is it used to alert before
but now it doesnt
dont know what im doing wrong
hmm it's weird. Have to do some normal work to so it takes a bit (well a lot) more time than usual
Weird. tried that as well. Didn't work
Anyways, a jquery example: https://jsfiddle.net/ckxrcate/32/
no it all works for me now for some reason
i havent changed anything it just started working lol
thanks anyway for your help
Any time man. Glad that it works now. Thought I'd give jquery a try because js didn't work but now it does
jQuery is the best thing ever
also
any idea why my class doesnt work on a div
<div class="errormsgs" id="errorcountries" style="margin-left:436px; width:50%"></div>
/* Error messages divs */
.errormsgs {
font-size: 12px;
font-weight: bold;
color: red;
}
@dapper yarrow if ur still here haha
i still am. give me 15 mins
Close of the width in the inline styling. My ocd is tripping balls π
@mint coral are you stil using the getelementbyid?
I meant with a semicolon
Getelementbyid won't work on a class (wasn't being a prick, misread your answer)
Use the link above for info
Replace getelementbyid with getelementsbyclassname. Store that in a variable. It results in an array. So if you only use that classname once it's: var x = document.getelementsbyclassname("errormsgs"); x.innerHtml("hello"); should do the trick
Shit no
X[0].innerHtml("hello");
I'm tired π
Any ideas for beginner oop java program
Yeah, don't study where I did. They'll suck all the java fun out of you
Question about multithreading: if I can get an exact count of the number of CPU threads available on a system dynamically, is it better to create something like an array or list of that many threads, or is it more sensible to make a queue with an unlimited number of queue-able threads?
IE a system with 8 CPU threads would have an array/list of 8 thread elements, while a queue version would be able to execute a maximum of 8 threads at any given time that would be chosen from the queue
This is "well known" research that resurfaces every other year. Let me tell you a story how I have heard about this in 2012 and putting it into perspective. ...
I envy parents who use keyloggers.
why
Can you guys tell me how your loadtime is on my website? Just did a huge amount of reoptimiztion https://dark3n1ng.party/
Well, I now feel like I'm back in 1999 with that website O.O
anyone who knows openCV or python can you help me with this?
for (x,y,w,h) in faces:
cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
roi_gray = gray[y:y+h, x:x+w]
roi_color = img[y:y+h, x:x+w]
eyes = eye_cascade.detectMultiScale(roi_gray)
for (ex,ey,ew,eh) in eyes:
cv2.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2)
cv2.imshow('img',img)]```
what does the function for roi_gray and roi_color do?
how do I change code so its fits to screen
@civic mountain
Also I want my particles to be over the video, almost as if the video is replacing the grey in the back
from copy import copy
app_ctx = copy(app)
app_ctx.message = msg
app_ctx.args = args```Can anyone think of a quicker way of doing this? `app` is a class that has been initialized.
I can't seem to do class attributes to it
telling us what lanuage would be useful
:3
can someone help me with my html and css
hi
Hi, so I am a email developer. I am just curious if anyone has any idea of new features I could add to email newsletters that could make them more interactive
For those VS Code users in here https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer
the solution is always a plugin.
though maybe there's ide-java or something that supports building.
With some plugins you could run your code within atom. But I don't know if there is some Java compiling plugins for Atom at this time. AtomIDE is only useful for diagnostics and advanced autocomplete.
I don't know if Visual Studio Code supports to run Java code within the editor (with the debugger) but I know for sure that it's working for JS and C# (and more through plugins)
Yeah that Atom IDE wont do what you need, didnt look at it properly. Best of using an actual dedicated Java IDE
I personally use Atom for its interface and plugins (for Nodejs/PWA dev) but if you really want to run code within your editor, you should use another IDE (and wait for atom-ide to become more powerful, they recently added a shell/cmd terminal so... Probably More Soon β’ )
From what I've heard, JetBrains have a cool (but not free) Java IDE (Eclipse like). But the closest alternative to Atom is Visual Studio Code (VS Code), if it supports Java debugging (which is probably the case)
JetBrains have IntelliJ community edition, which is free @little knoll https://www.jetbrains.com/idea/
Ok nevermind ^^' JetBrains have too much software with different licenses so it's hard to remember ^^'
Is vs backdoored
notepad++ is fucking horrible
Haven't used Sublime in years
- 1 for sublime!
sublime... ew
^
atom is my boi
sadly, i dont understand why you would use a text editor over an ide?
i do like atom but eclipse is much more convientent
@nocturne galleon same reason some people buy Ford and others buy Renault, different strokes for different folks.
what?
what the hell is a renault
jk im in the US lol
Plus it just seems easier to develop in a text editor than an IDE
how so?
Just how i find it
But I spend more time doing Python than other langs.
this is the closest ive gotten to an ide
We use Eclipse at Uni and I'm not a fan.
i like atom more
Me too
just that the script plug-in doesn't support user input?
Which one?
so i need to come back to using terminal commands
ummmm
let me check...
ha lol school wifi blocked me from looking at plugins 
I use Hydrogen to help me test my code as I go along.
plugin?
for atom
ill try it if it is
Yeah
it that pythom @nocturne galleon ?
Yeah
no its not
its python
Wait mine or yours?
yours
its not pythom
Yeah mine's Python
haha
shh
i tried to edit but you replied...
do you know java? @nocturne galleon
I can read it and modify it but I'm not an expert.
how much python do you know
A lot more than I know Java
i just restarted making objects and stuff in java
Nice
@nocturne galleon you should give IntelliJ a try
Node.js, Python, PHP, Go or C# for a web app
I'm leaning away from C# and PHP because they're probably less suitable for what I'm doing
And it really doesn't matter what I'm doing so I can use whatever
I personally use Node.js to develop web apps and it works well, the advantage is that you write server and client side code with the same language and even be able to use the same lib.
@hasty sail tried it, didn't like it! π
i use intellij for kotlin @hasty sail
@hasty sail finally, someone with some sense.
@ionic hull I've had my CPU up to 1600%, soooooooo, did i break it?
wut?
@nocturne galleon https://hastebin.com/wibumikoci.cs
@nocturne galleon thats a very basic way to do a quiz, and also very easy to break.
@proper gale just download some cpu
Oooh a shiny development channel.
Ooooh
Oooh
@proper gale how can i make it better
@proper gale im trying to learn swing so maybe my quiz could be used graphicly
dont bother with swing, go for JFX
neither is easier than the other, but JFX is newer and more capable.
what are some prerequsites for guis in java
not much.
i looked at example code and saw "@overrides" and polymorphism
should i learn that first?
@proper gale
@nocturne galleon patience.
i already know objects
properties and behaviors
ok
You'd have to change the webhook URL to your own but here's an IFTTT applet that "should" tell you when WAN show is live
It's no better than chrome notifications
Although all I've been getting are errors about the twitch service or api being down. Not on my part I guess
Guys who wants a custom page on my website
Ok guys if you want a cuistom page on my website please tell me everything you want on it (TEXT, Images, Gifs, MUSIC)
Why would anyone want a page?
@nocturne galleon he is probably some kiddo that thinks everyone uses his website
That image doesn't help
@winged zodiac I solved your "challenge" but you never acknowledged it
There we go, it does work
Whats the best service to run my landing page I need to be able to upload my files tho so some ftp support and support for like zoho or something so I can have a custom mail domain.
@ me response
@gritty rain like basically nothing I have messed around and created my website thats just in a file right now and everything is local. I have used a ftp once but that's about it
@nocturne galleon can you elaborate a bit more
I have a file that has a index.html and a style.css and a video file and an audio file. I need to put them online under a domain so that anyone can come view the html that I wrote. by view I mean like viewing like a website.
You need shared hosting and a domain
I also kind of want to be able to have in the future like zoho mail so I can have like memes@(insertmydomain)
k
@ionic hull I have over 380k views
@nocturne galleon You can buy a $5/m vps from Linode and a domain from Namecheap and host your content there.
I can give you a hand if you like...
No worries, this will also mean you can get custom mail domains too
@nocturne galleon Would you like to talk on voice chat?
Sure im not actually coding or looking at linode right now tho
is CLion a decent IDE?
Asking if their is a decent python teaching site won't mind if it costs a couple of bucks π€ π€ 
@nocturne galleon https://www.codecademy.com/learn/learn-python
@thorny galleon if you are unfortunate enough that you have to write C/C++ then it is the best one you can get
I mean there are no real alternatives that come even close to CLion
It is basically IntelliJ for C/C++
@thorny galleon as stated above, CLion is great. Personal favorite C/C++ IDE if you dont need extensions and MinGW is an option on windows.
basically, i'm dealing with a decade-old MMO server emulator codebase
it uses plain make, not cmake
would it be usable with CLion?
Not sure
anyone know a better way to do this? ```cpp
void clearBufferSubData(GLenum target, GLenum internalformat, GLintptr size, GLenum format, GLenum type,
const void* data) {
// required state tracking and glcall
}
void clearBufferSubData(void* dataptr) {
auto charptr = static_cast<char*>(dataptr);
GLenum target = *(GLenum*) charptr; // 0
GLenum internalformat = *(GLenum*) (charptr += sizeof(GLenum)); // 4
GLintptr size = *(GLenum*) (charptr += sizeof(GLenum)); // 8
GLenum format = *(GLenum*) (charptr += sizeof(GLintptr)); // 16
GLenum type = *(GLenum*) (charptr += sizeof(GLenum)); // 20
void* data = *(void**) (charptr + sizeof(GLenum)); // 24
clearBufferSubData(target, internalformat, size, format, type, data);
}
void runBuffer(){
// for: method/data* pair in buffer
void (*method)(void*) = /* this would actually pull from an array */ clearBufferSubData;
void* data = /* also pulled from array */ nullptr;
method(data);
}```
How do i get the asterisks under the numbers?
#include "stdio.h"
int main(void) {
int numbers, stars, rows, asterisks;
int a, b;
for(numbers = 1; numbers < 7; numbers++){
a = numbers;
if( a < 6)
b=a%2;
if (b == 0){
if(numbers >= 1 && numbers < 4)
printf("\n\n%10d", numbers);
else
printf("\n\n\n%d", numbers);
}
else
printf("\t\t%d", numbers);
for(asterisks = 1; asterisks <= numbers-stars; asterisks++){
for(asterisks = 1; asterisks <= numbers; asterisks++)
printf("*");
stars++;
}
}
}
Try putting printf("\n") before the 2nd for loop?
If thats isnt what you're looking for, explore gotoxy() but I think it's pretty outdated
unfortunately that was not it @spark pasture
im guessing your required output is a pyramid ?seperated by numbers?
well kind of a pyramid :p
i just have to get the asterisks under the numbers @dawn geyser
yeah so gotoxy might be your best option, you have to remember where you place the 1 and basically go to the same location 1 step lower
because it looks like you dont want the output of
1
*
2
**
3
damn discord haha
@verbal otter what are the actual requirements? because "printing under the numbers" could mean a lot, you obviously have more requirements than that otherwise they would be on new lines
@verbal otter use ``` to format your code please.
Put it at the top and bottom to make a code block
Does anyone here know how to make a MP4 video stream cdn with nginx or something else?
Depends.
@dawn geyser the stars under the number and the amount of stars correlates to the number making a pyramid
Like this. Put code in this to format it nicely so others can read it
didnt know u could do that
#include "stdio.h"
int main(void) {
int numbers, stars, rows, asterisks;
int a, b;
for(numbers = 1; numbers < 7; numbers++){
a = numbers;
if( a < 6)
b=a%2;
if (b == 0){
if(numbers >= 1 && numbers < 4)
printf("\n\n%10d", numbers);
else
printf("\n\n\n%d", numbers);
}
else
printf("\t\t%d", numbers);
for(asterisks = 1; asterisks <= numbers-stars; asterisks++){
for(asterisks = 1; asterisks <= numbers; asterisks++)
printf("*");
stars++;
}
}
}
See?
See the ` next to the 1 key?
ahhhh
that's the one.
yep
That letter after the ``` is the language it's in, which in your case is C.
do you know the answer to my problem? @tropic grail
I don't speak C, sorry.
@verbal otter It looks like you just need a \n in front of the asterisk, no? Maybe additionally you need to add the appropriate number of spaces as well.
^
no bueno bb
@tropic grail do you know the answer to my problem?
@verbal otter you need to sort out the tabs as well. Putting /n before the * will drop it to the next line, but it won't automatically line up beneath the numbers because you haven't added tabs before the asterisks like you did for the numbers.
\n I mean lol
@ionic hull No, I don't do C.
\n will make a long line of asterisks
@ionic hull actually creating your own CDN is...quite a big endeavor lol
@verbal otter sorry I should have been more clear, I mean /n before the first asterisk in a group, not before each one individually
can you show me what your saying?
put printf("\n"); before your asterisks loop
the nested for loop or the nested nested for loop