• Breaking News

    Wednesday, October 7, 2020

    Does anyone else with a programming job just feel mentally exhausted just working a few hours? Ask Programming

    Does anyone else with a programming job just feel mentally exhausted just working a few hours? Ask Programming


    Does anyone else with a programming job just feel mentally exhausted just working a few hours?

    Posted: 07 Oct 2020 12:40 PM PDT

    Especially when I'm stuck on something, I lose so much motivation and want to quit working and think I should just start delivering for Amazon or something. It's so hard to get myself to keep going... and idk how to fix this.

    I just started working about 6 months ago, and everyday I start off strong but lack so much motivation when I hit a wall. What can I do to keep me more motivated? Anyone else in the same boat as me?

    Edit: Just took a bunch of your guy's advice! Took a break, looked through the thread, went out for a run, and then changed my task. Was able to get through the newer task, felt a lot better and more motivated. Thanks for all the advice!

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

    What do you do for short breaks?

    Posted: 07 Oct 2020 01:03 AM PDT

    I'm trying to cut back on smoking. Right now I code for 2-3 hours until I need a quick mental break/cigarette, then I hop back on the computer. During COVID I pretty much code from when I wake up until bed.

    What are some things you do for short mental breaks that refresh your mind?

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

    How to use snoop wrap with javascript?

    Posted: 07 Oct 2020 09:36 PM PDT

    I have been trying to use snoowrap with javascript to be able to call the reddit api, and I continuously get an error here:

    const snoowrap = require('snoowrap'); 

    The error says:

    Uncaught ReferenceError: require is not defined 

    I have found multiple different answers where they use browserify, but I have tried that too, to no avail. Can someone please give me a straight answer about what I have to do to solve this error?

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

    I would like to build a simple software for my job

    Posted: 07 Oct 2020 09:08 PM PDT

    Hi programming,

    I am looking for a recommendation on what language to use to create the software below.

    I'll keep it short. I would like to build a simple stand alone software for my work. I would need it to be able to query a SQL database, display data, and be able to create new excels based on predefined templates with the same underlying data.

    Why in the hell do you want to build it outside of excel?

    I think it would be a fun project that would require me to learn something potentially new.

    What coding/programming experience do you have dummy?

    I utilize 9-10 self written scripts in R daily. I am not a programmer by trade, I like solving problems and once I have a solution that works I don't have the motivation to create new problems for the sake of continuing to use a tool.

    Do you have an example of what you are thinking?

    There is a program called Path of Building that was made for a video game called POE. It is stand alone, light weight, and rather robust. It was written in LUA.

    When I discovered that there was a language called LUA, I realized I don't have a whole lot of knowledge of all the unique languages out there. This realization is what lead me here to ask the experts!

    Thanks for the time!

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

    Language to automate PowerPoint

    Posted: 07 Oct 2020 08:58 PM PDT

    I am in the cell biology field, and we currently are taking microscopy images and inserting three images on a slide for every two hour time point. We want to take images from a hard drive and create powerpoints automatically that generate the three images side by side on each slide.

    I wanted to ask what language is best to use for generating these slides automatically. I have already tried python and ran into the issue of python-pptx being very finicky when it came down to inserting images. I am looking into visual basic right now, but I am not very experienced in it, nor do I know where to start.

    Are there any other languages out there that are better than VBA for this type of automation?

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

    I'm getting an unexpected ')' error on the parantheses after 'q' and behind #t and I have no idea why

    Posted: 07 Oct 2020 04:34 PM PDT

    (define (AtLeastOneQ L) (if (= first L '()) #f (cond [ (equal? (first L)'q') #t] [ (equal? (first L) '()) (AtLeastOneQ (rest L))]))) (if (AtLeastOneQ '(a q b)) "AtLeastOneQ passes first test" "AtLeastOneQ FAILED first test") (if (AtLeastOneQ '(a b c)) "AtLeastOneQ FAILED second test" "AtLeastOneQ passes second test") (if (AtLeastOneQ '(q q q)) "AtLeastOneQ passes third test" "AtLeastOneQ FAILED third test") (display "\n")s 
    submitted by /u/old_bint
    [link] [comments]

    How exactly do you go from a program that you write to an app?

    Posted: 07 Oct 2020 07:41 PM PDT

    What I mean is how exactly do you go from writing a program in something like Microsoft visual studio to an app that you can run on a computer and/or a cell phone without something like visual studio?

    Edit: basically, when someone uses a game or an app for social media on their cell phone, they typically have not gone out and put something like visual studio on their cell phone, so how do you go from having it run through something like visual studio to not needing it on the device to run?

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

    Trying to test some simple text code in the terminal in visual studio code, but it won’t update when I change anything in the code

    Posted: 07 Oct 2020 07:26 PM PDT

    I am very new to coding, just simply writing a piece of code that says

    "You have (int. value) pieces of pie"

    This code works, but when changing anything, whether it's be changing the int. value or the text, really anything, it won't update the changes in the terminal when I want it to print the code again, help?

    submitted by /u/I-already-redd-it-
    [link] [comments]

    Which statements can be considered as exit points?

    Posted: 07 Oct 2020 10:45 AM PDT

    There are many discussions related to whether it is better to have only one or multiple exit points per function, but it is not clear to me which statements can be considered as exit points: only return or some other ones as well?

    For example, should we consider throw and break as exit points?

    Are there 2 or 3 exit points?

    ``` func(x, y) { // guard if (!x) throw "You have an error here!"

    if (y) return "foo" else return "bar" } ```

    Are there 1 or zero exit points?

    ``` func() { i = 1 loop { if (i == 5) break

    show_message(i) i = i + 1 

    } } ```

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

    How choose a programming language/framework?

    Posted: 07 Oct 2020 06:15 PM PDT

    I recently paid a friend to make me a website, but me knowing nothing about coding didn't realize that he was making a single page application (which I didn't even know existed). So now I have a website not optimal for the first page load time (extremely important since I'm running search ads) and SEO, two of the most essential things for my site pretty much.

    Anyways, now I'm actually attempting to do my due diligence this time around and learned that there's a ton of different programming languages.

    I'm planning on going on fiverr or upwork to hire someone to develop and design a MULTI page application and don't want to make another dumb mistake. Is there any way for someone that doesn't know anything about programming (me) to decide the best programming language and framework for the site? A large factor I care about is page load time of course, followed by things such as security and easy debugging.

    A site that I'm sort of emulating is the following: https://bestreviews.com/best-dji-drones

    Any advice would be appreciated, thank you

    submitted by /u/New-Agent-7390
    [link] [comments]

    Clearing up confusion about C# concepts, and creating distinctions between them?

    Posted: 07 Oct 2020 12:10 PM PDT

    I feel like I need to have a clear distinction between these terms, which I don't as of now. I will begin describing what each term means to me, and I would like to know if I am correct.

    IOC (Inversion of Control)

    All I know about IOC is that its a ideology to reduce tight coupling. Dependending on abstractions (interfaces) rather than concrete types, so you can switch implementations easier. It also helps when unit testing so you can mock implementations.

    DI (Dependency Injection)

    Pretty much just passing or 'injecting' dependencies into the constructor (constructor injection) or property (property injection) as appose to newing up instances inside the class itself.

    Service locator pattern

    This just seems like an IOC container to me, how is it different?

    Dependency Inversion Principle

    A way of doing IOC. There are many forms of IOC and dependency injection is the most common.

    Many thanks.

    submitted by /u/autistic-programmer
    [link] [comments]

    I need someone to look at my code structure

    Posted: 07 Oct 2020 04:37 PM PDT

    I'm working on some c++ code and I would like to get someone's opinion on the structure I'm using. Functionality is correct, but I'm insecure about the structure and I would love to hear tips for improvement to make the code cleaner and more.

    Can someone help?

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

    where do dlls get included

    Posted: 07 Oct 2020 12:41 PM PDT

    so i used visual studio code for a while 3 weeks or so, because i wanted to get into c#

    But before i just compiled everything on my own without knowing anything about static or dynamic librarys i just typed g++ -o filename.exe filename.cpp

    and i was good but i got intersted in making something with dlls.

    and since im on windows now (ubuntu on my laptop) i use the mingw compiler and found this: http://www.mingw.org/wiki/sampledll

    to make and use dlls

    and it gave me a bit of a headache at first but it worked (i dislike copy pasting everything in a documentation or tutorial so i normally just implement my own code or experiment a bit).

    well after a couple of hours i now more or less understand everything, but now my question

    where does the dll get included or linked to my exe.

    this is what i did:

    files:

    libh.h

    libh.cpp

    then i did

    g++ -c -o libh.o lib.h

    the next command doesnt work for some reason on powershell but on cmd it does

    g++ -shared libh.dll libh.o -Wl,--out-implib,libMylib.a

    then

    i created a test.cpp file and included libh.h and used a couple of functions

    then g++ -c -o test.o test.cpp

    and at last

    g++ -o test.exe test.o -L. -lMylib

    now, i understand why most of this work but nowhere is the libh.dll included only the archive file,

    obviously if i remove the dll from the directory and run test.exe it wont work becuase the libh.dll is missing but i dont understand where it is linked

    thanks in advance

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

    Looking for Virginia Coders?

    Posted: 07 Oct 2020 11:45 AM PDT

    Hey all!

    Moved to VA right at the start of the pandemic and I've been dying of boredom from a lack of knowing anyone. I wanted to start a group to do programming events(Hackathons/Codeathons, etc.) and just meet more people in the field that are more local.

    A bit about me:

    Prior Marine(5 years), I moved here(Fredricksburg/KG area) for a role as a Software Developer. I now code basically full-time, but it's been my hobby for the past 8-9 years. Married, 2 kids, dog, the whole package. I teach coding and do commission based work in most of my free time right now, but I'd really like to be able to work with a group on something fun.

    TL;DR: Bored programmer wants more friends interested in programming to start a group.

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

    Paint Program data structures?

    Posted: 07 Oct 2020 03:17 PM PDT

    I'm a year 2 CS student at a random community college. We have to make a project using a data structure or by creating our own.

    My idea was using a set of two arrays (x and y axis) to represent pixels, and create a paint program in C++. Does this sound feasible? Would another structure work better in this case? Which data structures do paint programs usually use?

    Thanks guys!

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

    c++ error (learning classes)

    Posted: 07 Oct 2020 02:49 PM PDT

    question: https://i.imgur.com/hxvQx3e.png

    My code:

    double amount;

    double capacity;

    GasTank :: GasTank(double b){

    capacity = b; amount = 0; 

    }

    void GasTank :: addGas (double y){

    amount += y; if (amount > capacity) amount = capacity; 

    }

    void GasTank :: useGas(double h){

    amount -= h; if ( amount < 0); amount = 0; 

    }

    bool GasTank :: isEmpty(){

    return ( amount < 0.1 ); 

    }

    bool GasTank :: isFull(){

    return ( amount > (capacity - 0.1)); 

    }

    double GasTank :: getGasLevel(){

    return amount; 

    }

    double GasTank :: fillUp(){

    double temp = amount; amount = capacity; return capacity - temp; 

    }

    Error: https://i.imgur.com/xSDpV00.png

    I don't see what's wrong with my isFull function.

    I actually got this problem right before, but I am redoing a lot of these exercises for practice, and now it's giving me this error. Why?

    Any help appreciated.

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

    How would you create a single/command file that runs 2 commands in two different folder?

    Posted: 07 Oct 2020 10:21 AM PDT

    Hi!

    For my dev environment, I'm having a very small issue that is getting quite annoying. Basically, I am working on a React app with a Laravel backend. However, to work on both simultaneously, I must do an "npm start" in the React folder and a "php artisan serve" in the Laravel folder.

    I would like to have something, very, very simple that would allow me to launch both at the same time. Basically, like a bat files that makes 2 commands prompt windows open, go to two different folder and launch the command that fits the folder.

    I use Cmder if it's of any help.

    If anybody has an idea, I would love to hear it!

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

    How do I run this .c file on an image?

    Posted: 07 Oct 2020 01:31 PM PDT

    I was looking at Google's notocolor emoji source and found that it had this script that they used to turn an image into the notocolor flag emoji.

    I was wondering, how would I go about using this script on an image to turn my own flags into the emoji style? I am a novice when it comes to programming.

    Any help appreciated ^-^

    submitted by /u/20captainx12
    [link] [comments]

    What technical skills should a CS undergrad learn?

    Posted: 07 Oct 2020 01:10 PM PDT

    Simple SQL Entry question?

    Posted: 07 Oct 2020 12:32 PM PDT

    Suppose I have a SQL table.
    The columns are:

    Username, First Name, and Comments.

    I've stored the session name like so:
    $_SESSION['name'] = $_POST['username']

    When a user types a comment in a field (on a different .php file), I want to be able to store that comment in the database.

    There is a "Comments" column in my SQL table.
    How would I write that statement in php?

    I would first have to see which row the username is stored in.
    Then, I would have to insert the comment in that same row, in the "comments" column of that particular user.

    $_SESSION['name'] = $_POST['username']; 
    submitted by /u/Milchgauss
    [link] [comments]

    Question about calculating worst case complexity of a function.

    Posted: 07 Oct 2020 11:44 AM PDT

    Say I am calculating the worst case complexity of a function (f1), and that this function contains a call to another function (f2). When calculating the complexity (big O) of f1, how do I take into account the complexity of f2? Do I simply calculate f2's complexity and use it when calculating f1's complexity?

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

    Java Threaded Histogram Class Can't get It To Run.

    Posted: 07 Oct 2020 07:10 AM PDT

    I've created a class in Java to run a histogram after calling on a text file, however it will not run even though logically everything is correct and I was hoping to get some help.

    import java.io.*;

    import java.util.Scanner;

    public class ThreadedHistogram {

    public static void main(String[] args) throws FileNotFoundException {

    // - initialize array

    int[] counts = new int[21];

    for (int i = 0; i < args.length; i++) {

    FileReaderThread file1 = new FileReaderThread(args[i], counts);

    file1.start();

    try {

    file1.join();

    } catch (Exception e) {

    System.out.println("Main thread interrupted." + e);

    }

    }

    }

    }

    //--------------------------------------------------------------------------

    class FileReaderThread extends Thread {

    private String filename = "";

    private int[] freq;

    private String word;

    //-------------------------------------------------------------------------

    // Constructor for FileReaderThread

    public FileReaderThread(String fname, int[] f) {

    filename = fname;

    freq = f;

    }

    //--------------------------------------------------------------------------

    // method for running the file read, (run the threads)

    public void run() {

    System.out.println("Thread to read: " + filename + " - started.");

    try {

    Scanner sc = new Scanner(new File(filename));

    int wordcount = 0;

    while (sc.hasNext()) {

    word = sc.next();

    freq[word.length()]++;

    wordcount++;

    }

    displayHistogram();

    System.out.println("There were " + wordcount + " words in " + filename);

    } catch (FileNotFoundException e) {

    e.printStackTrace();

    }

    }

    // -----------------------------------------------------------------------

    private void displayHistogram() {

    int i;

    int j;

    for (i = 1; i < freq.length; i++) {

    System.out.print("[" + ((i < 10) ? " " : "") + i + "] ");

    for (j = 0; j < freq[i]; j++) {

    System.out.print("*");

    }

    System.out.println();

    }

    }

    }

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

    Is it okay to use google satellite base map without api-key on production mobile application?

    Posted: 07 Oct 2020 02:45 AM PDT

    I was looking for a google satellite base map and I found the following URL as a solution:

    http://mt1.google.com/vt/lyrs=y@113&hl=en&&x={x}&y={y}&z={z}

    The case is that some people were commenting about the Google TOS but I didn't understand if the TOS is just for the google API. Since I am not using any API key and just requesting this base map, is it illegal ?

    If yes, is there any solution without using an API key, e.g. writing something on the terms of service of my app?

    Thanks in advance

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

    CRUD frameworks or languages that are flexible about code block location? (MVC-related)

    Posted: 07 Oct 2020 09:53 AM PDT

    Are there languages or stacks for business CRUD that are flexible about where the event handling code blocks go? A discussion about code organization of Visual Basic classic versus MVC came up. Hard-wiring a file/folder structure into a stack or IDE seems like a limiting idea to me, something both choices suffer.

    Most CRUD frameworks are essentially bunches of event handling blocks of code. The factors involved are similar such that the key difference is the file and folder grouping. Too many frameworks force a given file structure. In honor of Conway's Law and flexibility, the location should be flexible. Here's a pseudo-code illustration of the concept I'm looking for:

     event block foo(area: supervisor, entity: contract, actionType: insert, stage:save) { // handle insert saving event for entity model "contracts" in "supervisor" area } 

    For brevity, we may want to group some together to "inherit" common group attributes:

     group block(area: supervisor, entity: contract) { event block foo(actionType: insert, stage: save) { // Same as above. Perhaps we don't need naming like "foo". } event block blib(actionType: insert, stage: validate) { // validation event for inserts of this entity } event block etc(...){...} } // blocking variation B group block (actionType: insert, stage:save) { event block foo(area: supervisor, entity: contract) { // same as first example } event block zerb(area: clerk, entity:reviews) {...} event block etc2(...){...} } 

    I believe that in the future, code will be stored in RDBMS tables instead of files, at least during active development. You'd be able to query to see the event blocks you want, filtered and sorted YOUR way without imposing any ordering or grouping on other developers, since they can write and keep their own code finding queries. File systems are not powerful enough to manage multiple independent factors well for larger projects. But in the meantime, something like the above is an intermediate step on that journey.

    The table could resemble:

     Event Code (table) ----------- ID SourceCode Area // General grouping category. "Default" assumed if blank Entity // Usually the database table name. Perhaps use F.K. instead to Entity table. Action // Insert, Update, Delete, View, List, Search, Other Stage // Validate, Save, Query, Display, HTMLtemplate CustomName // Optional, offers a way to have multiple variations of event handlers Sequence // Processing sequence, if relevant DevNotes 
    submitted by /u/Zardotab
    [link] [comments]

    Selecting an appropriate database/file type for large (300 Gb to 1.5 Tb) files of sparse data

    Posted: 07 Oct 2020 09:32 AM PDT

    I will be generating a lot of point/sparse data. Each "point" has 5 numbers associated with it: X position, Y position, time, intensity, and an identifier. Likely the files for this point/sparse data will be around 300 Gb to 1.5 Tb. I will then need to "view" sections of this data by filtering (e.g., getting all the points that are between two "X" and two "Y" values).

    The point data is initially stored (not by me - by a device that I don't control directly) in a somewhat compressed format that I parse into these 5 numbers. I doubt that the compressed files will ever be >300 GB, but unpacking the data causes it to grow by up to 5x.

    I'm not sure what the best database/file format for this data is. My initial thought was to use SQLite and use a row for each "point" but from some articles it seems that inserting rows is somewhat slow (~100,000 rows a second). As I'm expecting to have ~10-100 billion points per file, I don't think that this insertion rate is practical. For instance, at 100,000 rows a second, a 100 billion row file would take 280 hours to finish the insertions - I think that 1 hour would be the maximum time I'd be happy with to make each of these SQLite files.

    Does anyone have any suggestions? Maybe there's a way to really speed up Sqlite3 to ~300 million insertions per second that I don't know about or some solution that I've completely neglected. Any ideas would be greatly appreciated!

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

    No comments:

    Post a Comment