• Breaking News

    Wednesday, September 23, 2020

    A question for 8+ years programmers in the sub. What are some regrets you have in regards to your health and lifestyle throughout your years of programming? Ask Programming

    A question for 8+ years programmers in the sub. What are some regrets you have in regards to your health and lifestyle throughout your years of programming? Ask Programming


    A question for 8+ years programmers in the sub. What are some regrets you have in regards to your health and lifestyle throughout your years of programming?

    Posted: 23 Sep 2020 06:13 AM PDT

    If you could go back in time to give advice to your younger self what would you say?

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

    A simple explanation of Object Oriented Programming (OOP)

    Posted: 23 Sep 2020 10:02 PM PDT

    Id like someone anyone a god send if you may to explain to me as easy as possible what the hell object oriented programming is. Im having a hard time truly understanding this language type! Thank you in advance and please be nice!

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

    Hi, I would like to recompile gcc for windows but replace the keywords for C and C++ for a joke, how would I go about that?

    Posted: 23 Sep 2020 10:00 PM PDT

    My goal is to replace keywords like "if", "for", "while", etc with their translated versions to have a "localized" C/C++ version :D I have never done anything like that, any hint where to start would be welcome, thanks for your time

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

    Python While statement hw

    Posted: 23 Sep 2020 03:16 PM PDT

    What would be the best way to go about this I understand how to pick between the 4 coins but when it comes to writing the while loop I'm confused. I know you want to check and see if the coin can be subtracted and if so subtract it and if not choose again.

    There is another way to make change, chaotically! Import Random and using the random.randint function, write a function guesscoin() which returns one of 25, 10, 5, or 1 with uniform random distribution (in other words 25% of the time for each coin). You can do this with randint(1,4) and four if statements (e.g. if x=1 return 25)…

    Then define chaos(total), while the total isn't 0, pick a coin randomly using guesscoin and test to see if can be subtracted from total, and if so, increment the right variable (q,d,n, or p) and subtract the coin value from total. This requires a while loop (which you can read ahead to chapter 5) and an if/elif sequence. Finally, when all the coins have been selected, call printcoins3. If you accidentally get an infinite loop, you will have to interrupt the python process, modify the code, and try again.

    Printcoins3(q,d,n,p) checks for whether only 1 of a coin is to be given, and changes the output text to singular accordingly:

    For 32 cents change, I give
    1 quarter
    1 nickel
    2 pennies

    Extra credit: Printcoins4 adds the word "And" if there are at least 2 species of coins in the change. It is added before the lowest coin:

    For 35 cents change, I give
    3 dimes
    and 1 nickel

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

    .net Standard Library References

    Posted: 23 Sep 2020 07:50 PM PDT

    I was working on migrating some 4.5.1 libraries today for future proofing.

    I decided to try .NET Standard 2.0 because some of our work is in .net core and some is still in Framework, so in order to try and find a balance I chose this route.

    I didn't get very far in before I ran into a problem in my second library.

    The general gist is, I can't reference one finished library inside of another one when both are .net Standard 2.0. It keeps giving me an error that it's unable to install the first in the second because the first is for .net core 2.1, which I don't believe it is. I've detailed the problem in a StackOverflow question, but in order to signal boost I am cross-posting here.

    Has anyone ever seen something like this?

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

    MVC vs REST API

    Posted: 23 Sep 2020 01:41 PM PDT

    I am working at a company of 400 for 10 years by now. Our team consists of 5 developers.

    Around 4 years ago I made the company change from an old proprietary system to C# MVC, since many of our engineers knew C# already. We were 2 devs at the time and my boss was just my colleague. He is older and has a non OOP and no HTML /JS background.

    Recently our newest colleague, who just finished college mentioned REST API. He helped someone in his spare time with a project. Our boss, who learned about JSON less then 2 years ago and loves it was hooked. He now wants to replace our MVC Models in all views with JSON and call it REST.

    Our current model is basically a tree with 4 levels, which contains 'HTML elements' in its leaves, that are rendered using a class creating the desired HTML outputs depending on the object's properties. The knots are just elements with a Informationen about the knot and b a list of children.

    Is it bias due to the current model being my brainchild, or is my boss removing the M in mvc by using JSON and just crazy?

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

    What do big companies get from distributing public packages?

    Posted: 23 Sep 2020 04:31 AM PDT

    Angular, React, Typescript, and many others. Is it just for the goodwill in the tech community they do this? Or is it some kind of corporate charity? The realist in me feels it can't be too soft a reason as those projects consume company resources that shareholders would rather cash in on rather than spend on some unprofitable but well known side venture.

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

    What's a better way to program these if statement scenarios

    Posted: 23 Sep 2020 08:09 AM PDT

    When you see situations like

    If x >= 90 then Foo()

    Else if x >= 80 then Foo2()

    Else if x >= 70 then Foo3()

    Else if x >= 60 then Foo4()

    Else Foo5()

    End

    Is there a better way? If you have 100+ checks to do how do you achieve all the checks without writing this 100 times

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

    Working with a tons of large CSV files

    Posted: 23 Sep 2020 09:06 AM PDT

    So I was asked a question in a recent Job Interview, and I wondered if I could get your guy's opinion on it.
    They wanted to know what the best way to standardize hundreds of CSV files using pandas would be. I do have a pretty good grasp of pandas and how to manipulate Dataframes and the such, but the problem is that the CSV files may or may not have the same column names, so I couldn't mess around with it too much without setting all of the headers to something general. They did say that the header names were similar enough, just that whoever created them wasn't thinking about the need to standardize them in the future.
    Honestly, I'm not sure how to handle that kind of data programmatically without having to go through tons of files. I haven't seen any of the actual data, though, so that's all the info that I know, but I'm wondering if there is a technique or some different way I should try looking at it in order to get a better feel of how to solve this problem?

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

    Android Studio 4.0.1, Gradle, and React Native: AndroidManifest.XML not found when it exists

    Posted: 23 Sep 2020 04:41 PM PDT

    INTRO
    Greetings, all!

    My Android Studio 4.0.1 project refused to build due to not being able to find an AndroidManifest.xml file that's in /main/ where it should be, according to the documentation. Mass replacing the occurrences of "api" with "implementation" or vice versa hasn't helped.

    Thus, what other information do you want for clarification, and what should change to ensure this works?

    Thankee!

    MANIFEST FILE
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="com.hornet">

    <uses-permission android:name="android.permission.INTERNET" />

    <application

    android:name=".MainApplication"

    android:label="@string/app_name"

    android:icon="@mipmap/ic_launcher"

    android:roundIcon="@mipmap/ic_launcher_round"

    android:allowBackup="false"

    android:theme="@style/AppTheme">

    <activity

    android:name=".MainActivity"

    android:label="@string/app_name"

    android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"

    android:launchMode="singleTask"

    android:windowSoftInputMode="adjustResize">

    <intent-filter>

    <action android:name="android.intent.action.MAIN" />

    <category android:name="android.intent.category.LAUNCHER" />

    </intent-filter>

    </activity>

    <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />

    </application>

    </manifest>

    RUN ERRORS WITH DEBUG MODE ACTIVE
    Moved to this Google Doc for being too long for this post!

    https://docs.google.com/document/d/19OO-OIzFy6IXPEOAdvGZLgXNsW_1sfiZsLDs6H0Jjzs/edit?usp=sharing

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

    Can you create a virus that infects devices, using the outwards signal to find new devices, send over a copy of the virus, and keep repeating the process over and over again until all the computers in the world are infected?

    Posted: 23 Sep 2020 04:19 PM PDT

    Sorry, I know this is probably a very stupid question. I know nothing about any of this. Just wondering. Most people who get viruses are goofing around online and accidentally download one, I was wondering if you could create one that spreads by itself, and has the potential to spread to every computer, not just ones using a certain WiFi signal or something.

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

    Need to Transform a System of Google Sheets into a Database in 7 Days :/

    Posted: 23 Sep 2020 03:53 PM PDT

    Hey all!

    So, long story short - the company I work for relied heavily on Google Sheets from the beginning due to obvious reasons. When I started working on "systems", it was mostly doing some bit more advanced formulas as I have absolutely no educational background in development (aside from Unity hobby project of two years so a bit of C#). Over time, the sheets became larger, there was more of them and they were interconnected using AppsScript scripts. Last update was replacing AppsScript with Python for most of the heavy lifting (just raw Python tho, have yet to pick up pandas).

    Anyways, with the business growing and needing to do more with systems, I am out of options for sheets - they are too slow, archives are too large and it's breaking on the edges.

    I'll have 7 days vacation with plenty of time to learn new stuff and I need to come up with any solution for this that will make life easier for me and the whole company.

    System has to do this:

    • Be web-based
    • Have a UI in the form of editable table matching Google Sheets in look and feel as end users don't like idea of change
    • Handle usual e-commerce stuff, but that is not my main problem

    There's plenty of more stuff, but I mean, by the look of it and requirements, it's kinda obvious that I need a database. Pretty much migrating the logic of the sheets to database and that's it, right? As I have it working within sheets, I only have the problem with the sheer volume of data, and the fact that I cannot rely on calculated values because I came to like "third generation" of calculated values which I cannot convert to values because of the dynamics and possibility of change and I cannot tie to the script because the users want to see a billion of unnecessary things happening in real time. So, I need a database, right?

    Here's the issue with that:

    • I know C# and raw Python (only module I used is gspread to fetch data from Sheets)
    • I have played with MySQL a bit, I know how to query data or join tables, so could probably get the hang of it if I combine with something more in the style of C#/Python/Java
    • I have absolutely no idea about hosting or security issues or even making a web interface of any kind, let alone an editable table

    However, I have 7 days to get some kind of a working proof of concept to show, so that I can get the green light from upper management to make this a priority project.

    I can imagine it sounds very bad by this point :/ But I'm good with any improvement that can make my database a database and not a collection of huge Google Sheets, even if it means having to compromise with a lousy interface.

    And yes, proprietary software has been considered by upper management, but at this point seems like they feel there is too many business specific things and quirks that we need an in-house solution.

    I would greatly appreciate any input to push me in the right direction. I have until 5th of October to prepare and start learning and from 5th to 12th to get a proof of concept going. Thanks in advance!

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

    Programming Prospects

    Posted: 23 Sep 2020 03:46 PM PDT

    I've run into a lot of free time recently and want to learn a form of programming. I'm looking for something to learn in my spare time that will ultimately lead me to something profitable in the future. I like the idea of working from home freelance, but would also work for a larger company.

    I've got basic understanding of html and css, as well as some Javascript that my dad taught me. I've also got contacts in some larger firms (my fatherworks for oracle, brother works for IBM).

    What would be the best investment for my time? I've got a good 4 hours to dedicate every day after I finish University work, and no other commitments for the next 8ish months. I live in London. My ideal job would be something that I could travel with via remote working, or would allow me to move countries. I know I may be limited as I did not study this as a degree. But I'm also interested in something that could potentially earn me money in my free time.

    I guess my main question would be, how feasible is it to self teach yourself programming and make money from it? And if it is, what should I go into given my circumstances?

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

    Is it possible to work in a US company while living in Europe?

    Posted: 23 Sep 2020 07:56 AM PDT

    So I'm learning web-development and I'm from Portugal but I'm currently based in Switzerland, I don't rly know how the job demand is here in Switzerland or Portugal but is it possible for me to live here and work for a company in the US or even other country here in Europe? Moving there is an option but is it possible to get a job on other country before moving there?

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

    Which little things have made your workflow faster?

    Posted: 23 Sep 2020 06:30 AM PDT

    The more I program, the more i find little things that make workflow faster and my entire day more productive. Some have taken me a year to find out, others came to me in my first month. I'll share my list and hopefully you can contribute.

    • aliases for most common run terminal commands (git add, commit and push in a single word, starting a server...)
    • shortcuts to move between Vscode panes, down to the terminal and back...
    • although controversial, Vim. It saves me the (literal) pain of moving my hand to the mouse (I do have a medical condition)
    • using curl in the terminal as opposed to opening Postman to test APIs.
    • Shift + Super + arrow to move screen a different monitor
    • snippets for React, Python and Django
    submitted by /u/dirtyring
    [link] [comments]

    Codeforce 4A - Watermelon.

    Posted: 23 Sep 2020 01:39 PM PDT

    why is the 2nd solution not working?

    One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showed w kilos. They rushed home, dying of thirst, and decided to divide the berry, however they faced a hard problem.

    Pete and Billy are great fans of even numbers, that's why they want to divide the watermelon in such a way that each of the two parts weighs even number of kilos, at the same time it is not obligatory that the parts are equal. The boys are extremely tired and want to start their meal as soon as possible, that's why you should help them and find out, if they can divide the watermelon in the way they want. For sure, each of them should get a part of positive weight.

    Input

    The first (and the only) input line contains integer number w (1 ≤ w ≤ 100) — the weight of the watermelon bought by the boys.

    Output

    Print YES, if the boys can divide the watermelon into two parts, each of them weighing even number of kilos; and NO in the opposite case.

    I wanted to know which would work:-

    1)

    if(a<=2||a%2!=0)

    cout<<"NO"<<endl;

    else

    cout<<"Yess"<<endl;

    2)

    if(a>2&&a%2==0)

    cout<<"yes"<<endl;

    else

    cout<<"NO"<<endl;

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

    What is something recent grads don't generally know about working as a programmer?

    Posted: 23 Sep 2020 07:36 AM PDT

    Which CDN (filename->byte[]) can take rest commands to allocate bandwidth to a session id or password, in 0.1 second and the anonymous user who just tried to use it gets their bandwidth allocated and uses it within 0.2 seconds?

    Posted: 23 Sep 2020 09:14 AM PDT

    I have a bunch of byte arrays I want to make available to only those who go through a certain server by anonymously loading a webpage, and for that server to limit the total bandwidth given out per time or based on patterns of user behavior in realtime. I dont want to risk them sharing the urls to the byte arrays with thousands or millions of computers to DoSAttack and run up a large CDN cost. The byte arrays themselves are ok to share publicly but I dont want to pay for the bandwidth of a DoSAttack or infinite loop in someone elses webcrawl experiments etc.

    Also, in case of security failure, I want the CDN to be prepaid instead of unlimited risk of however much bandwidth it appears they are authorized to use before I have time to notice and turn it off.

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

    Work From Home break suggestions? Bonus points for productivity

    Posted: 23 Sep 2020 08:22 AM PDT

    Between needing a break and compile time I have occasional 5 to 10 minutes. So far my best breaks are doing dishes and gardening, but sometimes they are bad such as smoking, eating, or getting more caffeine.

    Anyway, thought someone here might have some good short break ideas.

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

    Having some trouble getting my Google API to work

    Posted: 23 Sep 2020 11:26 AM PDT

    I want to find every point of interest in the US with the keyword "marine", and it only gives me one result. I'm not really sure what I'm doing wrong here. My code looks like:

    https://maps.googleapis.com/maps/api/place/findplacefromtext/xml?input=marine%20Repair&inputtype=textquery&fields=formatted_address,name&key= ----------

    I enabled all the correct API through Google cloud, I set up the billing correctly, im just getting one search result instead of every place in the US like I want. Also, I would like to get the phone number as well in the results. How do i do that, and What am I doing wrong?

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

    Can I access an inner class from inside another inner class in Java?

    Posted: 23 Sep 2020 10:43 AM PDT

    For example:

    public class A {
    class B {
    public void doThing() {}
    }
    class C {
    //call B.doThing() from here
    }
    }

    Is this possible? Thanks!

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

    Javascript equivalent to python Geopandas?

    Posted: 23 Sep 2020 06:44 AM PDT

    Hi all-

    I have been using the Geopandas library in python. Basically, geopandas is equivalent to the pandas library but allows for a 'geometry' column which holds the spatial geometry of an object.

    I'm looking for a similar tool in javascript. Can anyone recommend one?

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

    In R, how can I combine tide data with measurements?

    Posted: 23 Sep 2020 10:27 AM PDT

    I have two dataframes, one with measurements taken in the water (a measurement was taken approximately every 10 minutes) and one with tide data over the past two years.

    df1 is the water measurements and looks like this:

    'data.frame': 74255 obs. of 22 variables:

    $ Date : Date, format: "2019-01-19" "2019-01-19" "2019-01-19" ...
    $ Time : POSIXlt, format: "2019-01-19 00:00:00" "2019-01-19 00:10:00" "2019-01-19 00:20:00" ...
    $ Humidity : num 91 91 91 91 91 91 92 91 91 91 ...
    $ Temp : num 6.15 6.07 6.15 6.2 6.16 6.2 6.22 6.21 6.22 6.03 ...

    df2 is the tide data and looks like this:

    'data.frame': 2825 obs. of 6 variables:
    $ Day : chr "tue" "tue" "tue" "wed" ...
    $ Hour : chr "05:15" "11:36" "17:44" "00:19" ...
    $ HW...LW : chr "LW" "HW" "LW" "HW" ...
    $ X....NAP: int -110 135 -142 151 -115 141 -140 155 -123 151 ...
    $ Date : POSIXlt, format: "2019-01-01" "2019-01-01" "2019-01-01" ...

    I want to add an extra column to df1, which includes in what hour after the last high tide (HW, so not LW) the measurement was taken, so it would just have a number ranging from 0-6 :)

    If anyone has a clue on how to do this I would highly appreciate the help!

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

    Passing function to CUDA kernel in Numba.

    Posted: 23 Sep 2020 10:05 AM PDT

    Hello! I am writing a CUDA kernel where I would like to have a function passed as a parameter to be used in the kernel's computation.

    here is an example of what I am trying to do

    @cuda.jit def my_kernel(out_array, func): x,y = cuda.grid(2) if x < out_array[0] and y < out_array[1]: val = func(x,y) out_array[x,y] = val 

    It is my understanding that func needs to be precompiled using @cuda.jit(device=True), but do I need to also somehow send the function to the device like I need to for the array?

    As is I get the error

     ValueError: cannot determine Numba type of <class 'numba.cuda.compiler.DeviceFunctionTemplate'> 

    The function being passed only contains computations that are supported by CUDA kernels, so I feel like this should be possible.

    Thanks in advance!

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

    No comments:

    Post a Comment