[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 25
File: 1459325368771.png (1 MB, 1280x720) Image search: [Google]
1459325368771.png
1 MB, 1280x720
Old thread: >>53880216

What are you working on, /g/?
>>
File: gnu+bola.png (444 KB, 1489x2048) Image search: [Google]
gnu+bola.png
444 KB, 1489x2048
Tell me \g\, which distro has the most swag, and why is it Parabola GNU\Linux-libre?
>>
File: FizzBuzz.png (13 KB, 578x461) Image search: [Google]
FizzBuzz.png
13 KB, 578x461
Name a better lisp than logo

protip: you can't
>>
>>53885518
JavaScript

>Javascript was described as "we want to do lisp in the browser" to get its designer interested, if I remember that interview correctly...

>Indeed, Waldemar Horwat once told me that he viewed JavaScript as essentially Common Lisp with a C-like syntax. In fact Waldemar defined a metalanguage, wrote an interprepter for his metalanguage in Common Lisp, and then wrote the JavaScript spec in his metalanguage, thereby enabling him to actually run the specification. It was a clever technique.
>>
there is a vid torrent about design patterns in C# by jon Skeet. Just search his name on KAT and youll find it. I'd be quick b4 seeders are dead, it has 0 currently. Its ripped from this https://www.pluralsight.com/courses/csharp-design-strategies
>>
Posted
>>53884972
In the other thread, but didn't specify I was looking for feedback.
>>
>>53885518
>>53885558
neither of these are lisps. rebol is not a lisp, either.
>>
>>53885634
https://en.wikipedia.org/wiki/Logo_(programming_language)
>>
>>53885491
A library for Hasklel that is a superset of Applicative containing the element absorbing property of (*>) and (<*) and operationally the opposite of Alternative's (<|>).
>>
>>53885655
it might be related to Lisp in origin, but it lacks some of the defining features of Lisps. note that Scheme is not considered to be a Lisp by many
>>
>>53885697
What's operationally the opposite of Alternative?
>>
File: haskell-fb-industry.png (1 MB, 1128x1080) Image search: [Google]
haskell-fb-industry.png
1 MB, 1128x1080
>>53885675

Come join us in functional programming general
>>
>>53885718

Scheme is a lisp. So is Clojure.

Languages that don't use S-expressions are 100% for sure not Lisps.
>>
>>53885719
empty <|> a = a
a <|> empty = a
a <|> b = a


So basically element absorption, swap the resulting `a` with `empty` in the first two lines. So not wholly operationally the opposite, especially not when you consider the list instance of Alternative which just appends.
>>
>>53885841
Oh, I see. Is that actually useful, though?
>>
>>53885841
>left biased
>no indication in operator symbol

[throwing up anime girl.pnjpeg]
>>
>>53885491
Stop this programming fag meme.
>>
>>53885795
I think so too, but I'm just saying there's no real agreement on what a Lisp is (just like with functional programming). people say that to be a Lisp you need to be a Lisp-2 (separate namespace for functions and variables) and late binding

JESUS CHRIST THESE FUCKING CAPTCHAS ARENT LOADING AT ALL PLEASE KILL ME NOW
>>
>>53885841
>>53885877
Like, wouldn't your operation be doing the exact same as
liftA2 (curry fst)
?
>>
>>53885795
By that definition, John McCarthy's language called LISP isn't a Lisp.
>>
right now I'm in an intro to software engineering class. feels like a waste of time, and the professor is a woman really bad at teaching and also very ugly
>>
>>53885877
It basically expands the functionality of (*>) and (<*) with accompanying absorbing functions similar to Control.Monad. Purely as a typeclass it removes the restrictions introduced by Functor, and is more of a parallel to Monoid, i.e. a Semigroup with an absorbing element instead of identity element.

>>53885909
Yeah it's gay lol

>>53885972
Yes, it's also identical to how (*>) and (>>) from Applicative and Monad respectively operate, but see above.
>>
Does anyone know how to read a frame/stream from a webcam in linux via C?
So far I've read about OpenCV but it seems that is much more than am looking for.
Anyone knows how dev/video0 works?
>>
>>53886074
Oops, meant (<*) and (<<), otherwise you'd need `liftA2 (curry snd)`.
>>
>>53886124
https://en.wikipedia.org/wiki/Video4Linux
>>
>>53886049

Hmm... right. First lisp used M-expressions, didn't it? But everything else after that used S-expressions...
>>
>>53886145

Nice, thanks!
>>
>>53886211

M-expressions are superior.
>>
>>53886273
Why do you hate S-ex?
>>
File: opengraph-icon-200x200.png (8 KB, 200x200) Image search: [Google]
opengraph-icon-200x200.png
8 KB, 200x200
>$current_year
>not using the best programming language ever invented

>concise yet readable syntax that feels natural to write in
>supports modern features and programming paradigms
>takes inspiration from the best of other languages
>hundreds of modules avaliable for use

I'm talking, of course, about perl 6
pic unrelated
>>
>>53886074
I think I get it now. So all it takes to make an instance of the class is to designate a value as the absorbing element "empty", and the operator is defined.
>>
>>53886300
because essex is shit place
>>
>>53886303
>datetime(now)
>perl

go back to 2007
>>
>>53886303
That joke would have worked if you left out the "readable"
>>
>>53886300

S-exprs are great! I once thought about making a Ruby-like language using S-exprs for pure object oriented programming shit... but then I discovered the Clojure guys stole my idea.
>>
File: Source_code_in_Perl.png (63 KB, 762x506) Image search: [Google]
Source_code_in_Perl.png
63 KB, 762x506
>>53886357
>implying perl isn't readable
>>
>>53886391
oh yeah btw, I tried out Ruby for something recently. surprisingly I really liked it and I think it fits in really well with the Lisp philosophy of making DSLs for everything
>>
>>53886436

Yeah, Ruby was at least partly inspired by Lisp. It was also heavily inspired by Smalltalk and Perl though.
>>
>>53886426
That looks like crap.

Also what is it with the French? Use English variable names like the rest of the world you fucks.
>>
>>53886391

While we've got you on the horn, here: best way to learn Ruby? I want to actually learn Ruby. Something meant for people who are already programmers would be good.
>>
>>53886451
this was just a snippet of code I got from google, it's the most readable I could find
>>
>>53886451
only native English speakers use English named variables you burger
>>
>>53886477
haha no
>>
oi lads

would you class addBook(Library l, book b) -> return l
as a constructor or a mutator? help me settle an argument
>>
File: 1452403462016.png (79 KB, 307x400) Image search: [Google]
1452403462016.png
79 KB, 307x400
>>53886477
>Anything related to computing
>Not in English
>>
>>53886477
Überhaupt nicht, du Depp.
Nur absolute Beginner benutzen deutsche Variablennamen hier.
>>
>>53886300
because he's not getting any
>>
>>53886467

The best way to pick up the syntax, for me, was through Why's Poignant Guide.

The best way to really learn the language beyond the syntax is to fuck around in the repl until you're comfortable with it. Ruby does a lot of things in the way you'd expect it to. And if you're not sure what all you can do with an object, just ask for its methods.

$ irb
irb(main):001:0> 9.methods
=> [:to_s, :inspect, :-@, :+, :-, :*, :/, :div, :%, :modulo, :divmod, :fdiv, :**, :abs, :magnitude, :==, :===, :<=>, :>, :>=, :<, :<=, :~, :&, :|, :^, :[], :<<, :>>, :to_f, :size, :bit_length, :zero?, :odd?, :even?, :succ, :ord, :integer?, :upto, :downto, :times, :next, :pred, :chr, :to_i, :to_int, :floor, :ceil, :truncate, :round, :gcd, :lcm, :gcdlcm, :numerator, :denominator, :to_r, :rationalize, :singleton_method_added, :coerce, :i, :+@, :eql?, :remainder, :real?, :nonzero?, :step, :quo, :to_c, :real, :imaginary, :imag, :abs2, :arg, :angle, :phase, :rectangular, :rect, :polar, :conjugate, :conj, :between?, :nil?, :=~, :!~, :hash, :class, :singleton_class, :clone, :dup, :itself, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :remove_instance_variable, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :extend, :display, :method, :public_method, :singleton_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__]
>>
>>53886477
latinofag here, programming in anything other than english is way too cringy for me.
>>
>>53886532
>The best way to pick up the syntax, for me, was through Why's Poignant Guide.

Thanks, M90.
>>
>>53886498
Neither, because it doesn't do anything.
>>
Working on an Arduino-based Firefighting robot. I'm using 3 servos, an ultrasonic sensor and a fire sensor.
>>
Native english speakers are inherently better programmers, treu of false?
>>
>>53886556
let's say it's a function that given a library and a book, add the book to the library and return the
updated library. Constructor or mutator?
>>
>>53886585
Mutator, because (if?) it doesn't construct a new library.
>>
>>53886477
are you retarded? Programming in english is a fucking must.
>>
>>53886538
>cringey
What the fuck is this supposed to mean in the context of writing computer code?
>>
>>53886644
only if you're selling your product to other countries
>>
>>53886609

that's what I thought! Apparently to this other unnamed person, deleteBook is a mutator while addBook isn't.
>>
>>53886689
They're dumb.
>>
File: wjp1xVE.png (1 MB, 1169x800) Image search: [Google]
wjp1xVE.png
1 MB, 1169x800
>implementation inheritance
>>
>>53886741
literally nothing wrong with this
>>
>>53886573
best programmers speak hindi
>>
>>53886788
Literally just a special case of composition & interface inheritance that doesn't scale.
>>
>>53886652

Its the context switch between one language and the other, it ruins your concentration and it makes the code seem like a mess due to library functions being in english.
Imagine this: you are working on a project with various people, then comes THIS one special snowflake and starts writing and documenting code in whatever his bullshit language is.
Now you are averse to non-eng programming for the rest of your life.
>>
>>53886848

template <typename T>
struct ContiguousProvider {
virtual T* begin() = 0;
virtual T* end() = 0;

inline std::ptrdiff_t diff() { return end() - begin(); }
}
>>
File: ppp.jpg (33 KB, 630x354) Image search: [Google]
ppp.jpg
33 KB, 630x354
I have a group of functions. They depend on each other successively (function A() feeds its output into function B via B(A()), which feeds into C as C(B(A())), and so on). I need each of these to increment a global variable called t, so that A has t = 1, B has t = t + 1, C has t = t + 1, so and so forth. I want the functions to update the global variable. Is this doable?

>pic related, it's the language I'm using
>>
>>53886972
anything is possible in snek

what you want to do is compose composition with incrementing t, in haskell that'd start with (.)(.)
>>
>>53886972
put
global t
at the start of each function

I think.
>>
>>53886995
boobs as syntax? count me in
>>
>>53885491
is why is bad to cast the return of malloc? i do it every time.
>>
Fuck you all, I only have dreams about coding FizzBuzz now.
>>
Can /dpt/ implement Prime Fizzbuzz?
For every number 1 to 100:
If it's a prime and a multiple of 3 and 5, output "Fizzbuzz"
If it's a prime and a multiple of 3 but not 5, output "Fizz"
If it's a prime and a multiple of 5 but not 3, output "Buzz"
Else, output the number
>>
Even Indians understand to program in English. No excuses.

>>53886913
template<class T>
struct IContiguousProvider {
virtual T *begin() = 0;
virtual T *end() = 0;
}

template<class T>
inline ptrdiff_t diff(IContiguousProvider<T> &prov) {
return prov.end() - prov.begin();
}

Special case + a bit of syntax. Power is equivalent, and composition doesn't lead to problems like multiple inheritance can.
>>
>>53886913
>>53887156
It's also how you would do things when implementing objects using closures. Inheritance is extra language complexity for little payoff.
>>
>>53887156
can't do prov.diff in C++
>>
>>53887256
As I said, it's just a bit of extra syntax for that special case.
>>
>>53886999
I don't know how to thank you. This is part of a PhD project I'm working on (MD-PhD here dabbling in bioinformatics and comp bio). I just... my fucking project works.

THANK YOU BASED GOD.
>>
>>53887110
this is fun bait for lots of reasons, I won't go into the obvious one:
>"every number" rather than "every integer"
>if it can be a "multiple" via a non-integer real literally all reals are a "multiple" of 3 and 5
>if some poor sod was dumb enough to take this problem seriously they might actually have some fun implementing a program that detects primes, but that process requires realizing that the problem is dumb
>>
>>53887110
:^)
>>
>>53887110
is_prime = lambda x: all(not x % i == 0 or i == x for i in range(2, 10)) if x != 2 else False
print("\n".join("FizzBuzz" if i % 15 == 0 and is_prime(i) else "Fizz" if i % 3 == 0 and is_prime(i) else "Buzz" if i % 5 == 0 and is_prime(i) else str(i) for i in range(1, 100)))
>>
>>53887110
sure:

