• Breaking News

    Thursday, April 11, 2019

    How does Tinder and Bumble implement nearest neighbors? Ask Programming

    How does Tinder and Bumble implement nearest neighbors? Ask Programming


    How does Tinder and Bumble implement nearest neighbors?

    Posted: 11 Apr 2019 04:06 PM PDT

    I'm looking for a data structure that would allow for efficient look ups of points within a certain radius from another point. That is, given a certain point and a radius, return all points within that radius to the given point. Basically, how does tinder and bumble accomplish this when you find other people X miles from me? I've heard of the K nearest neighbors algorithm but, this is hard because how do I appropriately select K? For example, suppose I select K = 1000 but in reality, k = 5000 would've return results all still within X miles from me. Anyone know of any data structures that can accomplish this efficient searching? It's okay if insertion of the data is not as efficient since searching will be used much more.

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

    Hosting a Programming Contest

    Posted: 11 Apr 2019 11:56 AM PDT

    I would like to host a private programming contest at my company for the developers. The idea is I would create a programming challenge question and anyone who worked here could try to solve it. The contest would probably last a few days and the winner would be the person whose solution passed all test cases and had the shortest total execution time. Is there any website that hosts programming challenges that we can use to do this?

    I already know HackerRank has something similar where you can create your own contests and challenges but their scoring is just based on test cases passed and earliest submission, not on the execution time of the program.

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

    What makes a programming language interoperable with another?

    Posted: 11 Apr 2019 07:24 PM PDT

    Disclaimer, I'm not a programmer, just generally curious about this stuff.

    The title is the question.

    Kotlin for instance, is fully interoperable with Java, so you can write both in the same file and it should still work (as far as I understand it). The same seems to be true for TypeScript and JavaScript.

    But what is it that allows a language to have this feature?

    What prevents Dart (for example) from being interoperable with JavaScript? Is it because Dart is static? Or perhaps because the syntax is different?

    Could a language like Swift theoretically be interoperable with JavaScript? If not (most likely not), why is that?

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

    How would you significantly increase your develepper skills

    Posted: 11 Apr 2019 02:04 PM PDT

    Hello, I worked for one year now as a data engineer (developping Java jobs to manage big load of data) stuff like this. Currently doing the same job in python. I also like video games (never really coded one tho).

    I'm not satisfied with my current skills and I want to be better.

    Practicing more is the obvious answer, but I learnt that there is many way of practicing and learning and I wanted to know if somehow there were some kind of optimal way.

    If you think there is not, I would like you to share with me how you would do it or how you did/doing it.

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

    Delete characters using tr or sed

    Posted: 11 Apr 2019 09:34 PM PDT

    I created a text file containing HTML comment of a web page using wget. Now, I want to delete occurrences of </u>. I tried sed 's/</u>//g' < textfile.htm > temp.htm ; mv temp.htm textfile.htm The error message is sed: -e expression #1, char 8: unknown option to `s'

    What is the right way of doing this? Thank you!

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

    Senior python Developer interview [urgent]

    Posted: 11 Apr 2019 09:19 PM PDT

    Can anyone guide what questions can be asked in a senior python developer interview, they are hiring me for python and big data projects.

    I have more than year of professional experience in python, Machine learning and deep learning.

    I have strong grip on python as I use it daily but still nervous what they gonna ask can anyone guide about what type of questions they can ask.

    Any help including links to any list will be great help. Thanks in advance!

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

    C++: Reading in multiple lines, each line gets saved into different variable.

    Posted: 11 Apr 2019 08:42 PM PDT

    How would I go about reading in from a text file where the text file has multiple lines and each line needs to be saved into a different variable. Especially unsure how to go about this if one of the variables is an int and not a string.

    Ex file:

    Line 1: hello Line 2: 2455 Line 3: bye Line 4: empty line ('\n') Line 5: hello Line 6: 26787 Line 7: bye Line 8: empty line ('\n')

    Would love some ideas on how you would do this.

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

    Collaboration on a random map generator

    Posted: 11 Apr 2019 08:16 PM PDT

    Not sure if this is the best place to post this. Basically, I'm wondering if anyone would like to collaborate on a project with me: a random map generator that generates unique and realistic world maps - like something you might find in an atlas. I have more or less a hobbyists level of experience so I'm no expert in what I'm trying to do. I just think it'd be something really fun to work on. I've already tried starting work on this idea twice before but it's a fairly big project with lots of connecting pieces. It'd be nice to have someone else to work with and discuss ideas with. Message me if this sounds interesting to you!

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

    What are some awesome programming books?

    Posted: 11 Apr 2019 03:58 AM PDT

    C++ help, trying to make a user function.

    Posted: 11 Apr 2019 04:04 PM PDT

    #include <iostream>

    #include <math.h>

    using namespace std;

    int Quadratic(int a, int b, int c)

    {

    int X = (b**2) - (4*a*c);

    return X;

    }

    int main()

    {

    cout<<"Hello World\n" ; Quadratic(1,2,3);

    return 0;

    }

    error

    |8|error: invalid type argument of unary '*' (have 'int')|

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

    Creating a simple Learning management system

    Posted: 11 Apr 2019 07:25 PM PDT

    Hi everyone,

    I have to do small project for my instructional design course at csu but i am not sure what program to use. I know html and some js as far as my experience. So here what I need to do:

    When the user opens the page, there will be a few questions such as "how many modules do you have?" and then "do you have a discussion board in your class?" and then "if you have a "Journal entry?" after the the user answers the page automatically creates 3 sections. First section has the number of modules (an empty content folder), second section will be a simple discussion forum, and the third will be a section to enter notes.

    What program do I need to use to create something like this?

    Thanks a lot

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

    Is this possible?

    Posted: 11 Apr 2019 06:55 PM PDT

    Ok, let me start with notifying you all that i am just getting into programming, but am very dedicated to learning. I am not asking for you to give me code or program something for me. I want to be able to learn it on my own, I'm just unsure if it is possible and which language I should learn to make this dream come true. Basic explanation would be I want to eventually create a phone app that can access a website that has a spread sheet of every player in our leagues stats per game. (updated weekly) And theoretically take said information from the spreadsheet and separate it into a "player profile" for each person. Is this possible to do? Which language should i learn to eventually far far down the road work on this project, and lastly, what would this be called, because I've searched and searched and don't even know what to type into google to try and learn. Thank you all for your help. I will be cross posting this, so sorry if you see it more than once.

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

    question about windows forms

    Posted: 11 Apr 2019 06:45 PM PDT

    Hi, in windows forms you can create UI elements via visual studio and code will be generated for you in a .h header. If I choose the windows forms project to be Visual C++, will the generated code from the UI elements also be C++?

    I'm sure this is a silly question, but thank you!

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

    What does it mean by "acquiring a lock" in multithreading?

    Posted: 11 Apr 2019 06:30 PM PDT

    Currently enrolled into a bootcamp and struggling, looking for advice.

    Posted: 11 Apr 2019 06:26 PM PDT

    I'm not sure if this is the right place to ask and I'm sorry for the cringe worthy opener. I'm currently in a coding bootcamp as a complete beginner and I'm really struggling.

    My peers haven't been the most helpful because most of them have some sort of background or at least fake it really well and don't seem too keen on helping as it may leave them behind. I'm just look for some tips on how to retain the information better and not always feel like I'm drowning in class. I don't have programming friends to turn to and just recently stumbled on this sub along with a couple of others. I'm enjoying what I'm doing but it just feels like I'm paces behind everyone else

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

    ISR style calling of function to handle data on pipe C++ Windows

    Posted: 11 Apr 2019 05:01 PM PDT

    I'm writing a program that, among other things, talks to other programs using named pipes (Windows, c++). I have a embedded software background and understand the theory of whats happening, but I've never worked with a full operating system before. I want a way to call a function on a "there's data in your pipe!" event (isr style ) . Ive tried googling for a bit now and the answer maybe overlapped IO? Something thats left me more confused than I started out with. In any case I really cant understand a way to achieve my goal and I'm seriously considering using a timer based poling method (again my embedded background.) Thank you

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

    "Understanding" Algorithms

    Posted: 11 Apr 2019 04:52 PM PDT

    I find when studying algorithms, I generally don't understand them. I can follow them but I don't have an idea or intuitive understanding of why they work. For example: I don't really understand Thompson construction (for NFA to DFA conversion), but if you were to ask me "why does linear search work?" I can tell you exactly why. (It's because if you go through every element in a list, you can't miss one. Either it is there or it is not.) Is there any way to develop an intuitive understanding for why algorithms work?

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

    For the love of god how do I stop getting 200 emails from indian recruiters a day?

    Posted: 11 Apr 2019 04:35 PM PDT

    Pls hlp. I'm assuming my resume is in a lot of databases. How do I track these down. Can't spend 10 minutes a day deleting these anymore. My sanity is dwindling.

    They're not even good offers. Hi, yes, please work the equivalent of slave labor for minimum wage my client will be very pleased. Must be senior dev 10+ years experience available on weekends, through the birth of your child, and a nice to have is selling your soul to the dark lord.

    Hi, yes, I'm interested in you going and fucking right off.

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

    Help with HTML finals project.

    Posted: 11 Apr 2019 03:05 PM PDT

    https://github.com/austinrtn/storeDb

    I am creating a program were the user manages the inventory of a store. The program uses HTML, PHP, MySQL, Ajax and JQuery. The user selects a category of items (Auto, Cooking, ect) from a dropdown list. Then another dropdown list below the first one is populated with all the items related to the category. Both lists are populated with information from a SQL database. I have got to the point where I am able to populated the first list which is static in regards to the info it is populated with. Whenever I try to populate the other list, I get a JSON error. At one point, both list were working, but at some point I had made a change and now the 2cd list of items does not populate. I believe the issue is within the script tag in INDEX.PHP, but i'm not sure. I have included the error message and the 3 files below. Hopefully this post wasn't too confusing. This is a project for my finals, so any and all help is greatly appreciated. Also sorry for the spaghetti code, most of everything here is from a youtube tutorial.

    /////////////////////

    ERROR MESSAGE

    ////////////////////

    index.php:2 Uncaught SyntaxError: Unexpected token < in JSON at position 2

    at JSON.parse (<anonymous>)

    at Object.<anonymous> (index.php:24)

    at fire (jquery-3.3.1.js:3268)

    at Object.fireWith [as resolveWith] (jquery-3.3.1.js:3398)

    at done (jquery-3.3.1.js:9305)

    at XMLHttpRequest.<anonymous> (jquery-3.3.1.js:9548)

    ///////////////////////////////////////////////////////////////////////////

    WHAT LINE 23 OF INDEX.PHP PRINTS OUT TO THE CONSOLE

    ///////////////////////////////////////////////////////////////////////////

    <!DOCTYPE html>

    <html lang="en" dir="ltr">

    <head>

    <meta charset="utf-8">

    <title></title>

    </head>

    <body>

    </body>

    </html>

    [{"name":"Wiper Blades","cost":"10.88","inventory":"12","id":"0","cat_num":"Auto"},{"name":"Battery","cost":"124.99","inventory":"8","id":"1","cat_num":"Auto"}]

    //****Notice how it prints out the blank HTML format before printing the correct items from the DB*****

    ///////////////

    INDEX.PHP

    ///////////////

    <!DOCTYPE HTML>

    <html>

    <head>

    <meta charset="utf-8">

    <title></title>

    <link rel="stylesheet" href="[https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css](https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css)" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

    <script

    src="https://code.jquery.com/jquery-3.3.1.js"

    integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="

    crossorigin="anonymous"></script>

    // vTHE PROBLEM IS PROBABLY HERE v

    <script type="text/javascript">

    $(document).ready(function(){

    $("#cat").change(function(){

    var getCat = $("#cat").val();

    $.ajax({

    url: 'data.php',

    method: 'post',

    data: 'getCat=' + getCat

    }).done(function(items){

    console.log(items);

    items = JSON.parse(items);

    $('#itemsList').empty();

    items.forEach(function(item){

    $('#itemsList').append('<option>' + item.name + '</option>');

    })

    })

    })

    })

    </script>

    </head>

    <body>

    <form class="" action="index.html" method="post">

    <select id="cat">

    <option value="">Category</option>

    <?php

    require 'data.php';

    $category = load();

    foreach($category as $c){

    echo "<option id=".$c\['id'\]."value=".$c\['id'\].">".$c['cat_name']."</option>";

    }

    ?>

    </select>

    <br>

    <select class="" id="itemsList" name="items">

    <option>Items</option>

    </select>

    </form>

    </body>

    </script>

    </html>

    /////////////

    DATA.PHP

    ////////////

    <?php

    require 'conn.php';

    include 'selStore.php';

    function load(){

    $db = new DbConnect;

    $conn = $db->connect();

    $stmt = $conn->prepare("SELECT * FROM category");

    $stmt->execute();

    $category = $stmt->fetchAll(PDO::FETCH_ASSOC);

    return $category;

    }

    if(isset($_POST['getCat'])) {

     $db = new DbConnect; $conn = $db->connect(); 

    $postVar = ($_POST['getCat']); //The selected category from the dropdown list

     $stmt = $conn->prepare("SELECT \* FROM main\_store WHERE cat\_num = '$postVar'"); $stmt->execute(); $items = $stmt->fetchAll(PDO::FETCH\_ASSOC); 

    echo json_encode($items);

    }

    ?>

    ///////////////

    CONN.PHP

    /////////////

    <?php

    class DbConnect {

    private $host = 'localhost';

    private $dbName = 'storedb';

    private $user = 'root';

    private $pass = '';

    public function connect() {

    try {

    $conn = new PDO('mysql:host=' . $this->host . '; dbname=' . $this->dbName, $this->user, $this->pass);

    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    return $conn;

    } catch( PDOException $e) {

    echo 'Database Error: ' . $e->getMessage();

    }

    }

    }

    ?>

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

    How to Store Usernames and Authenticate Requests?

    Posted: 11 Apr 2019 02:15 PM PDT

    I am making a practice app for learning how to interact with a backend on AWS, from React, and make requests to post random notes that could or could not be anonymous.

    Here is what I have so far in this practice app (source code available on github.com/mariotee/webnotes):

    • React front-end
    • AWS Api Gateway/Lambda backend
    • MongoDb/Mongoose

    So I want to store a username when someone logs in. The log in is done in the node.js backend with bcrypt in the database, but i only return the username and email.

    Then the username is saved in React state. However, this is an issue because people can just edit the state with React Dev Tools and post as someone else

    I did some research and people are saying an easy way to authenticate requests is to also return the database id when log in, and then send the id along with the username to do a comparison with whatever is in the database.

    But I've also heard that it is not good practice to have a controller call another controller. for example, i have a User Controller and an Entry Controller. and if i were to do this id and username approach, then i would need to call the User Controller functions from the Entry Controller.

    I was hoping to get some advice on how to go about making these kinds of requests.

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

    Need help on branching out

    Posted: 11 Apr 2019 12:47 PM PDT

    Hello,

    First, a bit about what I know:

    I have been doing professional development for 6-7 years now. I have done extensive work with PHP and Python. PHP primarily for my company's APIs and some light backend tasks, Python as an interface to our data warehouse.

    I have my Master's in Software Engineering, and am familiar with everything that entails (architecture and architectural patterns, design patterns, whatever, development methodologies, whatever).

    I want to start getting into my personal projects more. I feel that my professional work is not adequately testing the limits of what I learned, and I want a way to reinforce what I've learned through the years, and possibly branch out into something that is going to test me. The first part: fixing my portfolio website I made years ago. It is a bit of a standard PHP app that does what it needs to do, but I want the construction of the portfolio to be something worth mentioning in the portfolio.

    What I'm asking for is something that will kind of push me and test my limits. I could easily create a REST API, put a frontend on it using like jQuery, and call it a day, but I want something more than that.

    I did some research before making this post and some people recommend Go for the backend/API, and something like React for the frontend. Is that something that is going to test me? To be honest my only experience with webdev is MVC based sites.

    Is there a specific technology stack anyone can recommend that would: reinforce good habits, reinforce what I learned, is complex enough to kind of push me, but is also useful if I ever move on from this job? If not directly, at least in terms of developing decent skills in certain areas.

    Thanks!

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

    How do certain Players/Runtime Environments 'suppress' unhandled exceptions?

    Posted: 11 Apr 2019 12:40 PM PDT

    When I write, say, a .Net console application and there is an unhandled exception at runtime, the program crashes.

    In my special case this question refers to the Unity Game Engines executable player (but this surely applies to some other envirenments as well).

    When I develop and build an application in the Unity Game Engine, said build might have an unhandled exception occuring, but it will just continue running, maybe with undefined behaviour, depending on how much other processes depend on it you might be able to notice immediately.

    How is this accomplished? Just as a thought experiment, if I were to create an environment able to compile and execute some code written into a text field (completely disregarding sanitized input and so on), how would I tackle this issue on a basic level?

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

    How do I sell an application?

    Posted: 11 Apr 2019 08:49 AM PDT

    For some context, we're selling something written in combined Java/Scala.

    A friend and I have been working on a project over the last month-and-some-change, it isn't done yet, but we've already had more than a handful of people express interest in purchasing it, and we have both expressed interest in selling it, instead of just keeping it to ourselves like usual.

    First order of business is a skookum obfuscator, we will probably tie the app to an account on a website, there is also the possibility of distributing an app that downloads our app and runs it in memory so it never exists on the user's drive, but that requires a connection and is susceptible to MITM.

    Has anyone here sold an app before? What precautions did you take to prevent piracy and redistribution?

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

    Site like codewars or project euler where you need to find and fix bugs.

    Posted: 11 Apr 2019 11:42 AM PDT

    So at work I have recently been having to find and fix a lot of bugs and I kind of got a nice high from looking into unknown code and looking for the bug and then fixing it. Now I have started with a brand new project on Monday and I don't get that same high on new work. Not that I don't enjoy it I do but I missing having to fix a bit so I was wondering if there isn't a site like codewars or project euler where they give a project that has a bug or list of bugs and you have to go in and solve it. If anyone knows of such a site I'd appreciate it.

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

    Why does "% I" break the podcast media player in some Mazdas?

    Posted: 11 Apr 2019 07:49 AM PDT

    Not sure if any of you listen to Reply All, but their latest episode featured a problem where podcasts with % I in the title, such as 99% Invisible, immediately caused the media player in their Mazda to break. They ruled out a lot of issues, it's not the file itself, for example.

    This doesn't happen with the lowercase, % i. And it doesn't happen with a few other letters that they tried: % C, % R or % P.

    The person who originally coded the Mazda media player suggested that there was an issue with % because that means something to URLs, but (1) there's no URL in the actual mp3 file, and (2) why % I and not % P?

    From my own googling, I think the Mazda forum that had the media code they reference finding in the podcast is this, but I'm not sure as I am not a programmer: https://mazda3revolution.com/forums/2014-2018-mazda-3-skyactiv-audio-electronics/123882-custom-applications-sdk-write-deploy-your-own-applications.html#post1598946

    In case helpful, here's the discussion at /r/gimlet

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

    No comments:

    Post a Comment