/dpt/ - Daily Programming Thread

Last thread What are you working on, Sup Forums?

Other urls found in this thread:

github.com/Admicos/CCED/blob/master/ccedmainwindow.cpp)
c2.com/cgi/wiki?KillerOperatingSystem
greenteapress.com/thinkpython/thinkpython.html
python.org/
my.mixtape.moe/seosgi.ogg
github.com/palladin/Higher
hastebin.com/vowonoqodo.rb
ideone.com/TQaKm7
twitter.com/AnonBabble

yes, as is printNamesThatStartWith

What?

meant for 55953478, my bad

fuck me,

>tfw haskellfags so BTFO by imperative languages that they list computational complexity for every operation in their Matrix library except operations that update elements

WHY IS FINDING C++ ANSWERS FOR QSCINTILLA THAT FUCKING HARD???!

ehm, sorry for the caps. Whatever.

So, i'm making a text editor using Qt5 and Qscintilla, but enabling autocomplete crashes my program, any ideas?

Here (github.com/Admicos/CCED/blob/master/ccedmainwindow.cpp) is the file that has the Qscintilla code.

But it's probably due to my C(++) skills being shit, but hey you gotta start somewhere, right?

>tfw this upset and insecure
use whatever you want

Probably because no one uses it. I haven't heard of it before but I'll look at your code; do you know which function/line it crashes at?

> do you know which function/line it crashes at?
The autocomplete stuff happens at around Line 59.

Seeing if I can program my PWP 100 to do something other than type.

Why is this thread so fucking dead? Why was there no dpt for 5 hours? where is everybody?

anime

we're at defcon

ah alright

kys

typeclasses just make sense

other languages need them ASAP

Heavy anime

there is a /dpt/ thread, just it wasn't typed out

it didnt even say daily programming thread
not even programming

it is

Aren't they just Go-style interfaces that only check the name of a method?

huh. Maybe the search function is broken.

Should I learn winforms, WPF or both?

Nope nope, not at all. Chiggydout if that's what you thunk before: they rock.

Got a Raspberry Pi 3 for dicking around with server stuff. Bought it with an HDMI/VGA adapter because my display is old enough that it doesn't work with HDMI. After 8 days, the Raspberry Pi arrives at my door, the adapter doesn't. Amazon refunds me, but I still can't set this damn thing up without a display. I go down to Best Buy, and they don't have a fucking adapter.

I don't want to wait another goddamn week.

the summerfag put the title in the name field

>developing for a dying OS

it's like you want me to laugh at you

Winforms works with Mono on Linux, WPF is nicer to work with because XAML.

>Ruby

I made a giant spreadsheet the other day to track my progress on programming projects.

Now I'm slowly trying to convert it to a proper database running on a virtualbox.

So far I've made it so you can submit new issues and get a listing of all issues.

Still to-do:

>Editing existing issues
>Creating and editing tasks
>Time logging
>Progress tracking
>Project overview

(All this already works fine in the spreadsheet version, so I have a fair idea of how I want to implement it).

Anyone of you dickfaggots likes implementing numerical methods?

I am lost. I know basic data structures, and know how to program most things.

Now what the fuck do I learn?

Next is tying your shoelaces

Just wrote a fast integer-logarithm for any non-zero floating point value

not really useful probably but it felt cool to write

you shouldn't just learn programming. It's best to learn something else and then learn programming as a subsection of it.

What specific features do you guys think would make a killer os?

c2.com/cgi/wiki?KillerOperatingSystem

Oi, I made a .wav file generator in Ruby that took stdin text file and spat out wav.

Text file format was, per line, a float between -1 and 1.

Then wrote a generator for that file (in Ruby) that evaluated $1 as a Ruby expression, which had access to all sorts of prebuilt sound effect generators (most of which I just pulled out of my ass).

Was fun.

Newfag reporting

I want to learn a programming language to expand my brain and skillset a bit - any suggestions on where to start? Helpful literature/places to find it are definitely appreciated.

Lazy evaluation

Of course, Ruby was totally the wrong choice for the text to wav conversion (would use C next time easily) but for the number generator it was brilliant

Have you considered learning the best language of all past and current time?

Lazy installation, like pretty much what I have now.

go to piratebay

proceed to download books on programming

pretty simple m8

>Text file format was, per line, a float between -1 and 1.
How should I imagine this, as a sine wave?

This book is a pretty good start, you can read it for free: greenteapress.com/thinkpython/thinkpython.html

You can download Python 3 from python.org/

I was looking for more specific advice, like

Yeah mate just read completely random books. All books are created equal and definitely not half of them are outdated or outright bad

I need to create a powershell, batch or python script that will take a CSV as an input with Mac address, asset number and room number as headers. Create a .ini file for each MAC address, then use a combination of the Asset and room number and write that as a string to the first line of the file.

Would python be easier for this? I've had a good go with powershell but I can't figure out how Import-Csv stores each of it's records as objects.

Any help much appreciated. We're doing a very large deployment of thin clients and I'd rather have a script that can create the .ini files automatically. Currently I have a system that will create the files, but not append to the empty file, which means most of the tedious work has to be done by hand.

