/dpt/ - Daily Programming Thread

Old thread: What are you working on, Sup Forums?

Other urls found in this thread:

latkin.org/blog/2017/05/02/when-the-scala-compiler-doesnt-help/
wartremover.org/doc/warts.html
scalapuzzlers.com/
qt.io/licensing-comparison/
youtube.com/watch?v=IqiXMN03968
twitter.com/SFWRedditGifs

Threadly reminder that dlang-chan is not dead, and she's super duper cute and fast! Say something nice about her, /dpt/!

about to a start a program that monitors RSS feeds for activity and posts links to a discord channel

user who posted this a while ago, are you still here by any chance?

I really like your std.range D-chan.

but muh rust

Thanks, user! She's pretty confidant in her standard library. (Just don't mention the GC, please.)

...

I want to make a program using QT creator but it looks like I have to sell my soul to use it. Apparently theres a way of only having to do that with the qt code but it requires using obj files or something. Anyone know how to use qt without having to make the project open source

shut up you goddamned weeb

buy a license

i'm pretty sure Qt is GPL so no

Use wxWidgets. It's licensed under a modified LGPL.

Anime website, user-kun!

Please recommend me a small to medium sized project that is able to be completed in a reasonable amount of time while being written in the C programming language.

write a kernel

>reasonable amount of time
How much?
We don't know your ability either.

Please recommend me a small to medium sized project that is able to be completed in a week or two working part to full time on it, being of an average experience level, and written in the C programming language.

write a kernel

I think I remember reading that the Qt license is different depending on whether you statically linked it or not in your executable.

>average
Depends on what your definition of "average" is.

Averaging 2 integers in C.

Since I can average an arbitrary number of integers, does that make me a pro?

He means like 4 weeks.

implement naive bayes classifier

Lisp or ML?

Dude that boy/girl in the picture looks disgusting. Pick another anime character if you must but please none of that

>Averaging 2 integers in C.
That's impossible

True.

false

My usual programming language is Python. For the server side of my new web app, I want to try a new programming language. Any ideas? rust? go? node? D? racket? chicken scheme? haskell?

>inb4 web dev general
I don't care about js/css/html

#include

int main(void)
{
printf("I\n\t\"RUSH\"\n\t\t\\TO\\\n\tAND\n/FRO/");
return 0;
}

Image quantinizer, there is a lot of pretty interesting stuff you can come up with.

#include

int main(void)
{
printf("sizeof(short)=%d\nsizeof(char)=%d\nsizeof(int)=%d\nsizeof(long)=%d\nsizeof(bool)=%d\nsizeof(unsigned)=%d)", sizeof(short), sizeof(char), sizeof(int), sizeof(long), sizeof(bool), sizeof(unsigned));
return 0;
}

If you love python you will love D, it has the same level of productivity

Scala was a mistake

latkin.org/blog/2017/05/02/when-the-scala-compiler-doesnt-help/

> #include
You have no idea what you're doing, do you?

I've recently read about generators and wanted to try them out in my recent problem, but for some reason they do not work:

def critPaths(G):
# Find all nodes with no predecessor
for node in G:
if node.start == 0 and not node.prev:
critPath_rec(node, [node])

def critPath_rec(node, path):
print("hello")

# If there's no successor
if not node.next:
print("Critical path: {}".format(path))
#yield path

# If there exists a successor
for i in node.next:
if i.start == node.end and i.start is not None \
and node.end is not None:
critPath_rec(i, path + [i])

critPaths(G)


The code works perfectly fine if I comment out the yielding line. It prints all critical paths.

However once I add the yield, it no longer prints anything - no hello, no critical path and it returns NoneType generator.

It saves time. Im just doing really simple exercises for the hell of it
#include

int main(void)
{
printf("Number :: Root\n4 :: %f\n12.25 :: %f\n0.0121 :: %f", sqrt(4), sqrt(12.25), sqrt(0.0121));
return 0;
}

God, subtyping polymorphism is a mess. I'm glad Rust doesn't have this shit.

OOP belongs in LOO

