[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: 314
Thread images: 43

File: 1444378145195.png (2MB, 1696x2467px) Image search: [Google]
1444378145195.png
2MB, 1696x2467px
old thread: >>52315068

What are you working on, /g/?
>>
First for nim
>>
File: rew.png (16KB, 521x65px) Image search: [Google]
rew.png
16KB, 521x65px
>>52320169
>>52320179
I'm get the hashes from 4chan. Pic related.

>>52320192
Thanks, anon. That's what I'll do.
>>
>>52320242

How is it?
>>
>>52320280
Still haven't used it yet.
>>
>>52320254
Notice that that gets added onto the end of every md5 they send though? It's obviously not part of it, just strip the characters.
>>
>>52320254
Since you're going to so much trouble to style stuff, why don't you just make a local webpage that AJAX requests the API and display it how you want?
>>
>>52320291

O-oh.
>>
>>52320292
>It's obviously not part of it, just strip the characters
https://en.wikipedia.org/wiki/Base64#Padding
>>
>>52320348
til.
>>
File: haskell.png (12KB, 225x321px) Image search: [Google]
haskell.png
12KB, 225x321px
>>
Should I read files in 1024, 4096 or 8192 byte chunks?
>>
still tamagotchiing. learning about multithreading so i can have input interrupt ongoing animation to bring upba menu....any better ideas?
>>
>>52320722
What are you making it in? Multithreading is overkill.
>>
Prelude> take -100 "What the fug"
take -100 "What the fug"
:: (Num ([Char] -> Int -> [a] -> [a]), Num (Int -> [a] -> [a])) =>
Int -> [a] -> [a]

What does this even mean? I know I messed up not putting parentheses around the negative, but the output doesn't feel like it fits.
>>
What if laws were written like Haskell or Prolog programs, and could be formally verified to be completely unambiguous?
>>
Fucking hell. Am I a pleb if I use GLFW instead of writing all this bullshit boilerplate OpenGL initialization retardation myself?

Why is OpenGL + WinAPI such a goddamned clusterfuck?
>>
>>52321467
The amount of laws to comprehend in daily life would be several orders of magnitude too many for a human.
>>
>>52321484
Finishing a piece of software is less pleb than failing.
>>
>>52321467
Then you'd have a solution to a problem that doesn't exist.
The problem is not making the laws bulletproof, the problem is what to make laws ABOUT.

For example you can have a set of rigid laws outlining the circumstances in which lynching niggers is legal, but the point worth arguing about here is not the rigidity of the laws, but whether such a law should be in place.
>>
Why don't all languages just compile to C? You can't outdo decades of academic work on optimization that C has behind its back, why not give up?
>>
>>52321636
Because configuring a compiler to convert one language to well-written C is likely harder than converting to efficient machine instructions.
>>
Why do we have 2 dpts on the front page
>>
>>52321690
One is past 300 posts
>>
>>52321690
Because it's an epic meme in /dpt/ to make a new thread before the bump limit and then flock to it even before the old thread is autosaging.
>>
>>52321707
Not 310 though because we have retards making new threads
>>
>>52321487

Well, maybe for an ordinary human. But if we made mathematicians into lawyers, we'd be alright.

>>52321537

There have been way too many debates in the supreme court over what the meanings of various constitutional amendments are, and those meanings have changed over time. Do people have an inalienable right to bear arms or not? What does this right mean? Why is it applied unequally across the various states? How can one amendment be incorporated against the states, but another cannot when the wording of neither implies it?

That laws are designed not to be interpreted solely by the literal word meaning of the law is frustrating and makes understanding what one can and cannot do difficult. If a program can be formally verified to be unambiguous, we could resolve these issues, and if it's too difficult for a middle schooler to understand (and laws already are), it should at least be possible for a reasonable NLP program with a middle school vocabulary and a well-defined set of definitions accompanying a law to demonstrate what a law means, and whether another law violates that law or not, or whether a description of an individual's actions violate that law.

And yes, what the laws are about is obviously a large issue, but isn't it a bit of a problem if you pass a law to do one thing, and 100 years later, your law is interpreted to mean something completely different, or perhaps even the opposite of what you intended? Laws should both say what they mean and mean what they say.
>>
>>52321636
https://en.wikipedia.org/wiki/LLVM#LLVM_Intermediate_Representation
>>
>>52320696
Please respond.
>>
>>52321734
People, their interactions and circumstance itself is simply usually not reducible to binary interpretations.
>>
>>52321782
It depends on the system your code will run on.
>>
>>52320216
please stop this trap programming meme

thanks
>>
>>52320858
Oh wow. I dont think I've ever seen a type signature that messed up. It took me a while in ghci to figure out what was happening. The following statements are equivalent.
take -100 "What the fug"
take - 100 "What the fug"
take - (100 "what the fug")
(-) take (100 "what the fug")

The freaky type is a result of ghc trying to infer the the type of an ill typed statement. (-) has type Num a => a -> a -> a. The first argument to (-) is take, which has type Int -> [a] -> [a], so it infers that the a has that type. Hence, the return type is Int -> [a] -> [a]. The restrictions of Num ([Char] -> Int -> [a] -> [a]), Num (Int -> [a] -> [a]) come when ghci infers that "take" and (100 "what the fug") are instance of Num. The first restion is from "take", but I'm not sure where Num ([Char] -> Int -> [a] -> [a]) comes from. My guess is it assumes that 100 is being used as a function or something. Of course, adding type annotations will result in a nicer error message.
>>
>>52321820

Yes, but the meaning of a law should not be dependent on circumstance. The history of our supreme court decisions can be summed up as "these laws don't fit our current need, so we'll decide they mean something else." In other words, the supreme court is doing the job of congress instead of providing an objective analysis of the constitution and whether a law violates it.
>>
>>52321831
Which should you use without knowing that?
>>
File: pepe-the-frog-animated.gif (80KB, 592x415px) Image search: [Google]
pepe-the-frog-animated.gif
80KB, 592x415px
Message passing is so confusing tbqh.
>>
>>52321952
Then it should be completely configurable and the choice of default should be based off of what you estimate to be the most common use case.
The default choice should be very explicitly labelled as well.
>>
>>52321952
http://stackoverflow.com/questions/236861/how-do-you-determine-the-ideal-buffer-size-when-using-fileinputstream
>>
>>52321734
Again, you're under the assumption that the ability to make unambiguous laws is worth anything when those laws won't be passed in the first place because nobody agrees what to make laws about. The issue surrounding "the right to bear arms" is that nobody is interested in improving the law, all sides involved want flawed, ambiguous laws that can be exploited for their own agenda.
The inability to change laws without stirring up a shitstorm of continental proportions is simply a symptom of a corrupt and divided society.
>>
>>52321987
What is the most common use case for modern systems? That's what I'm asking.
>>
File: cm_exp.webm (3MB, 292x324px) Image search: [Google]
cm_exp.webm
3MB, 292x324px
>>52320216
Triangles. Always more triangles.
>>
>>52322030
this pleases my autism
>>
import math,time
msg = 'OSGTP !!Ju67JuF6jBe sucks dick+++++++++'
freq = 0.01
amplitude = 40
speed= 0.02
i = 0
while True:
s= amplitude*(math.sin(2*math.pi*freq*i)+1)
print(int(s)*' ' +msg)
msg = msg[1:]+msg[0]
time.sleep(speed)
i+= 1
>>
>>52321920
This isn't need, nor is it advantageous, at a local level. Where the law applies over multiple localities of differing opinion the law should be absolute and unambiguous, i.e. mathematical. Otherwise a locality with dominant political or population group will use interpretation to oppress other groups.

Democracy is just as oppressive as any other system without the proper checks.
>>
>>52321952
1024
>>
>>52321920
The issue is that representing a law as propositional logic is intractable.

You're welcome to try though.
>>
>>52321636
>>52321765
this anon

Pick up the purple dragon book and learn u a compilers
>>
>>52321717
Just like /d2g/ but at least we have drow poster to cover our asses ~_~
>>
>>52322035
It triggers mine.

It reminds me of abstract "art", I'm glad it turned into an actual image though.
>>
>>52322015
>>52320696

Usually 8k, or a multiple of it. You don't want to go below 4096, as this is the smallest block size on any real modern FS. It really depends on your platform though.

The biggest source of latency is reading from disk, so you ideally want to read at whatever block size your disk is, or a multiple of it. Reading half a block still has to read a whole block, so it's important to try and read at a multiple of the block size.

NTFS: 4096 if <16TB, 8192 if >16TB disk size.
ext3/4: almost always 4096
Fat32 (your application writing/reading from removable storage): 4096 if <8GiB, 8192 if greater.
(these are all only defaults, your end user could set it to any ridiculous number)

Generally, go for an even multiple of 8192 to get the widest possible support. The bigger your reads are though, the less it matters. Missing half a block for every 4 physical blocks is less important than missing half a block for every block.

There may be a way to read the fs blocksize on the fly, I don't know.
>>
>tfw the guy who owns the python 2.7 repo stars your repo
is there a better feel lads?
>>
>>52322175
That's exactly what I wanted, thank you.
>>
>>52322216
Yeah, not having a python user star your repo.
>>
what is golang's purpose
>>
File: bear.webm (3MB, 852x356px) Image search: [Google]
bear.webm
3MB, 852x356px
Ask your beloved programming literate anything.
>>
>>52322236
nice meme
>>
>>52322223
You missed out on a get by so little.

None of this is very tricky information to research though. Even the fastest drive is sooo much slower than RAM=>CPU Cache, so as long as you are doing your best to read whole fs blocks at a time, you can't go wrong. And to be honest, if you were doing incredibly performant programming where you really needed it to be perfect, you would already know the answer.
>>
>>52322251
being a meme
>>
File: AP1VuUl.png (3KB, 238x94px) Image search: [Google]
AP1VuUl.png
3KB, 238x94px
What's your current Github streak /dpt/?
>>
tfw spent the whole day shitposting and haven't written a single line of code.

Well, I attempted reading the assembly output of a C hello world program, but that's about it.
>>
>>52322343
>using botnethub
>>
>>52322343
i'm making an account and starting tomorrow

i'm paranoid and have a hard time maintaining an online persona
>>
Finding which of my queries is taking so long, and figuring out how to less time make it do be.
>>
>tfw finished writing tests for a class
seeing all those failures just does my heart good
>>
>>52322343
>using github
My streak on our gitlab we host at work is 5. Before the holiday season I streaked 5 (or 4, holidays and whatever) every week since sometime around april I think
>>
>>52322455
one of my coworkers is a fucking hipster shit webdev who runs mint on a macbook and hates tdd and unit tests

he's really fucking good at spewing memes and knowing vim tho
>>
I was going to say that variadic argument lists are stupid, until I realized that common functions I use must must use them, like printf() from C or console.log() from JavaScript.

Anyone here use variadic argument lists?
>>
>>52322482
I think TDD is dumb most of the time. But tests are important.
>>
>>52322343
0 days. Longest is 7, been somewhat active since Dec 13
>>
How different is Common Lisp from Scheme?

I know Scheme already.
If I want to do Norvig's AI book, should I just write all the projects in Scheme, or should I actually install and learn Common Lisp?
>>
>>52322502
Why?
>>
>>52322529
Which statement are you asking why to?
>>
>>52322540
why you hate tdd
>>
How can I check how often a server is updated? I know it's between 100 ms and 600 ms

the problem is when I call it sometimes it double-logs information if I check for too long and sometimes it doesn't update during the interval check

do I just have to make the interval too long or sterilize the data or is there a way to be more precise?

This is in javascript btw/
>>
>>52322513
Why waste your time trying to learn something for a book? Learn the material in the book. You can apply the content to any language. If you waste time learning something trivial for the book you risk burning out before even starting.
>>
>>52322583
I just don't see what I'm going to get out of stubbing for something that doesn't exist yet.

If it is a defect yes I'll write a test.
>>
What's a language with a good, strict type system?
No meme languages please.
>>
>>52322801
java
>>
>>52322806
this is true, it tells you exactly where you are wrong and what you should do to fix it

>>52322634
nevermind about this, I solved it
>>
>>52322030
fuckin cool as hell
how did you do it?
>>
File: brainfuck.jpg (249KB, 1366x768px) Image search: [Google]
brainfuck.jpg
249KB, 1366x768px
What's your latest meme?
>>
I think it would be fun to make a file sharing website, but I'm scared because I think people would upload illegal things and I don't want to get v&
>>
>>52322884
Pussy nigger
>>
i need ideas
i'm not the best programmer out there but a lot of the programming practice ideas i've seen are things i've done with ease
i just want to do something that isn't a fuckin toy program

how do y'all get your ideas?
>>
File: 1418160922610.png (114KB, 457x361px) Image search: [Google]
1418160922610.png
114KB, 457x361px
I fucked that post up, let me try again
So if I were to search through an array of objects, let's say they look like this
Class job{
String name = foo;
bar()
{
//etc
}
}

and I was trying to find the object with a given name, what would be the fastest way to execute the search? I feel like iterating through them wouldn't exactly be very expedient.
>>
>>52322918
Set out to do something overly ambitious, fail horribly and then cobble something together with the leftover code.
>>
File: coq.jpg (74KB, 1045x636px) Image search: [Google]
coq.jpg
74KB, 1045x636px
>>52322801
>>
>>52322926
Binary search.
>>
>>52322926
Language? Sounds like you want a hash table
>>
>>52320216
Source?
>>
>>52322930
i don't know what kind of ambitious things would be "feasible" at my skill level, honestly
>>
>>52322996
remake the game Tower of the Sorcerer
>>
>>52322918
Start making programs that are actually useful to you that automate things you do in every day life

>>52322940
I was thinking about that, but wouldn't it only work for numbers?

>>52322973
Java. Wouldn't a hash table search for the objects themselves, and not the strings within?
>>
>>52322996
Check out the problem sets here:
http://www.socalcontest.org/current/index.shtml

Each problem set consists of 10 problems. The intended goal is to finish as many as you can within 2 hours.
You don't have to finish a lot in that timeframe--in fact 2 is very average and 3 is pretty ok.

If you want to train your algorithm and math skills, I would set a goal to set aside 2 hours for a problem set every other day.
>>
>>52322996
this is good >>52323003

here are some of my beginner projects too

create a rotating line without using a rotate function
make a text based game
make a program that does a complex formula like newtons laws on something like a planet based on input
remake 2028
make a program that simplifies something you had to do anyways, like an average finder of something
make a calculator
>>
>>52323032
Also keep in mind that each problem usually contains some constraint that you have meet a performance standard based on some input. Usually this is some obscene number like "For any amount of a million fufillion elements", so it should be obvious that you should never brute force anything.
>>
>>52323006
>but wouldn't it only work for numbers?
You can compare strings the same way

If you want to return the instance, you can make an array of names coupled with the instance. Use binary search upon insertion, and you get the typical nlogn sorting time with logn retrieval time
>>
>>52322996
challenge.synacor.com

Make a vm that runs a small adventure game, with other little riddles scattered within
>>
>>52323053
>string comparison
disgusting

>>52322926
Insert every object into a hash set where the hashkey is derived from the string name.
There's a basic algorithm used for strings to generate hashkeys but I forget what it's called.
It's probably inside the book Introduction to Algorithms 3rd Edition.
>>
>>52323084
>hash algorithms
>having to deal with potential hash collisions
disgusting
>>
>>52323084
not him, but how is a hash any better than a string, since you have to run comparisons on it anyways and the generated hash could be longer than the strings?
>>
>>52323109
>m-muh hash collisions
>what is a hashset with linked lists
Please, you're asking to perform log(n) string comparisons versus a hashset that performs O(1) on the average case and O(n) given a terrible hashcode algorithm

If you're so worried about collisions, then write a better algorithm.
>>
For unordered / random set of data, the only way to go is a linear search on a 1-dimensional list, right?
>>
>>52323131
A "hash" is not equivalent to SHA-1 or MD5.
You misunderstand what a hash is.
A hash is an algorithm designed to operate on a set of data and produce a ``unique" value.
For example, a hashcode for an integer is literally just the integer itself. Because different integers are unique.

>>52323138
How the fuck do you handle your collisions? Jumping farther until you hit a new spot?
You sicken me.
>>
>>52323184
confirmed for never having written any multithreaded code
Guess what fagtron, your thread-safe queues use linked-lists.
So do your thread-safe stacks.
>>
>>52323146
Given a generic "search", then yes, if the dataset is not ordered given a known pattern, then you have no point of reference to begin the search. If you don't search the entire thing, then you will not have searched every element.

An example of a "known" pattern is a hashset, which is a circular array where elements are placed in elements that correspond to their hashcode. Collisions are handled in different ways depending on how you want to go about it, and I digress.
>>
>>52323084
>There's a basic algorithm used for strings to generate hashkeys but I forget what it's called.
Why not string.hashCode()?
>>
>>52322984
Seconding this, I've already done reverse image search
>>
>>52323300
What if he's writing this crap in a language that doesn't hold your hand?

>>52323313
>>52322984
mesu-nized festival
>>
>>52323344
He said he's using java matey
>>
Rate my naive substring matcher.
char *strstr(const char *haystack, const char *needle)
{
unsigned len_h = strlen(haystack);
unsigned len_n = strlen(needle);
unsigned i, j;
for (i = 0; i < len_h; i++)
{
unsigned matches = 0;
for (j = 0; j < len_n; j++)
{
if (i + len_n <= len_h) /* bounds checking */
{
if (haystack[i + j] == needle[j])
matches++;
}
}
if (matches == len_n)
return (char *) haystack + i; /* return match location */
}
return NULL;
}
>>
>>52323387
Null terminated, stop bounds checking.
>>
>>52323401
indexes i + j could be longer than the actual haystack and it will scan up to j characters off the array and possibly match garbage unallocated memory and produce undefined behavior
>>
>>52323401
>>52323387
Guy's right.
strlen() gets its value by finding the first null terminator.

Strings in C can either be null terminated or buffered to a known value.
Stick with one.
>>
>>52323387
now write one that uses a state machine
>>
File: 1451316101047.jpg (15KB, 138x176px) Image search: [Google]
1451316101047.jpg
15KB, 138x176px
Just now I almost deleted the source file of the project I've been working on for a couple of days now.

I should probably learn about version control one of these days.
>>
>>52321636
how do you think most C compilers works ? they compile C code into a intermediate representation language or into an abstract syntax tree. Most of the time, it's better to write your own fronted to directly operates on that IRL/tree. do you learn nothing in today computer science classes ?
>>
>>52323479
Git is so easy, just learn it
>>
>>52323344
Damn that was a great fap. Much obliged my nigga
>>
>>52323485
>do you learn nothing in today computer science classes ?
I'm a NEET reading programming tutorials inbetween masturbation sessions.
>>
File: cutie.png (2MB, 1866x1320px) Image search: [Google]
cutie.png
2MB, 1866x1320px
Why does radare2 have such a steep learning curve?

>>52323479
Learn git, seriously

>>52320216
Thanks for great pic OP
>>
>>52323456
i don't know what that is

>>52323401
>>52323429
i tested my strstr on a 1GB string and it only takes 0.7 seconds, it's fine
>>
>>52323515
>draw a girl
>call it a boy

people will defend this
>>
File: sicppat.jpg (286KB, 1024x768px) Image search: [Google]
sicppat.jpg
286KB, 1024x768px
>>52323502
then you should better go on wizardchan. this is /dpt/ here, we are a serious subreddit.
>>
>>52323541
Jokes on you, I'm super gay
>>
>>52323543
SICP is a bad meme.
2hu is shit.
Kill yourself.
>>
File: sicppa.jpg (330KB, 2362x2362px) Image search: [Google]
sicppa.jpg
330KB, 2362x2362px
>>52323559
it's only a meme to the one who hasn't read it.
>>
>>52323548
you're not attracted to men if you're only attracted to crossdressing anime boys
>>
>>52323387
char *strstr(char *string, char *substring)
{
char *a, *b;

b = substring;
if (*b == 0) {
return string;
}
for (; *string != 0; string += 1) {
if (*string != *b) {
continue;
}
a = string;
while (1) {
if (*b == 0) {
return string;
}
if (*a++ != *b++) {
break;
}
}
b = substring;
}
return NULL;
}
>>
>>52323577
I'm attracted to real boys anon, manga is simply another way of entertaining the gayness

Traps are what initially caused the turn for me, so they just hold a special place in my heart
>>
I sort of kinda want to write a driver for my sansa clip+ that would turn it into a dac.
Thoughts?
>>
File: 1.44mb of feels.gif (3MB, 287x191px) Image search: [Google]
1.44mb of feels.gif
3MB, 287x191px
>>52323613
s-stop saying that anon, you're making me nervous...

>>52323543
I can't believe someone actually set up that picture man
>>
>>52323641
That book looks like it's fresh off the presses.
The weeaboo tard probably never even read it and simply bought it to be part of the ebic quirky meme
>>
>>52323654
Can confirm.
I bought a SICP and I haven't even read it.
Don't feel like learning a new language just to learn some contrived functional programming.
>>
What are the optimisation options for clang?
>>
Why learn Java when there are plenty of other languages that can do everything it does and more?
>>
>>52323701
why learn any language other than C, D and Lua? There is no job you can want to do with any other language that wouldn't be better done by one of these three
>>
https://dlang.org/spec/version.html#predefined-versions
Oh wow, this looks super useful
>>
>doing prefix codeeval challenge
>keep getting 80-95% as my result
>WTF is going on?
>remember C can't average 2 ints
>do my maths in double and convert to int at end
>get 100%

kek
>>
File: 1452299588226.jpg (6KB, 255x98px) Image search: [Google]
1452299588226.jpg
6KB, 255x98px
>>52323742
>>
File: 1447288339850.gif (3MB, 350x349px) Image search: [Google]
1447288339850.gif
3MB, 350x349px
How to communicate information to a class initiated in a different thread in Python? For example, how to call the class methods (like MyClass.shit()) from different threads?
>>
>>52322642
Well actually building the programs would require writing my own Scheme versions of functions already baked into Common Lisp.
>>
File: loss in space.png (23KB, 625x790px) Image search: [Google]
loss in space.png
23KB, 625x790px
>>52323742
>codeeval
>google it
>Find out how you rate against top coders.
>Unlock awesome startup jobs and hacker deals.
>coders
>awesome
>startup
>jobs
lmao is this where ideaguys try and poach codemonkeys to grind out their shitty kickstarter projects for no pay?
>>
File: efd.png (305KB, 1532x763px) Image search: [Google]
efd.png
305KB, 1532x763px
It works. :D
>>
File: we just dont know.gif (999KB, 250x251px) Image search: [Google]
we just dont know.gif
999KB, 250x251px
>>52323764
>communicate information to a class initiated in a different thread
might as well break out the fucking paper cups and string m8 I don't think anyone knows
>>
>>52323823
Fuck if I know, I'm just there for some exercise.
>>
File: stallman1.jpg (124KB, 480x320px) Image search: [Google]
stallman1.jpg
124KB, 480x320px
>>52323838
>hides username
>makes no effort to hide disgusting proprietary OS
install parabola GNU plus linux libre
>>
File: challenge.jpg (752KB, 1920x1080px) Image search: [Google]
challenge.jpg
752KB, 1920x1080px
>>52323861
this is either going to ruin the thread or make it a hundred times better
>>
File: 1448856923145.jpg (309KB, 1200x1500px) Image search: [Google]
1448856923145.jpg
309KB, 1200x1500px
>>52323602
>>52323387

Ah I remember when I was in intro to programming and didn't know about recursion either.
>>
What happens when a page fault occurs in an ISR that handles page faults? it would double or triple fault right? how does the x86 CPU know that it's in an ISR to be able to trigger the double/triple fault?
>>
>>52323891
recursion is a parlor trick
>>
Doing Euler project and I have a question about my prime factor counter/lister

def factor_list(n):
temp = n
listy = []
for i in range (2, (n+1)):
while temp % i is 0:
temp //= i
listy += [i]
if temp is 1:
return listy

def factor_count(n):
temp = n
count = 0
for i in range (2, (n+1)):
while temp % i is 0:
temp //= i
count += 1
if temp is 1:
return count


why would n = 300002 return nonetype?
>>
>>52323874
:~/Documents/C/quine$ ./a.out
#include <stdio.h>
#include <stdlib.h>

int main() {
char c;
FILE *source;
source = fopen("quine.c", "r");

if (source) {
while ((c=getc(source))!=EOF) {
putchar(c);
}
fclose(source);
}
return 0;
}
:~/Documents/C/quine$

:^)
>>
>>52323952
>char c;
>c=getc(source)
0/10
>>
>>52323944
>that one guy who's too much of a lazy nig to open up a debugger and step through
>>
File: aaaaaaaaaaa.png (2MB, 3280x1200px) Image search: [Google]
aaaaaaaaaaa.png
2MB, 3280x1200px
>>52323864
I trust a well-respected company like Microsoft, I don't trust the average /dpt/ user. :^)
>>
>>52323944
I believe it might be "is". It works differently to ==
>>
>>52323958
Sorry only been programming since the start of this Summer, I'll look into the debugger

