• Breaking News

    Wednesday, October 30, 2019

    If two reddit posts have the same title, how does the reddit "database" know how to distinguish between them? Ask Programming

    If two reddit posts have the same title, how does the reddit "database" know how to distinguish between them? Ask Programming


    If two reddit posts have the same title, how does the reddit "database" know how to distinguish between them?

    Posted: 30 Oct 2019 07:38 PM PDT

    What are some interesting niche languages to learn?

    Posted: 30 Oct 2019 07:42 PM PDT

    I have Python, Java, and C in my toolkit, but I figured it might be interesting to learn something niche. Not an esolang, but something out of the ordinary that can be useful in specific situations

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

    My teacher doesnt want me to use if/elif statements for these certain lines of code my classes python assignment

    Posted: 30 Oct 2019 03:28 PM PDT

    The assignment is a BINGO program and I'm on the last few steps but I'm kinda stuck.

    So I need to take out a display a random number from the nested list called "allnumbers" that has numbers 1 through to 75 with the corresponding letter in front of it (B=1-15, I=16-30, N=31-45, G=46-60, O=61=75)

    ex. B3, I28, N32, G54, O73

    She said to append the letters from the variable "game" with the random number from "allnumbers" behind without using if/elif statements for each letter. I'm not sure how to do this.

    Here is the Pastebin of the code (Last 4 lines is where it's supposed to happen): https://pastebin.com/ECsd0SvS\

    edit: Ask questions if needed

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

    What software do you use to visually represent data flow in your application?

    Posted: 30 Oct 2019 07:26 AM PDT

    I'm looking to make a flow chart of state, components, and possibly even files and user interface to help the onboarding process of understanding data flow, code and file structure, and help enforce separation of concerns.

    What is the best software to visually represent this?

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

    What is a relevant functional programming language a mathematically-minded person can learn?

    Posted: 30 Oct 2019 12:19 PM PDT

    Despite having studied applied maths & informatics for a couple of years before changing degrees, I've never learned to actually program properly (I blame myself, flunked all of the practical classes), but I've always excelled in theoretical CS and other mathematical subjects. Now I want to shore up my programming knowledge by myself, and want to pick 2 languages to self-study, 1 procedural/object-oriented and 1 functional. For OO I was thinking Python, because of how popular it is these days and how much and varied applied mathematics you can do with it. Functional languages I know nothing about, besides a few names, so can someone point out what's particularly relevant these days and has some interesting applications, in fields such as symbolic computation/computer algebra or others?

    P.S. If anyone wants to make any suggestions regarding an OO language, I'd be happy to take them, although I do think Python's a solid choice.

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

    Question about creating a random walk model in python

    Posted: 30 Oct 2019 09:37 PM PDT

    I have a project to do and it requires I do some problems with random walks in python. While I have experience in python, it is mostly with data analyses and the such. So I will post the question, and since I have no experience in this area, if someone could point me in the right direction I would be so grateful!

    Consider a grid in d-dimensional space . There are n grid lines in each dimension, spaced one unit apart. We will consider a walk of m

    steps from grid intersection to grid intersection . Each step will be a single unit movement in any one of the dimensions, such that it says on the grid. We wish to look at the number of possible paths from a particular starting location on this grid.

    For example, consider the case where d=2

    and n=3. We will label the grid intersections (x,y), where x,y∈{0,1,2}. There will be six valid walks starting at (0,0) of length m=2

    :

    • (0,0)→(0,1)→(0,0)
    • (0,0)→(0,1)→(0,2)
    • (0,0)→(0,1)→(1,1)
    • (0,0)→(1,0)→(0,0)
    • (0,0)→(1,0)→(2,0)
    • (0,0)→(1,0)→(1,1)

    So if I had to find the number of valid walks for if like d = 5. n = 12, and m = 15. How would I go about finding that? If you can't answer but could point me in the direction of some tools I could use, that would be helpful too.

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

    C++ Vectors undefined reference

    Posted: 30 Oct 2019 09:10 PM PDT

    Hey guys, doing some programming homework here and I can't find any solutions to this error on the Stack. If anyone has come across this any help would be appreciated!

    `undefined reference to \KMeans::KMeans(int, std::vector<Point, std::allocator<Point> >, std::vector<std::vector<Point, std::allocator<Point> >, std::allocator<std::vector<Point, std::allocator<Point> > > >)'``

    Main.cpp

    vector<Point> pointsVector = read.getPoints();

    vector<vector<Point>> centroidsVector = read.getCentroids();

    for(int i = 0; i < read.getCentroids().size(); i++){

    for(int j = 0; j < read.getCentroids().at(i).size(); j++){

    `KMeans kmeans(read.getCentroids().at(i).size(),pointsVector,centroidsVector);` 

    }

    cout << endl << endl;

    }

    I need to get the vector from my mates read class, so I use his getPoints() function which returns a vector <Point>

    My constructor:

    KMeans(int,vector<Point> pointVec,vector<vector<Point>> centroidsVec);

    If you need more code let me know and I'll edit this post.

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

    Inverted data structure to count occurrences of words (C++)

    Posted: 30 Oct 2019 08:33 PM PDT

    In a string, let's say a sentence is "I love hamburgers and I love ice cream", I would like to have a data structure that will correspond "I" with 2 (2 occurrences) and "love":"1", "hamburgers":"1", but the thing is I have the sentence already as a vector of strings, what is the easiest way to make the inverted index without using a map?

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

    Finding the maximum sum of a 2D array with no vertical adjacency?

    Posted: 30 Oct 2019 07:35 PM PDT

    I have a programming question which is essentially finding the maximum sum of n x k array, where k is some constant, such that there is no vertical overlap, and we can only include at most 2 elements from each row. In other words, if we include A[i][4] then we can not include A[i-1][4] or A[i+1][4]. I'm not sure if it's a dynamic programming problem, or if its a greedy algorithm. Looking for a polynomial solution, any advice would be great :)

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

    What is the type of this Variable?

    Posted: 30 Oct 2019 03:33 PM PDT

    a = ['Hello', 'World']
    b = a[0]
    Whats the type of variable b? i would say it's a string. is it correct or can it still be a list?

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

    Does anyone have a program to download imgur favorites albums?

    Posted: 30 Oct 2019 03:27 PM PDT

    Hi,

    For strictly academic and scientific reasons, I'd like to download a users NSFW favorite albums and posts from imgur. Not album by album using something like ripme, I mean the entire profile. I'd like a way to download it all and have the folder structure for the users favorites and within them a folder for each album. Anyone knows how to do it? Complete newbie here and can't find what I'm looking for here or elsewhere.

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

    [JavaEE][JaxRS] Notification system in REST

    Posted: 30 Oct 2019 05:39 PM PDT

    What's an acceptable approach to implement WS Notifications in javaEE? My scenario is the following: client side (Angular) makes a call to a web service. After that, the web service should be able to send asynchronous notifications to the web client. Any examples would be appreciated. Thanks in advance!

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

    The unit files have no installation config even when WantedBy is set

    Posted: 30 Oct 2019 01:24 PM PDT

    [Unit] Description=Node.js Hello World Http Server[Service] PIDFile=/tmp/hello_world-99.pid User=Ubuntu Group=Sudoers Restart=always KillSignal=SIGQUIT WorkingDirectory=/home/ubuntu/chatbot/whatsapp/ WantedBy=multi-user.target ExecStart=/home/ubuntu/chatbot/whatsapp/index.js[Install] 

    I have this simple service that I want to start, but I keep getting those errors. Any help?

    I'm on Ubuntu 18.04.03 LTS (Bionic). I'm using AWS if it helps.

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

    How to get progress beyond just the syntax of python

    Posted: 30 Oct 2019 09:19 AM PDT

    Hi I have been programming here and there for a while now and I'm not sure how to progress further. If for instance I learned the sntax of python and algorithms etc how do I get beyond that and learn how to link that to complementary technologies such as databases and so on, to the point of for example being able to make a functioning desktop application that's download able. The best example I can think of for what I am asking is with html and css, even If someone learned how to code with html or css in a text editor or notepad, they still need to learn how to get their website online by hosting a domain and how to use a sftp and maybe WordPress and how it's themes work and how to connect it with databases etc etc. What I'm getting at is there's a difference between coding websites in notepad and acctualy making a finished product. In the case of html and css I kind of managed to move on past just coding in text editor but I'm struggling more with python. Any recommendations? Books? Tutorials? Courses? Or just general advice?

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

    Fish or Zsh (on mac)

    Posted: 30 Oct 2019 04:23 PM PDT

    Hello. I'm still beginner of programming. Recently, I decided to be Vimmer, so I'm setting my terminal. I've been used bash, now, I'm using zsh. But I think that there are lot of people who uses Fish instead. My boss told me that fish was not so good. That being said, I think Fish is much more beautiful than zsh. So my question is that which is better? And why? Thank you in advance

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

    Async and Callback functions

    Posted: 30 Oct 2019 02:14 AM PDT

    Can someone help me get my head around how to use callback functions to get around undefined errors with Async in JavaScript.

    I asked on stack overflow but they just pointed me to this article, I've been looking at it all day and I'm more confused than ever.

    I have some code where the request function retuns a authentication token and statusCode when it runs:

    const request = require('request'); var postData = { "auth": { "username": "x", "password": "x" } }; var options = { method: 'post', body: postData, json: true, url: 'https://api.appnexus.com/auth' } request(options, function (err, res, body) { var response = body.response.token console.log(response) console.log(res.statusCode) }) 

    I get that I need to wait until the request function has finished, by using a callback function, but I don't understand how to structure it - is the request function the parent or child function? It's already got a function as one of it's arguments - I don't get how I can see the console.log(response) print the correct token but I can't seem to find any way to get it to return in any meaningfull way outside of that function - it feels like it's right there but I can't seem to get the token value stored in the response variable outside of the function to use elsewhere.

    I've been looking at sties for hours and feel completely lost... can someone explain this like i'm 5 please?

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

    Dynamic Programming problem help

    Posted: 30 Oct 2019 11:12 AM PDT

    I have to create a dynamic programming solution to the following problem:

    Given a set of n stairs, such that each step of the stairs has a positive value how can we maximize the value if we are allowed K steps up the stairs and we can choose to skip 1 or 2 steps at a time

    Example:

    Given arr: 5, 1, 6, 2, 8, 9 n=6

    k = 3 we would take 6,8,9

    k = 2 we would take 6,9

    k = 1 we could not make it to the top of the stairs, furthest we could get is to value 6

    k=n we would take all the steps

    What's tripping me up is the fact that you have to take the last value (to make it to the top of the stairs) and you have to take values in such a way that you can actually reach the end. Any help, or pointers in the right direction would be appreciated, thanks!

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

    Taking a pre existing C# backend and implementing ReactJS

    Posted: 30 Oct 2019 08:59 AM PDT

    So currently we are rebuilding a website at my job. We have a pre-existing C# backend with 6 files getting different info back from the files. All 6 are .aspx. If youre looking in the network inspector from chrome the files are getting back information. I can see this because the site we have now we are just moving into a react framework to expand. This is a higher up decision.

    As of now i have no idea how to access this data:

    I am not sure if you can just use a HoC and pull all 6 api's in globally and access them that way by file? like fetching a json from the file its just a very weird thing i have never done.

    I have no clue what i should be looking for here. I did some googling and saw https://reactjs.net/ where its bundling the files together? but im not sure why. To my knowledge this is just a facelift but im putting an old engine in a new bay and i have no idea where to put the mounts.

    help please.

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

    Are there any unicode arrow characters that line up to the box drawing characters?

    Posted: 30 Oct 2019 02:20 PM PDT

    I asked this question on r/unicode, but I got no answers. So maybe I'll have better luck here.

    I'd like to have a unicode diagram where one box has a line that points to another. All the arrows I have tried seem to be standalone arrows do not connect up with the horizontal line and have a bit of white space on both sides (and off center. For example:

    ───→

    What would also be awesome is one like this: ⇥ but bigger that would connect to the box drawing symbols.

    Do such a things exist?

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

    Best place to find hackathons or other dev challenges

    Posted: 30 Oct 2019 07:44 AM PDT

    Me and a friend would like to participate in hackathons or other form of competitive, team-based dev challenges. It offers a good opportunity to practice brainstorming idea, expose yourself to new technologies and pick up new things.

    What apps do you guys use to find and enroll in hackathons?

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

    How do large social network clients track and store user journeys?

    Posted: 30 Oct 2019 09:45 AM PDT

    Take instagram or twitter for example: how do analysts know if a user navigated to a post from their feed or by searching? This question is trivial for 1-step attribution but I am curious about tracking multi-step journeys (ie user went to feed > saw a post > went to the author page > navigated to another author page > followed this author etc)

    I can imagine a data pipeline that sorts UI events on time and attempts to reconstruct the user journey that way. Or the client can keep track of every previous action that leads up to a UI event in a session and log the full journey each time. Probably several other ways to do this that I'm not thinking of.

    Are there any industry best practices on these or other approaches? Blog links or papers would be very useful as I'm having trouble coming up with anything on google

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

    Is it okay to raise an issue on a library's github, when the issue is related to interaction with another 3rd-party library rather than an inherent problem with the library in question?

    Posted: 30 Oct 2019 04:34 AM PDT

    We use a react UI component library called blueprintjs, which recently went through a big update. Since the update, the library is completely unusable with mobx (a dataflow library sort of like redux). This is a big issue for us as we use both mobx and blueprintjs in our product.

    By unusuable, I mean that the whole app crashes if a blueprint component is placed inside a mobx HOC. I created a very minimal example here to show that the app crashes as soon as you click the text field.

    I would like to raise an issue about this on blueprint's github, however I feel like they won't prioritise issues related to compatibility with libraries they have no control over. On the other hand, mobx is very widely-used in the react community so that might give them an incentive to fix the issue. Also it could uncover a wider issue in their update. Do you think it's appropriate to raise an issue on their github? Cheers!

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

    Having A div display text onto image; HTML & JS

    Posted: 30 Oct 2019 09:19 AM PDT

    so bascically i have a simple webapp that presents a random song when an image is moused over, right now what is happening is the text is being rendered beneath the image, but I would like it to render onto a section of the aforementioned image.

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

    Tkinter matplotlib animation really slow

    Posted: 30 Oct 2019 02:17 AM PDT

    C# How define a Key Value Pair within a loop

    Posted: 30 Oct 2019 11:25 AM PDT

    Hello, I am a student in need of help for some homework.

    For a gradebook software, one of the options is to alter the name of someone in the gradebook. It has to be done using multiple methods, but that's mostly irrelevant.

    Let's say that you had a dictionary<string, list<int>>; and that you wanted to change the key of one Key Value Pair inside that dictionary. How would you go about doing it?

    This is basically the idea I had:

    1) go through a foreach loop that would go through each value that was matched to a key (ie. <"Brodie",(91, 90, 99)> so it would go through the foreach loop three times.

    2) record each value onto a new list

    3) add that list to a new key value pair with the student's name.

    Here is the code for reference:

    List<int> grades = new List<int>(); for (int e = 0; e<1; e++) { foreach (int value in StudentGrades[oldname]) { grades.Add(value); } KeyValuePair<string, List<int>> newnamegrades = new KeyValuePair<string, List<int>>(newname,grades); } return newnamegrades; 

    The string newname is declared by the user earlier in the code. The only error I am getting is that when I type:

    return newnamegrades; 

    It gives me error cs0136 and tells me that the variable cannot be declared within this scope. I know why it does this, the Key Value Pair has to be defined before the for loop. The only problem is, how can I define newnamegrades as a KeyValuePair that is "empty" and that I can define within the for/foreach loop?

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

    No comments:

    Post a Comment