• Breaking News

    Saturday, March 24, 2018

    [Need help] Move picture box 1 to picture box 2 (basic game AI) Ask Programming

    [Need help] Move picture box 1 to picture box 2 (basic game AI) Ask Programming


    [Need help] Move picture box 1 to picture box 2 (basic game AI)

    Posted: 24 Mar 2018 08:12 PM PDT

    Hi all.

    I am making a simple game for my college course. At the moment I have done almost everything but I want to add enemy AI to my game. (doesnt have to be any good. I just want it to move towards the player at a constant speed. https://i.imgur.com/3yYxaMy.jpg)

    The form code is here: https://pastebin.com/ppvqmMe4

    My goal is to get pbxEnemy to move towards Player at a set speed.

    I have tried a bunch of stuff but I really dont know what to do. Any help would be lovely :)

    If this is the wrong place then I am sorry

    submitted by /u/EddieTheLiar
    [link] [comments]

    Need help with my future in programming(Java)

    Posted: 24 Mar 2018 10:05 AM PDT

    I started learning programming in August 2017. I am most comfortable with Java. Starting in January, I began learning OOP. So far, I've loved all of it. I have a lot of fun being challenged with my homeworks. But there's one major thing that I hate: making GUIs. I absolutely hate working with them.

    My professor recommends we use SceneBuilder to build our applications. My problem with using SceneBuilder is, although it does make building the GUI fast and easy, it feels like it's taking away from my learning, because I don't get to think through what's being made. Maybe I am just being proud. Maybe it's his requirement of binding file input, file output, and styling stuff in XML.

    The thing is, when I think about my future in programming, I now dread the idea of working a job where all I do is make GUIs. Are there any software programmers out there who work jobs where they don't have to make GUIs?

    I could really use some insight as to whether or not this field is really for me. Thanks in advance.

    submitted by /u/nehsquidward
    [link] [comments]

    Dealing with Files and Directories

    Posted: 24 Mar 2018 07:48 PM PDT

    When it comes down to dealing with files and folders, is Bash a better option than C (in terms of simplicity)?

    submitted by /u/nanoman1
    [link] [comments]

    A Very Unique Question (Hopefully)

    Posted: 24 Mar 2018 07:35 PM PDT

    So I'll be upfront: I know nothing about programming. That doesn't mean I won't learn in order to accomplish my goal. It's just that, at the time of this post, I don't know anything.

    Premise:

    I need to make a Mac-based program that does the following:

    1) automatically converts multiple PNG files from screenshots to PDF via drag-and-drop

    2) automatically fixes any orientation issues which are the result of converting PNGs into PDFs (sometimes they're lopsided)

    3) automatically merges these individual PDF files into one or more PDF containers (with the caveat being that every time the new PDF container exceeds 1 MB the remaining files go into a second PDF container until that also exceeds 1 MB and so on...)

    4) automatically names these new PDF container files in chronological order (1, 2, 3...)

    5) automatically saves every new PDF file onto the desktop without having to select it as the destination

    I won't go into why I need to build this program (it's work-related), but my questions are these:

    1) What would be the best programming language to learn to accomplish this?

    2) Should I use Xcode or something else to write this program?

    3) Is something like this possible?

    Thank you!

    submitted by /u/KayJayButton
    [link] [comments]

    What would be best to make a GUI with a interactive, updating graph network?

    Posted: 24 Mar 2018 01:13 PM PDT

    Hi, I'm trying to do a quick project which shows how things spread. Need a GUI that can update quickly and show animation based on what people select. What do you think would be best to try to start this in?

    I'm trying to model different algorithms like Random Walk.

    I'm thought python but not sure how to really work with GUI in python. I have only done like Visual C#, which doesn't seem like it would update very well.

    submitted by /u/howtoevenreddit
    [link] [comments]

    How do I make my linked list display alphabetically?

    Posted: 24 Mar 2018 04:58 PM PDT

    Hi, I have gotten the basics of my linked list code to work, and the add function now works, however I need to do it in alphabetical order. Any tips?

    public class LinkedList { Node head; int listcount = 0; public LinkedList() { this.head = null; this.listcount = 0; } public void Add(Node n) { Node current = this.head; if (current == null) { head = n; } else { Node prev = null; while (current != null) { prev = current; current = current.next; } prev.next = n; } listcount++; } public String toString() { StringBuilder builder = new StringBuilder(); Node current = this.head; while (current != null) { builder.append(current.data).append(", "); current = current.next; } return builder.toString(); } } public class Node { String data; Node next; Node prev; public Node(String data, Node next) { this.data = data; this.next = next; } Node() { } public String getData() { return this.data; } public void setNext(Node next) {//setnext this.next = next; } public Node getNext() { return next; } } public class main { public static void main(String args[]) { String start; boolean finished=false; LinkedList list = new LinkedList(); while(!finished) { start = JOptionPane.showInputDialog("Enter 'A' to add an item" + "\n" + "Enter 'D' to delete an item\nEnter 'F' to find an item."); if (start.equals("a") || start.equals("A")) { Node focus = new Node(); focus.data = JOptionPane.showInputDialog("enter an item to ADD"); list.Add(focus); JOptionPane.showMessageDialog(null, "your list is\n" + list.toString()); } else { finished = true; } } } } 
    submitted by /u/blankbleak
    [link] [comments]

    Access running python program from multiple computers?

    Posted: 24 Mar 2018 12:51 PM PDT

    I'm looking for implementation suggestions. My situation is that I have a Raspberry Pi which is controlling a physical device (continuously reading data from it and writing commands to it), and I need to be able to talk to it from multiple computers (all machines and the Pi are connected on the local network). I plan to write the code in python. I can ssh into the Pi, so one obvious solution is to just write a bunch of scripts on the Pi and call them remotely to access/write data. I'm wondering if there is a more elegant solution; it'd be nice to essentially have a continuously running program on the Pi that facilitates communication with the device, and I could just talk to that program from my other machines. How hard would something like this be? I'm willing to learn a bit of web programming, but given that I already have one working solution it wouldn't be worth too much time. Any thoughts?

    submitted by /u/stellar_guy
    [link] [comments]

    (C) how can I compare two integers (greater than/less than) using only bitwise operators?

    Posted: 24 Mar 2018 03:51 PM PDT

    Seems it might involve using sizeof()

    submitted by /u/PuppyLand95
    [link] [comments]

    My goal is to make a program that uses gridworld to display a string.

    Posted: 24 Mar 2018 11:43 AM PDT

    Every single box in my string should be filled with a letter and if there are any extra boxes, they should be filled with the last digit. The error I am running across is:Exception in thread "main" java.lang.NullPointerException at gridworld.WordSquare_BenMcDonald.<init>(WordSquare_BenMcDonald.java:41) at gridworld.WordSquareRunner_BenMcDonald.main(WordSquareRunner_BenMcDonald.java:6)

    Here is my actual code: package gridworld;

    import info.gridworld.grid.Grid;

    import info.gridworld.world.World; import info.gridworld.grid.Location; import info.gridworld.actor.Actor; import info.gridworld.actor.ActorWorld; import info.gridworld.grid.BoundedGrid;

    // This class should take any string and display that string in a square grid fit to hold the string.

    public class WordSquare_BenMcDonald { // Create instance variables for the grid and World (not ActorWorld), and the string being passed to it. private int number=0; private String lastDigit = null; private int length = 0; private World<String> BEN; private int counter=0; public BoundedGrid<String> grid;

    public WordSquare_BenMcDonald(String s) { length = s.length(); lastDigit = s.substring(s.length() - 1); number= (int) Math.sqrt(length); if(number* number == length) { new BoundedGrid<String>(number,number); BEN = new World<String>(grid); } else { new BoundedGrid<String>(number +1, number +1); BEN = new World<String>(grid); } for (int x=0; x< grid.getNumCols() - 1; x++) { for (int y= 0; y < grid.getNumRows() -1; y++) { if (counter<s.length()) { BEN.add(new Location(x,y), s.substring(counter,counter+1)); counter++; } if (counter >= s.length()) { BEN.add(new Location(x,y), s.substring(s.length()-1)); } } } } public void show() { // Set the title and show the world with the string displayed BEN.setMessage("Word Square World!"); BEN.show(); } 

    }

    submitted by /u/bendmacd
    [link] [comments]

    How to turn on and off the Dark theme of YouTube automatically based on time of day?

    Posted: 24 Mar 2018 05:44 AM PDT

    I want to write a Tampermonkey script so that every day after 5:30pm, the Dark theme of YouTube automatically gets turned on. And next day, after 6:30am, it gets turned off. What would be the Tampermonkey script required to make this happen?

    submitted by /u/jupiter_104
    [link] [comments]

    Linked list add command not working effectively. Anybody have any tips?

    Posted: 24 Mar 2018 11:26 AM PDT

    Hello, I am doing a linked list program with an add, delete, and find option for a school project, however, for some reason I can not get the list to display. It will either give me an error or only display the head node. any tips?

     public class main { public static void main(String args[]) { for (int i = 0; i < 3; i++) { LinkedList list = new LinkedList(); Node focus = new Node(); String start; start = JOptionPane.showInputDialog("Enter 'A' to add an item" + "\n" + "Enter 'D' to delete an item\nEnter 'F' to find an item."); if (start.equals("a") || start.equals("A")) { focus.data = JOptionPane.showInputDialog("enter an item to ADD"); list.Add(focus); while (focus != null) { focus = list.head; focus = focus.next; JOptionPane.showMessageDialog(null, "your list is\n" + focus.getData()); } } } } } public class Node { String data; Node next; Node prev; public Node(String data, Node next) { this.data = data; this.next = next; } Node() { } public void setData(String data) { this.data = data; } public String getData() { return this.data; } public void setNext(Node next) {//setnext this.next = next; } public Node getNext() { return next; } } public class LinkedList { public Node head, tail; int listcount = 0; public LinkedList() { this.head = null; this.tail = null; this.listcount = 0; } LinkedList(Node Set) { } public void Add(Node n) { Node current = this.tail; if (current != null) { current = this.tail; this.tail = new Node(); } else { this.tail = new Node(); this.head = this.tail; } listcount++; } } 
    submitted by /u/blankbleak
    [link] [comments]

    [C#] Help displaying an array

    Posted: 24 Mar 2018 11:24 AM PDT

    I'm trying to display the full array if the user selects that they want to see it in normal order, reverse order, and then be able to pick a specific number in the array.

    Obviously the first for statement allows them to pick a specific number in the array, but that's not exactly what I intended but it worked so that problems solved.

    I just need help figuring out how to display the whole array for the first option then I feel like I can easy code it for reserve order.

    Any tips or advice would be very helpful. Thank you!

    int[] nums = {7, 6, 3, 2, 10, 8, 4, 5, 9, 1};

    WriteLine("1: to view list in order from first to last");

    WriteLine("2: to view list in order from last to first");

    WriteLine("3: choose a specific position to view");

    WriteLine("4: to exit the program");

    int userInput;

    Write("Enter an option: ");

    userInput = int.Parse(ReadLine());

    for (userInput = 0; userInput <= nums.Length; userInput++)

    WriteLine(nums[userInput]);

    submitted by /u/Xytomax99
    [link] [comments]

    Questions about learning COBOL.

    Posted: 24 Mar 2018 09:03 AM PDT

    I'm a second year computer science student and, like everyone, looking for ways to differentiate myself from my peers. Everyone thinks they have the next big idea obviously, but I was wondering if going backwards (so to speak) and learning COBOL would be a good way to stand out? Will COBOL give me any edge in job hunting? I've read it's still quite common as legacy software, are companies desperate for people to maintain it? I figured I could get a book and start to learn it over the summer, but only if it would be worth my time.

    submitted by /u/CombustiblePineapple
    [link] [comments]

    When is it practical to use stored functions over scripts in the back end? [SQL, PHP]

    Posted: 24 Mar 2018 02:19 PM PDT

    I've looked around for information but found wildly different opinions on it. I figured things that don't require anything special that MariaDB can do can be done in the database as they're designed for the sort of thing.

    I may be asking too vague of a question. I can elaborate more if necessary.

    Edit: I should have mentioned this is a personal project that's just started so anything can be completely changed.

    submitted by /u/ROMaster2
    [link] [comments]

    How do 3rd Party Applications access our Bank Account?

    Posted: 24 Mar 2018 07:03 AM PDT

    How do third party apps like Venmo, Google Wallet, Mint, etc. access our Bank Accounts after we supply them our login information? Are they using custom web scrapers? Do they have some kind of deal with these Banks that allows them access to an API? My Google skills are failing me on finding an answer to this question. Appreciate any information on this!

    submitted by /u/a-butler
    [link] [comments]

    XPath - How do I save the h4-tag?

    Posted: 24 Mar 2018 06:17 AM PDT

    I've been tasked with cleaning out some html from a series of html-documents of´varying standard and age. In most of them there's a <table>-element containing a menu and a h4-element. Now, how do I remove the <table> but keep the h4-element? The table usually sits directly beneath the <body> (ie. childnode 1), Chrome dev-tool gives me the following XPath for the table, /html/body/table[1]. The HTML looks likes this,

    HTML CODE

    <table align="center" border="0" cellpadding="0" cellspacing="0"> <tr><td height="30" align="center" colspan="5"><h4>We need to keep this Information Header, Vol. 5 No.5, April 2000</h4></td></tr> <tr> <td><a href="infres53.html" target="_top" onclick="MM_nbGroup('down','group1','contents','',1)" onmouseover="MM_nbGroup('over','contents','../figs/contents1.gif','',1)" onmouseout="MM_nbGroup('out')"><img name="contents" src="../figs/contents.gif" border="0" alt="" onload=""></a></td> <td><a href="../iraindex.html" target="_top" onclick="MM_nbGroup('down','group1','authorindex','',1)" onmouseover="MM_nbGroup('over','authorindex','../figs/iauthori1.gif','',1)" onmouseout="MM_nbGroup('out')"><img src="../figs/iauthori.gif" alt="" name="authorindex" width="120" height="20" border="0" onload=""></a></td> <td><a href="../irsindex.html" target="_top" onclick="MM_nbGroup('down','group1','subjindex','',1)" onmouseover="MM_nbGroup('over','subjindex','../figs/isubji1.gif','',1)" onmouseout="MM_nbGroup('out')"><img src="../figs/isubji.gif" alt="" name="subjindex" width="120" height="20" border="0" onload=""></a></td> <td><a href="../search.html" target="_top" onclick="MM_nbGroup('down','group1','search','',1)" onmouseover="MM_nbGroup('over','search','../figs/isearch1.gif','',1)" onmouseout="MM_nbGroup('out')"><img src="../figs/isearch.gif" alt="" name="search" width="120" height="20" border="0" onload=""></a></td> <td><a href="http://InformationR.net/ir/" target="_top" onclick="MM_nbGroup('down','group1','home','',1)" onmouseover="MM_nbGroup('over','home','../figs/ihome1.gif','',1)" onmouseout="MM_nbGroup('out')"><img name="home" src="../figs/ihome.gif" border="0" alt="" onload=""></a></td> </tr> </table> 

    END CODE

    I am using C# with HtmlAgility to "clean" out these unwanted elements. But I can't figure out how to keep the h4-tag intact. I was thinking I could move it above the table and then delete the table...but can't get that to work.

    submitted by /u/christerjohansson
    [link] [comments]

    How to join two data tables in Visual C#?

    Posted: 24 Mar 2018 02:45 AM PDT

    In visual studio, I have a data set connected to a MySQL database which contains 3 data tables (person, fruit and person_fruits) where I need to execute the following command to join them and retrieve the new values:

    select person.name,fruit.fruitname from person p inner join person_fruits pf on pf.personid = p.codigo inner join fruit f on f.fruitname = pf.fruitname 

    The command will then return this new table so I can retreive its values:

    Name FruitName Bob Apple John Banana John Orange 

    How do I execute this command and store its values to a new data table and to a string?

    (Note: The table names and its values are fictional, used as an exemple)

    submitted by /u/Usanha
    [link] [comments]

    Question about a CAS login system similar to Google.

    Posted: 23 Mar 2018 11:36 PM PDT

    Hi r/AskProgramming!

    I am currently making 2 different websites with 2 different functions, both need users to register and login to post, vote, etc.

    But instead of having 2 different database models for 2 different register systems for 2 different sites, I want to have a universal CAS login system where only 1 account to create is necessary, with both websites having their own database table for data used for each project, and it can log you into both the 2 present websites AND any future websites or projects I make, be it through use of an API implementation or Oauth. I would also like users to be able to access a dashboard at each website to change their settings on their account for that website, as well as a general dashboard, where you can change your general account settings.

    A good example of what I want is how you can access Google Search, YouTube, Nest, Google Maps, and all other Google Services with just one google account. I want to do something like that.

    Any advice/direction/steps/guides would be appreciated! I need all the help I can get with this!

    -hazeust

    submitted by /u/hazeust
    [link] [comments]

    No comments:

    Post a Comment