for(int i = 1; i <= 100; ++i) {
std::cout << i;
}


what do i win?
>>
>>53887342
delete this
>>
>>53887369
So close.
>>
>>53887373
no
>>
>>53887383
yeah i f'd up

need if == 3 fizz if == 5 buzz. w/e it was gay i shouldnt have responded.
>>
Anyone know how critical hits are usually programmed? I'm retarded and I'm struggling to figure out how to calculate whether a value should be a critical hit or not.
>>
File: dpt fails again.png (37 KB, 743x610) Image search: [Google]
dpt fails again.png
37 KB, 743x610
reminder that /dpt/ can't program
>>
>>53887432
Random chance, I'd guess.
>>
I'm working on a curses torrent client.

rtorrent is nice, but I want something that's similar to pyroscope (without the ridiculous build process) and.. prettier? so I decided to start building my own.

I'm using node.js and chjj/blessed, there's modules on npm for torrent-stream..
at the moment I'm just dicking around with UI and deciding what features I'll want
>>
>>53887450
Let's say I have a weapon struct/object with a
double critical_chance
value. How would I make that influence it?
>>
>>53887432
physically simulate a dice roll
>>
>>53887467
If `critical_chance` is in percent, then you'd generate a random double between 0 and 100. If it's less than `critical_chance`, you crit.
>>
>>53887434
Sorry anon but you're the idiot here :^)
>>
>>53887467
rand() % 100; // random integer in range [0, 99]
if ((rand()%100) > (critical_chance*100))
; //crit
>>
>>53887467
Roll a number between 1 - 100, if your cirt hit chance is 25% then the number must roll between 1-25 for it to be a crit.
>>
>>53887493
>>53887500
>>53887510
Thanks guys, I thought so but my brain wasn't working properly for a moment.
>>
>>53887467
depends, do you want hit chance and crit chance to interact? how? it's sorta your decision.
here's one implementation, I'm not gonna bother doing it in pseudocode:
>hit chance is a prechosen number H between 0 and 1
>crit chance is a prechosen number C between 0 and 1
>randomly generate a number A between 0 and 1
>if A is lower than H but higher than H * C, simple hit
>if A is lower than H * C, critical hit
>else: miss
these are game design choices as much as programmatic choices
>>
>>53887523
FYI, don't use rand().
>>
>>53887551
faggot detected
>>
>>53887550
this is a reasonable implementation if, say, H is chosen based on multiple factors but C is constant based on the weapon used. I'd make sure that hits occur about as often as is appropriate, and then set C around- well, going by D&D 3.5 it could be in the range .05-.15.
>>
>>53887551
For some small shit function, it's okay.
>>
>Tfw programming is too hard
>>
>tfw programming is too easy
>>
>tfw shitpostan on /g/ and not actually programming
>>
when are we getting our own board?
>>
>tfw shitposting on /g/ and actually programming
>>
>>53887805
>>>7chan/prog
>>
honestly what I wanna see out of a hit/damage system is, like, a function D from x drawn from the reals in the interval (0, 1] to D(x) drawn from the non-negative integers less than (max damage). instead of calculating whether it does any damage at all in one step, then calculating damage the same way whether the hit was borderline or by a large margin, UNLESS it's a REALLY large margin in which case you apply a multiplier... so many fucking steps, right? just make damage directly dependent on accuracy. if you want accurate-but-piddling and inaccurate-but-powerful to be separate playstyles, you can still tweak what the function logic/maximum damage is, but I feel like you'd get more natural-feeling accuracy/damage correspondences if it wasn't split into several steps.
>>
>tfw actually programming and not shitpostan on /g/

