• Breaking News

    Tuesday, January 5, 2021

    Do companies like Netflix, Hulu, etc. have a way to access a list of everything they currently offer? Ask Programming

    Do companies like Netflix, Hulu, etc. have a way to access a list of everything they currently offer? Ask Programming


    Do companies like Netflix, Hulu, etc. have a way to access a list of everything they currently offer?

    Posted: 05 Jan 2021 03:16 PM PST

    So I am trying to make an app that lets you search through different movies and TV shows. Do the big streaming companies have any tool available that lets you pull a list of their entire catalog and dump it somewhere? Thanks in advance.

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

    Can I use a copyright product without a license in a program?

    Posted: 05 Jan 2021 06:37 AM PST

    I want to create a "game" more like a build program in which you can build with Lego bricks. I obviously don't have a license for them, but I also don't want to make it monetized or put ads in it. Is it okay to do so or can I get in trouble if I put it out for download?

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

    [Newbie to Java] Why does this not print the batteryLevel method as well?

    Posted: 05 Jan 2021 08:17 PM PST

    I completed my task for this project and was messing around trying to understand java some more so I added a battery check method and I was under the impression that the printline calling the constructor method (Codey) would also call this method since it had the return. Why didn't it?

    https://imgur.com/a/CRNqQvl

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

    Confusing module pattern behavior

    Posted: 05 Jan 2021 04:30 PM PST

    EDIT: this is javascript Here's a fiddle https://jsfiddle.net/3gy4r8mo/3/. Basically I have a function "changeBoard()" which changes an array "board" and a function "getBoard()" which returns board. When I change board like this board[2] = 3 the result of board and getBoard() is the same but when I change it like this `board = [0, 0, 3, 0], board and getBoard return different arrays. I would expect getBoard and board to always return the same array because all getBoard does is return board. Can anyone explain why they are different?

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

    I want to build a website and an app which tells people which face shape they have once they upload a snap of their face. What coding language should be used for the comparison part?

    Posted: 05 Jan 2021 04:21 PM PST

    Brainstorming

    Posted: 05 Jan 2021 07:33 PM PST

    With all this lock down, staying home and working with small startup team with only me being the engineer rest sales and marketing, I feel like I am missing working with other engineers, before this I worked as software engineer for 14 years in corporate world. One thing I miss the most are brainstorming sessions to bring the best product design to live. I was wandering if anyone is in the same boat and want to set up ad-hoc or biweekly meetings online with zoom/or jitsi where can share design/dev challenges and brainstorm the best way to solve them?

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

    Why can't I type ctrl+z here to end program?

    Posted: 05 Jan 2021 07:22 PM PST

    https://ibb.co/9c1LQr6 (I then hit enter)

    #include<stdio.h> #include<stdlib.h> int main(){ int i=0; int arr[100]; while(1){ scanf("%d",&arr[i]); if(feof(stdin)){ break; } i++; } int j; for(j=0;j<i;j++){ printf("%d ",arr[j]); } } 
    submitted by /u/JacksonSteel
    [link] [comments]

    Trying to automate EncFS with a C# Process, but can't programmatically enter the password

    Posted: 05 Jan 2021 02:03 PM PST

    I want to use EncFS in my C# project, and to do this I wrote a wrapper class that launches the encfs process and provides it with the necessary command line arguments through standard input. This works fine for the initial configuration, but for some reason, the "New Encfs Password:" prompt goes to the parent C# process' standard output and I can only enter the password there. This is not good, because I want to provide the password automatically from the code logic.

    I assume that this is some sort of security measure for entering the password, but I really want to circumvent it if possible.

    Not sure if it's relevant, but this is the code that creates the process:

    var process = new Process(); process.StartInfo.FileName = "encfs"; process.StartInfo.Arguments = $"\\"{Path.GetFullPath(encFolder)}\\" \\"{Path.GetFullPath(mountPoint)}\\""; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.StartInfo.RedirectStandardInput = true; process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.OutputDataReceived += ...; process.Start(); process.BeginErrorReadLine(); process.BeginOutputReadLine(); process.WaitForExit();

    Then I just send the necessary inputs to stdin after the first OutputDataReceived.

    Can anyone point me in the right direction?

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

    What is the best compromise/alternative for yellow text on white background?

    Posted: 05 Jan 2021 04:52 PM PST

    I want to add support for black-text-on-white-background setups to a console logging module, and I need to come up with a "bright theme" version of yellow text on black. Obviously, yellow on white has excellent readability, but I don't want to completely replace it with another color--e.g. violet on white--because it could imply different semantics. What color can I choose that is

    1. Somewhat legible against white ground, and
    2. ...still "feels" yellow?
    submitted by /u/lifeeraser
    [link] [comments]

    Best rapid development front-end

    Posted: 05 Jan 2021 04:50 PM PST

    Hey guys! I'm really struggling to choose a front-end platform. I need user login, custom HTML / JS. I have an API that we have built for the back end. Most of the display will be buttons, charts, with a bit of text. Most users will be mobile.

    I intend the first version to be completely thrown out after our pilot. I don't care about setting up a complex react app, or even about the style to a degree. Platforms like bubble.io really are not good enough, however, as we need to do complex JS and manipulate the dom here and there.

    I low key want to just do a flat HTML+CSS+JS webapp using bootstrap, but that ALSO seems slow. It will be a static site (other than the data spit back from the API).

    Thoughts on the fastest/ rapid / customizable web-app templates?

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

    Querying offline web data in a PWA with a weighted random order?

    Posted: 05 Jan 2021 03:06 PM PST

    Using localStorage as it seems the standard. Is it possible to write queries against the data similar to a Sql/NoSql query?

    My first trying to do anything like this and probably wanting too much functionality.

    Essentially I will have a large list that I want to grab the top 5 ordered by date for example. Preferably with the ability to add some randomness to it.

    Assuming from what I've read, this can't really be done natively. Any suggestions to do a similar hack?

    Think reddit posts, but offline, where the posts you see are basically a weighted random order.

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

    Help Understanding Hackerrank solution C#

    Posted: 05 Jan 2021 10:52 AM PST

    Hello,

    I have been working through some Hackerrank problems. I find that I can solve the problem for most cases but frequently my code is too slow and counted as incorrect, even for problems marked as easy. I was looking at a solution to one of these problems, but I'm having trouble understanding why it works. I can read the code and know what it's doing but I'm missing something in the logic and not understanding how this logic get the correct answer.

    The problem: https://www.hackerrank.com/challenges/repeated-string/problem

    The solution in C#:

    using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { string s = Console.ReadLine(); long n = Convert.ToInt64(Console.ReadLine()); var k = 0; var m = 0; var fu = n / s.Length; var fr = n % s.Length; for(int i=0; i<s.Length; i++) { if ('a'.Equals(s[i])) { k++; if (i < fr) { m++; } } } var r = k * fu + m; Console.WriteLine(r); } } 

    I understand everything until the body of the for loop. I get that the for loop is stepping through the string and the if statement is checking if the char at that position in the string is equal to "a". If so, increment k. After that, I can read the code but I'm not sure how the calculation gets the correct answer. Any help is appreciated, thank you.

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

    Confused about manipulating the DOM in JS.

    Posted: 05 Jan 2021 10:42 AM PST

    let btn = document.querySelectorAll('.button'); btn.addEventListener('click', function(){ btn.forEach(function(btn){ alert('hello'); }); 

    So this is what I have. I have three buttons on my HTML page, one being rock, the other paper, and the last scissors. I'm just trying to test if this eventHandler will work on all the buttons but right now, nothing happens!

    Can someone help me understand what I am doing wrong?

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

    Anyone here been a perpetual W2 contractor?

    Posted: 05 Jan 2021 08:03 AM PST

    I've worked 1099, W2, and FTE jobs over the years and am realizing I really love the straight-forwardness of W2s (mine have always worked similarly to an FTE aside from benefits and length of employment) combined with the temporary term (I tend to feel like doing something different after 6 months to a year or so).

    Has anyone here been successful in lining up W2s over the long term, particularly in frontend work? I'd love to work 6-12 months at a time and freely take any breaks in between. It would save me the hassle of working out hours/equipment/invoicing/taxes/etc for 1099 and wouldn't lock me into the longer term engagements with limited time off of FTE, but I'm not sure how many W2s tend to be out there at any given time.

    Whatcha reckon?

    submitted by /u/47milliondollars
    [link] [comments]

    [Help] - Creating an Editable table with a dynamic number of columns in react or using any existing component library.

    Posted: 05 Jan 2021 09:48 AM PST

    I've been banging my head over this for a while now.

    I have to create a table for my pet project like this https://i.imgur.com/ouNGQMD.png

    I am using ant-design along with react-typescript

    The Columns in this table are dynamic in the sense that they are generated based on the data available, the columns marked in red are the ones which will change, there can be two or ten depending on the range of dates selected in the top select component.

    All the cells marked Blue should be editable and the actions mentioned in the green box are "Edit Save Delete"

    I managed to get to a stage where I can have editiable columns if they are fixed, that is there is only fixed number of days in the table.

    This is a sample of my data. As you can see each combination of proj-subProj-activity-task has an array of hours/per day. I want that array of hours per day as additional columns in the table. Something like a two dimentional array.

    One more thing, I have control over the API, this is a basic timesheet app but every entry should be visible in the table. I can also change the API and Datamodels if I have to make it easier to achive my goal.

    For example if the date range has only 2 days, there should only be two colums depicting the hours. But they all should be editable.

    I am using antd's table component https://ant.design/components/table/

    const data: TimesheetData[] = [ { projectName: 'John Brown', subProjectName: 'SubProject 1', activityName: 'Activity 1', activityTaskName: 'Task 1', activityId: 1, projectId: 1, subProjectId: 1, activityTaskId: 1, hoursList: [ { hoursForDay: 2, workDayId: 1, workDayName: 'mon2412', }, ], }, { projectName: 'John Brown', subProjectName: 'SubProject 1', activityName: 'Activity 1', activityTaskName: 'Task 1', activityId: 1, projectId: 1, subProjectId: 1, activityTaskId: 1, hoursList: [ { hoursForDay: 5, workDayId: 1, workDayName: 'mon2412', },{ hoursForDay:3, workDayId: 2, workDayName: 'tue2512', }, ], }, { projectName: 'John Brown', subProjectName: 'SubProject 1', activityName: 'Activity 1', activityTaskName: 'Task 1', activityId: 1, projectId: 1, subProjectId: 1, activityTaskId: 1, hoursList: [ { hoursForDay:3, workDayId: 1, workDayName: 'mon2412', },{ hoursForDay:6, workDayId: 2, workDayName: 'tue2412', }, ], }, ]; 
    submitted by /u/tHeSiD
    [link] [comments]

    Typescript: how to do type checks against type alias

    Posted: 05 Jan 2021 06:25 AM PST

    What I am trying to do is basically this:

    type myNumber = number; let x: myNumber = 123; typeof x == "myNumber";//This always returns false 

    How can I write the last line in such a way that it checks if x is of type myNumber?

    And yes I am aware that the example is a bit pointless, in reality I am using this sort of thing in the context of function overloading.

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

    Is it an anti-pattern to pull remote API data, store it, process it, and serve locally? Or is it better to try to make API calls "real-time" as needed?

    Posted: 05 Jan 2021 08:12 AM PST

    I am an Integration Specialist at my company, and we offer an API (which I think it actually a bit crude).

    My clients always desire to use the API in real-time, making calls as needed in the user flow. They often want to pre-filter the data such that it only returns the exact data they need. Our API functions generally do not allow this.

    For any sort of complex setup, I want to recommend that they use our API as a data source... and plan on pulling all of their data to store locally. Then they can write SQL to process and serve the data as needed. Clearly this requires some work, as they would also need to write data-sync scripts to update their local data as things change.

    Is this kind of set-up generally considered an anti-pattern though?

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

    How do I make an interactive background?

    Posted: 05 Jan 2021 07:59 AM PST

    Here is what I currently have. (Forked)

    Repl.it

    This is an example of the outcome I am trying to achieve without the changes I want.

    Google Drive

    However, there is a problem with the code. I want the stars to be repelled by the mouse pointer on my computer, and then to snap back to their original position when they're out of the mouse's range, to form constellations. I've seen this on websites before, although I forget where. I can't seem to find any examples by searching this up. Does anyone know how I can program this myself?

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

    Struggling with XPATH on IMPORTXML. Want to get more selective with the data I pull.

    Posted: 05 Jan 2021 10:53 AM PST

    I'm trying to build a Sheet that will scrape websites and help me decide the best way to buy some materials.

    Here's the site I want to pull the data from: https://www.lowesdeals.com/lowes-coupons/10-off-50-lowes-instore-online-coupon/

    I want it pull just the price which is currently 1.99.

    I can get it to this point: "Price: $1.99" by using this formula:

    =IMPORTXML("https://www.lowesdeals.com/lowes-coupons/10-off-50-lowes-instore-online-coupon/","//h2/span")

    How can I get it to just extract the 1.99 and nothing else?

    Thanks in advance!

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

    Why are file names in websites always named with random characters? Is there a way to reverse it?

    Posted: 05 Jan 2021 09:55 AM PST

    When opening the source code, the names of all the files that make up the site are always named with random characters. Is there a way to reverse it to make studying the site easier? If it is a security measure, no need to answer.

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

    How to find the data of the second directory with the help of the first directory in C?

    Posted: 05 Jan 2021 09:54 AM PST

    I searched online about finding a directory or a file using C and I found a lot of results but the thing that I want is not to find the directory/file in the given location. Instead what I want is that if one directory/file(that are the same) is present in two different directories like

    directory1 |_d1 |_f1 directory2 |_d1 |_f1 

    then I want to access d1 or f1in directory2 with the condition that is if d1 or f1 is present in the directory1 then take(s) its/their name(s) from the directory1 and find that d1 or f1 in the directory2.

    I know its little bit confusing but I want to find the data of directory2 with the help of the data present in the directory1*.*

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

    C++ Blackjack - How to handle user splitting his hand?

    Posted: 05 Jan 2021 09:24 AM PST

    I am getting stuck on thinking out the logic of this one. I currently have a blackjack game, pretty simple. I have completed everything except on how to split the hands. Do you have any ideas how I could go about this?

    int blackjackGame(int betAmount, int userBalance) { // Declare variables. vector<PlayingCard> playingDeck; bool gameLoop = true; playingDeck = createDeck(playingDeck); // Create Deck playingDeck = shuffleDeck(playingDeck); // Shuffle Deck while (gameLoop) { vector<PlayingCard> userHand; vector<PlayingCard> dealerHand; int userChoice = 0; int playAgain = 0; bool activeHandUser = true; bool activeHandDealer = true; cout << "Your current balance is $" << userBalance << endl; betAmount = getValidBet(betAmount, userBalance); // Opening Draw cardDraw(userHand, playingDeck); cardDraw(dealerHand, playingDeck); cardDraw(userHand, playingDeck); cardDraw(dealerHand, playingDeck); // Get Hand Values cout << "Get ready to play!" << endl; // Output user hand cout << "User Hand...." << endl; for (int i=0; i < userHand.size(); i++) { cout << userHand[i].cardNumber << " of " << userHand[i].cardSuit << " Value: " << userHand[i].cardValue << endl; } cout << "User hand is worth: " << getHandTotal(userHand) << endl; // Tester // Output dealer top card cout << "Dealer Hand...." << endl; cout << dealerHand[0].cardNumber << " of " << dealerHand[0].cardSuit << " Value: " << dealerHand[0].cardValue << endl; cout << "************" << endl; // User draw loop while(activeHandUser) { cout << "Enter 1 to Hit " << endl; cout << "Enter 2 to Stand " << endl; if(userHand.size() == 2) { cout << "Enter 3 to Double Down " << endl; } if(userHand[0].cardNumber == userHand[1].cardNumber) { cout << "Enter 4 to Split " << endl; } cin >> userChoice; switch(userChoice) { case 1: cardDraw(userHand, playingDeck); for (int i=0; i < userHand.size(); i++) { cout << userHand[i].cardNumber << " of " << userHand[i].cardSuit << " Value: " << userHand[i].cardValue << endl; } cout << "User hand is worth: " << getHandTotal(userHand) << endl; // Tester break; case 2: cout << "User hand is worth: " << getHandTotal(userHand) << endl; // Tester activeHandUser = false; break; case 3: betAmount = betAmount + betAmount; cardDraw(userHand, playingDeck); for (int i=0; i < userHand.size(); i++) { cout << userHand[i].cardNumber << " of " << userHand[i].cardSuit << " Value: " << userHand[i].cardValue << endl; } cout << "User hand is worth: " << getHandTotal(userHand) << endl; // Tester activeHandUser = false; break; case 4: vector<PlayingCard> userSplitHandOne; vector<PlayingCard> userSplitHandTwo; userSplitHandOne.push_back(PlayingCard()); userSplitHandTwo.push_back(PlayingCard()); userSplitHandOne[0] = userHand[0]; userSplitHandTwo[0] = userHand[1]; } if(getHandTotal(userHand) > 21) { cout << "Sorry you bust" << endl; cout << "Dealer Wins" << endl; userBalance = userBalance - betAmount; activeHandDealer = false; activeHandUser = false; } } while(activeHandDealer) { cout << "Dealer Hand...." << endl; for (int i=0; i < dealerHand.size(); i++) { cout << dealerHand[i].cardNumber << " of " << dealerHand[i].cardSuit << " Value: " << dealerHand[i].cardValue << endl; } cout << "Dealer hand is worth: " << getHandTotal(dealerHand) << endl; // Tester if (getHandTotal(dealerHand) >= 17 && getHandTotal(dealerHand) <= 21) { activeHandDealer = false; } while (getHandTotal(dealerHand) < 17) { cout << "Dealer Hits..." << endl; cardDraw(dealerHand, playingDeck); cout << dealerHand[dealerHand.size()-1].cardNumber << " of " << dealerHand[dealerHand.size()-1].cardSuit << " Value: " << dealerHand[dealerHand.size()-1].cardValue << endl; if(getHandTotal(dealerHand) > 21) { cout << "Dealer Busts!" << endl; cout << "You win the hand!" << endl; userBalance = userBalance + betAmount; activeHandDealer = false; } } } if (getHandTotal(userHand) > getHandTotal(dealerHand) && getHandTotal(userHand) <= 21) { cout << "Player wins!" << endl; userBalance = userBalance + betAmount; } if (getHandTotal(userHand) < getHandTotal(dealerHand) && getHandTotal(dealerHand) <= 21) { cout << "Dealer wins!" << endl; userBalance = userBalance - betAmount; } if (getHandTotal(userHand) == getHandTotal(dealerHand)) { cout << "You pushed" << endl; } cout << "Would you like to play again?" << endl; cout << "1 to play again" << endl; cout << "2 to quit" << endl; cin >> playAgain; if(playAgain == 1) { userHand.clear(); dealerHand.clear(); betAmount = 0; } if(playAgain == 2) { gameLoop = false; } } } 
    submitted by /u/Nickt1596
    [link] [comments]

    Controlling monitors via displayport/HDMI/USB-C, any Linux APIs?

    Posted: 05 Jan 2021 05:37 AM PST

    I'm looking to simplify my life a little bit- one of the annoying parts of it currently is switching monitor inputs.

    Is there any standard for controlling monitors? I know HDMI CEC is a think, but can it work over displayport?

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

    Help me

    Posted: 05 Jan 2021 04:59 AM PST

    as a 15 year old who really enjoys programming I don't know what I know what to do but what Au do lnow is that I want programming integrated into my job so in my mind the smartest thing to do is learn Python, C++, and java script in that order so if my plan is flawed please tell me

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

    No comments:

    Post a Comment