instruction
stringlengths
71
71.9k
I'm working on an application in which it takes quite a bit of time to initialize the data. Some background: I'm creating a sort of pivot table in which I turn Figure 1 below into Figure 2. I've gone through with Stopwatchs and have been able to isolate a single line of code that takes 2 seconds during program load (i...
I am trying to create nodes for a linked list in a while loop. The code works, but it is not very pretty. How would I get the same results the proper way? root = malloc(sizeof(struct node)); // Allocates memory for first node pointer = root; // Set pointer to first node char buf[MAXBUF]; // Buffer for each line int si...
The world in my strategy game is comprised of a number of towers. At the start of the game, only one tower is generated, and when the player discovers new towers they are created and added to the array of towers that the Game controls. Towers after the first tower start with different settings. For example, they do ...
I have been learning C++ now for 2 months and this week I started reading a book on 3D graphics. I like coding whatever mathematical stuff I learn so I can understand it better, so when I learnt about Vectors, I decided to write a class on it. I'd be grateful for any suggestions on my code, be it style-wise, performanc...
I am currently writing this pack template to pack all the values (raw / fundamental + arrays of such, especially c-strings and std::string) as a helper for my rqueue - record queue currently used for debug/trace log (with remote acces, future plan includes other variable-size records gathered from small devices - PLCs)...
I have to enable/disable multiple inputs when a select change. It works but I want to do it better. How can I improve my code? $("#street_type").on("change", function(event){ if( $(this).val() == 1){ $("#clase_via").prop('disabled', true); $("#nombre_via").prop('disabled', true); $("#numero...
The point of this code is to mask a page where the user is editing the page's 'body' content. This is in a CMS. The rest of the page is the website template (i.e. header, index bar etc...). I've covered resizing the window, and the DIV itself growing larger. I'd love to know if there is a more efficient way to do this....
Unit testing in VBA is... lacking. (What isn't lacking in VBA though?) Since I've become more interested in unit testing lately, I decided I needed something better than Debug.Assert(), so I started building this framework. Currently there is a ton of functionality missing, but since I'm new to unit testing and interfa...
It seems useful to have a generic function to calculate the mean of all elements in a container, so I wrote one. By default it calculates the arithmetic mean, but should be able to accommodate other means (like geometric) if passed the appropriate functors. Assumptions: value_type can be default-constructed to yield a...
This is an E-mailer class that I created to send me E-mail when/if the Windows service (that will be installed on computers all over) throws an error, so that I know what is going on. I use a similar set up all over the place, so I would like to know if this is clean and efficient. class Emailer { public void sendE...
This is the second project for my CS1 class, this time I'm actually getting it reviewed before I submit it ;) The Harris-Benedict equation estimates the number of calories your body needs to maintain your weight if you do no exercise. This is called your basal metabolic rate, or BMR. The formula for the calories ...
I wrote some Lua bindings for FTGL's C API. This works well enough, but I ended up with lots of macros, one for each Lua function signature. For example, LUD_NUMBER_NUMBER_TO_NUMBER creates a Lua function that takes a lightuserdata argument followed by two numeric arguments and returns a number. I like having most of t...
I have written this piece of JS and CSS loading code and I would like some advice on it. Anything some of the JavaScript gurus could possibly point out would be much appreciated. The code works, but I have not done extensive testing, because I am concerned about replacing functions in this manner. A single JavaScript f...
Is there any reason NOT to wrap a long query over multiple line via new lines vs using concatenation? For example, consider this: $this->query("SELECT u.*, COALESCE(c2.name,u.state) AS real_state, c.name AS real_country, bc.alpha3 AS country_iso, bs.code AS state_iso FROM " . MAIN_DB . ".users AS u ...
I am trying to randomly select 4 items out of an array, each item has an index, a name and a price attached to it. Currently I have the following code segment to select 4 at random: function SelectItems() { $arrayItems = array( 1 => "Name of Item 1", 2 => "Name of Item 2", 3 => "Name...
I'm having fun with Java's Stream library and lambdas. The following code looks for persons within a list that have the same ID (which might indicate that something's wrong with the data) and prints out each group of people that share one ID. I'm not sure if I'm doing this the most concise way, though. This is the Pers...
The following question was taken from Absolute Java 5th ed. by Walter Savitch: A simple rule to estimate your ideal body weight is to allow 110 pounds for the first 5 feet of height and 5 pounds for each additional inch. Write a program with a variable for the height of a person in feet and another variable for the ad...
I am writing a program to calculate Mersenne primes. This code works, but it is so slow: import java.math.BigInteger; import java.util.Scanner; class calculate{ private static Scanner scanner; public static boolean MPtest(int x) { if (x < 2) throw new IllegalArgumentException("x must be greater then ...
How can I make this method better? int[] _input = new int[] { 5,45,184,594,14,8,5,184,1841,184,594,5,78,594,14,8,18,4,18,14,8,594}; Dictionary<int, int> _inputDictionary = new Dictionary<int, int>(); foreach (int i in _input) { if (_inputDictionary.ContainsKey(i)) { _inputDictionary[i] = ++_inputDic...
I've been exploring design based around some of the more advanced C++11 features lately, and some of them are turning out to be rather useful for some projects I'm working on. One is this policy-based, variadic logger class that supports any combination of policies to determine where it logs output to. Most loggers I'v...
Bit of a preface on my motive: I'm self taught and have never really worked in a collaborative environment. My only benchmark for quality is "does it work" and I've never been really subject to peer review. With that in mind I just thought I'd dump a small jQuery validation plugin I wrote here and see if anyone can sp...
I wrote this little piece of code to linearly interpolate between a winforms control's background colour and any arbirtrarly chosen colour. I don't like the way I wrote this piece and I was wondering if any of you would be interested in suggesting improvements. Some improvements/thoughts from the top of my head: If ...
I posted some code as part of an answer to another question and I thought it would be a good idea to get that code reviewed also. Any comments are welcomed, but I am mostly annoyed by terminalNode. It is basically a slightly convenient factory method, but I think it should either be renamed to something more enlighten...
I am writing a game where a car drives and makes jumps. When a jump is landed, the player is rewarded if they land all four wheels either at the same time, or near to the same time. If they don't, they are penalised. I am concerned my solution is not well abstracted (although I am open to all topics of feedback), and p...
I wanted to have a vector with usual values and with some sort of indexing : an element can have links to other elements (via indices). Something like the following, where V::size_type is the type of the vector's indices. vector<pair<T, vector<V::size_type>>> Obviously, this does not work because V is dependant on its...
This code for my blog checks to see if tags are in the params hash. If they are, then only posts that are tagged will be paginated. Otherwise, all of the posts are paginated. class PostsController < ApplicationController def index if params[:tag] @posts = Post.tagged_with(params[:tag]).paginate(page: params...
I don't really like SFML's Vector Classes so I tried making my own. Any criticism is welcome. class gVector2{ public: float x, y; float length = GetLength(); gVector2(); gVector2(float X, float Y) : x(X), y(Y){}; float GetLength(){ return sqrtf((x * x) + (y * y)); } ...
Initializing variables: <? php $host = 'localhost'; $user = 'root'; $pword = ''; $dbname = 'mydb'; $tablename = 'userdata'; $con = mysqli_connect($host, $user, $pword); Code for function to clean data to be sent to database (where $variables is an array which has data which is trimmed, strip_tags and htmlspecialchars...
I've written an AI (well... it's not really that intelligent) that plays the board game Ticket to Ride. In that game, cities are essentially nodes of a graph, linked together by train tracks (the edges of the graph). The goal is form routes between cities, but it doesn't matter how circuitous or direct a route is as lo...
I’m still relatively new to the TDD scene. I’m writing a Rails app, and some duplication immediately sticks out at me in my first model spec. How else can I approach this? require 'spec_helper' describe TimeEntry do describe "without a project" do let(:entry) { FactoryGirl.build :time_entry } it "should not...
Follow up of - Dynamically-sized stack - follow-up 2 I've took the tips given to me, and what I did now is: Use same case type for type stack and it's functions Returning 1 if push failed due to an OOM exception otherwise return 0 if succeeded. push could now only return a pointer to null due to OOM exception and not ...
The problem I am solving: I select multiple 2D SVG elements in an editor(the elements are in arbitrary positions on my canvas). I run the function calcMultiTrack() (see below). The elements should now have equal spacing between them equivalent to the trackingAmount parameter I passed when executing calcMultiTrack(). S...
This tool adds a new OS user, create directories and configuration files for Apache + NGINX, MySQL (MariaDB) database and user. I tried to take into account the comments from my previous post. Hope - this look little better. Tool is big enough, so - will not post all it's code here, just few main parts - I'm sure, ther...
I've written this Java code to implement merge sort: import java.util.*; public class MergeSort { int[] a; MergeSort() { Scanner scan = new Scanner(System.in); System.out.println("Enter the number of items: "); a = new int[scan.nextInt()]; for (int i = 0; i < a.length; ++i) {...
I've got two collections: collection of rules, and collection of keys that can handle specific rules. Key have method boolean canHandle(Rule) to check whether specific key can handle specific rule or not. I need to gather these two collections into single map Map<Key, List<Rule>> bycanHandle` predicate method. I've don...
I've written this whole code to extract cell numbers from a website. It is extracting numbers perfectly but very slowly, and it's also hanging my Form while Extracting. Imports HtmlAgilityPack Imports System.Text.RegularExpressions Public Class Extractor Shared doc As New HtmlAgilityPack.HtmlDocument() Public Shared ...
This class functions, in that the program can be left open for hours and it will still reconnect to the database when the user prompts for a CRUD operation. I've read about DAO, and some other approaches, and, at a minimum, recognize that reconnecting each transaction is overkill. Some sources say to use a DAO, other...
Is there any way to simplify it further? import java.util.*; class Triangle { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); if(a==b && b==c) System.out.println("...
I would like some feed back on a method which calculates the sum of Manhattan distances for each tile in a sliding puzzle to its goal position in the goal puzzle. Here is the code: public static int calcManhattanDistance(int[] ps, int[] goal) { int rowSz = calculatePuzzleRowSize(ps); int manhattanDistanceSum = ...
I have an admin class that controls when a user logs in and creates a new blog post. I am wondering if there is anything I can do to improve this class. Is there any way to reduce the code? Is there any repetitive code or better way of writing the functions? public class AdminController : Controller { private rea...
Consider the following class (I've stripped XML doc for the sake of simplicity), which does several and slightly different operations through a serial port to read/write from/to a Mifare card. It has a specific protocol, few commands that can be called sending the specified chars to the COM Port, and have been put alto...
I'm not sure whether my distaste for reflection is justified or not, but it feels ucky that I'm using reflection here. I'm trying to make a very simple class which has a number of List<T> where T : Model with a load and save method. The load method should: For every list, Open or create "Data/(<T>)/" Sequentially load...
I am learning Python and would like to know if there's a better way to rewrite it. What I am trying to do is to match list A that is passed to a method against a predefined list B. If an item in list A contains an item in list B, I'd like to move it to the end of list A. # example 1 a = [1, 2, 3, 4, 5] sanitized_list =...
I'm going through the 99 Haskell problems and I have a few question about the solution I implemented for Problem 23. It asks: Extract a given number of randomly selected elements from a list. This is the code I came up with: -- Extract a given number of randomly selected elements from a list. import System.Random ra...
Inspired by this question, I played a bit with the idea of modeling a Triangle, and a utility method to classify it: class Triangle { private final int a; private final int b; private final int c; enum Type { EQUILATERAL, INVALID, ISOSCELES, SCALENE } public Triangle(int a, int b, int...
I have a new job coming up soon and want to increase my PHP knowledge. This is my first attempt at creating and using a class. I just want to know if it's the correct way to do things. It's very basic: a simple encrypt / decrypt of a string with a salt. /** * Encryption Class * * Use for encrypting / decrypting a strin...
I implemented the split function in Haskell: split :: (Eq a) => a -> [a] -> [[a]] split _ [] = [] split x ys = f : split x rest where (f, rest) = break (== x) (dropWhile (== x) ys) Note that I'm calling dropWhile (== x) since break's second-tuple value will include the "broken on" value. example: *Main> break (== ...
I've finished the greed problem in Ruby Koans after much confusion. This is my first programming language and I have been doing fine, but then this problem really tripped me up for some reason, perhaps because it is one of the first problems where I need to be creating my own method. I eventually came up with this - ca...
At the documentation for QGraphicsScene, there is a simple example that does not work as written. I've written a fix that does work, and am curious if it could be improved. From the docs (does not work as is): scene = QGraphicsScene() scene.addText("Hello, world!") view = QGraphicsView(&scene) view.show() Fixed vers...
This is sourced from the Stanford Coursera self study DB class SQL quizzes. Students at your hometown high school have decided to organize their social network using databases. So far, they have collected information about sixteen students in four grades, 9-12. Here's the schema: Highschooler (ID, name, grade) ...
Inspired by this post, I wanted to be able, in any vba project I could be working on, to create a test class and write test methods. Like this: ThisWorkbook Workbook | class module (client code) Option Explicit Public Sub TestAreEqual() Assert.AreEqual 12, 34, "Values should be equal." End Sub Public Sub TestAr...
Out of fun, I solved "Nice Angles" challenge on CodeEval in C# 4.0: CHALLENGE DESCRIPTION: Write a program that outputs the value of angle, reducing its fractional part to minutes and seconds. INPUT SAMPLE: The first argument is a path to a file that contains the values of angles with their decimal fractions: 330...
I'm working on a jQuery plugin. The problem is that when I use it I can see a high CPU usage in task manager. I think the problem is here: $elementTSMask.on("mousemove", function(event){ if(isMouseDown && isLeftButton){ var toScroll; if(endPosition != 0){ toScroll = scrolled + (event.pageY ...
I have a script that makes use of datetime in order to name files. Only business days (Mon - Fri) are used. Here is my part of the code that finds the last business day: lastBusDay = datetime.datetime.today() shift = datetime.timedelta(max(1,(lastBusDay.weekday() + 6) % 7 - 3)) lastBusDay = lastBusDay - shift yesterday...
I wrote this program for a code test on some website. This program do some predefined transformations (transformation can be horizontally, vertically or by shifting to given number of keys) for every char in a file. For every char same set of transformations should be done. After doing all the transformations the new c...
I have been using entity framework 5 as DataAccess layer for my application. I have a case where there are a set of Levels offered. And I have a set of Colleges offering the Levels. Level : public partial class Level { public Level() { } public int LevelID { get; set; } pub...
Follow-up: Array-like container for uints shorter than 8 bits (Rev 1) First of all: yes, I need this kind of array to generate data for a piece of hardware, and it must be stored and manipulated somewhere. The general consensus regarding bit manipulation seems to be "if you need to do that, there's something wrong". T...
I've got an interview coming up for which the following is a prospective question: Given 2 strings, for instance: John Lennon Paul ON delete every character from string 1 which corresponds with any character in string 2 (case exclusive). So following the anticipated manipulations, the output in our case would b...
I implemented a test that reads data from temp file on Windows. I originally had an issue that I solved with the help of this answer def test_read(self): """Test read from file""" import tempfile import os try: with tempfile.NamedTemporaryFile(delete=False) as temp: content = 'Some ...
I translated the solution by the author to his challenge from C++ to Python. It seems to be correct, but I get timeouts for the test cases 6, 9 and 12. Here is the full challenge description: Watson gives to Sherlock an array: \$A_1, A_2, ..., A_N\$. He also gives to Sherlock two other arrays: \$B_1, B_2, ..., B_M\$...
I want to: use Watir::Browser methods without browser. instance prefix expand abilities of Watir::Browser using own methods and overload existing since I don't need more than one browser launched at the same time, using Module seems to have more sense than class Here is my try: require "watir" module Session_FF ...
I started a project with Objective-C and rewrote it with Swift. The project contains two UITableViewControllers: MasterViewController and DetailViewController. MasterViewController is linked to DetailViewController with a segue. MasterViewController has two UITableViewCells. The cell with indexPath [0, 0] has a detailT...
This is a completely functional python script of the Tic-Tac-Toe game. I've used python's set container for almost all data structure and operation. The code is small and somewhat readable. I would very much appreciate your opinion and suggestions to improve it in terms of speed, readability and refactoring wherever ne...
VBA's Collection class is lacking so I created a basic List class using Python's as a template. This could make future derived classes easier to implement. The biggest features are better setting and accessing of values. But one neat-o feature is Python-style indexing. Dim myList As List myList.Extend(Array(1,2,3,4,5,...
I've been working on my own programming language, as a hobby for the past couple of months now, called Reedoo. It is implemented in pure C++ 11 and uses only the libraries that come with C++; no external ones. I've never studied Computer Science, but I've done about 2 weeks of software development so far in school, bu...
Purpose: write Java program that downloads a list of URLs specified on commandline in parallel (simultaneously), reporting download completion every second. My solution follows below, please point out areas for improvement / things you would redesign. package org.test.mk.pjwget; import java.io.*; import java.net.URL...
I recently started programming in PHP using the MVC-pattern, which resulted in one of best choices I made so far, but I read through many articles showing "easy" examples and some of them were quite advanced (based on my opinion). I started learning the pattern by looking up some code and I ended up here: "php-mvc"-rep...
I am going through the 4clojure problems and I currently just solved the Tic Tac Toe analyzer: (fn [board] (let [vr (for [x (range 3)] (get-in board[(+ x 0) (+ x 0)])) vl (for [x (range 3)] (get-in board [(+ x) (- 2 x)])) columns (apply map vector board) ch...
Demo of the widget: http://jsfiddle.net/slicedtoad/Lywvbsf4/ It's a progress bar that shows a list of steps and which one is being completed as well as allowing previous steps to be revisited. It will be used to display the user's form completion progress on a web app that favors a client side approach (forms are submi...
I'm fairly new to JavaScript and Gulp. I was following this article for creating my gulpfile, trying to follow best practices, but it seems to me that this peace of code can be optimized and written better. Can you please give me some advice on how can I improve this code? Git repo can be found here: git@g.vova.io:Skok...
I am trying to develop a genetic algorithm to solve knapsack problem(0-1). I am new to algorithm and programming as well. Here is my code and it works but I would like to know your suggestions of how to improve it. Knapsack.h #ifndef KNAPSACK_H #define KNAPSACK_H #include <vector> #include <random> class knapsack { p...
A project I'm working on requires something akin to run length encoding on a vector in matlab. The data is in the form of a numeric vector, and the output is in the form of two vectors, elems and lens that hold the elements and their respective run lengths. For example data = [20 13 12 12 12 18 17 16 16 11] would give ...
I was attempting to do some contribution to the underscore-contrib library, and I ended up writing a function that will parse a JavaScript path to later on expose through an API if the path exists or to get the value. However, a reasonable concern around it is the complexity. (Discussion in the repository, if you're in...
I'm quite a newbie with Python, but I wanted to try my own little project, so I made a small script that puts all the desktop icons/folders into a newly created folder (called "Desktop1") if there are more than 25 items on the desktop. import os import shutil #My user on windows is Shadow so you're not like 'huh??' o...
Building on @RubberDuck's recommendations, I now have something I find... beautiful. I'm sure there's a couple of things left to polish - this site is about making great code out of good any code, right? This code requires trusted programmatic access to Visual Basic Project. 1. Client Code I want my test classes to ...
As per the definition given in lecture, ADT is, With reference to this definition, I would like to call SList class an ADT following 6 invariants: Multiple users of SList class should be consistent in usage with same SList instance. For example multiple users may insert items in same shopping list. No runtime excep...
This is my first project, a Flashlight application for Android-based devices: public class main extends Activity { private static final byte MENU_EXIT = 0, MENU_ABOUT = 1; private static boolean FlashlightState; private static long BackPressed; private static ImageView Lamp; private Flashlight FLASH...
I am having the following problem. My code works, but it seems like it can improve a lot. I am fairly new to python and can't seem to get this block any better. The logic behind it goes like this. I have a dictionary that acts like a tree, it looks like this: SampleTree[10000000] = ['ACC','ARRAY'] SampleTree[10010000] ...
Had my first go at implementing infinite scrolling for UITableView's in my iOS app last night, and I noticed I ended up copying/pasting quite a bit of boilerplate from one VC to the next (if I wanted infinite scroll on it). By the way, I'm fairly new to iOS, so this question is probably more broad than just specificall...
I'm using innodb full-text search to return a set of results where the newest posts are more relevant. Just wanted to check that this the best method: SELECT *, (MATCH(note) AGAINST ('$search' IN BOOLEAN MODE))/SQRT(GREATEST(1, DATEDIFF(NOW(), date))) AS score FROM notes WHERE userid = '$userid' HAVING score > 0 ORDER...
I'm still not satisfied by the readability of the code. The wanted behavior which would be self descriptive would sound like: "I've two fields; one is for the date and one for the hour. This two fields should be in a UserControl of which I have two instances, one is for the event time and one is for the event end time....
so i'm using a foreach loop to loop through a form i've send with javascript. In this loop I use the keys(input fields names) and values(input values) and use them to build my query, I still check for nulled values and other field types and then i add them to a variable . I'm wonderin if this is really the best idea if...
I would appreciate a thorough review of my updated User entity class. It's still an anemic domain model, but behavior (like upgradeToPremium(), etc) will be added as I'm developing my application further. This is the first time that I'm commenting my code properly according to the phpDocumenter docs. So some feedback o...
Before everybody yells at me about why I wrote a PDO wrapper class, it's to avoid writing try/catch, prepare(), execute(), etc. each time a query should be executed. I have pretty big website, so instead of repeating: $sth = $dbh->prepare('Some query'); $dbh->BindParam('x', $x); $dbh->BindParam('y', $y); //..etc $sth...
This is what I've been doing so far in my business layer to return error messages to the user. public void CreateMerchant(MerchantCreationModel model, out MerchantCreationStatus status) { //check if merchantId exists MerchantDTO merchant = _merchantRepo.GetMerchant(model.MerchantId); if (merchant != nul...
I'm currently playing with the Typeahead problem on Talentbuddy. There are already 2 questions on this subject (Typeahead Talent Buddy and Typeahead autocomplete functionality challenge), but none of these use a trie which is why I created a new one. Problem Statement Given a big list of user names and a list of strin...
I have to write a unit test for the method processRequest in the servlet below and I'm wondering if: It just shouldn't be done. The class should be rewritten / refactored to allow easier unit testing. Suggestions as to how? There is a meaningful way of getting the value of response.getWriter().print(result), which is ...
I am trying to find out how many minutes that are remaining until the next train will departure, based on the current system time in Java. I am so far not familiar with the many aspects of Java, but I have managed to get the program to work in most use cases with a switch statement and while loop, but it feels like I a...
I want to write a search that raises an error if the list supplied is not sorted. class BinarySearch attr_accessor :list def initialize(orig) raise ArgumentError unless sorted? orig self.list = orig end def search_for(n) s_list = self.list offset = 0 loop do mid = s_list.leng...
This is a follow-up to Array-like container for uints shorter than 8 bits In short: The PackedBitfieldArray should be a kind of container for packed (unsigned) ints shorter than 8 bits. It provides proxy objects for manipulation and iterators. What I have changed: PackedBitfieldArray::end() now returns a correct past-...
For heap (array based) sort, we need to start at index 1, ignoring the 0th index. If I want to make a static function like public static void heapSort(int[] array){ } The user shouldn't care about leaving the 0th index empty. And I don't want to allocate a new array (only to start from the 1st index). What would be ...
I have written this function that surprisingly works. (I didn't really know what I was doing; just a little experiment.) It is supposed to count rows selected by a PDO query. Is it well written? It works, but I am just asking, as it is my first more-complex function. function countRows($sql, $parameters){ r...
This PHP script to validates a booking form. (There is also a JavaScript validation as well, but please ignore.). I want to know if there is a better/more efficient way of writing it? I have created a function to check each value of the form. For example, it checks if the fullname text box is empty or not. I have then ...
This code that shells out to an external script could use some input in order to read smoother, I think. Praise and critique are welcome. module CompanyLib class S3 attr_reader :output def set_path local, remote @path = [local, remote] end def get_bucket /(^[^\/]*)/.match(@path[1])[0] ...
My first question: Searching a Word Document from Excel Since then I have implemented most of the suggestions by @RubberDuck and @Comintern. I have also added functionality for different-sized spreadsheets (horizontal and vertical), read multiple files in during a single run of the macro, and a bunch of constants. This...
I wrote the following code to answer this, but I am wondering if there is any better approach. For example If the following array is given: {10,21,34,45,56} we should find the differentiate of each number with other values of the array and in case it is equals to 11 should increment the counter. 10-21=-11 10-34=-24...
I have a csv with 3 columns (date, name, number) and it is about 20K rows long. I want to create a dictionary keyed by date whose value is a dictionary of name:number for that date. On top of that, I want add some elements together if the name contains a key word so they would be listed as keyword:sum of numbers, rathe...
I wrote the following code in response to this question "find sum of number of times that each character of source occurs in the target", is there any better solution for it? Analysis Target is alex alexander Source is ardx Characters of source that exist in target are like a--x-a--xa-d-r Total is 7. Code Str...
I recently worked on a system for the company I work for and would love some feedback on the following class for managing sessions. I don't claim to be a PHP guru but I like to think I gave it a try! <?php /* * CLASS: Session * * @author Nathan Fitzgerald */ class Session { var $user; private $auth_key = SECU...
I've been working on this project and here is my first function for step 2. I feel this is the most important one, as I will carry over recommendations from this review into multiple other functions that affect more tables & data. Design the DB schema and table relationships, and insert data for standards tables Creat...