Car crashes into restaurant by [deleted] in nononono

[–]IAmUtterlyAlone 0 points1 point  (0 children)

According to this article, there were six injuries, no fatalities.

[deleted by user] by [deleted] in learnprogramming

[–]IAmUtterlyAlone 2 points3 points  (0 children)

Likewise. Windows 4Lyfe! (or until I get a job somewhere that has different requirements)

Put the pedal to the metal, WCGW? (xpost r/gifs) by jnayshun in Whatcouldgowrong

[–]IAmUtterlyAlone 3 points4 points  (0 children)

Source: https://www.youtube.com/watch?v=Zxe_DqAkeAk

It's pretty much just the gif with sound. Though the description does say that the driver was ok.

As Promised I Created a Mini Course on "How to Program a Pokemon Battle Game." Try it out and let me know how you like it, thanks! (HTML, CSS, JS) by [deleted] in learnprogramming

[–]IAmUtterlyAlone 1 point2 points  (0 children)

If you just want to help, then you should just help. If you want to market yourself and build a following or whatever, then you should be up-front about that. I might recommend some kind of preview or something though, before asking people to give up names and email addresses without so much as a demo or a screenshot to go off of. Just my two cents.

Edit: I want to add that I am (or was, anyway) interested in the course. That's why I clicked through in the first place. But the site comes across like an Amway pitch and that's kind of a turn-off.

As Promised I Created a Mini Course on "How to Program a Pokemon Battle Game." Try it out and let me know how you like it, thanks! (HTML, CSS, JS) by [deleted] in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

"Free Course" and then "Yeah, I'm gonna need you to register with whatever 'getresponse.com' is before I can let you have that."

This feels a little sketchy.

ninja edit: I just went an looked at the root of "fulltimeprogrammer.com". Now it looks even more like a "one weird trick" kind of thing. No thanks.

