• Breaking News

    Thursday, October 11, 2018

    Help recommend me a gift to a young teenager relatively fresh with python Ask Programming

    Help recommend me a gift to a young teenager relatively fresh with python Ask Programming


    Help recommend me a gift to a young teenager relatively fresh with python

    Posted: 11 Oct 2018 11:03 AM PDT

    Hello,

    I was looking for some creative, fun and inspiring gift suggestions for a techy 15 year old relative of mine. As she's into python, I was concidering a book or something on Pytorch, but I'm not sure if it is too hard or appropriate. Other recommendations would be swell. Bonus points if it has something to do with webapp/frontend/games.

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

    Should I make an Html->Markdown parser in C++, or embed a language like Python where a parser already exists?

    Posted: 11 Oct 2018 03:41 PM PDT

    I'm working on an editor that allows you to work on both the HTML of a document and the raw markdown of a document.

    I need two essential functions to make this work:

    • A function that takes markdown and converts it to HTML
    • A function that takes HTML and converts it to markdown

    My app is made in C++ and Qt.

    I'm looking for the fastest solution as I'd not like to spend too much time on this.

    In C++/C, there are plenty of libraries that will allow you to convert markdown to HTML.

    However, there are no libraries that will allow you to take HTML and convert it to markdown. I came up with two different possible solutions. If you have an additional one, I'm definitely open to it.

    Solution 1: Embed Python in my C++ app, use a Python library like "Html2Text"

    The advantages I see are that Python is easy to work with and I'll already have a reliable library that can convert HTML to markdown.

    The disadvantages could be that I have to figure out how to distribute the Python libraries with my app. I'm also not 100% sure how easy it would be to get a Python library working in an embedded Python instance.

    Solution 2: Use an HTML parser library in C++. From that, essentially create my own HTML->Markdown converter

    The advantages I see are that I would have more control over my parser (Since I create it). I also wouldn't have to deal with distributing Python libraries or the potential overhead of embedding Python.

    The disadvantages are that this might take a lot of time depending on the problems I run into and any unexpected difficulties of parsing to markdown that I am overlooking.

    Note: The HTML I will deal with is very simple. By that I mean no Javascript, CSS, special media info, etc. Just the raw tags: h1-6, ul, li, table, bold/strong, i, etc.

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

    Fortran: Part2

    Posted: 11 Oct 2018 09:16 PM PDT

    Hey guys, I just completed this mini intro to Fortran95 and looking for a new source to further my skills including simulations, etc.

    Where do I go next?

    Which book/video do I use to learn more about Fortran to practically use it.

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

    Question regarding (int & int) output?

    Posted: 11 Oct 2018 09:05 PM PDT

    In python and C, when I execute these certain commands I get this output:

    >> 2 & 2

    2

    >> 3 & 5

    1

    >> 123 & 124

    120

    My question is why are these commands outputting these seemingly arbitrary numbers? I understand the outputs of (0 & 1) and (1&1) since they output to 0 and 1 respectively... but I don't understand the outputs above. Can someone explain this? Thanks.

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

    (Python) Help with spacing and aligning!

    Posted: 11 Oct 2018 07:15 PM PDT

    So I'm relatively new to python and recently have started taking classes at a local college. Everything is going well so far but I am having a little bit of trouble on my recent project. The project we have been assigned is to make a budget table using variables and print statements. For the most part everything is going well and whenever I run the script everything comes out neat and organized. However I have noticed that whenever the monthly budget increases to anything below $10.00 or above $100.00, the '|' symbol is shifted to either the left or right, making everything else off center. I'm just wondering if there is anyway that I can lock the '|' symbol into place so that whenever I alter the price to anything below $10.00 and above $99.99 everything will still remain in place

    A small segment of the code I have produced so far looks like this

    #Variables

    item1 = 'Food'

    item2 = 'Internet'

    item3 = 'Water'

    yearly1 = 108

    yearly2 = 960

    yearly3 = 1320

    monthly1 = yearly1 / 12

    monthly2 = yearly2 / 12

    monthly3 = yearly3 / 12

    print('==============================================')

    print('{:<5s}'.format('Item'), '{:>12}'.format('|'), '{:>11}'.format('Monthly'), '{:>3}'.format('|'), '{:>5}'.format('Yearly'))

    print('==============================================')

    print('{:<9}'.format(item1), '{:>10}'.format('| $'), '', '{:>.2f}'.format(monthly1),'{:>8}'.format('| $'), '{:>.2f}'.format(yearly1))

    print('{:<9}'.format(item2), '{:>10}'.format('| $'), '', '{:>.2f}'.format(monthly2),'{:>8}'.format('| $'), '{:>.2f}'.format(yearly2))

    print('{:<9}'.format(item3), '{:>10}'.format('| $'), '', '{:>.2f}'.format(monthly3),'{:>8}'.format('| $'), '{:>.2f}'.format(yearly3))

    When run it comes out looking like this

    Item | Monthly | Yearly

    Food | $ 9.00 | $ 1080.00

    internet | $ 80.00 | $ 960.00

    water | $ 110.00 | $ 1320.00

    and I'm trying to run it so that it comes out looking like this

    Item | Monthly | Yearly

    food | $ 9.00 | $ 108.00

    internet | $ 80.00 | $ 960.00

    water | $ 110.00 | $ 1320.00

    Any help at all would be much appreciated! I've been racking my brain for hours trying to figure everthing out but can't seem to figure out what to do!

    Thank you all for your time!

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

    How does one begin to move past terminal programs and into making programs with interfaces? I feel like there are so many avenues to do so and they are all so complex it is a bit overwhelming

    Posted: 11 Oct 2018 01:13 PM PDT

    And furthermore, tutorials never seem to teach the basics of any GUI library, but rather give examples that don't help me build one from scratch at all... any direction to a good tutorial would be greatly appreciated

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

    Quick question about what the & after a type in C++ eg/std::string& getname();

    Posted: 11 Oct 2018 07:05 PM PDT

    I'm following a guide and they're using this for getter

    inline const std::string& getName() const { return this->name; } 

    what does the & do?

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

    What are some of your favorite tech conferences?

    Posted: 11 Oct 2018 06:39 AM PDT

    WinAPI vs .NET framework

    Posted: 11 Oct 2018 08:11 AM PDT

    Hello everyone, I'm a small scale developer that works with the .NET framework. What are the advantages of using the Windows API in C++ over writing a program in C#? What are the disadvantages?

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

    What prevents machines from learning "human" code (Python, Java, etc)?

    Posted: 11 Oct 2018 01:25 PM PDT

    Why can't the computer interpret the language as it is, as opposed to converting it into machine code

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

    Display multiple lines of text in JOptionPane

    Posted: 11 Oct 2018 01:55 PM PDT

    I am trying to display multiple lines of text in a JOptionPane message using HTML. The problem is, I need to use variable names in the message, and am unsure of how to do so using HTML. I'm trying to do something like:

    String var1 = "abc"; String var2 = "def"; JLabel label = new JLabel("<html>Variable 1: " + var1 + "<br>Variable 2: " + var2 + "<html>"); JOptionPane.showMessageDialog(null, label, "Title",JOptionPane.WARNING_MESSAGE); //OUTPUT Variable 1: abc Variable 2: def 

    Is this even possible, or am I going to have to find an alternative method?

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

    Tips for comparing programming languages?

    Posted: 11 Oct 2018 01:43 PM PDT

    In general, most popular languages are not designed to be highly specialized. As such, it's often hard to tell what tasks a given language counts as a individual strength, weakness, or is simply acceptable at doing.

    That can make it hard to figure out what I would consider worth learning, for my individual needs. What are some ways to help figure this out, as a prospective learner of a given language?

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

    [Java] I'm really trying to figure out this problem for a project and I keep failing. I'm getting discouraged and need some guidance.

    Posted: 11 Oct 2018 01:13 PM PDT

    The question is..

    "A certain bank offers 6.5% interest on savings accounts, compounded annually. Create a table that shows how much money a person will accumulate over a period of 25 years, assuming the person makes an initial investment of $1000 and deposits $100 each year after the first year. For each year, your table should indicate the current balance, the interest, the new deposit, and the new balance."

    This is the code I have so far and it gives the basic table with the headers but of course the interest/ new balance are the same for all 25 years. I can't for the life of me figure out a way to get the table to run and calculate as needed giving me the results desired. I'm sure the fix is simple and it will make me feel dumb for not realizing it sooner. I'm having trouble storing variables in the loop so that I can keep a running total for all 25 years.

    public static void main(String[] args){

    table(1000.0, 25, 0.065, 100.0);

    }//end main

    public static void table(double id, int y, double i, double d){ //use method

    System.out.println("Year start\t Interest\t Deposit\t New Balance");

    System.out.println("\t \t \t \t " + id);

    for(int year = 1; year <= 25; year++){

    System.out.print(year);

    System.out.print("\t \t " + (i * b));

    System.out.print("\t \t " + d);

    System.out.print("\t \t " + nb);

    System.out.println();

    }

    }//end table

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

    Getting started on Python for Linux

    Posted: 11 Oct 2018 01:31 AM PDT

    I have installed Python 2.7.12 on my laptop and want to know what to do next? Is the programming done in the terminal or elsewhere? What else do I need to download? Sorry for the stupid questions, I'm just a beginner.

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

    How can I fetch data from an api when I take a photo?

    Posted: 11 Oct 2018 03:45 AM PDT

    Best way to maintain IP's and MAC's of users to avoid distribution/piracy?

    Posted: 11 Oct 2018 08:22 AM PDT

    I made a bot for a game, and to make sure people wouldnt easily resell it or hand it out, i log their IP's, MAC's, and timestamp with each access using firebase. If i notice their IP and MACs are different and more usage frequency, this means they have distributed the software. This leads to a lot of entries with the same IP and MAC (in most cases). My question is: Is there any simpler way of assuring that only one person can use my software and if not, whats a good way to control the persons access info to guarantee only one person is using the software?

    I was thinking maybe making just a object containing all the IPs he ever logged with, with all the MACs associated with that IP and a counter, counting each log with that info. So each time the bot is used with a IP or MAC not registered in that object, add it to the object with all the necessary info.

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

    What's the best way to generate a waveform from an audio file?

    Posted: 11 Oct 2018 01:48 AM PDT

    I'd like to build a web application that takes an audio file as input and then converts that audio file into a waveform that can be customised (e.g. colour, spacing, size etc). What would be the simplest way to approach this? Which languages would be best?

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

    github/php/sql help

    Posted: 11 Oct 2018 05:44 AM PDT

    basically i downloaded a zip file from github it's a crm application i really liked the demo it works great problem is i have no idea how to install the thing and the creator's support is non existent. i have been looking at the files with no idea what to do can someone help?

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

    how to deal with runtime error with return

    Posted: 11 Oct 2018 05:26 AM PDT

    someone told me it does that it didn't work tho when i tried it doesn't output anything

    https://pastebin.com/b7VUd1N5

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

    Are there any build processes to convert px to vh/vw?

    Posted: 11 Oct 2018 12:57 AM PDT

    I was looking at my project the other day, and I realized that while developing, I actively test out different spacings by adding or subtracting px values from a height or width. Sometimes though, I forget to convert the values manually when I get what I want (a nifty site like http://pxtovh.com/ ) does it for me, which I know it's super easy to do, I'm just lazy to do it manually.

    So I was wondering if there was any way I could automate this process?

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

    I need help with something including; C# & Azure Function Apps (and ThriveCart)

    Posted: 10 Oct 2018 11:18 PM PDT

    I've never worked with the mentioned things before, and after days of struggling I decided to look for help here.

    I'm trying to set up a Webhook in ThriveCart, and in order for them to accept a Webhook URL the "script must also respond with an HTTP 2xx status code when they send a HEAD request to it, otherwise, they will not allow me to add it".

    In Azure Function Apps (where I've set up the Webhook), my C# code looks like this:

    #r "Newtonsoft.Json" using System.Net; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Primitives; using Newtonsoft.Json; public static async Task<IActionResult> Run(HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); string name = req.Query["name"]; string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); dynamic data = JsonConvert.DeserializeObject(requestBody); name = name ?? data?.name; return (ActionResult)new OkObjectResult($"Hello, {name}"); } 

    where I'd believe that

    return (ActionResult)new OkObjectResult($"Hello, {name}"); 

    Would return a HTTP Response 200, but no.

    I've tried a bunch of similiar code snippets that would accomplish the same thing, but ThriveCart keeps rejecting the URL's.

    So; (TL:DR):

    Does anyone know how to write C# code (for an Azure Function App) that responds with a HTTP Response 2xx, hence satisfying ThriveCart's needs?

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

    No comments:

    Post a Comment