• Breaking News

    Thursday, May 30, 2019

    Keeping a master and slave server Ask Programming

    Keeping a master and slave server Ask Programming


    Keeping a master and slave server

    Posted: 30 May 2019 09:30 PM PDT

    So let's say I have one master(development) server that I want to keep synced up to 20 production servers how would I do this? It would be a few Py files.

    Ideally able to use digitalocean snapshot to deploy a new one without intervention.

    Thanks!

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

    Can anyone help me make this? Or know who can?

    Posted: 30 May 2019 04:55 PM PDT

    Hello all,

    I am an elementary music teacher with around 1200 K-5 students. I am finishing up my first year at this new (and obviously very large) school and I still don't know hardly anyone's name - it's tough when I see them only 30 minutes at a time and there's 60 kids in my music room at one time.

    I would really like to do something over the summer to help myself learn all of their names. I have a vision for something like a google form (but it doesn't have to be a google form!) with the question being their photo and 4 multiple choice answers. This programmed "Quiz" would randomly select a student photo, then randomly generate 3 wrong names along with the correct corresponding name as an option in the multiple choice section.

    I have access to every student's name and photograph through an education student management program called Phoenix Synergy SIS.

    My initial thought was to try a couple google add ons, try and put everyone's picture into a column of a google sheet and their name into another column and try to auto-generate a google form that way. My main issue is that the pictures would not show up in questions when I would export the data to a form.

    I am willing to pay if there's a freelance programmer out there that can help me out!

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

    Help installing a library from within a python file on MacOS?

    Posted: 30 May 2019 07:47 PM PDT

    I need to be able to install pandas from within a python file on a Mac. Imagine opening up a new Mac VM and only being able to run a python file that installs the library, imports it, and other stuff. An equivalent on linux would be:

    import os cmd = 'sudo pip install pandas' os.system(cmd) 

    Any help would be greatly appreciated.

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

    Trying to complete a Greedy program, my first ever (pertains to Harvard's CS50)

    Posted: 30 May 2019 06:38 PM PDT

    Hey all, brand new to coding and I'm doing my best. I've been plugging away at a greedy program for a few days now and while I think I'm nearing completion on it, I'm still hitting a few snags. Check50 yields improper results for every check except for "1", and that's because my code always only returns 1 coin.

    Here is my code: https://pastebin.com/G1FfkbCM

    If someone could attempt to guide me through my mistakes I'd be very appreciative. I'll try not to be obtuse when responding, but you'll have to bear with me as I'm incredibly new to this and bad at it. I am also aware of Harvard's code of conduct re: academic honesty; I don't want a wand waved to solve this for me, I simply want some guidance, and I feel as though I'm nearing completion. Thanks all!

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

    Why is 32 bit called x86 while 64 bit called x64?

    Posted: 30 May 2019 12:04 AM PDT

    What's the difference?

    submitted by /u/PewPaw-Grams
    [link] [comments]

    Java - Why isn't this try/catch working?

    Posted: 30 May 2019 06:37 PM PDT

    I'm trying to make a simple math game (with a calc() cheat ;D). Why isn't this try/catch working? I'm trying to make it so that if the input is invalid, it throws and exception saying to please enter valid input, but it just stops the program and gives an error.

    Here's my code:

    import java.util.*; public class MathGame { public static int questions = 5; public static int count = 0; public static int answer = 0; public static Scanner in = new Scanner(System.in); public static int num1; public static int num2; public static boolean answered = false; public static void main(String[] args) { MathGame game = new MathGame(); System.out.println("Enter 1 for simple calculator. Enter 0 to skip. Enter -1 to stop."); double timeStart = (double)(System.currentTimeMillis() / 1000.0); for(int i = 1; i <= questions; i++) { num1 = (int)(Math.random() * 99 + 2); num2 = (int)(Math.random() * 99 + 2); System.out.println(i + ") " + num1 + " * " + num2); while(answered != true) { System.out.print("Answer: "); answer = in.nextInt(); try { if(answer == 1) { System.out.print("Calculator: "); game.calc(); System.out.print("Answer: "); answer = in.nextInt(); } if(answer == 0) { continue; } if(answer == -1) { break; } game.isCorrect(); } catch(InputMismatchException ex) { System.out.println("Please enter valid input"); } } } double timeEnd = (double)(System.currentTimeMillis() / 1000.0); in.close(); double time = timeEnd - timeStart; int min = (int)time / 60; double seconds = time % 60; System.out.println("\nYou got " + count + "/" + questions + " right."); if(time > 60) { System.out.printf("Time elapsed: %d min %.2f seconds\n", min, seconds); } else { System.out.printf("Time elapsed: %.2f seconds\n", seconds); } } public void calc() { Scanner in = new Scanner(System.in); int var1 = in.nextInt(); String op = in.next(); int var2 = in.nextInt(); int result = 0; if(op.equals("+")) { result = var1 + var2; } if(op.equals("-")) { result = var1 - var2; } if(op.equals("*")) { result = var1 * var2; } if(op.equals("/")) { result = var1 / var2; } System.out.println(var1 + " " + op + " " + var2 + " = " + result); } public void isCorrect() { if(answer == num1 * num2) { System.out.println("Correct!\n"); count++; } else { System.out.println("Wrong.\n"); } answered = true; } } 

    Here's the error:

    Enter 1 for simple calculator. Enter 0 to skip. Enter -1 to stop. 1) 75 * 8 Answer: and Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at MathGame.main(MathGame.java:30) 

    I'm pretty noob so I know this code isn't pretty, but I'm trying to work with what I know how to do. Messed around with try/catch and variable scope, but just keep getting different errors. I think this is the closest draft I've had to getting it to work. Any suggestions?

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

    Check if URL changes upon pageload [Java]

    Posted: 30 May 2019 05:45 PM PDT

    Hi I am trying to check if a URL changes upon page load.

    For example: https://i.imgur.com/iffwImC.jpg will change to https://i.imgur.com/removed.png upon page load.

    I was thinking maybe use Java's webview and once the page is loaded just check what URL it currently is at?

    submitted by /u/l_-_-_-_-_-_-_-_-_l
    [link] [comments]

    Page refresh when something is sent to it

    Posted: 30 May 2019 12:24 PM PDT

    Hi,

    I am currently making a website/simulation that runs people through some processes on different pages. Since the simulation is timed, I need a way for the webpage to refresh when something is sent to it. For example, if someone on page 1 sends a message to page 2 how can I have page 2 refresh when receiving that message?

    Another example of something like this is gmail. You do not have to refresh the page or even the little refresh button above all the emails, when you receive an email it just pops up without having to refresh, I want something exactly like that.

    Thanks

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

    What awaits a programmer without higher education?

    Posted: 30 May 2019 06:09 AM PDT

    Hello.

    I graduated from high school a few days ago.

    I'm thinking about higher education.

    The fact is that I'd like to be engaged in programming web applications, programming applications for mobile devices, Android for example, and programming applications for Windows.

    In most cases, these areas don't require higher mathematics, I know a lot of guys who work in these areas without higher education.

    But one thing stops me.

    I'd like to immigrate to another country. The United States is the best option for me.

    I'm from Ukraine.

    Those who have higher education, have a chance to immigrate higher than those who don't have higher education.

    First, I don't have high marks from my school. The chance to do this year in my country is low.

    Secondly, I believe that I can learn everything I need on my own.

    I'd like to ask a professional programmers about higher education.

    What awaits me if I don't get higher education?

    Is it possible to go without higher education?

    If you know programmers who don't have higher education. Can you share their experiences?

    Thanks in advance!

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

    Recommended sources for learning image processing pipeline?

    Posted: 30 May 2019 03:13 PM PDT

    I am still a first year computer science student who is quite unfamiliar with this topic.

    How much time does it take to learn and any recommended sources?

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

    Show/Hide Div Element

    Posted: 30 May 2019 01:11 PM PDT

    http://prntscr.com/nvl83f

    I'm trying to show/hide a picture through a div element and a button. The problem is that the photo is already showing, I want it to be hidden until the button is clicked.

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

    How to repartition an SC-Card when you only see one partition.

    Posted: 30 May 2019 12:00 PM PDT

    Thanks in advance.

    I have got a problem and have problem formulate it.

    I wrote a RaspberryPi-Image on an 8 GB SD-Card. This created to partitions boot(16 MB) and another with ~ 7,9 GB.

    Now I wanted to use the SD-Card for something else but my WINDOWS PC can only detect the boot-partition.

    Does anybody now a tool that detects both partitions and let me put them back together into one partition and will I need another operating system then windows?

    Thanks for any advice.

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

    is it possible to make an app with a jupyter existing code?

    Posted: 30 May 2019 10:37 AM PDT

    well i have a code that's already working very well but my teacher asked me to make it more "friendly" 'cause he says that it is very complicated to run and to find the widgets, i have like 4 days searching about making that code into an app or mething, the inly thing i found was an online method in google with "io" but the internet here sucks so i was looking for someone who help me, i just need to know if there's any possible way to "conver" a jupyter code to a computer "app", the convert to ".exe" doesn't work as i wanted.

    thenks for your attention :3

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

    What are my options to auto-adjust photos? (exposure, highlights/shadows, color balance...) [x-post r/webdev]

    Posted: 30 May 2019 04:11 AM PDT

    Hi, I'm looking for a means to process photos similarly to what most smartphones offer as "auto-enhance photo" – a fully automatic ("smart") adjustment of curves, colors, white balance etc., ideally with little to no over-adjustment effects (ruining good photos).

    The intended use is for a print-on-demand web app.

    I've done some googling, but came up empty handed.

    I was hoping for a robust solution along the lines of webkit filters, css blend modes, or even server-side dlls, or cloud solutions like Azure's Computer Vision (which does have some neat image processing but doesn't offer auto-adjust as such).

    I'm a product manager, so my tech knowledge is limited; maybe I'm missing something obvious? Or is the most probable way forward through github, scouring for smaller projects and hoping for the best?

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

    can some one help me find pdf.js alternatives

    Posted: 30 May 2019 05:15 AM PDT

    I there any alternative for mozilla's pdf.js for converting pdf files to png or any other raster formats with out pre-processing the pdf in the backend.

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

    Help in JAVA

    Posted: 30 May 2019 08:41 AM PDT

    Hi, I´m making a game in JAVA, a 2048 (customized), and I want to be able to save and load the game and I dont Know how.

    My 2048 has 2 players, and is a "battle" and the last standing wins.

    There is the class "Game" that has 2 "Player" and each player has a "Board". (just for you to understand a little bit more my code).

    How can I save this game with the objects and all? The idea is to save it in a File and encript this file or make it unreachable for the user and modify the game saved.

    Thanks!

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

    What does this entry in an `strace` mean?

    Posted: 30 May 2019 02:07 AM PDT

    I have the following shell output:

    [OP@~]$ strace okular file.pdf /* snipped */ write(13, "\1\0\0\0\0\0\0\0", 8) = 8 futex(0x5576a0f79370, FUTEX_WAIT_PRIVATE, 0, NULLSettings::instance called after the first use - ignoring Invalid Context= "Legacy" line for icon theme: "/usr/share/icons/Adwaita/8x8/legacy/" Invalid Context= "Legacy" line for icon theme: "/usr/share/icons/Adwaita/16x16/legacy/" Invalid Context= "UI" line for icon theme: "/usr/share/icons/Adwaita/16x16/ui/" Invalid Context= "Legacy" line for icon theme: "/usr/share/icons/Adwaita/22x22/legacy/" Invalid Context= "Legacy" line for icon theme: "/usr/share/icons/Adwaita/24x24/legacy/" Invalid Context= "UI" line for icon theme: "/usr/share/icons/Adwaita/24x24/ui/" Invalid Context= "Legacy" line for icon theme: "/usr/share/icons/Adwaita/32x32/legacy/" Invalid Context= "UI" line for icon theme: "/usr/share/icons/Adwaita/32x32/ui/" Invalid Context= "Legacy" line for icon theme: "/usr/share/icons/Adwaita/48x48/legacy/" Invalid Context= "UI" line for icon theme: "/usr/share/icons/Adwaita/48x48/ui/" Invalid Context= "Legacy" line for icon theme: "/usr/share/icons/Adwaita/256x256/legacy/" Invalid Context= "Legacy" line for icon theme: "/usr/share/icons/Adwaita/512x512/legacy/" Invalid Context= "UI" line for icon theme: "/usr/share/icons/Adwaita/scalable/ui/" org.kde.kcoreaddons: Expected JSON property "X-Purpose-PluginTypes" to be a single string. but it is a stringlist discarding "Send SMS via KDE Connect..." "ShareUrl" ) = 0 futex(0x5576a0f79320, FUTEX_WAKE_PRIVATE, 1) = 0 /* snipped */ 

    How do I interpret the middle call to futex? Namely, there are a few things I don't understand:

    • what is going on with the fourth argument? According to futex(2) in the manual, the prototype is

       int futex(int *uaddr, int futex_op, int val, const struct timespec *timeout, /* or: uint32_t val2 */ int *uaddr2, int val3); 

      however, I don't see how this has type *timespec.

    • In my version of the manual, the futex_op FUTEX_WAIT_PRIVATE is not described.

    I'm running Arch Linux, and strace version 5.0.

    EDIT: for context, what's happening is basically this problem. I was looking at the system trace hoping to gain some information. The reason I did this is because for some reason, the error message is displayed on my terminal, despite not being written to stdout or stderr. But in order to understand why, I think I need to understand this futex syscall.

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

    Is it possible to create an alert when there is a computer sound

    Posted: 30 May 2019 08:02 AM PDT

    I have a friend who does day trading from his computer at home. While his trading program works well when he is at home, the program lacks features for sending alerts when he is away from home. We have been brainstorming at possible solutions and would love to hear if anyone has a better idea than us (we don't have many).

    The problem: when he steps out of his home, he is unable to hear his computer sound alerts when a specific event happens (price level is reached, stop loss, etc). We would need to somehow receive an alert to his phone (sms? email? app notification?) relatively quickly (ideally under 15 seconds).

    Ideas: we had several ideas but not too many good ones... we thought of having a walkie talkie next to the microphone, having a call going between two phones while he is away, having a noise alert hardware (we saw one called NoiseAware),... None of these solutions seemed very good, some pricey and some not very feasable.

    Question: I always like to go the programming route if possible, so do you guys think its feasable to program for example something when a noise happens (either loud enough or the alert specific noise) we can somehow get a quick notification on a different device? If it's possible, if you would be so kind to also let us know what would be the best programming language to create something like this so that we can search for a programmer with those skills.

    I really appreciate any ideas!

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

    Windows console program question

    Posted: 30 May 2019 07:33 AM PDT

    I have some windows console windows program, when I run it I can set some console options like font or window size in the console menu.

    What's interesting is that when I change and recompile program, and run it again, the last console settings are still active.

    Where does Windows store the settings ?

    PS: If this is relevant I'm using win7, Visual Studio and .net4

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

    Taking coding notes: jupyter notebook vs github gists?

    Posted: 30 May 2019 02:42 AM PDT

    Hi, I know this topic frequently comes up but hopefully this won't be an exact duplicate of previous posts.

    I'm looking for a way to save coding patterns and commands (mainly in python and related libraries) alongside some comments and easily be able to search through them (maybe adding some tags for quick search). Syntax highlighting would be a nice plus to have.

    I am currently considering jupyter notebooks and github gists. At the moment I am more biased towards the former, but I'm open to suggestions!.

    Any feedback or experience is greatly appreciated!
    Thanks

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

    Can I create a macro/program that navigates a webpage and downloads a spreadsheet?

    Posted: 30 May 2019 05:42 AM PDT

    Hey everyone,

    At my internship I have a handful of tasks, one of which is to prepare a spreadsheet in a particular format by adapting one I pull from a company portal site.

    Normally I have to click on the type of query I want, type a range of dates and which project I'm accessing, and hit enter. At this point, a customizable spreadsheet appears with rows and columns depending on what pieces of information you're interested in. You can drag and drop rows and columns on and off the spreadsheet. Normally I drag four query rows off and then add two rows. Then I would click the "export to excel 2000" button and make sure to save as an excel file rather than a webpage.

    I have to do this multiple times a month, and it takes a while because the site is slow. It'd be real convenient for myself (and would probably make me beloved by company managers everywhere in the company who are forced to use this obnoxious system) if I could automate this process. I'm not a CS whiz, so Please bear with me. My questions are as follows:

    -This is a company site. Would trying to access data in an automated fashion make it look like someone was trying to steal proprietary data?

    -This May be a sort of application/website combo. It seems to be run through a different application than explorer- some company portal that I had to get special permission to access. Does that make this harder?

    -Is there some way to program the location of my data entry and geography of my mouse clicks/drags/drops such that a program/macro navigates the webpage as I would in person, or will need a better understanding of the inner mechanisms of the site to do this?

    Thanks so much for your advice in advance!

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

    Confused about what firebase is and how it works and whether or not I should use it

    Posted: 30 May 2019 04:34 AM PDT

    I have an idea for a website and firebase seems like a good option, but I have a few questions. Is firebase a good choice for someone working on a project by themselves and would it be a good choice for making a website (I plan on making an app that goes along with the website eventually)? I've also read about there computer vision kit and would it be possible to just have the image someone takes on there phone to be sent to the database and have all the image classification be done there? For my website if I purchased a domain from a different source could I do something that would allow me to use the domain with firebase to host the website instead of using the hosting service the original domain provider has? Also would I have to learn any languages for the database part other than java for my project, since I'd prefer to have everything other than HTML/CSS, JavaScript and Flutter (its for making apps for ios and android) be written in Java since thats the language I know the best?

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

    If I want to build a simulator for an evolution simulation, what can I use with Python?

    Posted: 30 May 2019 01:33 AM PDT

    So I'm a software engineer, I have a lot of experience writing code in various languages, but lately I've been doing a lot of Python.

    I'd like simulate things such as birth/death/mutations of artificial organisms using math (easy to do in any programming language) but I'd also like to have a way to render these organisms in 3D using custom models and what not.

    I've heard Blender has some python hooks, but I was wondering if there's any pure python libraries that I could just import and run along with? My experience with blender is limited, but I'm willing to learn if that's truly the best option...

    I'm also open to suggestions on other languages/3d solutions, but I'd prefer the easiness and quickness of Python development...

    Also, if this isn't where to ask the question, I'm also open to directions

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

    No comments:

    Post a Comment