Trying to connect a Python script to React JS Ask Programming |
- Trying to connect a Python script to React JS
- How does reddit query sorted posts from their database ?
- Help with getting the backbone for an educational resource running? (web/js but I'm willing to learn whatever). I swear I'm dealing with something trivial.
- Is a Udemy certificate worth anything?
- What code to use for file index/database?
- Phython or Java for business/accounting software?
- C# or Python for Linux?
- How to prevent the html canvas from 'rotating' the squares in a dashed line.
- Mac Automator - Creating folders from a calendar event?
- Python or R for ML?
- beginner level programmer (python), i’ve just come across this, what does building something like this entail?
- Need HELP for my C code
- "Declaration or statement expected"
- Implementing some kind of Fourier transform to locate a radioactive source
- Integer factorization using a binary tree
- What Language for Parallel Operations (more detail within)
- Why doesn't the following merge-sort code (in C) print the proper result?
- Hello guys we need your help!
- Containers for Privacy?
- Why is there different brace positioning in different languages?
- Drawing a sprite vs drawing via a vector (HTML Canvas)
- Languages of the future?
- How do I make so a certain protocol only initiates if something = = true 5 times per time period [Arduino PIR-Sensor]
- What has this program been written in? It's been compiled/transpiled in JavaScript.
Trying to connect a Python script to React JS Posted: 29 May 2020 04:06 PM PDT In short, I'm using a python script to output JSON data from a database and I want to feed that JSON data onto a React platform. I am currently using Google Cloud SSH to host my python script from a github repository, and I've got that pretty much working. I am currently looking for a way to get that into React, but its very possible I am overcomplicating things. Any help would be much appreciated [link] [comments] |
How does reddit query sorted posts from their database ? Posted: 29 May 2020 05:47 PM PDT I can't seem to find the answer in the reddit source code archive ! I know from the documentation that they take N posts before or after a certain ID after sorting a post, but I don't know how did they make a query that does that. Does anyone know ? [link] [comments] |
Posted: 29 May 2020 05:25 PM PDT Overview Link to a zip of the offline copy. Sorry, I'm sure there's an easier way to post this file, but I'm having too much fun owning an FTP for the first time since the 90s at the moment. Here is the totally-not-working online version of the page Context: I'm an animator, but also former engineer so I'm not afraid to sit down with whatever for a weekend and learn it. I'm trying to post up my thesis work in a way that other animators can dissect it. That means frame-by-frame analysis and using relatively uncompressed media. What I'm trying to do: Make a frame scrubber display for 60 frame loop, though there are about 20 panels so this adds up quickly when you swap between fighters. This page doesn't have to be massively browser compatible and can load in an ungodly slow manner. It just has to work in chrome/firefox. And play smoothly once it DOES work. Problem(s):
Like I said just point me at something! I'll try to learn and do the rest. [link] [comments] |
Is a Udemy certificate worth anything? Posted: 29 May 2020 03:08 PM PDT |
What code to use for file index/database? Posted: 29 May 2020 06:04 PM PDT Hi, New to reddit so hope this one is appropriate for my question. I'm working on a website. I have code to overlay Image1 with Overlay1 on top of it. I know how to do that. What I'm looking for help with is this: Image1 is in many places, all over the website. Multiple different pages, many different posts. I want to set up something that basically says: Anytime Image1 (filename) appears on a post or page, overlay Overlay1. I need Overlay1 to show up on probably Image1, Image5, Image10, Image12, etc ANYTIME their filenames appear. I've tried to google but I think I'm using the wrong terms. Could I use an "if then" statement? Some kind of script? Thank you for any help! (I know html, php, css, javascript) [link] [comments] |
Phython or Java for business/accounting software? Posted: 29 May 2020 04:38 AM PDT My family owns a small company and I would like to build an app for their business process, nothing fancy, just a tool with a friendly GUI, that helps with processes such as tax calculations, accounting and that be able to print the data on templates (like invoice template). I started to learn web-dev about a year ago but on the way I discovered that what I really want to learn is building softwares like the one I just described above. Python is really popular these days and it has Tkinter but somewhere I read that that it's not very popular among companies for these kind of apps and Java or even C# would be a better option in the long--term. What would you recommend? [link] [comments] |
Posted: 29 May 2020 11:36 AM PDT |
How to prevent the html canvas from 'rotating' the squares in a dashed line. Posted: 29 May 2020 09:57 PM PDT If I have a circle path and draw it with a dashed squares, the squares rotate and contort with the path. Is there a way to simply 'stamp' squares along the path instead? [link] [comments] |
Mac Automator - Creating folders from a calendar event? Posted: 29 May 2020 06:06 PM PDT Hello there, before I go down a bit of a rabbit hole as I'm not an experienced programer, is it possible to create a folder from a calendar event? Basically we shoot a lot of videos where I work. Those videos are scheduled into peoples calendars (google cal / busy cal) and those shoots become projects. Which are setup with project folders with specific naming conventions. Every time we have a new shoot I need to create a folder. I use the details of the calendar entry as the details for the folder, it's not just copying and pasting the heading however there are some variables, like adding client code from notes, job number from heading, project name, address, and putting in a specific order. Before you ask! I have looked at how we book videos at the other end and how they get put into the calendar and getting the names sorted properly out there, but for the time being this isn't an option for many reasons I shell not go into because I wasn't around when it was setup (: I also then need to copy and and paste a template folder structure for specific clients into those folders. It's a very robotic task, will it be possible to have something that gets a specific entry from the cal, by using a note in the cal event for example (so it doesn't just add folders for everything in the cal), then creates folders in a specific location? We have a little bit of experience with things like zapier, that takes calendar entries and creates job cards for us in favro. [link] [comments] |
Posted: 29 May 2020 07:45 PM PDT Hi, I have been using python extensively for implementing machine learning frameworks using sci-kit learn, Keras, and of course pandas for data handling. Recently I have also come to use some R for topic models etc. I am confused as to which language is better suited/has better tools for ML, is R the one to use and has more scalable implementations? [link] [comments] |
Posted: 29 May 2020 07:23 PM PDT |
Posted: 29 May 2020 03:25 PM PDT Hi guys. I need someone to check my code that has written in C to troubleshooting. My code is taking the 2 numbers from the user for indicating the category. According to the category, the writer takes the 3 lines of poems from a related file, store it to the array. And message queue takes those poems from array to send it to the server(reader). It's almost done but I problem, the data can be sent to message queue due to the memory segment. And I've reached the warning that appeared because of the wrong allocation of array or data that has been taken from files (or because of something different that I don't understand). And still, I cant fix it. I think, at last, need mentor help. Can anyone help me with it, please? It's very important. Thanks in advance. [link] [comments] |
"Declaration or statement expected" Posted: 29 May 2020 07:06 PM PDT I'm getting an error "Declaration or statement expected." at the </html> tag, and "Expression expected." at the </html> and </body> tags. I think I might have an extra bracket somewhere, but I don't know where. Can somebody explain what I'm doing wrong and how to fix it? The html file is here (sorry for the comments)
[link] [comments] |
Implementing some kind of Fourier transform to locate a radioactive source Posted: 29 May 2020 03:06 PM PDT Hello everyone, My problem is the following (language used : Python) We are working in 2 dimensions, x and y. I have a radioactive source, that emits two gamma photons randomly from any points of the source, with a given angle theta with the x axis. Fun fact, these photons are intricated, but more important, they are emitted in two opposite directions, so their pathes are on the same line, but with opposite directions. I don't know what shape of this source is (a square, a disk or something completely different, it doesnt even have to be continuous), it is just an area on the plane. I only know that the source has a finite length, which means I have borders xmin, xmax, ymin and ymax so that, for each point (x,y) in the source : xmin < x < xmax ymin < y < ymax My goal is to determine precisely the shape of this source - it has applications in PET scanners, which are used in tumors treatment for instance, but that isn't today's question. To do this, I have two detectors, that are, in this plane, segments of length R parallel to the y axis. These detectors count how many times both emitted photons are detected : if one photon is detected, but the other is not, we don't count the pair. These detectors are put face to face. Then, I translate them while the distance D between them remains constant. For instance, if I call (xd,yd) the coordinates of the middle of the first detector, the other one's coordinates are (xd + D, yd), and the range of positions of the first detector during my experiment are numpy.linspace(xd-L,xd+L, num = N) and numpy.linspace(yd - l, yd + l, num = N). In each position, I simulate N' double emissions, with a theta angle randomly chosen, and I count how many times both photons are detected. I obtain a function f(xd,yd), where (xd,yd) are the coordinates of the first detector at each position, and I must use this function to reassemble the shape of the unknown source. My idea is the following : I map the area where I know the source is [xmin,xmax] and [ymin,ymax] with KxK infinitely small sources (reduced to a point), with K >> N. Each of these source simulates alpha_i_j * N' double emissions, with sum_i(sum_j(alpha_i_j) = 1 so that at the end exactly N' double emissions are simulated. Then, I repeat my experiment : move the detectors, and at each position, simulate N' double emissions, with the process I previously described, and count how many times both photons are detected. I obtain another function g(xd,yd). I repeat until, for instance, the average square deviation between f and g is low enough to me. Problem is : I've no idea about the shape of my source, and therefore I randomly chose the apha_i_j distribution everytime i repeat. Not surprisingly, my algorithm never terminates ! Any idea of maybe an heuristic I could use to make it almost sure my algorithm terminates ? PS : really sorry about my english, I'm not used yet to write about complicated problems like this in english. PPS : I think this subreddit doesn't tolerate pictures, but if asked I can provide my code and/or pictures by email or so. Thanks in advance ! [link] [comments] |
Integer factorization using a binary tree Posted: 29 May 2020 06:36 PM PDT Hey there. A while ago, I accidentally stumbled upon an integer factorization algorithm using a tree structure. I say stumbled because it was the result of following a seemingly random idea on paper, and after pages of number crunching with different numbers to disprove the it, I had to accept the fact that the stupid idea is working. My math skills being (shamefully) close to non existent,so I'm not sure how the whole idea would translate into a formula, or even how to search for something similar on the all-knowing internet. I'd like to know if the idea is already implemented (most probably in another form), or if there is anything similar out there. Wall of text incoming.. Since the whole point was to work with binary numbers, the resulting structure was a binary tree. The algorithm works by taking a number and building a binary tree starting from the least significant bit, by comparing the result on the current node with the number, and choosing the next most significant bits of X and Y. Let's say we have the number N = 10101. We start at the root node with X = 1, Y = 1 and current result R = 1. By comparing the second bit on R with the second bit on N, we have the case R[1] == N[1], thus the child nodes are left(X[1] = 0, Y[1] = 0) and right(X[1] = 1, Y[1] = 1). If we go with the right node, we calculate X*Y (11*11) and we get R = 1001. Then the 3rd bit of R (0) is compared with the 3rd bit of N(1), and we get the child nodes left(X[1] = 1, Y[1] = 0) and right(X[1] = 0, Y[1] = 1). Repeating this process, will yield the results 1 and N (if we keep choosing the nodes where one of the factors always stays 1), a LOT of gibberish results, and all pairs of numbers that multiplied will give the result N (if the number has more than 2 prime factors, say a, b and c, results will be (a and b*c), (b and a*c) etc). After a notebook's worth of wasted paper, and a lot of poorly drawn tree structures, I've concluded the maximum necessary tree depth was (length of N)/2 (later to find out it was Fermat's little theorem in disguise). I also found some other ways to cut away at the size of the tree, but I will not bore you any further. To test it without wasting countless hours and killing entire forests, I implemented a version of it in C, with GMP libraries to bypass the 64bit int limitations and preserving some speed(since GMP arithmetic operations are written on assembly level, I doubt anything I could have done myself would even come close). After fixing the bugs, the algorithm seems to be working, at least for numbers up to 80 bits, since I did not get to implement a multi-threaded version of the code yet, and test runs at this size take about 2 hours to run, processing time doubling with every extra bit. The interesting part is that given the right arrangement, the calculations can be distributed among multiple threads(or different machines altogether) as sub-trees, without the need for a constant connection (like in the case of number sieving) or any actual information besides X and Y. And better yet, given some more fiddling, different ways of iterating the tree could prove to be even faster. For those of you who lasted this far, have you encountered anything like this before? Is there anything worth pursuing here, or am I reinventing the wheel? Any help would be greatly appreciated :D P.S: I am wildly aware of how inefficient this approach is, since the number of nodes generated for any number would be 2^(sizeOf(N)) without any optimizations. Also, to prevent my CPU from bursting in flames, the algorithm does NOT use multiplication at any point of the iteration. [link] [comments] |
What Language for Parallel Operations (more detail within) Posted: 29 May 2020 07:34 AM PDT I want to try to make an automated stock/option trading program. I have limited programing experience. Last thing I did was Matlab in college, years ago. My reason for posting here is to get suggestions on what language to use. I think multi-threading would be required, which is why I have not been able to figure out which language I need to learn. The general principle would be as follows: Program constantly grabs stock ticker data, via trading broker's API (last price, bid/ask, volume, etc.) for dozens to hundreds of tickers, and does this once a minute or as often as once a second. Then it would add that data to a data file, and keep doing that throughout the trading day. Concurrently, it would analyze all existing data for tickers in that data file and look for trends that meet specific criteria. When tickers meet those criteria, the program tells a brokerage via its API to execute a trade. Then it monitors positions and will tell the brokerage API to close the trade when some criteria for the price is met. That's the basic concept. It appears like the program needs to do several things at once. Analyze all of the tickers simultaneously. Possibly ping the broker API for ticker data for numerous tickers concurrently (if that's even possible). I don't know how fast the typical language operates. If it runs fast enough multi-threading might not be necessary. If I only need to get ticker data once every 10 seconds or something like that, it may be easy for the program to get ticker data for something like 100 stocks, for each add half a dozen data points to the full data set for each ticker, analyze all the old data for some fairly simple criteria within that 10 seconds. My understanding is if true multi-threading is required, python is probably not appropriate it, but if it is not, then python might be fine. Thanks in advance. [link] [comments] |
Why doesn't the following merge-sort code (in C) print the proper result? Posted: 29 May 2020 04:08 PM PDT [link] [comments] |
Posted: 29 May 2020 12:14 PM PDT We are group of 3 young programmers (17-18 years old) and we are trying to find an idea for an app which is going to be useful in our everyday life. We are fluent in C++, C, Java, (HTML, CSS, JavaScript for web development), and lastly Python. We all have the time and will to start a project and not abandon it halfway through. Lastly, we would be grateful if you could help us with any of your suggestions. Thank you for your time! [link] [comments] |
Posted: 29 May 2020 02:38 PM PDT This question comes as mostly the afterthought of a showerthought. I don't know much about containerization though so the answer might be simple and plain had I a little more knowledge. Just wanted to satisfy my curiousity. Can a container be used for Privacy purposes? I assume there is storage involved but have no idea what limits might be imposed. Let's assume though that it could be a lot, say 1 TB for example. If I then wanted to have collections of containers that held content and make it available could someone else grab a container, read from it what they want, and destroy it without a trace? My guess is the answer is I'm an idiot and that's not the way any of it works. If so, that's a perfectly acceptable answer in my book. [link] [comments] |
Why is there different brace positioning in different languages? Posted: 29 May 2020 10:18 AM PDT For example, most java programmers would do public class Test { } Whereas C# programmers would put public class Test { } Is there a reason for this or is it just preference? If so, why do most programmers using a certain language use the same curly brace positioning? [link] [comments] |
Drawing a sprite vs drawing via a vector (HTML Canvas) Posted: 29 May 2020 02:01 PM PDT Hey there. I'm working on a game for a jam right now. The sprites for the game will be stylized to look like this (Mobile users: https://cdn.discordapp.com/attachments/559163894837411850/716007276426559498/New_Drawing-2-Layer_6_Copy.png ). However I wanted to give the sprites more character by randomly moving the lines/fill which means having to redraw every sprite a couple of times and playing a animation, and since some of those sprites will have different states/animations of their own I now need to draw multiple frames for every frame of a sprite on my sheet. This sounds absolutely terrible. As an alternative I've decided it would be better (and much cooler) to instead have my sprites be vectors/a collection of points, create a renderer that traces squares along the lines they make to emulate the style, and simply re-draw them every half second or so with slight variations in each point's location to create the same effect as drawing multiple frames while maintaining the style. I was wondering how much better/worse performance would be since this is a web game, I was hoping to make it compatable with smart-phones, and browsers obviously have much less power to work with in both pc and mobile environments. [link] [comments] |
Posted: 29 May 2020 07:44 AM PDT What anguages do you think are going to be the most demanded on the future? [link] [comments] |
Posted: 29 May 2020 12:21 PM PDT So this is a tough one for me. Basically, here's my assignment: I have a motion sensor, and if cars pass the motion sensor more than 5 times a second, a certain protocol needs to initiate. I don't know how to word it exactly, but here's what I've got: int greenPin = 13; int redPin = 12; // choose the pin for the LED int inputPin = 2; // choose the input pin (for PIR sensor) int pirState = LOW; // we start, assuming no motion detected int val = 0; // variable for reading the pin status void setup() { pinMode(redPin, OUTPUT); // declare LED as output pinMode(greenPin, OUTPUT); pinMode(inputPin, INPUT); // declare sensor as input Serial.begin(1000); } void loop(){ val = digitalRead(inputPin); // read input value if (val == HIGH) { // check if the input is HIGH digitalWrite(redPin, HIGH); // turn LED ON if (pirState == LOW) { pirState = HIGH; } } else { digitalWrite(redPin, LOW); // turn LED OFF if (pirState == HIGH){ pirState = LOW; } } } - What I have now is whenever the motion sensor returns HIGH ( I move my cursor in front of it) The Red light will start to burn. I need the Red light to only start burning after more than 5 cars per second pass. else, the Green light needs to keep burning. I understand if you guys don't understand so ask anything you don't understand. [link] [comments] |
What has this program been written in? It's been compiled/transpiled in JavaScript. Posted: 29 May 2020 11:45 AM PDT Some friends ran into a piece of non-minified JavaScript on the Internet. It uses some very weird patterns. It has obviously been generated (transpiled from another language) and we've been trying to figure out what the original language was. The code is here: main.js. It's from 2016. We suspect the original language is statically typed and has operator overloading. It might or may not be a language meant for the JVM. This treasure hunt is somewhat challenging and for no real purpose, just fun. A few good coders have been scratching their head over this for a few hours and I thought it was fun to offer the challenge to a larger audience. The following are some observations we made. They might help finding the source language, or might be false leads:
[link] [comments] |
You are subscribed to email updates from AskProgramming. To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google, 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States |
No comments:
Post a Comment