/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: wKYwoiM.jpg (700x958, 100K)

Other urls found in this thread:

blog.golang.org/why-generics
youtube.com/watch?v=iozAFIr3BEw
w3schools.in/csharp-tutorial/methods/
paste.debian.net/hidden/1bee0635
troydhanson.github.io/uthash/
myredditnudes.com/
twitter.com/SFWRedditImages

Alright Jow Forumsentalmen, I need your brains. I made a simple script to sign into hulu, but it only gives you two sign in's before you get a retry limit, and have to wait about 5 minutes before you can sign in again. Do you guys have any idea about how I can get around the wait time?

Attached: unknown.png (79x145, 16K)

/dpt/ - Daily Pedo Thread

threadly reminder that if you want a language without generics, you'll have to learn Go.
#include
#define print(X) _Generic((X), \
double: printf("%i\n", X),\
int: printf("%f\n", X),\
char: printf("%c\n", X))

int main (void) {
int x = 42;
double z = 11.0;
print(x);
print(z);
print((char)'a');
}

You have three options:
a) Use a proxy.
b) Don't fucking hammer their login prompt and instead add a delay.
c) Become a Hulu employee and do whatever the fuck you want.

C's generic are such abomination but also Go is adding generics: blog.golang.org/why-generics (but also just as crippled and botched version that's nearly as bad as C).

is it important to be familiar with html and css before learning javascript?

I was thinking proxy, but they are kinda unreliable.

even if you delay, you will still hit retry limit. I am pretty sure they only allow you 2 requests per 5 mins. Do you think there is any way other than a proxy?

Yes, doing less requests than 2 per 5 min.

Woah man nice Generic!
#include

struct Foo
{
int x;
};

#define print(X) _Generic((X), \
double: printf("%i\n", X),\
int: printf("%f\n", X),\
char: printf("%c\n", X), \
struct Foo: printf("%d\n", X.x))

int main (void) {
int x = 42;
double z = 11.0;
struct Foo foo;
foo.x = 666;

print(x);
print(z);
print((char)'a');
print(foo);
}

request for member 'x' in something not a structure or union

no.
you'll want to know HTML and CSS when you get around to applying JS to webshit.

it takes like a week so why not

This isn't a foot thread

you don't have to learn it before, but you do have to learn it eventually.
But what if I want to do more than 2 per 5 mins

>But what if I want to do more than 2 per 5 mins
You use a proxy.

am I never gonna make it if I need ADHD medicine to study programming?

I try to cope by telling myself that maybe I do have ADHD and I'm just treating a legit medical condition, but another part of me says that it's just cope and I'm a retard who needs pills from my doctor in order to do things that everyone else can do without it

I recommended change Main image for an iframe And embeed timeframes, Also recommended make a 3 long in imaging exepting number 3 to make number 2 the embeded one last forever, I have thought of mixing normal-slow cam animations And music fragments. Also imgur.com for uploading images. Also My server is rebooting alone I have an idea for extra security, deleting all certificate from server Sincé I had that done by error my Toshiba been up for two weeks

C or Python?

I'm in the same boat someone please answer

neither

Python

kys

If you have to choose between the two, easily Python, it's much more useful for most tasks, and simple, with big community and libraries, used for most things. You're unlikely to do any of the 2-3 things that C excels at anyway (and it's not exceling there because it's a good language per se).

Why should someone choose Idris over Shen or vice versa?

Attached: qq.jpg (400x323, 51K)

julia

whats wrong?
/* This is a comment. Yay! */
#include

int sumArrays(int row, int column, int *array[row][column])
{
int sum = 0;
for(row = 0; row < 3; row++)
{
for(column = 0; column < 3; column++)
{
sum += array[row][column];
}
}

return sum;
}

int main(void)
{
int arrayA[3][3] = {{1, 2, 3},
{4, 5, 6},
{7, 8, 9}}, sum = sumArrays(arrayA, 3, 3);
printf("the sum is %d\n", sum);

return 0;
}

Attached: d.jpg (142x116, 10K)

What's wrong is you used faggot bracing.
for(column = 0; column < 3; column++)
{

It depends. Of course I won't choose python to program drivers and C for web scrapping.

the array is the third parameter in the function definition but the first in the call for sum

What about:

int sumArrays(int **array)
{
int row, column, sum;
sum = 0;
row = (int) (sizeof( array ) / sizeof( array[0] ));
column = (int) (sizeof( array[0] ) / sizeof( array[0][0] ));
for(row = 0; row < 3; row++)
{
for(column = 0; column < 3; column++)
{
sum += array[row][column];
}
}

return sum;
}

why is cs50 so shitty?

>lectures seem to be designed for literal retards while problem sets are frustrating and way more advanced than the lectures

Attached: 1564196955325.jpg (399x464, 52K)

This may help
youtube.com/watch?v=iozAFIr3BEw
but really, you need to decide what your goals for your life are and pick the best means to achieve them. I'm no doctor, so don't interpret this as "medical advice," but I think the reason why people who don't have ADHD should not take ADHD meds is because they can be more trouble than they are worth. The meds have side effects. Look up the common side effects for what you are taking. If you take it long enough, you may encounter most or all of them to some degree. You may already be experiencing some of them. For some people, their problems are bad enough to make the side effects worth it. For other people, it is not worth it. There are many people with legit ADHD who are desperate to find a non-drug solution. That aside, if you re-frame the issue as I did above then it may allow you to stop worrying about "what is true ADHD?" and instead ask "how can I live best?"

All that said, if you have career possibilities that don't require meds, I would explore them unless programming is near and dear to your heart.

Attached: secret squirrel.jpg (640x858, 134K)

for what?

thanks! I wasn't sure how I should go about getting the values of a vector but that is very insightful. I'm going to keep making small changes to it so I can wrap my head around C's syntax and the whole type assignment thing. I come from Python so I feel pretty dumb making these mistakes (which is probably the case, but I think I can manage it now that you've helped me). again, thank you user

