• Breaking News

    Friday, April 30, 2021

    What's the fastest you've ever been rejected by an interviewer? Today was 2 minutes into my interview. Ask Programming

    What's the fastest you've ever been rejected by an interviewer? Today was 2 minutes into my interview. Ask Programming


    What's the fastest you've ever been rejected by an interviewer? Today was 2 minutes into my interview.

    Posted: 30 Apr 2021 11:56 AM PDT

    The guy started by saying "I don't know why I'm being brought into to interview you..." Then later he was basically saying good luck and good bye but 2 minutes in. I forced him to stay on the line to try and sell myself to him but I felt like a used-car salesman.

    It stings all the more because I got the interview with this person who didn't want me by impressing a much higher up person who conducted the last interview. The higher up was an executive but made it there via true-engineering and wasn't a pure business guy. Similar to someone like Bill Gates who was an engineer and technology expert but also moved up until he managed much more than he programmed. So I guess it sucks more because I survived Bill Gates but was rejected by a lower-level engineer. Oh well though, life goes on.

    I still have to tell the guy thanks because he was cordial and nice so I'll make sure to tell him that I'm grateful for his time. But yeah, sucks to fall hard on my face at the finish line.

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

    need a baseline to get started on a python project

    Posted: 30 Apr 2021 10:56 PM PDT

    I want to write a script that parses/reads the top voted posts in a music subreddit ( r/music for example ) and find the equivalent youtube videos/songs for it and then updates a playlist with a particular granularity ( say every 24 hours or every week ). I am fairly new to Python and pure programming in general and was wondering if there is a template somewhere that I can refer to if I get stuck or take pointers from. Thanks

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

    How to open a new tab with a certain URL and close the current tab?

    Posted: 30 Apr 2021 10:31 PM PDT

    javascript

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

    Starting software dev bachelors program with two emphasis in c# or Java, which one should I choose?

    Posted: 30 Apr 2021 08:31 PM PDT

    I've been reading online and it seems like Java is used a lot more. But c# can do more advanced things. So for those of you who are more involved than me, what would you recommend? What considerations would you suggest?

    For personal projects I want to:

    I definitely want to be able to build mobile apps.

    I definitely want to do some web development

    Do some indie game dev

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

    Is it possible for a process to take the same amount of time to complete every time?

    Posted: 30 Apr 2021 02:53 AM PDT

    For context, we're using a web application in our work. Not sure which programming language it's built on. We use it to save text and upload images. Before, if we just save a text it usually just takes a minute to save. Sometimes it'll take longer depending on the amount of images we upload.

    Then suddenly two weeks ago our saving process became so slow. After some more saving I noticed that it took exactly 30 minutes to save. It doesn't matter if I save just a text or if I save multiple images, always 30 minutes.

    Is this possible? I just find it weird that it always took the same amount of time no matter how much I'm saving to complete.

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

    Conceptual Relational Database Question

    Posted: 30 Apr 2021 04:31 PM PDT

    Hey all,

    I am trying to find the best way to do this in my head, but I keep running into various walls.

    It is a fairly simple question, but not sure how to achieve it - let's say I'm making a table to hold incoming orders, what we're primarily interested in right now is the product_id and the quantity.

    Now, I will want to know from where I will fulfil this order - whether it's warehouse A or warehouse B. However, I might not have it in either of the warehouses and will have to fulfil it from the container A. So, ideally, I would want some fulfil_from column to exist. The problem is that this column cannot have a foreign key constraint in that case as it can reference to either my warehouse table or my container table.

    Now, I've been thinking about this and the only thing that comes to mind is making another column to differentiate between two types of fulfilment, so the fulfil_from isn't a foreign key, but the new column (let's say fulfil_type) is and is referencing a new table that has two entries - one for each type of fulfilment. But this looks like complication + beating the purpose of it.

    Are there any suggestions for a more elegant approach to this?

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

    How to plan a path?

    Posted: 30 Apr 2021 06:20 PM PDT

    Given a set of randomly linked nodes such as https://i.imgur.com/NZ4vrKV.png, what is the recommended way to find a path between two arbitrary nodes? At each point you are only aware of the nodes you directly link to, and the previous nodes you've seen.

    I can't even find the name of an algorithm to use for this and my own ideas feel like they would be awfully inefficient. There has to be a good way to do this but my own research has stalled.

    Grateful for some advise, even the name of a method to look up.

    Thanks

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

    Why is this random character generator always producing the same character?

    Posted: 30 Apr 2021 05:56 PM PDT

    Maybe i'm missing something.

    I made a function that is supposted to generate a random character using std::crono and mt19937. The character set has 62 unique characters, however, the only character the function seems to produce is 'B'. The idea is that this function is supposed to generate a random character that can be found within the charset, but has a numeric value of less than or equal to a given numeric value.

     char kw_cypher_get_next_character(char charset[], double current_cypher_numeric_value) { std::random_device kw_rand_device; char kw_next_character; bool kw_character_is_valid = false; std::mt19937::result_type seed = kw_rand_device() ^ ((std::mt19937::result_type)std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch() ).count() + (std::mt19937::result_type)std::chrono::duration_cast<std::chrono::microseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count()); std::mt19937 gen(seed); do { std::mt19937::result_type val; val = gen() > std::mt19937::max() - (std::mt19937::max() - (sizeof(charset) - 1) % sizeof(charset)); if (val <= sizeof(charset) - 1) { kw_next_character = charset[val]; kw_character_is_valid = true; } } while (kw_character_is_valid == false); return kw_next_character; } 

    Can someone explain to me what i am doing wrong and why it always comes up as 'B'? thanks

    EDIT: I figured it out!

    Switched to Uniform_int_distrobution, and a < needed to be a > in a if statement.

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

    Why isnt $JAVA_HOME variable working

    Posted: 30 Apr 2021 05:43 PM PDT

    I have the JAVA_HOME env variable set in .zshrc

    ... export JAVA_HOME=/usr/lib/jvm/java-16-oracle ... export PATH=$PATH:$JAVA_HOME/bin ...

    jdk 16 is installed correctly, checked, its also in the right directory (ubuntu /usr/lib/jvm)

    other environment variables are printing correctly, its just that echo $JAVA_HOME is printing nothing, dunno why

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

    Trying to figure out how Rockstar achieved their vehicle engine audio for GTA V.

    Posted: 30 Apr 2021 05:22 PM PDT

    So this might be a dumb question to ask, but it is something I've wondered a lot about and don't really know the right terms to look into this further, nor the knowledge to try and attempt it without any references. And this is in my opinion, the only place relevant enough to give an input so.. here goes.

    I noticed when looking around inside the vehicle engine files for a couple of cars in GTA V, that it uses 3 main audio clips; one for idle, one for acceleration, and one for deceleration. Typically from what I've seen in the past, most games use multiple sound clips for; low revs, mid revs, high revs, etc. So I'm unsure of how you'd go about using a single sound clip to cover the entire rev range without it sounding janky in some way. (Again I don't have a very good range of knowledge on this, so apologies if this is kinda obvious)

    I'm hoping that I could try and make a similar system, so any input on this would be highly appreciated as I'm honestly not too sure where to go from here. Additionally any links, sources or ways this could be achieved would be also very greatly appreciated.

    Thanks.

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

    What is the easiest way to add a payment service in developing countries?

    Posted: 30 Apr 2021 01:23 PM PDT

    Hey guys! My cousin has a bigger clothing shop in a third world country. They do not have paypal or credit cards and cannot use their bank accounts for online banking. Since he gets many requests from europe and the US he asked me if I could help him integrate a payment solution. Unfortunately I do not know how and he does not use smth like shopify where theres a built-in solution. Any ideas on how we could solve this?

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

    Why doesn't this script download file when a new tab is open at its right?

    Posted: 30 Apr 2021 08:27 PM PDT

    function download(filename, text) { var element = document.createElement('a'); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); element.setAttribute('download', filename); element.style.display = 'none'; document.body.appendChild(element); element.click(); document.body.removeChild(element); } 
    submitted by /u/hwpcspr
    [link] [comments]

    Maybe stupid question... OpenID is very coupled for users... But imagine I wanted a OpenId for objects (barcodes as identifiers) does it make sense?

    Posted: 30 Apr 2021 02:41 AM PDT

    Imagine that I wanted to be able to authenticate and identify objects with a openID flow, allowing for integrations and usage of different partners...

    Using identity4.

    Do you think that it is viable.. or should create a in house solution?

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

    Code Test Preparations.

    Posted: 30 Apr 2021 03:08 PM PDT

    I am interviewing for a job and have a code test coming up this week. This company works with e-commerce solutions and the developers program mostly in Java and use SQL for their storage. The code test will be written by hand without the help of the internet and the only description I have of the task, so far, is "The task will be to implement a solution that can be used by a customer. It can be anything from getting information, updating files, or transferring data between files. Something you'd run into daily working here.".

    I honestly have no idea how I can prepare for this interview in any way other than sharpening my SQL skills and writing a little Java code just for the sake of it. I have no prior real-life work experience and I am wondering if any of you veterans out there might know what I can expect from an interview such as this one or how to prepare for it better? Any techniques, libraries, or APIs that I should know about?

    I am thankful for any help or comments.

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

    Inputs Scrambled? Virtual Key input in Java vs. Python/C++

    Posted: 30 Apr 2021 02:42 PM PDT

    Hello,

    A few weeks ago I posted this question https://www.reddit.com/r/AskProgramming/comments/mpise3/javas_robot_vs_c_win32_for_keyinput/
    which was very helpful, and using the suggestions there I've managed to track down what -should- be a solution, however what I'm finding is that my inputs are scrambled in both Python and C++.

    For example, using Java this works as expected:

    press_key(KeyEvent.VK_NUMPAD8); void press_key(int key){ robot.keyPress(key); } 

    However, when I use that same keycode (or the hex value, 0x68 in this case) in Python or C++:

    Python:

    def SendInput(*inputs): nInputs = len(inputs) LPINPUT = INPUT * nInputs pInputs = LPINPUT(*inputs) cbSize = ctypes.c_int(ctypes.sizeof(INPUT)) return ctypes.windll.user32.SendInput(nInputs, pInputs, cbSize) SendInput(Keyboard(0x68)) 

    I'll spare you all of the additional code, I'm using what I found here: https://stackoverflow.com/questions/11906925/python-simulate-keydown

    C++:

     INPUT ip; //Set up the INPUT structure ip.type = INPUT_KEYBOARD; ip.ki.time = 0; ip.ki.wVk = 0; //We're doing scan codes instead ip.ki.dwExtraInfo = 0; //This let's you do a hardware scan instead of a virtual keypress ip.ki.dwFlags = KEYEVENTF_SCANCODE; ip.ki.wScan = 0x68; //Set a unicode character to use (A) //Send the press SendInput(1, &ip, sizeof(INPUT)); //Prepare a keyup event ip.ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP; SendInput(1, &ip, sizeof(INPUT)); 

    So with the C++ and Python implementations, I'm able to send the input, however the key codes are scrambled - in the same way, at least

    For example, When I send 0x4D ('M') I get an input that is either D or NUMPAD6 (They do the same thing). However that's only for in-game inputs. The games chat window accepts the inputs as expected.

    Does anyone know why Robot is unscrambled, and C++/Python are? I guess they're operating on different levels of the OS but I don't know enough about the hardware and drivers to do anything about that.

    Based on the responses from my previous question, I expected Robot to basically convert the Virtual Keys to scan codes. Or maybe I have this all backwards! Any point in the right direction is appreciated

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

    When Yelling at The Sound Sensor the Speaker Plays? (Arduino)

    Posted: 30 Apr 2021 08:22 AM PDT

    Hi! It's my first time trying to code anything at all and my second time messing with an Arduino. I've connected an SD card and a sound sensor, the Idea is when someone exceeds a threshold (yells) the speaker plays a sound file from the SD card.
    They all work, I have played songs through the SD card, and I have connected the sound sensor that responds to the decibels. but I don't know how to code it. I've tried to combine a code that lets you play .wave files from the SD card and another code that I've used before which moves a servo motor when you clap your hands near a sound sensor. As expected that didn't work.
    If you could help me with the code I'd be grateful.

    The sd card is connected like this -Make an Arduino Project that Speaks / Reacts - YouTube 1
    5V- 5V
    GND-GND
    CS- PIN 4
    SCK- PIN13
    MOSI- PIN 11
    MISCO- PIN12
    I soldered and wired Speaker as shown too, all works and I can play sound files.

    The sound sensor connected like so- GND-GND, + TO +, and A0 to PIN A2. And it responded well.

    here's the code-

    #include <SD.h> //include SD module library

    #include <TMRpcm.h> //include speaker control library

    #define SD_ChipSelectPin 4 //define CS pin

    int sound = A2;

    int soundCounter = 0; // counter for the number of times sound was picked up

    int soundState = 0; // current state of sound

    int lastsoundState = 0; // previous state of the sound

    int speaker = 9;

    const int threshold = 200;

    TMRpcm audio; //crete an object for speaker library

    void setup() {

    pinMode (sound, INPUT);

    pinMode (speaker, OUTPUT);

    audio.speakerPin = 9;

    Serial.begin(9600);

    }

    void loop() {

    // put your main code here, to run repeatedly:

    // read the sound sendor input pin:

    soundState = digitalRead(INPUT);

    if (soundState != lastsoundState) {

    // if the state has changed, increment the counter

    if (soundState == HIGH) {

    soundCounter++;

    Serial.println("on");

    Serial.print("number of times sound is picked up: ");

    Serial.println(soundCounter);

    }

    else

    {

    // if the current state is LOW then the speaker went from on to off:

    Serial.println("off");

    }

    // Delay a little bit to avoid bouncing

    delay(50);

    }

    int statusSensor = analogRead(sound);

    if (statusSensor >= threshold){

    (soundState == HIGH) ;

    !SD.begin(SD_ChipSelectPin);

    digitalWrite(speaker, HIGH);

    audio.setVolume(6.9); //0 to 7. Set volume level

    audio.play("2.wav"); //the sound file "1" will play each time the arduino powers up, or is reset

    }

    else{

    (soundState == LOW);

    digitalWrite(speaker, LOW);

    }

    }

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

    NodeJS/Typescript/Completely new stack

    Posted: 30 Apr 2021 11:43 AM PDT

    Hey folks so I've been looking everywhere for someone to help me so I've turned to reddit to find a solution.

    I'm a University student whom has limited experience with coding, I've done a few projects here and there so I know the basics of programming however I've taken on a project way outside my wheelhouse. It's not paid and it's for a friend.

    The software is created using Node however it uses other stuff like Puppeteer. I'm outside of my comfort zone as usually I see a main method in which kicks everything off. With this I can see a main.ts which seems to open up a listener from the bootstrap method. However I have no idea how the other functions in the project are called.

    I'm looking for anyone with experience with node that could hopefully give me a helping hand. As I said I'm completely out of my comfort zone so there could be a lot of work for whoever (if anyone) is willing to help. I'd be more than happy to compensate you for your time! (I'm treating this as a learning experience so don't mind parting with some cash for some help).

    I can give much more specific information about the project if it interests you. I'm unsure if this is the right place for this kind of post however I'm getting to desperation station! Any advice is welcomed!

    Thanks! :)

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

    Documenting FE API usage

    Posted: 30 Apr 2021 11:42 AM PDT

    This is work related and wasn't sure where to put it, but figured I'd ask here. What frameworks (or do you even) document the usage of an API on the FE of your application? We use Swagger for documenting the existence of end-points and what data is returned on the BE, but we're trying to figure out internally how those end-points are actually used for purposes of presenting to the higher ups ( for e.g. during reworks and migrations, what pipelines need to be preserved, which can be cut, etc ). Obviously this could be a schema (just some way of noting in the code) rather than a scraping tool, but am curious if this is done anywhere else.

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

    Connection options from a React Native app to a REST API

    Posted: 30 Apr 2021 11:32 AM PDT

    We are planning to build a React Native application which is supposed to communicate with a REST API on our backend. We aim to have a Spring based API running on a laptop, for instance, where multiple instances of the application should be able to connect and exchange information

    We considered three options -

    1) If we host it on our own computer, then we assume that the IP for that would need to be static and should not involve DHCP. We are not sure whether that is feasible, and we do not have much technical knowledge to start off with on this. Is this an approach which could be feasible, and if so what are the things we should be aware of?

    2) We of course could host it on the cloud, like on an AWS instance, but we are starting off and are low on budget (very xD). We would definitely want to start off with the free tiers and scale it up in the future, but is there a more cost effective option than going down this route?

    3) Could we leverage some P2P libraries, like WebRTC or Socket.IO for this purpose? Again, we have a basic understanding of these topics but lack the judgement to determine whether it is something that is going to be workable in the short term and feasible if and when we want to scale the app in the future.

    Any insights or comments on this will be highly appreciated. We acknowledge that we probably lack the technical expertise at this point of time to pull the entire thing off, but are willing to learn. If there are maybe any other libraries/frameworks that might be more suitable, please do suggest the same.

    Thanks! :))

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

    [HELP] How to always save file in the same directory as script, regardless of OS?

    Posted: 30 Apr 2021 11:02 AM PDT

    Hi, how can I make my program save a basic file output in the same directory as it's source file, regardless of my OS? I know there exists os.path and pathlib but I don't understand the docs...

    Code snippet:

    dataFile = open(dataFileName, "a") dataFile.write(dataFileString) dataFile.close() 
    submitted by /u/3Domse3
    [link] [comments]

    How to learn elm/rust/gleam?

    Posted: 30 Apr 2021 10:41 AM PDT

    My partner is a programmer. I dabbled a bit in html, cs and java a while ago.

    When he speaks of anything programming related I don't understand the half of it. I would like to be able to 'get' what he talks about, to understand his passion a bit better.

    He's most interested in 'uncommon' languages such as elm, rust, gleam. Which one would be easiest to "dive into"/learn - if that's 'possible' at all without much background knowledge? Any good resources you recommend?

    I don't think I have a very 'techy' brain, more of an artistic person, so please be mindful of that in your replies :'D Thanks a lot.

    submitted by /u/G1n-a
    [link] [comments]

    Programming Language and Idea Feasibility Question

    Posted: 30 Apr 2021 09:03 AM PDT

    Hi all, hoping someone can assist me.

    I manage Advertising for Amazon sellers. It's very similar to Google ads where I essentially increase/decrease bids on what is known as the Amazon Advertising Console.

    I base my decisions on the metrics that are in front of me on the screen in the web browser and I compare that information over different date ranges.

    So what I'm wondering is, is there a way to program a web extension or a tool that maybe scrapes the data from the Amazon Advertising Console web pages and that adjusts the bids for me based off a set of rules that I provide (e.g. If Clicks is greater than it equal to 8 in last 30 days, reduce bid 10%).

    If so, what programming language would be most beneficial? What would the technique or process be called?

    I realise there are already tools for Amazon Pay-per-click however they lag behind the current Amazon Advertising capabilities and even alongside using one of those tools currently requires a lot of manual bid adjustments. I believe it's because they use the Amazon API which is slow at updating new features.

    That's why I wonder if there's a way to simply use the data that is already on the screen as opposed to an API.

    Any help here would be massively appreciated.

    Edit: Here's a link of a screenshot to show what I mean by Amazon Advertising Console.
    https://drive.google.com/file/d/1p9XxORDx-Ihxz6FVYGYgUwi3ODVcPhc7/view?usp=sharing

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

    Portable Git-based Project Manager

    Posted: 30 Apr 2021 05:08 AM PDT

    Hey Guys!

    does anyone know a portable(for external drives/usb) Project Manager tool that uses git and is somewhat similar to GitLab(repo, issues, merge-requests, ci/cd? - but no groups/teams etc.)

    Platform: osx/win10.

    does a tool like this even exists?

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

    How can i create an VR world viewer using HTML and javascript

    Posted: 30 Apr 2021 08:45 AM PDT

    so basically trying to develop an application which shows a VR view of your current position in the world. i want the application to download from an OpenStreetMap (OSM) data from a GeoJSON-based API and should render different types of object using different geometries and models. For example, roads can be rendered as simple lines, trees as a simple model of a tree (or at the very least, a cylinder topped by a sphere) and pubs, restaurants and cafes as models of a building (or at the very least, a box of appropriate size). Ideally, points of interest should have the POI name rendered on the surface of the model or geometry used to represent the building.

    submitted by /u/Ok-Nefariousness2568
    [link] [comments]

    Something like wake on Lan but different

    Posted: 30 Apr 2021 08:28 AM PDT

    Hi,

    I have a computer and want to start it if I hold a nfc tag near my smartphone. The problem is that my motherboard doesnt seem to support WoL and I cant change something on the router. So I came up with the idea that when I scan the nfc tag, the smartphone sends a ping to my Raspberry Pi and he is connected to the starter cables of the motherboard of the PC and start it.

    So I need a way so that the Pi can see that he got pinged, but I didnt found a working command. Did someone have one??

    (Sry for the language btw)

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

    No comments:

    Post a Comment