instruction
stringlengths
71
71.9k
I need to handle a resizable WPF ScrollViewer that scrolls vertically and stretches horizontally and contains stretched wrappable TextBoxes. I have the following XAML WPF layout (the smallest example I have managed to produce): <Window x:Class="ESiftClient.TestWindow1" xmlns="http://schemas.microsoft.com/winfx/...
I think my code is sloppy can anyone give me advice to do it better? This is a page pagination that get rows from mysql db and calculate the number of pages. <div class="row"> <div class="twelve columns tac"> <?php //Check for the current page and select one of the two versions of "back" link. ...
I have a text file composed of several subsequent tables. I need to get certain values from certain tables and save them in an output file. Every table has a header which contains a string that can be used to find specific tables. The size of these text files can vary from tenths of MB to some GB. I have written the fo...
The core of this question is removing a Static Class smell from my Web-Api/MVC solution. It presently works but feels kind of dirty. Present Solution Standard solution with 6 projects: MVC Api Api.Client - wrapped client to make in-code calls Api.Model - Dto's, Request models, etc. Domain - Entity layer, services, cl...
I have a function that formats a number (even a float) to a German decimal format. I got this function from here https://stackoverflow.com/questions/149055/how-can-i-format-numbers-as-money-in-javascript and it works. But every time I want to format a number that I stored in a variable I have to add .format(2, 3, '.',...
NOTE: Added a follow-up question with the reviewed code I am trying to get back to basics with C, so I am doing some data structures in it. The following is my implementation of a Single Linked List (The code is on github with tests). LinkedList.h /* * File: LinkedList.h * Author: antoniocs * * Created on 26 d...
I wrote a small JavaScript library for material design toasts (notifications). Here's the GitHub repo. I'd like to know what my mistakes are and how I can correct them. The code works correctly and was linted with jshint, but I'd like to know more about the code's level of quality. I'm interested in notes on readabilit...
/* * Power set is just set of all subsets for given set. * It includes all subsets (with empty set). * It's well-known that there are 2N elements in this set, where N is count of elements in original set. * To build power set, following thing can be used: * Create a loop, which iterates all integers from 0 till ...
Problem 62 of Project Euler goes The cube, 41063625 (3453), can be permuted to produce two other cubes: 56623104 (3843) and 66430125 (4053). In fact, 41063625 is the smallest cube which has exactly three permutations of its digits which are also cube. Find the smallest cube for which exactly five permutations of i...
Here is the Euler problem referenced, it says: The n\$^{th}\$ term of the sequence of triangle numbers is given by, t\$_n\$ = ½n(n+1); so the first ten triangle numbers are: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... By converting each letter in a word to a number corresponding to its alphabetical position and addin...
I've recently finished a prototype for a little Raspberry Pi website. The main page of the site displays current users found in the room (through bluetooth). I wanted this list updated regularly from data in a MySQL table, so no refresh is needed. When someone walks into or out of the room, the webpage shows almost ins...
I am getting two different lists of members, then if certain conditions meet, I add more members to the list before converting into an array. Is there any way this could be improve? I guess we can use Linq and cast but I am not advanced in either of the skills I mentioned. List<Member> Members = new List<Member>();...
I have this as part of a project to normalize DateTime values to more readable strings, localized to the relative time in the past that they happened. It allows you to make several customizations. If you don't want a time to show up, specify "" for the timeFormat, etc. You can change the reference DateTime so that you ...
A rags-to-riches of A method to capitalize the first letter of all words in a String. To recap the requirements: Please implement this method to capitalize all first letters of the words in the given String. All other symbols shall remain intact. If a word starts not with a letter, it shall remain intact too. Assume t...
I've been wanting to try out F# for some real world programming so I decided to try rewriting a program that is being used at work. It can be reduced to a few steps: Get report templates. In this step I query a DB and get some templates for reports Update data that the reports are working on. In this step I query some...
The following ingests a preexisting SqlCommand and returns the values. A couple caveats right now. 1 ) Type properties must be named identical to the SQL column 2) properties must be given a custom [SQLColumn] attribute. The attribute contains a string which I plan to use later for variation in property names while ke...
I'm learning from "Jumping into C++" by Alex Allain (sample chapter and TOC) and solved the first problem in Chapter 26 "Inheritance and Polymorphism". I'm especially concerned about my use of dynamic_cast, as that isn't covered yet and I suspect there's a better way. Implement a sort function that takes a vector of p...
Write a program that lets a user play "Rock, Paper, Scissors" against the computer. The program should ask the user to choose one of the three choices, and then the computer randomly picks one (without knowing what the user has chosen). For this problem, the user should be asked to enter an integer: 0 for rock...
I'm working with a legacy program that does a bunch of markup manipulation, some of it higher-level and specific to the proprietary markup, some of it lower level string stuff. I rewrote and documented the customized low level stuff (and used string.h stuff where applicable). I'm not not usually a C-coder, but I'm tryi...
I'm writing a method to insert objects into a MySQL database and while everything runs fine I feel my code is bulky and inefficient. What steps would you take to make this code more pleasant to look at and more efficient? public void addAuthorization(Authorization authorization) { try { // Builds the query...
For one place that I interviewed at (for a Python developer position) I worked with one of the devs on two Project Euler problems, one being problem 79. We talked through different approaches and came up with solutions together, but we coded separately. He seemed impressed that we were able to get through two problems....
In an attempt to get deeper down into Scala, I decided to make a BST using as many interesting concepts as possible in order to explore everything Scala has to offer. Taking inspiration from this question/accepted answer, I wrote: package bst object BST { def apply[T <% Ordered[T]]() : BST[T] = new EmptyBST[T]() } ...
I am trying to model person in OOPS using immutability. I have created an object bond with age as 25. To change the age I have created a new object and returned it. Is there any better way to change the age instead of passing all the values of object again? Is this a correct way to do? import java.io.*; import java.uti...
For one place that I interviewed at (for a Python developer position) I worked with one of the devs on two Project Euler problems, one being problem 85. We talked through different approaches and came up with solutions together, but we coded separately. He seemed impressed that we were able to get through two problems....
Here is a simple program that I created to print a file by breaking it after a fixed number of columns. I feel it can be optimized but not sure how. Any feedback is great. #This is a simple program that takes a file and the limits the columns length to #the number passed in as second argument if ($#ARGV < 1) { print...
I wish to use this sample to make my code more readable. Could you share with me your ideas on method naming, variable naming, if-statements etc. It would be great if you have any URLs. private boolean areEngineersHappy (List<Engineer> engineers) { int notHappyEngineers = 0; int happyEngineers = 0; for (Engineer ...
I wrote this code for this code golfing challenge on the CGPP sister site. It wouldn't really be a competitive entry because I had to write all the functions from scratch. (I didn't even golf anything in my code.) I'm looking for ways to improve performance all-around. Please see the above golfing challenge for a deta...
I'm trying to simplify this function, as there can be multiple type of data objects and for each type there is also a male and a female version. The number and name of the elements in the objects are always identical. As you see, most of the code is repeating... function calculate(type, j, value, s) { for (var i = ...
(EDIT: here is the follow up question) I have written a small program in C to calculate the smallest number where any of its permutations or the number itself is divisible by a set of given numbers. It works great when the number is only 4-5 digits but then it becomes very slow. Do you have any suggestions on optimizat...
I'm writing a theoretical MVC application to aid in learning more about ASP Identity 2. In real terms I'm new to ASP Identity as a whole but thought I'd jump in in this release as it's the default in new projects and everything I read about it seems to mostly suit my needs. There is one issue that I need to be able...
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. I...
I have created an Arduino sketch that I am using to send and receive data via serial. It works pretty well and doesn't seem go wrong as long as the correct formats are received. Is there anything I could do to improve this/shrink it to clear up some code smells? String dataString; void setup() { Serial.begin(9600); ...
Please review my program for the Game of 31. The game of 31 was a favourite of con artists who rode the railroads in days of yore. The game is played with a deck of 24 cards: four labelled each of 1, 2, 3, 4, 5, 6. The cards in the deck are visible to both players, who alternately withdraw one card from the deck a...
This is one result of my work on Project Euler to learn Java. I'm interested in how well this conforms to best practices as well as any recommendations on efficiency. (I'm pretty sure this code is a lot more efficient than it is readable, but it's not deliberately obfuscated, I swear! :) ) import java.util.ArrayList;...
My view object: { description: "2tik 2tags" id: 100 portfolio: "TSLA" term_id_1: 260751 term_id_2: 285493 term_id_3: null ticker_1: "GOOG" ticker_2: "TSLA" ticker_3: "" timespan: "ld" top: "" } I need to grab the term_ids and stick them into a new array, but only if they are...
The C++ code below simulates the timecourse of the membrane potential (V) of a population of 128 leaky integrate-and-fire neurons using the Euler method for numerical integration. It produces data for three data points in Figure 1 of this paper. (Well, it produces 400 ms worth of data for three data points.) I have an...
I recently submitted the code for this for an 2 hour interview but I was rejected. The app shows book information with a image, title, and author. Each entry has a title but some entries have no image and/or author. Here is a screenshot: I was given this feedback: There is a lack of proficiency from what we would ex...
In my web app, I have a view where users can search in receipts and drafts. I've implemented this ability in search method at my view model, but I'm not sure if this is the best place to put it. So I'll let you take a look at it. public class ProductCardSearchViewModel { public IEnumerable<ProductCardRowViewModel> ...
I am trying to check if a list has any consecutive repeating elements and then reorder it such that the repeats are avoided. If that is impossible, then return False. For example: checkRepeat([1,2]) Out[61]: [1, 2] checkRepeat([1,2,2]) Out[62]: [2, 1, 2] checkRepeat([1,2,2,1,1]) Out[63]: [1, 2, 1, 2, 1] checkRepeat(...
I have an Engineer which doesn't look very good. How can I make him better organized? What about good practices? Interface: public interface Engineer { String HOMELESS = "homeless"; String ENGINEER = "engineer"; String SOFTWARE_ENGINEER = "softwareEngineer"; String TEST_ENGINEER = "testEngineer"; S...
Is there a more elegant way than the following to check if two numbers have the same sign? bool sameSign(int num1, int num2) { if (num1 > 0 && num2 < 0) return false; if (num1 < 0 && num2 > 0) return false; return true; } It could also be written as the not case...
I wanted to learn about Iterable and Iterators and hence thought about getting my hands dirty rather than reading theory and forgetting it. I am curious how I can improve readability and error handling of my code. I also thought to practice and include test cases. class foo_range(object): """ Custom range iterator ...
I've previously posted some code that deals with making Cartesian co-ordinates safe at compile time. I've been doing a bit more thinking about this in a more general setting, as it is a problem that I quite consistently run into in code bases (all quantities are just declared as double and then forgotten about; or at b...
This is a follow-up from my previous question! I cleaned up the code and added all the notes from the answers. I have also updated the code on github LinkedList.h #ifndef LINKEDLIST_H #define LINKEDLIST_H #ifdef __cplusplus extern "C" { #endif typedef struct LinkedListNode LinkedListNode; typedef struct L...
I have a Model that looks like this: public class Item { public Item() { FilePaths = new List<ItemFilePath>(); } public int Id { get; set; } public virtual ICollection<ItemFilePath> FilePaths { get; set; } } public class ItemFilePath { public int Id { get; set; } public virtual I...
The first number will be dynamically selected and remaining array should be sorted ascending int[] array = {1,1,0,1,2,2,0,0}; int firstNumber = 0;// dynamic can be 0 or 1 or 2 int numberOfOccurances = 0; //Basic sort functionality for(int i = 0 ; i< array.length; ++i) { if(array[i] == ...
I would like to develop a kind of template or canonical implementation for a concurrent subclass of NSOperation in Swift. See here for my previous request which is implemented in Objective-C. In that previous solution, there are still issues when the operation will be cancelled while it has not yet been started. There ...
i am currently working on a project that involves me creating a worksheet for storing student test scores and grades. i wrote a script that retrieves users information and presents it in form of a worksheet. If changes are made to this document it saved the program stores or updates the database. I need reviews and op...
I know there is a more elegant way to write this. The logic is solid and doing what I want it to, but I feel like when written like this, it is awfully cumbersome to have these many if statements essentially doing the same thing. if (forward) { if (counter == listEnd) { counter = 0; } else { ...
(EDIT: here is the follow up qusetion) Using this program to test for the smallest number where its permutations or itself is divisible by 10 or less numbers is twice as slow as the fastest program I found doing this (I don't have the source code). How can this program be twice as slow, what optimizations can I do with...
I have a DB with a master table called "facturas" and another detail table "facturas_detalle." I would like to insert to them, so this is a "Database-First". I need some guidance or advise of best practice here. I've read some examples that are outdated versions of Entity Framework and ASP with no MVC approach. **fact...
I'm working on a database migration script written in python, which will take data from a MySQL database and insert them into a PostgreSQL database with a different Schema (different table structures, different datatypes and so on). Performances does matter, since I will have to handle with sizable databases. I use mys...
Edit: My initial idea was to use numpy to solve efficiently this problem but after trying without results, someone comment on stackoverflow: "Numpy can speed things up a lot IF your problem is essential parallel in nature" I realize that numpy is not the best tool in this case and tried using cython. I have defined ...
I am trying to create a horizontal accordion using jQuery. The code works fine, but I just want to know if my approach is correct and if there are any improvements I could make to the existing code. $(document).ready(function () { $("ul li").children(".Acc_Content").animate({ width: '0px' },{ duration: 1000, queue: f...
This small application is used to approximate conflicts in a schedule. Using a minimal time span of 30 minutes in my example, the application should be able to figure if there's a conflict in +/- 30 minutes range. To compute my approximation, I based my code on this SO's question. The idea is to use bitwise manipulatio...
In order to implement the Observer pattern in C#, one of the ways to go (at least, the one I chose) is to make classes that implement the IObservable<T> for the observable objects and the IObserver<T> for the observers. In a project of mine I created a base class from which every observable inherits: public class Obser...
Looking at my code, I feel like it is not instantly clear for someone who did not write it. I feel like readability will be important for me in the future, if I'm ever to write code on an enterprise, or open source project. Do you have any advice as to how I can make this and future C more readable? #include "datatypes...
I am creating a GUI library to better learn C++ and wanted to see if there is anything to improve/simplify. And I also wanted to be able to call an event of a parent and then for it to iterate all its children and those children to iterate their children and so forth, but I did not want to have a foreach loop in every ...
This is a C# programme to convert Brainfuck to C#, then convert that C# to a .exe. So basically, it's a Brainfuck to Windows exe file converter/compiler. This requires any of: .NET 2.0 in C:\Windows\Microsoft.NET\Framework\v2.0.50727 .NET 3.5 in C:\Windows\Microsoft.NET\Framework\v3.5 .NET 4.0 in C:\Windows\Microsoft....
What I was trying to do here was create a Python script that would generate passwords with 16 characters with uppercase and lowercase letters, and numbers. The generated password would then write itself to a file. Let me know what you think because I know they say the point of Python is to be able to write powerful scr...
The following method retrieves a list of users and the subscriptions for each user, from my database. That said, it works, but it runs pretty dang slow. I'd like to improve the speed on it. Currently, it fetches a mere 90 records, and takes nearly 20 seconds to do so, partly because, for every record of final output, i...
This is really a follow on from a question I asked earlier this year on Stack Overflow. I received a great answer to the following problem: I'm trying to code up something simple and pythonic to identify combinations of values from a list which sum to a defined value, within some tolerance. For example: if A=[0.4,...
I wrote this script as an NYC-specific-API for file upload for a mobile app. Users upload a video file and also their geographic coordinates. I then use an external API to get the corresponding borough in NYC (since the iOS reverse geocoding SDK labels everything as New York, NY regardless of user location within NYC)...
I have a method (C#, .NET framework 4.0) to check overlapping ranges between two prices. I have a process, which will have one or more price(s). A price has one or more range(s), like height, length, width, etc. Each range has a min and max value. How can I further optimize this code? Or is there a better way of doin...
I created a Tic_Tac_Toe class to play the game Tic Tac Toe. Is there a better way of coding a game like this? I started learning python 5 days ago and my knowledge is limited. class Tic_Tac_Toe: x1 = x2 = x3 = x4 = x5 = x6 = x7 = x8 = x9 = '' l = '|' a1 = a3 = b1 = b3 = c1 = c3 = a4 = a6 = b4 = b6 = c4 = c6...
I've tried to implement the access function DBLookup() in VB6 for a project I'm doing. Does anyone have comments on how well done it is and what could be improved? Take note that the Database connection object cn is only valid for a single query, and it's being initialized whenever you call the other public function, d...
I need an external application that helps deployment of the web application. The application should create the aspnetdb database on the dedicated SQL server. Then it creates the wanted roles for the web application, and it defines the initial users, assigns their roles and properties. The code below works, but it proba...
Is there a way to speed-up the following R code? actionVec<-NULL for(iii in 1:length(resultTable$V1)){ actionVec[iii]<- sum(browse$V2==resultTable$V1[iii] & browse$V4 == i & browse$V5 == ii)} this is a loop to form a vector for each record (row) in resultTable, containing the number of entries that match the condition...
I have a very basic method at the moment that fills text boxes with data relevant to the selected company. I load the data into a DataGrid using this method; CompanyDataService namespace SdcDatabase.Controller { class CompanyDataService { public DataTable GetCompanyList() { string co...
This question is a follow-up question to this one. I wrote a small JavaScript library for material design toasts (notifications). I'd like to know what are my mistakes and how can I correct them? Code works correctly and was linted with jshint but I'd like to get notes on readability and performance. Here are the GitHu...
I was wondering if it's possible to move these add remove methods into a single method: public void AddToVipGroup(int companyID, string userID, string auditTrailUrl) { string userName = "", groupName = ""; GetUserAndGroupNames(companyID, userID, out userName, out groupName); GroupUtilities.AddUserToGroup(us...
Using VB.NET, I have created an AddIn for Autodesk Inventor and the customer has a bunch of drawing number strings which follow this sort of scheme: P01867-13-TP09-001-4950-1775-1175-895-1125-835 P01867-13-TP09-002-4950-1775-1045-895-1035 P01867-13-TP02-019-L-1137-275-852-102 P01867-13-TP02-019-L-1137-275-852-102 P0...
I have a DbContext with a SoftDelete implementation inside it. To make it more clear and maintainable, I wanted to extract it to separate class and use as a component of DbContext or something similar. After first try, it looks it is more complicated than I expected. I also don't want to make it more complex. The probl...
I need to open and read several files for a project. Some of them are plain text files, and I just want a standard File.open to read from. One of them is an XML file, and I want it automatically loaded into Nokogiri in the following way: xml = File.open("#{LOCATION}/#{filename}.xml"){|f| Nokogiri::XML(f){|config| confi...
Is there a more concise way of doing this? const string TOTAL_COUNT_KEY = "totalCount"; private int TotalCount { get { int safeInt = 0; if (ViewState[TOTAL_COUNT_KEY] != null) safeInt = (int)ViewState[TOTAL_COUNT_KEY]; return safeInt; } set { ViewState[TOTAL_COUNT_KEY...
I have a 'Membership' model that keeps track of a Member's membership. A membership can be updated by an admin (admin_add), or by the user (update). This code is working great, but I'd love some feedback on how it looks, sections that could be improved, etc. Membership Model: class Membership extends AppModel { ...
For the Harvard cs50x MOOC I have completed an assignment in which a C server framework that functions like a barebones apache server is provided, to be finished by the student. The below code will launch a server on the host IP with the root server folder pointed to by whatever is pointed to in the launch arguments. ...
I have implemented this algorithm, but I would like to get ride of the variable res, which is outside the Solution class, could anyone help me with this? """ Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ res = [] class Solution...
Intro Yesterday I posted this question. Since then, I've updated my code to incorporate these suggestions. I've also removed the dependence on C++11. Finally, I've made the following changes that get me closer to my overall goal: Rather than iterate over different values for dt within my script, I have dt specified...
I'm working on a project which simulates (very simple/watered down) a network. The basis of this is to learn how to implement a Queue. I understand there are many ways to go about this, but I ultimately went with a LinkedList mainly because of it's nature (FIFO) which makes it easy to utilize in a Queue. I would apprec...
This is a function I made for a timer that counts down and performs a callback at the end. It seems to work fine, but I think the code is not very clean and has some unnecessary bits; also I would like some notes on readability. The code: //timer object function function Timer (element, callback) { var ac, minutes,...
I previously discussed the performance concerns about different GCD algorithms. I wrote a simple Java class that implements the Binary GCD algorithm. It is a really tiny class that has only two easy-to-use methods. See for yourself: GCD.java package math; /** * This is a utility class that provides the functionality ...
Is this an efficient and clean implementation? function BST(items) { this.tree = {}; if (items) items.forEach(this.add, this); } BST.prototype.add = function(item) { if (!this.tree.value) { this.tree.value = item; return item; } var currNode = this.tree; var inserted = false; ...
I have the following javascript code that creates a github issue viewer. Can anyone give me some advice on how to improve the code? ;(function (global, $) { var currentPage = 1, configSettings= { 'base_url': 'https://api.github.com/repos/', 'repo': 'npm', 'repo_user': 'npm', ...
I have been practicing backtracking and I wanted to know how I can improve my code. For eg, I don't want to use global. Also, I am not sure if my code will work for all the cases. # Given two words of equal length that are in a dictionary, write a method to transform one word into another word by changing only # one le...
I created a function that will return 2 dates that depend on an input parameter. When the parameter is: 1 - return start date of current week and end date of current week 2 - return start date of last week and end date of last week 3 - return start date of current month and end date of current month 4 - return sta...
I have an action on four buttons. I need to make a down (checked) button if it's pressed and other buttons up (unchecked). My button is TToolButton and the property Style is set to tbsCheck. Could you please suggest improvements? LButtonName := (Sender as TAction).ActionComponent.Name; if LButtonName.Equals('btnVori...
I know that exists a lot of solutions about how to create an OUTER JOIN between two DataTables. I created the following code in C#: DataTable vDT1 = new DataTable(); vDT1.Columns.Add("Key"); vDT1.Columns.Add("Key2"); vDT1.Columns.Add("Data1"); vDT1.Columns.Add("Data2"); vDT1.Rows.Add(new object[] { "01", "ZZ", "DATA1_...
I just started learning reactive streams with RxJava. After reading a couple of books and a lot of articles our there I am still having trouble understanding how to coordinate multiple threads. I would appreciate a critique of the following code, particularly if anyone knows a better way to do it. I basically want to e...
I'm new to Python and wrote this code for collecting all files in an m3u (playlist) file and copying them into a directory. import shutil import os import sys args = sys.argv #check for m3u file if len(args) > 1 : m3ufile = args[1] else : print "m3u file must be set" sys.exit() #check for destination ...
This code works perfectly, but it bothers me. Having a labeled, nested for loop, with a true condition, a break statement, and a continue label...it really bothers me. But I couldn't figure out any other way to arrange the flow control here without sacrificing the efficiency. Any ideas? private static ArrayList<Inte...
I am trying to build a multi page form widget with React for a website inspired by this. Since quite some time has passed since I last touched JavaScript, I'm directly adapting to ES6/7 and tried to port the concept of Tommy Marshall (link above). I'm on a good way so far, thinking about using Redux Form for the actual...
I wrote this to learn JavaFX, and as an excuse to re-make the Game of Life. This is the most complex GUI I've ever written, so I'd like feedback mainly on it, but I'll welcome any criticism! My version differs from the original in that cells inherit their neighbour's color when they're born, which leads to interesting ...
The goal of this function is to an invert an income tax function. That is, given the tax paid and the financial year, the function should return the taxable income for that year. I would prefer to invert the income tax function rather than create a new function (so that changes to the income tax function will not requi...
I'm very new to programming and am admittedly embarrassed sharing my code for critique. This code works and produces the correct answer to the Project Euler Problem 17, which asks how many letters there are when the numbers from one to one thousand are written out in words (excluding spaces and punctuation). I was hopi...
It works by finding 2n+1 with n from 1 to k, but not where 2n+1 would be divisible by one of the already known primes. I'd like to know if the program can find every prime, and if so, how it compares to the efficiency of other algorithms. n=1 k=input() primes=[2] def f(n): b, a = 1, 1 for i in primes: a=((2...
Does it allocates something that hasn't freed? Something that remains in memory? Except result byte array, ofc. private unsafe byte[] ToByteArray(SecureString secureString, Encoding encoding = null) { if (secureString == null) throw new ArgumentNullException(nameof(secureString)); if (encoding == null) ...
I have a set of domain objects which try to find a solution to a problem. The top level object has an algorithm which splits up the problem and delegates it to lower level objects, which in turn do the same. I want the top level algorithm to throw an exception if it did not find any solutions, giving a breakdown of po...
I'm currently writing a game and want to encode everything that happens (GameObject has moved, hp changed, was created/destroyed, got/lost a component, ...) in Events that look like this: class HpChangedEvent : IEvent { public int GameObjectId; public int NewHp; } I hope that will make it easier to network the...
I need to create a commandword to be send to hardware and I'd like to make is as efficient as possible (without going to Assembler or similar). The command is 16Bit long and has to be passed as an array of two bytes to the hardware interfacing library I use (wiringpi). The first four Bit are configuration Bits and the...