[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: 340
Thread images: 36

File: computer science.gif (2MB, 320x240px) Image search: [Google]
computer science.gif
2MB, 320x240px
What are you working on, /g/?
>>
>>56938791
First for thank you based mods
>>
dont test my autism janitor
>>
>>56938791
That'll do, kid.

Shame you missed the link to the last thread:
>>56932599

Working on a Xamarin app using Azure Mobile App as the backend.

Trying to figure out if I want to keep sucking on that Microsoft teat.
>>
first of all the other threads were perfectly acceptable
>>
File: b2d.png (21KB, 1366x672px) Image search: [Google]
b2d.png
21KB, 1366x672px
Dunno why old thread got deleted when this one has no posts but cont. for my Box2d editor
>>56938718
Yeah sure I can explain more. If you've ever seen RUBE (Really Useful Box2D Editor) I'm basically trying to clone that as much as possible for fun and usefulness. Box2D if you don't know is a 2d physics simulation engine and my goal is to create an editor for it so you can easily import complex shapes and environments with it. My endgame is to implement the joint feature and write loader code for c++ and be able to load in ragdolls, and animate them with machine learning.

So far in my editor I've got full undo/redo, and mostly everything done except the polygon drawing and joint tools. Right now I'm struggling with making the scaling and other tools more complicated, with options to input scaling/rotating coordinates and lock transformation on one axis.
>>
File: akari eats chippus.png (131KB, 256x256px) Image search: [Google]
akari eats chippus.png
131KB, 256x256px
Still working on akari-bbs!
I'm adding support for threads and boards!

https://github.com/microsounds/akari-bbs/tree/thread-mode
>>
to answer that anon from the other thread: just textbook algorithm stuff. i am trying to spice it up by writing everything up and making some visualizations but i'd rather be doing other stuff

>>56938784
get a screengrab of her in game dev girls that should be on-topic right

>>56938791
comfy lectures
>>
>>56938847
Nobody wants K-shit in their thread
>>
>>56938880
I do
>>
where is irene
>>
>https://www.youtube.com/embed/ftQfpAeyxPo

It hurts. "the rust community" is one of the most cancerous things out there.
>>
>>56938887
someone got mad, no pretty girls allowed
only code
>>
>>56938884
Sucks to suck, you've been relegated to your own containment thread on /mu/
>>
Friendly reminder that you're guaranteed a job in silicon valley if you're mentally ill.

https://www.youtube.com/watch?v=ftQfpAeyxPo
>>
>>56938847
I'd prefer hime to kpop shit, and I fucking hate anime
>>
>>56938887
triggering some trans/lgbtq sjw janitor
>>
>>56938889
>>56938896
So that's a guy, right?
>>
>>56938924
probably the janitor
>>
>>56938924
I can't even ... did you just assume its gender?
>>
I have an embarassingly stupid question to ask, anyway...:

the way to obj initialization is

// In source packet in file init/ex2/CoffeeCup.java
class CoffeeCup {
// Constructor looks like a method declaration
// minus the return type
public CoffeeCup() {
// Body of constructor
}
// ...
}


why just "public className()"
instead of "public void className()"?
>>
>>56938893
Koreans aren't attractive and their shitty music is cancer.

Koreaboos are probably the one thing I hate more than anything else in this world.
>>
>>56938924
Yes.
And he was hired by stripe.
And he cannot code or stand up straight when talking.
>>
Doing some HackerRank/Project Euler assignments

Also, nth for Java being okay
>>
>the x community is y
what the f*ck does this have to do with programming?

I wouldn't want to hire him he'd probably spend all day on some community website.
>>
>>56938945

Because constructors are special.
>>
>>56938945
You're returning an object of the class with the constructor. You don't return anything with void methods.
If your example is Java, you can get a coffee cup with
CoffeeCup cup = new CoffeeCup()
>>
>>56938945
Because the constructor does not return.
>>
>>56938791
Any of you know some good books on programming abstractions and achieving maximum efficiency?
>>
>>56938992
effective c++
>>
>>56938791
anyone know what lecture this is? or have a link?
>>
>>56938958
java is fine it's just extremely verbose
>>
>>56938977

Prefer

CoffeeCup.getInstance();


:^^^)
>>
>>56939005
https://www.youtube.com/watch?v=2Op3QLzMgSY
>>
>>56938319 (Cross-thread)
>the one in the top right is wrong
???
See pic.
>your annotations of the field are very close in some cases
Only thing that matters is that the annotated pixel belongs to a segment that's mostly field. I'll give my groundtruth data another check but I think I stayed pretty consistent. In any case 1-2 segments with the wrong annotation label shouldn't really matter given the number of segments I annotated (around 5000).
The problem with red players isn't that they're being classified as field by the SVM; it's that the segmentation algorithm can't distinguish them from the green background for some reason (something that my annotations don't influence).
>>
>>56939005
watch it now
>>
>>56939015
thanks BUD
>>
>>56939012
>he doesn't write a factory class to construct his objects
shiggy diggy...
>>
>>56939031
>Factory classes
>He doesn't use HKFs
>>
File: 1474736301657.jpg (50KB, 500x714px) Image search: [Google]
1474736301657.jpg
50KB, 500x714px
I have been writing SAS for over a month now, I really don't like the language. Anyone else here who has to program in a joke language from the pre C days?
>>
>>56939051
you just made that up
>>
>>56938998
I'm a little scared of C++ because my path in learning to program has been a bit unusual and messed up, is this accessible for someone who isn't familiar with C++/Java-type languages?
>>
>>56939053
Fortran is quite comfy desu
>>
>>56939071

No I didn't.
>>
>>56939051
>He doesn't call his CoffeeCupFactory Microservice via a CofeeCupProxy
>>
>>56939053
Not pre-C, but I do plenty of maintenance on VB. That qualifies as a joke, I'm fairly sure
>>
so, what do you do when your life is a disaster, when you don't know what to do, when your projects are complete shit, when you tell other people you can make programs, but have little to show, when you are scared of having a job because you feel like a dumbass, when you are a 30 y.o. NEET that doesn't even like being a NEET, but has no idea wtf to do with his life?

>>56938951
>Koreans aren't attractive and their shitty music is cancer.
THIS
koreans are ugly, why do people even think they are "cute"?
>>
File: 1451065672589.gif (2MB, 500x282px) Image search: [Google]
1451065672589.gif
2MB, 500x282px
>>56939102
I feel your pain

I had to touch JCL last week and don't know if I like computers anymore.
>>
>>56938852
hey you shitter
at least separate those html templates into header files or something
>>
>>56938889
I'm so glad I posted that video last night
>>
File: woo.jpg (2MB, 2730x4096px) Image search: [Google]
woo.jpg
2MB, 2730x4096px
gooks built your phone show some respect
>>
>>56939111
WEB DEVELOPMENT
>>
>>56939145
The way I have header files now, they're being used by multiple .c files.

Also, some of my html templates are printf format strings, so I can't do that.
>>
>>56939111
>Koreans aren't attractive
The plastic ones are. They're specifically engineered to be attractive.
>>
>>56939111
I thought at first it was just weebs trying to avoid the stigma, but apparently real people have started to take the Koreaboo meme seriously.
>>
>>56939173
>The way I have header files now, they're being used by multiple .c files.
So?

>Also, some of my html templates are printf format strings, so I can't do that.
Write a simple template system then.
>>
if im not busy i hate myself

what language makes me do the most busy work?
>>
>>56939209
Assembly
>>
>>56939197
If I declare const char arrays in a header file, it'll produce multiple declaration errors in every file that includes that header.

Also, I don't know what that is.
Could you provide an example?
>>
>>56939209
I'd say C since it's all about reinventing the wheel.
>>
>>56939230
https://en.wikipedia.org/wiki/Include_guard
>>
>>56938791
so i got to do a java course to get a degree, could anyone tell me why the setType method doesnt work? probably not what this thread is for but it would be nice

http://pastebin.com/5VQn9Sri

i did exclude some methods i didnt find necessary, but yeah i might be wrong. Feel free to throw shit at me
>>
>>56939250
you defined the method outside of the class, this isn't even legal Java syntax.
>>
>>56939230
>If I declare const char arrays in a header file, it'll produce multiple declaration errors in every file that includes that header.

Then use the extern file and have one source file that defines the templates and link with each module? I'm sure there's a way around this in C.

>Could you provide an example?
Look up what Jinja2 is for example, something in that vein, except much simpler for your purposes.
>>
>>56939250
think carefully about what || means. on either side of this thing should be a boolean
>>
>>56939262
yeah the ordering is wrong, it is inside the class. I just threw it at the top of the pastebin to highlight it.

The problem seems to be with the if statement, but i dont know why the or (||) statement isnt working
>>
>>56939263
>Then use the extern file and have one source file that defines the templates and link with each module?

I'd rather not have html markup strewn around everywhere.

Also that template stuff sounds like a project in and of itself.
I'm fine with static headers right now. When my needs change, I'll generate them dynamically.
>>
>>56939230
>multiple declaration errors in every file that includes that header.
Nani?
>>
>>56939324
#ifndef DATABASE_H
#define DATABASE_H

const char *str = ":^)";


gcc -o board.cgi obj/board.o obj/database.o obj/substr.o obj/query.o obj/utf8.o -lcrypt -lsqlite3
obj/database.o:(.data+0x0): multiple definition of `str'
obj/board.o:(.data+0x10): first defined here
collect2: error: ld returned 1 exit status
makefile:23: recipe for target 'board.cgi' failed
make: *** [board.cgi] Error 1
>>
>>56939286
for strings shouldn't you use .equals()?
>>
>>56939278
I guess that makes sense, but I don't really understand how it works. Do I do a long ass "else if" statements with type.equals(String) then? Warrior and mage are only two of the options I want to be valid
>>
What should you put in your CV? Do things like "I know Python fairly well" and "I know my way around git" belong in there?
>>
I added specular lighting to my raytracer
>>
What should you put in your CV? Do things like "I know screwdrivers fairly well" and "I know my way around toolboxes" belong in there?
>>
>>56939371
I tried that, and it works for a single String, but I don't know how I can make more than one String viable as a type

I want setType to have 2 valid String outcomes, and everything else unspecified.
>>
>>56939430
something like:
this.type = "unspecified"
if (type.equals("Warrior") || type.equals("Mage")) {
this.type = type
}
>>
>>56939379
Include any language you can recognize on sight, and any tool you've ever read about.

The point of a CV is to not get filtered out by automated recruiting software.
>>
>>56939466
If you don't want to get grilled on something, don't put it on your resume.
>>
File: c program.png (3KB, 563x118px) Image search: [Google]
c program.png
3KB, 563x118px
Critique this C program.
>>
>>56939447
Ah right, should have thought of that. Thanks!
>>
>>56939477
I got grilled on Javascript prototypes once. I've done a couple of projects in JS too, and apparently I've used them too, but I still don't understand what prototypes are.
>>
>>56939379
See >>56939418
>I know my way around toolboxes
jej

"fairly well" and "know my way around" are dumpster fire adjectives that don't necessarily imply a certain level of skill but try to imply any level of it anyway. One thing people like to do is attach actual position levels to their skills, such as "junior python programmer" (scripter, what the fuck ever, not like HR drones care so long as their mental checklist item is ticked) to demonstrate that they're novices but still able to function alongside their betters.

If you know a language, you better fuckin' know that language on sight.
>>
>>56939430
>I tried that, and it works for a single String
It isn't working like you think its working, NEVER use == or != to compare Strings, ALWAYS use String.equals(String).

String == String is not checking if the two string values are equal, it is checking if the two strings are in the same place in memory.
>>
>>56939494
I give it a strong 5 to a decent 6.
>>
>>56939494
why format string
why stdlib
>>
>>56939494
>#include <stdlib.h>
>using printf instead of puts
3/10
>>
>>56939544
Makes sense. Thanks for taking the time helping the slightly retarded.
>>
>>56939579

puts is bad.
>>
>>56939592
>
>>
>>56939592
is it? why?
>>
>>56939592
If puts was so bad, why is it there bub?
>>
>>56939075
Don't worry about learning optimalisation techniquesif you're a novice. Start with getting your basics right.
>>
>>56939653
>>56939633
>>56939605

It's getting deprecated.
>>
>>56939653
exactly, this is why I always use gets
>>
>>56939668
>
>>
>>56939676

How would you rate my shitposting today?
>>
>>56939685
improvement needed
>>
>>56939685
PHP_INT_MIN
>>
>>56939685
shart in mart
>>
>>56938791
Reading my first book.
Never learned from a book before. Book is pretty good
>>
>>56939760
Once I discovered books I understood why they taught us reading in school.
>>
>>56939494
why a format string ?
printf("...\n"
"...\n");
>>
>>56939530
It's easier to explain with ES6 because you can explicitly cast the prototype with __proto__, but prototypes on the whole aren't too hard to understand. The prototype basically just means the object that another object inherits attributes from.

In Javascript everything is an object, so you can think of it like a chain of inheritance that begins with Object.prototype. If you cast an object literal or a new Object(), it'll share the attributes of Object.prototype, which is the only object that won't inherit anything. Otherwise, it'll inherit its prototype and attributes from the constructor you call (new Array() will have Array.prototype, new Namefag() will have Namefag.prototype and so on). If you add or change attributes to the Namefag object, it'll add or change the attributes for all the objects with its prototype as well.
>>
>>56939760
I'm surprised at how effective books are for programming. I thought they wouldn't be a good way of learning for some reason.
>>
>>56939804

Because.
>>
How do you split the source code of a project into multiple subdirectories when you're using autotools/automake?

I want to build a binary in the src directory, but for manageability I would also like to put some files in src/subdir

src/Makefile.am looks like this:
SUBDIRS = subdir
bin_PROGRAMS = foo
foo_SOURCES = main.cpp One.cpp
foo_CFLAGS = ...
foo_LDADD = ...


src/subdir/Makefile.am looks like this:
bin_PROGRAMS = foo
foo_SOURCES = Component1.cpp Component2.cpp
foo_CFLAGS = ...
foo_LDADD = ...


This doesn't compile though, because make looks for a main in src/subdir as well.

So how do I move some files into a separate subdir properly?
>>
>>56939926
If you insist on complicating matters by adding subdirectories within src/ and include/ you're gonna have to work harder to script it.

Things are much easier when you use wildcards and filter-out to do everything without updating your dependencies manually.
Just give the names of the executables you want.
>>
>>56939926
Just let cmake handle it
>>
>>56939822
Okay that makes sense. I also found a page that explains it the way you do.
>>
Why does no one care about the c standard updates?
>>
>>56940198
I had to maintain some pre ANSI C this week.
Be happy when you get ANSI C, don't expect more. Just use C++ desu
>>
>>56940007
How do I typedef the name of a class element?
For example if I want to change the value of SDL_Pointer in w and h instead of x and y?
If I do
typedef SDL_Point S;

I can rename the whole class, but how do I change S.x and S.y in S.w and S.h?
>>
>>56940214
What's wrong with pre-ansi C?
Zero type-checking is really comfy.
>>
>>56940198
What do you mean by this?
>>
File: kött svett.jpg (162KB, 1280x800px) Image search: [Google]
kött svett.jpg
162KB, 1280x800px
>tfw constraint logic programming to solve scheduling problem
Feels like magic desu
>>
File: 1443738621478.jpg (353KB, 1000x1000px) Image search: [Google]
1443738621478.jpg
353KB, 1000x1000px
>>56940228
typedef struct 
{
int w;
int h;
} MY_Point;
// ...
MY_Point p = {1, 2};
SDL_Point sp = (SDL_Point) p;
>>
>>56940304
typedef your_point my_point;
>>
>>56940315
That's a) true and b)
#define true false
>>
>>56939250
You guys helped me last time, so I thought why not shoot you another one.

http://pastebin.com/n5EixUKL

Would it be possible to create a method that would check if any of the String inputs were empty?

A simple yes or no would do, I'm just curious if its possible. Would be nice with a pointer or two though.
>>
File: 1475520103536.jpg (75KB, 463x768px) Image search: [Google]
1475520103536.jpg
75KB, 463x768px
>>56939075
Yes.
The learning curve will kill you or cure you.
Enjoy your wild ride, pilgrim.
>>
File: 1475525163207.jpg (26KB, 350x317px) Image search: [Google]
1475525163207.jpg
26KB, 350x317px
>>56940361
How about you do you own homework... ya know... fer a change?
>>
>>56940361
Maybe
>>
>>56940361
Maybe in Java 9.
>>
>>56940388
I mean that is not actually in the task, I just got curious.
>>
File: 1474054311810.jpg (26KB, 400x462px) Image search: [Google]
1474054311810.jpg
26KB, 400x462px
>>56940315

using someType_t = oldNastyShitNobodyLiked_t;
>>
I got a job where they think I know how to code but I just know how to do basic HS shit, how do I learn java effectively in a week
>>
>>56940424
Then yes.
You using stl or old broken bs?
>>
Hi, all! Some of you might remember me as the guy learning Excel VBA who doesn't understand arrays. I would be tremendously grateful if someone could explain to me what I'm doing wrong.

Summary: Trying to input the values of the range A1:E5 from three separate worksheets into a three-dimensional array. I have to use nested For/Next loops, so unfortunately, if there is a more efficient way (which I'm sure there is), I can't do it. Then, I display the results in a fourth worksheet. Am I copying the array wrong, am I displaying it wrong, or both? The compiler says the display line is the incorrect one, but I have a feeling I'm probably doing the WHOLE program wrong.

Dim myArray(1 To 5, 1 To 5, 1 To 3)
Dim x As Integer
Dim y As Integer
Dim z As Integer
For x = 1 To 5
For y = 1 To 5
For z = 1 To 1
Sheets("Challenge 5a").Cells(x, y).Value = myArray(x, y, 1)
Next z
For z = 2 To 2
Sheets("Challenge 5b").Cells(x, y).Value = myArray(x, y, 2)
Next z
For z = 3 To 3
Sheets("Challenge 5c").Cells(x, y).Value = myArray(x, y, 3)
Next z
Next y
Next x
Sheets("Challenge 5d").Cells().Value = myArray(x, y, z)


Again, I am very stupid, so sorry about wasting people's time.
>>
File: 1473973300548.gif (154KB, 400x400px) Image search: [Google]
1473973300548.gif
154KB, 400x400px
>>56940444
First you put your head under the front of a bus wheel.
Then you wait for a sudden surprise.
>>
>>56939053
Assembly
>>
>>56940361
isEmpty() checks if a string is empty ("", length == 0)

https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#isEmpty()

So if you do
new Item("sword", "", "", 100, 100);
, the arguments description and Action are empty (empty strings)

do you mean a constructor for Item where you don't need to supply all the arguments? You can define more than one constructor:
public Item(String name, String description, String action, int value, int weight) {
this.name = name;
this.description = description;
this.action = action;
this.value = value;
this.weight = weight;
}

public Item(String name, String description, int value, int weight) {
/* call the other constructor with a default value for action since it is not supplied */
Item(name, description, "Default Action", value, weight);
}
>>
File: 1470619935546.jpg (132KB, 1155x684px) Image search: [Google]
1470619935546.jpg
132KB, 1155x684px
>>56940479
Yes.
I recall you.
You didn't wash your hands after visiting the shitter.
I never liked you.
I refused to sign your birthday card as it came around the office.

Who are you again?
>>
>>56940456
Fairly confident old broken bs is the right answer. In the course I'm doing we're basically doing everything through BlueJ.
>>
>>56940479

Wait, sorry, the last line was supposed to be:

Sheets("Challenge 5d").Range("A1:E15").Value = myArray (x, y, z)


Which is still wrong, but just whatever.
>>
>>56940361
You can't iterate through individual parameters in Java, but you can create a method that takes a variable number of strings, like this (sorry for the shitty intending, I wrote it in the reply box)
private boolean allNotEmpty(String... strings) {
for (String str: strings) {
if (str == null || str.isEmpty()) {
return false;
}
return true
}
}
[/code[

You can use it like
if (isAllEmpty(name, description, action)) {...
>>
>>56940538
Sorry for the fuckups, the method should ofc return trueafter the loop
>>
>>56940484
>>56940444
ok I'll be more specific, where can I see basic/advanced syntax of stuff you can only do with Java and not C or C++
>>
>>56940444
Learn the String, Regex, Math, and most of the abstract objects in the util APIs and then the syntax should come to you
>>
>>56938791
How do I format C# files in Visual Studio 2015? Control+D, Control+K does not work. Windows 10. My files are a mess.
>>
What do you guys listen to while coding?

I've had this on loop for a few hours now and I've never written as beautiful code as today.
https://www.youtube.com/watch?v=-rSW74L-XMA
>>
>>56938896

I would fuck her right in the asshole.
>>
>>56940822
Format them? I assume you format your code while you type it, right?
>>
>>56940838
japanese schoolgirl music from 10 years ago
https://www.youtube.com/watch?v=4tzOyIuhB1g
>>
>>56940838
I was listening to undertale music last night because I didn't have any music on my computer, and it was the first thing I could think of. Some were pretty good, some sucked.
>>
>>56940838
https://vimeo.com/66226198
>>
>>56940838
http://rainymood.com/
>>
>>56940878
Eat a dick asshole.
>>
>>56940838
strictly gooks https://youtu.be/WJua7KEP_oE
or the sounds of js frameworks being born https://github.audio/a
>>
>>56940880
oh wait nevermind, this is some "official" gimped version from the label

fuck them
>>
what can u do with lisp?
>>
>>56940892
muh nigga, Discovery a goat, but RAM is not bad either
>>
>>56940899
Is your code written in an XML file or something?
>>
File: file.png (231KB, 740x220px) Image search: [Google]
file.png
231KB, 740x220px
>>56940921
>>
>at a talk
>slide has xkcd
>leave the room
>>
>>56940930
No I'm copying and pasting and editing like a 100 different files and it doesn't come out perfect every time, so I need to format. You people are insufferable cunts.
>>
File: 1444610440574.webm (827KB, 872x618px) Image search: [Google]
1444610440574.webm
827KB, 872x618px
>>56938852
I was bored so I made a custom CSS
>>
-module(fizzbuzz).
-export([fizzbuzz/0]).

fizz({A, B, C}) ->
if A == true ->
io:format("fizz"),
{false, true, false};
B == true ->
{false, false, true};
C == true ->
{true, false, false}
end.

buzz({A, B, C, D, E}) ->
if A == true ->
io:format("buzz"),
{false, true, false, false, false};
B == true ->
{false, false, true, false, false};
C == true ->
{false, false, false, true, false};
D == true ->
{false, false, false, false, true};
E == true ->
{true, false, false, false, false}
end.

fizzbuzzA(0, A, B) ->
io:format("~p: ", [0]),
fizz(A),
buzz(B),
io:format("~n");
fizzbuzzA(N, A, B) ->
io:format("~p: ", [N]),
NA = fizz(A),
NB = buzz(B),
io:format("~n"),
fizzbuzzA(N-1, NA, NB).
fizzbuzz() ->
fizzbuzzA(60, {true, false, false}, {true, false, false, false, false}).

am i doing it rite
>>
so what's oop about
unifying structs and functions?
I can do that I c by using headers
>>
>>56941059
no it's about encapsulation
>>
>>56941059
>so what's oop about
Buzzwords, snake oil, more buzzwords.
>>
>>56941009
If you're copy-pasting so much, it might be easier just to put the functionality you keep copying into a function. I don't see another reason to copy paste so much.
>>
>>56941022
I can see my post!
>>
>>56941059
Well, it makes some programmers very happy that they don't need function tables if they want to create classes in a real language
>>
>>56941059
>so what's oop about
It's all about syntax sugar.
>>
>>56941059
>so what's oop about?
Creating more programming paradigms to make your language look more... functional
>>
>>56941059
magic
>>
>>56941090
/r/iamverysmart

I am building pages, not a fucking function you retard.
>>
>>56941175
Ohayou, reddit.
>>
>>56941175
Templates. It's the same thing.
DRY
>>
What's the C# equivalent of a java thread executor pool?

>>56941175
If you're building 100 similar pages, look at Spring(or any similar library) and page templates... Especially if you're executing code on them.
Hell, if you're executing code on pages then your library likely already allows for templates, or you don't actually have to have a copy of your code for every single page. There is 0 reason, ever, to copy code that much.
>>
File: 17-lights.jpg (76KB, 550x599px) Image search: [Google]
17-lights.jpg
76KB, 550x599px
I have a problem /g/

I have multiple buttons on a single page scrolling website that are hidden until they are moused over. I have to click each of these buttons are it is too tedious to do this manually (they number in the hundreds).

Also note, that I have to log in onto the website to access these data. How would someone go about writing a script to mouse over and click each of these buttons?

Would curl be an option? I'd prefer that as I am on loonix so yeah
>>
>>56941241
Maybe try something like Mechanize on Python.
>>
>>56941241
Are the buttons CSS-hidden, or are they actually non-existent until onMouseOver? If it's just CSS then grab them with JQ or something similar and just .click() it
>>
>>56941175
>/r/
Don't do that.
>>
Java and C++ are the only worthwhile languages.

C++ because it's the fastest and lightest when written competently.

Java because it is extremely simple and powerful, and runs anywhere with a JVM.
>>
>>56941351
faggot
>>
>>56941351
t. second semester comp sci student.
>>
Is Haskell really THE entry language to FP or is there something else?
How's Elm?
>>
>>56941411
Scheme is very nice for learning FP.
>>
>>56941411
OCaml. Elm is a simpler version of standard Haskell, it's actually halfway between ML and Haskell.
>>
>>56941365
>>56941376
butthurt rustfags

Java & C++ runs the world.
>>
Anyone else have trouble with confidence?
I can't be proud of my work at all.
>>
>>56941577
no, I'm extremely proud of my code
perhaps you need to git gud
>>
File: test.png (91KB, 510x510px) Image search: [Google]
test.png
91KB, 510x510px
>>56938791
playing around with images. Very basic images.
>>
>>56941606
What language?
>>
>>56941411
haskell isn't remotely entry-level FP

scheme and ocaml are both good recommendations
>>
ok so im trying to make a algorithm for generating pseudorandom numbers. Problem is, im no good a java or programming in general.

I have this... (pic related)

and want to get to where i input the values for seed one (semilla1) and seed 2 and multiply them together, get a result from that result get the middle 4 numbers from the numerical result and then multiply seed 1 by the new generated number for N amount of iterations.

how solve?
>>
>>56941610
C
>>
>>56939494
what font / colour scheme is this
>>
File: lelque.png (335KB, 1440x900px) Image search: [Google]
lelque.png
335KB, 1440x900px
>>56941632
pic
>>
>>56941632
Find the greatest fixed point of the bounded semilattice.
>>
>>56941648
Write your code in english, barbarian.
>>
>>56941267
what is Mechanize? I enjoy Python so this is interesting.

>>56941336
by onMouseOver, do you mean Javascript?

When I inspect, the class name is "ef-name-col" and there is also a react file ID.
>>
>>56941648
I always assumed that IDE's could translate stuff, so you could type Si(condition) for an if statment if you spoke spanish instead of learning the English word.
>>
File: 1438042389798.png (77KB, 606x475px) Image search: [Google]
1438042389798.png
77KB, 606x475px
>>56941648
>if(true)
>>
>>56941411
>Elm
>web
>runtime
you lost me there. is there a good fp language that doesn't need all that runtime shit?
>>
>>56941690
Every language needs a runtime.
>>
>>56941690
Yeah I looked at it awhile ago and it was pretty different.
oh well.
>>
>>56941698
that's wrong though. C only needs a very small runtime and if you remove a few functions from the stdlib then you don't need any runtime at all.
>>
File: test.png (43KB, 510x510px) Image search: [Google]
test.png
43KB, 510x510px
oops.
>>
What is it with Ruby and hipster web devs? Is it because of that Why book with the cartoon foxes?
>>
>>56941672
Mechanize is for python 2, so don't use it. Use python 3 and use requests.
>>
>>56941059
C-style "objects" don't allow for polymorphism. you have to use macros to implement templates/generics, typecasts and careful alignment to implement standard inheritance, and homeroll your own vtables to implement virtual inheritance. all of these things are absolutely fucking wretched, will introduce bugs and will not get you better performance since they're not first-class to the compiler and the compiler can't implement e.g. empty base class or type erasure

inheritance is often a meme and a mistake, but a good example of a concrete polymorphism problem in C is the generic sort code, which gets absolutely wrecked by the C++ sort (which itself is not even a very good sort). this is because the only way to implement a polymorphic sort in C is to pass around runtime void pointers to functions, which the C compiler absolutely cannot reason about. so you end up making a function call on every comparison, which is ridiculous
>>
>>56941717
What do you do with a C code that you can't run.
>>
Just left my job. I am officially NEET.

Where do you all look for remote jobs? Trying to work from home.
>>
>>56941750
odesk, elance, upwork or whatever it's called now
>>
>>56941738
>what is kernel development
>>
>>56941769
>kernel code doesn't run
wew lad
>>
>>56941672
If you inspect it, then go to the event listeners --> onClick, you should eventually be able to find some code which is presumably calling some AJAX somewhere. From there you can hopefully grab an endpoint that you can dump into python / curl / whatever.

Some sites don't want you to script anything, so the onMouseOver code could make an AJAX call which then populates the onClick. That's a defense mechanism though, I doubt whatever site you're targeting has anything like that.
>>
>>56941679
I can not stop laughing.
>>
>>56941750
What was your previous job?
>>
>>56941794
Janitor at Google.
>>
>>56941800
You're a cuck, moot.
>>
>>56941777
My point was that C code without a stdlib will run, and is how every kernel starts out.
>>
>>56941807
nyoro~~n :3
>>
>>56941861
Wow, even I'm not that big of a weeb.
>>
>>56941059
The problem with OO is that if you ask 10 different people you'll get 10 different answers.

The way I see it is that it "expands" possible operations and simplifies some common ones (like passing functions as arguments).

Applied too vigorously I think it's a bit of a meme (like with Javascript), although it can be very fun in its own way too.
>>
Is K&R still the best resource for learning C?
Should it be supplemented with anything?
>>
which one and why? Also, whats the difference?

A
def test():
a = another_func(10,20,30)
return a


B
def test():
return another_func(10,20,30)
>>
>>56941648
please explain, why are you doing everything you are currently doing
>>
>>56941648
I'm sorry but I cannot take this language seriously at all.
>>
>the more I program, the more I realize that everything in reality is exactly like a giant particle simulation
all hail the oversimulator
>>
File: lisp.jpg (38KB, 768x384px) Image search: [Google]
lisp.jpg
38KB, 768x384px
>>56941914
(defun test () (another_func 10 20 30))
>>
>>56941914
There is no difference, other than wasting cpu cycles with the extra assignment being done.

A proper implementation of the language being used will probably optimize the assignment away anyway.
>>
>>56941936
It's kind of scary desu.
>>
File: 1435347886410.jpg (581KB, 800x800px) Image search: [Google]
1435347886410.jpg
581KB, 800x800px
>>56941954
Why be afraid?
Think about it. If reality is a simulation, it's likely a particle one and not a human-centered one, and then these particles themselves have formed other computational systems (I.E. brains)
So then your mind, your brain, is running on a thread
What happens in a regular computer system to a thread after it dies? It gets reused again later.
>>
>>56941914
This is the difference.

>>> import dis
>>> def t1(): return another_func(10,20,30)
...
>>> dis.dis(t1)
1 0 LOAD_GLOBAL 0 (another_func)
3 LOAD_CONST 1 (10)
6 LOAD_CONST 2 (20)
9 LOAD_CONST 3 (30)
12 CALL_FUNCTION 3 (3 positional, 0 keyword pair)
15 RETURN_VALUE
>>> def t2():
... a = another_func(10,20,30)
... return a
...
>>> dis.dis(t2)
2 0 LOAD_GLOBAL 0 (another_func)
3 LOAD_CONST 1 (10)
6 LOAD_CONST 2 (20)
9 LOAD_CONST 3 (30)
12 CALL_FUNCTION 3 (3 positional, 0 keyword pair)
15 STORE_FAST 0 (a)

3 18 LOAD_FAST 0 (a)
21 RETURN_VALUE
>>>
>>
>>56941914
The first one with a better variable name, otherwise the second one.
>>
>>56941914
If that's python, another_func is allowed to return some serious bullshit that changes its value upon assignment / other conditions, so they could in theory operate differently.

In practice, if someone ever makes something that does that they need to be taken out and shot, so all you're doing is assigning a pointless local var
>>
File: ruby.png (66KB, 256x362px) Image search: [Google]
ruby.png
66KB, 256x362px
>>56941722
Ruby is a beautiful language but hipsters web devs only use it for Rails. Rails only redeeming qualities are based on its rapid development cycle compared to other frameworks. Thats it. Rails is more about shipping to market first and not about making a good web framework. Fuck Rails.
>>
I have a bunch of Cartesian points. What's the best way to find out the area that they cover?
>>
File: test.png (202KB, 500x500px) Image search: [Google]
test.png
202KB, 500x500px
>>56941718
this makes me feel really uneasy.
>>
>>56942044
Points don't cover any area. How are the points connected?
>>
How do I send a POST request to without a browser?
>>
nig
>>
>>56941794
I did web development, front-end and back-end. Back-end was Java.
>>
>>56942071
Open a socket to some server. Send a correctly formatted list of HTTP headers for your POST request. Get data back. Close socket.
>>
>>56942071
curl -x POST www.example.com
>>
>>56942116
 curl: (5) Couldn't resolve proxy 'POST' 
>>
>>56942069
At the moment they're just a bunch of points on a graph, I guess part of the problem is finding a way to connect them first before you calculate the area.

Is there a good method of calculating the concave hull of a bunch of points?
>>
>>56942163
Its suppose to be a a captial X. My bad. Lowercase x is for proxies
>>
>>56942044
I assume you want the largest possible polygon with only your points as vertices.

1. Heron's formula --> calculate size of a triangle
2. Use ^ to see if point D is inside the triangle ABC (look up how to do this, rather easy)
3. For every possible set of 3 vertices ABC:
3.1 if there are any points inside ABC, remove them
4. You now have the outermost rim that will make up your polygon
5. Reduce it to triangles and sum

(naive solution)
>>
File: 2016 10 05 18:35:27.png (23KB, 484x181px) Image search: [Google]
2016 10 05 18:35:27.png
23KB, 484x181px
Does anybody know where I can read up on good header file practices for C?

I know how a header file works and can make on, but I want to know whether I'm doing some things that may be good or bad practice.

pic is a quick snippet of what I have now.
>>
>>56942174
>concave hull
Is a concave hull really what you want? Wouldn't a convex hull make more sense?
https://en.wikipedia.org/wiki/Graham_scan
is a way of computing convex hulls.
>>
>>56942174
I literally Googled concave hull and got what you wanted.
>>
>>56942209
>typedef

lol
>>
>>56942225
I'm trying to work out the total area that a robot has covered. I could just use the convex hull but that wouldn't give me an accurate measurement if the room the robot is exploring is not a convex shape.

>>56942226
The main reason I posted the question here was to see if there was a simpler way to do it. Unfortunately there doesn't seem to be one.
>>
>>56942227
just wanted to try out typedef, I could've just used struct matrix but it doesn't matter either way
>>
>>56942306
I don't know exactly how the convex hull algorithm works, but you could give each point an area, say about the size of the robot so that each point is instead a circle. And maybe paint that to a bitmap and measure from there. It would give you an approximation, and if it's done while the robot is operating, it wouldn't be too computationally expensive.
>>
>>56941718
what did you do?
>>
In C, what exactly does fscanf return for the purposes of using it as a sentinel value in a while loop?

I'm trying to read data from a file, which is not the issue; but in outputting it to another file, I repeat the last value twice
>>
>>56938791
cross posting from /sqt/

so I'm looking to upgrade from my x220 for programming, looking at a macbook laptop around £600ish, will this be a good choice also do macbooks spy on me? do I need an apple account to use one?
>>
>>56942374
That could work, it would also give me a graphical output for the report. It shouldn't be too difficult to generate a heatmap from this method too.

Thanks.
>>
File: 94308.gif (727KB, 541x541px) Image search: [Google]
94308.gif
727KB, 541x541px
here's a scraper for the opposite of slavechan

requires a bit of customization (boardnames.html is just the main page) and you have to make the directories first

some of the images don't work though and I am unsure exactly why so you can debug that too!

#imports
import codecs
from bs4 import BeautifulSoup
import re
import os
import requests
import time

#boards
f=open('boardnames.html','r').read()

boards=BeautifulSoup(f,'html.parser')

boardlist=[]

for elem in boards.findAll('a'):
boardlist.append(
[
str(re.sub('( ){2,20}',' ',elem.text.replace('\n',''))),
elem['href']
]
)

print(boardlist)

for i in range(19):
del boardlist[0]

headers='Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36'

c=requests.Session()


i=0
for name,link in boardlist:
print(link)
print(name)
out = c.get(link+'/c', headers={'User-Agent':headers})
print(out)

catalog=BeautifulSoup(out.content,'html.parser')

thread_arr=[]

for elem in catalog.findAll('div',{'class','catalogMedia'}):
print('elem found')
for found in elem.findAll('a'):
if 'global' not in found['href']:
thread_arr.append(found['href'])
for elem in thread_arr:
print('Thread Link:',elem)

out = c.get(elem, headers={'User-Agent':headers})

data=BeautifulSoup(out.content,'html.parser')

for data_point in data.findAll('span',{'class','mediaFileAttrb'}):
_in=data_point.find('a')['href']
if 'filegone' not in _in:
print(_in)
print('Board Name:',name)
thread_name=re.sub('.+(thread/)','',elem)
print('Thread Name:',thread_name)
image_name=re.sub('.+(images/)','',_in)
image_name=re.sub('.+(videos/)','',image_name)
print('Image Name:',image_name)
img=c.get(_in, headers={'User-Agent':headers})

try:
os.makedirs('boards\\'+name+'\\'+thread_name+'\\')
except:
pass

f=open('boards\\'+name+'\\'+thread_name+'\\'+image_name,'wb')
f.write(img.content)
f.close()
>>
>>56942561
apple is extremely user hostile
you cannot develop macOS/iOS apps without paying for a $99/year developer license in order to run unsigned (not from app store) code on your macOS/iOS device.
>>
>>56942591
You can easily run unsigned code on macOS. You do need the license if you want to put your app on the mac app store. You can also test apps for iOS without the license too. You only need it to sell through the appstore and be able to sign your code.
>>
    la        $a0,string        #string[i]
lb $a1,orig
lb $a2,new
li $a3,0


loop:
lb $t0,($a0) #t0 <- string[i]
beqz $t0,done #if (string[i] == 0) goto done
beq $t0,$a1,replace #if (string[i] == orig) goto replace
addiu $a0,$a0,4 #i++
b loop
replace:
sb $a2,($a0) #string[i] <- new
addiu $a0,$a0,4 #i++
addiu $a3,$a3,1 #count++
b loop

why does this fall through to the instructions below and ignore my unconditional branches?
>>
>>56942811
also holy fuck that formatting
>>
>>56942561
literally no reason to program on apple devices unless you are specifically developing for an apple platform

if you want to drop that much money you can easily get a desktop with a GTX 1060/i5 and do more high-performance (modeling, videogames) work on there. I have that combo and can do pretty much anything on it

or get a laptop which has portability but decreased performance, obviously. I have a laptop from lenovo which has lasted me 3 years now, the y410p and the build quality is dropping off so I don't recommend them.

Just depends on what your needs are in a computer. You do NOT want to super cheap out on a laptop though, and I recommend an SSD esp for stuff where transfer rates matter (scrapers, creating dictionaries for kindles, etc).

I do pretty much all the things I mentioned in my post so I need pretty versatile equipment
>>
>>56942561

>Is it worth spending $1000 on a macbook

The answer will forever be no
>>
>>56942811
can branch instructions only increment (rather than decrement) the PC or something? that would explain it i guess but that doesn't really make much sense to me
>>
What do you guys think of this meme: http://c2lang.org/

I actually think it's pretty neat.
>>
>>56942944
It's pretty cute.
>>
>>56942944
>No header files
>No forward declarations
>No includes necessary
>Integrated compiler option syntax
>Integrated Build system
>Compilation per target, not file
>Simplified type syntax
>Stricter error checking (uninitialized var usage is error)
>More built-in types (uint8,uint16,uint32,int8,int16,int32, ...)

fund it
>>
Are there any good sites like Project Euler but with problems that are interesting more from an engineering standpoint than a pure maths stand point?
>>
>>56942944
module hello_world;

import stdio as io;

func int main(int argc, char*[] argv)
{
io.printf("Hello World!\n");
return 0;
}


yikes
>>
>>56942986

Codeeval
>>
are lisp and haskell meme languages?
>>
How do I stop language hopping? I have something like 15 different compilers and VMs installed.
>>
Does any one here know GTK? I'm really new to it, and I can't figure out why my text isn't showing.
>>
>>56943053
lisp yes
haskell less yes but ultimately its own niche that has a use.
>>56943057
which ones have you tried so far?
>>
Why the fuck are java errors so verbose and specific? Look at this schlock
public Object loadObject(String name) throws FileNotFoundException, IOException, ClassNotFoundException {
File file = new File(baseFolder + name);
FileInputStream fileIn = new FileInputStream(file);
ObjectInputStream objectIn = new ObjectInputStream(fileIn);
return objectIn.readObject();
}

Would "FileNotFound" or "ClassNotFound" not be enough for you, devs?
>>
>>56943057
Actually make something instead of writing hello worlds over and over.
>>
>>56943057
>language hopping

it's called using the right tool for the job.
>>
>>56943095
Because it tells you it's an exception. Exceptions are classes, so people append Exception at the end so they know that class is an exception.
Java is verbose, but the issue is elsewhere.
>>
>>56943128
If it's that standardized then why isn't there some sort of reflection in place
>>
File: 1384599492953.jpg (63KB, 500x600px) Image search: [Google]
1384599492953.jpg
63KB, 500x600px
>>56943095
>Java
>>
>>56943147
>AKA: I am incapable of OOP design and am going to criticize it anyway
>>
>>56943163
OOP is fundamentally flawed though.
I think you're the retard who incapable of simple procedural design.
>>
>>56943163
>AKA: I am incapable of understanding code without it being abstracted
>>
>>56943146
The name is for the programmer's sake, not for the compiler.
>>
>>56943169
The retarded thing is the image for pretending that procedural design doesn't have /any/ abstraction even when handling complicated/robust programs

The kite on the bottom would look exactly like the kite on the top if there were only a single instance of it and your program did nothing else
>>
>>56943169
>OOP is fundamentally flawed

Very interesting. Link me to your blog.
>>
So I tried to dip my feet into c by porting a simple python script I wrote, but it only works if the user plays nice, I dont know how to fix

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
char scale_input[2];
char temp_input[6];
float temp;
int temp_length;
int scale;
float fahr;
float cel;
float kel;

do{
printf("Enter The First Letter of Your Scale. \n");
fgets(scale_input, 3, stdin);
scale = scale_input[0];
}while(scale != 99 && scale != 107 && scale != 102);

do{
printf("Enter the Temperature \n");
fgets(temp_input,7,stdin);
temp_length = strlen(temp_input);
if(temp_length > 5){
printf("This Tool is Intended For Use on Earth, Please Choose a Lower Number \n");}
}while(temp_length > 5 || temp_length == 1);


temp = atol(temp_input);

if(scale == 99){
fahr = temp * 1.8 + 32;
kel = temp + 273.15;
printf("Your Temperature in Celsius is %f \n", temp);
printf("Your Temperature in Fahrenheit is %f \n",fahr);
printf("Your Temperature in Kelvin is %f \n", kel);
}

else if(scale == 102){
cel = (temp - 32) / 1.8;
kel = (temp + 459.67) * 0.55555556;
printf("Your Temperature in Fahrenheit is %f \n",temp);
printf("Your Temperature in Celsius is %f \n",cel);
printf("Your Temperature in Kelvin is %f \n", kel);
}

else if(scale == 107){
fahr = temp / 0.55555556 - 459.67;
cel = temp - 273.15;
printf("Your Temperature in Kelvin is %f \n",temp);
printf("Your Temperature in Celsius is %f \n",cel);
printf("Your Temperature in Fahrenheit is %f \n", fahr);
}
return 0;

}
>>
>>56943195
https://www.youtube.com/watch?v=QM1iUe6IofM

>>56943190
Abstraction is not everything, you know.
>>
>>56943203
I know you're now freed from the shackles of forced indentation, but you should still do it.
>plays nice
What is not "playing nice" in your program.
>>
File: treeFractal.png (94KB, 591x317px) Image search: [Google]
treeFractal.png
94KB, 591x317px
i made fractals
>>
>>56943203
>this indentation
>from someone coming from python no less
>>
>>56942811
>addiu $a0,$a0,4 #i++

isn't that i+=4?

.data
string: .asciiz "Test ee"
orig: .ascii "e"
new: .ascii "i"

.text
la $a0,string #string[i]
lb $a1,orig
lb $a2,new

loop:
lb $t0,($a0) #t0 <- string[i]
beqz $t0,done #if (string[i] == 0) goto done
beq $t0,$a1,replace #if (string[i] == orig) goto replace
addiu $a0,$a0,1 #i++
b loop
replace:
sb $a2,($a0) #string[i] <- new
addiu $a0,$a0,1 #i++
b loop

done:
li $v0, 4
la $a0, string
syscall

replaces the e with i
>>
>>56943266
god sorry about the formatting
>>
>>56943089
>which ones have you tried so far?
I started with Javascript, then I tried C, Python, Racket, Erlang, Haskell and Scala.

I guess I would be best off with learning C, I just don't want to end up reinventing the wheel except shittier.
>>
>>56941737
>this is because the only way to implement a polymorphic sort in C is to pass around runtime void pointers to functions, which the C compiler absolutely cannot reason about. so you end up making a function call on every comparison, which is ridiculous
No, it's not, see QSORT macro from openbsd for example.
But putting it all in a macro isn't even neccesary either, both gcc and clang can do devirtualization of function pointers, and the only reason standard qsort is typically slower than std::sort is because the latter is implemented in a header file, while the former resides already compiled in a static or dynamic library. Keep the same qsort code with function pointers and everything and put it in a header file so the compiler sees the full definition and you will see modern compilers inline everything just fine.
>>
>>56943211
>Abstraction is not everything
I never said it was, but that image is retarded for more reasons than one.
The C example is a theoretical program that does one single thing: It creates a flying dragon and then handles it by throwing results right out to the console with no other handling

The Java example appears to be a theoretical program that supports a single instance of a flying dragon, but it could also support any number of other kite types as well. These other kite types can be handled through the same methods as the flying dragons. Moreover, it's flat-out wrong and is obviously written with 0 experience of how java or OOP works, because the person is controlling something that extends Dragon to control the dragon when in reality it would be the other way around (He would be controlling a Kite object, from which Dragon is extended) to make use of polymorphism.

Java has problems, large problems even, but the problem is not OOP design. To imply that inheritance is just "fusing stuff together" is retarded and is completely missing the core concept.

C is good too but it has a limit to its usability when you get to more complicated/abstract projects (I.E. a game, web dev, corporate collaboration, or anything else that isn't low-level).
>>
>>56943278
What's your desired intention with programming?
Just a hobbyist?
Or are you looking for a career?
And not necessarily.
I think the whole "learn C before any others" is out-dated much like the language in most applications.
>>
>>56943221
>What is not "playing nice" in your program.
button mashing causes it to overflow and executes everything before its supposed to

>>56943256

im allowed to indent?
>>
>>56943272
my formatting was fucked too. MARS sucks dick. and yeah that was it -- i ended up just switching to jump statements but the fallthrough was due to a retarded """""understanding""""" of how offset was actually working. i was trying to set it on bits when the instruction actually works off of bytes (evidently). took me an embarrassingly long time to figure that out
>>
File: IVOUb5P.jpg (999KB, 2693x3600px) Image search: [Google]
IVOUb5P.jpg
999KB, 2693x3600px
>>56943311
>im allowed to indent?
How do you indent one level and then come to the conclusion that you aren't allowed any more indentation?

What the fuck, honestly.
>>
>>56943311
as much as you want m8
>>
>>56943053
all programming languages are absurd when taken dogmatically
>>
File: compiler-dmd.png (16KB, 294x294px) Image search: [Google]
compiler-dmd.png
16KB, 294x294px
>>56943361
say that again motherfucker
>>
>>56943337
What is MARS?
>>
>>56943419
simulator for MIPS
>>
>>56943419
a MIPS simulator with an integrated editor that ate my formatting. i assumed it ate yours too
>>
>>56943424
Thanks anon.
>>
>>56943057
Life is short, learn Python.
>>
>>56943311
>im allowed to indent?
This is why we don't teach people python first.
>>
>>56943278
> I would be best off with learning C, I just don't want to end up reinventing the wheel except shittier.
then don't use C. At least, don't start with it.
Just choose a language that's high-level(ish) that works on all platforms and then learn it really well, like a .net language. Learn other languages/tools that you need to while making projects (I.E. SQL, REST APIs, php, whatever else you need to use) and then once you have a solid foundation in that language, jump to other languages for projects that require specific ones (I.E. C for low-level data manipulation and extremely low impact programs)
>>
File: 1475113620365.jpg (207KB, 650x650px) Image search: [Google]
1475113620365.jpg
207KB, 650x650px
>>56943311
>having your mind ruined by a dogshit-tier language where block scope is influenced by whitespace

i'm so, so sorry
>>
>>56943108
my NEET detector is off the charts
>>
>>56943490
you better fix it
>>
>>56943453
but python is all about corret indent
>>
>>56943108
>the right tool for the job
Most languages are the right tool for most jobs except for edge cases or corporate work.
>>
>>56938791
Trying to learn about Linked Lists, but having trouble wrapping my head around how they work.

Here's an example from my book, can someone please help me understand what's going on here? I've tried looking up examples online but it just hasn't clicked for me.
public class GenericNode<E>
{
private Object data;
private GenericNode<E> link;

public GenericNode(Object initialData, GenericNode<E> initialLink)
{
data = initialData; //The element stored in this node
link = initialLink; //Refers to the next node in the list
}
>>
>>56943283
>No, it's not, see QSORT macro from openbsd for example.
i did mention macros or pseudotemplates

i use the sort example for its simplicity and ease of grok, if it were a robust polymorphic type you'd end up passing the entire suite of subroutines in the higher-order function's signature, or using macros

sophisticated macros are pretty intimidating as a library in terms of the errors they might throw, and at the extreme you can embed any DSL you want in m4 or a transcompiler, so at some (unclear) point it's not idiomatic C

to be clear, BSD-style macros are absolutely the right way to do this if you want to do it in C
>>
Am I the only one who wants people to post their homework? It's nice to come across (hopefully) a challenge once in a while. I don't mind doing homework for others because I like programming, is this bad?
>>
>>56943552
as long as you don't tell them the solution outright
>>
>>56943525
>>56943525
You are defining a class GenericNode which has a generic type of E.

The GenericNode class and objects will have access to its link, so its linked to another node (private GenericNode<E> link) ((Notice how they both use <E>, this means they both share a generic type. They also hold some data, defined as just an Object. The bottom part is a constructor.
>>
>>56943552
I'm doing a project for class that's all about linked lists, could you help me with this >>56943525
>>
>>56943552
>. I don't mind doing homework for others

Why do it for free though?
>>
>>56943577
Good point, but it's also fun showing them how to step through the hurdles of solving the problem, It isn't too hard to explain it to people, and I'm sure they would appreciate it.
>>
>>56943552
no Ive done other peoples homework once or twice out of boredom, but I try to do it a tad unusual for fun too

http://pastebin.com/Dfh2CVCd
>>
>>56943552
The problem people have with people posting their homework here (and in prettym uch every other programming community) is that what it comes down to is somebody is trying to put their workload on to the community instead of doing it themselves. It's not so much that people are averse to doing some form of challenge.
>>
NEW THREAD!

>>56943607
>>
>>56943583
Right, I got the generic<E> part, and the constructor. I'm just not understanding how they're "linked". I'm pretty retarded. I also have a hard time visualizing structures and shapes that fit together
>>
>>56943590
I'd charge when it looks like a hassle, otherwise teaching them is probably a plus for me because I enjoy doing problems. I could make profit off of this but i'm no jew!
>>
>>56943552
Wouldn't you rather be working on a project than doing first semester CS homework?
>>
>>56943599
That's the thing, though. If at any point you just tell them the solution, then even if they read your entire post (they likely will not) they won't /understand/. Solve the problem, then point them in the right direction (AKA: here's my solution's classes/methods and fields with no code inside said methods or classes)
>>
>>56943618
they are "linked" because the GenericNode<E> class has a "link" or an object that points to another GenericNode<E> in the List.

Take a look at this:
https://en.wikipedia.org/wiki/Linked_list
>>
File: linked-list.png (8KB, 800x80px) Image search: [Google]
linked-list.png
8KB, 800x80px
>>56943618
The link points to the next node. If link is null, there is no next node and you're at the end of the list.
>>
>>56943629
I would, and that's why when I do take up homework its projects I know I can do quick, easily and efficiently.
>>
>>56943649
>>56943618

never mind lol it finally clicked. The "link" GenericNode object is "linked" to this node because this node is creating "link" as a new GenericNode object. God I'm retarded
>>
>>56943618
like others said, it's a self-referential data structure which contains a field of data (or multiple) and in its simplest form, a pointer to another instance of its own type. they can either be iterated through directly if you can access its member data publicly or through member functions
>>
>>56943169
>>56943211
It's not fundamentally flawed. Even the guy in video says the only problem with OOP is encapsulation.
Things like inherence or shared state are just matter of language design. Rust only allows traits in inherence and has much more strict hierarchy of references which eliminates these problems.
Also the problem are people who care more about using patterns/whatever than actually solving the problem. They are good to know, but you should use them when they are needed, not design whole code to justify their usage.
>>
>>56943694
Rust is not an OOP language.
>>
>>56943715
It's not strictly OOP, but ti's multi-paradigm and you can do OOP programming in it.
We are talking about OOP as paradigm, not as programming language design, aren't we?
>>
OS Anon here. It's really satisfying to see the blinking cursor on the prompt. Anyways, I'm working on FAT12 and FAT32 support now. It'll probably be done by tomorrow. I also included a prebuilt image in my github repo so you can test it without setting up the build environment. For anyone who didn't see me in the last thread, the repo is here: https://github.com/Penot1/FutureOS
>>
>>56944022

are you using a book to build this? if so, which one?
>>
>>56944036
Nope, I am using the OSDev wiki though. I got most of my info from there and I'm kind of just working on my own now.
http://wiki.osdev.org/
>>
>>56944105

Neat. Good luck.
>>
>>56944105
Just wait, it gets better. I just got ELF executable loading in user mode working. From an assembler I wrote, running in my OS.
Thread posts: 340
Thread images: 36


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