• Breaking News

    Tuesday, August 18, 2020

    Need help with writing a birthday message in code Ask Programming

    Need help with writing a birthday message in code Ask Programming


    Need help with writing a birthday message in code

    Posted: 18 Aug 2020 01:46 PM PDT

    Hi! My brother is a programmer and I thought it would be a neat idea to write a message in code on his card or cake. I know that he knows C++ and Java. How would I write a question followed by an answer? In either language, whichever is easiest.

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

    New Job Imposter Syndrome

    Posted: 18 Aug 2020 12:41 AM PDT

    I worked as a dev at Chase for years on only two applications. Around the pandemic, my team got let go. I got a new job pretty quickly, and was busting out issues in a Go app (a language I'd never used) in the first week, but they let the entire dev department go after my first month.

    NOW, I'm the third week into my latest position, working on a completely different application. It's driven through a custom built state machine, where a lot of things are only accessible in specific states. I've merged in two completed issues, but I've been stuck on my third issue for the past 5 days due to this state flow. Starting to get a little panicky. Anyone have experience with that feeling of imposter syndrome on their 3rd week at a new job? I feel like I should be doing more at this point.

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

    Can't really understand this section in Cpp primer[14.2.2 errors during input]

    Posted: 18 Aug 2020 10:03 PM PDT

    Do you know any cool algorithm visualizations on Youtube?

    Posted: 18 Aug 2020 08:15 PM PDT

    I really like Max Cooper - Transcendental Tree Map, https://www.youtube.com/watch?v=O7bKq03bAsg so, if anyone knows something similar

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

    Shipping API with Stripe

    Posted: 18 Aug 2020 07:53 PM PDT

    Hi all, Newbie here to programming in general, I have had freelancers build me a PHP Lavavel framework multi-vendor marketplace. Think eBay to a very niche market. I am looking for a shipping API in which a seller charges shipping on their item, the buyer pays for it, then the seller can print a label right there within my marketplace. Not sure how that really works with a multi-vendor marketplace that is C2C. Please excuse my unfamiliarity with it.

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

    How to Autoplay(embed) youtube video in SwiftUI

    Posted: 18 Aug 2020 06:51 PM PDT

    Im currently working on an app in SwiftUI and im hoping to embed a youtube video and auto play in swiftui. This seems like a difficult task and I haven't found much info on them. I managed to find a WKWebView workaround however it doesnt autplay the video and plays it in full screen,

    Is there a way to autoplay a youtube video in swift ui ?

    This is the code I got to work so far:

    struct WebView: UIViewRepresentable { func makeUIView(context: Context) -> WKWebView { WKWebView(frame: .zero) } func updateUIView(_ view: WKWebView, context: UIViewRepresentableContext<WebView>) { let request = URLRequest(url: URL(string: "https://www.youtube.com/watch?v=V_r5RCjRdqM")!) view.load(request) } } struct CardView: View { VStack { WebView() HStack { VStack(alignment: .leading) { Text(category) .font(.headline) .foregroundColor(.secondary) Text(heading) .font(.title) .fontWeight(.black) .foregroundColor(.primary) .lineLimit(3) Text(author.uppercased()) .font(.caption) .foregroundColor(.secondary) } .layoutPriority(100) Spacer() } .padding() } .cornerRadius(20) .overlay( RoundedRectangle(cornerRadius: 20) .stroke(Color(.sRGB, red: 150/255, green: 150/255, blue: 150/255, opacity: 0.1), lineWidth: 1) ) .padding([.top, .horizontal]) .frame(height:UIScreen.main.bounds.height*0.5) } } } 
    submitted by /u/kharlm12
    [link] [comments]

    What ide can I use to make a Windows application?

    Posted: 18 Aug 2020 09:47 AM PDT

    So recently I started Android app development, and I loved using Android studio. I was wondering if there is something for Windows application development that I can use Java with, in order to make UI for the application in such a convenient way.

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

    Rewriting C based app to run in windows?

    Posted: 18 Aug 2020 06:15 PM PDT

    I am currently working on a project involving heavy use of C for backend and java for the frontend. Currently it only builds in a linux environment. It also works on android based devices using NDK and JNI. However the easiest way to run it on windows devices is through something like a non-native compiler. From what I understand, visual studio does have the option for it, but im still not sure how to approach it after reading the documentation.

    Is it feasible to port it as a windows desktop application? The main goal is to make it easy for the end user to install and setup.

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

    How can I make a script that will copy XYZ folders and then paste them into one folder?

    Posted: 18 Aug 2020 06:10 PM PDT

    I'm working with shell script. Also, I would like to exclude a specific folder that is within one of my folders to copy.

    Pseudocode:

    rsync -av /Users/john/Documents # directory to copy /Users/john/Desktop # directory to copy /Users/john/Desktop/Backup32949324 # exclude this directory /Users/john/Desktop/Backup32949324 # copy the previous directories into here 

    Before Running Script:

    Backup folder is empty

    /Users/john/Desktop/Backup32949324

    Desired result:

    • Backup folder has Documents and Desktop folder

      1. /Users/john/Desktop/Backup32949324/Documents
      2. /Users/john/Desktop/Backup32949324/Desktop
    • This path does not exist.

      1. "...Backup32949324/Desktop/Backup32949324"
    submitted by /u/blacklambo78
    [link] [comments]

    How to get better at codechef/ competitive programming?

    Posted: 18 Aug 2020 05:14 PM PDT

    I am currently hovering around 2-3 stars (division 2) in codechef and I think I do alright in long challenges. However, I can't seem to improve and I don't know what resources I should be looking at/ books I should be reading to improve my score. I have read a decent amount of algorithm books, but most of the concepts behind the harder problems on codechef/ competitive programming don't seem to be covered.

    I mean if you are really good at competitive programming how did you get to that point? Does it require a deep understanding of math concepts or is it just hard work or an eye for patterns?

    submitted by /u/Say-WaddupMolePeople
    [link] [comments]

    Unable to use AJAX and AWS API Gateway to POST to an AWS Lambda Function

    Posted: 18 Aug 2020 04:50 PM PDT

    Hello,

    My code is to act as a 'digital url book' in html. Users enter a url in a text field and click a submit button. Upon submission, the url is sent to an AWS lambda function that records the entry in a DynamoDB table. Another AWS Lambda function reads the table and displays the entries in a list to the user.

    So far, I have been able to use AJAX and AWS API Gateway to GET the DynamoDB table contents for display, yet I am unable to configure the POST commands to call on the AWS lambda function that logs entries into the DynamoDB table. Whenever I run the code, AWS will show invocations on the Lambda function that reads the table, but never on the function that is to write/post to the table (even after clicking the submit button multiple times). The relevant portion of my html code is displayed below: upon loading the api it will GET the table contents and display them (no issue), yet the bottom portion after the click command does not work.

    <h1>Your URL List:</h1> <div id="sites"> </div> <h1>Enter Your URL</h1> <form> <label for="urls">url</label> <textarea id="urls"></textarea> <button id="submitButton">Submit</button> </form> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <script type="text/javascript"> var API_URL = 'https://wnq9rrdc37.execute-api.us-east-2.amazonaws.com/prod/sites'; $(document).ready(function(){ $.ajax({ type: 'GET', url: API_URL, success: function(data){ $('#sites').html(''); data.Items.forEach(function(urlbookItem){ $('#sites').append('<p>' + urlbookItem.url + '</p>'); }) } }); }); $('#submitButton').on('click', function(){ alert("Hello! I am an alert box!!"); $.ajax({ type: 'POST', url: API_URL, data: JSON.stringify({"url": $('#urls').val()}), contentType: 'application/json', success: function(data){ location.reload(); } }); return false; }); </script> 

    I have configured a mapping template in the integration request section of my POST command in AWS API Gateway. The template is as follows. Could this be the issue?

    { "url": $input.json('$.url'); } 

    I would greatly appreciate any insight on where I am going wrong with my code (permissions, html, ajax usage, api gateway, etc. - I am not sure).

    Many thanks!

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

    Help with a little (very tiny) problem

    Posted: 18 Aug 2020 04:36 PM PDT

    Hello, Fellow humans!
    I found this video https://www.youtube.com/watch?v=qTRW7ELhhME&t=170s in which they proof that: if you have a stick with a longitude L, if you cut that stick in two points, there's a chance of 25% that you will get three pieces to form a perfect triangle.

    I tried to do this with a practical example and I can't get that 25%. My result is about 19.3% all the time. Can someone explain to me what am I doing wrong?

    Matlab code: (Sorry but yes, Matlab, all I had at hand was matlab)...

    for i = 1 : 10000

    mu = 10000;

    A = rand(1,mu) ;

    B = rand(1,mu).*(1-A) ;

    C = 1 - abs(A) - abs(B);

    Cond = sum(double((C < A + B ) .* (A < C + B ) .*(B < C + A )));

    Prob2(i) = Cond/mu * 100;

    end

    mean(Prob2)

    Note: -----

    I expanded the code just for fun and to try something else (this part is not neccesary and I think is kind of wrong but, if you want, take a look). I thik with this last modification check It is getting out of my hands because the probability is even lower (about 11.3%)

    for i = 1 : 10000

    mu = 10000;

    A = rand(1,mu) ;

    B = rand(1,mu).*(1-A) ;

    C = 1 - abs(A) - abs(B);

    Cond = sum(double((C < A + B ) .* (A < C + B ) .*(B < C + A )));

    H =find(((abs( ( ( B.^2 + C.^2 - A.^2)./(2.*B.*C)))<1))==1);

    Theta = rad2deg(real(acos(( ( ( B(H).^2 + C(H).^2 - A(H).^2)./(2.*B(H).*C(H))))))); % Cosine theorem

    Alfa = rad2deg(real(asin((B(H)./A(H)).*sin(deg2rad(Theta))))); % Sine theorem

    Beta = rad2deg(real(asin((C(H)./A(H)).*sin(deg2rad(Theta))))); % Sine theorem

    ANG = sum((Theta + Alfa + Beta) > 179.9); % Alfa + Theta + Beta should add 180°. I specified 179.9 because I was getting something wrong.

    Prob(i) = ANG/mu * 100;

    Prob2(i) = Cond/mu * 100;

    end

    mean(Prob)

    mean(Prob2)

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

    What is the time complexity of concatenating to a stringstream?

    Posted: 18 Aug 2020 01:59 PM PDT

    If I have the following code in C++:

    stringstream s; for (int i = 0; i < n; i++) { s << 'a'; }

    Would each insertion take O(1) time or O(n) time? Would the whole thing take O(n) time or O(n2) time?

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

    Storing huge data with C#

    Posted: 18 Aug 2020 12:09 PM PDT

    I am trying to make a Windows application. It will be storing data of around 2000 objects, with around 15 data members for each object. I do not know how to build a database. Is there any way I can do it in Visual studio, using C#, without database (Like shared preferences in Android studio)? If not, it will be great if you could give some resources how to build one. I want to create a software that takes all the objects and stores everything in a computer locally, I'm not even sure if a database is the best way to go.

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

    Which should I go for, React Native or Flutter?

    Posted: 18 Aug 2020 11:15 AM PDT

    I have been a Full-stack web dev for a long time, so I'm much more familiar with JS.

    I have been thinking about native mobile app dev now, but by doing some searches on google, I'm literally getting confused which should I go for?

    Obviously, I'm not think about native android/ios. I looked at flutter, though Dart is gonna be a complete new lang for me, but it's easy, and so Flutter.

    On the other hand, react-native is like homie to me since it's JS, but researches shows less performant than flutter.

    I just want to learn quick small android/ios app projects, which will use some native APIs like camera, geolocation etc, so what would be your suggestion to go for?

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

    ELI5 (or close to it): What is Segment Heap?

    Posted: 18 Aug 2020 10:58 AM PDT

    I came across this paper on a memory allocation technique called Segment Heap:

    https://www.blackhat.com/docs/us-16/materials/us-16-Yason-Windows-10-Segment-Heap-Internals.pdf

    Reading through this paper, it's unclear to me what exactly this entails, does anyone have an explanation and/or a pointer to something that gives a bit more in terms of explanations?

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

    What are fundamental things web devs should know?

    Posted: 18 Aug 2020 10:28 AM PDT

    I'm a general software developer who after some time is focusing more and more on frontend web developer. I'm about to start a new job where I'm the only frontend developer hired on and everyone else considers themselves full stack.

    I was wondering if someone could post a good list of fundamental things that frontend developers should know which would help me grow into a specialist of sorts in my new company.

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

    MapTiler Question (JavaScript, HTML)

    Posted: 18 Aug 2020 10:06 AM PDT

    Hi, I have integrated such a map from MapTiler (OpenStreetMap) into my website. (https://youtu.be/wVnimcQsuwk)

    Is it possible that when I click on the map, the exact coordinates are copied or displayed from there? (I use LeafletJS)

    Thanks in advance!

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

    git Push not working

    Posted: 18 Aug 2020 07:39 AM PDT

    Today is my first attempt created a branch and then pushed a folder to gitLab.

    After many attempts with errors[I have too many so I don't past it here cos the latest shows some promise that it is working]...I am still not getting it right.

    git merge mybranchNsme - -no-ff

    it shows Already up to date

    git branch -a

    shows that I have 2 names there <code> xxx 619432d4 first abc Xxx1 619432d4 first abc </code>

    But, at GitLab I don't see my folder being pushed up

    All it appeared at GitLab is this line : You push to BranchName 1 hour ago

    How do I make the folder push to my new branch?

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

    Trouble converting cURL request to postman

    Posted: 18 Aug 2020 02:26 AM PDT

    I have a request with the following: curl -D- -G https://api-sandbox.getviia.com/v1/oauth/connect -d "client_id=clientID" -d "redirect_uri=clientCallback" -d "response_type=code" which returns 302 as expected but I have a hard time converting it to a postman request.

    If I use the import function it gives me the error: "Error while importing Curl: Only the URL can be provided without an option preceding it.All other inputs must be specified via options."

    If I add them as x-www-form-urlencoded it gives me 400:"{ "error_description": "ClientId: 'Client Id' must not be empty.\r\nRedirectUrl: 'Redirect Url' must not be empty.\r\nRedirectUrl: The specified condition was not met for 'Redirect Url'.\r\nResponseType: 'Response Type' must not be empty.\r\n", "error": null, "errors": [ "ClientId", "RedirectUrl", "RedirectUrl", "ResponseType" ] }"

    and if I add them as Q parameters I get 200 (but that's not what I am expecting).

    So I'm only getting the correct response while using the commandline and I'm failing to convert it to a postman request - anyone know what I'm doing wrong?

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

    Automation with Microsoft Test Manager and Selenium?

    Posted: 17 Aug 2020 11:47 PM PDT

    Hey guys! I need some advice.

    I have to look into feasible ways of implementing automatic tests.

    I work for an ISP and, for example, one test case would be testing the web interface of any given router.

    I managed to record the button clicks with Selenium IDE and now I have the exported code base (Python in Visual Studio Code) of the test.

    My question is as follows:

    Can it somehow be implemented with Microsoft Test Manager 2017 (so that it passes the test if an expected thing happens)?

    What would be the "easiest to grasp" framework to do something like this? I have little experience in coding but am willing to learn anything.

    Can someone point me in the direction I should be looking to accomplish something like automated tests via Test Manager and a browser based automation software like Selenium IDE?

    Much appreciated. Thomas

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

    Question about repeatedly querying multiple sites for specific information on item stock/availability.

    Posted: 17 Aug 2020 11:15 PM PDT

    There are a number of sites that I'd like to be able to track when items come back into stock as their email alerts are totally worthless, often 12-72 hours after the item was put back for sale on the site, so they are out of stock by the time the emails are sent.

    All of the sites have a page dedicated to each item and they all will list "out of stock" or "unavailable" when appropriate. Some of them will list "in stock" or "Available" when it's able to be ordered, but some of them don't show anything in this field when it is available - though these sites WILL always list "out of stock" when it isn't in stock - so I guess that could be used to identify availability.

    Now I've identified the location of the code in the "elements" and also in the source code, though both seem to have very different looking code that I no longer understand (I'm very confused by the "elements" section and how the code on that section works compared to the pages source code).

    All of these sites run some kind of shopping cart software and I'm guessing many of them are custom made (though IDK for sure) as some of them are big companies, so I'm not sure how it would be possible to query the site to ask for product info (or would I just query the page?) - and then have the app/script report back what it finds - or only give an alert when it finds things in stock.

    I'm thinking this might be possible if I were to be able to request the page for the item and then have a script that looks for the section of source code or w/n the elements that says available or out of stock, so it would run this continuously (or every XX mins) until it finds what it's looking for.

    I'm wondering how difficult something like this would be to write, and if something like this could be created where new items/pages could be easily added if I am able to identify the correct section of source code that would need to be found to identify the availability properly.

    If this could be made into a web app, that would be awesome, but also something that runs on the desktop is fine (even if just in the command line). I have no idea what kind of language would be best for this and what area of expertise I should look for to find someone who might be able to develop something like this.

    If anyone is interested I think there's a good possibility that I could raise some $$ to develop this. It doesn't need to be pretty, just functional, and honestly, if it's a little difficult that's better b/c it will keep some people from distributing it if they don't understand how to modify it for their own items.

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

    Java as a first programming language

    Posted: 18 Aug 2020 02:57 AM PDT

    Hello guys!

    I am studying a computing and IT degree (software route), and it looks like they have picked Java as the main programming language.

    They showed us a little bit of Python before (where they told us how popular Python is), but now we have an entire module for Java.

    My question is: it looks like the most popular languages out there are Python and JavaScript. So, do you think Java is still a good choice?

    Best in mind that I'm pretty new programming, etc.

    Thanks I'm advance

    submitted by /u/Free-_-Yourself
    [link] [comments]

    No comments:

    Post a Comment