instruction stringlengths 71 71.9k |
|---|
Find all nodes of trees, without siblings.
This question is attributed to GeeksForGeeks.
I'm looking for code reviews, optimizations and best practices.
public class PrintNodesWithoutSiblings<T> {
private TreeNode<T> root;
public PrintNodesWithoutSiblings(List<T> items) {
create(items... |
This is my first code in C# ever. It compiles and works as intended (not complete), but I want to see what I'm doing right and wrong as a first-timer.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System... |
I want to write a program to work out how many semi-magic squares there are.
Here is the definition of semi-magic squares
If we define \$H_n(t)\$ is the number of semi magic squares which satisfy:
The square is \$n*n\$ dimension
The sum of each row elements and sum of each column elements equal to \$t\$
The first ... |
I'm comparing two variables which I'd like to be printed to the console like so:
==Full Ex Vat==
true
Currently the code to do this is:
print '==Full Ex Vat=='
print case when
@aTotalExVat = @sTotalExVat
then 'true' else 'false' end
which I feel isn't as elegant as it could be.
Any tips?
|
I'm having a hard time figuring out if the code I wrote is purely combinatorial or sequential logic. I'm designing a simple 16-bit microprocessor (will be implemented on a Spartan 6), and I'm new to Verilog, HDL and FPGAs. The code for the microprocessor is complete, but I'm having second thoughts about the best practi... |
I'm trying to create code that reads a text file (containing (double) numbers between 0 and 1) and filling up a 3D array/matrix (calling it matrix from now on) with those values. After that is done I need to figure out the current max-value inside this matrix and then look at the values around it (in every possible dir... |
I am practicing object oriented design and have taken Tic Tac Toe as an example. I have written first all the requirements and then started writing code. I would like to get it reviewed so that I can improve my skill further. Please provide suggestions.
I have placed code at this GitHub repo.
Square.js
//Square class
f... |
I've just begun creating my first user class. First, I need some clarifications.
Am I using try and catch correctly?
To clarify, the way I would be instantiating this object is like so:
try{
$loggedInUser = new LoggedIn/User($email,$password,$useragent);
$_SESSION['user'] = $loggedInUser;//now session holds use... |
Given a base path and a list with extensions the task is to list all files:
Two of my solutions are:
from glob import glob
from os import path
EXTENSIONS = ['*.zip', '*.jar', '*.pdf']
DOC_PATH = '/path/to/files'
# Solution1:
files = []
for ext in EXTENSIONS:
files.extend(glob(path.join(DOC_PATH, ext)))
#... |
I wrote my first animation in Java FX and would like a code review.
I created StackPane with Rectangle. Rectangle starts to move inside StackPane to right-bottom direction and changes direction after hitting the StackPane bound.
Please review the code that moves Rectangle. Is it a correct implementation of a Java... |
I have to write the following method:
I have sorted array of integers and in this array every integer repeats twice, except two elements. I have to find these two elements.
Input: 1, 1, 2, 3, 3, 4, 4, 5
Output: 2, 5
This is my solution:
private static int[] findUniques(int[] arr) {
int[] res = new int[2];
in... |
This server require fast decoding of packets from clients, as I am expecting 5000 concurrent clients that is sending packets possibly every second. This is a game server (5000 players walking send packets each n every step).
I want to see if my implementation is fast enough or there are still room for improvements. The... |
The problem:
A Node is located in a specific coordinate (x, y, z).
A Node can be one of these types: None, Hinge, Roll, Fixed. (it is called Boundary Condition)
Different boundary condition type determine a Node's Degree of Freedom.
I have one Abstract NodeBase class and multiple classes of nodes inheriting them. ... |
This library registers a new user.
Questions:
Where should the DB class instantiation happen for user class? I tried instantiation in the constructor but that property doesn't seem to be available to the rest of the user class. As a work-around, I'm creating a new instance with every function that needs the DB class.... |
I'm trying to figure out the cleanest way to implement a fluent interface with unique_ptr and other "modern" C++ language constructs. Here's my first attempt:
#include <iostream>
#include <memory>
#include <vector>
// Backported from C++14
namespace std
{
template<typename T, typename ...Args>
std::unique_ptr<... |
I implemented a generic Deque<T> data structure.
Please, review this implementation.
Deque.java:
import java.util.Iterator;
import java.util.NoSuchElementException;
class Deque<T> implements Iterable<T> {
private class Node<T> {
public Node<T> left, right;
private final T item;
public Node(T item) {
... |
I have been writing an event class for my game engine and I came across to the following problem:
Is casting a base class object to a derived class object given a type flag a good programming design?
Let me give you the following simple example. I have this enum holding the categories of the events:
enum DisplayEventT... |
I'm implementing the K-nearest neighbours classification algorithm in C# for a training and testing set of about 20,000 samples and 25 dimensions.
There are only two classes, represented by '0' and '1' in my implementation. For now, I have the following simple implementation:
// testSamples and trainSamples consists ... |
I've a feeling I'm overdoing my Auth class, and that it could be done in a simpler and more understandable way.
Could you give me advice on this, please?
This is for my learning process and I just want to learn. This is why I am 'reinventing the wheel'.
class Auth
{
protected $pdo;
protected $session = null;
... |
I'm a beginner in JavaScript and I am sure that there is a better way to do it (basic one minute timer from 01:00 to 00:00 running from pageload):
JSFiddle
window.onload=function(){
(function(){
setInterval(function(){
cro();
document.getElementById('unminut').innerHTML="0"+jocminut+":"+jocsecunda1+jocse... |
The following code list all files in a folder and allows the user to download one of them. It is working but I think it could be done better.
Is there a way to reduce the number of forms to only one and to improve the way I retrieve the name of the file to download?
My second concern is about the security of my getFile... |
How can I rewrite this in a simpler way?
$imageContainer = $($(this).parent().children()[0]).children()
currentIdx = 0
for e, idx in $imageContainer
if e.className.indexOf('active')
currentIdx = idx
break
|
I used the idle command to wait for incoming messages in my Gmail mailbox. The protocol I am using is IMAP.
My concern is as follows:
While the below code works, Gmail has a tendency to try to interrupt the connection. Therefore, I found some solutions online including sending a periodic NOOP command and catching the F... |
I have a list of datacenters, which are dc1, dc2 and dc3. And each datacenter has six ids as of now (can be 11 in each datacenter as well or uneven number for each datacenter).
dc1 - h1, h2, h3, h4, h5, h6
dc2 - h1, h2, h3, h4, h5, h6
dc3 - h1, h2, h3, h4, h5, h6
Now I am trying to generate combinations of datacente... |
My Problem
I have a library containing business logic which is being used from 3 different projects:
Website
Local WPF Application
WCF Service
The library uses Entity Framework and a connection string which is read out of config on first use and saved in a static variable. (The config file for all 3 consumer projects... |
The code below is sort of complicated to explain...
It writes a "sphere" of data to a 3D array from the given 3D-Position outwards in a spherical shape based on the given radius and value to write.
A graphical representation of this would be:
double UbytePrism :: PrismSphereSet( uint64 Xpos , uint64 Ypos , uint64 Zpos... |
I have the following function that creates an array of JSON objects with properties from an array of arrays, where the first 'row' in the array contains the keys.
It works, but could it be improved?
var myArray = [
["a","b","c","d"], // will become keys
[1,2,3,4],
["foo","bar","baz","bob"]
];
function mak... |
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below N.
#include <stdio.h>
int main(){
int i=0,j,k,l,sum=0;
scanf("%d",&i);
if(i<=100000&&i>0){
for(j=0;j<i;j++){
s... |
In my Android app I have number of methods that should be executed in a background thread.
One of the methods looks like this
public static void processItem(final Context context, final String itemId)
{
if (Looper.myLooper() == Looper.getMainLooper())
{
Thread task = new Thread()
{
... |
I have a multithreaded application for web scraping from an automobile website. While performing web scraping, there are many links that give the same result, so I have to check for data redundancy.
I have maintained a BlockingCollection<String> that adds vehicle VIN number in it and performs a check if the link to be... |
I am creating a vector class which can be manipulated on the GPU and I am using C++AMP for the GPU accelerated code.
I am wondering the most efficient way of assigning elements of a different type to a concurrency::array in C++AMP. There are two ways that I can think of (but there may be more):
Firstly, one could use ... |
Ignoring my shocking use of the mysql_* extension (and any associated issues), could you take a look at my script that uploads an image, adds it to a database, creates a thumbnail of the image 578px in width, and adds that to the database too?
<?php
require_once("validate.php");
while ($hq = mysql_fetch_assoc($hash_qu... |
This is my solution to the FROGV problem on Codechef:
N,K,P = map(int,raw_input().split(' ')) # N: No of Inputs, K: highest possible jump, P: no of test cases
L = map(int,raw_input().split(' ')) # Takes in the N space separated inputs
Li = sorted(L)
Breaks = [] #Records the starting point a of pair a,b such that the ju... |
I have a small script that takes a list of objects from an SQL table and groups them if the date-time on the object has less than 60 second difference with the last object.
It does this by converting the date-time to epoch and then subtracting the epoch of the previous object from the epoch of the current object. The ... |
Is there a better way (I'm pretty sure there is) to create a stored procedure to do dynamic paging, filtering and sorting than the following code?
I'm actually generating this sproc from a database using a T4 template.
CREATE PROCEDURE [uspProductWithPagingSortingFiltering]
(
-- Optional Filters for Dynamic Search
@Pro... |
I got sick and tired of writing certain functions over and over again, so I made a module that has those functions whenever I need them. I don't use it for code I plan on sharing, so I don't need to worry about portability. I do code in Python 2 and Python 3, so I used a bit of hackery to make it compatible with both.
... |
Recently I have discovered one thing, which makes me feel frustrated. The Perl is lack of syntax sugar for strings, to do the same things, those are applicable to lists. The implementation I posted here would require to be rewritten to work for lists.
Thus, I had to re-write the code to Python to work for list as effic... |
I am working on an HTML5/jQuery todo list app and here is my code so far.
As you might notice, there are some functions called at the beginning of the JS code. These functions work perfectly right now. Is it OK if I declare these functions inside the object literal and then call it using the object? In my opinion, the... |
After posting my previous question about this Job Queue, I decided I wasn't actually very happy with it. I am embarrassed to admit that upon further testing it did not function properly in all situations. I received some awesome feedback about it, and I have made extensive changes to the classes as well as fixing all... |
Given two linkedlist, merge them. Looking for code review, optimizations and best practices.
The code is influenced by feedback here.
Changes incorporated were:
Linkedlist is no-longer write-only
Constructor is not the only way to add new elements
HashCode and Equals are more meaningful
Merge (non-recursive) function ... |
Is there a faster way to get all primes between 0 - n?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
namespace myPrime
{
public class simplePrimer
{
public List<BigInteger> primeList;
public void findVersion(BigInteger goal)
... |
I have seen various tweaks for quicksort and to establish their usefulness, I designed a program that randomly generates arrays and times how long quicksort takes to sort them. Right now I'm focusing on how the pivot is chosen. I'm comparing choosing the first element as the pivot versus choosing the median of first, m... |
I am aware of the fact that a sorted unidirectional list has only very few use cases, but nevertheless, this python code feels fairly long for Python code. How can I improve it?
class List:
def __init__(self, list):
self.first = list
def __repr__(self):
element = self.first
elementsList... |
I'm using multiple jQuery filter functions to affect the background color of select objects based on the selected option and it works, but it seems bulky/redundant. Does anyone know how these filter statements could be simplified/combined? I have a JSFiddle here.
<head>
<!-- Load minimum jQuery -->
<script src="http... |
I've written a decorator for easily creating multiple dispatch functions:
from functools import wraps
def multi_dispatch(for_function):
"""
Returns a multiple dispatch version of the function.
The returned function doesn't allow keyword arguments.
>>> @multi_dispatch
... def foo(a, b):
... ... |
I'm much more fluent in JS, but I needed to sort a lot of dates, ages, genders, etc. from a tab-delimited text file so I wrote this. Could I get some tips on how to make this more efficient and more Pythonic? The more Python I write the more I like it, but I definitely need some help.
One thing I noticed is that when I... |
I'm working on a proxy service that will run on top of a Java application in order to manipulate some headers. I've just completed the first step and that is intercepting the request message and storing them.
This code features only the storage part, and not the edit and send part.
Some information about HTTP requests:... |
I have a class that I use to represent a distance called Dimension.
Here is its four constructors:
/// <summary>
/// Accepts any valid architectural string value for input.
/// </summary>
public Dimension(string passedArchitecturalString)
{
storeArchitecturalStringAsInternalUnit(passedArchi... |
I have been unable to find any other way to update a user config file than the following method.
public class SettingServices : ISettingServices
{
public UserSetting GetUserSetting()
{
XmlSerializer reader = new XmlSerializer(typeof(UserSetting));
StreamReader file = new StreamReader(UserConfig... |
I would like a complete threshing of this code so that I can see what I did wrong and what I am using incorrectly.
I made this super simple, trying to learn a little bit about List<T> while I was doing this. I have never actually tried to do this before, so I thought it would be a good learning experience, but it just... |
I tried writing alternative functions to Java's BigInteger.add(BigInteger.ONE), BigInteger.add(BigInteger), and BigInteger.subtract(BigInteger):
public static BigInteger increment(BigInteger x)
{
int i=0;
while(x.testBit(i))
x=x.clearBit(i++);
x=x.setBit(i);
return x;
}
public static BigInteger add(BigI... |
My goal is to create a memory-efficient (immutable) collection of strings. The imagined use-case is checking for valid words in a Scrabble-like game.
Wikimedia Commons has a pretty good summary of the data structure (author: Chkno):
(Image license: Creative Commons Attribution-Share Alike 3.0 Unported.)
For an input o... |
An implementation of the singleton pattern in PHP using a trait (added in 5.4). Is there anything missing, any ways to create a second copy of the class?
trait Singleton {
static function instance() {
static $instance;
if ( is_null( $instance ) ) {
$instance = new static;
}
... |
Given a list of objects, return an iterator for such a list. Looking for code-review, optimizations and best practices. Verifying complexity to be O(n) where n is sum of all objects, including elements of collections if contained. previously solved here.
public class FlattenIterator implements Iterator<Object> {
p... |
It's known that if you naively sum up a collection of arbitrary floating-point numbers using any floating-point standard (e.g. floats or doubles with the C standard), the end result may differ, sometimes significantly, from the actual sum. This is due to the loss of precision involved in approximating a real number in ... |
I started to refactor my app to MVC today. I wasted a lot of time because of simple mistakes.
One was I kept trying to access the getter method inside of my custom getter method, which just causes and endless loop of gets.
Even when I figured it out, I repeated this mistake several times. I think it's safe to say I'll ... |
This is a Graphical Timer control I made for C# Winforms, which taught me quite a bit (it is my first Custom Control). The code below is a fully working application with the Graphical Timer, some buttons to control it, and a listbox showing the sweeping angle of the pie (for debugging purposes). Being my first control ... |
Okay - so basically I have a login form that has a couple of 'states' it needs to display (connecting, input credentials, authenticating, invalid credentials, etc...etc...) - in the past I've literally tossed my views into my DI container and bound a ContentControl to a property on my ViewModel that holds a reference t... |
During the hiring process, a company gave me this test:
Q) Consider Share prices for a N number of companies given for each month since year 1990 in a CSV file. Format of the file is as below with first line as header.
Year,Month,Company A, Company B,Company C, .............Company N
1990, Jan, 10, 15, 20, , ............ |
Inspired by another question, I decided to implement Kahan summation in C++ (though that question implemented a different summation algorithm).
Since I was writing C++, I decided to make the code generic. Although it's a little difficult to imagine anybody bothering to use Kahan summation on single-precision floating p... |
We start with an empty queue. For the push operation we simply insert the value to be pushed into the queue.
The pop operation needs some manipulation. When we need to pop from the stack (simulated with a queue), first we get the number of elements in the queue, say n, and remove (n-1) elements from the queue and keep ... |
#include<stdio.h>
int main(){
int numberGiven,num=2,i=0,stack[100] = {0},top=-1;
// get the number from user
printf("Enter the number : ");
scanf("%d",&numberGiven);
while(numberGiven >= num){
// check for prime-ness of number
for(i=num/2;i>1;i--){
if(num%i == 0){
... |
This is a part of my Minesweeper analyzer code that didn't fit into the last question.
This code uses FieldGroup which extends ArrayList because I am using some more data than just the elements themselves.
I am mostly wondering: Can any simplifications be made in the split method? Even though the current code is fast e... |
I have made a method which returns a list of all songs on my device. Now I want to get a list of albums out of these songs.
What I basically do is go through every song I have in my list, check if its album is already in the list and if not I create a new album.
This method will take some time since there are 1400 son... |
For a data warehousing project I ran into the following:
Custom fields that users can create, modify and delete, that should be loaded into the data warehouse as they are when the ETL happens.
On the profiling part of the area in the database that holds this data I discovered that theses fields are not columns in table... |
This is a script which takes an Amazon URL as input, takes out ASIN/ISBN from the URL, and uses Amazon Python API to fetch details.
For this task, I looked at many Amazon URLs and observed the following things:
ASIN/ISBN is always present in an Amazon URL
ASIN/ISBN can be present anywhere in the URL
ASIN is always in... |
This is my code
<ul id="filter">
<li><a href="#" class="dropdown">Any status ▾</a>
<form>
<ul class="opt">
<li>
<input class="option" type="submit" name="status" value="Active" />
</li>
<li>
<input clas... |
As a beginner in Ruby, I am trying to optimize this script that is a client side pre-commit hook for git.
Was hoping I could get a review to ensure I am following all ruby idioms, and to ensure I have the most elegant solution.
#!/usr/bin/env ruby
#
# Pre-commit hook created to help ensure dns changes are being
# comm... |
As you will see, I am not very familiar with Python and NumPy but want to learn it.
The following code is a very basic Sudoku solver which works fine for simple examples. Although it runs, I still have the feeling it is not very Pythonic.
from numpy import *
import sys
def set(col,row,wert):
# Set the value in fi... |
To calculate torque I need to look up a value from a table which I've hardcoded based on three conditions: grade, size, and thread. Then I need to multiply it by coefficients associated with the selected lubricants.
I've written the code to be a web-app, but it will also just run as an html file sitting on a company dr... |
Given an iterator of iterators, return all of the elements from the iterators in order. Looking for code review, optimizations, and best practices. Verifying complexity to be \$O(n)\$, where \$n\$ is the total number of elements from all iterators.
public class IteratorOfIterator implements Iterator<Integer>{
priv... |
I am learning PySide and am trying to implement widgets within a main window. My goal right now is very simple: I want to place a QLabel, with independently defined event handling, inside a main window that has its own event handling:
# -*- coding: utf-8 -*-
from PySide import QtGui, QtCore
class MainWindow(QtGui.QWi... |
I am trying to refactor these three methods into one:
public StatusReturn UpdateProperty(int id, int onlineReportId)
{
//Yes I realize I should not be using ref variables but the queryPermissions is an external dll.
var webQueryInputProperty = new WebQueryInputProperty();
//This line is ... |
I am solving ROCK problem on SPOJ. I have used bottom up dynamic programming approach for this problem. Time complexity for this is \$O(n^3)\$.
#include<stdio.h>
#include<string.h>
#include<math.h>
#define MAX 210
#define NEG_INFINITY -1000
int sellable(int a[MAX], int i, int j)
{
int index,sweet=0,sour=0;
for... |
I am working on a class library in C# to convert WKT to GeoJson. I am getting shapes in WKT out of MSSQL. A lot of the shapes that come out of SQL have a lot of points. I am concerned that even though what I have is working on the much smaller shapes I am using for testing, that it will either fail or be really slow... |
I took a little bit from all the answers to my previous question Threshing: Sieve of Eratosthenes.
This may be bordering on code-golfing, but I think that I have a pretty good piece of code here.
Is there any major concepts that I am overlooking, although it still seems super simple?
var upperLimit = 9999;
var primes ... |
I'm brand new to programming (in general) and C++ (in particular). I'm learning the basics of classes and objects.
I'm trying to do the following:
Create a class called X. It has 4 member functions, with 0 arguments, 1 argument, 2 arguments and 3 arguments, respectively.
In main(), make an object of this X class t... |
If we have a set of classes or structs such as:
struct Point
{
float x;
float y;
};
struct Square
{
Point topLeft;
float width;
};
struct Circle
{
float radius;
Point middle;
};
If we need to add some functionality to to these, does something like below make sense?
inline Point middleOf(const... |
I'm currently trying to make the code of an app I'm developing a bit more efficient and easier to read. Basically what this does is after the user taps with two fingers (gesture) it retrieves a previously saved array from NSUserDefaults of player names, and fills in the 6 text boxes (tagged 6-11) on a table view with t... |
I have this function which parses Beautiful Soup elements:
def get_info():
holder = []
problem_dict = {}
selection_container = []
for moselect in base_page.find_all('div', attrs={'class': 'Moselect'}):
if moselect.find('div', attrs={'id': 'noSize'}):
holder.append(moselect.find_all('... |
Background: I have 4 GB of text data dispersed in 250,000 html files. I want to interlink the files with <a> for the reader to click on. I have a 12 MB file of regex patterns to identify the <a> sites.
Situation: I have developed a working proof of concept, three files:
an XML file of regex patterns of where we would ... |
I'm currently learning how to use Apache Spark. In order to do so, I implemented a simple wordcount (not really original, I know). There already exists an example on the documentation providing the needed code. However, I tried to go one step further and to produce the result as a sorted list (by frequence) by using th... |
I have a list of lists which represents the options I can chose from.
I have a sequence of indices which represent which option lists I want to take elements from, and in which order.
E.g. if I have
choices = [
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
]
sequence = [ 2, 0, 1, 1 ]
I want my output to be
[7, 8,... |
I have been given three values: @lLength, @lWidth, @lHeight. I need to take these DECIMAL(4,2) values and set the values of @lMax, @lMid, @lMin with the values I've been given in order of value. So whichever value of Length, Width or Height is the greatest will be stored in Max, and the second created in Mid, and the l... |
I have this method that performs certain functions based on the state that the algorithm is currently at:
static infoStruct_t info;
void first_part_of_algorithm(void){
info.state = FIRST_STATE;
//set other information here as well
while(info.state < FINAL_STATE){
switch(info.state){
ca... |
I have two classes that do that same thing with different types. I was thinking of using generics (but I am open to all options). QueryPermissions and the WebQueryObjects come from an external dll that I cannot edit.
public class OnlineReportOutputService : AService, IOnlineReportOutputService
{
public IEnumerable... |
I have created a tool that lets me calculate the profitability of doing certain actions in an MMORPG game which I play, it's more edging towards a quick-and-dirty solution than towards a neat solution because it's simply a tool and does not need excessive robustness, however I do think there is room for improvements.
I... |
So I have a URI with a DNS alias, and I need to dynamically replace the alias with the actual machine. I started out with this:
var builder = new UriBuilder("http://server-alias/path/to/resource");
builder.Host = Dns.GetHostEntry(builder.Host).HostName;
return builder.Uri; // http://server1.mydomain.net/path/to/resourc... |
I'm new to JavaScript, and I've built a lightbox for an image gallery. There's a button to open the gallery, plus forwards, backwards, and close buttons, and keyboard controls. Currently, everything works exactly the way I intended, but I know that it can be more DRY, and would love some feedback on that.
Here is the r... |
Overview:
I have a need to manage a Google Calendar from a spreadsheet, so I developed a Calendar Manager program with Google Apps Script. I found some inspiration over on Stack Overflow, but my requirements are a little different. Rather than just have a simple list of events, I have a matrix of not quite recurring al... |
I am querying all orders from a WordPress database that uses the WooCommerce Bookings plugin. I want to display upcoming bookings, and there is a potential to have every hour within 2015 to be booked; which means that I might query over 8700 orders.
I'm new to PHP and did most of this following code myself. I'm not sur... |
I have a view controller on my app, where the user is shown a table view. The table view displays their address book contacts and allows the user to select any friends that they would like to invite to the app.
I have 2 model classes: HALAddressBook represents the address book, and HALContact represents an individual c... |
I have two different folders.
In one folder, I have files that will be exported to a remote site via FTP.
In a second folder, I have .dat files that will be processed by a ftp client program that I have. Each .dat file contains basic information that my ftp program needs to process a request.
I needed to create a bun... |
I made a simple AngularJS text function. The purpose is to provide an array of content to display. A 'slider' will be made with next and previous buttons that hide on the last and first slide, respectively. I can't help but feel it isn't very efficient. Any thoughts?
Here is a JSFiddle for those who want a live example... |
First off, this is not my code. I'm curious what everyone thinks about changing the type of an object inside of a method then modifying the properties of the cast type. I wanted to use composition to build up a patient, but this is the recommend path. I'm probably wrong which is why I wanted 3rd party feedback. Or m... |
I am doubtful about the security of my PHP code. I am new to programming, but want to learn how to secure things, protect my databases from SQL injection, and other best practices. I'd like to know if my databases are safe from attacks with this code.
public function __construct( $data = array() ) {
if( ... |
I'm looking for a code correctness and best practices review on the following. I created the following in order to prevent using the same code to convert serialized JSON to something more accessible in my HttpHandlers without incorporating this directly into my base handler. I don't always need to post over full entiti... |
I am new to programming in Python and wrote a simple Blackjack project. I am looking for experienced peers to provide a high level code review about the overall design patterns and proper usages. The code performs as expected and passes all my unit tests so I am mainly looking for feedback on how to make the code more ... |
Given n sorted lists, merge them.
This is a fairly common question, attributed to plenty of interview question websites.
I'm looking for code-review, optimizations and best practices. I'm also verifying complexity to be \$O(n*m*log(n))\$, where n is the number of list and m is the size of longest list.
public final... |
I am pretty new to JavaScript, and put together a weather application. I'd like to get some feedback on improvements I could make to the code itself and also possible ways to speed up weather data display.
This is a screenshot of the working site:
The basics for how the application works:
It checks if local storage h... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.