/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

pastebin.com/XWzyPSy9
twitter.com/SFWRedditGifs

You're retarded.

Who here has experience with ORMs? Specifically SQLAlchemy.

pastebin.com/XWzyPSy9

How the fugg do I remove deleted object from ORM's?
Deletion from the actual DB is successful, when it still remains in the Session. I have tried to do `session.expunge(original_object)` - exits with an error, if this line goes after `session.commit()` or does nothing, if is put before.

Running tests with pytest.

Working through the K&R exercises, all is well. Thanks for recommending it to me Sup Forumsoys.

Programming dat fizzbuzz

Whatever you day, blublet.

What is Python good for?
What can i do with it?

Throw together quick scripts without having to think even the slightest

literally pseudo code
also lots of (good) libraries

It is just a script language? I can't do powerful shit with it?

I really wanted to create an executable or something, the only way to make a pseudo executable gives me a 200mb files (more if you use various dependencies).

What's the closest thing to python that i create executables without the user having to install a library or something?

What's a good pace to work through Kernighan and Ritchies book? Is it the kind of thing where I should be skipping stuff that seems trivial to me or should I be thorough?

What are some good, easy to learn and lightweight alternatives to SQlite for C and Python development?

C# probably, seeing that you are a wincuck.
2.335234234 pages a hour.

very interesting jape

>200mb
i doubt it. py2exe/cxfreeze aren't that big.

you can do lots of things with python, it just depends on whether it's the right tool for the job or not. sure packaging is (one) of the issues of using it (especially on windows), but it doesn't mean it can't be done.

I wish I was a Japanese girl.

You can even make Chrome extensions with it.

Is /dpt/ kill?

What's wrong with Agda?

Does anyone have any cheatsheet for python in blender?
I know about bpy.ops.wm.operator_cheat_sheet() but a graphical version would be so much easier to understand, even if it was simplified.

It doesn't have to be anything fancy, I didn't manage to find anything unfortunately, would be really grateful if you could help

Coming from C to Python

index = 0
for line in questions:
questions[index] = line.rstrip("\n")
index += 1

Is this too C-like?
I thought line = line.rstrip would work but it doesn't

You can do for index, line in enumerate(questions):
questions[index] = line.rstrip('\n')

but if you are reading from file and don't want the newlines you can just do questions = file.read().splitlines()

Wouldn't this work?
questions = [line.rstrip("\n") for line in questions]

Thank you
Yes I was reading from a file, combining read and splitlines seems the best option. Cool that you can do all this in a single line.
It's also kinda confusing right now though.

I tried to learn C with K&R but ended up switching to K.N. King's C book, and I'm happy with the choice I've made. I felt like K&R rushed over things too quickly, without enough comprehensive detail or exercises to get me used to the information. K.N. King has a lot more exercises and includes C99, which I'm happy about.

Hey guys, What IDE should one use for Java? Ive been using eclipse, but last week while browsing i saw someone using one that had this neat drag and drop gui thing? Anyone know what im talking about? Anyone have other IDEs to suggest?

>drag and drop gui
Probably Netbeans, however I think there's a plugin for that in Eclipse. People say the Jetbrains one (forgot the name) is pretty good too, might try it out.

Thanks user. Im still really new to this, and uni so far has only tought us how to code the gui from scratch. This would save me so much time. When I get home from the office, I will give that a try.

>that image
kek

Anyone of you already used the function EXPLAIN PLAN FOR in oracle sql ?

If I run it, the tab "explain" doesn't show me anything, and when I use SELECT * FROM PLAN_TABLE; or SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());
it doesn't seems to be the right query explained

if I click on "automatically save trace" it tells me I don't have the rights to do it
>failed to access V$MYSTAT
>get read rights of the catalog from your admin.


Any idea ?

nice blog.

But a few anons already pointed in this board that K&R was actually made for people with a past of programmer, and wasn't very nice for complete beginners, even if some people might be comfortable with it.

Iteration is always more efficient than recursion?

Well, sometimes a good compiler can do TCO to compile recursive code as iterative, so a better way to put it would be "iteration is never less efficient than an equivalent recursion".

Working on a CRM for iOS. Basically, I am really bad at keeping in touch with friends and just want reminders to call, email, text, or linkedin message people, as well as tracking to see the last time I did any of those actions.

I am also going to law school and want to make sure that I work my network fully. I keep looking at what's available, but CRM is so expensive or too heavy for what I want. It's a frustrating space.

>install eclipse
>add tomcat server to project
>add axis 2 facet to project
>create hello world class
>generate axis 2 service from class
>start server
>deploying web service HelloWorld
>localhost:8080/axis/index.jsp is 404
is this why Sup Forums hates java?

Neah Sup Forums has legitimate reasons to hate Java, you just suck at it.

Is shell scripting programming?

If so, I am working on a powershell script that will grab the contents of a directory and compare filenames up to the first whitespace character. I'm not super familiar with string manipulation in powershell. I think I need to use regex.

Also, my dumbass just found out you can do .\ in powershell like ./ in bash lmao.

Learning the CLI metadata format to parse .winmd files to generate WinRT bindings.

Is Atom good?

People actually use powershell?

if you enjoy waiting and using excessive memory

VSCode manages to use Electron without being complete trash.

Is it slow?
Unless it's leaking memory like sieve, I don't think a little unnecesary memory usage is something I'll notice.

yes, slow and bloated
VSCode is basically Atom done right

I think most windows sysadmins do.

>VSCode is basically Atom done right
Care to offer more detail on this?

Guess I'll have to try VSCode

I DON'T KNOW HOW TO USE PARALLELIZATION FOR CLUSTER COMPUTING REEEEEEEEEEEEEEEEEEEEE

