#development

1 messages · Page 59 of 1

hollow basalt
#

porting?

finite nest
#

Nope, I can later tho

#

Why?

#

why, you want an Ubuntu touch Port?

#

xD

#

I'm bad at porting tho :/

hollow basalt
#

not really lel

#

just keeping an eye

finite nest
#

ah

#

i was trying to learn ethical hacking from a group but it kinda sucked the way they have a online virtualized attack machine that is very slow.

hollow basalt
#

free?

#

I honestly want to learn with a group

#

instead of doing it self

finite nest
#

it is free

#

@hollow basalt dm me

#

if you dont mind

hollow basalt
#

currently playing hehehe

nocturne galleon
#

@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);
}
};

@crystal tundra Problem here is that you are creating the pointer already inside the private area. I need a vector<smart_pointer<classnametopointto>> smartpointerlist();. And then I need to be able to fill up that list

crystal tundra
#

Oh so a vector of smart pointers

nocturne galleon
#

yeah exactly and the amount of smart pointers inside the vector varies from node to node

#

Should I just use regular pointers and then do a manual cleanup of the tree?

spring pond
#
class Foo {
private:
  std::vector<std::unique_ptr<int>> ptrVec;
public:
  void makePtr(int& number) {
    ptrVec.push_back(std::make_unique<int>(number));
  }
};

Would this work?

nocturne galleon
#

How would I adjust it to this one: ```c++

template <typename T>
class smart_pointer
{
private:
T* m_pRawPointer;
public:
smart_pointer(T* pData) : m_pRawPointer(pData) { cout << "node just created" << endl; }
// constructor
~smart_pointer() { cout << "deconstructor for smart pointer called" << endl; delete m_pRawPointer; }
// destructor
T& operator* () const
// dereferencing operator
{
return (m_pRawPointer);
}
T
operator-> () const
// member selection operator
{
return m_pRawPointer;
}
};```

#

@spring pond

#

some corresponding thing for make_unique

spring pond
#

why are you making your own smart pointer class

umbral saffron
#

should I learn java

spring pond
#

if you don't have a lot of experience with programming its a good place to start

umbral saffron
#

ok

#

wait sorry I forgot

#

im Thonk Man

spring pond
#

oh

#

well since you've already started with python i'd recommend continuing with it

umbral saffron
#

ok

nocturne galleon
#

Severity Code Description Project File Line Suppression State
Error C2664 'Node::Node(Node &&)': cannot convert argument 1 from 'int' to 'const Node &'

#
class Node {
public:

};

class Foo {
private:
    std::vector<std::unique_ptr<Node>> ptrVec;
public:
    void makePtr(int& number) {
        ptrVec.push_back(std::make_unique<Node>(number));
    }
};





int main()
{
    Foo obj;
    int d = 33;
    obj.makePtr(d);


    return 0;
}```
spring pond
#

well your problem is that you didnt change the function signature

#
#include <vector>

class Node {
public:

};

class Foo {
private:
    std::vector<std::unique_ptr<Node>> ptrVec;
public:
    void makePtr(Node& node) {
        ptrVec.push_back(std::make_unique<Node>(node));
    }
};

int main()
{
    Foo obj;
    Node n = Node();
    obj.makePtr(n);

    return 0;
}
nocturne galleon
#

oh yeah my iq is gone today

#

that's what being awake for 36h does to you

umbral saffron
#

ye i forgot a : and it messed it up and I couldnt figure it out for like 20 mins

umbral saffron
#

why doesnt my button work

#

on my GUI

#

like it doesnt show up

crystal tundra
#

have u set a central widget

#

u are doing qt right?

umbral saffron
#

yes

#

PyQt5

#

from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QPushButton

#

these are all the things I imported earlier

#

it worked before

#

then I added to it

#
def QMainWindow
     label = QLabel (win)
     label.setText ("Attempt one PyQt5")
     label.move (50, 50)

     b1 = QPushButton(win)
     b1.setText ("Click this")
     b1.clicked.connect (clicked)```
#

that worked

#

but ```py
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()``` does not

#

i mean it opens in

#

but no button

#

@crystal tundra

crystal tundra
#

lets just start with some very basic stuff

#
def QMainWindow
     label = QLabel (win)
     label.setText ("Attempt one PyQt5")
     label.move (50, 50)

     b1 = QPushButton(win)
     b1.setText ("Click this")
     b1.clicked.connect (clicked)```

@umbral saffron this not good code

#

do not do this

umbral saffron
#

ok

crystal tundra
#

but ```py
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()``` does not
@umbral saffron this is mostly good

umbral saffron
#

mostly

crystal tundra
#

u got the __init__ almost right

#

however

#
def __init__(self, *args, **kwargs):
  super(MyWindow, self).__init__(*args, **kwargs)
``` should be the first line
#

second of all

umbral saffron
#

so replace that?

crystal tundra
#

dont replace

#

just change

#

those 2 line

umbral saffron
#

yes

crystal tundra
#

to add these things

#

next thing

#

every QMainWindow needs a central widget

#

so after ur super function: ```python
self.centralWidget = QWidget()
self.setCentralWidget(self.centralWidget)

#

next to do

#

use a layout

#

look up qt layouts

#

try use it

#

make sure to pass its parent as self.centralWidget

#

and ping me here if u get stuck

umbral saffron
#

so after ur super function: ```python
self.centralWidget = QWidget()
self.setCentralWidget(self.centralWidget)

@crystal tundra that did not work

crystal tundra
#

u must ```python
from PyQt5.QtWidgets import QWidget

#

as well as all the other widgets u r importing

umbral saffron
#
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QPushButton```
#

i have that

crystal tundra
#

just put QWidget after

umbral saffron
#

do i need another one then

