#development
1 messages ยท Page 58 of 1
I kinda had an argument with him since he got angry at me after I asked him if he'd ever seen a woman
why would he even message me this tho
it just confused me
what the question was trying to achieve
lol reply to him yeah Im cool asf
lol
anyone that knows why he would leave
maybe he got too overwhelmed by my apology
i cant answer it to him
it wont let me
but the real answer is no
i dont think anyone who's ever spoken in this channel can answer yes
Hello, im organizing small game jam event, if anyone would be intrested , dm me ๐
I have been strugling trying to understand this for way too long so if anyone could help me out that would be much apreciated. I am trying to understand how kruskals maze genorator works from this article http://weblog.jamisbuck.org/2011/1/3/maze-generation-kruskal-s-algorithm, and I get the algorithum part but when talking about implementation he says,
Implementing Kruskalโs algorithm is straightforward, but for best results you need to find a very efficient way to join sets. If you do it like I illustrated above, assigning a set identifier to each cell, youโll need to iterate on every merge, which will be expensive. Using trees to represent the sets is much faster, allowing you to merge sets efficiently simply by adding one tree as a subtree of the other. Testing whether two cells share a set is done by comparing the roots of their corresponding trees.
This makes no sense to me because adding a subtree still only changes one cell, and it dosn't change the root node either witch is what is used for comparisons. So not only would the merged sets not be recognized as the same set, but you would still need to check every cell to see if the tree needed to be modified. What am I missing?
how exactly do I get started with doing front-end development on a site? I explained a bit more what I mean in #off-topic yesterday but I can explain it again here
I and a few others run a big modding community and have someone who has a mod list site for us to list mods there. They have to follow copyright law to be allowed in the sub which this site follows but a splinter site with a better layout doesn't do so and wants to be the main site.
A few are critiquing how the site is shown as like a 90s page so I want to try and learn it to help said good site to appear better than the splinter.
@hazy bobcat learn some css, find a good framework
ask ppl for critique on ur designs, make a nice user esperience
@hazy bobcat https://getbootstrap.com/
Hello friends!
If have an array if (a, b, c, d) is it possible to make it in js so it creates every possible combination in like order? Like (a, aa, aaa, b, ba, baa, bb, bba, baby, etc..) ? How would I do such thing or where should I start
sounds like a homework lel
(a, b, c, d)
How do you create "baby"

