• Breaking News

    Monday, April 22, 2019

    Why is it so challenging to design a decent shuffle function? Ask Programming

    Why is it so challenging to design a decent shuffle function? Ask Programming


    Why is it so challenging to design a decent shuffle function?

    Posted: 22 Apr 2019 07:34 PM PDT

    Whether it's apple music, spotify, or another similar service. Why does the shuffle function always seem to be awful at truly random selections? On Apple Music I notice I only get the last 20 songs or so I added fairly often. Or on spotify sometimes I'll get 20 songs in a row from only 2 artists who happen to have very little songs in my library.

    So what gives? It's a pretty common complaint/issue for these companies, is it something specific that's hard to develop?

    Also should note it's not a settings issue.

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

    [C++] Trying to render a ray tracer in realtime so I can interact and move the camera around

    Posted: 22 Apr 2019 07:09 PM PDT

    Hello,

    So I created a basic C++ ray tracer which creates a vector of pixels(float) and the image gets exported to a bmp file using Cimg. I wanted to take it to the next step and be able to move the camera around in real-time(in super low resolution of course). Any ideas how I'd do that?

    I have some familiarity with OpenGL and am interested in ray tracing with DirectX although I think for DirectX I need a RTX series graphics card which I don't have. That'd allow me to move the processing towards GPU and better experience all-in-all.

    Basically I want to take my ray tracer to the next step. No idea what are my options. Thank you for reading! Any help would be appreciated.

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

    Machine learning and neural networks

    Posted: 22 Apr 2019 07:46 PM PDT

    Hey everyone,

    This is more of a broad question, I'm just not sure how to approach something like this yet.

    How, or what would be a good approach to creating an app where all the users contribute data to a machine learning model (neural network?) and those results are used to improve efficiency for other users on the app. For example, say there is an app where people take pictures of food and those pictures are used to train a model to help identify different foods. How could you take all of those models from all the users, combine them and use that big model to make identifying the foods more accurate for all users?

    I've made models before with apples coreML, both text / photo based. But I'm unsure of how too (join?) them, like in the above example. If you could possibly lay it out generically, the steps one could take to go about it and I'll research further, I'm just lost on starting.

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

    Can a programmer create new and innovative tech in a year or two?

    Posted: 22 Apr 2019 05:55 PM PDT

    I am a CSE student and the reason I chose CSE was because Computers is the only field where you don't need money and mentors to create something new or innovative. You only require a PC, skills and hard work.

    So, Is it possible for a CSE student to create some new and innovative software/technology in a year or two that can be used to start a startup or sell the technology to some other tech giant?

    I am a beginner, still learning C. I am willing to put in the hours and hard work.

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

    Developing intuition for GPU Shader development

    Posted: 22 Apr 2019 09:12 PM PDT

    I've been coding for almost 40 years and have a decent gut for logic and performance down to the hardware level based on assembly language, C, etc. But I never touched GPU code, CUDA, Shaders, etc, nor have I ever looked at the hardware engineering. I vaguely know it does a lot of math in parallel, and that's it.

    Is there a good way to understand the architecture, how it works, what shader code does, and ultimately get a good sense of performance guidelines (like "make sure you don't call sin 20 times per pixel").

    submitted by /u/13_0_0_0_0
    [link] [comments]

    'Effective power' text over iphone. Behind the scenes?

    Posted: 22 Apr 2019 08:42 PM PDT

    Howdy, doing a paper on mobile security. Was wondering if this article was using any similar processes/exploits found by recent android renderer executing kernel code like this. If not, does anyone have any info about what went wrong with the first? or what topics to look into to find similar exploits?

    Thanks

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

    When would you take an old project off of github?

    Posted: 22 Apr 2019 08:12 PM PDT

    I have some old projects on github that I hosted and maintained for other people, but the relationship has with all of them have all ended over 2 years ago and I want to turn into a portfolio page now.

    Is now the time to go ahead and take them of or should I leave them in place just to be archived?

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

    Arrays with the exact same name assignment in java?

    Posted: 22 Apr 2019 07:46 PM PDT

    Hi! Im going through some old practice exams and Im a bit confused by this question:

    public static void main(String args[]) { int x = 5; int y = 10; int[] a = new int[x]; myMethod(x,y,a); System.out.println(x + y + ", " + Arrays.toString(a)); } public static int myMethod(int x, int y, int[] a) { x = 2; for(int i=0; i<a.length; i++) { a[i] = x*i; } y = y/3; a = new int[y]; a[x] = y*3; return y; } 

    It asks what prints. Im not sure why the first value of a (0,2,4,6,8) prints rather than its new assigned value, (0,0,3)?

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

    How do I import data from something like Excel into an HTML variable.

    Posted: 22 Apr 2019 07:42 PM PDT

    Say my excel sheet says:

    State | First | Second

    AL | Hello | Hi

    MO | Goodbye | Bye

    Let's say I have a variable called alabamasfirst. How would I place "hello" into that variable.

    Thank u sorry that i know nothing about coding

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

    Calling 'debug' with incomplete return type 'QDebug'

    Posted: 22 Apr 2019 11:35 AM PDT

    I'm trying to learn how to create GUIs with QT in c++ using this playlist.

    I can't get through the second tutorial, however, as qDebug is not working. I get the error in the title in my code, and the error

    error: invalid use of incomplete type 'class QDebug' qDebug() << "MyRect knows that you pressed a key"; ^ 

    When trying to run the code. What is this, and how can I fix this?

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

    what do your managers use to coordinate, assign, & track development?

    Posted: 22 Apr 2019 06:34 AM PDT

    other than Excel..

    I'm looking to get ideas on how dev managers organize, assign, & track development items.

    as an example:

    • we get a list of 500 development items (reports, interfaces, etc..)
    • we have 30 developers

    I want to be able to manage/prioritize the dev list, assign each dev 2 concurrent items, track progress, and have 1-2 new items in their queue. As a bonus, I'd like to track testing approvals and other relevant dates (planned start, actual start, planned finish, actual finish, unit test passed date, user acceptance passed date, etc..).

    thanks a lot, TC

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

    how to debug/step-into interface Implementation

    Posted: 22 Apr 2019 02:42 PM PDT

    the problem I have is I cannot step into my implementation functions

    I have a static and dynamic library and exe I am using MVS 2017, C++

    in the static lib i have interface,

    class myinterface {virtual start();}

    in the dynamic lib i have class which implements the interface

    class myclass : public myinterface {

    start()

    }

    myclass::start()

    {blahblahblah}

    in the exe I use instance of myinterface so i have line like myinterface->start()

    it works fine but I cannot step into the implementation of start() which is what i want to do

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

    [C]Need help figuring out why my qsort function won't sort

    Posted: 22 Apr 2019 02:08 PM PDT

    Hey all, I've been tasked today with modifying an old program to no longer use a selection sort function, and instead to use qsort. My original program worked well, but this new iteration doesn't behave properly. Instead of sorting a list, it adds some spaces between the entries and otherwise does nothing.

    The goal of the program is to input a file name, and sort the list of data in the file. In particular, it's a 3 column list of school supplies. I've attached screenshots of The list, , incorrectly sorted list, , Original Program, , Current project.

    Apologies for the formatting on the program screenshots, I couldn't get a full page screenshot unless I copy/pasted into a document.

    Again, not sure why it's just adding spaces and not sorting anything. Any help or direction would be a huge help.

    quick edit: here's an example of a sorted list from the original program that worked: https://i.imgur.com/zklbQ05.png

    edit number 2: I changed the dot operators in the compareString function to be arrow operators: ->

    it flipped the list upside down instead of sorting anything. Equally confused but at least it's a new problem to lead me somewhere

    Big boy EDIT 3: I changed all the comparison signs with strcmp, result is still the same. Here's a paste of my code as requested: https://textuploader.com/1dar2

    Final edit: I got the program working at 99% capacity. The first entry on the original list has a few random characters in front of it, but otherwise it is sorted. Final output

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

    HackerRank help (Java)

    Posted: 22 Apr 2019 12:07 AM PDT

    This is the New Year Chaos question from HackerRank.

    Question: Any person in the queue can bribe the person directly in front of them to swap positions. If two people swap positions, they still wear the same sticker denoting their original places in line. One person can bribe at most two others. You must know the minimum number of bribes that took place to get the queue into its current state. If any person has bribed more than twice the print out "Too chaotic".

    Input: 1 2 5 3 7 8 6 4

    Expected output: 7

    My output: 6

    Can you point out what I did wrong in this code?

     static void minimumBribes(int[] q) { boolean flag = false; int bribes = 0; int math = 0; for (int i = 0; i < q.length; i++){ //check if person has bribed more than twice //if so, flag and exit the loop if (q[i] - (i + 1) > 2 ){ flag = true; break; } //check if person is bribed by determining if they are less than the index value //if so, add by absolute value of the difference else if (q[i] < (i+1)) { bribes += Math.abs((i+1) - q[i]); } } if (flag == true) System.out.println("Too chaotic"); else System.out.println(bribes); } 
    submitted by /u/WTFparrot
    [link] [comments]

    Quickest way to solve nested loop questions on paper exam?

    Posted: 22 Apr 2019 08:33 AM PDT

    Hi all!

    Im going through some old finals for my intro to java class, and there are alot of questions that involve solving nested for loops by hand (its a paper exam); things like solving for the value of count with the following example code:

    public static void main(String args[]) { int n=6; int count = 0; for (int i = 0; i < n; i++){ count--; for (int j = i+1; j < n; j++){ count--; for (int k = j+1; k < n; k++){ count++; } } } System.out.println(count); } 

    I can solve this by just going over the loops over and over with a pen and paper; but this takes a long ass time and often gets me confused. Are there any tricks to easily solve these types of problems?

    edited for clarity, thanks /u/dorbinator

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

    Can somebody explain what happens when a pointer is passed as a pointer to a pointer inside another function.

    Posted: 21 Apr 2019 11:52 PM PDT

    Here is the code :

     #include <stdio.h> int main() { int i = 10; int *const p = &i; foo(&p); printf("%d\n", *p); } void foo(int **p) { int j = 11; *p = &j; printf("%d\n", **p); } 
    submitted by /u/bbugsbunny
    [link] [comments]

    trying to get a txt file array into a bubble sort and sort from greatest to lowest but I can't work the array into the algorithm.

    Posted: 22 Apr 2019 08:28 AM PDT

    Its to a point where I build successfully but I get no output

     #include <iostream> #include <fstream> using namespace std; int main() { int the_input; ifstream inFile("project.txt", ios::in); int i; int a[100]; int n=100, j; if (!inFile) { cerr << "File could not be opened" << endl; exit(EXIT_FAILURE); } while (inFile >> the_input) { for (i =0;i<=n;i++) { for(j=0;i<n-1;i++) { int temp; for(j=i+1;j<=n-1;j++) { if (a[i] > a[j]) { temp = a[i]; a[i] = a[j]; a[j] = temp; } } } } {cout << the_input<<endl;} } return 0; } 
    submitted by /u/SpeedWagon2
    [link] [comments]

    C# - OutOfMemoryException with a 70.000x70.000 float matrix...

    Posted: 22 Apr 2019 04:08 AM PDT

    Hello!

    I am currently writing my diploma thesis and have encountered a small problem.

    Currently I am studying mechanical engineering and my diploma thesis deals with the creation of a program for the analysis of RDE data (Real Drive Emission).

    In other words, among all the measured channels (up to 100 channels), my software is supposed to name the channel that is most likely to be the reason why the nitric oxide NOX-channel has been increasing at a specific moment.

    In order to be able to call a channel, the measuring channels must not be shifted in time, unfortunately they are.

    Measuring with a frequency of 10Hz to 1Hz may cause time shifts due to the measuring device. Thus, it may be that a measuring channel at 10Hz has around 70,000 measurements.

    Therefore, I have the Dynamic Time Wrapping (DTW) built into my program which should shift the channels dynamically.

    The problem is that when comparing just 2 channels, the DTW method produces a matrix of size, for example: 70000 x 70000, since all channels always have the same number of measurements. Each cell now has a float (32 bit). Consequently, the time shift of 2 channels alone would need about 19 Gb of memory.

    As you can see, memory is my problem because I always get a OutOfMemoryException.

    If you had any idea how I could solve the problem different.

    It should be noted that a simple move of all measurement entries in a measurement channel does not work because the time shift is not always constant. There is a compress or stretch in certain areas of the measurement instead.

    PS: I write in C# and my English is really bad, sry for that!

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

    Any tool to compare responses of API calls?

    Posted: 22 Apr 2019 06:48 AM PDT

    I am trying to develop a new version of an API and need to compare and see how the responses of these (new vs old version) differ.

    The responses in my case are JSON. I tried to google for any such tool on github but couldn't find one.

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

    Unit Testing a function that calls other unit tested functions.

    Posted: 22 Apr 2019 12:55 AM PDT

    Are any of the modern web technologies particularly suited for building a one-page dashboard? (Backend dev with no web experience.)

    Posted: 21 Apr 2019 10:24 PM PDT

    Hi,

    Are any of the modern web languages / frameworks particularly well-suited for creating one-page dashboards? e.g. Imagine, waking up and entering how many hours of sleep you got, updating a calories counter throughout the day, or tapping a button to say, "I worked out today!" or "I had a beer today." And then later, building out some views or graphs.

    I'm a backend dev interested in learning a new web technology, but don't have too much free time. So, I'm trying my best to limit features and make choices that ultimately save time. For example,

    • I want it to be accessible from any device, but it does not have to be responsive / mobile. (It's not a focus I want to spend time perfecting or debugging.)
    • I want to integrate a mature undo / redo library. (I don't want to have to write SQL to fix a database row every time I fat-finger something.)
    • I prefer it to be Javascript-based (if there even is a thing that isn't?) so that I can draw from a multitude of libraries when it comes to building views and graphs.
    • I prefer it to be hosted (and am willing to pay) so I don't have to spend time on administration. But, not a dealbreaker. I'm able to rent a VPS, install Nginx, etc.

    I began a React tutorial, but I felt like it might be overkill for what I want to accomplish. Or, should I continue? I really like what I'm hearing about Rust, but it doesn't seem mature enough to be painless.

    Appreciate any direction, thanks.

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

    [beginner question] how to make something that gives random result from sets of tables?

    Posted: 21 Apr 2019 11:11 PM PDT

    Hi, I recently had the idea of trying to make something that could help me with certain elements of Tabletop Roleplaying games, Spesificly when there are tables with random results, and often when you roll on several at once, and thought it would be nice to just have a button i could press and I was displayed a random result.

    But im curious about what the simplest way to go about it, would be, as Ive not touched programming in quite awhile.

    Have studied Python and C as part of a class for a year, and had a minor project in Perl, but other than that, my programming knowledge is quite limited. And maybe it could be doable in Excel?

    to make it very simple, i would imagine that i have 3 tables (could be in separate documents), with a list of entries. Then I have some sort of process that picks one random entry from each of the tables, and then displays it in a spesific order.

    example:

    In a game called Mutant Year zero, you have a grid map, and when the players in the game move from one square to another, several rolls have to be made in order to figure out if the area is urban or rural, what sort of building or environment is there, how much radiation is in the area, if artifacts can be found there, what sort of threats can be found and what sort of mood that affects the area.

    So, I would appriciate a few tips on what the easiest way to make a program that does all of these table-rolls for me, instead of having to spend a few minutes each time it needs to be checked.

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

    No comments:

    Post a Comment