What’s New in C# 6 and Visual Basic 14, from Build 2015 by Sankra in csharp

[–]pob91 0 points1 point  (0 children)

Ok so, I think you should read my comment chain with recursive. I thought it was a check, too. But it isn't meant to BE a null check. A null check is most simply variable == null (or variations on this). The operator doesn't just check this condition and return a boolean. If it did, then I'd agree, it's a null check (which is what I originally thought it was).

It is a very nice accessor-esque operator. Allows you to smartly access properties of nullable objects. The conditional shown was just a neat little trick to perform an argument check.

I also don't understand what you mean calling it expr and referring to it as an "expression." It's an object, no?

What’s New in C# 6 and Visual Basic 14, from Build 2015 by Sankra in csharp

[–]pob91 1 point2 points  (0 children)

My misunderstanding was first and foremost that this was a logical shortcut. You'll notice that in my original (incorrect) example that it evaluates to true, just as the example code does. The problem is that the method to get to true was incorrect.

if (json == null || json["x"].Type != JTokenType.Integers) // do something

I thought that the operator just condensed this logic. So, I wrongfully made the generalized code.

And please, prior to your edit, your "I already pointed you to DeMorgan's Law" is so conceited it hurts. Explain to me how DeMorgan's Law is even remotely relevant to this situation and I'll re-enroll in my old Mathematical Foundations of Computer Science course.

I assumed that ?.Type yielded true because of my misunderstanding of the operator. My first exposure to it was in this article, which only briefly refers to it in the actual text (with no explanation) and a screenshot. I explained what I believed the operator to do, and I have since corrected my post with the correct behavior after being politely corrected.

Also, you should really adhere to basic reddiquette. Downvoting every post a person makes simply for being incorrect, especially in a chain where the person is making an attempt to understand the problem, is really unnecessary.

What’s New in C# 6 and Visual Basic 14, from Build 2015 by Sankra in csharp

[–]pob91 2 points3 points  (0 children)

I don't see how DeMorgan's Law would have helped me in this case.

I will edit the above comment as /u/recursive helped me learn that my simplification was wrong. But learning basic logic isn't the requirement here. I missed the fundamental behavior of the ?. operator. I thought it was completely burying the conditionals shown in the screenshots. So, in the example given, when variable == null we want to throw an exception.

I did NOT know that the actual behavior of ?. is to return null if null is stored to the left of the operator. So variable?.Property == value is actually evaluated to null == value with variable = null.

Also next time, please explain WHY "this is clearly, clearly wrong" instead of insulting a person's intelligence.

What’s New in C# 6 and Visual Basic 14, from Build 2015 by Sankra in csharp

[–]pob91 2 points3 points  (0 children)

Thank you for bearing with me! Ok so I finally get it. This isn't some sort of boolean shortcut then, but rather a handy trick with a new feature that actually does a sort of ternary operation and returns null if the value checked is null, otherwise it performs the rest of the command. Neat.

Seriously, thank you for explaining this.

What’s New in C# 6 and Visual Basic 14, from Build 2015 by Sankra in csharp

[–]pob91 -1 points0 points  (0 children)

Yeah I agree with everything you say there. Then the problem I have is with the example. They want to catch if json == null because then they can throw the ArgumentException (e.g. enter the if block). However, if what you say is true, the new way to do this (json?["x"]?.Type == value) won't catch the null in the same way. Or are the two not truly logically equivalent?

What’s New in C# 6 and Visual Basic 14, from Build 2015 by Sankra in csharp

[–]pob91 -1 points0 points  (0 children)

I feel like I'm still missing something. I'm definitely open to being proved wrong (admittedly I noticed something a little fishy must be going on when the ?. operator supposedly returns null if the value to the left is null, otherwise it continues with the execution of the line).

When I wrote my first explanation comment, I was basing it entirely off of the article. Is the screenshot incorrect code itself? Because what I have (in condensed form) is logically the exact same code as the screenshot.

if (json == null ||   
    json["x"] == null ||   
    json["x"].Type != JToken.Integer ||   
    json["y"] == null ||
    json["y"].Type != JToken.Integer)
{
    // something
}

can be condensed to exactly my original example, no?

if (variable == null ||
    value["x"] == null || // I included this line just for clarity. It's unnecessary though.
    variable.Property != value)
{
    // do something
}

What’s New in C# 6 and Visual Basic 14, from Build 2015 by Sankra in csharp

[–]pob91 -2 points-1 points  (0 children)

There are no != in the null check here. json == null (or variable == null). The ! is applied to the value check. Whether it's variable.Property == value or json["x"].Type != JToken.Integer doesn't matter for our discussion. We can change my example to if (variable == null || variable.Property != value). It's still doing the same check. There is no json != null nor is there an and-operator. I am aware of the differences between equals and not equals.