What os does it need to run on? If it only needs to run on nix, write up a quick shell script.

Windows, ideally. However, if that's a better solution, I could run it on nix machine and copy them to the server.

No way, write it in powershell or as a cmd script.

>Vim enthusiast
>Exam on next course will be on computers "equipped with Emacs"

This is going to be annoying.

Anyone got a nice vim to emacs cheat sheet?

but vim would be installed nevertheless

You can config emacs to work more like vim. Check out evil or spacemacs

I tried to post many non conforming objects in this board user.

Shall I post a sound including webm in another board ?

Sure, you can post those in and link it here.

Fuck this is getting annoying

The only way it accepts sound is with webm. You could also just upload the ogg to mixtape.moe or something.

I posted webm.

The board literally said that only Ogg/Vorbis was allowed, so I did OV for them and got that bullshit.

Mebbe your suggestion is the easiest. Fuck the entire internet, and the planet, for how it turned out.

omfg someone did it right
my.mixtape.moe/seosgi.ogg

It's barely even worth listening to.

It's a complicated mathematical formula, in sound form. Honestly, better things to do in life.

how did I not know this existed
github.com/palladin/Higher

One of these was the the command I used to generate it.

Currently working on some ruby scripts to dump databases to various formats, so far written the main class for MySQL and a transformer implementation which outputs the tables to CSV files. Planning on adding transformer implementations which output to other databases, .sql files, or maybe through a regex searcher.

No H8, ruby is not my main language

hastebin.com/vowonoqodo.rb

Done it, cheers.

>F#

So I found a bot on github and it's in french I want to kind of clone it to my github then translate to english, but I want the english version to only be on my github and don't want to take any credit off the creator - am I right in assuming to do this I just fork it, git clone it, make my changes then git push and it'll only push the changes to my repo?

(((fork) -> make changes -> merge request

You click fork on the github site, then copy the url of your fork to clone. Then, yes, it will work the way you expect it to.

Working on a simple rouguelike-like "game", but using predefined maps instead of random generation. I've found a neat program called REXPaint which let's you draw ascii art, and I've now got the map files successfully loading into my program, setting the terrain details based off the character, blocking movement to non-ground tiles.

I know it's not much, but I've never programmed in C++ before, so there was a bunch of stuff that was new to me.

Ok so I have a problem. How are strings stored in C?

I'll give an example:

#include

typedef struct s
{
char *str;
} s;

void
init_s(s *s_ptr)
{
s_ptr->str = "lorem ipsum";
}

s my_struct;

int main(int argc, char *argv[])
{
init_s(&my_struct);
printf(my_struct.str);

return 0;
}


Where the hell are the strings stored? Are they automatically dynamically allocated? Shouldn't s.str, being a pointer, become invalid after the scope of init_s ends?

t. idiot

Do what the other user said. Make sure you split your work off into another branch before the merge request.

String literals are implicitly static const. Do they live in the .data section and are never allocated or freed. They are a part of the executable.

With modern C++, is there any reasons to use arrays over vectors?

Yes, speed.

How much speed are we talking about though?

Lot.

std::array > t[n]

Vectors require dynamic allocation, which is much slower than static allocation.

Oh. I see. Then that means I'll still have to manually dynamically allocate certain strings I'm reading from an XML file. Thanks.

Vector's are just as fast to access as normal arrays, but with a vector you'll want to keep in mind it's dynamically allocated. If you don't pre-allocate enough space (say, with reserve()), the vector gets resized in, say, a push_back operation and you have pointers to some of the vector's items, the pointers will become invalid.

To add to the previous post

If you had something like below it'd be on the stack and you'd lose it after init_s went out of scope liek you initially thought. "lorem ipsum" itself is still some static data somewhere though. It's just copied to the local char[]

void
init_s(s *s_ptr)
{
char str[] = "lorem ipsum";
s_ptr->str = str;
}

The allocation only happens when creating the array and upon resizing, so its not necessarily an issue depending on how you use the vector. What happens when stuff gets pushed to a vector depends on the implementation, some will for example increase the size by 5 % every time the max capacity is reached and a new push_back happens.

Would a compiler not be smart enough to optimize that code though?

Righto. Thanks.

Compiler optimization shouldn't change the behaviour of the code.

Is Eclipse still the best Java IDE?

IntelliJ is better. Both are shit btw.

How would it optimize that? Embed the string into a series of load literals? That's more inefficient.

Are you a stupid fucking frogposter?

>best Java IDE
Yes, yes you are.

Am I the only one that respects a project less if it's not on github, I mean really can you not afford £7 a month

Stupid mac poster.

Why would you ever use == for reference types in Java?

this doesn't work either senpai

ideone.com/TQaKm7

ok what's > called again

a100.greater(b100) ?

I use an x220 running arch

To compare Integer objects you would use .equals or do .intValue == .invValue

The reason the first one returns true is because the java compiler optimises Integer objects with values in signed 8 bit integer range through caching meaning it is literally the same object.

how do I compare primitives by reference in Java

This is bait, user.

There are no primitive references in Java.

how do I compare primitives by address in Java

You cannot. Ask the language designer for an explanation.