• Breaking News

    Wednesday, December 4, 2019

    Repos with first/simpler project example? Ask Programming

    Repos with first/simpler project example? Ask Programming


    Repos with first/simpler project example?

    Posted: 04 Dec 2019 03:31 PM PST

    Does anyone have an example of their first usage of somewhat-more-than-basic packages and/or concepts through a project? I'm having trouble coming up with and sticking to a project because I find that to build anything I can come up with, it ends up needing a bunch of different resources that end up being really overwhelming.

    For example, I wanted to learn how to use APIs, I figured I might want to figure out web apps in general first. So I tried following Miguel Grinberg's Flask tutorial so I could try to make a web app, and it started out alright, albeit challenging. I used Cygwin, Flask, Jinja2, and Vim for the first time. I used the Python he talked about but because of the intersection of a bunch of different languages I wasn't really intuitively getting how they were working together. Soon there was SQL and login stuff where I was more skimming than understanding anything. Likewise with other things like Java apps, I'll find that they need me to download bunches of stuff, known CLI well, etc., when a lot of this is still new to me.

    I've only ever worked with one language at a time, and it seems like any project, even tutorial, I can find, is asking for familiarity with a whole stack. I've only ever worked with one language at a time and I'm sure I'll get to putting a bunch together after a bit more practice but I want to make a small step first. Like, for example a project just in Java, without 10 new different packages.

    I wanted to see some examples of projects like this, if it even exists. Something that's got enough to it to still be a 'project' but less overwhelming. Any resources?

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

    What libraries are missing in the programming community?

    Posted: 04 Dec 2019 07:40 AM PST

    I want to set out a goal to program a library or port an API. What do you guys feel would bring the most value to the community? What should exist that currently doesn't?

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

    git: Change submodule branch from a post-commit hook

    Posted: 04 Dec 2019 05:20 PM PST

    I tried to use git checkout branch from a post-commit hook and I keep running into errors presumably from wrong environment variables. When I make a test script with git checkout branch and run that, it changes the submodule branch just fine. Is there a way to make the hook switch the branch on the submodule?

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

    [Python]How to calculate f-measure for segmentation/background subtraction method?

    Posted: 04 Dec 2019 08:59 PM PST

    Hi, I'm using the CDNet 2014 dataset to test out my background model.

    I would like to calculate the recall, precision, f-measure of my background subtraction algorithm but I'm running into trouble with the CDNet 2014 utilities for this. It seems to have trouble running with the partial solutions I have (I couldn't do the whole database)

    So I was wondering if I could write something up myself.

    The CDNet dataset gives you both the images, then the ground truth to compare with. I have my foreground masks which are jpgs with everything black but the foreground pixel. So it'll be binary: everything is either 0 (background) or 255 (foreground) . Here is an example

    The CDNet ground truth pixels only have the values:

    The groundtruth images contain 5 labels namely

    0 : Static

    50 : Hard shadow

    85 : Outside region of interest

    170 : Unknown motion (usually around moving objects, due to semi-transparency and motion blur)

    255 : Motion

    I've seen some code in Matlab that is relatively simple but is there any way to handle finding the f-measure in Python? I looked at sklearn but I'm not sure about its efficacy or methods here.

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

    Design Choices and Error Handling for a Cryptocurrency WebSocket Tracker App with Alerts (NodeJS)

    Posted: 04 Dec 2019 02:28 PM PST

    I am building a crypto tracker app that tracks data from the Bitmex crypto exchange. I am using NodeJS and Websocket API module provided by Bitmex at: https://www.npmjs.com/package/bitmex-realtime-api

    This is my first NodeJS app so I am a little unsure on what the best practise is in terms of directory structure and the design of my application.

    In essence, the connection to the Bitmex WebSocket and the user alerts will be setup as shown in the code below. This snippet needs to be running at all times the server is running.

    // Create Bitmex WS client const BitMEXClient = require('bitmex-realtime-api'); const client = new BitMEXClient({); client.on('error', () => console.log('Error'); client.on('open', () => console.log('Connection opened.')); client.on('close', () => console.log('Connection closed.')); client.on('initialize', () => console.log('Client initialized, data is flowing.')); client.addStream('XBTUSD', 'instrument', (data, symbol, tableName) => { // Do something with the data... // For example, if data.price > 1000$, send email/text alert to user }); 

    The client 4 on methods as shown above: 'error', 'open', 'close' and 'initialize'.

    Questions

    1. What is the best practise to handle each of these events?
    2. Do they just get logged into a .logger file?
    3. Any modules I should be using for logging?
    4. What is the best way to handle the on 'error' event? My initial thought was to just log the event followed by retrying the connection after a certain time interval.

    The current directory structure of my app looks as follows:

    CryptoTracker | +-- node_modules/ | +-- public/ | | | +-- index.html | +-- src | | | +-- index.js 

    My assumption is that the Websocket client connection code needs to live within index.js since that is the entry point of the app.

    1. I was thinking that the best way to go about this was to a create a file with the websocket connection code as shown above like /src/utils/bitmex-websocket-connection.js and then require it in my index.js file.
    2. Another option is for me to create a class and then call it from within index.js.

    Questions

    1. Would (1) or (2) be a better way to go about it?

    Thank you for the help!

    Cheers!

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

    What I’m I doing wrong here

    Posted: 04 Dec 2019 07:57 PM PST

    Coloring code in Visual Studio

    Posted: 04 Dec 2019 09:58 AM PST

    I'd label some methods as need more work, or need to be optimized, moved to another class, etc... or now I am moving app to another framework so I am moving methods between two projects, so highlighting parts that I have moved would be useful instead of identing the whole code more, as that butchering seems like the only way I can make if visually distinctive without destroying the code.

    Is there a marketplace or other extension that allows for changing code background or other methods that you'd use in these cases?

    PS: Using C#

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

    Downloader process

    Posted: 04 Dec 2019 03:36 PM PST

    Hi everyone, I'm trying to implement a process to download logs from several IoT servers (assume you have multiple devices) and I'm looking into the best/fastest way to have a process running and it accumulates the data to a database or a datalake, and whether I should consider batch or streaming process, can you please share any resources for that type of architecture?

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

    [web] How to load HTML/CSS property values from a database, and make them work when you construct or update the page?

    Posted: 04 Dec 2019 10:01 AM PST

    So, do you load the values into variables in JS placeholders, and then just send those values to the recepient via id or class or parent/child relationships?

    It can't be that easy. But I would need a billion ids and classes. Is it normal to have a billion id-s?

    Can I store id names and directory links, and other "fancy" stuff also as strings and just slap them into the code when I construct the page with appendChild()?

    Just give me some advice please. I know the question is stupid. I have yet to learn SQL and PHP, so I don't know the other part of the equasion, and I also have no idea what ajax is and why you need it for dynamic pages.

    Tnx!

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

    How to send JSON from a web page to a Python server?

    Posted: 04 Dec 2019 12:36 AM PST

    I'm trying to create a web page with React. I need to send a json string to my Python server based on the user input. How can I do this?

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

    Beginning Programming Question - C++

    Posted: 04 Dec 2019 12:46 PM PST

    I'm having issues with my code for my beginning programming course and apparently my teacher will be out for the remainder of the time that this lab is due so I can't ask for help.

    I don't know the issue of my code but it's supposed to count the days in between of two dates included with leap years.

    Example input

    1901 1 1

    2016 1 1

    Example output

    42003

    https://repl.it/@AaronNguyen7/ChequeCheckCzech

    Can somebody help me or point me in the right direction to fix my mistakes?

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

    Develop applications in Gtk and Glade

    Posted: 04 Dec 2019 06:40 AM PST

    I thought that it is easy to develop apps using GTK and Glade, but after trying around for two days I am lost. I have no idea how the Glade designer works compared to WPF, Windows Forms or Qt. I have tons of experience in HTML5 and native Windows development. I also wrote a few apps in Qt, but Gtk is a closed book to me. Everytime I try to open the book and learn something, I get lost really fast and don't even get Hello World up and running.

    After googling for another day, I have found exactly no tutorials using Glade and Gtk. So I tried to learn something from an already written project, but again, the Glade files looked corrupted right after I checked them out of Git. Can someone point me to a tutorial that explains Glade and Gtk in depth? I really want to develop a native Gnome app with CSDs but I just cannot figure it out.

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

    Best Framework for Android+iOS app / allows Rust / needs camera access

    Posted: 04 Dec 2019 10:53 AM PST

    Performance doesn't have to be great, this won't go into production. Prefer ease of use, compatibility, community, existing extensions/libs/plugins, etc.. NEEDS to be able to call into rust code somehow, binary interop probably OK but (again) the easier the better. Also, I need camera access and am hoping that is painless.

    I'm a professional dev but haven't built a real mobile app before. For context, I'm proficient in JS, C#, Python, C++.Here is my current, uneducated top candidates and related (possibly faulty) thinking:

    1. Pure web app. Node JS, express, running react/vue/angular. PROS: all those libraries, huge community, simple to start easy to grow CONS: camera access won't be turnkey?, the app doesn't really need fulltime internet
    2. React Native PROS: hot, cool, fresh, has the word 'native' CONS: Literally don't know anything about it yet, facebook
    3. Xamarin PROS: probably relatively turnkey, fast true app CONS: What's this community like? Like most MS things, I'm expecting this to be the "best" and "hardest to use" thing on this list

    THANKS!!

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

    Lua vs. Javascript: Why do Lua functions have to be defined above a function call, whereas in Javascript that is not needed?

    Posted: 04 Dec 2019 10:14 AM PST

    Hi all, this is assuming that Lua functions don't belong to some table. Why is this? If you try to call a function that is defined below the call in Lua, it can't find it. In javascript, it seems fine. I think in languages like C, you have function prototypes that consist of just the function signature, and as long as the prototype is above the function call and the function is defined elsewhere you're fine. I get that in Java, this is not needed as methods usually belong to the same object, and that object is instantiated (along with all its methods) before any calls happen.

    Any elaboration on this topic is appreciated, thank you!

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

    easy way of creating a check-in db

    Posted: 04 Dec 2019 10:05 AM PST

    Hello!

    I've created a simple inventory check-out db but I don't know how to check it back in or see what's available. I want to know how to utilize the check-out items to see if an item is available or not. I think I'm also going to need to create a new form to check-in the inventory back. I've looked out on the web and youtube but can't find any resource. Thank you in advance.

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

    Why does it seem to be the consensus that command line work is more suited for linux computers?

    Posted: 04 Dec 2019 10:00 AM PST

    Backbone of Apple

    Posted: 04 Dec 2019 09:11 AM PST

    Let's say I've decided to work at Apple. And I want to get really really deep into the programming, and I believe that Swift isn't powerful enough to use it everywhere(Even in Apple). Which "backbone" language should I learn? C, Java or Python? Maybe something else?

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

    Question about adding custom code to a wall switch sensor.

    Posted: 04 Dec 2019 12:18 AM PST

    Hello,

    Is it possible to add custom code to a wall switch so that a video will play on screen when the switch gets turned on? And if it's possible can you guys show me in the right direction?

    I'm talking about this switch: EM6514 e-Domotica Wall Switch Sensor.

    Thanks,

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

    (Regex / Kotlin) Nestes Regexes / same group name multiple times

    Posted: 04 Dec 2019 08:14 AM PST

    I have three Regexes. The first one is for a name (eg John Doe or John or "Dr. John Doe" (With quotes)).The second one is a greeting (eg Greetings, or Hi, ).The third one is for another person, who greets "John" (eg Michael says, ... or ..., says Michael) (.. is the greeting).

    From a piece of text I want to extract the name and Greeting, and the person who greets, if it exists. The text can be a greeting, person who greets or just the name.

    This is my current source code. Kotlin won't allow this, because I am using a group with the same name name twice in the regex. But it can only be one at the same time, so I don't understand why it doesn't let me do that.

    private val NAME_REGEX = getNameRegex("name") private val NAME_REGEX_GREETER = getNameRegex("name_greeter") fun getNameRegex(name: String) = """(?<$name>[A-Za-z]*|".*")""".toRegex() // I have multiple names in the Spoken regex, so I use this // function to use multiple names private val GREET_REGEX = "(?<greeting>Hi|Greetings), $NAME_REGEX".toRegex() private val SPOKEN_REGEX = """"$GREET_REGEX", says $NAME_REGEX_GREETER""".toRegex() private val UNIVERSAL_REGEX = "(?:$SPOKEN_REGEX)|(?:$GREET_REGEX)|(?:$NAME_REGEX)".toRegex() fun main() { println(UNIVERSAL_REGEX) // java.lang.ExceptionInInitializerError: null } 

    I was able to get a regex by removing all .toRegex() calls, but this obviously won't function. The final regex that it outputs is: (?:"(?<greeting>Hi|Greetings), (?<name>[A-Za-z]*|".*")", says (?<name_greeter>[A-Za-z]*|".*"))|(?:(?<greeting>Hi|Greetings), (?<name>[A-Za-z]*|".*"))|(?:(?<name>[A-Za-z]*|".*"))

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

    If you know one programming language, do you know all of them?

    Posted: 04 Dec 2019 04:16 AM PST

    How can I learn dry programming?

    Posted: 04 Dec 2019 02:01 AM PST

    I while back I got interested in programming and went through a course of C++ basics in my school (solving math problems on the console). Then I decided to give unity a try. After about half a year of dabbling in it, I realised that it didn't teach me programming (what I wanted), but rather just using the software.

    Where should I go from this? How and where can I learn dry programming?

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

    How to write standers on pre implementation phase?

    Posted: 04 Dec 2019 01:58 AM PST

    I'm working on graduation project, before implementation phase exactly, and I was asked to "look-for/check-out existing code with same topic to determine later how good is your software, and write it on paper", the problem is idk what to look for exactly, how many lines of code? complexity?.

    note: the professor wont answer me for some reason

    excuse my English.

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

    How to authenticate an application in a Micro front end architecture

    Posted: 04 Dec 2019 02:10 AM PST

    I am trying micro front end architecture where I have an authentication system sitting in one server and the inventory application in another server. My authentication app handles registration and login authentication. Now I am not able to come up with a right design to make both these system communicate with each other. When I am authenticated I should be redirected to the home page of my inventory application. When I am logging out I should be redirected back to the authentication application. However that inventory app URL should not be able to open without authentication. I am not sure if I need to maintain session here. If I do I am not sure how to handle it. Also , is server side rendering a probable solution for this problem ?

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

    No comments:

    Post a Comment