[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


Thread replies: 322
Thread images: 25

File: 1459325368771.png (1MB, 1280x720px) Image search: [Google] [Yandex] [Bing]
1459325368771.png
1MB, 1280x720px
Old thread: >>53880216

What are you working on, /g/?
>>
File: gnu+bola.png (444KB, 1489x2048px) Image search: [Google] [Yandex] [Bing]
gnu+bola.png
444KB, 1489x2048px
Tell me \g\, which distro has the most swag, and why is it Parabola GNU\Linux-libre?
>>
File: FizzBuzz.png (13KB, 578x461px) Image search: [Google] [Yandex] [Bing]
FizzBuzz.png
13KB, 578x461px
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 (1MB, 1128x1080px) Image search: [Google] [Yandex] [Bing]
haskell-fb-industry.png
1MB, 1128x1080px
>>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?
>>
>$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 (63KB, 762x506px) Image search: [Google] [Yandex] [Bing]
Source_code_in_Perl.png
63KB, 762x506px
>>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 (79KB, 307x400px) Image search: [Google] [Yandex] [Bing]
1452403462016.png
79KB, 307x400px
>>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 (1MB, 1169x800px) Image search: [Google] [Yandex] [Bing]
wjp1xVE.png
1MB, 1169x800px
>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 (33KB, 630x354px) Image search: [Google] [Yandex] [Bing]
ppp.jpg
33KB, 630x354px
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 (37KB, 743x610px) Image search: [Google] [Yandex] [Bing]
dpt fails again.png
37KB, 743x610px
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 (117KB, 600x600px) Image search: [Google] [Yandex] [Bing]
discuss.jpg
117KB, 600x600px
"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 (31KB, 1323x213px) Image search: [Google] [Yandex] [Bing]
that one dutchman.png
31KB, 1323x213px
How do I into writing an interpreter?
Mainly the language over the parsing
>>
File: simg57.gif (2KB, 319x41px) Image search: [Google] [Yandex] [Bing]
simg57.gif
2KB, 319x41px
>>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 (991KB, 568x707px) Image search: [Google] [Yandex] [Bing]
you-died.gif
991KB, 568x707px
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 (32KB, 1020x858px) Image search: [Google] [Yandex] [Bing]
JUST.png
32KB, 1020x858px
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 (32KB, 1147x420px) Image search: [Google] [Yandex] [Bing]
rrrrrrr.png
32KB, 1147x420px
>>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 (73KB, 500x646px) Image search: [Google] [Yandex] [Bing]
timetogo.jpg
73KB, 500x646px
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 (57KB, 800x334px) Image search: [Google] [Yandex] [Bing]
;D.png
57KB, 800x334px
>>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 (1MB, 400x300px) Image search: [Google] [Yandex] [Bing]
1446512644123.gif
1MB, 400x300px
>>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 (1MB, 1300x4704px) Image search: [Google] [Yandex] [Bing]
1433517695304.png
1MB, 1300x4704px
>>53888672
>Microsoft
>>
File: magic_tits.jpg (145KB, 1200x675px) Image search: [Google] [Yandex] [Bing]
magic_tits.jpg
145KB, 1200x675px
/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.
>>
>>53889953
There is literally nothing wrong with Karl Marx
>>
>>53889948
C# is definitely what you are looking for
>>
>>53889948
D
>>
>>53889953
Kill yourself.
>>53889965
Kill yourself.
>>
>>53889980
Will I be able to make any Android or IOS applications with C# without all the verbosity
>>
File: 1459552406241.gif (383KB, 480x270px) Image search: [Google] [Yandex] [Bing]
1459552406241.gif
383KB, 480x270px
Would I get IP banned by google if I tried to make a website that indexed unlisted youtube videos by trying random 10-character base62 youtube video IDs and then indexing the matches?
>>
>>53889953
Kill yourself.
>>
Steve Jobs did nothing wrong
>>
File: prod.jpg (83KB, 500x627px) Image search: [Google] [Yandex] [Bing]
prod.jpg
83KB, 500x627px
>new "cyber-security team" launched at work
>sorry developers who've been here 10+ years. You don't get prod access. But when shit breaks, you'll get blamed.
>Welcome aboard new intern, here's your production access!

Shit's been fucked. Basically they give prod access away like candy to the least component people; many of them have never touched a command line shell in their entire fucking lives. Meanwhile developers who know what they're doing are locked out of prod in the name of security. Then when someone incompetent messes with shit and breaks production, the developers get blamed and yelled at for it.
>>
>>53889948
Ruby :^)
>>
>>53889980
Wait a second you lied to me!