>>53887805
never again
welcome to neo-/g/, enjoy your stay. rice threads are over there, os flame wars over there and smartphone b8 over there. enjoy your stay!
>>
>>53887824
>reals

stopped reading there.
>>
Seriously programming is way too hard to make a quantum physics simulation app WHY LIVE
>>
>>53887849
Import quantum


__init(self)___ = quantumSim.run
>>
Anyone done anything w/ the Panama papers or Turkey population dataset yet?
>>
>>53887865
laughed
>>
>>53887839
oh no, you might have to tweak the logic very slightly to generate hit attempts as integers using a pseudorandom number generator that probably works from the uniform distribution between 0 and 1 (closed on either end or not, Idk) anyway, what an inconvenience
unless you're mad I'm not working with the complex plane, in which case I can't help you bro
>>
I'm writing a PDP-11 emulator.
>>
>her attack resolution model is ill-defined for the non-real hyperreals, what a plebe
>>
>>53888071
>her
>>
>>53888087
yeah son, I'm a L
O
N
D
O
N
>>
Looking for resources on writing c++ code for CUDA cores. Doing an intro course on it right now.

I'm about to shell out $300 on a GTX 980 or whatever the fuck. Saving up $1200 for whenever that GP100 releases with all.
>>
>>53888147
good goy
>>
>>53888178
I could give you 1 year to write a deep neural network -- and you still wouldn't, you meming nigger.