>>52323966
Thanks! I think I've had this problem before actually, someone said it was something about caching.
>>
if i make a video game from scratch using only opengl and sdl, will people recognize my worth and treat me nicely/
>>
>>52323986
>opengl and sdl
?
>>
>>52323997
what
>>
>>52323964
Stop wasting Hiro's bandwidth.
>>
>>52323974
>it was something about caching.
Not sure what he meant, but I believe "is" compares instance
>>> a = "hi"
>>> b = "hi"
>>> a == b
True
>>> a is b
False
[/code[
>>
>>52324018
can you even use both at the same time? I've never used SDL but I always just thought it was a more abstracted graphics library
>>
>>52324091
SDL can create an OpenGL context to use with it.
>>
File: 1451593982750.jpg (35KB, 300x360px) Image search: [Google]
1451593982750.jpg
35KB, 300x360px
>>52323964
>tfw I can't replace image links with local host links

Why, Chrome? Why?

My plan was to replace the links of images I've already downloaded with links to the equivalent image stored on my SSD.
>>
>>52324091
SDL is not just a graphics library. It handles windowing contexts, key input, mouse input, sound playback, etc.
Basically it's meant to make life easier when dealing with graphical applications that require real time user input.

Also very portable, so you don't have to get cucked by winAPI to make a window.
>>
>>52324122
>cucked by winAPI
god don't tell me 'cuck' is catching on with the free software lot
>>
>Clang can't link boost correctly
>/usr/include/boost/program_options/detail/value_semantic.hpp:18: undefined reference to `boost::program_options::arg'
>g++ has no issues

What the fuck?
clang++ -std=c++14 -Weverything -Wno-c++98-compat -O2 -g *.cpp -o a.out -lboost_program_options

Switch clang++ for g++ (and change -Weverything to -Wall -Wextra -Wpedantic) and it compiles fine...
>>
Going to learn a GUI framework: C# or Java?
>>
>>52324167
Why wouldn't it?
Proprietary software is the direct software equivalent of cuckoldry.
>>
>>52324172
>GUI framework
>Lists programming languages
Sure is r/programming here.
>>
>>52324172
LAZARUS
>>
downloading virtualbox to use ubuntu lads

am i leet yet?
>>
>>52320216
Hey, I've been learning python and now I want to make a imgur gallery scraper right, so I need to parse the html for links to images I want to download but the only available links from the gallery view are the links to a jpg of a thumbnail and not the actual full image. When I compare the links of the thumbnail and the image the difference is like 1 letter or a number at the end but I don't think I could follow that pattern for the loop. Did someone do it? Could you post code/explain it?
>>
>>52324178
Fine, SWING or whatever is the default one for C#?
>>
File: 1444365047428.jpg (180KB, 768x1024px) Image search: [Google]
1444365047428.jpg
180KB, 768x1024px
>>52324182
>i can't concatenate filename strings

typical python babby
>>
>>52324172
C# WPF is you want to lock yourself into Microshit.
Otherwise Qt. Fuck Java.
>>
>>52324171
>boost
haha meme i like it
>>
>>52324167
Does it trigger the cuck?

>>52324173
Doing things for no compensation is a common cuck trait.
>>
>>52324189
>Default for C#
There's two. Windoows Forms which is old, and crusty but 'simpler' for coders and WPF which is better in every way and thus less popular.
>>
>>52324197
I really don't want to lock myself into Microsoft but at the same time I also don't want to do Java.
>>
>>52324171
>boost
wow clang performance features must have come a long way
it's literally optimising out that whole clusterfuck
>>
File: tZk9wdy.jpg (449KB, 1920x1080px) Image search: [Google]
tZk9wdy.jpg
449KB, 1920x1080px
>>52324195
>concatenate filename strings

I don't even know what the word "concatenate" means. Did you make imgur scraper or not? If you did, explain it don't be an autist.
>>
>>52324199
signing away your copyright to all the code you produce and being forced not to reveal any of it under an NDA is the purest form of cuckoldry there is
>>
>>52323944
That's a really shitty prime factorization algorithm.
>>
>>52324189
Anything > SWING.
If you want to be with the cool kids, use Qt. It has bindings for any language you can imagine. PyQt seems to be the most popular.
>>
File: 1451542408508.png (607KB, 761x720px) Image search: [Google]
1451542408508.png
607KB, 761x720px
chrome.runtime.onMessage.addListener(function(responce, sender, sendResponce) {
var filename = responce.url.split("/");
filename = responce.folder + '/' + filename[filename.length - 1];


chrome.downloads.download({
url: responce.url,
filename: filename,
conflictAction: "overwrite"
}
});


Why haven't you used the Chrome API yet, /dpt/?
>>
>>52324199
>>52324173
It's just terrible /pol/ cancer
>guys donald trump is kind of dumb
>aHAAHHAHA WHAT KEK HAHA CUKC LMAO u CucK MAD XDDDDDDDDDDDDDDD
>>
File: 1452057364208.png (139KB, 400x398px) Image search: [Google]
1452057364208.png
139KB, 400x398px
>>52324209
concatenation is the joining of 2 strings together, it's a pretty standard term
have you never used a cat command?

>don't be an autist
nevermind, go fuck yourself
>>
File: 1447807578845.jpg (154KB, 800x651px) Image search: [Google]
1447807578845.jpg
154KB, 800x651px
>>52323891
int
recurse_strstr(char *str,char *substr,int index)
{
if (*str == '\0' && *substr != '\0')
return -1;
if (*str == '\0' && *substr == '\0')
return index;
if (*str == *substr)
return recurse_strstr(str+1,substr+1,index);
if (*str != *substr && *substr == '\0')
return recurse_strstr(str+1,substr,index);
else if (*str != *substr)
return recurse_strstr(str+1,substr,index+1);

}

char *
strstr(char *string,char *substr)
{
char *i,*j,k;
i = string;
j = substr;
k = recurse_strstr(i,j,0);
return k ? (char *) &string[k] : NULL;
}
>>
File: PertinentCheeryLadybug.webm (2MB, 1280x720px) Image search: [Google]
PertinentCheeryLadybug.webm
2MB, 1280x720px
>>52324228
>[CURRENT YEAR]
>being a cuck
>>
>>52324228
You sound like a cuck if I'm honest, and despite what you've heard on /qa/, the majority of 4chan either like /pol/ or are indifferent towards /pol/.

Also, caricatures aren't very mature.
>>
>>52324182
wot u on? I just checked the html, and all you have to is truncate the filename
example:
thumbnail:
<img alt="" src="//i.imgur.com/be4nxspb.jpg" original-title="">

full image:
http://i.imgur.com/be4nxsp.png
>>
I'm working on a script/small interface that gives me an easy way to wget sites, and present me a library-like system for accessing them, without having to fumble around with wget's folder structure.

I'm doing it in Ruby, and I managed to whip up the bare-minimum code to make it work in about two hours. I'm trying to grapple with how to delete entries from the system, because I don't know how to track which files wget creates. Any ideas?
>>
>>52324255
You're kidding? I thought /g/ was a liberal board.

I'm going back to reddit, fuck you guys.
>>
File: 1449255745612.jpg (10KB, 250x213px) Image search: [Google]
1449255745612.jpg
10KB, 250x213px
>>52324258
>truncate

Just started learning Python and I don't even know English that well, wtf is truncate now. Are you fucking with me ?

How would you write the loop that goes through the gallery and takes links?
>>
File: 28.jpg (33KB, 320x300px) Image search: [Google]
28.jpg
33KB, 320x300px
>>52324255
>the majority of 4chan either like /pol/ or are indifferent towards /pol/.
Yeah, not really.
Leave /pol/ more often, newfag.
>>
>>52324255
I like /pol/ too senpai, but the cuck meme is dumb

>Also, caricatures aren't very mature
neither is foaming at the mouth and screaming cuck every time someone says something bad about the chosen one
or the overuse of the word cuck for that matter
>>
>>52324258
and also the filetype changes from .jpg to whatever file types imgur hosts, so use "try" to find out which one to use, unless that info is also on html, can't be bothered to check

>>52324286
It means "cut off" referring mostly to the end, unless it's supposed to always refer to the end. Also, you can use imgur's api, unless you want to challenge yourself with html scraping. Here's the api: https://api.imgur.com/
>>
>>52324246
Should be
char *
strstr(char *string,char *substr)
{
char *i,*j;
int k;
i = string;
j = substr;
k = recurse_strstr(i,j,0);
return k > 0 ? (char *) &string[k] : NULL;
}
>>
>>52324286
you know what, there's this nice little thing called "google", you type in "define" plus the word you dont understand and it's like a little dictionary!
>>
>>52324286
have you made sure that your dragon dildo was slid /all/ the way into your colon before you started writing Python? aallll the way?
>>
>>52324286
>wtf is truncate
Either a master baiter or dumb as a rock but I'll bite

Do you even know that there on-line translators (e.g.https://translate.google.com/ ) for all of those words you don't know.
Use your brain and the tools provided man!
>>
>>52324293
>I'm a cuck
That's nice, anon. Each to their own.
>>
>>52324286
If English is your first language, you should really prioritize that before Python.
>>
>>52324304
>>52324246
the whole point of a recursive function is that it's completely self-contained and you don't need to write a control function to make it act recursively.
Your function is not recursive in that respect.
And with that being said, scanning a string for a substring is hardly an ideal candidate for recursion in the first place.
You seem smart and not at all dumb, why don't you write something useful?
>>
File: ABORTION.png (203KB, 740x1024px) Image search: [Google]
ABORTION.png
203KB, 740x1024px
>>52324321
>>52324313

>autism
>>
>>52324336
go back to reddit
>>
File: 1449116875940.png (151KB, 1188x524px) Image search: [Google]
1449116875940.png
151KB, 1188x524px
>>52324331
it's not, in fact it's my 4th language.
>>
>>52324332
>and you don't need to write a control function to make it act recursively
What kind of stupid requirement is that? A wrapper for a recursive just sets the arguments up correctly and sets up any state that the caller doesn't need to know about.
>>
>>52324348
a recursive function is one that calls itself in a loop and only breaks the loop when a certain condition is met.
You put that logic into recurse_strstr(), not any functions outside of it.
>>
>>52324189
JavaFX is basically WPF. Problem is the JavaFX libs are oracle JDK only, so no Openjdk atm.
>>
>>52324358
Again, what kind of stupid requirement is that?
Why aren't you allowed to put any logic outside the function that does that actual recursive work? Not enough CS wankery for you or something?
>>
>>52324336
Thousands of children are being killed every day in the developed word and it's all legal because people refuse to accept the responsibility of their actions, they won't even wait and put the child up for adoption, they have to kill it before it is born.

Pretty disgusting if I'm honest and I'm not even religious.
>>
File: 1QNBzJa.jpg (331KB, 1200x900px) Image search: [Google]
1QNBzJa.jpg
331KB, 1200x900px
>>52324408
A fetus isn't a child...
>>
>>52324398
i suggest you look up recursion before you embarrass yourself any further
you call it CS wankery and yet you continue to participate in the parlor trick that is recursion

>>52324408
>implying a clump of cells is a person
>>
>>52324421
I know what fucking recursion is, fuckface. I just don't agree with your retarded requirement that ALL recursive functions must be purely recursive.
>>
>>52324336
Do people unironically post that when arguing?
>>
>>52324444
why half ass things?
write a real recursive function you fuck
>>
>>52324408
>children
Fetuses.
They don't pay taxes and they're not sentient, so it's nobody else's business what anyone does with them.
I bet you're the kind of person who thinks retards have to be euthanised, too.
>wait and put the child up for adoption
Abortion is not about getting rid of the child, it's about getting rid of the pregnancy.

Fuck fetuses, even infants are completely unintelligent, yet it counts as murder, which is retarded. It should be property damage at best.
>>
>>52324418
>>52324421
>>52324460
The first thing people do when they want to kill something is dehumanize it. It isn't a human being, it's just a Jew.

Abortions are still legal when the "fetus" has brain activity. At what point does the "fetus" become a child?
>>
>>52324465
If you are willing to imbue a single diploid cell with human rights you face two major objections from me:

1. When a human life ends there is a murder investigation, this means every miscarriage, every failed implantation of a zygote to blastocyst becomes a murder investigation and if any cause can be found where the woman did anything to endanger that human they would be charged with something between negligent homicide and murder. In the extreme women could be forced to submit to inspections of their periods to ensure they didn't murder a human being in that cycle.

If they walked too far, if they had a drink of alcohol, if they fell down, if they ate too much... all of these becomes a cause to imprison that woman for having a miscarriage.

Life begins at conception!!!
>>
I'm first year in uni, programming in C#, basically just finished the introduction, I learned some C++ in school, but pretty much all the programming I (we) did was basic math problems like how many trees grow, how tall they are and stuff like this.
How should I start programming something more "real", I know I won't pull 4 years without doing some extra work, but I just don't know where to start from, because with what I know, I can't really think of anything I could do except for those retarded things like reading from a file and writing them either in console or another file
>>
Is the OpenGL Superbible any good, does it teach opengl in general, or opengl for our shitty custom framework?
>>
>>52324460
>I bet you're the kind of person who thinks retards have to be euthanised, too.
No, but I like the idea of voluntary eugenics, i.e., the state pays people with hereditary diseases to undergo sterilization.

>>52324494
>When a human life ends there is a murder investigation
No there isn't, when a human life ends under suspicious circumstances there is a murder investigation.

If the police think someone killed themselves they are not going to be out looking for suspects.
>>
Is there a function that gives the amount of unique combinations from a list?
[2, 3] has 3
[2, 2, 3] has 5
>>
>>52324531
>suspicious circumstances
a miscarriage would not be a suicide, it would be criminal negligence on the part of the mother and if you wish to count a clump of cells as a person, then they deserve to have their murder investigated and brought to justice
>>
>>52324465
Why does it even matter whether it's a child or not? The morality of abortion is irrelevant.
The question is why should the government have say in any of this. Why should the government own somebody's fetus and protect the rights of that fetus? Why do you want the government to own whatever comes out of your nutsack, for no reason, and imprison you for not treating it well?

I thought you neo-cons hated the government.

>>52324531
> voluntary eugenics
Then why shouldn't abortion be voluntary? Do you really value the rights of a fetus over the rights of a person?
>>
>>52324541
Some sort of modified factorial function that deals with duplicates.
>>
>>52324531
i find it hilarious that it's always the genetically inferior people in favor of eugenics that would result in the forced sterilization of people like them

maybe they do deserve to get sterilized, no need to pass on their retard genes
>>
>>52324546
>Then why shouldn't abortion be voluntary?
Because a child/"fetus" can't consent to have its life terminated. Are you stupid?
>>
>>52324568
a fetus can't consent to being conceived either, what's your point?
>>
>>52324541
what language?
>>
>>52323944
Here's a better prime factorization function. Primes must be at least [2,3] for it to work but the more primes you pregenerate the faster it'll go.

def factors(n,primes):
if n < 2: return None
listy = []
for prime in primes:
while n % prime == 0:
n /= prime
listy += [prime]
div = primes[-1]
while div*div <= n:
while n % div == 0:
n /= div
listy += [div]
div += 2
if n > 1:
listy += [n]
return listy
>>
>>52324585
Was thinking there was a mathematical name but I'm working in Python.
>>
>>52324541
in python
from itertools import combinations
list = [2,2,3]
combos = set()
for i in range(1, len(list)+1):
for item in combinations(list,i): combos.add(item)
print len(combos)
>>
I'm trying to build a small website using node.js on scaleway.

When I ssh in, I'm root. Should I work in root or not?
>>
>>52324633
Sounds fine to me. Saves you a lot of 'sudo' typing.
>>
It should be legal to kill anything that doesn't pay taxes.
Animals, hobos, children (provided they're your own, otherwise it's property damage), illegal immigrants, etc. Why should MY taxpayer dollars be spent on the investigation of some hobo's murder or an animal abuse case nobody gives a fuck about? Maybe that money should go into bettering the lives of people who actually contribute.
>>
>>52324209
https://en.wikipedia.org/wiki/Concatenation
>>
>>52324666
Why do people post stuff like this?
Surely, nobody actually believes this person is being sincere?
>>
>>52323952
#include <stdlib.h>
main(){system("cat quine.c");}


ayylmao.
>>
>>52324666
>one day you get run over by a bus
>nobody investigates your murder since you don't pay taxes anymore, cuz ur ded

lol
>>
>>52324680
I actually am.
Law shouldn't be concerned with morality.
Law exist to maintain a society, anything that isn't part of that society (those who don't contribute) shouldn't be concerned with.

A government that attempts to enforce some kind of moral system is overstepping its boundaries, inching closer towards a fascist dictatorship.
>>
>>52324693
well it's pretty clear that he was killed by a bus
>>
>>52324716
k tard

>>52324717
yeah, but at least that bus driver won't get in trouble, because that would mean the government is enforcing an arbitrary moral system and overstepping it's boundaries

:^)
>>
>>52324692
11/10
>>
I heard this was /g/'s Daily Politics Thread, did I come to the right place?
>>
>>52324693
>run over a useless welfare leech
>go to prison and become a tax leech
Before:
One tax leech and one contributor
After:
One tax leech

Tell me why should we care if useless fucks die.
>>
>>52324761
oh yeah it's real easy to dehumanize people when it's not happening toyou
>>
>>52324761
>Tell me why should we care if useless fucks die.
Game theory
>>
File: 1452312857424.png (206KB, 1696x2467px) Image search: [Google]
1452312857424.png
206KB, 1696x2467px
>>52320216
Learn2PNGoptimization
fucking faggot
>>
>>52324776
So, you're a communist.
>>
>>52324814
I'm a mainstream economist
>>
>>52320216
what a contrived comic
who would pose like that?
>>
>>52324775
Do you think the government should take your money and send it to starving africans?
Because that's the same thing as them taking your money and sending it to welfare leeches.
>>
>>52324866
honestly i'd rather my money go to neets than to support wars and political power grabs I don't agree with
>>
>reading tutorial about a graphics API
>so far so good, just explaining what the functions do and how to use them
>"And now, lets write a class for our textures!"
>oh boy, here we go
>500 lines of boilerplate code for something that can be done with a couple of functions
Why do all tutorials do this.
>>
>>52320216
>>52324848

uhhh, does anyone have source for this?
>>
>>52324916
>>52323344
>>
>>52324945
yeeeeeee
>>
File: Eternity (11-16-2015).png (2MB, 1920x1080px) Image search: [Google]
Eternity (11-16-2015).png
2MB, 1920x1080px
>>52320216
How should I go about downsizing an image using OpenGL?
C btw.
>>
>>52325042
Muh screen waste.
>>
>>52324906
because the majority of people writing tutorials have no idea what they're doing
>>
Is there a book or something i can look at for opengl?

Every tutorial is shit.
>>
>>52325105
have you looked at https://open.gl/ ?
>>
>>52325105
OpenGL SuberBible.
>>
>>52325119
Doesn't that get too bogged down in it's own wrapper?
>>
>>52325118
this one is a troll, most of their example code doesn't even work

>>52325127
i'll check this out thx
>>
So I have a simple little program that uses recursion. My assignment is to rewrite it so it uses a stack.
How would I start this? (Sorry, I'm new to this)
>>
>>52325105
http://antongerdelan.net/opengl/
>>
>>52325185
I've tried this, it's awful.
>>
Why aren't you compiling to PDF, /dpt/?
>>
can I pipeline my quine straight into a compiler? Like
>./a.out | gcc -o b.out
except actually working
>>
>>52325196
It's good and one of the most appreciated on opengl.org and on game development forums. Even a perfect idealized tutorial could not resolve your mediocrity.
>>
>>52325211
You need to specify the language when piping to gcc.
./a.out | gcc -o b.out -xc

This will work if it's C code, for example.
>>
>>52325243
>>52325211
Wait a minute, sorry you also need to specify that you're taking data from stdin in the first place.
So this is actually the proper command:
./a.out | gcc -o b.out -xc -
>>
File: Screenshot - 090116 - 22:14:46.png (3KB, 197x72px) Image search: [Google]
Screenshot - 090116 - 22:14:46.png
3KB, 197x72px
>>52325249
YES

now to write a program to do this while(1)
>>
>>52325279
while(2) runs twice as quickly
>>
File: 1289760103008.jpg (44KB, 327x640px) Image search: [Google]
1289760103008.jpg
44KB, 327x640px
>>52325105
The docs.
Here's my image viewer in OpenGL, might be a decent example:
https://github.com/EZ3CHI3L/Eternity
>>
>>52325293
sweet thanks senpai
>>
>>52325293
ebin
>>
>>52325279
It's faster to use the 'goes-to-the-future-very-quickly' operator if you're using C.
main() {
while(--------->++) {
//do some code
}
}
>>
>>52324102
yu can do that
tampermonkey + custom js or just make an extension
both is a meme though
>>
Rate my recursive strstr, /g/.

bool prefix(const char *xs, const char *ys)
{
char x = *xs, y = *ys;
if (x == 0) return true;
if (y == 0) return false;
return x == y && prefix(xs + 1, ys + 1);
}

char* strstr(const char *needle, const char *haystack)
{
if (*needle == 0 || prefix(needle, haystack))
return haystack;
if (*haystack == 0)
return 0;
return strstr(needle, haystack + 1);
}
>>
>>52325460
it's shit
>>
>>52325149
everytime you would normally split off from a function, you add those details to a stack. When you finally return from the very last case, you use that information and interact with the information in the last point of the stack

For example, if I had a factorial function, once I reach 1, I would see that 2 is in the stack, and multiply with it. You wouldn't need recursion in this case, you could use a short while loop

stack = []
n = 6

while n != 1:
stack.append(n)
n -= 1

while stack:
n *= stack.pop()

print n


This is just 1 way that just came off the top of my head since I just used stacks. Someone could probably find a better way. Also, more complicated algorithms would have you add a lot more to a stack
>>
File: dsa.png (6KB, 378x84px) Image search: [Google]
dsa.png
6KB, 378x84px
>>52325375
No you can't.

Chrome doesn't let sites link to local files.
>>
I'm stuck on a problem in C Programming: A modern approach.
"Airline tickets are assigned lengthy ID numbers, such as 47715497443. to be valid the last digit of the number must match the remainder when the other digits are -as a group- divided by 7. (for example 4771549744 divided by 7 gives a remainder of 3) write a program that checks if a ticket is valid. HINT: don't attempt to read the number in a single step, instead use getchar to obtain the numbers one by one and carry out the division one digit at a time, being careful not to include the last digit"

I've been just trying to get the program to do it correctly by completely ignoring the last digit (im entering the example number, just without the 3 and trying to get the answer 3)
and I just can't get the program to give the desired result.

#include <stdio.h>

int main()
{
float remainder;
char c;

while(c = getchar() != '\n') {
remainder = c % 7 + remainder;
}

printf("%f", remainder);


return 0;

}


results in 10 and changing the % to division results in 1.4, also not a desired result.
Its the chapter just before arrays, but I don't know, the books done a couple stupid things, like making me print "5%" without telling me I need to tell printf to do "%%" to get a single "%" character to show up.
>>
>>52325568
>results in 10
change
c % 7 + remainder

to
 (c + remainder) % 7
>>
>>52325460
>
{

}


/10
>>
>>52325546
Probably for security reasons tbqh.
>>
>>52325592
Thanks anon, I probably should put the book down and go to bed, reading through it and doing all the exercises for chapters 1 - 7 in 4 hours at 5am is probably not the greatest idea, but I felt like I wasted my day. bleh
>>
>>52325653
probably for the better, you sleep during the busier parts of the day, night pal
>>
>>52325460
fixed your indentation
bool prefix(const char *xs, const char *ys)
{ char x = *xs, y = *ys
; if (x == 0) return true
; if (y == 0) return false
; return x == y && prefix(xs + 1, ys + 1)
;
}
char* strstr(const char *needle, const char *haystack)
{ if (*needle == 0 || prefix(needle, haystack))
{ return haystack
;
} if (*haystack == 0)
{ return 0
;
} return strstr(needle, haystack + 1)
;
}

thank me later
>>
decided to use eclipse as my editor for all programming languages

read in "the pragmatic programmer" that it's best to have one editor you know really well and use for all tasks and I kind of agree.

what do you think /g/?
>>
>>52325756
>C
>no line number
Read a fucking style guide, faggots.
/*10*/bool prefix(const char *xs, const char *ys)
/*20*/{ char x = *xs, y = *ys
/*30*/; if (x == 0) return true
/*40*/; if (y == 0) return false
/*50*/; return x == y && prefix(xs + 1, ys + 1)
/*60*/;
/*70*/}
/*80*/char* strstr(const char *needle, const char *haystack)
/*90*/{ if (*needle == 0 || prefix(needle, haystack))
/*100*/{ return haystack
/*110*/;
/*120*/} if (*haystack == 0)
/*130*/{ return 0
/*140*/;
/*150*/} return strstr(needle, haystack + 1)
/*160*/;
/*170*/}
>>
>>52325902
I agree with the concept but Eclipse isn't built for that.
I use Emacs for pretty much everything, with a couple IDEs for specialized use cases (Qt for C++ GUI work, TeXStudio for TeX stuff, MonoDevelop for .NET stuff, etc.).
>>
>>52325905
>not using hex line numbers
are you one of those queers?

/*1*/bool prefix(const char *xs, const char *ys)
/*2*/{ char x = *xs, y = *ys
/*3*/; if (x == 0) return true
/*4*/; if (y == 0) return false
/*5*/; return x == y && prefix(xs + 1, ys + 1)
/*6*/;
/*7*/}
/*8*/char* strstr(const char *needle, const char *haystack)
/*9*/{ if (*needle == 0 || prefix(needle, haystack))
/*A*/{ return haystack
/*B*/;
/*C*/} if (*haystack == 0)
/*D*/{ return 0
/*E*/;
/*F*/} return strstr(needle, haystack + 1)
/*10*/;
/*11*/}
>>
>>52325936
those are hex numbers dumbass
>>
>>52325926
>Eclipse isn't built for that.
isn't extensibility a core feature of eclipse much like in those meme editor like emacs and vim?

My python works a charm with PyDev and it integrates well with source control and unit tests.
>>
>>52325992
Kinda, but Emacs is way more featured than Eclipse. Eclipse has a small set of core features that are 'ported' to other languages and whatnot through plugins. Emacs, on the other hand, has boatloads of features and can have arbitrary new ones added at will, as the actual running of emacs itself can be modified through scripts. Eclipse can't do that.
>>
>>52325951
>deliberately misnumbering your code
don't be stupid now

>>52326048
well, it's really easy to set up and get going and it provides all the core features I need. I don't feel like spending a year getting to grips with emacs.
>>
Share your best fizzbuzzes, /dpt/!
public void FizzBuzz()
{
for(int i=1;i<101;i++)Console.WriteLine("{0:#;}{1:;;Fizz}{2:;;Buzz}",i%3*i%5==0?0:i,i%3,i%5);
}
>>
>>52326107
Wtf that's completely unreadable. You'd get thrown out of any interview you tried to pull that shit in.
Here's an actually decent fizzbuzz in C#:
void FizzBuzz()
{
const string FIZZ = "Fizz";
const string BUZZ = "Buzz";
const string FIZZBUZZ = "FizzBuzz";

int i = 0;
while (i < 150)
{
Console.WriteLine(++i);
Console.WriteLine(++i);
Console.WriteLine(FIZZ); ++i;
Console.WriteLine(++i);
Console.WriteLine(BUZZ); ++i;
Console.WriteLine(FIZZ); ++i;
Console.WriteLine(++i);
Console.WriteLine(++i);
Console.WriteLine(FIZZ); ++i;
Console.WriteLine(BUZZ); ++i;
Console.WriteLine(++i);
Console.WriteLine(FIZZ); ++i;
Console.WriteLine(++i);
Console.WriteLine(++i);
Console.WriteLine(FIZZBUZZ); ++i;
}
}
>>
How do I git gud at Javascript
>>
File: Untitled-1.jpg (79KB, 721x308px) Image search: [Google]
Untitled-1.jpg
79KB, 721x308px
I've got this problem which I need to solve using branch and bound. I looked it up online, found a bunch of theoretical examples but no actual implementation, and didn't understand much to be honest. I get that it's a more optimized backtracking, however, I struggle to understand most things without a real example. (not saying that I know jack shit about programming)
So now I'm looking at this problem, which looks easy as fuck, with no idea how to solve it. Any assistance is greatly appreciated.
>>
>>52324219
>Qt. It has bindings for any language you can imagine.
Except for C, the most important language.
Seriously, Qt has no fucking C interface, it's a fucking joke.
>>
>>52326166
something similiar to bubblesort looks like it woud work

move the gap along with the goat that's bubling until gets to the end. once it has passed select the next closest opposing goat and repeat
>>
>>52326178
>the most important language
Only a fool would write a GUI application in C.
>>
>>52324219
don't get this meme

in terms of GUI isn't wxwidgets just as advanced but with native bindings?
>>
NEW THREAD!!!

>>52326241
>>52326241
>>52326241
>>52326241
>>
>>52326107
import fizzbuzz
Thread posts: 314
Thread images: 43


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