public class FirstProgram
{
public static void Main( )
{
System.Console.WriteLine("Hello");
System.Console.WriteLine("Juan!");
}
}




All that bloat just to print to the console
>>
>>53890042
What about dying?
>>
>>53890054
did
I
stutter
>>
>>53890019
Yep, its basically java with all the verbosity and shitty shit taken out
>>
>>53890049
Sounds like they're treating you codemonkeys like the computer janitor peons that you are.

All is right in the world.
>>
>>53889937
Both are acceptable. I'd personally shorten it to "one data, two data, three data."
>>
>>53890061
yes
>>
>>53890024
probably, at least eventually
>>
which is right, my code
 
sem_wait(&empty); /* wait for the number of empty spots to be at least 1 */
sem_wait(&mutex); /* enter critical region */
/* produce */
sem_post(&mutex); /* leave critical region */
sem_post(&full); /* increase the number of full spots by 1 */



 
sem_wait(&mutex);
sem_wait(&empty);
/* produce */
sem_post(&full);
sem_post(&mutex);


or the code my professor is telling me to change it to? my version compiles and runs correctly, and when i switch it to his version it deadlocks, and i told him that and he told me i must have a bug that needs to be fixed
>>
>>53890024
probably. they want people to use their apis, and only for things they approve of (which wouldn't include that). you should distribute the process across cheap hosting service instances and periodically spin up new instances if/when they get banned
>>
>>53890051
Sounds like python is up your alley if having a console program being short is all you care about
>>
>>53890135
What should I care about in a programming language?
>>
>>53890076
>data as a common-number count noun
huh, that's a new one. valid, I guess, but I've never seen it that I can remember. I was hoping someone in this thread was a pedant and would throw a shitfit about data being etymologically a plural count noun, but I guess I have to give you guys a little more credit than that.
>>
>>53890149
things that actually matter
>>
>>53890190
Such as what?
>>
>>53890149
Choose 1 (one):
a) It thinks like the machine
b) It thinks like the programmer
>>
>>53889789

The first is more likely than you think.

https://css-tricks.com/tales-of-a-non-unicorn-a-story-about-the-trouble-with-job-titles-and-descriptions/

>OMG Math!
>>
>>53890112
Your makes more sense, but neither snippets make any sense. I'm guessing there is more to it.
>>
>>53890316
math is fukin gay
>>
File: SS2215.png (26KB, 1037x350px) Image search: [Google] [Yandex] [Bing]
SS2215.png
26KB, 1037x350px
need a lil help (not a pro programmer, bear with me)
been asked to write a simple program in C which will check if the number for a mandelbrot set will explode or not. as you see at iteration 38, it goes beyond what double can store. i'd like it to print a single 1.#inf00 and then stop without adding any extra functions & shit. is there some neat trick to do it?
>>
>>53890340

Well, if you can't into basic math, you shouldn't get the job.
>>
>>53890400
define 'basic math'
>>
>>53890316
Wow that site runs like doghsit.
>>
>>53890168
For me it comes from "one (point of) data, two (points of) data, ..."
>>
>>53890358
You can probably see if it's exploding without overflowing your double...
>>
>>53885491
Does anyone know any apps useful to write and run java on android?
>>
>>53890458
you're going to write java programs on a smartphone? with the touchscreen/minuscule keypad?
>>
>>53890432

Division with remainders. You know, the thing that gets taught at most elementary schools in the third grade.

