[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 321
Thread images: 30

File: dpt.jpg (12KB, 414x381px) Image search: [Google]
dpt.jpg
12KB, 414x381px
Last thread >>55946704

What are you working on, /g/?
>>
>>55957258
yes, as is printNamesThatStartWith
>>
>>55957265
What?
>>
>>55957265
>>55957280
meant for 55953478, my bad
>>
>>55957317
fuck me, >>55953478
>>
>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 (https://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?
>>
>>55957416
>tfw this upset and insecure
use whatever you want

>>55957463
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?
>>
>>55957509
> do you know which function/line it crashes at?
The autocomplete stuff happens at around Line 59.
>>
File: IMG_20160806_123020.jpg (1MB, 2461x2975px) Image search: [Google]
IMG_20160806_123020.jpg
1MB, 2461x2975px
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?
>>
>>55957877
anime
>>
>>55957877
we're at defcon
>>
>>55957953
ah alright

>>55957962
kys
>>
typeclasses just make sense

other languages need them ASAP
>>
>>55957877
Heavy anime
>>
>>55957877
there is a /dpt/ thread, just it wasn't typed out
>>
>>55958211
it didnt even say daily programming thread
not even programming
>>
>>55958244
it is
>>55951615
>>
>>55958179
Aren't they just Go-style interfaces that only check the name of a method?
>>
>>55958246
huh. Maybe the search function is broken.
>>
Should I learn winforms, WPF or both?
>>
>>55958257
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.
>>
>>55958261
the summerfag put the title in the name field
>>
File: 64d0.jpg (14KB, 640x320px) Image search: [Google]
64d0.jpg
14KB, 640x320px
>>55958780
>developing for a dying OS

it's like you want me to laugh at you
>>
>>55958780

Winforms works with Mono on Linux, WPF is nicer to work with because XAML.
>>
File: 640.jpg (14KB, 640x320px) Image search: [Google]
640.jpg
14KB, 640x320px
>>55959165
>Ruby
>>
File: 2016-08-07_00-22-51.png (42KB, 797x448px) Image search: [Google]
2016-08-07_00-22-51.png
42KB, 797x448px
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?
>>
>>55959497
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
>>
>>55959497
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?

http://www.c2.com/cgi/wiki?KillerOperatingSystem
>>
>>55959292
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.
>>
>>55959652
Lazy evaluation
>>
>>55959702
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
>>
File: &&.png (7KB, 272x130px) Image search: [Google]
&&.png
7KB, 272x130px
>>55959795
Have you considered learning the best language of all past and current time?
>>
>>55959803
Lazy installation, like pretty much what I have now.
>>
>>55959795
go to piratebay

proceed to download books on programming

pretty simple m8
>>
>>55959702
>Text file format was, per line, a float between -1 and 1.
How should I imagine this, as a sine wave?
>>
>>55959795
This book is a pretty good start, you can read it for free: http://www.greenteapress.com/thinkpython/thinkpython.html

You can download Python 3 from https://www.python.org/
>>
>>55959831
I was looking for more specific advice, like >>55959836
>>
>>55959831
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.
>>
>>55960002
What os does it need to run on? If it only needs to run on nix, write up a quick shell script.
>>
>>55960056
Windows, ideally. However, if that's a better solution, I could run it on nix machine and copy them to the server.
>>
>>55960070
No way, write it in powershell or as a cmd script.
>>
File: 1393088795545.jpg (39KB, 500x750px) Image search: [Google]
1393088795545.jpg
39KB, 500x750px
>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?
>>
>>55960176
but vim would be installed nevertheless
>>
>>55960176
You can config emacs to work more like vim. Check out evil or spacemacs
>>
>>55959832
I tried to post many non conforming objects in this board anon.

Shall I post a sound including webm in another board ?
>>
>>55960333
Sure, you can post those in >>>/wsg/ and link it here.
>>
>>55960348
Fuck this is getting annoying
>>
>>55960406
The only way it accepts sound is with webm. You could also just upload the ogg to mixtape.moe or something.
>>
>>55960417
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.
>>
>>55960417
omfg someone did it right
https://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
https://github.com/palladin/Higher
>>
>>55960417
>>55960466

One of these was the the command I used to generate it.
>>
>>55957258
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

http://hastebin.com/vowonoqodo.rb
>>
>>55960079
Done it, cheers.
>>
>>55960488
>F#
>>
>>55957258
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?
>>
>>55961255
(((fork) -> make changes -> merge request
>>
>>55961255
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.
>>
File: Forest.png (581KB, 1440x810px) Image search: [Google]
Forest.png
581KB, 1440x810px
>>55957258
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 <stdio.h>

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
>>
>>55961255
Do what the other anon said. Make sure you split your work off into another branch before the merge request.
>>
>>55961474
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?
>>
>>55961494
Yes, speed.
>>
>>55961500
How much speed are we talking about though?
>>
>>55961519
Lot.
>>
>>55961500
std::array<t,n> > t[n]
>>
>>55961494
Vectors require dynamic allocation, which is much slower than static allocation.
>>
>>55961489
Oh. I see. Then that means I'll still have to manually dynamically allocate certain strings I'm reading from an XML file. Thanks.

>>55961494
>>55961500
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.
>>
>>55961474
>>55961489
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;
}
>>
>>55961547
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.
>>
>>55961565
Would a compiler not be smart enough to optimize that code though?
>>
>>55961565
Righto. Thanks.
>>
>>55961600
Compiler optimization shouldn't change the behaviour of the code.
>>
File: tumblr_nyp2w3esF61ro7rpno1_1280.jpg (29KB, 640x519px) Image search: [Google]
tumblr_nyp2w3esF61ro7rpno1_1280.jpg
29KB, 640x519px
Is Eclipse still the best Java IDE?
>>
>>55961675
IntelliJ is better. Both are shit btw.
>>
>>55961600
How would it optimize that? Embed the string into a series of load literals? That's more inefficient.
>>
File: Java.png (17KB, 484x402px) Image search: [Google]
Java.png
17KB, 484x402px
>>55961675
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
>>
>>55961736
Stupid mac poster.
>>
>>55961697
Why would you ever use == for reference types in Java?
>>
File: java2.png (17KB, 384x298px) Image search: [Google]
java2.png
17KB, 384x298px
>>55961795
this doesn't work either senpai
>>
>>55961801
http://ideone.com/TQaKm7
>>
>>55961827
ok what's > called again

a100.greater(b100) ?
>>
>>55961748
I use an x220 running arch
>>
>>55961801
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.
>>
>>55961850
how do I compare primitives by reference in Java
>>
File: sqt.jpg (61KB, 416x620px) Image search: [Google]
sqt.jpg
61KB, 416x620px
>>55961801
>>55961827
This is bait, anon.
>>
>>55961857
There are no primitive references in Java.
>>
>>55961870
how do I compare primitives by address in Java
>>
>>55961885
You cannot. Ask the language designer for an explanation.
>>
>>55961899
how do i mutate primitives in Java
>>
>>55961901
int i = 0;
i++;
>>
>>55961857
No such thing as a reference to a primitive. References are objects only.
Integer <= Object
int <= Primitive
.equals for objects (== does reference equality, not value equality)
== for primitives
>>
>>55961909
i mean with a function
if ints are cached won't this mutate the cache?
>>
>>55961920
It mutates the primitive in the 4th dimension.
>>
>>55961678
Pretty much this.
IntelliJ randomly decides that it's time to change settings while eclipse breaks every time you want to open a different workspace.
>>
Is there an easy way to convert python 2.x to python 3?
>>
>>55961952
https://docs.python.org/2/library/2to3.html
>>
>>55961952
delete all the code
>>
>>55961957
thanks
>>
Would the following echo hi anon ever 10 seconds?
while true
do
echo "Hi"
echo "anon"
sleep 10
done
>>
>>55961999
depends what timescale sleep uses.
>>
>>55962008
Assuming that's bash, sleep works in seconds by default.

>>55961999
Yes.
>>
>>55961952
4chins won't let me post the link, but you can google "fuzzy notepad port python 3" for a pretty good guide.
>>
>>55962029
it is bash, do I not need to put a ; after each command?
>>
>>55962074
No. You only need to do that if multiple commands are on the same line.
>>
File: 070816-1410.png (2MB, 4000x2560px) Image search: [Google]
070816-1410.png
2MB, 4000x2560px
Working on reversing Pokemon Go. Looking at other stuff now though, not just the protobufs...

I was there when the unknown6 was found, and the dll created, still got source code yo
>>
>>55962228
why are you reversing pokemon go?
>>
>>55962276
og nomekop
>>
best language for a console based game?
>>
Hi internet

for a uni-project i will have to port an econ programm (linear optimization) from Visual Basic to Python.
Now I have basic knowledge about Python, but will I need to know VB too? I do not know if its properly commented and such
>>
>>55962321
You'll probably be able to figure it out as you go along. VB isn't particularly complicated.

Have a look at some VB programs[1] beforehand and see if there's anything that's not immediately obvious what it does.

1: http://rosettacode.org/wiki/Category:Visual_Basic
>>
>>55962228
Sounds neat. Honest side question nonetheless: why do you need so many vms?

(Inb4: VMS)
>>
>>55962351
Thanks for the response, that website looks sweet, thank you very much
>>
>>55957258
just learning javascript
is this a good inplace reversing of array function?
function inplace(xs) {
for (var i = 0; i < xs.length / 2; i++) {
var a = xs[i], b = xs[xs.length - 1 - i];
xs[i] = b; xs[xs.length - 1 - i] = a;
}
return xs
}
>>
>>55962379
Only 1 vm open, It's just got 6gb assigned to it, since I need to load up an Android emulator (S6) which consumes like 4GB ..
>>
>>55962074
while :
do
echo Hi
echo anon
sleep 10
done
>>
>>55962507
>changing state
>>
>>55962566
im a newfag to the lang
any other way to make it better?
>>
File: 1449408701420.png (226KB, 480x433px) Image search: [Google]
1449408701420.png
226KB, 480x433px
>try starting Hibernate 5 on a semi-empty database previously managed by Hibernate 4.3 for shits and giggles
>H5 immediately enters a weird loop updating Hibernate sequences and doing nothing else
>it's been at it for the past hour
>the database had probably 100 rows between all the tables
Muh enterprise
>>
>>55962573
 xs.reverse() 
>>
>>55962520
Oh. So what's with the Gnome shell over VNC then? I assumed it came from one of your other vms, but that's impossible so...
>>
>>55962573
He's trolling you just fyi
>>
>my language is functional because it has map/filter/reduce

Ugh.
>>
>>55962228
so, is pokémon go written in C???


how does it run on android????
>>
>>55962664
javascript??
does it even have filter?

also, what is real functional programming?
>>
File: 11.png (97KB, 834x588px) Image search: [Google]
11.png
97KB, 834x588px
>>55962664
>>
>>55962690
My sides
>>
>>55962690
>on twitter
>emoji trash
>isVegetarian
is this advertising for Rust?
>>
>>55962690
the fuck
>>
>>55962690
lmao
>>
>>55961551
>>55961584
So the main issue with vectors is people forgetting how they work in the low level, maxing out the initial size, and then allowing the vector to double in size just to add a few extra elements when they should have called reserve() and added more space that way vs doubling the whole thing?
>>
are linked lists a meme in javascript?

function array2list(xs) {
if (xs.length == 1)
return {value:xs[0], rest:null}
else
return {value:xs[0], rest: array2list(xs.splice(1, xs.length - 1))}
}

function list2array(ls) {
var array = [ls.value];
if (ls.rest == null)
return array;
else
return array + list2array(ls.rest);
}

print(array2list(range(1,8)))
print(list2array(array2list(range(1,8))))


output
[object Object]
12345678
>>
>>55962680
currying by default
immutable by default
sum types
pattern matching
lists
some other shit
>>
>>55962771
>some other shit
clearly you're a memer
>>
>>55962781
>just because he doesn't remember he is a memer xD 11!!!!11!!

why don't you google what a functional programming language is, fucktard?
>>
>>55961736
Yes. I don't even use Github, I use Gitlab. At least they're politically neutral and you can have a massive amount of free private repos if you want.
>>
Could somebody explain programming to me? To me it looks like a bunch of logical giberish commands that somehow make sense to you. I'm a vetenarian so im probaby as far away from IT as i can be but i still consider myself pretty tech-savy
>>
>>55962809
memer confirmed
>>
>>55962813
only thing I dislike about gitlab/bitbucket is the profile pictures for each project
>>
>>55962507
Yeah, it looks like it does the job (tho there arent hundreds of ways to do it)
Heres how I would do it
function inplace(xs) {
for (var i = 0, j = xs.length-1; i < xs.length / 2; i++,j--) {
var a = xs[i], b = xs[j];
xs[i] = b; xs[j] = a;
}
return xs;
}
>>
>>55962820
it's like lambda calculus
you have an expression (like 1+1) which you reduce to something normal (like 2) which can't be reduced anymore.

but more complex thanks to types, arguments, etc.
>>
>>55962850
Not an argument.
>>
>>55962820
Programming is writing instructions for a computer in a programming language.

This programming language is designed to be both understandable by humans (who think in natural language) and computers (who think in a completely logical, math-like sense).

>logical giberish commands that somehow make sense to you
You start one step at a time and it will make sense. The basic elements are very simple, it's all about combining them in clever ways.
>>
>>55962820
You instruct the computer to perform certain actions.
>>
>>55962866
i < j bumboy.
>>
>>55957463
Maybe the lexer needs a valid object but yours goes out of scope because it's on the stack.
>>
>>55962996
Yeah you're right. That's so triggering
>>
>>55962905
Wut?
>>
File: c++-bad-luck-brian-198015.jpg (222KB, 476x547px) Image search: [Google]
c++-bad-luck-brian-198015.jpg
222KB, 476x547px
is Lua a meme language? why is it paired with C++ ?
>>
>>55963131
go back to 9gag, faggot
>>
>>55963131
What really impresses girls is Haskell.
>>
>>55963184
No it's a big dick. And I got one. I also know Haskell.
>>
>>55963131
I was thinking yesterday that I would probably recommend it as a first PL because it works hard in order not to be confusing and it has tail calls

Really if neovim becomes scriptable in it this will be paradise
>>
>>55961948
Is it wrong of me to primarily hate Java because I hate using a bloated IDE?
>>
Any Rust users here?

I'm kind of a flippin' idiot this morning and as a mainly C / Java user this language is frustrating the hell out of me. I just want to read a goddamn string from standard input and bind it to a variable. (the long term goal is to make a to-do list application in Rust, but most irrelevant).

What am I doing wrong?

use std::io;

fn get_string() -> io::Result<String> {
let mut buffer = String::new();

try!(io::stdin().read_line(&mut buffer));

Ok(buffer)
}

fn main() {
let mut input = String::new();
input = get_string();
println!("You typed: {}", input.trim());
}
>>
>>55963131
Simple syntax, easy to get into, minimal, pretty fast for an interpreted language when using LuaJIT, easily embeddable and extensible. Makes it a perfect choice for extending your program with plugins.
>>
>>55963250
Error message?
>>
>>55963250
The compiler tells you everything you need to know.

input = get_string().unwrap();
>>
>>55963237
you don't have to write java in an IDE. you could just use a text editor.
>>
>>55963293
Some libraries are pretty damn hard to use without an IDE, I tried doing that with LibGDX once and just gave up because it would've been too much work, not to mention on multiple machines.
>>
>>55963293
IDEs speed up development time. Search the javadocs every minute sucks.
>>
>>55963409
>>55963403
Well then don't bitch about "bloated IDEs". It's what has to be dealt with when writing anything more complicated than hello_world in Java.
>>
>>55963486
>Anonymous is the same person
idiot
>>
File: k.png (102KB, 1189x591px) Image search: [Google]
k.png
102KB, 1189x591px
>>55963486
lol
>>
>>55963233
>>55963275
what kind of stuff is it good at?
>>
>>55963237
yes because you should use an IDE/""""""""text editor"""""""" no matter the language and for professional development you should be able to run a fucking IDE, it doesn't take much to run with modern hardware
>>
Has anyone ever had an error regarding the winreg module when trying to install other modules with pip? I tried Stack Overflow nothing useful
>>
>>55963550
Same things Python is good at, but the OOP is lacking. You kind of have to implement it yourself. There are machine learning and numerical analysis packages for it, a couple 2D game engines, and the IRC and mailing list are pretty comfy. Full of pretty smart people, who like to do things their own way (a lot of reinvent the wheel) and prefer simple semantics.
>>
>>55963551
I usually have 3 Android Studios open. It consumes 6.5 out of 8GB RAM. That leaves very little RAM to build with Gradle.
>>
I'm studying assembly, C and watching cybrary's A+ Course.

Any books/materials you guys recommend? Right now i'm reading "programming from the ground up" and k&r's C
>>
>>55963649
It will just swap with virtual memory. It's not like you can't use it.
>>
>>55963649
Should have fallen for the 16 GiB RAM meme.
>>
testing stuff
>>
>>55963672
No it doesn't. It starts swapping on my HDD and the system grinds to a halt.
>>55963697
Company meme laptop.
>>
>>55963649
>3 Android Studios
what?

>>55963709
then ask for a better computer or a RAM upgrade
>>
Is python a good beginner language for a hobbyist and will having an active github help me get a job repairing pcs?
>>
>>55963746
>what?
Library, old code base, new code base
>then ask for a better computer or a RAM upgrade
Yeah, I might go for a Macbook with PCIe SSD and 16GB. Current machine is a Dell XPS 15. Shit's a pain in the ass with multi window due to Nvidia Optimus bullshit.
>>
>>55963764
>Github
>Repairing PCs
????
>>
>>55963250

use std::io;

fn get_string() -> io::Result<String> {
let mut buffer = String::new();

try!(io::stdin().read_line(&mut buffer));

Ok(buffer)
}

fn main() {
// allocation of the input isn't required. you already allocate in get_string
// let mut input = String::new();
// unwrap is called on get_string
// becuase you are returning a result wrapping a string
let input = get_string().unwrap();
println!("You typed: {}", input.trim());
}
>>
Might be contributing to some free software projects.
>>
File: le_smug_china_man.jpg (18KB, 306x374px) Image search: [Google]
le_smug_china_man.jpg
18KB, 306x374px
Should I learn Java or Python?
>>
>>55960176
vi is in the posix standard, and most distros opt to substitute vi for vim.
>>
>>55963850
Haskell
>>
>>55963850
Rust
>>
>>55963850
do you want to have some fun? python.
do you want a job? java.
>>
>>55963850
java. python is fucking garbage, even if you think java is bad because memes then python is still far worse
>>
>>55963987
Wow, you really convinced me by your lack of arguments.
>>
>>55964008
wow, i really care
>>
>>55962675
bump??????????????????????????????
>>
>>55964216

Of course it's fucking not.
>>
>>55964216
It's written in COBOL.
>>
>>55957258
Thank you for not using an anime image
>>
>>55963792
I figure it's tech related so it should help
>>
>>55964216
It's made in Unity.
>>
>>55964235
>>55964235
so why is that code in C?
>>
>>55962675
it's made using unity, so C# probably, but it could be using other languages as well, like java for networking stuff, don't know
>>
exokernel for ARM64
it's only going to deal with initialization and access of hardware and virtual memory, then hand control to the operating system, super minimal :3
>>
Is there a tutorial available for Rust with programming exercises?
>>
>>55964279
The coder was probably writing a Pokemon Go Pokemon locator in C using data that they got from reverse-engineering the Android app.
>>
Learning C++
Is this
*a = b;

the same as
a = &b;

?
>>
>>55964319
no
>>
>>55964319
no. the first one assigns the value of b to the a pointee and the second changes the address of b to the a pointer
>>
>>55964331
>changes
assigns
>>
File: lain.png (588KB, 814x637px) Image search: [Google]
lain.png
588KB, 814x637px
Thinking about rebooting my visual novel.
>>
Does anyone know the differences between the first edition of "Introduction to Algorithms"(CLRS) and the third edition? The first edition is like £30 cheaper.
>>
>>55963663
Second this. What kind of assembly should i learn? Fasm?
>>
>>55964319
No. First assigns the value of b to the pointee of a, second assigns the address of b to a which makes b itself the pointee, see?
>>
>>55964351
https://www.quora.com/What-is-the-difference-between-CLRS-second-edition-and-third-edition
>>
>>55964360
MIPS
>>
Best NLP library + language for making a waifu? I want to talk to my computer.
>>
>>55964340
Omg yes please I'm a fan of everything GNU-related including your project please please PLEASE
>>
>>55964409
http://alice.pandorabots.com/
>>
>>55964360
>Fasm?
That's an assembler
>>
>>55962675
Pokemon go is written in C# in Unity. But there are a few libs shipped with the game, and these libs native C and called from within the C# program. The libs contain the encryption routines and stuff...
>>
File: ?.png (7KB, 120x120px) Image search: [Google]
?.png
7KB, 120x120px
Is it possible to crack a 7-Zip file encrypted with a 30 digit password ?
>>
>>55964666
Possible? Yes. Feasible? No.
>>
>>55964666
>Is it possible?
Yes
>Is it doable in your lifetime?
Probably not
>>
>>55964388

This. It's ""easy"".
>>
File: hmap.png (650KB, 1192x1941px) Image search: [Google]
hmap.png
650KB, 1192x1941px
Im working on a program that loads a point cloud, and converts it to a height map. Im kinda stuck at this point.

So i load the point set, draw it with opengl (1. pic), apply a shader so the points are colored according to their heights. I set the camera above and center of the point set, set the FOV to really small like 0.0001 so its basically orthogonal view (2. pic). You can see the gaps between points. Then i manually set the camera distance closer and closer (3. and 4. pic) to the points so the gaps get smaller and disappear (5. pic).
This is what i want, every point in the 3d point set is represented by a 2d pixel on the screen. How would i set the distance programmatically to achieve this?

If i reduce the distance further the points might overlap (6.pic) and the data would be invalid.
>>
anyone know of good resources and tutorials for programming the MSP430 ?
i need to get uart communication working with a gsm module to send SMS
>>
I have these two functions, I thought the first was the bottleneck of my program, so I tried to write a version which was sorta binary search esque, but it runs a lot slower, did I program it badly or what? xs can be rather large.

I'm still trying to solve a hackerrank problem which times out, i'm getting triggered by it, I should probably give up

searchtuple :: (Num a, Ord a) => [(a,a)] -> a -> a
searchtuple ((a,b):xs) n
| n <= b = a
| otherwise = searchtuple xs n

binsearchtuple :: (Num a, Ord a) => [(a,a)] -> a -> a
binsearchtuple xs n
| length xs == 1 = 1 + fst (xs !! 0)
| n > b = binsearchtuple (snd $ splitAt mid xs) n
| n > (snd $ xs !! (mid-1)) = a
| otherwise = binsearchtuple (fst $ splitAt mid xs) n
where mid = (length xs `div` 2)
b = snd $ xs !! mid
a = fst $ xs !! mid
>>
>>55962318
Lisp
>>
>>55962771
Mostly agreed, but the untyped lambda calculus wouldn't meet the definition because of destructuring and types. I'd say drop these.
>>
Ok anons, i want to learn something new so im thinking Ruby or Python?
Which one should i pick and why?
I would build mostly web apps, so it would be Rails or Django?
help me decide
>>
>>55964858
use Ruthon
>>
>>55964858
python with django because ruby on rails is deprecated
>>
>>55964922
>ruby on rails is deprecated
said a NEET on a russian painting image board
>>
>>55964938
it's common knowledge, ask in >>>/g/wdg if you don't believe me
>>
>>55964814
Pick a language that's not slow then.
>>
>>55963624
I like it already.
>>
>>55965079
Yeah I'm gonna learn a whole other language to solve one problem on hackerrank

And no, I can't use c or something like that because it's the functional domain
>>
>>55965096
>And no, I can't use c or something like that because it's the functional domain
hackerrank won't let you use C or are you memeing?
>>
>>55965109
>function domain
there's a section which is just for functional programming
>>
>>55965116
ah ok then
>>
>>55965116
>there's a section which is just for functional programming
>Clojure
>Erlang
>F#
>Haskell
>OCaml
>racket
>Common Lisp
>Scala

choose your poison
>>
>>55964949
what the fuck is not "deprecated"?
>>
>>55965162
Like I said
>Not gonna learn a whole other language for one problem
>>
>>55965164
>>>55965001
looks like phoenix with elixir is the hottest new meme
>>
>>55965096
Well in which case, enjoy never solving the problem because your language is inherently shit.
>>
>>55965171
F# is basically C# and scala is basically java
>>
>>55965218
and Brainfuck is basically C++
>>
>>55964814
How many times is this being called?
>>
>>55965246
not at all.
>>
>>55965171
(not >>55965211)
I dont see anything wrong with your code, except maybe that it would not handle [] very well but that's not the point. Are you sure lazy evaluation isn't the culprit? Haskell isn't just another FP lang after all...
>>
>>55965277
Full code:

import Control.Monad
import Data.List
import Control.Applicative
import qualified Data.ByteString.Char8 as B
import Data.Maybe

main :: IO ()
main = do
getLine
list <- map (fst . fromJust . B.readInt) <$> B.words <$> B.getLine
getLine
nums <- map (fst . fromJust . B.readInt) <$> B.lines <$> B.getContents
let a = zip [1..] $ scanl1 (+) $ reverse $ sort list
mapM_ print $ map (subset list a) nums

subset :: [Int] -> [(Int,Int)] -> Int -> Int
subset xs ys n
| sum xs < n = -1
| snd (ys !! 0) > n = 1
| otherwise = searchtuple ys n

searchtuple :: (Num a, Ord a) => [(a,a)] -> a -> a
searchtuple ((a,b):xs) n
| n <= b = a
| otherwise = searchtuple xs n

binsearchtuple :: (Num a, Ord a) => [(a,a)] -> a -> a --this is slower, JUST
binsearchtuple xs n
| length xs == 1 = 1 + fst (xs !! 0)
| n > b = binsearchtuple (snd $ splitAt mid xs) n
| n > (snd $ xs !! (mid-1)) = a
| otherwise = binsearchtuple (fst $ splitAt mid xs) n
where mid = (length xs `div` 2)
b = snd $ xs !! mid
a = fst $ xs !! mid


One of the inputs which times out regardless of algorithm is this

https://hr-testcases-us-east-1.s3.amazonaws.com/2376/input07.txt?AWSAccessKeyId=AKIAJAMR4KJHHUS76CYQ&Expires=1470599587&Signature=UR9k4bBMlO%2BnCMnFBAeQe7X1KxQ%3D&response-content-type=text%2Fplain

>>55965335
Well i'm using bytestrings instead of normal IO which I think makes it not use lazyness, not sure about the rest of it, i'm kinda new to haskell. Regarding [] I just ignored it as it never occurs and I want to go as fast as possible
>>
>>55965365
IO operations may be strict there, but your lists will still be lazy af fyi
>>
File: 1468095360351-vg.png (200KB, 964x343px) Image search: [Google]
1468095360351-vg.png
200KB, 964x343px
Yo noob javafag here. I'm starting to get a good grip with this, but dunno where to go next. I'm interested in doing some web work. For example, i want to parse a webpage to extract some stats from it and then store it in a database. However, the webpage is all in html. Do I need to know html to do this or nah? Also, I have use an app on my android for hltv.org, but it is literally just the same as the mobile browser version of the site (in html), which is limited compared to the desktop. If I wanted to make my own version of the app with the same content as the desktop browser version, do I need to know html? If I don't necessarily need html, what language would you recommend for Web dev?
>>
>>55964273
programming has nothing to do with repairing PCs
>>
What do you think of this, /g/?
http://www.chrisduell.com/blog/development/first-do-it-then-do-it-right-then-do-it-better/
>>
>Rust STILL doesn't have a solution for untagged unions
They could have gone the
#[repr(union)]
, which doesn't require any new syntax yet still makes sense as a struct layout (unions are structs with all fields at the same location). But no, they had to appease the retards who a) can't wrap their heads around the union-as-struct concept and b) are trying to use resource-owning types in untagged unions.
>>
>>55965691
common sense, except for the link at the end about OOP SOLID bullshit which totally ruined it for me. I mean like how can you fall for it FFS?
>>
>ah yes i put effort into "orienting" my entire codebase around "objects" even when it makes everything worse
>i then spend time on the internet telling everybody else to do the same because i seek validation for a decision i can't justify with facts
>>
>>55965720
>they had to appease the retards who a) can't wrap their heads around the union-as-struct concept and b) are trying to use resource-owning types in untagged unions
show me these, I want to see it with my own eyes. I know they are a bunch of CoCked pussies already, but still
>>
>>55965896
https://github.com/rust-lang/rfcs/pull/1444
>>
>>55965691
>if you can’t code with passion, you shouldn’t be coding at all
I totally agree. And I could add a lot ofg criteria like this one.
>>
_variable or variable_?
>>
>>55966051
__variable__
>>
>>55966051
_variable is reserved for the compiler
>>
>>55966051
First one, but using the underscore for identifiers are "reserved" in some languages. (They don't force this, but sometimes it's recommended to not name it like that.)
>>
File: maze.png (2KB, 632x300px) Image search: [Google]
maze.png
2KB, 632x300px
Did r/dailyprogrammer's weekly challenge.
>>
>>55965502
Use a web scraping method
>>
>>55966087
source code?

i wanna learn anon
>>
>>55962228
Just kill it with fire already
>>
>>55966102
It's fuck ugly and poorly commented,

Only compiles on Windows because I didn't want screen flicker and ncurses doesn't work on Windows.

http://pastebin.com/576cC88p
>>
Could someone explain what a closure is?
>>
Shilling this thread: >>55965043
Please stop by.
>>
>>55966232
A lambda that "captures" free variables.

In C, closures typically manifest as a function pointer with a void pointer to a "cookie".
>>
>>55963624
IRC is full of people whose main language is something else and who would never actually use Lua for a project unless it was specifically related to Lua. That is why it is filled with smart people and not dumb Lua monkeys
>>
I'm already good with python, is it worth learning django or should I learn php instead? Or some other alternative for simple web shit?
>>
>>55966277
So they differ from std::function because the arguments can be of any type, right?
>>
>>55966232
A function that captures values from the enclosing scope. An example in Lua:
function addFactory(a)
return function(b)
return a + b
end
end

The inside function 'closes' around the variable a. The function returns a function that takes a parameter b and adds it to the enclosed variable a. The inner function is a closure.
>>
>>55964319
Yes. & is a left inverse to * and vice-versa, as long as the operations are valid in the first place. So just like in the middle school algebra, you can apply to both sides:
*a = b
&*a = &b
a = &b

This completes the proof.
>>
>>55966349
std::function wraps a closure. The void* cookie is used to store the captured data.
>>
>>55966300
Wow, you sure are upset about it. Did Dirk put you in your place for suggesting something dumb on the list?
>>
>>55966351
>>55966370
Thanks lads.
The concept is much easier than I thought.
>>
>>55966355
lad pls rly
>>
File: golf.jpg (36KB, 268x409px) Image search: [Google]
golf.jpg
36KB, 268x409px
>>55966355
>>
File: torrent.png (27KB, 661x455px) Image search: [Google]
torrent.png
27KB, 661x455px
your thought?
>>
How do you access an API for a site that doesn't have a public one? I need a API to get a client id, so I can access information like inventory, stock, etc.
>>
>>55962768
> array2list([])
- Uncaught RangeError: Maximum call stack size exceeded(…)
>>
>>55964814
If you want fast indexing don't use a list. Use a Map or IntMap (if dynamic size) or an Array
>>
>>55966567
yup. Also linked lists should cache their length imho
>>
>>55966018
Wait, I'm confused, they merged the rfc, does that not mean they intend to add it to the language?
>>
>>55966594
yup.
>>
>>55959292
Not really desu. That shit has been optimized to hell and back since the 70s, so anything reimplementations are more of language exercises than anything else, which isn't really useful if you're not working on a new lang.

A good exercise might be to develop bindings for an optimized C/Fortran numerical methods library in a different language though.
>>
so if m is a map<string, int>
and you do decltype(m)::key_type, string will be returned

how do i do something similar for a custom templated class so that (assuming t is an object of my class)
decltype(t)::key_type returns something specified by me

i tried making typedef key_type within my class but i keep getting "a nonstatic member reference must be relative to a specific object" error
>>
>>55966665
template <typename T>
struct AType {
using ATypeVariable = T;
typedef std::vector<T> AnotherTypeVariable;
}
AType<int>::ATypeVariable x;
AType<float>:::AnotherTypeVariable xs;
>>
>>55966594
Good idea, dunno how I didn't think of that
>>
>>55966694
i still keep getting
>a nonstatic member reference must be relative to a specific object
>>
>>55966555
What makes you think that they have any API at all then? Either way if they have any private/internal API it's most likely behind some authorization gate which you won't get through so your best bet is to scrape instead.
>>
File: 1467990527644.png (58KB, 391x296px) Image search: [Google]
1467990527644.png
58KB, 391x296px
Hey folks, I wanted to ask you for some advice

I noticed this course on Game Programming and Design has been around in my college for a while, directed at computer science majors. I'm a physics major but I could take it as an optative.

The bibliography is:

>Jesse Schell,The Art of Game Design, Morgan Kaufmann, 2008. 4.
>Fullerton, Tracy; Swain, Christopher; Hoffman, Steven, Game Design Workshop: Designing, Prototyping and Playtesting Games, Editorial CMP Books, 2a Ed., 2008.
>Ian Millington. Artificial Intelligence for Games. 2a. Edición, USA San Francisco. 2009.
>Jeremy Gibson. Introduction to Game Design, Prototyping, and Development: From Concept to Playable Game—with Unity® and C#. Pearson Education. 2015.

Does it look any good? Should I give it a go?
>>
>>55966792
post code
>>
>>55966792
60% sure your argument to decltype is at fault. POST CODE
>>
>>55965190
Elixir syntax is fucking disgusting
>>
>>55966809
but.. you cant scrape something like inventory without a client id, and to get a client id you need the api iirc
>>
>>55966841
>>55966835
never mind, it looks like the reason it wasn't working was because my header files got mixed up some how and my cpp file was looking at an old copy of the header

thanks
>>
C++ guy here, I need some help understanding some java. Do objects in java work like pointers?

Lets say I've got an array Foo foo[]. Now I search the array and put the results in a new array Foo fooFiltered[].
If I now make some changes to objects in fooFiltered, will the changes be reflected in the original foo array?

So basically what I'm asking is do arrays in java store pointers or actual objects?
>>
What are some good resources to learn about lambda calculus?
>>
>>55967022
>If I now make some changes to objects in fooFiltered, will the changes be reflected in the original foo array?
Yes


So basically what I'm asking is do arrays in java store pointers or actual objects?
Yes
primitive types are an exception tho
>>
>>55966654
Meh, I just do it for fun and to get used to Haskell better.
>>
>>55967022
>Do objects in java work like pointers?
Yes each object is a reference (ie. a pointer).
>If I now make some changes to objects in fooFiltered, will the changes be reflected in the original foo array?
Exactly, you had just copied the reference.

>>55967022
They store objects, but objects in Java are pointers, not like C++. You can't have a raw object.
>>
>>55967022
>If I now make some changes to objects in fooFiltered, will the changes be reflected in the original foo array?
no
>>
>>55967022
Yes to all.
>>
>>55967022
everything in java with the exception of primitives are pointers.
>>
>>55967052
yes
>>
>>55967055
Primitives are objects in Java?
>>
>>55967072
no
>>
>>55967072
No, primitives are int,long,byte,float,double. They are allocated from the stack.
>>
>>55966606
That's correct
>>
New thread
>>55967224
>>55967224
>>55967224
>>55967224
Thread posts: 321
Thread images: 30


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.