[C#][Review] Am I parsing my json correctly like this? via /r/learnprogramming


[C#][Review] Am I parsing my json correctly like this?

Because I'm bored, intrested in Reddit bots and only know C# I thought I'd look into learning how to work with web api's. One part of that is handling json responses.

I've got a simple program that outputs the comment contents + author name of the currently signed in Reddit user (or whoever you specify). It seems to work, but I don't feel like this is a good way of handling my json.

I think it will fail to catch some posts because of the way I try to recognize Json objects/entries (??) and my usage of the "body" and "author" strings. I also feel lost because of the many ways I've seen on handling Json data. Considering Jsonobjects seem to be for smaller size files I chose the datareader (right decision?).

Before going further with this stuff I'd appreciate someone looking at my code. Giving me pointers on what other methods of handling Json I could look into and telling me what the obvious flaws are.

http://ift.tt/1nxTtwm

Submitted January 31, 2016 at 06:36PM by Vincenttb
via reddit http://ift.tt/1RUrbcc

Calculate the maximum number of disjoint regions in an arrangement created by n lines. via /r/learnprogramming


Calculate the maximum number of disjoint regions in an arrangement created by n lines.

This is a homework problem, I'm not asking for the answer but I do really need help understanding the problem:

in computational geometry, an arrangement of lines is the partition of the plane formed by a collection of lines. Observe that the lines partition the plane into disjoint regions. Calculate the maximum number of disjoint regions in an arrangement created by n lines.

I really don't understand the premise, I suppose. Having to explain what it means, gun to my head, I would say: So the arrangement of lines partitions the plane, or essentially breaks apart the plane making multiple planes (2 or more). Calculate the maximum number of planes created by an arrangement of n lines.

Am I understanding this correctly? I can't help but think it's wrong because I really don't know where I would go from here.

Submitted January 31, 2016 at 05:52PM by rshacklf
via reddit http://ift.tt/1m7n92j

[Java] What is wrong with my copy constructor for a linked list of characters? via /r/learnprogramming


[Java] What is wrong with my copy constructor for a linked list of characters?

Here is the copy constructor:

public CharacterList(CharacterList s) { this.head=null; this.mySize=s.size(); if (s.head != null) { this.head = new Node(); head.data = s.head.data; //copy rest of the list Node newPtr = head; for (Node origPtr = s.head.next; origPtr != null; origPtr = origPtr.next){ newPtr.next = new Node(); newPtr = newPtr.next; newPtr.data = origPtr.data; } newPtr.next = null; } } 

CharacterList has : Node head, int mySize, char myDefaultValue, has a method called size(), and some other methods

Node has: char data, Node next, Node() [default constructor], Node(Node s) [adds a node after current node,but before the subsequent the nodes], Node(char value, Node s) [same as last method, but adds data=value for the new node inserted]

Submitted January 31, 2016 at 05:54PM by McFiddlyWiddly
via reddit http://ift.tt/1QRdmKH

How to prepare for Java as a decent C# programmer? via /r/learnprogramming


How to prepare for Java as a decent C# programmer?

As the title states, I'm an okay C# programmer, having programmed in the .NET world as a part of school courses for the last 2-3 years. Now I'm about to start in a new school that rarely uses .NET but Java, Python, JavaScript and a bunch of others, but mostly Java.

Anyway, any ideas how to prepare for the Java world as a C# programmer? I've been thinking about just taking it all in as it comes, hoping that my C# experience will make me able to figure out most differences as I go along, or at least be able to find out how to do this and that without the biggest problems. I'm aware of some of the differences in syntax, features etc, but apart from the plenty comparison articles out there, I was wondering if there's a good post out there helping the programmer get into the Java 'mindset', so to speak, as I fear the many similarities between C# and Java could make it difficult for me to make it difficult for me to quickly make the jump.

Submitted January 31, 2016 at 05:59PM by Left4Cookies
via reddit http://ift.tt/1POnx3K

Best way to practice your programming skills daily… via /r/learnprogramming


Best way to practice your programming skills daily…

Yo!

So, I already know of all the usual mentions like Project Euler and /r/dailyprogrammer but I am sure there are more good resources like those out there in the world!

Which programming task/project subreddits/sites do you recommend everyone here takes a look at?

Thank you!

Submitted January 31, 2016 at 05:35PM by GlazyUK
via reddit http://ift.tt/1SuXH3z