instruction
stringlengths
71
71.9k
This just opens all drawing files in solidworks and saves as a *.pdf file. I just wanted to to get a second set of eyes on this before I let it go on the actual drawings database (i.e. all our files) and hopefully make sure it won't encounter any errors. using SolidWorks.Interop.sldworks; using SolidWorks.Interop.swcon...
I'm trying to program a volatility updating rule using iteration. I start with the well-known Heston-Nandi model where the returns dynamics are: $$ \left\{ \begin{array}{rcl} R_{t+1} &=& r + \gamma h_{t+1} + \sqrt{h_{t+1}} z_{t+1}\\ h_{t+1} &=& \beta_0 + \beta_1 h_t + \beta_2\left(z_t - \beta_3 \sqrt{h_t}\rig...
I have developed a simple weather application that provides the current weather report based on the city provided by the user. Can anyone help me to improve this code? MainActivity public class MainActivity extends ActionBarActivity implements OnClickListener { TextView lblLocation, lblTemperature, lblPressure...
Is it possible to optimize this solution to the N-queens puzzle? #include <iostream> #include <cstdio> #include <cstdlib> #define N 10 using namespace std; /* print solution */ void printSolution(int board[N][N]) { for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) cout<<board[i][j]<...
Is it better performance or not to call one of two separate functions in response to an if statement over passing an argument to a function? And, what are the performance implications? My first function checks for the existence of a cookie: function checkCookie() { var accept=getCookie("_cmci"); if (accept !==...
There's some repetition in here. I tried making it into a function but then the response wasn't filling up the #project-container div. Is there a way to condense this code to make it more elegant? // Activate projects $('.post-link').click(function(e) { e.preventDefault(); var post_id = $(this).attr('rel'), ...
In my previous question, I got heaps of good advice BUT no solution for the problem apposed. I applied the valuable learnings from the past on this.question and am also hitting it from a different angle. The second part is the reason I didn't mark the question as 2.0 version of the first but feel free to let me know ho...
In the game of Narcotic Solitaire, played with a standard 52-card deck, the player deals a row of four cards onto the table, from left to right. If all four cards are of the same value, they are removed from the game. If two or three cards are of the same value, they are moved on top of the leftmost card of that value....
I have an IRepository class that I use a lot. But I noticed that for many of my repositories I do not implement most of the methods. Also, I usually don't have a TKey that I want to specify if I'm not using the GetById method but the current design forces me to specify it. I was thinking of changing the interface o...
The following code interweaves two linked lists together in three flavors: iterative, recursive top-down, and recursive bottom-up. My iterative solution feels like it can be optimized better and my bottom up recursive design skills are not necessarily the best (although this solution is a much smaller task than most re...
I tried to help someone in Stackoverflow with a refactoring exercise. Did many changes to his original code and made a somewhat decent solution (at least in my eyes). Was thinking, whether someone can critique on my implementation. class Theatre COST = { running: 3, fixed: 180 } attr_accessor :number_of_audience, ...
A few days ago I decided that I wanted to get involved with libgdx. So far I'm blown away by how simple it is to get something on the screen to work with. I'm trying to make a very simple tech demo where stars fall from the sky that can get collected by a player controlled cloud. Stars that get not collected will be le...
I am aware that most 'generic' BFS algorithms that use a queue also check for uniqueness of visitation to 'speed things up' as it were, but I'm a bit unclear as to how to implement such a method as I'm still a newbie to graph theory. Beyond any general critique, I am curious about how I can modify the iddfs_queue() fun...
This is a follow-up of: Very basic shell on microcontroller in C A few days back I've asked for a review on a simple shell parser in c. Based on the answers, I've restructured my code to use a table-based Mealy machine. shell.h #ifndef SHELL_H #define SHELL_H #include <stdio.h> #include "usart.h" #include <string.h> #...
I've been doing some JavaScript for fun again. This time I tried my hand at drawing the Dragon curve - a neat fractal that consists of one line traveling across the plane, never crossing itself, and creating an interesting shape in the process. There's several ways to go about generating the Dragon curve; for instance,...
I needed to convert a formatted file size back into its length in bytes. I came up with the following code but want it reviewed: /** * Converts a formatted size to its equivalent in bytes. * * @param size * The formatted file size. Examples: "125.5 MB", "1KiB", "0.8 GB" * @return * @throws NumberForma...
I have defined the tag that can sit on all the pages of my website and be easily integrated into the admin tool. It is the broadest category with properties that are relevant for all pages. Can you please tell me if it is written correctly? I am concerned that the URL code line might be picked up as a circular link and...
I wanted to learn how to create awesome parallax scrolling effects so I decided to look up how to do it, after some searching I put together this test. It works fine to some extent but it feels a bit messy, especially if you would expand it with more effects and elements. You can see it in action here (had to replace ...
I'm trying to learn how chained hashing works, but can't get any further than this. I think hashing works, but after finishing this little program, someone told me that what I have created so far has nothing to do with hashing. #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <time.h> #d...
I am taking an algorithm course and we are to implement merge sort that handles list of elements with even or odd number of elements and handles duplication, so I wrote this function: void mergesort (int* list, int len) { if(len == 1) return; int i = len/2, j = len-i; int list1[i], list2[j]; ...
I have a small UI that involves adding roles and modules to a user database array. The interface works as is, no problem at all, but it seems to have a bit of 'duplicate' code that I was hoping I could get some advice on ways to refactor, if at all possible. JS and Knockout function Db() { var self = this; se...
This code is supposed to find, in a graph, the node with the smallest maximum distance to all the other nodes. The problem from Quora is : How do I find the node that has the least maximum distance to all the other nodes in a tree? "So you're thinking about moving into an unknown city. You have been given a map of...
I want to wait for a line to be read, but only for so long before timing out. This is what I came up with. Is there a better way to do it? Dim reader As New System.IO.StreamReader(pipe) Dim nextCommand = Await New Func(Of Task(Of String))( Function() Dim t = reader.ReadLineAsync() If (Not t.Wait(...
The koan is at the end of this snippet. It requires you to write a function to convert a map to a string, and then prepend a full name to it. The following solution works fine. I am just wondering if there are simpler or more efficient ways of doing the same thing. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ...
I came here to ask if there is a way to prevent already guessed guesses from being guessed again in my brute-force Java program. Basically I used a rand.nextInt in my program but the program will guess already guessed passwords again even if they were incorrect. How could I prevent this as it wastes time and processing...
I am working on a 2D tile based platformer and was hoping to get someone to review my collision detection. I've only included the X collision check since the Y is essentially the same. Any suggestions/criticisms are appreciated. // Corrects X movement if a collision occurs. private void checkXCollision() { ...
def current_active_role user_roles.each do |r| if r.is_active_role return r end end return nil end The block above returns whatever the user's currently active role is. There are User, UserRoles (lookup table), and Roles tables. I'm looking for a more concise way to say "go throu...
I have this type: type Future<'a> () = let mutable _value: 'a option = None member x.Resolve value = if _value.IsSome then failwith "can only resolve once" _value <- Some value member x.IsResolved with get () = _value.IsSome member x.Value with get () = match _va...
I have a list of tasks I get from my database (as strings) and then execute. However I'm uncertain on how to implement this correctly. Currently I have implemented this in the following way: Private Sub Monitoring(installationCode As String, drive As String, syncFolder As String) InitializeDatabaseConnection(in...
I'm currently trying to create a macro, to edit a document that is around 280k rows and 12 columns. For the first steps I found a macro to delete the rows I don't want based on certain criteria, but the code repeats itself a lot. Every time I run it, I change the criteria and link the macros. Also, is there a better w...
This code is working fine, but it looks awful (yes, I am a rookie on this thing). How can I improve it to look better? Private Sub Worksheet_Change(ByVal Target As Range) 'Conditional Formatting Application.ScreenUpdating = False If Target.Column > 6 And Target.Column < 8 And (Target.Value = "G" Or Target.Value = "Y...
I have a function to display or hide some elements. What I want to do is to manage the display of those elements regarding a value. How should I replace the term toggle? Toggling for me means 'show the element if it's hidden, or hide it if it shown.' (yes, I mean toggling visibility) function togglePassengers() { v...
You are given a string of lowercase letters. Your task is to figure out the index of the character whose removal will result in a palindrome. There will always be a valid solution. Here is my quick solution: public class Main { private static final String AAA = "aaa"; public static void main(String[] args) ...
This is pretty much the first Powershell script I've ever done and I am here looking for a quick review of it. Is there something I could have done better? Is the format okay? I don't know much about expected standards, and this was cobbled together as a result of me wanting to learn. $Company = Read-Host 'Enter Co...
This is how my LinkedList class looks like in PHP. I am trying to figure out if I can rewrite my reverse_list_recursively() function more elegantly without having the funky $current = NULL. The reason I have it is because I need to pass $current in my recursion call. I'm not sure if there is another way to do it. <?php...
I've been been working on a vertical histogram that prints an asterisk in place of a number in a certain range (say 1-10... and so on). My code is working as required. Is there a better, simpler or more efficient way of doing it? If so, would you mind explaining or showing me better code if you have it handy? import ja...
Any suggestions for improvement or critiques are welcome! <!DOCTYPE html> <html> <body> <canvas id="myCanvas" width="400" height="200" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML5 canvas tag.</canvas> <input type="button" onclick="alert(ColorToText())" value="Click Here"/> <script> funct...
I know I have seen this before and I can't remember how to fix it or find where I saw how to fix it: def product_matcher(item) product = [] if !item.blank? product = self.products.where(:id => item.id).first else product = self.products.where(:id => token.id).first end product end It seems wrong to m...
As an assignment, I was to create an \$n\$-dimensional vector type for \$n \le 20\$. This vector only has to support addition and scalar multiplication. I tried to write good code, with proper memory management, error reporting, and a nice API. However, I have little experience with C so I would welcome any feedback on...
I'm trying to create a C# brute force MD5 password checker. If I run it with "test1" without MD5, it completes in 15 seconds. I would like to make it faster, but I'm a c# beginner, and don't know how to optimize code anymore. Basically, instead of nested for loops, if using flags (of type boolean), so if you have 4 cha...
How would you improve on this? It's been fairly long since I last did something slightly more extensive in C++, so I'm looking for ways to be more compatible with modern C++ ways, and this style of OOP. I think especially the user action part and new opponent generation might be what needs the most work? main.cpp #incl...
I can clearly see I'm repeating myself, but I don't know how to refractor this without making it really ugly. What I have: class ChildModelController < ApplicationController def new @model = ParentModel.find(params[:id]) # Does the current user have permissions on the parent model if si...
I am looking for code correctness and design usage as I think I might be over doing it in the class department. There are two things I'm mostly concerned with. The possible redundancy of classes derived from IPerks. As CommonPerks, UncommonPerks, etc, all look identical except for the rows/columns in its internal perk...
def return_year_by_month_and_period(month) pw = self.property_water.first().billing_increment case pw when "12" self.property_water.where(period: month).first().year when "6" case month when 1, 2 self.property_water.where(period: 1).first().year when 3, 4 self.property_water.wher...
Can anything be improved in this code? #include <iostream> using namespace std; void print(int *a, int n) { int i=0; while(i<n){ cout<<a[i]<<","; i++; } } void swap(int i,int j, int *a){ int temp = a[i]; a[i] = a[j]; a[j] = temp; } void quicksort(int *arr, int left, int right...
How to optimize this merge sort code to make it run faster? And how to call merge_sort function without user input by declaring necessary array in the code? #include <iostream> using namespace std; int a[50]; void merge(int,int,int); void merge_sort(int low,int high) { int mid; if(low<high) { mid = low + (high-low)...
If it is possible I would like some comments on the overall style of the program. It feels like I am writing the whole program as one big script and I'm not sure how to break it down into several compact modules. Also, I feel like I'm writing the program like I do in VB.NET because of the global variables. Any comments...
I have a function which goes through every name in an object. This object has an array parameter materials which holds other objects. Those objects have the same array parameter which hold more objects and so on. My code lines 3-5 just repeat while adding .material and another variable. Also the code will only go into ...
How can I improve it and its running time efficiency? Problem (SPOJ/CANDY) Jennifer is a teacher in the first year of a primary school. She has gone for a trip with her class today. She has taken a packet of candies for each child. Unfortunately, the sizes of the packets are not the same. Jennifer is afraid tha...
The issue I have with this class is that most of the methods are almost the same. I would like for this code to be more pythonic. Note: I plan on replacing all the for loop constructs with list comprehensions. class Sorter(BaseCrawler): def __init__(self, base_dir): self.base_dir = base_dir def by...
This is part of the project I started just now. It is a function that returns the offset address of a first occurrence of a string match into a given range of memory blocks. #include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct { unsigned long offset; unsigned long terminal; } Range; unsig...
I've created a working query in Entity Framework and I'm curious if there's a better way to do this. Since there's a lot of field on my models, I will only publish the relevant ones here. My Models are like this: public class Category { public int Id { get; set; } private ICollection<Product> products = new Li...
This is a function to determine if a number is between x and y. It is part of a library of mine called EOL or "Everything in One Line". #include <stdbool.h> #ifndef _WINDOWS_H #include <windows.h> #endif bool between (WORD n, WORD x, WORD y) { return (n >= x && n <= y) ? (true) : (false); }
The goal is to call startManager on application start so that the manager is initialized in background without blocking application main thread. Is it a safe implementation? Any recommendation or best practice? (use an Executor, use a synchronized block, ...) public class FileConverter { /** The Constant logger. */...
The recommended way to report something as "progress" back from a async function is to use IProgress<Type> or IProgress<Class>. When the caller invokes the async function, it can provide an implementation for IProgress. This object is then used inside the called instance to report back progress. For a better descriptio...
In the bit of code below: How can I make add_day, add_ week and add_month work as a single function? They are almost copy-paste of one another. I'm trying to follow the DRY rule. How can I set this so that I don't use the variables day/week/cur_day? import datetime from collections import defaultdict class ParsedDa...
I've just started working with SQLite in C# to test various features of an application. In building my first SQLite example I wanted to insert a large .csv into a table (Person) with two columns, A and B. The .csv file is 50MB in size and contains multiple rows of the same data ("abc, def"). I wrote the following code...
Can anybody give me suggestions for making it faster? (Project Euler #14) import time start = time.clock() def collatzChain(n): count = 1 while n != 1: if n % 2 != 0: count += 1 n = (n * 3) + 1 if n % 2 == 0: count += 1 n = n / 2 return coun...
This is my first game that I made. How could this be improved? #include <iostream> #include <time.h> #include <stdlib.h> #include <unistd.h> #include <conio.h> using namespace std; int snakelenght=2; char direction='d'; char field[20][30]; class Past { int m_nx; int m_ny; public: void Init(int x,int y) ...
The code below is a publisher base class. I've never really liked the way I implemented this class. Are there any improvements/simplifications I can make to it? Background: The execute(...) method is called periodically from ServiceImpl. ServiceImpl is just a generic service class. package me.munyengm.core.publish; im...
This question has been superseded by C++11 lock free collection similar to std::forward_list - follow-up 2 Thread safe and lock free collections are very hard to write, so I'd appreciate any feedback, especially regarding bugs. The code below is a self contained cpp including some tests. This question is a new iteratio...
For a quick summary: I've created this internal web application, and I've hit a point where I can really see the mess I've made. I need some help separating the logic, the view, and the data. More detail: Over the past few months, I've been doing all I can to learn more about JavaScript built web sites/applications. I'...
So, I fixed my problem with a public ViewModel for my MainPage like this: MainPage.xaml.cs: private static MainPageVM Data = new MainPageVM(); public MainPage() { this.InitializeComponent(); SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested; this.DataContext = Data; this.SizeCh...
In my MUD game engine, I built a messaging api that allows objects to subscribe to concrete implementations of an IMessage interface. Is there anything glaringly bad about the approach I have taken? The intended use-case is for objects, such as an IPlayer implementation, to subscribe to WhisperMessage and ShoutMessage ...
The following code: import random def keygen(): l = list('abcdefghijklmnopqrstuvwxyz123456789!@#$%^&*()_-+={}[]|\:;?/~`"" ') random.shuffle(l) return l def encrypt(x): key = keygen() #or a static key for consistency y = list('abcdefghijklmnopqrstuvwxyz123456789!@#$%^&*()_-+={}[]|\:;?/~`"" ') z...
For an input triple (a, b, c), the task is to count the number of integers in the inclusive range [a, b] which have c distinct prime factors. This entails factoring each of the numbers in the range [a, b] and establishing how many distinct prime factors each has. I need faster code so my program runs faster and works o...
While checking my SPs today I found that I have, SELECT COUNT(*) ,CASE WHEN ISNULL(MIN(COALESCE(MP.NewPrice, MP.Price, 2147483647)),0) = 2147483647 THEN 0 ELSE ISNULL(MIN(COALESCE(MP.NewPrice, MP.Price, 2147483647)), 0) END FROM MerchantsProducts MP I need to replace this with something which make more sense. Can ...
How can I improve this game? #include <iostream> #include <deque> #include <vector> #include <chrono> #include <random> #include <conio.h> #include <Windows.h> #include <tchar.h> using Matrix = std::vector<std::vector<int>>; namespace { HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_I...
I have an alternative algorithm to the same problem as Finding missing items in an int list. My implementation includes optional min and max bounds to selectively fill in the list. The linked implementation is much simpler. My Questions are: How do our two algorithms compare, efficiency wise? Besides the algorithm lin...
I think performance won't be a big issue here as the concatenation only happens once (2-3 at worse because of multiple threads). Out of the two methods, which one would you prefer, in terms of readability and performance? Is there any better way to accomplish the task of calculating desired string:uaInfo? public stati...
The Situation I have created some code in the form of modules that each represent a medical questionnaire (I'm calling them Catalogs). Each different questionnaire has its own module as they may differ slightly in their content and associated calculations, but are essentially made up of simple questions that have boole...
What is considered to be a good programming practice for returning value from the function? For example, if we have a function in C named list* after( list *node), which returns the node which is after the node pointer. First option: node *after(node *first_ptr, node *nod_ptr) { if (!(is_last(first_ptr, nod_ptr)) ...
I've to do a generic method Classify<T> that, given a sequence of elements of type T and an arbitrary number of predicates, returns an array of n+1 lists (where n is the number of the predicates). More precisely, if the element satisfies the first predicate then it is added to the first list. If not, then if the elemen...
I want to create a circular queue using a linked list. I also want to create many instances of that data structure (queue) without repeating the code. This is what I came up with: #include <stdio.h> #include <stdlib.h> struct queue { int info; struct queue *next; struct queue *front; struct queue *rear...
Suppose we have an application which process packets from somewhere. We should choose right handler for the packet depending on packet type and also we know that it might be necessary to change algorithm of handlers and add new handlers in the future. The question is: how can I write maintainable code? Here is my draft...
I have this code inside a post route: The first one is to alert me when a user registers on my site: sendgrid.send({ to: "my@email.com", from: "myother@email.com", subject: "[ALERT] " + req.body.eventDate, html: "SOME HTML", }, function(err, json) { ...
I've started using Code Climate to assess some of my code quality and ran into a situation that I can't seem to find a good solution for. In short, in trying to solve some code duplication that resulted in a low "grade" by using metaprogramming, I simply get a low grade for code complexity instead. Anyone know a good a...
I wrote a program which computes the harmonic partial sum to N terms with multithreading capability. I've been working on this to sharpen my C++ skills for the upcoming semester. Just wondering if there's anything that doesn't follow the C++ standard and/or glaringly wrong. Also wondering if I can make any further opti...
I am trying to check if an Array A contains all the elements of Array B and similarly Array B contains elements of Array A, the order does not matter. Some examples: A B Result {1} {0} false {0, 0, 0} {0, 0, 0} true {17, 4, 11} {4, 17, 11} tr...
I have created a simple program in which the user is prompted for various details about their employment. In my Employee.java file, I have all the methods. Employee.java: import javax.swing.JOptionPane; public class Employee { private static String name; private static String jobTitle; private static int ...
I am creating an algorithm to take a series of labelled points placed randomly and move them until they fulfil a set of constraints. The constraints have been pre-computed and are each a lower and upper bound of the distance between two points. There is definitely a solution that satisfies all constraints. The procedur...
I am a beginner in programming languages, so I apologise if my code is badly formatted or doesn't make any sense. My program gets an image and a RGB color range as input and it counts how many pixels are in each group. A group only contains pixels connected directly, not diagonally, so for each pixel, it searches for v...
I am trying to encrypt the input string using the following rule: 1st Character of string will be increment by 4 ( a will become e ) 2nd Character of string will be increment by 1 ( a will become b ) 3rd Character of string will be increment by 7 ( a will become h ) Rest of the characters will be replaced using the ab...
This programme uses a genetic algorithm to get the string "Hello, World!". It can be summarized as follows: Create a random initial population. Let the best reproduce and kill the worst until we get a 'good_enough' result. I used doctest to verify correctness. import doctest import random def random_char(start=' ',e...
I have implemented this compile time map as a way of learning templates and constexpr classes: template<class K, class V> class Element { public: const K key; const V value; constexpr Element(const K& key, const V& value) : key(key), value(value) {}; }; template<class K, class V> constexpr Element<K, V> El(...
I'm trying to solve simple Java problems in various ways. Could anyone comment about the code, like how it could be better, and what could be a problem? // When using already-defined-method is allowed static String reverseStringByChar1(String str) { return str == null ? null : new StringBuilder(str).reverse().toStr...
I'm trying to generate a bunch of uniformly distributed unit vectors around the unit circle. Here's my code, which is working, but unfortunately I have a for-loop. How do I get rid of this for-loop? import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl def gen_rand_vecs(dims, number): vecs = ...
My problem is that I have a sequence, potentially infinite, of strings. Let's suppose it to be {"Mickey Mouse", "Bugs Bunny", "Winnie the Pooh"} I have to make an exthension-method Initials that returns a sequence of their capital letters in uppercase, so in this case, doing: var names = new string [] {"Mickey Mouse...
I'm not normally a C programmer but thought I'd take a shot at making something useful. This is a C utility I wrote to judge how similar several files are using the algorithm I think diff traditionally uses. I'm interested in general feedback. I don't write C usually but I do read it from time to time to try and pick u...
I need to read an archive file format which stores filenames as 8 characters for the name (null-terminated if less than 8 characters, not otherwise), immediately followed by 3 characters for the extension (i.e. without a dot). So basically, I need to read the components and add a dot between the name and extension (nam...
I'm trying to parse an estimated travel duration and distance between two waypoints using Google Directions API. Tap on this to see an example of data received. private class func parseTravelData( data: AnyObject!, mode: ESTMode, completion: (NSDictionary?) -> Void) { var receivedData = data as? NSD...
I have written a Sudoku solver, for the euler problem and also packaged it into a ruby gem. In my solution strategies I do a lot of iteration (double/triple nested loops, I am coming from Java/C). One method in particular has a lot of if checks and iteration. Would it be better to package this iteration into an enum...
I have written a type with the following public API: public sealed class InitializationGuard { public bool IsUninitialized { get; } public bool IsInitializing { get; } public bool IsInitialized { get; } public InitializationTransaction BeginInitializati...
I'm a student and still studying. I just made my own Pastebin tool to generate source code. I've also contributed this project as an open source. You could see this project from here. If you wish to see the demo, you could visit here. Now after this, I've made this project using JSP and servlet. Actually, when the user...
I'm trying to implement Knuth's Five-guess Mastermind algorithm in my own version of Mastermind, but when running step 6 it takes my code hours to actually run through everything to get the neccesary information. I was wondering if any of you would know a better way to obtain the same results? Here is my code with rele...
I'm an experienced programmer trying to learn OCaml. I figured a good way to do that would be to pick a simple task on Rosetta code that didn't yet have an OCaml example and do it myself. With that in mind, I wrote this program to find the last sunday of each month in a given year. It works by using Gauss's algorithm t...
Is there a better way to implement bootstrap tabs routing with SammyJS besides this? <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <link href="lib/bootstrap.min.css" rel="stylesheet" /> <script src="lib/jquery-1.8.2.min.js" type="text/javascript"></script> <script src="lib/bootstrap...
I am doing a background image animation using the function. It works, but I think I am doing more coding than what it requires. Can anyone please help me to minimize it? Don't recommend the CSS animations, I am working for IE9. Live var call = function () { var x = 0; return function () { x++; x...
Is this merge sort following good coding standards? What are some improvements I can make to make it cleaner? public final class MergeSort { private MergeSort() { // prevent instantiation } private static Object[] temp; public static <T extends Comparable<? super T>> void sort(List<T> arra...
With native JavaScript, I intend to traverse a collection of elements in the DOM that contain a link and an image (and possibly other elements). The image may or may not be inside the link—in most cases the image will be in the link, but in some cases it may be directly adjacent to the link, or it may be a child of ano...