crystal tundra
#
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QPushButton, QWidget```

@umbral saffron

umbral saffron
#

ok i did that

#

question

#

what did what u added do

#

it didnt change

crystal tundra
#

yeah ik

#

this is just getting the app properly working

#

next is

#

but ```py
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) #look here (change win to self.centralWidget)
     self.label.setText ("Attempt one PyQt5")
     self.label.move (50, 50)

     self.b1 = QPushButton(win) #same here
     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()``` does not
@umbral saffron

#

as well as that

#

clicked should be a member function

#

indent it properly

#

and do self.b1.clicked.connect(self.clicked)

umbral saffron
#

in replacement of self.b1.clicked.connect (clicked) right?

crystal tundra
#

yup

#

just remember

#

self.

#

for any member variables

#

u have to specify self

#

i.e. self.win not win

umbral saffron
#

.self for anything under the class MyWindow right

#

or the def

crystal tundra
#

yup

#

remember indent ur clicked function to be a member function

umbral saffron
#

wait indent the def clicked(self):

#

?

crystal tundra
#

yup

#

get rid of the other clicked funtion

umbral saffron
#

ok

#

gone

#

but how do I get the button to show up

#

@crystal tundra

crystal tundra
#

yep

#

so self.b1 = QPushButton(self.centralWidget)

#

instead of self.b1 = QPushButton(win)

umbral saffron
#

so for every thing u need to import them

#

wait wait wait

#

i got it

#

i just need a way to call initUI

#

right?

#

actually just all of MyWindow

#

i might be wrong

spring cove
#

might i ask, im new to programming, what language is that?

umbral saffron
#

Python

spring cove
#

oh ok cool

umbral saffron
#

im still learning it too

spring cove
#

ok thats all i had to ask, good luck with that project or whatever it may be

umbral saffron
#

thanks

crystal tundra
#

oh yeah

#

course u gottta call initUI

#

in ur __init__ function

umbral saffron
#

how do i do that

crystal tundra
#

initUI()

umbral saffron
#

just at the bottom

#

so under window() i do intiUI()

#

ok it did something

hollow basalt
twilit pawn
#

So like, im trying to code a bot that gives out notifications when a tiktok is posted and/or youtube vid is posted. Can anyone help?

midnight wind
#

idk, maybe use the youtube api

#

or you could build a web scrapper

#

use node.js puppeter

hollow basalt
#

Don't get tiktok

twilit pawn
#

@hollow basalt wdym?

hollow basalt
#

I mean what I mean

twilit pawn
#

Idk what u mean

#

😑

crystal tundra
#

So like, im trying to code a bot that gives out notifications when a tiktok is posted and/or youtube vid is posted. Can anyone help?
@twilit pawn there is a tiktok api u can use

#

Just look up tiktok api python

#

And ull find the download and docs for it

nocturne galleon
#

that code doesn't work @spring pond

#

run it yourself and see

ocean robin
#

I own an Among Us bot(It is discord verified) Dm if interested

steel ether
#

Hey guys, I need a bit of direction in this python project I'm working on.

#

I found this JavaScript library that I could use for my project. But I don't know JavaScript and I don't find an equivalent python library.
Is there any way I can use the JS library in my python project?

hollow basalt
#

for the question: yes

#

but it would be slower

steel ether
#

How?

#

I don't think speed is going to be an issue here.
It's just a basic prototype so far.

spring pond
#

i missed some #include's in my code snippet

rotund plover
#

Hey guys someone can help me with phpmyadmin?
For some reason it stopped working.
I can't do anything inside it.
When I try to click something there it just refresh the page.

warm sleet
#

wat

#

phpmyadmin

rotund plover
#

I'm using phpmyadmin only for viewing

warm sleet
#

phpmyadmin not really the best solution for managing an sql database

rotund plover
#

It just got broken for some reason

#

Not doing much there

warm sleet
#

@rotund plover workbench can directly connect to the sql server

#

so you dont need php, or phpmyadmin

rotund plover
#

Is there a good workbench for Linux ?

warm sleet
#

it runs on linux too

rotund plover
#

Except terminal

warm sleet
#

Its a desktop program

#

@rotund plover it has a table inspector, database inspector, as well as the regular tree-view on the left side like in phpmyadmin

rotund plover
#

Now works except viewing tables

warm sleet
#

SELECT * FROM table

rotund plover
#

I hate php

warm sleet
#

That's not PHP, but SQL

rotund plover
#

Always doing issues

#

Phpmyadmin

#

Haha

warm sleet
#

mhm. I used to use that when I first starting doing web stuff

#

and its so bad xD

rotund plover
#

Ya

#

I never had a great time with phpmyadmin

#

Not even good time

#

Always had problems

warm sleet
#

phpmyadmin is commonly used by those 'managed website' hosting

#

where you get FTP, and phpmyadmin to manage everything

rotund plover
#

Yes like cpanels directadmin and etc

warm sleet
#

cpanel is a bit more

rotund plover
#

I hate it

warm sleet
#

phpmyadmin is specific to webapplication hosting with php

rotund plover
#

Ya a bit more problems

#

I used to work with cpanel

warm sleet
#

cPanel can do other administrative things

#

like DNS

rotund plover
#

Ya

warm sleet
#

and whatever else you want

#

meanwhile

#

Linux ftw

#

do it yourself

rotund plover
#

I like my terminal

#

I don't like web panels

warm sleet
#

SQL development I do from within my IDE

#

viewing, migrating and managing databases I do with the workbench

rotund plover
#

I'm testing my python website

#

So I need to monitor my web db

warm sleet
#

That SQL Workbench has a built in ssh client, so you can use it as a proxy

#

so you can tunnel sql over ssh

#

over a firewall

#

most sql servers only accept connections from localhost

rotund plover
#

Ya but I have private IP at home

warm sleet
rotund plover
#

So I can use it Normally

warm sleet
#

See this ^

rotund plover
#

Looks good

#

Remind me my old best friend MySQL query browser

warm sleet
rotund plover
#

Always want me to register

#

😠

#

I guess I'll need a real email there

#

Oh nvrm

warm sleet
rotund plover
#

Didn't noticed to the download hehe

warm sleet
#

looks identical to the features that phpmyadmin has

rotund plover
#

Ya

#

I know this program

warm sleet
rotund plover
#

Haha

#

I saw worst

warm sleet
#

majority of that is minecraft inventories

rotund plover
#

I saw 60gb

warm sleet
#

they take up a lot of space

#

largest DB I've worked with was 2.5TB

rotund plover
#

And 120

warm sleet
#

OracleDB

#

like 500+ tables

rotund plover
#

No just saves cache and logs in db

#

Not something important

#

I wondered what will happen if I remove all of it without the customer permission

#

Didn't went well

warm sleet
#

oof

#

Once a day I run an mysqldump on the database

rotund plover
#

But I was able to blame his programmer because he already fucked up the vps disk

warm sleet
#

compress the file and scp it to another machine

rotund plover
#

Replication of 120gb db to another server in another DC out of my country

#

When my country doesn't have good internet to outside of the country here

warm sleet
#

sounds like you need fiber

rotund plover
#

Fiber will not help to

warm sleet
#

I got a 1G x-connect to my VPS in the datacenter :)

rotund plover
#

Our ISPs here sucks

#

I got dedicated in germany with 1G

warm sleet
#

Nah, I ment as in. My home internet has 1G to the VPS, and 250M to the wider internet

rotund plover
#

I have 1Gb network on my dedicated to the wider internet

#

And my home have adsl

warm sleet
#

:(

#

I was on adsl for many years

rotund plover
#

Ya

warm sleet
#

never again.

rotund plover
#

Our ISPs here don't want to be connected to each other directly and lower out latency and ms to each ISP here

warm sleet
#

whut

#

why not

rotund plover
#

Each company connect only them self's

warm sleet
#

they don't peer among eachother?

rotund plover
#

And building not private houses so I'm fucked up

#

they don't peer among eachother?
@warm sleet nope

#

I can ping my friend IP and get like 40ms

warm sleet
#

yeah but adsl already has poor latency

rotund plover
#

Even the fiber not peered

#

My friend have it he pinged someone that in different ISP he got like 45ms

hollow basalt
rotund plover
#

The ISP told him that because he is too far from their rack thats why he get such high ping

#

All the ISPs here togther if they'll be connected to each other will have max of 2tb bandwidth

hollow basalt
#

hmm private peering is expensive

rotund plover
#

The biggest ISP here have 500gb

#

Well ya but you need to be peered

warm sleet
#

Not sure you understand what peering is

rotund plover
#

Fortnite updates crashed all the outbound traffic 2.5 weeks ago

warm sleet
hollow basalt
#

Not sure you understand what peering is
Pogey

rotund plover
#

We had no access to facebook youtube google play store apple store and all the services that not hosting in my country

#

1 day

hollow basalt
#

and you expect peering to solve that?

rotund plover
#

No I except they will be able to handle it

warm sleet
#

We had no access to facebook youtube google play store apple store and all the services that not hosting in my country
@rotund plover sounds like time for a holiday

hollow basalt
rotund plover
#

We had internet only to services that hosted here

hollow basalt
#

that's hardly internet at all

#

it's like intranet

rotund plover
#

My dedicated server hosted in Germany and this hosting provider have more than 5TB of peering

warm sleet
#

thats not peering

rotund plover
#

They are connected all over europe I wish our ISPs here will do that

warm sleet
#

Thats just a traffic allowance

rotund plover
#

Ya

#

Here max is 500gb man

midnight wind
#

but that's not what peering is...

rotund plover
#

They are not peered to anything

#

That's not really meters

#

We want low latency with fiber 40ms inside the country is fucking high

hollow basalt
#

still not peering

rotund plover
#

I'm talking about latency not peering now

#

I know that is peering I just not talking about it right now

#

They are connected to IIX but still shit.
The ISPs here are not good enough

#

Wanna hear something funny

#

My ISP said it's ok to get 600ms to their gateway

warm sleet
#

get different isp kek

rotund plover
#

All of them like this here

#

I have 3 fibers under my house 🏡 and none of those ISPs willing to connect me

#

Oh ya after they said that the started to blame my hardware

gusty girder
#

When creating a resource using a REST api, should I only reply with a 201 Created, or should I also show the created data?

shy helm
#

You should return the created resource

#

Is there a reason why you’re building a “response” object? All that data should just be in the HTTP response header, no need to add it to the body

spring pond
#

^
Most if not all of the response object is unneeded. You could maybe use the message string, but it is probably unnecessary

#

actually im 99% sure that you will not need it because you shouldnt be rendering a response directly

warm sleet
#

@gusty girder depends. what kind of API style you are using.

#

pure REST always expects you to return the content you sent

#

except POST

#

if you create a new item with PUT you should return the object.

#

This is useful for things like generated primary keys (by the database)

#

@shy helm not nessesarily.

#

you can have things like "_status": "201 Created" in the top

shy helm
#

I mean sure, but there's really no point

warm sleet
#

Headers are ftw

#

you can add your own

#

X-My-Fancy-Header

shy helm
#

ehhhh

#

I'm not a big fan of custom headers, too much tie in

#

If you can't return the data you need in the body or in standard HTML headers, you're doin something odd

warm sleet
#

Auth is the only place I use it strictly

shy helm
#

Not necessarily, wrong, but just odd

#

There's already a header for that 😛

warm sleet
#

Exactly

#

X-Forwarded-By

#

xD

shy helm
#

heh, those are pretty standard tho

#

X-Forwarded-For, X-Forwarded-By

warm sleet
#
        location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $host;
                proxy_set_header X-NginX-Proxy true;
                proxy_pass http://localhost:8090/;
                proxy_redirect http://localhost:8090/ http://$server_name/nexus/;
        }
#

Nginx <3

#

@shy helm in my application APIs I embed exceptions into API responses

#

when the API returns a non 200 code, the client unmarshalls the exception (instead of the expected object) and throws it

#
    private static T Deserialize<T>(string data) {
        try {
            var serializer = new XmlSerializer(typeof(T));
            using (var reader = new StringReader(data)) {
                return (T) serializer.Deserialize(reader);
            }
        } catch (TargetInvocationException) {
            try {
                var serializer = new XmlSerializer(typeof(ApiError));
                using (var reader = new StringReader(data)) {
                    throw new ApiException((ApiError) serializer.Deserialize(reader));
                }
            } catch (InvalidOperationException) {
                throw new ApiException(new ApiError {code = -1, message = "Unknown Error", status = ""});
            }
        }
    }
shy helm
#

You use XML responses o.O

warm sleet
#

I love xml

shy helm
#

pain

warm sleet
#

@shy helm I will use json when they finally standardize a schema

#

all the types the API provides I export as xsd

#

The actual client is an interface facade implemented with rest

#

the java server interfaces are identical to the C# client interfaces

shy helm
#

There's a bunch of standards for JSON schemas

warm sleet
#

I've yet to find one that can generate it from java source files

#

the REST interface itself can speak both XML and JSON

#

But I choose the use XML, its just easier to do with .NET

shy helm
#

You can export OpenAPI specifications with some java packages

#

I've done it

warm sleet
#

Cool

#

I've been looking for a way to improve on this

#

I'm using a deprecated java tool to do this

#

JXC was removed in java 10

shy helm
#

TBH though, most people are moving towards doing it the opposite way

#

schema -> code gen for classes

warm sleet
#

I'm aware

shy helm
#

Protobuf, Apache Avro, etc

warm sleet
#

this workflow kinda grew out of a pure java environment

shy helm
#

I'm a big fan of protobuf tbh

warm sleet
shy helm
#

great performance, small message size

#

If you want to do pure Java then why do you need to export schema?

#

Just use GSON and annotate your class, move classes to a shared lib

warm sleet
#

That's a different project ;)

#

MOXy is why I use JAXB for this

shy helm
#

I see Eclipse

#

and I want to die

#

🙂

warm sleet
#

EclipseLink

#

w/e, they just offer a way to use the XML APIs from java

#

to do json as well

shy helm
#

I'm just bugging you 😛

warm sleet
#

Code first

#

I know schema first is the new hotness

#

those objects are modelled after what comes out of the database

shy helm
#

It's the new hotness because schema registries are becoming hot

#

tbh though, I don't hate it, very useful when doing large distributed projects

#

good way to do schema/interface evolution

warm sleet
#

@shy helm GSON fails for me

#

when I try to do things like lists

#
@Data
@NoArgsConstructor
@AllArgsConstructor
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Profile")
@XmlType(name = "Profile")
public final class Profile implements Serializable {
    private Player Player;
    private Highscore Highscore;
    @XmlElementWrapper(name = "Spells")
    private List<Spell> Spells;
    private boolean Online;
    private Family Family;
}
shy helm
#

Why does it fail for lists?

warm sleet
#

long time ago, but I always had issues with the annotations it provides

#

And the beauty of using JavaEE interfaces, is you do not need any additional dependencies to use

#

though.. that holds true for GSON, annotations are not required runtime

shy helm
#

hmmm, idk I haven't experienced these issues, couple of years ago I worked on a big big rest API for a very popular mobile app, we used GSON extensively

#

was a Spring Boot app though so 😛

warm sleet
#

@shy helm MOXy also ties into the JAXBContext

#

and the rest server I use, Jersey, can use it too

#

@shy helm this is pretty much all JavaEE

#
    @GET
    @Path("{id}")
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    @Override
    public Player getPlayer(@PathParam("id") String uuidString) {
        UUID uuid = parseUUID(uuidString);
        PlayerDao dao = provider.getDao(PlayerDao.class);
        Player player = dao.getPlayer(uuid);
        if (player == null)
            throw new NotFoundException("No player with that UUID was found");
        return player;
    }
#

sorry for the many pings

#

bad habbit from IRC

shy helm
#

heh no worries I do it too

warm sleet
#

You could do rest applications without any of this nonsense

#

If you just write JavaEE provider classes

#

you can use an Appserver like Tomcat

#

to provide all of this crap for you

shy helm
#

heh yeah, there's tons of ways to skin the cat

warm sleet
#

@shy helm this just gets called by maven during the package step

#

but oracle been cleaning up the tools.jar

gusty girder
#

@warm sleet thanks

warm sleet
#

@gusty girder forgot to mention

#

Look up 'rest idempotency'

#
An idempotent HTTP method is an HTTP method that can be called many times without different outcomes. It would not matter if the method is called only once, or ten times over. The result should be the same.

Idempotence essentially means that the result of a successfully performed request is independent of the number of times it is executed. For example, in arithmetic, adding zero to a number is an idempotent operation.
#

POST to create new content, PUT to update existing content

urban flint
#

any one fuck with dbus on linux? I'm trying to get output of something run from dbus if that makes sense

rotund plover
#

@rotund plover workbench can directly connect to the sql server
@warm sleet
I have problem with this bench.
I can't view inside the tables

warm sleet
#

@rotund plover what user account are you using to log in ?

#

need to have the right permissions to view info schema

rotund plover
#

Root

#

Have all the permission muhahaha

silver furnace
#

You can set perms on the info schema I think

#

Never apt mysql from current ubuntu sources.

midnight wind
#

why, are they outdated?

silver furnace
#

It won't even use password auth. Uses something otherworldly. You won't even be able to login with -u -p unless you kill the service; start it up manually with some flag to ignore auths. Then you get in as root only to find out that you don't own the schema with users

#

Turns out you gotta flip the auth module and even then, it autogenerates a password for a real "root" user called debian-sys-maint

#

I guess this is the Debian distrib for 8.x; not just Ubuntu

why, are they outdated?
@midnight wind Nah, too updated for my taste

midnight wind
#

ah ok

silver furnace
#

It's ok, though. 5.6 is manually installed through deb packages anyways 🤷‍♂️

#

MySQL 8. What is MySQL 8? Never heard of him

#

You run the darn thing under a separate user, allow only local connections, who even needs a password. If there are multiple apps that shouldn't access eachothers' dbs, you can use something other than root

#

(The joke being <=5.6 because I would only use MySQL for legacy/compat reasons)

rotund plover
#

MySQL 8 is the newest MySQL engine that got released recently.
But I still prefer Mariadb.

hollow basalt
#

I mean, they should be compatible

rotund plover
#

Ya

#

I just don't know why MySQL workbench not working as it should on fedora after connecting my server

#

This is the error

#

I'm using root

#

From my phone it's working perfect

#

Only MySQL workbench gives it

silver furnace
#

your select or update clusterfking of columns

#

fff

#

You need brackets

#

Nope not it either

#

I think it's backtick instead of quote

#

Or you're running just the single line instead of the whole script if you define the global var earlier

rotund plover
#

What

#

I'm just trying to view the table

warm sleet
#

@rotund plover what sql server version are you running

#

@silver furnace this the schema inspector of the mysql workbench

#

it fires off a big query to fetch context information

rotund plover
#

@rotund plover what sql server version are you running
@warm sleet mariadb

#

10.4

warm sleet
#

Oh

#

yeah no shit

#

I thought you were using mysql

rotund plover
#

It's pretty the same and it's fucking dumb if it's not working with mariadb

warm sleet
#

newer versions of mariadb are not compatible with the workbench

rotund plover
#

Ah

warm sleet
#

SQL queries themselves will fire properly

rotund plover
#

Well fuck it

warm sleet
#

but database context that the workbench uses will fail

#

THat's another client that works relatively well^

rotund plover
#

I guess the update for mariadb fucked something

warm sleet
#

@rotund plover nah the server is fine

#

MySQL Workbench is only officially supported for MySQL

#

not for MariaDB

rotund plover
#

That's why phpmyadmin got broken I think

#

I did update to the server

rotund plover
#

This is only for windows 😔

rotund plover
#

It works but the look of the program is yak 🤣

#

Now to fix my saving option in my website

balmy jackal
#

is there anyone with even the most basic skills in python here rn?

#

i need some help

#

i am trying to use the pyautogui library to make like...a macro

#

i wanna use it as a bot in skyrim

#

but my script stops running in the background when i switch over to skyrim

hollow basalt
#

I have the most basic skills in python

#

I can print hello world

balmy jackal
#

i just want someone to kindly look over my poorly optimised code and see if thats the issue here

#

i havent even done that yet

#

i havent seen a single guide

#

i am... a fucking idiot who decided to use a script instead of a proper macro lmao

#

import pyautogui
import time
pyautogui.FAILSAFE = True
print('starting in')
print(5)

time.sleep(1)
print(4)
time.sleep(1)
print(3)
time.sleep(1)
print(2)
time.sleep(1)
print(1)
time.sleep(1)
print(0)

x = 1
while True:
pyautogui.click(duration=1.5)
time.sleep(0.5)
pyautogui.click(duration=1.5)
time.sleep(0.5)
pyautogui.click(duration=1.5)
time.sleep(0.5)
pyautogui.click(duration=1.5)
pyautogui.press(keys='f5')

#

here

hollow basalt
balmy jackal
#

my unnecesarily over complicated script

#

the first part is just a countdown

#

then its a loop

rotund plover
#

There is someone who can help me with python flask and flastdb ?
I'm trying to print something from my db into a webpage on my site and it's only gets the id numbers without all the other things like name and etc.
How can I fix it

hollow basalt
#

then its a loop
we can read it from the code

#

There is someone who can help me with python flask and flastdb ?
I'm trying to print something from my db into a webpage on my site and it's only gets the id numbers without all the other things like name and etc.
How can I fix it
can you show us your code?

balmy jackal
#

wait thats how a loop is done?

#

is it legit?

#

daaaaaamn

#

i thought i just jerry rigged that one

#

i feel so legit rn

#

if someone can find a flaw pls ping

rotund plover
#

can you show us your code?
@hollow basalt sure here it is

hollow basalt
#

thanks,

balmy jackal
#

i suspect its system optimisations

rotund plover
#

I tried 2 options

balmy jackal
#

cuz even the countdown just stops

rotund plover
#

None of them worked

hollow basalt
#

so your code prints the id right

rotund plover
#

Ya

#

The id and all the information

#

Should print

hollow basalt
#

can you show us how you print it

rotund plover
#

Now only shows id

#

Actually my website is open ww

#

You can access it

#

😂

hollow basalt
#

i mean I don't even know the url

rotund plover
#

Ya

#

Basic website

#

Paint saves the paint into the db

#

The save link should show all the paint info

#

Because it's not showing the information the search link doesn't work either

hollow basalt
#

I mean can you show the template

rotund plover
#

Oh

#

Sure

#

save template

#

save.js

hollow basalt
#

so you manually added a file into the DB to test your select?

rotund plover
#

I saved a file from my website

#

With save button

hollow basalt
rotund plover
#

How can I fix it ?

#

I'm implementing it the paint is not my work haha

hollow basalt
#

can you give the whole code for the search

#

like the whole thing

rotund plover
#

Search.js ?

#
  • trample
#

?

#

search.js

hollow basalt
#

no no, the python one

rotund plover
#

search.html

#

I sent you in the photo

#

but here you go

#

The real cur.execute is the one in comment.
The second one is the last one I tried

hollow basalt
#

shouldn't you like return all the possible filenames if it's a get

rotund plover
#

Where at what like ?

#

Last return ?

hollow basalt
#
def search():
        if request.method == 'GET':
                return render_template("search.html")
#

aren't you returning an empty template

rotund plover
#

Nope

#

It's return render_template("search.html")

#

It's just returning the page

warm sleet
#

render template?

rotund plover
#

Ya

warm sleet
#

you need a view + model to render a template

#

what template engine are you using?

#

most of them work similairly

#

from my code:

#

    /**
     * Compiles and returns a final HTML DOM.
     *
     * @return String value containing a HTML DOM.
     */
    @Override
    public String render(ModelAndView modelAndView) {
        if (modelAndView == null) {
            return null;
        }
        String viewName = modelAndView.getViewName();
        try {
            Template template = handlebars.compile(viewName);
            return template.apply(modelAndView.getModel());
        } catch (IOException e) {
            logger.debug("Failed to render object", e);
            throw new RuntimeException(e);
        }
    }
hollow basalt
#

Yea, I mean shouldn't you query the database for everything then return it in the search.html

#

e

rotund plover
#

Using flask render template

#

It works on other pages

warm sleet
#

@rotund plover yeah, you're supposed to pass models as parameters to render_template

#

render_template("view.html", name="hello world")

hollow basalt
#

^ this tbh

warm sleet
#

name is then available inside the view

hollow basalt
#

return something

#

or you know

#

you'll render nothing

warm sleet
#

render_template returns the html string

#

you should send that back to the browser

rotund plover
#

Am ok

warm sleet
#

so you'd return render_template()

#

My code does something along same lines

rotund plover
#

I agree that's how the other person did it that's why I never considered change it 😅
My other functions return more the just html file

#

What MySQL fetchall does ? Only takes all the info from the table ?

hollow basalt
#

it fetches all from the cursor (last executed statement)

rotund plover
#

Ok

warm sleet
#

while (next()) {}

#

:)

hollow basalt
#

that's bad practice

#

use while True

rotund plover
#

Can I just print the fetchall

#

To my page for a test

hollow basalt
rotund plover
#

Like print(files)

hollow basalt
#

python print() can pretty much do anything

rotund plover
#

Ya but I call it in my site

hollow basalt
#

no

rotund plover
#

It's raining in background

hollow basalt
#

if you want you can store it in a string then yeet that string into your html

rotund plover
#

Just want to see if it get the info from the db

#

If I get the list to tuples

hollow basalt
#

since you're still in dev mode, you can use the terminal for the print

rotund plover
#

I'm running on debug mode right now

rotund plover
#

Well if I change the for files in files in template to , for file in files I get output

#

But all duplicated

#

All the first and second rows

hollow basalt
#

can you show us

rotund plover
#

Ya you can surf to my website in 10 second and see it under gallery

#

Oh wait

#

Stoped working completely

#

Now you can see it

#

All row 2 duplicated all over the page

#

Any ideas ?

hollow basalt
#

I can only see banana10

rotund plover
#

Ya

#

That's the problem

#

This is only row number 2 from the table

#

If I change 1 letter you'll see only the numbers again

#

I can send you the original code

#

Before I tried to implement it to my site

#

I changed it to MySQL and implemented it to my site

#

At least my login and register works perfect

warm sleet
#

@hollow basalt nghhh typescript so powerful

#
  public async getByUrl(url: string, culture: string = this.culture): Promise<Content> {
    return this.client.delivery.content.byUrl(url, {culture: culture});
  }
#

default parameters done easy

hollow basalt
#

interseting

#

using this in default params

#

thats kinda weird

#

so it would use the current value everytime you call it without params

warm sleet
#

@hollow basalt nvm

#

language still sucks

hollow basalt
warm sleet
#

it resolved to undefined

#

fuck.

#

what use is a compiler

hollow basalt
#

I mean I'd rather want it to be undefined

warm sleet
#

if it still fucks up

hollow basalt
#

guess it isn't your type

rotund plover
#

I fixed my phpmyadmin

#

Now all good, the problem I had because something with my Domain

#

Change the domain I use for it and now it's good

next igloo
#

Im trying to make a block go to the players position

#

My current code is

$(“block”).left = $(“player”).left;

#

And it automatically runs 60 times per second but does nothing

#

Its meant to be an object that will stick to the player

hollow basalt
rotund plover
#

:FeelsWOW:
@hollow basalt I still encountering this issue with the images save

#

I think I'll change it to save actual file instead in db

hollow basalt
#

can be

rotund plover
#

But I'm 2 tired and need to do homework so...

#

Maybe in another time when I'll be bored while listening to my teacher

#

Because he can't teach

wraith turtle
#

that moment when you just procrastinate for 3 weeks about writing a script XD

#

and contemplate procrastinating another week or two

next igloo
#

What would be a good language to learn after JS

spring pond
#

python

midnight wind
#

I mean you never finish learning a language

#

If you going with js, there are so many frameworks you can learn

#

You can learn front end like react, vue, etc.

#

Or backend like node.js

#

@next igloo

#

Learn about databases like mongodb

next igloo
#

Currently the other languages i know are html and css

#

And scratch if you count that

midnight wind
#

Then make a project

nocturne galleon
#

Anyone here familiar w/ writting windows drivers and/or applications that allow you to send and recive signals over usb?

midnight wind
#

Combine your knowledge

next igloo
#

I am for a school assignment

#

We have to make a game using all 3

midnight wind
#

I too "know" js and html and css, but in practically it's hard

#

Then make a multiplayer snack game

#

Js for the game

next igloo
#

The game im making is a run and gun (super mario with a gun bassically)

#

It uses jquery

midnight wind
#

jQuery for multiplayer? @next igloo

#

Or just dom manipulation

next igloo
#

No its a single player game, i think you misunderstood

#

Its for a grade 10 computer science class, so no multiplayer servers yet

#

And the game is pretty complex compared to the simple space invaders some people are doing

west garden
#

Can somebody help me how to code in Arduino?

#

I need it for my classes

midnight wind
#

@west garden what do you need help in

west garden
hollow basalt
#
log(![Pogey](https://cdn.discordapp.com/emojis/541722916434214912.webp?size=128 "Pogey") )
midnight wind
#

Just saying please learn me how to code doesn't help

#

For the most part coding is looking at tutorials and videos already out on the net

#

If you need SPECIFIC help, like a program not working, that's showing initiative

#

I'm being nice here

west garden
hollow basalt
#

you are unwilling to learn yourself

ivory bear
#

is there a channel for linux stuff?

#

I'm trying to figure out why ls just returns Failed

#

trying to look on google but they all talk about other errors, mine is just literally only returns one word Failed with capital F

#

nvm, idk what happened but apparently it's a file named Failed in the home dir

pure crow
hollow basalt
ivory bear
#

idk ok, I was trying to re-setup bunch of thing on diff server

apt install mariadb-server got hang so I killed that and stuff, then was doing bunch other thing cuz of locked dpkg thingy and after all that I just do ls to see the directory and got that returned so I got even more panic

#

it's fine now though

midnight wind
#

@ivory bear if you need linux stuff it's basically #networking All the linux people are over there

ivory bear
#

I will keep that in mind, it looked like it's fine... for now™

rotund plover
#

@midnight wind did you manage to find the cause of the problem with the vpn?

midnight wind
#

nope, I never had the time to look at it

rotund plover
#

Ah

#

I'm curious to know what is the real issue there

nocturne galleon
crystal tundra
#

thats the language arduino uses

#

and if u dont know it

#

u will be really stuck coding for arduinoi

nocturne galleon
#

well you only need the really basics of c/c++ to code arduino for your home projects to work

queen zenith
#

For anyone that has experience with linked lists in c++; If I want to access the 5th node in a linked list do I need to traverse the previous 4 nodes before accessing the 5th node?

vestal glen
#

That's how the data structure would work, yes.

queen zenith
#

these data structures are blowing my mind. I never thought trying to figure out the best way to store/search data would be this interesting.

#

I just looked up hash tables. You turn what you want to store into an index which determines where its stored in the array so you can access it immediately without searching. THATS SO FREAKING COOLeyes

lone cairn
#

So, I'm learning python and I'm trying to create a simple program that accesses a local db, reads a csv, writes the contents to a table (id, firstname, lastname, email, password), then run a query that can fetch the id/password and then hash the passwords.

The literature reading is not going well for me and I don't know where the ideal resources for figuring this out might be, lol.

hollow basalt
#

Sure

#

My suggestion is:

  1. Find a library to read csv
  2. Find driver for database, is it mysql/mariadb ? Postgre?
  3. Hash the password when saving to database, not when fetching it
lone cairn
#

mysql, and I have been able to figure out a method that should work, but now weird errors galore, lol.
using a dictionary approach to input the contents of the table,; however now my program in the middle of it gets a "mysql" not defined.

I imported like this at the top, was I incorrect?

import mysql.connector as MySQL
from mysql.connector import errorcode
import os
from csv import reader, writer
import random
import time
from passlib.hash import argon2
import csv
hollow basalt
#

can you like, send the whole thing

lone cairn
#

|| ```
#import from csv

