• Breaking News

    Saturday, November 28, 2020

    I can’t pass a programming interview to save my life. Ask Programming

    I can’t pass a programming interview to save my life. Ask Programming


    I can’t pass a programming interview to save my life.

    Posted: 28 Nov 2020 04:33 PM PST

    I have made 2 apps on the App Store. Both of which are real world. One is e-commerce and the other is social media. Both uses noSql backend.

    I'm 21, and might wanna get a job soon. Don't have college degree yet.

    I know how to solve problems otherwise how did I end up making two real world apps?

    The thing I hate about the interviews is they want to hear catch phrases. And I get anxiety sometimes. Obviously the candidate that memorized all the algorithms will get selected, why bother.

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

    Using Google Maps Javascript API inside a Java program

    Posted: 28 Nov 2020 12:03 PM PST

    I'm trying to make a weather app in javafx that launches a google map and retrieves lat/lon based on where the user clicks.

    So far, I have it working so that javafx creates a webview and launches the javascript file that displays the map. Then depending on where I click on the map, it displays the lat/lon.

    My question is, how do I get those co-ordinates back to my java code so I can use them?

    The picture is what the map looks like, I just need those two numbers to be usable in my javafx class instead of javascript; https://imgur.com/6VFgPyc

    submitted by /u/No-Cryptographer-852
    [link] [comments]

    I created a newsletter with hand-picked Remote jobs for developers - I'd love to hear everyone's thoughts.

    Posted: 28 Nov 2020 04:13 PM PST

    Hey everyone, I developed and launched a weekly newsletter (Jobleter) featuring hand-picked Remote jobs for developers from verified employers.


    Due to COVID, I got laid off this summer and didn't have a job for almost 2 months. My daily routine was to get up, open several job posting sites and look through all of the jobs that I thought were a good fit for me. I did this for almost 2 weeks and I just couldn't continue doing this as it was a huge drain of my time and was getting me no where. I then started looking for remote jobs and found the perfect one for me. That's when I thought of Jobleter.

    A lot of people are in the same place as I was and with Covid, all of the software companies have gone remote. Jobleter is a weekly newsletter (currently for developers only, but will be expanded) that contains hand-picked new jobs from verified employers.

    Give it a try and let me know what you think.

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

    The word for a really well-written piece of code.

    Posted: 28 Nov 2020 06:11 PM PST

    I'm sure people on r/askprogramming have encountered this more than once.

    Code that is simple and well styled, easy to understand, easy to debug, and effective at doing what it's supposed to without being complicated like this

    The opposite of stuff you find on https://thedailywtf.com/ or the antithesis of r/badcode.

    "Elegant" is one

    Thanks!

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

    Do I understand dependency injection with this analogy correctly? What's crucial piece that could be missing?

    Posted: 28 Nov 2020 07:19 PM PST

    I'm learning and studying concepts in programming by relating to simple examples in real life. My eli5 for dependency injection and the purpose of using it as below (posted in my blog), is there any crucial aspects that I missed out?

    What is DI?

    My analogy: Imagine you want to build a house (software
    ) that you are able to live in with all necessities. There are many areas you will need to take care such as piping, electricity, WiFi, lighting etc. You will need to engage different companies or stakeholders to get each of the components done.

    In the process, imagine for each company you engage with, you will sign a contract with them, and after each component is done (let's say lighting installation is completed), the company or team who are in charge in that component will be in-charge to test it (unit-testing
    ).

    In real life, we usually hire contractors to do these for us. Contractors have contracts in place with all these different companies and teams (dependencies
    ). The house, to be fully functional and ready to move in, depends on these components. So DI works like the contracts manager. You don't have to worry about the connection in between the components, each function / team just need to make sure their core job is done correctly.

    One team (object
    ) might be dependent on each other (dependency
    of that object). For example, lighting team might use what the electricity company have setup, for the lights to be able to light up after the installation completed. In this case, some of the electricity's company work components are dependencies in the lighting team's work. Contractor will provide the information ("instance variables"
    ) needed by the lighting team, so that the lighting team don't have to dig into details of the signed contract between the electricity company and the owner to find out what are the details of the work implemented when they need to use it.

    Why with DI?

    It breaks down each components to be more manageable. The isolation of the components also makes it easier for testing. With DI, the lighting company only need to take care of lighting installation, and test to make sure lighting works as intended after they are done. Without DI, everything is chained together. For example, if the contract with electricity company changes, the lighting company need to change all the impacted items and can't test their work independently. So DI role is to wire the connection together. Leaving the actual work to the team who's in charge to only focus on their core function and not worrying about other secondary related stuff.

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

    Why does the space before %c in scanf matter that much here?

    Posted: 28 Nov 2020 07:14 PM PST

    scanf(" %c",&tc); 

    #include<stdio.h> int main(){ FILE* p=fopen("input1.txt","w+"); srand(1); char c; int i; for(i=0;i<1000;i++){ if(rand()%2){ c=rand()%26+97; }else{ c=rand()%26+65; } fprintf(p,"%c",c); } fclose(p); fflush(p); p=fopen("input1.txt","r"); char tc,fc; int sum=0; while(1){ rewind(p); scanf(" %c",&tc);//here if(tc=='*'||tc<'A'||tc>'z'||(tc>'Z'&&tc<'a')){ return 0; } do{ fc=getc(p); if(fc==tc){ sum+=1; } } while(fc!=EOF); printf("%d\n",sum); } fclose(p); } 
    submitted by /u/JacksonSteel
    [link] [comments]

    Why does the space before %c in scanf matter that much here?

    Posted: 28 Nov 2020 06:47 PM PST

    scanf(" %c",&tc); 

    #include<stdio.h> int main(){ FILE* p=fopen("input1.txt","w+"); srand(1); char c; int i; for(i=0;i<1000;i++){ if(rand()%2){ c=rand()%26+97; }else{ c=rand()%26+65; } fprintf(p,"%c",c); } fclose(p); fflush(p); p=fopen("input1.txt","r"); char tc,fc; int sum=0; while(1){ rewind(p); scanf(" %c",&tc);//here if(tc=='*'||tc<'A'||tc>'z'||(tc>'Z'&&tc<'a')){ return 0; } do{ fc=getc(p); if(fc==tc){ sum+=1; } } while(fc!=EOF); printf("%d\n",sum); } fclose(p); } 
    submitted by /u/JacksonSteel
    [link] [comments]

    How safe is WhoIs privacy?

    Posted: 28 Nov 2020 05:40 PM PST

    If someone really wanted to, would they be able to convince the privacy company to give out my home address and name? I mean aside from law enforcement. I signed up on google domains in case that's relevant.

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

    Python to Javascript - JS equivalent of Deferred?

    Posted: 28 Nov 2020 10:58 AM PST

    I am writing websocket centric code like:

    function load(socket) { socket.ask("remote_service.get_thing").then(on_load); } function on_load(result) { console.log("I got", result); } 

    Socket in the above case is a wrapper around websocket and the ask method looks like - Note this is just example code I typed up here to outline what I am doing, there will likely be syntax/typo errors.

    class MySocket { ... setup code for socket ... ask(endpoint, arguments){ let d = new Deferred(); // setup in constructor, starting with 1; this.caller_id += 1; this.pending[this.caller_id] = d; //just a simple map/object const msg = { type:"ask", endpoint: endpoint, args: arguments, caller_id: this.caller_id } this.actual_socket.send(msg); } receiveMsg(msg){ const response = JSON.parse(msg.data); switch(response['type']) { ... other cases .... case "response": let d = this.pending[data.caller_id]; d.fire(data.result); delete this.pending[data.caller_id]; break; } } 

    My Deferred just holds the callback provided by .then and .fire calls it so I am not going to replicate it here.

    Is there a way I can use Promise instead and make my code look like

     async function load(socket) { const result = await socket.ask("remote_service.get_thing"); console.log("I got", result); } } 

    Also it is very likely I will get other messages from the remote side in the time from when I send an ask request to when the remote side responds.

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

    Return values in C++

    Posted: 28 Nov 2020 04:45 PM PST

    I'm kind of new to C++ (coming from Java), so this might be a rooky question (I thought I had a decent understanding of the basics, but apparently I'm wrong) and I have the following question:

    I have a function that creates an object (Object object;), then I'm initializing some values (object.a = "whatever"), then I'm returning that object.

    It was my understanding that, when calling that function, I receive an Object with the value of a set to "whatever" (and I quickly tried this in an online editor cause I googled for this first, and that seemed to be the case). However in my code a is not set. Did I get something completely wrong here or am I missing something?

    (For more context, even though I don't think this is important, I'm working with ROS and preparing some markers with some values that always are the same. In order to avoid repeating myself and to keep the code clean I wrote a function that does that for me).

    Edid: fixed markdown

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

    what would be the right amount to charge a coder?

    Posted: 28 Nov 2020 04:13 PM PST

    I am wondering how much I should pay a coder for the following or if its even possible for one person to do all this:

    - A small scale downloadable social application that can run off of a flash drive/ some sort of portable memory

    - messaging, browsing random pictures, creating mood boards, adding friends, collaborations, browsing timelines, creating statuses, uploading pictures/videos, and a decent amount of movies (100)

    - contains 5 changeable radio stations (I think these would have to be linked externally)

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

    Database help

    Posted: 28 Nov 2020 03:37 PM PST

    Ive recently been trying to get back into making web apps after a few years out, currently working on a small inventory system as a project to try and relearn but I'm having some difficulties with the database design (I've forgotten more than I originally thought). anyone care to offer any help on properly designing this database?

    this is what I have so far.

    https://imgur.com/slu9KX9

    The project is an inventory management/prediction web app. Additionally staff members will be able to register and see hours worked etc.

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

    What were the extent of your skills at the end of fullstack camp?

    Posted: 28 Nov 2020 07:26 AM PST

    I have programming experience with building vba apps and python for data analysis.

    Currently doing a personal project for fullstack using flask, html, css, SQL and going to host it eventually. It's a good application, has a user interface, works with an API, moves the data around and shows the user the results. Has other options too

    Also learning DS and Algo via leetcode.

    Just wanna get an idea of what your skills were at the end of bootcamp so I have something to compare against. The project is for more show and show intent, but will eventually be focusing on leetcode more

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

    Does hand grip prevent carpal tunnel?

    Posted: 28 Nov 2020 11:11 AM PST

    Hi, I'm an IT student. I'm pretty worried about carpal tunnel (fortunately, I don't have it at the moment). I've googled if hand grip helps to prevent carpal tunnel but I don't see a definite answer :(

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

    Are there any ways to guarantee that threads aren’t scheduled out under a lock?

    Posted: 28 Nov 2020 02:33 PM PST

    If a software thread is scheduled out while holding a mutex, other threads waiting on the mutex will not be able to progress; your game stalls, or maybe your plane crashes. If there was a way to tell a thread 'schedule out now if you were going to schedule out in the next 5 branchless instructions', this would allow you to make strong guarantees about timely forward progress. Are there any platform specific system calls along these lines?

    'Lock-freedom' I hear. I challenge anyone to point me to an O(1) lock-free LRU cache.

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

    PS5 bot help

    Posted: 28 Nov 2020 02:29 PM PST

    Is there on here (or on another sub) that could help me secure a PS5 via a bot? I've tried getting one through every Walmart drop, but it never goes through. I just want one to play with my son, I'm not looking to get a bunch to resell (like some terrible people). So yea if y'all know someone on here or another sub y'all could point me to that'd be awesome!

    Oh and I'm certainly willing to compensate whoever can help me with this as is fair for the time and work involved. Thanks y'all!

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

    From back to cross platform api ?

    Posted: 28 Nov 2020 01:38 PM PST

    Hey folks ! :) I am used to PHP, Jquery, AngularJs, a bit viewsjs.. I would like to improve my knowledges and my goal is to be able to build some app (cross platform).

    I tried react native, I can't tell it's bad or great (for me!), I have the strange feelings that sometimes, I have to do "a lot", for easy things (but hey, I am not used to).

    What would you recommands as my next new language ?

    Thanks :)

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

    Where to put data manipulation logic in a web dashboard application

    Posted: 28 Nov 2020 01:28 PM PST

    I'm building a dashboard using react and a charting library on the frontend, with a node.js backend with express. The data needed is stored in a NoSQL database, so the flow of data would be:

    Page load -> frontend calls backend API -> backend runs a query on the database -> data returned to frontend and displayed.

    There's a bit of data manipulation needed to get the data from the DB format to the chart format - it's nothing complex, all the data is in one collection. My question is working out where to put that manipulation step - on the frontend or on the backend API route?

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

    Creating a program that sends messages to people automatically

    Posted: 28 Nov 2020 12:17 PM PST

    I work in an agency and I want to create a program that allows me to send the same messages to say hundreds of people that use that online chat.

    Can anyone help me how would I go about building that program, what would I need, or what languages to use.

    Thank you very much!

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

    How to take information from a file with a specific pattern for different users in Java?

    Posted: 28 Nov 2020 04:57 AM PST

    Hello guys, I'm coding a music player that supports different users, I've got a .dat File that has a specific pattern and holds the information for the users, the songs, genres and artists associated with that specific user and their classification(how much they like the song or artist or genre).

    The objective is to read the File and take the information out of it to create the users and to load their songs etc and associate them to the user. The file has this layout:

    Number of users Name of the user, number of genres, num of artists, num of songs genre1, classification of this genre genre2, classification of this genre artist1, classification of this artist artist 2, classification of this artist song1, classification of song song2, classification of song ----- (this is what seperated users 

    So, as an example the file will look like this for 2 users:

    2 Jack Sparrow, 2, 3, 2 Metal, 3 Rock, 5 Iron Maiden, 4 Muse, 5 Slipknot, 3 Starlight, 4 Duality, 3 ----- Elizabeth Swan, 1, 1, 0 Pop, 4 Madonna, 5 (when it's the last user, it doesn't have the separation -----) 

    I've already loaded and created the user objects by filtering the lines with 4 commas and the rest of the lines, I also filtered the first line with the number of users and their info and what I have left to filter, following the example above is this:

    Metal, 3 Rock, 5 Iron Maiden, 4 Muse, 5 Slipknot, 3 Starlight, 4 Duality, 3 ----- Pop, 4 Madonna, 5 

    I've decided to load all of the lines into an ArrayList trying to work my way around

    Now, the objective is to load the rest of the info and associate with each user. So what I have resumed is:

    • The file is read line by line and filters the Strings that are just numbers(number of users) from the ones that are not(all the rest), this leaves me with the number of users filtered.
    • I've now have to filter the users from the rest and add them to an ArrayList, I've done this by checking which lines had 4 commas(standart number of commas for users), this leaves me with the genres, artists and music associated with the specific user.
    • I've added this last filtered part to an ArrayList, because I did all the rest inside a while loop and it created some conflicts if I continued working inside it.
    • Now I need to take the info from the ArrayList and associate it with each user.

    The code I've written for this last part is this:

    for(int u=0; u<users.size(); ) { for(int i=1; i < filteredInfo.size(); ) { if(filteredInfo.get(i).contains("-----")) { u++; i++; } else { users.get(u).addTodos(filteredInfo.get(i)); i++; } } } 

    This code gives me a java.lang.IndexOutOfBoundsException: Index: 4, Size: 4 and I'm just stuck here, I need help to take the info and load it to the specific users.

    I'm sorry if this question is badly written, Ive done my best to detail it and to explain what I've done and I hope it's under the guidelines.

    Hope someone helps me because I can't sleep trying to figure this out.

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

    Book to learn assembly programming for Linux

    Posted: 28 Nov 2020 08:20 AM PST

    Could you recommend a book to learn assembly for Linux?

    I know c++ and c# at a pretty basic level, so I would still consider my self a beginner in programming.

    I have an Intel core i7 processor if that matters.

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

    How many url lib requests I can make to YouTube per day without being banned?

    Posted: 28 Nov 2020 07:52 AM PST

    I'd like to harvest some search request data. I am not sure how many I am allowed to do without getting my IP banned. I've tried searching online, but I have not found any answers. I'd like to do a few thousand per day, if possible.

    Any insight would be appreciated.

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

    Caching and invalidating duplicated data

    Posted: 28 Nov 2020 06:08 AM PST

    If you select the same data from two different queries and cache the results individually, how do you ensure these queries are kept up to date with changes to the data?

    For example, let's say you have a game that has players that can join guilds. When you select a guild, you can either select it by guild ID, or you can select it from a player ID that is in the guild.

    select * from guilds where id = 17 select g.* from guilds g, guild_members gm where g.id = gm.guild_id and gm.player_id = 35 

    Both of these queries return the same guild - guild 17. In order to not have to repeat the second query however where we don't know the guild ID, we would cache the queries individually with the same data.

    guild_17: { id: 17, name: 'some guild' } guild_for_player_35: { id: 17, name: 'some guild' } 

    Now, if you change the name of the guild, you have to clear both cache keys. Actually, you'd have to clear cache keys for every member of the guild because they'd each be caching the same data under their own player ID. In this narrow use case the brute force answer seems clear, to load the guild and its members always and then clear all the cache for each member any time there is a change.

    However if these types of queries are common it quickly grows out of control to maintain a mapping of which keys must be cleared for which models. What if you can select a guild as an enemy of another guild?

    My question is what are some best practices around this, is this a situation where you just don't cache it in this way, any advice you can give on this. Thanks.

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

    No comments:

    Post a Comment