Stop coding in C, learn something to make money, like Flutter or React Native, or some Frontend Frameworks, Laravel, Symfony, or Django

Or learn to interact with an API in Python

You do realize class numbers are not standardized.

I'm going to uni soon considering majoring in CS, what's a good minor to go along with it? Also, from where does the course start? Does it assume you have experience already, or does it start from the basics?

Attached: serveimage_0.jpg (1280x718, 108K)

>falling for the CS meme

ok hi; i'm a rockstar software developer and (unusually for me) have run into an issue in C/gcc
was wondering if any of you guys could shed some light onto this.
the error is conversion to a non-scalar type requested
this is occurring within a macro where i am casting like this, notice the cast from a pointer to a pointer
struct HashMap *x = (struct HashMap *)y;

Attached: huh1.png (592x356, 205K)

C is awesome. Stop jewing around.

Just to clarify: I am NOT suggesting that anyone should take meds unnecessarily.

kill yourself

save and reuse the cookies

Kys

Have you programmed before?

Hey, Anone! I tried making something in your favourite thing, JavaScript! Can you take a look at it?

Attached: b449c2ed7d44d41549cbcf1780744f09.jpg (667x1000, 91K)

stop replying to the webshit bait

yea

Yeah, but am still in the kinda intermediate range

you might get bored if you're even slightly experienced since they go at a very slow pace. all I knew when I started was the logic behind a for function and the first year almost drove me insane

>C is awesome

Attached: file.png (216x233, 45K)

This thread really goes to shit during aussie hours.

What's the best way to do image comparison in Python? Let's assume I have a database of baseball card information and pictures of the cards. I want to be able to take scans of new cards and compare them to the database and see if I have their data already.

I'm looking for python books to take myself from basic fundamentals to intermediate. I've read both Python Crash Course and Learn Python The Hard Way. Is there such material or do I just search engine how to do X until im dead. Hoping to learn more about networking and web development.

Learning Python by Mark Lutz is a more in depth look at the language that gets fairly technical. Just pick a project and build it though. You'll find out what's important in a practical sense and actually have something to show for it than another book read.

how about dirtying your hands a bit?

The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will see what is lacking in most other languages.

Read the fucking book faggot. You're not smart

I like C!

Hmm, actually didn't try that. Is that a technique thats often used. I would think the cookies are only usable one time. But I am not that well versed on that stuff.

>i'm a rockstar software developer
>almost certainly casting the result of malloc and not understanding why its wrong

>intermediate range
should be enough but here is a general tip for college: don't assume you'll be spoon-fed everything you need to know. your professors are not omniscient. even if they are experts, they can't read your mind or your personal future to know what *you* need. if you want the best info then you have to hunt for it. it's your responsibility to find it.

>casting the result of malloc
himegoto memes could have prevented this

not sure what you're doing user, but it sounds like you should learn about cookies. it'd be a way to maintain the session instead of starting a new one. are you looking to crack accounts or do you want to stay logged in? you can achieve the 2nd with saving cookies, and the 1st would require proxies.

Alright cool, and im trying to crack accounts, So I am gunna try maintaining the session and let you know how that goes.

oh if you're just cracking, then keeping the session alive isn't going to help. as an user said before: use proxies.

Attached: 1565928988792.jpg (209x250, 8K)

damn, I was trying to avoid using proxies but I guess i'll have to, thanks anyway.

I just realized I haven't done anything productive today.

>tfw you have to design a new program around a cryptic tool developed 10 years ago in another country that has zero documentation
>tfw it's critical for a bid on a big potential customer
>tfw want to shoot myself because every day we find some new undocumented behaviour that breaks something
fucking kill me, anons

Attached: 705.png (226x223, 79K)

yeah, proxies can be yuck. i've heard of a few hulu proxyless methods over the years, but i haven't looked into it. maybe you could try searching around. good luck

Cute!

thank you all for replying to my post

i believe that this is not an issue with malloc, as please notice the cast from a scalar type (pointer) to another of (what i believe to be) the same type

Attached: kisumi-birthday.jpg (530x750, 113K)