import mysql.connector as MySQL
from mysql.connector import errorcode
import os
from csv import reader, writer
import random
import time
from passlib.hash import argon2
import csv

conn = MySQL.connect(
host='localhost',
database='LAB5',
user='root',
password='')
cur = conn.cursor()

cur.execute('DROP TABLE IF EXISTS users')

DB_NAME = 'LAB5'
TABLES = {}

TABLES['users'] = (
"CREATE TABLE 'users'("
"'ID' int(11) NOT NULL,"
"'firstname' varchar(45) NOT NULL,"
"'lastname' varchar(45) NOT NULL,"
"'email' varchar(45) NOT NULL,"
"'password' varchar(22) NOT NULL,"
"PRIMARY KEY ('ID')"
") ENGINT=InnoDB")

for table_name in TABLES:
table_description = TABLES[table_name]
try:
print("creating table{}: ".format(table_name), end='')
cur.execute(table_description)
except mysql.connector.errors as err:
if err.errno == errorcode.ER_TABLE_EXISTS_ERROR:
print("Exists currently")
else:
print(err.msg)
else:
print("OK")

#infile

infilecomp = open("data.csv")
csvReader = reader(infilecomp)

#next(csvReader)
#print
print("moving along...")

for row in csvReader:
try:
cur.execute("INSERT INTO users VALUES (%s, %s, %s, %s, %s)",
[row[0],row[1],row[2],row[3],row[4]])
conn.commit()
except:
break
#done?
print("Complete")

