• Breaking News

    Tuesday, August 11, 2020

    Way to build an app in which user fills a form that can be downloaded or emailed as a PDF? Ask Programming

    Way to build an app in which user fills a form that can be downloaded or emailed as a PDF? Ask Programming


    Way to build an app in which user fills a form that can be downloaded or emailed as a PDF?

    Posted: 11 Aug 2020 04:31 PM PDT

    I'm working on an app through Phonegap (written in HTML/CSS/JS) that's intended to have the user fill out a form (radio buttons, text boxes, etc.) which will then be either downloadable (as PDF) or simply sent to a specific email upon completion (as a PDF).

    I've been using a JavaScript function that prints the page as a PDF that's automatically downloaded at the click of a button on the bottom of the page.

    But I've noticed that the Print to PDF function doesn't seem to be a true PDF in the sense that I can't highlight the printed text within the resultant PDF. Additionally, the amount of information in each print seems to have a limit. I can't get it to print content on the page beyond a certain length. I also am not sure that this works on mobile, but it seems to work when tested in the browser on Chrome (with some issues).

    What's the best way to create a PDF after the user fills out the form? I've read that I can maybe create something server-side and have the app send a PDF (via email) from a server after the user fills out the information on the page. Does this sound right?

    Can I make it so that the user fills out the information in the app, clicks a button, and then the information on the app is saved and a PDF of said information is sent via email? I'm not quite sure how to set up a server to do this if even possible.

    Simply, I just want my clients to fill out the info in the app, and then click a button on the bottom of the page that then takes that information and spits out a PDF. I'm having trouble finding an effective way to actually do this.

    Here's my code thus far (sans head, CSS):

     <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/dom-to-image/2.6.0/dom-to-image.min.js" integrity="sha256-c9vxcXyAG4paArQG3xk6DjyW/9aHxai2ef9RpMWO44A=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.5/jspdf.min.js"></script> <div id="content2" class="app"> <h1><u>4-Point Inspection</u></h1> <br> <div class="border"> <center><form> <label for="fname">Insured/Applicant Name</label> <input type="text" id="fname" name="fname"><br><br> </form></center> <center><form> <label for="fname">Application/Policy #</label> <input type="text" id="fname" name="fname"><br><br> </form></center> <center><form> <label for="fname">Address Inspected</label> <input type="text" id="fname" name="fname"><br><br> </form></center> <center><form> <label for="fname">Phone</label> <input type="text" id="fname" name="fname"><br><br> </form></center> <center><form> <label for="fname">Actual Year Built</label> <input type="text" id="fname" name="fname"><br><br> </form></center> <center><form> <label for="fname">Email</label> <input type="text" id="fname" name="fname"><br><br> </form></center> <center><form> <label for="fname">Date Inspected</label> <input type="text" id="fname" name="fname"><br><br> </form></center></div> </div> <center><button class="btn btn-info" id="downloadPDF">Download PDF</button></center> <script>$('#downloadPDF').click(function () { domtoimage.toPng(document.getElementById('content2')) .then(function (blob) { var pdf = new jsPDF('l', 'pt', [$('#content2').width(), $('#content2').height()]); pdf.addImage(blob, 'PNG', 0, 0, $('#content2').width(), $('#content2').height()); pdf.save("test.pdf"); that.options.api.optionsChanged(); }); }); </script> 

    Here's the Javascript function (also shown at the end of the above code):

    $('#downloadPDF').click(function () { domtoimage.toPng(document.getElementById('content2')) .then(function (blob) { var pdf = new jsPDF('l', 'pt', [$('#content2').width(), $('#content2').height()]); pdf.addImage(blob, 'PNG', 0, 0, $('#content2').width(), $('#content2').height()); pdf.save("test.pdf"); that.options.api.optionsChanged(); }); }); 

    I simply want a way to turn this interactive form into a PDF that's either downloadable or just emailed to a specific email address - I just don't know the most effective way to do this.

    Any and all help/recommendations would be deeply appreciated. Thanks!

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

    Is there a way to see the flow of your code?

    Posted: 11 Aug 2020 06:59 PM PDT

    Hey everyone, I'm a highschool student learning programming. I like it a lot but it gets messy fast. I know about UML to structure everything but is there a plugin for eclipse or a tool that lets you see what's happening from the second you hit 'run' to the time you terminate?

    Like being able to see when a method references a variable would be great. Sometimes I make small mistakes that could be solved SO much faster if I could see what happens...if that makes sense.

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

    What is the logic and process are like behind websites like Skyscanner and Google Flights? How do they get all the info from different airlines, prices and consolidate them into their own website?

    Posted: 11 Aug 2020 08:38 PM PDT

    Hi there.

    I am thinking about an idea of doing something similar, which is to consolidate a list of prices (some other product) from different sources. Do they have an API to call from different airlines through some collaborations?

    Thanks

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

    using references when creating projects

    Posted: 11 Aug 2020 06:57 PM PDT

    To start off, I have only been learning python and some command line in Kali Linux (i didn't really set up a path for myself to follow) and I feel I have a good grasp of how python works from a beginner's perspective of course. The point I am trying to make is that I can do some things from memory which are very basic but for things I did not hammer in as much with repetition I keep using references or reading notes I took when studying, is this normal for people who code all the time or will my memory with the languages I learn get better? It really is kind of worrying to be honest cause it feels as though if I wanted a career in any tech field I would need a pocket reference to do anything

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

    What was the most impossible task your manager asked you to do?

    Posted: 11 Aug 2020 04:20 AM PDT

    Edit: also say how you responded

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

    Trying to deploy locally with Chalice

    Posted: 11 Aug 2020 09:32 PM PDT

    Hi everyone,

    I've been trying to learn about APIs using AWS and python and the video I'm following has me using Chalice to deploy projects, but every time I deploy locally with 'chalice local', the prompt freezes and I cannot even ctrl-c out of it. I've looked up the issue and can't find an answer, anyone have any experience with this issue? FYI, 'chalice deploy' seems to work fine.

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

    How to deploy your rest api

    Posted: 11 Aug 2020 07:48 PM PDT

    I recently build a rest api using nodejs that accesses data from a csv rather than a database. How would I deploy the api with the csv even though its fairly large. Would I be better somehow transporting the CSV to a mongoose database maybe? Id really rather just launch exactly what I have now but I can see the CSV file being an issue. Otherwise its a simple express server and api with some endpoints.

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

    Technologies/process to create Rock Band style drum interface.

    Posted: 11 Aug 2020 07:29 PM PDT

    I've been playing Rock Band for years now and can play most songs on expert difficulty. I have such an easier time knowing how to coordinate my hands/leg in this format, since I'm so used to it. This kind of translates to drums, but I struggle more with learning songs. I'd like to create 2 related programs. The first would be some way to make custom drum beats in a similar style to Garageband. The second would be a way to convert that information into a video that looks like Rock Band. There's no way I can make this right now, but I'd like to know any languages/frameworks or the basic process on how to approach this. Any help would be appreciated.

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

    Bad mobile games

    Posted: 11 Aug 2020 06:45 PM PDT

    When you scroll through Instagram (or any other social media I assume) it's a recent phenomenon where you'll see ads for these really bad looking mobile games. Something like "try and get the blocks over the bridge, 99% will fail" or some garbage.

    If these ads are still being run, it must be that people are making money (from in app ad revenue I'd imagine?)

    It seemed similar to dropshipping in that you're basically selling a low quality product and inundating social media with ads to see what takes off.

    I wanted to ask if anybody has any information/first hand experience related to this. Is this a viable thing for a developer with basic ios experience to try and do to make some extra money? Of course not every app will sell, but the games look so basic that you could more or less pump them out pretty quickly and test what works. Am I pipe-dreaming about a get-rich-quick scheme? Thanks!

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

    Help with converting characters into words for google home

    Posted: 11 Aug 2020 05:12 PM PDT

    Helloo, first of all thank you so much for reading this. I have a schedule for school that automatically connects to Google calendars, and it looks like this: https://imgur.com/UurxEBl

    As you can see, my subjects make sense to me however it is a bit jarring when I ask my google home "What do I have today?" and it responds with "You have 10HIC". Is there a way to like convert each subject into it's name so that the response is better? I have no coding experience but I am very willing to learn :) Thanks so much again for reading and I hope you have an amazing day.

    submitted by /u/-0rangeo-
    [link] [comments]

    Any programmers here who inherited code from an acquired company, which had a "very promising" tech stack and it turned out to be absolutely garbage ? What are some really shoddy implementations you have seen in the wild ?

    Posted: 11 Aug 2020 03:31 AM PDT

    How to create a "global" styled data for REST API

    Posted: 11 Aug 2020 03:59 PM PDT

    Not too sure if the phrasing of my question is clear but essentially I am making an API in NodeJS for a CSV file. Right now the data is loaded and cleaned up when there is a request to /api/reports. My problem now is adding say /api/reports/:id I now need to load and format the data again. How would I load the data before the server does anything else as soon as it is spun up and then pass that data into each endpoint so I am not constantly doing the exact same thing. I hope I frame this correctly but here is some of my code

    app.js (entry)

    const reportRoute = require("./routes/reports") app.use("/api/reports", reportRoute) 

    reports.js

    const reports = [] fs.createReadStream(__dirname + "/nuforc_reports.csv") .pipe(csv({ delimiter: "," })) .on("data", data => reports.push(data)) .on("end", () => console.log("Reports CSV Loaded")) router.get("/", (req, res, next) => { // this would be where I reformat the raw data and return the formatted } 
    submitted by /u/findingjake
    [link] [comments]

    Help replacing third-party control functionality (ASP.NET/VB/C#)

    Posted: 11 Aug 2020 10:32 AM PDT

    Hi,

    We have a relatively simple VB winforms app that is now very long in the tooth, and i am considering migrating this to ASP.NET as it makes sense that the app should be served through a browser. I am not a developer to trade, but the app is simple and VB is easy (I get by in C# too).

    The app is a browser for product information, and most of the clever work is done in the backend, using dynamic SQL (and we do have some proper SQL skills in-house). The current iteration of the app uses a third party grid control (third party now long defunct) that allows us to dump the result of any SQL to the grid, and it will happily create all of the column objects from scratch and has some basic parameters for how it should format the data. 2 lines of VB to populate the table, one to set the datasource to a datatable, and a built-in method to call to redraw the grid.

    The rub of the question is this: is there an obvious choice for third party controls that replicate this behaviour, for any of the ASP.NET frameworks? Specifically the easy populating and dynamic creation of columns. If there is something obvious out there i would prefer to know before start really digging myself. Realistically it will probably be webforms, but I think MVC is within our capabilities too.

    Thanks

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

    Best Lenovo laptop for programming?

    Posted: 11 Aug 2020 10:24 AM PDT

    I am a college student currently doing online learning. Need a new laptop because my pc is crap, and my current laptop is a 2008 Toshiba satellite.

    I need it to be Lenovo because I can use my mom's union discount to get it for about half off. Was thinking about the X1 Extreme gen 2, but it would still be about 2 grand (Canadian), which although I can afford, I still have other bills to pay.

    Would this be the best option, or are there other models I should be looking at? I want it to still be useful for my actual career after I graduate.

    Thank you!

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

    [c++/X11 linux] Why does XGetWindowAttributes and XMapWindow return 1 (BadRequest) ?

    Posted: 11 Aug 2020 04:10 AM PDT

    I've been messing around with xlib, and I came up with the following program which doesn't work, but I have no idea why…

    #include <X11/Xutil.h> #include <stdio.h> int main(int argc, char const *argv[]) { fprintf(stdout, "hello\n"); Display *display = XOpenDisplay(nullptr); if (display != nullptr) fprintf(stdout, "got display\n"); Window root = DefaultRootWindow(display); fprintf(stdout, "got root\n"); Window testWindow = XCreateSimpleWindow(display, root, 0, 0, 100, 100, 1, 0, 0); // This stores the result of X function calls so that I can check it afterwards int callResult; callResult = XMapWindow(display, testWindow); if (callResult != Success) fprintf(stderr, "Failed to map window! [%u]\n", callResult); XWindowAttributes attrs; callResult = XGetWindowAttributes(display, testWindow, &attrs); if (callResult != Success) fprintf(stderr, "Failed to get window attributes! [%u]\n", callResult); return 0; } 

    When I run it, I get the following output:

    $ g++ -lX11 src/test.cpp -o build/test && build/test hello got display got root Failed to map window! [1] Failed to get window attributes! [1] 

    I really don't understand why both functions return 1, or BadRequest according to X11/X.h

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

    Help with an error in a python project i have.(keep in mind i took 2 weeks worth of python)

    Posted: 11 Aug 2020 08:46 AM PDT

    import csv Country={} State={} choice=input("Enter 1 for country or 2 for state and country: ") if(choice==1): country=input("enter the selected country: ") with open('C:\Users\USER\Desktop\project2.csv', 'rt') as f: csv_reader = csv.reader(f)

     next(csv_reader) # skip the heading for line in csv_reader: Country[line[3]] = {'Confirmed': line[7], 'Deaths': line[8], 'Recovered': line[9], 'Active': line[10]} print(Country[country]) 

    if(choice==2): state=input("Enter State of choice: ") with open('C:\Users\USER\Desktop\project2.csv', 'rt') as f: csv_reader = csv.reader(f)

     next(csv_reader) # skip the heading for line in csv_reader: State[line[2]] = {'Country':line[3],'Confirmed': line[7], 'Deaths': line[8], 'Recovered': line[9], 'Active': line[10]} print(State[state]) 
    submitted by /u/the--gate--keeper
    [link] [comments]

    Should I learn ReactJS from scratch without learning JavaScript separately?

    Posted: 11 Aug 2020 06:38 AM PDT

    Context: I am in the process of learning Flutter & Dart for app development, but I am guessing that in order for Flutter Web to be a stable technology for web development I will have to wait for some time.
    So I am thinking about learning a Javascript framework (having some background in HTML & CSS) in order to be able to offer full-stack solutions (mobile app & website).

    Is it a good idea to try to learn a JS framework and learning Javascript along the way or should I learn JS first? I should also mention that I have a decent grasp of OOP from Python and Dart.

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

    Approach and datastructures to solve this particular problem

    Posted: 11 Aug 2020 06:10 AM PDT

    Design a reverse proxy for the given scenario. You will be given n servers and their IP addresses, m endpoints the reverse proxy has a list of IPs for each endpoints. Every request that comes to an endpoint goes in round robin fashion to this IP address.You also get special type of hits to the reverse proxy from the server monitor which says that

    -a particular server has gone down and can't take any request

    -a particular server is up now and can't take any request

    Once a server comes back up it should be added to end of the queue in round robin corresponding to each of endpoints it is responsible for. At the end of q queries give out list of requests received by each servers.

    Note- Consider everything is a string(the machine ip adresses along with the domains

    How do i approach solving this question? What data structures do i use?

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

    Is it possible to make a program that send a message in discord every hour or so

    Posted: 10 Aug 2020 11:02 PM PDT

    I was wandering if its possible to make a program that will send a custom message in discord say every 3 hours. Wanted to know because my favourite server on a game has a discord you can earn points in every 3 hours. You can then use those points to buy something in game

    submitted by /u/MyTwoCats-
    [link] [comments]

    Making an excel file from csv in Java

    Posted: 11 Aug 2020 01:00 AM PDT

    Hi so I'm a beginner. I made a small software with Java which uses a CSV(.txt) database. I would like to do something like this: add a button to my software which would make a copy of the original .txt file and than make the copy into a excel file.

    Is this possible to do?

    Could anyone refer me to a resource where I can learn more about this or give me tips on how to do this? any help would be appreciated.

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

    I need chatbot framework, existing open source chatbot I can use to build my own chat. Give me some examples.

    Posted: 10 Aug 2020 11:30 PM PDT

    No comments:

    Post a Comment