I think I know a different permutation
@fervent thicket Sounds like a recursion tree
ah cool! I'll check it out :D
I'm messing around with character designs for my game, does this look nice?
ah yes the blender monkey
nice
@umbral saffron you are using venv, did you add the dependency?
Yeah, you have to add it as a dependency of your project
otherwise you cant import it
what does that mean
oof uhm
your project depends on tkinter
so you need to download the code for tkinter
python can do this for you
actually its "Interpreter Settings"
@umbral saffron no, you need to add tkinter to your project first
before you can import it
@umbral saffron its a library with code that your program uses
I actually use pip for managing dependencies, not sure how this translates to venv
@spring pond ?
its the same thing
sometimes i use venvs, sometimes i use my system install for projects
the interface in pycharm is the same
yeah but how do you tie it into his pycharm instance
from what the screenshots have it looks like he already has an interpreter configured
he just needs to add the packages
@umbral saffron close that window
ok
send a screenshot
click on the plus
yea
sudo apt-get install python3.8 python3-tk is what is suggested
but he's on windows
you shouldn't need it b/c its in std lib
wait so what am i doing
you shouldnt need to do anything
just tested, it works on 3.9 w/o any install
3.8 shouldnt be any different
@spring pond actually
if you look at his first screenshot
@umbral saffron its already working.
the import is grey because it is not used in code
you have no code
imports are grey if unused, and your source file is empty
once you reference tkinter, it will become regular colored, like above^
nah u good
i learned
stupid of me to not notice earlier
xD
if the import didnt exist, it'd be red
@spring pond I only really use python if the shell doesnt cut it for me
its the easiest way to whack together some code
yeah definitely
i use intelliJ but i just played around with it once
@umbral saffron you dont need an IDE for python programming
You could use a regular text editor
the intellij family is really nice but it can take a bit to get around
yeah its definitely my favorite set if ides
@spring pond I actually used netbeans before
it was the only IDE at the time that had full maven integration
but IDEA is now maven based too
i considered using netbeans when i was using eclipse a long time ago but i ended up with idea
@spring pond tbf
netbeans sucks ass
It just, cannot compare to this
JavaEE, Language Injection
i see you have ultimate
Yep
ive never tried it but ive heard its good
Its same as community
it looks like it has a lot more
but you can install other languages as packages
oh thats interesting
well considering pretty much every other ide that jetbrains has is forked off of this im not surprised
Do you use dependency injection?
IDEA puts little breadcrumbs on the left
for injection points
ill be honest i don't really know what that is, i dont use java too often anymore
@spring pond declare interfaces, and any constructors that need instances, use interfaces only
instead of using a factory, you use a dependency injection framework
to bind interfaces to classes
but you can do this runtime
oh avoiding factories sounds like a godsend
It also allows you to mark a type as @Singleton
and it will make 1 instance, and remember it
Very useful for unittesting
static singletons are a cancer
lol
@spring pond https://i.imgur.com/2fdzKqv.png
So I have my DAO interfaces for the database
and the database properties are just passed to the constructor of the module
cool
@spring pond idk if you ever made rest services
im working on one right now lol
but the instance that handles the request, is usually created by the webserver
granted its in python
how do you pass parameters to the constructor?
im using django with django-rest-framework
so im not sure if that applies
im using method-based views with some special annotations
yup
if you build applications in java, you'll want to avoid that kind of stuff
well the objects is managed by django, i just made the database model
@spring pond with DI, all you do is
@Inject
public PlayerWebService(HighscoreService highscoreService, SpellService spellService,
LivePlayerDao livePlayerDao, FamilyService familyService, DaoProvider provider) {
this.highscoreService = highscoreService;
this.spellService = spellService;
this.livePlayerDao = livePlayerDao;
this.familyService = familyService;
this.provider = provider;
}
you add an @Inject
and if the DI framework wants an instance of PlayerService (the interface)
it looks at the bindings, and sees it creates a PlayerWebService
and the constructor has @Inject
so it looks for instances of each parameter
essentially, the DI framework constructs objects for you
so is it reading from the database or where is it creating these objects from
Yeah in this case, I have a DatabaseModule
ok
which binds those Dao interfaces to actual classes with code
makes sense
@spring pond essentially, 1 package has 1 module
the package defines public interfaces, that are described in the module
and all classes are package private, exposed through the module

