• Breaking News

    Friday, August 23, 2019

    Code review request for a Python extension written in C Ask Programming

    Code review request for a Python extension written in C Ask Programming


    Code review request for a Python extension written in C

    Posted: 23 Aug 2019 10:37 AM PDT

    Here is the source code.

    I'm relatively new to C and have never written a C Python extension, so please point out as many Python API usage/memory management/code architecture mistakes as possible.

    EDIT: I am also interested how can I properly handle NULL references when creating Python objects (i.e. allocation errors). Right now this extension will probably crash the interpreter, but how do you properly handle such cases?

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

    [CI/CD] Is it okay to build on every push?

    Posted: 23 Aug 2019 09:57 PM PDT

    GitLab user here. I'm trying out continuous integration right now. I configured my project to build (and test) all branches whenever I push--and I am alarmed by the number of pipelines I am generating, because I tend to push often.

    Is it considered good practice to build/test whenever I push? Or should I build/test only when I make a merge request (i.e. pull request in GitHub)?

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

    Is Normalized.css still used?

    Posted: 23 Aug 2019 09:50 PM PDT

    I have enrolled myself in a few web dev courses on Udemy. In one course or let's call it the newer one, doesn't use normalize.ss. Normalize is not added to the HTML.

    On the other hand, the older course is using normalize.css and #id more often than .class. Think this course is following old techniques which are not in trend now. Should I pursue with the older corse?

    I may be wrong about the latter. Please do correct me if I'm wrong and let me know if it is fine to use normalize. These are a few questions I want to get answered.

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

    Python beginner level

    Posted: 23 Aug 2019 09:18 PM PDT

    What does this mean? Thank you! var = {2: 2}

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

    Tic Tac Toe

    Posted: 23 Aug 2019 07:31 PM PDT

    Should I feel bad that I cannot create a game of tic tac toe after studying Python with Udemy courses for less than 40 days? I have watched the review of how to create a game of tic tac toe twice and still cannot do it. I am using Jose Portilla's Python Bootcamp from Zero to Hero course. Any suggestions?

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

    Is there any blockchain whose purpose is ONLY to generate random bits that the most people and computers agree are actually random?

    Posted: 23 Aug 2019 05:15 PM PDT

    Unity mac build to run an exe

    Posted: 23 Aug 2019 05:01 PM PDT

    sorry if the question is too specific but I'm trying to use the html-to-pdf Nreco tool (which is a wkhtmltopdf C# wrapper) to generate a pdf from my unity app, the problem is that the tool does this through the wkhtmltopdf .exe command line tool, so my question is, is there any way to get around this to make it usable on mac OS ?

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

    How does reserving space for variables work?

    Posted: 23 Aug 2019 10:06 AM PDT

    In most programming languages, you are able to reserve space for variables.

    In C: int x = 5;

    In Python: var x = 5

    In x86 (nasm): x: dw 5

    But how does reserving memory work under the hood? How does the compiler or assembler pick an address for your variable to be stuffed in?

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

    Need some help understanding how to design Server-to-Server Authentication

    Posted: 23 Aug 2019 03:22 AM PDT

    I'm writing a SaaS application that should work in the following way

    • the service takes input requests
    • checks if the API Key / Referrer is valid
    • sends out a response

    At the same time there is the business user who can control what the output is in the response.

    I want to make the onboarding/ authentication as smooth as possible but also maintain that is both secure and robust enough.

    For example, the use case would look like this

    • The customer installs the plugin / code on their website
    • The website reaches out to the SaaS server and authenticates itself (tells the SaaS app that it is contacting from xyz.com)
    • The SaaS app does a Reverse IP check to see if the request from the IP was same as xyz.com
    • A record is stored in the DB which maps the API key to the customers domain name, and the API Key is stored on the customers website.
    • All the requests from customers website to the SaaS server now uses the API Key that was generated

    So far it looks very straighforward for me to implement. Here is what complicates things and I don't know

    • How do I authenticate correctly and eliminate fraud if there is more than 1 website hosted on the same ip
    • If a user changes their webhost / ip address, how do I authenticate them again?

    More Questions

    1. Is this a good practice (secure) ?
    2. Are there any tools/libraries out there that provide this out of the box?
    3. The whole post sounds very stupid and I should simply read how OAuth 2.0 works
    submitted by /u/webdevop
    [link] [comments]

    Starting Competitive coding

    Posted: 23 Aug 2019 03:41 AM PDT

    I am second year college student and I am starting with Competitive coding because to get internships in the 3rd year we have to have good algo and ds knowledge. But I am not able to get a particular path to follow in order to be good at ds and algo and also secure good ranks at competitive coding.

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

    Winapi - After creating a remote thread in an external process, can you see the status/return of the lpStartAddress function?

    Posted: 23 Aug 2019 02:48 PM PDT

    Hi, I'm creating a remote thread and passing LoadLibraryA as the lpStartAddress which is called upon the thread being made. However, it seems like my dll is not being loaded (CreateThread does return successfully though). I want to get the result of the LoadLibraryA call, which returns NULL if it fails. Is there any way to get this result, since this function has now been executed in a separate thread belonging to another process? Thanks!

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

    Phone Bot | Those auto switches when user presses a number during call

    Posted: 23 Aug 2019 01:27 AM PDT

    Hey,
    So I'm trying to make a doorbell that calls you (for multiple apartment units at once).

    There are plenty of ways of placing a call through a bot and so on.
    My issue: How do you tell the bot to do x thing when users presses y number in a normal call?

    (no app just phone network)

    It appears my googling skills aren't as high as I had hoped ..

    Just a pointer in the right direction would be enough I just have no idea what's it called or what conditions need to be fulfilled to implement it.

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

    R script - editing data that is variant in size

    Posted: 23 Aug 2019 12:02 PM PDT

    Hey there folks,

    I'm currently doing my first ever coding project for this internship I've had over the summer. I helped run the experiment and then did data collection for it. Now I'm designing the tool that we're going to use to analyze the data, all in R.

    Somethings to know when considering this project:

    1. The data is essentially HRV (heart rate variability) scores and it is supplied by a third-party program, in the form of a json. I've already been able to import the data, but now I'm being overwhelmed by the sheer quantity and
    2. The problem is that the data set can be exported either by session or in batch, I want to be able to process this data with the actual quantity of it being varied. It looks something like this:

    { "export":[ { "user":{ "DeviceUuid":"xxxx-xxxx-xxx...", "Email":"memes@something.org", "DateCreated":1562704486, "Password":"", "FirstName":"Kappa6", "LastName":"", "DOB":0, "Gender":-1, "DateUpdated":1562704618, "DefaultChallengeLevel":1 }, "sessions":[ { "SessionUuid":"8ff8a8cd-b23d-483d-9205-da9b24e4a670", "LocalDate":20190715, "DateCreated":1563231726, "LastModified":1563231726, "DevType":7, "OSType":5, "OSVer":-1, "DevDescr":"emWave2", "OSDescr":"00.81 Jan 30 2017 22:12:55", "SoftwareType":4, "SoftwareVer":"Unknown", "SensorType":3, "CoreModuleVersion":"Unknown", "SensorVersion":"Unknown", "ChallengeLevel":1, "IBIStartTime":1563231726, "IBIEndTime":1563231972, "ZoneEPStartTime":1563231726, "ZoneEPEndTime":1563231972, "Latitude":0.000000000, "Longitude":0.000000000, "SampledIBI":[hundred numerical values seperated by commas], "LiveIBI":[Same as above], "ArtifactFlag":[0,0,0...], "AccumZoneScore":[0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,4,6,8,10,12,14,16,17,18,17,16,15,14,13,12,11,10,9,10,11,10,9,8,7,6,5,4,3,4,5,6,7,9,11,10,9,8,9,8,7,6,5,4,3,2,1,0,0,0,1,2,3,4,5,4,3], "ZoneScore":[0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,1,2,2,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0], "EntrainmentParameter":[0.239999995,0.010000000,0.010000000,0.010000000,0.020000000,0.109999999,0.280000001,0.059999999,0.319999993,0.119999997,0.129999995,0.170000002,0.449999988,1.049999952,2.170000076,4.170000076,10.229999542,27.610000610,16.899999619,7.000000000,2.049999952,1.669999957,1.240000010,1.230000019,0.010000000,0.509999990,0.419999987,0.400000006,0.389999986,0.449999988,0.439999998,0.509999990,0.589999974,1.129999995,0.879999995,0.430000007,0.159999996,0.259999990,0.319999993,0.300000012,0.200000003,0.280000001,0.400000006,0.970000029,0.980000019,1.409999967,3.009999990,7.130000114,7.329999924,0.330000013,0.259999990,0.209999993,0.610000014,0.409999996,0.289999992,0.170000002,0.109999999,0.129999995,0.170000002,0.189999998,0.159999996,0.100000001,0.150000006,0.189999998,0.600000024,0.759999990,0.870000005,0.920000017,1.059999943,0.379999995,0.209999993], "Achievement":40, "AvgCoherence":0.571843028, "PctMedium":20, "PctHigh":15} 

    And then it repeats for the next session, assuming you have more than one, starting from "SessionUId". How would one be able to have the parameters be something that is versatile, and selected for in a way that follows patterns rather than just designated values? The most important feature of this is the IBI data, which we can use to interpolate and extrapolate many different things from. Not only would I like to cut out some of this information, but also then be able to use the xlsx package so that it can all be bundled neatly as an excel sheet or workbook as an export.

    I'm not looking for anyone to help out with the entire damn thing, but a simple referral to what even this kind of problem is called would be nice. As you might be able to tell, I'm completely new to coding, Thanks for your time.

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

    Bash script bug

    Posted: 23 Aug 2019 02:29 AM PDT

    Why does grep only work for the last line of this script?
    This script stores each line of a file in an array then checks to see if the file contains each line. It should contain every line.

    secret_file="secrets.txt" secrets=() if [ -f $secret_file ]; then while read -r secret || [[ -n $secret ]]; do secrets+=( $secret ) done < $secret_file for secret in ${secrets[@]}; do echo $secret if grep -Fxq $secret $secret_file; then echo "$secret in $secret_file" else echo "$secret not found" fi done fi 

    Output:

    0 not found 1 not found 2 2 in secrets.txt 

    secrets.txt:

    0 1 2 
    submitted by /u/firelemons
    [link] [comments]

    Automating tasks between outlook and onenote

    Posted: 23 Aug 2019 10:46 AM PDT

    Hi everyone,

    I am looking for suggestions for how to automate a task. I receive update emails with a good amount of information in them pertaining to a bunch of different people. I essentially want to use a criteria that finds my name, copies that info with my name on it, and pastes it into a one note tab (which is where I make notes and comments so I can keep track of what I'm working on/whats been done.)

    This info that I receive in an email in inside of an excel table and there are multiple columns, one of which has my name. So when my name appears, I want that whole row of information copied over to one note. This email always comes from the same person, just in a few different varieties.

    I am not extremely proficient at coding in multiple languages, but I have had some experience and I welcome all help and suggestions! I have never posted here before, so please let me know if I can add any other information.

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

    I want to store an int value before closing my UWP app

    Posted: 23 Aug 2019 04:46 AM PDT

    Is this possible to do without the use of sqlite database? Basically, I want to set the value of an int variable before I close the program, and when the program is restarted, the previously stored value should be displayed. I know I can do this using a text file and write the value to that file, and then retrieve the value from it. But is there a simpler way since this is just a number like 16340?

    submitted by /u/Curious-Cat-2020
    [link] [comments]

    Question about Multiple Processes and Pipes

    Posted: 23 Aug 2019 10:14 AM PDT

    Hello, I am confused with a couple aspects of Pipes and multiple Processes. I am trying to create two processes and connect their input and output through pipes as drawn in the top right picture. Must I create two entire new processes such as returnValue1 & returnValue2? Or is there an easier way to do it than this? One other aspect that has me confused is which parts of the pipe(s) do I need to close? What is the problem that occurs when the pipe is not closed? I appreciate all the help!

    https://imgur.com/vldV6sG

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

    Kademlia | Can two nodes exchange messages directly?

    Posted: 23 Aug 2019 02:43 AM PDT

    I'm doing some research on Kademlia based decentralized networks. After bootstrapping a new node, instead of broadcasting messages to the nearest nodes, can a message be sent to a specific node identified by its ID? (Even if that means to relay the message to multiple peers before reaching the destination)

    Thanks in advance

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

    What is the term for the icons that are in the bottom right corner of the windows taskbar?

    Posted: 23 Aug 2019 01:07 AM PDT

    I'm developing a tool intended to run in the background of the windows OS that hooks into a few things like keyboard input, MIDI input, etc. I'd like to have an option to kill the tool by being able to right-click a menu icon in the bottom right of the windows taskbar but I don't know the term for it.

    If someone could please tell me what this is called so I can consult the StackOverflow gods with accurate terms that would be great. Bonus points if you're able to tell me if I'm able to make a python package behave this way.

    Edit: Solved. System Tray

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

    Music charts api

    Posted: 23 Aug 2019 02:23 AM PDT

    Hi r/AskProgramming,

    I hope this is the right place to ask.

    I'm looking for an API where I can get the current music charts by country. Can anyone point me to something useful, because I couldn't find anything googling for 2h. This is for a web project I want to start building.

    The Spotify api lets you fetch playlist data. This way I could fetch all of their TOP50 playlist that they have for each country, however this would be a lot of api calls at once.

    Another option I found was https://charts.youtube.com/charts/TopSongs/gb, where you can download a .csv file with the current charts. Is it possible to write a server-side script that goes through every country and downloads the corresponding csv file once a day/week?

    Any help is appreciated!

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

    Looking to create an algorithm that shows 20 images on a certain event call, with 50% of images being based on a user’s interests, and the other 50% being random.

    Posted: 22 Aug 2019 11:18 PM PDT

    Hey r/AskProgramming!

    I'm currently making a simple website in Node.JS that allows users to set their desktop background from a fullscreen image on my site (through the magic of Wallpaper Engine). All images have keyword tags that are related to what the image displays. When a user signs up, they give us 2 interests they have. I'm interested in how I would go about creating an algorithm that, on every page load, they are served 20 images. 50% of which are based on the interests they have, that match an image's keyword(s), and the other 50% being completely random.

    Any help is appreciated. Thanks guys!

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

    No comments:

    Post a Comment