instruction
stringlengths
71
71.9k
I have the following code that that writes large images to disk. My application server is running out of memory and I'm wondering if I could somehow optimize the following: public void writeImgToDisk(byte[] base64AttachmentInBytes, String dmxi){ String destinationAndFileName = ""; String fileNameMinus...
I did run this code through StyleCop. Goal was to optimize the reading, parsing and inserting of a file on the web and write the rows to a database table using a stored procedure. Contrast this (roughly) to my most previous code review here: C# helper class - mailto Different code but I feel like I'm making progress, f...
Here's some code that I've written for implementing a Convolutional Neural Network for recognising handwritten digits from the MNIST dataset over the last two days (after a lot of research into figuring out how to convert mathematical equations into code). """ Convolutional Neural Network """ import numpy as np impor...
I want to speed up the following code, which is from an algorithm class. I get a list of 200000 nodes where every node is a tuple of the length of 24 where every item is either a 1 or 0. These items represent a graph where the distance between them is the hamming distance(number of bits that two nodes are different). ...
Recently I had to add 2 different sets of logic for moving my player around the board. One lets the player pick a location and move him there while the other uses a dice. I'm reusing code for both cases and would like to "merge" them into one thing. Any help and suggestions would be greatly appreciated. void Update() ...
I am reviewing some C code (see extract below) that uses inline asm. I believe there are 4 spec violations, 1 inefficiency and 1 honking big design flaw in this code. While some of the problems I'm seeing apply to both the x86 and x64 sections in that code, this post is focused on x64. Before I'll be allowed to check...
We have a console application which runs to perform an incremental load of our data warehouse staging area, with data from a number of production databases. The source database don't necessarily have a rowversion/timestamp/etc. column so we are currently using change data tracking in SQL to load changes to the tables. ...
I just got into Node.JS and am loving it but I am wondering if I am learning it the right way or using it. This is basically a simple server in Flash but I want to see if am doing it right with handling client connections. This makes a new CurrentPlayer after it gets a login packet and sets the ID and username once the...
My question is about how to achieve a well-performing animation for a set of ImageViews, so that the foreground fades away and the background stays the same. Currently, I'm writing a clone of "Color Lines" for Android using a GridLayout as a board and ImageViews as game pieces. Every ImageView uses the same (circular) ...
I have updated my code from the last time it got reviewed. If anyone has some more suggestions on how I can improve this and/or make it faster it would be appreciated! def is_prime(num): '''Calculates whether num is a prime number, if it is return True otherwise return False''' # SPECIALCASE: These are spe...
Input: 1000 23 100 26 32 Output: 23 26 32 100 1000 Since 23 has '2' factors and 26 has '4' factors and 32 has '6' factors, and so on. Should I use a linked list for these types of problems? Is my code efficient? Or how can it be optimized? Code: #include <stdio.h> #include <stdlib.h> int facts(int); int main(...
I got a function to recalculate the image size based on two settings. Force ratio, force the requested ratio, default the original ratio will be used. Keepsmaller, the uploaded image may never become bigger If keep smaller is not enabled, by default we will focus calculation on the first reached, it's hard to explain...
I'm somewhat new to JavaScript and AngularJS, and read in Doug Crockford's book that hoisted function declarations can lead to issues. If you have any pointers on how to structure my file, those would be much appreciated. (function() { 'use strict'; function PlayerProfileStatsCtrl($q, ColumnService, LookupServ...
Connect Four kinda caught my eye, and I decided to start from the very basics. Here I have bare-bones implementation for playing the game between two human players on the command line: Board.java package net.coderodde.game.connect4; import java.util.Objects; /** * This class implements the actual Connect Four board....
I am trying to write the sum of selected NumPy array column and write to a file. The following code snippet is working fine: for i in range(int(ldata[2])): s_u.append(dos2[i][1]) s_d.append(dos2[i][2]) p_u.append(np.sum(dos2[i,[3,5,7]])) p_d.append(np.sum(dos2[i,[4,6,8]])) d_u.append(np.sum(dos2[i,[...
I have a library that will be called in multiple places. Here is my implementation: var vessel1 = new Vessel(); var vessel2 = new Vessel(); vessel2 should use the same instance as vessel1. The reason I need a singleton pattern here is because of my _initialize() function. It should only ever be called once and with my...
I am implementing a lexer for an experimental language by the name "Phoenix", the language supports four primary arithmetic expression for integers only (add, subtract, multiply, divide), variable assignment and print statement. Typical input: # this is a comment value = 1 + 7 / 4 * (30) print('Value = ', value) lexer...
This is my first decorator in Python! I found some of it on the internet but have tweaked it to our needs. Here is the couple concerns of mine: Multiple python version compatibility Is grabbing the self or arg[0] the best way to get the instance of the class? Any other general improvements! Here is the decorator. im...
I am wondering the best way to setup a database class, to remove repeat code by using OOP. This way if I changed how I connect to the database (switch from PDO to sqlsrv driver) I can just change it in 1 file, instead of all the files that use PDO. I've setup a class that I will show below, but I feel like it may be ha...
I built a small "todo" app with an object oriented JavaScript approach. I have spent this morning reading on a few ways to approach this, and I've come up with the following: document.addEventListener("DOMContentLoaded", function () { var todo = Object.create(null); todo.newTodo = function (evt) { evt.preventD...
Question How can the following implementation of fractionParse be made less ugly? (Preserving unreduced numerators and denominators is supposed to be a feature---as shown in the second example---so using readMaybe s :: Maybe (Ratio Int) doesn't really help.) Things that irked me in the process of writing it, include: ...
Any ideas how I could improve this? I already know that there is no checking for anything other than a 1, so you can enter a 2 or an a or a b and it will be interpreted as a 0, not interfering with the program's functionality. What I would like to know is if anyone has any suggestions for improving the logic. def main(...
I was wondering if you guys know how to reduce the amount of subselects in this SQL Server Query? I think I'm using bad practices in this: WITH TotalizedRepairOrders AS (SELECT SalesOrder,Items,DepartmentName, LastCompletedActivity,NextActivity,Plant,ParallelNextActivity FROM OrdersSynthesis) SELECT Plant, ...
This code queries the GitHub followers API and stores the graph in a mongodb collection: import java.util.Date import akka.actor._ import akka.routing.RoundRobinPool import com.mongodb.casbah.Imports._ import org.json4s._ import org.json4s.native.JsonMethods._ import scala.concurrent.ExecutionContext.Implicits.global ...
I submitted this script as part of a interview process. It was rejected and no reasons were given. I'm wondering what parts of my script were unacceptable. The script works, and satisfies the question, but I must be doing things very wrong. Use Selenium, Watir, Capybara, or similar to automate the following user wor...
I wrote my very first Python program to answer a Super User question. I'm wondering how the application can be rewritten to make it as pythonic as possible. Unit test import unittest import os import shutil from DeleteDuplicateInFolderA import DeleteDuplicateInFolderA class DeleteDuplicateInFolderATest(unittest.TestC...
I wanted to expand the UIFont class in my application so I could use the large/medium/small letters concept. I created but for some reason it looks weird. I finished it and it does what's is supposed to do but I am not happy with it. Usually when I have that feeling is because I am messing up big or just being a newbie...
I know the runtime for generating all permutations is supposed to be \$O(n!)\$. I'm not sure if the code I wrote for it runs in \$O(n!)\$ though. I'm having trouble analyzing its runtime. The for(char c: cArray) part is in \$O(n)\$. What about for (String s: currResults) and for (int i = 0; i < s.length() + 1; i++)? pu...
This is my battle system that I wrote in Lua. Bear with me on this one, this is my first real program that does something besides write hello world. If there is anything that I could have done differently, drop an answer down there and I will take your advice for my next program. Huge shoutout to Jakuje for helping me ...
I have Producer Threads A, B and C producing 3 different types of events Events A, B and C respectively. The Consumer thread can only process only one Event B at a time, where as it can process any number of Events A & C at a point of time. Event class: package codility.question; public class Event { private Stri...
This solves Project Euler 4: Largest palindrome product using C# (specifically, using LINQPad). Any and all suggestions for improvements to either the C# code or the math/algorithm are very welcome. A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is...
This is the x86 version of a C file assignment (I have included both). We were to convert the C code to assembly. I am rather new at assembly and would really appreciate suggestions and help for optimization and functionality. This is a C implementation of Dijkstra's recursive algorithm for computing the greatest commo...
I'm learning Swift and trying get a good understanding of some of its many features. The following is an AVL tree implementation with extensions that conform to SequenceType, CollectionType and ArrayLiteralConvertible Everything seems to work correctly. I wish to get some feedback on my overall approach, pointers on ho...
Input a binary tree (the root node) and 2 other nodes that need to be assessed for finding the least common ancestor (LCA) Code: a. Finding the nodes first with either breadthFirstSearch or depthFirstSearch b. If they both exist, find the LCA. What searching mechanism would be best here? Using breadthFirst for now. ...
import praw import time import database # Create a user agent and log into Reddit UA = 'OZBOZZ v0.1' r = praw.Reddit(UA) # Log UA into reddit with my personal user name and password r.login('', '', disable_warning='True') subreddit = r.get_subreddit('listentothis') current_time = int(time.time()) user = '' submission...
Input: Array of sorted integers and an element to check the frequency for Output: Frequency of the element public class FrequencyElement { public static void main(String args[]){ //System.out.println("Enter Input string"); int input_array []= {2,3,4,25,99,99,19000}; int element = 99; System.out.printl...
I am using below code and for result i am using interface for call back purposes. @Override public void onResult(String result) { if (this.mClient != null) { this.mClient.cancel(); mProcessing = false; } try { JSONObject j = new JSONObject(result); JSONObject j1 = j.getJSON...
I'm working on a report of quality control. I have a list L, which contains the names of files that I should open and import the data into EXCEL, then fill my quality control table by these data. And at the end, I want to know which file in the list has not been opened, that means this file (or this point of control) i...
I can't wrap my head around that. There seem to be a lot of redundancy, and even if it is not called called more than ten times in the main loop, I still find it hard to swallow that it loops through the whole list at each invocation. def get_file_info(f, stream, field): discoverer = GstPbutils.Discoverer() di...
My question is about this sort of table that's simplified here. Often, I find myself putting this element, (int (*)(const void *, const void *))&strcmp for bsearch. I go between prototyping with void pointers, creating dummy functions, and casting, but none is really a satisfactory, especially when the functions are co...
Problem from Hacker Earth: Inverted GCD: Given an array a of \$N\$ numbers , you have to find the number of pair of indices \$i\$ and \$j\$ that satisfy the following relation: \$i < j\$ \$a_i > a_j\$ gcd\$(a_i , a_j) = 1\$ Input: The first line of the input contains a single integer N - denoting the size of the ar...
After reading a bit about CSS3-text-shadows and seeing a few advanced examples I had the idea for a "neon light"-banner. Next idea was to animate it. Finally it has become a mixture between a Sass-mixins and a bit of JavaScript. One more thing I should mention: It's a fun-thing. I'm not intending to use it somewhere p...
The generic arrays in C I found on the net used either of these methods: The preprocesser with #define and #include (a lot of repetition and different names when declaring multiple types, but type-safe). void *-pointers (no type safety). void *-pointers and callbacks that fetch specific datatypes from the pointers (tr...
I have a table of groups, and a table of members. Each member belongs to one group. This is how it looks (more groups then 2 are possible): Groups id | name | year | ------------------ 1 | Nice | 1966 | 2 | Hard | 2012 | Member id | name | idGroup | ---------------------- 1 | Bernd | 1 | 2 | Max | 1 ...
This is an update from here. I have made some changes, and have decided to only include the UI side of things in this particular question. I wanted to make the application follow the MVVM pattern, but I have strayed in order to add functionality incompatible (or at least so I read) with the pattern. Synopsis This progr...
I want to create a function that filters a list with the following criteria: Strings containing numbers should be removed Strings containing only one word and first letter of the word is not uppercase should also be removed. Strings containing more than one word and first letter of each words except first word is not ...
I have this RPG game and this has elements such as the map, the monsters and the items. The monsters and the items are stored in Lists and every time I want to show the map around the player, I have to check if the element is within the bounds of the camera. public void ShowCamera() { int size = cameraSize/...
I have written a solution of a Mars Rover problem in C++ using OOP, but I am not fully satisfied with the design. What changes can I make to improve the design? Problem description is: A rover’s position and location is represented by a combination of x and y co-ordinates and a letter representing one of the four card...
This class is mostly an educational exercise for me using some C++11 constructs. I wanted to create something similar to an "invocation list" in C#, i.e., a list of zero or more function objects which should be called when the invocation list as a whole is invoked. I'm certain there's room for improvement here and I'm ...
I have the following code that I am trying to optimize. I am running it on a Linux machine with 24 cores. I thought I could use multithreading to make it faster, but it's somehow making it way slower than the single thread. I believe it is because of cache misses but I am not sure how to structure this code to avoid th...
I would like to be able to set token values (defaultFieldSet.tokens) and names (defaultFieldSet.names) on org.springframework.batch.item.file.transform.DefaultFieldSet using a java.util.Properties object. Specifically, the keys of the Properties object will serve as the names and the corresponding Properties values wil...
The challenge is to calculate the sum of the first 1000 primes. The code applies a sieve thanks to past answer, here, and works but I wonder about the flexibility of this solution. #include <stdio.h> unsigned long compute_sum_of_primes(int primes_needed) { int sieve_size = 20 * primes_needed; int sieve[sieve_s...
I'm not happy about my code, but is the better way that I find, I'm not happy because I see that there are many code repetitions and when any change is easy to make mistakes. Do you think you can do better? Any suggestions are welcome Sub ConvDateD(c As Integer) Application.ScreenUpdating = False Dim lrw As Long, i As...
I have a problem with my code. I made so much code, and now I need to place ends, which I cannot figure out how to do because I need to line everything up and then place at least 5 or 6 ends in the right places. I am fairly new to Lua and I'm sure that there's a better way to go about this, so if there is, tell me in ...
I have code that opens a workbook and copies the sheet to the workbook running the code. I know activating is generally bad for speed but I can't figure out how to speed this up anymore. The data area is usually "A1:Q45000" but is different all the time. Sub AutofillOperations() Dim answer As Integer, fd As File...
I wrote a Matrix struct and a neural net that uses it. Why is this slow? Gprof blames Matrix::operator()(int, int) which I suppose is my constructor, and Matrix::operator*(Matrix) and vector<float>::operator[]. #include <iostream> //#include <C:/Users/David/Google Drive/Coding/neural_c/Launcher.h> #include <fstream> #i...
I'd love thoughts on how to make this more elegant. I'm planning to add some additional functionality, but basically this is just my first pass at creating a pythonic Slack bot from scratch. You need Slack API token to run it. I am deploying to Heroku, so I have it looking for an environment variable called API_TOKEN ...
I have a working macro that finds a specific word and deletes the whole text. It finds the word "JOBSPECIALTYCODE" in the sheet, selects and deletes it, then moves to the next sheet. I just want to ask if there is any alternative way to make my macro work fast. I only use a record macro. Sub aHaveProgess() ' ' ' ' 'D...
For simplicity, it is checking whether the characters in a string (that needs to be created) are present in a larger string (dictionary). Would a character array of the letters make sense here, or would it be better with a Map<Character, Integer>? public class RansomNoteProblem { public static void main (String args[])...
I just finished a scraper in python using scrapy. The scraper logs in to a certain page and then scrapes a list of other pages using the authenticated session. It retrieves the title of these pages and puts it in a list of items together with the page name. Because there are little examples to find on continuing scrapi...
Here is my code that finds the number of digits in a given integer (either positive or negative). The code works and results in expected output. ''' Program that returns number of digits in a given integer (either positive or negative) ''' def ndigits(x): # Assume for the input 0 the output is 0 if(x == 0): ...
I have a MVC WinForms application. I am using Dependency Injection with Ninject as the IoC container. public class SqlObjectExplorerController : ToolController, ISqlObjectExplorerController { private ISqlObjectExplorerView view = null; private SqlServerStructureProvider structureProvider; private IProgress...
I have a matrix in which the right-most elements are repeated YYYYMMDD dates in descending order, for example: 40 1122 1711 20160326 169 700 950 20160326 40 1630 1711 20160326 182 700 950 20160327 40 1029 1711 20160327 169...
I am checking data output in some testing code, and only some fields can be None, but I think this can be better: for key in data[0].keys(): self.assertIn(key, data_model) if data[0][key] is None: self.assertTrue('rate' in key or 'percentage' in key or 'ratio' in key) continue ...
I am retrieving data from a json object and even though code works I am not sure if I am following best practices. In particular some of the objects seems too deep (like value.metadata.connections.comments.total) and not sure if there is a better way to avoid creating all my markup in JS. (function getData() { $....
I'm learning F#. The code below gets a number e.g. 100 and list of factors and should divide that number by the factors without any rest. (There is an actual code I've got in C#, but this is F# port). I especially didn't liked equalsDifference function.. any better solution? namespace RozbijaczApp module Rozbijacz = ...
I've written a home-grown solution for checking the status of my servers. This is both an exercise for me in learning further about Python, but it's also critical to status-checking critical things on my "network" of servers - both running against both an internal ("home") network against 18 or 19 VMs internally I nee...
I have functions of permutation : function permutations($letters,$num) { $last = str_repeat($letters[0],$num); $result = array(); while($last != str_repeat($this->lastchar($letters),$num)) { $result[] = $last; $last = $this->char_add($letters,$last,$num-1); } $result[] = $last; return...
I'm learning Python. I'm making a random animal generator, from 5 txt files. Each file is a list of words for respectively the specie of the animal, an adjective, an origin, and a bodypart with a color. Not all may appear in the description. I also wanted it to be arithmogrammatic. Here is my code, I know it can be imp...
I'm computing the crc32 of a given file using boost: uint32_t crc32(const std::string &fp){ boost::crc_32_type result; std::ifstream is{fp, std::ios::in | std::ios::binary}; size_t file_size = is.tellg(); is.seekg(0, std::ios::beg); std::vector<char> buf(file_size); is.read(&buf[0], file_size); ...
I have solved the following problem. My code works but Hackerrank says that I can do faster: There are plants in a garden. Each of these plants has been added with some amount of pesticide. After each day, if any plant has more pesticide than the plant at its left, being weaker than the left one, it dies. You a...
I made this small Blackjack game in the past as a way to practice C++ basics and have fun at the same time. I stopped working on the game during the last two years of my computer science degree program and now in my free time I want to improve it. I'm looking for suggestions on how I can improve the game. Not just addi...
I'm trying to reproduce a gbm model which was estimated without a set.seed value. To do so I need to determine what seed was used, which I can figure out based on one of the summary metrics from the estimated model (as shown below). require(MatchIt) require(gbm) data("lalonde") i <- 1 while(!(tmp$rel.inf[1] == 82.34293...
I'm fairly new to Java. I want to divide my code into 3 classes. First class to contain my GUI, second to compute the algorithm and third class to write results in my file. I have the code working but I can't get to divide it in 3 separate classes. All i want to know is by example, how can i make parameter list that I ...
This project is ultimately my senior thesis to graduate from college. It will end up being very long with several code reviews and redesigns. The next rubberduck perhaps? I've been working on a project that tests awareness of phishing scams. It generates emails based on templates and sends them out to a database of ema...
I'm starting a new C projet and I want to have the cleanest and shortest error checking code possible. To that aim, I often use two things : functions return 0, false or NULL on error I try to use small functions with one cleanup label "fail" or "error" So I thought about using a macro to simplify the code even mor...
I recently answered a Stack Overflow question about transforming an array of Characters into a String in Swift. Looking at the question and the Swift standard lib, it appears that there is a method joinWithSeparator, but the current implementation only supports SequenceType instances where the Element is a String. As...
A while ago I asked this question Memoizing decorator that can retry and then promptly forgot about it. I more recently saw Python decorator for retrying w/exponential backoff and wanted to add backoff, but figured I should improve what I already have first. I have taken some of the suggestions of the original, but rea...
I recently had an interview and got to phase 2 which is a coding assessment. One of the questions was: Find the first non-repeating character in a string: ("DEFD" --> E) I didn't pass the coding assessment and was wondering if the community can help me improve. Solution: /// <summary> /// Assuming that lette...
This prime number library is one of my first programming projects I've done in c++. My goal is to create useful functions that deal with prime numbers in an efficient way.Note: (Most of the functions used are powered by the sieve of Atkin) I'd like to know any sort of optimization or better code practices that I should...
I followed the tutorial Build a PHP MVC Application and have implemented a database connection. I made a seperate database connection class and I call it in the controller. It works, but now I have to inject it whenever I call a method from the user model. Is this considered good (dependency injection) or bad (repeatin...
Exponential backoff in the context of various networking protocols looks something like this: When a collision first occurs, send a “Jamming signal” to prevent further data being sent. Resend a frame after either 0 seconds or 51.2μs, chosen at random. If that fails, resend the frame after either 0s, 51.2μs, 102.4μs...
I recently had an interview and got to phase 2 which is a coding assessment. One of the questions was: Given an array with 1,000,000 integers between 1 and 1,000,000, one integer is in the array twice. Find the duplicate. I failed the interview and was wondering what improvements do I need. /// <summary> /// Assuming...
I'm working on a function that returns a specific set of times for a given timezone and a given frequency; day, week, month. For any given timezone and a frequency the function will return the unixtime hour start and unixtime hour end of the last full frequency given. For example, the last full day, the last full 7 d...
I recently developed my first appwidget for Android, and it works really nice. I basically created a collection widget and use a Loader to retrieve the data from a database, and when a user clicks on the list item, that items details will be saved into a bundle in an intent, and the main activity will be launched with ...
I'm in the process of writing a python script for automating a data ingestion pipeline using Amazon Web Service's Kinesis stream, Firehose and lambda. This is my first stab at writing Python, but I do have some experience with JavaScript and Node.js. Scripts are organized as follows: build_pipeline.py - this is where ...
There is no input validation for this, but that aside, I would appreciate it if anyone could help me improve the logic of this script. import math #Input num = input("Enter a whole number: ") #Floors input in case of a non whole number decimal = math.floor(float(num)) #Variables exp = 0 divTwo = 1 zeros = 0 total = "...
I heard/read that writers of texts can be recognized by counting their used words and compare these to previous works. As a code kata I experimented with this a bit and found some disturbing facts. 'Romeo and Juliet' was written by one of the Bronte sisters. Shakespeare plagiarized it from the future. My program is n...
I'm starting a new, small C project and would like to have the safest, cleanest and shortest error handling code possible. Here is a comparison of different ways to handle errors in the same C function. Which one should I use and why ? The function, called db_create, creates a new ImageDatabase instance. Table Of Conte...
The send_sms_message method takes text as an argument. The length of text is unknown and can be 0 or as large as 1070 (after that we will have no space for the actual text, because multi-part message text will be so long). The trick is that if text is larger then 160 characters, we need to split it into parts and to ea...
I have created this macro and having a small issue. I am very new to this VBA and did this with experts’ guides by googling it. I am creating an excel form for a work purpose at work. The Excel form has 7 sheets and each have named tables with different data. 1st sheet is the editable form, which retrieves data from t...
Is it possible to reify the graph of lambda terms expressed as parametric HOAS. Not quite sure if it is data PLambda a where Var ∷ a → PLambda a Lam ∷ (a → PLambda a) → PLambda a App ∷ PLambda a → PLambda a → PLambda a newtype Lambda = Hide { reveal ∷ ∀ a. PLambda a} data PLambdaNode a n where G...
I'd like to get some feedback on my AVL tree implementation. I appreciate any comments related to style and performance, particularly if something can be written in a more concise or idiomatic way. If you see a way to refactor delete into something shorter and with less repetition, please let me know. I am also interes...
I wrote this code over the last few days and I learned a lot, and it works as I expect. However I suspect it's woefully inefficient: import requests, bs4, os os.chdir('../../Desktop') wallpaperFolder = os.makedirs('Wallpapers', exist_ok=True) pageCount = 1 GalleryUrl = 'https://wall.alphacoders.com/search.php?search=...
I have been using Python 3 to learn programming, and this is a very basic task, but I want to gain good programming patterns/habits at the very beginning. The program will first randomly generate a number unknown to the user. The user needs to guess what that number is. The program interacts with the user. import rando...
I have a set of images with class = tt like so: <img src="images/arc_unselected.png" title="Arc" class="tt" /> and I have written this code to change the images after clicking: $(".tt").click(function(event) { var title = event.target.getAttribute("title") resetOther...
I'm using a selfmade python program for learning new words in new languages. Originally I made this program for a university course but now I'm just trying to imrove it and make the code "prettier" and perhaps some small functionality improving. :) The basic principle is that the program reads from a file the foreign w...
I tried the module pattern for the first time, with this exercise as a problem to solve: http://exercism.io/exercises/javascript/grade-school/readme It's a small exercise requiring simple tasks : Add a student's name to the roster for a grade "Add Jim to grade 2." "OK." Get a list of all students enrolled i...
Can you check my code if I wrote like a professional? connection page. form sign page. plan page. log out page. First I create the database and tables, then the connection file, then the form sign in page, then the plan page, finally the log out page Database educate (create table users): CREATE TABLE users( id INT A...
Suppose there is an array A = {3,2,5}, then points for this array correspond to indexes (i,j) where i <= j = {(0,0), (0,1), (0,2), (1,1), (1,2), (2,2)}. The program returns max(sum) such that sum = A[i] + A[j] + (j - i). For the above array : point (0,0) will have sum = (3 + 3) + (0 - 0) = 6 point (0,1) will have sum ...