/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

en.wikibooks.org/wiki/Haskell
ocaml.org/learn/tutorials/
kotlinlang.org/docs/reference/coroutines.html
twitter.com/SFWRedditVideos

Learning Scala

A cross platform smart contract programming language.

Making Ponzi schemes and MLM scams accessible for everyone, I see.

fuck off commie

There's nothing commie in cross platform language you tool.

there's everything commie in cross platform language you tool

Erlang is the only true OOP left

a more convenient launcher for downloading mods and then using them for an old sonic doom based fangame

eolang*

>Rust doesn't even have variadic generics
LMAO

Rust doesn't even have generics.

Don't delude yourself, now.

Reminder that if your so-called "systems programming language" can't be used to write an MBR, then it is not a systems programming language.

MBR in js when?

mbr.js

Rust doesn't even have pi types.

And I can guarantee you that "pi types" are 100% useless, now go back to jacking off to your completely useless academic languages, retard.

It's literally just templates with parameters that aren't types senpai.

One of the most useless gimmick that gets shilled here for no reason. D has had it for ages, C++ only got it this year.

C++ still lacks a few major things too. Fuck off.

what do people recommend for learning opencv?

The wiki is down right now. Where should I start if I want to learn to program?

Is there a clever algorithm that gives out a sequence of RGB values that look nice and have good contrast next to each other?

>C++ only got it this year.
C++ had variadic templates since C++11.

Alcohol.

is there any better alternative?

Ether.

Useless without fold expression

Every time I've tried to learn to program I get bored to tears and lose motivation. Is there any saving me?

You're speaking to a rust homosexual, truth is relative to these kind of people.

stupid furry

the comic is the new loss
catch up with the times newfag

>if you aren't a furry then you're a newfag
shut up furry

shut up newfag

How the fuck do I name an application?

Please respond

en.wikibooks.org/wiki/Haskell

Install OCaml and ocaml.org/learn/tutorials/

How about naming the application after one of your ancestors?

How can I improve this hash function?
With the tableSize at twice the size of what the user inputs, I'm getting roughly 10% collisions which seems a bit high.
int hashCode = 13;

for(int i = 0; i < word.length(); i++)
{
hashCode = hashCode * 23 + word.charAt(i);
}

if(hashCode < 0)
hashCode *= -1;
out.println("Hascode is: " + hashCode);
return hashCode % tableSize;

does big o represent the time it takes for something to run?
so if something is o(n) what does that mean? that it executes n instructions or it takes n time to run or what?

big O and small o aren't the same
it represents the growth

a function f(x) is O(g(x)) if it grows no faster than g(x)
It might be time or space (memory)

O(n) is an ideal measure of the worst case efficiency of an algorithm. If an algorithm runs in O(n) time, at worst, doubling the input size will double the time taken. If it's O(n^2), doubling the input size could quadruple the time taken, and so on. Typically, time is measured in terms of instructions executed on an abstract machine, so it is only a rough estimate.

only 'number of steps' not the time of course
O(n^2) in cache memory can be faster then O(log n) in RAM

(or anything else, also it could be upper, lower, average bound etc)

f(x) is o(g(x)) means that f(x) grows strictly slower than g(x)

Whats the role of a string scoring function that measures how likely a string is meant to be apart of a name or address.

And how would you solve it using dynamic programming?

Learning Kotlin

why

It's sexy

>that feel when you read two chapters about programming concept but didn't understand anything and now have to re-read everything

no, it's heinous

learn Haskell

such as what?

>huge support
>compatibility
>speed

you shouldn't rush. take your time and write foobars every time you finish a chapter.

f(x) is o(g(x)), if for all epsilon greater than zero, a punctured neighbourhood of x_0, which is U(x_0), is found, that for every x in U(x_0): |f(x)| < epsilon * |g(x)|.
lim x -> x_0 |f(x)|/|g(x)| = 0.

e.g.
x^2 = o(x) if x -> 0; since lim x -> 0 x^2/x = 0.
this also remains true: o(x^2) + o(x^2) = o(x^2) if x -> 0.

Fuck me, I am an autist.

Does your favourite language's type system allow you to write a y combinator? Oh, it doesn't? That's okay, I guess blublets like you don't really need the power and elegance of untyped lambda calculus; After all, you really only write fizzbuzz programs all day anyway.

Wise choice, sir. Wise choice.

how hard is it to convert a working c++ command line app to work on Android?

