• Breaking News

    Thursday, January 23, 2020

    Does consistency take precedence over best practice? Ask Programming

    Does consistency take precedence over best practice? Ask Programming


    Does consistency take precedence over best practice?

    Posted: 23 Jan 2020 05:16 PM PST

    Let's say you have quite a monolithic project, and a certain way of doing something is done the same way consistently throughout the project. However, it's done in a horrible way. Let's say you need to do that "thing" now. Do you do it the same way for the sake of consistency? Or a better way for the sake of best practice.

    I'm personally inclined to believe, consistency is the approach here. Although it's not best practice, atleast other developers are familiar with it and expect it. (This is in consideration that it would be an insane workload to change everything)

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

    Looking for a resource to recreate an Oracle PL/SQL package for SQL Server, Postgresql, MySQL, DB2, and SAP HANA.

    Posted: 23 Jan 2020 02:42 PM PST

    Each of these listed databases has the capability to create and execute stored procedures, but with unique proprietary syntax. I'm looking for a reference that can help recreate my fully functioning Oracle PL/SQL package in each of SQL Server, Postgresql, MySQL, DB2, and SAP HANA using their native syntax.

    Does any such reference exist?

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

    What is the most common decision impacted your project in a big way like mine was branching strategy it had very had hit when we just moved into production after being in undercover development for 2 years and need some love to move forward ??

    Posted: 23 Jan 2020 08:27 PM PST

    - and -- in console programs

    Posted: 23 Jan 2020 03:52 AM PST

    Why some paraneters are prefixed with - and why others prefixed with -- when you use a console program?

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

    Why should I use a struct over a class?

    Posted: 23 Jan 2020 07:50 PM PST

    Ik when to use a class and an enum, but I've been told a struct is just "a mini class", so why not just use a class?

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

    Is there an API to accept wires? Or how else can I cheaply process large payments securely.

    Posted: 23 Jan 2020 02:58 PM PST

    I've got my first large client & their invoices are creeping up to $10k+. They're located across the country & from invoice date I don't have time to wait for critical funds to be in my account.

    The past few, they've just wired me the money & that works fine, but that process is kind of cumbersome & involves sending them my bank info. I want to make it easier & more secure, so I want to add invoicing to the workflow portal I built for them, so they can just pay me there.

    The easiest would be to just run their card with stripe or PayPal, but both are gonna charge 2.9% (+ cc fees?), so on a $10k transaction I'm out like $290+. So I'd rather not take their card as I can't really afford to lose that kind of money right now.

    My next thought was ACH payments as stripe can handle those too & they only charge a flat $5 for large transactions, but after reading the documentation apparently ACH payments can take up to a week to process. I really need the money processed instantly or at least same day, so that won't work.

    Is there an API I can use to have them send a wire through my portal? Or is there any other way? Or how do you guys process your invoices?

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

    [Question] Are there "GUI Builders" That will let me make a simple interface with hyperlinks without any programming knowledge?

    Posted: 23 Jan 2020 06:40 PM PST

    I apologize if this is a stupid question, or if this is actually nothing for this sub, it does not seem obvious to me

    I would like to make an interface where I can put in images and connect links to them, so that when I click them I get redirected

    I need this to make shopping materials for my business more convenient, since my current bookmark tab is getting extremely extremely crowded and its painful to find the right entries all the times

    tyvm everyone

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

    Issue with API request in java

    Posted: 23 Jan 2020 02:12 PM PST

    Not sure if this is right place to ask about this, but i have a java application that is submitting the request to the twitch API. This works on windows, but when transfred to my raspberry pi it returns a 400 response. More detail on this can be found on my stack overflow question here https://stackoverflow.com/questions/59883828/httpurlconnection-is-returning-400-for-linux-but-works-on-windows

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

    Cannot seem to find jpalleg on the internet any longer.

    Posted: 23 Jan 2020 04:45 PM PST

    I can't seem to find a library that I need to compile one of my cousin's older games. He wanted to let me learn some code from it, but I cannot seem to find jpalleg online. It also needs DUMB and Allegro, but I can find those pretty easily.

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

    Is there an IDE setting to define a text shortcut that that triggers a suggestion dropdown?

    Posted: 23 Jan 2020 12:21 PM PST

    Hey all, beginner programmer currently using Intellij as my default IDE for Java. Wondering if this kind of setting exists for IDEs (doesn't specifically have to be in Intellij)

    For example, if I type:

    S.O.P 

    I'd like it to trigger the suggestion dropdown with this:

     System.out.print(""); System.out.printf(""); System.out.println(""); 

    Similar to how it does with other method calls and then moves your cursor between the quotes.

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

    A tool for building intuitive code documentation

    Posted: 23 Jan 2020 12:26 PM PST

    Hi Reddit,

    We're Rishabh, Aashish, Noah, and Moksh, the creators of Codeflow: a tool for building intuitive documentation for code. You can check it out here:

    https://codeflow.now.sh/

    As current college students, we were all lucky enough to spend our summers interning a variety of places. One common theme we found between our experiences is it was often difficult to start working on a project and typically took many rounds of discussions to understand the flow of the code. Tools like Dropbox Paper and Confluence are great at communicating high-level specifications for engineers, but fail to capture nuances needed for new engineers to continue developing.

    Codeflow is our attempt at a solution. It allows engineers to easily build presentation-esque tutorials which focus on stepping through the code logically. We hope it can become a centralized repository of tutorials designed to capture an engineer's thought process and make ramp up more efficient.

    Here's an example of a tutorial built using Codeflow:

    https://codeflow.now.sh/tutorials/view/RishabhJain96/next.js/tree/b595dd/ck5q9b79d00000vlbn7ichp7p

    At this stage, we're hoping for feedback as we try to validate this approach. Any and all thoughts are appreciated.

    Thanks,

    Rishabh, Aashish, Noah, and Moksh

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

    Two-dimensional string arrangement using pointers in C

    Posted: 23 Jan 2020 10:42 AM PST

    I want to do a two-dimensional array of strings using pointers, since by doing that I can later release the dynamic memory and make a smaller or larger array using the same identifier (variable).

    I used the code:

    #include <stdio.h> #include <string.h> #include <stdlib.h> unsigned long rows = 0; unsigned long cols = 0; unsigned long chrs = 30; char ***mtx = NULL; int rszmtx(char ***, unsigned long, unsigned long); int main(int argc, char *argv[]) { rszmtx(mtx, 0, 0); for (int r = 0; r < rows; r++) { for (int c = 0; c < cols; c++) { strcpy(mtx[r][c], "[]"); } } for (int r = 0; r < rows; r++) { for (int c = 0; c < cols; c++) { printf("%s ", mtx[r][c]); } printf("\n"); } return 0; } int rszmtx(char ***matrix, unsigned long y, unsigned long x) { if (y <= 0) { printf("Enter the number of rows: "); scanf("%lu", &rows); } else { y = rows; } if (x <= 0) { printf("Enter the number of cols: "); scanf("%lu", &cols); } else { x = cols; } free(matrix); matrix = (char ***) malloc(rows * sizeof(char **)); if (matrix == NULL) return 1; for (int r = 0; r < rows; r++) { matrix[r] = (char **) malloc(cols * sizeof(char *)); for (int c = 0; c < cols; c++) { matrix[r][c] = (char *) malloc (chrs * sizeof(char)); } } return 0; } 

    In the function "main" I want to call the function "rszmtx" and assign a size to "mtx" given by the user. Then I want all the strings to be "[]" and print them out. The problem is that I can neither assign nor print anything. When testing I noticed that if I put the mapping and/or printing inside the "rszmtx" function everything works fine. Why is this, how can I map and print "mtx" outside the "rszmtx" function?

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

    ByteArrayOutputStream to a File - Drive API, Java

    Posted: 23 Jan 2020 09:47 AM PST

    The context is that I'm trying to use the Drive API in Java in order to download a file and store it in a specific location. This is on Android btw. Here is what I am referencing: https://developers.google.com/drive/api/v3/manage-downloads#download_a_file_stored_on_google_drive I'm not the most experienced coder, so I don't understand how to use the ByteArrayOutputStream and store what it receives from the Drive API in the file format that the file originally had when that data is downloaded and stored in the ByteArrayOutputStream. I'm trying to download a folder filled with contents by the way.

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

    In CSS grid, why does align-self and justify-self in the child element work perfectly, but align-content and justify-content in the parent grid container doesn't?

    Posted: 23 Jan 2020 08:57 AM PST

    Hello!

    This realization came out of my quest for finding a way to center divs inside a css-grid.

    Finally, I found that:

    align-self: center; justify-self:center; 

    work without a problem.

    I was happy with it, until I realized that I used those two lines in literally every child of the grid wrapper element. So I tried the obvious solution and tried to use the parent commands:

    align-content: center; justify-content:center; 

    and it didn't work at all.

    Now, I do realize that these are basically flex-commands because most of the documentation insinuates that. But I do hope that using it in a css grid is legit. At least the child commands, and that I can at least make a class if I don't find some other way to center stuff.

    Margins are so volatile and flimsy and you have the age old problem of vertical units being linked to horizontal ones, so I wanted to avoid that entirely.

    Do you have some advice for me? What should I do?

    PS: forgot to add the proof that it doesn't work:

    https://www.w3schools.com/code/tryit.asp?filename=GB7Z9Y26WZGL

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

    MS Access DB to link multiple MS Forms spreadsheets

    Posted: 23 Jan 2020 06:54 AM PST

    I'm part of the preventative maintenance team at work and I need to build a DB to store multiple excel spreadshets.

    I have a powerapps app that links every location to it's maintenance checklist. These checklists have an excel file linked to them so you can see it's answers. The problem is we will have hundreds of files to look at, one by one. So I thought of having an Access DB to store all answer files and make a report with all the info needed, like time taken at site, i.e.

    I want to know if i can do it and how could I approch this problem. Importing multiple excel ms form files that are stored in a SharePoint website and using them at a report.

    Thanks in advance!!!

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

    [JavaScript] Stopping function execution without executing the program itself?

    Posted: 23 Jan 2020 06:23 AM PST

    Hello!

    I am working on a project where we used to have a bunch of cron jobs running in Jenkins, but business needs have dictated we need to migrate away from this resource and into an already-existing k8s infrastructure, whose devops pipeline unfortunately does not allow for effective management of cronjobs. As a result, next best possible thing is to stand up an application that manages the cronjobs as an abstraction, which is what we're doing with cron.js.

    My question is, we have a certain job that runs every half hour. However, because of the data that is being handled, it may take longer than 30 minutes to execute this job. In the past, in Jenkins, we were able to simply include something like this:

    { disableConcurrentBuilds() } 

    in our Jenkinsfile, and the next job would only run after the previous execution terminated. However, i have done some digging through the docs and i haven't found anything that would allow for this with cron.

    Would love some additional insight on this, as well as any workarounds -- Since most of our function execution happens in a separate library that we created, I would rather not have to modify the library to look for a race condition or whatever. At this point that'd be a last resort.

    Thanks for any thoughts you may have!

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

    MongoDB Node.JS driver: create, append, and update documents with arrays

    Posted: 23 Jan 2020 05:10 AM PST

    I am looking to achieve the following operations with the MongoDB Node.JS driver, could this be performed with an optimal approach? There are three possible operations required: create, append, and update.

    1. Create the following document.

    json { "_id": "hello_world_cluster", "items": [ { "item_name": "my_item_one", "first_seen": 1000, "last_seen": 1000, "logic": true } ] }

    1. Append new items to an array.

    json { "_id": "hello_world_cluster", "array": [ { "item_name": "my_item_one", "first_seen": 1000, "last_seen": 1000, "logic": true }, { "item_name": "my_item_two", "first_seen": 2000, "last_seen": 2000, "logic": true }, { "item_name": "my_item_three", "first_seen": 3000, "last_seen": 3000, "logic": true } ] }

    1. Update items that are found in an array.

    json { "_id": "hello_world_cluster", "items": [ { "item_name": "my_item_one", "first_seen": 1000, "last_seen": 4000, "logic": false }, { "item_name": "my_item_two", "first_seen": 2000, "last_seen": 2000, "logic": true }, { "item_name": "my_item_three", "first_seen": 3000, "last_seen": 3000, "logic": true } ] }

    submitted by /u/Kitchen-Job
    [link] [comments]

    Live Server - how to restart it in VSCode?

    Posted: 23 Jan 2020 12:54 AM PST

    Hi.

    No matter what changes I make to my code, the "Live Server" doesn't update. I've closed it, re-started Sass (npn run sass), but not sure what else to try...

    Will appreciate some advice.

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

    Hi Guys! Just need a little help with a simple averaging program in C++

    Posted: 22 Jan 2020 10:31 PM PST

    Basically, I have an assignment that had me make a random number generator game that would tell you how many tries it took you to figure it out. What I can't for the life of me figure out is how to average the results from the game. Do I need to define each correct result as an individual variable and then average it like a normal set of data or do I need to set up some kind of specific memory that tracks each number of tries and then averages it? Cause I have no idea how to do the latter but the former seems to not be practical

    Any help would be greatly appreciated, thanks in advance!

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

    Question about parsing speed

    Posted: 23 Jan 2020 04:15 AM PST

    Hello!

    For a school project we need to make a client that listens to a program that sends 8000 xml files every second. This data needs to be processed and stored in a database.

    Atm I've written my own parser to convert the data from xml to my local txt database. Though my computer can't handle the 8000 xml files / second and eventually starts to fall behind.

    My question is as following: If I would use a parser like SAX or DOM, would that increase my processing speed? Or should I look for solutions elsewhere, like optimizing my threading?

    Thanks in advance!

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

    [Apache server, node.js, mod_proxy] Is it standard practice to use mod_proxy make node.js work on a Apache server?

    Posted: 23 Jan 2020 03:21 AM PST

    Our website is run on an Apache server. We are making a tool for the website that react is a good choice for. This is our first time needing node.js on the website. I plan on using mod_proxy to reroute all calls to the tool to go to a different port that node.js will be listening on. I have read that with a small number of users (we only have 12k on our site) this is fine but for a bigger site you should use two separate servers and something to route the traffic. Since I am teaching myself all of this, I am curious what the standard practice is. At what limit should you switch to having two servers and something to handle the flow of traffic?

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

    how do i dynamic load data in Modal's or SpanTag in Modal's ( ASP.net , C# )

    Posted: 22 Jan 2020 10:28 PM PST

    i have created a modal ,lets name it ExModal and many card's that will target ExModal , there are Span Tag's in ExModal , i want my data to be dynamic in Modal ,as i have created function that will return data according to ID's ( dbf.runall(i) ) ,there are many card on index page which have this button :

    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalLong">Enter</button>

    below : index.aspx.cs

    DatabaseFunc dbf = new DatabaseFunc();

    public void Col1(int i)

    {

    dbf.runall(i); // this is input of ID ,so database will return string according

    // int i : ID(a primary key of database)

    MspanT.InnerText = dbf.retQ(); // this will return string from Database

    MspanB.InnerText = dbf.retS();

    MspanB2.InnerText = dbf.retD();

    MImg.Src = dbf.retImg();

    }

    below : index.aspx , this is my modal i m talking about

    <div class="modal fade" id="exampleModalLong2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">

    <div class="modal-dialog" role="document">

    <div class="modal-content">

    <div class="modal-header">

    <h5 class="modal-title" id="exampleModalLongTitle2">

    <span id="MspanT" runat="server"

    class="badge badge-primary text-center">Title </span>

    <%-- I Want above span tag to be dynamic --%>

    </h5>

    <button type="button" class="close" data-dismiss="modal"

    aria-label="Close">

    <span aria-hidden="true">&times;</span>

    </button>

    </div>

    <div class="modal-body">

    <img src="Img\Math.jpg" id="MImg" runat="server"

    class="d-block w-100" alt="..." width="100" height="200">

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

    No comments:

    Post a Comment