• Breaking News

    Saturday, June 16, 2018

    What motivates you to contribute to open source projects? Ask Programming

    What motivates you to contribute to open source projects? Ask Programming


    What motivates you to contribute to open source projects?

    Posted: 16 Jun 2018 09:16 PM PDT

    Is it numpy, numPy, or NumPy?

    Posted: 16 Jun 2018 11:25 AM PDT

    Beginner trying to make a menu for a simple game.

    Posted: 16 Jun 2018 11:13 AM PDT

    Hi! I'm a beginner in Java, and i'm trying to make this menu, that is suppose to show the options to play the game either with another human, with the cpu, or just watch the cpu vs cpu play, but right now, i'm having a problem with the scanner thing, it's giving this error: "int cannot be converted to java.lang.string".

    Also, i should ask, to make an option to exit the game, can i do it by just putting System.exit() in the swtich case option?

    Thanks,

    edit: Oh and i'm using BlueJ.

    import java.util.Scanner;

    public class menuNice { private Scanner scanner; public menu() {

    } public void menu() { Scanner scan = new Scanner(System.in); System.out.println(""); System.out.println(""); System.out.println(""); System.out.println(""); System.out.println(""); System.out.println(""); System.out.println(""); System.out.println("option"); System.out.println("*----------------------------*"); String option = scan.nextInt(); switch (option) { case 1: break; case 2: break; case 3: break; case 4: break; case 5: break; case 6: break; default: System.out.println("Don't forget to choose an option"); break; } } 

    }

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

    Removing a right-click option from software

    Posted: 16 Jun 2018 04:48 PM PDT

    We use 'Connectify' at work so that everyone can use WiFi on their devices. The only issue is that people keep on removing their device from the software's 'Previously Connected Devices' menu so that their usage cannot be monitored (metered connection).

    What is the process to remove the 'Remove Device' option when they right-click on their device in the software.

    I have basic experience in programming, but like most I can utilise resources on Google to work stuff out.

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

    Do you find smoke breaks helpful or hurtful to your work flow?

    Posted: 16 Jun 2018 04:40 PM PDT

    I just asked myself this kind of whimsical question while having a smoke.

    Programmers like to talk about how they have to get into a flow state to be really productivity, and how easily an interruption can kill that. Does stepping away from the keyboard for a few minutes do that to you too, or does it help you gather your thoughts and come back at a problem with fresh eyes?

    Would you recommend to others to pick up a habit - not of smoking, but of stepping outside every 90 minutes to two hours and take a few deep breaths? Would you say this is like teaching your subconscious the Pomodoro technique?

    I've been programming as a hobby for about 8 years now, and got my first job in the industry a little over two years ago. I picked up smoking three, maybe four years ago? I never really payed attention to this question before, but I'll try to from now on.

    Also, I'm not at work right now, I'm not answering my own question by asking it here.

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

    Windows Administrator want to learn programming

    Posted: 16 Jun 2018 04:32 PM PDT

    I am working as a Senior System Administrator (Solution Architect) for Windows, with a specialisation in Active Directory. I have always been interested in learning programming and then move my career towards programming. My only programming knowledge is from my University education where I studied C++ and was pretty good with it. Which language should I start with? For beginning, I have just started learning Python, just to see how it goes.

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

    Why are modules important?

    Posted: 16 Jun 2018 12:45 PM PDT

    I just started my computer science major, and while I do enjoy learning python in my intro class, I still don't really understand why we learn to do things in turtle, matplotlib, etc. I can see how the math module can be useful for a programmer but not sure when I'll ever have to draw a turtle or generate an image that only displays the green channel when there are much faster ways of doing the same thing.

    My guess is that we use these modules to get a visual representation of how things like loops and conditionals work, but I'm a bit annoyed at having to learn new syntax for something I'll probably never use. Things are more interesting to learn when I understand why it's important so that's why I'm asking this.

    What am I missing?

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

    Beginner needs help in Java

    Posted: 16 Jun 2018 12:36 PM PDT

    So I've been trying to make a "Gamemaker" where i can place Rectangles and walk on them as a Player. At the moment I'm trying to check the Collision between Player and Rectangle. The problem I'm having right now is that the Player is only standing on the latest added Rectangle. It seems like the other Rectangles are not being "checked" and the Player just falls through them. Everytime I click on the button which adds a new Rectangle the Player falls through the Rectangle it currently stands on but stands on the newly added one.

    The Rectangles are being added to an ArrayList with this code:

     public void handle(MouseEvent event) { if (event.isPrimaryButtonDown() && Collision.cButton(event)) { Rectangle.recs.add(new Rectangle(event.getX(), event.getY(), 50, 50)); } 

    The Collision between Player and Rectangle is being checked with this code (only the bottom of the player with the top of the rectangle):

    public static boolean cPlayerRectangleBelow(Rectangle r, Player p) { return (p.getY() + p.getHeight() == r.getY() && p.getX() < r.getX() + r.getWidth() && p.getX() + p.getWidth() > r.getX()); } 

    The Player is moving with this code (only down):

    public void gravity() { for (Rectangle r : Rectangle.recs) { if (Collision.cPlayerRectangleBelow(r, Main.player)) { setVy(0); } else { setVy(1); } } } public void move() { setY(getY() + getVy()); } 

    Everything is running in a loop:

    AnimationTimer at = new AnimationTimer() { @Override public void handle(long now) { g.clearRect(0, 0, width, height); d.draw(g); player.gravity(); player.move(); } }; at.start(); 

    Any help on how to fix this problem would be greatly appreciated.

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

    C/C++: how do I access individual pixels on screen (preferably as an array-like)?

    Posted: 16 Jun 2018 03:33 PM PDT

    I am preparing to write a program that will operate like a cellular automata, but I want to see if I can get it to work on the pixel space of my monitor without any antialiasing or such effects. In other words, my question is: in C/C++ how do I get access to the exact pixels inside a window (or, the pixels in the whole screen in fullscreen)?

    I suppose I could also do this in Java or Python, but I need the practice in C and C++.

    This question applies to Windows or to Linux (since I work with both) but I would prefer to have it work in Windows if at all possible.

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

    Is there any way to render videos programatically?

    Posted: 16 Jun 2018 03:26 PM PDT

    I'm looking for the way to render video programmatically. Nothing too fancy, just a picture or two and some audio. Anything out there that can achieve this? Maybe even blender automation?

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

    Code Newbie asking Newbie questions

    Posted: 16 Jun 2018 08:02 AM PDT

    Hey guys! So I have been interested in learning how to code for a while now so with it being summer now I get some time off school so I went on Udemy and I start a Python course. I follow along the lessons and there is some homework at the end of each section. But lets be honest, even I know that there is no way I will learn python in just this 11 hour course. This might give me a decent foundation but I was wondering if there is a website where I can 'practice' like I am given a task and I have to code it? Or just somewhere I can practice after I am done with the course and at least be somewhat competent with Python before moving onto another language.

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

    Does anybody know what this is called?

    Posted: 16 Jun 2018 10:25 AM PDT

    My cousin handed me this thing as he wants to display it in his bar/garage. I have no idea what it is called and cant find anything about it whilst googling so I think its quite old. you can connect to it through a serial port so im guessing you can program it to display customised text/images.

    If anyone could point me towards a manual or at least give me the generic name of what it actually is that would be great.

    Alls I have came up with so far is 'budweiser branded spinning LED thingy'.

    https://imgur.com/luCXSK8 https://imgur.com/5gcdol2 https://imgur.com/Gi6Xt3n https://imgur.com/zSfFqQr

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

    what gpio pins is this code reading ?

    Posted: 16 Jun 2018 05:47 AM PDT

    so i've got a code from an article and trying to work through it, it's about implementation of iot in raspberry pi.

    there are 4 elements in this project(2leds, 1 sensor & 1 motor as fan) .so i found out in the lines 42-47 that the pins 17,22,27 are used for the three elements but i can't figure out which pin is for sensor ? (the author says the lines 90&91 display sensor readings)

    also, in the lines 77-83 what "buffer" command does ?

    here is the code :https://gist.github.com/mhvn092/8c2fcb391d9afeb09dcc8d3363450fc0

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

    Looking for a good approach to a multi-tenant access control system

    Posted: 16 Jun 2018 05:25 AM PDT

    Hi,

    I'll apologize for my post in advance, as I feel it's going to be a length one. I'd love to hear all opinions and ideas that might help me.

    For a project that I'm working on, I need permissions done right the first time. With the new privacy laws (GDPR) and the fact that the system will be dealing with a lot of personal data, I can't afford doing things wrong or having to rewrite them completely at a later stage.

    To give a bit of background, the system I'm writing is a GraphQL API written in Node.js using TypeScript and our current database is PostgreSQL. Because the system is multi-tenant, there are Organisations, all of which contain members (Person), who may or may not have a login (User). A User always has a Person, and the Person can be part of 0..n Organisations.

    Permissions are a concept that exist in all websites, but usually it's one of these cases:

    • A user is either admin or not. If an user is admin, he has permission to do whatever, users who aren't, can't do this (sort of RBAC)
    • A user can be given role(s) (i.e. WordPress), such as superadmin, admin, writer, editor, and access depends on their (highest) role (RBAC)
    • A user can be given rights to access certain entities (even with differences between read and write) (DAC using ACLs)

    The issue with all of these approaches, is that in most cases or plug-and-play solutions, there is only one entity (user) that this system revolves around. Sometimes systems use a combination of RBAC and ACLs, where roles have their own ACL, and roles are granted to users. The system I'm writing, is a bit more complex.

    When using systems such as OAuth2, it's possible to get API calls made by actual Users (those who log in), but also OAuth2 Clients that perform calls solely as an application (thus, no bound User), or a Client that's bound to another entity (Organisation). This already adds one layer of complexity, because I don't just assign permissions to users, but also to clients.

    Another layer of complexity is the fact that this is a multi-tenant system. When one Person is executing a query to get a list of Person[] matching a certain set of criteria, I might need to strip certain fields when one of those instances do not share at least one Organisation (read: I can only see field x of Person y, if I'm in a shared Organisation).

    In the worst case, for each Person that matches the initial query, I need to query the database again to see if x has permission to see y. This can be solved by using DataLoaders, but even then, this system needs to be designed properly.

    It's clear that a system like this, that's definitely going to get more permissions than this, it'll quickly get complex. However, it might be that there are plug-and-play solutions (even for other languages) that I might not be aware of, or I'm approaching the problem completely wrong.

    Another solution I thought of, was storing all my data (or a copy of the data with only the required fields to function) in a graph database, such as Neo4j. When mirroring some of the data, this adds another challenge, as I need to make sure that all data is always correct. However, using a graph database seems to be exactly made for this. Any node of any type can have any relation to any other node, and it's possible to query these nodes based on those relations, instead of querying if a relation exists in the first place.

    When creating a new instance of any entity, I need to insert this into the graph database, creating all the required relations (this might add up).

    Is there any material on the matter, and could someone point me in the right direction? If not, that might mean I need to roll my own solution, and I would happily document it so that others don't have to face this issue in the future.

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

    Best hosting for large numpy queries

    Posted: 16 Jun 2018 05:09 AM PDT

    I'm building a small web-app that needs to do the following backend query: On a large numpy array (2,000,000 x 1,000) perform a single matrix multiplication, argmax and return the result to the client.

    It's not going to have a lot of traffic, so I'm thinking AWS Lambda or Google Cloud Functions could be useful for the task.

    The main issue is that it takes a while (maybe 10s) to load the 2GB numpy array into memory.

    Google Cloud Functions seems to support some "state" like this, even though it might free it once in a while. On the flip side, it doesn't appear to support Python. In AWS it looks like I'd have to reload the array on every query, which would probably be expensive.

    Am I getting the options right? Which of the two (or maybe something entirely different) would you use for a task like this?

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

    No comments:

    Post a Comment