instruction stringlengths 71 71.9k |
|---|
I need to extract from a large XML file some information:
0 or 1 attribute per tag
Trigger on a leaf element
So I wrote this Python code:
def ascend(element):
parent = element.getparent()
return [parent] + ascend(parent) if parent is not None else []
def parsexml(filename, tag, attrs):
from lxml import ... |
The missing code in task 1 were the methodsarea(), perimeter() and toString().
In task 2 I know that using built in collection such as Arraylist would be efficient and simpler,So any new different idea and implementation are appreciated.
Make the classes Circle and Rectangle complete: write the missing code.
A stati... |
The problem:
How to get the largest number of consecutive days from an array of unknown number of Date objects, by taking into account days only like 4th of April, 5th of April and so on.
Example input data:
let calendar = Calendar.current
let x1 = Date()
let x2 = calendar.date(byAdding: .day, value: 1, to: x1)!
let x3... |
I am trying to use the code of this guy. Written in 2013 but it is a bit obsolete on some points.
Basically, the idea is to create folders from 1 dataset to train several models independently on the same data.
Then, I can do a second level training based on the results of the first level. Combining models like this in... |
I have an abstract object and I need to test whether it is an instance of one of the several concrete classes. Every concrete class has a Value property that is not inherited.
The following points need to be true:
Single cast per class
Short circuit when one test is successful
No unnecessary casts
This is the solut... |
I've built this simple interactive scenario. Now everything seems to be working fine except for the start of the for loop as below. What can I do to make the script execution faster?
Here is the full code: http://codepen.io/Angussimons/pen/oZmNer
for (let i = 0; i < manNumber; i++) {
// Definisco quale strada
if ... |
Today I had an interview, where I was asked to solve this question:
Design Tic tac toe game
Game rules:
Design a simple tic tac game with 2 modes for 3*3 matrix. At the
beginning, ask if single player or two player mode has to be played
(more details on the mode below).
The players input position on matrix by inpu... |
Task
I want to watch the "Recent Posts" section of a blog for changes/new posts but only for specific posts containing a pre-defined word. Afterwards a list should be outputted in the console with how long it is already published.
Code
RSSWatcher.java
import java.io.IOException;
import java.net.URL;
import java.time.Cl... |
Please could somebody verify that my method of implementing Smart Pointer is correct, and if there is maybe a more efficient way of achieving it.
#ifndef SHARED_PTR
#define SHARED_PTR
#include <iostream>
#include <mutex>
using namespace std;
template <class T>
class RCObject
{
T* rawObj;
unsigned int count;
... |
This is a simple custom font rendering class I wrote. The idea was to code something that could be passed a lengthy string and render that properly in any game that uses pygame.
On top of this, the class can draw each character one at time for a kind of typewriter effect.
Anyway, I'm just looking for feedback or any ti... |
I am trying to implement the modified Next Reaction Method with time varying propensities as mentioned in sections IV and V of this paper. At one step in the process this expression must be evaluated: \$\int_t^{t+\Delta t\mu}a(X(t,s), s) \textrm{d}s - (P_k - T_k) = 0\$. In the end this evaluation should tell us \$t + \... |
I've recently solved the "UTF-8 Validation" LeetCode problem:
A character in UTF8 can be from 1 to 4 bytes long, subjected to the
following rules:
For 1-byte character, the first bit is a 0, followed by its unicode
code.
For n-bytes character, the first n-bits are all one's, the n+1
bit is 0, followed by n-1 by... |
I'm new to Rust, coming from C++, and so to increase my knowledge of Rust I made a small program to manage an array. You can add, insert, delete, print and more an array or its elements.
I don't really care much about performance at this point, but more on readability, good practices and so on.
So, what could I have do... |
I have just developed a match scheduling algorithm and had to use some pretty funny modular arithmetic. While it works fine i would like to know if my calculations could be simplified any further.
Though it looks a little complicated it's in fact very simple and seems to work very efficiently.
A little bit explanation ... |
I am working on a text-based adventure game and I'm implementing new features, one of these features being saves and loads. This code works, and I know that there is a more efficient way of coding it, but this is sufficient. I will first post the code (feel free to play with it, but bear in mind that this is only the b... |
I was having some real issues creating a jQuery plugin that could handle multiple instances with different config options. I came up with this, but am not sure if it follows best practices. I used some sample boilerplate, but it didn't handle exactly what I wanted, though the core of that still remains.
Here's a fiddle... |
I omitted all free operators but the equality comparisons ones because of verbosity. I am glad about any comments and improvements.
Motivation
I know that optional references are equivalent to pointers and their implementation is just such a wrapper. But I believe they make sense in some circumstances and please correc... |
I'm new to PHP, having coded in Perl and ColdFusion years ago. In the process of trying to familiarize myself with my new job, I have found some code that would neither seem efficient nor logical, although it does execute properly.
I would like to get feedback about whether one particular piece of code is poorly wri... |
I have been creating a class for users on my account. OOP and classes are not my strong point.
Below is an extract from my class which I use to create a hash (that will be stored in a database) and the second function is used to check a value against a hash.
I know that I should just use bcrypt for my hashing but I was... |
I just started watching C++ videos couple of days ago. I tried taking everything I learned about classes and passing by references vs values. The main question I what would like to know is this the correct way to change the values of private class members or is there a more 'professional' way of doing it. (Or standard)... |
I have the following code
int eval(char* string) {
char* token;
outputString[0] = NULL;
token = strtok(string, " ");
while(token != NULL){
if(strstr((char *) token, "@") != NULL) {
strcat(outputString, "@");
token = calc(token);
}
strcat(outputString, token);
strcat(outputString, " ");
t... |
I'm currently applying for a job at a well known company in Stockholm, and I need some help with reviewing my initial draft of my solution to the Mars Rover problem. I mainly use JavaScript when I develop, but the company requires me to solve it using Java, C# or Python.
Luckily for me I've got some basic Python skills... |
I'm not expert on OpenID, so i don't know if my package is correct and safe. I've realized that after login on Steam community, take about 2/3 seconds to return to my page. It's my issue or is from steam?
{
/**
* The application instance.
*
* @var \Illuminate\Contracts\Foundation\Application
*/
private $app;
/**
... |
I've recently begun using Clojure, and I wanted to translate a project that I wrote with p5.js to us Clojure and quil. Unfortunately, the code resulting from a direct translation is bad enough to make a grown man cry. Here is the original js code for reference: (you'll need it :)
var xOffset = 450 / 2, yOffset = 450 / ... |
This is a function I wrote which has the intention of extracting bits of the URL.
For the latest version visit my GitHub.
function getPage($options = "", $page = "")
{
$self = "{$_SERVER["REQUEST_SCHEME"]}://{$_SERVER["HTTP_HOST"]}{$_SERVER["REQUEST_URI"]}";
/*
* - return the string untouched
* a - ... |
We are given a function f2(), that can return either 0 or 1 with equal probability. Now using this function f2() only, write a function f200() which returns a number from 0 to 199 with equal probability distribution.
In Ruby:
def f2
return Random.rand(2)
end
def f200
# this function makes use of the property that,... |
PRIME1 is a CodeChef problem which states:
Shridhar wants to generate some prime numbers for his cryptosystem.
Help him! Your task is to generate all prime numbers between two given
numbers.
Input
The first line contains t, the number of test cases (less then or
equal to 10). Followed by t lines which contain tw... |
I have an online catalog on which I need the customers to save their favorite products and shipping addresses. I want to manage the access with Facebook for security of all. I also need a section for the admin, to see some information in the database.
I want to know if this is safe. I want a basic "system" of user cont... |
I've written a class that takes a file, validates the formatting of the lines from an input file and writes the set of valid lines to an output file. Each line of the file should have a first name, last name, phone number, color, and zip code. A zip code is valid if it has only 5 characters, a phone number can have onl... |
I have made a phone order pizza ordering program for my Digital Tech assignment. I would appreciate feedback on the code quality (increasing efficiency, whilst maintaining readability). The full code is runnable on repl.it, and is also pasted below.
This is a repost with an updated version of my code for review. Pizza ... |
I have two different arrays that are widely different in length, arrayA, arrayB
for example:arrayA.Length=1000 and arrayB.Length=100,000
Create a boolean function that returns true if each item in arrayA are also present in arrayB, at least the same number of times as in arrayA.
Please review my code below and help m... |
I just solved the Hash Tables: Ransom Note problem on Hackerrank using both Java-8 and Java-7. Given m words in a magazine and the n words in the ransom note, print Yes if a kidnapper can replicate his ransom note exactly (case-sensitive) using whole words from the magazine; otherwise, print No. 1 ≤ m, n ≤ 30000.
I a... |
I've designed a little struct that should help me deal with Excel columns in terms when the letter index is used. The idea is to use the struct implicitly most of the time for iterations over Excel columns etc.
The struct works in the cases i've intended it to. However, on the one hand, I'm not sure if it isn't a littl... |
I have implemented a project called NodeFlow. As you can see in the picture you can create multiple nodes and connect their properties with other (Function)Nodes to modify the properties and let the data flow through the nodes to create a result (in this case it is the addition and multiplication to the result 4). I i... |
This is my first attempt at using T4 templates and I thought I generate the NLog.xml with it by getting the tables and the columns from the database to automatically create all targets.
SqlServer reflection
To get the information about the log tables I use a couple of helper methods and classes that support the databa... |
What I basically want to do is this:
int main()
{
const int n = 100;
#pragma omp parallel for
for (int i=0; i<n; i++)
{
int thread_ID = omp_get_thread_num();
printf("%d) work 1 %d\n", thread_ID, i);
#pragma omp barrier
printf(" %d) work 2 %d\n", thread_ID, i);
#pragm... |
In my web application, I'm utilizing a PDF library which is using a native DLL.
I'm using it for two very different purposes in two completely separate (and isolated by NuGet) parts of the web application.
Upon application start, I load the library DLL and thus lock the file. Then, rebuild requires completely terminati... |
I have made a tic tac toe for two players and written down some functions to do the decision making about who is the winner. I have gone through some cases while testing but need advice to see if I am in the right track and also if all the winning positions are being taken care of.
I would like to know even if this can... |
I am considering an approach fo BDD tests on Android.
The sample app — a simple messenger — has been made in Kotlin, so will be the tests.
I ended up with something like this :
class IGotYourMessage : Scenario<LoginActivity>(LoginActivity::class.java, {
Given()
.iAmOnLoginScreen()
.When()
.iLog... |
I'm pretty sure this code can be optimized, but I'm not talented enough in Linq to do it myself. Here's what I'm trying to do: I have an XML file that needs to be converted into a .csv file. The XML looks like this:
<Inventory>
<Item>
<Name>Super Mario Bros</Name>
<Count>14</Count>
<Price>29... |
I have this method :
private string GetCheckResultFor(string url)
{
Stopwatch reveil = new Stopwatch();
reveil.Start();
HttpWebResponse response = null;
url = Regex.Replace(url, @"\s+", "");
if (!url.StartsWith("http") && !url.StartsWith("https")) url ... |
Requirements:
Implement a function that, given a standard date and an indicator
whether or not the output should be in american standard (weeks start
on sundays, the first week of the year is the week containing the
first day of the year) or in ISO8601 standard (weeks start on mondays,
the first week of the year is th... |
I recently did a technical test for a well known Bank in 'The City' and as a result got no further. They were also kind enough not to give me any feedback. The test entailed a TDD approach to a simple and open brief. I am going to post up my solution and the brief.
I would be very grateful to receive any comments and ... |
Background:
I have written this code to transforme a .csv file exported from a software called Geneious containing SNPs and concatenate them into a DNA sequence.
So basically take fields from .csv file to make strings.
The code itself is just a bunch of functions that perform small tasks, some functions call others and... |
I've created a program that will find if a word is a palindrome or a reverse string (emordnilap).
How it works:
The palindrome part works by reversing the string, and comparing the two strings using strcmp to see if they match one another. If they do match, it will return true, if they do not match false.
How it chec... |
Given a string like "abcdbcfbc" , I want all the occurrences of 'b' to be interchanged with their previous character.
The output should be: "bacbdcbfc"
I've come up with a temporary solution:
function punjabi_alternate($string) {
$len = mb_strlen($string);
$sploded = array();
while($len-- > 0) {
$... |
PRIME1 is a codechef problem which states:
Shridhar wants to generate some prime numbers for his cryptosystem.
Help him! Your task is to generate all prime numbers between two given
numbers.
Input
The first line contains t, the number of test cases (less then or
equal to 10). Followed by t lines which contain tw... |
I created a small console application to recursively search a folder and all subfolders for files that contain a match for a regex.
The command line arguments are the path you're looking to search followed by the regex (in .NET regex format).
I break this up into two threads: the main thread loops through the files and... |
I have created a C++11 implementation of a simple Tree for an online code challenge,
I'd like to know how to improve it and how to make my code use less memory :
#include <iostream>
#include <vector>
#include <memory>
#include <algorithm>
#include <sstream>
#include <cassert>
template<class T>
class TreeNode : public ... |
I am reading a text file that has some name inconsistencies. For example I have names like:
MILLERS, WALTER M IV
DUPONTE, THOMAS B. II
HARDIWAY, GRANT U. SR.
GUIDRY, PAUL JOHN
As you can see I can split the name by first name and last name however the suffixes are placed incorrectly. Ideally the names should be:
WALTE... |
I recently came across the need to be able to allow a user to select a value from a select list, and have it dynamically displayed in an unordered list and have the value disappear from the unordered list. The use then needed to be able to click and remove the row, which would then allow the value to reappear in the se... |
I needed a task system that would let me define a cron-like rule in the database, and be able to find the next and the previous time when the task was and is supposed to happen.
I am running a web application, so ways like run a scheduled and check for every minute, or other ways around does not work for me, so I had ... |
I've created simple matrix class in c++ and I would like to know what you think about the code. I've left the implementation in header file for simplicity for now.
The class is not finished yet, it misses a lot of utilities, but wanted to get review of the basics.
#pragma once
#include <exception>
#include <vector>
#i... |
Suppose we need to sort a sequence and we know that every sequence component is within \$d\$ steps from its correct position. In such a case we can use a local heapsort: we take \$d\$ as an argument and set \$w = d + 1\$ (window width). We load the heap with \$w\$ first sequence components after which we pop the heap a... |
I tried to implement the builder pattern of GoF. After searching for almost every related posts/examples on the Internet, I'm still confused. But I found that there are two kinds of patterns, which are both called builder:
Bloch Builder : A famous post, but a comment pointed out it's actually a fluent interface, still... |
I am doing some practice interview questions for class, one of the questions is:
Given an undirected graph G, find the minimum spanning tree. Function should take in and output an adjacency list.
Here is the code that I have which works using Kruskal's algorithm:
### Question 3 main function and helper functions.
# W... |
For the past week, I've been developing a simple raycasting algorithm. And I've finally managed to work out how to add textures and to get everything working.as I'd like it to. However, even at a rather low resolution of 5 pixels per vertical scan line, the program still runs incredibly slowly. It runs a bit better in ... |
This is a follow up to my original post:
I've written a class that takes a file, validates the formatting of the lines from an input file and writes the set of valid lines to an output file. Each line of the file should have a first name, last name, phone number, color, and zip code. A zip code is valid if it has only... |
I've recently solved the famous N-Queens problem:
Can you place \$N\$ chess queens on a \$N × N\$ board in such a way that no one
attacks another queen?
The idea here is based on the ideas from several blogposts describing a bitwise approach - approaching the board row by row, keeping track of bits of 3 numbers - c... |
I have written this script to stop and start a specific service and check if it was able to load and unload applications tasks correctly, by checking a status in application log. Also it writes a log which tells the sequence of events in the script.
I have following questions related to my code :
I feel this is not an... |
I wrote an Angular 4 app and a part of it was a multiselect component. The multiselect component acts like a basic HTML select but gives you the ability to select more than one option, typeahead, and a more usable interface for the user.
You can see the working demo here on plunker.
The component works but it is slow, ... |
I was trying to see what is the highest number of moving and colliding boxes (sprites) I could get in pygame? So that I could start working on game I want, I searched google and I found different people do it as a challenge, trying to get to the highest number of sprites. But none of them use the colliding, they just... |
So I wanted to code a simple PRNG for generating terrain in a game. It has to have the following properties:
Computationally cheap
Generate semi random numbers between 0 and an positive integer.
I need to be able to go back and teleport anywhere in the world so random.Next doesn't cut it.
I basically want a noise f... |
A sorted array is passed to my method and i have to find the minimum singular value. If no such value is found the method returns 0.
I have created two versions of this method. In the first version, I iterate trough the array twice which works fine but there has to be a way to find the value with one iteration.
In the... |
Primary Concerns
As long as the stash is not within scope, globals such as
window/global would effectively be sanitized of any risky methods,
such as eval
The API feels complete, am I missing anything?
Are there any "risky" aspects to the sever method.
Any thoughts with regard to performance or security.
I don't think... |
Basically, I am trying to make Hangman/Wheel of Fortune style game. The demo for the game I made is here.
Is there anything I can improve or should change?
var money = 0;
var tries = 7;
var words = [
["E", "L", "E", "C", "T", "R", "O", "N", "I", "C", "S"],
["A", "R", "R", "A", "Y"],
["E", "A", "S", "T", "E... |
Here is the code. Works great! Any advice would be great! Also, try it BEFORE reading the code. See if it is good. I've only found 1 "exploit" that can be use to beat the computer everytime and it is still in progress.
NOTE : All class are in one folder because of simplicity and other reasons
Git repo., you can downloa... |
After what I've felt is a sufficient amount of research, I have made my first attempt at a domain driven design MVC project. I would love for you guys to tear it apart and give me pointers to make it better.
The actual "data tier" has 2 projects, MyProject.Data and MyProjects.Model. I wont go into detail on the Model p... |
Imagine you are a company that wants to assist some US-based companies
to ship their goods to customers in Hamburg. To achieve this, lets
assume that every order can be represented by a tuple (orderId,
companyName, customerAddress, orderedItem).
Thus, some sample data might look like this:
001, SuperTrader, Stei... |
I make my original program more interesting and try to make the builder API more easier to read:
Now it's a static method of Builder: Pizza.Builder.recipeBuild(...) ,who bake the pizza with your customized Builder
Customer only need to setup her/his Builder, she/he doesn't have to know anything about the workflow abou... |
For the past week, I've been making a raycaster in JS and if you want a live demo, you can try it here. It ran smoothly before I added variable height walls but now it is very slow (~15 FPS) so I want to know how to make it run faster.
I'd also like it if somebody would review the code normally so that I can improve it... |
I have the following sample Triangle class and I want to validate the set accessors' values, obviously I cannot have a zero side or height Triangle. But while I am writing the validation rules for each property I found myself repeating the same code over and over again. Is there a more concise way to write these proper... |
I have the following function that allows me to calculate the marketing spend on my advertising campaigns.
The problem is that it's now taking too long (over 15 minutes) to apply the function to said dataframe, as it now has more than 8 months of historical data.
I have no idea if there's a way to speed up the process... |
I wrote some code for my question about deleting temp files that weren't deleted on exit before and would like to get some feedback if I forgot some details or got something wrong.
private static final String PROJECTNAME = "projectname";
private static final String LOCKNAME = "lock_ThisIsAVeryLongFilenameNoOtherApplica... |
Here is a code which sends email notification on new comments.
<?php
namespace Rib\Src\Apps\ContentNotification\ContentNotificationControllers;
use Rib\Src\Apps\ContentNotification\Email\NewContentNotificationEmail;
use Rib\Src\Services\DbSql;
use Rib\Src\Services\Email;
class JobSendNotificationsCron
{
public... |
I started using PDO 2 days ago, but I want to know if the way I'm coding and the way I'm using it is the correct way of doing things with PDO.
Please let me know if you guys notice any security flaws or improvements in general.
Here is a function I wrote that shows updates.
function ShowRemoveUpdates() {
ob_start()... |
I created this basic metaball visualization in JavaScript. While it does look nice, it is very slow if you increase number of balls and/or make drawing area larger. I think that the performance is so bad because it iterates through every pixel every time the frame is updated but I cannot think anyway how I could update... |
I am new to Java and I use the following code to retrieve parameters
from a linked hash map from the Cloud Foundry API. My question is if there is a better way to do it in Java?
public HashMap<String, String> getUserData(String Url, String org, String space, String app) throws MalformedURLException {
URL endpo... |
Note that this code uses C#7 functionality like local methods and ValueTuple
I am programming an HMI for an industrial machine. Part of the HMI's task is to read the machine settings and present them in better human understandable concepts. In this case a Material and its corresponding MaterialWebfeedSettings.
In the f... |
I've knocked up this code to allow me to query for specific service names using PowerShell.
I'm after the executable (PathName) for the service, so the Get-Service cmdlet is not appropriate here. I don't actually have any services with special characters in their names; but I like to build robust code where I can fores... |
I was searching on how to read a single character from the console and I found many irrelevant or overcomplicated posts, so I tried the following code by myself and it seems to work. But is that a proper way to read a character in terms of coding standards? I am a C# beginner.
Console.WriteLine("Please select: y/n?");
... |
recently I've been working on machine learning with Java and Weka, and while I found the .ARFF format easy to understand (you just need an .ARFF file and Weka will do the rest :P), sometimes the process can be really annoying: You have some data, and after some processing you want to feed it to a Weka classifier. The t... |
I have always been into HTML and CSS so I decided to give programming a try. I installed Python because I heard it is the best first programming language. So I made this program just now and I'm super excited and happy about it. I would like to have your criticism or feedback and tell me how I can make it better or add... |
I am trying to write a program I am calling "terraform cashier." Terraform is a tool released by hashicorp to allow you to codify your infrastructure. I thought it would be useful to know how much your infrastructure would cost you before you deployed it, and have implemented a prototype of that for AWS. I also had to ... |
For a class we needed to implement an undirected unweighted graph that:
Maintains a distance matrix that can be printed
Supports the computation of the graph's diameter (uses dist matrix)
Prints the number of connected components and their included vertices
With the above being said, I opted for an adjacency matrix t... |
I am making this simple game in SFML and I have this vector of pointers std::vector<Brick*> bricks; which stores objects of class Brick.
Classes Brick and Ball derive publicly from class Object, because I have a polymorphic function to check colissions between 2 objects (Ball object is sf::CircleShape and Brick object ... |
I'm trying to find the occurrences of strings in view B in a string in table A. However, the performance is horrendous (takes about 17 minutes to run) and I was wondering if anyone had any suggestions to improve it.
view B has 3570 records and has one column of type varchar named MISubCode
Table A has 160081 records an... |
I have an Excel VBA script that concatenates five values: three static text strings, and values contained in two dynamic user-input ranges. One of the ranges contains values that need to be concatenated repeatedly in the output, top to bottom, over and over, until the end of the data in the other range is reached.
So,... |
Given an N-by-N grid with each cell either occupied by an 'X', an 'O', or empty, write a program to find the longest sequence of consecutive 'X's either horizontal, vertically, or diagonally. To test your program, you can create a random grid where each cell contains an 'X' or 'O' with probability 1/3.
I would like a r... |
What my code does is it reads a 24 bit bitmap image in color, runs a very simple edge detection algorithm and outputs a monochrome 1 bit bitmap with the edges in white. Here is an example of the output.
The basic algorithm is that I am looping through all of the pixels in the 24 bit bitmap two pixels at a time and if t... |
I had never done a full interactive app before so this is a really big step for me. It's very simple and fits into a single file. One thing that will be odd is the fact that I didn't use arrays. I don't know why but there were a ton of runtime errors occuring whenever I tried to do something that involved an object in ... |
I'm working through Build Your Own Text Editor, a walkthrough of the code to an extremely small text editor for a posix terminal in C, but I'm attempting to follow along in-the-spirit with OCaml.
I've put together a function that wraps an parameter function with termcap stuff to get the terminal into raw mode. This cod... |
I have written two different codes for merging (merging with costs) and I want to know if I can make optimizations to run faster.
merge1:
private static long merge(List<Integer> array, int[] res, int start, int mid, int end) {
int i = start; // index of left subarray
int j = mid; // index of right sub... |
I need to get some ids from contacts and contactgroups to be able to collect the data. My example works but i dont know if this is the way to go.
getIdArray() {
let contactIds = [];
let groupIds = [];
let contacts = this.http.get('Contacts/').map(res => res.json());
let contactGroup = this.http.get('ContactGroups/').ma... |
I've create a Docker script momodock.script that does some installation for a set of tools that I'll need to install on multiple machines:
FROM ubuntu:latest
MAINTAINER Momo <mo@mo.com>
LABEL description="TL;DR instructions to install Moses with Docker."
RUN apt-get update
RUN apt-get install -y apt-utils debconf-utils... |
I wrote this program as an answer to Express a Number challenge on the Programming Puzzles & Code Golf site; it may be worth looking there for the context. The concept is simple (and familiar to anyone who's seen Des Chiffres et des Lettres or its UK version, Countdown): given a target number and a set of initial numb... |
I want to create wrapper for boolean type to not use more if statements. Can you tell me that this class make sense?
public final class Bool {
private boolean value;
private Bool(boolean value) {
this.value = value;
}
public static final Bool of(boolean value) {
return new Bool(value)... |
My first assignment was to determine the monthly bill depending on what package you have for your ISP. This is the exact assignment.
An Internet service provider has three different subscription packages
for its customers:
Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.... |
(See the previous iteration.)
I have this small library for solving the SAT (satisfiability problem) via brute force: we are given a boolean formula, which is a conjuction (and) of clauses. Each clause is a disjunction (or) of variables or their negatives.
Given a formula, we want to compute such assignments to binary ... |
I am learning object oriented JavaScript and come up with below exercise. There are two multi-select lists, one is source and other is target. User can move the item from source to target and vice versa.
I tried to encapsulate the functionality in an object to initialize it any number of times on the page. However, I ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.