• Breaking News

    Thursday, May 14, 2020

    Beginner RemoveFromArray function on Odin Project. Having some trouble with this. Code listed below. Ask Programming

    Beginner RemoveFromArray function on Odin Project. Having some trouble with this. Code listed below. Ask Programming


    Beginner RemoveFromArray function on Odin Project. Having some trouble with this. Code listed below.

    Posted: 14 May 2020 02:35 PM PDT

    Hey all,
    I'm trying to make a function that takes two or more parameters. The first is always going to be an array, the second is going to be a value. This can be numeric or a string. So far this is what I have thought up.
    https://pastebin.com/hKWNKDyX
    But it fails in certain cases and I'm not 100% clear why.
    For example RemoveFromArray([7,8,9,0],7,8,0) returns Array[9,0].
    If someone could help me understand why this is failing I would appreciate it!

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

    How to learn LaTeX?

    Posted: 14 May 2020 07:54 PM PDT

    I fine it's so hard to use or learn and I need this for university homework.

    submitted by /u/It-is-not-a-username
    [link] [comments]

    Beginner question on Unity, Visual Studio Code and C#

    Posted: 14 May 2020 07:39 PM PDT

    Sorry for such a basic question. I'm used to using XCode, and trying to write a game in Unity is very different from what I'm used to. The first time I ever ran Unity or Visual Studio Code was like two days ago.

    So, I'm working on a string parser for my game, but I'm not sure how to test it. In XCode there was a terminal that I could send output to, but I'm not sure how to do that sort of thing with Unity or with Visual Studio Code. Its literally like a 5 line piece of code that I need to test and it isn't really related to any sort of game object.

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

    How are the most "low level" dll's made?

    Posted: 14 May 2020 03:42 AM PDT

    So I was doing some research on c++ programming to figure out how I would capture data from the webcam. I saw you can use the win32 api, which I am guessing uses system calls (?) to other more "basic" dll's like kernel32 or user32 (examples, probably not the ones).

    I also saw that on the internet there are other dll's that other people had made and that were based on these dll's also.

    So my question is, how are these "basic" or "low level" dll's made? (kernel32, user32 etc)

    And which of these dll's would I have to use to use the webcam, which would be the lowest (in level) I could go to use the webcam? (before firmware and drivers I guess)

    I am just starting to learn about the subject so excuse me if I got any concepts wrong.

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

    Doing backend web dev without much frontend skills?

    Posted: 14 May 2020 05:27 PM PDT

    I have some Python knowledge and am considering exploring some databases so I can start getting into making some basic web applications.

    To do backend development properly, is it possible for it to be done with rudimentary frontend knowledge? HTML and CSS are no issue but having knowledge of JS and frontend technologies seem to be the bigger thing here. Would it be possible to show projects on GitHub in such a manner of where there isn't much for the frontend, but focus is on the backend?

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

    End cursor follow on user click

    Posted: 14 May 2020 08:31 PM PDT

    So I'm working on this project and I need my ball to stop following the cursor when the user clicks down and stay there. The goal is for the ball to get into the goal and have a little jingle play when its at a certain coordinates. I'm just a little unsure on what to do to try to achieve this this at the moment. I'm using Canvas for HTML5 so its all JavaScript. Here's my code to look at.

    var canvas = document.querySelector("#myCanvas"); var context = canvas.getContext("2d"); context.imagesSmoothingEnabled = false; context.webkitImageSmoothingEnabled = false; var canvasPos = getPosition(canvas); var mouseX = 0; var mouseY = 0; canvas.addEventListener("mousemove", setMousePosition, false); function setMousePosition(e) { mouseX = e.clientX - canvasPos.x; mouseY = e.clientY - canvasPos.y; } function update(){ context.clearRect(100, 100, canvas.width, canvas.height); context.beginPath(); context.arc(mouseX, mouseY, 25, 0, 2 * Math.PI, true); var gradient = context.createRadialGradient(150,175,0,150,175,450); gradient.addColorStop(0, "#FFFFFF"); gradient.addColorStop(1, "#000000"); context.fillStyle = gradient; context.fill(); context.lineWidth = 5; context.strokeStyle = '#535353'; context.stroke(); var myImage = new Image(); myImage.src = "soccer-gate.svg"; myImage.addEventListener("load",loadImage,false); function loadImage(){ context.clearRect(0, 0, canvas.width, canvas.height); context.drawImage(myImage,0,0,100,100); } requestAnimationFrame(update); } update(); function getPosition(el) { var xPosition = 0; var yPosition = 0; while (el) { xPosition += (el.offsetLeft - el.scrollLeft + el.clientLeft); yPosition += (el.offsetTop - el.scrollTop + el.clientTop); el = el.offsetParent; } return { x: xPosition, y: yPosition }; } 
    submitted by /u/RoyalWeirdo
    [link] [comments]

    What's a good language to use for fast calculations, and 2d graphics output?

    Posted: 14 May 2020 07:12 PM PDT

    Just for fun, I want to write some programs that output maybe some points, lines, circles, or other shapes on a grid to the screen, and update frequently. Nothing specific here, just fooling around with math and art kind of thing. Just for proof of concept, I was doing this in a C# WPF windows form application, running some math calculations using classes and list objects, and then outputting to the canvas. Granted I was processing a lot of data, but doing it this way, the calculations take a long time, and also doesn't seem an ideal way to handle frequent refreshing of the grid UI. Does anyone know the best tool for this kind of thing?

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

    can anyone tell me the feasibility of this project (on a $0 budget) and point me in the right direction API wise?

    Posted: 14 May 2020 06:59 PM PDT

    so basically, i'm an amateur programmer (read: kind of shitty) but i'm in a pretty good band. for our single release on may 29th, i'm trying to set up a system to make a watch party that's more interesting than a simple zoom call or youtube premiere (details at the bottom of post). i'm basically wondering if you guys think this kind of setup could work and if any of you had any experience with the kind of apis i would need to make this work. given our website is on a budget account on hostinger, i don't think we have the bandwidth necessary to host a custom implementation through our servers. i was trying to figure out a way to do it where people are sent a zoom/google meets/something link on the website or have the video call part routed through zoom or google meets but inside our website, but from what i can tell zoom api access is expensive as fuck and so is google meets.

    i could probably make the chats manually and merge them manually (we're not that big), but i'm not sure how i can make empty zoom or google meets rooms for 2 people and it would be nice to have it scripted.

    anyway, here's the idea, thank you so much!

    6:30

    users connect to website

    they're connected with the next person to connect to the website over video chat

    first conversation prompt

    6:35

    second conversation prompt

    6:40 third conversation prompt

    6:45

    two person chats are merged with another two person chat

    four person chats start being created for people still on the website (after 30s they're added to a four person call)

    fourth conversation prompt

    6:50

    fifth conversation prompt

    6:55

    sixth conversation prompt

    7:00

    all chats merge into big video call

    music video plays

    talk for a little bit

    play unreleased song

    shout out our instagram

    7:20

    end

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

    How does Antivirus software work?

    Posted: 14 May 2020 06:43 PM PDT

    Around 2 days ago, I was surprised because Windows defender flagged CMAKE as a trojan virus when using the MinGW32 compiler specifically and it made me wonder, how does an antivirus program actually work? What kind of algorithms could identify something as a virus? How can you tell the difference between intended behavior and a virus? I tried googling this, but I struggling to find any information on the actual technical details and algorithms they use. All I'm able to find is advertisements for different antivirus programs.

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

    Any quick start guides for C out there?

    Posted: 14 May 2020 11:36 AM PDT

    Hi there, are there any quick start guides to reasonably serious C programming for those with higher-level language experience? I find the literature and courses out there for C are pretty sparse. I'm looking for a "coles notes" for a programmer of the list of things I should recognize with examples. Find the books vary from "hello world" and jump right to "here are five concepts at once which we don't explain". Looking for suggestions.

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

    How can I set different variable for every object I create from a parent class ?

    Posted: 14 May 2020 01:34 PM PDT

    public abstract class ParentClass { private static int pieces; public ParentClass (int Pieces){ pieces = Pieces; } public static void reducePieces (ParentClass Object) { Object.pieces -= 1; } public String toString() { return "Pieces : " + pieces; } } public class KID1 extends ParentClass{ public KID1 (int Pieces) { super(Pieces); } } public class KID2 { public KID1 (int Pieces) { super(Pieces); } } public static void main (String[] args) { KID1 Objective1KID1 = new KID1(4); KID1 Objective2KID1 = new KID1(9); KID2 Objective1KID2 = new KID2(10); KID3 Objective2KID2 = new KID2(30); //I want to reduce 1 piece only from Objective1KID1. ParentClass.reducePieces(Objective1KID1); //print every object's toString. System.out.println(Objective1KID1.toString()); System.out.println(Objective2KID1.toString()); System.out.println(Objective1KID2.toString()); System.out.println(Objective2KID2.toString()); } I expected this output : Pieces = 3 //ParentClass.reducePieces(Objective1KID1); Pieces = 9 Pieces = 10 Pieces = 30 But I get this : Pieces = 29 Pieces = 29 Pieces = 29 Pieces = 29 

    Sorry if what I did is stupid, but I am getting a lot difficulties learning OOP.

    Thank you.

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

    Not sure where to start with fixing this (C)

    Posted: 14 May 2020 05:12 PM PDT

    Apologies in advance if this isn't the right place to post this. My teacher gave this program to start on, but to start she included syntax errors that she wanted us to fix.

    #include <stdio.h>

    int main(void) {

    int length, width; int lcount, wcount; 

    printf("Enter length: "); scanf("%d", &length); 

    printf("Enter width: "); scanf("%d", &width); printf("\\n"); 

    wcount = 0; while (wcount < width) printf("\\n\\t"); lcount = 0; while lcount < length { printf("\*"); \++lcount; } \++wcount; } printf(\\n\\n); 

    return(0); 

    }

    As far as I know the program starts out by asking to enter in a length, and then a width. I've got it to build a couple times but every time it wouldn't output anything after entering a length and width. If anything it would always just output to a blank window with a tiny white rectangle that bounced around for a few seconds. Can anyone help a fellow gamer out please

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

    Do I understand Dependency Injection (sort of need a TL;DR/ELI5 version)?

    Posted: 14 May 2020 04:31 PM PDT

    All of the material I can find about it is so dense and complex because it tries to explain every detail. I need the big picture before I dive down that rabbit hole. I think I have the general idea.

    Is it just passing the dependencies (such as other objects) to the class from outside of the class? For example with constructor injection, you might have a Non-Animal class that uses an Animal object in some way. Then you would create an Animal object in the class that uses it but assign it in the constructor.

    Also, is the point to reduce dependencies between classes and make it easier to unit test (since you can create tests with stub objects passed through the constructor)? Is there any other purpose?

    submitted by /u/-CJF-
    [link] [comments]

    How can I import a C# file into C++/CLI code?

    Posted: 14 May 2020 03:34 PM PDT

    I know that u can use the C# classes directly in C++/CLI but how exactly do u include the cs file in the C++/CLI code?

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

    Can a plagiarism detector be used for accurately checking code?

    Posted: 14 May 2020 01:00 PM PDT

    A few days back, I submitted some code to my college professor, in order to validate my semester.
    Today I got an email saying that he used a plagiarism detector and found out my code was 59% similar to his, and that it shouldn't be more than 15%.

    I'm using python's socket library to create a client and a server. The code is less than 100 lines long, so it's pretty obvious why his code and mine are very similar...

    I did some research and most of the tutorials/docs use the same code structure I used.

    And I'm not the only one in this situation, pretty much all students who submitted something received this mail.

    So I was wondering how I could prove that I actually didn't plagiarise anything and the fact that the code is very similar is a given, due to the shortness of the program & the same library being used.

    Thanks!

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

    What is OpenAPI and how does it relate to Express?

    Posted: 14 May 2020 06:43 AM PDT

    Can someone explain to me the point of OpenAPI? I had understood that for Node.js development, it is standard to build your API using express. But then what good does OpenAPI do for you? Does it substitute some of what express does?

    Sorry for the noob question but I'm really failing to see the point.

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

    SHA265 AND MD5 collisions on files?

    Posted: 14 May 2020 11:01 AM PDT

    Awhile ago, I was reading a hacking article describing a method of altering a file in such a way so it doesn't change the MD5 hash of the file. This was done by changing the file, then padding it out (sometimes many many hundreds of MB) with specific values. I know a lot of download sites provide a MD5 and SHA256 hash, presumably to mitigate this kind of vulnerability.

    I was just wondering, what is the likelihood (or has it been proven to be 0% chance) that 2 different files would have both the same MD5 and SHA256 hashes? That is, if I have file A with MD5_A and SHA256_A, what is the likelihood that file B would also come up with MD5_A and SHA256_A?

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

    Get coverage of protractor tests.

    Posted: 14 May 2020 10:33 AM PDT

    Always run "else"

    Posted: 14 May 2020 01:02 PM PDT

    Whatever you type, run "else". When i write "juan", it runs console.log("Choclo")

    const botonAceptar = document.querySelector("#aceptar")
    const nombreUsuario = document.querySelector("#nombre-usuario").value
    botonAceptar.onclick = function(){

    if(nombreUsuario.toLowerCase() === "juan"){
    console.log("Hola")
    } else{
    console.log("Choclo")
    }
    return false
    }

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

    C++ to C# COM pointer to struct problem

    Posted: 14 May 2020 09:07 AM PDT

    I have a COM interface I'm trying to work with. There are two methods with pointers to structs. Problem is I can't figure out how to marshal them correctly. But I also don't really care about them. They just come with the interface (of which I need one method).

    Is there a way I can just generically cast them to something. I don't really care if I can do anything with them in C#.

    IDL CODE:

    HRESULT OnChanged( [in, unique] tagSTRUCT* pStruct); 

    C++ CODE:

    typedef struct tagSTRUCT { byte b; ULONG l1; ULONG l2; int bpb; int pt; int status; BOOL response; } STRUCT; 

    C# CODE:

    [ComImport] [Guid("COM Guid")] public interface IEvents { void OnMediaChanged(??? struct); // WHAT CAN I PUT HERE TO NOT GIVE A SHIT? } 
    submitted by /u/PressurePass
    [link] [comments]

    SoapUI Question

    Posted: 14 May 2020 09:00 AM PDT

    I'm trying to follow this doc: https://www.soapui.org/soapui-projects/ws-security/

    Under 1. Getting started, item #10, I have tried using signature as WSS Entry but its not being added to my request. Any ideas why?

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

    Return info from a different csv column

    Posted: 14 May 2020 08:23 AM PDT

    Hi,

    I am getting back into programming and I'm working on a program in python that reads a user's input into a csv file and after verifiying the content is there, returns information from a different column. For instance, if I enter a MLB players name, I should get his current lifetime batting average.

    Any help would be greatly appreciated

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

    Best place to practice data structures and algorithms?

    Posted: 14 May 2020 07:47 AM PDT

    How does one approach a “high risk” codebase?

    Posted: 14 May 2020 07:41 AM PDT

    Given, Ive start working on an existing codebase where the overall architecture looks like this:

    AngularJS client -> Business API -> Data API -> Common API -> Database

    Where the common API houses the relational models and ORM mapping for all the tables in the database.

    The way this was designed in the Business API was such that in a certain part of it, dozens of different workflows are hard-coded for status processing. There is a very tight coupling here and any minor logic changes here will result in bugs in completely unrelated components.

    To boot, 7-8 devs are all working on one big class and one big stored procedure so changes are always being overwritten as others are force pushing.

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

    No comments:

    Post a Comment