Hello guys can somebody help me refractor my code? I don't have any idea on how to use Object oriented. This is part of Link.
$punch_in = "2019-07-01 07:16:00";
$punch_out = "2019-07-01 18:00:00";
$in_threshold = "2019-07-01 08:15:00";
$out_threshold = "2019-07-01 17:15:00";
$exact_in_thresho...
I have case that I want in the first page I can choose the video URL or source from the local file by using form, and after I submit the form, it will pass the variable that contain URL or Source and call the function on another page so the video will playing on the second page. I've tried pass v...
I have written a bilinear interpolant, is working moderately well except that is painfuly slow. How can rewrite the code to make it faster (using opencv directly isn't a valid answer). The snippet is below:
import numpy as np
import numpy.linalg as la
import matplotlib
import matplotlib.pyplot a...
I'm learning GLSL shaders on Book of Shaders and I decided to mess around with one of the examples. I wanted to see, whats a more efficient way to calculate to mask out the color?
#ifdef GL_ES
precision mediump float;
#endif
#define TWO_PI 6.28318530718
uniform vec2 u_resolution;
uniform float...
hi I have made and AI for my enemies which works perfectly but a particular section of code is repetitive and I feel that it can be optimised
void ChangeDirection()
{
if (movement == Vector3.left)
transformModel.rotation = Quaternion.Euler(0, 270, 0);
else if (mov...
I'm voting to close this question as off-topic because this question fits best on codereview.stackexchange.com, since the code currently already works correctly. — dbc37 secs ago
Hello guys can somebody help me refractor my code? I don't have any idea on how to use Object oriented.
$punch_in = "2019-07-01 07:16:00";
$punch_out = "2019-07-01 18:00:00";
$in_threshold = "2019-07-01 08:15:00";
$out_threshold = "2019-07-01 17:15:00";
$exact_in_threshold = "2019-07-01 08:00:...
I spent some time today trying to write FizzBuzz in a functional/declarative style. I thought it would be a good chance to get some feedback on it since I've been doing functional programming for about a year now.
(I know there are some similar questions asked here before, but their approach to ...
I have written some code that transforms 2 way matrices into 1 way matrices. Although it's comfortable to use, it's very sluggish and slow in execution. Does anyone have any idea how to improve the performance? I'm aware that the same transformation can be done with standard formulas, but solely ...
https://github.com/HardikM1999/WikiLinkMapper
I would like some suggestions on how to make it better and also if any features that i should add to this Script. I am using beautifulsoup,requests for scraping and networkx for plotting the graph.
import requests
from bs4 import BeautifulSoup
impo...
I'm making use of RxJS and observables within my Angular application to process the results of API calls and process data. I've written the component and it works without any issues. However after further research into RxJS and observables I've became aware that the way in which I am using subscr...
the website I'm developing allows customers to book an appointment. They can also cancel their appointment with the following rules:
if the appointment is cancelled between 48 hours and 1 hour in advance, the customer has to pay 50%.
if the appointment is cancelled below 1 hour in advance, the ...
Hey am a noob and am trying to solve a problem at hackerEarth now in testcases inputs are big enough like num = 100000 and query = 10000 https://www.hackerearth.com/practice/data-structures/arrays/1-d/practice-problems/algorithm/range-query-2/ please check this link if you don't understand my...
The idea is not match for /orders and then match again for /products and vice versa.
if(request.getPathInfo().matches("/users/(.*)")) {
Matcher matcher = Pattern.compile("/users/(.*)").matcher(request.getPathInfo());
if (matcher.find()) {
System.out.println(matcher.group(1));
...
@Heslacher now I'm really confused; that link in my answer doesn't say much about zombies, but the Meta post actually about zombies appeared after my answer... either I've forgotten how time works, or... I don't know, but it's mildly disturbing. I do at least understand your comment now, so that's progress of sorts.
Print sums of all subsets of a given set
Problem summary : Print all subset sums of a given set of integers
My approach is to store previous results and use them to calculate new (similar idea as DP).
SubsetSum.cpp
#include<iostream>
#include<vector>
//using namespace std;
bool isPowerOf2 ...
Hi there Eva. This kind of question I think would be better asked on Code Review. This appears to be a question about code quality and not about a specific problem. — Mike - SMT59 secs ago
On this frabjous day, our community manager Rebecca Chernoff has graciously allowed all of us *1 to be her for one day, and one day only. And so, ladies and gentlemen, let me present to you:
We're all Rebecca Chernoff \o/
A userscript dedicated to making all of you Rebecca Chernoffs. Reall...
I made a program to explore the symmetries of an equilateral triangle using Python and Turtle Graphics. It's formatted using Black Playground.
As usual, my goal is to be writing "code that doesn't suck." What do I need to to to achieve that goal is this instance please?
I'm guessing some repeti...
Some people may be having an issue with Slack. We’re currently investigating and will have more information shortly. Thank you for your patience.
Jul 26, 10:07 AM EDT
If you believe that the code works correctly, consider presenting your work (with its unit tests) in a more-complete fashion over at Code Review. You'll likely get some suggestions on making it more efficient, easier to read, and better tested. Before you do that, make sure to read A guide to Code Review for Stack Overflow users first, as some things are done differently over there - e.g. question titles should simply say what the code does, as the question is always, "How can I improve this?". — Toby Speight48 secs ago
Please review the Python Code for Parking Lot.
The requirements are basic like for a usual Parking Lot.
Kindly check the code quality on various measures.
Also, check from the functionality perspective and if something could have been done better.
Thanks.
from datetime import datetime
import t...
Good morning all - I have written a fairly large VBA program for work and I am looking for a few experienced vba coders who would be willing to take 30 minutes to an hour out of their day to look through the entire file and give me some pointers on the things I would like to do going forward, as ...
I'm new to PHP, and I wrote this script as a bit of practice. It's a tool for engineers to find out what fittings are needed to reach a certain angle of a turn, provided they have access to 8°, 11.25°, 22.5°, 45°, and 90° fittings.
To prevent problems with null inputs, "pipemain.php" is ran first...
To teach myself Rust, i implemented simple Quadtree over 2d Point with insert, delete, contain function.
So.. my code seems to me not "idiomatic rust code" also i think it not so fast.
Help me write more elegant and fast version!
P.S I'm add 2 test:
1.simple test for check code work
test t...
This is what Code Review does, Stack Overflow is better suited for specific Q&A. If you do post on CR, please note the title of the post should summarize the purpose of the code, and the body of the post should describe what's going on and why. — Mathieu Guindon16 secs ago
I am creating an iOS app and I want to implement Singleton Pattern.
I have created "Singleton" LibraryAPI to act as an entry point UserManager object to get data from web API. after that I used a facade Pattern "method" to call UserManager implementation.
final class LibraryAPI {
static let...
As as final project for a MOOC I wanted to write a program that finds the exact cover set/minimum dominating set from the given social network data. So I did end up with writing this. I kinda followed this algorithm.(https://www.geeksforgeeks.org/exact-cover-problem-algorithm-x-set-1/)
I did tes...
I have a semi-working project currently and am wondering if I am doing this the wrong way or if there is a more efficient. I will try to be as general as possible as to keep the point concise.
Any tips, suggestions, articles, ideas, etc. that you have will help me greatly. I am a one man show ...
Help
I have written a function which moves the last element of the linked list to front and returns the linked list.
Suppose, Linked List : 3 -> 2 -> 1 -> x
Output after executing change_order function: 1 - > 3 -> 2 -> x
But my output is 3 -> 2 -> x
Note: If I make change_orde...
A function that funnels all filenames into a file and opens that file in vim. The user then changes the names, saves, and quits. Finally the function renames the files in the folder with the new names provided in the file.
bulkrename() {
mkdir -p ~/.temp
ls > ~/.temp/newfilenames && nvi...
I am working on an iban api which is about saving the iban of some members after(iban validation) in a database. The code is split between Domain (entities, behaviour for iban validation), Database and its access (new member, retrieval, etc.).
I am looking for feedbacks about the async code and ...
I recently started coding in Python and it is bit difficult. For my assignment I have to calculate how many years the user will reach a million dollars. The user input how much they want to invest each year, and their interest rate. This is the code I have so far....
invest = int(input("How much...
I've been working on a minimalist DSL for authoring interactive fiction, and would love to get it reviewed. I'm more interested in getting feedback on the language itself, and any ideas for improving it, but of course feedback on the implementation is also welcome.
The project is tentatively ent...