• Breaking News

    Thursday, July 16, 2020

    Has anyone else spent a long time implementing a solution to a problem only to discover there's a language feature that does exactly what you need? Ask Programming

    Has anyone else spent a long time implementing a solution to a problem only to discover there's a language feature that does exactly what you need? Ask Programming


    Has anyone else spent a long time implementing a solution to a problem only to discover there's a language feature that does exactly what you need?

    Posted: 16 Jul 2020 12:09 PM PDT

    I feel really dumb, I just spent almost 5 hours implementing a solution that is easily solved by a native feature of the language that I didn't know about.

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

    Making card game simulator. Trying to find the best practice to implement a specific effect

    Posted: 16 Jul 2020 11:51 AM PDT

    So, I'm attempting to make a rules enforcement application for a card game and I've hit snag where I can't think of any way to do this without a bad code smell.

    Card game has 3 types of cards, X, Y, and Z. Currently I have all the cards in the game set up with an ICard interface, an abstract CardImpl class to implement it, and the X, Y, and Z card classes inheriting from that class, adding in functionality as needed (X cards go to different zones when played then Y cards etc). There's also a deck class that is a collection of ICard.

    One of the X cards has an effect that's "Reveal n cards, pick a Y card from among them, put it in your hand, shuffle the rest into your deck". I'm trying to find an elegant way to handle this that doesn't involve me checking the type of a card in the deck at runtime with instanceof or similar methods I could write.

    Is there a good way to do this or am I stuck having to do something that smells bad?

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

    Minimum operation to go from a to b. How to approach this problem?

    Posted: 16 Jul 2020 10:02 PM PDT

    Given input n, a and b, in the range [0,n]

    You are allowed to perform the following operation:

    +10, -10, +1 , -1

    What is the minimum operations required to transform a to b?

    If a goes out of bound, it stops at the last legal number.

    How do I approach this problem using dp? Thanks

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

    In Visual Studio when you creat a new project there is an option Create Directory for Solution. Is it recommended doing it that way always?

    Posted: 16 Jul 2020 02:25 PM PDT

    I'm using VS 2015 because the latest version is too slow for my PC.

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

    What programming language should I learn? And what (free) resources can I use to learn it?

    Posted: 16 Jul 2020 05:15 PM PDT

    Recently unemployed and thought maybe I should take the time to learn some programming. I know a little VBA from using Excel. I've always enjoyed working with it, coded a bunch of macros to speed up my work and even made an Excel version of Connect Four. What would be a useful programming language, that is hopefully somewhat similar or VBA and also has free tutorials and where could I find them?

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

    When is bucket sort better than other sorting algorithm?

    Posted: 16 Jul 2020 08:59 PM PDT

    How can I make atomic commits when working on a new project?

    Posted: 16 Jul 2020 02:13 AM PDT

    I try to make my commits atomic. However, when I work on a new project, it's hard to isolate changes into commits. I often fall into a trap:

    1. Work on feature X.
    2. Realize that X needs some feature Y.
    3. Pause X and start working on Y.
    4. Realize that feature Y needs another feature Z.
    5. Pause Y and start working on Z.
    6. Realize that I need to rewrite X to use Y and Z.
    7. Pause Z and rewrite X.
    8. My working directory is a mess.

    I suppose I should make commits at steps 3, 5, and 7. But then I would have to commit incomplete, untested code. That's bad, isn't it?

    What should I do? Is this just the way things are with new projects? Can I avoid this by planning the entire project in advance?

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

    CUDA for non-NVIDIA devices?

    Posted: 16 Jul 2020 07:35 PM PDT

    OpenCL is junk. I have yet to find a single program that actually works on any computer I've tried.

    CUDA is just so clean and works every time without fail, obviously only on NVIDIA systems.

    Why is there seemingly no bridge between these two factors? Is it just not possible to use Intel or AMD graphics cards for anything more general than graphics?

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

    Is ASP.NET Core 3.1 what people usually refer to as .NET Core?

    Posted: 16 Jul 2020 06:18 PM PDT

    I'm trying to watch a tutorial called Learn ASP.NET Core 3.1 - Full Course for Beginners on YT and wonder if it's the same as NET Core? Which is cross platform. I know there is regular ASP.NET which is Windows only.

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

    What should I use to make an app to run on my windows computer

    Posted: 16 Jul 2020 01:49 PM PDT

    I am a beginner/amateur programmer looking to build my own audio equalizer application for my windows computer for a research project.

    I would need to be able to:

    • play audio
    • adjust the volume of specific frequencies and have it affect the audio output of my windows system
    • create a visual display with some simple animations
    • create a relatively simple GUI

    What language / programs would be best to do this? My first thought is max for live. Does this seem feasible?

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

    Advice building a job matching queue system

    Posted: 16 Jul 2020 04:13 PM PDT

    I'm building a sort of instacart clone. The user can create a shopping list, this shopping list would then be sent to a queue to be matched with delivery agents. These delivery agents can accept or decline the request, in the latter case the shopping list would have to be rematched with someone else.

    At the moment i'm not making it location targetted or anything, just trying to start simple.

    I'm thinking of using two fifo queues - one for the shopping lists and another for the delivery agents.
    Doing things this way could mean very long waiting times - maybe i could dynamically increase the number of queues based on how many lists/agents are in them, this should shorten waiting times.

    Perhaps there are already built solutions ?

    Would appreciate second opinions/advice on this

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

    Is this a sort of database caching and is there an alternative? I'm unclear on the terminology.

    Posted: 16 Jul 2020 09:49 AM PDT

    Firstly, I apologize if this is a trivial question. My background is aerospace and not computer science. With that said, my department has a large collection of C++ libraries from Master students implementing theory for numerical simulations. I'm removing the 500 MB collection of data that originally shipped with it, within the src code.

    The idea is that if filepath_x is requested, then the file associated to that file path will be downloaded, according to a index.json file.

    I have a first prototype of - what I can guess is - some kind of database caching. Consider this data resource which is pinned to by this json. The following path requests in C++ and Python are as follow:

    Is this database caching or is it called something else? Are there existing solutions which I could use that already exist? Thank you in advance for your time spent following my links and reading this.

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

    Advice on quickly preparing for a technical coding interview?

    Posted: 16 Jul 2020 03:33 PM PDT

    Advice on quickly preparing for a technical interview?

    Hello,

    I was wondering if anyone could share some advise or resources on quickly preparing for a technical interview

    I got this job opportunity on pretty short notice and I have my first technical coding interview in just a few days,

    I'm pretty nervous because while I've been coding at my job - none of it is like a leetcode question! Haha...please help

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

    [HELP] Homework Assignment Issue

    Posted: 16 Jul 2020 11:51 AM PDT

    Is a front-end or back-end specialisation better or worse for remote working?

    Posted: 16 Jul 2020 12:51 AM PDT

    I'm a novice coder, currently learning Python. My long term goal is to work in programming as a freelancer and/or remotely, does going down the back-end or front-end route matter i.e. are some jobs more unlikely to have option of doing work from home? Because my long term life goal is to live in the countryside and not have to have a long commute or live in a big town or city. And if front-end is better for my purposes, should I stop learning Python and switch to JavaScript, CSS and HTML? Since my (limited) understanding is that Python is only relevant for back end code?

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

    Flutter question stful/stless

    Posted: 16 Jul 2020 08:04 AM PDT

    Hi there! I have a question about flutter: i'm not sure if i need a stful or a stless widget as main widget. If i implement a stful widget in a stlesswidget is that ok? Like having a statless scaffold as main widget but having a stful widget add a listtile through the floating action button?

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

    Chain of responsibility pattern with custom configurations

    Posted: 16 Jul 2020 07:00 AM PDT

    So we have a simple logging system in place for our applications. It uses a chain of responsibility pattern, so that I can call Logger = New ConsoleLogger(New FileLogger( New ElasticLogger())); etc. in order to append functionality to the logger.

    However all these loggers need each their own config class - how would you implement this? Using a config of type "Object" and casting it is an option, but It doesn't feel right. I could also build In a JSON serializer to each class and look for a file with config a for example. Not sure what the right approach is here - looking for good ideas 💡

    I was uncertain about post flair. Maybe an Architecture flair would be nice here.

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

    I will pay you to review my code in C

    Posted: 16 Jul 2020 09:46 AM PDT

    Hello! I'm an intermediate-level computer science student, who is largely self-taught and in desperate need of feedback. I'm looking for someone to review several of my projects written in C based on their efficiency, code organisation and clarity. The projects are medium in size (several 100s lines) and probably too large for communities such as r/codereview. Therefore, I'm prepared to pay anyone willing to help and share experience.

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

    Taking website data and placing in Anki

    Posted: 16 Jul 2020 05:56 AM PDT

    There is a website (https://iknow.jp/courses/566927) that has Japanese sentences and their translations along with audio. Is there a way to take that and run it into Anki all at once? It would save me a lot of time.

    Sorry if it has been asked, not sure where to ask this.

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

    Resource based authorization in Web API

    Posted: 16 Jul 2020 05:33 AM PDT

    Im currently working on a API project whilst on furlough. Just after some guidance. Im using .NET core 3.1, EF core 3.1 and asp.net identity.

    I want to implement resource based authorization to stop one logged in user effecting another users profile and resources if they were to get a hold of the API call with ID's included.

    For example - api/Post/15/annotations if you are a logged on user into the app you would be able to hit this regardless if you know the "15" id. (obviously this is a guid in my actual API).

    So my question is based around the database creation, should each table and child tables have a ownerID or would only the parent table be required to have this?

    Also is there any other way to achieve this level of security, any suggestions would be a real help.

    Thanks.

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

    Mac vs Windows for programming

    Posted: 16 Jul 2020 04:56 AM PDT

    Hi,

    I have a Mac at the moment and have noticed with most tutorials in programming - the tutor would usually use Windows and at my university they preferred Windows.

    Would it be a smart move to purchase a windows laptop for the sole purpose to program and since my work uses Power Bi.

    I'm happy to keep my Mac to do my writing and research work.

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

    Was the method "ReadInput()" necessary as we gave the values while using the method name?

    Posted: 16 Jul 2020 03:57 AM PDT

    This is a code from a java book. In which we make two classes

    https://pastebin.com/QQnJtjLE

    What is the use of the method "readInput()" in class DateSixthTry if we are giving values to setDate in class OverloadingDemo.

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

    No comments:

    Post a Comment