#development
1 messages · Page 5 of 1
this is dict.get()
like None, 0, or False
and then this is supposedly what makes "key in dict" work, I'm poking around to figure out what this means
prolly this
you can benchmark the python code if you really care
what ide is that
vs code
damn what plugins
alright if dict.get(key) is 0.77% slower (im not a scientist though) than if key in dict, which kind of lines up with the extra couple lines in the cpython source
but I bet if I ran the tests, itd be incredibly different so im just gonna not look into that
Does VS have a WYSIWYG GUI editor?
if dict.get(key) and if key in dict are different, you probably want if key in dict
I’m looking to replace AdminScriptEditor
yeah, I think dict.get(key) is best used outside of if statements
dict.get(key) is used to actually get the value, key in dict checks if the dict contains the key
using if dict.get(key) looks like you're trying to check if the dict contains the key, but will evaluate to false for some values even when the dict contains the key
I do like the readability of key in dict too
This is the theme
>>> x = {}
>>> x[1] = None
>>> print(x)
{1: None}
>>> if x.get(1):
... print('hello')
>>> if 1 in x:
... print('hello')
hello
that is actually really interesting and probably couldve caused me headache at some point
Senior developer?
*Co-Owner you potato
I've been programming since before you where born
I'm older than you
migitino is 65 bro
what's this? what are you guys even debating lol?
it rarely is good when the only thing a commit message says is "Made it good" 
Anyone know why I get asset protocol not configured to allow the path: when I try to load files from my local disk with tauri?
but its made it was good so like its good its chill bro dont mind the 11,000 lines added
yeah, I don't mind indeed 
On your first day at the new job, squash every commit from the repo into a single commit with message "Legacy code" and force-push to master.
getting this kinda energy
don't think this channel is meant for recruitment lol
exposure to some money in my pocket
wdym by signup page
like a website signup?
I don't understand
what's the purpose
websites for that already exist
like evite
since there is an article on how to hide it I assume it's a feature https://help.evite.com/s/article/hide-guest-list-on-invitation
Is there anyone that is beginner or just starting to learn programming? I’m looking for someone to learn with or help stay on track
I know html and starting js
Js is reasonably capable.
if you need that kind of mentorship or relationship join bootcamps
if you can't/won't pay for that you can usually find
hi i want some help with docker
please help
You should double check the mongo image name: https://hub.docker.com/_/mongo
MongoDB document databases provide high availability and easy scalability.
That’s how it is sometimes
Is there a better way? I have been running this version of code from Windows 7, so i assume there must be a faster command?
"for /F %%a in ('mountvol ^| find ":"') do (
dir %%a 1>nul 2>nul
if not ErrorLevel 1 (
del /s /f %%a*.log
)"
i then have it repeat for different extensions (eg .mdmp .old etc)
for /F %%a in ('mountvol ^| find ":"') do (
dir %%a 1>nul 2>nul
if not ErrorLevel 1 (
del /s /f %%a*.log
)
GM all, Any FE Devs here?
What
oh that means frontend
i thought that was gonna be something crazy
and yes there are a lotta fronties here
nope, no frontend developers exist on this server, please move along!
in all seriousness - how about you just ask your question instead lol?
maybe theyre looking for likeminded individuals to discuss rounded stuff
I'm round
Nice, But looking for someone skilled in the following......
- Javascript ES6+
- React.js proficiency
- HTML
- CSS & SCSS
- Understanding of Websockets
- Electron.js experience (Understanding the IPC/Renderer workflow)
- Application Architecture Design (Understanding the most performant ways to structure Electron apps)
- Core understanding of how Web Browsers work (Chromium especially, V8 JS Engine, Rendering, Processes & Threads)
- A great attention to detail from designs
- The want to create innovative and game changing products!
- An interest in online privacy is a plus
- Must be fluent in English
There is a bounty for the successful referral. Thanks anyway. DM me if anyone should need more info. Thanks.
@silk eagle Here's a link to the online application. https://vsdofekru0q.typeform.com/to/wZLJRmgw
You should’ve led with that then 😛 “looking to fulfill a bounty - anyone interested in a front end position?” Or along those lines
Good luck on the bounty hunting anyway! 🙂
I once worked some place that did referral links that never expired, it was hilarious. Ppl would just spam the links online and get unlimited referral bonuses from random strangers that applied to openings.
Blender's default Color Grid texture remastered into a game-ready developer tiles texture, .0625 measurements
I'm the one paying the bounty 😅
🤝 👍
what, so if I refer someone who gets the job, you pay me $500?
thought you were looking to find someone and get $500 if you did
Is it bad practice to use a dom element to store data
Like if I use a list in html to store names and read the list to get them back
wouldn’t it be easier to just store it in a variable
It sounds inconvenient. Sounds like something someone would do because they lack experience/knowledge.
What is this list of names? Something you’re displaying on the page anyway?
Anyone have any tips for me disabling zoom on websites?
I've understood that browsers tend to prevent you from doing such on websites. Which makes sense, considering it's a feature for a user's convenience, and by taking it away from them, you fuck with their accessibility...
However, in apps that aren't really websites, but more like desktop apps built in a browser engine (such as Discord for example), it might make more sense to prevent zooming...
Yes.
I am the community Manager for MASQ.ai We are looking to add another member to the Dev team. Bounty on a referral that leads to successful employment. 🍻
ah okay - good luck, hope you find someone for the position! 🙂
I was setting up a thing where you enter multiple names to search for in a dataset, since I was displaying the names to be shown on the dom anyways I thought I might as well read the names from the dom as well since that prevents any chance that there's a mismatch with what will be searched for and what is displayed
but I ended up just having a separate set that I keep track of alongside the html where I stored the actual names
these days you typically use frameworks like React etc, which will store the names in a list (variable), and render them in the DOM as well
but sure, you could do it this way, though it makes more sense to just store them in a variable, and build the list in the DOM from the same variable
Idk if there is a way todo that on a website rendered by a browser, but if you are making a web app using a browser engine (like electron app) then usually it already is or can be disabled.
But when they are using their browser / browser engine I don’t think you get any control. 🤔
no, not like Electron, it's a IE11 browser control in a .NET app
Maybe could do some CSS trickery with measuring the browser on first render, then making everything in app fixed size. So if they zoom in / out then it’ll stay the that fixed size? Idk if that’ll even work out just trying to brainstorm. Lol
Oh IE11 and .NET aren’t in my wheel house, if there is something custom in that stack. 😅
yeah, meta viewport is supposed to work, but apparently no browser respects the no scale option 😒
AAAAAAAAAAAA
trying to compile lzma tools from scratch. I barely even know how to write a makefile
You don’t need to know how to write a make file to build a project
Figured it out
I did need to do my own makefile, the source code is open src from somewhere but stripped down to go onto embedded os. And need a new makefile to build on desktop so I dont need to emulator all the time
turned out to be simpler than i thought it was gonna be
(AMD SYSTEM TESTED ONLY) So guys If anyone Having trouble disabling driver virtual singutrue and tried everything possible in bios ... and when shift click the restart button the modified system. boot to disable it is frozen .. I found out that a clock overclock is causing this issue disable it to default.
python modules are depressing
pythons' performance is very acceptable to python users
I recently got a LicheeRV Dock development board. I tried to use a generic allwinner d1 boot media but it failed to boot. When I plugged the power cable into my laptop I noticed a USB device titles something like "allwinner usb flasher". I didn't copy that string but when I looked it up it suggested to use some USB flasher to flash some firmware to it. Where would the firmware be and how would I flash it? I had found a tool to flash the d1 chip, but no firmware. Would I need to flash the firmware to boot from the SD card?
Is it a bad idea to do API calls within useEffect in React?
No that’s a common way to fetch some data and set to state as long as you make sure deps array is set so it doesn’t keep rerunning on every render.
If you want a lib that wraps it up for you all nice with caching react-query is pretty awesome, esp when paired with Axios which auto parses json and throws on not ok. Granted those are pretty easy tasks to make a fetch wrapper do and just call that wrapper. Feel like I may have suggested that lib to you in the past though. 🤔😅
I tried to follow an infinite scroll for my "pagination", but for the "since" I get no normal value return, which is why my scrolls not working.
https://coolhead.in/create-infinite-scroll-in-react
The first would be the since and the second is the limit, which returns 20.
Of course, I also added the query according to the backend API like bla bla LIMIT since, limit
If sharing the whole could would help more, I can also do that, but I don't want to be a big pain
By not working, I mean, I keep seeing my "loading" text and nothing happens even if scrolling, which I believe is because of the since isn't correct, so the query is not working
Edit: Solved this, now the only problem is that, it keeps going into a loop, so it adds +X to since everytime until things overload.
So Ive had issues with Grammarly(Im not here for tech support don't worry) and from what I understand it isn't optimised for macOS in any browser. So my question is why? like does MacOs have a x86 translation thing built in and its not like they just haven't developed it properly for safari as its about as bad in chrome too. So does anyone understand why enough to explain it with my at best year 10 computer science class knowledge of programming.
who says it's not optimized?
can't find anything online about it
idk if u google grammarly macOS lag some stuff comes up
it legit consumes 4-6GB of ram
and I've reimaged my laptop twice
well it's electron which explains a lot
there's a suspected reason
ok so basically cant do anything but uninstall quite annoying. I probably also need to with actually just spelling correctly but me trusting it moved be from an A to a B in a recent assessment.
thanks for the help though
interesting to see for something thats not free and seems to have a huge marketing budget they cant redevelopment the extension but that could be a bit nieve of me
lol, you'll be surprised how much software sucks in the world
even when you are paying thousands
yeah I've head it gets MUCH worse in when buying software for a company. I've heard some real horror stories of companies charging heaps, moving on to developing and supporting their new product and then not supporting a product their still happy to charge millions to a company.
was watching reviews Microsoft developer kit 2023 volterra anyone using it for daily use?
review comming on shorcicruit
?
any reason this prints absolutely random values that are not in the array at all? if i manually enter a number in place of the i it returns the proper value from that element in the array.
beginning to think it might be a hardware issue at this point with the arduino but everything else works perfectly on it (it is primarily a geiger counter)
Not really
Made a new arduino sketch with only the array and reading out the elements to serial and there I get expected results
Weird af (running on same hardware)
wait no it still happens and seems to happen only in progmem
yeah didnt realise the intricacies of arduino progmem weird that it seemed to work normally when outside a for loop tho
it looks like out of bounds shenanigans? is it def populated at that index?
I forgot to use pgm_read_byte_near
I have no idea how it was reading values normally outside of loops tho
The relief when it just works lol
(and yes the thing counts geigers too)
Javascript ultra noob here
I wanna make multipage site with a single HTML
And my current js solution is rather crude and takes a lot of code
Each button has its own function and the function just sets the intended element to translateX(0px) and other page either translateX(500px) or translateX(-500px) depending on the page location to have proper transition.
I need a way to shorten this
And opacity for intended element to 1 with the rest to 0
Yeahh like a week experience of javascript 
Surely it’d be easier to just dive into Vue, React, Angular, or Svelte?
Then use the typical multiple files and hyperlinks instead of that clunky codebase you have right now
You must first walk before you can run
Go with multiple files and master the 3 before fiddling with that kind of "changing the page using scripts" code
Use multiple pages please lord all mighty
No web application in this world ever has several pages on one site directory
well i used multiple html on a previous one
but i don't quite understand how to make a good transition yet
my teacher kinda don't give an eff on shitty code anyway
just need the web looks good
Wym a good transition
dynamic looking stuff
wdym dynamic looking stuff
like fluent looking site with animations
not static monotone ones
i have news for you about how modern js frameworks do it
don't worry about that since that basically requires SPA
which is out of your scope
plus I personally hate websites with lots of animations
the hack I've seen done is make an animation to a white screen
then when the other page loads make animation from white screen to website
stealing this idea
Does anyone have experience setting up an build system for large projects? Currently we are using threadrippers with Proxmox running multiple vms, each vm is dedicated to a single development branch in order to maximize cpu usage. However I feel that this is not as cost effective as building multiple i7 builds
depends on the cost of everything around the system too
it's also probably not worth buying new systems before the threadrippers have earned their worth
i hate java compiling i just spent an hour and a half debugging on a missing semicollon
Hi. I can't remember if the binary operation where you change the 1's with 0's and the 0's with 1's has a name? For example 0101 would result in 1010, or 0000 would result in 1111?
bitwise not?
switcharoo
what did the compilation errors tell you
also the code looks interesting, what does it do? 👀
Our current systems are being overwhelmed right now
Anyone who knows visual studio code, I hid the "run" button on accident I have Code Runner installed, I cannot for the life of me figure out how to get it back
Fair
Syntax error and thats it becuase im using a difrent compilor so the errors are so vage
Why not use IntelliJ? It probably wouldn’t help you with this problem though, but I’m fairly sure it’s a better tool to use than BSCode for Java programming
what compilor are you using
tbf, the red line in the editor should be an indicator already.
If the red line does not alarm the coder, changing the IDE won't
becuase im building for a robot so i have to use their thing (wipilib)
.
oh, I see, makes sense then - was just curious fwiw 🙂
yeah, I was just asking out of curiosity ^^ and also not sure if IntelliJ has their own compiler or not, but since they are using some other custom compiler anyway, that doesn't really matter either
Anyone happen to know RAM consumption differences between SQL Management Studio and DataGrip? My work compute has 16GB RAM, and I seem to always consume 80-100% of the RAM while using DataGrip + Firefox 
Is 16GB RAM just not enough for these kinds of things?
Where did you read that they have a custom compiler
Who? IntelliJ? If so; I didn't read they have, I just said I'm not sure if they do or not
don't have much problem with sql studio
but my ram usage doesn't go below 10GB all day long
yeah, I seem to be struggling a bit here
this is the result after restarting pretty much, so surely it'll be much higher after a bit of work
Ah yea, that's why I usually don't go with 2 Jetbrains Software.
i go with using "power save" mode in one when using the other
their "intelligence" simply is too heavy to be running at the same time
ahh, guess I don't have to have both running at once - just out of convenience so I can switch back and forth as I please, instead of opening and closing it all the time 😛
and my PC at home has 64GB RAM, so at home I really never have issues with this kind of stuff
I guess it's fine, until I want to index a database, or whatever it does, that takes an eternity to do 
Yea that's fair. I would do that too if there won't be a perofmance limit
In my current tasks, where we have different databases that with the same content.
indexing is just PIA
why would I need to index the same schema to run 2-3 select/updates
yeah, I sometimes have many databases, same structure, but different content
Yea I meant same schemas but different data
so I tend to want to hide the ones I'm not working in, and deciding to show some other ones, I have to wait for it to index or whatever lol
ahh yeah
SSMS is better in that regard, but I don't think SSMS indexes ahead of time, like DataGrip does(?)
Yea like most IDE vs Jetbrains.
jetbrains does the heavy lifting at the start to provide the seamless exp
ssms is better when I need to do simple things
yeah, so it's fairly quick after it has done the heavy lifting
yeah, I just find myself getting much more value from DataGrip than SSMS, in terms of convenience - especially with editing data in tables
in SSMS it's easiest to just write update/insert queries lol, and that's so annoying compared to just add/edit a row in a table
also in DataGrip you can run a select query, then edit the data in the result table, but I can't do that in SSMS 😦
Yea DataGrip is better in Development overall
Although not true, I created a bias where
creating script = ssms
r&d = datagrip
If I need to change something quickly datagrip would be the way to go,
yeah, they both have their areas to shine 😛
just like Visual Studio vs Rider - although I believe Visual Studio has gotten a lot better now that it's 64 bit support as well
All of the devs in the company I know uses VS. I use rider
I don't follow company tradition
haha yeah, I tried using Rider in my last job, but the project just wouldn't work in Rider (codebase was really old though, like 10 years or so)
also TFS integration (since we used that instead of Git) wasn't particularly good in Rider 😛
IDK. the current project just wasn't build for rider but it kinda works
and yes no TFS integration. but that's price to pay
yeah, now I don't work as a developer anymore, and the times I do touch code, it's new projects written from the ground up by me - for better or worse 😛
yeah. this is my first job as a fulltime dev
ahh, nice ^^ how are you liking it?
I had my first full time dev job in 2017-2019, as a fullstack developer on a proprietary CMS solution written in PHP
then I was a fullstack developer on a proprietary eCommerce solution written in C#/ASP.NET from 2019-2020
Indeed
you were a fullstack developer
that's good! I was very conflicted personally haha
some projects/tasks I enjoyed A LOT, and others just burnt me out
technically still am, just not professionally anymore, just on a hobby basis 😛
Anyone experienced with Pandas here? I have a dataset with some missing rows (all rows where a particular column would be 0), and I want to backfill those.
More specifically, that is exactly what I'm trying to find out about that dataset - which rows were omitted.
Example data:
city | dealership | quarter | car | units_sold
1 | 1 | 1 | civic | 10
1 | 2 | 1 | corolla | 5
In this example, the missing data tells me that dealership 1 sold 0 corollas, and dealership 2 sold 0 civics.
This is not the actual dataset, by the way. The actual dataset comes from a 1.5GB CSV with 26 columns and 5 million rows
unclear question
you can always be
what part wasn't clear?
everything tbh
it's very confusing when we can't see more of "the picture"
correct me if I'm wrong @dense cloak, I think what he meant was:
- every dealer sells all car, but when he sells none of a specific type of car, the row is omitted.
Exemple, the entry in the csv
city | dealership | quarter | car | units_sold
1 | 1 | 1 | civic | 10
1 | 2 | 1 | corolla | 5
Represent:
city | dealership | quarter | car | units_sold
1 | 1 | 1 | civic | 10
1 | 1 | 1 | corolla | 0
1 | 2 | 1 | corolla | 5
1 | 2 | 1 | civic | 0
And the question would be, how to add the omitted row?
exactly @young elbow
Actually, I think I just got this working!
First I created a new column that represents the unique combination of city, dealership and quarter (just a string concatenating the three, split by -).
Then I created a MultiIndex from_product between this new column and the name of the car.
Finally I called set_index on the dataset, followed by reindex with fill_value=0
is protobuf similar to a less readable/more efficient json?
#0 MyAlloc (size=65536) at src/Alloc.c:44
#1 0x000055555555efbb in RangeEnc_Alloc (p=0x555558765720, p=0x555558765720, alloc=0x555555562d70 <g_Alloc>)
at src/LzmaEnc.c:545
#2 LzmaEnc_Alloc (allocBig=<optimized out>, alloc=0x555555562d70 <g_Alloc>, keepWindowSize=<optimized out>,
p=0x5555587656b0) at src/LzmaEnc.c:2561
#3 LzmaEnc_AllocAndInit (p=0x5555587656b0, keepWindowSize=0, alloc=0x555555562d70 <g_Alloc>,
allocBig=0x555555562d70 <g_Alloc>) at src/LzmaEnc.c:2717
#4 0x000055555555f2a7 in LzmaEnc_Prepare (allocBig=<optimized out>, alloc=<optimized out>, inStream=0x555558765560,
outStream=0x0, pp=0x5555587656b0) at src/LzmaEnc.c:2733
#5 LzmaEnc_Encode (pp=pp@entry=0x5555587656b0, outStream=outStream@entry=0x7fffffffdb40,
inStream=inStream@entry=0x7fffffffdb20, progress=progress@entry=0x0, alloc=<optimized out>,
allocBig=<optimized out>) at src/LzmaEnc.c:2904
#6 0x000055555555794f in Encode (fileSize=<optimized out>, inStream=0x7fffffffdb20, outStream=0x7fffffffdb40)
at src/lzma_api.c:248
#7 lzma_run (inputStream=inputStream@entry=0x555555557280 <inputCallback>,
inputContext=inputContext@entry=0x7fffffffdc80, outputStream=outputStream@entry=0x5555555572e0 <outputCallback>,
outputContext=outputContext@entry=0x7fffffffdc80, compress=compress@entry=true) at src/lzma_api.c:286
#8 0x0000555555557a3d in lzmaCompress (inData=<optimized out>, inLen=<optimized out>, outData=0x7fffffffdcf8,
outLen=0x7fffffffdd00) at src/lzma_api.c:305
#9 0x000055555555f6a0 in doThing () at main.c:26
#10 0x00005555555551a7 in main () at main.c:37
``` this is so true
very easy to understand so simple
what am i looking at
stacktraces of LZMA library
that makes sense, understandable
I have to remove all dynamic memory allocations
would it be possible to write a whole app for android in c++ or c? i know people mostly use kotlin and java for that, but the c languages?
i dont see why not but the languages arent that used for mobile developing so there must be a reason
There's an NDK so it's possible, and you still need their studio thing to do it (https://hackaday.com/2020/05/13/writing-android-apps-in-c-no-java-required/). While there are some technical reasons why writing entire apps in C++ may not be ideal (such as JNI switching overhead without workaround, portability challenges, etc), it's mostly avoided just because there's so much native support for Java, which has been blessed by Google as "preferred" with their SDK. With that said, C++ is still often utilized in the form of libraries, especially for mobile games. (at least, that's my understanding. Take this all with a grain of salt; I have no experience with android dev)
the reason is, there are much more 3rd party libraries available so that's easier
what is jni
The Java Native Interface https://www.ibm.com/support/pages/java-native-interface-jni. Perhaps best understood if I phrase it that context switching between the JVM and Native code, and exchanging data between them, can be costly. There are some shared memory workarounds; but those sorts of problems may not be relevant to you unless you're making something highly responsive like a game.
so you cant run c++/c "natively" as you can run java
In a sense, but backwards. The execution path needs to leave the JVM and execute on the native hardware. That often requires moving around a lot of resources. Sort of, but not exactly like, having the JVM on a desktop launch a native application.
But as I mentioned; mostly the reason for people using Java et al is their official support. I think the NDK has a limited subset of the regular Java API available to it, and none of the frameworks obviously. Another friction point is that beyond just the technical lack of support, there's also a lack of community support. If you run into problems, it will be quite difficult to find resources to help you out since the rest of the ecosystem is all written in the preferred languages
there is no JVM, nor Java on Android. The primary reason for not doing stuff in NDK is because it makes mostly no sense. Yes, you can code whole app in NDK, but why would you
ah correction, i was thinking of Dalvik (DVM), but it seems my information is ancient
thanks!
it's complicated, but the point is that Java/Kotlin code is compiled into Dex/ART bytecode; native code is, well, native code. You still need to have the classic stuff like Android Manifest etc, but for most use cases, it makes no sense to code the whole application in something like C/C++; more often than not it is best to do huge parts of application in Java/Kotlin code and only performance parts would be in native code. You don't want to waste your time in doing stuff like "main game menu" in native code if you don't have to.
or to be more specific 🙂
Java/Kotlin is compiled to Dex (interpreted bytecode), which is compiled into ART (native code for specific platform). So if you are fine with feature set of the Java/Kotlin code and expense of some stuff like handling garbage collection, you just ignore native code
yes
time to get back into some assembly coding 🙂
yuck!
Imagine
Poll on visual node based no code ai development (as seen in unreal and unity for games) https://www.reddit.com/r/artificial/comments/ypye9v/how_many_of_you_would_use_a_drag_and_drop_visual/
6 votes and 8 comments so far on Reddit
bro writing assembly but still using a python script to build
bro please just use sh/bat or something
Python is a pretty nice scripting language
It is used a lot nowadays
Ansible is an example
Probably a Makefile would be a better choice, but this is literally a couple lines of code so it doesn't really matter
i had enough of drag & drop tools when i had to do it for XML transformations
drag & drop is nice. until it doesn't work and can't fix it using the tool used
then you regret your decision and just go back to doing it programmatically
before I go out and start spending my free time relearning RoR, is there anything that is preferred over rails nowadays? (regardless of lang)
Preferred for what? Rails was always rather niche, but had a decent developer experience and high productivity for web development.
if you need more performance golang, rust or elixir might be a better choice. If you want to do machine learning Python makes more sense. Enterprise world still widely uses Java/Kotlin and C#, sometimes node.js. And of course most of the web runs on PHP, so that's the most popular choice
and if you mean another framework for Ruby then Hanami got a little bit of traction, but not enough to mention it yet
I guess a better wording wouldve been 'what alternatives are there' but that's exactly the kind of answer I was looking for, thank you.
one of my colleagues has actually been doing some work w/ custom editor panels/controls in unity for drag-and-drop scripting of things like level interactions/missions
it's a great time saver for stuff that works well as visual diagrams
but only because we all understand and can write the underlying scripts/level definitions, and have no problem dropping back to that as needed
Does anyone know much about reverse engineering Unity games?
-- 03:10:18.872 ▶ 2 seconds lagging. (x3) - Server - Ping:23
-- 03:10:22.888 NobleBuild loaded successfully. - Server - ExperienceMain:9
-- 03:10:24.904 4 seconds lagging. - Server - Ping:23
``` got lag detect and pingin' finally working *not
Hey guys anyone know some c# to help with my assignment? I'm so lost and idk where to begin
here is a screenshot
A hint on where to start would go a long way its due tomorrow and I'm panicking
yes
no idk where to begin w this
yeah but ever1 comes from foundation year or previously learnt c# this is new to me
all we learnt were concepts and exercises never a question like this
things like basically completing a code or finding the mistake
That would be appreciated
we are gonna learn gui but haven't yet
my teacher said to create a method and use a while loop that checks the player's answer
but I still have no idea how to
its morning
but i have class in 1hr
ill dm u when i get back sounds good?
Thanks again for the help
you should make a bootloader then boot into a c main function and write your own operating system
so itll be the exact same thing..... whats the point
i'd rather write python than sh tbh
ive been working with a mysql database, trying to encrypt the data i store in it. But for this you need a key, which you of course want to store safely. Storing this in another database with encryption raises an issue however, since you will need to save those keys as well and that just dumps me into a rabbithole of keys. What is the industry standard in this?
depends on what you want, last place i was at we used SOPS https://github.com/mozilla/sops
hashicorp vault also exists
ahh so its stored differently than just yeeting it into a db
that would make more sense than whatever i was thinking for sure
the reality is you are going to need to have the unencrypted secret accessible somewhere, you just have to put proper permissions and safety in place
i guess this isn't as useful depending on your deployment model
Yeah its already locked behind admin permissions and locally hosted without any opened ports or anything, so i think its already safer than ill ever get
Its super interesting to read about, but doesnt fit my needs no xd
Its more complex than i need, i think creating a small algorithm to code and decode a couple thousand keys internally will suffice
wait
The db is only accessible through the admin route, so anything done will inadvertedly return the data unencrypted anyways
how do you plan to encrypt the data?
start by reading in user input and printing it back out
Thanks man I managed to find a solution : )
im dying from quartus
Anyone has any idea on how to re-create this button animation in css?
well you probably should start with the logo on the left, then some text, and on hover you move the logo out and move the arrow in... that's my idea
or are you just looking for someone to do your homework for you 🤣
ill stick with my transform scale(1.04) buttons
more in the sense of i got no clue what im doing in css xD lol it isnt homework
fair enough, sorry for assuming (a lot of people show up in here trying to get homework help)
this is probably a solid starting point https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions
CSS transitions provide a way to control animation speed when changing CSS properties. Instead of having property changes take effect immediately, you can cause the changes in a property to take place over a period of time. For example, if you change the color of an element from white to black, usually the change is instantaneous. With CSS trans...
read up on how transitions/animations work in this scenario
So, I have this project model that has an owner, which can be either a User or a Team
const projectSchema = new Schema<IProject>({
projectName: {
type: String,
required: true
},
description: {
type: String,
required: false
},
site: {
type: String,
required: false
},
owner: {
type: Schema.Types.ObjectId,
required: true,
refPath: 'ownerModel'
},
ownerModel: {
type: String,
required: true,
enum: ['Team', 'User']
},
slug: {
type: String,
required: true,
unique: true,
dropDups: true
},
keywords: {
type: [String],
required: true
}
})```
The problem I'm having is when the owner is a team, because teams can have multiple owners, like this
```ts
const teamSchema = new Schema<ITeam>({
teamName: {
type: String,
required: true
},
owner: {
type: [Schema.Types.ObjectId],
required: true,
ref: 'User'
},
slug: {
type: String,
required: true,
unique: true
},
bio: {
type: String,
required: false
},
verified: {
type: Boolean,
required: true,
default: false
},
quote: {
type: String,
required:false
},
members: [{
member: {
type: Schema.Types.ObjectId,
ref: 'User',
required: true
},
status: {
type: String,
required: true,
enum: ["accepted", "pending"]
},
type: {
type: String,
required: true,
enum: ["admin", "coworker"]
}
}],
followers: {
type: Number,
required: true
},
logo: {
type: String,
required: false
},
type: {
type: String,
required: true
},
})```
And while I got to populate the owner field of the project (aka loading the team), I can't for the life of me make the owner of the team neither the members of it load via populate.
I tried owner.owner, tried altering the model to not use an array, tried using deepPopulate plugin but got a type error. Nothing worked
Does anyone have a suggestion?
take a look at the actual database schema, i'm going to bet that it's only going to allow users to be referenced. What's the stack you're currently using?
hey can anyone explain how can I do this table in excel ?
sorry if the question is off topic
Select multiple cells and select merge & center under alignment.
tried that but the issue is that merge and alignment is disabled for some reason
The table tool is a bit finicky, so you may have to merge first, then format as table.
Do any of you guys have ideas for remote development jobs I could apply for?
You should know what you want
Hi I know the basics of html and css, but I want to get somewhat more in depth of it, does someone knows a good guide or tutorials that could help?
great ty
Every position I apply for is a no, so I guess I'm just screwed and need to work a crappy job forever.
how many did you apply to
took me 60+ applications and 12 interviews to get my first entry level position earlier in the year
no hs diploma no degree
just keep applying, build ur skills while doing so, if you get an interview and it doesn't go well, ask why it didnt go well. if they tell you that you aren't qualified for a position, ask if they have any other open positions that you would be qualified for, etc. interviews are where u dont have to be a resume in a chrome tab.
they're where you have to be code in a chrome tab 
is polling or event based joystick more useful for game programming?
Probably polling for most things youd wanna do
Idk if I got extremely lucky. But when i started searching for internships, after only 2 applications, the first one had gotten back to me and ended up hiring me. Now they gave me a pretty sweet job offer.
That said, I'm looking to move away from that company and having some struggles, so maybe im not so epic awsomly programmer as current company thinks
I'm convinced that recruiters go through a ton of candidates just to be like "hey guys im finding the best people, it'll take a while". job security
I've applied to over 100 positions and never got an interview, I've been programming for over a decade.
programming for a decade, but how long have you been applying for
Over a year.
applying for a year, but how long have you been trying
You just need to learn to catch their interest. If you read the job listing you'll see what they specifically look for, tailor your application to that.
Do you know how many people just apply and don't even bother catering the application to the specific company in question or don't even read the listing at all? Also if the recruitment company is using an online portal it's specifically to easily filter out people who don't meet the basic requirements.
Or you don't have the skills they're looking for? What programming have you done for over a decade?
I’d deff take a step back and analyze what your applying to, your skills, and your resume. If you have been programming for over a decade, applied to programming jobs for over a year and over 100 positions with 0 interviews then something sounds very off.
When you say over a decade are you saying professionally / as a full time job or has a hobby / side gigs? Those at every different things and may help set the context and what type of role you should try applying to.
I'm being offered a previously owned fujitsu U757 fujitsu laptop. it has this processor (the weaker one)
https://cpu.userbenchmark.com/Compare/Intel-Core-i7-8550U-vs-Intel-Core-i5-7300U/m320742vsm223355
but it has a single slot 8GB of memory that I may be able to upgrade to a double slot of 8GB (16GB total). My currently laptop is a Lenovo with the i7 above but only 8GB of RAM. Would it be worse switching for the weaker processor even with the extra RAM? I'm in uni but I have one subject that Spring in Java + ReactJS, which tends to take some time to compile.
you would be going from 4c/8t to 2c/4t. You need to decide for yourself if you are hitting CPU or RAM constraints
oh crap I forgot to check core count yeah
what is your current laptop model ?
Lenovo ideapad 320-15IKB bought in 2018
Wish my teacher at the time hadn't said 8GB was enough
well
you could upgrade it to 16GB module if you really wanted
https://www.notebookcheck.net/Lenovo-IdeaPad-320-15IKBRN-8250U-MX150-FHD-Laptop-Review.284462.0.html a bit different submodel, but i guess it is similar enough.
see the Maintenance section:
After removing the numerous screws, the cover can be removed relatively easily with a little skill and a suitable lever.
you just remove the original memory module and put in a 16GB module, they cost around 50-60 euros for a 16GB module ?
I am creating a new database and related schema to be able to monitor an experiment and multiple samples of data. I am thinking of creating a table for every experiment run, and then having a many-to-one relationship of another table (samples) and having a key in the samples table relating to the experiment created in the experiment table.
Because the samples taken happen almost immediately after the experiment is started and an experiment record is created, I am wondering what the best way to keep track of the ROWID pk (sqlite3) key would be so that I could insert this as part of the sample record created. Is it appropriate to do something like SELECT MAX(ROWID) FROM experiment LIMIT 1; and set the result to a global to share with the rest of the program?
Last time I check I have 2x4GB one is unremovable
My model has 2 slots, and an amd gpu
as article says:
The storage device and RAM can be exchanged easily, although we should mention that only one module can be exchanged** as the other 4 GB element is firmly soldered** on to the motherboard.
so while 4+16GB is not perfect, it is better than being RAM limited
make sure you're running into memory limits when compiling if memory is what you think is the problem
I really doubt that dropping half your cores for more ram is gonna be faster
I switched from using 4 cores (really threads) to using 1 core (really thread) and on some large project to build in one hour instead of not being able to build in 12+ hours.
oh much, really thread
so i have created a little html site with a button which plays an audio when clicked. but, when i run the code via the html file rather than through VS Code, the audio doesnt play
can anyone tell me why?
nvm it started working
got a controller working in terminal ui, now to actually start making a game with it haha
tcell
i couldnt find any library that split a char into 2 pixels
i mean there was termloop but thats old
i think ppl recommended tcell over termbox based stuff
Cool
will buy for $70 when it releases
twin stick shooter?
possibly? top down
what would be the quickes way of filling a char array with chars first and then adding another special char every so often (like every 10 times or so). I thought of iterating it but there has to be a better, faster way, no?
What are you even doing? You can’t really do it without iterating, one way or another you will be iterating
You can however split a string into a char array
top secret idk i think i need to badoom it into existence
how do you even declare a string in c?, in c++ you do str but in c str doesent get recognised
isnt it just a char array?
It does depend on the language you use and where you’re getting the characters to fill the char array with
I have no idea about C or C++, but I also didn’t see you mention your language anywhere
i forgor
Probably, yeah
c is a very goofy language
interally string is just an abstraction on top of a char array
yeah i know but its weird nonetheless as c++ any most other languages have str prefix for such variables
its just that im not used to seeing a string that is defined as an array of chars (even though thats what it actually is in reality)
i know, i just said it just isnt something im used to looking at
can anyone tell me the most efficient way of adding a char every so often (every 10 lines) but in a way of pushing the right hand chars for 1 index to the right/ just squeezing a value in
as in 1 1 1 1 1 1 and then 1 1 1 . 1 1 1 so we squeezed a . there
for (int i{0}; i < array.size(); i++)
{
if (i%10 != 0)
{ array[i] = 'a'; }
else
{ array[i] = 'b'; }
}
yeah, especially when it doesn't even model the hardware properly anymore
why doesn't it model the hardware properly? I've heard people say this before but idk what they really mean by it
In the wake of the recent Meltdown and Spectre vulnerabilities, it
this is why
Anyone use Dreamweaver with FTP? Mine won't connect and I can't figure out why 😠
dreamweaver
Fundamentally, the operation must require iteration at some point if the number of bytes you need to write is larger than what the architecture can move into memory in one go. Even most memcpy implementations just do a while assignment loop https://stackoverflow.com/questions/19187562/understanding-the-implementation-of-memcpy
However, iterating over char sized elements can be wasteful when most architectures are capable of moving much more than a single byte at a time.
There are some complexities and caveats here about different languages and their object models etc. (especially in the case of C++, avoiding undefined behavior can be tricky). But the simplest terms: if the memory is sufficiently aligned and divisible by a larger unit, you can treat the underlying buffer as said larger unit, such as a 64 bit unsigned integer, and assign 8 bytes at a time instead of 1. The optimizer and processors are pretty smart and can do a lot of heavy lifting, but in some cases it can be illegal to perform certain optimizations depending on the code you write. If you can control the sizes involved, you can see some "significant"* improvements just by doing a simple hack like this. If you add further constraints, such as compiler specific behavior, or platform specific instructions; you can get even more performance by using some extensions and inline assembly.
Regardless; I'd probably fill it with junk first, then go back and insert your special values. In most cases, that will keep the operation predictable and cache hot. But really, what's optimal will change based on the length, access patterns, and locality.
- Which brings me to the fact that everything i mentioned here is a micro-optimization, and often premature optimization. I write code for time and resource constrained systems where that speed often matters, but it may not for you. The only way to know, and know which optimizations actually matter is to measure it.
development
what up #development, having an existential crisis, can someone tell me new things that are happening in software engineering
most recent things I can think of that are like long-term grand-scheme cool are containerization, blockchain was a cool concept, then it was like the internet or something before that, but im starting to feel like my code is going to replace me.
are holograms out yet
i think we have very different ideas of what constitutes a meaningful advancement in the grand scheme of things... for my money, large language models are probably the next big thing
not that i think most of the hype is justified... a lot of people don't understand the implications and what machine learning actually does
but there are some interesting use cases
By this definition x86_64 assembly doesn’t model the hardware either
it doesnt but not to the same extent
C still maps pretty closely to underlying assembly
In asm the memory model is still flat and instructions are still thought to be executed in sequence
can map to hardware is not the same as always maps to hardware... assembly is inconvenient cuz its closer to the latter than most languages
c++ is the language which is best at doing both hardware and humanfriendly abstraction, additionally it's 0 overhead in its abstractions, which makes it faster than assembly
What in the world was that GL function that allows you to batch a bunch of GL commands together into a single call?
Also compilers are better at optimizing unless you are up against the grayest beard in the world.
and even then, those beards would be better optimising the compiler 🙂
haha, I did this with SQL, because the DB we were using turned out to have a fixed network delay per call, so by making what was basically an anonymous stored (temporary) procedure, I reduced the turnaround time by an order of magnitude.
A lot of meaningful advancements happen over time built on much smaller ones. Also it is hard to say what is a meaningful advancement to one person vs another, since it kind of depends what your field is.
If your in the web space I’d deff keep an eye on wasm + Rust, I think that can unlock some very interesting things we can do on the browser. Especially with the work being done for wasi which should unlock some IO access for wasm.
We have already seen video games and entire video editors put in the web with wasm, the future could be very interesting if your browser can run many applications that had to be installed.
Ofc it doesn’t have to be Rust for wasm, but I enjoy Rust and it’s having really good community support in wasm right now. Who knows how it’ll shake out in 5 years or so though.
so im trying to use Mediapipe pose to run FBT in VR, it connects to Steam VR but im getting error 138 and a pose attribute error, idk what to do from here... it runs on python IIRC. Ik the TCP is a communication error but i have no idea how to solve it
Does anyone know of Somewhere you can find examples of using win32 IDesktopWallpaper in C++?
Couldn't find examples by searching for both the import of the header and for IDesktopWallpaper.
Wanna test something with IDesktopWallpaper::AdvanceSlideshow function but having issues calling it (never programmed c++, have programmed in others)
Why do programs try to read from /dev/null? I see no reason as to why right now.
One common usecase (particularly in bash scripts etc) would be to redirect a program's stdin so that it would read /dev/null instead and immediate get EOF.
But, if you actually have a program which is explicitly trying to read from a hardcoded /dev/null, and it isn't just a default filepath value that could be replaced by something else... Uh... I can't imagine why.
So then why would an init program create three fds for /dev/null? Just because they are writing nowhere or maybe something else?
if writing (rather than reading); it's used to discard the output. I'd have to see what you're talking about to understand the usecase; they could be placeholders which could be swapped for something else later in the code, or it could be theyre used as redirects for other applications / libraries. Curious as to why there would be three though...
So, I looked at readlink /proc/1/fd/* and found 3 instances of /dev/null the flags are 0100002
I think I would have to SRE the binary to figure out what it is trying to do there.
Wait, 0, 1, 2 are stdin, stdout, and stderr.
That means no output and no input.
That makes sense now. If it doesn't have an input then there isn't an fd 0, which would display as /dev/null!
I threw together a small example for you. https://pastebin.com/szY2nMB0
When you run the program, it should advance the wallpaper forward (because the first parameter is NULL: if you have multiple monitors, it will advance whichever is next in line to change).
Since you're also new to C++, this may be a bit daunting, but I decided to make it more like what you'll see in modern C++ rather than most of the older C style win32 COM examples that you may find out there.
Working with OS code is always a bit weird, and the COM API is even less beginner friendly than that. AdvanceSlideshow is a method for an object but the only way to create that object is to first initialize COM on the executing thread and then call a function which talks to the service and returns a pointer to the object via an out parameter. When you're done, you need to clean up these resources by calling the Release method on the object and then 'uninitialize' COM. Because of this, my example has an emphasis on using object lifetimes to automate resource clean-up in a safe way (referred to as the 'RAII' principle https://en.cppreference.com/w/cpp/language/raii)
I didn't comment any of the fundamental language syntax, so if you're confused about anything please let me know.
forgot to responde here but ty, it worked.
I compiled it on visual studio btw. I managed to change it so I can set my own timer to advanceslideshow, using sleep. One thing this made me realize is that I will stay the hell away from c++ for the future. Already had a bad time with C and it seems to be worse, but that's also because I'm used to more object oriented languages that have garbage collector like java, kotlin, python
Glad to hear it helped :D
If you were to do this in C (sans error checking) it would look more like...```c
CoInitializeEx(COINIT_APARTMENTTHREADED, tag)
IDesktopWallpaper* our_new_resource;
CoCreateInstance(
CLSID_DesktopWallpaper,
NULL,
CLSCTX_LOCAL_SERVER,
IID_IDesktopWallpaper,
(void**)&our_new_resource);
AdvanceSlideshow(our_new_resource, NULL, DSD_FORWARD);
// now cleanup
Release(our_new_resource);
CoUninitialize();```
but in C++, we can utilize object destructors to clean up our resources automatically when we leave scope. C++ can be a giant headache due to the complexities; but with abstraction we can write code that's both safer and more expressive.
const raii_com com; // com and wallpaper are both error-checked
const auto wallpaper{ desktop_wallpaper_factory(com) };
wallpaper->AdvanceSlideshow(NULL, DSD_FORWARD);```
What's scaring you is all the noise of setting up those objects...
When you really get going with modern C++, like using the STL containers, ranges, and algorithms; you can start to really see where it can be more high level than C and more like what you're familiar with (no more writing linked lists by hand :P )
I don't 🙂
He dont
I am 15 years old and I am into development and coding for about 2 years, I want to learn backend, is there a roadmap or course you can recommend?
anyone who can help on varnish?
I am not 15 years old. maybe try building a project that uses a certain technology.
There is no real roadmap
I can animate now?! 👀, moving forward from spriting and concept art normally
https://media.discordapp.net/attachments/999955536713879592/1045341880742850620/Kirin_F_.gif
which one is better in taking notes/writing coding docs?
plain markdown or notion?
anyone know anything about resistors
Theory, yes, no practical experience
Also sorry if I left pings on 😅
Do you know the supply voltage in your country/state?
uh no
I think you can find that on Google, where do you live?
lemme read the datasheets hold on
For like whatever you’re making
Your peak current can be 1.5 x 1.414 so theoretically around 2.25 A
do you know a resistor that does that much?
And if your supply gives 120V then you will ideally need a resistance of 120/2.25 ohms
But however this can vary practically so it’s always best to seek a resistor of a slightly higher resistance
i mean it's literally never going into the wall
You’ll be using a battery?
it's gonna go into my phone so I can have a keyboard and mouse :))
That goes too far beyond my knowledge sorry!
well damn ;- ;
Because multiple sources leads to multiple complications like orientation, biasing on your circuit’s transistor etc.
well do you think it'll need a resistor it do you think it can handle itself
It will definitely need a resistor as a circuit with 0 ohms draws no current
i mean my phone can't give out that much power i know that
say that to this
The fans in your PC maybe have no resistance of their own, but the plugin to your power supply adds a resistance to complete the corcuit
corcuit
well what if I plug it into my uh phone via adapter
No idea what happens to voltages outside of direct wall power
damn
Your phone’s power delivery circuitry is probably quite more complex than a the simple AC or DC source in your wall
i'm going to have to learn about resistors and capacitators now
Well AC wall sources are never DC
i usually just have 2 parts and wires running through them
Fan powered by phone
Can't show phone bc I had to take a picture
@thorny cypress
import random
while True:
print("Lets play a game...")
num1 = random.randint(1, 500)
num2 = random.randint(1, 500)
print("What is " + str(num1) + " + " + str(num2) + "?")
answer = input("Your Answer : ")
if answer == num1 + num2:
print("Correct! The answer is " + str(num1 + num2) + "!")
con = input("Do you wish to continue? (Yes or No) : ")
if con == "Yes":
print("Ok trying again!")
continue
elif con == "No":
print("Ok closing...")
quit()
else:
print("Wrong ! The correct answer is " + str(num1 + num2) + "!")
con = input("Do you wish to continue? (Yes or No) : ")
if con == "Yes":
print("Ok trying again!")
continue
elif con == "No":
print("Ok closing...")
quit()
``` What's the next challenge you have for me
finished the base of my rendering engine. completely vanilla c libraries. the text beneath says whether or not the point is seen and some coords and stuffs. tomorrow ill add some other stuff but in the end i hope itll become a full 3d game. the perspective is lagging alot, unfortunately my laptops bad but its a start nonetheless
will add optimisations later, as of now its ~90 lines with comments and spaces
here is my complete game written fully in python
yo cool
gotta start somewhere bro
i mean, how many people can code and have made their own game
how many lines do u think this is
i have no idea, but i would assume probably around 14?
in python?
ah yeah
@thorny cypress
delete
from emp
where sal in (select sal from ( Select sal from emp e where sal < (select avg(sal) from emp where e.ndep = ndep group by ndep))x)
[21:28]
my solution to a query that i have to delete every employee that receives less than their department average
[21:28]
it works
[21:28]
but i have to disable foreing keys
[21:28]
or delete them from the database
[21:28]
and i dont know if i can do this because my teacher never talked about foreing keys
Look into learning how to define functions, learn to manipulate lists, then look into how to read and write files. From there things open up. I’m not a professor or anything, so I can’t tell you what’ll teach you the best.
You should really make sure you understand the concepts before you move on, though. You’ll have a rough time loading image recognition libraries if you’re still having to grapple with syntax.
And finally, perhaps most importantly, learn to look stuff up. The big secret among programmers as to how we remember so many different instructions is that we don’t, we understand the concepts and how to implement things and google the specific syntax. Understanding the logic is a lot more important than memorizing the exact intricacies of the map() function.
If you want a specific exercise, easy-ish one that you can do with just while loops is a number guessing game where you guess a number and it’ll tell you if it’s higher or lower until you get it right. Then, learn lists, and see if you can’t make hangman or tic tac toe. Don’t worry about dealing with graphics, again, low level stuff is a lot more important.
👍
Hey can someone help me with the following issue?
i wrote a little something in VSCode for PowerShell
in VSC it worked fine in the "Run" function
but when i export it as a .ps1 file it didnt work properly
https://cdn.discordapp.com/attachments/836273631888932905/1046420405914705949/image.png
https://cdn.discordapp.com/attachments/836273631888932905/1046421146704293909/image.png
and if i run the .ps1 with Administrator PowerShell
https://cdn.discordapp.com/attachments/836273631888932905/1046421529803620412/image.png
then jsut use VSC
in this one you have an extra . at the beginning of the filename
sometimes you can just tell who was a hawk in a past life
are you still up
bc I gotta question
Smooth
Is anyone familiar with .m3g files? Old 3d model file developed for nokia for mobile games. Trying to convert it into a different format so other programs can open it. Found no success trying it myself.
import random
import tkinter.messagebox
from tkinter import *
window = Tk()
window.geometry('400x200')
window.configure(bg="black")
startMsg = Label(text="PyGame", font=('Times', 40), bg="black", fg="white")
startMsg.pack()
def gameWindow():
game = Tk()
game.title("PyGame")
game.geometry('400x200')
game.configure(background="black")
num1 = random.randint(1, 50000)
num2 = random.randint(1, 50000)
sum_num = num1 + num2
startMSg = Label(text="Lets play a game...", font=('Times', 40), bg="black", fg="white")
question = Label(text="What's " + str(num1) + " + " + str(num2) + " ?", font=('Times', 30), bg="black", fg="white")
answer = Entry(width=50, bg="black", fg="white", font=('Times', 20))
def onclicksubmit():
if not answer.get().isdigit():
tkinter.messagebox.showinfo(title="Error!", message="You can only use numbers!")
else:
if int(answer.get()) == int(sum_num):
tkinter.messagebox.showinfo(title="Correct!", message=f"The answer was {sum_num} !")
yesOrNo = tkinter.messagebox.askyesno(title="Continue?", message="Do you wish to play the game again?")
if yesOrNo:
gameWindow()
game.quit()
else:
tkinter.messagebox.showinfo(title="Wrong!", message=f"The correct answer is {sum_num}!")
yesOrNo = tkinter.messagebox.askyesno(title="Continue?", message="Do you wish to play the game again?")
if yesOrNo:
gameWindow()
game.quit()
submit = Button(text="Submit Answer", background="gray", fg="white", font=('Times', 15), command=onclicksubmit)
startMSg.pack()
question.pack()
answer.pack()
submit.pack()
game.mainloop()
def startgame():
window.destroy()
gameWindow()
button = Button(window, text="Start!", activebackground="lightblue", bg="grey", command=startgame, fg="white",
font=('Times', 20))
button.pack()
window.mainloop()
so I have this code and for the most part it works fine
but when yesOrNo is true it creates itself inside an existing window and opens a blank one up
No clue sorry
basically this is what it does
are you creating a new tk when you call stuff? i thought you pass around the result of Tk() to functions
wdym by that
like, a window is created by calling Tk(), so arent you creating a new tk window every time Tk() is called? which is whenever you enter the true part of the yesorno
seems like u are trying to make a game in tkinter.
For simple game dev in python i would just recommend pygame since its extremely easy and all the window management is pretty much already taken care of.
Tkinter isnt known as the best for application dev, especially game dev
game loops and everything in pygame would make ur code so much easier and readable
if you dont want to use pygame, there is also PyQt (probably the best for applications in my opinion)
it's not really a game
it's just this but with gui
import random
while True:
print("Lets play a game...")
num1 = random.randint(1, 500)
num2 = random.randint(1, 500)
print("What is " + str(num1) + " + " + str(num2) + "?")
answer = input("Your Answer : ")
if answer == num1 + num2:
print("Correct! The answer is " + str(num1 + num2) + "!")
con = input("Do you wish to continue? (Yes or No) : ")
if con == "Yes":
print("Ok trying again!")
continue
elif con == "No":
print("Ok closing...")
quit()
else:
print("Wrong ! The correct answer is " + str(num1 + num2) + "!")
con = input("Do you wish to continue? (Yes or No) : ")
if con == "Yes":
print("Ok trying again!")
continue
elif con == "No":
print("Ok closing...")
quit()```
I'm not too sure what's going on with your screenshot, because when I run your code i get multiple root windows rather than it duplicating like that. But anyways, you're not calling game.destroy() when you call gameWindow(). I'd recommend putting it above the if yesOrNos, since the window gets destroyed either way.
As a side note: that variable name is a bit odd. I'd probably use something like playAgain. You can also restructure that if answer == num1 + num2 to eliminate the duplicated code because the behavior and logic is identical for both branches; only the strings change. Also, Ideally, you would redesign this with a more object-oriented style to more easily do all of this within the same root window (only calling Tk once); but how you currently have it is fine for simple stuff & learning purposes.
Since you're in a while loop anyway, try using break instead of quit. That way it just exits the loop and closes normally. quit() can be weird when run in certain environments. Shouldn't matter here but not a great habit to get into.
any idea how I could decode a json file like this?
I want to get subtrees of each node
in what language
Yes, you can decode JSON in a lot of languages but I was wondering if they had one they preferred to use
anyway, @lilac pebble something like this in Python, probably:
import json
class Node:
def __init__(self, nodeId: int, subs: list = None, isRoot = False) -> None:
self.id = nodeId
self.subs = subs
self.isRoot = isRoot
def GenerateSubs(subNodes: list):
newNodes = []
for node in subNodes:
newNode = Node(
nodeId = node["nodeId"],
isRoot = node["root"] if node.get("root") is not None else False
)
if node.get("subs") is not None:
newNode.subs = GenerateSubs(node["subs"])
newNodes.append(newNode)
return newNodes
def IterateSubs(node: Node) -> list:
nodeIds = []
for subNode in node.subs:
if subNode.subs is not None:
for x in IterateSubs(subNode):
nodeIds.append(x)
nodeIds.append(subNode.id)
return nodeIds
if __name__ == "__main__":
with open("test.json", "r") as jsonData:
nodeData = json.loads(jsonData.read())
node = Node(
nodeId = nodeData["nodeId"],
subs = GenerateSubs(nodeData["subs"]),
isRoot = nodeData["root"] if nodeData.get("root") is not None else False
)
print(IterateSubs(node))
also in the gui while I had to work around not using a loop since it would just open itself if I closed it
Arduino
I can get by name, but I don't understand getting by subsection
Thanks will try to convert it into Arduino
yeah C/C++, but I'm using the ArduinoJson library
You can probably just find a lightweight json Libra
You should have included that in your original message, no one knows what you mean
true mbmb
i'm just happy to participate in things so I probably wouldve shared my python version of the solution regardless of whether c/c++ was specified
gives me a good opportunity to possibly get criticisms n stuff
Do you even need a loop
Hi, I am doing application in java and I want to build like "chessboard" not generated but every block of it need to have address like in excel "A15, B5 ....", and in each of them I put image or button and others..... For example program called "Railroad & TrainController" has this feature.
I am using swing and awt for beginning. If I need to use javaFX I can use it. But I am not sure how to do it (the feature what I need), if there is existing library.
yes
Recursion counting game :)
import random
while True:
number = random.randint(0, 10)
print("Can you guess the number?")
answer = input("Guess : ")
if answer.isdigit():
if int(answer) < number:
print("Sorry! But " + str(answer) + " is to low.")
elif int(answer) > number:
print("Sorry! But " + str(answer) + " is to high.")
elif int(answer) == number:
print("Correct! " + str(answer) + " was the answer!")
else:
print("The guess needs to be a number!")
continue
so I have the base code but how do I stop it from generating a new number if you get it wrong?
move the number = random.randint(0, 10) out of the while loop
if I restart the loop will there be a new number
no
have you learned functions yet?
in this one if you go into generateNumber() and put return number at the bottom, then above the while True put number = generateNumber() it'd work, but my advice without giving you the entire solution is... you can have 2 while loops, for example... while guess != num:
please just make a plan first. Say "ok firstly i need to make the window, then x function needs to start, after that y function etc." and build the game on that. when you are going to be making bigger projects, that blueprint will help you a lot
i just think and ask and then things work out
it not a good practice tho
i just code for fun ;- ;
I don't plan on making it my career
in neither case its a good practice
@lilac pebble Try https://arduinojson.org/ or https://github.com/nlohmann/json
It's not just about being a better programmer or planning for a career. It's basic problem solving and design. Those same thought processes can be applied to many areas of life, just like logical and critical thinking. Ultimately, by practicing this, you'll be saving yourself (and potentially others) a lot of time and headaches. To draw an analogy: just because you're playing a videogame "only for fun" doesn't mean you're limited to button-mashing; strategize and think things thru. You'll probably end up having even more fun.
super high-level / abstract pseudocode may be a useful tool here.
no
programming is only fun when u know what u doing, i agree 100%
No
or at least, learning to know what you're doing.
Yea
realest of the realest replies
nah its best when you dont know what youre doing but the program still manages to execute correctly
im trying to look at things i can do with my time to make money, where could i start with web development? Im wary of just googling this because im sure im just gonna get bombarded with ads about the best platform and then just lose interest
I'm not a webdev but w3schools is a very popular choice and has many good free resources
@copper ravine do u think this'll work
work for what?
uh led usb
I don't think that's going to work. Do you know what the pinout of the USB connector is?
yep
VCC and ground are the "outer" of the 4 pins
ik
you should not have any connections on pin 2-3
uh for some reason the led has pins for d+ and d-
yeah
ok, I2C
uh what
those are not at all the same signals as USB D+/D-
can you link the data sheet for the leds?
D+/D- are not data in and out.. they are a differential data pair (so USB)
so am I gonna need like a physical button or smth
way more than that
those leds are controlled via an I2C bus, so a completely different connection from USB
oh great things are now getting complcated
more so than you probably think tbh
alr can I get an I2C bus
you'd need to maybe put a microcontroller on the board that has USB support and maybe write some firmware to control the LEDs (I think it's a shift register or something actually)
https://lcsc.com/product-detail/Light-Emitting-Diodes-LED_XINGLIGHT-XL-2835UBC-02_C2843871.html do u think this'll work without any resistors or other things
XL-2835UBC-02 XINGLIGHT US$0.0129 - 60mA 462.5nm Colorless transparence -40℃~+85℃ 457.5nm~462.5nm Positive post blue 120° 60mW 2835(mm) Light Emitting Diodes (LED) ROHS datasheet, price, inventory C2843871
no, you will always need at least a resistor with a basic LED
Note those are maximums for the LED; you should look a bit further into the datasheet and you should find the "normal" current value
hey does anyone know any good gui libraries for python?
i tried customtkinter but it's eh
It's frustrating as hell, frankly. It's one thing to know the syntax of any specific language. It's quite another to express what it is you're trying to do in a "best practice" approach. Given multitude of ways to accomplish the same task/goal within the same language, more often than not it's poorly thought-out and constructed.
I respect people that code for a living, but knowing what I've seen in IT over the last 20+ years, hell no, programming isn't for me. I'll stick with basic scripting 🙂
ngl, i often have this brigdes at work, like iknow my solution works and is a good practice but the enterprise practice is XYZ and makes the code way harder to understand. I code for a living but "code" is a big word, i code like 20% of the time and 30% is testing 30% configurations/deploying and 20% is waiting for reviews. as a middle java dev
I was re-working some code that was written inefficiently and somehow the more efficient code runs at nearly the same performance. The limiting factor is still the read speeds of the database (SQLite).
🥹
it reminds me of when I tried to save memory by pulling from the database as it is needed, but when I checked I found it doesn't use any less memory. Thank you caching + overhead of an interpreted language.
i wonder, do you think luke or at least one of the floatplane devs do advent of code
why
because it's fun (and I would like to see what their code's like)
@copper ravine so I'm wondering if you know how to just connect things to gnd
in easyeda
so im creating a function that should run again and again until the condition in while is fulfilled, but it keeps printing a statement infinitely when the condition is the same as while condition
int Am;
Boolean withdraw = false;
System.out.println("Enter the amount to withdraw: ");
Scanner Withdraw = new Scanner(System.in);
Am = Withdraw.nextInt();
do {
if (Amount >= Am) {
Amount = Amount - Am;
System.out.println("'Rs" + Am + "' Has Been Withdrawn!");
withdraw = true;
System.out.println("Remaining Balance is: 'Rs" + Amount + "'");
} else {
System.out.println("Insufficient Amount... Please Try Requesting Less Amount.");
}
}
while (!withdraw);
}```
heres the code
i just realized i started the do while loop after the input code, so thats why the code was running in an infinite loop after being false
Yup
i swear, i always try to fix a code for like 20-30 mins and wont understand the problem
ask for help and i'd notice the mistake within 5 mins
In software engineering, rubber duck debugging (or rubberducking) is a method of debugging code by articulating a problem in spoken or written natural language. The name is a reference to a story in the book The Pragmatic Programmer in which a programmer would carry around a rubber duck and debug their code by forcing themselves to explain it, l...
I haven’t used easyeda before
Hi Guys, I wrote a simple excel vba for the user to retrieve some data from SQL database. Me and my team can run it successfully and get the data. However, the user got an error, anyone know what cause the error? (the user is using the same exact excel version with my team--Office 365) (The highlighted row is the error row)
MS SQL?
yes
yes
can't connect to the server
probably needs ODBC setup
at first, I thought so too. However, some other excel works (with the same connection to the database, only retrieve other info)
Also, I tried with other method to open the connection and it stuck when it's trying to open the recordset
look, honestly VB and ODBC is super fragile and I hate it with the power of a thousand suns
ok so if I attempt to make a scematic
and use the gnd thing will and convert it will it still be connected to ground?
wdym
in a schematic just show the ground symbol
the actual circuit layout will be different
So in a schematic, all alike symbols (like ground) are logically connected and when you export that schematic to the pcb layout software, it will automatically connect them together for you.
- Don't assume VDD18, VDD33 and VDD5 are connected internally to the chip
- The crystal might need loading capacitors; refer to its data sheet
- You haven't yet, but don't connect the USB shields directly to ground (use a small value cap, maybe 0.1uF. Do directly connect all the USB shields together.
Pretty decent for a first shot though
I am quite literally following the datasheet
It gives an example schematic
What's the part number for the crystal you used?
Oh u mean the crystal things might need its own
yes
Yeah, you need to follow the clock circuit exactly:
Uh what
I'm not using the ti controller anymore
oh
SL2.1 A is the controller I'm using
hmm, I can only find a rather basic and useless datasheet for it
I mean there's like 16 pins and 3/4 of them are for the usbs
Also do I just hook those up like this into my schematic?
yup, if that's the reference circuit, follow that
Alr
Also thing is I don't have "hand" on my usbs
HAND -> USB shield I'm pretty sure
...
HAND == EH
Alr
Still gotta connect vdd
That looks reasonable
I'm almost done I just need to hook up the main USB
I have no idea how to design stuff so do you have any tips
This is what I have rn
You want to put capacitors close to the component they are filtering for starters.
Uh done
uhm, the upstream port is the wrong type
It can't be USB a?
nope
Are you sure
Because in the scenatic it shows something that looks like a USB a male
I mean, yes. The spec says so. To plug that device into another device with a cable (which you are required to use to connect two devices) you would need a USB extension, which is not strictly allowed.
Schematic*
You can't use the visual symbol in the schematic to infer the component. The component type should be indicated with a part number or name explicitly.
So it has to be a cable?
yes
And if it isn't a cable
use a usb-b connector
But I need a male connector?
Also I have literally nothing that has a USB b port
Why do you need a male connector?
Uh to plug it into things?
Ok, you're going to have a hard time if you don't understand how the USB spec works. Good luck.
I rrl don't understand this at all
Why would I switch the male port with this female one
wait do u mean uh I get a type a to type b cable then plug it in?
we making a usb hub or smth
not we I am making a usb hub
Where is vcc coming from on the left?
And the vcc on the right is also connected to vcc voltage?
and now you've lost me
in the example schematic it shows this
but I have no idea how to get vcc voltage
You would have a power supply circuit
but I don't
You need to add one
The USB B's vcc is connected to the vcc/vbus along with the vcc/vbus on the other side right? Or are you doing voltage stuff to make it a clean signal?
Or are you just getting it from the input usb
ig the usb
Schematics often don't show the whole circuit just sections
How will the USB devices connected to the USB get USB power? As of the last full schematic you are missing a vcc on the left.
Joe Barnard has a good video on circuit and pcb design
You often have one pcb layerr be ground and another be vcc
And it's just connected via vias
uh 4
You don't worry about layers when making schematics
... I have a full pcb
ok and?
ok so you are already making the routing already
I've already finished the schematic I'm just making sure that I have everything correct
no uh everything is finished
I just wanna know if it will work as intended
but you said you don't know where to get VCC before?
he was asking me about vcc voltage
but I think I'll skip a power supply and let the usb do all the work
From this image, what supplied the voltage on the left? It doesn't appear to be the host port on the right. It doesn't look like USB ports on the left are powered by the hub chip since only the data lines are connected.
so should I have a layer gnd and 1 layer vcc
What am I missing?
uh bottom layer is vcc
What is powering the bottom layer then?
idk stuff ig
this is the example schematic so I'm assuming that it knows everything
The vbus on the USB to computer and USB out do not appear to be connected. Are they connected?
yep
i am 99% sure that i'm done
Could you show this again with zoomed in on the USB type b. It appears as through it might not be connected to the vbus layer.
somewhere here idk
no this is easyeda
you designed it you should know
i design alot of bs
like this bs
or this bs
also uh I think the ports get it's power from the capacitators when they hook up to gnd and vcc
The Close up of the USB B looks like vbus should be connected since they both have the same net ID, but it doesn't look connected.
where tf do you see the net ids
Capacitors hold charge and do not provide power. Basically if you had a big enough capacitor on the vbus and gnd then you could handle a sudden power draw of a power flicker on voltage in.
If you look at the image it says u1_11 on the vbus and USB vbus, but they are not connected.
it says there's only one thing that has ul_11
uh @copper ravine can you shed some light on this
That probably just means you could order it and it follows your schematic.
I only count 16 nets if the two vbus are connected.
I might just be missing something.
Post pictures of the schematic and both pcb layers
Make the pcb layers separate to make it easy to follow please
Uh how
just take screen shots of them or something
so am I all set
or is there something i'm missing
In your schematic, you need to add the "VCC" symbol to the upstream USB VCC pin/wire in your schematic. Right now, the VCC of the downstream ports is not connected to the upstream port
so no power to anything you plug into the hub
like this
yup
so now i'm done
i got a working usb hub
i can't even imagine tryna do this without that helpful schematic
Well, assuming you got the reference design from the datasheet correct, yeah, it might work
Same problem as I was noticing.
https://www.ti.com/general/docs/suppproductinfo.tsp?distId=26&gotoUrl=https://www.ti.com/lit/gpn/tusb2046b
Page 16 is a more larger reference design for a USB hub. It is a significantly more complicated design.
Interestingly enough there isn't an EEPROM on your design.
a what
also this is like a 30 cent chip
An EEPOROM is a little memory chip. The USB chips I seen use it to configure the VID and PID which are identifiers of the vendor and product. Windows uses it to download the correct firmware for the device.
I don't think he is using a TUSB2046 anymore. It is some rando chip from china iirc
wdym "think"
i don't think ti has any usb chips with only 16 pins
Yes. That link is me just trying to find a reference design for USB to compare against since I don't know what chip that is.
i mean it has decent reviews
and I just wanna make smth that isn't so complicated but does something useful
https://www.ti.com/product/MSP430G2210#pps
An 8 pin microcontroller.
From TI
is it for usbs
Oops didn't read the USB part.
Why no green?
red or purple are awesome
purple it is
I have been working on a keypad. I have a working set of software and are trying to build a printed circuit board. Where does a surface mount LED go on a cherry switch?
i have no idea what u mean but maybe somewher on the cherry switch
On the layout where does it go.
Got bored and made a very basic fork bomb in rust, my laptop is quite upset with me
like literally instantly it just couldn't even open task manager
you should just use a footprint that has everything
I have an idea...
I have an idea, I'd love to have you guys and girls look at.
With the release of the new streamdeck+ with its knobs, I would like to look into making a small panel of knobs like the bottom of the streamdeck+, but with my own interface if possible. I have multiple years of development experience so writing custom software for this will be possible, I'm just curious if there are any resources you could recommend me for creating projects like this
.global _start
_start:
/* write */
ADDI a7, zero, 64
ADDI a0, zero, 1
la a1, msg
la a2, len
ecall
bne a0, a2, exit_error
start_loop:
/* write */
ADDI a7, zero, 64
ADDI a0, zero, 1
la a1, guess
la a2, guess_len
ecall
bne a0, a2, exit_error
/* write */
ADDI a7, zero, 64
ADDI a0, zero, 1
la a1, yes
la a2, yes_len
ecall
bne a0, a2, exit_error
/* exit */
ADDI a0, zero, 0
ADDI a7, zero, 93
ecall
exit_error:
/* exit */
ADDI a0, zero, 1
ADDI a7, zero, 93
ecall
.data
msg:
.ascii "Hello World!\n"
len = . - msg
.ascii "\0"
guess:
.ascii "Guess the number.\n"
guess_len = . - guess
.ascii "\0"
yes:
.ascii "yes"
yes_len = . - yes
.ascii "\0"
I am trying to get it to print all three strings one at a time and for some reason it only prints the first string. The error is because the second and probably the third write statement are flawed and the address to the string is not loaded. What is different making the second string not run?
100ec: 00001597 auipc a1,0x1
100f0: 06c58593 addi a1,a1,108 # 11158 <__DATA_BEGIN__>
VS
1010c: 80e18593 addi a1,gp,-2034 # 11166 <guess>
I think i figured it out...
I want to understand the explanation before I try to explain it to all who are interested.
The problem was that the data labels were not aligned properly. When the program compiled the code it had one string starting right after the last. This isn't desired because the linker or assembler cannot figure out how to align the data itself nor can it figure out how to set the pointer register the correct way.
I was trying to find a problem to an issue I have been having and I used the site luke brought up. the open AI, and the chat gave me very legit sounding answers, but they were wrong
very confidentially incorrect. So be careful using it as a source of truth
thats what makes it realistic
I continued the WAN show and Luke hit on the nose
QMK
Thanks!
not too hard to design a little PCB to handle multiple rotary encoders
anyone into VR development or perhaps ML/AI/generative art who has hardware opinions relating to building a PC?
Opinion: it must have a processor
you'll probably want Cuda, 32gb memory minimum, good workstation processor
idk how big your data sets are but maybe you're the target audience for a used RTX 3090 since it has a somewhat good VRAM size to money ratio
Buzzword salad
anyone into Virtual Reality, Web 3.0, Machine Learning, Computer Vision, Artificial Intelligence, Decentralized Computing, Kubernetes, Tensors, CI/CD, SaaS, Autonomous Vehicles, Fast Paced Exciting Work Environment, or Binary Search Trees?
or Self-Starter
ci/cd is p cool tho
all buzzwords are cool, at least to employers
Artificial Intelligence and BST here 💀
I made a number guessing game in assembly. It turns out, you still are not allowed to write to address 0x00 when running under application mode (user space). I can share the code if anyone is interested.
Why would you try writing to address 0 anyways?
It was unintentional.
npe
I looked into what it was doing in the assembly and found that I was attempting to store the program counter in the third register I gave it then loads data at a relative offset. That third register I set to x0 or zero. This is a dedicated register that always returns zero.
anyone working on interestring stuff in their free time
ive been growing a garlic but its winter so I think its not doing too well
Didn't mean anything like that but thats kinda neat
nice
Programming in assembly, wanting to build a keyboard (text entry device).
what would yall do with a tomu if you had one
i wanna get one but i wouldnt know what to do with it
What is that
its an ARM microcontroller computer thing that fits in a usb
hm
hm
whats teh point tho
so is my computer tho 👺
i would have it calculate heads or tails
@copper ravine where do I find a usb that looks like this
most of them are like this
also when I look at this I have no idea what that symbol in the bottom right is
it's a gnd
chassis ground specifically, likely representing the board itself here
Yea but since it is connected to what I am guessing is usb, that is likely the usb shield
do u know how I can place it
bc I don't see how
should be with all the other power symbols
yeah but it's apparently not for me
it can just be a second ground net
You don't really need to assign a symbol to it, as long as it is wired correctly
alr now new question
lets say I have two controller chips
how would I hook them up to 1 usb upstream port
Hook one's upstream to one of the other's downstream
um like this
I guess... what does the datasheet say? That sounds like something that would be in the datahsheet
also if you ask I'm using 2 two port chips because the 4 port chip isn't available for me
this is only for the upstream port 😢 and it's still not done
That might be a USB type c... Or USB type b rev 3.0.
There is a USB type "a" standard for 3.0
no it might not
idk about you but I read and at the bottom it clearly says
Those two schematic symbols are the same; the pin names are slightly different that is all
i also realized that it doesn't uh create those dots when you mix up the cables
That is because they are not connected
You can place dots manually and they will be if you need that (not in this case)
no uh some connections have a dot
i'll do this and then there will be the dots
Yes; if you drag a wire end and stop on another wire, it will usually connect them (make a dot)
also uh a 1000pf capacitator equals 0.001uf right?
;- ;
Wait no; 1000pf is 1nf, so 0.001uf yeah
alr thx
alr so how does this look
You need to have the tx pins of the upstream routed to the rx pins on the downstream and vice versa. You also need those capacitors on all tx/rx lines between the two controllers
But that looks good for the moment
You will also need to route the tx/rx/d pairs so they are impedance matched to 90ohm. The data sheet also says to ensure the pairs have at least 5 times the trace width between pairs
I decided not to use two controllers