cur.close()
conn.commit()
conn.close()

#

haven't gotten to the hashing part yet, but I can get parts of this to work individually, but not as a whole lol

hollow basalt
#

which line is the error

lone cairn
#

39

hollow basalt
#
except mysql.connector.errors as err:

this one?

lone cairn
#

"excepts mysql...

hollow basalt
#

oh yea nice

#

oh yea nice, make me count 39 lines

lone cairn
#

I wrote it more for me to find the first words

#

I've the error code on another screen

hollow basalt
#

use

except mysql.connector.Error as err:
#

or in your code

except MySQL.Error as err:

Since you imported it as

lone cairn
#

Solid, thank you very much.

hollow basalt
#

So, does your code work now . anymore errors?

lone cairn
#

it works, but I'll be breaking it again when I try to add the part that hashes; before saving to the db

#

backing it up right now lol

hollow basalt
#

ok ok, see ya later when you break it or something

midnight wind
#

are you using git

#

if not, you should

#

not github, just plain ol git

#

@lone cairn

lone cairn
#

I'm getting chastised irl for not using git, so I'm now looking into git lol

low carbon
#

It's not fun at first, but it's way more fun than crashing a production server and having no way to revert

hollow basalt
#

crashing a production server and having no way to revert
I mean you rely on git for stability