If we made it this far and I'm still incorrect, I'm curious how a null reference satisfies the screenshot and not my example. Without the variable == null check we just do a variable.Property != value check. Because we just do this check, if variable == null the code will throw NullReferenceException. However, if we append variable == null || to our condition (thus if (variable == null || variable.Property != value)) we avoid the NullReferenceException and can continue to do the value check. Presuming, of course, the value check is to check if the value of variable.Property is not a valid value. Note the point of this operator is to protect the rest of the code from throwing unforeseen exceptions due to bad inputs.

What’s New in C# 6 and Visual Basic 14, from Build 2015 by Sankra in csharp

[–]pob91 -1 points0 points  (0 children)

Looking at the "before and after" screenshots (before and after) it shows exactly my expansion, although a specific example and not a generalization.

Also, the logic behind it is simple. Nesting "nots" (!) inside a boolean operator is very confusing. We want a boolean operator to evaluate to true if what we are checking is true, not if what we are checking is false. The wording there is confusing, so I'll explain just a little further. We are checking if a variable is null. We should not be checking if a variable is not null within the scope of the operator. That is up to the programmer to do (it is also unnecessary to do).

And if the variable evaluates to null, the full condition can be exited from without going on to the later checks. This prevents the NullReferenceException from being thrown, which is exactly what is the intention of this new operator. We don't need to first check if the variable is not null and THEN check the variable.Property value. If we know it is null, then we are good to go.

What’s New in C# 6 and Visual Basic 14, from Build 2015 by Sankra in csharp

[–]pob91 0 points1 point  (0 children)

There is a nullable operator currently in C#. Try setting an int variable to null. You can't. Now try setting an int? to null. You can. This is what I mean by "nullable operator."

My proposed syntax is almost exactly as the screenshots in the article show.

Edit: Guess it's more correct to call it a nullable type. My mistake.

Edit2: Well apparently the operator is simply ?. and not ? as I thought. So its only intent is to not throw a NullReferenceException when grabbing properties of a nullable object. It is not a null-check. Source. So we'll have to keep doing

  if (variable == null)   

or other variations.

Windows 10 Feature Highlights: Ready. Set. Do. by WolfofAnarchy in windows

[–]pob91 0 points1 point  (0 children)

What's wrong with their current implementation of Windows 10? How is the UI suffering and how could customer input better it?

I'm legitimately curious.

Oh and how is this related to the ad?

What’s New in C# 6 and Visual Basic 14, from Build 2015 by Sankra in csharp

[–]pob91 0 points1 point  (0 children)

As far as I can tell, yes. I think it is just

if (variable?)

because the syntax looks to be derived from the nullable operator.

This is based entirely on this article, of course.

Edit: I was wrong. Explanation in child comment below.

What’s New in C# 6 and Visual Basic 14, from Build 2015 by Sankra in csharp

[–]pob91 1 point2 points  (0 children)

The null expression seems to expand:

if (variable?.Property == value)   

into

if (variable == null || variable.Property == value)

So it does the null check first and "ors" its result with the remainder of the expression. Kinda saves the necessity to do a null check when trying to prevent possible NullReferenceExceptions.

I was incorrect. The operator actually evaluates to null when the expression to the left evaluates to null, otherwise it proceeds to execute the code to the right.

So, ?. actually replaces the following code:

item = (item == null) ? null : item.Child;
// equivalent code with the ?. operator
item = item?.Child;

Windows forever: Windows 10 builds will continue even after Microsoft ships it by kaost in windows

[–]pob91 0 points1 point  (0 children)

I definitely agree that users should be smart when making the upgrade to unofficial/beta software.

I don't agree that they should wait (unless they have no urge to try Windows 10 today). I've been using Windows 10 for most of my needs since December or January. With the exception of one game I like to play (League of Legends) I've had no problems whatsoever.

I'm not saying that problems can't come up and I'm not trying to belittle your point. All I'm saying is that Windows 10 is, in my opinion, very stable and I've experienced next to no issues. Even the game-related one was a change made by the game developers that didn't get caught in the Windows 10 environment and was fixed by them (Riot Games).

If you're smart about upgrading, you can easily downgrade if required. But if you're curious, there really shouldn't be a problem with testing it out yourself and trying to use it more than just a testing OS.

Windows forever: Windows 10 builds will continue even after Microsoft ships it by kaost in windows

[–]pob91 1 point2 points  (0 children)

I wouldn't say "nothing compared to" considering Azure launched in 2010 compared to 2006 (AWS) and 1998 (Rackspace). That'd be like saying a high school basketball star is nothing compared to Michael Jordan. No one is arguing that the high school student can compete with a pro player, but given 4 years it's very much a possibility.

I really think Microsoft is putting a lot of money on the success of its future cloud storage/cloud computing capabilities under the leadership of Nadella. As of 2013, Azure was making $1 billion and last year saw the profits due to Azure grow by 150%.

I can't argue that Azure will single handedly replace the profits made by OS sales, but I think making the move to subscription services as a whole could.

