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

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

Thread replies: 255
Thread images: 28
File: red_hat_logo.jpg (12 KB, 648x348) Image search: [Google]
red_hat_logo.jpg
12 KB, 648x348
Previous thread: >>55617401


What are you working on, /g/?
>>
>>55623304
Why do universities start of with teaching java? Is there any better beginner language?
>>
File: 1467398868589.jpg (475 KB, 852x973) Image search: [Google]
1467398868589.jpg
475 KB, 852x973
*tips red hat*
>>
/dpt/ isn't even worth coming to any more, holy fuck. pathetic.
>>
File: 1466384703504.png (87 KB, 547x700) Image search: [Google]
1466384703504.png
87 KB, 547x700
>>55623304
just tidying up
>>
>>55623327
>Is there any better beginner language?
literally anything
>>
>>55623304
Making a web application for some friends when they are gonna teach some kids JavaScript.
They need to make games and save their shit on my server.
>>
I am writing the entire Linux Kernel in Java using OOP practices only
>>
>>55623329
Thank you for not starting a thread war (:
>>
>>55623355
You've gotta let the redditors make the OP every now and then or they'll take over the board
>>
File: noeffect.png (101 KB, 252x362) Image search: [Google]
noeffect.png
101 KB, 252x362
>>55623327
It's not script-tier but doesn't force newbies to think about memory and shit. Similar syntax to C/C++ without the pointers.

Reposting from old thread.
I'm writing a compiler from a fictional language to Chip-8. The author of the Dragon Book creates separate token types not only for things like "while" and "for" but also SEPARATE types for "true" and "false". Why doesn't he make a "boolean" token type? Should I make separate tokens for "int" and "bool" too?
>>
>>55623361
True, otherwise that retarded trap meme might actually take off
>>
>>55623327
It's only taught because there are so many jobs for Java due to oracles massive and successful marketing for the language. Quality has nothing to do with it, trust me. Java is annoying to program in and pretty bad.
>>
>>55623379
>thinks every girl is actually a boy
are you gay?
>>
>>55623410
N-no!
>>
>>55623410
>Thinks cartoons are real life
are you a child?
>>
Java is actually not to bad, but compared to most other computer languages its not as implemted but all the while worth learning. If your new to computer coding than I would start with either c/c++ or Python then go on to Java.
>>
File: 1468587391705.jpg (80 KB, 574x574) Image search: [Google]
1468587391705.jpg
80 KB, 574x574
>>55623304
Please use an anime picture next time.
>>
>>55623345
It's decent if you ignore the programming language dick swinging. Admittedly, that's like 70% of DPT so idk
>>
>>55623446
a 30% on topic percentage is the definition of shit..
>>
>>55623458
Thanks for contributing.
>>
>>55623436
>c/c++
Why are you grouping two completely different languages together like that?
Also, Java is complete trash and is not worth your time at all. OOP is fundamentally flawed, and Java forces you to use it.
>>
>>55623483
>Why are you grouping two completely different languages together like that
C++ can compile regular C
>>
>>55623483
Java is worth the time if you want a good paying career
>>
File: a3bc3a404e.jpg (97 KB, 599x473) Image search: [Google]
a3bc3a404e.jpg
97 KB, 599x473
>>55623329
Glad to see my OC is used more and more, Chi-chan 2stronk.
>>55623304
I'm learning WPF, all these books kinda sucks balls, ATM they just only teaches you the framework and not how to actually build an app.
>>
>>55623458
I don't disagree!
>>
>>55623503
No it can't. C has evolved a lot since 1980, you know. It can't even compile all valid C89.
int *ptr = malloc(sizeof *ptr);

valid C, invalid C++.
And that is just a simple example. There are all sorts of semantic differences that will make the languages very different.
>>
>>55623514
Your oc looks like shit
>>
>>55623537
the void pointer casts are probably the only thing you would be changing.

that doesn't make it a "completely different language"
>>
>>55623556
take that back!
>>
>>55623571
I think that while there are differences, they are definitely similar enough to group together
>>
>>55623581
XD
>>
>>55623571
it does make it not compilable by C++ though
>>
>>55623500

>windows forms
>shiggy diggy

Haven't touched this since some HS programming class.
>>
>>55623571
>>55623587
C99 and C11 together add a whole bunch of very useful things which cannot be used in C++.
Also, the way you write modern C and modern C++ is COMPLETELY different. We're not talking about 1980 'C with classes' here.
>>
>>55623619
>C
>still no polymorphism of any kind
>>
File: 1367258709159.jpg (94 KB, 580x720) Image search: [Google]
1367258709159.jpg
94 KB, 580x720
>>55623556
ty, last time I got told that too.
>>
>>55623642
>still no polymorphism of any kind
void pointers


also, you can have type-safe macros with the non-standard gcc statement expressions
>>
>>55623688
>void pointers
>remotely comparable
>>
>>55623642

>using polymorphism irl

Surrrrreeee. We barely use inheritance and interfaces, and that's only when someone gets bored.
>>
>>55623701
of any kind
>of any kind
"of any kind"
>>
>>55623718
>void pointers
>polymorphic
nonsense

>>55623711
>inheritance
stay out of this OOP man, or i'll beat you back into your cage
>>
>>55623731

>stay out of this OOP man, or i'll beat you back into your cage

haha, do you really not use OOP? I thought that was a joke when I skimmed the last thread.
>>
>>55623783
>haha, do you really not use this one specific (shit) paradigm?
>>
>>55623731
I'm not saying it's good, but it's not impossible

void *polymorphic_square(void *x)
{
unsigned long long *n = (unsigned long long *) x;
*n *= *n;
return n;
}
>>
>>55623826
double x = 4.3;
polymorphic_square(&x)
>>
File: trianglesHowDoTheyWork.png (3 KB, 718x402) Image search: [Google]
trianglesHowDoTheyWork.png
3 KB, 718x402
Ok guys, this is serious. How do I find the point in the middle of this line. I am the guy trying to build some empty triangles.
>>
>>55623840
use the midpoint formula


come on man
>>
>>55623840
(A + B)/2
>>
>>55623856

Fuck me. I didn't even know this was a thing. I am sitting here deriving it from the Pythagorean Theorem for length/2 and then throwing that into trig after getting angle of line to find resulting point. Ty
>>
>>55623838
use a struct and hint the type there instead of simply passing random pointers.
>>
File: 1463456505497.jpg (26 KB, 300x419) Image search: [Google]
1463456505497.jpg
26 KB, 300x419
>>55623898
>Fuck me. I didn't even know this was a thing.
literally how
>>
>>55623840
>>55623898
How fucking retarded can you be?
>>
>>55623908
>>55623913

>literally how
>How fucking retarded can you be?

Valid questions bros, valid questions.
>>
Historical linguistics simulation. Wanted to use racket but python already has a good sound change rule applier lib and it would take to long to recreate it in racket so python it is :/
>>
>>55623924
This is so fucking basic I'm surprised there's a fucking "formula" for it

This is like child level knowledge

Can you find the middle number between 3 and 5?
>>
>>55623304
Just hype-shilling on /g/ as usual. Added Cheat Engine-like register features(such as paint red on change, double click to set register etc.) to PINCE today.

https://github.com/korcankaraokcu/PINCE

Tell me how it looks lads
>>
To the guy that made the chip8 emulator: what resources did you use?
>>
>>55623954
>.py
>>
>>55623954
>https://github.com/korcankaraokcu/PINCE

Saw this project on cheatengine forum.. It's now on /dpt/

This is oddly appropriate.
>>
>>55623939
Honestly I looked at his post and immediately began overthinking it. I assume he did the same.
>>
>>55623965

Crates:
Rand,
SDL2

The rest was rust standard libraries.
>>
>>55624040
I mean for documentation/manual of the architecture.
>>
>>55623939
>>55624032

That's what happened - I have a working solution that uses the pythogorean theorem to get the length of the line, divide by half, then get the angle of the line, and use trig to move up half.

Not saying that as an excuse, but since he asked. Supposedly people fail interviews for this shit too (over-complicating).
>>
>>55624049

http://devernay.free.fr/hacks/chip8/C8TECH10.HTM

Also did some research on misc places. Bisqwit did a pretty nice video showing the process.
>>
>>55624055
>I want the average of these two points
so take the average of the two points?
>>
>>55624055
I actually smacked my forehead after googling "midpoint formula". I went " Welp...I'm retarded."
>>
>2016
>not using week typed languages
>>
>>55624089

Same.
>>
File: 1468612665737.jpg (43 KB, 464x524) Image search: [Google]
1468612665737.jpg
43 KB, 464x524
>>55623966
Wallahi senpai there's nothing wrong in using python. I started programming with assembly. Doing only FP-related hacks and pointer arithmetic is FUCKING boring, especially after 5 years. Programming got fun again after I've met with python. She's charming desu

>mfw the first time I discovered python
>>
File: PepeDiskMark for GNU_087.png (43 KB, 650x354) Image search: [Google]
PepeDiskMark for GNU_087.png
43 KB, 650x354
>>55623304
>What are you working on, /g/?
Now actually works
>>
>>55624131
I like your licensing.
>>
>>55624115
What if I need more than 7 days?
>>
File: 1466913882224.png (743 KB, 800x600) Image search: [Google]
1466913882224.png
743 KB, 800x600
>>55624131
>Use by normies is prohibited under federal law
>>
>>55623610

System.Drawing isn't WinForms, it's just a nice wrapper for GDI+
>>
>>55624145
then you cast your variable to a month
>>
>>55623939
>Can you find the middle number between 3 and 5?

A better question is this: Can you do it in C?
>>
>>55624179
Is this a trick question? Of course not
>>
>>55624131

>MiB

autism
>>
>>55624115
>2016
> 20+ megabytes of memory usage + giant misc mostly unused libraries for something that could be done in less than a megabyte.
>>
>>55624196
International standard.
http://physics.nist.gov/cuu/Units/binary.html
>>
>>55624196
>MB
baka desu senpai
>>
File: 1468781382214.jpg (59 KB, 540x778) Image search: [Google]
1468781382214.jpg
59 KB, 540x778
>>55624074
Please include a debugger with it. Is there a place that I can see your project?

>mfw your project
>>
>>55624318
>>>B
>>
Anyone got nerd techno on hand?
>>
>>55624427
There aren't any nerds here you faggot, just programmers
>>
>>55623371
>author of the Dragon Book


... Chumbley?
>>
>>55624427
https://www.youtube.com/watch?v=vgk7vKiTAqo
https://www.youtube.com/watch?v=QTY_Fiau_8o

Not techno but meh.
>>
File: ayyyyy.png (24 KB, 1114x461) Image search: [Google]
ayyyyy.png
24 KB, 1114x461
ayyy this is taking forever
>>
>>55623371

Boolean should typically be implemented as your smallest type with defined values as language constructs (true(1), false(0))
>>
>Johnson is a notable person, with an 80s hacker personality. Marisa is creating his own operating system. They eventually created an IRC channel for themselves
What IRC channel did marisa make?
>>
>>55624530
Who the fuck is Marisa? Why is the foreign secratary creating an IRC channel?
>>
I was browsing okular source (https://quickgit.kde.org/?p=okular.git&a=tree) and, as beginner, I'm pretty confused. Must a darm pdf viewer really be so complex?
>>
>>55624192

You have passed the test.
>>
>>55624540
>Who the fuck is Marisa?
An old tripfag
>>
Can someone explain to me applicative sequencing in terms of non-IO monads?

What does sequencing mean for Lists, for instance?
>>
You all talk about these advanced topics but none of you have built any practical or useful applications. What's the deal?
>>
>>55624548
>https://quickgit.kde.org/?p=okular.git&a=tree

Loading and saving file formats according to standards is always needlessly painful.

Oh, and the fun part is on some types you can't trust that following the Standards will actually be able to load the file (Microsoft is particularly known for this)
>>
>>55624552
The real question is can you implement `Frob" in O(fib(N))?
>>
>>55624621

Bro, I am making triangles.
>>
>>55624482
What are you doing?
>>
>>55624621

Since when are mostly undergraduate topics "advanced"?
>>
>be in school studying CS
>new and interesting topics every week, learned a lot of cool stuff

>graduated and got a job
>same mundane web/database shit day after day

I did not sign up for this. Are all """programming""" jobs this boring?
>>
>>55624740
>Are all """programming""" jobs this boring?

Pretty much.
>>
>>55624740
>I did not sign up for this
So you aren't under contract with your employer?
Just leave then
>>
>>55624740
Go academia.
>>
>>55624697

Making https://en.wikipedia.org/wiki/Sierpinski_triangle

>>55623395
>>
>>55624740

Yep all the interesting work is generally done outside of the job as a hobby (When the contract allows it at least..)

There is a reason why most of the people with actual jobs programming just shit post.
>>
File: trianglesHowDoTheyWork2.png (31 KB, 1134x437) Image search: [Google]
trianglesHowDoTheyWork2.png
31 KB, 1134x437
>>55624769

Holy shit it worked. 2 hours of life. Wasted.
>>
>>55625066
Why aren't you just using a lazy infinite data structure based on comonads?
>>
>>55625082

I got lazy as shit about halfway through. Also infinite looping it kills my processor. I bet it will get yours too.
>>
>>55623304
Making a homebrewed Library in c++. Re implementing the list ADT using a singly-linked list instead of the double like in the STL.
>>
>>55625082

You do realize outside of a "pure" functional language monads are generally unnecessary, hard to implement, or not used?

Like the only big examples that come to mind of monads being used outside of haskell are LINQ extensions and Unix Pipes.
>>
>>55625133

Triangles guy here - I actually don't know what the fuck monads are. I am googling as we speak, when I replied to that anon I was just answering to the "why not infinite loop" portion.
>>
>>55625133
I'm not talking about monads, I said comonads
>>
>>55625158
>I actually don't know what the fuck monads are.

Monoids in the category of endofunctors.
>>
>>55625174
>>55625179

>muh education

Never learned shit in school, more triangles, more comonads, more /g/ fool.
>>
>tfw no /g/ anon to become my mentor and teach me how to be a competent programmer
>>
>>55625235
Just learn Haskell.
>>
>>55625235
this >>55625249
>>
File: 1407422646302.gif (88 KB, 100x100) Image search: [Google]
1407422646302.gif
88 KB, 100x100
>>55625253
>>55625249
>>
>>55625174

comonads are just monads with the operations reversed.

extract ::  m a -> a
extend :: (m a -> b) -> m a -> m b

return :: a ~> m a
flip (>>=) :: (a ~> m b) -> (m a ~> m b)
>>
>>55625279
>no argument
>>
>>55625280
they're the dual to monads, "with the operations reversed" is not a particularly good descriptor
>>
>As both Wes and Eric highlight, a monad is a triple consisting of a type, a Unit function (often called Return), and a Bind function. If the type in question is Task<T>, what are its Unit and Bind functions?

mindfulloffuck.jpg
>>
>>55625300
>learning a dead language
>>
>>55625235
Dress up as a cute anime girl and I will.
>>
>>55625327
>no argument
>>
>>55625345
>DEAD
>>
File: ENOUGH.jpg (5 KB, 252x161) Image search: [Google]
ENOUGH.jpg
5 KB, 252x161
>>55625325
>bind
>not join

FUCKING NORMALFAGS WHEN WILL THEY STOP
>>
>>55625353
>yourClaim :: Nothing -> False
>>
>>55625308

I guess a better description would be they're the inversion of a monad. Literally you just flip the arrows in the definition of monad to get a comonad.
>>
File: 1340154171021.gif (1 MB, 200x207) Image search: [Google]
1340154171021.gif
1 MB, 200x207
>>55625388
NIGGA ITS DEAD. AS IN NO ONE USES IT.
IT'S A MEME LANGUAGE MADE IN 1999 THAT HAS NO USE TODAY.

Might as well tell the guy to learn Latin and go be a translator no where because IT'S FUCKING DEAD.

JUST LEARN C FAMILY AND BE DONE WITH IT.
>>
>>55625235
I will be your mentor if you want.
So as first step in your programmer career you must absolutely install and learn inkscape, then we can talk
>>
>>55625414
>void (*yourClaim)(void);
>>
>>55625414
>fp increasingly popular
>all new modern languages are taking from haskell
>dead
>>
>>55625458
>>all new modern languages are taking from haskell

Haskell is probably the last stop for feature robbery.
>>
>>55625470
That sounds like a great thing.
>>
>>55625495

It is a good thing. Haskell is total nonsense.
>>
>>55625458

It's a bit date now but you gotta remember this

https://www.youtube.com/watch?v=iSmkqocn0oQ
>>
>>55625534
are jones
>>
>>55625436
Why inkscape?
>>
>>55625527
What's your favorite language?
>>
>>55625661
Java
>>
>>55625707
Of course.
>>
Why does everyone have to make everything for fucking unix?
>>
>>55625764
because there's basically two different versions of your codebase, the Windows version and the Absolutely Everything Else version
>>
>>55625764

Programmers typically don't like the windows operating system.
>>
>>55625764
Because it's not WINAPI_DWORD_HND -tier retarded.
>>
>>55624179
Worth failing the test for this one

void line_midpoint(int x1, int y1, int x2, int y2, int *xr, int *yr)
{
*xr = (x1+x2+1)>>1;
*yr = (y1+y2+1)>>1;
}
>>
whats the cheapest cpu I should get to run visual studio without a shitload of lag? I plan to also get 16 gigs of ram and already have an ssd
>>
>>55623642
union pleb {
enum pleb_type {
PLEB_OOP_FAG,
} typ;
struct {
enum pleb_type typ;
int classes_made;
int (*give_oop_design_pattern)(const char *);
} oop_fag;
}


Expand as necessary.
>>
>>55625979
>polymorphism
>OOP
pick one
>>
>>55625978
>> buying a new computer to run an IDE
Why don't you try CLion, or another C++ IDE?
>>
>>55625989
>they're the exact same thing
>>
>>55624115
>> 2016
>> can't spell weak
>>
>>55625937

why do you do +1

void Midpoint(intmax_t x1, intmax_t y1, intmax_t x2, intmax_t y2, intmax_t& xr, intmax_t& yr)
{
xr = (x1 + x2) >> 1;
yr = (y1 + y2) >> 1;
}
>>
>>55626001
Fucking OOP fags, taking words with good meaning and restricting them to an extremely fucking specific shitty usage
>>
>>55625707

wew lad
>>
>>55625937
>>55626024

come on guys
point midpoint(point p1, point p2)
{
point out;
out.x = (p1.x + p2.x) / 2;
out.y = (p1.y + p2.y) / 2;
return out;
}
>>
>>55626051
return point((p1.x + p2.x) / 2),(p1.y + p2.y) / 2));
>>
>>55626024
so I can round the numbers up

not so useful if shifting by 1, but it can be necessary when shifting by larger numbers to add (1<<(n-1)), because if we're using arithmetic shifts then -1>>anything is -1 and sometimes you don't want that jump just behind 0

>>55626051
yeah that works too
>>
>>55625979
You switched union and struct.
>>
File: nyt-2week-with-legend.png (1 MB, 1024x1068) Image search: [Google]
nyt-2week-with-legend.png
1 MB, 1024x1068
has anyone here ever built one of these, or something similar to it (a visual map of data with all of its connections minimized so you can see relations)?

It's called the ForceAtlas 2 model and I have no idea how to even get started with it
>>
>>55626132
what is your question? do you have the data?
>>
File: picture2.png (233 KB, 1923x1077) Image search: [Google]
picture2.png
233 KB, 1923x1077
Working on figuring out the least distance I have to walk, and in what order I have to walk to catch all the Pokemons in my area.
>>
>>55626203
>basic weighted pathfinding
>>
Is it possible to manage memory on the stack or is that completely up to the compiler.
Like say I was pushing my memory limit and wanted delete objects on the stack if the limit is hit. Is something like this possible or does it need to go on the heap.
>>
>>55626236
heap
never use the stack for persistent/reliable storage
>>
>>55626203

Have fun collecting data for the CIA. Did you read what access agreements you gave to the application when you installed it?
>>
>>55626223
Yeah I am going to compare the result with A* next.
>>
>>55626256
wtf does A* have anything to do with this? you want at traveling salesman solver
>>
>>55626170
not yet, just testing the waters

I was thinking of adapting it to youtube's sidebar way of finding similar music. Since every video has a set of related music so you can draw 10 connections for each video and draw an enormous map showing where each video is in relation to others'. The scraping part would be easy enough (relatively speaking)

>>55626203
you could even input those into mapmyrun with a POST request and get the actual route distances (factoring in predicted time) for each rather than as the crow flies calculations
>>
>>55623327
In my uni they start teaching C.
>>
>>55623327
at Berkeley the first class is in Python with a bit of Scheme. Second class is data structures in Java.
>>
>>55626302

Most places are starting with C# and Java or Python and only giving C / C++ classes as opt in courses.
>>
>>55626273
Sorry by A* I meant apply a heretical approach on top of TSP to optimize for the rarest pokemon's first, based on CP.
>>
>>55626326
>heretical
heuristic*
>>
>>55626302
my sister is working on her CS degree at Berkeley and they're using python right now for the upper div machine learning/AI course
They have to do lots of shit though like writing in assembly and optimizing different languages for specific machines
>>
Hey guys I'm using Java and I don't know what is better to do after I'm done using a variable (like an arraylist or something).

Which is better? I'm completely done using the variable.

Arraylist.clear()
Or
Arraylist = null
????
>>
>>55626248
but I thought accessing the stack was far faster than the heap. Or does it only matter when you are first allocating it.
>>
>>55626349
CS188 is in Python. I believe it's also on EdX.

In the intro machine structures course, 61C, we do MIPS assembly and performance programming with OpenMP/SSE intrinsics and stuff. Not sure which class is about optimizing for specific architectures.
does she post on /sci/?

>>55626370
neither, the garbage collector will take care of it
>>
>>55626281
>you could even input those into mapmyrun with a POST request and get the actual route distances (factoring in predicted time) for each rather than as the crow flies calculations

That's actually not a bad idea, I will look into it, thanks! Right now its just doing straight euclidean distance calculations.
>>
>>55626393
>the garbage collector will take care of it
Not him, but I think that wouldn't happen since it exists a reference to the array. (Until the program finish I guess.)
>>
>>55625436
Srly, why Inkscape?
>>
>>55626370
create a timer and test it. Take a look at the memory allocation as well, if you want the practical approach

>>55626397
that would be serious overkill though honestly, talking about several more hours of debugging for this program

>>55626393
no she doesn't use 4chan
I have another friend at berkeley who posts on /fit/ and /sci/ though, although I think he's physics or something
I'm not majoring in CS though so a lot of the stuff you guys work on goes over my head
>>
>>55626382

Using heap memory pools with special allocators can get similar performance to the stack if done carefully.

In general though stack access is much faster. It's usually already cached.

The problem is the stack is small and finite. You can't allocate big objects or keep many objects in it. If you've got a large amount of data or need it to be persistent you should use the heap. If you've got a relatively small amount of data that doesn't have a very long life time use the stack.
>>
>>55626496
>I have another friend at berkeley who posts on /fit/
Found the gay.
>>
>>55623304

Is this the proper way to delete a tree with variable number of children?

typedef struct term_tree{
char* name;
int numArgs;
struct term_tree* args;
}term;

void initTerm(term** newTerm, char* name, int numArgs){
if (!isTermName(name))
exit(printf("error: %s is not a valid term name\n", name));
if ((isFunctName(name) && (numArgs < 1))
exit(printf("error: a function or must have at least one argument\n"));
(*newTerm) = (term*) malloc(sizeof(term));
(*newTerm) -> name = name;
(*newTerm) -> numArgs = numArgs;
if (numArgs <= 0)
(*newTerm) -> args = NULL;
else
(*newTerm) -> args = (term*) malloc(sizeof(term)*numArgs);
}//initTerm

void deleteTerm(term** newTerm){
term* iter = (*newTerm);
if (iter -> args == NULL){
free(iter -> name);
free(iter -> args);
free(iter);
}
else{
int numArgs = iter -> numArgs;
for (int i = 0; i < numArgs; i++){
iter = &((iter -> args)[i]);
deleteTerm(&iter);
}
}
}//deleteTerm
>>
File: 1422396933515.jpg (36 KB, 300x292) Image search: [Google]
1422396933515.jpg
36 KB, 300x292
>>55626666
Huh, I got Satan's quads.
>>
>>55626496
hm okay. do you go to cal too? every lecture I see a few people on 4chan.
>>
>>55626714

Careful some professors at schools lurk on dpt / other programming boards to catch students.
>>
>>55626731
catch students doing what? are they going to look at my 4chan account history to check for plagiarism?
>>
>>55626714
nah I got to UC Merced for economics and literature
I'm the low achiever in our family

I'm guessing you're comp sci or something similar?

>>55626731
it's not like they can do anything except feed bad information though
>>
>>55626751

You'd be surprised at how many students post assignments on boards and are literally just given answers.
>>
>>55626669
>exit(printf("error: %s is not a valid term name\n", name));
I know that is "correct", but that is a really strange way to do that.
>void deleteTerm(term** newTerm){
You don't really seem to be using the second level of pointer at all. You could get away with this being 1 pointer.
>for (int i = 0; i < numArgs; i++){
>iter = &((iter -> args)[i]);
That doesn't seem correct.
Why don't you just do
for (int i = 0; i < iter->numArgs; i++) {
deleteTerm(iter->args[i]);
}

?
>>
>>55626758
that's pretty cool. I was going to do an English double but then I realized I just liked reading books and not writing about them.

yeah I'm doing EECS and math

>>55626281
i've used matplotlib to make plots like that in the past. I'm sure R or Julia could do it too.

>>55625158
read learnyouahaskell

>>55624619
not sure what your question is exactly, but as a computational context, I believe applicatives "try all the combinations" in lists. If you think about a list as a nondeterministic computation, the applicative style will give you all the possible branches. The other way is with ZipLists where you just go across each list.
>>
>>55626829

>not using second level of pointer

You pretty much have to in C or else you can't modify the pointer inside of a function and see the change outside.
>>
>>55626868
I know. You're not modifying the pointer though.
At no point is there a
*newTerm = something;
statement.
>>
>>55626829
>I know that is "correct", but
>You don't really seem to be
>You could get away with this
>That doesn't seem correct.
>Why don't you just do

you are a pedantic fuckwad and I hate people like you

stop worrying about what doesn't matter, see the forest for the trees and realize that your pointless search for perfection is a fool's errand based in self-doubt, ignorance, and fear.

don't even think of replying to this.
>>
>>55626926
(You)
He obviously seems to be learning and I didn't want to impose my views on him strongly, so I made everything half-assed suggestions instead.
>>
>>55626878

There will be in other functions.
>>
>>55623783
If you don't watch this you have no right to ever advocate for any programming paradigm ever again
https://www.youtube.com/watch?v=QM1iUe6IofM
>>
When is a piece of code good enough to warrant you putting it in your portfolio and/or recording it on Github?
>>
hey /g/, help me find a way to kill myself painlessly and without even knowing I'm dying.
>>
>>55627487
>hey /g/, help me find a way to kill myself painlessly and without even knowing I'm dying.
Learn Java
>>55627487
When it runs
>>
>>55627487
post it here, we'll let you know

>>55627505
>>>/adv/

>>55627474
>hurrdurr OOP vs FP what is scala
>>
>>55627552
> When it runs

Also when you check it for memory leaks and comment it properly
>>
>>55627575
>when you check it for memory leaks
That's the job of the GC.
>>
I collect VHS tapes, CEDs, Beta tapes and Laserdiscs...and tube TVs...
>>
is there a multiplatform way to do networking in C++.

Like sockets but multiplatform(win,linux,osx)
>>
>>55627487

When you're not scared about putting it as part of your resume.
>>
>>55627734
I don't use a GC.

>>55627828
libuv?
>>
>>55627828
sockets are multiplatform

they are THE platform for networking
>>
>>55627845
they dont work for windows though do they
>>
>>55627855
they do tho
>>
File: 1457146192804.png (80 KB, 226x208) Image search: [Google]
1457146192804.png
80 KB, 226x208
>>55623304
This core dump error is driving me nuts. I've tried to reduce my step sizes, commentize part of my code or optimizing it but it still shows up right before the last step size is done running.
>>
>>55627865
wheres the header file

Is it the same header across all platforms or
>>
>>55627921
step size is 1, no? are you referring to gdb? do you know which line it segfaults on?
>>
>>55627921
compile with debug symbols, attach to gdb and run "bt full"
>>
unicode driving me crazy

why can't windows have an option to install more valid symbols to its command line ffs
>>
>>55628106

Windows makes nothing easy and will attempt to be it's own special little snowflake in most cases.

Microsoft wants to keep their tyrant monopolies.
>>
Working on token based authentication.
package token

import (
"math/rand"
)

const (
size = 2048
)

var (
chars = []rune{
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
}
)

func New() string {
var t string
for i := 0; i < size; i++ {
t += string(chars[rand.Int() % len(chars)])
}
return t
}
>>
did anyone here take the computer science 101 course online at harvard. it streams on youtube.
>>
idea: to compress text size of long books, replace the most common words with 000-999 numbers

yeah?
>>
https://redraster.itch.io/chess-clock

https://redraster.neocities.org/products/chess_clock.html

https://redraster.neocities.org/

which one of you guys...
>>
>>55629475
Do you honestly think even most basic compression algorithms don't do this?
>>
>>55629475
Simpsons did it: https://en.wikipedia.org/wiki/Huffman_coding
>>
File: DCT.jpg (88 KB, 256x256) Image search: [Google]
DCT.jpg
88 KB, 256x256
>>55629475
congrats, you figured out how compression works

JPEG works in a similar manner, but instead of words, it uses chunks


try reading up on it. it's interesting
>>
>>55629638
JPEG does so much more. Even your picture is completely unrelated to what he wrote.
>>
When will ghc-mod for ghc 8 be on cabal?
>>
>>55623327
In Harvard we started with C
>>
Database stored procedures or post processing the data in php?
>>
File: 1455596028755.jpg (8 KB, 265x265) Image search: [Google]
1455596028755.jpg
8 KB, 265x265
>>55630094
>php
>>
>>55630094
depends what you need the data for innit
>>
>>55630118
Why does it depend?
>>
>>55630094

Stored procedures just mean fucking around with a database outside framework, and better yet, putting load on the database server instead of the easily scaled frontend.
>>
im writing a gps spoof thingy for pokemon go
basically the user visits a website hosted by me that allows him to choose and update his gps coordinates using a joystick or rawcoordinates
the server then provides an API to fetch said coordinates

now i just need to figure out how to let the user point his GPS service towards my webserver
>>
>>55623327
At my university they teach us Java which makes up about 1/4 of our course and didn't fucking bother to teach us C one bit even though it makes up 1/2 of the course.
>>
Why do people like templates? Why do they not do real metaprogramming using a good metaprograming framework?

It makes no sense.
>>
>>55630272

Yeah universities are pushing the Java / C# grunt work hard.. The day java starts going the route of cobol can't come soon enough.
>>
>>55630304
Why do people think parametric types are metaprogramming?
>>
>>55630313
It'd still make more sense to me if they taught us C and expected us to put in work to learn Java, since C makes up a majority of the course.

It doesn't help that Java clicked with me straight away and I struggle like a retard with C.
>>
>>55630322
Well templates are more than that.
If that was all they were then I'd be fine with it. They'd be constrained to a very simple use case. But instead we have an incredibly weird syntax for a (to my knowledge) complete meta-programming language.

Of course as soon as you have to do a lot of type specialization you've pretty much ruined the metaprogramming part.
Which happens in a lot of cases.
>>
>>55630304

There are very few people who truly enjoy c++'s template system. It's a convoluted and horrible language within a language.

>>55630326
What exactly makes you struggle with c? I doubt that you're doing too much pointer / cast magic in a introductory course.
>>
>>55630252

what technologies are you using to build that ?
I can help you for free if you want
>>
>>55630346
Structs were one thing that didn't make sense to me (mainly because one of our lecturers seems to tell one group one thing and another group another, even though we're split up purely alphabetically). There was also something to do with user input and my lecturer wanted to lynch me for using atoi().
>>
>>55630346
>There are very few people who truly enjoy c++'s template system.
Yeah. I was hoping this.
Why do you see them used everywhere when you could easily just write something yourself? Boost even has something. I haven't looked at it but I'm quite confident it's more convenient than templates.

>>55630326
>It doesn't help that Java clicked with me straight away and I struggle like a retard with C.
Well it's about understanding objects vs data then most likely.

Stop thinking about things as objects.
Also my university started with C and quickly went to C++. It's not much better to go into C++ but the C start was important.

What bothers me is that they decided to try and brainwash us with OOP and how we're supposed to try and make an effort to use all C++'s features when we can.

It's like we weren't there to learn. They wanted codemonkeys who can write c++ code just using the standard library.
>>
>>55630389
To be honest I don't think we've gone that far into objects this year for it to be an understanding issue like that.

Some of C's syntax just seems odd to me too. I think I just need to dive into the K&R book properly to understand why you sometimes slap an asterisk in front of something and sometimes you don't.
>>
>>55623304
I am aspiring programmer, I am however jobless and with no working experience.

I will help with anything for FREE as long as I get some kind of credit for the project you are working.

I like C++, javascript (and all the shit that goes with it), Can work with Java and C# too but I dont prefer it, only if its necessary. Also Python and few of its shit, for small or fun projects not labeled as "enterprise quality code" .
>>
>>55630380

Structs are just a group of types set sequentially in memory under a name.

>>55630389

The boost library is biggest collection of advanced template abuse in existence.

C++ Templates are almost literally implementing a lisp / functional dialect to generate c++ code at compile time.

>>55630409

& is a reference it means your passing the variable itself rather than a copy to the function.

* declares a pointer (Variable that holds a memory location to some type of data). You also use the * to dereference a pointer dereferences (Access the value at the memory location)
>>
>>55630472

Meant to type that last part as a definition.

Dereference (Access the value at the memory location)

Tiredness is killing my typing ability.
>>
File: ecCe519.png (3 KB, 576x23) Image search: [Google]
ecCe519.png
3 KB, 576x23
Write("Insert size as space seperated integers X Y: ");
int[] input = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
Random rand = new Random();
Array vals = Enum.GetValues(typeof(KnownColor));
using (Bitmap bmp = new Bitmap(input[0], input[1]))
{
for (int i = 0; i < input[0]; i++)
for (int j = 0; j < input[1]; j++)
bmp.SetPixel(i, j, Color.FromKnownColor((KnownColor)vals.GetValue(rand.Next(vals.Length))));
bmp.Save($@"C:\img_{input[0]}x{input[1]}.png", ImageFormat.Png);
}


I got so bored just sitting here not working on anything that I quickly threw this together and passed in 10,000 x 10,000.

Who /boredom/ here?
>>
>>55624513
that's a retarded blanket statement, /g/oy
>>
>>55630409
>To be honest I don't think we've gone that far into objects this year for it to be an understanding issue like that.
Well the thing is C isn't an object oriented language. With Java you associate functions to data
public class Vector2{
public float x;
public float y;
Vector2 Add(){}
Vector2 Multiply(){}
...
}

In C you can't do that. A struct is a collection of data. It's a way of abstracting so you don't have to type so much.
struct Vector2{
float x,y;
}
//Now we can just say "Vector2 direction;
//direction.x=0.0f;
//direction.y=1.0f;
//and pass this combined variable around.

I don't see how there can possibly be any confusion.
>Well that's rather simple.

>>55630441
Contribute to github projects. Fork them, add a feature, make a pull request.
>>55630472
>The boost library is biggest collection of advanced template abuse in existence.
I'm aware. But for people who use templates they wouldn't care right? And it offers them more easy to reach functionality in the Boost.MPL. Yet they insist on their own template use, which doesn't make sense to me.
>>
>>55630304
Templates are lovely.
Thread replies: 255
Thread images: 28

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.