• Breaking News

    Friday, March 8, 2019

    Value order not as expected, after performing a BFS on the graph? Ask Programming

    Value order not as expected, after performing a BFS on the graph? Ask Programming


    Value order not as expected, after performing a BFS on the graph?

    Posted: 08 Mar 2019 09:34 PM PST

    I'm trying to create a graph based on adjacency lists. This is the structure of the graph.

    class Graph{ private: struct Vertex { int data; Vertex *next; set<int> anti; }; struct Neighbors { Vertex *head; }; public: int Limit; list<int> print_list; Neighbors *adjacent; Graph(int Limit); Vertex* Add_Vertex(int data); void Connect(int before, int data); void Display(); list<int> BFS(int v); list<int> DFS(int source); }; 

    The code compiles completely fine, but when I try to replicate the order of creating edges for LINK or any other page, I always get a different order.

    My question is, what is causing my order to be different from theirs? I think I'm following the logic smoothly but instead of producing 2 0 3 1, I produce 2 3 0 1. As much as possible, I want these outputs to be similar.


    Edges & Creation:

    Graph::Vertex* Graph::Add_Vertex(int data) { //Initialize vertex Vertex* temp = new Vertex; temp->data = data; temp->next = NULL; return temp; } void Graph::Connect(int first, int second) { Vertex *temp; //Create a vertex and get pointer for second if (first != second) { //Create a vertex and get a pointer for first temp = Add_Vertex(first); //Connect created node to second vertex temp->next = adjacent[second].head; adjacent[second].head = temp; } temp = Add_Vertex(second); //Connect created node to first vertex temp->next = adjacent[first].head; adjacent[first].head = temp; } 

    BFS Implementation (Main call not included):

    list<int> Graph::BFS(int from) { print_list.clear(); bool *visited = new bool[Limit]; for (int i = 0; i < Limit; i++) visited[i] = false; list<int> queue; visited[from] = true; queue.push_back(from); while (!queue.empty()) { from = queue.front(); print_list.push_back(from); queue.pop_front(); Vertex *Displaying = adjacent[from].head; while (Displaying) { int adjacent_node = Displaying->data; if (!visited[adjacent_node]) { visited[adjacent_node] = true; queue.push_back(adjacent_node); } Displaying = Displaying->next; } } return print_list; } 

    Another test on:

    1 2, 2 3, 1 5, 1 4, 4 7, 7 8, 8 9, 2 6, 5 7

    Expected:

    1 2 4 5 3 6 7 8 9

    Actual:

    1 4 5 2 7 6 3 8 9

    Where starting vertex is 1.

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

    [GIT] Heavy editing a fork but still getting updates from origin/master

    Posted: 08 Mar 2019 09:45 AM PST

    Hey guys,

    do you guys have any experience / tips for having a fork of a project that is rather heavily edited (20% of files removed, some new files, 20% slightly edited) and still getting updates (merging with origin/master)?

    Would it be as simple as just doing a merge every bunch of commits?

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

    Is there a tool to automatically generate GitHub pull-requests against my fork of a upstream library?

    Posted: 08 Mar 2019 07:58 PM PST

    I maintain a fork of an upstream project on GitHub. I'd like to be notified of changes to the upstream project (it's fairly quiet, so it shouldn't be too noisy) — but more importantly, I want Travis-CI automatically building each possible merge when features are merged upstream.

    That is, if something is committed upstream (with, say, a 24-hour de-bounce period?), I'd love a bot that opens a new pull-request against my fork's repo with a merge-commit containing those new changes. That way, Travis-CI's pull-request-building features would kick-in, and I'd be able to see (even on my phone) whether that commit still passes tests in the fork, and use a single tap to keep my fork up-to-date with the upstream.

    Does anybody know of a product, tool, or workflow along these lines?

    Thanks!

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

    Programming Games (With Basketball?) For Kids

    Posted: 08 Mar 2019 07:40 PM PST

    Are there any such games? I have a private student (10 years old) who might really enjoy something like this.

    Thanks in advance for your help.

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

    Possible to automate large batch (3,000+), resizing and re-positioning of an image?

    Posted: 08 Mar 2019 07:27 PM PST

    Hey,

    Not a programmer but I did try to learn python a while back. A scenario came up at work that I'd like to solve. Essentially we have a bunch of company logos in PNG files. We also sometimes display them, but they are resized and repositioned (blank space on all sides of logo for it to be positioned correctly). So is it possible to take a logo, size it to a given size, put it in a certain location, and do the same for all files within a location?

    If so, can I have a quick rundown of what to research? Thanks! :)

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

    OSCeleton Signal Help

    Posted: 08 Mar 2019 06:14 PM PST

    I don't know if this is the correct subreddit to ask for programming advice, but I am a music producer that is trying to use the Kinect for an audivisual display. I downloaded the Kinect SDK 2, OSCeleton which sends OSC signals (https://github.com/Zillode/OSCeleton-KinectSDK2) to Ableton. It is a Visual Studio Solution that uses Kinect SDK drivers.

    It uses indexes at the beginning to define the joint, however, Ableton can only read one signal at a time. In a more clear manner, it sends the signal with this format:

    Address pattern: "/osceleton2/hand" Type tag: "iiiffffifd" i: The ID of the sensor i: The ID of the user i: The ID of the hand (1 == Left, 2 == Right) f: X coordinate of joint in real world coordinates (centimetres) f: Y coordinate of joint in real world coordinates (centimetres) f: Z coordinate of joint in real world coordinates (centimetres) f: confidence value in interval [0.0, 1.0] i: state of the hand (1 == Open, 2 == Closed, 3 == Lasso, 4 == Unknown, 5 == NotTracked) f: confidence value of the hand state in interval [0.0, 1.0] d: time stamp in milliseconds since Unix epoch 

    For Ableton, I need the signal to be:

    Address pattern: "/joint/name/id" Type tag: "fff" f: f: Y coordinate of joint in real world coordinates. f: Z coordinate of join in real world coordinates. f: X coordinate of the joint in real world coordinates. 

    I don't even know how to locate the part in which it sends the signals and reformat it. Any help would be appreciated, though I'll try to keep analyzing the code.

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

    SE that studied Data Structures & Algorithms after being in jobs, did it help your day to day work?

    Posted: 08 Mar 2019 01:47 AM PST

    I've been a software engineer for 5 years and even though I studied Data structures & Algorithms at University I can't remember how to merge sort, binary tree sort, how to super effectively work out a palindrome etc.

    Would studying these things now that I have a lot more perspective and context help me with my day to day job and help produce more efficient, elegant solutions to problems?

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

    Twitch view bot help

    Posted: 08 Mar 2019 08:13 PM PST

    How do I make a view bot that gives twitch traffic under different IP in C language?

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

    CalendarView with events and date picker

    Posted: 08 Mar 2019 12:29 PM PST

    Hello everyone. I wanted to ask you is there some android library written in Kotlin for CalendarView with events and date picker. I've tried searching for such thing in GitHub, but I haven't found anything. I'm stuck with this and I can't do anything. Thank you for helping!

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

    How did you get your first programming job?

    Posted: 08 Mar 2019 06:18 AM PST

    Hi. Ive been learning to code for a few months. Im putting together a few projects now. Whats the best way to get a job? How did you get your first one?

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

    [Paying] Need someone whos good at Java

    Posted: 08 Mar 2019 06:24 PM PST

    Need to be available at 8am tomorrow I will be paying you to watch over me as I complete a java project and tell me where I have made mistakes and how to move forward. will be paying good

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

    ps3 assembly language

    Posted: 08 Mar 2019 09:36 AM PST

    Obviously back in the day games were written in assembly, differing in language depending on the hardware of the system. Now games are written in a plethora of languages, disregarding assembly, which is fine. However, like systems back in the day, your console would still have a display when turned on before the game would load (on the dreamcast, for example, it asks you for your time, and gives a menu to scroll through. The gamecube, wii, and many other systems have this in place). So my question is what assembly language does the ps3 use? What CPU was used? What language is used to create the menu, animations, and other such things? Thanks for answering if you can, I'd appreciate it

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

    Kinda an ad but

    Posted: 08 Mar 2019 12:25 PM PST

    I was wondering if anyone here could help me create a program that would auto vote on a site. I was gonna try to use an autoclicker and keyboard typer but the position of where the thing that needs to be clicked changes and so I need something that would take input from my screen and IDK how to code that shit.

    Thx <3

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

    need help with JavaFX Gridpane coloring

    Posted: 08 Mar 2019 08:01 AM PST

    Me and a friend are working on a Conway's Game of Life right now for a school project, but right now we have to click each individual panel in a grid in order to color it.

    I was wondering if there is a way to see if the mouse is pressed when hovering over a panel of the grid so it can then be colored.

    Link provided shows how our game looks like atm. I want it to color the panes as I click and drag over them.

    https://imgur.com/a/c3nzZ73

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

    Is it bad form to copy and paste large portions from someone else's script?

    Posted: 08 Mar 2019 07:42 AM PST

    I have a great idea for a script (one of my first scripts for work) that I want to write and I found that another script an old colleague on another team made has a ton of the pre-requisite stuff all written out nicely. I would be copying 90% of his pre-requisite portions and it would save me a ton of time as otherwise I'd have to re-invent the wheel. If that makes sense.

    The purpose of my script is different than his but his pre-reqs and variable setups are basically what I would need in mine. Should I just write my own and ignore his script entirely or should I go ahead and copy and paste a ton?

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

    Anyone know how to edit/render images with java/c/python?

    Posted: 08 Mar 2019 07:40 AM PST

    Hey guys, gonna need som help..

    Currently working on a black jack project, and i got the logic working. Now, I want to create images of the current table situation.

    Imagine having a black jack table picture, and a bunch of card-pictures. I want to edit these cards onto/ontop of the black jack table picture.

    So let's say the logic says player has Diamond 10, Clubs 5. Dealer has .. Hearts of 4 and a hidden card.

    I then want to generate a Diamond 10 and a Clubs of 5 at a pre-determined position. Also generate the dealers' cards at a specified location ontop of the table image.

    If there is a way to load the image into a 2D array of pixels, i would simply want to run a double for - loop and replace some given pixels in the table picture with the card' pixels.

    Any advice? thanks in advance (:

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

    What datatype should I use for Optional data? (Javascript, VBA/Excel, Python, and SQLite)

    Posted: 08 Mar 2019 06:07 AM PST

    I have data that will be used in Excel, Javascript, Python, and SQLite. Some of the entries are 'optional', but I was not recommended to use NULL because it can create errors/problems.

    Any suggestion how I should denote a value that a user never gave input for?

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

    Is there a programming book that talks about code but without any code and syntax specific.

    Posted: 08 Mar 2019 04:48 AM PST

    I find books like that entertaining reads. It's like a podcast for code.

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

    SPI OLED with 8051 MCU

    Posted: 08 Mar 2019 03:37 AM PST

    Hello there

    Im currently working on a device thats powered with a C8051F920 MCU and i should control a SPI Oled panel.

    Now ive successfully managed to create a template to programm it on Keil uVision 5 with C but i have no idea how to initiate the panel same as write strings on it could anyone help or at least give me a few hinds?... :)

    Its a 4 wire SPI

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

    Cross-platform App build? How does it work?

    Posted: 08 Mar 2019 01:01 AM PST

    Hi all, I've been tasked to project manage a cross platform solution, and I don't know where to start helping with the BA. Idea is...

    Have an online account to log onto (web). Have an app to log onto (mobile) Both with synced data and live work flow. Solution is a task manager but needs to remain private, so we can't use a SAAS.

    What kind of solution is this? Is it Mobile App, Cross-platform?

    What kind of developers should we source? What language, etc?

    Thank you.

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

    Using most recent data from Node server upon page load

    Posted: 08 Mar 2019 12:21 AM PST

    When my page gets requested, I have my server get data from a database. I've got that part figured out using an express route. Now I obviously want to use that data when generating the page. How do I do this?

    app.get('/', function(req, res) { console.log("GET REQUEST RECEIVED") getData().then(function(result) { data = result; }, function(err) { console.log(err); }); //useDataInAppJs(data); ?????????????????????????? res.sendfile(__dirname + '/public/index.html') }) 

    I've been Googling a lot but just can't seem to figure out how to implement that commented line.

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

    Choices for a person who likes coding but hates front end design ?

    Posted: 07 Mar 2019 10:30 PM PST

    Hi redditors, I like coding. i.m interested to do programs. But i hate front end design. Is there any choices for which completely based on back-end without textboxes, label, dropdown box tools etc ? Interested to see your advices.Thanks in Advance

    Edit : i hope some of you will point embedded systems. i dont have skills in microcontrollers, etc.

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

    No comments:

    Post a Comment