Let me have my parallel data processing ffs
>>
File: discuss.jpg (117 KB, 600x600) Image search: [Google]
discuss.jpg
117 KB, 600x600
"Easy processes and good documentation means you can't sell professional services."
>>
>>53888279
>would rather write bad code than just tear down capitalism
>>
you: capitalism incentivizes bad thing
me: huh, you're sure right
you: well? aren't you going to stop doing good thing?
me: [wearing a balaclava and carrying a molotov cocktail] listen, my dude, I'm kind of busy right now
>>
>>53888295
>>53888329
Is this the birth a new epic meme?
>>
>>53888338
>new
here, lemme google that for you. from the wikipedia page:
>Karl Marx[note 1] (/mɑːrks/;[5] German pronunciation: [ˈkaɐ̯l ˈmaɐ̯ks]; 5 May 1818 – 14 March 1883)
>1883
>>
is programming a meme?
>>
>>53887849
breh give me the equations and I'll have an app by the end of the week.
>>
>>53888426
you're a meme
>>
>>53888295
>tear down capitalism

And with it, you'd tear down quality of life worldwide.
>>
hey /dpt/

How do I get good at Python? I am pretty familiar with C but I want to write things in Python, but I feel uncomfortable and lost using it. I've skimmed through a couple books at least. Any tips? A book or course you'd recommend for someone that's already programmed a good amount? Thanks.
>>
>>53888524
python3 reference guide . . . Make something ?