Imagine calling yourself a rockstar developer and not understanding how to get a reference of a scaler type.

>says "notice the cast from a pointer to a pointer"
>quotes a cast of a variable to a pointer
>no information shown at all about the type of the variable
>as you can see there's a pointer here and it's getting cast to a pointer
I'm getting "unreliable narrator" vibes.

this is so confusing every section is just more confusing
w3schools.in/csharp-tutorial/methods/

maybe i should just give up and go to sleep

>inb4 stupid objections
the point of you being an unreliable narrator is not that you're wrong about this specific thing, but that since you are so blatantly wrong, you're not being careful at all, and therefore can't be trusted with anything.
what's more likely the actual problem is that your example showing a "clear cast from a pointer to a pointer" is constructed and that your real code shows a clear cast of a pointer to a struct.

Attached: esdfsdfsdf.png (1303x552, 117K)

What salary should I ask for first job, is 60k reasonable?

i think i understand references
sorry i'm trying. that is what is shown following the expansion of the macro

i've uploaded a paste now. hopefully someone can help! thank you all very much for your time. sorry if this is blindingly obvious or anything

paste.debian.net/hidden/1bee0635

Attached: 2429cf7daac71acac93dbe1cb2f664f1.jpg (500x417, 27K)

Just use python

Attached: busta-640x675.jpg (640x675, 90K)

Holy shit learn about inline functions you fucking retarded macro abuser. This wouldn't even be a problem if you used proper functions with typed arguments.

this is only part of my project, most of it is not in macros. this seems to be the only somewhat reliable way to get generic-type behaviour in C as much as i dislike the idea
all hashmap implementations that i have seen in C also use macros in their implementation

this made me laugh. thanks user :)
also python is fine just not ideal for my project (i'm writing a game)

Attached: 1502411540026.png (721x489, 17K)

holy shit C is outdated garbage when you resort to using the preprocessor to copy and paste code

You're an actual retard.

>Cniles will actually defend this
int main(){

srand(time(0));

struct HashMap tmap;

do{ typeof(&tmap) __om=&tmap; typeof(8) __s=8; struct HashMap * __m=(struct HashMap*)__om; __m->map=malloc(__s*sizeof(void*)); __m->mapC=0; __m->mapA=__s*sizeof(void*); memset(__m->map, (int64_t) 0, __m->mapA);} while(0);

struct Test lol[(100)];
int i=0;
while(imapA / sizeof(void *));}while(0); struct{typeof(lol[(100)].name) k; typeof(lol[(100)]) v; void * n;}** cur=(typeof(cur))&(((struct{typeof(lol[(100)].name) k; typeof(lol[(100)]) v; void * n;}**)__m->map)[__slot]); while(*cur!=
((void *)0)
){ if((*cur)->k==__k){ (*cur)->v=__e; break; }else{ cur=(typeof(cur))&((*cur)->n); } } if(*cur==
((void *)0)
){ *cur=malloc(sizeof(struct{typeof(lol[(100)].name) k; typeof(lol[(100)]) v; void * n;})); (*cur)->k=__k; (*cur)->v=__e; (*cur)->n=
((void *)0)
((void *)0)
){ size_t __slot; do{ typeof(__m) __fom=__m; typeof(__cur->k) __fk=__cur->k; uint64_t __hash= hash_int(__fk); struct HashMap * __fm=(struct HashMap*)__fom; __slot=__hash % (__fm->mapA / sizeof(void *));}while(0); typeof(__cur) __new=&(((typeof(*__cur))__m->map)[__slot]); } } free(__oldmap); }} while(0); }} while(0);
i++;
}

return 0;
}

change the offending line to hashwtf __fm=__fom; after adding the typedef, and that line is now fine and the error's elsewhere. Conclusion: lol, macros.

Stop being an idiot and use void * function parameters.

What the fuck

t. cnile

That code style is shit. C++ don't makes it better.

yeah looks like you're an OK narrator but you've broken gcc's ability to help you troubleshoot whatever actual problems are in this code, sorry.
if you just want a C hashtable, troydhanson.github.io/uthash/ is OK.

>y-you don't need type safe generics.
>void* is fine!

Attached: 72A5CF3E-0E6F-4B6D-BA02-B688FF6269F8.png (627x722, 114K)

yeah, thanks for your suggestion. i'll soldier on for a little bit until i lose all hope and end up resorting to using third party stuff. it's not exactly ideal though

Attached: 1561362680993.jpg (700x651, 291K)

>Trying to go through the cryptopals online tutorial
>Dumb as fuck so I keep getting stuck

Attached: 1566116267245.jpg (619x453, 47K)

Your current shit is not ideal.

dumb frog poster

Please help user why am i so dumb

okay but unless you have any suggestions beyond using someone else's code or using python there's not much i can do about it

Attached: kisumi-1.png (2400x1698, 2.73M)

You can not abuse macros like a retard.

pretend you're writing Go and stop trying to be generic. Embrace Go's specificity.

these things happen man, try not being so dumb

Attached: 1542019188484.png (403x473, 49K)