/dpt/ - Daily Programming Thread

Old thread: What are you working on Sup Forums?

Other urls found in this thread:

pastebin.com/izNXZAsb
doc.qt.io/qt-5/android-support.html
rextester.com/ZPEC94872
rextester.com/live/UOFGM88429
codeshare.io/
twitter.com/AnonBabble

I wrote a desktop app in C++ and Qt, I'd like to convert it to use on an Android phone. I never wrote anything for mobile. What do?

trying to do day 3 of AoC in befunge98

99*:00"tupni"i$$>v ;stack has number of lines left on top;
&&&64p44p24p 24g44g64g v
v g44 g42g44g46 <
A B C 6 C + B < A
4 A + B < C
g A + C < B
2
4
g
+
`
!
^$$$$$$ _v
pop +
extra `
values !
^$$$ _v
+
`
!triangle checks out
^ _48*:1g1+:.0pv
^ <
for some reason ip never
reaches these last two options

there's an extra debug :. on line 2 of this file
(coord (1,16) and (1,15))

run like so:
$ cfunge advent03.bf < input
it requires that the input file be named "input"
as well as that the input file be redirected in on stdin

I'm at the point in debug hell where I think I just need to sleep on it.

Anime /dpt/ is best

Holy fuck, the network file is 52 megs haha, no wonder It can't load or something

Daily reminder that Java and C# are the only relevant languages.
Don't fall for Haskell and C memes spreaded by NEETs.

>relevant languages

I think you meant Javascript and Python, grandad

material cancer

I'm new. Is what this poster saying true?

No, C is the only language you need. Everything else is a waste of time.

>tfw paid to use OCaml

If you want to get a job then yes, not many companies need C/Haskell experts while Java and C# are one of the most demanded languages.

Well, to be honest, you should look/learn as many languages as you can.
After you've gone through some of them, just go with the one you feel like using/is the right one for the job.

REPOSTIN FROM DEAD THREAD:
Would this be a worthwhile feature for an IRC bot "/dpt" would make the bot post a link to the most recently made dpt thread - no idea if I could make it but would it be worth investing my time into trying?

Is this true?

>job
If I don't care about that?

Yes.

Particularly try to avoid C++ if you can. It'll ruin your life.

How?

Nah, it'll just ruin whatever project you decide to do in it...

Lisp. Definitely Lisp.

what's the third best algorithm for image processing? i already have normalised correlation and sum of squared differences implemented

Finishing a space invaders clone
In fucking MIPS

>Nah, it'll just ruin whatever project you decide to do in it...
That and even in your 30s people will consider you a know nothing newfag.

Yes, C is the only language conceived by people with actual understanding of computers.

Sill you should try to learn every languages and use what suits you most according to your current project or your tastes.

Oh ok let me just program this microcontroller in C#

oh wait

Oh ok let me just jerk my little dick with C

oh wait

Why not. C# is just a language. You could have a compiler just for that.

Are you saying C programmers have big dicks?

You could have. But there's a reason you don't. It's a too high level language to be useful for firmware

Well, yes and no, since C# has garbage collection it requires a runtime, something most microprocessors (Going at ~20MHz) won't really be able to handle...

>runtime
Do you understand the meanings of your own words, user?

You can use a subset of C# which is called almost-C. Yes I know it's stupid and more simple to use C.

Okay, I can see that my learning rate is a little high, but this is pretty cool, wow

What library are you using?

Torch7

This is the network itself, if you're so inclined

wtf i love neural networks now

that looks like shit t.b.h

what does?

the syntax, the code. everything

why are you trying to avoid Sup Forums filter? It's good desu

Yeah, I could put in to a table first and then just feed the table indices to the network, but I'm being lazy rn.

wtf have I done here?

#include

int foo()
{
static int c = 0;
c++;
c++;
return c;
}

int main()
{
printf("%d,%d,%d,%d\n", foo(), foo(), foo(), foo());
return 0;
}


Output is 8,6,4,2. wtf?

Order of execution for arguments is not defined in C

Anyone ?

learn java and read android sdk docs

I think I went overboard with the latest training iteration, I went to take a shit and 30 minutes later it still aint done.

Whoops, it's roughly 35k iterations, let's hope it was worth it...

For the user who asked for the code of my shitpost detector, here you go:
pastebin.com/izNXZAsb

It's really disgusting, don't say I didn't warn you. I'll clean it up when I'll have some time.
Just so you know: Sup Forums has an API.

badWordCount += postList[i].lower().count('fuck')
badWordCount += postList[i].lower().count('shit')
badWordCount += postList[i].lower().count('tits')
badWordCount += postList[i].lower().count('fag')
badWordCount += postList[i].lower().count('nigger')
badWordCount += postList[i].lower().count('cunt')
badWordCount += postList[i].lower().count('kike')
badWordCount += postList[i].lower().count('kys')
badWordCount += postList[i].lower().count('cuck')
badWordCount += postList[i].lower().count('pajeet')
badWordCount += postList[i].lower().count('spic')
badWordCount += postList[i].lower().count('retard')
badWordCount += postList[i].lower().count('sperg')
badWordCount += postList[i].lower().count('autist')
badWordCount += postList[i].lower().count('shitskin')
badWordCount += postList[i].lower().count('newfag')
badWordCount += postList[i].lower().count('goy')


But user, those are actually nice words...

Also, why aren't you using a list?

Holy fucking shit, this is actually incredible

Right. So in this case it might first be executing the final call of foo() in the printf function, then working in reverse to the first call of foo() and printing it out in that reversed order. That makes sense, thanks.

what's the point of this what does it do and hy are you making it?

Yes, but don't depend on that, it's undefined behaviour. Once you compile your program with a different compiler or on a different platform (or even just different compiler settings), it might be different.

doc.qt.io/qt-5/android-support.html

Read you dumb fucker

Hello frenchy, I'm french too. Just wanted to tell you some faggots don't like unnecessary spaces before interrogation marks ("?"), you're warned.

Have fun on the internet! :)

By a list, do you mean a list of curse word ? I guess i could do that, i'd be cleaner than this pile of shit.
As I've said, this is pretty shitty, i'm gonna refactor most of it anyway. Ultimately, you'd just give an it, and not some strings, and it would give you back a dictionnary of Grades.

Come to think of it, a dictionnary probably isn't really needed, I could use a list.

It's a reversed CNN, usually a Convolutional Network takes an image and outputs what it thinks it is, here I am giving it what it should show me and it outputs an image.

Basically it's a network visualizing something from nothing (like dreams or imagination)

>why

Why not

Some langs are harder to efficiently compile than others. C is pretty much all the way up there (C++ being somewhat of a close second), that's why we use it for microcontrollers. You can use C on MCUs running at less than 1MHz with 512 bytes of RAM, because every operation you write in C pretty much directly translates to one instruction of the CPU, an array created in C will correspond to a memory chunk in SRAM of exactly that size, etc. (there are some caveats, but generally you get the idea. on a 512 byte MCUs you wouldn't do anything off the stack.)

C# would require a huge runtime, since it has all kinds of extra features; exceptions, safe container datastructures, automatic memory management etc. The basic overhead of creating an empty ArrayList or string in C# probably already exceeds the memory capacity of some of the smaller MCUs. Not to even speak of garbage-collection, threads, JIT etc. Also the overhead of e.g. calling a method would probably end up being thousands of instructions.

You can remove a bunch of those language features to make it easier to compile C# to native code that more closely corresponds to what runs on the hardware (e.g. cython/rpython does this with python), but then, is it really C# anymore?

You would have to add language features C# doesn't have right now to make it useful. On MCUs, you often need to be able to set interrupts, write to specific memory regions and specific CPU registers to achieve certain things. For instance if the MCUs has a USB client device on it, you would typically write and read data through special registers. You would also probably not want to use e.g. the average numerical types available in C# (since C# probably guarantees e.g. certain overflow behaviours, has certain type sizes etc that your MCUs may not natively implement, meaning if you write something like "a*b", instead of emitting one instructions, you may end up with hundreds)

Is C++ a bad language? Why is it hated here?

Also now I can trippily merge 2 images by changing the input weights like so

Microsoft is currently developing a C#->native compiler/runtime. The executables have a couple of kilobytes/megabytes overhead of course, depending on how much of the framework/runtime you use. But still, it is possible.

Because some C fizzbuzzers put and together.

user, my autistic sensors are unusually high when processing your posts. I'm sorry...

It's not even a language, just a bunch of plies of autism barely glued together.

Basically I am making the computer dream up images from nothing, makes sense?

It's a bloated abomination. People keep adding more and more features to a bad foundation, no matter if these features actually integrate neatly with the existing language.

It's not a bad language, especially since C++11 it has improved drastically. But it is definitely a more advanced language that has been around for a long time and has accumulated a good deal of cruft (both in the language itself as well as in terms of bad/outdated tutorials/information out there).

It remains one of the more powerful and popular languages though. Few other languages can compete with it in the areas where it shines. Rust is probably the newest contender in that arena.

Why can't Microsoft just die and go bankrupt? This cancer screwed computer science already enough.

Xamarin compiler for visual studio has tools for this exact situation, no?

Sure, and we've had things like that for java in the past as well. But that's still far far far away from what you'd need to run even on generously-sized microcontrollers. The output of those compilers still generally assumes you are running on an operating system that allows you to spawn threads, allocate memory on the heap dynamically, etc etc.

>makes sense
Are you trying to avoid answering my post because you don't understand it by implying I don't understand yours?

What's a plot like this called?
Or what I'd it called when you fill in the regions like this (no gradient)?
What would the colors be based on? What do the colors represent normally?

Case in point: rextester.com/ZPEC94872

What exactly are you talking about? C#? .NET?
Both technologies are actually really good in my opinion, especially since they recently open sourced pretty much everything.
Don't get me wrong, I don't particularily like Microsoft either, but C#, .NET etc. are not the reason they should die.

Then I'm not sure what you're talking about

Sure, I know, I didn't want to prove C# is suited for Microcontrollers. I've worked a lot with really small Microcontrollers with just a couple of kilobytes of RAM.
I just wanted to point out that it might be possible to work with C# programs without having to install gigabytes of runtime and framework beforehand.

contour plot but every time you change into a new region you use a different color

The colors are generally just auto-generated. If you plot with e.g. octave, matlab, matplotlib etc it just happens automatically. It uses a colorscheme (default or you can specify one) and then assigns each value a color, given it knows the range of all your values.

This one looks like the YlOrBr colorscheme from matlab, but the plot itself doesn't look like it was generated by matlab/octave (I don't recognize the font etc)

Heat map or height map?
Colors are based on the result of a 2D function at the specific point.

I'm trying to decide on the name for my first proper project, it's a raspi that sits on your desk, if you plug a usb into it all the contents of the usb are encrypted with a random 64 char password then deleted and replaced with normal non suspicious looking files
current name options
>usb blackhole
>one-time pi (name by an user on dpt)
feedback on either name or new suggestions are very helpful

Ok thanks.

t. gentoo user

>one-time pi
this

What is the best language to write server side apps in? End user desktop apps? WHY?

But user, what's the fucking point

looks like a contour-plot to me. useful if you want to plot a 3dimensional Surface - the lines represent points with the same height, an in this picture the lighter colors represent higher values (take a look at the numbers on the lines)

Shellscript and Shellscript

Because fuck you.

why not just dd if=/dev/urandom of=/dev/sdX

None, just like Sup Forums.

MyIJPie_h

Oh and would you consider this a nice plot for categorising? In this case the author wanted to simplify conditions by dividing ranges of the two variables into different regions to make analysis/presentation easier.

Is there something else I should look at aswell for that purpose?

>would you consider this a nice plot
that highly depends on what you want to show the user.
>In this case the author wanted to simplify conditions by dividing ranges of the two variables into different regions to make analysis/presentation easier.
For this it makes sense I suppose.

I thought this but it doesn't use one time pads (If I'm understanding what a one time pad is)
I have 10+ HDDs that need wiping and often wipe usbs in fits of paranoia
That won't kill as much time
>MyIJPie_h
I do not understand this name, I'm a retard can you explain it pls

seems fine to me, but I don't know what you're doing exactly

>That won't kill as much time
Why do you need it to kill time? What the fuck is the point of a device that wipes your drive and takes a lot of time doing so?

just for the sake of it desu also by killing time I mean killing my time not making the device take longer (on purpose)

I'm not doing anything specific. I just know this will come in handy though.

We code together /dpt/:
rextester.com/live/UOFGM88429

I am working on a translation aggregator clone in WPF for translating visual novels. It uses Agth to get the text and then you can put your google translation API key into the configuration file to use their new translate machine learning end point. It also supports using Selenium to type into google translates website and then hides it's own UI so that you can just use the translate window like the main window but I dont want to distribute it with that because I am pretty sure that violates some type of a users aggrement. Also I am trying to do duplicate text removal better but since I am not doing any natural language recognition the approach is very naive.

My application still looks like dog shit but I am looking forward to digging deeper into WPF and getting it to look nice.

why not codeshare.io/

>codeshare.io/
Doesn't run the code?

>machine translation with vns
kys you'reself

If I have a lot of repos (20+) would separating them by year be a good idea? would it stop people on github being able to find them? plus it'd make it easy for people to track how much I've done in a given year...

Why do people keep repeating this debunked meme about Rust being faster than C++? It runs slower and even compiles slower.