instruction
stringlengths
71
71.9k
A week ago, I applied for a 'Software Engineering Internship' at one of the company. Since I know C++, C#, Java well and have worked on couple of ASP.NET MVC projects with MS SQL server before, I knew I was well qualified for the job. Plus, I recently graduated from my Bachelor of Computer Science with High Distinction...
I've written an object which allows parsing and serializing a command line. I don't in any way consider this done, but this is the beginning of it. I know there are other implementations out there like this, but they tend to be either too primitive or too heavy. This is an attempt to simplify parsing and serializing a ...
I have written a file to extract text from news articles. The program works as I want it to except it takes hours for it to write the output files. I have tried different buffering options as well as adding the data I want written to an array before writing that to the file. I have almost no experience programming so I...
I wanted to keep my controller tests DRY, readable, and make writing new tests very simple so that it encourages good practices like one assertion per test (if you have to redo a lot of work over and over, chances are you're just gonna shove more assertions into the same test to avoid the extra work). Here's the strate...
I feel like the if-else combination isn't the most optimal and I'm also not sure if I need a loop var Auktionator = function(){ var rennt = false; this.versteigern = function(objekt){ if(rennt === false){ for(var i = 1; i<=4; i++){ if(i === 1){ setTimeout(function(){consol...
I've prepared a simple login form, using prepared statements to prevent SQL injections. How secure is this ? <head> <title>Login</title> <?php session_start(); // set up a token $form_token = md5(uniqid('auth', true)); // session form token $_SESSION['form_toke...
This is the JavaScript file that i use for my editor that allows people to edit questions from a form. I'm wondering if this sort of approach to use JavaScript objects is good or that I kind of miss the point here? $(document).ready(function() { manager = new Customerformquestionmanager(); manager.formId = firs...
The point of this code snippet is to calculate and compare an MD5 obtained from a USB device connected to the computer against a database to check its validity. var md5String = string.Empty; using (var md5 = MD5.Create()) { var md5CRC = md5.ComputeHash(File.ReadAllBytes(destinationFilename)); foreach (byte b in...
I'm implementing a graphical representation of an "analog clock" with moving hands (seconds, minutes and hours), using mainly2 FLTK facilities and the function Sleep(miliseconds): main.cpp: #include "iostream" #include "GUI.h" #include "Window.h" using namespace Graph_lib; #include "AnalogClock.h" int main () try {...
I'm getting the correct results, but my method isn't the prettiest. Is there any way to do this with less code? var longestSuffix = function(A, B) { return rec(A, B, 0); function rec(A, B, count) { if (!A.length || !B.length) return ''; if (A[A.length - count - 1] === B[B.length - count - 1]) {...
I have hand-coded a forgotten-password reset system. I am apprehensive about security issues/vulnerabilities. What part of this can be exploited or could be made more secure? forgot-password.php <?php require_once 'connect.php'; if($_SERVER['REQUEST_METHOD'] === 'GET') { if(isset($_GET['email']) && !empty(...
I am very new to Java and although my code works, I know that it must be possible to write this using fewer lines of code. I am serializing multiple objects, eventually I will look into serializing to multiple files, for now, I am using just one file, so it constantly gets over-written. How can I nest or reduce the num...
I'm using vectors to create matrix and the vector itself is consuming a large space. So I implemented a version that would use less memory and, if possible, be as fast or faster than std::vector. How can I improve the performance and is there anything that should be changed? #ifndef __DATAARRAY_H__ #define __DATAARRAY_...
The script below is taken from this site. It doesn't currently work, but I have made it work at my own computer (not currently accessible) by changing what BeautifulSoup looks for. The script is intended to print info to the console, however, what I really want is to utilize this script to return a tuple (self.tomatom...
I have a question regarding creating controls in runtime in ASP.NET 4.0. I'm building a application and in admin.aspx page I have multiple controls (DropDownLists) which are dynamically created with values from a Sql database. I know that for having events fired for dynamically created controls, I have to create this c...
I recently decided to try and write my own implementation of Linq, which then lead me on to trying to solve some of the problems we have in our code base at work. Our code is littered with the following (obviously a simplified example): var items = new List<string> { "apple", "dog", "chair" }; if (item...
I need to validate a variable length string against some white-listed characters. The algorithm that I have works but I have a sneaking suspicion that there is a more elegant solution. The code below hasn't been identified as a bottleneck so ease of maintenance is preferred over a clever but confusing implementation. p...
I am attempting to create XML forms using user input to populate certain areas that would appear when loaded into a STIG viewer. Right now everything is working enough for me to create this and have it work just fine. Is there a way to throw the lower portion which contains the rules and whatnot into a method and have ...
Note This question was born in request to post more details from this question on Programmers. Since details may uncover new/different complexity, I'm asking another question here. I also will use this question for reference purposes as it more fully defines my application. Currently I am seeking to improve storing...
I get back two dictionaries, I need to parse through them and put in an array two objects. I think I did a very poor job and I have a feeling there is a better way to make the code more compact and generic. I think there is definitely a way to combine these two loops. Please advise on any better way to accomplish this...
Using Apache POI, I want to retrieve a Person from my Excel file by id or by name. To keep the example simple, the Person class is only an int id a String name and in the Excel file, the id starts at A2 (A1 is the header) and the name at B2 (B1 is the header). I came up with this code: ExcelDB class: package datasource...
I have a program that takes an input from the user (the user's name) and print a result with their name inside a border such as: ************* * name_here * ************* The code: def style_1(): print "*" * (length_of_name + 4) print "*", name, "*" print "*" * (length_of_name + 4) def style_2(): pri...
I'm a newbie to C++ (coming from C#) and I decided to complete this Code Golf challenge for fun (though I definitely wouldn't say it's short). Essentially, the challenge was to calculate the phi(not_pi()) of all the numbers from 1 to 100, and print them out in a loop, where phi(n) is the number of integers less than o...
I wrote a small "game" in Python for practice. I would like if someone could go over it and tell me if there is anything wrong or if there are any improvements I can make. import time import sys class Creature: def __init__(self, name, hp, inventory): self.name = name self.hp = hp self.inven...
I am new to Rust. I would like to know any better way of doing this and if it can be done preferably with safe code. use std::mem; use std::mem::size_of; fn show_byte <T> ( element: T) { let array: * mut u8 = unsafe{ mem::transmute(&element) }; for i in (0.. size_of::<T>()) { let current = (array a...
I am looking for some ways to make my code simpler for this currency converter. currencies = { "BRL":"(Brazilian Real)", "USD":"(US Dollar)", "EUR":"(Euro)", "GBP":"(Great Britain Pound)" } def real_to_dollar(): user_value = raw_input("How many reais? ") ammount = float(user_value) conversi...
Please critique this and make suggestions on the best practices. //Seasons Divided #include <iostream> #include <string> #include <iomanip> #include <stdlib.h> using namespace std; int main(void) { string Answer; //Character Declarations string Sex; string Age; string Height; string HairLength; string HairColor; str...
I have referred some class diagram to actually create visitor. #include <iostream> using namespace std; //know should not be used, but for simplicity class Book; class Pen; class Computer; class ICartVisitor { public: virtual int Visit(Book &) = 0; virtual int Visit(Pen &) = 0; virtual int Visit(Computer...
This is a programming challenge I submitted as part of a job interview, which I failed because it lacked "maintainability" and "patterns and best industry practices", so I guess we could all learn something from my mistakes. The challenge was to write a program that, given a list of programming languages, it'd return ...
The idea here is to be able to find a USB serial port device connected during runtime, thus not knowing its port number, and use it in the application to retrieve information from the device. string comportInfo = string.Empty; using (var entitySearcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32...
I have a data access class: using CompanyX.DataAccess.CompanyXTableAdapters; namespace CompanyX.DataAccess { public class CompanyXDataAccess { #region Invoice public CompanyX.InvoiceDataTable GetInvoiceByID(int ID) { InvoiceTableAdapter ta = new InvoiceTableAdapter(); ...
I am working on a multi-threaded webcrawling program in Java. Each WebCrawler starts at a root page and repeatedly extracts new links and writes them to a database. I have included most of the code below: public class WebCrawler implements Runnable { private ConnectionPool connectionPool; private ExecutorService execu...
I have written this snippet to find r-permutations of n, i.e. if I have an array of n=3 {0,1,2}, then r=2 permutations will be {{0, 1}, {0, 2}, {1, 0}, {1, 2}, {2, 0}, {2, 1}}. Can somebody review it and help me optimize / reduce its complexity (I don't want to use recursive function): "_getAllPermutation": function(in...
My task was to receive an array of integers and then reassemble the array as required: The array size is to be of element index 0 The next element (index 1) has the number of even distinct digits (digits that appear in only one integer input but not the rest). And the next pairs (if any) of elements will store the val...
I have finished writing my first Node.js app: a CLI app that runs Conway's Game of Life. I am looking for feedback on things that might not have been done the "Node.js way" and what I can do to better improve my understanding of Node.js. Specifically speaking, looking at the the game.js module, is what I am doing follo...
After profiling of one project I've found a bottleneck in the code, specifically the line: String columns[] = line.split("\\s+"); I've tried to find a workaround, but all ready made solutions, such as StringTokenizer and Scanner seem to be less efficient (for example, look at the answer on SO). So I decided to write a...
Here's a simple function I wrote using recursion. Does this run in \$O(n)\$ time and use \$O(n)\$ space, where \$n\$ is the number of nodes in the tree? def is_valid(root, min, max): if not root: return True if min is None or max is None: return is_valid(root, float("-inf"), float("+inf")) p...
var x = 0; document.getElementById("1").addEventListener("click", function() { if ((x % 2) == 0) { document.getElementById("dropdown_1").style.display = 'block'; } else { document.getElementById("dropdown_1").style.display = 'none'; } x += 1; }); var y = 0; document.getElementById("2").a...
This is a code to calculate somebody's age. It takes 2 inputs: A specific date (to calculate your age at a specific time or the current time). The birth date. print('''# This is Age Calculator Program. # This program is written by Mahmoud Naguib and it will be improved. # You can contact me at : https://www.facebook...
I'd like to get some feedback/criticism on my attempt to write a simple client/server application that reports back the (client's) global IP address. It would be nice if you could comment on the UDP socket setup, general security or any other drawbacks you were able to spot. Since this is my first attempt in writing Py...
(See the next iteration.) I have this Python (3.4) script for demonstrating the performance of the BFS algorithm, both traditional and bidirectional: #! /usr/bin/env python3.4 import time import random from collections import deque __author__ = 'Rodion "rodde" Efremov' class DirectedGraphNode: def __init__(self...
The following code fetches a set of company IDs from a database if there are any events associated with a company that has a missing property. Because the set of company IDs is embedded into the SQL query using parameters, and the number of parameters may exceed the maximum for the RDBMS / database driver, the set is p...
I have such objects that I need to merge: defaultConditions = where: enabled: true acc_id: ne: null conditions = where: id: 2 acc_id: ne: 5 This helper recipe, which replaces where from defaultConditions with where from conditions, is not quite right for this purpose. So I wrote...
Is this good OOP style? Do I need to split this class into two classes? If so, how do I do this? What methods should I need to add to the interfaces? public sealed class DeferredResultCollection<TResult> : IEnumerable<TResult>, IDisposable { private readonly IAsyncCursor<TResult> _asyncCursor; private readonly ...
I set out to make a simple dynamic resize method for images. Obviously, it's better to serve images that are pre-sized to avoid unnecessary server loads. But it was fun to make for a novice/beginner jQuery project and not really meant for a production project. For many of you, I'm sure it'll be rudimentary at best, but...
I have designed a Backspace button (part of a keyboard which I am designing) in windows forms and it works perfect with no errors (the code works very good). This button deletes what is inside the textbox. I just want to see other people's views and what they think about my code, so because I am new to c# I think there...
Pardon if this is silly, but I'm pretty new to coding. I have this code, that works, but I feel like it could be tighter than this, I just can't seem to get it to work any other way. The idea is to read a .txt file find incoming e-mail strings and organize the data by frequency of hour sent. Here is an example line tha...
I had an interview and was asked a problem. I provided a solution and wanted to make sure if this is correct. There is a Tile class. It has a boolean variable isGoldenTile which is false for all but true for one tile. There is a List<Tile> neighbors. These are list of its immediate neighbors which are tiles. There is a...
I am creating a blog using React, MongoDB, Express and Node. I have three components: App, List, and Item. The item is a blog post; the list is a list of the blog posts, and the app includes a place to enter text and submit it. I will eventually add more functionality, but I want to determine if I am adhering to best p...
I am implementing a SQL-like datbase system in python, and so I needed to implement a value changing function, but what I ended up with seems very convoluted. Here is code relevant to the value changing: def _get_primary_rowval(self): idx = 0 for n in self.def_column: if n.is_primary: return...
At the moment I have a Reminder Date. In the UI I have two fields to create the reminder date. The first field is an int and the second field is a combo box. public int Frequency {get; set;} public ReminderComboItems item {get; set;} public enum ReminderComboItems { Minutes, Hours, Days, Weeks, Months, Years } p...
I thought of writing a utility class where I can implement patterns that are useful for day-to-day parsing of strings, without having to to import java.util.regex everywhere. So I wrote this simple class as a model. This was inspired by a (now deleted) Stack Overflow question: For ex: String str="asd14sd67fgh007"; I ...
I think I solved the following problem. However, I was wondering if there was a faster or more efficient way to solve this. I believe the the runtime is O(n) and space is O(1) (O(256) assuming ASCII) # Longest substring with at most 2 distinct characters # # Given a string S, find the length of the longest substring T...
wRecently needed to swap keys with a colleague on the other side of the country. This script encrypts a file using the other persons public key that is stored on github. It outputs a script that will re-generate the original message (if you have the private key). #!/bin/bash # # Usage: # ./crypt <GitHub User> <File T...
I wanted to take on the challenge of the classic Robot Path's problem but solve it using Pascal's triangle. The approach was generate pascal's triangle, then grab the middle element from the row. I saw the following pattern: //where combos are on pascal's triangle: // 1x1 grid on the 1st line ===> 1 // 2x2 grid on 3rd...
I've written this Wack-a-mole like game on my iPad in the app Pythonista. Keeping that in mind, it uses a different graphic interface from the one I have usually seen used, Tkinter. I'm a beginner and this is my first major project, so any tips on how to code more efficiently and improve this program would be greatly a...
This is my simple jQuery form validation/submit logic and it is working perfectly fine. But still I am posting this to see if someone check the logic and suggest me if there is any other simple way to get the same results. In my form I put all input boxes and select into .valid1 class, all checkbox and radio buttons to...
I have a situation in which I need to get the closest road to a DbGeography point. This takes 5 - 8 seconds to run in some cases. I have a Spatial_Index on the column and I re-organised it, so it is not fragmented. This query is quite heavy, sometimes the CPU usage raises to 100% because of this. This is what the tab...
This (working) code is supposed to return a new array that consists of elements of both arrays that were not marked as duplicates (find duplicates in both arrays, remove such elements from both arrays and create an array from the leftovers, if any) Is there a way to simplify this function? function diff(arr1, arr2) { ...
I think this code has far to many if else clauses and not enough abstraction via functions. I would like to break the code down into a series of small functions, or methods if i decide to go OOP, but I'm not sure of the best way to do so. If you brilliant Pythonista's could guide me in the write direction I would appre...
This function sorts an array and returns the unique items. I'm trying to get it down to a readable 5 lines of code. So far I've renamed the variable cursor variable and inlined the assignments. I'll appreciate fresh eyes. Before function uniques(array) { var result = [], val, ridx; outer: for (var i = 0, le...
I am having a simple foreach where I add objects to a list: List<SoonestDrawDateModel> soonestDrawDateModel = new List<SoonestDrawDateModel>(); foreach (var item in drawDates) { SoonestDrawDateModel sdModel = new SoonestDrawDateModel(); sdModel.DrawDay = item; sdModel.DrawDayId = it...
My task was to write a server class, which uses select(), for a student projet. It was working, but i'm now willing to improve it a lot, and be able to use it in other personnal projects, so any critique and improvement idea is welcomed ! Here is the main.cpp : // example packet typedef struct packet { char ...
I am looking for the way to speed up my script. The final output is as required, but it's clunky and really slow. I know it's slow because of the double for..in.. loops. So, how could I make it a bit smoother? My script updates existing feature classes. I have two folders where all up-to-date shapefiles (shp) are store...
I made my own version of merge sort: (defn rsort[a] (cond (<= (count a) 1) a :else (let [half (/ (count a) 2) [lh rh] (split-at half a)] (loop [res () slh (rsort lh) srh (rsort rh)] (cond (empty? slh) (into srh res) ...
Problem (Tape Equilibrium): A non-empty zero-indexed array A consisting of N integers is given. Array A represents numbers on a tape. Any integer P, such that 0 < P < N, splits this tape into two non−empty parts: A[0], A[1], ..., A[P − 1] and A[P], A[P + 1], ..., A[N − 1]. The difference between the two parts ...
gotoxy() allows you to place the blinking text wherever you want. I wasn't able to get it to behave the way I wanted, so you will notice I had to insert a bunch of spaces in the cout portion of the blink function. Obviously this could be refined. blink() I put a "/r" to set the cursor back to the beginning of the line,...
I have made a simple Tic Tac Toe game but I think I have not followed a few conventions. I hope if you could help me improve it by suggesting some fixes. package practice; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class TicTacToe extends JFrame implements ActionListener{ /** *...
A short time ago, I discovered the LinuxFromScratch project. After getting a system up and working (after much struggling), I realized that if I wanted to continue using LFS, some sort of package management would be quite nice. Of course I could have installed Pacman, apt-get, rpm, etc. like any sane person, perhaps. I...
In this question related to rolling multiple dices, the OP pretty prints for a single case where number of dices is less than or equal to 6. This led to me finding this code golf on "Draw dice result in ASCII", but still only 6 sides. I wanted to extend this to at least 20 sides, and possibly some day any number of sid...
(See the next iteration.) The following snippet is a brute-force algorithm for computing a graph radius in time \$\Theta(V^2 + VE)\$ and space \$\Theta(V)\$ simply by doing \$|V|\$ breadth-first searches over each node in the graph. The graph radius is a minimum graph eccentricity of any node of the graph, where eccent...
I'm building cross-platform application (every mobile/desktop OS + web in ASP.NET). I'm using Xamarin, so I can do everything in C#. But before I start working on UIs, I want to build soild, flexible Core/Domain project that will be shared in all Client apps. I read a lot about DI and IoC containers, I know a lot of t...
I have this task to find the longest identical phrase which appears in 2 given files. With small files (~500KB each) it works just fine, ~10 secs to finish. But with larger files (~5MB each) it took ~43 mins to complete. The text in larger files are just copied and pasted over and over again. And I want to improve that...
Arguments: The directory in which you would like to change file extensions Old file extension And what the new extension should be Example: $ touch /tmp/spam.eggs $ python change-ext.py /tmp .eggs .spam $ ls /tmp $ spam.spam My Concerns. Is the code easy to read and comprehend? Is the code Pythonic? Does the code h...
I created this class for a project when I wanted to have List<T> properties on a class and also listen for items being added and removed. I looked at using BindingList<T> or ObservableCollection<T> but I felt that their collection changed events are too complicated. I simply wanted to know when items are added and rem...
I created an evolutionary algorithm that optimises the range of a "glider"...ignore the accuracy of the physics behind the problem! Any comments on how to improve the algorithm/my coding style would be greatly appreciated. If it helps, here is the link to the github repository. from __future__ import division import r...
Let's consider following function that return some risk levels enum type: func calculateRiskLevel()-> ResultFirstLevels { let result = self.result if result < 1 { return .Level1 } else if result >= 1 && result < 5 { return .Level2 } else if result ...
I have some code that does what I want - it just doesn't feel correct for being done in JavaScript. What it does is take data that is like this: var data = [['Marker', 'sampleName1', 'sampleName2'], ['CCR4', 71.6, 83.4], ['CD27', 42.3, 76.2]]; And create a list of objects that looks like this (to use the ...
I have a simple custom attribute MessageDeliveryAttribute that has one string filed. Also I have several classes that mark with this attribute like: [MessageDeliveryAttribute("MessegaToDb")] In the app.config are settings like: <appSettings> <add key="MessageToConsole" value="true"/> <add key="MessageToDb" v...
I made a game in python which plays a bit like old terminal based RPGs, though a lot more basic. I had originally intended to implement a weapons and armour system and thus remnants of this can still be seen in the latest version of the code. Please review this, from the documentation to the actual code. from random im...
I made a simple tic-tac-toe AI app, where the AI, who is always O, wins or ties. I just wanted some input on it, and wanted to know if there was any ways to improve it (not the functionality of it, but how efficient it is, cleaner ways to write stuff, better naming, etc.). I also don't know if I'm supposed to go throug...
I've been practicing my algorithms using The Algorithm Design Manual. I've decided to implement the breadth first search section (5.7) using javascript. I also have a findShortestPath and a connectedComponents function that utilize my BFS. My BFS function accepts an adjacency list. /* A Queue object for queue-like func...
You may want to take a look at Rounds 1, 2, and 3, though that isn't necessary for understanding what's below. The major change since Round 3 is that my code is much cleaner and I'm including profiling information here. Here's my script: #include "hansel.h" #include <deque> int main() { // Parameters. const doub...
This is a basic Tic-Tac-Toe game with a minimal interface. The only concessions to ease of use are input validation (7 lines) and 1-indexed rows and columns (a few bytes). I've been trying to tighten it up while still maintaining readability and PEP-8 style. I'm pretty happy with most of it, except for printing the boa...
The fn odd_ones(x: u32) -> bool function should return true when x contains a odd number of 1s. Assumption: x is 32 bit unsigned. Restriction: The code should contain a total of at most 12 arithmetic, bitwise and logical operations. Forbidden: Conditionals, loops, function calls and macros. Division, modulus a...
I have written a simple pager in C. It works fine for most things, but I'd like to know how it can be improved. Specific things I'm looking for are if there are size and/or speed improvements to be made, as I have noticed that it sometimes performs slowly (but that might be my slow computer ;-), and usability. This obv...
I was looking for a way to better define email recipients along the lines of the To/CC/BCC convention. Although SYSTEM/STANDARD/EMAIL contains CC and BCC fields, they are not currently functional, see: "How to Add Addresses to the BCC Field Using Rebol's Send Function" Therefore in this solution, I've reorganised the S...
See the previous and initial iteration. Terminology Given an undirected graph \$G = (V, E)\$, the eccentricity of a node \$u \in V\$, \$e(u)\$, is the maximum length (number of edges) of a shortest path from \$u\$ to the furthermost node from \$u\$. The graph radius is the smallest eccentricity over all its nodes, or n...
I wrote a program that finds out if matrix has 2 oblique lines that each oblique line has the same value. The lines does not have to be the same value. for example: for this example, output is false (there is only 1 oblique of 1,1,1) for this example, output is true (there is 2 oblique: 3,3,3 and 2,2,2) This is my co...
I have created this fake API just because I want to learn how to use JWT. It is a simple unsigned token exchange with two methods call: login and adminPassword. I've used https://github.com/lcobucci/jwt as a JWT implementation. This is the server code (index.php): <?php // https://github.com/lcobucci/jwt require_once '...
I'm developing an iOS application where data is fetched from a third-party REST API. Each request must contain an authorization token. In order to implement this, I've written a fetchToken withCompletionBlock:(void (^)(ASToken*) token,NSError * error) method in AppDelegate: -(void) fetchTokenWithCompletionBlock:(void (...
Implementation of a hash function in java, haven't got round to dealing with collisions yet. I tried to use good code, refactored, descriptive variable names, nice syntax. My code must be efficient and extensible. Would be interested to know how you guys would improve. Three classes: TestHash - main method is here, ha...
So I needed a a star rating feature to appear in my app - it doesn't need to be interactive. I have my app connected to a database I've set up in Parse, and I've made a column for OurRatingof type Number, and I just set a number between 0.5 and 5. In my custom cell, I have 5 images which will display my star images. Th...
dataListOne and dataListTwo will be full of BO objects (around 4000 - 5000). Lets say dataListOne comes with objects with business keys: "one,two,three,one" and dataListTwo has: "three,four,five". At the end I must have: insertList: "one,two" updateList: "three" deactivateList: "four,five" There may be 2 BO's with sa...
I've been practicing my algorithms using The Algorithm Design Manual. I've decided to implement the depth first search section (5.8) using javascript. Note you can execute the code here if you don't have node.js. var doDFS = function(graph, source, directed, processVertexEarly, processVertexLate, processEdge, logOff) {...
Given a typelist, return a typelist of all the permutations of it. For example: using Types = typelist<char, int, double>; using Permutations = typelist< typelist<char, int, double>, typelist<char, double, int>, typelist<int, char, double>, typelist<int, double, char>, typelist<double, char, int>, ...
I am building a database for a hypothetical university. This is my SQL definition, with generated data added for my future use, such as demonstrating queries: Create Table Semesters ( Semester varchar(6) Primary Key Not Null, ); Insert Into UniversityDatabase.dbo.Semesters Values ('Spring'), ('Summer'), ...
I have written this piece of code that implements the double factorial in Python both iteratively and recursively; the code works without problems, but I'm interested in improving my overall programming style. Here's the code: def semif_r(n): #recursive implementation if n == 0 or n == 1: z ...
I'm learning how to write tests in Angular (these are my first tests in general). There are a lot of tutorials out there but each one of them has a different approach. I'm a bit confused if I'm doing things the right way. I made a simple directive for testing purposes and I've called it tooltip (though its not really a...
I have a list of lists of 4 integers, each representing the length of one side of a tetragon in clockwise order (so each number is the length of the side of the right-hand-adjacent-side of the previous one). Integers can be negative or positive or 0. My idea is that if any of the sides are less than or equal to 0 then...