• Breaking News

    Sunday, June 9, 2019

    Noob question but how can I check multiple values in an if statement using || c# Ask Programming

    Noob question but how can I check multiple values in an if statement using || c# Ask Programming


    Noob question but how can I check multiple values in an if statement using || c#

    Posted: 09 Jun 2019 06:14 PM PDT

    if(chance == 2 || chance == 3 || chance == 4) Seems very inneffcient I'm still fairly new so sorry if it's a stupid question, I tried google but couldn't word it correctly.

    Even better would be something like this if chance is equal to anything from 1-30;

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

    What to call a design document only of algorithms and math proofs?

    Posted: 09 Jun 2019 03:42 PM PDT

    I'm doing a personal project right now, and I've been writing a lot of mathematical models, algorithms, and math proofs to show their effectiveness. It's not as inclusive to call it a design document as it makes no reference outside of algorithms, but what would I call this document?

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

    Has Java's popularity been slipping over the past few years?

    Posted: 09 Jun 2019 09:15 PM PDT

    It seems like Java was substantially more ubiquitous just a few years ago, but now outside of Android development I almost never see anyone using it. But C# does seem to have taken over it's place and gained a lot of favor at the same time.

    Is this even true or do I just not notice anything Java related anymore because I stopped using it?

    submitted by /u/I-Downloaded-a-Car
    [link] [comments]

    Planning out projects and other responsibilities?

    Posted: 09 Jun 2019 07:03 PM PDT

    Hey everyone. I'm a college student and I'm on summer break right now. This summer, I am working part time at a gym, helping a lab with work, and I also have a big list of personal projects that I want to do over the summer. I learn best by doing, so doing these projects will help me become more proficient with multiple computer languages. I am looking for some advice on how to plan these out. If you have any methods I could use to plan out my responsibilities, could you share them in the comments please? Since most of these projects involve programming, are there any planning techniques used in the workplace that I might be able to use to plan out my work and set deadlines to make progress? I think this would be helpful because I would learn about how things are planned in the workplace and could help me in the future. Finally, what are some good books about productivity?

    Sorry for asking all of these questions, I just want to plan out all my responsibilities so I don't come out the summer feeling like I wasted it. If this isn't the right place for this post, please direct me to the right subreddit

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

    Need to make my python code faster!

    Posted: 09 Jun 2019 01:18 PM PDT

    Currently while running this on Google Colab, in the conversion stage of audio chunks to images and saving them, after saving around ~1k images, it eats up all the RAM and stops. Is there a way to fast this up? Maybe use parallel programming?

    https://codereview.stackexchange.com/q/221790/202403

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

    Programming language

    Posted: 09 Jun 2019 09:03 PM PDT

    What kind of language should I learn and how should I learn it for being a beginner?

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

    Need some help understanding and adding angular constraints to CCD, (simple) inverse kinematics

    Posted: 09 Jun 2019 08:42 PM PDT

    I'm terrible at maths. I've been working on an IK solution to try and get more comfortable with using maths/angles in Unity.

    I've been able to made a CCD solution which works like this: https://www.youtube.com/watch?v=tZvdZGUxbbc

    But when I try to put angle constraints on the joints, I get some weird behaviour - shown here: https://www.youtube.com/watch?v=k1YY9KqqaYY

    I'm unsure why my constraints do not behave as intended and cause the rapid snapping seen.

    They also cause the solution to be innacurate (the heel no longer perfectly positions at the target).

    Here is my angle constraint code, scraped together from bits of advice etc:

    //clamp current joint rotation within set limits

    Vector3 currentJointEulerAngles = joints[i].joint.transform.localRotation.eulerAngles;

    if (currentJointEulerAngles.x > 180f)

    currentJointEulerAngles.x -= 360f;

    currentJointEulerAngles.x = Mathf.Clamp(currentJointEulerAngles.x, joints[i].XaxisMin, joints[i].XaxisMax);

    if (currentJointEulerAngles.x > 180f)

    currentJointEulerAngles.x -= 360f;

    currentJointEulerAngles.y = Mathf.Clamp(currentJointEulerAngles.y, joints[i].YaxisMin, joints[i].YaxisMax);

    if (currentJointEulerAngles.x > 180f)

    currentJointEulerAngles.x -= 360f;

    currentJointEulerAngles.z = Mathf.Clamp(currentJointEulerAngles.z, joints[i].ZaxisMin, joints[i].ZaxisMax);

    joints[i].joint.transform.localEulerAngles = currentJointEulerAngles;

    If anyone can explain/help me out here I would really appreciate it. Have been pulling my hair out for a full day now.

    If you need any more information I'll add it asap.

    Thanks everyone.

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

    Ways to improve programming skills?

    Posted: 09 Jun 2019 03:24 PM PDT

    Other than solving other programming problems, are there any other ways I can improve my problem solving skills, using games and such?

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

    Using the Decorator Pattern with an Adapter - is this a correct use case?

    Posted: 09 Jun 2019 01:07 PM PDT

    Hello.

    My application is using the Node AWS SDK as to upload images to Binary Object Storage. I have built an Adapter, called FileCRUDOperationsAdapter as a wrapper around the AWS API that permits me to define my own interface for uploading files for the rest of my application to use.

    At one part of my application, images are received from the client in a particular format. I need to do a lot of pre-processing on those images (such as transforming their object properties, resizing them, manipulating the buffers, etc.) prior to using my Adapter to upload them to AWS S3.

    Is this the correct use case for implementing a Proxy or Decorator Pattern around the Adapter, or are there better methods to do it - such as just creating a service class that does the work to prepare the images, and then pass those off to the Adapter.

    I'm also using Test Driven Development, so I need all implementations to be testable.

    Thanks.

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

    What's the best way to send password from client side to server side.

    Posted: 09 Jun 2019 06:56 PM PDT

    I've heard that sending a password from the client side to the server side with HTTPS is pretty safe. But what if I don't have an HTTPS website. What's the best way to do this?

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

    Having trouble with a minesweeper game I'm making.

    Posted: 09 Jun 2019 06:22 PM PDT

    I am working on a Minesweeper game in Python using PyQt5. I'm working on the logic for the function that determines the count for bombs touching a tile. For some reason, the only bomb_touching_count returned is 0. Also, I'm having a problem with placing/removing flags. I haven't figured out how to recognize right clicks, so I've added a button that switches to flag placement mode. Currently, it places the flag fine, but it won't remove the flag on the second click. Can anyone find the error in my logic? Also, any pointers and advice would be appreciated, I'm still a semi-new programmer (2nd year CS student), this is the biggest project I've done.

    https://github.com/kennyb321/minesweeper/blob/master/minesweeper_v3.py

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

    Is there a quick and dirty way to distribute tasks to a GPU in Xcode?

    Posted: 09 Jun 2019 05:52 AM PDT

    I have a physics simulation that takes an hour or so to run. There are a lot of parameters that can be tweaked and I want to sample as much of the solution-space as I can, to search for interesting qualitative effects.

    Learning CUDA properly will take longer than running the simulation.

    I just need brute throughput.

    Is there a poor man's way to achieve this by changing a few settings in Xcode? I quite like being able to use the IDE.

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

    Largest to Smallest loop in RAPTOR

    Posted: 09 Jun 2019 05:47 PM PDT

    Hi, I'm a beginner programmer doing an assignment for my intro class. My textbook and professor have been less than helpful and any help online is in a programming language I don't understand yet, but some tips have been helpful.

    The problem is: "Design a program with a loop that lets the user enter a series of numbers. The user should enter –99 to signal the end of the series. After all the numbers have been entered, the program should display the largest and smallest numbers entered."

    My flowchart in RAPTOR looks something like the following:

    lowest - 10000

    highest - -99

    integer - 0

    WHILE

     ->"Enter a random number and continue to enter numbers when prompted. Enter -99 to exit the loop." GET integer Exit condition: integer= -99 No? Enter number prompt Yes? IF integer > -99 THEN highest - integer, output "the highest number is" + highest ELSE integer < -99 THEN lowest - integer, output "the lowest number is" + lowest 

    My issue is that the programming doesn't seem to be remembering the numbers entered in the input (i think) and then the Console is not displaying the message, only that x amount of characters have been evaluated. ANY help would be greatly appreciated.

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

    Help with data alignment on MIPS

    Posted: 09 Jun 2019 10:43 AM PDT

    I have this example text that looks like the following:

    .data prompt: .asciiz "Please enter your name: " hello: .asciiz "Hello " .align 2 name: .space 20 #buffer for user input

    I don't get what .align 2 does. It forces the next item to begin on a word boundary, so I'm guessing its talking about name? How do you know what word boundary its suppose to go into? Like how do you know what the addresses are?

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

    If GPL code is discovered in a commercial product, does that invalidate any restrictions on redistribution?

    Posted: 09 Jun 2019 12:40 PM PDT

    For example, the PS1 Spongebob Game was found to include GPL'd code:

    (https://mobile.twitter.com/foone/status/1137120829005750272?fbclid=IwAR1_rLd1V__KoSmkxq1VMy4pVUrxhrudn6FcZ25tt-qrkfWdIff0Esbxi40)

    Does that mean we're free to redistribute it? If the software were more modern, would this mean it was automatically GPL'd as well, regardless of what the company that owned it said to the contrary?

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

    How to parse flat JSON in Java? Easy question!

    Posted: 09 Jun 2019 04:18 PM PDT

    In the server, I have an array of objects that is getting converted to JSON with JSON.stringify(Array);

    In the client (Android), I am receiving the data with the format:

    [{"field":"value", "field2:value"},

    {"field":"value", "field2:value"},

    {"field":"value", "field2:value"}];

    I really want to be able to loop through those three entries in my Android code, and process them separately. They correspond with the three entries in the array that is sent from the server.

    However, I am a JSON Noob and I can't figure out how to do it!

    When I try to convert my Json String to a JSON array with Gson (library), I can an exception saying its 'not an array'). How can I solve this, short of using some hack like string.split, etcetera?

    Working example code for android would be a godsend!

    Thanks!!!

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

    Adding delays between GImages (Java)

    Posted: 09 Jun 2019 10:14 AM PDT

    so lets say you have

    GImage g= new GImage ("Image.png) ;

    GImage n = new GImage ("image2.png");

    add (g);

    add (n);

    and you want their be a delay between add(g) and add(n) so you can see the image (g) for a bit before (n) is added, what would you do? I tryed using delays and even a really big for loop but it doesnt seem to make a delay even when i put the for loop / delay between add(g) and add(n), i dont get it .

    EDIT: i figured it out: use a Swing timer object and use that for your delays

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

    any tools for tracking flaky tests?

    Posted: 09 Jun 2019 03:49 PM PDT

    There are a few articles with really interesting ways to track down flaky tests (e.g. tests that fail randomly sometimes), does anyone know any tools that help track flaky tests across multiple CI runs?

    An example use case would medium-large size integration test suite, with a number of tests that randomly fail <1% of the time. Instead of the error being masked by an engineer hitting re-run, some sort of report that keeps a record?

    https://samsaffron.com/archive/2019/05/15/tests-that-sometimes-fail

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

    [C++] Problem with 2D Vectors

    Posted: 09 Jun 2019 03:32 PM PDT

    I just started using vectors in C++. I feel like I'm being retarded here, but am I doing this right?

    vector<vector<char>> spr

    { {'#','#','#'}, {'#',' ','#'}, {'#','#','#'}, }; Object test(spr, 0,0); 

    Constructor for Object:

    Object(vector<vector<char>>, int x, int y) { this->sprite=sprite; this->x=x; this->y=y; for (int i = 0; i<sprite.size();i++) { for (int j = 0; j<sprite[0].size();j++) 

    cout<<sprite[i][j];

     cout<<endl; } system("pause"); } 

    I expect

    ###

    # #

    ###

    as output, but I'm receiving nothing as output, which is making me think I'm initializing the vector wrong. It reaches the "pause" just fine so I'm think it's that.

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

    Having trouble parsing CSV

    Posted: 09 Jun 2019 09:33 AM PDT

    i have a csv file with 2 columns x and f(x) i have implemented some code that returns the first column which is simply the numbers 1-100 i want to modify the code to return f(x) which is just x squared this is the code i have so far i was wondering if you could help me

    int main() { FILE *ftestData = fopen("test.csv","r"); char buffer[100]; char* pch; if(!ftestData) { printf("Error opening file\n"); return 1; } pch = strtok(buffer,","); while(fgets(buffer,100,ftestData)) { pch = strtok(buffer,","); printf ("%s\n",pch); } fclose(ftestData); return 0; } 
    submitted by /u/thekrispytoe
    [link] [comments]

    Looking for front-end contributors for my open-source Go project

    Posted: 09 Jun 2019 05:02 AM PDT

    [I'm not sure if this is the right sub to post this, but I guess a lot of programmers in here, so it won't hurt.]

    So, I'm a back-end guy and I'm working on building a p2p software for the LANs. It's not the most novel thing out there, but it certainly is fun to build something like that (read 'learning') and such software is certainly the need of the day. The project is, I would say, well past its initial stages and I'm now spending a great deal reading up things to implement stuff - which I feel is a good sign. But there's a lot more to do.

    Considering where the project is at right now, I think it's the right time for me to start searching for contributors who can build a desktop UI for the tool. I'm looking for open-source enthusiasts who work on anuglar.js [or the like] for a living and are interested in contributing to the project. If you're one of them, I'd love to chat. But even otherwise, if you'd like to discuss about what the project is about, feel free to comment.

    Project link: https://github.com/gravetii/diztl

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

    Keeping terminal active while playing a video

    Posted: 09 Jun 2019 09:35 AM PDT

    Hoping for some help with a bash script I'm writing...

    The goal is to trigger a keypress to play a random video within a folder. This should be simple, but as soon as the first video plays (i.e. with VLC), the video window receives the key presses and my bash script no longer has control to trigger another video.

    I want to keep the video window open so the video player is displayed at all times, but a video only plays on a keypress.

    I'm open to any video player that can be installed on an arm system running Ubuntu 13.04. Just need to find one that doesn't steal the keypress priority.

    I can post my bash script in a comment if that helps.

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

    Align PHP Yoast Breadcrumb Code To Center?

    Posted: 09 Jun 2019 08:36 AM PDT

    Hello, question from a newbie!

    I can't figure out how to align the PHP Breadcrumb code for the Yoast SEO Plugin. I did everything they said, and added their PHP code in the single.php. Here's the code:

    <?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb( '<p id="breadcrumbs">','</p>' ); } ?>

    ^ When I saved this code, the breadcrumbs on my site is pushed all the way to the left instead of aligning it in the center.

    Am I suppose to add a custom CSS code?

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

    Extracting Information From A Website

    Posted: 09 Jun 2019 07:29 AM PDT

    I don't know if this is possible and have no programming/coding knowledge but am just curious. Is it possible to extract information from one online store (name, pictures, sizes available, price, ect) and be able to put that into another online store. I am locked out of one of my online stores I made for fun and would like to extract the whole catalog of items I had there to my new store without filling in each item again. I had close to 100 items listed and it would take me hours putting all that information back in.

    I'll use Amazon.com for example. If I want to take all those items out and be able to post them on my own website, would I be able to? I feel like it would be possible because I have the "Honey" app that is able to compare similar items at a lower price which is probably by extracting the information from different websites. I really don't want to put in all my items in manually again. Any help is appreciated.

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

    No comments:

    Post a Comment