instruction stringlengths 71 71.9k |
|---|
Questions:
How could this code be written better?
Could this be written in less lines of code if constructed using classes?
Also, If the user-created menu items were to be saved to a file for later use, which would be the best approach to use? (pickle? plain text file? etc.)
Problems:
How do I dynamically draw the... |
I have this object wrapper class, which I will use to implement my Qt OpenGL scene. It is working, but I am looking for a way to:
Improve the API.
Remove extra OpenGL calls.
Optimize it.
I know that QGL stuff is deprecated and I should switch to newer Qt5 API, but it still has some things missing.
GLObject.h:
#ifndef... |
Objective
Currently I have the flags hardcoded. But want to optimize my code for production. So I am wondering if I have this code done clean enough to leverage CSS inheritance while maintaining support for older browsers.
I have this menu on my CodePen
whose size will vary per device (media queries not shown yet)... |
I need to print this in Java, but I feel that my code is too big:
*
**
***
****
***
**
*
public static void main(String[] args) {
for(int i=0; i<=3; i++) {
for(int j=0; j<=i; j++) {
System.out.print("*");
}
System.out.println();
}
for(int j=1; j<=3; j++) {
fo... |
Reservoir sampling implementation. Reservoir sampling is a family of randomized algorithms for randomly choosing a sample of k items from a list S containing n items, where n is either a very large or unknown number. If question is unclear let me know I will reply asap. Looking for code review, optimizations and best p... |
Here's my Python implementation of Conway's Game of Life:
class Game(object):
def __init__(self, state, infinite_board = True):
self.state = state
self.width = state.width
self.height = state.height
self.infinite_board = infinite_board
def step(self, count = 1):
for g... |
I've put together a board for Ultimate Tic-Tac-Toe (What's that?). This is part of the current code-challenge: Code a Ultimate Tic-Tac-Toe
Resources:
Live demo of my view – For you to see what I did there
Simon's working implementation – To illustrate that this is going to be a functional game
Questions:
What are yo... |
Can someone help me improve this code? I and trying to have a couple extension methods to convert strongly-typed lists to a DataSet and DataTable respectively.
But... being so green to C#, I am not sure this is the most efficient way to do this.
using System;
using System.Collections.Generic;
using System.ComponentMod... |
I have a function that needs to evaluate some parameters to determine if they're valid or not. They all need to be evaluated individually, so I have some code like below.
#Configure widgets held in a layout
def layoutConfigurer(name, widgetType, minW, minH, maxH, maxW, flat, focus, image, position=False):
widgetTyp... |
I want to get the shortest sequence to reach a number.
Rules:
A[0] is always 1
Either A[i] = A[i-1]*2 or A[i] = A[i-1]+1
For example, if my input number is 17, my output should be 6, because
A[0]=1, A[1]=2, A[2]=4, A[3]=8, A[4]=16, A[5]=17
The following code is not working properly for few inputs, such as 15.
public... |
This is a very basic timer that can support multithreading with std::thread and std::chrono.
The timer has the classic functions: start() and stop().
The start() method creates an independent thread (if multithread support is enabled), then sleep the thread for a given Interval, then execute Timeout function. This meth... |
public class diceGame {
public static void main(String[] args) {
int dice1;
int dice2;
int count = 0;
int theSum = 0;
int lowest = Integer.MAX_VALUE;
int finalSum = 0;
int diceSum;
int totalSum=0;
while (count < Integer.parseInt(args[0])) {
... |
I've created a linked list to use it in SquareList. I've started to create a linked list based on just that. I want my class to follow the iterator pattern. How can it be improve to use vector iterator?
#ifndef LINKEDLIST_HPP
#define LINKEDLIST_HPP
#include <stdlib.h>
template <typename Object>
class Linkedlist
{... |
I'm mixing chrome.i18n into my templates as templateHelpers with Backbone.Marionette.
templateHelpers: function () {
return {
// Mix in chrome to reference internationalize.
'chrome.i18n': chrome.i18n,
instant: this.instant
};
}
and here's my template:
<% if( instant ) { %>
<img cl... |
I've been making a bot for Reddit that finds reposts (based on image MD5 comparing) and posts a small comment on the thread (that part will be later, right now it downloads images and compares MD5). If the image is original content, it will add it to its list of hashes. The source code is here. Any suggestions as to wh... |
In CodeIgniter, I have created function (helper) to populate, store and retrieve checkbox group. I just wonder if I have written code is in proper way and optimized or needs some more finishing?
Function
if ( ! function_exists('checkbox_group') )
{
function checkbox_group($checkboxes = array(), $name)
{
//... |
I am using jQuery to implement a basic quiz functionality. How can I improve this code snippet even more? Is there any better way of doing it?
I am using jQuery 1.6.4.
/*jshint -W065 */
$(function () {
var jQuiz = {
answers: {
q1: 'd',
q2: 'd',
q3: 'a',
q4: 'c... |
I have written the following function that takes an address object and builds a string using the object properties. It will later be used to display a tooltip
var getAddressTooltip = function (address) {
var tooltip = '';
if (address.MasterAddress !== undefined &&
address.MasterAddress !== null &&
... |
I am sorting 2 arrays of object like this, but I know this is very bad. Any good approach, like using each method like so? ( I tried, but using each, I am unable to return the object )
var O1 = [{'name':'one'}, {'name':'two'}, {'name':'three'}, {'name':'four'}, {'name':'five'}, {'name':'six'}];
var O2 = [{'name':'rat'... |
I have a function which verifies the "Password" field and suggests the user to enter a strong password. I also have a label named "Password Strength", referring to the strength of a password (very weak, weak, medium, etc).
I'm just wondering if there is a better way to re-write this code.
function chkPasswordStrengt... |
Recently I set about to writing conversion functions in Haskell between decimal and negabinary. I tried to write them in as much functional a style as possible, also aiming at brevity. Below I present my take at the task. I'd be interested in your refinements of the method I employ or any comments whatsoever.
These are... |
Aim: Import Excel to SQL
Potential Issue:
Wrong file type - this is handled in the 'upload' button by not allowing anything but *.xlsx files. The wrong type of Excel file (i.e. not 2003 onwards) would be good to be able to handle this as well.
Notes:
The below code does work. What I am always looking for it improvemen... |
I wrote a function split-seq-by-n which accepts a sequence and a number and splits the sequence into subsequences of length n (the last subsequence getting the remaining elements). It works on all subclasses of 'sequence, among others 'string, 'cons, 'vector etc.
;; Splits sequence into subsequences of length n
(defun ... |
The main impetus for this review is to determine if my ASP.NET Web API controller has too many dependencies. I'm of the opinion that 3-4 is okay, but 6 seems like too many. I have many controllers with similar layout. I've considered extracting all of the "PostPrimary" operations into a single wrapping dependency, but ... |
Rewrite appropiate programs from earlier chapters and exercises with pointers instead of array indexing. Good posibilities include getline(Chapter 1 and 4), atoi, itoa, and their variants(Chapters 2, 3, and 4), reverse(Chapter 3), and strindex and getop(Chapter 4)
Here is my solution:
static char *hidden(int n, char... |
I'm trying to use an object and persist it into the data base.
I created a class in the library's folder.
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Solicitud {
private $categoria;
private $consecutivo;
private $id;
private $mensaje;
private $solicitante;
... |
Can anyone please help me to simplify this form validation script? It works great but I was just wondering if I can get some help to make it simpler. Your opinion on the approach I used below is also welcome (i.e it is good or bad practice/method).
<script type="text/javascript">
var FormValidation = functi... |
This code works, but since I'm just learning Haskell I'm wondering if it could have been done in a more idiomatic way.
The main function is called tokenize, and it uses helper functions called tokenizeOne and tokenizeSeveral.
Here is the code:
tokenizeOne "" (' ':rest) = tokenizeOne "" rest
tokenizeOne str ('\\':ch:re... |
I am using a combination of knockoutJS and jQuery. I have a number of jQuery plugins which perform particular re-usable functions, such as a numeric spinbox.
I have written a binding handler to allow me to bind an observable property to the spinbox, it looks like this:
ko.bindingHandlers.spinbox = {
init: function... |
I have a class that listens to a file event constantly and reads that json file once it's created and makes of it a mail report and an excel file.
Now, I made the properties that are used for both these tasks static so I could determine their values once from the json and easily access them from all methods:
public cl... |
This is my first project I am doing in VB.NET, and also my first real programming project. There is sensitive data, so I am utilizing Microsoft's Encryption/Decryption class (clsCrypt).
For optimization, quality and best practice standards, which code the 'best' way to retrieve encrypted data from a MS SQL Server 2008... |
I think my current structure is way too repetitive. I feel like I must be missing something that would easily make this sign up wizard work far better.
<ol class="registerMeter">
<li class="progress-point" ng-click="wiz('step1')" ng-class="{active: step1.active, done: step1.done, todo: step1.todo}">Step 1</l... |
The code below finds the index of the lowest unique integer on each line of the file. The numbering starts at 1, and when there's no unique value, the 0 should be output.
The sample input looks like this:
3 3 9 1 6 5 8 1 5 3
9 2 9 9 1 8 8 8 2 1 1
And the sample output is this:
5
0
I wonder if this code can be simplif... |
I just wrote this and don't like how bulky it is, also given the fact I will have to add at least another if statement.
I was going to switch it to a case statement but wanted to check if there were even better ways to reduce the clutter.
string emailLetterPath = Server.MapPath("~/emails/rejected.htm");
if (jobApplica... |
I have the following code and it's taking quite some time to run. I'm getting an Out of Memory Exception due to the high volume of answers there are. Is there any way I could speed it up?
var controlStrings = answerControlStrings.Where(a => a.ControlN.Substring(a.ControlN.IndexOf('_') + 1, a.ControlN.Length - a.Contro... |
I'm implementing basic sorting algorithms to learn them, and coding, better. Criticisms and possible optimizations welcome.
import unittest
import random
def merge_sort(seq):
"""Accepts a mutable sequence. Utilizes merge_sort to sort in place, return
a sorted sequence"""
if len(seq) == 1:
return se... |
It all works exactly as it should. It finds data from today, finds unique emails and puts them in an array. I then check the data again from today, against the emails to total up different values. Then output those values to a sheet.
I'm sure there might be better methods to do what I wish. Such as only going through... |
Please review this code.
import java.awt.*;
import javax.swing.*;
public class Snake_Ladder {
public static void main(String[] args) {
new Snake_Ladder();
}
public Snake_Ladder(){
int i;
JFrame frame = new JFrame();
JPanel pane = new JPanel();
GridLayout experimentLayout = new GridLayout(11,0);
pane.setL... |
I have the following function, intended to take standard dice notation (XdY+Z) and return a (sort of) random number based on the input. Are there any bugs/bad ideas/optimizable sections I am missing?
function dieRoll(dice) {
if (/^[\d+]?d\d+[\+|\-]?\d*$/.test(dice) == false) { //Regex validate
return "Inval... |
After programming in Haskell for a while, I've gotten attached to a functional style. This is clearly evident in the code for my genetic algorithm.
Could you provide me with some hints as to how I can make this code more pythonic? By that, I mean provide some method of organisation rather than throwing a bunch of fu... |
I had a situation when I needed to move all array elements in circular fashion. When I say this, I mean:
0 1 2 3
1 2 3 0
2 3 0 1
3 0 1 2
The array:
var players = ["hash1","hash2","hash3","hash4"];
Players is the array that contains user hashes and their place on the table. Table is round, so array must rotate in cir... |
I've done some reading about implementing AES256 and deriving a key from a password. If I understand correctly:
I want to generate a new salt (for the key) and a new IV (for the encrypted message) for every new message.
It should also not be a problem sending the salt and the IV together with the message.
I decided ... |
I've written an implementation of a dynamic array in C, but I'm not sure if my implementation is correct... This is what I'm worried about: if I add an element, will it remain in the collection? This problem has arisen from my (apparently) limited knowledge on void pointers. I haven't found any answers to my question o... |
I've implemented a common wrapper pattern I've seen for the .NET cache class using generics as follows:
private static T CacheGet<T>(Func<T> refreashFunction, [CallerMemberName]string keyName = null)
{
if (HttpRuntime.Cache[keyName] == null)
HttpRuntime.Cache.Insert(keyName, refreashFunction(), null, DateTi... |
I created this testimonial on CodePen
I am a bit skeptical about a few things in my HTML structure. For example, I typically see testimonials enclosed in <div>s with custom classes. In my case I used a <blockquote> but had to overwrite a lot of rules.
Also wondering if enclosing the author in <strong> tags was wise.
... |
I tried to make a calculator in Java and have added some stuff. I'm a beginner and have learned yesterday how to make buttons.
import java.awt.Dimension;
import javax.swing.*;
import java.awt.Toolkit;
import java.awt.event.*;
public class JavaCalculatorCopy extends JFrame{
JPanel Panel = new JPanel();
JTextA... |
I'm working on a directed study project with a professor of mine helping him build out a Django based website. The website is a historical account of the people, events, projects, and organization in the computer graphics industry.
Since the beginning of the project (way before I started working on it) my professor has... |
I'm just starting to understand the Python syntax and I created a module that does what I wanted, but really slow.
Here are the stats of cProfile, top 10 ordered by internal time:
ncalls tottime percall cumtime percall filename:lineno(function)
1291716 45.576 0.000 171.672 0.000 geometry.py:10(barycen... |
This is my take at the current code-challenge, Ultimate Tic-Tac-Toe, at least the presentation part.
As I chose to write a WPF application for my game, and this is my very first time fiddling with a UniformGrid and ItemsControl, I'd like to know if I've done any beginner mistakes.
MainWindow
<Window x:Class="TicTactics... |
I'm using meteor and angular. Since I can't add modules after the angular bootstrap, I made a workaround and somewhat not satisfied with the way it was coded.
How can I improve this?:
(function() {
var controllers = ngMeteor.newControllers,
filters = ngMeteor.newFilters,
directives = ngMeteor.n... |
I am having a huge brain fart with efficiency right now.
The idea here is if I have a static table (unfortunately formatted this way with the data I've received), how would I appropriately append a select option dropdown with every value from the table categorized easily?
I currently have it working, but it seems as if... |
This is my take at the current code-challenge, Ultimate Tic-Tac-Toe.
It all started with a CellValue and a BoardPosition:
/// <summary>
/// Identifies the players, or the possible values a cell can take.
/// </summary>
public enum CellValue
{
X,
O
}
/// <summary>
/// Identifies the possible board positions.
//... |
While I should probably be using Dependency Injection via Ninject or a similar project, I have been attempting to implement an abstract factory design that would provide me with the following easy to read and use syntax:
UniversalFactory.Factory<IFoo>.Create<FooImpl>(... parameters ...);
I'm throwing this experiment o... |
I've written a solution to Euler 41:
We shall say that an n-digit number is pandigital if it makes use of
all the digits 1 to n exactly once. For example, 2143 is a 4-digit
pandigital and is also prime.
What is the largest n-digit pandigital prime that exists?
But it feels like I could compress the code down inst... |
This is my attempt at the Ultimate Tic-Tac-Toe code challenge.
It uses jQuery to build out the game grid and find the states of all the "buttons" (actually <div>s) when calculating whether or not someone has won an individual board or the entire game.
This version follows the recommendation that a filled board that is ... |
I am creating an application in Java that runs at scheduled intervals and it transfer files from one server to another server.
For SFTP I'm using jSch, and my server and file details came from Database.
My code is working fine but its performance is not good because I'm using too many loops in my code.
Is there any way... |
I wrote Clojure code which takes named params and has to generate 2 .csv files as output.
Please review it.
(ns my_cli_clojure.core
(:gen-class :main true))
(require '[clojure.data.csv :as csv]
'[clojure.java.io :as io]
'[me.raynes.fs :as fs]
'[clojure.tools.cli :refer [cli] :as c])
(defn write_csv_d... |
Is there anything that can be done to improve this code? Even if its using a comepltey different technique.
This code gets a list of vanruns with rules, cutoff time and fittinging time offset. We pass in the date (either now or for future that works out the best vanrun time) We want the latest cutofftime in that day fo... |
I'm preparing for an exam on C++, as part of my preparation I want to implement a generic map without using anything from the STD for educational purposes.
Before jumping into implementation of everything, I want to know that the skeleton for my Map is solid and I use templates and template inheritance correctly.
Above... |
Generally, UI code is painful and full of kludges (at least, mine was like that). Recently I have decided to put an end to it and try to learn how to write good and reusable UI code.
So here is the pattern (in a general sense of word) I came up with when subclassing UIViews:
Subviews are properties and are initializ... |
I've been a procedural PHP programmer for a long time but I'm getting to learn OOP and would like some advice. I'm designing a class which currently is composed mainly of simple getters/setters, but I'm not quite sure if I'm designing my class in the best way possible.
The getters require accessing a database to pull t... |
Would it be better to convert the array in the following code to
$langs = array("en", "de", "fr");
and then reusing the values for both $folder and $flag? If so, how then would my foreach (or maybe a while?) loop be written?
<?php
$langs = array(
"en/" => "en.png",
"de/" => "de.png",
"fr/" ... |
This is another entry for The Ultimate Tic-Tac-Toe review.
My design criteria were:
A DLL which encapsulates the data, i.e. the game state
Don't include the GUI, nor the decision-making (game-playing) logic
Be careful not to allow corrupted state
Make it as small (few lines of code) as possible
Here's the DLL code:
u... |
I recently got rejected at a job interview for submitting this:
https://bitbucket.org/gnerr/password-validator
The interviewer asked for a password validation library that was configurable via Spring, with the following default validations:
Must consist of a mixture of lowercase letters and numerical digits only, wit... |
Runs smoothly, however valgrind is showing "possibly lost: 544 bytes in 2 blocks".
This is my first time doing a lot of things here so I might be making multiple mistakes.
Please let me know if anything needs to be fixed, or if I should just do something completely different for whatever reason.
/* protosynth
*
* Thr... |
I am practicing for interviews and I tried solving the problem on my own and got a solution. I was wondering how can I improve the performance and memory on this program?
The problem performs addition on linked list nodes. The nodes are 1s->10s->100s->.... The goal of this program is to perform addition on two of thes... |
I have tried to write a function like memcpy. It copies sizeof(long) bytes at a time.
What surprised me is how inefficient it is. It's just 17% more efficient than the naivest implementation with -O3. With optimizations off it's a lot faster than the naivest, so perhaps the compiler is doing this automatically?
It will... |
I have created a script for going a multiple select option in Angular without using a select box that you have to hold control in order to select multiple items.
Demo: http://jsfiddle.net/qwertynl/xfw9f/
Code on GitHub
Here is my code:
Javascript:
var switcharoo = angular.module('switcharoo', []).directive('multiSelect... |
I tried to make the code for implementation of first-come first-serve job scheduling algorithm as used by operating systems.
How can I make it better?
I am using turbo C++ compiler
#include<conio.h>
#include<iostream.h>
#include<dos.h>
struct process//contains information about processes in waiting queue
{
int wait... |
A week ago, I have asked how to simplify a form validation. From the answers, the code now is improved. Can anyone please share their opinion on the approach used below and advise me if there is a better way to cut it?
//Create object to hold the different error messages
var errorMessage = new Object();
errorMessage.... |
I have the following code which I have written due to the fact the Microsoft's Sanitizer is now to aggressive.
What I'm trying to do is as follows.
Create a whitelist of HTML tags I want to keep
After the tags have been converted, run the text through the sanitizer and remove any tags I do not require.
After that, rem... |
I've got some pretty simple validation that I'm working on, but it seems like I'm repeating myself a bunch of times. There has to be a better way of doing this. I'm simply checking if there is a value filled in for specific fields and apply a color if the value isn't filled in. There are also other areas where the vali... |
I wrote this code to clean up some of the space on our file server. We've got 15 years of legacy data that nobody accesses or changes or cares about that we have to keep regardless. I'd rather have it not sitting on our main file server so that I don't have to add an additional TB to it annually. This script goes throu... |
I wrote this prototype after reading the Wikipedia article on hooking. I didn't bother to read any of the code examples listed there because, well, I just didn't. I don't have a good excuse.
The documentation in this file should tell you enough about its purpose and intended usage. I'm looking for a confirmation of ... |
I am creating a blog concept with this layout on CodePen
Here is my current code in development
<article class="post">
<h2>Skating Down Venice Beach</h2>
<img src="http://s1.favim.com/orig/20/skate-skateboard-skinny-jeans-vans-Favim.com-205640.jpg">
<a href="#" class="readMore">
<i class="fa... |
Recently I am working on batch to make a very simple command line interface.
The code looks like this:
@echo off
echo Simple command-line interface
echo.
:input.get
set /p input="COMMAND\>"
set input5=%input:~0,5%
if "%input%"=="something" goto something
if "%input5%"=="echo " goto echo
:echo
set content=%input:~5%
ec... |
I've tried to take the shortest, simplest path to a C# solution to the Ultimate Tic-Tac-Toe challenge. This implementation plays in the console. I admit the game logic could be hived off into a separate method, but I'm not sure that would be an improvement. I also admit that the fields should be tighter than public,... |
Instead of creating an Admin_Controller or MY_Controller I was going to try and just try out all my controllers on requirements that are needed per controller. I know this may seem like additional work but then after which I want to go back and fix it all. I wanted to know how my login looks as of right now?
I'm gettin... |
I saw somewhere on here that it helps reduce spam by adding a dummy input field that you hide with display: none, and like if it's filled out, then it's obviously a bot sending the message. Well, I did something kind of like that but initially set it to = 0. So if it's not 0 then it doesn't send the form, since a bot ... |
I have created an MS Excel type of grid in jQuery. I want to learn best practices and I need your comments for more optimized code.
Please review the code and offer your suggestions.
Demo
jQuery:
var JS = JS || {};
JS.training = JS.training || {};
JS.training.tableData = JS.training.tableData || {};
JS.training.ta... |
This maze has multiple entry points, and quite obviously multiple exits. The entry or exit is not provided at input. Of the multiple sources and destinations, any single path from any source to any destination should be returned. The path need not be the optimal or shortest path.
I'm looking for code optimization, g... |
Please review the following code:
static int md5_encode(const char * input_md5 , char * output , int size)
{
// checking pre-requisits //
if( output == NULL || input_md5 == NULL || size == 0)
{
printf( "main.cpp:md5_encode() error check for the prerequisites. \n");
exit(0);
}
int input_length = str... |
I am working on a micro project: a Haskell DSL for describing circuits.
(You can find the code here)
I'm pretty happy with everything so far, but there is an ugly function alu32:
alu32 c0 c1 c2 a b =
let aluc = alu1 c0 c1 c2
(out0, cout0) = aluc (a !! 0) (b !! 0) c0
(out1, cout1) = aluc (a... |
In JUnit 3, I cannot tell JUnit what type of exception is expected. In JUnit 4, the declaration @Test(expected=NullPointerException.class) does it.
But, unfortunately in Android development, I can use only JUnit 3. So I wrote this simple method:
public class TestingUtils {
public static void assertExpectedExceptio... |
I'm trying to develop code to filter my e-mail with JavaMail, but I doubt it's the best way of doing this. And I want to collect all messages without attachment.
package service.forkinjoin;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.RecursiveAction;
impo... |
I'm working on a small command line application in c# where data is read from a CSV file along with a query and KNN is calculated for the query based on the data.
My problem isn't the algorithm at all, I understand it. Im having difficulty working with my code though. I think it's down to bad planning.
Here's my object... |
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
typedef uint8_t byte;
typedef struct
{
byte i, j;
byte S[256];
} Rc4State;
void swap(byte *a, byte *b)
{
byte temp = *a;
*a = *b;
*b = temp;
}
/*Initialization & initial permutation
also initialize i&j counters in state for stream genera... |
Suppose I have the array:
double[] arrayToCut = new double[100];
for(int i = 0 ; i < 100 ; ++i) {
arrayToCut[i] = Math.random();
}
My objective is to end up with two arrays, firstArray and secondArray. firstArray is equal to (for example);
double[] firstArray = new double[50];
for(int i = 0 ; i < 50 ; ++i) {
f... |
I have 2 tables as below:
Downtime
DowntimeCode
I am then doing this to get the Description field from the DowntimeCode table for the DowntimeCode with the sum highest value in the Downtime table for the current date and a specified line:
public string TopCodeForToday(string line)
{
var date = DateTime.No... |
I am brand new to C++ and am working with the Arduino micro controller. The project I've been working on for my university requires me to write code to do the following:
If the ultrasonic sensor detects a distance within a certain range, output HIGH to activate an electric motor
If the sensor detects distance outside... |
Aim: To have only one of each character on the Return string:
Public Shared Function CheckForDuplicates(ByVal vCharCheck As String) As String
Dim vDeDuplicated As String = ""
Dim i As Integer
For i = 1 To vCharCheck.Length ' Count length of string
'vDeDuplicate is blank to start so will always ca... |
So I developed some code as part of a larger project. I came upon a problem with how to match paragraphs, and wasn't sure how to proceed, so I asked on Stack Overflow here. You can find an in-depth description of my problem there if you're curious.
Just to be clear, I am not reposting the same question here to get an... |
One of the books I'm currently reading to learn C# asked me to write a method that takes an integer between 1 and 99999 and displays each number in that integer in a sequence, separating each digit by 2 spaces.
For example: the int 87564 would be written to the console as 8 7 5 6 4.
This is simple enough to do using th... |
I want to draw the table like this:
6³ = 3³ + 4³ + 5³
9³ = 1³ + 6³ + 8³
12³ = 6³ + 8³ + 10³
18³ = 2³ + 12³ + 16³
18³ = 9³ + 12³ + 15³
19³ = 3³ + 10³ + 18³
20³ = 7³ + 14³ + 17³
.....
100³ = 35³ + 70³ + 85³
I've tried this:
$start = microtime(true);
funcC(100);
echo microtime(true) - $start;
function funcC($n){
... |
If one does not know tilt maze then the game looks like this. Basically one can travel in 4 directions North, East, South and West, but this travel's endpoint is the furthest non-obstructed block. If solution has multiple routes, then the any single solution is returned which need not be optimal.
Please verify complexi... |
In order to complete one of my assignment I needed to include a quicksort so I was wondering if this is correct and acceptable.
The code:
private ArrayList<String> sort(ArrayList<String> ar, int lo, int hi){
if (lo < hi){
int splitPoint = partition(ar, lo, hi);
sort(ar, lo, splitPo... |
I am trying to create simple registration form with Backbone. I need to validate fields on blur, and whole form on submit.
HTML:
<form>
<div><input name="name" type="text" placeholder="Name"/></div>
<div><input name="surname" type="text" placeholder="Surname"/></div>
<div><input name="email" ty... |
To download the tool and for usage instructions, see the follow up to this question
Description
I have realized that there's a whole bunch of code I want to have reviewed, but copying file by file, selecting the code and pressing Ctrl + K is a slow process, and I want to remember which other parts to include in my que... |
I looking over some old code, I had written the function below with a C-style for-loop iterating over a count variable. I then fixed it up with new knowledge, but still am suspicious that there is even a better way to do this.
The function should behave like so:
>>> join_list(['a'])
'a'
>>> join_list(['a', 'b'])
'a or ... |
What I'm doing?
I'm creating a member-list where initially only the names are visible. Clicking the names reveals the member information. This is done with jQuery by adding/removing classes.
I left out the CSS with the transitions for this review.
HTML:
<ul class="block-list member-list">
<li>
<a href="#" ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.