• Breaking News

    Saturday, May 11, 2019

    Is it possible to condense whole programs into a single formula? Ask Programming

    Is it possible to condense whole programs into a single formula? Ask Programming


    Is it possible to condense whole programs into a single formula?

    Posted: 11 May 2019 03:59 PM PDT

    After finding out about xor swap, I wondered if I could do the same kind of thing for a function that returns the greater of two values. I came up with the following:
    x^( (x^y)*(x<y) ).
    Then, I did the same for 3 values:
    z^((z^(x^((x^y)*(x<y))))*(z<(x^((x^y)*(x<y))))).
    Shortly thereafter, I wrote up a formula to return the sign of a slope (1, -1, 0, or 2 if the slope is undefined):
    ( ( ((y2-y) / ((x2-x) + ((x2-x) == 0))) / abs( ((y2-y) / ((x2-x) + ((x2-x) == 0)))+((y2-y) == 0) ) ) ^ ( ( ((y2-y) / ((x2-x) + ((x2-x) == 0))) / abs( ((y2-y) / ((x2-x) + ((x2-x) == 0)))+((y2-y) == 0) ) ) * ((y2-y) == 0) ) )*((x2-x) != 0)+(((x2-x) == 0)*2).
    Here's that same formula but in slightly more readable terms (C):
    int rise = (y2-y);
    int run = (x2-x);
    int riseSafety = (rise == 0);
    int runSafety = (run == 0);
    int safeSlope = (rise / (run + runSafety) );
    int baseSignSlope = ( safeSlope / abs( safeSlope + riseSafety ) );
    int zeroSignSlope = baseSignSlope * riseSafety;
    int infCheck = (run != 0) + (runSafety*2);
    return (baseSignSlope ^ zeroSignSlope) * infCheck;
    My question is as follows:
    How far exactly can this idea go? Is it possible to condense whole complicated programs into a single line?
    Additionally, what is the difference in efficiency between this and a regular program?

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

    What language/framework/platform/editor environment has given you the best DX?

    Posted: 11 May 2019 05:04 PM PDT

    Trying to reverse engineer POST requests, how do I 'catch' them?

    Posted: 11 May 2019 05:00 AM PDT

    I can see the response in Developer tools, but I can't see the POST request being sent.

    Do I really need to MITM myself to see this?

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

    What are some great language agnostic should read books for programmers.

    Posted: 11 May 2019 05:59 PM PDT

    I am trying to put together a library of book my developers should definitely read. The ones I've read and would highly suggest are Phoenix Project/ Pragmatic Programmer / Design Patterns: Elements of Reusable Object-Oriented Software / Code Complete / Clean Code: A Handbook of Agile Software Craftsmanship and for programmers that want to know more about whats underneath what they write I like https://userpages.umbc.edu/~squire/intel_book.pdf as a good intro to architecture. But I am sure more are out there.

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

    Regex questions

    Posted: 11 May 2019 02:10 PM PDT

    EDIT: Heres the repo. Halp D:

    https://github.com/Joe-Gigs/regex

    Hey all,

    So I am working with Regex for the purposes of matching inputs and outputting something based on what was entered.

    Some examples:

    When I enter a sentence in all caps the script will tell me to 'chill',

    When I mention an acronym like BBC it will say something different and here lies my issue:

    I am learning regex as I go and I am having trouble differentiating between a sentence with all caps and one with some caps and everything is getting all mixed up.

    Anyone know a good regex pattern for 3 (or maybe more?) acronyms?

    Thanks.

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

    Book for learning more about computer architecture, memory management and CPU performance/IO

    Posted: 11 May 2019 09:26 AM PDT

    I've worked mostly with web applications (Java server side/javascript frontend/server side), but I don't have a deep understanding of how memory management or CPU performance works. My upcoming projects at work are going to require this kind of knowledge, can anyone recommend any good books around these topics?

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

    Want to build a Vocal Remover from music in Python

    Posted: 11 May 2019 05:43 AM PDT

    I'm planning to build a vocal remover program (Karaoke maker) in Python. Is there any good library or open-source program in python. ....any suggestion is most welcome .

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

    Need help creating a GUI for a small project

    Posted: 11 May 2019 12:35 PM PDT

    Hey guys

    I started working on a little project of mine and bought myself a RP model 3B+. I've done some back end programming in the past, got my back end code finished in Python now, but i've got no experience in front end programming.

    The end result of the project is supposed to behave like a small reaction-based game with a neat looking GUI.

    Quick overlook of the project:

    Hardware: Keyboard, mouse, monitor and some buttons connected to raspberry.

    Backend: Player types his/her name on the keyboard, program waits for a start input button, after that the main program starts counting the score of the player(compares it to the current best score at the same time). All the useful data is saved to a database( for creating a highscore table).

    UI should consist of the main screen - user input, after that creates a screen where it shows the player's progress with a progress bar (compared to the ghost of the current best player) for example and the remaining time of the program. When the time runs out, it displays the score and switches to the highscores.

    How can i pull off the front end side of the project? Thought of creating web app through html, css and js and converting it to desktop exe with electron afterwards.
    The emphasis should be on the neat look design.

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

    How do you dynamically resize call stack frames?

    Posted: 11 May 2019 01:03 AM PDT

    I have a recursive tree for evaluating chess moves.

    Each recursive function call creates a new stack frame. Different chess positions have a different number of legal moves, and so each stack frame should ideally be of different size/offset.

    I have tried storing moves in heap memory and as expected, this is slower than storing moves in fixed size arrays (no chess position has more than 216 moves). Few chess positions have as many as 216 moves and so this strategy clogs up the CPU caches with null moves. I have tried maintaining my own stack for chess moves at different depths; this is working well but now I have raw pointer spaghetti with two call stacks per thread.

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

    Looking for coding help!

    Posted: 11 May 2019 11:22 AM PDT

    Hey,

    I'm new to android development, and would really appreciate if I find an experienced programming body who can guide and help me out when I get confused and stuck.

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

    wtf does PROFICIENT mean

    Posted: 11 May 2019 04:58 PM PDT

    Is my interpretation of these CSS snippets correct?

    Posted: 11 May 2019 07:24 AM PDT

    Example 1

     .sidebar li a:link { color: red; } 
    • The a:link contained within the parent li contained within the parent sidebar //should have color red after clicked.

     

    Example 2

     .sidebar h3.resources { background: transparent 
    • The resources class nested inside the h3 class inside the sidebar class //should have a transparent background.
    submitted by /u/mementomoriok
    [link] [comments]

    autoComplete.js v5.0 just released!

    Posted: 11 May 2019 05:48 AM PDT

    Simple autocomplete pure vanilla Javascript library.

    Version 5 has just been released with improved support for large datasets and the ability to do API calls and to debounce them plus more stuff.

    ne.link/pCpERc8

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

    Confused about ftok()

    Posted: 10 May 2019 11:20 PM PDT

    I'm confused why it requires a pathname to generate a key. What does the pathname have to do with generating a key?

    Also, what type of file should a shared memory file be? Does it matter?

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

    No comments:

    Post a Comment