[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: 332
Thread images: 34

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>58955696

What are you working on /g/?
>>
>>58962817
First for D
>>
File: 1468882928057.png (199KB, 439x392px) Image search: [Google]
1468882928057.png
199KB, 439x392px
Employed Haskell programmer reporting in
>>
>>58962849
how _is_ D? i've heard some good things but also very little.
>>
>>58962879
D is dead. Nobody uses it.
>>
How many hours should I realistically be putting into learning an OOP language to be successful in a CS degree
>>
>>58962907
POO has nothing to do with computer science.
>>
>>58962879
Pretty good if you don't mind it being completely GC free (yet). I find it much better to use over Java or C++
>>
>>58962833
it's done but i'll publish it only when my dumb website is up.
which may take from half a year to never.
>>
So guys I want to program a little bot to make alts for some japanese autism game. First thought would be that I have to sniff the packets sent and received by the actual game and then analyse what's in there so that I can make my bot send the correct commands and interpret the information the server sends. Thing is: I have no idea how I would go about doing the packet sniffing. Would wireshark or some other comparable tool work just fine? And if yes, anyone have some good site to read up on that stuff?

Of course if my thoughts are stupid I am open to a proper way to get the results I want.
>>
>>58962817
Still working on WPF. It's a nice framework but I think I'll leave the project without much more technology features anymore, just content, it starts doing most of what need, barring some file saving I/O features that are basic technology.
Thinking of doing something multiplatform, for a family business site, it has to do basic things like promotion and booking of services.
I thought of going mobile platforms, but sad thing is the cesspit of the web is probably more optimal for that kind of thing.
>>
Making an algorithm which calculates the root of a number using the babilonian method in python 3.
def babilonian(n):
guess = (n-0.5)/2
def method1(k,u):
h = k/u
u = (u+h)/2
print(u)
while guess**2 != n:
method1(n,guess)
return guess

print(babilonian(5))

The problem is after the first attempt of method1, it keeps returning the same number in a infinite loop.
What the fuck am i doing wrong?
>>
>>58962913
I thought Pajeet was an authority on programming.
>>
>>58962879
Seems really divided and lost on if it wants gc or no.
Chapels seems way better option.
>>
>>58962875
So what you mean to say is that you work at a Wendy's, and program Haskell on the side?
>>
>>58962905
Why go on the Internet and make things up?
>>
>>58962631
Here's a good reference: http://youmightnotneedjquery.com/
>>
>>58962952
while guess**2 != n <---- this is always true
method1(n,guess) <--- thus, this is will run forever
>>
>>58962943
it's just a pattern matching problem if you have a wireshark equivalent api, read up on that business (finite automata)
>>
>>58962952
(defun s(A)
(do((x 1(*(+ x(/ A x)).5))(n 100(1- n)))((zerop n)x)))
>>
>>58962985
/*
* Some simple finite state machine implementations.
*/

/*
* Theoretically you could use the address of a state handler as its identity,
* however this is extremely cumbersome in C, as while you may compare function
* pointers for equality, you may not use them as switch expressions.
*/

enum state {
EVEN,
ODD
} fsm_a(enum state, int), fsm_b(enum state, int);

// Type A

enum state fsm_a(enum state st, int in)
{
switch (st) {
case EVEN:
return in ? ODD : EVEN;
case ODD:
return in ? EVEN : ODD;
}
}

// Type B

static enum state even(int in)
{
return in ? ODD : EVEN;
}

static enum state odd(int in)
{
return in ? EVEN : ODD;
}

enum state fsm_b(enum state st, int in)
{
#ifndef __GNUC__
static enum state (* const tbl[])(int) = {
#else
/*
* This ones for free :-) The GNU typeof extension can simplify
* unintuitive type declarations significantly.
*/
static const typeof(enum state (*)(int)) tbl[] = {
#endif
[EVEN] = even,
[ODD] = odd
};

return tbl[st](in);
}/code]
something i just whipped out earlier today re: implementation.
>>
As a straight white male am I pretty much SOL for getting hired in tech now? Everywhere I look people are saying that H1Bs are taking over everything, and if it's not H1Bs, its diversity and gender quotas.
Are these just memes perpetuated by incompetence?
>>
>>58963034
my heart sank when i saw the missing bracket as i had just pressed post
>>
>>58962985
Pattern matching is not a problem.

My problem is that I have never done anything like packet sniffing. Or infact anything related to doing stuff to a running program to the outside (like trying to read the memory allocated by the program and just trying to make sense of the shit in there).

But I take that as "Yeah, wireshark works just fine"
>>
>>58962983
Right, I know it's always true but it shouldn't be, method1 process the number once and returns the same number everytime
>>
>>58962985
>>58963034
>>58963046
Also thanks for the trouble to give such an elaborate answer
>>
>>58963067
well i'm drunk and extremely nice
>>
>>58962985
>finite automata
what about infinite state automata?
>>
>>58962952
Integers are immutable in python, when you do `u = (u + h)/2`, `u` now references a new object, while guess remains how it was. to get around this return u from the internal function and set guess to that.

def method1(k,u):
h = k/u
u = (u+h)/2
print(u)
return u
while guess**2 != n:
guess = method1(n,guess)
>>
>>58963065
You know method1 doesn't modify it's parameters? Python is call-by-value
>>
>>58963065
def Babylonian(number):
if(number == 0):
return 0

g = number/2.0;
g2 = g + 1
while(g != g2):
n = number/ g;
g2 = g
g = (g + n)/2

return g
>>
>>58963088
Python is pass by referene however the assignment operator always reassigns the label not the value.
>>
>>58963075
you're joking but i was just today thinking what separates a "trivially looping" computation, i.e. detectable, such as for (;;) ;, from an undecidable one (susceptible to the halting problem)
is it just class in the chomsky hierarchy?
>>
does anyone actually use anonymous classes in java?

inb4 >java
>>
>>58963138
>that posting style
fuck off, plebbitor.
>>
>>58963159
answer my question faggot
>>
>>58963168
i don't talk to plebbitors, sorry.
>>
>>58963138
I use them all the time, just because i'm associated with the Anonymous organization (4chan hackers).

i do not forgive a class and i rarely forget one.
>>
>>58963159
>>58963181
i didn't know you could be elitist about being the second worst
>>
>>58963181
ur hardcore lol
I am the hacker who started the whole Anonymous thing
>>
>>58963207
well, i was Heaven a couple years ago on /b/

top that
>>
Writing some gerneric json serializer in c++ - for this freaking old borland (embarcadero nowadays) compiler...
>>
>>58962952
What are you doing? The algo is simpler than that.
def bab(n, v):
x = v
for i in range(0, n):
x = 0.5*(x + v/x)
return x

print(bab(10, 2))
>>
>>58963138
I try to avoid them but there's a time and a place for everything.
>>
>>58963327
Or with a convergence test:
def bab(v, e=0.001):
x = v
old_x = v + 2*e
while abs(old_x - x) > e:
old_x = x
x = 0.5*(x + v/x)
return x

print(bab(2))
>>
>>58963265
Why?
>>
Is there basic programming work available online somewhere? I'm willing to work for less than min wage--I just want to do some light development for a bit of pocket money. So far all I can find is Pajeets doing bad work for a dollar an hour, and if that's all that there is, I'm not interested. I'd appreciate any recommendations or advice.

.
>>
>>58963383
Fiverr
>>
c vector storing void pointers or storing items of block size?
typedef struct {
uint count;
uint size_reserved;
uint block_size;
char *data;
} vec;




typedef struct {
uint count;
uint size_reserved;
void **data;
} vec;
>>
>>58963404
lol
>>
>>58963419
>typedef
>>
>>58963419
eh, leave the block delimiting to the memory allocator i.e. malloc of your choice
>>
>>58963442
settle down linus
>>
>>58963461
hehe

>Please don't introduce more typedefs. They only hide what the hell the thing is, which is actively _bad_ for structures, since passing a
structure by value etc is something that should never be done, for example.

http://yarchive.net/comp/linux/typedefs.html
>>
File: LIST.png (955KB, 1048x646px) Image search: [Google]
LIST.png
955KB, 1048x646px
just waiting for LIST to complete.
>>
>>58963445
say I would add 1000 ints to vector.
I would have to call 1000 mallocs and store the pointers to vector.
Or I could have this one malloc for the vector memory and store the 1000 ints there.
>>
File: hah no.png (27KB, 480x30px) Image search: [Google]
hah no.png
27KB, 480x30px
>>58963488
freenode ended my suffering
>>
>>58963419
Fat pointers.

http://libcello.org/learn/a-fat-pointer-library
>>
>>58963495
sz = sz * growth_factor + 1
where growth_factor is either PHI or 2
>>
>>58963374
Because legacy application and everything else is not enough
>>
>>58963559
hell is real but at least you get paid
>>
>>58963559
You may want to try json.hpp. https://github.com/nlohmann/json
>>
>>58963605
>https://github.com/nlohmann/json
Thanks! very kind... but yeah, I don't even have C++11!!!
>>
>>58963605
bitch, i'm the core contributor lmao
>>
>>58963632
Then maybe wrap https://github.com/kgabis/parson in C++.
>>
>>58963644
Hi, Theo.
>>
>>58963081
thanks anon
at last i truly see
>>
>>58962952
What ur doing wrong is implementing babylonian method for square roots instead of the more general newtons method, faggot.
>>
>>58963673
>https://github.com/kgabis/parson
Thanks, but in general the problem isn't the json handling - it's the nightmare of the runtime informations (RTTI) of the embarcadero rtl
>>
>>58963488
Nice operating system
>>
Is Lisp safe to use in medical equipment controllers?
>>
>>58962817

What is a zeta swap?
>>
i ama wb deve pls no bully :3
>>
>>58963039
H1B is being killed by Trump
>>
>>58963747
>Today on "question you don't want your medical equipment manufacturer asking on 4chan"
>>
>>58963747
>medical equipment controllers
>critical systems?

basically, you have use a language that you can formally prove that its programs are correct.
>>
>>58963725
sometimes you can't go without the latest and greatest
>>
>>58963747
Would you write your own pacemaker in lisp?
>>
>>58963039
>As a straight white male am I pretty much SOL for getting hired in tech now?
If you're not willing to make a sacrifice, yes. Comfy days of easy jobs are over. Now you need "people skills"

>Everywhere I look people are saying that H1Bs are taking over everything
Shit shops like Oracle, yes.

>and if it's not H1Bs, its diversity and gender quotas.
Given the same skillset etc, a recruiter will forward female CVs/resumes ahead of yours, and the company reviewing will generally prefer those over you as well. If you know what you're talking about you're already going to sound better than 90% of applicants.

>Are these just memes perpetuated by incompetence?
Yes.
>>
>>58963747
>dynamically typed
sure. just don't use it on anyone but yourself.
>>
File: jeet in steet.png (1001KB, 1200x1198px) Image search: [Google]
jeet in steet.png
1001KB, 1200x1198px
> EXAM REQUIRES PROGRAMMING ON PAPER

CUT MY LIFE IN TO PIECES
>>
>>58963815
i'm not a fucking cripple so no. but I would write in Haskell
>>
>>58963762
yeah no, it's far too lucrative for us economy even for a populist protectionist to kill
you _want_ the smart, educated foreigners to jump ship as the years 0 to college graduation are sunk cost
>>
>>58963854
>that formatting
Stupid redditor. Return to your website.
>>
>>58963854
if you can't write simple programs even on toilet paper, you aren't worth shit
>>
>>58963878

Stupid monkey, return to your mudhut
>>
>>58963902
yup, redditor confirmed. deport yourself back to your shithole
>>
>>58963884
index cards and a ballpoint pen fo' life
>>
>>58963884
>you aren't worth shit
Was that not clear by his blatant redditry?
>>
>>58963902
why do you support hirojewki
>>
>>58963995
because it's a plebbitor.
>>
rate
typedef struct {
uint count;
uint size;
uint block;
char *data;
} vec;


static inline void vec_new(vec *v, uint s)
{
v->count = 0;
v->size = 16;
v->block = s;
v->data = malloc(s * 16);
}


static inline void *vec_get(vec *v, uint n)
{
return (void*)(v->data + (n * v->block));
}

static inline void *vec_add_one(vec *v)
{
if(v->count == v->size) {
size_t tmp = v->size < 1024 ? v->size * v->size : v->size * 2;
char *d = malloc(tmp * v->block);
memcpy(d, v->data, v->size * v->block);
v->size = tmp;
free(v->data);
v->data = d;
}
void *p = v->data + (v->count * v->block);
v->count++;
return p;
}


#define vec_add(v, val) ({ typeof(val) *p = vec_add_one((v)); *p = (val); p; })


int main()
{
vec v;
vec_new(&v, sizeof(int));
for(int n = 0; n < 100; n++)
vec_add_one(&v, n);

int sum = 0;
for(int n = 0; n < v.count; n++)
sum += *(int*)(vec_get(&v, n));

free(v.data);
return 0;
}

>>
>>58963995

I was filling out enough captchas for it to be worth it
>>
>write a generic function that draws any star polygon
I managed to do this

from turtle import *

def star(aretes, couleur) :
color(couleur)
if aretes % 2 : x = 180
else : x = 360
for i in range(aretes) :
forward(200)
left(180-(x/aretes))

# ex : star(8, "red")

exitonclick()


But I feel it's not elegant at all somehow

disregard the float precision
>>
File: maxresdefault.jpg (127KB, 1920x1080px) Image search: [Google]
maxresdefault.jpg
127KB, 1920x1080px
Mostly learning scala on Coursera if that counts, the Martin Odersky's course. Not bad.
>>
>>58964049
One issue is that it really assumes you're using some kind of IDE. Thankfully intellij seems a bit less of abomination than eclipse and even comes with vim mode.
>>
>>58963747

Use Ada.
>>
>>58964009
fixed
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef unsigned int uint;

struct vec {
uint count;
uint size;
uint block;
char *data;
} ;


void vec_new(struct vec *v, uint s)
{
v->count = 0;
v->size = 16;
v->block = s;
v->data = malloc(s * 16);
}


void *vec_get(struct vec *v, uint n)
{
return (void*)(v->data + (n * v->block));
}

void *vec_add_one(struct vec *v)
{
if (v->count == v->size) {
size_t tmp = v->size < 1024 ? v->size * v->size : v->size * 2;
char *d = malloc(tmp * v->block);
memcpy(d, v->data, v->size * v->block);
v->size = tmp;
free(v->data);
v->data = d;
}
void *p = v->data + (v->count * v->block);
v->count++;
return p;
}


#define vec_add(v, val) ({ typeof(val) *p = vec_add_one((v)); *p = (val); p; })


int main()
{
int n;
struct vec v;
vec_new(&v, sizeof(int));
for (n = 0; n < 100; n++) {
vec_add(&v, n);
}

int sum = 0;
for (n = 0; n < v.count; n++) {
sum += *(int*)(vec_get(&v, n));
}

free(v.data);
return 0;
}
>>
>>58964094
>typedef unsigned int uint;
I hate fags who do shit like this.
You don't need your own special snowflake integer types.
>>
File: technology cirno.jpg (85KB, 404x500px) Image search: [Google]
technology cirno.jpg
85KB, 404x500px
has anyone here actually fucking read norvig cover to cover?

its 1000 fucking pages aiming to serve as a complete introduction to AI, but when i told my prof i hadnt read it, i only attended lectures and skimmed relevant chapters for revision he looked at me like i was taking the piss.
>>
>>58964139
how would you do it?
>>
>>58964139
it's not my own special snowflake integer type it's short hand for standard type.
>>
>>58964156
By just typing unsigned instead.

>>58964159
It's still special snowflake shit. All you're doing is adding extra cognitive load and possibly confusion for other programmers, just to save a few characters.
Everyone knows what the standard integer types are. Now they have to remember your dumb shit too.
>>
>>58964139
>>58964159
Special snowflake type would something like SDL_int
>>
>>58964139
I don't see the point of it in C, since it's just a rename but in languages with real types it's good.
>>
>>58964190
>All you're doing is adding extra cognitive load
what are you, an Agile Code Artisan ?
>>
>>58964190
#include <stdint.h>
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;
typedef unsigned int uint;
typedef uintptr_t uptr;

>>
>>58964195
>what are you, an Agile Code Artisan ?
I'm actually a scrum master powered by waterfall vibes
>>
File: 500x500.jpg (35KB, 500x500px) Image search: [Google]
500x500.jpg
35KB, 500x500px
>>58963908
>>58963884
>>58963924
>>58964004
>>
>>58964261
>I'm actually a scrum master
you could have just answered yes
>>
>>58964139
>>58964190
who gives a shit though. i just use them and defer any bugs caused to the sorry cunt who wrote the header file.
if you define them in the source file as by
>>58964241
its all quite simple, unless your too dumb to "get it" so to say
>>
>>58963854
>Touching a computer ever
>Not writing all your programs in pseudocode with a quill and have your assistants implement it, print out and bring you the results.
Goddamn plebs.
>>
>>58964294
Really, I'm just against overuse of typedefs in general.
typedefs should be used to simplify types, not just hide them behind an extra layer of shit, so you don't have to type as much.
>>
>>58964261
lmao i just remembered a time couple summers ago
it was a beautiful finnish summer day when i got a beer and decided to drink it on the bar terrace
i seated next to these 2 slightly overweight nerds who no shit had a good 30 minute conversation about scrum mumbo jumbo bullshit
no shit these guys go to conferences and care about "the enterprise", probably because they know they're shit developers so they co-opted bikeshedding as a career
>>
Is there any way to return a variable value back to another function without adding it in the parameters. Basically, I'm asking how does return work.
>>
>>58964335
>lmao
>No capitalisation and almost no punctuation
Are you 12 years old?
>>
>>58964345
yeah you pass it in %rax, or %eax on 32 bit, if it's an integer
hope this help
>>
>>58964352
i found the scrum master
>>
hi guys. i have a program that produces and processes dumps with approx. 100-200 thousand entries.
Should I make use of sqlite or it is okay to store it in json-like format?
>>
File: 123wedfv.jpg (51KB, 1280x720px) Image search: [Google]
123wedfv.jpg
51KB, 1280x720px
>>58964352
>>
>>58964387
XML
>>
>>58964345
well you just return it, that's how return works
int returnsSeven() {
return 7;
}

int seven = returnsSeven();

>>58964371
lol
>>
>>58964371
>%eax

what is this? I'm using c++
>>
>>58964403
Why?
>>
>>58964435
fuck if i know

just popped in my head
>>
>>58964409
>I'm using c++
You're beyond salvation.
>>
>>58964409

It's the name of the general purpose register in x86 used for storing return values when they are integers or pointers. It also functions as an accumulator register for certain instructions.
>>
int main () {
if (condition) {
task
}
}


int main () 
{
if (condition) {
task
}
}


int main ()
{
if (condition)
{
task
}
}


Which one, /g/?
>>
>>58964456
int main
(
){
if (
condition
)
{
task
}
}
>>
So I get what they're trying to say but on an actual implementation level this is bullshit right? I mean there's no way a computer can know what type this is gonna return without actually running it right?
>>
>>58964407
int findMaximum(int grade[])
{
unsigned int current_maxGrade = 0;
unsigned int compare_maxGrade = 0;

for (int x = 0; x < 6; x++)
{
compare_maxGrade = grade[x];

if (compare_maxGrade > current_maxGrade)
{
current_maxGrade = compare_maxGrade;
}
}
return current_maxGrade;
}


I wanna send current_maxGrade back to the main function without having to change the parameters of findMaximum
>>
>>58964345
what?
if I understand you correctly do
int a = method();
instead of
int a; method(&a);
>>
>>58964456
The middle one.
>>
>>58964453
##Abr.##Nm.##########################Clr.Sv.##
#_EAX_|_Accumulator_register_______|_Yes_____#
#_EBX_|_Base_register______________|_No______#
#_ECX_|_Counter_register___________|_Yes_____#
#_EDX_|_Data_register______________|_Yes_____#
#_ESI_|_Source_index_register______|_No______#
#_EDI_|_Destination_index_register_|_No______#
#_ESP_|_Stack_pointer______________|_No______#
#_EBP_|_Base_pointer_______________|_No______#
##############################################


i made this :-)
>>
>>58964467
int fn() { }
I vonder...
>>
File: 1481759136145.png (149KB, 460x420px) Image search: [Google]
1481759136145.png
149KB, 460x420px
>>58964465
>>
>>58964492
rly maeks u thnk
>>
>>58964470
Seems to me like that's what you're doing, you just have to make sure to call this function in main and do something with the returned value.
>>
>>58964456
2nd
>>
>>58964470
int maxGrade = findMaximum(grades);