Python is slow as fuck, step it up to C++ kid
>>
I hate to do this but I am trying to make a function that strips comments from a C program for an exercise in K&R. Am I too retarded for progamming?

#include <stdio.h>
#define MAX 1000
int get_line(char s[], int lim);
void uncomment (char s[], char s2[]);
/* UNFINISHED BECAUSE I AM A USELESS DEGENERATE INCAPABLE OF ANYTHING PRODUCTIVE 4/4/16 */

int main ( void )
{
int len;
char program[MAX];
char strip[MAX];
while((len = get_line(program, MAX)) > 0) {
uncomment(program, strip);
printf("%s", strip);
}


return 0;

}


int get_line(char s[], int lim)
{
int c, i;
for(i=0; (c=getchar()) != EOF && c != '\n' && i < lim -1 ; ++i ) {
s[i] = c;
}
if( c == '\n')
s[i++] = c;
s[i] = '\0';
return i;
}


void uncomment (char s[] ,char s2[])
{
int i,l,j;
int begin, end, begin_st, end_st;

begin = end = begin_st = end_st = i = l = j = 0;
while(i < MAX -1 && l < MAX -1 && j < MAX - 1)
{
if(s[i] != '/')
++i;
else if (s[i] == '/' && s[i+1] == '/') {
while(s[i] != '\n')
++i;
if(s[i] == '\n')
end = i - 1;
begin = i;
}
else if(s[i] == '/' && s[i+1] == '*') {
while(s[i] != '*')
++i;
if(s[i] == '*')
end = i + 1;
begin = i;
++i;
}
begin_st = begin;
end_st = end;
while(begin > 0 && end > 0) {
if( j < begin_st )
s2[l++] = s[j++];
else if(j > end_st)
s2[l++] = s[j++];
else
++j;
}
begin = end = 0;
}
s2[j] = '\0';
}
>>
>>53888524
Learn Python The Hard Way
>>
>>53888565
Please ignore how messy it is, I have changed it a million times since yesterday so it just got worse and worse.
>>
>>53888520
son, I've read this a few times now, and I can't figure out how this is supposed to be a shitpost. looks to me like it's an unironic political opinion. now, call me a traditionalist, but I think if you're going to discuss the validity of non-capitalist systems seriously, you might want to post on a different board! might I recommend
>>>/his/
or possibly
>>>/pol/
or, if you're looking for a more global opinion, perhaps this is more your speed
>>>/int/
>>
File: that one dutchman.png (31 KB, 1323x213) Image search: [Google]
that one dutchman.png
31 KB, 1323x213
How do I into writing an interpreter?
Mainly the language over the parsing
>>
File: simg57.gif (2 KB, 319x41) Image search: [Google]
simg57.gif
2 KB, 319x41
>>53888464
where i is the imaginary unit, Y is the time-dependent wavefunction, h is the reduced Planck constant, V(x) is the potential energy, and is the Hamiltonian operator.
>>
>>53888520

This. I eat meat every single day while North Korea just told its citizens to prepare for famine (again), and the Chinese are eating "gutter oil". I dummy want to lose capitalism.
>>
>>53888565
how will you handle multi-line comments like
/*

*/
>
>>
>>53888580

I understand it's shitposting, but I wouldn't want anyone to get the impression that communism could be discussed in a positive light.
>>
>>53888524
If you already know everything in the tutorial [1] then you need to start writing programs, the bigger the better. If you can't think of anything, then just write toys using the better /dpt/ roller [2] until you are inspired.

[1] https://docs.python.org/3/tutorial/index.html
[2] https://better-dpt-roll.github.io/
>>
>>53887849
https://www.youtube.com/playlist?list=PLdCdV2GBGyXNMz8fltjdSrRQ8SYsZZj3Z
related
>>
>>53888612
>non-capitalism is necessarily communism
see, this is more like it. keep this level of shitpost quality up and we might have some fun
>>
Is using vim for C++ pantsu-on-head retarded? I used Code::Blocks in college..
>>
>>53888633