midnight wind
#

@lone cairn so in your case, instead of making a current copy, you would just make a new branch and once it works, you would merge it into master.

hollow basalt
#

just create

#

projectv1.zip
projectv2.zip

west garden
midnight wind
#

@hollow basalt nah it's:

myproject
myprojectfinal
myprojectfinalfinal
myprojectfinal1
...

hollow basalt
#

ngl, we used google drive

#

cause back in my days, git weren't taught yet (not part of curriculum)

#

so i had to teach my teammates how to use git

nocturne galleon
#

Hellp guys

#

Im a newbie in programming branch

#

My uni gave us an assignemnt regarding it

#

we were asked to code for the pac man game

#

can anyone help ? or any ideas ?

worn relic
#

Does anyone know if the ursina game engine works with macOS?

hollow basalt
sacred mango
#

Anyone here into Unity Development?

nocturne galleon
hollow basalt
#

yea

nocturne galleon
#

you said you have an idea

#

lol

hollow basalt
#

you said you have an idea

pseudo nacelle
#

theres two examples with 20 sec of googlin

#

This video is part of a series in which I am using python and the pygame library to make a replica of Pacman. The editor I am using is atom and I highly recommend it even if you use languages other than python! You can treat this as a tutorial to follow along with and I Hope it helps. Feel free to comment below with any of your coding problems!!...

