• Breaking News

    Saturday, May 29, 2021

    How to find the range of MMAPable virtual addresses in a program? Ask Programming

    How to find the range of MMAPable virtual addresses in a program? Ask Programming


    How to find the range of MMAPable virtual addresses in a program?

    Posted: 29 May 2021 05:05 PM PDT

    Background information:

    1. I'm using 64 bit Arch.

    2. I'm writing an experimental custom allocator, so portable code is a stretch goal, not a requirement.

    3. I'm not using C or C++. I'm doing my syscalls directly.

    According to this SO post: https://stackoverflow.com/questions/17671423/where-is-the-stack-memory-allocated-from-for-a-linux-process A program's virtual address space is organized like this:

    ------------------ <--- Top of the process address space Stack (grows down) v v v v v v v v v ------------------ (unmapped) ------------------ <--- Maximum stack size. (unmapped) ------------------- mmap ------------------- (unmapped) ------------------- ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ brk (grows up) ------------------- BSS ------------------- Data ------------------- Text ------------------- ------------------- <--- Bottom or process address space. 

    Presuming this is correct, I'm trying to find the exact range of MMAPable address space here. Is it sufficient to find the lower bound by doing sbrk(0), page aligning up, and then ensuring that brk and sbrk are never called again? For the upper bound is it sufficient to assume 008FFFFF FFFFFFFF - SIZE_OF_STACK - A_GIGABYTE_OF_PADDING, and then page aligning down, is safe address space? I'd prefer a more exact and robust answer for the upper bound, but I'll accept a reasonable approximation that's guaranteed safe.

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

    What programming language would be Esperanto of programming languages?

    Posted: 29 May 2021 08:27 AM PDT

    A regular, easy to learn but unwanted/marginalized by the major players/companies. What programming language is like that?

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

    How can I create a long-running task that sends notifications to multiple users every so often?

    Posted: 29 May 2021 09:30 PM PDT

    So basically with this app I just want to make it, so a user enters a schedule into some REST API which is then stored into some SQL database.

    I want my app to notify each user by their schedules.

    I'm not sure how I can go about doing this. My main issues is this:

    How will my app stay "aware" of multiple schedules which can all happen at different times?

    What happens if I have 100 schedules? A 1000? 10000? These all need to be handled, I can't do a huge select to extract them all at once otherwise it's just going to gum up the application.

    I know this thing is a perfect candidate for multithreading. To be frank, I want to get it done with Elixir, but those concerns above have me somewhat confused.

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

    How can I export an object from main.js to utils.js without executing the entire main.js (client side)

    Posted: 29 May 2021 02:39 PM PDT

    As the titles says, I am trying to export an object from main.js to utils.js without executing the entire main.js (client side).

    For reference, my main.js looks like this

    function init(){
    if(document.getElementById('title')){
    document.getElementById('title').innerHTML += "hey"
    }
    const btn = document.getElementById('change-btn')
    if(btn){
    btn.onclick = function () {
    location.href = "utils.html"
    }
    }

    window.onload = function(){
    init()
    }
    export default class User{
    constructor(height, width){
    this.height = height;
    this.width = width
    }
    }
    export const userA = new User(10,5)

    and my utils.js looks like this

    import user from "./main.js"
    console.log(user)

    I want utils to ultimately print the user with 10 as height and 5 as width but I have been stuck on this for a few days :((

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

    Any of you doing college and a software developers job at the same time?

    Posted: 29 May 2021 02:44 PM PDT

    Ok so i am an foreigner planing to move to US. I want to work as software devoloper but people told me that i should do college first, and problem is there is no comouter science college in my country. So i was womdering if i can move to US and works as software devoloper at same time i go to college. Have any of you tried this and have you been sucesfull?

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

    Grid how to find the index of the first position of the next row given a starting index

    Posted: 29 May 2021 08:18 PM PDT

    0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

    assume there is a 2d grid like a css grid with 15 elements like above, there are five columns and 3 rows, and starting index is 0

    given the index of any element, how do you find the index of the first position that is in the next row ?

    for example,

    index 4 returns 5
    index 6 returns 10
    index 2 returns 5
    index 11 returns 15
    index 0 returns 5
    index 14 returns 15

    my formula is not working
    const colPosition = index % colCount; const rowPosition = Math.floor(index / colCount); const answer = index + (colCount - colPosition) + 1;

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

    I need help choosing a language

    Posted: 29 May 2021 07:03 PM PDT

    So I can't decide whether I should choose c++ or Python. I have learned a good bit of html and css but that's it. I will mainly use it for AI. Any help in deciding will be greatly appreciated and a explanation even more so.

    submitted by /u/why_am_i-_-Here
    [link] [comments]

    Serious question

    Posted: 29 May 2021 06:40 PM PDT

    Is Eloquent javscript good for beginners?

    submitted by /u/Objective-Income-405
    [link] [comments]

    Is this a valid 2-opt algorithm?

    Posted: 29 May 2021 06:33 PM PDT

    I have implement this 2-opt algorithm, but I am not sure if my code is right. Has anyone worked with 2-opt before?

    ArrayList<Record> twoOpt(ArrayList<Record> path) {
    int N = path.size();
    ArrayList<Record> best = new ArrayList<>();
    for (Record r : path) { best.add(r); }
    for (int i = 1; i < N-2; i++) {
    for (int j = i+1; j < N+1; j++) {
    if (j-i == 1) continue;
    ArrayList<Record> newPath = new ArrayList<>();
    for (int k = 0; k < i; k++) {
    newPath.add(best.get(k));
    }
    for (int k = j-1; k >= i; k--) {
    newPath.add(best.get(k));
    }
    for (int k = j; k < N; k++) {
    newPath.add(best.get(k));
    }
    if (cost(newPath) < cost(best)) {
    best = newPath;
    }
    }
    }
    return best;
    }

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

    Why is there different brace positioning in different languages?

    Posted: 29 May 2021 08:37 AM PDT

    For example, most java programmers would do

    public class Test {

    }

    Whereas C# programmers would put

    public class Test

    {

    }

    Is there a reason for this or is it just preference? If so, why do most programmers using a certain language use the same curly brace positioning?

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

    How can I export an object from main.js to utils.js without executing the entire main.js (client side)

    Posted: 29 May 2021 03:01 PM PDT

    As the titles says, I am trying to export an object from main.js to utils.js without executing the entire main.js (client side). For reference, my main.js looks like this

    document.getElementById('title').innerHTML += "hey" const btn = document.getElementById('change-btn') btn.onclick = function () { location.href = "utils.html" } export default class User{ constructor(height, width){ this.height = height; this.width = width } } export const userA = new User(10,5) 

    and my utils.js looks like this

    import user from "./main.js" console.log(user) 

    I want utils to ultimately print the user with 10 as height and 5 as width but I have been stuck on this for a few days :((

    I have tried using if statements to check if document.getElementByID(blah) exists first. This works but I am sure that there is a better solution :((

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

    How do I get multiple outputs for 2 simultaneous equations in python?

    Posted: 29 May 2021 02:58 AM PDT

    I'm trying to plot a graph with 2 simultaneous equations, but I don't need to solve them, I'm just trying to get multiple results from substitution, like when x is 1, or when y is 0.

    My equations are 5x+2y=20, y=2x+1

    All the solutions that I found are only to solve the equation, not substituting values to get multiple results.

    halp pls

    preferably with numpy or sympy functions, i'm tryiing to learn those haha

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

    How to Color Locations By a Factor On a Leaflet Map?

    Posted: 29 May 2021 01:11 PM PDT

    countries <- read_csv("regions.csv") countries Factor Location <chr> <chr> 1 blah Mexico 2 blah2 Quebec 3 blah2 New Zealand 4 blah3 Bahamas 5 blah3 North Carolina 6 blah3 Northwest Territories ... ... sp_countries <- readOGR("https://raw.githubusercontent.com/datasets/geo-boundaries-world-110m/master/countries.geojson") 

    I have a data frame that links factors to locations. If you look above, you will see that the column location can be anything from a city, a region, a state, or a country.

    I would like to color or outline each location's polygon according to their factor. I think the problem is

    1. My factor is not included in any GeoJSON files.
    2. My GeoJSON file does not have polygons for both cities, regions, states, or countries.

    I'm a little lost on how I would accomplish the above as I just started learning leaflet, and any help would be greatly appreciated!

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

    Can I set up a localhost server on airplane WiFi?

    Posted: 29 May 2021 09:13 AM PDT

    I'm flying long distance with my girlfriend soon, and I might take an upgrade to first class while she stays in economy (we've discussed it, she won't be salty). If I used my computer to launch a local server on some random port could we then chat/play games/do whatever or does airplane wifi somehow block this?

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

    Need help learning gui frameworks

    Posted: 29 May 2021 03:32 AM PDT

    Hi!

    I wanted to learn electron because I was sick of very simple gui libraries like tkinter in python and wanted to bring my UI prototypes into real python gui applications. But then I noticed electron gets a lot of hatred because performance issues and many people preferred qt over electron. But what I'm worried about as a person who is new to gui programming, I don't know If I can make electron-like desktop programs like vscode with qt6 and I wanted to ask you if is it possible to make complex UIs that can be made with electron with qt. And if It's possible, where can I learn the qt itself and implementing it in programs.

    Thanks ;)

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

    GUI Java

    Posted: 29 May 2021 06:26 AM PDT

    Can someone link me with a good website to learn GUI for Java? My last teacher didn't really teach well, but I remember he used JOptionPane. But when I look up GUI Java, I also see AWT. Can anyone tell me which one is better, what's different, what I should use?

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

    AI Related Projects

    Posted: 29 May 2021 04:47 AM PDT

    Hey everyone, I am an AI Expert with a proficiency in Computer Vision (how machines see and interpret what they see) and Natural Language Processing (how computers hear, read, understand and interpret language and text). I am currently looking to collaborate on challenging, impactful, and relevant AI projects or projects that require AI.

    What is the best way to collaborate in teams or work with individuals in this regard?

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

    How to find the elements not seen in the Elements tab? How to see those SoundCloud commenters one by one?

    Posted: 28 May 2021 10:03 PM PDT

    https://ibb.co/FgTP1vm

    https://soundcloud.com/stream

    I wanna see all commenters in the Elements tab, not through clicking them on the website one by one and check the Elements tab's change.

    javascript

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

    how to flutter and flask make eCommerce app

    Posted: 29 May 2021 03:21 AM PDT

    how to flutter and flask make an ecommerce app

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

    No comments:

    Post a Comment