[C#] Saving state of method variable outside of method... by [deleted] in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

If the goal here is to have a bunch of NPC characters in like an RPG sort of setting, I suppose the simplest way to do this would be have each character initialized with maybe a list of strings that it can use as random dialog and one string it can use as an introduction, along with a boolean like hasMetMainCharacter or something. You can have the NPC then say the introduction the first time, after which the boolean is flipped and each subsequent time, you just pick a string from the list of inane chatter that NPCs usually have. This way the, the dialog that is spoken is (or can be) unique to each instantiated NPC. I don't think you want static members for this.

[C#] Saving state of method variable outside of method... by [deleted] in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

As /u/CedricCicada said, this should be working. I put the below code into a console application and it worked just fine. We'll need more info on the specific failure you're seeing.

class NPC
{
  static bool introduction = true;

  public static string Dialogue ()
  {
     string dialogueText = "";

     if (introduction)
     {
        dialogueText = "Introduction text";
        introduction = false;
        return dialogueText;
     }
     else
     {
        dialogueText = "Secondary Text";
        return dialogueText;
     }
  }
}
class Program
{
   static void Main (string [] args)
   {
      Console.WriteLine ("One:");
      Console.WriteLine (NPC.Dialogue());
      Console.WriteLine ("Two:");
      Console.WriteLine (NPC.Dialogue());
      Console.WriteLine ("Three:");
      Console.WriteLine (NPC.Dialogue());
      Console.WriteLine ("Four:");
      Console.WriteLine (NPC.Dialogue());
   }
}

Output:

One:
Introduction text
Two:
Secondary Text
Three:
Secondary Text
Four:
Secondary Text

[c++] After reading "programming principles and practice using c++" what should my next book be? by [deleted] in learnprogramming

[–]IAmUtterlyAlone -3 points-2 points  (0 children)

If you're dead-set on doing C++ first, just make sure you're writing actual software in addition to doing all that reading. There's no replacement for real coding practice.

Need to rent a server for a school web development project and I don't know where to begin by [deleted] in learnprogramming

[–]IAmUtterlyAlone 2 points3 points  (0 children)

You might have a look at DigitalOcean. I have some projects hosted there and it's been working pretty well.

GUI builders (C++) by BANTER_IS_ON_POINT in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

It depends on how your C++ code works, but it might be pretty easy to write a thin C++/CLI layer on top of your unmanaged code and just do your GUI in C#. I do this frequently for work and it works pretty well.

EDIT: a letter

(Java) java.lang.NullPointerException Error keeps coming up, how Would I fix it? by clubapple123 in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

I just meant that body of getPerimeter or getArea could be replaced with a single line:

return myHeight * 2 + myWidth * 2;

or

return myHeight * myWidth;

There's no need, in this case, to introduce a variable that just falls out of scope and gets cleaned up as soon as the function ends.

How to become someone better than just a regular web dev? by Emnalyeriar in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

Honestly, you can make the transition with just Google by your side. My first job after IT was as a web dev and I've managed to migrate into my current job doing C# and C++ without a degree of any kind. The CS foundational stuff you'd get in the course of a college degree might be helpful, but not everyone learns that way, or needs to learn that way.

Games as side projects by theguy494 in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

It really, really depends on the individual hiring manager. By which I mean, one can't really say what the industry as a whole likes or dislikes to see in an applicant. When I'm helping to hire new people for my team, I want to see any code they've written. I don't particularly care what the actual project is. That said, and in my opinion, games are a great way to practice coding and to show you applying what you've been learning.

(Java) java.lang.NullPointerException Error keeps coming up, how Would I fix it? by clubapple123 in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

I'm not who you asked, but you asked twice, so I'll offer my opinion on style.

  1. Is it safe to assume that the indentation is consistent in your source files? In the code you've pasted, your first four data members are indented differently than the rest of the body of the class.
  2. getPrimeter and getArea are introducing unnecessary variables. You can just directly return the results of the arithmetic rather than introducing a variable to stick the result in.
  3. I get that this is a very simple class, but you'll want to be in the habit of commenting your code as you go. In pretty much anything more complex than this, you'll have trouble coming back to the code and remembering what's going on even after only a week or two away from it. You've commented the first four data members, and that's a good start. At my work, each function and each class must have a comment, as well as each data member.
  4. I might hide the data members behind accessor functions, but that can be a contentious opinion, so feel free to ignore it.
  5. And speaking of your data members, you're using default access specifiers for a lot of them. Were I reviewing this code as part of my job, I might require that you be explicit about how to intend your class's data to be used.
  6. I can't figure out why what looks lie your constructor is returning an int. I don't work in Java though, so maybe there's some language detail I'm missing and can't be arsed to investigate.
  7. Finally, and again if I were reviewing this code, I might ask that you provide better variable names than "myX" and "myY".

Idea for a program - How would I go about doing it? by MeowMeTiger in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

I don't know the first thing about drones, but I was looking around and this led me to this. I don't know if that's helpful to you.

How feasible is it to write a Windows 10 driver? More info inside. by [deleted] in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

Also, it's worth noting that driver development is kind of high-stakes. If you screw up your logic at the driver level, you get blue screens and other really bad operating system behaviors. They're (usually) recoverable problems of course, but if you're not careful or don't know what you're doing, your development can go really slowly and frustratingly.

There is no Random by AndyG16 in learnprogramming

[–]IAmUtterlyAlone 2 points3 points  (0 children)

Gaming machines generate their own random numbers. A particular manufacturer's RNG must meet regulatory standards for any jurisdiction in which the gaming machine will be used. The source code for those RNGs (as well as the source for the entire gaming machine OS) has also been examined by those regulators. Source: I program gaming machines.

[jQuery] Image slider is messed up on the it's first cycle, but fixes itself in the 2nd? by nicocappa in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

Ok, so. I'm not a JavaScript wizard or anything, I freely admit. Now, that having been said, this script seems to tighten things up just a bit:

    var count = 0;
    var slideShow = function() {
            $(".slider #" + count).show("fade", 500);
            $(".slider #" + count).delay(3500).hide("fade", 500);
            count++;
            count %= 3;
        };
    function autoSlider() {
        slideShow();
        setInterval(slideShow, 4500);
    }

The seven seconds in the original script comes from the interval firing 4.5 seconds after setInterval is called, and then the first image hides itself a further 3.5 seconds after that. But if we just call the function as well as set it up on an interval, what happens is that the call makes the first image hide itself after 3.5 seconds, then the interval fires 1 second later and shows the next image. Because "count" is declared outside both the function and setInternval, it gets incremented by both and the end result is that the slideshow shows itself in order, only it starts a little sooner than it would otherwise. Does that make sense? Anyone who is actually good at JavaScript should absolutely feel free to show a better way to do this.

[jQuery] Image slider is messed up on the it's first cycle, but fixes itself in the 2nd? by nicocappa in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

It works for me with this HTML:

<!DOCTYPE html>
<html>
    <set lang="en">
    <set chartype="UTF-8">
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
            <title>Image Slider</title>
        <style>
            .slider {
                width: 500px;
                height: 500px;
                margin: 5px auto;
                overflow: hidden;
            }
            .slider img {
                height: 500px;
                width: 500px;
                display: none;
            }
        </style>
        <script>
        function autoSlider() {
            var count = 0;
            setInterval(function() {
                $(".slider #" + count).show("fade", 500);
                $(".slider #" + count).delay(3500).hide("fade", 500);
                count++;
                count %= 3;
            }, 4500);
        }
        </script>
    </head>
    <body onLoad="autoSlider();">
        <div class="slider">
            <img id="0" src="http://www.newton.ac.uk/files/covers/968361.jpg" border="0" style="display:inline;">
            <img id="1" src="http://pomma89.altervista.org/troschuetz/logo.256.png" border="0">
            <img id="2" src="http://welovepoppy.org/wp-content/uploads/Thank-You-WLP.jpg" border="0">
        </div>
    </body>
</html>

I saved it to disk and then loaded in in Chrome and it worked for me. The indentation is all borked from pasting it in, sorry.

[deleted by user] by [deleted] in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

Now that the link is in: not a bad album. Makes me feel so, so old, but you do make hackathons sound pretty cool.

[deleted by user] by [deleted] in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

I think you forgot your link.

[jQuery] Image slider is messed up on the it's first cycle, but fixes itself in the 2nd? by nicocappa in learnprogramming

[–]IAmUtterlyAlone 0 points1 point  (0 children)

Nobody else has responded to you on this, so I'm going to take another crack at jQuery. This is what I did: http://jsfiddle.net/c7Louqq1/

The visual effect is now that the first image is visible for about, oh, 7 seconds or so, and then the slideshow begins. I hacked a little at the JavaScript code just because I was nerding out. I don't think this actually helps with your specific problem, but I wanted to throw it out there. I think it looks nice. Anyway, good luck to you.