• Breaking News

    Sunday, September 27, 2020

    My mind keeps drifting when I'm programming Ask Programming

    My mind keeps drifting when I'm programming Ask Programming


    My mind keeps drifting when I'm programming

    Posted: 27 Sep 2020 05:17 PM PDT

    I have been web programming for about 3 years now.

    Recently I started having some issues focusing when programming. Maybe I have always had this problem and only recently began to notice it.

    Whenever I try to code, my subconscious would start drifting. It typically drifts to some negative thoughts like an embarrassing moment in my life. The thought is very uncomfortable and distracting. I find myself having to, for a lack of a better word, tense up my body, to stop the uncomfortable thoughts.

    As a result I just can't focus on programming, especially when there is an obstacle in the project I'm working on. Whenever there's even a small obstacle that I have to stop and think about, my mind starts drifting to those thoughts and I feel like I have to distract myself or else it gets too uncomfortable.

    I can't seem to focus for more than a few minutes at all. I really have to force myself to have any chance. Getting into the flow just feels too hard.

    I remember in the past, I would typically go to a public place to code, like my local library or coffee shop. Being in a public place helped me focus. But since COVID that hasn't been possible, so I've been programming from home. I think being in a comfortable environment like my home where my thoughts wander freely, is partially the reason behind this issue.

    Does anyone else experience something similar? It is really bothering me.

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

    I’m a web developer thinking about moving into data analysis. What’s the market like?

    Posted: 27 Sep 2020 07:48 AM PDT

    I'm a web dev but I really enjoy working with data. Lately I've had to do a lot of data transformations, data analysis for compliance purposes, dashboards for business management, etc, and its rewarding and enjoyable work to me. With companies like Palantir about to IPO, I feel like the market must be pretty strong, but I've never made the effort to jump into a pure data analysis role. I think I'd like to start by freelancing. Would love to hear some input on this from the community!

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

    Why are programming concepts explained with such difficult language?

    Posted: 27 Sep 2020 10:13 PM PDT

    I just read a page explaining concurrency programming because it seems to be a hot topic in west coast tech area interviews this month.

    I did not understand half of the concepts it was trying to convey because the language was to foreign and generic. I finally understood that I already used concurrency in a script that leverages threads for api calls because the network communication was the bottleneck. (Processing won't haul just because one thread is waiting for a reply).

    I had to reread the article after I understood that I already did this once to even get near to fully grasping what the author was trying to convey.

    Is this intentional? MSDN docs are the fucking worst as well. I can't help but feel like these authors are trying to jack themselves off or gate their knowledge by forcing readers to speak their weird language.

    What am I missing here?

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

    How does print to PDF work (esp in web browsers)

    Posted: 27 Sep 2020 06:00 PM PDT

    This might sounds silly or trivial but I'm not even sure where to start searching. A search for "how does print to PDF work" supplies a lot of results regarding how to print to PDF, but not HOW PRINT TO PDF WORKS.

    I've been an amateur programmer since the 90's and know a little about things like system calls. However, I never thought about this until I submitted a change of address to the USPS and when I tried to print to PDF and it simply supplies a blank page, something which frustrates me to no end.

     

    My question: How does print to PDF work, especially in browsers?

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

    I want to create a sort button in mern

    Posted: 27 Sep 2020 08:24 PM PDT

    I want to create a sort button in mern using query string. I don't know how to add query string in react except using route.

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

    Benefits of VM / Interpreted Languages

    Posted: 27 Sep 2020 11:19 AM PDT

    I'm trying to understand what the benefits of interpreted languages are, compared to languages that compile to executables, or to an intermediate like C/CPP. (Nim,Haxe,Vala)

    I've generally got 2 platforms I want to compile for, x64 Linux and x64 Windows, yet apparently I want users of my software to install and maintain a memory intensive framework to save me a compile? Am I really egotistical enough that I think my 5 seconds to compile for another platform is worth more than every single one of my users having to install and maintain an interpreter, or there must be something else I'm missing?

    It also seems like I'm intentionally locking my code into a proprietary framework, everybody who wants to run it has to go through Microsoft, or Oracle, or whoever else. My code becomes unwittingly easier to decompile whether I want that or not, and anything built off it now has an added dependency of several hundred megabytes.

    Can someone explain the fact interpreted languages are the most widely used, and are still growing in popularity? I can understand why companies want people to use it, it makes them gatekeepers, but are programmers getting anything out of it?

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

    How can I create a command line for every file in a directory?

    Posted: 27 Sep 2020 04:14 AM PDT

    I need to run a command line for every file in a directory (more than 100 files.)

    The command is:

    ffmpeg -i D:\FILENAME.avi -itsoffset -0.25 -i D:\FILENAME.avi -map 0:v -map 1:a -c copy -aspect 4:3 D:\FILENAME.mov 

    How can i replace FILENAME with every file in the directory individually? They are not numbered or uniform file names, they are all unique (house.avi, water.avi, grass.avi etc.)

    Please don't critique the command itself, it works fine. I just need to create this line for each file in the directory. Thank you

    Example of what I am trying to achieve:

    ffmpeg -i D:\house.avi -itsoffset -0.25 -i D:\house.avi -map 0:v -map 1:a -c copy -aspect 4:3 F:\house.mov && ffmpeg -i D:\water.avi -itsoffset -0.25 -i D:\water.avi -map 0:v -map 1:a -c copy -aspect 4:3 F:\water.mov && ffmpeg -i D:\grass.avi -itsoffset -0.25 -i D:\grass.avi -map 0:v -map 1:a -c copy -aspect 4:3 D:\grass.mov 
    submitted by /u/ProfessionalLocal8
    [link] [comments]

    What would be your choices to build a single page application to an Oracle backend if you could not use a framework?

    Posted: 27 Sep 2020 08:45 AM PDT

    Let me clarify the difference between a framework and library by example. Angular is a framework. jQuery is a library. Spring is a framework. Servlet is a library. Hibernate is riding the fence.

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

    Codeforces problem that I really struggled with

    Posted: 27 Sep 2020 12:23 PM PDT

    Here's the basis of the problem: given an n x m grid, can you fill it with "L-shaped" tiles made out of 3x1 tiles connected to 1x2 tiles. My initial thought was that this would have something to do with the taking the width and height modulo 3 or 1 and finding out some information from there, but none of my attempted solutions along this line work. Here's the problem statement:

    https://codeforces.com/gym/102740/problem/C

    Most of my approaches would solve like 6 test cases, but got stuck on the seventh.

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

    How can I put the follower count of each person following someone into an array in python?

    Posted: 27 Sep 2020 03:36 PM PDT

    Keep getting negative numbers in C++

    Posted: 27 Sep 2020 03:32 PM PDT

    I've been working on this for the past couple hours and keep getting either negative numbers or +/- inf for my code (see below) They need to be positive numbers. Any help will be greatly appreciated and I'm just learning so any tips would be helpful too

    # include <iostream>

    # include <cmath>

    # include <iomanip>

    using namespace std;

    int main ()

    {

    int temp, w; //temp= temperature in degrees C; w= weight percent of beryllium (%) double lambda; // conductivity cout << "Material Conductivity Calculator" << endl; cout << "Enter the temperature (Degrees C) of the material" << endl; cin >> temp; if (temp < -273) 

    {

    cout << "Temperature cannot be below -273 degrees C!"

    << endl << "Enter the temperature (deg. C) of the material" << endl;

    cin >> temp;

    }

    else if (temp > 1210)

    {

    cout << "Temperature cannot be above 1210 degrees C!"

    << endl << "Enter the temperature (deg. C) of the material" << endl;

    cin >> temp;

    }

    cout << "Enter the weight percent of Beryllium (%)" << endl; cin >> w; if (w < 0.5) 

    {

    cout << "Weight percent of Beryllium cannot be below 0.5 weight percent!"

    << endl << "Enter the weight percent of Beryllium (%)" << endl;

    cin >> w;

    }

    else if (w > 20)

    {

    cout << "Weight percent of Beryllium cannot be below 20 weight percent!"

    << endl << "Enter the weight percent of Beryllium (%)" << endl;

    cin >> w;

    }

    if (temp < 200) { lambda = 0; } else if (200 < temp < 325) { lambda = (75\*sin(4.5\*w))/(350-temp); } else if (325 < temp < 400) { lambda = (95\*sin(4.8\*w))/(415-temp)+3.1; } else if (400 < temp < 510) { lambda = (105\*sin(4.2\*w))/(520-temp)+9.05; } 

    else if (510 < temp < 700)

    {

    lambda = (125*sin(4.1*w))/(705-temp)+19.12;

    } else if (700 < temp < 950) { lambda = (80\*sin(4.4\*w))/(960-temp)+32; } else if (950 < temp < 1210) { lambda = (18\*sin(4.45\*w))/(1211-temp)+44.5; } else if (temp > 1210) { cout << "Material decomposes into two phases" << endl; } 

    cout << "At " << temp << " degrees C and a material with " << w << " weight percent beryllium would have an approximate conductivity of " << setprecision(4) << lambda << " seimens/meter." << endl;

    return 0;

    }

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

    Is there a program that can simulate house design features?

    Posted: 27 Sep 2020 03:10 PM PDT

    For example, I am working on a patio. The patio has stone slated with different size variations, covering about 50 square feet of area. I am looking for a program that can similar all the different shape variations that can be made using let's say 60 slates of various sizes to cover an area of 50 square feet.

    Anyone have any ideas on what I can use?

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

    .NET Core SignalR saving to database in hubs

    Posted: 27 Sep 2020 03:00 PM PDT

    So I'm using SignalR and EF Core in my .NET Core project.
    I have 2 hubs created. One called "main" and users get connected to it on whatever page they are at.
    Second is called "room" and users get connected to it only when they are on a page called room.

    Now, both of these hubs have OnDisconnectAsync method which uses injected service which uses EFCore's dbcontext to update record in database (different columns are updated in both hubs but on same record).

    Problem is when user is on room page and refreshes page or switches to different page (triggering OnDisconnectAsync method on both hubs) it doesn't update one of the columns and gets concurrency failure error.

    Is there a way to fix this so it updates from both hubs? Can I run methods on different threads and would that even work with dbcontext? Does scope of injected service or dbcontext (which is scoped by default) matter?

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

    Developing a Chrome Extension

    Posted: 27 Sep 2020 08:48 AM PDT

    Hi, I am new to Chrome extensions and am trying to build one myself. I want to develop a feature that is similar to Grammarly's popup (shown in the link below) but couldn't find a term or resources for it. Any kind souls out there that could help a brother out?

    Image: https://imgur.com/h6TR8bI

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

    What would be a good reason to return a localStorage item setting (like Spectrum does)?

    Posted: 27 Sep 2020 02:02 PM PDT

    I'm reading Spectrum's source code and found that in their helpers, they created a function that sets/removes an item from localStorage while returning it. I'm fairly new to programming and had never seen that pattern. Anyone could explain why is that? Also, I noticed it's in a try/catch statement and I also don't know why? can't think of it failing?

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

    How do I automate transferring attendance data from one spreadsheet to another?

    Posted: 27 Sep 2020 07:47 AM PDT

    I teach classes online, and when I start live sessions, I give my students a Google Doc digital sign-in sheet. Since they can only sign in using their school GSuite account, and their GSuite account is built around their first and last names, I have a strong record of who attended my class and a way to correlate the two sheets with each other. Now, how do I tie them to each other?

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

    search for multiple values in a vector c++

    Posted: 27 Sep 2020 09:48 AM PDT

    I have a vector<int> that contains a lot of values and I need to see if contains the numbers 1-99. Is there an easy way of solving this

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

    Minimizing number of API calls with unknown time interval in real world

    Posted: 27 Sep 2020 07:20 AM PDT

    Hi all,

    My problem is the following. I am trying to pull data from an API for all sports outcomes in most major sports in the world. When a game is played I would like to automatically create a forum post and state the main statistics. I don't know the schedule ahead of time.

    I was thinking of pinging the API every couple of minutes to see if there is a change in standings and then individually requesting data on teams where there are changes. The problem with this is that I will hit pricing limits very quickly. I can increase the time between pings but that I would like to minimize time between outcome and publication. Is there any other solution?

    submitted by /u/Mba-advice-ask-guy
    [link] [comments]

    Help with a basic question (research for fiction)

    Posted: 27 Sep 2020 09:05 AM PDT

    I am writing a graphic novel based in 2018 (October specifically if that helps) in which, in a minor scene, a character who is supposed to be superior at programming has a job interview with a social media startup company.

    I know nothing about programming, but I just need to know what words to use in order to briefly imply that this character is great at it.

    How would I convey that they are talented in a variety of ways through brief, jargony dialogue?

    Proficiency in what type(s) of languages would imply a high level of skill/proficiency in 2018? Which be desirable to a social media company?

    Thank you!

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

    AMD or Intel?

    Posted: 27 Sep 2020 08:51 AM PDT

    I'm a project manager at my company however 95% of my day to day work is either programming or design, which means I need quite a powerful PC to do my work efficiently. For the last year an a half, I've been using my four year old desktop with an i7 4790k @ 4.4GHz boost clock. While still a decent pc for gaming or other relatively easy tasks, my compile times can take up to one or two hours.

    This brings me to my question: I'm looking to build a new pc in the coming couple of months and I'm really undecided between AMD and Intel CPUs. I chose a Ryzen 3700x, however, I heard that Intel owns the compilers we use and have quite significant optimisations for their CPUs in this area, that AMD's are lacking.

    Also worth noting that I often work with lower level C++, sometimes also delving into C++ Intel intrinsics, I assume getting an AMD CPU wouldn't allow me to do that anymore(?).

    TL;DR: is there a significant enough difference between Intel and AMD CPUs (when it comes to compile times and low level programming) for me to pick one over the other?

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

    Can someone explain to me why my while loop and my for loop are not producing the same outcome?

    Posted: 27 Sep 2020 08:39 AM PDT

    Hello, this simple console app program was written in C++. I am trying to write a single function program that uses a while loop to produce 10 random numbers, each equal to or between 1 and 100. I can get it to work using a for loop, but I cannot get it to work using a while loop. Essentially what is happening is the 10 numbers that are generated by the while loop are all the same number. However, the 10 numbers generated by the for loop are all different. Can someone explain to me why this is? Also, is there a way to write the while loop such that it will produce 10 unique random numbers?

    I will copy and paste the contents of the program below.

    #include <iostream>

    #include <cmath>

    #include <cstdlib>

    #include <time.h>

    #include <iomanip>

    using namespace std;

    int main()

    {

    srand(time(NULL)); 

    int num = 1; 

    while (num <= 10) { srand(time(NULL)); 

     int ran = rand() % 100 + 1; 

     cout << setw(2)<< num << ": " << ran << endl; 

     num++; } 

    cout << endl; cout << endl; 

    for (int num = 1; num <= 10;) { int ran = rand() % 100 + 1; 

     cout << setw(2) << num << ": " << ran << endl; 

     num++; } 

    }

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

    Visualization of dataframe for 3 variables in Rstudio

    Posted: 27 Sep 2020 12:17 PM PDT

    First of all, English is not my first language. I'll try explaining our problem so that everyone can understand.

    For school we have a dataset about movies. It's about 10000 lines and contains movies from 1960 till 2015. The dataset also contains information like genres, user-review score, release date and profit etc.

    Our assignment is to make a good visualization(or multiple) of the amount of movies of every genre that came out every year. There's 20 genres in total, and data from 60 years for about 10000 movies.

    Movies also have multiple genres, we already split those in up and have also made a table with the amount of each genre in 1 year.

    The thing is, if we want to visualize it this way we need 50 bar charts. Also, if we want to find out the amount of movies with a certain genre for all the years we have to make a for loop which would be very inefficient.

    We want to try making a stacked circular bar-chart but are still looking for other options.

    Does anyone know a good way to show information in a form like this?

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

    Should I get a new computer only for programming?

    Posted: 27 Sep 2020 07:56 AM PDT

    The computer I use is old and cannot install Visual Studio and other IDEs. Also, what is the best OS for programming a game engine in? Should I use the programming languages C#/C++?

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

    Trying to get <aside> to float right of <main>, but it only goes above or below

    Posted: 27 Sep 2020 11:22 AM PDT

    I have a <header> and <footer> already made. And I have <main> to the left like normal with some paragraf and headers in it. I also have an <aside> that I set as "float: right;" in my css, but it goes below <main> where the <footer> should be and just acts like another element. The only way I found that help was setting width to 40% on <aside>. Then it would be in the right spot horizontally, but still below <main> Here's a link to the css since my explanation was probably a bit confusing. https://imgur.com/a/o9OwvhB

    Update: I got it working, setting float left on <main> and float right on <aside>, but now the footer is inside both of them.

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

    No comments:

    Post a Comment