True and false => true

>=>
That's the wrong symbol mate. It's just a "single" right arrow ->.

>>=

More proof that Scala is a mess:

wartremover.org/doc/warts.html
scalapuzzlers.com/

'>=>' is itself a wrong symbol.
'->' is equivalent to '=>'.

if(!true)

Actually, there are probably shitloads of different conventions for logic symbols.
I just learned that -> was a logical operator, and => was more for saying that one equation implies another.
So when dealing with a boolean expression, it would be like ((A ∧ B) → C) -> (¬A ∨ ¬B ∨ C)
and when dealing with a mathematical equation, it would be something like 2a = 2b ⇒ a = b

-> is either a function 'arrow' or implication, which are really the same thing.
>and when dealing with a mathematical equation, it would be something like 2a = 2b ⇒ a = b
They're still the same concept though. I just prefer the => symbol.

>They're still the same concept though
Yeah, the difference in the definitions I learned is extremely subtle and not very important, and it would really just be arguing semantics at this point.

Should my language have any other numbers besides reals? But then it won't have comparison operators, so maybe I should add something like an unsigned 8 bit int?

It really depends on the nature and purpose of your language. Lua got away with only having doubles for a very long time, and only added actual integers in the latest version for whatever reason.
>But then it won't have comparison operators
Sure you do. You just can't trust the equality operators that closely for non-integer arguments.

we don't need reals where we're going

Is there any guides to assembler learning?

>It really depends on the nature and purpose of your language.
Non-Turing complete systems programming.
>Sure you do.
Comparing arbitrary real numbers is undecidable though. Which is why I would need to add another number type.

>Non-Turing complete
>Not a DSL
Oh, you're just a stupid memer. Sorry that I actually replied to you seriously.

Hey, guys. How to star freelance work? I really need food, guys. I know C/C++ and C# a little bit. HEEEELPP MEE1.
Thanks.

>Not a DSL
Systems programming isn't general purpose. But I don't see what would prohibit me from making it general purpose. In most cases you don't really need to be able to compute every possible function.
>memer
Sorry, but what's a "memer"? The word "meme" makes no sense in this context.

Try Go. It's widely used as a faster Python replacement.

:^)
typedef struct x {
volatile int ix;
volatile float fx;
float gfx() const { return fx; }
int gix() const { return ix; }
} x;

int main(void)
{
x v;
v.ix = 5; v.fx = v.ix/2;
printf("%d:%f", v.gix(), v.gfx());
return 0;
}

upwork?

What's up work?

>typedef struct
>Sepples
Stop being an idiot and write proper C code.
Also, go learn what truncation is.

How do I learn to write proper C codes?

By writing C and not C++.

You seem very angry for 0 reason

qt.io/licensing-comparison/

Posting in a slightly aggressive tone does not mean that someone is angry, you goddamn fucking normalfag redditor scum.

It's happening!
youtube.com/watch?v=IqiXMN03968

Literally who cares?

You

Has anyone used Laravel + Voyager yet? I'm trying to make a simple checkout/subscription platform. So far beating my head against it.

The recent DIPS are pretty neat, hope they go through.

I'm trying to learn C++ and am fucking around with pointers.
I want to have an array filled with other arrays, but starting at some index.
I know this is stupid and shouldn't be done, but It's just for practice and I want to know how I am fucking up regardless.

Object **foo = Object*[a];

Object **bar = { foo[b], foo[c], foo[d]; }

for( int i yada yada){
for( int j yada yada){
(bar[i] + j)->DoStuff();
}
}


This compiles and runs without crashing, but when I access values in objects I get complete bollocks back, save for when j is 0.

>Laravel
Why?

>I want to know how I am fucking up
The first word in your source code.

If you are new, then make something you know how should work and implement it.

Embedded:
make gas station. Write drivers for different peripherals, so you have a keyboard, a screen, a motor for the pump etc. This is scalable to the degree you want.
These are some of the things I did when I was new to programming.

General desktop applications:
make a data structure, I suggest an AVL tree.

