• Breaking News

    Friday, March 26, 2021

    What exactly is C#? Ask Programming

    What exactly is C#? Ask Programming


    What exactly is C#?

    Posted: 26 Mar 2021 05:22 PM PDT

    I always had the impression that it was exclusively for the .NET framework. But i see that you can use it on linux. And that there is a n open source version called Mono.

    Basically my questions(with regards towards Mono) are:

    1. Is c# a compiled langauge?
    2. Will the resulting binaries be dependant on the .net framework?
    3. Will the resulting binaries be dependant on mono?
    4. Is it cross-platform?
    submitted by /u/el3ctro0yte
    [link] [comments]

    Understanding compilers and cmake

    Posted: 26 Mar 2021 11:33 AM PDT

    I am a graduate student in chemical engineering studying computational chemistry. Which basically means that instead of running experiments in an actual lab, I do them behind a computer.

    As a computational guy in engineering, I have been exposed and have a decent amount of experience in Python and bash (smatterings of awk, and so on). However, I have been using more heavy-duty computational software, with an emphasis on speed and efficiency. I am running into compilers and mpi and openmpi, hyperthreading, cmake -- just a whole bunch of computing stuff I had only heard in passing, and wasn't bothered by when I wrote my python scripts.

    I know the basic of C, memory management, but I wanted to ask, how should I go about learning CMake, and openmpi? I really have no clue what CMake does, why is it useful. I just see it everywhere, and I want to have SOME understanding of what this thing is.

    I appreciate any advice you have for me.

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

    Are JavaScript frameworks MVC if they don't contain the business logic?

    Posted: 26 Mar 2021 01:43 PM PDT

    I don't think I fully understand the concept of MVC. I read that many JavaScript frameworks such as Angular are said to be MVC. But when it is using a backend technology to get data and doesn't contain any business logic is it still MVC? Also I read that Spring framework can also be MVC. Is this always classified as MVC or just when used a certain way? Just a bit confused by the concept. Would appreciate if anyone could shed some light on it.

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

    What are the most important aspects/things that ALL programming languages have in common?

    Posted: 26 Mar 2021 08:18 PM PDT

    To be more specific, I know there are Programming Careers and they have a HUGE difference between a guy that learned Python in a month and can code some stuff.

    Is there something that is taught in this careers that all prg. languages share?

    Im trying to learn Python and then JS as FAST as possible to get a job before I go broke. It's gonna be my first programming job too, so it will be hard but not impossible. I trust myself.

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

    How hard would it be to make a program that makes the player move towards the mouse curser for top down games?

    Posted: 26 Mar 2021 09:14 PM PDT

    I have a hard time using wasd to move for top down games. Some games allow you to move towards the curser. Would it be possible to make a program that takes over the movement controls and moves the player? As long as I'm pressing or toggled a button.

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

    (Question) When and when not to use pointers in C?

    Posted: 26 Mar 2021 04:42 PM PDT

    I started learning C back in 2019 but then I got busy with other stuff. I'm now learning it again in school.

    I generally understand what pointers are but I'm confused when to actually use them (or when not to use them).

    Also to provide more context, my main programming language is Java.

    Any help is greatly appreciated :)

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

    How were common syntax themes like Monokai born?

    Posted: 26 Mar 2021 11:23 AM PDT

    I can only assume they were popular for some editor at some point and were just ported to everything that came after, but when and where?

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

    How do other games do AI drivers for their race games?

    Posted: 25 Mar 2021 10:51 PM PDT

    I'm making a driving system for my AIs but it's complicated. I don't want my AIs to crash constantly. Yknow?

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

    How to create a program/script that can automatically fill out forms in web page (open to language options)

    Posted: 26 Mar 2021 10:41 AM PDT

    So one of the things I have to do on a daily basis is fill out forms on a website. Thing is, it's quite tedious and would like to automate the process.

    The form first asks you to select a certain number of checkboxes, then you hit "next" for the next page. Next page would have a combination of radial buttons, boxes where you have to fill in information, etc...

    I usually have to fill out the form the exact same way every time so in terms of keyboard inputs it could look something like:

    [Spacebar], [Tab], [Spacebar], [Tab], [Spacebar], [Tab], [Tab], (wait a few second for the next page to load), [Tab], [Tab], "John Smith," [Tab], [Spacebar], [Tab], [Tab], (wait a few second for the next page to load), etc......


    What would be the best way to do something like this?

    I usually program in backend stuff like C++, Java, Python, etc... and have some knowledge in front end stuff like javascript, CSS, html, etc... and even learned a bit of BASH to use command prompt to make batch scripts.


    Really, I'm open to any language as learning new languages doesn't seem to difficult once you pick up a couple. Plus, what I want to doesn't sound to difficult to program once I know the method to do it.

    Just trying to figure out what the best language to do what I want.

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

    Finding areas of interest in a heatmap

    Posted: 26 Mar 2021 04:00 PM PDT

    Is there a well known algorithm or method of finding areas of interest in a heatmap?

    I want to find areas with high values in a heatmap so that i can mark specific coordinates coordinates of interest. I also want to calculate the value of each of these marks by doing a sum operation in a certain radius (different radius for each mark).

    I dont only want to mark each area with the highest value though, i want to find every area of interest and sort them by their value so i can pick out the highest value marks.

    Best way i have of explaining this is if a heatmap would be interpreted as a height map. I want to find each and every "mountain" in the height map, mark its peak, and the peak should should have a value associated with it which is the volume of the mountain as a whole.

    Would really appreciate any help on this!

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

    How do i update the image?

    Posted: 26 Mar 2021 02:47 PM PDT

    import redditinfo as ri import pygame as pg import button as b import utils as u import image_loader as img_ldr class gui: def __init__(self,surface): self.surface = surface self.font = pg.font.SysFont('Verdana',15) self.nextPostButton = b.Button(self.surface,(0,0,0),(255, 87, 0),(100,100,100,50),50,self.font,'Next Post',True,(255, 87, 0),(0,0,0)) self.selected_post = 0 self.subreddit = ri.from_subreddit('memes',l=5) self.subreddit_post = self.subreddit.get_posts() self.subreddit_post_urls = self.subreddit.get_url_list() self.author_name = self.subreddit_post[self.selected_post].author.name self.loader = img_ldr.Loader() self.img_list = self.loader.convert_list(self.subreddit_post_urls) self.image = pg.image.load(self.img_list[self.sel]) def gui_event_handler(self,event): if self.nextPostButton.gets_clicked(event): self.selected_post += 1 def main_page(self): # image_list = [] # for image in self.img_list: # image_list.append(image) self.nextPostButton.show() try: self.author_name = self.subreddit_post[self.selected_post].author.name except IndexError: self.selected_post -= 1 author_surf = self.font.render('Author: '+self.author_name,True,(0,0,0)) print(self.selected_post) self.surface.blit(self.image,(100,300)) self.surface.blit(author_surf,(100,150)) 

    How do i update the image using the index in my terrible code?

    This is what the convert list does:

     def convert_list(self,url_list): imglst = [] for url in url_list: image_to_string = urlopen(url).read() image_to_file = io.BytesIO(image_to_string) imglst.append(image_to_file) return imglst 

    and the

    get_post_urls(lst) 

    just returns a list of Submission urls using praw

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

    tired of expensive subscriptions

    Posted: 26 Mar 2021 05:18 PM PDT

    Is there an easy way to sync products inventories and profit and expenses from websites like shopify, square, loyverse, quickbooks, etc. The thing is, I want an app that does it all as POS (Point of sale), e-commerce and the accountability but most of them just do one of them and charge you extra to sync with other apps that offer the lacking feautures. I'm just tired of it. These guys are app developers, I think it would be easy to add those extra feautures charging a little more but instead they chose to complicate things and charge you a lot of money. I should take a course of HTML? JAVA? Or is it too difficuly for someone with no experience in coding? Please help!!

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

    Artist portfolio with admin system

    Posted: 26 Mar 2021 10:47 AM PDT

    Im coding a website for my dad whos an artist and idk how to make the art gallery with an admin system so that he can post in it. Thanks

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

    Question about clock_gettime() and clock_getres()

    Posted: 26 Mar 2021 10:20 AM PDT

    So, a linux user was trying to run an old custom network benchmark on their linux machine and got an implausible fast number - better that was physically possible - and asked me to look at the source code, which I found was using a combination of the rdtsc instruction and the CPU frequency from /proc/cpuinfo to create the time deltas. I fixed that by switching to using clock_gettime(CLOCK_MONOTONIC,...) and cured the problem - but then it got me to thinking about the resolution of the numbers we were getting... and when I checked the resolution with clock_getres() I got another implausible answer - that the clock has a resolution of 1 nanosecond.

    So, now I'm wondering, what does that even mean, to say that the clock has a resolution of 1 nanosecond but not make any claims at all about the accuracy of the clock...

    Is there some way to learn the accuracy of the times returned by clock_gettime()?

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

    C++ glm::vec2 issues

    Posted: 26 Mar 2021 09:57 AM PDT

    #include <iostream>
    #include <random>
    #include <vector>
    // gfx
    extern "C" {
    #include <raylib.h>
    }
    // for vectors
    #include <glm/geometric.hpp>
    #include <glm/common.hpp>
    #include <glm/vec2.hpp>
    #include <glm/vec4.hpp>
    static float MaxBoidSpeed = 2.0f;
    static float MaxSteerForce = 0.03f;
    static float DesiredBoidSeparation = 25.0f;
    static float DesiredBoidNearby = 128.0f;
    class Boid
    {
    public:
    Boid(float x, float y, float angle)
    {
    velocity = glm::vec2(cos(angle), sin(angle));
    position = glm::vec2(x, y);
    ID = boid_count;
    boid_count++;
    }
    void Update(std::vector<Boid>& boids)
    {
    ApplyForce(AvoidOtherBoids(boids) * 1.5f + AlignWithOtherBoids(boids) * 2.0f + CohereWithOtherBoids(boids) * 2.5f);
    velocity += acceleration * 10000.0f;
    velocity = glm::clamp(velocity, glm::vec2(-MaxBoidSpeed, -MaxBoidSpeed), glm::vec2(MaxBoidSpeed, MaxBoidSpeed));
    position += velocity;
    acceleration *= 0;
    }
    void Draw()
    {
    printf("position %f %f\n", position.x, position.y);
    DrawCircleV({ position.x, position.y }, 2.0f, BLACK);
    DrawCircle(position.x, position.y, DesiredBoidNearby, { 255, 0, 0, 32 });
    }
    void ApplyForce(glm::vec2 force)
    {
    acceleration += force;
    }
    glm::vec2 GetPos() { return position; }
    void SetPos(glm::vec2 pos) { position = pos; }
    glm::vec2 GetVelocity() { return velocity; }
    unsigned int GetID() { return ID; }
    private: // functions
    glm::vec2 AvoidOtherBoids(std::vector<Boid>& boids) // Rule 1
    {
    glm::vec2 steer;
    float count = 0;
    for (auto boid : boids)
    {
    if (ID != boid.GetID())
    {
    float distance = abs(glm::length(position - boid.GetPos()));

    if (distance <= DesiredBoidSeparation) // if within bounds then separate
    {
    glm::vec2 difference = position - boid.GetPos();
    difference = glm::normalize(difference);
    difference /= distance;
    steer += difference;
    count++;
    }
    }
    }

    if (count > 0) steer /= count;

    if (glm::length(steer) > 0)
    {
    steer = glm::normalize(steer);
    steer *= MaxBoidSpeed;
    steer -= velocity;
    steer = glm::clamp(steer, glm::vec2(-MaxSteerForce, -MaxSteerForce), glm::vec2(MaxSteerForce, MaxSteerForce));
    }
    return steer;
    }
    glm::vec2 AlignWithOtherBoids(std::vector<Boid>& boids) // Rule 2
    {
    glm::vec2 sum;
    float count = 0;

    for (auto boid : boids)
    {
    if (ID != boid.GetID())
    {
    float distance = abs(glm::length(position - boid.GetPos()));

    if (distance < DesiredBoidNearby)
    {
    sum += boid.GetVelocity();
    count++;
    }
    }
    }
    if (count > 0)
    {
    sum /= count;
    sum = glm::normalize(sum);
    sum *= MaxBoidSpeed;
    glm::vec2 steer = sum - velocity;
    steer = glm::clamp(steer, glm::vec2(-MaxSteerForce, -MaxSteerForce), glm::vec2(MaxSteerForce, MaxSteerForce));
    return steer;
    }
    else
    {
    return glm::vec2();
    }
    }
    glm::vec2 CohereWithOtherBoids(std::vector<Boid>& boids) // Rule 3
    {
    glm::vec2 sum;
    float count = 0;
    for (auto boid : boids)
    {
    if (ID != boid.GetID())
    {
    float distance = abs(glm::length(position - boid.GetPos()));
    if (distance < DesiredBoidNearby)
    {
    DrawLine(position.x, position.y, boid.GetPos().x, boid.GetPos().y, RED);
    sum += boid.GetPos();
    count++;
    }
    }
    }
    if (count > 0)
    {
    sum /= count;
    DrawCircle(sum.x, sum.y, 2.0f, BLUE);
    return seek_to(sum);
    }
    else
    {
    return glm::vec2(0, 0);
    }
    }
    private: // helpers
    glm::vec2 seek_to(glm::vec2 target)
    {
    glm::vec2 desired = target - position;
    desired = glm::normalize(desired);
    desired *= MaxBoidSpeed;
    glm::vec2 steer = desired - velocity;
    steer = glm::clamp(steer, glm::vec2(-MaxSteerForce, -MaxSteerForce), glm::vec2(MaxSteerForce, MaxSteerForce));

    return steer;
    }
    private: // fields
    glm::vec2 acceleration;
    glm::vec2 velocity;
    glm::vec2 position;
    float angle = 0.0f;
    private: // ID stuff
    unsigned int ID;
    inline static int boid_count = 0;
    };
    class BoidFlock
    {
    public:
    BoidFlock(unsigned int count)
    {
    boids.push_back(Boid(100, 249, 23));
    boids.push_back(Boid(245, 100, 45));
    boids.push_back(Boid(100, 34, 2));
    boids.push_back(Boid(243, 100, 230));
    boids.push_back(Boid(100, 34, 5));
    boids.push_back(Boid(34, 100, 88));
    printf("created %i boids.\n", boids.size());
    }
    void Update()
    {
    // boids[0].SetPos(glm::vec2(GetMouseX(), GetMouseY()));
    for (auto boid : boids)
    {
    boid.Update(boids);
    }
    }
    void Draw()
    {
    for (auto boid : boids)
    {
    boid.Draw();
    }
    }
    private: // fields
    std::vector<Boid> boids;
    };
    int main(int argc, char* argv[])
    {
    InitWindow(640, 480, "broids");
    SetTargetFPS(60);
    BoidFlock* flock = new BoidFlock(16);
    while (!WindowShouldClose())
    {
    BeginDrawing();
    ClearBackground(WHITE);
    flock->Update();
    flock->Draw();
    DrawFPS(0, 0);
    EndDrawing();
    }
    delete(flock);
    CloseWindow();
    }

    I've been having problems with this code because somewhere in the flock->Update() function the vector for the position is being reset, or something is keeping it from changes its value. I need help finding where it is.

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

    Scheme question

    Posted: 26 Mar 2021 09:22 AM PDT

    Hi Could someone please explain how ( lambda x y) ( append y ( list x ) ) work to reverse a list in scheme? I had to do this using fold right function Thank you

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

    Library using STL unique_lock crashes in Android not iOS

    Posted: 26 Mar 2021 09:22 AM PDT

    https://i.imgur.com/DDJX7kC.png Screenshot is my code (snippets of the ones in question)

    I have a library that is shared between an Android app and an iOS app. So the function is called and the unique_lock is created. When it tries to call the lock function on it, I get a null pointer dereference error. This works just fine when using the library in my iOS app, but not on the Android app. I solated it to the usage of unique_lock. Any idea why? Tried multiple devices and Android versions.

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

    suggest good resource about understanding garbage collector. i want to do in depth

    Posted: 26 Mar 2021 03:48 AM PDT

    JavaScript: Assigning anonymous functions to variables

    Posted: 26 Mar 2021 07:02 AM PDT

    I am having trouble understanding the concept of assigning a value to a variable using anonymous functions in JS.

    Given the following code:

    function getDate() { let date = new Date() return date } const date = getDate() console.log(date) // => outputs current date 

    This can be "assigned" to a variable using an anonymous function like so:

    const date = () => { let date = new Date() return date } console.log(date) // What I would think should work console.log(date()) // What actually works 

    The issue I'm having is that the use of an anonymous function to declare a variable seems to just create another function in a different way. The date variable can only be accessed by calling date() and not simply date . Is there something I'm missing or am I looking at it wrong?

    submitted by /u/2138970231hc
    [link] [comments]

    Ignoring folders zipping up a project in Windows... can it be done?

    Posted: 26 Mar 2021 06:06 AM PDT

    So the way this web project gets deployed is pretty ghetto, but it's a straight file copy onto the server.

    My problem is the node_modules folder is pointless to deploy, and windows zip crashes trying to zip it (empty file\folder error). If it was on the ROOT I could just not zip that folder, but it's nested a few levels down in a folder I DO need.

    Is there any way or utility I can just zip up specific folders and\or ignore specific folders on a zip command?

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

    Good Resources on Compilation in Different Programming Languages (and/or in General)

    Posted: 26 Mar 2021 02:20 AM PDT

    Hey,

    I'm a "self" taught programmer.

    I'm looking to learn more about how programming languages interact with operating systems.

    And the phases of individual program/application lifecycles like interpretation, compilation, and execution.

    Can anyone recommend good resources for these subjects?

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

    Which automation platform do you use and why?

    Posted: 26 Mar 2021 02:01 AM PDT

    My friends and I are trying to assess the need for an all-in-one automation platform to cover various DevOps needs such as CI/CD, automated workflows, data pipelines, etc.

    For instance, running integration tests, dataflow pipelines, or creating a backup of your database like so:
    1. Download the backup from the server.
    2. Upload it to a cloud service.
    3. Send a Slack message to the team that a backup was executed.

    If you, or your company, are using an automation platform such as Step Functions, Airflow, Tray.IO, or any other product in that area, we'd love to hear your experiences with them, their pros & cons, what use-cases do they serve in your work, have you considered other alternatives before committing to your current platform, and basically anything else you'd have to say that would shed light on the subject.

    We'd also appreciate a rough estimation of how dissatisfied are you with your current solution and how likely you are you to embrace a new one that would fit your needs?

    Thank you very much.

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

    How does spotify clients know where the music is playing?

    Posted: 26 Mar 2021 05:41 AM PDT

    When I connect to my nest audio speakers on the phone the desktop client also updates and tells me that the music is playing on nest audio. It is also able to show/update progress and I can control volume etc. How does Spotify do this?

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

    How do i insert JS variable in sql query ??

    Posted: 26 Mar 2021 04:44 AM PDT

    I am getting the following error message

    sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'where oemail = '[test3@gmail.com](mailto:test3@gmail.com)'' at line 1",

    my sql query is as following :

    var sql = "insert into venue_info(cover_pic_url,images_url) values(?,?) where oemail = ?"

    tried everything from string interpolation to escaping , nothing worked . Any suggestions . I am using mysql server and mysql package from npm .

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

    No comments:

    Post a Comment