[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: 354
Thread images: 41

Previous Thread: >>56555120


What are you working on, /g/?
>>
>>56559084
First for Java
>>
first for endofunctors
>>
>>56559084
Thank you for using a (non-trap) anime image.
>>
A monad is just a monoid in the category of endofunctors.
>>
>>56559296
>endofunctors
Well, the Monads most people talk about are specifically categorized over endofunctors on Hask.
>>
lets say im a complete beginner learning C#, how long would it take me to learn to code something like a media player/library similar to itunes but exclusively for store/playing audio files? how much longer would it take to give it a 'polished' look like say itunes or however i imagine it to be?
>>
File: 270.webm (240KB, 600x440px) Image search: [Google]
270.webm
240KB, 600x440px
>>
File: 1473646868978.png (132KB, 1080x1920px) Image search: [Google]
1473646868978.png
132KB, 1080x1920px
ILLARY CLINTON FOR HOSPITAL 2016

>literally using a 30 lbs lighter body double
>>
File: Play V3 2.png (16KB, 649x254px) Image search: [Google]
Play V3 2.png
16KB, 649x254px
>>56559342

You could do it in a few hours. If you do it correctly with appropriate OOP meme-patterns, it will take a bit longer.
>>
>>56559431
whoa i was expecting something like months but thats good to know, thanks
>>
any standard @media max/min width for screen resolutions?
>>
>>56559455
nah he's delusional maybe if you already knew C# you could get a working prototype in a few hours but not a real professional 'polished' finished product
>>
>>56559342
>>56559431
not the same anon, but.. what about a map (web/desktop/... multiplatform) app?
>>
nth for coq
>>
>>56559483

Throw some libraries at the problem and everything can be done in a few hours.
>>
>>56559490
I gave ur mum the coq last nite
>>
File: file.png (68KB, 902x691px) Image search: [Google]
file.png
68KB, 902x691px
Currently trying to plot out a new layout for my application's options menu. Kind of tempted to steal the Visual Studio style of treeview on the left, content on the right with a search bar.

Current setup works, but it doesn't manage resizing very well so I've been getting complaints from people trying to run it on a toaster that it's too big for them to do stuff.
>>
>>56559482
>but not a real professional 'polished' finished product

Did I imply that? If you want a truly polished product, it'll probably take a few months work.

A basic media player can be done within a week if you're learning to CShart in mart.
>>
>>56559546
>Kind of tempted to steal the Visual Studio style of treeview on the left, content on the right with a search bar.

I always contemplate doing that, but I can never figure out a good method for actually showing the panels on the right.
>>
>>56559559
ok i read his post sloppily, the polished part was a separate question, you answered the first part
>>
>>56559565
My current thought is to make a series of user controls. Use the tag for each panel as the value for the selected treenode, load and dispose as necessary. It's a bit less manageable than the current form since I can't just ctrl-f whatever in a single document, but it does become easier to do the other stuff.
>>
>>56559617
>I can't just ctrl-f whatever in a single document

You could have all the panels define in one document. Would sort of break the one-class-per-file """rule""", but since they're all intimately related, there's no reason not to.
>>
Daily reminder that clay > knives
>be clay user
>try out knife
>drive knife into my chest at full speed
>it kills me
How the fuck can anyone use this unsafe piece of shit? clay doesn't have this problem.
>>
File: il_570xN.607765236_9fu8.jpg (65KB, 570x570px) Image search: [Google]
il_570xN.607765236_9fu8.jpg
65KB, 570x570px
>>56559951

The clay compiler is written in knife, kiddo.
>>
>>56559951

Clay, if driven into the Solar Plexus at full speed, could probably kill someone as well.
>>
>>56559951
enjoy your clay collector stopping you everytime you have clay you aren't using
>>
File: 1473528696345.jpg (80KB, 479x720px) Image search: [Google]
1473528696345.jpg
80KB, 479x720px
>>56559084
If I like html, am I an homosexual?
>>
>>56560137
yes
>>
>>56560137
html is literally <1% of a serious project
>>
>>56560154
That wasn't what I asked.
>>
>>56560154
You know what, I was just going to let your little shit comment go, but you need to be taught a lesson boy. When I ask you a question, you better fucking answer it and you better answer it right code
>>
File: reeeeeeeee.jpg (24KB, 587x323px) Image search: [Google]
reeeeeeeee.jpg
24KB, 587x323px
I can't get my stupid code to work. I know im retarded but can't figure out what im doing wrong ffs
>>
File: 1473068569478.jpg (10KB, 164x160px) Image search: [Google]
1473068569478.jpg
10KB, 164x160px
>>56560225
Maybe programming isn't for you.
>>
>>56560225
INDENTATION
ASSIGNMENT OPERATOR AND EQUALITY OPERATOR ARE TWO DIFFERENT THINGS
YOU HAVE AN IF STATEMENT THAT DOES NOTHING
>>
how does this work exactly
Prelude> [1, 10..100]
[1,10,19,28,37,46,55,64,73,82,91,100]

I know it just +10 then -1, but how does it read
enumFromThenTo 1 10 100

from 1 then 10 to 100?
>>
>>56560225
>python
learn glorious java, the IDE will point out problems with sane error messages
>>
I'm planning on writing a java program that downloads a media (jpg png webm etc) off 4chan with the json api.

How would I go about this? I tried using the URL class and GSON for parsing and all that, but it is much too difficult for me to get working. At times when getting the json or whatever html code of a webpage, it would not connect. Only google works and the 4chan json api of a thread. If I were to use an URL like youtube.com, bato.to, or even 4chan.org, I would be getting an error.
>>
>>56560225
What language is this
>>
>>56560300
looks like cancerous python 3
>>
>>56559545
I agree with you dude. The problem is the ambiguity of the definition of `programming paradigm'.

To me, I just think about it as how the program is written, and not how it is run.
In this way, almost all programming is still procedural. But things like Prolog are borderline.
>>
>>56560254
it says
>returns an array of members of an enumeration starting with the first argument and finishing with the third one in distances determined by the second one, it is equivalent to syntax.

so why does 1 change things? [0, 10..100] produces 0, 10, 20, ...
>>
>>56560254
Wait, what?
I thought any sequence like that [x,y>x,..z] is always non-decreasing?
Why does it make an exception to reach 100 in this case?
[1,9,..100] doesn't do that, and it goes up to only 97.
>>
>>56560279
>>56560295
Is Java good? I seem to always see people shitting on it when I come here but it seems like lots of people use it. A
>>
>got my hot steamy debian setup just how I like
>libraries working well no issues with repositories
>got codeblocks working right because I can't live without it


Recommend me an author on C/C++ or Fortran
>>
>>56560360
it's literally one of the best languages alongside C++, people only hate it because of memes and butthurt
>>
>>56560370
ok pajeet
>>
>>56560360
It's pretty bad, but it only gets bad when you get really good. Same with Python I think. Some languages are bad from the getgo. Some languages are okay and always remain ok, while others start off ok and after a very, very long time, become horrible.

Some languages are great and stay great for a long while. You won't be able to recognize those languages until you've learned and gotten fairly good at one of the languages that gets bad.

So learn Java, sure.
>>
>>56560225
read a book, then start editing beginning from your while loop.
>>
>>56560225
The algorithm at glance:

>Create a infinite loop where you read the input.
>If the input is equal to zero, break it.
>In every iteration sum up the read number, and increment the totals of inputs by 1.
>After the loop, calculate the average dividing the total sum by the number of total inputs.
>Show the result to the user.
>>
>>56560345
>>56560254
now I somewhat get it I think
Prelude> [3, 9..100]
[3,9,15,21,27,33,39,45,51,57,63,69,75,81,87,93,99]
Prelude> [3, 6..100]
[3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99]


it looks like it just adds 3 in the second line, but actually it just adds 6 and takes 3 each time
>>
>From my other thred

So someone just offered me a spot in his startup for a percentage of ownership. I'm a CS & Math student in college and I'm asking for advice. It would involve a streaming video component on a website as well as normal streaming. I would also need to learn HTML or CSS ASAP before he gets someone else. How feasible is this? Also the kid is trying to move pretty quickly with this but I don't think he knows how long it will realistically take. Any help appreciated.
>>
>>56560409
What makes it bad though?
>>
>>56560154
what is most of it? like could u give me a quick rundown of something
>>
>follow this guide: https://www.microsoft.com/net/core#ubuntu to install the packages
>you get "This software may collect information about you and your use of the software, and send that to Microsoft." from apt-get
I just fell for the C#meme and my system joined the botnet...
>>
Hey friends I just dropped in to tell you I am going to learn cobol starting tomorrow!
>>
>>56560345
ignore this post, I misread

>>56560427
[x, y..z] = let diff = y - x in [x, y, y+diff, y+2*diff, y+3*diff..]
>>
>>56560446
he sounds inexperienced, if he doesn't have any credentials worth mentioning just do your own startup, and HTML and CSS are easy as shit, if he can't do that himself it's a red flag
>>
>>56560446
>young person
>startup
>technology
>using all of someone elses work

trash it
>>
A confusing aspect in C.

Why can sizeof determine accurately the size of (and consequently the length of) and array of integers when the array is declared with bracket notation, but it can't do the same with a pointer declared array?

Isn't a bracket declared array essentially a pointer anyway?
>>
Why am I obsessed with fortran and how do I convert this into employability
>>
>>56560453
It hides things but lets those things affect the real program
https://ideone.com/tMC6Dv

Any "justification" of this is just an explanation on why it's broken.
>>
>>56560446
tell him to fuck off
>>
>>56560489
No. Arrays are special until you pass them as pointers to a function.
sizeof will give you the length of an array if it's an array. When you pass an array name to a function, it decays to a pointer.
>>
>>56560470
>>56560474
Yeah honestly I could just zuckerberg him anyway. His idea has some obvious flaws and I can improve them and make a better site. I had already been thinking about a similar idea anyway. Thanks
>>
>>56560295
Why use shitty languages like Java when you can use bash?
curl -s "https://a.4cdn.org/$1/thread/$2.json" | jq -r ".posts[] | select(.tim) | \"-O https://i.4cdn.org/$1/\" + (.tim | tostring) + .ext" | xargs curl
>>
>>56560364
>google IDE fortran
>500$

wew, where's the free IDEs for linux with fortran parsing? is there only codeblocks?
>>
>>56560463
if anyone is interested:
https://askubuntu.com/questions/792214/how-to-stop-net-core-from-collecting-data-to-protect-privacy
>>
>>56560698
also
https://news.ycombinator.com/item?id=11988120

the sad part is, I still don't know how tf to use this C# library with dotnet/mono: https://github.com/pauldendulk/Mapsui (I'm >>56559483 ). could someone tell me? can I simply import then from the current directory? do I have to drop the dir somewhere?
>>
>>56560463
>>56560698
>hurr i should have the source code to everything because i'm a greedy fuck
>durr i'm not going to give anonymous usage statistics to help improve software

ubuntu is itself a botnet

fuck you
>>
>>56560761
shut the fuck up you fucking retard, stop vomiting memes and sucking corporate dick. or just kys already.
>>
>>56560779
you're the memeing fuck i bet you unironically look up to rms fucking underage communist faggot
>>
>>56560364
Kent Dybvig
>>
how do I make three 33% width divs in a row that will show one after another on mobile mode with css
>>
File: life4.webm (2MB, 1280x800px) Image search: [Google]
life4.webm
2MB, 1280x800px
Thanks for your help earlier. I got my game of life to work.
>>
>>56560871
flexbox?
>>
working on a mobile that acts as a gps system using google maps api with geofencing.
though i'm lacking a few more features before i can believe it's done.
Any ideas?
>>
>>56561008
just steal features from other map apps and gps devices?
>>
>>56560295 here, I just finished being able to connect to the json page and create an object with it with GSON.

Now, about the API rules... what does making 1 request per second mean?

>>56560295
I wanna practice
>>
>>56560489
On 64 bits machine:
sizeof(void *) == 8;

int a[1];
sizeof(a) == 4;

int *p = a;
sizeof(p) == 8;

void *mem = malloc(rand() % 0xFF);
sizeof(mem) == 8;

C does not and should not track allocations' size, it's your work to do that.
>>
>>56560904
>wrapping around
thats cheating.
>>
So I'm doing a little experimenting. If you go to:

http://www.testufo.com/#test=framerates

The top alien scrolls smoothly, but then at about every 1/4 screen it suffered a little kick - does any one else get this? It's like a little flicker, like the sprite stopped moving for a few frames then resumed.

Trying to solve this programmatically has lead me down an incredibly deep rabbit hole of different theory. So far the only application I've found that can consistently move something across the screen without a kick is blender with auto framerate dropping.
>>
File: life6.webm (3MB, 1280x800px) Image search: [Google]
life6.webm
3MB, 1280x800px
>>56561310
How should I handle edges then?
>>
>>56561683
You just posted a dick
>>
>>56561683
Thanks my boss saw me looking at this and gave me a promotion.
>>
>>56561683
Ruby, for the simple minds. Enjoy b&
>>
>>56561683
>implying you're a girl
>>
File: Lanka 24.png (12KB, 122x167px) Image search: [Google]
Lanka 24.png
12KB, 122x167px
This is pretty nifty
http://forum.dlang.org/post/[email protected]
>>
I dunno why, but this:
 
delete [] array;
array = nullptr;

gives me a exception error, but:
array = nullptr;
delete [] array;

is fine

Arnt you supposed to delete the object then reassign the pointer to a null address?
>>
>>56561683
LAC?
>>
>>56561893
You aren't supposed to use new/delete at all.
>>
>>56559084
So I got distracted by other things, but my VM is coming along nicely, though it's not a huge issue translating code over. Halting works, I'll get to IO tomorrow.

http://pastebin.com/mpXh17dr
>>
>>56561893
>then reassign the pointer to a null address?
Only turds do that.
>>
File: Screenshot_2016-09-12_03-03-25.png (64KB, 589x96px) Image search: [Google]
Screenshot_2016-09-12_03-03-25.png
64KB, 589x96px
>>56562011
Forgot pic, though it's nothing super special
>>
>>56561999
>>56562013

im just going by the book
>>
>>56562041
Which book and for with C++ revision?

Remember, anything about Sepples without Stroustrup or Sutter on its cover is shit.
>>
>>56562116

>Remember, anything about Sepples without Stroustrup or Sutter on its cover is shit.

fugg :DDDDDD
whats a sepple?

http://www.apress.com/9781484200087

should I just dump this then?
>>
Hey /g/. I started programming seriously back in May. Before that I know just a little theory and GML. I started with C# and quickly moved on to Python. Until a week ago, I had a sprawling repo of my solved challenges on Github. Now I haven't solved a challenge for nearly two weeks. I dunno why. Can somebody tell me how can I get my spark back? I kinda got bored since I didn't do anything real I guess.
>>
Is getopt the best tool to get cli options in c++?
>>
>>56562190
>global state
no
>>
>>56562225
What do you mean?
What do you suggest?
Thanks.
>>
>>56562233
>What do you mean?
It uses global variable cancer.
Not to mention that it's POSIX only.

>What do you suggest?
A switch inside an if inside a while loop.
>>
>>56560510
Thank you. How exactly are arrays treated, in that case? Are they treated essentially like an alternative data type?

>>56561234
Yeah, I've been working keeping track of the size (and length) of dynamically allocated arrays in the most hassle-free and efficient way. What is a common method of doing so?
>>
>>56562247
Excuse me, but maybe we are talking about different things.
Doesn't get opt just get argv and arc and basically loop over them and stuff?
Where is the global cancer apart from argv and argc?
>>
File: 1467557438617.png (477KB, 1450x1080px) Image search: [Google]
1467557438617.png
477KB, 1450x1080px
Does somebody have suck pictures or lists but with sorting by difficult?
>>
>>56562269
>extern char *optarg;
>extern int opterr, optind, optopt;
>>
>>56562277
>such*
fix
>>
>>56560510
Oh, and I forgot to add, what if they're passed to a function into an array parameter?

i.e.

(assuming "arr" is a bracket declared array)

Function call:
func(arr);


Function definition:
void func(int arr[])
...
>>
>>56562285
Damn you are right, totally forgot about them since it's been a while.
I am a bit suprised that after googling around it's either getopt or boost.
I don't want to introduce 30 MB of dependencies just for boot's getopt, so it's either getop (no posix) or manually loop over.
What do you guys suggest if i am building a github portfolio to eventually show employers?
Is looping over your shit seen as dirty?
>>
i am new to prolog and trying to implement a program that checks to see whther or not a given list of coordinates (a 9x9 cell) contains all cells from [1,1] -> [9,9]

does anyone have any tips on how to do this? the input would be

[[[1,2],[1,2],[1,2],[2,1],[2,2],[2,3],[3,1],[4,1],[4,2]],
[[1,4],[2,4],[2,5],[2,6],[3,6],[3,7],[3,8],[4,8],[4,9]],
[[1,2],[1,6],[1,7],[1,8],[1,9],[2,7],[2,8],[2,9],[3,9]],
[[3,2],[3,3],[3,4],[3,5],[4,3],[5,1],[5,2],[5,3],[5,4]],
[[4,4],[4,5],[4,6],[4,7],[5,5],[6,3],[6,4],[6,5],[6,6]],
[[5,6],[5,7],[5,8],[5,9],[6,7],[7,5],[7,6],[7,7],[7,8]],
[[6,1],[6,2],[7,2],[7,3],[7,4],[8,4],[8,5],[8,6],[9,6]],
[[6,8],[6,9],[7,9],[8,7],[8,8],[8,9],[9,7],[9,8],[9,9]],
[[7,1],[8,1],[8,2],[8,3],[9,1],[9,2],[9,3],[9,4],[9,5]]]
which would fail because theres no [1,1]
>>
>>56562116
also this is the code I'm talking about:

int max{};
cout << "how many primes do you want? " << endl;
cin >> max;
int *primec{ new int[max] };
*(primec + 0) = 1;
*(primec + 1) = 2;
*(primec + 2) = 3;
*(primec + 3) = 5;
int potentialprime = 5;
int ccont = 0;
int primeco = 4;
int fngbase = 4;
while (ccont < max)
{
int test = potentialprime + 2;
int testcntr = 0;
int testisprime = 0;
while (testcntr < potentialprime){
if ((test % ((potentialprime + 2) - (testcntr + 1))) == 0){
testisprime = 1;
}
testcntr++;
}
if (testisprime == 0){
primec[primeco] = potentialprime + 2;
primeco++;
ccont++;
}
fngbase++;
potentialprime += 2;
}
for (int l = 0; l < max; l++){
cout << *(primec + l) << endl;
}
delete[] primec; // this does'nt work
primec = nullptr;


no bully
>>
>>56561023
yeah but there are a lot of ideas that don't fit my app.
>>
>>56562323
Honestly, if you just want to do it and be done with it, and do not care for systems other than POSIX then just go with getopt. Otherwise just manually looping is fine, I haven't seen anyone who would consider it as dirty, especially for something as trivial as parsing arguments.
Also, if you are interested for GNU-like long arguments you should probably go either with getopt_long which is glibc-only or with your own solution. However I think that it would be better to just use the alternative -flongOption instead just to be compatible with how POSIX handles arguments.
Also, if you go with your own solution please remember that in POSIX the second - stops the argument parsing and considers the rest normal input, useful when you have a file that starts with - for example.
>>
>>56562387
I see, thanks for the suggestion, i found a good samaritan wich basically redid getopt but portable and actually no global shit, i am probably rolling with it.
https://github.com/skeeto/optparse
It breaks my heart that classes start soon and i will have to abandon this general, best place on 4chan.
>>
>>56562337
If any coord <1 or >9, return false;
Create a map of coord pairs (like [1,2]); values of the map would be how many of those coord pairs have you encountered in your input.
If any value is 2 or more, return false;
return true;
>>
>>56561607
Well, a game of life board is actually infinite, so there are no edges

Instead of having it be double-array based, you can have a vector of coordinate-pairs of cells that are alive and add or remove from that as necessary.
>>
>>56562409
This is quite nice, thank you for sharing it.

>It breaks my heart that classes start soon and i will have to abandon this general, best place on 4chan.
Best of luck anon. Are you on CS as well? I will start soon too and I have the same worry, I just hope that I will still be able to visit for 1-2 hours per day.
>>
File: hxykyb202tbx.png (2MB, 1600x900px) Image search: [Google]
hxykyb202tbx.png
2MB, 1600x900px
>>56562446
Yeah i am in cs.
>>
>>56559084
What are some hot nosql databases that I should look into?

I've used Redis, Neo4j, MongoDB, and Elasticsearch (is elasticsearch a nosql database?)
>>
>>56562409
>>56562446
Lmao are you kidding me? Since when is CS so demanding that you can't' go on 4chan I was even coming here during lectures
>>
File: 1469404795889.jpg (19KB, 262x274px) Image search: [Google]
1469404795889.jpg
19KB, 262x274px
>>56562535
>browsing 4chan in public
>>
>>56562535
It depends on your college/university you are attending.
Mine is one of the best of my country and the stem faculties are kinda bone breakers.
I have to take the train every day on top of that.
That means i will have no time for projects and i'll be stuck on lurking casually when i can.

>Since when is CS so demanding that you can't' go on 4chan I was even coming here during lectures
When i am to lectures i prefer paying more attention to lectures.
I don't know if you are american but here in europe cs courses have more math than engineering courses and less than full math degrees and is not considered meme shit.
>>
>>56562556
>le secret club :D
There were others in my class who were on 4chan too
>>
>>56562578
UK?
>>
hey guys what are some features of social networks that need map visualization?
>>
>>56562338
            if (testisprime == 0){
primec[primeco] = potentialprime + 2;
primeco++;
ccont++;
}

When calling delete[], the pointer must be to the start of the allocated block. You incremented it in the above if clause.

>Arnt you supposed to delete the object then reassign the pointer to a null address?
Yes.
>>
>>56562338
is my problem really obvious or is this the wrong place to ask?
>>
>>56562601
see >>56562600
>>
>>56562116
>Stroustrup's book
>good
>>
>>56562600
>When calling delete[], the pointer must be to the start of the allocated block. You incremented it in the above if clause.
False
>>
>>56562600
fugg
so adding in
prime = *(prime+0)
sends to pointer back to the start right?
>>
>>56562116
I have the c++ book from stroustrup. He's bad at explaining.
>>
File: IMG_20160912_102336.jpg (192KB, 864x1152px) Image search: [Google]
IMG_20160912_102336.jpg
192KB, 864x1152px
>>56562578
>anon humbly implying his university is better than mine
If you're not in US, you didn't go to a better university than I did. Have you considered that maybe you're just not that bright?
>>
>>56562338
Use the sanitisers anon, they always help a ton to finding out problems. Here is the script I use to make calling gcc easier.
$ cat ~/bin/c
#!/bin/sh
gcc -Wsizeof-array-argument -fdiagnostics-color=always -g -gdwarf-4 -Og -Wall --std=c11 \
-Wpedantic -fno-diagnostics-show-caret -fsanitize=undefined \
-fsanitize=address -fno-omit-frame-pointer -fcilkplus -pthread \
-lm -D_FORTIFY_SOURCE=1 -D_XOPEN_SOURCE=700 -I ~/include/ \
-L ~/lib/ -Wno-maybe-uninitialized "$@"

You probably want just
g++ -g -Wall -fno-diagnostics-show-caret -fsanitize=undefined -fsanitize=address -fno-omit-frame-pointer -D_FORTIFY_SOURCE=1
>>
>>56562600
>You incremented it in the above if clause.
No he didn't.
>>
>>56562659
>reading comprehension
>>
>>56559628
What I'd kind of like to be able to do is dynamically generate the menu options; like if I have a boolean option, I'm obviously going to use a checkbox. At that point I just need to generate the checkbox ; all the strings are localised using tags as references to an XML so that's easy to manage, default state of the checkbox obviously comes from the options, etc. Would be a bit more complex for things like comboboxes, but that's still doable.

The other dev on my project's going on about doing everything with databindings, but the code for that terrifies me and I haven't found any decent tutorials that help me understand how to implement it. Definitely not as easy as just plopping down a checkbox.
>>
>>56562638
I am not implying anything, just that here you won't find many people fucking around during lectures, and the ones who do are usually the lower grade "as long as it works" crowd.
I used to do that in high school, it was a waste of time.
>>
>>56562663
I realised it just after I made my post, sorry.
>>
File: Im feeding them.jpg (175KB, 819x791px) Image search: [Google]
Im feeding them.jpg
175KB, 819x791px
>>56562648
is it bad that i do not know what this is as a newbie
>>
>>56562338
If user inputs 5 as max, program will put 9 numbers into the primec array while it can only hold 5. That's your problem.
>>
>>56562651
>>56562621
Oh crap, I misread primeco and primecec, my bad.

Disregard what I said. Legitimately don't know why its not working then. What happens? Just a segfault?

>>56562619
Where in the standard does it specify that deleting[] on an incremented pointer is not UB?
>>
>>56562668
Or the ones who are bored because they understood the slide without further baby talk from the lecturer.
>>
>>56562688
Yes, ofc.
That happens to me too, but i believe that opening your browser and doing completely unrelated stuff because you got a slide fast will just distract you in the long term.
I am not telling you not to.
>>
>>56562675
What compiler are you using?
These are arguments passed to gcc/g++, the GNU compilers for C and C++. -g tells it to compile with debugging symbols. -Wall tells it to print all the warnings (the useful ones at least, there are many that are not included), -fno-diagnostics-show-caret -fsanitize=undefined -fsanitize=address -fno-omit-frame-pointer are all options for the sanitisers, consider them as run-time checks that tell you the exact problem and its location in the source. -D_FORTIFY_SOURCE=1 I am unsure what changes it makes but it adds more sanitisation I guess. Also check https://github.com/google/sanitizers/wiki
>>
>>56562682
>Where in the standard does it specify that deleting[] on an incremented pointer is not UB?
None, I meant to only quote
>You incremented it in the above if clause.
>>
>>56562676
mmmm the program can accept 5 inputs or less, its only when
 delete[] primec 
is called that the exception comes about

also I get a : "
HEAP CORRUPTION DETECTED: after Normal block (#181) at 0x0083C938.
CRT detected that the application wrote to memory after end of heap buffer.
"
error message
>>
>>56562738
>CRT detected that the application wrote to memory after end of heap buffer.
You are probably writing at primec[x] where x >= max.
>>
>>56562712
I'm using VS 2013
is that inherently bad?
>>
>>56562756
>>56562712
>>56562682

THANKS

fuck me
 int ccont = 0; 
is wrong, It needs to be
 int ccont = 4; 
or else it'll keep inputting weird stuff.
thanks /g/
>>
File: lulz.png (405KB, 672x880px) Image search: [Google]
lulz.png
405KB, 672x880px
could you guys recommend some good python books?
i was thinking of going through pic related
>inb4 python is shit learn X instead
I'll learn other languages later on, but I have been working with python for some time now and I don't like dropping things like that
>>
File: CqQSYVyVMAA_7Eu.jpg (147KB, 803x1200px) Image search: [Google]
CqQSYVyVMAA_7Eu.jpg
147KB, 803x1200px
>>56562790
have a maid as my thanks
>>
>>56562638
For Bachelor's?
How the hell does one even get in Cambridge? My friend with A*AA applied and he was rejected.
>>
>>56562638
oh mr almighty can you tell us what books cambrige uses to teach programming languages?
>>
>>56562823
>A*AA
lel. I have friends who got rejected with A*A*A* and went to Imperial m8. You need A*A*A* and good interview
>>
>>56562859
How much did you get?
>>
>>56562832
I read SICP and Intro to Algorithms in my first year. Check https://www.cl.cam.ac.uk/teaching/1617/CST.pdf for current curriculum

>>56562871
I'm international. Had a few medals and 100% on my high-school exams that got me in
>>
>>56562675

I've been coding C for years and I've never heard of some of these flags.

I recommend:

-Wall -g -D_FORTIFY_SOURCE=2 -fstack-protector -fPIC -Wextra -fsanitize=address
>>
>>56562959
>
-D_FORTIFY_SOURCE=2

Fucks up legit code, this is what the documentation says at least.

>-Wextra
It adds tons of bullshit warnings over legitimate code. I have yet to stumble upon a legitimate warning from -Wextra.

No reason to exinclude -fsanitize=undefined
>>
File: 1468942180029.jpg (142KB, 1920x1080px) Image search: [Google]
1468942180029.jpg
142KB, 1920x1080px
>>56562930
brb, killing myself
enjoy your sweet university anon.
>>
>>56563013
Already graduated m8
>>
>>56562930
I am also considering to try to get into Cambridge.
International as well, pretty good high school exams (fulfilling the standards they name on their webpage, at least), finished apprenticeship, a couple of certs from international competitions and significant contributions in free software.
Second choice would be Edinburgh. Any tips?
>>
>>56563111
>significant contributions in free software.
Such as?
>>
>>56563111
What kind of significant contributions in free software? If you're young, I'd do something hot that looks cool. Do some deep learning projects for example and upsell it. Become Kaggle expert or contribute to big libraries such as scikit-learn or ghc or something relevant to your interests. Get a phone app with a several thousand downloads if you can get it down in a weekend and mention it casually. Just do some impressive-looking things, don't imagine the interviewers can't be blinded by shiny stuff
>>
File: 1465705996701.jpg (321KB, 665x786px) Image search: [Google]
1465705996701.jpg
321KB, 665x786px
I actually made an array that increases once you reach the cap limit
void cpy( int x[] ,int y[] ,int r)
{
int cntrr = 0;
while (cntrr < r){
x[cntrr] = y[cntrr];
cntrr++;
}
}

int main(){

int amt{};
cout << "input amt of numbers to be inputted: " << endl;
cin >> amt;
int* expp{ new int[amt] };
int cntr = 0;
int state = 0;
int placehold = 0;
while (state == 0){
if (cntr == amt){
cout << "maximum breached, remaking list: " << endl;
int* exppr{ new int[amt] };
cpy(exppr, expp, amt);
delete[] expp;
expp = nullptr;
int examt = amt;
amt = amt + 1;
expp = new int[amt]{};
cpy(expp, exppr, examt);
delete[] exppr;
exppr = nullptr;
}
cout << "input number: " << endl;
cin >> placehold;
expp[cntr] = placehold;
cntr++;
cout << "to continue input 0" << endl;
cin >> state;
}

for (int g = 0; g < amt; g++){
cout << expp[g] << endl;
}

system("pause");
return 0;
}


c-can i have some braise?
>>
>>56563176
There is only one cpy() needed; you use two. Not very braiseworthy.

Also allocating is a fairly expensive operation so people usually allocate an array that's twice as large as original (instead of 1 element larger).
>>
>>56563229
Most implementations use 1.5.
>>
>>56563269
Well, I've seen 2x more, but I haven't seen a lot, so maybe.
>>
>>56563176
now change it into a reusable class
>>
In C#, if I have a constructor for a class (called Cell), and I create a 2d array of Cells as such:
Cell[,] class_times = new Cell[7,8];


Does my constructor get called on each cell and set the values to what's in my constructor?
>>
anyone knw why this is returing
ERROR: nb_linkval/2: Arguments are not sufficiently instantiated
?

cgrid([H|T]) :- 
nb_setval(Grid, [H|T]),
nb_getval(Grid, Gcells),
write(GridCells),
length(H, size),
size =:= 9,
rowgrid(H, T),
cgrid(T).
>>
>>56563176

>system("pause")
Have you ever wished that you could bitchslap someone through the Internet?
>>
File: anal beads.png (33KB, 613x765px) Image search: [Google]
anal beads.png
33KB, 613x765px
>>56563379
>Does my constructor get called on each cell and set the values to what's in my constructor?

No.

You can test this in 5 seconds using a breakpoint.
>>
>>56563279
>>56563229

i see, thanks for input

>>56563434
too bad i guess ;^)
>>
>>56563434
What other code will output a localized message to user asking him to press any key?
>>
>>56563575
>>i see, thanks for input
No.
Change your code to use one cpy().
>>
>>56563594
that is what I meant
i will see how to work that out, thanks
>>
/dpt/ irc channel when
>>
>>56563617
They have existed and they have always been cancer.

Better off joining a Discord or IRC for your specific languages.
>>
REEEEEEEE
>>
>Failed to update password. Password must not contain repeating characters.

Are you fucking kidding me
>>
>>56562141
See-plus-plus == sepples, Rajesh.
>>
>>56563798
Not him but you need to fuck off.
>>
File: image.jpg (89KB, 720x960px) Image search: [Google]
image.jpg
89KB, 720x960px
I want to become a software dev in the future and I'm planning on registering at my local community college for some computer science,Java,and C++ classes for the up and coming spring semester pretty soon. Do the intro classes to these courses typically expect you to have some general knowledge on these topics? Because I'm pretty tech/computer illiterate right now.
I study some Sol Learn C++ from my IPad from time to time but I feel as if I'm not really learning anything that'll help me in the future
Please no gentoo. Seriously need some advice
>>
>>56563828
>Do the intro classes to these courses typically expect you to have some general knowledge on these topics?
Typically no, but you should drop them an email and ask
>>
>>56563822
No thanks, anon. Stay on topic please.
>>
>>56563828
>Do the intro classes to these courses typically expect you to have some general knowledge on these topics?
No.
>>
>>56563828
A lot of Intro classes are an Introduction to the language specific functionality, not general Introductions to programing, e.g. A Java course may teach you all about classes and inherritence, polymorphism but skips conditionals, loops etc.

So you should know at least a bit, get to know the language, learn the syntax, do some simple exercises (fizzbuzz etc).
>>
File: 1471225503397.png (222KB, 366x500px) Image search: [Google]
1471225503397.png
222KB, 366x500px
>tfw my dad called my meme CS degree a programming degree
>>
>>56563948
>falling down the stairs meme
>>
File: 1422661826207s.jpg (3KB, 123x125px) Image search: [Google]
1422661826207s.jpg
3KB, 123x125px
>>56560492
>What is boxing?
I think you did not understand the concept used here.
The "==" compares reference equality, which is not unambiguous given due to boxing rules and optimization.
You can create undefined behavoir in every popular language by applying wrong operators.
The proper way would be:
Integer a100 = new Integer(100);
Integer b100 = new Integer(100);
System.out.println(a100.compareTo(b100));

or if you necessarily wants to use boxing:
Integer a100 = 100;
Integer b100 = 100;
System.out.println(a100.intValue() == b100.intValue());

All this behavior is well documented
t. pajeet
>>
>>56563587

Honestly, if you needed to do that exact functionality, you could rig something up in ncurses (for being able to read "any" key), and it would be both more portable and more secure. But I would first question why such functionality is even needed in the first place.
>>
>>56563594
if (cntr == amt){
cout << "maximum breached, remaking list: " << endl;
int* exppr{ new int[amt] };
cpy(exppr, expp, amt);
delete[] expp;
expp = nullptr;
int examt = amt;
amt = amt * 2;
expp = new int[amt]{};
int cntrr = 0;
while (cntrr < examt){
expp[cntrr] = exppr[cntrr];
cntrr++;
}
delete[] exppr;
exppr = nullptr;
}

done ;^)))
>>
stupid jokes aside how does one learn assembly? Any good books?
>>
>>56564662
step by step assembly with Linux
it's white and has blue cogs on the front
>>
File: 1473614942364.jpg (13KB, 288x318px) Image search: [Google]
1473614942364.jpg
13KB, 288x318px
Is cobol a good language to start learning?
>>
>>56564084
compareTo() is different from equals()?
>>
>>56564717
In the 1980s maybe
>>
>>56564717
No.
>>
>>56564717
Yeah if you can somehow get a job with it. People I've seen who know it are dinosaurs sitting in comfy jobs since no one is there to replace them and their companies are to cheap to update to a new platform. So... No?
>>
>>56564705
>with linux
Do i have to use linux?
>>
j>>56564811
Windows is banned from /dpt/ fgt
>>
>>56564819
But i have no spare computers to run linux ;_;
>>
I have been traveling constantly recently, and I can't take a laptop with me because the only one I have is too big and the battery is fucked anyway so I take my Nexus on the road.
Question is, can I somehow use it to write networking code in whatever language and run a little Go/C/C# web server on it (through Termux) with the phone in airplane mode?
I have not heard of anyone doing this but thought you guys might know as you're usually pretty hot shit with these things.
>>
>>56564737
>>56564741
>>56564778
The reason I ask is because a huge amount of companies around in my area use it for a lot of their stuff. My university actually makes it mandatory because so many of the jobs around here are COBOL programming and there is almost no one to fill their positions. It's also worth noting that almost no one from my degree program graduates without a job. Also thanks for your responses guys. I love you :)
>>
>>56564819
Everyone here runs Windows
>>
>>56564845
all computers can run linux
>>
>>56564952
But i dont want to reinstall a new os ;_;
>>
File: 1468540941275.jpg (122KB, 845x740px) Image search: [Google]
1468540941275.jpg
122KB, 845x740px
>>56564949
Stop projecting.
>>
>>56564949
kek
>>
>>56564939
Do you live near banks?
I hear they still have cobol openings
>>
>>56564949
wew lad
>>
>>56564662

boards.4chan.org/g/thread/56558736/i-want-to-learn-to-program-ive-read-the-wiki-and#p56563125
>>
>>56565022

Let's try this again:

>>56563125
>>
>>56564962
> what is dual-booting
Also once you've done it once or twice you'll see that (re)installing GNU/Linux is much less of a headache than Windows.
>>
>>56565036

>introduction to assembly(brief contents)
>1400 pages

Wew
>>
>>56565069
Ill still read it
>>56565044
Mmmm Ill pass, plus i think i have a crapbook i can install kali on...
>>
File: error.png (2KB, 368x82px) Image search: [Google]
error.png
2KB, 368x82px
Please help. I can't solve it.
>>
>>56565079
underage or great bait
not sure
>>
>>56564977
Insurance companies are what I'm around.
>>
>>56565130
How not to ask for help, the post.
>>
>>56565142
kinda checks out

>>56565138
is kali that bad? Im in a uni course that will use it next year.
>>
>>56565163
what uni?
>>
File: werwrwqr.png (9KB, 585x378px) Image search: [Google]
werwrwqr.png
9KB, 585x378px
complete beginner in python here, trying to make a simple Witcher1 like poker dice

but at this point I'm fairly certain that there is a funtion that will do all of this in one line...
is there a number-matching function or something like that?

I'm in the middle of codeacademy course but I know that if I don't practice, I will forget everything
>>
>>56565179
no point saying, its a pretty bland average one
>>
>>56565180
oh yeah the double equation sighn, I know, I know just fixed that
>>
>>56565180
what the fuck is that shit jesus

random_numbers = [randint(1,6) for _ in range(6)]
print("{} identical numbers".format(len((random_numbers)) - len(set(random_numbers))))
>>
>>56565180
i think there is a template function for python right
>>
>>56559344
>japanese people still use the built-in laptop modem
>>
>>56565232
eh this is too complicated for me :(
>>
File: d.jpg (33KB, 500x713px) Image search: [Google]
d.jpg
33KB, 500x713px
>finish writing Java class files in NetBeans
>use Jsoup (external .jar file) in class files
>right-click project and hit Build
>To run this application from the command line without Ant, try:java -jar "C:\directory\path\dist\projectname.jar"
>open command prompt
>runs fine, but only runs the project's solitary main class

>try to run all five individual class files
>javac -cp "C:\external\jar\directory\path\here\jsoup-1.9.1.jar" *.java
>enter "dir" to see if class files generated
>duplicate files of the .java files appear with .class extensions
>success
>enter "java ClassName" to run compiled files
>Error: Could not find or load main class ClassName

anyone know how to get around this?
>>
>>56565277
>generate random numbers using a list comprehension
>calculate duplicates by computing the difference between the list of numbers and the set of numbers
>it works because set removes duplicates
>print number of duplicates
>>
>>56565247
That the connection is hard-wired doesn't necessarily mean the laptop has a modem built-in.
>>
>>56565296
>posting that disgusting shit on a blue board
>>
>>56565296
don't drink the java
>>
>>56565297

what if you wanna check if there is a say, Full House which is one pair and one triple
>>
Can someone linke me some Haskell excercises? There are enough literature sources, but not that many Excercises and answers.

Please anyone.
>>
how can i turn something like
[[9,9],[[7,1],[8,1],[8,2],[8,3],[9,1],[9,2],[9,4],[9,4],[1,1]]]


into

[[9,9],[7,1],[8,1],[8,2],[8,3],[9,1],[9,2],[9,4],[9,4],[1,1]]
in prolog?
>>
>>56565298
What are you talking about? That's obviously a telephone plug. When have you ever seen a computer with a telephone plug that doesn't have a built-in modem?
>>
>>56565324

you're on your own after this

def is_fullhouse(elements):
"""Check if elements (list of 6) is a full house

>>> is_fullhouse([1,1,1,2,2,3])
True

"""
counts = [elements.count(elem) for elem in elements)
return 2 in counts and 3 in counts
>>
>>56565363
depends, how fluid is your german?
https://www.inf.tu-dresden.de/content/institutes/thi/gdp/teach/2016ss/prog/tut/tut02.pdf
>>
>>56565363
why not do other prog lang exercises in haskell?
>>
>>56565368
Looks like cat5e to me.
>>
>>56564727
equals returns either true or false. compareTo returns -1 if the caller is less than the argument, 0 if the caller is equal to the argument, or 1 if the caller is greater than the argument.
>>
>>56565384
the `)` should be `]` when i assign to `counts` btw
>>
Is there some kind of framework for C that will compile it to multiple platforms?
>>
File: 1435194745803.jpg (42KB, 669x746px) Image search: [Google]
1435194745803.jpg
42KB, 669x746px
>>56565394
>why not do other prog lang exercises in haskell?
>>
>when you get focodeblocks working

FOSS fortran projects where?
>>
>>56565363
implement a simply typed lambda calculus
>>
Have cooldown timer been reduced on /g/?
>>
who is your waifu
>>
Anyone here with an image that lists a bunch of projects to choose from? Dunno if its a roll or not, but i saw one that is listed by difficulties before
>>
>>56565367
http://stackoverflow.com/questions/15926034/how-to-merge-lists-in-prolog
>>
>>56565449
The C language is portable, you know.
>>
>>56565567
loser
>>
>>56565574
But the compiled code isn't.
>>
File: scala.png (362KB, 565x736px) Image search: [Google]
scala.png
362KB, 565x736px
>>
>>56565595
Just compile it again.
>>
>>56565608
What's the joke?
> t. never touched Java
>>
>>56565608
>using scala or java
>2016
>not rust+fortran master race
>>
>>56565573
this didn't work
>>
>>56564949
Nope.
>>
>>56565368
It could be two ethernet ports. I've seen older laptops with two of those.
>>
Why java is the best language in 2016?
>>
>>56565785

It isn't
>>
>>56565785
Nice trick question.
>>
>come up with idea
>That sounds great let's make it
>Start with a pretty rudimentary design
>Day goes on
>Lurk internet for a while
>Find website that does what you want but better

Err time man
>>
>>56559951
I too am an avid fan of false equivalencies.
>>
>>56566044
false equivalencies > you
>>
>>56564949
N-NANI??
>>
>>56565864
>Err time man
?
>>
Why is eclipse always such a nigger? and where are the alternatives that do what it does without being programmed in memeva?
>>
>>56566169
Nevermind I just found this

https://sekao.net/solidoak/
>>
>>56564962
You can always just use a virtual machine
>>
>>56559084
also posted in sqt
>So I use vim on arch on my laptop and just installed vim (called vim80) on my windows machine where do I put my dotfiles i.e .vimrc and .vim folder?
>>
>>56565864
Don't let that stop you. I started one of my projects even though the only two relevant systems like it have been developed by PhDs for more than 20 years.
>>
What are some good beginner projects for python
>>
>>56566366
>>So I use vim on arch on my laptop and just installed vim (called vim80) on my windows machine where do I put my dotfiles i.e .vimrc and .vim folder?
arch users, everyone.
>>
>>56566366
in your home directory, though i think you prefix them with underscore rather than dot
>>
>>56565163
http://docs.kali.org/introduction/should-i-use-kali-linux
Maybe that helps answering the question with "no"
>>
return bool(x % 2) 
google here the fuck i come hope you have a great job opening with my own office
>>
fuck i need to poop but my phone is charging.
>>
>>56566613
take SICP with you
>>
def recurPower(base, exp):
'''
base: int or float.
exp: int >= 0

returns: int or float, base^exp
'''
if exp == 0:
return base * exp+1
else:
return base*recurPower(base, exp-1)
is something wrong with my indentation here? im getting a syntax error saying my
return base * exp+1
is outside the function
>>
>>56567353
>is something wrong with my indentation here?
yes, clearly. try
def recurPower(base, exp):
'''
base: int or float.
exp: int >= 0

returns: int or float, base^exp
'''
if exp == 0:
return base * exp+1
else:
return base*recurPower(base, exp-1)
>>
File: BenderEmbarassment.gif (282KB, 500x370px) Image search: [Google]
BenderEmbarassment.gif
282KB, 500x370px
Trying to use Magick++, and am using this video: https://www.youtube.com/watch?v=7miwnp8iDm8
to help me link the Magick++libraries to XCode, but I'm running into an error.

When I run the
Magick++-config --cppflags --cxxflags --ldflags --libs 

on the Magick API (around 3:30 in the video), I get the following error message

ImageMagick-6$ Magick++-config --cppflags --cxxflags --ldflags --libs
/usr/local/bin/Magick++-config: line 50: pkg-config: command not found
/usr/local/bin/Magick++-config: line 47: pkg-config: command not found
/usr/local/bin/Magick++-config: line 53: pkg-config: command not found
/usr/local/bin/Magick++-config: line 56: pkg-config: command not found


I did everything the guy did in the video (Install through homebrew, used the same terminal commands, etc..), so any ideas on what I'm doing wrong?
>>
>>56567403
>pkg-config: command not found
install pkg-config ?
this is not >>>/g/sqt , though
>>
>>56567442
>this is not >>>/g/sqt , though
Eh, fair enough. It was programming related, so I thought I'd ask here anyways.

But
brew install pkg-config
worked, so thanks!
>>
Leibniz equality.
Eq : (A : Type) => (x y : A) => Prop
Eq A x y = (P : A => Prop) => P x => P y

refl : (A : Type) => (x : A) => Eq A x x
refl A x P p = p

sym : (A : Type) => (x y : A) => Eq A x y => Eq A y x
sym A x y p = p (\a -> Eq A a x) (refl A x)

trans : (A : Type) => (x y z : A) => Eq A x y => Eq A y z => Eq A x z
trans A x y z p q = q (Eq A x) p
>>
>>56567705
x = y when forall f. f x = f y?
>>
I've toyed around a bit with the Dining philosophers problem: https://en.wikipedia.org/wiki/Dining_philosophers_problem
and I think I found my own solution.

The idea is that all philosophers obey the following two rules:
1) If someone sits to your right, you may only pick up the fork to your right if the guy to your right just put it down.
2) You may only pick up the fork to your right for at most ten minutes.
3) If the fork to your right just got put down and the one on your left is available, eat for ten minutes, otherwise do nothing.
4) If there is nobody to your right the problem is trivial, just eat for 10 mins once every 50 mins.

The regular mode of propagation is that you have a traveling wave of eat instructions that wraps around clockwise and prompts the philosophers to eat once every 50 minutes. If there are two or more such waves, either the philosophers will eat twice or more per 50 mins, or it will die down to fewer waves.

So the only mode where philosophers can stave is if there is no wave traveling around instructing them to eat. We can solve this by appointing one philosopher to be a timer, who picks up the fork to his left and puts it down if he has not eaten in the past 100 mins.
>>
>>56567767
Leibniz equality is encoding the proposition that x = y as the ability to transform, for any predicate P, a proof of P(x) to a proof of P(y). That's exactly how you use (eliminate) a proof of equality.
>>
>>56567839
So preemptive multitasking?
>>
>>56567884
Is there any reason why it's a proposition specifically? (And not any function application)
>>
>>56567933
x = y is a proposition...
>>
>>56567972
I meant the predicate P
>>
>>56567986
You mean why isn't P : A => B for any type B? It wouldn't make sense, because then the application to some x : A wouldn't yield a proposition for which a proof can be supplied to be transported along the equality.
>>
>>56568017
No?
I mean why
x = y
doesn't mean
f x = f y
for any f, including regular functions
>>
"Lines of code" is a silly arbitrary metric that is basically meaningless.
>>
>>56568063
Oh, it does. It's easily proven.
thm : (A B : Type) => (f : A => B) => Eq A x y => Eq B (f x) (f y)
thm A B f p = p (\a -> Eq B (f x) (f a)) (refl B (f x))

But it can't be the definition of equality. It's not primitive enough (it mentions equality).

You originally said
>x = y when forall f. f x = f y?
which is the converse and not true.
>>
>>56563434
Relax pleb. Not him but it seems like some toy code for learning purposes. He's not coding a nuclear plant software
>>
>>56568121
I don't see the purpose of propositions when you have dependent types
>>
>>56568120
If you assume that both compared projects are DRY, well documented and are written in the same language, LoC is actually a decent metric.
>>
>>56568166
Prop in the calculus of constructions is an impredicative universe. If there was no Prop, I could define equality, but I wouldn't be able to use it to prove anything about equalities. Simply making Type impredicative would lead to inconsistency.
>>
>>56567920
I'm a physics major, not a CS grad so I'm not sure. The idea is that everything any process does is triggered by an instruction from another process.

In other words, explicit timing is only needed for initialization, and it's fully distributed/local so it needs no central authority like a waiter.
>>
>>56568166
>>56568233
Oh, and Prop can safely be impredicative because it's designed to be proof-irrelevant. It's less expressive than Type.
>>
>>56568232
How do you define a Line of Code, though?

Some languages chain many things into one expression, such as a C-like language chaining many things in one statement that ends with a single semicolon.
>>
>>56568270
Does coq have universe polymorphism?
>>
>>56568274
Whatever is accepted as not mangled shit in that language.
>>
>>56568349
That's subjective.
>>
>>56568364
And?
>>
>>56568063
If x = y was defined to mean forall f. f x = f y, it would expand into forall f g. f (g x) = f (g y), which would expand into forall f g h. f (g (h x)) = f (g (h y)) and so on.

>>56568323
No, and universe polymorphism wouldn't actually help. To use the Agda notation, you'd end up having to quantify over (n : Level) -> ..., which is impossible, since it has no type. You need impredicativity, which is unsound if it's not "guarded" by proof irrelevance, which is given by Prop in the calculus of constructions.
>>
>>56568372
This supports the fact that Lines of Code as a metric is arbitrary.
>>
>>56568407
it isnt though
>>
whats a good way to track my progress on a programming project

i tried using one of those todo things but its quite terrible and just gets cluttered like mad
>>
>>56568457
>i tried using one of those todo things but its quite terrible and just gets cluttered like mad
Maybe you should focus more on doing the project then on tracking how much you aren't doing
>>
>>56568457
Depends on how in-depth you want to get.

You can get a VS Team Services server for free that has kanban boards, user stories, basically the whole agile shebang.

You can estimate hours on tasks and it constructs burn-downs for you based on how many hours a day you're going to work on it and what iteration each group of tasks (forming a story) belongs to.

Might be overkill for you, though.
>>
>>56568473
i think i might have adhd

i keep losing focus and switching to something else
>>
>>56568485
I'm a solo dev so that seems a bit overkill but I'll look in to it

thanks
>>
Vim 8.0 just got released
https://groups.google.com/forum/#!topic/vim_announce/EKTuhjF3ET0
>>
>>56568536
jesus...
>>
>>56568513
I simply create Github issues and use that as my TODO list/suggestion box. Also helps keeping track of which commits relate to which issue.
>>
>>56568536

>If you like Vim, please consider helping poor children in the south of
Uganda: http://iccf-holland.org

Fucking hell.
>>
>>56568624
What's wrong with that? They're just saying that if you're prepared to donate money to Vim, donate it to a different cause instead.
>>
i finally learned something useful i wanted to know from my 2nd week of introduction to prorgraming and CS
from file import *

Feels pre good man
>>
>>56568659
Don't use this in code though.
>>
File: pepe the frog.png (198KB, 550x535px) Image search: [Google]
pepe the frog.png
198KB, 550x535px
i had a repository up on github from last year where i put an assignment on there to be able to edit it on my laptop and desktop and forgot about it, and some just now guy found it and forked it. i deleted it now but i think he probably is using it for his assignment now. i'm not going to get in trouble am i? why would you publicly fork something on github for everyone to see if you're plagiarizing it instead of copy and pasting?
>>
>>56568649
but i want to support Vim, not niggers
>>
>>56568698
>i put an assignment on there to be able to edit it on my laptop and desktop
You should use bitbucket, or apply for a github student developer pack.

You probably could get in trouble. Why did you delete yours?
>>
>>56568698
>why would you publicly fork something on github for everyone to see if you're plagiarizing it

Oh I don't know, maybe like, not plagiarizing?
>>
>>56568749
cuz i didn't realize i left it up there. it wasn't a very long project, just a single class with a couple functions but it was portrayed as a big deal at the time and people were freaking out. i didn't even realize the things were public unless you payed until just now
>>
>>56568689
why? should i just import stings alone?
>>
>>56568698
If it's some random guy not from your university, you could have left it up and actually made any academic investigation into that guy's assignment incriminating. If he's related to you via university, you could probably get into some trouble?
>>
>>56568649
Might as well burn that money.

Depending on the location, donations to areas like that end up in the pockets of local militia, and when those donations are used to build infrastructure, that infrastructure is often stripped down or destroyed.

Sure, it would help some, but the more efficient method would be to donate it to another worthy cause in the civilized world where the funds might actually get used on something useful.
>>
>>56568769
it was a pretty niche assignment without much applicability in the real world i don't think. maybe he browses random peoples github accounts and saw that it was useful for an unrelated thing he wanted. but i think its more likely he googled the name of the assignment and found my repository
>>
>>56568698
stupid frogposter
>>
>>56568781
http://stackoverflow.com/questions/2386714/why-is-import-bad
>>
New thread fucking where?
>>
>>56568698
What the fuck do you think github is? You own private storage for git repos?
>>
nm i looked on his page and he just looks like a random guy trying to learn about event driven simulations. he forked a bunch of related stuff the same day. good thing i caught that it was still up there and public though
>>56568809
i didn't think it was run by greedy jews locking off core functionality. should've listened to stallman
>>
>>56568843
You don't need a remote server if you just need the CVS.
>>
>>56568843
>i didn't think it was run by greedy jews locking off core functionality. should've listened to stallman
What the fuck are you on about?
>>
>>56568624
it's always been like that, you blind retard
>>
>>56562648
What's the -lm for when no source file has yet appeared as an argument
>>
NEW THREAD http://boards.4chan.org/a/thread/147114388/
>>
File: 1459487588767.jpg (78KB, 340x314px) Image search: [Google]
1459487588767.jpg
78KB, 340x314px
>>56569143
>boards.4chan.org
>>
>>56569143
>/a/
Kill yourself immediately. I'm not going there ever.
>>
>>56569160
>implying that's the biggest issue
>>
How the fuck do I improve my productivity? Reading some tech book, pretty easy, but 1-2 hours tops, then my brain feels like a goo. Is it normal? How do wizards do wizardry then?
>>
File: 1468998276232.png (178KB, 500x500px) Image search: [Google]
1468998276232.png
178KB, 500x500px
>>56569143
>i still clicked it
>>
>>56569143
you know you can do >>>/a/147114388/ right
>>
File: North-America.png (215KB, 1788x2044px) Image search: [Google]
North-America.png
215KB, 1788x2044px
>>56559084
NEW THREAD >>56569230
>>56569230
>>56569230
>>56569230
>>56569230
>>
I wrote a C program that takes an integer as a command line argument and outputs its binary equivalent. The problem is my first implementation only worked for numbers under 256 but I optimized it but now it only works for numbers under 512. I having a lot of trouble optimizing it to work for all numbers. Any suggestions?
>>
>>56569370

Here is the program
  
int main(int argc, char *argv[]){

int decNumber = atoi(argv[1]); //convert cl arg to int
const int binSize8 = 8, binSize16 = 16;//length of binary numbers
const int byteSize = 256;//when 2 bytes are required to rep binary
const size_t size8 = 8, size16 = 16;
int counter = 0;

if (decNumber < byteSize){//if number is under 256

int *numList = calloc(size8, sizeof(int));
int binList[] = {128,64,32,16,8,4,2,1};//array of 8 bits, powers of 2

while (counter < size8){ //use bitwise & to compare number bits
numList[counter] = (decNumber & binList[counter]);
counter++;
}
switchOne(numList, binSize8);//replace nonzeros with 1's
for(int i = 0; i < binSize8; i++) //print
printf("%d", numList[i]);

free(numList);
}
else if (decNumber >= byteSize){//if number is 256 or under 512

int *numList = calloc(size16, sizeof(int));
int binList[] = {1,2,4,8,16,32,64,128,256};

while (counter < (binSize8+1)){
numList[counter] = (decNumber & binList[counter]);
counter++;
}
switchOne(numList, binSize16);
for(int i = binSize16-1; i >= 0; i--)
printf("%d", numList[i]);

free(numList);
}
else if(decNumber < 1){
printf("Error invalid input, enter positive integer.");
return 1;
}
else{ printf("Error invalid input\n"); }
printf("\n");

}//end of main

void switchOne(int array[], int size){//replaces nonzero's in an array with 1's

for(int i = 0; i < size; i++){
if(array[i] != 0)
array[i] = 1;
}
}
Thread posts: 354
Thread images: 41


[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.