Learn AI:
Make a game AI for some simple game.
Evolutionary neural networks is fun and easy to implement.

Make an image filtering application.
If you want to do everything yourself, use gimp to convert images into ppm and then load those.
But you could also make a jpg loader if you want to spend the time.
If you don't mind loading libraries, then you can use the webcam in your laptop and have the filtered image displayed in the screen.
Having a program that is running continuously is a good learning experience as well.

Make a wireless network using a speaker and a microphone.

That is not the code, it's cleaned and abstracted.

What a shitty character to pick as language mascot.
I dislike D even more now

Still better than lisp alien.

Not him but could you elaborate on the gas station? That caught my attention.

Post the original then.
>sepples
>either clean or abstracted
That doesn't seem possible.

Because I want to call myself Code Artisan irl

haha xd just use C amirite

Enjoy the mess.

void DrawTiles(sf::RenderWindow *window, View *view){
int width, height, leftOffset, bottomOffset = 0;
Tile center = *(view->Center);
Tile** tiles = center.tZLevel->GetSquare(center.GetX(), center.GetY(), view->Range, &width, &height, &leftOffset, &bottomOffset);

for(int y = 0; y < height-bottomOffset; y++){
for(int x = 0; x < width-leftOffset; x++){

std::cout

I'm just trying to pick up the basics on Python and HTML/CSS so I can make a website and compete with my siblings.

...

I'm working on a problem in RUBY that is wrecking my head if anyone cares to help, basically I need to read a json file and pass its variables into a method's input parameters as hash values:

# Turn this example json
{
"name": "myName",
"colorsArray":[
{
"colorName":"red",
"hexValue":"#f00"
},
{
"colorName":"green",
"hexValue":"#0f0"
}
],
"useColours": true
}


# Into something like this
method(
name: "myName",
colorsArray: [
{
colorName: "red"
hexValue: "#f00"
}
{
colorName: "green"
hexValue: "#0f0"
}
],
useColours: true
)

# By doing something like this
method(parsedJson)

The example json file is far more simple than the one I'm actually working with, the json file can have any number of variables and nested arrays of data in nested arrays of data, even up to lists of 100+ variables and I need to be able to pass it all into the method input parameters no matter whats in the json file.

No this is not homework, I'm just new to Ruby and have never come across something like this before and it's been holding me back from more important work for a while.

Thank you

Writing pong in C with SDL2

Use code tags, faggot.

Read the sticky.

Do we kode on thursdays?

Language: Python

if user == USERNAME and pswd == PASSWORD:
return True
return False

How to write in a more sane way?

>haha xd
>amirite
>C
No, it's trash as well.

return (user == USERNAME and pswd == PASSWORD)

Didn't think it would matter for such small and simple code

Even if it's a single line, use them.
Trying to read code without nesting is an annoying experience and most people aren't even going to bother.

It's annoying to read, and you could have literally just hit Alt+C to generate code tags before pasting.

(OP)
I'm working on a problem in RUBY that is wrecking my head if anyone cares to help, basically I need to read a json file and pass its variables into a method's input parameters as hash values:

# Turn this example json
{
"name": "myName",
"colorsArray":[
{
"colorName":"red",
"hexValue":"#f00"
},
{
"colorName":"green",
"hexValue":"#0f0"
}
],
"useColours": true
}


# Into something like this
method(
name: "myName",
colorsArray: [
{
colorName: "red"
hexValue: "#f00"
}
{
colorName: "green"
hexValue: "#0f0"
}
],
useColours: true
)

# By doing something like this
method(parsedJson)

The example json file is far more simple than the one I'm actually working with, the json file can have any number of variables and nested arrays of data in nested arrays of data, even up to lists of 100+ variables and I need to be able to pass it all into the method input parameters no matter whats in the json file.

No this is not homework, I'm just new to Ruby and have never come across something like this before and it's been holding me back from more important work for a while.

I swear Ruby has a readjson that converts it to an appropriate dict

I think there is something like that, but I for the kids of me can't figure out what exactly it is