• Breaking News

    Wednesday, August 28, 2019

    Is there such a thing as a Union of Concerned Programmers? Ask Programming

    Is there such a thing as a Union of Concerned Programmers? Ask Programming


    Is there such a thing as a Union of Concerned Programmers?

    Posted: 28 Aug 2019 11:54 AM PDT

    When it became apparent that nuclear weapons might destroy mankind, the Bulletin of the Atomic Scientists was started to educate the world and preferrably try to stop the whole thing.

    When it dawned on earth scientists that antropogenic climate change is destroying our human habitat, the Union of Concerned Scientists was formed to try and turn things around.

    Are we as programmers organizing somewhere to stop Big Data, or poorly thought-out software in service of the public, or ill-secured software in general, or social networks hijacked for nudging whole nations, from fucking civil society up for good?

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

    I want to learn to code and don't really want to spend a lot of moeny for a pc. Is that good enough?

    Posted: 28 Aug 2019 11:59 AM PDT

    Hello, i don't know if this is the place to ask, if don't, please forgive me and tell me where to post this.

    So, i'm about to buy a laptop(i've chosen a laptop for portability) with this specs:

    17" in display and 1080p

    Intel core I5 4th generation(sorry, but i buy a used one so i don't really know how many cores does it haves)

    1 TB HDD

    8 GB Ram

    GeForce 840m 2GB dedicated

    This pc cost around 295 € (328 USD). First, is it worth that money? And second, is it good enough for a beginer like me?

    Edit: formatting

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

    Is there a way to statically type in Python?

    Posted: 28 Aug 2019 09:04 AM PDT

    I recently discovered and have been using TypeScript, and it's been a blast. I use Python for developing my back-end, and I was wondering if there's a neat little toy out there that'll allow me to statically type Python the same way TypeScript allows developers to statically type JavaScript.

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

    How do I handle real money transactions?

    Posted: 28 Aug 2019 02:49 AM PDT

    I want to create an application (web/mobile) that can handle transactions between bank accounts. Is there an API I should use or should I build from scratch? What should I look up to learn more about this?

    Examples of the transactions would be charging a user's credit card (not an in-app purchase but straight to credit card) and also transferring credit into an account like Venmo

    Any guidance is appreciated thank you

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

    Why would someone prefer other way of doing this arithmetic?

    Posted: 28 Aug 2019 10:21 AM PDT

    My question is regarding making a function that does arithmetic and Ill be using JavaScript.

    const arithmetic = (a, b, operator) => { let obj = {add: a+b, subtract: a-b, multiply: a*b, divide: a/b}; return obj[operator]; }; 

    this was my initial answer which I didn't really come up all on my own because I had to search through various places to get the "logic" going but the idea is nice and simple where we have object that defines all the operations and then we return the object key as in obj[operator] and thats it. But when I was looking around, specifically at Codewars where I was doing this, I noticed that this solution was really popular:

    function arithmetic(a, b, operator) { switch(operator) { case 'add': return a + b; case 'subtract': return a - b; case 'multiply': return a * b; case 'divide': return a / b; } } 

    I assume the second one is preferred because it is more efficient as in the first example you evaluate all expressions every time, right? Is there any resources where I could read more about understanding such concepts about how to program more efficiently or is this just something you get through practice?

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

    Robotics: I have kinematics and I want dynamics, but I don't grok the math. Please help?

    Posted: 28 Aug 2019 11:41 AM PDT

    I've watched the Sodermann tutorials on Youtube and I've been trying to read documents like

    http://www.diag.uniroma1.it/~deluca/rob2_en/06_NewtonEulerDynamics.pdf

    My math ends in high school and it doesn't take long before the symbols are swimming in my vision. I need someone to break Dynamics down into programmer talk so I can convert it to work in my system, please. pseudocode would be amazing.

    I have forward and inverse kinematics working in my robot arm, described with D-H parameters. I can get the moment of inertia and the center of mass from the 3D model (made in fusion360). See it here: https://www.youtube.com/watch?v=cGN66PCsQQs

    My goal is to detect forces on the arm by comparing the real time absolute sensors and the simulated model. if they drift apart, something is pushing on the arm, e-stop. A nice-to-have would be velocity/force control for the tool tip.

    The existing code is here: https://github.com/MarginallyClever/Robot-Overlord-App. Specifically, the DHRobot class is a good starting point. I have a set of solvers which attempts to generate joint angle values from the D-H description and the desired target matrix. search for "solve(" and you'll see it.

    If you can help, please share!

    submitted by /u/i-make-robots
    [link] [comments]

    Coding GUI help appreciated

    Posted: 28 Aug 2019 04:06 PM PDT

    Hey I need some help on my Computer Graphics assignment, I am confused on where to start with the images. I am suppose to have the 3 radio buttons with an image display. the first 2 displays different colors, and the last one displays an image. In the actual code I dont know where to start to set up the how to show the colors for each when pressed and show the image on the 3rd one. *Gave link to assignment

    https://s3.us-east-1.amazonaws.com/blackboard.learn.xythos.prod/57c93be5643d6/9243710?response-content-disposition=inline%3B%20filename%2A%3DUTF-8%27%27HW1.pdf&response-content-type=application%2Fpdf&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20190828T210054Z&X-Amz-SignedHeaders=host&X-Amz-Expires=21600&X-Amz-Credential=AKIAIL7WQYDOOHAZJGWQ%2F20190828%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=26be42197d0942b804b6b205ddd152015e1d12ab5dd60451f010a2b912a5030b

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

    Help me find: CLI library for faster tests by increasing system clock

    Posted: 28 Aug 2019 09:43 AM PDT

    Hello. I saw a link awhile ago (I believe on /r/programming) about a cli you could use to run a test suite that has a lot of sleep code in it or that has time dependent code.

    I think it worked by increasing the speed of the system clock inside of the process. Unfortunately, I can't remember the name and my duck-duck-go-fu is failing me. Does anyone know what I'm talking about?

    Here's an example of the usage:

    Without the CLI:

    $ time bin/tests Passed real 10m0.000s 

    With it:

    $ time program_name_im_looking_for bin/tests Passed real 00m0.001s 

    Any ideas?

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

    In home WiFi, is the router simultaneously a DHCP server, a DNS nameserver, and a NAT translator?

    Posted: 28 Aug 2019 05:26 AM PDT

    (Java) how to create subclass that will always match superclass constructor?

    Posted: 28 Aug 2019 07:21 AM PDT

    Here is the way I currently create a class that extends another:

    class A{

    int i;

    A(int integer){

    i = integer;

    }

    }

    class B extends A{

    B(int integer){

    super(integer)

    }

    }

    you see i use super() to pass the arguments from the B constructor into the A constructor when creating the object.

    the problem i have with this is that if i choose to add more variables to A's constructor then I will have to edit B's constructor.

    my question is there a way to write B that is adopts A's constructor automatically? thanks for reading.

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

    [JS] Why does the first non-arrow function work, but the second arrow-function which seems identical fail?

    Posted: 28 Aug 2019 02:34 PM PDT

    I'm just trying to wrap my head around arrow-functions, and functional programming. Here are 2 versions of the same code, where the first one works fine (old-style JS, prior to ES6) but the second one fails:

    // this code works ????? doHW('math', logFinished) function doHW(subject, callback) { console.log(`starting HW: ${subject}`) callback() } function logFinished() { console.log('finshed doing homework') } // but this doesn't???? wtf doHW('math', logFinished) let doHW = (subject, callback) => { console.log(`starting HW: ${subject}`) callback() } let logFinished = () => { console.log('finshed doing homework') } 
    submitted by /u/illyric
    [link] [comments]

    What's the best option for In-App payment implementation?

    Posted: 28 Aug 2019 02:13 PM PDT

    Let me start off by saying I'm not a developer. I'm actually in the midst of launching my own app (think food delivery app) which will require payments. The problem is that said payments will often be for small amounts, and I'll only be taking a percentage of those as revenue which means that implementing a 3rd party to handle and secure all payments is simply not possible since they would be charging more than the amount I'd be earning.

    With all this in mind, I figured my only logical solution would be to develop my own in-app payment system, but I'm ell aware this takes time and will cost me a good amount of money. So I was wondering, are there any other options available? And, even if there are, is developing my own system the best idea?

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

    How do you deal with depression?

    Posted: 28 Aug 2019 02:00 PM PDT

    I have been struggling with depression for over five years. There're good days and a lot more bad ones. I'm self-taught, so I have been practicing programming on my own doing small stuff, building a portfolio but the last few weeks have been different. I can't bring myself to open an editor. I don't know if it's the original depression or the hopeless unemployment. What do you do to feel excited again when depressed?

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

    Simulate multiple click on a mouse press python

    Posted: 28 Aug 2019 01:25 PM PDT

    So I tried to simulate multiple mouse left click whenever I press the mouse's left button.However, my mouse start teleporting/moving slowly whenever I run my code. I am actually running this code with pycharm IDE.

    I thought that maybe I am sending too much command per mouse press, so I decided to add a sleep between each click, to see the behavior. Unfortunately, the program still behave the same way.

    from pynput.mouse import Listener,Controller, Button
    mouse = Controller()

    def on_click(button, pressed):
    if pressed and button == Button.left:
    mouse.click(Button.right,1)

    with Listener( on_click=on_click) as listener:
    listener.join()

    I know that the code is not completed yet, but my final goal would be to simulate multiple click, with an interval of ~0.05 second, while I hold the mouse's left button.

    Thank you,

    link to stackoverflow: https://stackoverflow.com/questions/57698378/simulate-multiple-click-on-a-mouse-press-python

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

    What is the benefit of compiling to bytecode before interpreting in interpreted languages like Java?

    Posted: 28 Aug 2019 05:39 AM PDT

    In the programming class I'm taking at the moment, we're talking about the different ways different languages handle your source code. During the talk, we discussed the advantages and disadvantages of interpreted and compiled languages, and I started wondering what the advantage of compiling to bytecode before interpreting in Java is. As far as I understand, Python just interprets the source code itself, so it seems to be possible.

    Why does Java need to compile it first? It's not like the source code gets completely obscured by it, since I know the class files can be at least somewhat converted back, like the fan made modding tools for Minecraft did back in the day. My teacher couldn't answer, so I'm turning to you all. What is the advantage of compiling to bytecode before running in Java?

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

    Phone # Expression Assistance

    Posted: 28 Aug 2019 12:28 PM PDT

    Greetings,

    I am looking for assistance on two expressions:

    -match a 10-digit phone number
    -grab only the Area Code of the phone number

    I have this: ^\d{3}\d{3}\d{4}$ || Looking for validation or a better way (simple).

    Any assistance is greatly appreciated

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

    What do you think of project managers?

    Posted: 28 Aug 2019 12:18 PM PDT

    I'm interviewing for a Junior Project Manager position tomorrow. I can't code and I have bachelors and masters in philosophy.

    Will I be bullied by programmers? How do I earn your respect? I would like to learn how to code, mind you, but now I need to land a job so I won't get thrown out into the street.

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

    Programming needs for browser game?

    Posted: 28 Aug 2019 05:00 AM PDT

    I'm thinking about making a text/image based browser game, no Flash/video, and starting to plan for the basics. My programming background is a couple of university courses in Java, but initial searches mostly talks about PHP, CSS/HTML, jQuery and JavaScript.

    That all makes sense, but I mostly associate that with graphics and site design.

    I assume I'll eventually need a database, but would Java be completely useless in this case?

    If that's the case, what kind of scenario would use server side Java/other?

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

    What Is Your Dating Life Like???

    Posted: 28 Aug 2019 10:51 AM PDT

    Hey everyone! I'm doing research on busy careers and how it affects their dating lives. Dating in general is a very stressful thing to go through but add on the busy lifestyle and career can make it even harder. I also know that with these type of careers, school was very demanding which also may have limited the amount of opportunities to interact with people as well. I recently graduated Physical Therapy school and based off my experiences it was difficult for me to search for and pursue a long term relationship. This carried over to my post graduate life and I noticed that it was difficult for me to build a connection with women during a date due to not having much interaction with women romantically because of heavily focusing on my schooling during my college years. My experiences have led me to 2 questions I would like to ask you all:

    1. As a young professional who is entering the dating scene, what are the 2 biggest issues you're dealing with?

    2. Regarding your dating life, what would you wish for more than anything else?

    Thanks so much guys in advanced! I'm looking forward to reading your answers! Feel free to message me personally as well as I do understand this could be a touchy subject so some.

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

    Hey Guys, Newly formed programmer(2 Days old) who just needs some guidance ?

    Posted: 28 Aug 2019 08:42 AM PDT

    Hey guys, Just as the title suggests, I don't need to be spoon fed or have my hand held through this but I feel I should give a little back story. I had never done or studied anything related towards programming until literally 3 weeks ago. Now i find myself in the masters of computer science course after having previously got a bachelors in Commerce.... ( why do you ask ? that's another story for another time) However all that aside I decided fuck it, I'm gonna work and get at this thing and do something by putting in the time and effort. Well now I find myself having self taught myself c++(its the only programming language accepted for my assignments and the only one I know). I just wanted a few pointers(no pun intended regarding pointers in c++ :P) and a general idea of the direction in which I should start or write out my code. If this isn't much of a bother, Ill upload my Assignment details and let you guys have a go at it. Mind you my submissions on Monday the 1st of September 2019, Which isn't your problem at all but I really do hope you'll understand my urgency(why did I start so late ? I literally finished learning c++ an hour ago :( )all I need is some pointers and direction nothing more and any help is cool even if not. Cheers lads

    (Details of Assignment below )

    Overview

    This assignment is to be implemented using procedural programming. The overall program should follow the progress of students through a sequence of subjects that are part of an academic course at an educational institute : ABC (A Big College).

    General code notes

    These are some general rules about what you should and shouldn't do.

    1. Your assignment should be organised into:

    (a) A driver file containing your main() function. (b) A header file containing the prototypes for the functions you write. (c) An implementation file containing the implementations of your functions.

    1. Provide a text file Readme.txt with instructions for compiling your code on Banshee into the executable ABC. The Readme.txt should actually be a text file, not a doc or pdf or rtf or something other than text, and the instruction should be a copy and pastable command.

    2. If your code doesn't compile on Banshee you will likely receive 0 for the assignment.

    3. You are not allowed to use classes.

    4. You can use structs, but not member functions in them.

    5. Within your code, be consistent in your tabbing style. We want readable code.

    6. Include sensible volumes of commenting.

    1

    1. Use appropriate variable names.

    2. Don't leak memory.

    3. Your main() function should make it clear what is going on, and shouldn't be too large.

    4. Other than the initial command line input, the program should run without user output. In particular this means there shouldn't be pauses waiting for the user to press a key.

    Run structure

    Once your program is compiled into the executable ABC, it must run as follows:

    $ ./ABC Students.txt Subjects.txt Teachers.txt Output-file

    The files serve particular purposes and by purpose should be assumed to be in this order. The names and content of the files may differ, so you shouldn't hard code the content of the sample files into your program, or hard code the names of files into your program. The expected structure of the input data files is given in the next section. When you read from the data files you should report on the data read in. We should see a list of students, a list of subjects, and a list of teachers; all appropriately formatted so it's clear you have correctly partitioned the data. This report should go to standard out, not to Output-file. Output-file is used to report on results. It should be clear that you have correctly linked files, that should be clearer once you read the format of the data files. The students in the students file are to be processed in the order they are given. The run of each student is independent. Each student attempts to go through their plan of study taking each subject in the order listed in their plan. A student cannot take a subject until they completed the previous one on their plan. If a student fails a subject three times in row they are to be excluded from the college. The file Output-file should be ordered by student and contain a clear report on the progression of each student, including subject, teacher, and performance for each time they take a subject. When you start each student you should report to standard out, with the student name and the name of the program they are studying for. You should also report when the student moves to a new subject or attempt at a subject, and when they finish their study.

    The process involved in a student taking a subject is as follows: • For the given subject randomly allocate a teacher who is allowed to teach the subject. • Apply the teacher and student modifiers to the subject distribution. The modified mean and standard deviations are determined as follows:

    Mean = Student ability - Subject difficulty - Teacher toughness Standard deviation = Student consistency + Subject variability + Teacher variability

    Here goes an example using the data listed in the next section. If Average Ant is taking Basic Bouncing, and being taught by Tough Terrapin, the mean and standard deviations become:

    2

    Mean = 50 - (-10) - (15) = 45 Standard deviation = 5 + (-2) + (3) = 6

    Poor Average Ant doesn't have a great chance of passing... At this point you should report the student name, subject attempted, teacher teaching, and the distribution parameters to the Output-file. • Determine the mark obtained by the student by generating a random value drawn from the subject distribution. Values less than 0 or more than 100 should be appropriately modified so the mark is an integer in the range 0 to 100. • Based on the mark three different actions are possible: 1. If the mark is in the range 0-44 inclusive, the student is given an F (for fail) grade. 2. If the mark is in the range 45-49 inclusive, the student is given a supplementary assessment. Generate a new value from the distribution and add +5. If the new mark is in the range 0-49 the student fails and received an F grade. If the new mark is in the range 50-100, the student receives a 50-PS. The supplementary assessment mark should be recorded and reported along with the original mark. 3. If the mark is in the range 50+, the student is given a grade in accordance with the following table, where the ranges are inclusive of the values at the end of range:

    Mark Grade 50-64 P 65-74 C 75-84 D 85-100 HD

    • As noted earlier, if a student fails a subject they need to retake it, with a maximum of three attempts allowed. For a first retake of a subject a modifier of +5 is added to the mark obtained. For the second retake a modified of +10 is added to the mark obtained. In each retake the teacher is independently randomly generated. If no more retakes are allowed, the exclusion of the student should be reported to the Output-file and you should move on to the next student. • The mark and grade for each attempt should be reported to the Output-file. • If the student has passed the subject they proceed to the next subject, if there is one. If the student has completed all subjects, they graduate and this should be reported to the Output-file.

    Inputs

    Three data files are needed for each run of the program. The general syntax of those files is described here, and one example of each is provided on Banshee in /share/cs-pub/251/Assignments/One/. Those

    3

    files are in Unix format so if you copy them over to Windows and back to Unix there may be additional characters, particularly the end of line ˆM that may appear. The three data files are as follows, with the commas and colons used to separate fields.

    1. Students.txt: No more than 10 entries.

    Name,Student code,Ability,Consistency,Program name:Subject list

    Example:

    Average Ant,204932,50,5,Short course:1 Brilliant Bison,234543,80,3,Bachelor of Bounciness:2,5,3 Consistent Canary,123456,60,1,Diploma of Doggeral:3,6 Dusty the Dinosaur,000001,65,3,Master of Extinction:1,2,3,4,5,6 Iggy the Irratic,369523,50,15,Some Degree of Oddness:7,5,3,1

    The student code is a 6 digit string. Note that it can have leading 0's as in Dusty the Dinosaur. The ability is an integer in the range 0 to 100 inclusive and represents the mean mark for the student prior to applying subject or teacher modifiers. The consistency is a value in the range 0 to 15, and is the standard deviation prior to applying the teacher and subject modifiers. The subject list contains a list of integers with each number corresponding to a subject listed in the subject file. There won't be more than 10 subjects for any student.

    1. Subjects.txt: No more than 10 entries.

    Name,Difficulty,Variability

    Example:

    Archery,-15,1 Basic Bouncing,-10,-2 Counting for Animals,0,2 Digging,4,1 Better Bouncing,0,2 Finding Friends,10,3 Gathering Greenery,15,0

    The name cannot be empty. The difficulty is an integer modifier for the mean in the range of -15 to 15 inclusive. The variability is an integer modifier for the standard deviation in the range of -3 to 3 inclusive.

    1. Teachers.txt: No more than 10 entries.

    Name,Toughness,Variability,Subject list

    Example:

    4

    Tough Terrapin,15,3:2,3,4 Softy Squid,-15,-3:1,2,3,4,5 Moderate Monkey,0,0:4,5,6,7 Contrary Cat,3,3:3,5,6

    The name cannot be empty. The toughness is an integer modifier for the mean in the range of -15 to 15 inclusive. The variability is an integer modifier for the standard deviation in the range of -3 to 3 inclusive. The subject list contains a list of integers with each number corresponding to a subject listed in the subject file. There won't be more than 10 subjects for any teacher. These represent the subjects the teacher is allowed to teach.

    Output

    If there is a problem with one of the three input data files, such as it doesn't open or it contains invalid data, a report should be made to standard error, and the program should abort. The error should be detailed enough to unambiguously identify the problem. The output was explained in the Run structure section.

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

    What is the ideal architecture for showing messages from backend API return on frontend?

    Posted: 28 Aug 2019 02:22 AM PDT

    Say you have a website with a backend API and a frontend application.

    When the user does things on the frontend the backend API is consumed and then stuff happens on the frontend in response.

    When I first started developing I would have things like error messages (incorrect input, etc) be returned by the API layer and shown to the user on the frontend. But the problem is with larger sites this doesn't extrapolate well to multiple languages.

    So then I switched to having the backend API return error codes, and then frontend would show a human-friendly error message according to the error code, in the users chosen language. But the problem with this is it's not nice for situations where you want to allow users to consume the backend API directly for their own purposes.

    I could have the backend return a human readable message AND an error code which gets used by the frontend to display a human readable message in the users desired language. But the problem with this is now I have each each string stored in two places, the backend and frontend. So API changes involve text changes which update the same strings in multiple locations (a 'multiple sources of truth' issue).

    What is the best architecture for dealing with this issue in large applications (backend API + frontend application + multiple languages + ability to users to bypass frontend and consume backend directly)?

    Thanks for the help, hope this is the right place to post.

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

    No comments:

    Post a Comment