• Breaking News

    Saturday, May 18, 2019

    Good way to consider corner cases Ask Programming

    Good way to consider corner cases Ask Programming


    Good way to consider corner cases

    Posted: 18 May 2019 03:11 PM PDT

    Hello r/AskProgramming,

    I'm looking for some advice/suggestions on how I can consider corner-cases quicker and more clearly. I was working on this LeetCode problem:

    Given an unsorted array of integers, find the number of longest increasing subsequence.

    https://leetcode.com/problems/number-of-longest-increasing-subsequence

    and found it took me a long time to get to a working solution. In the end, I did take a look at hints in the discussion area.

    I'll try my best to describe what I think my weakness is by contrasting it with a type of problem I'm rather good at. So problems that I'm good at are problems where the number of corner cases are small, for example:

    1. Given a BST and a target of type int, return it's in-order traversal predecessor and successor.
    2. Given a binary tree - return true if it's a BST otherwise return false

    I'm good with these types of problems because I can narrow down the corner cases (and maybe minimize them). I just walk the tree, if I run into a null I do X and if I run into a valid node I do Y. The problem I have with the LeetCode problem is the number of possible input permutations are large so it's harder to consider all corner cases. Possible inputs like:

    1. 1,2,3,4
    2. 1,2,3,3,4
    3. 3,1,2,3,3,4
    4. 4,4,4,4,4
    5. []
    6. etc

    The input can be any length and the numbers can be increasing, decreasing, stay the same.

    When I was solving the LeetCode problem I knew it was going to require a DP solution at first glance. I also knew how to get the longest increasing sub-sequence and felt this was just a slight modification of that problem. I tried a number of approaches before taking a hint and coming to the final solution.

    1. Approach 1 - works for input [1,3,5,4,7] but failed for [1,2,3,3,4]
    2. Approach 2 - fixed for approach 1 but fails for [5,5,5,5,5]
    3. Approach 3 - fixed for approach 1&2 but fails for [1,2,3,1,2,3]

    Let me know if you want details on each approach but I hope my point is clear - the possible permutations of input is vast it's hard for me to consider all corner cases. It also wasn't obvious to me that I needed to tabulate the number of LIS I've seen so far not just the longest lengths, but I think I can fix this problem with more practice. My biggest problem seem to be difficulty considering large patterns of inputs.

    Thanks in advance.

    EDIT: I did try out various inputs on pen&paper but couldn't cover all possible inputs hence my problem.

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

    Best way to implement user permissions into MySQL Database?

    Posted: 18 May 2019 06:01 PM PDT

    I'm trying to create a permissions/group system for a website I'm designing and I'm stuck up on how to properly create a database for it. So the way I'm thinking is creating a Permissions Schema and each command as a table with groupID and userID as columns in a row. That way when somebody tries to execute a command, the command refers to its table within the Permissions Schema and if the users ID or group ID is registered in the table, it allows the execution .

    Is this a decent way of implementing this, or should I create an overall website schema with Permissions as a table and find a way to work out commands as rows instead of tables?

    Additional question, is it common practice to have multiple Schemas/databases for one website or application (Like Users Schema, or Permissions), or is it better practice to have one schema/database with a ton of tables in it? (Like Users table or Permissions table)?

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

    Function Indexing in various languages?

    Posted: 18 May 2019 05:24 PM PDT

    What algorithms do the various languages use to find a function/ method when it is called?

    Are they ordered internally?

    Are they always inline?

    What terms can i use to search google for more information?

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

    What would you name a superhero whose power is writing code?

    Posted: 18 May 2019 01:16 PM PDT

    Where can I get an obscene amount of cute pictures to use in a project?

    Posted: 18 May 2019 08:28 PM PDT

    Dynamic audio for television and movies at home?

    Posted: 18 May 2019 07:20 PM PDT

    Hi there. Perhaps this isn't a programming question per sae, moreso an idea. Given that most movies and television shows are streamed digitally and at home, and given that there are many complaints about dialog being too quiet and action/explosions being too loud, would it be possible to program...something to analyze upcoming audio and, if it surpasses a specified ceiling or drops below a floor, the program could automatically adjust the volume?

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

    Unable to get output while Dart coding on Sublime Text 3

    Posted: 18 May 2019 08:28 AM PDT

    I cant get my simple dart code to work after setting up Sublime Text 3 for dart development. I only get the build time, while the print command does not work.

    I checked all my configurations, checked if my SDK is properly defined at the right places. I also added the location of the dart-sdk to my PATH variable

    This is just a simple dart code which I want to run.

    All I can see is the Build Time, along with cmd, directory and path variables. I cannot see output from the "Print()" command. What can be the reason?

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

    Are smaller-time mobile app devs commonly expected to handle both iOS and Android?

    Posted: 18 May 2019 02:27 PM PDT

    Hey all,

    Apologies if this is a silly question or if this isn't the right sub. I'm getting my feet wet, so I'm just seeing what skills I need to have. Is it the norm for developers (who aren't working for giant companies) to know how to develop for both?

    Just perusing job listings, solely out of curiosity, and I see quite a few people asking for someone to develop an iOS and Android app, which I of course understand from the client's perspective. I was just wondering if developers are expected to be decently-versed in both, or if it's typical that this would require two people/teams.

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

    Looking to shadow a software developer

    Posted: 18 May 2019 12:28 PM PDT

    How should I go about looking for a company to allow me to get a feel of the computer science department

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

    How to re-zip as a .jet file

    Posted: 18 May 2019 07:14 AM PDT

    I have a .sqlite file and the developer zip it as a .jet file. Now I can open it with 7zip, I can edit the db but at the end I couldn't re-zip again as a .jet file. I tried every solution that I saw on the internet, but none of them answer to me.

    If someone wants to take a look, file download link.

    https://wetransfer.com/downloads/ea5a329dff6b4ca48363a6faca2b17af20190516110040/2b647b

    Any help would be great.

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

    I want to create a GUI application for authenticating a user to connect to my vps server located on a cloud

    Posted: 18 May 2019 06:59 AM PDT

    Disclaimer: I am a newbie to programming

    I want to create a GUI application for authenticating a user to connect to my vps server located on a cloud...

    The follow features is required: - login authentication - various fields to enter server information

    Can someone point me in the direction i need to go to create such an application, with path of least resistance in mind? Perhaps theres an open source application (Not fully sure what this means?) I could tweak, or maybe i should take up python and start learning in the direction of (idk)?

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

    Clarification on Codecaves which uses an injected DLL

    Posted: 18 May 2019 02:16 AM PDT

    I've read this article more than a dozen times now: https://www.codeproject.com/Articles/20240/The-Beginners-Guide-to-Codecaves

    I need some clarification on a few parts of the article, I hope someone here is knowledgable on the topic.

    So, you have to inject the DLL by using openprocess and writememory, correct? After that, do you have to use LoadLibrary as well? Or do you use asm inlined in the .exe to call LoadLibrary?

    If it's the latter (inlined asm), i don't see how exactly it would be done, because you only want to do LoadLibrary once, after that, you just want to call, in asm, the dll.

    Or, if you do LoadLibrary from the loader (externally with createremotethread then I'm a bit confused on the difference between code caves and dll injection. Because whenever I read about different hacking techniques, it's always a choice between using dll injection or using code cave, or some other technique such as manual mapping or reflective dll injection and etc. Why does this article use both code cave and dll injection? If he uses createremotethread, then they've already a complete regular dll injection.

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

    No comments:

    Post a Comment