instruction
stringlengths
71
71.9k
I started writing a set of tests for my SageContextBase class, which needs to be abstract because the client code must derive from it (think of it as EF's DbContext - it can't be instantiated directly, but it packs a truckload of functionality) - I have 5 passing tests covering everything that should be happening insid...
I've made a quick game in C++ where you race down a vertical track and dodge 'X's or obstacles. The player is represented as a 'v', and the score is counted by how far you manage to get down the track. The obstacles are randomly generated at the bottom of the map and slide up each time the player moves (using the arrow...
I'm a student, and I'm trying to make the product of two square matrix with some threads in the soup. I've already worked on some fast single-threaded product (with some cache-friendly tricks), and I'm interested now on multithreading. The following code works, but I don't fully understand my outputs in terms of perfor...
I have written a program that is very simple, with a very specific purpose. However, having written it in approximately 2 hours, (with a bit of cut/paste from some of my other programs and MSDN) it's very ugly. For example, the main part of the program is held entirely within one big using block, when it really doesn't...
Doing some exercises on basic data structures, I learned about queues, and decided to roll my own to better understand how a basic queue can function. As the name indicates, this Queue is made from a finite (i.e. regular) array. The JavaDoc gives more details throughout. All this is pretty new to me, so I'm hoping to ...
I know I can probably use MSTest (I'm under Linux without an IDE so maybe not?) or another unit testing library, but for a small project I decided to write my own unit tests without resorting to a framework (for fun and for learning). Right now, I have only one type of assert and one test but I would like a code review...
This a continuation of a previous question. I want to thank Joe Wallis for his help with increasing the readability of my code. Although the changes made by Joe Wallis did increase the speed of the code, the speed improvements aren't enough for my purposes. I'll reiterate the problem, but please feel free to look at t...
Input: An array of colors with weights. e.g [['red', 10], ['blue', 20], ['green', 30]] Output: A random color from the array, based on it's proportion to the other colors. So for the example above, red should show up 1/6 of the time, blue 2/6, green 3/6. I was asked this during an interview. After talking to that inter...
In my journey of learning Rails, I'm wondering if I should test model validations. If so, is this a correct way to do it? require 'test_helper' class ShippingAddressTest < ActiveSupport::TestCase test "shipping addresses validations" do s = ShippingAddress.create assert_not s.valid?, "Address was valid with...
Pretty straightforward, I implemented the popular fizz buzz challenge in Haskell. import qualified Data.Map as M factorWords = M.fromList [(3, "fizz"), (5, "buzz")] factors :: Int -> [Int] factors x = filter (\y -> x `mod` y == 0) factorKeys where factorKeys = M.keys factorWords fizzbuzz :: Int -> String fizzbuz...
I use this to automate the lights in my home while I am away at night (simulating presence). The scheduling of when this runs is handled by my home automation software (Indigo Domotics). I'm open to any/all critique, but am especially interested in whether doing the randomization within the Light object is the right a...
I have these easy-to-use methods for reading and writing binary data in files. FileTools.java: package net.coderodde.file; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import ...
Note: This code was first posted on another forum by me under the name Candy. Read this note before you declare this code copied. Since I was bored, I decided to code a Rock Paper Scissors game in Python in my iOS device (There are offline interpreters available). The very first version of my code was ugly and large, s...
I wrote a small JavaFX Application to inspect Javascript within HTML pages. It loads and browses sites, shows the HTML source, shows an overview of the text of a page, provides a simple Javascript terminal, and runs Javscript files from disk. I'm thinking with some careful perusing it can be at least a little shorter a...
This connection class can be used, through composition, to make IRC clients for different kinds of IRC services. #ifndef CONNECTION_HPP #define CONNECTION_HPP #include <string> #include <queue> #include <functional> #include <tuple> #include <boost/bind.hpp> #include <boost/asio.hpp> #include "irc_exception.hpp" #inc...
As suggested in comments here I created a new topic for next version. I edited a bit original code, added exception processing and optimization, that first N = 1/core count tasks are processed on main thread. public static void Foreach<T>(ICollection<T> source, Action<T> action) { var toBeProcessedOnMainThread = (...
I've got ~20GB of data about the same subject, concatenated from small files of 16kB, each produced by different measurement equipment. They share some headers (on the example: B, D & E) and they may have different headers (A - C - G - G), like so: File1: HeaderA|HeaderB|HeaderC|HeaderD|HeaderE| value A|value B|value C...
I wrote this game to practice some simple OOP. You play against the computer, but be aware that the computer has no real AI, as it just generates its moves randomly. The loser is the one whose turn it is when there is only one match left in the stack. import java.util.Random; import java.util.Scanner; class Game { ...
For each function, I am manually adding another case. Can this be somehow shortened? Case and function names are the same. For example, the Euclidean_Distance case calls the Euclidean_Distance function, and all the functions take the same parameter. double dblDistance = 0; switch (csSettings.enDistanceMetricBetwenDocF...
public class InfoSerializer : IInfoSerializer { private static readonly ILogger _logger = LoggerFactory.Instance.GetCurrentClassLogger(); public string Serialize(BackgroundJobInfo info) { var stringBuilder = new StringBuilder(); using (var stringWriter = new StringWriter(stringBuilder, Cul...
I was just playing around with some code and had the idea about writing some kind of ostream manipulator to delay the output of characters in a typewriter like style. The focus was mostly on how to use it and was inspired by std::fixed or std::setprecision. Overall it works pretty well. I just want to make sure that I ...
For an intranet site with large description-texts I made these website with an accordion navigation. // Get all span-"buttons". var buttons = document.querySelectorAll('.sign'); buttons = Array.prototype.slice.call(buttons); // Toggles the visibility of the text-paragraphs. function toggleDisplayed() { var secti...
I wrote the following two players snake game in OCaml. It is working fine (I did not pay much efforts to the graphical appearance though). As a beginner in OCaml, I would be happy to have some review. #load "unix.cma";; #load "graphics.cma";; let minisleep (sec: float) = ignore (Unix.select [] [] [] sec);; Graph...
Two weeks ago I started writing some Javascript and AngularJS code for a customer. As a proud newby I must also be aware of the dangers on the big bad Internet. In particular vulnerabilities such as XSS attacks. I've already performed a vulnerability scan and this showed I didn't restrict session cookies to httponly. H...
I wrote simple C# TCP Server application and my program use a lot of cup, i was wondering anyone can review my code and would be grateful for any hints and suggestion. This is my code. public class Program { static void Main(string[] args) { int _Port = Convert.ToInt32(System.Configurat...
I've been working on a expression parser which will be part of another project (some sort of DSL). This parser basically uses the Shunting-yard algorithm, except for the case of parenthesis: here it uses a nested stack. I was going to extend it with unary expressions, variables and function calls among other things. Bu...
Here is some code that reads Active Directory to get a person's manager and parses the result for the managers name. It omits the remaining information. I was just wondering if there might be some more efficient way of doing this instead of the code I am currently using. var Manager = (string)UserDirectoryData.Properti...
I solved this problem using closures with Perl and I wonder if/how I could/should have done it differently? Background: User creates config file describing properties of some source data file that would be processed: Type of file delimited (and the delim) or fixed width How many fields to expect Which fields are to be...
This is for K&R C Exercise 1-14: basically asking to create a program that prints a histogram of the frequency of types of characters. This is done with very basic C functions/knowledge as covered in the first chapter. I feel like this code as it stands is pretty clunky with all the for loops to print (though it does f...
Friends, It's been several years since I last worked with the ASP.NET Web API framework. Even then I had developed with it minimally. I have a requirement for a service that will allow for the creation of a new question, retrieval of all questions, and then retrieving a question by an eventId. The following code is my...
The aim is to guess a four letter string. Each letter can be tried four times. If the letter cannot be guessed, we go to the next letter until the fourth letter is reached. I looked at my code and even though I'm satisfied because I've done everything by myself, I'm wondering how I can improve it. I'm probably relying ...
I have a requirement in which I need to set color of two or more rows of a table same if they have same value in cell one and I have to maintain this alternatively i.e. no 3 or 4 rows should have the same color unless there cell value is same. I have written following code but I don't like it that much as it seems dirt...
I have the following code, how can I make it more efficient? Also, it doesn't always find the shortest route. (See Cat -> Tree) import urllib.request, re, json try: file = open("urls.json", "r") urls = json.loads(file.read()) file.close() file = open("links.json", "r") links = json.loads(file.read...
The purpose of this store procedure is to reach into a large database (test), query for a subset, and update a column value, but with a big constraint - I can only update one row at a time in order to avoid deadlocks because the database is large and used by many resources. The code attempts to change the value of tes...
So I'm working with a function that returns a pointer to a list item. Right now, I'm using: IYamlEntity* YamlList::operator[](int key) { // Check for out-of-bounds. if (key < 0 || key >= _items.size()) return nullptr; return &(_items[key]); // **<- Line of interest.** } Would the following be better? IYaml...
I am writing a program that is capable of reading a matrix supplied from a text file. One intended feature of this program is that it should be capable of detecting various delimiters in the text file. So, for example, these inputs should be interpreted equally: 1,2,3,4 5,6,7,8 9,10,11,12 1:2:3:4 5:6:7:8 9:10:11:12 M...
I am making a small script, which, when run in the console on Vocabulary.com, picks one answer (the third or fourth) and clicks. Then the code checks if the answer was wrong or right and goes to the next question. Because the animations between the time the question is answered and the appearance of a "next question" b...
I have an extremely large function for turning my database output of menu links into a multidimensional array that nests each of the links in a menu fashion. I'm wondering if anyone sees a way this class function can be shortened or simplified in some way. The mysqli query: private function _interactions($product, $pe...
I wrote a simple tree data type in Java consisting of nodes which are themselves trees, and where each tree has its own list of children (not a binary tree). I plan on eventually using it in a minimax algorithm where I keep track of future game states in a board game by holding different board states in nodes and holdi...
This is my latest brain child for clojure, could it be done with less code, cleaner, or in a more re applicable way? I am at a pretty early stage in my clojure learning so an in depth explanation of how and why my code is faulty would help me get a handle on what I am doing wrong so I do not build bad habits. (def next...
I want to make a Ruby nested hash table class to avoid repeating ugly code and to keep my programs as true to the OOP paradigm as I can. Are there any ways to make this class definition smaller and/or simpler? To clarify, the class essentially creates an arbitrarily-deep hash table. For example, if you had a NestedHa...
I have a table where I'm storing a row for each transaction that records the type of transaction along with the amount of money being recorded for the transaction type. I then need to write a report to sum the amounts of various types. At the moment I'm doing this with a series of CTE's, but I'm sure there's a better w...
What I've created is a CacheBuilder service that will be passed in a list of items, and will build a results cache. The results are produced by making calls to another service (AsyncService) which will take a variable amount of time. At the same time, other consumers can be checking the results cache, to see if the ite...
Context I have a bunch of data points that look roughly like this: (defn rand-key [] (into [] (repeatedly 3 #(- (rand-int 19) 9)))) (defn rand-val [] (rand-nth [:foo :bar :baz :qux])) (def data (into {} (repeatedly 10 (fn [] [(rand-key) (rand-val)])))) Obviously the actual coordinates would have a much greater ...
Inspired by this CR question, I decided to create my own queue! If you guys see anything taboo or have any improvements, please let me know. Ultimately I want it to be feature rich and bug free, with every possible case tested, so if there's anything else that can be added (like an iterator) and thoroughly tested, plea...
Say we have these data: var mat = [ { "id": "A-B", "x": "1", "y": "0", "weight": "100" }, { "id": "A-C", "x": "2", "y": "0", "weight": "77" }, { "id": "A-D", "x": "3", "y": "0", "weight": "95" }, { "id": "A-E", "x": "4", "y": "0", "weight": "...
This code takes id, name and marks of 3 subjects for 5 students from user base, calculates the total of 3 subjects per student, and then takes a criteria level with which to sort; level 1 sorting does sorting based on 1 criteria only, while level 2 will sort based on criteria 1 and if similar occurs (like if select lev...
.globl inet_addr_asm inet_addr_asm: movq $0xff00000000000000, %r8 movq $0x3000000000000000, %r9 # load ASCII '0' into register nine movq $10, %r10 movq $100, %r11 movq 8(%rdi), %rsi # load eight byes from string address shlq $8, %rsi # get rid of prefixed '.' (if any) movq %rsi, %rcx # load...
The following code is a C solution to the following problem UVA 10018. The Problem The "reverse and add" method is simple: choose a number, reverse its digits and add it to the original. If the sum is not a palindrome (which means, it is not the same number from left to right and right to left), repeat this proc...
Here is a GPA calculator in C#. I am feeling like the code that I write and format are quite long and would like it to be shorter. This program is using radio buttons to enable and disable the text boxes according to the number of subject chosen. Perhaps that part can be shortened. public double gradePoint1, gradePoint...
This is a time line for control over the events of some containers in a train station. It gets all the data to build the time line by getting a JSON from a database via REST service. The app resets every minute to refresh the results and every dot representing a container has some info in a tooltip activated by hoverin...
I'm pretty new to Angular. I wrote a weather app and need my code reviewed. I especially need help on best practices for handling edge cases on the response from the JSON endpoint. Here's the HTML: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scal...
I would like get some suggestions for improvement of this function, and alert me about any dodgy practices that you find. I have been trying to learn python for a short time now and I would like to get some pointers on writing more pythonic code before I develop bad habits. from string import ascii_uppercase, ascii_lo...
(See the next iteration.) I have that application for en-/decrypting files. Here, I will post the actual GUI and command line code. In order to run the program refer to this GitHub repository. Some images: My code is as follows: App.java: package net.coderodde.ciphertool; import java.awt.BorderLayout; import java.a...
I'm still new to programming. (First exposure was school about a year ago), and for some reason this problem really gave me a lot of problems trying to solve it. Can you help me understand what I could have done different/better here? import java.util.*; public class Lab10 { public static void main(String[] args) t...
Given these two methods, is it defensible that one is better than the other? In what terms? Performance? Elegance? Readability? public static void AddFirstNotNull(List<object> onlyNotNull, List<object> source) { var item = source.FirstOrDefault(v => v != null); if (item != null) { onlyNotNull.Add(item); } }...
I'm using Spring HATEOAS to create some links on my REST API. However, the entities i'm returning are very close, so the code to generate the links are the same: private Iterable<Link> getTemperatureSensorLinks(Links sensorLinks, Integer curPage) { Integer lastPage = sensorLinks.getLastPageNum(); Integ...
I've started to learn PHP classes, interfaces, extends and things related to those. Before this i've worked only with functions and it started to be quite a mess with hundreads of separate functions. What i'm trying achieve is the following: Html table, which has 25 products listed. Each product has its quantity and ...
I'm new to Java and is trying to find a substring within a string using regular Expressions. I was just wondering if there are any alternative ways to achieve the same goal, or in a more elegant or efficient manner. while (true) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System...
I took a look at Speed up processing between VBA and IE, but I didn't see anything that addressed the speeding up of the retrieval of information via IE. Since MS got rid of the stock retrieval database (MSN Money), there wasn't an easy way to get current stock prices. From what I gather, there are some add-ins availa...
I'm trying to improve the portability of a file format converter, specifically to POSIX platforms other than Linux. I'd appreciate a review of the following functions used for converting between little endian and host endian 32bit unsigned integers and back. This is basically to replace le32toh and htole32 on platforms...
This function is a working function, which builds a number of queries depending on the values of $_POST. group, class, category, subcategory, brand, product are all arrays sent via post from a userform which uses the Chosen jQuery plugin for multi-select boxes. So here I assume that the user cannot maliciously enter th...
I'm making a web-service for an app with a (partially) crowdsourced movie database. These two functions allows users to add and remove which genres a movie is liked to, and get the log of whom have done what changes. I need to make many very similar functions for other data. [HttpPost] [Authorize(Roles = "Us...
I have written a program that takes in some amount of money, and prints the equivalent change (starting at hundred dollars, to fifty, to twenty, down the pennies). Here is the code: System.out.print("Enter amount of money: "); Scanner scan = new Scanner(System.in); double value = scan.nextDouble(); int valueIntegral =...
I implemented a simple tool to find duplicate files, by applying the following strategy: Take a list of files and return the sets of duplicates (set of sets) Implement a custom Comparator<File> to compare files by content Implement another comparator that calls the first one, and when two files are equal, mark them as...
My code will generate a spelling mistake inside of a string 50% of the time. It will retrieve a letter from a random index in the string like, "t" and then duplicate that letter like, "tt" and store it in the spelling mistake variable. It will then replace, "t" with "tt" in the string to replicate a spelling mistake. (...
I'm a self-taught (on the job) programmer, always looking for ways to expand my skills. Seeing all the FizzBuzz examples with hard-coded logic checks made my head hurt, so I thought I'd try my hand at it. Leaning heavily on KISS, I'm ignoring exception handling and such, and all that's required to add new fizzbuzzers i...
I am looking for an elegant alternative of the following code where wordXX contains always 16 bits: uint64_t wordHi = 0xaa; // I would like u_int16_t over u_int64_t here uint64_t wordMi = 0xbb; // because it represents the real data better uint64_t wordLo = 0xcc; uint64_t largeword = (wordHi << 32) + (wordMi << 16) + ...
I have created a basic checkbox custom meta box in order to set a post as "featured". //create the boxes html markup function custom_meta_box_markup($object) { wp_nonce_field(basename(__FILE__), "meta-box-nonce"); ?> <div> <label for="meta-box-checkbox">Featured Article </label> ...
I'm not great with javascript. I need some code to rename all iframe src attribute names to data-src, for a lazyload plugin to work. I couldn't find out how to rename the attribute names, but with some trial and error I managed something similar and it is working OK: $( document ).ready( function() { $( 'ifra...
For educational purposes and to understand how iterators are working in C++, I've create an input iterator and I would like others to look at and provide any feedback on my code. template<typename T> class iter_input { public: typedef T value_type; typedef T& reference_type; typedef const T& cons...
I have been learning object oriented programming for quite a while. I understand many concepts about it but I quickly realized that I made a big mistake just reading theory and not doing any actual coding . There was no practise at all and when I started to write some code, I felt it was harder to think and come up wit...
This JavaScript file is part of a large Ruby on Rails app. Any feedback is appreciated. Update 3.7.16: as per @Jonah's suggestion, here's a description of the code's purpose: I've built a bus-tracking application using Ruby on Rails that displays a user's location as well as the location of several nearby buses all on ...
Requirements were to create a constructor for a complex number, that receives a string. For example: \$3+5i\$. The regex extracts positive or negative numbers from the string with optional decimal. My professor told me that my regex was "beyond wrong": public Complex(String str) { ArrayList<Double> list = new...
I have been learning AngularJS and have written my first app. It's a Hangman AI which learns words and guesses the solution based on the words it knows. Please look over my code and provide some pointers towards better practices, techniques and overall criticism. Here is a CodePen demo, as the Stack Snippet may have cr...
I have a library that defines a bunch of ISprite interfaces, like IPieceSprite and ITileSprite. Then, it defines a global ISpriteFactory that should be supplied to the library upon initialization. ISpriteFactory should create concrete objects based on the interfaces mentioned. I made this rough implementation, but it m...
//convert the comma separated numeric string into the array of int. public class HelloWorld { public static void main(String[] args) { // line is the input which have the comma separated number String line = "1,2,3,1,2,2,1,2,3,"; // 1 > split String[] inputNumber = line.split(","); ...
(Everything needed for running the app is here.) I have refactored my previous version a bit. App.java: package net.coderodde.ciphertool; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Toolkit; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List;...
I want to make show/hide logic more maintainable in my codebase. Because they are too faraway located in separate js files, it hard for people to maintain. The flow in my codebase is: require.js init (hide the target DOM at first) → app.js → load_comments.js (show the target DOM if the comments length > 0) main.js (...
I would like to improve the function below without calling twice InserisciRigaNote. Before I fill my dictionary. When I compare idNota with the current database id I check if it is equal or not, if different means that the dictionary is filled and I can proceed with the insertion of the row in DataGridView I have a que...
I am tring to learn coding in clear way. I developed easy application to simulate EKG. I would like to ask some experts, if the code is clean and if they have any suggestion, what could I improve. Possible improvment is not to avoid first loop (no counter of data is set to -1, to avoid first read), but I do not have an...
I was working on LeetCode to practice myself with Java programming. I encountered a question about insertion sort a linked list. My code currently runs correctly, but it failed on an instance with more than 8000 nodes. I guessed there must be a bottleneck for my code and I need your help. My code : /** * Definition ...
I have created REST API in codeigniter. REST sever created in codeigniter 3.0 and REST client created codeigniter 2.x.x. I have wrote simple code for login. After login client created dashboard page. So for creating dashboard page I am sending so many request to REST server and it's taking too much time. Below is the ...
I'm writing a function divideMoney that takes the value of a sum of money and divides it according to some percentages, then rounds each division to the nearest denomination. For example: //divideMoney(sum, percentages, denomination); divideMoney(102, [0.5, 0.30, 0.20], 0.25); This should divide the sum of $102 to 3 ...
I am new to the functional style, and I wrote a curry function to practice this new style. This curry function takes a regular function and returns the curried version of it. Currying is a technique, with which you can partially evaluate functions. function curry(f, self) { return function () { if (arguments.le...
Here is a function in a django rest api, that takes data in json and registers a category for a given website. I'd like to merge two try...except parts that check 'site_id' and 'category_id' but I am not sure how to do it. Also any other suggestion to make it pythonic is appreciated: @myql_view(['POST']) ...
I require that the Feature set of my Licence to have a non-empty intersection with a set of features that the module I am loading contains. I expect other lists in my License to form similar requirements, and I wish to be able to specify as much information as possible on the license object, i.e. I do not wish to need...
I'm trying to figure out double linked lists. I'm looking for any type of comments you might have for my code. Anything that will make it better. #include <iostream> using std::cout; using std::endl; using std::clog; using std::cerr; class List { private: struct node{ node* n_next; node* n_prev; ...
Let's say I have a square matrix of size (n*m) x (n*m) that is composed of n x n sub-matrices, with each submatrix being a square of size m x m. I want to select the diagonal indices of the off-diagonal submatrices. This is the code that I have so far, but I would like to do this without the calls to itertools.permuta...
I have written a small JavaScript function which performs an AJAX request every x seconds. I was hoping some of you could give it a look over and give me any pointers on redundant code or bad practices. The idea of the function is to: Allow for polling to be initiated Once initiated, poll once every x seconds and perf...
Here is code that retrieves an access token from SharedPreference. public static AuthToken getFromPreference(SharedPreferences p) { try { String at = p.getString(ACCESS_TOKEN_KEY, ""); String uid = p.getString(USER_ID_KEY, ""); long t = p.getLong(EXPIRES_AT_KEY, -1); if (at.isEmpty() || u...
I'm a newbie with Haskell and I'm trying to learn the language and its idioms while working through a small data analysis project. The first step of my analysis is to take a very long list of data, generate the set of ngrams from that list, then create a histogram from the generated set of ngrams. This approach seems ...
I am making a game for my computer science class. My professor's requirements are: Write a Processing program that draws a triangle in the middle of the window. Rotate the triangle when the left and right arrow keys are pressed using the translate and rotate methods. When the spacebar is hit, create a torpedo that app...
I want to store the information returned by the dis function of the dis module in a structured way, using a dict, associating the mnemonics of each code of a line to the correspondent line number. Note: Instruction is a subclass of _Instruction, defined in the dis module as a namedtuple. Output: disassembled_dict = { ...
I'm trying to do some basic math comparing some course groupings to completed courses. The original code shown below seems huge and maybe not pythonic? I'm trying to write better view code then what I currently have. The reason? I want to improve and secondly, I'm checking manually for each and every course. There has ...
I'm writing a program/tests in C# using Selenium and Chrome web driver. Everything works well, however I would like to simplify the code and make it object-oriented. I thought about extracting some parts of the code to different classes, and perhaps refactor the area of driver.FindElement... by using it only one time w...
I have an interval array like below: var interval = [[1], [1,3], [3,5], [5,7], [7,9], [9]]; I want to compare an input value say 1.5 with in the interval, and create an array drawData = [0,1,0,0,0]. To do this, i'm using a if loop like below: if(attr.freq < interval[0]){ freqData = [0,0,0,...
I want to make a simple wrapper for sklearn models. The idea is that the wrapper automatically takes care of factors (columns of type "object") replacing them with the average value of the target, while preserving the syntax of sklearn models. If the factor is too scarce, it is replaced by the overall average value of ...
This code checks if string has correct format for passing to struct. Correct format needs to be [123456789'\t'First Name'\t'Last Name'\t'City]. I didn't know how to enter tabs, so I used '\t'. I use them to separate different word blocks so e.g. first and middle name can be read to a first name in struct. I wrote alter...
I have the following function and want to simplify the code to make it more readable by eliminating redundant lines: Function AddSheet(shtName As String, Optional readOnlyFlag As Boolean = True) As Boolean 'Add new worksheet to current workbook at the end If readOnlyFlag And IsSheet(shtName) Then AddSheet...