• Breaking News

    Tuesday, May 25, 2021

    Best way to use git Ask Programming

    Best way to use git Ask Programming


    Best way to use git

    Posted: 25 May 2021 01:25 PM PDT

    So I use git to manage version control on my projects, and I have 2 devices that I code on (laptop and desktop). I obviously want to be able to share between the 2, but the problem I am having is, if I write code on my PC, and then need it on my laptop, but I am halfway through the edits, I have to make a new commit and push it with some dodgy message like "commit to share for laptop". I want a better way of sharing between the 2 so that I don't have to make a commit where the code isn't a stable version and I have a weird commit in my log.

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

    Understanding this bitcoin transaction

    Posted: 25 May 2021 09:25 PM PDT

    Hey, I've been learning about UTXO and the overall bitcoin transaction process.

    I came across this transaction and I'm curious how to interpret it.

    Usually I see an unspent output with the same address as the input's previous output address, but in this scenario it looks like the unspent BTC is going into a new address.

    What's going on here?

    https://blockstream.info/tx/e5c256c4bcaab3c557227eed2c8941df1d978cf1de83c480075944503b17e7da

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

    Why is it that django always on top on the list of best backend frameworks and spring in the middle of the list

    Posted: 25 May 2021 02:34 AM PDT

    Is django really good than spring boot

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

    A Program that Detects Image

    Posted: 25 May 2021 08:54 PM PDT

    So I wanna try and create a program where when a certain image pops up the program would detect it and press a button on my keyboard, I'm a beginner so I'm still trying to learn stuffs but I really wanna get into this one.

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

    How does a computer know the difference between a local and external IP address?

    Posted: 25 May 2021 03:53 PM PDT

    Not sure if this is the right subreddit, but anyway...

    If I go into the terminal and type ssh 192.168.1.X I can connect to a device on my network. If I port forward, then I can ssh remotely using the external IP address. But how does the computer know that 192.168.1.X isn't an external IP address?

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

    Don't understand proof for: if composite number passes fermat's test, it will pass for at most half of a < N

    Posted: 25 May 2021 07:13 PM PDT

    EXCERPT FROM BOOK

    Lemma If aN−1 ̸≡ 1 mod N for some a relatively prime to N, then it must hold for at least half the choices of a < N.

    Proof. Fix some value of a for which aN−1̸≡1 mod N. The key is to notice that every element b < N that passes Fermat's test with respect to N (that is, bN−1 ≡ 1 mod N) has a twin, a · b, that fails the test:

    (a·b)N−1 ≡ aN−1 ·bN−1 ≡ aN−1 ̸≡ 1 mod N.

    QUESTION:

    I understand the process of getting from (a·b)N−1 to aN−1 ·bN−1 (just distributing the exponent). But I do not understand the next step where aN−1 ·bN−1 turns into aN−1 ̸≡ 1 mod N. If bN−1 ≡ 1 mod N, then shouldn't you be able to substitute 1 mod N for bN−1 and therefore eliminate bN−1 on the left and render the right side unchanged since 1 mod N/1 mod N is still 1 mod N?

    submitted by /u/Fluffy-Information-4
    [link] [comments]

    Spring Framework components

    Posted: 25 May 2021 03:00 PM PDT

    Recently I started to learn spring and not really familiar with some concepts. Currently, I'm learning it by creating different projects.

    So, I have a @Service with function save(MultipartFile csvFile) which saves given csv file to the database. There are two types of given CSV file possible (they differ by content and column number) which must be parsed in different ways (because of different structure) and added to different @Repository. Moreover, the second file needs two repositories while the first one needs one. All these three repositories are different database tables.

    To solve this, I came up with the idea to create factory singleton @Component which on given file will produce with ( applicationContext.getBean(TypeALoader.class) / applicationContext.getBean(TypeBLoader.class) ) some loader abstract class prototype @Component with the needed implementation for the particular file type (its own parser implementation and @Autowired @Repository). But to autowire and use repositories, I need to provide them in the class constructor. The problem is that, as said before, first class needs one repository, the second one needs two repositories.

    I don't know how to implement this. Is this logic ok at all ? Is there a simpler solution ?

    P.S.: I have a static method which returns the type of the given csv file.

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

    If there is an address like something1.something2.com, what does something1 stand for and how is it created?

    Posted: 25 May 2021 12:47 PM PDT

    If I have a domain something2.com, how would I create something1.something2.com?

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

    fatal error LNK1120: 4 unresolved externals

    Posted: 25 May 2021 06:32 PM PDT

    Hello everyone,

    I'm trying to compile code and I get an error: unresolved external symbol funcName referenced in function main

    my current setup is that I have my Main.c file with #include "head.h" and int main(void){}. I also have another file called runCode.c which #include "head.h".

    Does anybody have any idea how to fix that? Thank you!

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

    website displaying ip address instead of domain name.

    Posted: 25 May 2021 06:01 PM PDT

    Hey! so to start off im going to explain everything I have going

    using debian

    Installed nginx

    using google domains (I will be using "example.com" and "my ip" to hide my info.)

    The domains work, for instance if I go to "www.example.com" or "example.com" they will both load my website. The tab of the page displays the correct info "example" but the url/address bar just shows "my ip" instead of "www.example.com"

    Im not using any software on the server, just nginx. Im completely new to this whole thing so maybe its a simple fix?

    thanks for your time.

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

    What programming language to use for dashboard style, multi-platform app?

    Posted: 25 May 2021 11:53 AM PDT

    I have an app idea that I would like to bring to life, but I'm not really sure where to begin with programming it.

    What I'm trying to develop is essentially a maintenance/service app for a specific industry. There are features down the road that I would like to add that do not exist anywhere at the moment and I feel like they have the potential to add a huge amount of value.

    The first part of bringing this to life would be taking all the existing data and features in my spreadsheet and displaying that information in a dashboard style web app similar to this.

    I have a very crude spreadsheet that contains all of my data. I manually enter data into the spreadsheet now and it automatically calculates and displays information based on this data. The data in my spreadsheet is driving reminders and highlighting certain items at specific dates and intervals.

    I would like to make data entry much easier and have a way to display the information in a much clearer and user friendly way.

    The first steps to get the ball rolling here would be:

    1. Build the dashboard and application to display my existing data in a clearer and easier to read format.
    2. Have a feature on the browser and in an application accessible from my phone to enter new data and display it in the above format.

    I would like for this to be accessible from a computer browser and from a phone browser or phone application (preferred). It would also have to be available on all platforms (Android and Apple).

    I have some basic Python and C++ under my belt and a very basic understanding of programming. Depending on how complex the initial programming will be, I may attempt it myself. Once I gain a deeper understanding of what's required and what exactly I'm trying to accomplish, I may just look at hiring out the development to keep the ball rolling.

    If I could get pointed in an initial direction on developing dashboard style services that are cross-platform, that would be great. I would also greatly appreciate any advice when it comes to developing a new app, program, etc. or hiring out development.

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

    In python is it better to use sys.maxsize or float('inf')?

    Posted: 25 May 2021 08:57 AM PDT

    For leetcode questions, you sometimes need a starting maximum or minimum for reference in solving the problem

    In python is it better to use sys.maxsize or float('inf')?

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

    C++ variable being overwritten

    Posted: 25 May 2021 01:06 PM PDT

    Hi guys, in my project I create a variable as follows

    static const char* key[32] = { genKey(32) }; 

    which works fine, it generates a key and can be displayed after generation, however, when I output the key further down in my project I get my key gets "scrambled" or corrupted.

    key after generation:

    42FCE922F48D3D0D6DCB1C118B9AD4984D980C414A8AAB39FC9E65C23AAB2D73 

    key further down the process:

    try 1: ╚⌂@☺╚⌂@☺ try 2: R39c74aa1d9bf6b71620182a55008c576 - Copy.jfif 

    I assume that I am incorrectly storing my key, but I'm not sure how. Any help would be greatly appreciated.

    Thanks in advance.

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

    What's a good all inclusive inventor kit that allows me to write my own code to move robotics or any add on peripherals?

    Posted: 25 May 2021 12:21 PM PDT

    The answer could be raspberry pi. I know of adafruit and their electronics kits. I kinda want a breadboard as well to learn about varying voltages and components. I recently bought a velleman p8055 but after soldering 200+ points and passed the circuit test. I found out it was only windows compatible.

    So I'm stuck because I have no experience. I want all kinds of experience and I'm willing to purchase a few different kits to expand my computer science. Can you all recommend some please? Mac OSX please

    I'm currently a student whose at the 2 year mark of learning computer science in college.

    Thank you.

    TL:DL can you recommend a fun kit to expand my computer science knowledge? Mac OSX compatible.

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

    Best javascript library for recording http interactions for cucumber testing for a react/rails spa?

    Posted: 25 May 2021 04:03 PM PDT

    I have a project that has a react front-end ui and a rails backend that the react app makes axios requests to. I'm in the process of writing cucumber-js tests for it using selenium and chromedriver. I want to be able to run the ui cucumber tests on jenkins without having to have the api running.

    For example - Say I run the cucumber-js test with selenium and it opens the index page of my react ui which makes a request to the rails api to get the index info. i would like to save that get request to read from it later.

    For rails cucumber I know the answer is to use the vcr gem to save the http interactions and use them later but I'm having a hard time figuring out a good solution for cucumber-js. I looked at using nock but that seems to only work with explicit http requests rather than ones made by the ui during the test so I don't think that would work unless I'm missing something?

    Thanks for any help!

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

    Problem: 403 forbidden fetching from dex guru with node.

    Posted: 25 May 2021 03:49 PM PDT

    Hi! Looking for a kind person to help out, please. The problem is that I am trying to fetch from https://api.dex.guru/v1/tokens using

     import * as fetch from 'node-fetch'; const method = 'GET'; const headers = { 'user-agent': 'Chrome/79', }; const result = await fetch('https://api.dex.guru/v1/tokens', { method, headers, }); 

    This is Nodejs. For some reason

    curl --user-agent 'Chrome/79' https://api.dex.guru/v1/tokens 

    works. Any help would be appreciated.

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

    Generic programming

    Posted: 25 May 2021 03:39 PM PDT

    Hi Are there any language doesn't support generic programming? ( Template ) If yes which are they and why they don't ?

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

    What is the 'CSS' of desktop apps?

    Posted: 25 May 2021 07:09 AM PDT

    For creating websites, you can use CSS. But what if you're creating a desktop app with say, the C language?

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

    Help with retrieving encrypted password

    Posted: 25 May 2021 10:52 AM PDT

    I have a problem with my script. As you can see I'm creating a change password script. And I use the standard password_hash() password_default as encryption method. But, my problem is retrieving it and let current password check for the current hash / password. It fails and returns an error code: Parse error: syntax error, unexpected identifier "password_verify", expecting "(" in: ***************************. Right now I need help with allowing my script to recognize the hash from the current password and see if it applies by using password_hash. If anybody can help me that'd be highly appreciated.

    Note: Some of you may warn me of SQL Injection. I am well aware of that thank you. But, I will look at that a later time.

    <?php
    session_start();
    if (isset($_SESSION["username"])) {
    $username = $_SESSION["username"];
    }
    $_SESSION["id"] = "1";
    $conn = mysqli_connect("localhost:3306", "Root2", "****", "****") or die("Connection Error: " . mysqli_error($conn));
    if (count($_POST) > 0) {
    $result = mysqli_query($conn, "SELECT password from tbl_member WHERE id='" . $_SESSION["id"] . "'");
    $row = mysqli_fetch_array($result);
    var_dump($row, $result);
    if password_verify($_POST["currentPassword"] == $row["password"]) {
    mysqli_query($conn, "UPDATE tbl_member set password='" . password_hash($_POST["newPassword"], PASSWORD_DEFAULT) . "' WHERE id='" . $_SESSION["id"] . "'");
    $message = '"<p style="color: white; text-align: center; width: 300px;">Wachtwoord is veranderd.</p>';
    } else
    $message = '"<p style="color: white; text-align: center; width: 300px;">Huidige wachtwoord is onjuist. Voer alstublieft de correcte wachtwoord!';
    }
    ?>

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

    If JavaScript's `HTMLElement` is just an interface, why can I write `HTMLElement.prototype`?

    Posted: 25 May 2021 02:14 PM PDT

    This question is spurred by this SO answer where OP is asking how to write web component classes in ES5. Basically you can extend HTMLElement, which seems bizarre to me, because the Mozilla docs define it as an interface and not a concrete type.

    Obviously, the element objects returned from document functions have their own underlying types; private classes. At least this is my understanding.

    Isn't accessing those types (i.e. HTMLElement.prototype) considered private API usage?

    Or, am I just misunderstanding the usage of the word "interface" here? The word itself can have many definition, but in programming it generally means one thing. Is that not the case here?

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

    How would one go about making a League of Legends companion app? Languages, time, effort etc

    Posted: 25 May 2021 01:23 PM PDT

    Hey guys! For my final year project I'm thinking of making something similar to a League companion app, like Blitz.gg or the op.gg client, but I'm not really sure where to start looking into, other than the Riot API obviously to gather the data about in-game stats and then some other API or what I assume web-scraping resource to gather build and champion data from a stats site or something.

    If there's anyone with knowledge on how these kind of programs would be made, any insight or help on getting started would be greatly appreciated.

    Thanks!

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

    ERR_CONNECTION_TIMED_OUT using Selenium and Cucumber in Azure

    Posted: 25 May 2021 12:52 PM PDT

    I am running a selenium cucumber application. If I run my tests locally it passes my tests pass as expected. If I run it on Azure on my release pipeline I get the following error: org.openqa.selenium.WebDriverException: unknown error: net::ERR_CONNECTION_TIMED_OUT

    Browser Version: 90.0.4430.212

    ChromeDriver 90.0.4430.24

    The site that I am navigating to works if I browse to it from my local browser. However I see that on azure the some tests fail with the error. If I have 15 tests about 10 will randomly fail with the error and the rest will navigate to the site fine.

    My code snippet:

    getDriver().get(url); Thread.sleep(10000); if (driver.findElement(By.tagName("body")).getText().contains("This site can't be reached") | driver.findElement(By.tagName("body")).getText().contains("ERR_CONNECTION_TIMED_OUT")) { driver.manage().deleteAllCookies(); Thread.sleep(10000); getDriver().get(url); } 

    I added the if statement after the fact because somebody suggested to clear cache.

    The url comes from cucumber side where I gave the example.

    Examples: | url | | https://uat.somesite.com/animal?nogeoredirect=1 | 

    The site is a UAT site but is publicly available with the ?nogeoredirect=1 added

    https://stackoverflow.com/questions/67679476/err-connection-timed-out-using-selenium-and-cucumber-in-azure

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

    Javascript cleaner shorter way of comparing instance to multiple instance types

    Posted: 25 May 2021 10:49 AM PDT

    if (item instanceof Tier1 || item instanceof Tier2 ){ // do something } the above Javascript checks if an object is an instance of one of two classes, named Tier1 and Tier2. There are a lot of classes as many as up to 10, what is the shorter or cleaner way to check if an object is an instance of one in a list of classes?

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

    Software or process to show logic flow

    Posted: 25 May 2021 10:22 AM PDT

    I am wondering if there are any good softwares or process flows to show logic flow in forms. Basically something that makes it much easier to code conditionals in a form based on certain information. Maybe something that melds design and logic? I haven't yet found a great solution here other than google sheets or lucid chart mind mapping. Are there any good suggestions here?

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

    No comments:

    Post a Comment