• Breaking News

    Friday, February 19, 2021

    Algorithms course by Princeton (Coursera). Ask Programming

    Algorithms course by Princeton (Coursera). Ask Programming


    Algorithms course by Princeton (Coursera).

    Posted: 19 Feb 2021 12:17 PM PST

    Hey everyone, I'm 16 years old and really interested in algorithms and coding in general, I have some programming experience myself (dabbling around web development and Python), I want to start the Algorithms course by Princeton on Coursera, but the course requires intermediate Java skills, which would be the best and most effective course in your opinion ?

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

    I’ve been a pro dev for a year now and I’ve never hashed anything?

    Posted: 19 Feb 2021 08:05 PM PST

    The boss and the internet as a whole seem to be obsessed with "hashing" data for one reason or another. Usually I think to check for uniqueness.

    Anyway, here I am, over a year later and I haven't needed to hash a gosh darn thing.

    So, uh...what am I doing wrong?

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

    Best way to document?

    Posted: 19 Feb 2021 07:00 PM PST

    Any heuristic on how to explain how to use some code you made in documentation. I made it so I obviously understand it, But I'm trying to find obvious questions someone's gonna ask me. I'm in a lab doing my thesis, and this is my last semester. So I'm trying to document my code so I don't get asked after I graduate what the hell is going on, also I'm considering making a video to explain how to do it as well. Any guidance for this is much appreciated.

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

    Automatically generate switch statement from an enum list

    Posted: 19 Feb 2021 11:07 AM PST

    I find myself doing this alot. I have a list of enums and I want to generate a switch statement from them. How can I automatically add the case and break; to the list of enums by just copying and pasting?

    From this:

    Enum1, Enum2, Enum3,

    To this:

    Case enum1: Break; Case enum2: Break; Etc....

    Without manually typing it a 100 times lol. Is there a tool? Do IDEs have a way to automate this?

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

    Internet radio on pi 4. Asking for basic advice/guidelines for a noob tackling these features.

    Posted: 19 Feb 2021 09:40 PM PST

    I'm a noob using a raspberry pi 4. The plan is to use a windows iot to create an internet radio that connects directly to my 2 radio servers upon boot. I'm thinking I will write this in java (if possible) or PHP. Below are the things that I am trying to achieve, I know this may be a lot for my first project, but I'm passionate about it. Any advice or guideline you can give would be awesome! I am not asking you to do the work for me, I am simply a lost kid in a huge ass mall. Just need some directions. Thank you!

    - Understanding and incorporating Gpios

    - two radio stations(maybe just 1)

    - Linking the pi to the 2 radio streams

    - Using a button to switch radio stations

    - Understand the use of knobs to adjust the volume

    - allowing users to easily connect to their own wifi through a possible GUI menu

    - display art and audio visualizer of the radio station

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

    How to make whole word go to next line using character arrays

    Posted: 19 Feb 2021 07:04 PM PST

    QUESTION:

    Any idea how I make a whole word go to the next line because it gets cut. Thanks!

    MY CODE:

    #include <iostream>

    using namespace std;

    int main() {

    char paragraph[500];

    for (int z=0; z<=5; z++)

    {

    cin.get(paragraph, 100);

    cout<<paragraph;

    cout<<endl;

    }

    }

    MY INPUT:

    The new situation in the world has found many of us unprepared. At one moment, people were making summer plans and going about life as usual, and the next, they had to deal with lockdowns and self-isolating. It can prove especially challenging to deal with for those who are away from their homes and 'stuck' in another country.

    MY OUTPUT:

    The new situation in the world has found many of us unprepared. At one moment, people were making s

    ummer plans and going about life as usual, and the next, they had to deal with lockdowns and self-i

    solating. It can prove especially challenging to deal with for those who are away from their homes

    and 'stuck' in another country.

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

    What would the difference between validation experience and scripting experience be?

    Posted: 19 Feb 2021 06:51 PM PST

    I received a notification on LinkedIn about a job and in the description it said they prefer someone who has experience with validation testing in python rather than just scripting. I'm still pretty new to the programming game and I was wondering what the difference would be here. Thanks!

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

    Login/session conventions

    Posted: 19 Feb 2021 06:31 PM PST

    So I've been reading that methods like JWT is safer against XSS attacks and things of the sort...

    My question is why do I have to use local storage in the first place for user authentication/persistence? Cant I just have my server query the database for a Boolean that states the user still has a session?

    Or does something like this just get expensive after having many users? Is that it? Or is it a page load time thing? What is erroneous about my idea, thank you in advance 😊

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

    Creating values based on previous values pandas.

    Posted: 19 Feb 2021 06:22 PM PST

    Hello,

    I am trying to create a column that contains values based on the other column names. For example:
    INPUT

    df = {'col1': [1, 0], 'col2': [0, 0], 'col3': [1, 1]}

    OUTPUT

    df = {'col1': [1, 0], 'col2': [0, 0], 'col3': [1, 1], 'new_col' : ['col1col3', 'col3']}
    All my values are 1 or 0. So if there is a value, the new column will contain the column name where there was a 1.

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

    What are the connotations behind using the word 'remove' or the word 'delete' ?

    Posted: 19 Feb 2021 06:13 PM PST

    I know it's a rather trivial matter, but when naming functions that have the functionality of remove / delete, I'm not sure which verb to use. I feel like this does kind of matter, so I'm curious as to how you guys choose between the two words when naming.

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

    New job, spaghetti code, how do you deal with it?

    Posted: 19 Feb 2021 02:21 PM PST

    I joined a company with a spaghetti code code base. How do you try to understand the code?

    • I don't see the layers
    • Very long variable names to confuse me
    • Private helper methods or calling other public methods in the same class
    • Long methods
    • User interface isn't much better, business logic isn't clear, I can't really see the flow.
    • Lots, lots of other developers joined and left with less than a year of unemployment. The only ones there have been at the company for 3-5 years.

    Stuff that I used to do in 30 minutes or less now takes days or even a week to understand what's going on. I've joined blue chip code base companies in the past, and was on my way and very productive after only 2 weeks. But now it's been almost 3 months and I still don't have a clue.

    They don't seem to care about syntax, SOLID, or anything.

    On top of that, I was given a 12" laptop to code on :-(.

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

    What type of information should I know to make a basic containerized mini shell? (C - language)

    Posted: 19 Feb 2021 06:56 AM PST

    Is knowing basic knowledge of the C language and having an understanding about how to use docker and pthreads enough?

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

    Converting large word document to XML or markup to use in other creative ways.

    Posted: 19 Feb 2021 08:18 AM PST

    Asking for advice about an idea for a side project.

    I have a very large word document (700+ pages) and would like to interface with its content in other ways. I want to be able to extract titles for bookmarks, isolate different sections, make tables with some of the bullet points.

    I would like to keep the content but be able to visualize it in different ways.

    I started off by converting it to a text file to greatly reduce the size. Then I started added my own tags like: "root", "section", "sub-section", "table", "tabletitle", "table-item", etc and then began extracting the content from between those tags.

    Then I kind of discovered XML and XML parsers that might do some of the harder work for me. Then I saw that I could maybe add XML directly to the word documents but then I am not sure how to parse the word document.

    Wondering if anyone could point me in a better direction?

    Thanks!

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

    MQL4 - Function not working as intended

    Posted: 19 Feb 2021 12:05 PM PST

    Hello, I am writing this post in regards to a function that I have been working to solve for months now. I have searched endlessly on Google, the MQL forums, and every other resource I could find.

    This function is supposed to dynamically allocate a lot size based on stop loss risk. Using a $1000 balance, it should risk 1% of that $1000, giving $10.00 risk. The further the distance from the entry price to the stop loss, the smaller the lot size, but the $10.00 risk must be consistent.

    CONSTANT 1: 1% risk of $1000 balance = $10.00

    CONSTANT 2: distance between Stop Loss and Take Profit (this variable is determined by the program and cannot be altered)

    VARIES: amount in the lot size

    These three values come together to create the resulting lot size.

    Here is the code;

    const double riskAdjustedBalance = 1000 - (1000 * 0.03); //Takes the original balance and gives a little breathing room //percentRisk= 1 double DynamicLots(double percentRisk, double entry, double stopLoss) { double stop; //*Sets CONSTANT 2, mentioned in post. This is not in program if (stopLoss > entry) { stop = stopLoss - entry; } if (stopLoss < entry) { stop = entry - stopLoss; } //stop = 0.632, value collected from program double maxRisk = (percentRisk/100) * riskAdjustedBalance; //maxRisk = 9.70, value collected from program double pipValue = MarketInfo(_Symbol, MODE_TICKVALUE); if(Point == 0.001 || Point == 0.00001) { pipValue = pipValue * 10; } //pipValue = 9.478, value collected from program double lots = (maxRisk / stop) / pipValue; //lots = (9.70 / 0.632) / 9.478 = 1.619 // the cost of a single lot is $10,000 1.619lots = $16,193.396 if(lots < MarketInfo(Symbol(),MODE_MINLOT)) { lots = MarketInfo(Symbol(),MODE_MINLOT); } if(lots> MarketInfo(Symbol(),MODE_MAXLOT)) { lots= MarketInfo(Symbol(),MODE_MAXLOT); } if(MarketInfo(Symbol(),MODE_LOTSTEP) == 0.01) { lots = NormalizeDouble(lots,2); } else { lots= NormalizeDouble(lots,1); } return(lots); //lots = 1.62 } 

    For those unfamiliar with MQL4;

    MarketInfo(_Symbol, MODE_TICKVALUE) find the value of a tick in the account's base currency. Suppose the account is funded in Euros, then the value will be changed and returned in Euros.

    MarketInfo(Symbol(),MODE_MAXLOT) finds the maximum lot size allowed by the broker. It is only being used as a safety and will not be used often, if at all.

    MarketInfo(Symbol(),MODE_MINLOT) finds the minimum lot size allowed by the broker. It also is only being used as a safety and will not be used often, if at all.

    Thank you in advance for looking at this code.

    submitted by /u/2_stepsahead
    [link] [comments]

    If the teams holidays are approved by the manager, who approves the manager's holidays?

    Posted: 19 Feb 2021 03:48 PM PST

    How are you running Linux on a Windows machine (dual boot vs virtual machine)?

    Posted: 19 Feb 2021 03:34 PM PST

    I'm about to buy a new gamer laptop, the Lenovo Legion 5. So far I've been programming on a Dell laptop dual boot with Ubuntu and Windows. However, it seems that the Legion 5 has a lot of issues with drivers when running Linux.

    I'm considering running Linux on Windows + VMware, but first I wanted to know how other programmers are doing it and how is your experience so far if you have this kind of setup.

    My main worry is how's Docker going to be on VMware

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

    Host HTML with JS on google Apps Script, or some other way inside Google? Details inside.

    Posted: 19 Feb 2021 02:26 PM PST

    First, I am not a programmer. Just a hobbyist.

    I've developed an HTML/javascript based pricing calculator for the salespeople to use at work. Basically, input material cost of a job, and it outputs a handful of useful information to use for pricing support contracts and other things. The original version of this calculator was created using a large google sheet (which is what they are currently using), but I've spent some of my spare time reworking it in js to make a prettier and cleaner version.

    Our company has completely transitioned to Google Workspace (formerly G-suite) over the past couple of years, so I'm hoping to find a way to host this project inside that world as a convenient means of limiting access to only people in our company. There used to be a way you could (unofficially) host a site in a shared folder on google drive, but it's been killed off. I'm wondering if Google Apps Script could be made to work without having to rework the entire thing. Is there a simple way to just pull in my already-written js, and use it as-is? Or, is there another Google Workspace product I could use to do this?

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

    "tcsetattr" not defined. DEVC++

    Posted: 19 Feb 2021 02:21 PM PST

    Help please, I'm using DEVC++ on Windows 10, here's the code for termios. h https://pastebin.com/mJF790uB and below is the code I'm trying to execute. What am I doing wrong?

    #include <stdio.h>

    #include "termios.h"

    #include <unistd.h>

    #include <stdlib.h>

    /* run this program using the console pauser or add your own getch, system("pause") or input loop */

    void enableRawMode(){

    `struct termios raw;` `tcgetattr(STDIN_FILENO, &raw);` 

    `raw.c_lflag &=~(ECHO);` `tcsetattr(STDIN_FILENO,TCSAFLUSH,&raw);` 

    }

    int main(int argc, char *argv[]) {

    `char c;` `while(read(STDIN_FILENO,&c,1)==1 && c!='q'); // read is a system call used to read data into a buffer` `// STDIN_FILENO- default standard input file descriptor` `return 0;` 

    }

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

    what is the run time and space complexity for this problem?

    Posted: 19 Feb 2021 01:33 PM PST

    https://leetcode.com/problems/top-k-frequent-words/discuss/445066/C-Easy-Solution

    Is it runtime: O(nk) or O(nlog(k))? space time O(n)?

    Also, If I declare 5 dictionaries or arrays that are the length of N. Is that N * 5, so O(N)?

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

    How was the interview that landed you the job?

    Posted: 19 Feb 2021 12:24 PM PST

    What did you get asked? How well did you do?

    There seems to be a stereotype around the "invert a binary tree" problem, have you ever been asked that?

    Thanks for contribution!

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

    How to make headphones 'Hear-Through'

    Posted: 19 Feb 2021 08:27 AM PST

    I have a little project I want to do with C# but don't know how to go about it. How would I essentially take any audio output on my computer, pass it into my program and combine it with the input from the microphone (the volume of this added audio can be controlled) and then returned as a combined output? I just generally don't know where to start on a project like this, I have a decent amount of coding experience but have never worked with windows audio before.

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

    What language is the Audible app coded in?

    Posted: 19 Feb 2021 07:43 AM PST

    How memory efficient is functional programming (languages)

    Posted: 19 Feb 2021 11:26 AM PST

    I heard a bit about functional programming and find it actually quite interesting, though I've heard that it allocates a lot of unnecessary/duplicate memory to keep its data constantly immutable. Is this really the case in praxis? Do languages designed for functional programming (like Haskell for example) maybe have some tricks to get around that under the hood?

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

    Implementing a client REST API where endpoints are dependent on client configuration

    Posted: 19 Feb 2021 07:35 AM PST

    I'm working to integrate a client API into my C# app, but I'm having trouble figuring out a clean, simple, or clever way of addressing a problem where endpoint support is based on the current product-configuration of my application.

    As an example, say I can select a product type in my app (either ProductA or ProductB), and the REST API has three GET endpoints (ValueX, ValueY, and ValueZ). ProductA supports all three endpoints, but ProductB supports only the ValueX and ValueY endpoints, not ValueZ (for any number of reasons; it's an older product, it's less featured, etc. Ultimately, it's out of my control).

    What I want to avoid is writing some middleware for each endpoint that performs some conditional based on product type, which seems like a maintenance nightmare as new products and features are released, like this or some unsustainable variation of this:

    // C# Value ValueZMiddleLayer(ProductType productType) { if (productType == ProductType.ProductB) { throw new UnsupportedProductTypeException(productType); } return API.GetValueZ; } 

    This must be a solved problem, but I'm not finding anything useful in my design patterns book and I don't think I'm using the right keywords on google. Does anyone here have some wisdom to impart on me? Thank you!

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

    No comments:

    Post a Comment