instruction
stringlengths
71
71.9k
I have a couple of images in my database and I need to check if the images are still good or if they're deleted or corrupted. I came up with a solution but it's very slow. I was wondering if there was a way to make this faster. img = 'http://some_image_cdn.com/images/image.jpg' begin Nokogiri::HTML(open(img)) rescue ...
An easy, terribly written but working, Caeasar (Monoalphabetic) cipher implementation, with a GUI (Graphical User Interface). Cipher.java class Cipher { static final String alphabet = "abcdefghijklmnopqrstuvwxyz"; public static char shift(char ch, int amount) { return alphabet.charAt((alphabet.indexOf...
I've been working on this user script to hunt for a specific string in an HTML webpage with the goal of finding the time at which it appeared. This feels needlessly complicated and I would like advice on how too condense and upgrade the code to more simply find the time. // ==UserScript== // @name Magma Time...
I'm creating a program that averages four numbers - three from a file and one from user input. Simple enough. But the catch is, the professor is going to be deliberately trying to break the program. I'd like advice in any regard, but remember the focus is on robustness. import java.util.*; import java.io.*; public c...
I am working through UPenn CIS 194: Introduction to Haskell (Spring 2013). Since I am not able to take the course for real I am asking for CR (feedback) as it could be from teacher in that course. HW1 - Validating Credit Card Numbers - Full description A shortened problem statement: Validate a credit card number by th...
I'm a beginner in the coding world, and I've been learning Java recently. I tried to make a small text game with the limited knowledge that I currently have of Java. I would like you to tell me ways to improve my code, so that I can learn it better. I currently feel my code is a bit messed up, but at least it's a start...
I'm writing a Telephone class and it has a method called getDigits which takes in a String parameter and returns the number that would appear on your phone if you typed in those letters the old fashioned way. Example: Typing in "CAT" would return 228. I wrote the following code and it works but I wanted to know if anyo...
I'm new to Doctrine and had a hard time deciding how to get random rows within it without creating custom DQL functions or using a native query. The solution I have come up with is below. This is within a custom repository for an Entity. I'm hoping for some constructive criticism in regards to it, however it currently ...
Problem Statement Suppose you have a string \$S\$ which has length \$N\$ and is indexed from \$0\$ to \$N−1\$. String \$R\$ is the reverse of the string \$S\$. The string \$S\$ is funny if the condition \$|S_i−S_{i−1}|=|R_i−R_{i−1}|\$ is true for every \$i\$ from \$1\$ to \$N−1\$. (Note: Given a string \$str\$, \$str_...
I am working through UPenn CIS 194: Introduction to Haskell (Spring 2013). Since I am not able to take the course for real I am asking for CR (feedback) as it could be from teacher in that course. HW2 - Log file parsing - Full description {-# OPTIONS_GHC -Wall #-} module LogAnalysis where import Log parseMessage :: S...
This is an accounting program (and my first attempt at a web app of any kind) where users need to get and retrieve objects from different JSON URLs and at different levels. Rails is used for the back. I'd like to know if the following process is the best to use: User clicks button to toggle some boolean value Local JS...
I have a very long switch statement with more than 18 cases. I want to make it more comfortable and easier for the maintenance, but I have no idea how ... switch($key) { case 'male': return $filter = array($gender , '=', 'male'); break; case 'female': return $fil...
I wrote a simple script to translate (a subset of) StackExchange markdown to HTML. I used Regex for this task, but luckily I only had to use simple patterns. Modularization I also wrote a Regexp-generating function as I noticed that in Markdown you are always looking for things inside such and such symbols, I feel like...
I'd like to get some feedback on an example web API I've put together. It's mavenized and available on GitHub here. Setup The only thing you'd have to change to run this locally is line 31 in src/main/java/com.example.config.PersistConfig.java: String databaseLocation = "jdbc:derby:C:\\Users\\Kevin\\Desktop\\SpringExam...
I am interested in hearing views on this new Module I am adding to an existing system to handle sale items from a 3rd party Software system. This system sends (XML) messages to our system, we need to look up our database and sell the item if present. Before I continue going down the route I am, I would like opinions on...
This project is from the subreddit for beginner Python projects: The goal of the project is to create a program that allows the user to choose a time and date, and then prints out a message at given intervals (such as, every 3 seconds) that tells the user how much longer there is until the selected time. If the chosen...
The following code grabs the HTML-encoded, multi-line content of a text field. It then splits the content on line breaks, and finally displays it with commas as separators. I would like to have this code reviewed to see if there is a simpler way to grab the string, split and display it. Note - I hated the idea of wri...
I have setup agenda tasks to periodically retrieve and possibly insert new SE sites and tags in my MongoDB database. Some things that bother me in particular: Lots of code duplication No string formatting to inject variables in it Many callbacks -- is this the preferred way to work? Updating/inserting entries in the d...
I am working with MongoDB through Docker, and I have a terrible bash command to pull the Docker Machine IP so I can sanely connect locally. export dockerip="$(docker-machine ls | awk '{print $5}' | sed -n '2p' | sed 's/tcp:\/\///' | sed 's/\:2376//')" mongo --host "$dockerip" --port 27017 How can I optimise the docker...
I wrote a method that takes an array T[] array (T is a type parameter) and a second array int[] indices. The method should remove those entries from array, whose indices are stored in indices. Then, the resulting array will be "returned" as an out-parameter T[] rest. Finally, there is a second out parameter T[] removed...
Given You’re given the pointer to the head node of a linked list, an integer to add to the list and the position at which the integer must be inserted. Create a new node with the given integer, insert this node at the desired position and return the head node. A position of 0 indicates head, a position of 1 indicates ...
This Haskell program just aligns the text lines on the given substrings. I took inspiration from here, but my code is not golfed. import Data.Function import Data.Ord import Data.List import Data.List.Split alignOn :: String -> [String] -> [String] alignOn char lines = map padline lines where partBeforechar = h...
I am posting this as a follow up to the Tic Tac Toe class in Python question. I have made extensive changes and rearchitected the code. I now have a board class, a game class, players and an application that ties them all together. While at this point I have got only a 3x3 board, I have designed my code to be scalable ...
I have implemented a function to produce a 32-bit checksum of a file using the following method: checksum = word_1 + word_2 + ... + word_n, where word_i is the 32-bit words the file consists of. Here are several questions I'm very interested about: Is the way I read file word by word correct or there is a better way? ...
I'm coding for a function that checks the longest word (or words) in a string: If multiple words are of the same size, those words have to be displayed. If a single word is inputted, that word has to be displayed. Words should consist only of alphabets. The following code has been tested and displays the correct inpu...
This code is working and was tested for over 10000 images. I have many headerless images, i.e images which are binary files with known dimensions. Some of the images have a visible area which is different from the size of the binary files which have padding. For example, the image is 100x100, however the file size is 1...
I'm trying to parse an object generated from an Excel file. The output lists each cell with its contents. If the cell is just a number then it remains a number but if the cell contains a formula (has attribute f) I want to make that a getter so whenever that cell is called the result is updated in case the other cells ...
Is there a simpler way to implement this function? function has_duplicates(arr) { var myObject = {}; for (var key in arr) { if (myObject[arr[key]]) return true; else myObject[arr[key]] = true; } return false; } console.log(has_duplicates(["foo", "bar", "baz", "quux", "foo"]));
I'm currently learning C with The C Programming Language by K&R and this is my current exercise: Rewrite appropriate programs from earlier chapters and exercises with pointers instead of array indexing. Good possibilities include getline, atoi, itoa, reverse, strindex and getop. This is my atoi solution with pointers...
As an exercise I want to have a single window application (in Swift on Mac OS X) with 4 views, each controlled by an independent view controller and have their own XIB file. I have working code, but I feel I've done it the wrong way, so the question is have I used a bad design pattern? My main concern is the empty view...
I am working on an Android application for reading NFC cards. I came to a point when I needed to design an abstract class to streamline the process of creating views for visualizing and editing various forms of data by subclassing the abstract class with views like BinaryView, HexView, StringView, et cetera. I became a...
I want to generate some random data and store it in a container. I split the container into disjoint intervals using iterators and pass them to a thread function (I hope its body isn't important here). There are several design-related questions here: Is it a good practice to solve such task in this manner? If it is, d...
I'm working on a TopCoder problem which seeks to find the letters preventing an input sentence from being a pangram in all caps, alphabetical order. MissingLetters.h #ifndef _MISSING_LETTERS_H_ #define _MISSING_LETTERS_H_ #include <string> #include <set> #include <utility> class MissingLetters { public: Missing...
I'm writing a game in C# Monogame, and I've decided to make my project as modular as possible. GitHub At first, I've had a single project with a folder that's separated inside to other folders which represent different systems in the game (Items, Abilities, Stats). I've started by making a .dll project for everythi...
I'm trying to teach myself C++ from Stroustrup's Principles and Practice Using C++ (second edition) and I've gotten to the drill in chapter 4. The problem tells me to make a program that takes in a number with a unit of either feet, inches, meters, and centimeters, as well as log the largest and smallest numbers the us...
This is my first experimentation with the producer-consumer problem (and thread manipulation in general), so any feedback on taboos and fixes is greatly appreciated! #include <condition_variable> std::condition_variable cv; #include <iostream> #include <random> #include <mutex> std::mutex mtx; #include <thread> // ...
I have written a simple state machine. Comments and feedback are welcome. #include <stdio.h> #include <stdlib.h> typedef enum Event { eEVENT_X, eEVENT_Y, eEVENT_Z, }Event; typedef enum States { eSTATE_X, eSTATE_Y, eSTATE_Z }States; int e = eEVENT_X; int s = eSTATE_X; struct state_transition...
I have a number of messages with a payload as a list of items. My goal is to transform the message payload without losing the relation between the message and payloads. Isn't it possible to rewrite the code to a single pipeline without creating an instance of a nested pipeline for each message? using System.Threading.T...
Given The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? Solution def max_factor(num): """Find the maximum prime factor.""" factor = 2 while factor * factor <= num: while num % factor == 0: num /= factor factor += 1 ...
I've just created a method that toggles menu visibility. At the moment I've gone with an if..else which checks my flag and acts appropriately. Can anyone offer any suggestions on how to make this snippet better? Maybe it shouldn't all live in the same snippet? Maybe I should be combining the show/hide logic that's dupl...
I've written this small generic library for the purpose of my Bachelor's thesis. It's fully functional and unit tested and I want to get as many opinions as possible regarding overall code quality (readability, naming, structure, coupling, cohesion, etc.). GitHub (this project is licensed under the terms of the MIT lic...
I have script for get three values (minimal numbers) from array : $(document).ready(function(){ var _array = [1,2,3,4]; var save = 0; var _new_array = []; var nearDistance = []; $.each(new Array(3),function(n){ if (_new_array.length < 1){ save = Math.min.apply(Math,_array); ...
I'm looking at writing a simple proxy. At the moment I've got a logger, command line argument parse and simple daemon (it does nothing beyond logging). Next I'll be looking at starting the network-related work, but before that I wanted to get a review to see if there's anything wrong with my basic approach at the momen...
The following module AssertLibraryFunction improves upon CheckLibrariesExists in two respects: It honors the optional argument REQUIRED of find_package: if the check fails, it raises a FATAL_ERROR. It also honors QUIET. Its result is cached in a variable named ${LIBNAME}_${FUNCTION}. Therefore, argument 4 of CheckLibr...
I am familiar with the simple use of QSqlQuery::prepare() and QSqlQuery::bindValue() as in: QSqlQuery query; query.prepare("SELECT name, address FROM members WHERE id = :id"); query.bindValue(":id", member_id); query.exec(); In this scenario I show a list of people (members) to the user, all with a check-box in front....
I have many different methods like ones below, but is there way I could improve them and remove duplicate code ? public static ADUser Load(string userName) { using (PrincipalContext pc = MyUtilities.GetPrincipalContext()) using (UserPrincipalExtension user = UserPrincipalExtension.FindByIdentity...
I'm trying to create a list of subpaths from a flattened array. Here's the starting point: var flat = [ {path: "/" }, {path: "A" }, {path: "A.A"}, {path: "A.B"}, {path: "A.C"}, {path: "B" }, {path: "C" } ] The goal is that anything under a parent would be a subpath of that. So the goal would look li...
I created a form with title, body and tag input and there are 3 tables: posts, tags and post_tag. Now I use this function to add new tags and attach them to the post postcontroller.php public function store(Request $request) { $input = $request->all(); //get inputs value $tag = $input['tag']; ...
I am using KnockoutJS to bind some values. I have a date value TimeByDay that I bind like this: <span data-bind="text: new Date(TimeByDay)"></span> But I would also like to transform the date on a different location and simply add a day to the TimeByDay value. I can do it like this: <span data-bind="text: new Date(new...
I wrote this tiny library yesterday. The goal was to implement enums in JavaScript with type-safety. I modeled the implementation similar to enums in Java, since that is what I am most familiar with. It seems to work like you would expect, but I wanted to make sure that what I did makes sense and that there isn't some ...
I've been writing a program to improve my Javascript skills. It's a very simple app for typing practicing. var excercise = "The Battle of Westerplatte was the first battle in the Invasion of Poland and marked the start of the Second World War in Europe. Beginning on September 1, 1939, German naval forces and soldiers...
Problem: Given an sorted array of N distinct integers, find floor value of input 'key'. Say, A = {1, 2, 3, 5, 6, 8, 9, 10} and key = 7, we should return 6 as outcome. How can I optimize my solution? private static int CalclualteFloorValue(int[] _sortedarray, int l, int r, int key) { if (_sort...
I was working on the binary Bayesian network classifier I asked about earlier. See also Part II/II. See also the next iteration of Part I. TERMINOLOGY We are given a directed acyclic graph (dag) \$G = (V, A)\$, where \$V\$ is the set of nodes and \$A \subseteq V \times V\$ is the set of directed arcs, and a weight fun...
This is the continuation of Binary Bayes network classifier in Java - Part I/II TERMINOLOGY We are given a directed acyclic graph (dag) \$G = (V, A)\$, where \$V\$ is the set of nodes and \$A \subseteq V \times V\$ is the set of directed arcs, and a weight function \$p \colon V \to [0, 1]\$. For any node \$u \in V\$, \...
I've created a Grid with a RecyclerView similar to the GoogleIO 2014's generic media player one. GoogleIO generic music player Mine The thing is that the images doesn't load immediately, but with a delay, so I had to put that "dirty" code for add a crossfade every time an image is loaded. Beside that, I just want the...
I wrote this pretty straight forward begin and end overloads for istream_iterator. Is this standards compliant? Any problems with usage? #include <iostream> #include <iterator> #include <fstream> namespace std { template <typename T> std::istream_iterator<T> begin(std::istream_iterator<T> iter) { ...
In my project I need to have one class as singleton which must be globally accessible: board.h: #pragma once #include "io/io.h" #include "lib/drv/gpio.hpp" class Board { public: static const unsigned int CORE_FREQ = 48000000; static const unsigned int SYSTICK_FREQ = 1000; volatile uint64_t tickCounter; ...
Since I've looked far and wide for a good example of this to no avail, I have created my own using the JSONArray and JSONObject classes. It took me a while to realize that the push method for JSONObject overwrites everything previously pushed. public static JSONArray getJSON(String url) throws IOException, JSONExceptio...
This script allows you to practice your typing skills, as soon as you finish typing a new word appears for a non-stop typing experience. The code has in memory the top 100 words as per the Pareto Principle and Zipf's Law, of these, the top 10 are more common than the rest. To start, type start. Tested in Linux, Python ...
The below code is a solution I put together for the Project Euler #11 question which asked to find the largest product of 4 numbers of any direction in a matrix (horiz, vertic, and diag all acceptable.) Coding methodology: To me this is the most important. Is the algorithm I used feasible or mostly correct, if not how...
Is there any DRYer way to write this method ? or is it better to keep it this way for better reader understanding ... Each role has a list of authorised activities for a specific resource ( in this case Sheet) , a user may have multiple roles ( depending upon his company, his working group in the company, his function ...
The purpose of this code is to find the largest palindrome in a string. It works fine when the string is short, but every time I test this code with 1000+ characters in a string, it takes forever to give me the palindrome in it. PalindromeFinder::PalindromeFinder(){} string PalindromeFinder::toString(){ stringstream...
I have an RPG-like program that uses a Character class to specify and return information about an individual player/character. I was curious about a way to best set and return an inventory of strings in terms of memory and performance for this purpose. I gave some thought to creating a struct or using something similar...
I recently started learning Java, algorithms, and data structures. I am trying to check if a string is palindrome. I would like a review to see where and how I could improve. import java.util.Stack; class Palindromer { Stack<Character> stack = new Stack<Character>(); int top = -1; public boolean isPalindrome(String ...
I have written this code for DFS in a binary tree and would like improvements on it. // Method 1: Recursive DFS public static boolean DFS(Node root, int k){ if(root == null){ return false; } else if (root.data == k){ return true; } else { return DFS(root.left, k) || DFS(root...
TERMINOLOGY We are given a directed acyclic graph (dag) \$G = (V, A)\$, where \$V\$ is the set of nodes and \$A \subseteq V \times V\$ is the set of directed arcs, and a weight function \$p \colon V \to [0, 1]\$. For any node \$u \in V\$, \$parents(u) =\{v \in V \colon (v, u) \in A\}\$, which is a set of parent (or inc...
Summing doubles can cause a loss of precision. Summing integers, however, doesn't. (Assuming no overflow.) Here's a high precision sum function I wrote: #include <iostream> #include <vector> #include <cmath> #define BASE 10 bool is_int(double n) { double intpart; return std::modf(n, &intpart) == 0.0; } double sum...
I am just starting to learn C++, and I wrote was the following implementation of the trial division algorithm to find the prime factors of a positive integer. I'm hoping the community here can suggest changes to both the algorithm and to the implementation. I barely know any language-specific features of C++, so I'm su...
I have finally finished a Ruby calculator project, which is not based on eval. Instead it parses input char by char. The project is hosted on GitHub. However, I find a specific part of the program very annoying since whenever I have to add something I have to rewrite a portion of it again. def trig case @look when ...
I am working through UPenn CIS 194: Introduction to Haskell (Spring 2013). Since I am not able to take the course for real I am asking for CR (feedback) as it could be from teacher in that course. HW3 - Code golf - Full description module Golf where import Data.List -- ["apple","orange","plum"] example -- ... [("appl...
I decided to write a simple dictionary to use as a cache: public class CacheDictionary : Dictionary<string, object>, ICacheDictionary { private readonly Dictionary<string, CancellationTokenSource> _expireTasks = new Dictionary<string, CancellationTokenSource>(); private int _defaultExpiration; public Cache...
What could I improve on this code? from random import randint guesses = 0 randomNum = (randint(0,100)) numPlayer = 0 while (numPlayer!=randomNum): numPlayer = int(input("Guess the number(0-100)")) if (numPlayer>randomNum) : print "It's -" elif (numPlayer<randomNum) : print("It's +") guesses=g...
I have written an implementation of memcpy function and I want to know how good is it and if it gets the most out of the processor capabilities or not. The reason for this is because I am writing my operating system (which will be of course reviewed on parts here on Code Review) it is supposed to work efficiently on b...
Python has itertools.chain(), but C++ has nothing. This is my attempt to implement such a thing. Looking mainly for comments about potentially smarter ways of doing things or potential pitfalls this code falls into based on its current implementation. Currently, the objects that chain() will give back will be a referen...
I have the following code which returned the solution I was wanting after running for 1 hour. Are there any techniques I could use to improve run-time? If I were using imperative programming I would just more aggressively cache the partial results, but that's less appropriate for this approach. How should I transform t...
This is a class to encode and decode SGTIN96 product identifiers, typically used to write EPC on RFID tags. Refer to EPC(TM) Generation 1 Tag Data Standards Version 1.1 Rev.1.27. import java.math.BigInteger; import java.util.HashMap; import java.util.Map; // Refer to EPCTM Generation 1 Tag Data Standards Version 1.1 R...
I've created a recursive depth-first search implementation in Java as an example for an article I am writing on my website. It needs to be concise in order to fit on the page easily (independent of screen sizes), hence the lack of extra spacing. public static boolean depthFirstSearch(TreeNode find, TreeNode top){ if...
I have built RESTful web services. The services endpoints have a similar logic: If the input validation succeeds, do a database operation and return the result. If the db operation fails, return the db error. If the validation fails, return a response with information on the failed validation. My code was explicit in...
I'm learning Scala (and functional programming). Is there a better way to solve Euler problem 4 than either of these two solutions. Euler 4 I like this array comprehension solution, but it wastes so much space. def isPal(n: Int): Boolean = { val sN = n + "" sN == sN.reverse } def euler4Iter: Int = { var largestPa...
This code interprets an abstract syntax tree generated by a recursive descent parser for a dynamic scripting language called Hassium. The syntax of this language looks like this # Recursion functions func fibonacci(n) { if (n == 0) { return 0; } else if (n == 1) { return 1; } return fib...
I have made a basic stack class utilizing a linked list for data storage and \$O(1)\$ push and pop and just want some basic feedback on the class to see if there is anything basic I missed. It seems to be working perfectly and I know there are no memory leaks. I'm just being cautious and wondering if there is one or tw...
Root to leaf path sum equal to a given number Given a binary tree and a number, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals the given number. Return false if no such path can be found. I have written 3 solutions: one recursive, one using 2 stacks (DFS), and...
I completed a sample programming challenge and wanted to find out how I could make it more efficient. I'm trying to get better at writing more efficient code, so I would be interested in hearing ideas on how I can make the code more efficient. I ran it, and it works, just curious if there are inefficiencies that some o...
This following code executes correctly.I was wondering if there are better ways to write this code instead of using while(true) and break.For example using expressions,flags, do-while,etc. import java.util.ArrayList; import java.util.Scanner; public class Words { public static void main(String[] args) { Scanner re...
I have created a simple system to get hands on experience with OOPS design and some features in Java: The system is: A ClassOfStudents contains Students A Student contains a list of scores A Student can be a PartTimeStudent or FullTimeStudent A score is valid only if it is between 20 and 100 I have: Used enum for ge...
This finds a peak element in an array. Please consider I want only one peak element. Also, my code should follow only C++11/14 and not C++03. #include <iostream> int peak(int * arr, size_t size) { auto start = 0; auto end = size - 1; //empty array if(arr == nullptr || size <= 0) { return -...
I would love my component to be reviewed. I am looking forward to responses mainly answering the questions: Is my code violating the SOLID principals? If so, where and how? Does my component contain any flaws? Does my code contain any security issues? Does my code follow the OOP principals? Can my code be optimised? I...
I have a JSON array or literal (passes through JSON.parse). Requirement: an array of tasks which contains operations which are key/value pairs. Array of tasks > Array of operations (array of operations at times will contain duplicate key/value pairs) [ [ { resize: [1200, 1200] }, { ...
In the Wikipedia article about the binary search algorithm, a small paragraph in particular got my attention: Midpoint and width A different variation involves abandoning the L and R pointers and using a current position p and a width w. At each iteration, the position p is adjusted and the width is halved. Knuth stat...
I've a working function. But it feels complicated and doesn't look too good, I would like to improve it. function Modes(arrays) { var frequency = {}; // array of frequency. var maxFreq = 0; // holds the max frequency. var modes = []; for (var j in arrays) { frequency[arrays[j]] = (frequency[ar...
I wrote a class that can convert to and fro from Roman Numerals and Decimals. I would appreciate critical points on everything, especially: Shortening my code. Choosing a better approach. Using better/new features of Java 8. And so on... I didn't add JavaDoc because I am expecting suggestions for a better approach. I...
Problem here. It's not exactly the brute force approach but I'm not using any sort of pre-calculated primes table, and I'm definitely not using the coprimality trick shown in the PE pdf. I'm finding the divisor count for each triangle number via its representation as a product of primes. More on it here. I've written a...
I've been working on this elevator program for quite some time now and finally finished it and made it work and I'm pretty proud of myself, but I'd like to see ways how to optimize my code so I can learn for the future. By optimizing I mean, making the code look better, maybe by using less lines of codes. public class ...
Is this a good use of the decorator pattern? If not, why not? Is this a good idea to use for example when we have objects communicating with MVC through PHP or via ASP? To send data through the model to a decorator class that extends so ; and also using this data to extend to other classes. For example, in theory one c...
The object is to notify if a plane was found or not. The aircraft_identifier variable is a must. cpl_id and target_no are optional, only either of them can be applied at time not both, they are used for further identification if aircraft_identifier is not unique. qo = 'squawk' or 'callsign' # only these variants are p...
I'm currently working on reincarnation of the Cactus project, Cactus Reborn, and I've gotten the basic implementation so far. At this point, you can create simple, playable games. There are currently three usable classes/functions: Location - This class describes data about a location in a GameFlowchart class, like a ...
I wrote this simple key-value interface on top of Sqlite3 to use in my Android app. I am using this to persist Java objects as strings converted using Gson. The public API has 3 methods. get(Context context, String key, String defaultValue) set(Context context, String key, String value, Integer persist) clearCacheByL...
Just to reiterate my prev. post, as I think it helps structure my weaknesses. Coding methodology: Is the algorithm I used feasible or mostly correct? If not, how do I correct it and why won't it work or scale? I realize in some cases there are always going to be optimal solutions that will be over my head mathematica...
I'm writing a bash plugin to help people create books in a specific way. It's an ordinary shell script to setup the project and create its subresources. I'm using a loop to create barebones assets and then seek to checks-in the project into a repository as well. The plugin will eventually provide simple commands such a...
For our first assignment in our algorithm class we are suppose to solve several different questions using information from a 2D array. We are also suppose to optimize our code to get more marks on our assignment. We also are only allowed to use 1D and 2D arrays as the only data structure. The problem was find the uniqu...