instruction stringlengths 71 71.9k |
|---|
As I was writing my first part of my Chess question, I realized that I couldn't fit all my code into one question (I exceeded the character limit), so I will continue here.
The pieces all share the same structure, and I had to have a way of storing them together, so I created the Piece interface:
import java.util.List;... |
This is from one of those online test sites, so the result had to be contained in a single class.
The problem was stated as follows:
Your java method will be given a 2-D array trip[n][2] of strings,
representing a travel log for a group of people. For each 'n',
trip[n][0] is the name of the person and travel [n][... |
Please consider the following three tables that I am playing with in the image below:
I want to come up with a SQL Query which shows first_name, last_name, and the total amount of all orders for customer_id 12345
Here is what I have come up with:
SELECT C.first_name , C.last_name,
SUM(O.total_price) AS TotalAmo... |
I've been working on learning Java and this was a challenge as part of a chapter on data types:
Create a program that computes how far away, in feet, a listener is
from a sound. Sound travels approximately 1,100 feet per second
through air.
You can also compute the distance to a large object, such as a rock
wall... |
Note -> Follow-on question posted here: YAuB - Micro Benchmark Follow-on
I recently answered this Beautiful String question, where the task is to maximize the value of a string by assigning each character a different value (from 1 to 26) in a way that the sum of all characters is maxmized.
A number of different solut... |
I am working with a some small functions to test recursion. I am fairly new to Python and am wondering if there is a cleaner way to get the job done.
def count(t,p):
''' recursive function when passed a binary tree (it doesn’t matter if it is a
binary search tree) and a predicate as arguments; it returns a co... |
I am writing a small class that has one method: get_state. It is parameterless and returns a dictionary of all the names in self (look in its dict) that are not bound to function objects (test functions by using inspect.isfunction on the objects). When a class inherits from Dumpable, its instances can call get_state() ... |
The AsyncWorkerQueue class uses TPL Data Flow and Rx to async process and cancel work in a queue. It takes in a worker factory (Func) and executes it when its turn (or not if its scheduled to be canceled).
public class AsyncWorkerQueue : IDisposable
{
private TransformBlock<TaskFactory, TaskFactory> Worker { get; s... |
I just completed a Codility test. The question presented was pretty simple but I may have over thought it.
Question:
Find the element which has the highest absolute deviation from the mean. E.g. Array = [1,1,-1,1].The average is 0.5, so the absolute deviation for each element in the array is [0.5,0.5,1.5,0.5] (note t... |
Input: ArrayList of ArrayLists with email ids.
Output: Return ArrayList of email ids which appears in each inner ArrayList.
Ex: Input: [[abc@gmail.com, bca@gmail.com],[abc@gmail.com,bca@gmail.com,bca@gmail.com],[abc@gmail.com,xyz@gmail.com]]
Output: [abc@gmail.com]
I have written the code using HashSet and HashMap and ... |
I have a basic webapp that basically serves the same purpose as Rubular.com, but for gsub.
It runs some simple JavaScript, which POST's to a Sinatra app, which then updates page with the results.
index.haml
%h1 Gsubular
%p It's like Rubular! But for y'know...Gsub!
#gsub_div
%h2 Gsub-ed String:
#gsub_answer
%form... |
I have written a program that generates all possible numbers which can be represented by adding 2 cubes which have value less than N
For example: when \$N = 10, 1^3 + 2^3 = 9\$
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class AllNumberLessThanNasCubes {
public static void ... |
I'm writing a small tool that allows to manually protocol dial-in-actions. That means a user can say he dials in to a site or he dials out of a site. (What this means is not important for the sake of this software.) These action are stored as plain JSON text with automatic backups. The communication with the front end ... |
I know people on SO/SE are a bit butthurt that no one knows where to asks the questions, so I hope this thread somehow fits into this sub forum ;-)
If i have to check if a value in my django model is set (!= None) i do it like this:
if not model.fiel:
model.field = some_logic()
It feels pretty pythonic but i hones... |
I have the following as my Ajax / PHP contact form on a site I am building. I have sanitized the inputs but just wanted to make sure I havent missed anything...
// Only process POST reqeusts.
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get the form fields and remove whitespace.
$name = strip... |
I'm creating a command-line tool which is supposed to work on both Windows and Linux OS. It will be used to manage our application - start, stop, deploy etc.
We have it in bash scripts now (and it works very well for about 6 month), but I want rewrite it in Python with classes.
It's big enough, so here are only a few m... |
I've put together a function in Delphi XE7 which returns the Dropbox directory path on my machine, as this path can be customized by the user.
This function currently works on my computer, but it could have many defects preventing it to work for other users on different machines. So I would be very grateful if anybod... |
I've just finished this function and wanted to know if anyone know another way to do the same:
function findtext(archivo,Delimit1, Delimit2 :String) :String;
var
Buffer :AnsiString;
ResLength :Integer;
i :Integer;
PosDelimit :Integer;
begin
Buffer := read_file_z(archivo);
if Pos(Delimit1, ... |
I have implemented a solution to the Potter Kata. Basically, there are 5 different (types of) books, and the buyer gets a discount depending on how many different books he has bought. Multiple instances of the same book (type) don't get a discount.
The discount values are the following:
2 different books: 5%
3 differe... |
I need to observe a ConcurrentQueue, but to minimize the resources I want to pause the Thread if the Queue is empty and resume it from another Thread if there is a new Entry in the Queue. I implemented a pausing and an resuming of a thread like this:
My Worker, where the DoWork() method is called in a new Thread, looks... |
Background
I have a situation where I have fixed number of objects with their own routines that would need to be called with the same initial message.
To accomplish this, I have a Factory that binds objects to a Composite object whose main method is to call methods on its subordinates without having to know how many i... |
This code works but I'm not really sure if I wrote it good enough. It seems a bit vague but I can't really assess it properly. I'm particularly concerned with the xAxis variable. I don't like how I have to initialize it inside the first loop. I would rather have it next to yAxis. Is this a problem?
float yAxis = SPACE_... |
I have a function like this:
BOOL CGameData::GetCheckSum(BYTE o_byObjCheckSum[32], int *o_pnFileSize, char* pFilePath)
{
memset(o_byObjCheckSum, 0x00, 32);
*o_pnFileSize = 0;
UINT uiCheckSum = 0;
if(strlen(pFilePath) <=0)
{
return FALSE;
}
FILE *fp;
fp=fopen(pFilePath, "rb");
if(NULL == fp)
{
return FALSE;
}
fse... |
I have two separate lists both sitting side by side. How can I refactor the code below to only have one filter function for both lists?
$("input.filterInput").keyup(function() {
filter(this);
});
function filter(element) {
var value = $(element).val();
$(".pdfList > li").each(function (){
if ($(t... |
Given the code below, is there a better way to essentially create different native objects without changing the native constructor or the nativeList.json file? The only option I can see is adding a String nativeType variable to the constructor and creating the native object based on that the type passed. So to create a... |
I am interfacing with a network device and must read a response after I issue a command. Sometimes when I attempt to read, nothing has been returned from the terminal. This means I must wait, but not forever, right?
My solution: Enter a loop with a time comparison guard (time elapsed since start). Then inside, I will c... |
I'm new to Ruby and as an exercise I implemented different factorial algorithms. Other rules are: raise an ArgumentError exception if n < 0 or if n is not an integer.
I'm interested in whatever feedback you can think of, including Ruby idioms (can something be implemented more idiomatic?). If you see anything that can ... |
I'm still working on a parser that can parse log entries from a game called HearthStone, the overall idea is that it will read the log file live when the game is running, parses the log file and show interesting and useful data in real time.
The focus for this question is to load the card data from JSON files, as can b... |
I'm creating a simple function to verify whether or not a string is a palindrome, and must use stacks in solving it.
bool isPalindrome(string word) {
// #1 determine length
int n = word.size();
// #3 make sure we have an even string
if (n % 2 != 0)
word.erase(0, 1);
// #2 load the stac... |
The code I have now is currently working, but I'm looking for ways to optimize it, and really, to just get any feedback.
I'm implementing this code through Ensighten (a tag management platform) as a custom javascript tag. Ensighten works by injecting tags either sync or async scripts on to a page. I've set this tag to ... |
I've created a program which recreates the Queen Ann's Lace fractal. However, when the amount of points that are being plotted increases, the points are plotted way slower. Is there any way to make it so that I only add a point, instead of adding a point and repainting all of the others? I've looked everywhere for an a... |
In my answer to this question, I wrote a new solution. Personally, I would not use a stack, but given that a stack was required, how good is this solution?
In this solution, I add half of the word, not including the middle character if applicable, to the stack and remove it from the string. If there is a middle chara... |
I have created a space encoder program, because it is fun to generate invisible messages. (This programme is not cryptographically secure, it is just for fun)
import doctest
def to_spaces(text):
"""
Each char with ASCII code x gets converted to a
line of x spaces.
>>> to_spaces('a').count(' ')
97
... |
For my third assignment in CS2, I was given the following:
A set is a special bag that does not allow duplicates. Specify each
operation for a set of objects by stating its purpose, by describing
its parameters, and by writing preconditions, postconditions, and a
pseudocode version of its header. Then write a C+... |
I am working on an interview question from Amazon Software. The particular question I am working on is "to write a program to find \$a^n\$."
Here is my recursive solution to this problem (in Java):
int pow(int a, int n) {
if(n == 0) {
return 1;
} else {
return a * pow(a, n -1 );
} ... |
I've created some methods to help me convert PDF to text and then text to a JSON object. I've never done this before and I'm using this exercise as a way to improve my knowledge of Ruby.
The following code does what I want, it works. It just returns a very ugly object. Right now I'm trying to craft some regular expres... |
I am new to programming and want to know if this is really bad code. I know my variable names may seem arbitrary but I spent some time trying to get them right. I am struggling on that. Would you do this the same way?
#include <stdio.h>
#define MAXLINE 100
void printHistogramHorizontally(int alphabetofline[]);
int ma... |
This is a very lengthy class called Particle, it relies on two other headers, one of them is a simple struct which contains an x and y (Vector2), and the other header gets a material's properties (materialProperties.h). The class is no where near done, and I am struggling to get my collision detection function to work.... |
This code fragment from 2009:
#include "../asklib.hxx"
std::vector<AskBase*> questions;
AskUI<std::vector<AskBase*> > ui(questions);
ui.add(new Ask<std::string>("Enter your name: ", 3, 25));
ui.add(new Ask<std::string>("Enter your city: ", 2, 25));
ui.add(new Ask<std::string>("Enter your state: ", 2, 2));
ui.add(new As... |
I was creating a program and I was trying to explain it to some of my coding friends. They commented that it was too tedious typing out all the "if" commands. How do I streamline this code?
Note: this is a ".bat" program.
Waiter.bat
@echo off
set /p Food="What would you like to eat? "
if /i %Food%==pizza findstr "Pizza... |
I did a few times ago what I called a plasma in plain JavaScript:
jsFiddle
The idea is to use 2 oscillators (LFO) which have their frequency + phase driven by two oscillators each. Then we use those 2 main oscillator output to decide of the r, g, b of each point.
To test the quite new API asm.js, I've ported it to be ... |
I'm working on graph mining, so I'm trying to find the best library to do that.
I've read in here that "graph-tool" is faster, so I tried the same program who count the duplicated graphs (I call them frequent in the program) in networkx and graph-tool.
The graph are in this .txt file:
t # 0
v 0 0
v 1 3
v 2 9
e 2 1 68
... |
I was asked to code a solution in Python in 15 mins. Print all possible word combinations for a given phone number. Numbers 0 and 1 will not be part of the phone number, the numbers can be repeated, phone numbers can be of any length.
For example if the number is 245:
All combinations of 'ABC', 'GHI' and 'JKL" is:
['AG... |
Following some great advice here from Simon, I realized that I had over-engineered things, and that the Task builder methods were a horrible Java8 abstraxction. In Simon's words: "From a usability perspective, this is a bit weird...".
After messing with things a bit more, the original use-case like:
uBench.addTask(Tas... |
Here's an implementation of Hangman using Java 6. I've split the code into 2 classes - a logic class & a gui class. Is it ok to have so many static member variables? Please let me know if there are any design improvements that I could make.
Hangman logic - main class
import java.awt.*;
import java.io.*;
imp... |
Before I get started, I feel I need to list the following.
I am not looking for an existing DI or Framework this is a personal project to shift from procedural to oop programming.
Tear this apart. I am trying to learn the latest best practices i do not want to be stuck creating broken code for future builds/projects.... |
Given points on a two dimensional graph, find a line that passes the most number of points.
Any comments please?
import static org.junit.Assert.*;
import java.util.*;
import org.junit.*;
public class Solution {
public class Point {
double x_coord;
double y_coord;
public Point(double x, double y) {
... |
I am using jQuery UI Tabs for a web application and I would like to navigate thru different tabs with these four buttons:
next-tab: takes you to the next tab
prev-tab: takes you to the previous tab
preview-btn: takes you to the preview tab (a specific tab or the last tab)
back-btn: takes you to the last active tab fro... |
Release 1.1 of Rubberduck only had a handful of implemented code inspections, more as a proof of concept than anything else. For release 1.2, we now have 19 implementations of our IInspection interface - here is what happens when the user clicks the refresh button on the Code Inspections toolwindow:
private void Refre... |
I've been asked to create a bubble sort function that checks whether the array has been filled sorted before all passes are complete, thereby avoiding unnecessary passes. This is to involve "remembering" the last sort.
Below is the code I have for just a normal bubble sort that goes through all passes, and is quite in... |
I have started a project in PHP with PDO and I'm almost done, but I've read somewhere that PDO escape alone is not secure and we have to consider some settings of PDP. I am a little confused about my PDO class and usage.
public function __construct(){
//set DNS
$dns = 'mysql:host=' . $this->host . ';dbname=' . ... |
It is meant to be given strings over time and output all NewLine delimited substrings. The ColumnReader is meant to be a solution for Delimiter-separated-value files, like CSV or TSV.
using System;
namespace fbstj
{
public sealed class LineReader
{
public string NewLine { get; set; }
string _b... |
I'm working on a tool to import data from one database to another. One requirement is that I have to split a string from one source field into three (shorter) fields at the target. If possible the string should be split at a space character. If the string doesn't fit completely into the target fields, the rest can be o... |
Given a string, this code
Multiplies odd numbers
Subtracts even numbers, do nothing if only one even number is found
Turns uppercase letters to lowercase and vice versa
I think this code is too long for those operations. There are certainly better ways of doing this. How can I make this shorter, better and faster? An... |
I am trying to learn DFS and BFS. However, I just want to make sure that I am not doing anything wrong. Would you please determine if the BFS and DFS functions are correct?
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
using namespace std;
class Graph
{
private:
int num_of_vertices;
v... |
I've recently been fiddling around with a type safe implementation of cartesian co-ordinates (and a few operations on those co-ordinates). Often it's easy to get units mixed up: is something in metres, or in some other unit?
The idea for this code is to provide a framework to catch all such errors at compile time. This... |
I'm working on a small custom backend app in PHP for personal use (and practice MVC) and I thought it was a nice opportunity to try (and learn) requirejs to 'organize' my scripts and load just what the page needs.
I wrote some lines just to test its functionality, and works pretty well... but I've been wondering if thi... |
The branches I need to merge are called test and test-passed. Merging will always be fast-forward, from test to test-passed as commits to test-passed are only done automatically from test. This is currently working, just wondering if the approach is correct. The script is executed by Hudson, once all testing is complet... |
The following pascal function (compiled with Delphi) will split strings. It works perfectly, but how to improve the code? For example, to avoid using the repeat-until loop.
type
TSarray = array of string;
function Split(Texto, Delimitador: string): TSarray;
var
o: integer;
PosDel: integer;
Aux: string;
begin... |
I have a component that I want to render with certain styling based upon the props that it will receive. I'm currently defaulting the prop types, and then creating the styling at render as such:
getDefaultProps: function(){
return{
size: "small",
shape: "rounded"
};
},
statics : {
function getShape(shap... |
I have created this unit containing a class derived from TXmlIniFile. This class uses the common TCustomInifile methods to write to and read from an XML file. It comes from an idea of Chris Rolliston from his book "Delphi XE2 Foundations" (which I warmly recommend):
unit PAXMLIniFile;
interface
uses
System.SysUtils... |
It works, but it seems a bit long winded. I'd like some critiquing.
#include <stdio.h>
#include <stdlib.h>
struct node
{
int data;
struct node * previous;
struct node * next;
};
struct linked_list
{
struct node * first;
struct node * last;
};
struct linked_list * init_list(struct node * node)
{
struct l... |
The code reads an input with numbers and find the sum with the minimum difference of the first two big numbers. The sums are three.
Is there is any way to make the code cleaner? (Note that I don't need to take any restrictions such as NULL parameters, etc)
Moreover, there is an int in my program pA = -1 with that value... |
I want to write a library to parse any valid or invalid HTML-like things. First of all, I am trying to build a lexer. Here is what I did;
/* A html lexer */
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
void *memcpy(void *, const void *, size_t);
#define TOUPPER ('a' - 'A')
/* This lexer is UTF unaw... |
My goal is to find the sum of the exponents of the prime factors of an integer.
I wrote the code below with the complexities specified here (I am not 100% sure of the complexities though):
Runtime complexity:
findPrimesSmaller: \$O(n \log(\log n))\$
exponentInDecomposition: \$O(n)\$
primeExponentsCount: \$O(n^2 \log(... |
I am writing a method to create a folder tree. I am getting the data from a database and creating the list of nodes. Is there a way to get the method to execute quicker? Perhaps using parallel task library?
Each node looks like this:
public class Node : INode
{
public int Id { get; set; }
public int? ParentId {... |
I'm a very inexperienced VBA user, I've just created my first "For Each" loop but it's very slow. I'm happy that it works but eager to know if there is a alternative method that is quicker. Any advice would be appreciated but please bear in mind my inexperience!
My routine takes two variables "UserSelectionMin" and "... |
I'm trying to write clean code, but I'm not so good with exception handling.
How can I improve this method? Or is it good enough already?
This method gets a hash from a file.
public String getLatestHash() {
String hash = "none";
URL packURL = null;
try {
packURL = new URL(ConfigManager.get("play_ur... |
I have a section of code that I've been attempting to clean up and hopefully speed up. The section of code where I pass values in order to generate a key and update a table on a different sheet I think is my biggest problem. However I would like any suggestions/modifications to clean this section up first.
An overview ... |
I wrote a small program that collects the server status, caches it for a certain amount of seconds, and then sends that to a mothership server. It's broken down into a few pieces, starting with main.py, config.json, and a few small 'libs' to keep things visually separate:
main.py
#!/usr/bin/python
import os
import sys
... |
I have something like a generic build script for a group of projects. I am using Fake but my F# skills are pretty bad. Would you please take a look and point where I can improve it?
ORIGINAL
#I @"./bin/tools/FAKE/tools/"
#r @"./bin/tools/FAKE/tools/FakeLib.dll"
open System
open System.IO
open Fake
open Fake.Git
open F... |
This is my first open source release and I'd like to get some feedback on my code styling/organization. Implementation tips are appreciated as well.
The code is for an AngularJS select box that allows you to select from a list of values, or enter in free text.
The control can be configured to:
compare against an attr... |
I am currently taking a computer science class in high school, and it is my first time programming (2 weeks since I started). I have currently finished my program; however, there were a few details that bothered me. I was supposed to create a program which can calculate average of individual marks and then calculate al... |
I have created a simple Pseudo "Sieve of Eratosthenes," for a class in Java. I am looking for the most optimized option, or at least an option that is more optimized than current. If there is any other advice that you have to offer, I would be more than happy to hear that as well.
import java.util.*;
public class Siev... |
I wrote the following implementation of a Vector in Java. I was wondering what you folks thought of it.
package space;
public class SpaceVector {
private final double x;
private final double y;
private final double z;
public SpaceVector(double x, double y, double z){
this.x = x;
this.... |
I'm relatively new at programming in general including Python. But I've tried to create a program in Python that alerts users through a pop up window to perform an action every 2 hours.
import time
import ctypes
count = 0
print "This break message was sent on "+time.ctime()
messageBox = ctypes.windll.user32.MessageBo... |
I have implemented the following in order to handle JS XHR requests coming from HTML pages. Is there a better way to do this with OWIN?
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseFileServer(new FileServerOptions
{
FileSystem = new PhysicalFileSystem(st... |
I have the following table:
<table>
<tr class="rowUpdate">
<td>Corredor</td>
<td>Id Corrdor
<input type="text" value="dfdfgdf23231fg" class="validate" name="idcorreo" />
</td>
<td>Nombre
<input type="text" value="rertretert" class="validate" name="nombre" />
</td>
<td>Email
... |
I wanted to get some criticism for the below ADT. This is just a basic ADT that will be fed into a TVM calculator. Main purpose is to have it initialized and correct for input errors.
Full disclosure: I am modeling it after Code Complete 2 guidelines. You should notice if statements stating nominal cases first followed... |
I'm looking to optimize a simple sum calculator used in Project Euler+. The premise is simple: Find the sum of all the numbers divisible by 3 or 5 under X.
At first I did it like so:
def main(testCases):
final_answer = []
for x in range(testCases):
answer = 0
test = long(input())
for num... |
I have a server which has a permanent state which has to be saved on stable storage. It is composed by three fields:
List<LogEntry> log
int currentTerm
int votedFor
They have to be set during the server setup (in other words, when the server object is created). Every time that I update their "volatile" value, the re... |
I am generating a searchable and sortable data table using bootstrap. All works fine.
I am looking for the best approach to get it. Can anyone can please update/suggest the right way, if you find anything better?
jsfiddle
var tableMaker = function (columNames, parent, data) {
var table = $('<table />', {
id... |
I wrote a quick prefix tree implementation. I know it may be far from perfect, but I need to make sure that I got the basics right.
My main concerns are:
Have I settled for the correct data structures?
Is this a scalable solution? What sort of problems can I run into if this is a huge tree?
public class PrefixTree {... |
My task is to write a program to store files in object store. One of the subtasks requires to send json or xml format response to the file uploader/downloader as requested by client.
The following rules must be followed:
entry
+-------------------------+... |
I working on a calendar app on Android, using roomaorama, which is nice.
I am fetching all the events from Events table in Calendar provider once which seems not good performance wise.
The library uses a infinite view pager. It uses 4 adapters to display dates.
CaldroidGridAdapter adapter0 = getNewDatesGridAdapter(
... |
In reply to previous question I rewrote ColumnReader and would like more suggestions
using System;
namespace R2D.IO
{
public sealed class LineReader
{
public string NewLine { get; set; }
string _buffer = "";
public void Parse(string text)
{
_buffer += text;
... |
I have this JSFiddle that generates a random number of progress bars then assigns a random number and percent to them.
I am wondering if you know how to better optimize this code to have better run-time.
/*Creates a random amount of bars*/
function runBars() {
var start = new Date().getTime();
/*Sets the max... |
I want to optimize my code for performance and fine-tuned logic.
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Collections;
import java.util.Comparator;
/**
* Created by ShrivasA on 1/30/2015.
*/
/* Take an Element and Apply the following condi... |
I'm doing a program in Delphi, writing in all kinds of files, either text or executable:
var
openfile: TextFile;
begin
AssignFile(openfile, 'test.exe');
Append(openfile);
WriteLn(openfile,'[test]hi world[test]');
CloseFile(openfile);
end;
How can I improve this?
|
I have this "generic" implementation of an array-based FIFO-queue. As I have written very little code in C, I don't have an idea what to ask, so feel free to tell anything that comes to mind.
array_queue.h:
#ifndef ARRAY_QUEUE_H
#define ARRAY_QUEUE_H
#ifdef __cplusplus
extern "C" {
#endif
/**********************... |
Below is a snippet of code of a little practice project. I am still pretty new to EF and I was wondering if there is a way to write the below statement so that all required data is eager loaded since I have the ID parameter.
public ActionResult Index(int? id)
{
var viewModel = new InstructorIndexData
... |
This program connects to Soundcloud and turns the supplied username into a CSV file with the user's like list. The code accomplishes this although it looks rather messy and was wondering what I could change to improve it.
import soundcloud
import urllib.request
import json
import requests
client = soundcloud.Client(cl... |
In the current project that I am working on, we are using dapper to query the database and sometime when mapping from dynamic types to concrete types we end up with a messy block of code.
I created a folder called mappers and have created an Interface<T>, an abstract class inheriting from that interface and I have also... |
I do HTML5 Video player with some controls. I have a button, where I change classname for make play, pause or replay button. I have a mute/unmute button, volume range slider, timer and fullscreen mode button.
Maybe I can do some functions better or faster, and also, maybe I need to change comments?
Logic:
"use strict"
... |
Looking for feedback on a set of templates I've just created. I'm planning on converting them to Yeoman but want to make sure they're ready for prime time before doing so. They are currently in CodeSmith Generator format.
Their main goal is to generate the guts of a MongoDB / Mongoose / ExpressJS web service from SQL... |
I am mainly trying to avoid the nested forEach statements and am trying to move towards a lazy evaluation type solution.
jsFiddle
var skus = [{
"id": 25175837,
"giftOptions": 1,
"rmsSkuId": 53750485,
"available": 1,
"backOrder": "",
"channelId": 1,
"photoGroupId": 0,
"colorId": 19219... |
I am a web developer, trying to have fun with C++11, so any positive/negative feedback is very welcome.
This is a toy virtual machine with 3 registers and 3 commands:
vm/vm.h
#ifndef VM_H
#define VM_H
#include <iostream>
#include <vector>
#include "vtypes.h"
namespace violet
{
class Vm
{
bool runnin... |
Based on the solution provided in this question , I have written non-recursive Java code to find the path form to a given element in a binary tree. This code is working for all the elements except root.
Is this the correct implementation of the algorithm provided?
Please check and suggest the required changes for the... |
I'm using WordPress ( PHP Based Platform ) and I'm trying to read an external XML File, convert it into a usable array, then compare two arrays - one from the xml file and another from an options database. I've coded it so that it does work but it just looks messy. I'm not sure if it's my naming conventions or how I'm ... |
I have a method that load my walkthrough view. I have my view controller composed of a scroll view. And others views controllers used only for the walkthrough (maybe I should used xib uiview instead of uiviewcontroller). And when I'm on the viewWillAppear, I'm calling this method:
/**
Prepare dynamicly the walkthrough ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.