It's literally just a better editor in basically every way

in fact i think the only one thing atom does better is config UI vs json config, but you'll rarely be changing it anyway

>No overloading
>No virtual methods
Jesus christ. Enjoy writing impl'ing 15 traits by hand for each struct.

Overloading is incompatible with type inference. Virtual methods are suboptimal.

VSCode's addons are better.

>VSCode is basically Atom done right
Wrong. Atom uses piece table and VS Code uses rope, which is an inferior data structure for the case at hand. But alas, microsoft fanboys don't know what they are talking about.

That's not very enlightening. But thanks, I guess.

>Enjoy writing impl'ing 15 traits by hand for each struct.
Rust is trash, but your objection is bizarre. What's stopping you from having just one trait with all the relevant "virtual methods", just like you would have then in one class in C++?

To add, GNU/Emacs uses gap buffer, which is insanely faster but it's not optimised for multicursor edits.
That's not how you write C++

>Virtual methods are suboptimal.
Being a Rust dev is a mental illness... It's like you're not even trying anymore. Your answer to any perceived weakness is to screech "it isn't needed anyway!"

just have a function as a field man

...

He is right though, statically dispatched functions are faster than dynamic dispatch. Method lookup is expensive.

>That's not how you write C++
Are you retarded or something? You can have a trait with multiple functions just like you can have a class with multiple virtual methods.

Not to mention they can be generic without boxing.

...

Why are you posting your selfies?

Haven't looked into the specifics of their buffer implementations, but my guess is that whatever VSCode loses with pointer indirection for the rope, it more than makes up for by not having to run what is effectively an entire web browser.

The anti-Rust shitposter is getting more and more deranged by the day, it's quite funny.

That makes 0 sense.
Furthermore, VS Code derives from atom-shell too.

Typical discussion between C++ fucktards and Rust fucktards:
>sepples monkey: durrrr rust doesn't even have virtual method so you have to implement a separate trait for each one!
>rust money: huurrrrrrrrrrrr virtual methods are BAD! why would you ever want dynamic dispatch if you can have static dispatch?

bumping

>rust money

Why else do you think we shill rust?

>He is right though
He isn't, though. Virtual methods are suboptimal? Compared to what? Dynamic dispatch being slower than static dispatch has absolutely no bearing on the optimality of using virtual methods.

The difference is that one is wrong and one is right.

>durrr he made a typo, so funny

> Virtual methods are suboptimal?
Yes. Inherently. Method lookup is not free of cost. Unless, you are doing anything compile-time that is.

>The difference is that one is wrong and one is right.
Neither is right, both are plainly retarded, and each one thinks the other one is the retard. I guess it's just what happens when basement dwellers decide to LARP as system devs.

>people still use OOP

This has got nothing to do with systemdev

>Yes. Inherently.
Floating point division is suboptimal. It takes more cycles than integer addition.

Helps your project remain maintainable and more organized

>Rust doesn't have virtual methods so you have to implement a separate trait for each one
Incorrect.
>virtual methods are suboptimal to statically dispatched methods
Correct.

>OOP
>maintainable
>organised

>trying this hard

The apt analogy would be using floating point division and rounding to perform integer division. In which case, yes, they would clearly be suboptimal.

Virtual methods are dynamic dispatch only, trait methods are static when they can be and dynamic if they must be. Hence virtual methods are suboptimal for doing the same thing as Rust methods.

Pick any C project, and wonder why it slowly becomes an unreadable mess. Hence wonder why the maintainers try to emulate OOP.

FP is significantly more maintainable and organised

Newfag at OOP here.
Been learning vtable in C++, why vtable get resolved in runtime? Isn't the linker could link the proper method with proper class in compile time?
for example:
class shape{
protected:
int x;
int y;
public:
virtual void move(int xp, int yp){
this->x += xp;
this->y += yp;
}
};
class circle : public shape{
int radius;
public:
void move(int xp, int yp){
this->x += xp * xp;
this->y += yp * yp;
}
};
class rectangle : public shape{
int lenght;
}
};

int main(){
circle foo;
rectangle bar;
shape * baz = &foo;
shape * baa = &bar;
baz->move(2,3);
baa->move(2,3);
return 0;
}
Isn't that obvious in compile time which function will be called on which instance?
Why the linker couldn't do that?
Why the name mangling couldn't just mangle the virtual function name to other name to make the linker able to find which function to link to?

>Performance penalty

not much more than OOP, virtually none if you're doing impure FP

Oh fuck I made a typo in the rectangle class

compiler can't always tell

Paradigms don't have inherent performance penalties.

>No virtual methods
What are trait objects

>paradigms depend on performance penalties

Who are you quoting?

Since you're clearly a couple of retarded children, let me spell it out for you: dynamic dispatch isn't "suboptimal" compared to static dispatch because it does a different thing, so your comparison is inherently invalid. A particular use of dynamic dispatch may be suboptimal if it can be avoided, but if you need dynamic dispatch, then you need dynamic dispatch.

>Virtual methods are dynamic dispatch only
class Foo {
virtual void bar() {
}
}

int main() {
Foo foo;
foo.bar();
return 0;
}

What makes you think a compiler can't tell that there's no dynamic dispatch needed in this case?

>the compiler will optimize it out bro haha just trust the compiler haha

bar does not derive from anything, idiot. Come back when bar is below 10 layers of inheritance

Why?
Why couldn't the compiler generate the vtable like usual, but the linker resolve the vtable and link the function properly in compile time instead of runtime?

You probably think you are a smartass too.

If you try to use the type behind a reference or pointer the compiler can make no such assumption.