Alternatively, FizzBuzz can be solved with just addition, as long as you reset each of two counters whenever they are equal to 3 or 5.
>>
>>53890316
oh, well, that makes sense. she's not really a "programmer-" her job involves some domain-specific programming, but is largely communicative/facilitative. can't even really fault her for being thrown by unexpected interview questions- it's happened to my dumb ass, although not in programming, and she makes a living with her skillset (unlike me). still, she doesn't seem like she'd post in /dpt/ or be interested in doing so.
>>
>>53890457
well, i can simply check if it's bigger than 2 because by definition it'll explode but that ain't challenging
there's a fun trick with NaN so maybe there's one with infinite number as well, i could learn about
>>
>>53890358
break;
>>
>>53890495
Smaller codes nothing really big.
>>
>>53890358
if its equal to positive infinity, just do a break after the print?
>>
>>53890432
You just need a basic understanding of variables and loops.
>>
http://money.cnn.com/2016/04/04/technology/george-hotz-comma-ai-andreessen-horowitz/index.html?iid=ob_homepage_money_pool&iid=obnetwork

>programming is so easy
>writing algorithms and having your own self driving car start up is just so easy
>lol at the noobs

so why do i suck at programming then?
>>
>>53890565
practice
>>
>>53890543
how do i check that in one "if" without math.h?
>>
>>53890506

She was applying for a JavaScript position, and expecting to get away with not being able to solve a program that anyone who has been introduced to just for loops, if statements, and variable assignment can do. The fact that she can't do it means she either doesn't understand JavaScript -- which was clearly stated in the job requirements -- or is dumb as a post with regards to problem solving.
>>
>>53890592
give us a question that any programmer should be able to solve with just loops if statements and variable assignments that isn't fizzbuzz
>>
>>53890509
Doesn't seem very challenging to just let it loop until the double breaks, but that's just me I guess. You can probably compare it to infinity or something like that.
>>
>>53890598

Fibonacci of a given n.
>>
>>53890249
feature support? verbosity is far too trivial a downside to discount an entire language. verbose languages like c# and java go hand-in-hand with editors that support effective code completion anyway
>>
>>53890506
>>53890316
>>53890592
I'm really not
sure this article proves the point you want it to. I mean, she fucking says:
>I am fully aware that I am not a programmer, at least "programmer" in the sense of algorithms, data modeling, etc.
am I supposed to be embarrassed on her behalf that her programming/problem-solving skills extend not much farther than they need to for the job she does? the biggest mistake she made was "apply to a job whose qualifications she didn't perfectly match." job descriptions are written to filter out people not confident in their skills, you have to go into most job interviews with the attitude that anything you don't know you can figure out on the job. "can't on-the-spot solve a problem that has nothing to do with her job" is not actually all that great an indicator for "can't solve problems that would come up if she had the job."
>>
NEW THREAD!!

>>53890674
>>
>>53890678
dumbass
>>
>>53890668
even if general-purpose programmatic thinking is super relevant to that particular job, her literal point is "how am I supposed to tell what skills are actually important to the job if we can't agree how to describe the job requirements"
>>
>>53890678
>Making thread when it hasn't reached bump limit
fucking cuck. No one join this bitch ass thread
>>
>>53890619
i googled out that i can do as follows:
POSINF (1.0 / 0.0)
NEGINF ((-1.0) / 0.0)
NAN (0.0 / 0.0)
but damn, this looks terrible
>>
>>53890739
are you suppressing exceptions or something?
if so, don't, and then you could catch the exception to handle this:
http://www.gnu.org/software/libc/manual/html_node/FP-Exceptions.html#FP-Exceptions
>>
>>53890668
I think them asking the question shows that they expect an all-around programer. She'd probably find herself needing to do more than angular front end javascript daily if she joined. If there was a failure, it was a failure of the company to communicate their expectations. That would at least have given her time to prepare.
>>
>>53890739
Maybe take a look at HUGE_VAL?

http://www.cplusplus.com/reference/cmath/
>>
>>53890786
"1/0 = &infin;" it says there
well, if that's the only simple way...
>>53890839
the thing is i'd like to avoid any #include
>>
>>53886498
is the original library mutated or does it return a new library?
>>
Why do both of these visualisers handle AVL Tree deletions differently?

http://visualgo.net/bst.html
https://www.cs.usfca.edu/~galles/visualization/AVLtree.html
>>
>>53890919
i can send u a pic of my dick and u can use that as a reference
>>
Does anyone know where I can find a windows php release with composer and all extensions enabled for development?
I only need php and not mysql, apache and all bloated thing links in xampp or wamp.
Thanks in advance.
Thread replies: 322
Thread images: 25
[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.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK