instruction
stringlengths
71
71.9k
I found a bit better implementation for Java Arrays.sort(int[]). To make this code review more simple I divide this questions to several parts. The goal of this question is to find more ways to increase the performance even better. Edit: Tested over Java 6, win 64 bit. In average for equal redistributed input(did not t...
I'd like to add a bulk of items into a sparse array, starting at a certain index. I came along this requirement in order to accomplish client side pagination while not retrieving all data from server (assuming server returns the right data, given the required indexes). To keep right indexes when "Skipping" and "Taking...
I have been trying to learn C by making a Hangman game. It's not perfect, but with C, I worry that my coding practices will not be very good. I'm also new to allocating memory myself, so I feel I may have done something wrong there. I would very much appreciate reviews of my code. The game takes in a text file with t...
As you're probably aware, PHP doesn't support type hinting for scalar types. I feel this might be good practice to build into my framework, although I'm aware some of you might disagree seeing as PHP is a loosely-typed language. But I'd like some feedback on the implementation of this. Do you think it's efficient, poin...
I was given a task where given a string of '0's and '1's, return the longest substring where the count of '0's and '1's are equal. I was told also that the code should be O(n) and space O(1). Below is what I came up with: def max_equal_sub(s): ''' I get the substrings by iterating over the starts and the ends ...
Write a program to do addition of intervals to an interval store. An interval is represented by an array of two elements - the lower and the upper bound (you can assume integers). Assume that intervals are constructed properly (e.g. the lower bound is not greater than the upper bound, etc.). Implement the #add m...
I have to parse a file line-by-line and in single line I have split by ",". The first string is the name and the second is the count. Finally, I have to display the Key and Count, for example: Peter,2 Smith,3 Peter,3 Smith,5 I should display as Peter 5 and Smith 8. I confused about choosing between BufferedReader vs...
I have been working on a certain task these days and after several hours of torture, I have done it! However, I believe the code that I have "crafted" is quite difficult to be understood and to be honest, I wouldn't be able to understand it if I wasn't the one who made it. Anyways, this is my code. I would like to rece...
Based on Dynamically call lambda based on stream input: Try 2 This fixes most of the points pointed out by @Morwenn. It has been generalized so anybody can call it. The only extra part needed by the code is a function to retrieve values from a stream. This is passed as a template argument to callFunctor() see the exam...
This code is super slow. I'm looking for advice on how to improve its performance. #!/usr/bin/python # -*- coding: utf-8 -*- # # rss feed indexing bot # import requests import urlparse import time import cookielib import psutil import feedparser import socket import datetime import sys import urllibfthe reason fo...
For homework, I have to code a program in Python that effectively simulates a bank ATM. print('Welcome to Northen Frock Bank ATM') restart=('Y') chances = 3 balance = 67.14 while chances >= 0: pin = int(input('Please Enter You 4 Digit Pin: ')) if pin == (1234): print('You entered you pin Correctly\n') ...
I'm looking for code review, optimizations and best practices. Also verifying complexity to be O(n), where n is the string length. public final class InfixToPostfix { private static final char PLUS = '+'; private static final char MINUS = '-'; private static final char MULTIPLY = '*'; private static fi...
So here it is, my linked-list implementation in Java. I have coded against Java's List<E> interface as if my LinkedList<E> could replace the standard java.util.LinkedList<E> and it should make no difference. I am however aware of that I did not implement Deque<E>, as only implementing List<E> is a task on its own alrea...
I was eventually going to add another computer and more options to this (i.e., Rock-paper-scissors-lizard-Spock) but I wanted to make sure I was using the best practice for this type of game. Any help would be appreciated. # The traditional paper scissors rock game import os def clear(): os.system("clear") clear(...
I'm learning Haskell and thought it would be fun to write an AI for the game 2048 in Haskell. In my implementation I got rid of the randomized aspects of the game. This makes the program deterministic (or pure). However, I don't think it performs very well. It uses a very simple algorithm: Recurse into all possible mov...
To create a Logging system for a larger application, I came up with the following draft. The log sinks aren't detailed yet, but the factory method for logger creation and a rough draft of the logger itself are. Is this a good start and worth continuing? Or are there pitfalls you can see? class LoggingSink; // abstract ...
Background When a user leaves a page, if they haven't submitted form data, a button is animated to draw the user's attention. (This is a poor UX choice--all the form data should be submitted--but it is what I have to work with at the moment). Only the text, which is centered on the button, must wiggle: the button itsel...
Following-up on Creating ADODB Parameters on the fly and pushing the "wrapping" of ADODB a step further, I have written two more classes that allows me to expose methods that don't require a Connection object, without returning an ADODB.Recordset. Taking this method as a reference: Public Function Execute(connection ...
This program is for a class project and requires me to read data from a text file then display a list of totals. Here are the instructions/requirements: The fields in each record will be separated by a comma. Format: Age, Gender, Marital Status, District# For example: 18, M, S, 2 The city has 22 districts. The census ...
This is something I wrote as a reply to a deleted "Rock/paper/scissors [updated]" question. Since I can't post it as an answer (and the line-by-line analysis is gone as well), it might be nice to get a code review. """A game of rock/paper/scissors.""" import random SIGNS = ("rock", "paper", "scissors") VERBS = ("crus...
Perform a graph clone. Verifying complexity to be O(E). Looking for code review, optimizations and best practices. class NodeOfGraph<T> { private final T item; NodeOfGraph(T item) { this.item = item; } public T getItem() { return item; } } public class GraphWithCloneFunctionalit...
I have been reading about SQL injection and I want to secure my code. I am not asking anyone to write me a code, but I just want to learn it in simple terms. The best way for me to learn is to edit my code so I can compare them. <?php if (isset ($_POST['email'])) { //Connect to the database through our include ...
I have next/previous buttons on my site and all they do is slide sections of the site from left to right and vice versa, it is smooth and looks good on a desktop but on mobile devices it is a bit slow and jumpy. if (type == "prev") { $(this).hide('drop', { direction: 'right' }, 600, function () { $('#dv' + page).s...
I'm designing a small account/password manager using C# and SQL Server CE. LINQ to SQL is my ORM of choice. Here's the data model representing how the SQL Server CE database is set up: And here's my GUI with a cheesy color-coding system to show how the data is mapped to the GUI: Since the user is able to dynamically ...
I'm writing away for this website, and I've come into a problem. I need to display only one td based on the corresponding radio button pressed. However, there are two 'master' radio buttons that dictate how many radio buttons are shown, and after that, which are selected. - if that makes any sense! Now, I am only showi...
The code I want to refactor look as following: public bool CheckPay(Int64 orderID) { vpc_OrderInfo = orderID; RequestParams = string.Format( "vpc_Version={0}&vpc_Command={1}&vpc_AccessCode={2}&vpc_MerchTxnRef={3}&vpc_Merchant={4}&vpc_User={5}&vpc_Password={6}", vpc_Version, vpc_C...
Given a large bounding rectangle ("envelope"), a list of points, and a maximal aspect ratio, the goal is to find a rectangle within the envelope, whose aspect ratio is bounded within the given aspect ratio, that contains a largest number of points from the list. For example: if the envelope is the rectangle with corner...
I am getting List ids and by using those ids I am creating a Map by fetching related data of id from database, here I am checking prevId with currId if these are not equal then I am putting them into oCMap. Can this code be optimized? Or are there any improvements (like is there any better algorithm)? Please offer su...
For a school project I have been asked to create a login system for a website. The language I have to use is PHP with no database as of yet (for a later assignment). I'm just wondering if this code has any security flaws. Here is my current code: Navigation.php note that this is to be included in another html document....
I am looking for a review on the following code which is for this question. I am looking for a general review of the code. I am specifically also looking for advice on how to make this code run more efficiently. #include<iostream> #include<stdlib.h> using namespace std; long int b[100001]={0},x,n,m,i; char num[100001];...
Is this the best way to do this sort? assets.OrderBy(a => a.GalleryItems != null && a.GalleryItems.FirstOrDefault() != null ? a.GalleryItems.OrderBy(gi => gi.SortOrder).First().SortOrder : 1000) Basically I have a group of assets, which contain a group of gallery items with a sort order. I nee...
I just began learning programming and I'm learning Objective-C. I'm taking an online course and in that course we were doing a magic crystal ball app. Then I decided to use what I learned and make my own app. Viewcontroller .h #import <UIKit/UIKit.h> @class MBFQuotes; @interface MBFViewController : UIViewController ...
I am trying to remove file extension of a file with many dots in it: string a = "asdasdasd.asdas.adas.asdasdasdasd.edasdasd"; string b = a.Substring(a.LastIndexOf('.'), a.Length - a.LastIndexOf('.')); string c = a.Replace(b, ""); Console.WriteLine(c); Is there any better way of doing this?
I'm planning to make a small game for learning purposes. So far, I've got the hang of the canvas element and using the context to draw things on it, as well as object notation and classes in JavaScript. But before moving on to making the rest of the game, I'd like you to please take a look at my code and see if there'...
I've had ideas for something like this in the past but I've finally implemented one and I could definitely use some code review for it. Obviously the quality of the names generated will depend on what the whole thing is seeded with, but that's a separate question. My concerns are the quality and readability of the co...
Here is a class of one of my applications I'm trying to learn writing good code with. Old Code: //----------------------------------------------------------------------- // <copyright file="Client.cs" company="-"> // Copyright (c) -. All rights reserved. // </copyright> // <author>-</author> //---------------------...
I am comparing two integer values, but there is chance of parseInt giving NaN. I would like to know if I need to do any additional checks. var txtFromCustomerId = document.getElementById(FROMCUSTOMERID_FIELDNAME); var txtToCustomerId = document.getElementById(TOCUSTOMERID_FIELDNAME); if (txtFromCustomerId != null && ...
This is my first Laravel package. It uses hybrid Auth package to authenticate users using their social network accounts. It can retrieve information to store in a local database. Its purpose is to be able to link several social networks accounts into one single user. That way, if you login with Facebook or Twitter, y...
I'm currently working on a very simple one-file project: Lumix provides the possibility for the camera TZ41 (and others) to load GPS data and tourist information from a DVD to a SD-card so that you can see on the camera (which has GPS and the SD card inside) this information. Sadly, the software to copy it on the SD ca...
I am slowly learning C and C++, and decided after a few lessons to dive in myself without any help. I developed this prime number generator. It seems fast, but I'm wondering if I'm following the best practices for C++, or if I am missing anything important. #include "stdafx.h" #include "stdio.h" bool checkPrime(int Num...
For this project, I do not have access to Boost or C++11. Note: I updated the question's description to clarify what I am doing. I have not changed the code though, so no answer has been invalidated. I have to deal with functions that return error codes. When one of these functions fails in exceptional cases, I would l...
This function checks if a list is sorted. isSorted' :: (Ord a) => [a] -> [a] -> a -> Bool isSorted' [] [] _ = True isSorted' (x:xs) [] _ = isSorted' xs xs (head xs) isSorted' orig (x:xs) a | a > x = False | otherwise = isSorted' orig xs a I don't like how this function requires that the list be entered twice. But,...
Over at Stack Overflow I asked how to scan a local filesystem ignoring all remote mount points. I only really wanted a push in the right direction and received it. After clacking away on my keyboard I think I might have what I what I need. I ask for an evaluation to determine if it fulfills the requirements: Scan ever...
I am formally a PHP/C# developer and I am new to C. I need you to help to correct my coding with C. I have a kind of following pieces of HTTP user data string. char *userData = "=GET /ad26908aa2e811e3855e0a22f2d2d906_8.jpg HTTP/1.1..Host: distilleryimage10.ak.instagram.com..Connection: keep-alive..Accept-Encoding: gzip...
Please review the following code: #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char *some_text = "THIS IS SOME ARBITRARY TEXT FOR TESTING THE STRLEN AND COPY FUNCTIONS"; char *test = malloc(strlen(some_text) + 1); strncpy(test, some_text, strlen(some_text)); strcat(test...
I need to seed a database with user data. When trying to write records to a file using sqlite3 with node, I tried writing the logic in a naive manner, without any error checks - but it was failing with numerous SQLITE_BUSY database locked errors. Then I added code to retry in case of an error, but was insufficient - en...
Please let me know a better approach to solve below problem: Problem: Vertically arrange the words in a string and print on console. Sample Input: Hello Jack Output: H J e a L c L k o My solution: public static void toVerticalWords(String str){ //split the words by whitespace String[] strArr = st...
int kth_smallest_number(int A[], int n, int k){ /*kth smallest number is smaller than pr equal to n-k numbers in A*/ int smaller_than_count; int i,j; for(i=0; i<n; i++){ /*Check whether the number A[i] satisfies the condition*/ smaller_than_count = 0; for(j=0; j<n; j++){ ...
I have code which I need to refactor in order to use in many places. So I tried some solutions but always ending with repeated and messy code. So, I decided to ask what possible best solutions are. This code is used for calculating sale price in e-commerce project. My goal is to put some code in method which will not c...
I just finished writing a flat-file DB class for PHP which supports selecting, updating, inserting and deleting. I was wondering if there are any ways to make it faster or if I'm doing anything the wrong way. <?php class FlatDB { private static $field_deliemeter = "\t"; private static $linebreak = "\n"; pr...
I have a DataService, which should talk to the server and store vars (for complicated calls, for example). Last time, I ended up with this approach (for the example, I'm working with a list): GetList() - returns cached data (just a property) SetList() - sets a property ReadList() - read data from file from IsoStorag...
I'm new to this pattern and I see arguments online about different implementations. I have the following code and it seems fine to me, but I'm wondering if having to pass the DBContext into the constructor would cause any issues down the line? I'm using this with EntityFramework (RECORD_TYPE is a table brought in from ...
I've been working on a Sudoku solver as an introduction to the Java programming language. I know there's a bunch of ways to program a Sudoku solver, including a brute force/recursive approach and a logical approach. I've chosen the logical approach to start out to keep things simple. This program solves Sudokus the exa...
I have an array of length n that contains numbers from 0 to n-1 in random order. I now want to "inverse" this array to one that where index i corresponds to the location of i in the source array. Example Source_Array = {2,0,1} Transform to: Result_Array = {1,2,0} This means I find the index 0 at position 1 in my sour...
I am applying to a university to study Computational Linguistics, and as I read, it would be recommended to have a background in Artificial Intelligence. The Admission board asked me to prepare a portfolio of my works, and I am considering to add this solution to the portfolio. I have been lazy to develop an AI to bypa...
I am trying to implement a custom ApiClient in Python, using requests. The way it does authentication is by: login(username, password) -> get back a token if valid, http error code if not set the token in {'Authorization': token} header and use that header for all endpoints which need authentication Can you check if ...
This query produces the results I want. Is there a less wordy or more effective way to write this query? Criteria: 1. Vendor in detail record must have a record in TRANSEFFECTIVE 2. Get the most recent (begin_frame) record from TRANSDETAIL 3. Tells me if the vendor has any other categories in the TRANSMODAL table. In...
I am looking for a review on the following code which is for this question. I am looking for a general review of the code. I am specifically also looking for advice on how to make this code run more efficiently. import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.io.InputS...
I decided to write a program to test music theory, and, while it would've been much easier for me to make it elegant and perfect in Java, I thought I'd take the opportunity to get more familiar with Python. Below is the full script. It simply prints a staff in treble of bass clef with a note somewhere and asks the use...
Can someone help me refactor this to be more optimized? Performance seems to be very optimal, but I think more can be squeezed from it. <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class o7th_Model extends CI_Model { private $msg = ''; private $custom_msg = null; ...
I've been studying PHP for a while now and decided to dive into OOP. Most of my code was a mess and I've begun to refactor much of the website to OOP; however, I'm having an issue with redundancy in my class functions. Below is a my Tracking.class.php file, which is responsible for returning arrays based on the funct...
How could this template class ThreadPool be improved? I use Boost queue to keep std::function's numbers from std::array(simple hashing) from which I can later retrieve the std::function's objects to execute them with operator(). It's not possible to store them directly in boost::lockfree::queue (Stored Object Type mus...
Suppose the following example unit test for an ASP.NET MVC controller: [Test] public void Delete_Will_Redirect_To_Index_1() { bookRepository.Add(someBook); var result = booksController.Delete(someBook.Id) as RedirectToRouteResult; Assert.That(result, Is.Not.Null); Assert.That(result.RouteValues["Action"...
I am writing a stochastic simulation for a Yule process: If you start with a certain number of bins each containing a random number of balls, you add another ball to an existing bin with a probability that is proportional to the number of balls within that bin, as well as create another bin with a single ball each time...
If I need to obfuscate an iPhone password that is hardcode (Oauth Client Identifier and Client Secret), would this be a way to do it? NSString *a = @"a"; NSString *b = @"b"; NSString *c = @"c"; NSString *d = @"d"; NSString *e = @"e"; NSString *f = @"f"; NSString *g = @"g"; NSString *h = @"h"; NSString *i = @"i"; /* ...
This was a question asked to me before setting up an interview. You are given a game board that contains a four by four (4x4) array of pieces. The pieces can be one of six shapes and can be one of six colors. If the board contains 4 pieces of the same shape and same color, the board contains a winning pattern. public...
So, I have the boundaries of every states in the US, from the google map KML file. This KML file is actually a XML file. I'm converting this file to a JS file compatible with google map in order to draw polygons on my map. Here is an excerpt from the file with all the coordinates: <?xml version="1.0" encoding="UTF-8"?>...
I wrote the following split function. It takes a list, an element and an Ordering (LT, GT, EQ). For LT, the list will filter out all items that are >= the element argument. split' :: (Ord a) => [a] -> a -> Ordering -> [a] split' [] _ _ = [] split' (x:xs) a LT | x < a = x : split' xs a LT | otherwise = split' xs...
This is a piece of code I am working on to reuse in a few places on various websites. It is used to capture name and email addresses for people interesting in registering for something, we want to add them a newsletter...So here is the scripts/CSS/HTML and it feels clunky. And maybe others might have some input on ho...
I created this small Python calculator after abstaining from writing code for a while now. I would love seasoned programmers input. #!/usr/bin/env python " A Simple calculator " class Calculator(object): """ Example input: expression: (12+4)*2^4-(10-3*(15/5)) steps: 1) compile it to a list...
Here is a question I tried from the Codility train website: A small frog wants to get to the other side of the road. The frog is currently located at position X and wants to get to a position greater than or equal to Y. The small frog always jumps a fixed distance, D. Count the minimal number of jumps that the s...
As I understand, the constructor chaining can be applied to cases when we have some common data to initialize. I have 3 constructors that accept 3 different types of arguments and have some common data. I'm not sure if I can do constructor chaining. public class RStandart { private readonly SqlConnection _objConn; ...
I have this method in my service layer public ModuleResponse GetModules(ModuleRequest request) { var response = new ModuleResponse(request.RequestId); try { response.Modules = Mapper.ToDataTransferObjects(ModuleDao.GetModules()); return response; } ...
This is piece of code is using to download images. Can somebody tell me how to optimize this code to decrease download time for each image? URL url; HttpURLConnection connection = null; InputStream input = null; System.setProperty("http.keepAlive", "true"); try { url ...
I need to extract some metrics from ManagedBeans and store the collected metrics in an object bean. The object bean is defined with member variables to hold the metrics. In this case, is it right to extend the ObjectBean and write the extractor class? For example: class ThreadMetricsBean { private long liveCount, d...
I need to re-wrap a text so that it fits a given width, font and DC. The result needs to be an array of lines. I use the following code: private struct SplitInfo { public string Word; public string SplitChar; public override string ToString() { return Word; } } private static float GetWid...
I'm relatively new to JavaScript OOP and would like to know the best practice when doing a simple object such as a Model. Here's a piece of code representing class named Child: What I'm asking for is: The usage of this (and the weak reference I'm doing which I name self) The global shape of the code (methods in protot...
I've since come up with an improved version, which isn't technically lock-free, but might be as close as you can get (nearly) lock-free job queue of dynamic size (multiple read/write) code below is not thread safe I was looking for a *simple lock-free job-queue which can be used in a generic way, cross-platform. * no ...
I've started working on a script that turns sections with headings into a tabbed interface. The repo is at https://github.com/derekjohnson/tabs and a demo at http://derekjohnson.github.io/tabs/ It works in IE8 up, although I haven't fully tested it on all the devices I have access to. I'm particularly interested in fee...
Notes I'm working my way through SICP, and as I got very confused by the section on folds, I decided to try to implement foldr in scheme and javascript to understand how it works differently with immutable and mutable variables. I'm mostly looking for advice on whether or not what I've done makes sense idiomatically in...
This is my first attempt at a jQuery plugin, which is a simple modal window. I'm keen for feedback of whether I've got the principle correct, the usability of the plugin and any improvements that could be made. Here is a working JSBin. The plugin instructions: Add one or more elements that will launch a modal when c...
I made a C++ container of an ordered list of integers, that, in order to save space, I save as ranges: For example, the list \$ \{1,2,3,5,6,7,8,9,20\} \$ is saved in memory as \$ \{(1,3), (5,9), (20,20)\} \$. I have doubts of the iterator used to show all the numbers that are include on one list is right. Mainly becaus...
As the title says, the objective is to free a binary tree without using the stack or allocating memory. This was required for a kernel module where resources were limited. Result has a complexity of \$ O \left( n \right) \$. template<typename T> struct Node { T data; Node* left; Node* right; }; // Util...
I have this code below for autocomplete feature of several inputTextbox. The input box also share same class".wikiInput". When user typed something in either of them, a relevant autocomplete dropdown box should show up. Instead of hard code one by one. How do I optimize them into a simpler format. Note the lookup has d...
I am trying a stack implementation using an array. I want to know if this approach is OK or if there is a logical problem. This program is working fine. #include <stdio.h> #define MAXSIZE 5 struct stack /* Structure definition for stack */ { int stk[MAXSIZE]; int top; } s; void push (); void pop(...
I have two statements that look like this: $('table tr td:nth-child(' + columnNumber + ')').toggle(); $('table tr th:nth-child(' + columnNumber + ')').toggle(); Is there a way to combine these two statements?
I was inspired to write a BBCode to HTML converter as I'm currently learning functional programming. I wanted achieve functional cohesion. jsFiddle I'd like feedback on: structuring of the code. Should the functions getHtmlTag and getHtml be contained within bbTagToHtmlTag since they are coupled through the rules vari...
I'm new when it comes to Java and programming in general, but I feel I have a decent grasp on a lot of the fundamentals. I've created this "random planet generator" that is virtually useless aside from minimal entertainment, but I've created it to help solidify what I've been learning. I'm not asking for code, but for ...
This is my solution for problem 26 from Project Euler: """Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.""" from timeit import default_timer as timer import math from decimal import * start = timer() def longestPeriod(n): # define function longest = ...
This is a revised version of an AI for the game 2048, written in Haskell. Link to original thread: Poor AI for 2048 written in Haskell I think this version is a lot cleaner, thanks to the tips from Benesh. I would like to know if I'm following best practice guidelines and especially if I made the right choices performa...
Most of you already know me, please be brutal, and treat this code as if it was written at a top tech interview company. Question: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 ...
What I'm trying to do: Get user input for Google Play App page. e.g. https://play.google.com/store/apps/details?id=jp.scn.android Scrape 100 reviews from Google Play App and organize them into an array. My JavaScript function: function test() { var urlAdd = document.getElementById('input').value; var urlEn...
I have written a piece of code for removing duplicated values from a string. Any suggestions on improvements? public static String removeDuplicate(String s) { char [] temp = s.toCharArray(); int length =temp.length; for (int i=0;i<length;i++) { for (int j = i+1; j<length;j++) { ...
I'm doing some research for a meta post on Gardening.SE (where I'm a pro tempore moderator). I'm using the Stack Exchange Data Explorer (SEDE) to find information about first time users who post questions in our [identification] tag, and how they subsequently interact with the people who respond to their question, whet...
I have a backup script which should backup a folder and send it to email. This should be done once a day. As this is on my laptop which is not online 24/7 I need to check that I am online and can send email. For this script I have an entry in crontab running every 2 hours. Because the folder is a really important to me...
I am working in an inherited code (as in "everybody related to it left before I arrived at the job and left no documentation") and I have noticed an strange pattern. Almost(*) each Struts (Struts 1.3.8) method that is invoked begins with a code such as public ActionForward myMethod(ActionMapping mapping, ActionForm for...
I have been developing this plugin architecture, mostly for fun and education, its a simple WinForm with some plugin logic and two plugins, i want to know if there is a better way of doing it. Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing;...
I've written it for an assessment. It works but my assessment also requires a peer to review it in terms of how it could be improved, how it rates as a piece of JavaScript, etc, any comments would be appreciated (I don't know anyone else to ask). As a bit of background this is JavaScript written to be embedded in a HTM...
Consider a method (let's call it IsPrimeHybrid) which calls at least two methods (let's call them IsPrimeNaive and IsPrimeBySearch) that calculate an identical result using different approaches and the outer method returns the result when any of the inner methods finishes. The following is my first attempt to write suc...
This is my constructor to transform an Outlook contact into a Dynamics CRM contact: public Contact(ContactItem contactItem) { LogicalName = EntityLogicalName; FirstName = contactItem.FirstName; LastName = contactItem.LastName; //if no last name, use the first name if (String.IsNullOrEmpty(LastName))...