▶ Play video
#

just search for the programming lang you prefer

hollow basalt
ruby pewter
#

Hiya. Anybody around to answer a simple question?

hollow basalt
#

depends

ruby pewter
#

Basically

#

I have a very very very long line with a ton of code. Is there any tool online that'll separate each tag into a different line?
Like say I have: <div class="w-full sm:w-1/2 p-6"><div class="w-full sm:w-1/2 p-6"><div class="w-full sm:w-1/2 p-6">
Instead of it being in a line, I'd get an output with each of those in a diff line

#

I kinda did it with find n' replace using VSCode but I'd figured there's a tool that'll make that easily.

hollow basalt
#

so you just want to format your code

ruby pewter
#

pretty much

#

I've been downloading some svg illustrations but it gives me everything in one line and when I put it in my website it's a pain to modify the colors and stuff

hollow basalt
#

vscode should have that option

#

if not, check the plugins for "format code"

rotund plover
#

Notepad++ have it to if I remember correctly

#

I'm still looking for this option in vscode

nocturne mist
dusty ermine
dusty ermine
nocturne mist
quaint palm
#

is there a way we can contribute to the bot?

#

and what lang is it written in?

hollow basalt
#

assembly

quaint palm
#

sure

nocturne galleon
#

Wait why would u beautify vscode?