This takes the variable grades, calls findMaximum and passes it in as an argument.
Then it takes whatever value is RETURNED from findMaximum and stores it into maxGrade.

I don't really understand where your confusion or problem is.
>>
File: 11.png (74KB, 460x420px) Image search: [Google]
11.png
74KB, 460x420px
>>58964493
your png is now optimized
>>
>>58964094
Just use size_t you pleb, that's what it's there for.
>>
File: 1487205919692.png (68KB, 460x420px) Image search: [Google]
1487205919692.png
68KB, 460x420px
>>58964528
your png is now optimized
>>
>>58964487
>Clr.Sv.
What's this mean?
>>
>>58964537
what if i want less that 16 bits?
BTFO
>>
>>58964537
nah fuck size_t
>>
>>58964543
caller saved, as opposed to callee saved
i love my dumb retarded abbreviations like i was on a PDP-11
>>
>>58964492
Okay so I'm retarded, but what even is the point of it then.
>>
>>58964537
echo | gcc -E -xc -include 'stddef.h' - | grep size_t

output
typedef long unsigned int size_t;
>>
>>58964556
As I was saying before: special snowflake.
>>
>>58964094
>>58964537
Also basically everything inside the if in vec_add_one can be replaced with a call to realloc
>>
>>58964564
just use a short, why waste space unless you're using mmap with HUGE