What other options are there?
>>
>>53888279
"Undocumented or poorly written code will destroy a company over time."
>>
>>53888608
W-why wouldn't this take care of it?
    else if(s[i] == '/' && s[i+1] == '*') {
while(s[i] != '*')
++i;
if(s[i] == '*' && s[i+1] == '/')
end = i + 1;
begin = i;
++i;
}
>>
>>53888653
in the future, you should avoid asking humans questions you can more efficiently ask search engines, but here's a freebie.
>https://en.wikipedia.org/wiki/Post-capitalism
>>
>>53888694
>all variations on socialism and communism

It's precisely what I predicted.
>>
>>53888582

Scan (characters -> tokens)
Parse (do correctness checks and convert tokens -> AST)
Interpret AST (or do some bytecode shit and interpret that)
>>
int x{1};

but not
auto x{1};

REEEEEEEEEEEEEEE
>>
>>53888644
not at all
>>
>>53888688
nvm I misread your loop. I thought it was only processing each line individually. let me look it over again.
>>
>>53888706
>savors the smell of "didn't read" shitposting
>>
>>53888745
There's no point anon. I am just a retard who can't debug babby code. Thanks for your help.
>>
>>53888754

I assure you, I read it.
>>
>>53888739
I'm going to use Eclipse with CDT, but thanks anyway senpai.
>>
>>53888572
I'm not a complete idiot that wants to kill myself for how stupid I am. (Fuck Zed Shaw)

>>53888613
Thanks anon, will do.
>>
>>53888565
I don't approve of K&R but here are some ideas:

>don't read line by line. read char by char
>input buffer only needs to be as big as the maximum number of characters necessary to start/end a comment
>consider all the possibilities of starting/ending a comment before you even open your fucking editor (protip: it's /* and // so the buffer only needs 2 ints)
>no need to store comments or cleaned up code. just print it back to stdout right away
>read some god damn tutorials
>>
>>53888798
No problem.
>>
>>53888792
What a mess. What a waste.

vim is great
>>
>>53888792
S P A C E M A C S
>>
>>53888826
Alright you convinced me I'm using Vim.
>>
>>53888279
this also comes up in cases where you aren't explicitly selling your services. at microsoft, people often intentionally don't document their work because being the only one that really knows how to use it grants them additional job security
>>
File: you-died.gif (991 KB, 568x707) Image search: [Google]
you-died.gif
991 KB, 568x707
Added some features to this little textgame I made thanks to the anons in this thread. Written entirely in rust.
Still a novice programmer so pls dont bully
>>
File: JUST.png (32 KB, 1020x858) Image search: [Google]
JUST.png
32 KB, 1020x858
how to deal with people who won't contribute?
>>
>>53888870

Cute. Now make it use ncurses and start adding menus so you can do more than just attack and get attacked.
>>
>>53888881
Sabatoge their grade by doing all the work and claiming that they didn't participate in the project
>>
>>53888881
Why do you feel that they should be contributing more?
>>
>>53888855
don't get memed on
>>
>>53888870
neat!
>>
>>53888881
The graphs looks like a girl period cycle
>>
>>53888914
Good idea, i have 0 experience with ncurses though. Can I even get that shit working with windows?
>>53888942
Thanks anon
>>
>>53888809
I am gong to keep using K&R but why don't you like it anon?
>>
>>53888613
>rolls Conway's game of life
>has literally programmed dozens of cellular automata that take RGB images as input
they're PROBS not as interesting as Conway's game of life because they're not infinite and likely also not Turing-complete, but also. implementing Conway's game of life sounds like it would put me to sleep at this point
>>
>>53888881
>1,013++ / 438--
so 1,014 / 437?
what is this meme shit
>>
>>53888966
additions and deletions
>>
>>53888952
post source
>>
>>53888881
Unrelated: I wonder what >>53888888 was?
>>
>>53888959
Roll again. They're just little toys for when you can't think of anything else to make.
>>
>>53888881

Give them a task. Remind them about their task every few days.

>>53888952

Ncurses is portable, although it can be a pain to set up on Windows (there's probably some binaries floating around somewhere). Rust should have a port of ncurses, if not some ncurses-like libraries.
>>
File: rrrrrrr.png (32 KB, 1147x420) Image search: [Google]
rrrrrrr.png
32 KB, 1147x420
>>53888947
as it should attached is our cycle schedule
>>53888919
bottom left is a student athlete and hasn't done shit.
>>
>>53888973
i know, i just mean they shouldn't use increment/decrement operators because "programming lol" when it doesn't even make sense. +x / -y would have been just fine
>>
>>53888836
>tfw spacemacs looks neat but I have no idea what I'm doing in emacs
>>
>>53888987
It's kind of a mess.
https://github.com/Starchery/text-souls
>>53889005
I'll look into the ncurses thing, thanks.
>>
>>53888988
hahahaha
fuck you for encouraging repeating digits bullshit...


but ALSO that's fucking great

>>53889003
oh I know, I was just kinda laughing 'cause my first roll was so spot-on aimed at something I have a lot of experience with
>>
>>53888716
You literally mentioned everything I didn't care about
>>
>>53888836
The reason I dont use spacemacs or an ide is because I have a lot of different computers and I hate doing any amount of setup and vim is always installed and always works.
>>
>>53889007
>bottom left is a student athlete and hasn't done shit
get rich or become a snitch but dont be a little bitch
>>
>>53889015
Spacemacs is very easy to grasp and get started with. It has mnemonic key bindings and uses which-key (displays availble keybindings when you press SPC). Give it a try (you don't have to).
>>
>>53888881
Communicate.

Talk to them about their productivity, and let them know its OK to push incrementally.

Don't be an asshole, but let them know you have standards of participation.
>>
>>53889049
none of the rest of my team members is going to shaft him in the peer evals, it'll just look like me being a dick.
>>
>>53888870
>displays negative health
ew
>>
>>53889094
>none of the rest of my team members is going to shaft him in the peer evals

Why not?

Also, what's the project?
>>
>>53889088
Promise them that you will give everyone an A on the group evaluation and then give them all a C.

t. My OOP classmates
>>
>>53889034

Then maybe you should be more specific.
>>
>>53889094
then
>G E T T H E F U C K O V E R I T

you think his lack of effort is going to get him places when hes out of school?

>get rich or become a snitch but dont
>dont
>dont
>be a little bitch
>>
>>53889128
I said mainly the language
>>
>>53889122
SEC school. everybody babies the athletes. even the students.
It uploads pictures to various accounts its configured for as a photographer takes them. Accomplished with a raspberry pi mounted to the bottom of a dslr. Currently works with twitter and dropbox.
>>
>>53888582
read essentials of programming languages
>>
>>53889171
>It uploads pictures to various accounts its configured for as a photographer takes them. Accomplished with a raspberry pi mounted to the bottom of a dslr. Currently works with twitter and dropbox.

What lang?
>>
>>53889140

That tells me fuck all about what you want. What specifically about the language?
>>
>>53889095
You don't like that? I like when games do that.
An alternative is to make it say OVERKILL whenever they're killed and their health goes below 0, but that happens way too often for it not to be obnoxious.
>>
>>53889219
type Expression =
| Lit of string
| Let of string * Expression
| App of Expression * Expression
>>
>>53889197
python
>>
>>53889171
>"hey man, i'm going to fail you on the peer eval if you don't start actually doing something"
>uh y u do dat mayne?
>"because i'm selfish and you aren't contributing"
>dayum ok iz be better

then fail him on the peer eval even if he has an epic turnaround. you're a pussy.
>>
>>53888590
See you friday m8
>>
>>53889223
>enemy has x health
>you hit for x+y
>enemy has been defeated
imo, its your game
>>
vector<auto> defeatCommunism;


How does the compiler deal with this
>>
>>53889255

Neat project. More interesting than mine, at least.
>>
>>53889296
not valid yet
concepts voted out
>>
>>53888590
>transliterates psi as Y
no
>>
>>53889431
sue me
>>
File: timetogo.jpg (73 KB, 500x646) Image search: [Google]
timetogo.jpg
73 KB, 500x646
You guys have to solve Fizzbuzz but there are two rules
1. You can't have the same solution as the person who solved it before you
2 You can't add minor changes to code and say its different. i.e. You can't take someones code and change a 3 to 2+1.
Ill start
#include<iostream>
int main(){for(int i=0;i++<100;){if(i%5&&i%3)std::cout<<i;std::cout<<(i%3?"":"Fizz")<<(i%5?"":"Buzz")<<'\n';}}
>>
>>53889458
Do you think removing the whitespaces and newlines makes it look more cool?
>>
>>53889477
Yea
>>
>>53889458
#include <memes.h>

int main(int argc, char *argv[])
{
fizzbuzz();

return 0;
}
>>
just had a conversation with my dad about comment sections/comment-driven sites and realized: if my dad read these threads he'd have an aneurysm. which, frankly, is justified. 4chan is trash, and the trash is at the heart of the concept. he's been using Internet communities for 20 years, he knows better than to fall for "anonymity is a good idea."

... but I'm addicted to general threads and there's no going back now
>>
>>53889498
fatal error C1083: Cannot open include file: 'memes.h': No such file or directory
>>
File: ;D.png (57 KB, 800x334) Image search: [Google]
;D.png
57 KB, 800x334
>>53889458
>>
What is a good introduction to C++, /dpt/?
>>
>>53889520
Someone didn't get the latest version of glibc.
>>
>>53889543
Slowly inserting a toothpick into the gap between your finger and nail
>>
File: 1446512644123.gif (1 MB, 400x300) Image search: [Google]
1446512644123.gif
1 MB, 400x300
>>53889513
>>
>>53889528
Is that D?
>>
>>53889528
but you're printing out the brackets and quotation marks and not the newlines
>>
>>53889528
This is not fizzbuzz, fizzbuzz has no quotation marks, brackets or commas.
>>
>>53889597
replace the ".writeln;" at the end with ".join('\n').writeln;"
>>
>>53889630
Fizzbuzz has no spaces, tabs or newlines
>>
>>53889647
FizzBuzz has no Fizz, Buzz or FizzBuzz
>>
is fizzbuzz one of those memes that's funny because it's always been funny and if I stick around long enough I, too, will think it's funny? or is there something inherent about fizzbuzz that makes it amusing and justifies its endless repetition
>>
>>53889676
Yes it does
>>
>>53889694
It's funny that there are people ITT that cannot implement fizzbuzz.
>>
I love you guys so much!

Lets make /dpt/ great again
>>
If I need to mess with HTTP/HTML stuff, what's better than BeautifulSoup & Requests?
language does not matter
>>
>>53885518
I can't, because all lisps are equally shit.
>>
>>53889709

int n = 6000000; // 6 Gormillion nevar forgetti spaghetti

for(int i = 0; i < n;i++)
{
if(i % 3 == 0 && i % 5 == 0)
{
System.out.println("FizzBuzz");
}
else if( i % 3 == 0)
{
System.out.println("Fizz");
}
else if ( i % 5 == 0)
{
System.out.println("Buzz");
}
else
{
System.out.println(i);
}

}

>>
>>53889709
like
>"cannot implement fizzbuzz" as in "cannot write a program that produces strings human-readable as fizz, buzz, and fizzbuzz for the appropriate numbers," or
>"cannot implement fizzbuzz" as in "produces programs that solve fizzbuzz but the output is formatted in a way inconsequentially straying from unstated hyperspecific requirements that have nothing to do with the problem logic," or
>"cannot implement fizzbuzz" as in "carelessly posts early drafts that do the wrong thing on the assumption that the problem is so simple that they won't make any errors the first time around, but had they checked the output and not posted early implementations they would have arrived at a correct implementation and we would never have known they screwed up"
the first one's hard to believe, the second two don't seem all that funny
>>
>>53887864
It's ALWAYS the fucking Pythonfags making these stupid fucking posts.
Do the world a favor and kill yourself now.
>>
>>53889777
#include <complex>

using namespace std::complex_literals;
static const auto n = 6_000_000i;
>>
>>53888520
Kill yourself you cancerous tripfag.
>>
>>53889694
>>53889789
>>53889777
It's also funny b/c it baits autismos into posting long replies
>>
>>53889789
the first one. and believe it
>>
>>53888565
Consider the following: char *derp = "/*"; is a valid string and not a comment. As well as char derp = '/'; is a valid char and not a comment.
>>
>>53889815
Sorry I only program in Java I like to program in Java but without all the verbose code of


public static void main(String[] args)
{

}



if you take that stuff out Java is pretty fun language
>>
File: 1433517695304.png (1 MB, 1300x4704) Image search: [Google]
1433517695304.png
1 MB, 1300x4704
>>53888672
>Microsoft
>>
File: magic_tits.jpg (145 KB, 1200x675) Image search: [Google]
magic_tits.jpg
145 KB, 1200x675
/android/

I have to download sql db from server into my app inernal storage
/data/data/appname.com/database/


I am using DownloadManager, but it looks like I cant just download it into folder I want and for such basic task I have to write another class using ContexProvider

is there a easier way?

Why every basic task on this os require such effort?
Downloading a fucking file should be like 1-2 line of code.
>>
>>53889843
I'm just verbose, dude. I reply to things that I have opinions on. those opinions are usually lengthy.
>>
>>53889889
because java
>>
>>53889891
Java is perfect for you then
>>
hey /dpt/
>one datum, two data, three data...
>there are a lot of data
or
>one piece of data, two pieces of data...
>there is a lot of data
>>
Hi guys What is a good Object Oriented language that is not ridiculously verbose like Java which I can program good applications in?
>>
>>53889828

I might be cancer, but at least I'm not commie scum. Kill yourself.
Thread replies: 255
Thread images: 25

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.