#

:/

quaint palm
#

bruh

#

why wouldnt u?

#

i made my own theme based off of monokai

nocturne mist
nocturne galleon
#

Is it dumb to call a function with the name of the class the function belongs to every time like: ClassName::FunctionName(). Or is it good coding practise
because my code ends up looking pretty messy with all the ClassName::

#
if (Rules::IsItOutOfBoard(MoveFormatting::oldx(BoardClass::ScanGetCordinatesW(x + counter, y)), MoveFormatting::oldy(BoardClass::ScanGetCordinatesW(x + counter, y))))
nocturne mist
#

I'd say the lack of line breaks is worse for readability than the class names.

nocturne galleon
#

how would you write it

nocturne mist
#
  Rules::IsItOutOfBoard(
    MoveFormatting::oldx(BoardClass::ScanGetCordinatesW(x + counter, y)),             MoveFormatting::oldy(BoardClass::ScanGetCordinatesW(x + counter, y))
  )
)```
nocturne galleon
#

thx

nocturne mist
#

That third line should be indented, seems Discord isn't liking it though.

pliant siren
quaint palm
#

@frigid magnet sus

#

u got banned

indigo plinth
#

In C, is unsigned from, unsigned to the same as unsigned int from, to?

crystal tundra
#

Yep

#

When adding extra words before int, u can just omit tge word int

frigid magnet
pseudo nacelle
quaint palm
#

@frigid magnet from twt

frigid magnet
quaint palm
#

lol

#

ok

rotund plover
#

Send us we wanna play

hollow basalt
#

@pliant siren I double this (let us play pacman)

#

if you can also give the source if that's aight

frigid magnet
# quaint palm ok

I know this is a little late but I feel like the ban was good since now I have to concentrate in real life and then I don't have more servers distracting me

quasi plover
#

so i'm learning c++ and i have no idea what's the difference between endl and n\

#

any ideas ?(exept that n\ can be included inside a string)

deep scarab
#

endl is just \n but with a flush as well

tired juniper
#

so I have an HTML question. How do you align the text in the center(in a table) in HTML but without it looking like a pyramid or something. I mean it's cool but I want to align the first row in the center and then every other under it. If I do align=center it just goes center for every text so it becomes like a pyramid

#

How can I align it in the center but like every text begins where the previous one does,without an indent?

bleak breach
#

@tired juniper got a photo of what you’re going for?

warm sleet
#

@tired juniper You're looking for CSS here, not HTML

#

align is a style

#

Though there are elements you can use for 0-width and merging cells

#

its the colspan property of a table cell

#

You will ultimately have to make a grid

#

like a 9x9 grid, and use colspan to merge cells

#

though using tables for alignment is a kind of dirty solution. div's are your friend

outer fjord
#

Hey! I want to make an app that tracks your app usage and analytics for a school project, but I'm new to app development. Do you guys know a useful guide for me to start with?

bleak breach
#

@outer fjord You probably need to start by choosing a platform you want to develop the app for. Android or iOS?

outer fjord
#

Android, for android 8.1 and up

bleak breach
#

tracks your app usage
Do you mean tracks usage of your app, or other apps on the device?

outer fjord
#

The other apps on the device, so social media and games that kind of stuff

bleak breach
#

If I've googled correctly you'll need to develop an android app that requests the android.permission.USAGE_ACCESS_SETTINGS permission.

#

Here's a tutorial to get you started: https://www.youtube.com/watch?v=Ob4vSoWud9k

Want to build your first Android app? In this tutorial series let's get started with Android Studio and app development. We'll build an inventory management app that allows us to add products, then list them so that we can scroll through them. This app will be created using Kotlin and not Java. Kotlin is the current and future of Android, and Ja...

▶ Play video
outer fjord
#

Thanks! Probably waited to long to start with this project. I have to finish it by the 8th of January

warm sleet
#

@outer fjord Code Academy has good tutorial on android

#

assuming you already know java, it has some good explanations on how android activities work

#

It also assumes you use Android Studio ofc

outer fjord
#

Yeah I'm gonna use Android Studio, but I'm new to coding, I know a bit of PHP but that is about it. Luckily my partner knows a lot more about coding

warm sleet
#

@outer fjord Android has a bit of a confusing API

#

the idea is you have an Activity, with elements you define in an xml file

#

you can then use code in the activity to make it do things, all elements you put on screen like a button, text input etc, are configured in the xml layout

#

Android has some good documentation on how this all works

outer fjord
#

I'm gonna look up some guides to get a basic understanding

spring pond
#

its still in development tho

outer fjord
#

so what are the benefits of Jetpack compose compared to Android Studio?

warm sleet
#

jetpack is just a framework to design apps with

spring pond
#

compose is just a library that runs in studio

#

what crystal said

outer fjord
#

Oh okay

warm sleet
#

It also uses kotlin instead of java

#

nothing wrong with that, Kotlin is a fine language

#

Compose is just nice if you want rich media applications

#

with lots of visual flare

#

Android window (activity) kit is a bit crude at times

spring pond
#

i believe that jetpack compose is just a declarative version of the android ui builder

warm sleet
#

yea

spring pond
#

it looks really similar to swiftui

outer fjord
#

Oh yeah, I'm gonna follow a basic guide so I get an understanding of Android Studio

spring pond
#

you definitely want to do that first

warm sleet
#

@outer fjord do you have a phone to test with?

#

If you enable developer mode, you can link it up with Android Studio

#

and run the app on the phone, debug on the computer

outer fjord
#

Yeah, Im gonna test the app on my Samsung A70

#

I've already enabled USB Debug on it

warm sleet
#

I hate building android apps, but for wildly different reasons

#

mainly because standard library in android is not the same as with java

spring pond
#

wdym

warm sleet
#

bringing all kinds of edge cases with it

#

and libraries that misbehave

spring pond
#

i havent actually built android apps but i was considering porting a currently in-dev ios app to android eventually

#

im hoping compose will be good enough to use by the time i start

warm sleet
#

And I mostly write enterprise apps in java

spring pond
#

swiftui definitely is not a finished product

warm sleet
#

and all the JavaEE interfaces don't exist on android

#

Not that you need them necessarily

#

but makes life easier

spring pond
#

what does java ee do? is it just a bunch of language extensions?

warm sleet
#

@spring pond JavaEE is just interfaces

spring pond
#

huh

warm sleet
#

they define a common interface between the application and the application server

spring pond
#

thats interesting

#

i would think there would be more

warm sleet
#

the idea is that things like databases, rest services and all that crap, is not handled in user code

#

but by the application server instead

#

so you just request an instance of an interface, and dont care how it gets created

spring pond
#

ok

warm sleet
#

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 architecture with this design inverts control as compared to traditional pr...

spring pond
#

im probably just gonna try to learn kotlin for android and hope it goes well

#

from what ive done before its quite similar to swift so thats nice

warm sleet
#

@spring pond the benefit of JavaEE is that everyone uses it

#

so any library that has to work with enterprise stuff, uses JavaEE

#

and you need less glue code

#
Inversion of control serves the following design purposes:

To decouple the execution of a task from implementation.
To focus a module on the task it is designed for.
To free modules from assumptions about how other systems do what they do and instead rely on contracts.
To prevent side effects when replacing a module.
spring pond
#

considering your comment that the code is "not in user code" does that mean that ee is server-side only?

warm sleet
#

nah

#

user code, is code within your own project

spring pond
#

ah ok

warm sleet
#

If you develop servlets, you just ask for database access

#

and the servlet host, Tomcat, Glassfish, or whatever, has implementations for that

#

so it dont matter if you use MySQL or OracleDB

#

javax.ws.rs is the interface you can use to develop rest services

next igloo
#

In JavaScript, is there a way where you can get the center of an object

#

$(“#Thing”).position().top does not work because the object is rotating and pointing to the cursor

#

Which means even though the center has not moved, the top-left corner has

vestal glen
#

you can get the bounding box and calculate the center from that, probably.

quick meadow
#

Does anyone use ue4 here?

bleak breach
#

A little

wind oracle
#

Could someone here help me with java ?

spring pond
#

ye

wind oracle
#

alright I need to sort a int[] that's full of numbers from smallest to biggest

#

using a for loop and positions

spring pond
#

well you could just use a sorting algo

wind oracle
#

public static void intExchange(int[] table, int pos1, int pos2)

#

thats all he gave us

spring pond
#

what are pos1 and pos2 supposed to be

#

are those clamps?

wind oracle
#

positions

spring pond
#

but what are you supposed to do with them? are they meant to represent the bounds of a subarray or what

wind oracle
#

huh the positions of the smallest ones I think

spring pond
#

are you supposed to swap pos1 and pos2 in the array? thats what would make the most sense with the header

wind oracle
#

I think im supposed to out print

#

it just out prints the list of "players"

spring pond
#

so do you want to sort the players based on an attribute?

wind oracle
#

based on the amount of goals

#

which is nbBut[]

spring pond
#

i'm not sure how far along you are in cs, but i'd strongly recommend making an object out of all of these players

wind oracle
#

how can I do that

spring pond
#

let me make an example real quick

#

can you translate the names of those arrays

wind oracle
#

huh yea

#

nomJoueur = playerName

#

pJoue gamesPlayed

#

nbBut ammountGoals

#

nbPasse ammountPasses

#

points = points

#

minuteP = minutesPlayed

spring pond
#

ok, working on it

#

@wind oracle

class Player {
  private String name;
  private int gamesPlayed, goals, passes, points;
  private long minutesPlayed;

  Player(String name, int gamesPlayed, int goals, int passes, int points, long minutesPlayed) {
    this.name = name;
    this.gamesPlayed = gamesPlayed;
    this.goals = goals;
    this.passes = passes;
    this.points = points;
    this.minutesPlayed = minutesPlayed;
  }

  public String toString() {
    return padLeft(name + " " + gamesPlayed + " " + goals + " " + passes + " " + points + " " + minutesPlayed, 35);
  }

  public String padLeft(String s, int n) {
    return String.format("%" + n + "s", s);
  }
}
#

now you can turn your old arrays into an array of objects and then use a sorting algo to sort by goals

warm sleet
#

@wind oracle you can use objects to group data together

#

and have them represent some concept

#

like a Player has properties such as name and gamesPlayed

#

so given the code that @spring pond posted

#

you can do things like:

Player[] players = { new Player("name", 1, etc), new Player("name2", 2, etc) } 
#

but at this point, I would recommend using lists, its much easier

#

List<Player> players = new ArrayList<>()

#

you can then players.add(new Player(...));

#

Arrays cannot change in size, but Lists can