• Breaking News

    Friday, November 30, 2018

    CompSci Weekend SuperThread (November 30, 2018) Computer Science

    CompSci Weekend SuperThread (November 30, 2018) Computer Science


    CompSci Weekend SuperThread (November 30, 2018)

    Posted: 29 Nov 2018 05:05 PM PST

    /r/compsci strives to be the best online community for computer scientists. We moderate posts to keep things on topic.

    This Weekend SuperThread provides a discussion area for posts that might be off-topic normally. Anything Goes: post your questions, ideas, requests for help, musings, or whatever comes to mind as comments in this thread.

    Pointers

    • If you're looking to answer questions, sort by new comments.
    • If you're looking for answers, sort by top comment.
    • Upvote a question you've answered for visibility.
    • Downvoting is discouraged. Save it for discourteous content only.

    Caveats

    • It's not truly "Anything Goes". Please follow Reddiquette and use common sense.
    • Homework help questions are discouraged.
    submitted by /u/AutoModerator
    [link] [comments]

    How to generate random RGB value that has a fixed average?

    Posted: 29 Nov 2018 05:50 PM PST

    Given an integer N ([0, 255]), how would you write a program that generates random RGB values whose red, green, and blue average to be N?

    Ex:

    N=127

    Example Outputs:

    (255, 65, 59)

    (50, 110, 221)

    Edit: Why am I being downvoted? This is a genuinely hard problem and most of the answers here are flawed... Either the values tend towards one color because they don't follow a uniform distribution, or the output is not in the range of [0,255].

    Edit 2: Im so sorry, I just realized I forgot to specify that the distribution of rgb values should be uniform. I feel like an idiot, but oh well. Anyway, the reason I asked this question is because I was trying to write a program to convert a grayscale image into random noise, so that when looking at the noise through a grayscale filter, it reveals the original image. (Spoiler alert: it doesnt work too well, which I should have expected... you can make out the original image in the noise since the brightness of each color reflects the grayscale value. Oh well, original question is an interesting problem nevertheless) Sorry about the confusion.

    submitted by /u/santoso-sheep
    [link] [comments]

    Recording and Jupyter Notebook for the Data Science Webinar on Recommender Systems - From Simple to Complex

    Posted: 29 Nov 2018 08:28 AM PST

    [Compilers] When using multiple IRs, how to match an error (i.e. semantic) onto the original line of code where it originated from?

    Posted: 29 Nov 2018 08:41 AM PST

    Assuming an AST-based approach. My naive solution would be to annotate every term in the IR with the number of the original line of code. The problem I see is that this representation might be to memory-consuming if the translation created multiple IR terms per original term.


    Edit 1: I lied a little bit - I do not want to build an compiler, but an static analyis tool. So basically the same, but with more analysis than type inference and we do not produce executable code (but a report of errors found - and where).

    To make up an example:

    Java -> Boogie (a verifyer language) -> My IR with annotations, blackjack and hockers ^-- Some analysis finds a bug X here 

    Now I want to report that some bug X was found - but the user does not care about my very own cool IR, so I want to show him where the error happens in the Java code. I would guess I am not the only one with that problem, is there a canonical best practice? Why not directly verify in Java? Because I want to be able to verify multiple, similar languages.

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

    HELP-I need a basic layout of all the stacks and resources needed to develop a daily guitar training routine that can be trackedAnd saved. Can be basic but Im trying to use it to learn hireable skills such as html js react node sql etc. 3 YR software eng student

    Posted: 30 Nov 2018 01:42 AM PST

    CS Classes that focus on the digital aspect of computer architecture?

    Posted: 29 Nov 2018 09:21 AM PST

    I'm currently trying to learn Assembly & C, but I know that knowing the foundations of how a computer operates, from the bottom to the top, is complementary to knowing these languages and helps a ton in understanding computers and coding languages like C. But most of the Computer Architecture classes I'm looking at seem to focus on the hardware aspect of the architecture rather than the digital aspect. Does anyone know what I'm talking about?

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

    Basic Encryption Help

    Posted: 29 Nov 2018 07:54 AM PST

    I'm having a hard time 'solving' these encryption problems in my beginning CS class.

    Here's my problem.

    Using public keys n=91 and e=5, encrypt the message 101.

    I went to the back of the book for reverse engineer this bad boy and I see ...

    The message 101 is binary for 5.

    5 to the power of e = 5 to the power of 5 = 15625

    15625 (mod 91) = 64 which in binary is 1000000. Thus, 1000000 is the encrypted version.

    My question is how in the hell did they get 15625 as the answer of 5 to the power of 5?

    EDIT:

    I think this could be a typo in the book. In the following problem, it has 2^29 and gives the correct answer.

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

    No comments:

    Post a Comment