(please use size_t, it's good)
>>
>>58964387
bump, I need advice
>>
>>58964564
exactly so why make your own typedef when size_t does the job (and does it correctly across multiple platforms due to the nature of size_t corresponding with sizeof)
>>
>>58964522
When i do this I get an error.
>>
>>58964600
because size_t is offensive and coders should not use it.

us girls want to be part of this world too.
>>
>>58964610
Error tells you exactly what's wrong - you're trying to pass an int argument to a function which accepts a pointer-to-int
>>
>>58964592
use google protocol buffers or cap'n proto

or just dump to a file with in a simple binary format
>>
>>58964610
int findMaximum(int grade[])


You're trying to pass in an int. not int[]
>>
>>58964610
The problem is not what you thought it was though, you're passing an integer to your findMaximum function when it expects an array of integers.
>>
>>58964487
If we're using legacy 32-bit x86...
>>
>>58964614
ugh go jerk off to an anime about it
>>
>>58963747
If Lisp is good enough for NASA, then it's good enough for me!
>>
>>58964610
This is c++ btw, so just use std::max_element and std::vector (although std::max_element will work with C-style arrays, it's better to just use std::vector in c++)
>>
>>58964649
>!
>>
>>58964624
thanks. why do so many projects use sqlite for similar tasks, though? e.g. Skype, Firefox, Telegram, Conversations...
>>
File: bitch_rides_huge_cock.png (122KB, 1355x615px) Image search: [Google]
bitch_rides_huge_cock.png
122KB, 1355x615px
>>58964667
>>
>>58964667
Not him, but it's because SQlite just werks.
>>
>>58964667
i mean you can use sqlite, and probably should.
it depends on your performance requirements.
if you doing it once a minute or so you're ok with sqlite, but if it's a constant hot loop better use a non-textual, binary format.
>>
>>58964614

If size_t is so offensive to you, use it's signed counterpart, ptrdiff_t.
>>
>>58963845
Note: SBCL can detect type errors at compile time. It can also treat macroexpansion errors at compile time. I can't speak for other compilers though.
>>
>>58964693
the c11 rsize_t is the most kosher of all typedefs
>>
>>58964637
the x86-64 semantics are far easier so i didn't feel the need to focus on those
>>
>>58964403

Please do not recommend XML over JSON. XML is bloated and obsolete.
>>
>>58964786
got to agree
the xml spec has weird ideas about whitespace and such and other arcane semi-ambiguities
json is nice and simple
>>
>>58964741
Why rsize_t over size_t?
>>
>>58964786
>XML is bloated and obsolete.
for you
>>
>>58964808
mostly semantics, it's supposed to be a strongly typed alternative of size_t for object size (scale) in opposed to an index or offset.
>>
https://www.youtube.com/watch?v=ySN5Wnu88nE
Look closely at his bookshelf
>>
>use these different types for your programs
>sure there is no real difference since they're typedefs and c is weakly typed
>you might as well just use the standard types and have good variable names
What did c mean by this?
>>
>>58964872
whom are you quoting??
>>
>>58964887
you
>>
>>58964741
>>58964840
Nobody supports Annex K.
>>
>>58964890
but I didn't say anything like that.
>>
>>58964887
Everyone above me
>>
>>58964898
What? Where are these posts? If you search for the quotes the only result is your post.
>>
>>58964872
it's the same shit as whit getters and setters for object fields.
Like someday you might want your int to be actually string, so you would use typedef int Abstact_int; and later change it to typedef char * Abstact_int and not break your code.
>>
>>58964912
>it's the same shit as whit getters and setters for object fields.
Why do you think I get this analogy? I'm not an animal like yourself.
>>
rate
{-# LANGUAGE ViewPatterns #-}

import System.Random
import Control.Monad
import System.Directory
import System.Environment
import System.IO.Error


randumb :: IO String
randumb = do gen <- newStdGen
return $ take (fst $ randomR (12,24) gen)
(randomRs ('a','z') gen)

main :: IO ()
main = do dir:files <- getArgs
flip catchIOError (handler dir)
$ forever (mapM (\f -> do name <- randumb
copyFile f $ dir ++ name)
files)

where handler dir (isFullError -> True)
= do removeDirectoryRecursive dir
createDirectory dir
main
>>
File: the game.jpg (48KB, 460x420px) Image search: [Google]
the game.jpg
48KB, 460x420px
>>58964909
filename
>>
>>58964894
i mean i don't disagree
>>
>>58964909
I'm sorry you don't know what a paraphrase is, aspie.
>>
>>58964924
wow
scary anime
what happened to it?
>>
>>58962817
converting an asp.net webforms application over to vaadin
>>
>>58964935
What do you mean? How can a quote be a paraphrase? A quote is the literal quotation of some words. Which your post (>>58964872
) is not.
>>
>>58964786
what would ypu say about xmpp?
yes, theres that xml bloat to it, but it is compressed anyway, right?
>>
@58964865(You)
>>
File: 1456252005610.jpg (62KB, 690x460px) Image search: [Google]
1456252005610.jpg
62KB, 690x460px
>he unironically uses case switch instead of if-else
>>
File: 1486915126825.jpg (100KB, 392x409px) Image search: [Google]
1486915126825.jpg
100KB, 392x409px
>>58965055
>not wanting better readability for a lot of cases
>enjoying worst performance
>>
>>58965055
minimal perfect hash functions are pretty cool
>>
>>58965055
Who are you quoting though? And why did you post this stupid person as your "reaction image"?
>>
>>58964872

Portability. A long on 64 bit Windows is not a long on 64 bit Linux. An "integer big enough to store the size of an object" is also going to be different on different platforms. The base types in C are wholly inadequate for anything specific. You can't even make the assumption that int is 32 bits.
>>
>>58965158
Why the hell do you format your posts in this way, redditor?
>>
>>58964951
Old protocols using XML get a pass. New protocols should use something else.
>>
>>58965193

I do not use Reddit, fag.
>>
>>58965158
also the uintN_t types are guaranteed by the standard to comply by two's complement representation, which is a necessity for any sort of portable bit twiddling
>>
@58965169
Can the mods please ban this guy?
>>
>>58965169
>>58965201
stop spamming idiots
>>
>>58965201
Yes, I can see that by your inability to use this site.
>>58965214
Sorry, this isn't plebbit. Do they do this kind of stuff often over there?
>>
>>58965201
Meant for
>>58965169
>>
>>58965205
http://www.viva64.com/en/a/0010/
ya'll should read viva64 if you you think of yourself of a big shot C dev
>>
@58965214
how do i make @mentions work?

he

lp

plz
>>
sup, Python scrub here trying to write a program that calculates simple and compound interest, displaying each one in a column. It's a 1000 initial investment and an interest rate of 5%. Can someone point me in the right direction?
>>
>>58965403
>Python
stopped reading right there, "breh"
>>
>>58964922
file bomb?
>>
@58965386
https://greasyfork.org/scripts/11961-posting/code/@-posting.user.js :â–³)
>>
@58965432
Oh wait, that crap is an old version.

https://greasyfork.org/scripts/11960-posting/code/@-posting.user.js
>>
>>58965406
wow thanks a lot!
>>
File: file.png (26KB, 1230x694px) Image search: [Google]
file.png
26KB, 1230x694px
I'm a real programmer now
>>
>>58965466
it's no QBASIC but you're all right
>>
File: 2017-02-15-212106_639x285_scrot.png (29KB, 639x285px) Image search: [Google]
2017-02-15-212106_639x285_scrot.png
29KB, 639x285px
Which of these is the "proper" way to implement fizzbuzz?
>>
File: iiterates into thread.png (24KB, 789x228px) Image search: [Google]
iiterates into thread.png
24KB, 789x228px
Iron oxide
>>
>>58965480
2nd one imo
>>
>>58965480
for(int i = 1; i <= 100; i++) {
printf("%d\r", i);
if (i % 3 == 0) { printf("Fizz"); }
if (i % 5 == 0) { printf("Buzz"); }
printf("\n");
}
>>
>>58965506
but why?
>>
@58965446
It's beautiful
>>
>>58965524
That's pretty smart
>>
>>58965526
if someone ctrl-c's the program at the right time just as 15 is happening they might see a "Fizz" instead of "Fizzbuzz"
>>
>>58965466
https://www.b4x.com/
>>
>>58964387
json is fine. you may have to encode the data, but it should be fine
>>
>>58965480
fizzp = (n) -> !(n % 3)
buzzp = (n) -> !(n % 5)
fizzbuzzp = (n) -> fizzp n and buzzp n
range = [1 to 100]
[both, mixed] = partition fizzbuzzp, range
[fizzed, mixed2] = partition fizzp, mixed
[buzzed, neither] = partition buzzp, mixed2
both-m = map (x) -> [x, \FizzBuzz], both
fizzed-m = map (x) -> [x, \Fizz], fizzed
buzzed-m = map (x) -> [x, \Buzz], buzzed
neither-m = map (x) -> [x, x], neither
all = concat [both-m, fizzed-m, buzzed-m, neither-m]
|> sort-by (.0)
|> map (.1)
|> join "\n"
>>
>>58962952
use a fucking loop
>>
Updating my t-test calculator to be able to read arrays off of an input file.
>>
>>58964528
>>58964542
What are you using for this? Optipng only gets me down to 111kb.
>>
>>58965852
Gentoo
>>
>>58965414
yeah I needed to remove cp from the browser cache
fuck those /b/tards, why do they post cp so much
>>
>>58965772
can you plaese write proper f# so that I can decide if I'll learn it or not?
>>
File: 106127.jpg (390KB, 620x930px) Image search: [Google]
106127.jpg
390KB, 620x930px
Hey guys, I made a reverse shell that can dump chrome passwords and use text-to-speech. What other features should it have?
>>
>>58965900
is that a downie?
>>
>>58965920
Don't focus on the black man and answer my question
>>
>>58965897
don't, it's garbage.
>>
>>58965926
he looks like a nigger though
>>
How do I make a monoidal fizzbuzz?
>>
>>58965930
Maybe he is, maybe he isn't, do you have anything to add to my reverse shell or not?
>>
>>58965947
who the fuck tells chrome to save passwords
>>
>>58965947
>>58965900

I can tell by your language "my reverse shell" that this is your first one and you're super proud of it. Don't be a skid.
>>
>>58965946
Fizzbuzz isn't a binary operation you shit
>>
File: haskell.png (1MB, 868x1229px) Image search: [Google]
haskell.png
1MB, 868x1229px
I consider myself pretty good with imperative programming, how do I learn more functional programming techniques?
>>
>>58965897
That's LiveScript, not F#. Proper:
for i from 1 to 100
if i % 15 == 0
\FizzBuzz
else if i % 3 == 0
\Fizz
else if i % 5 == 0
\Buzz
else
i
|> join "\n"
>>
>>58965965
Im not a skid or proud, I don't have enough features, thats why I am asking you guys what I should add to it.
>>58965957
lots of people
>>
>>58965988
Learn map/apply/reduce/filter
Understand lambda
Functions as first class citizens
Avoid state where possible
That's just off the top of my head.
>>
File: mpv-shot0002.jpg (59KB, 1280x720px) Image search: [Google]
mpv-shot0002.jpg
59KB, 1280x720px
>>58965988
read master thesis and papers from prominent academics
primarly, your end goal is to understand monads and lens
the more abstractions you learn, the better
do haskell obvs
you might wanna try lisp because of its metaprogramming capabbilities
>>
>>58965988
>>58966029
Yes, your education is incomplete until you get a taste of both untyped and typed lambda calculi.
>>
real men who make money program in Java
>>
>>58966453
anyone who """"programs"""" in Java is by definition not a man.
>>
>>58963747
Use Javascript
>>
>>58966463
found the guy programming in a meme language not making any money!

>LaughingGirls.exe
>>
>>58966453
real men who make money develop on nodejs
>>
>>58966506
at least I am a real man. and I'm glad you agree.
>>
>>58965480
says"Fizz"x!($_%3)."Buzz"x!($_%5)||$_ for 1..100
>>
>>58966453
Real men don't program
>>
>>58966607
this
we are all girls here
>>
>>58966617
I wear high thighs when I program and slippers
>>
>>58966633
I program in my panties and with a collar on
>>
>>58963875
That presumes the people in charge are rational human beings. Current legislation winding through will raise the minimum wage for an h1b visa applicant to 130k per annum.
>>
            Console.Write("Write a string");
string text = Console.ReadLine();
Console.Write("Write a regex to that matches the previous string");
string pattern = Console.ReadLine();

Regex rx = new Regex(pattern);

bool state = rx.IsMatch(text);

if (state)
Console.WriteLine("Valid regex");
else
Console.WriteLine("Invalid regex");


Can someone help me out? What I'm trying to do is test a regex with a string that's supposed to be matched. But somehow the code I have validates expressions that I think shouldn't be validated?

For example, if the string is:
hello
And the regex is:
h

It says the regex is valid, but it shouldn't be, right? ' h ' as a regex should only match a string with just a single "h" in it, no?

The language is C#
>>
>>58966779
Why the fuck do you format your posts like that, plebbitor?
>>
>>58966779
regexr.com
>>
>>58966779
No.
A regular expression of "h" will return valid matches of anything containing the letter h.
>>
>>58966779

have you tried "=" instead of using a method like ".isMatch()"? if not you should try it out. if that doesn't work, post it on stackoverflow.
>>
>>58966834
you mean .equals()
>>
File: 1356409655253.jpg (7KB, 201x251px) Image search: [Google]
1356409655253.jpg
7KB, 201x251px
What's the worst way to make mobile apps and why is it with React Native?
>>
give me hackathon ideas
>>
>>58966822
why the fuck couldn't they call "regular expressions" just "expressions"?
>>
>>58966940

They're regular.
>>
>>58966940
What would "Perl Compatible Expression" be?
>>
>>58966940
Because you're not supposed to do stupid shit like "match for h", you're supposed to do shit like (?:description-id-[0-9]*" dir="ltr">)(.*?)(?:<\/a>)
>>
>>58966957
Perl expression
>>
>>58966974
https://examples.perl6.org/categories/euler/prob098-andreoss.html
my favorite Perl Compatible Expression
>>
File: clean code.jpg (58KB, 836x419px) Image search: [Google]
clean code.jpg
58KB, 836x419px
behold the power of javascript
>>
File: NatsuhoPole.png (39KB, 407x264px) Image search: [Google]
NatsuhoPole.png
39KB, 407x264px
>>58967020
Wow, I've never seen any language do that before
>>
I'm fairly certain I managed to create a type of layout with CSS, that hasn't been accomplished (without considerable drawbacks) yet. At least I couldn't find a single example of this method being used, despite many articles that have been written on different ways to do create this layout.
My method has very good browser support, works flawlessly (based on my testing), and is very clean and intuitive.
I'd like to share this method with the public, but I'd also like to have even a tiny bit of credit for it. I wonder how/where I should share this code/method.
>>
>>58967218
open github account under name
put code on github
get contributors to further develop it
include github link in resumes
?????????????
>>
>Tfw you are all programming gods with your big weeners when I am here trying to figure out how to write a path finding algor in a maze
>>
>>58967325
Try a*
>>
>>58967325
no, the hrt shrunk all our weeners
>>
>>58967336
what is a* can someone explain?
>>
>>58967352
https://en.wikipedia.org/wiki/A*_search_algorithm
>>
File: tumblr_ofryyks6HB1u0z65io1_500.png (249KB, 500x687px) Image search: [Google]
tumblr_ofryyks6HB1u0z65io1_500.png
249KB, 500x687px
Writing a book on Golang
>>
why do Pajeets make the best programmers?
>>
File: tumblr_o49ocm3k8N1rxajw6o1_500.gif (1MB, 500x281px) Image search: [Google]
tumblr_o49ocm3k8N1rxajw6o1_500.gif
1MB, 500x281px
>>58967415
Developers would be a more suited terms. They develop, they don't innovate.

That's what industry wants.
>>
>>58967422
term*
the*
>>
>>58967415
>Pajeets
>best
>>
File: 20130803004346.jpg (203KB, 574x800px) Image search: [Google]
20130803004346.jpg
203KB, 574x800px
>>58967402
make sure to put lots of anime in it
>>
So how was your Valentines Day, /g/?
>>
File: 16684208.jpg (44KB, 480x539px) Image search: [Google]
16684208.jpg
44KB, 480x539px
>>58967452
I was working

>>58967447
Can't. I can put anime references though
>>
>>58962875
>Haskell
>programmer
pick one
>>
>>58967422
>>58967445
Plenty of good software in IT at big name companies like Intel has been written by them and plenty of math and engineering fields related to computer science because of Pajeets
>>
>>58967459
>Can't.
Why not?
>I can put anime references though
This will do. Just be sure to make a fair bit of them, not just one reference.
>>
>>58967475
>written by
developed* by

> plenty of math and engineering fields related to computer science because of Pajeets
I think you are missing an auxiliary verb
>>
>>58967402
she is going to fall!
>>
>>58967488
>I think you are missing an auxiliary verb
#blownthefuckout by white nationalist repeating digi*s of justice
>>
>>58967512
the seven can be interpreted as a 1 so you are indeed correct
>>
Someone fucking kill me.
Please.

>tfw "design" team is demanding retarded shit again
>>
>>58967535
it can be fixed with OOP don't worry
>>
>>58967535
Some of you guys are alright.
Don't go to job tomorrow
>>
>>58967535
what kind of retarded shit?
genuinely curious.
>>
>>58967563
The kind of stupid shit people wih no background in engineering ask for. That kind.

>Why don't we put X feature in
Yeah if it was that simple, I won't be working at this place already. That kind of shit.
>>
>>58967594
give example
>>
>>58967594
this in no way satisfies my curiosity.

tell me more
plsplsplsplsplsplsplspls

t. CS undergrad.
>>
>>58967603
>>58967616
really?
I can't even give a shit and I am trying to
>>
>>58963854
My last job interview required me to write a program on paper, live in front of the interviewers without a reference.

Turns out it was correct C that just compiled correctly.

That was their minimum requirement.
>>
>>58967603
>>58967616
I work in circuit design for a company which sells consumer electronics. Often times the design/marketing ask for certain features to be cut and another feature to be added as if features trade 1 for 1 which consideration for the engineering aspects of the product.

>Well if we remove X feature, surely we can squeeze in Y feature
>Y feature is what we project to the trend
>Cue months of work being scraped or reworked to add their retardation inside
>Monthly meeting ask my superior why we are behind on schedule

Thankfully I just sit in during the meeting. I wonder how my superior can take these bunch of retards at face value.
>>
>>58967663
what program?
>>
File: 1295417060290.jpg (84KB, 500x327px) Image search: [Google]
1295417060290.jpg
84KB, 500x327px
>>58967632
In return, I shall give you the first meme I ever saved on this machine.
>>
>>58967674
It was something simple, like reversing a string without a temporary variable.
The key points were knowing C syntax by heart, and avoiding an off-by-1 error.

I'm just saying practicing to program on paper without any references can have real-life benefits, like for me getting that job.
>>
>>58967690
>a fucking leaf
>>
Any good books on how to think like a programmer/software developer? I am still a beginner, and while I understand the questions/problems, I have a hard time translating my "thoughts" into code. Hope that makes sense. It's kind of like trying to play what you hear in your head in guitar. Thank you in advance. Preferably in C, since is the language I am trying to master at the moment.
>>
>>58967671
kek'd. Thank you based anon.
>>
>>58967701
As boring as it may be, like you should practice your scales, chords and picking technique over and over again,
practice elementary algorithms and design patterns (in a general sense), over and over.

Skill comes 1/3 from learning new information and 2/3 and experience.

That's also why Asperger's have a hard time in social situations because they try to derive it from information and not practice, but socializing is highly irrational. So you need to practice.
>>
>>58967701
>>58967730
Think of it this way: if you practice the programming "vocabulary" and grammar over and over, it will be much easier to formulate sentences.
>>
>>58967701
read an algorithms book and write lots of code read more programming books

>>58967698
i would have a loop going through the string in reverse and storing it in a new string
>>
>>58967730
Thanks a lot for the analogy, fellow anon guitarist. It's makes a ton of sense.

>>58967745
I do, indeed, need to practice a bit more. At least 1 hour every day. Thanks a lot anon.
>>
>>58967759
>i would have a loop going through the string in reverse and storing it in a new string
You had to reverse it in-place using pointers.
They wanted to see the candidate has a basic understanding of pointer arithmetic.
>>
>>58967759
Thanks for the suggestion, anon. Do you recommend me an specific algorithm book? I was thinking on buying "Introduction to Algorithms", but if you know a good one, even better.
>>
>>58967690
I'm a time traveler. Send me your first anime pic and I will get the information from him.
>>
>>58967775
ohh i never used pointers before or know what they are I only program in Java

>>58967778
that book is a pretty good one I would recommend reading it giving it a go
>>
>>58967698
>avoiding an off-by-1 error
that's rich coming from someone who didn't avoid it himself
>>
New thread

>>58967869
>>
>>58967698
Would I get bonus points for calling the atomic swap intrinsic?
>>
File: 2000px-Ruby-logo-R.svg.jpg.jpg (22KB, 385x385px) Image search: [Google]
2000px-Ruby-logo-R.svg.jpg.jpg
22KB, 385x385px
why did this meme get so popular
>>
>>58968149
>meme
fuck off back to your shithole of a website and take that garbage language with you
Thread posts: 332
Thread images: 34


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