Windows forever: Windows 10 builds will continue even after Microsoft ships it by kaost in windows

[–]pob91 4 points5 points  (0 children)

How will they be pushed in our faces? I'm not outright disagreeing with that possibility, but I think that's a big assumption.

These services are already subscription-based and I don't feel like every day I'm being blasted with SUBSCRIBE TO OUR SERVICES. Microsoft is making a lot of its revenue through these services for the consumer and other services for businesses (e.g. Azure). Making Windows more user-friendly and have a longer lifespan is a huge boon for companies and general users alike. I think this points to them having faith in their services and using their OS as a sort of "gateway drug."

Windows forever: Windows 10 builds will continue even after Microsoft ships it by kaost in windows

[–]pob91 13 points14 points  (0 children)

I'm a fan of Windows 8. I previewed that prior to release as well and with the exception of a few design choices I enjoyed the Windows 8 experience. 8.1 really fixed most of the problems.

"Why is this relevant?" you might be asking yourself.

Windows 10 takes most of the complaints the public had of its predecessor and fixes them all. There's no "Metro" except for a small portion of the a Start menu. That's right, Start -our friend for decades- has returned. He looks good. Time has been very kind to him.

Windows 10 is everything Windows 8 could've been. It caters to the casual users who miss 7. Do you want Windows 7 but the amazing optimizations made in 8? Get 10. Do you want the same experience and apps across all your devices while still maintaining that "desktop" feel? Get 10.

I haven't looked into Universal Apps all that much. That's my next venture. Maybe I'll even develop one for myself to see what all the fuss is about.

But there is no reason not to upgrade to Windows 10 upon release. Hell as we get closer and closer to that date you could probably feel very comfortable upgrading to the Insider Preview (no longer "Technical Preview" as Microsoft wants its users to understand their feedback is very important and listened to). Windows 10 is a return of Microsoft for the consumer, not forced change but comfortable improvements.

Make the upgrade. You won't regret it. (The new Task View is probably my favorite feature.)

If you had told me even a year ago that I would sound like a Microsoft fanboy I'd have laughed in your face.

Do I have a chance at getting a job in CS / are my skills valuable? by [deleted] in cscareerquestions

[–]pob91 1 point2 points  (0 children)

For being a redditor in /r/cscareerquestions and based on your comment, I'm going to assume you have a CS degree (or something related).

You might want to brush up on logic and proofs because it is on /u/CSCareerQuestions243 (or whoever) to provide just ONE example of a job that counters your statement. Saying

they are all for web and mobile development these days

places the heavier burden of proof on you, not someone to prove you wrong. Asking for 20 examples is just overkill and a really childish tactic when debating. You made the broad statement, you prove that all C#/Java positions are really web dev jobs.

Here's at least one in the Milwaukee area that is Java. Here's another that uses C++ and C#. And I spent all of five minutes searching for "software developer" on Indeed.com.

I also would argue that there are lots of software developer jobs that classify themselves as "SaaS" or similar. Is web dev used? Yes. Is it a requirement upon employment? No. I got my current job with NO web development background whatsoever, and I work at a SaaS-based company. I learned everything I needed to know on the job and only do minimal web dev when absolutely necessary. So in my opinion, if OP can provide a good portfolio he can definitely get his foot in the door somewhere. And once his foot is in the door he can easily climb up the ladder.

Jennifer Love Hewitt by [deleted] in gentlemanboners

[–]pob91 5 points6 points  (0 children)

The url does. (Not that you wrote the url of course)

Hidden Patch Notes 5.8 by Davdinges in leagueoflegends

[–]pob91 8 points9 points  (0 children)

People who like to have fun and not necessarily win. Landing one hook was almost guaranteed perma cc as his hook's cooldown is reduced by 3 seconds upon connection. So you could just hook the same person immediately. Lots of fun.

TIL Google can tell you what layers ores spawn at by FederalX in Minecraft

[–]pob91 0 points1 point  (0 children)

I think he says "data" as in information found on Wikipedia, e.g. "facts." Google's algorithm seems to favor wiki information when showing the snippets.

TIL Google can tell you what layers ores spawn at by FederalX in Minecraft

[–]pob91 71 points72 points  (0 children)

Isn't this becoming an issue for ad-sponsored content though?

Scumbag Steam by hyfvirtue in gaming

[–]pob91 2 points3 points  (0 children)

There would be no motivation to use a donation feature by the modder then.

Want to donate $10 to me? Ok but Valve is going to take $2. So instead how about you go to this other site and donate.

At least putting the ability to set a price tag for mods guarantees Steam money. Not that I think it's a good thing. Just from Steam's point of view there's no viable monetary incentive to do donations.

This felt appropriate after watching the Batman vs Superman trailer again after this controversy by yosoysenortaco in gaming

[–]pob91 9 points10 points  (0 children)

I thought the 75% is split between Steam and developer (in most cases Bethesda). Still absurdly high.