what are you doing in kotlin?

You will have to rewrite all platform dependent code from scratch. If your c++ program does not use network then it's not that bad. If it does and you have no experience creating android network apps then you are fucked.

Android apps and backends.

build a tool that takes a c++ project and trans piles it to an android project

link the GitHub project here when you're done

why is there a bunch of async annotations?

is that really necessary?

Those are suspending functions aka coroutines.
kotlinlang.org/docs/reference/coroutines.html

what if it's standard c++14 and the network part (really just a periodical download of a html file) will be handled by something else?

i've built a bunch of apps in android using raw Java, but i don't think i will ever get to your level (assuming its good)

>build a tool that takes a c++ project and trans piles it to an android project
but I don't know shit about android right now so it has to be somebody else

You just need impredicative polymorphism.

but why do you need this?

>and the network part (really just a periodical download of a html file) will be handled by something else
By something else you mean http library? Yes, you can do that but still there are lots of pitfalls. Like, your app can be killed by the OS while you are doing network request thus causing memory leak. Or user can rotate the phone while you are doing network request and this will cause a memory leak as well.

I have 2.5 years of experience with android but I don't think I'm that good. Still have a lot of shit to learn.

because I need the same capability I have on my PCs on a phone too

but what does the app do?

some calculator?

>Or user can rotate the phone while you are doing network request and this will cause a memory leak as well.
I'll be the user, but wtf? why would it do this?

yeah but it's kinda advanced, like if I had to rewrite it in java it would take days

Daily reminder that /dpt/ means
Daily
Programming
Thread

if (true) big();

>why would it do this?
Because android kills activities (or like windows with UI) on device rotation (destroys and then creates them again). It can also kill activities when there are lots of other apps running and OS doesn't have enough memory available. Android can even kill the whole app. But, if you are the only one who will be using that app then it should be fine. You can also disable orientation changing for your app.

This.
Stop making a new thread less than 24h after the old thread.

Also, Android is asynchronous by nature, so if you have never written asynchronous code it will be another pitfall.

>Because android kills activities (or like windows with UI) on device rotation (destroys and then creates them again).
Insanity.

Does iOS do this?

AFAIK no, it doesn't.

Android should copy the idea probably.

I'm sure people have noticed this but don't complain

Hi. Absolute newbie here. Quick help with visual studio please, adding pictures to excel sheet cells.

I've got two buttons, one prompts for the picture and the other loads it into the sheet. However I don't know how to add them on different cells, the pictures are loaded on top of another.

Private Sub btnSaveImage_Click(sender As Object, e As EventArgs) Handles btnSaveImage.Click

myworksheet.Shapes.AddPicture(Filename:=Image1, LinkToFile:=Microsoft.Office.Core.MsoTriState.msoFalse, SaveWithDocument:=Microsoft.Office.Core.MsoTriState.msoTrue, Left:=0, Top:=500, Width:=240, Height:=200)

End Sub

This is the code for the loading button. How do I make it so each picture is loaded next to each other rather than on top of another?

Well, there are workarounds. Like, you can use singletones to hold objects that you don't wan't to be destroyed on device rotation. There is also a new library by google themselves that provides you a class (ViewModel) which you can inherit from and that class won't be destroyed on device rotation (activities are still being destroyed anyway).

...

>Insanity
No, that's what code monkeys (ie. google coders) do when they face a problem they don't understand.

I'm trying to get into a promotional video card (a card that plays a video when you open it). It was solder pads on it, labeled GND, R, L and PA, anyone knows what that's for?
also it allows you to put in other videos via usb, is there a way to access other storage through that?
Has anyone ever worked with melis 2.0 OS?

GND = ground

R = Ribosome
L = Lebosome
PA = Power Adapter

>tfw you get stuck because something that ought to be dead simple doesn't work as you expect

Learn here.

brainlet
switch to javascript

reminder that x86 assembly is the only good programming language

asslel is shit

haha shit i figured it out

better to comment out things you're temporarily "overwriting" so you don't look in the wrong place

fucking damnit I'm sick of working with brainlets who complain about the use of any slightly advanced feature in a programming language

I tested and they're the same but want to confirm:

SELECT lkdjsf FROM abc JOIN def ON lskdjf
==
SELECT lskdjf FROM def JOIN abc ON lksjdf

Of course they are the same, are you honest to god fucking retarded

this memory editor