i think im following the 1package/module for my set
@spring pond yeah but get this. what if you wanted support for "Two kinds" of databases
but ofc python doesnt really have access modifiers
but ofc python doesnt really have access modifiers
atleast we have double underscore
one module for each DB kind
atleast we have double underscore
yeah thats what i was refrencing
so runtime you can do something like if (db == SQL) { bind( new SqlModule())
exactly.
And it also makes wiring up your code lot easier
if you need a database reference
you just add the interface to your constructor
@spring pond https://github.com/google/guice
ill be keeping that for later
DI is a thing in almost every OO language
its very useful for applications that have many components
you can write your components as libraries and even share them between projects
you just have to add the module to your injector and you're good to go
In software engineering, inversion of control (IoC) is a programming principle. IoC inverts the flow of control as compared to traditional control flow. In IoC, custom-written portions of a computer program receive the flow of control from a generic framework. A software archi...
This is the principle it tries to fulfill
if you want to get philosophical xD
In object-oriented design, the dependency inversion principle is a specific form of decoupling software modules. When following this principle, the conventional dependency relationships established from high-level, policy-setting modules to low-level, dependency modules are re...
The goal of the dependency inversion pattern is to avoid this highly coupled distribution with the mediation of an abstract layer, and to increase the re-usability of higher/policy layers.
im not super experienced in programming for large applications so a lot of this is going over my head, but it looks interesting
Yeah, it allows you to do interface seperation
ok
Cross-package imports should only be on interfaces
When I design a new component
I usually start with an interface
define some methods I want this component to have
then I create an implementation of said interface
and add it to module to I can use it in my application
if you use an interface that isnt bound with a module
you will get an exception
makes sense
injector = Guice.createInjector(new DatabaseModule)
injector.getInstance(MyInterface.class)
im not super experienced in programming for large applications so a lot of this is going over my head, but it looks interesting
@spring pond lots of big big projects also use Spring for DI
mmmm spring
hmmm, depends what you're doing
lots of nice things in Spring Boot to make your life easier
Annotations are also nicer
yeah but is it that spring boot does for ya lol
wat
Like, what is it that spring boot does that you cannot do normally
Write OAuth implementations? ๐
mh
I wrote my own OAuth handler as a servlet filter
its like 30 lines of code
@shy helm I did that
after the existing spring solution was giving me headaches
exceptions in spring internals
and no clear documentation on what to do
Like, you built a standard following OAuth handler in 30 lines?
It's not that complicated if you do it wrong...
is your system intercompatible with actual OAuth?
or are you just calling it OAuth?
What kind of auth flows did you support?
xD
Yeah, I had to do that for Kerberos auth
If you can't fall into the default types of auth spring boot supports it can be a bit painful
No disagreement from me there ๐
But tons of apps will find spring already supports exactly what they want
need minimal amount of code to do it
yeah
I cobbled together my own glue code over the years
to do this as simple as possible
Even more complex stuff like handling Kafka is nice on Spring
StandaloneServer(WebserverProperties properties, Injector injector) {
URI baseUri = UriBuilder.fromUri("http://localhost/").port(properties.getPort()).build();
ResourceConfig config = new ServiceConfig(injector);
server = JettyHttpContainerFactory.createServer(baseUri, config);
}
void start() throws Exception {
server.start();
}
the ServiceConfig holds all the jax-rs servlet configuration
Only shitty thing, which makes me want to replace this
Jersey uses HK2 for DI
and I use Guice
netty is a TCP lib
jetty is a webserver
register(new ContainerLifecycleListener() {
@Override
public void onStartup(Container container) {
ServiceLocator serviceLocator = container.getApplicationHandler().getServiceLocator();
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(injector);
}
@Override
public void onReload(Container container) {
}
@Override
public void onShutdown(Container container) {
}
});
But if you're using Spring you can use either ๐
this way, I can just use jetty as a standalone servlet engine
@shy helm yeah thats what spring does for you
It provides that servlet context for you
but spring defines a lot of types that are already in the JavaEE standard
Just looking at these docs
I remember why I hate spring
@shy helm http://sparkjava.com/ :D
Spark Framework - Create web applications in Java rapidly. Spark is a micro web framework that lets you focus on writing your code, not boilerplate code.
one my favorite libs
I actually heard about Spark Java
Its a lot like expressJS
JK Express is not bad
Try building a webserver in Python and cry yourself to sleep
Apparently not a single web framework in Python was well thoughout
With session logins and userroles :D
they're all so convoluted and poorly designed
Our 2015 survey tells us that over 50% of Spark users use Spark to create REST APIs, while about 25% use Spark to create websites.
o.O did 25% of their users die
I am that 25%
@GET
@Path("minecraft")
@RequiresLogin
public ModelAndView getMinecraftServerStatus(Request request, Response response) {
Map<String, Object> models = new HashMap<>();
ServiceAPIClient client = session(request).getClient();
ServerInfo info = client.getServerInfo(request.queryParams("server"));
models.put("server", info);
models.put("page", "Server Information");
models.put("page_desc", info.getName());
return new ModelAndView(models, "status/minecraft");
}
@shy helm basically ^
like I said, I got bored
but this is as small a controller I could get
I think I used handlebars.js as template engine
Try building a webserver in Python and cry yourself to sleep
cries in django
@shy helm ok you are right, I did die at some point..
the routing provider is a fucking mess
private static TemplateViewRoute createCall(final Method method,
final Object provider,
final boolean login) {
return (request, response) -> {
try {
if (login && !session(request).login()) {
LoginHelper.login(request, response);
return null;
}
return (ModelAndView) method.invoke(provider, request, response);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new InternalServerErrorException(e);
}
};
}
I think some of my favourite Java code I've ever written, to this day, was some wrapper stuff over the Kafka library
@shy helm now for the terror
return providers.stream()
.filter(p -> !p.isInterface() && !p.isEnum())
.flatMap(p -> {
try {
Path classPath = p.getAnnotation(Path.class);
String path = classPath.value();
Object object = injector.getInstance(p);
Route route = new Route(object);
Arrays.stream(p.getDeclaredMethods())
.filter(m -> m.isAnnotationPresent(GET.class))
.forEach(m -> {
String mPath = "";
if (m.isAnnotationPresent(Path.class)) {
mPath = m.getAnnotation(Path.class).value();
}
m.setAccessible(true);
route.addRoute(
new Tuple<>(
RequestMethod.GET, combinePath(path, mPath)
),
createCall(m, object, m.isAnnotationPresent(RequiresLogin.class))
);
});
Reflection galore
sniffin annotations
We wanted to use protobuf for sterilization, so I had to write a bunch of generic code which allowed you to create and map classes, auto create serde classes, etc
Was very fun to build
@shy helm those are my favorite coding challenges
I've built my own module loader for this one gameserver
runtime reload code
private void loadModule(File moduleFile) throws Exception {
String moduleClassPath = null;
boolean reloadable = false;
try (JarFile jarFile = new JarFile(moduleFile)) {
try (URLClassLoader preLoader = new URLClassLoader(new URL[]{moduleFile.toURI().toURL()}, getClass().getClassLoader())) {
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
if (entry.isDirectory() || !entry.getName().endsWith(".class"))
continue;
Class<?> clazz = Class.forName(trimClassName(entry.getName()), true, preLoader);
if (isModule(clazz)) {
if (moduleClassPath != null) {
throw new Exception("Module has more than one compatible module class: " + moduleFile.getName());
}
moduleClassPath = entry.getName();
reloadable = clazz.getAnnotation(Module.class).reloadable();
}
}
}
}
Security experts can have a fieldday with this
It basically enumerates all .class files in the jar, loads them into a classloader and checks if the types are annotated with @Module
Whoever said classloaders should be immutable, better come fite me
lmao
@shy helm lol but.
very secure
the interface is sexy
class CoreModuleLoader extends ModuleLoader<KnockturnCore> {
CoreModuleLoader(KnockturnCore instance) {
super(new File(instance.getDataFolder(), "modules"), instance);
}
@Override
protected void handle(Loadable<KnockturnCore> module, Module meta) {
if (module instanceof CoreModule) {
((CoreModule) module).setVersion(meta.version());
}
printName(meta);
}
...
@shy helm its minecraft so w/e
@shy helm we have big lists of constants that may need to be updated on the fly

thats 350 entries
Omg use a config store
lot of our roleplay plugins uses this
Even like a nsql DB ๐
@shy helm can't
some families have direct code references
and thats not compilesafe
Family is part of the public API that every developer can use
And make it load the config internally
but the Families data, is 'private'
since we don't want to give away our roleplay data to everyone
@shy helm meh, I forget why I didnt use sql at the time
Lot of this data is backed in sql
the java interface behaves like an enum
Iโve had to deal with runtime enum creation, itโs not the worst
Our had to pull from a REST API too
static Family valueOf(String name) {
return (Family)StaticDataBinding.getBinding(Family.class).stream().filter((f) -> {
return Objects.equals(f.name(), name);
}).findFirst().orElseThrow(() -> {
return new IllegalArgumentException("No family with that name exists");
});
}
static Family[] values() {
List<Family> families = StaticDataBinding.getBinding(Family.class);
return (Family[])families.toArray(new Family[families.size()]);
}
interface ^
import tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_widgets()
def create_widgets(self):
self.hi_there = tk.Button(self)
self.hi_there["text"] = "Hello World\n(click me)"
self.hi_there["command"] = self.say_hi
self.hi_there.pack(side="top")
self.quit = tk.Button(self, text="QUIT", fg="red",
command=self.master.destroy)
self.quit.pack(side="bottom")
def say_hi(self):
print("Hello World!")
root = tk.Tk()
app = Application(master=root)
app.mainloop()``` its starting to work
@shy helm some of the patterns from this project aren't really what I write code like now
I used this project in 2014, as an excuse to learn new techniques
so not only did it serve my gameserver
it also taught me how to code
It runs on like 7 servers simultaenously
and synchronizes between nodes with redis
@umbral saffron starting
Im trying to make โgunโ to go to the location of the โplayerโ
The gun will always point to the cursor as well
The gun and player are both <div>
And have the same css settings apart from color and pixel size
nice
Can someone tell me what i have wrong in my code
whats the error message
and what software are u using
and what OS
@next igloo
There are no error messages
then whats the issue
The thing does not work
meaning
The gun wont go to the player
oh
And it wont point at the cursor
then i cant help
I think i have a few syntaxes wrong
is that all of the code for that
Yes
wait ye it is
Function gunAim(e) {
Does loop, it logs the mouse x and y coordinates
The other lines of code dont run
I dont think debug will help
just to see whats wrong
Itโs probably because i dont know the proper syntaxes
Im also using Glitch, a free code editor that runs in your broswer
whats the Timer2 = settimer thing
Intervals of 25miliseconds
getMousePosition() -- does things that things that are unrelated
@next igloo usually get implies you return something
updateMousePosition() seems more appropriate :)
And you don't have to globally scope those fields either
How do I create a vector that stores smart pointers?
vector<smart_pointer> list; does not work
smart pointers are a class of pointers including shared_ptr<T> and unique_ptr<T>
is there no way to make a list of smart pointers
when you run my command, a button is supposed to come up on the GUI but theres nothing there
import tkinter as tk
from tkinter import filedialog, Text
import os
root = tk.Tk()
def addApp():
filename= filedialog.askopenfilename(initialdir="/", title="Select File",
filetype=(("executeables","*.exe"), ("all files", "*.*")))
canvas = tk.Canvas(root, height=700, width=700)
canvas.pack()
frame = tk.Frame(root, bg="White")
frame.place(relwidth=0.8, relheight=0.8, relx=0.1, rely=0.1)
openFile = tk.Button(padx=10, text="Open File", pady=5, fg="White")
root.mainloop()```
@umbral saffron you define a function, addApp but you never call it
oh yea
well i wanted to finish addApp and test it and its supposed to open a GUI that has a button that when u click it it opens ur files
but when it opens
@umbral saffron what do you mean by "opens ur files"
u click it
and it opens file explorer
or at least u should be
again this was another test
to see if it can open things
but theres no button
@warm sleet
@warm sleet the get mouse position function works perfectly and the variables it outputs are correct, i just need the correct jquery syntaxes i think
@umbral saffron is that code above the one thats currently running?
lol
did u uninstall it
ah
sec
import tkinter as tk
from tkinter import filedialog
root = tk.Tk()
def file_dialog(e):
filename = filedialog.askopenfilename(initialdir="/", title="Select File",
filetype=(("executeables", "*.exe"), ("all files", "*.*")))
canvas = tk.Canvas(root, height=700, width=700)
canvas.pack()
openFile = tk.Button(root, padx=10, text="Open File", pady=5)
openFile.bind("<Button-1>", func=file_dialog)
openFile.pack()
root.mainloop()
@umbral saffron
Try this
only weird thing
I couldnt figure out
was why the button looks so weird after you close the dialog
@umbral saffron you basically bind an event handler to the button
and the button wasnt visible
because you didnt pack() it
oh
@umbral saffron ok figured it out
try this:
import tkinter as tk
from tkinter import filedialog
root = tk.Tk()
def file_dialog():
filename = filedialog.askopenfilename(initialdir="/", title="Select File",
filetype=(("executeables", "*.exe"), ("all files", "*.*")))
canvas = tk.Canvas(root, height=700, width=700)
canvas.pack()
openFile = tk.Button(root, command=file_dialog, padx=10, text="Open File", pady=5)
openFile.pack()
root.mainloop()
so you're just supposed to pass the function as command
ur 1st one worked
yeah
what
but its not the right way
look at the button
after you close the dialog
it doesnt have an animation
meaning
you run that bit of code
but doing command=file_dialog you mere pass a reference to that function
with file_dialog() you call the function
ohh ok
execute, invoke, call
means basically same thing
we're not doing prayers or magic here
lol
ok so the last thing I wanna try is taking a GUI linking it to a website
so its like a web browser
its a website called wolframalpha
i think i can figure it out
well look
you use the wolfram alpha API
yes thats what i was gonna do
and do your request directly with their servers
so doing
import wolframalpha
client = wolframalpha.Client("API")
assert isinstance(client, object)
res = client.query('temperature in miami')
print(next(res.results).text)```
doing that would do it
but i want it so res = client.query('temperature in miami') can be edited and can be typed in a gui
?
k
so then how do i make it so it can be edited in a GUI
nah thats not the point
Just saying, I've used wolframalpha before, long time ago
made a little command in a chat channel ,where you could ask for wolframalpha
thats what im trying to do kinda
yeah
@umbral saffron keep your imports at the top of your file
individual bits of code that you want to run, you put into methods with def
idk what that means
functions/methods
@umbral saffron imports allow you to access code from other files
in this case, you are importing tkinter and wolframalpha
put this at the top of your file import wolframalpha to import it
then you can create a client with this: client = wolframalpha.Client(app_id)
not sure what that PySimpleGUI is
i did
wtf
PySimpleGUI is another tkitner thing
are you just copy pasting random things from the internet?
what
what is all this crap https://i.imgur.com/HRWsKGO.png
no im not taking random things
it was a thing based on a tutorial that i edited
is it not needed
@warm sleet
@umbral saffron
import wolframalpha
client = wolframalpha.Client("APP ID")
result = client.query("What is the answer to life, the universe, and everything?")
print(next(result.results).text)
make a new file
put this in there
and try it out
wait nvm i had the other file still open XD
software is documented
you have to read and try to understand what it is doing
a query is a request for data
and it returns a Results object
which I put in a variable named result
yeah
next() just takes the first item in a list
Results may have more items
for pod in result.pods:
for sub in pod.subpods:
print(sub.text)
this would run through all the results and print them out
logically what you would do is
for pod in result.pods:
do_something_with(pod)
create a new method to do something with the pod
so the second one makes it cleaner and more info u would want?
Yeah depends on what you need
if you have graphs
or images
I think they are supplied differently
this is just plaintext
im gonna try the Tkitner thing again
but i only got far enough for 1 button that opens something
@umbral saffron just do this:
def query_wolframalpha(text):
client = wolframalpha.Client("APP ID")
result = client.query(text)
return next(result.results).text
then you can call it from anywhere else in your code
a function, or sometimes called a method
and using query_wolframalpha lets u use all of that to use the bot
so this is different thanresult = client.query("What is the answer to life, the universe, and everything?")
yeah thats jsut to show you how it works
but by creating a method for it with def
we can give it an input text
and then use that with the wolfram client
and we then return the answer
so am I replacing
this is coding 101
client = wolframalpha.Client("LLJV76-R2T8GERLT8") result = client.query("What is the answer to life, the universe, and everything?") print(next(result.results).text)
You should do a python tutorial
i was looking at some
codeacademy
and it led me to the really long code thing
@umbral saffron once you understand how the language works
you'll be able to read and understand what a program is doing
without this, you're kinda aimlessly doing things
python is quite easy
thats not really how its done
You break up your programs into little functions
structure what you are doing
makes it a lot easier to read and write code
@umbral saffron some programs have 1000s of functions
this is one file for one of my projects
all of those are functions
woah
and if you don't organize things
you end up with spaghetti code
and it just grinds your progress to complete standstill
so u gotta make sure its organized
coolloorrrr
omg
haha.
if you click on it
xD
color formatting in minecraft is really annoying
java is a very easy language imo
compared to langs like c++
however it does require a lot more boilerplate than some other languages such as Kotlin
it was the first language i learned
ok
if you're looking to learn a lot of languages, java is a great place to start
python is too
all i need to do now is make the GUI with text
may i suggest qt
its a c++/python library with a lot of features
and the system is quite intuitive
i have ptsd from swing
qt5
thats the version you need
i have some projects i have used qt in if you need examples
python-qt5 or qt5
qt5
@spring pond he should do a tutorial first
ok
and not slap together random crap from the internet
good point
there are quite a few out there
https://build-system.fman.io/pyqt5-tutorial i think this is the one i first used
wait do i need to update pycharm then it says it couldnt find a version that satisfies the reqirement
importing specific elements such as a text box QLabel or a button QPushButton
its later on in the linked tutorial
but if I import the whole thing doesnt it have all of that
well pyqt5 is divided into modules
oh
sample import
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout
pycharm should have prompted you to install pyqt5-stubs
i think it did
if you did it it should give you code completion
like some pre written code?
nah just telling you what the arguments are and stuff like that
so the qt thing can set up a GUI so it has a text box u can type in
and search it
@umbral saffron if you see words like stub being used
look them up ;)
there's lots of jargon
that thing you have highlighted
it adds it to the imports
you dont need to type it in youself
oh cool
also you don't need import PyQt5 as qt
then what do I do?
did you follow the tutorial?
not yet
you probably should
im going to but i have some things to do first
i gotta tell u, if u import the whole of PyQt5 ur program is gonna be massive
last project i did with it, i left in unused imports
and the windows version was 35mb
the linux version was 110mb
so u really wanna be careful about only including the smallest amount of stuff possible
So much Python here
Program in python
projects
do 11 push ups
vs code is drunk ?
it works when i run it
and python extension package is installed in vscode
if it works when you run it then maybe vscode cant find the package
How can I allocate memory to smart pointers and then store them inside a class without them going out of scope as soon as the function used to create the smart pointers is done. I need to store them inside my class but they are deleted as soon as the createsmartpointer functions is done
list indexes shouldnt be nested
I figured it out
list3 = [1,2,[3,4,'hello']]
list3[2][2] = "goodbye"
print(list3)
im dumb
How can I allocate memory to smart pointers and then store them inside a class without them going out of scope as soon as the function used to create the smart pointers is done. I need to store them inside my class but they are deleted as soon as the createsmartpointer functions is done
@nocturne galleon well im assuming this is c++, so i give my advice: in ur class definition: ```cpp
class Foo {
private:
std::unique_ptr<int> ptr;
public:
void makePtr(int& number) {
this->ptr = std::make_unique<int>(number);
}
};
just make the function to create the smart pointer a method
rather than a global function
how do i access my linux terminal from a website, or make buttons to run series of commands on a website
are you saying that you want to access a terminal-like environment from a website?
if so, you'd have to use something like https://www.npmjs.com/package/node-ssh
bruh
i installed google
on python
it shows it
but on the actual code it doesnt work
I am so close to having this figured out I just gotta figure out a way to remove everything thats not an alphabetical letter. Or remove anything from the list before a (since they are all listed before the a)
what does it do?
Not an expert on this, but wouldn't regex do that in a one liner?
why can i not import google

like I already imported it
it doesnt work in the code tho
@cinder kraken I do not know Regex but yes I do see regex suggestions when I google to remove the characters. I assume you don't mean it can do the whole thing?
@umbral saffron are you trolling?
I don't know what you are trying to do but judging by that red line there is no standard libary for python called google
there is tho
Well the line means the module is not there
oh
but idk the module so cant help you
ok
I think you might be getting ahead of yourself
like if the thing i linked does not really make sense to you
its really basic
you might wanna still be learning the fundementals
Like what are the different data types, comparisons, lists, loops etc etc
Arithmetic operators
ye probably
A pangram is a sentence that contains every single letter of the alphabet at least once. For example, the sentence "The quick brown fox jumps over the lazy dog" is a pangram, because it uses the letters A-Z at least once (case is irrelevant).
Given a string, detect whether or not it is a pangram. Return True if it is, False if not. Ignore numbers and punctuation.
was the assignment btw on Code Wars
Some solutions that are 1000000 x better then mine
I am so dumb.
@spring pond
import wolframalpha
import PyQt5
from PyQt5 import QtWidgets
from PyQt5.Widgets import QApplication, QMainwindow
import sys
def window():
app = QApplication(sys.argv)
win = QMainwindow()
win.setGeometry(200, 200, 300, 300)
client_wolf = wolframalpha.Client("API")
result_wolf = client_wolf.query("question goes here")
print((next(result_wolf.results).text))
def query_wolframalpha(text):
client_wolf = wolframalpha.Client("API")
result = client_wolf.query(text)
return next(result.results).text```
why doesnt this work (i removed the APIs so thats not it)
well you aren't calling window()
whats the error
you need to use from Pyqt5.QtWidgets import ...
no you didnt
does it need to be lowercase?
from PyQt5 import QtWidgets
from PyQt5.Widgets import QApplication, QMainwindow
this is not correct
this is
from PyQt5.QtWidgets import QApplication, QMainwindow
just that line
ok
so that fixed one of the issues
WAIT
i got it to work
thanks
but trying to add a label breaks it...
yes
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel```
but its grey
like I havent used it yet
label = QtWidgets.QLabel(win)```
but i did
is it not showing up or whats happening
label = QtWidgets.QLabel(win)
AttributeError: 'NoneType' object has no attribute 'QLabel'```
oh
ye
nah youre learning
ok so my issue was im making it too complex
https://www.youtube.com/watch?v=1HpvvJS12Kc I don't expect yall to understand what this is but, help a brother out and leave ah like please, basically it's graphics mod i made.
Don't forget to zess that like button, subscribe button and that bell notification ya'll and enjoy da' video
Take this as a teaser, the next showcase will be in 4K
Note:
Been awhile since I made an update on making my ENBS. Benchmarks for this video with the ENB on and off...
How do I store an fluctuating amount of node pointers that are of type unique_ptr<node> inside the Node class? Every time I create node class I'll tell it the amount of children it will have. Im having problems storing the smart pointer
why does it say that I have an invalid syntax?
import PyQt5
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QPushButton
import sys
from PyQt5.uic.properties import QtWidgets
class MyWindow(QMainWindow)
def __init__(self):
super(MyWindow, self).__init__()
win = QMainWindow ()
win.setGeometry (200, 200, 300, 300)
def initUI(self):
self.label = QLabel (win)
self.label.setText ("Attempt one PyQt5")
self.label.move (50, 50)
self.b1 = QPushButton(win)
self.b1.setText ("Click this")
self.b1.clicked.connect (clicked)
def clicked(self):
self.label.setText("you pressed the button")
def clicked():
print("clicked")
def window():
app = QApplication(sys.argv)
win = MyWindow()
win.show()
sys.exit(app.exec_())
window()```
kinda
this is a common mistake, don't worry
I think your thought process is
win = QMainWindow ()
Would make it a class variable?
yes
that doesn't work in python
you need to use the self keyword
def __init__(self):
super(MyWindow, self).__init__()
self.win = QMainWindow ()
self.win.setGeometry (200, 200, 300, 300)
everytime you need to use this variable use self
e.g.
def initUI(self):
self.label = QLabel (self.win)
self.label.setText ("Attempt one PyQt5")
self.label.move (50, 50)
@umbral saffron 
ohhhhhh ok
class variable exists btw, but you're calling a method
so instead of win it would be self.win
yes
ok
it still says MyWindow(QMainWindow) is not a valid syntax
did you copy pasted it line by line?
cause you need the semi-colon
class MyWindow(QMainWindow):
little by little
thanks
ok
class MyWindow(QMainWindow):
def __init__(self):
super(MyWindow, self).__init__()
self.win = QMainWindow ()
self.win.setGeometry (200, 200, 300, 300)
def initUI(self):
self.label = QLabel (win)
self.label.setText ("Attempt one PyQt5")
self.label.move (50, 50)
self.b1 = QPushButton(win)
self.b1.setText ("Click this")
self.b1.clicked.connect (clicked)
def clicked(self):
self.label.setText("you pressed the button")
def clicked():
print("clicked")
def window():
app = QApplication(sys.argv)
win = MyWindow()
win.show()
sys.exit(app.exec_())
window()```
I thought you used self.win

e.g.
self.label = QLabel (self.win)
self.b1 = QPushButton(self.win)
I dunno what tutorial you are using, but you missed a copy paste in the init function (constructor)
just a hint lel, find it out yourself

wait wait wait
ur right
i didnt do the self. thing for all of them
thats why it didnt work
wait what
still doesn't work after you used the self ?
can you screenshot
ah yes
i said the hint
you missed a copy paste in the init function (constructor)

want to help you, but also want you to learn
Can this channel be used for porting purposes also?
@umbral saffron i guess I would tell you the answer now
you didin't called the initUI
so you declared it, but didn't used it

how learning am I
very
i mean you just asked for porting
most people don't know about porting
i'd say you're smarter than me @finite nest
I only successfully ported ubuntu touch twice with literally no knowledge how. nor do i remember half of it.
What about Lineage? or windows ARM for EDK2 powered phones?
Lineage is interesting, but my samsung phone is not part of the compatibility list
i would only use it when I have another phone
wouldn't want to destroy my daily driver
Im trying desperately to learn and make my trash edk2 port work
it doesnt even boot
i would only use it when I have another phone
What samsung you have?
Im trying desperately to learn and make my trash edk2 port work
interesting, might try to check my samsung for this
looks like I need to buy a new phone
edk2 seems to work for only AARCH64 bit phones, there are very few ARM32 bit phones that work with it
ok
@finite nest what are you doing rn





