instruction stringlengths 71 95.1k |
|---|
This is a question from a phone interview I had.
The question was in 2 parts:
a. find("cat") -> T/F suggest a data structure to find is if a word
exists in a large dictionary, how will one node of that data structure
will look like?
b. Implement a bool Find(string str) function which returns true or
false if the... |
private static int Sum (int[] a, int from, int to){
int total=0;
for (int i=from; i <= to; i++)
res += a[i];
return total;
}
public static int Method3 (int []a){
int temp=0;
for (int i=0; i <= a.length; i++)
{
for (int j=0; j <= a.length; j++)
{
int c = Sum(a,i,j)... |
My code is very very slow. Could you give me hints on how I can make it much faster?
for (stdext::hash_map<unsigned __int32, CVertex*>::iterator it1 = graph.begin(); it1 != graph.end(); it1++)
{
for (std::vector<CVertex*>::iterator it2 = it1->second->getNeighbors().begin(); it2 != it1->second->getNeighbors().end();... |
I wrote a Python script to collect a list of directories containing third party libraries and submit them all to dependency-check, a program that compares library versions to known-vulnerable third party libraries. This code works correctly and I'm after feedback about Python programming, especially my testing methods.... |
This question suggests a different (improved?) implementation for searching/filtering names based on a search query. This is based on the question here: Name filtering in Java
A Trie allows the prefix of terms to be used as a search mechanism. The Trie requires pre-processing the data in to a data structure that has ve... |
I literally spend all day working on PHP and I think I figured it out, but I need some reviews in order to make my code secure & okay. I am asking you about functionality here. The code below works.
index.php
<form action="upload.php" method="post" enctype="multipart/form-data">
<div id="file_container">
<i... |
I implemented sequenceA:
sequenceA :: Applicative f => [f a] -> f [a]
sequenceA [] = pure []
sequenceA (x:xs) = (++) <$> (fmap (\y -> [y]) x) <*> sequenceA xs
I don't like the fact that I'm making a new list, and then concatenating the result via ++.
However, I'm not sure how to make use of cons, i.e. :, in this f... |
I have constructed an API service that dives into a storage engine and retrieve data.
I have tried my best to apply the MVC modelling with services (repository) in mind where the controller (as it should) is just the data direction (input goes in and it redirects the output with the Repo in the middle doing all the hea... |
Here's some code I wrote quickly to get a nice millisecond countdown going. It displays the number of milliseconds until the new year in whatever timezone is next to be in 2015 are in in huge font, and spits out the timezone in small reasonable font below.
<!DOCTYPE html>
<html>
<head>
<title>Newyear Coun... |
I made this piece of code to detect inactivity on different aspects of my app. It is part of a set of pieces to analyze user behavior.
Not saying it's ugly, but good looking constructive criticism to help me improve my code and could be useful to me for other similar components.
function InactivityTimeout(idle_time, ... |
I am an absolute beginner to programming and am learning it using C. I have just learned function pointers and tried to implement a quicksort function using function pointers to determine the nature of sorting.
//Program implementing a quick-sort function using Hoare method
//to partition using a random pivot.
//Funct... |
The goal of my current piece of work is to read from a global config file all the settings and then from the local file only those settings that a user has chosen.
Firstly I wrote a function but then I needed a class. It's my first working class in Python, and I ask if you can kindly note its defects. Although it works... |
I have five groups in Group table as Group1, Group2, Group3, Group4, Group5 and whenever a new role added into Role table I have to make an entry into GROUP_ROLES table as below:
declare @gid1 int, @gid2 int,@gid3 int,@gid4 int,@gid5 int,@rid int
select @gid1 = id from Group where name = 'Group1'
select @gid2 = id from... |
I am coding a 2D board game. I let the user choose the difficulty level in the beginning, which influences the skills points of the player.
Here is the code I wrote for the Player class:
package model;
public class Player {
// VARIABLES ---------------------------
private Position position;
private int ... |
I want to backup my GitHub repositories since there is news about blocking GitHub in India. I wrote Python code to automate this and would like for it to be reviewed.
import os
import requests
API_TOKEN='xxxxx'
#from https://github.com/settings/applications
api_repo='https://api.github.com/user/repos'
url = '%s?acce... |
I wrote a simple sound player to use as part of my MorseString class. I am new to using sounds (in fact, I was helped a lot by Google) and I don't know if this is the correct way to play a sound.
The method takes a specific frequency and a duration as parameters, and plays the frequency for the specified duration.
pri... |
What would be the preferred method for handling errors when using the PDO to connect to a MySQL database? I was using mysqli_error($this->pdo), but I heard this was bad practice. Any feedback would be much appreciated.
class Database
{
/*
* Database properties
*/
private $server = 'localhost';
p... |
Note: A run is a series of adjacent chars that are the same.
I just want to answer a few questions:
Is this readable?
Does it need commenting or is it self-descriptive enough?
Are there any efficiency tweaks this could have?
Is this a good way to test?
Which is the preferred/conventional syntax?
int maxCheck = 0,
... |
I'm very new to AngularJS. I'm using a directive for translation of category objects like:
{
"id":17,
"order":2,
"published":false,
"createdAt":"2014-12-29T16:22:43.000Z",
"updatedAt":"2014-12-29T16:23:22.000Z",
"CategoryTranslations":[
{
"id":13,
"name":"Fishes",
"description":"Fishes desc",
... |
The purpose of this code is to find a password with brute force cracking where as it will try all the possible combinations until it finds the correct password. For example, it will start like a then b then c . . . ab . . . cz . . . dd and so on until it finds the correct password. All of it works, but the performance ... |
I'm new to JS and jQuery. I wrote this function which just does what I want, but it seems very unreadable, and because of my experience, I don't know a better way to handle it.
Could you please give advise me how to refactor it?
function new_section(id, name, order) {
return $('<tbody>')
.attr('id', 'secti... |
I am trying to simulate a window system with java. I don't know much about Java graphic-APIs, so i began with AWT (I am using Graphics2D here, so far I don't need it, but I think it will come in handy at some point). So far I just have two functions: Each window can draw its own individual content and windows are put o... |
I got a proposed exercise from a Java2 book. This one wants me to find out the numeric centers.
A numeric center splits two list of numbers that make the same result when you add the numbers in each list. For example, 6 is the first numeric center because 1+2+3+4+5=15 and 7+8=15 too. The second numeric center is 35 bec... |
Is this Test Case overkill?
I am new to Unit Testing so I am learning and I'd love to hear your opinion about it.
use Application\Tests\TestCase as TestCase;
class RoutesSubmissionsTest extends TestCase {
public function setUp()
{
parent::setUp();
$this->app['router']->enableFilters();
}
... |
Problem:
Given 2 strings, consider all the substrings within them
of length len. Len will be 1 or more.
Returns true if there are any such substrings which appear in both strings.
Compute this in linear time using a HashSet.
Solution:
import java.util.HashSet;
public class Standford3 {
public static void... |
I have a Windows-Runtime app (very similar to WPF), and I am using (at least I think I am!) the MVVM style. I want to make sure I am doing this the proper way, and not just a working way.
This is my MainPage.xaml:
<Grid Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300" x:Name="Item... |
First time writing a big project in OOP. I am quite used to scientific programming but not to OOP, and even less to building GUIs. I am writing a 2D board game: the player can move on a map from tile to tile, meet Helpers and Enemies, and win a Trophy in the end.
I used the MVC pattern and the Model parts consist of t... |
I'm new to Angular and I would like some advice on how I can improve my code. The main things that I want to focus on are decoupling and code correctness.
HTML:
<body ng-controller="myController as myCtrl">
<fieldset>
Select movie to display:
<button ng-click="myCtrl.change('mortalkombat')">Mortal Kombat</but... |
I'm learning Swift and would appreciate any code review suggestions (the more nit-picky, the better). In particular, I'm wondering if there's a more efficient way to format the time in the timeToString function I wrote, since I'm repeating myself three times.
import UIKit
import Foundation
class ViewController: UIV... |
public class WmSync : IDisposable
{
public WmSync()
{
var sync = new Control();
sync.Handle.GetHashCode(); // ensure handle is created
_sync = sync;
Thread.MemoryBarrier();
}
public void Dispose()
{
_sync.Dispose();
}
public void BeginInvoke(Action a... |
I have studied the strategy pattern and understood it w.r.t the example given in the PDF that I referred. I wanted to make sure that my understanding is correct, so I have written a simple program in C++ and designed the strategy pattern using the family and vehicles as the subject. Please provide corrections/suggestio... |
I attempted a solution to a seemingly simple problem:
Peak Finder
Let input be a list. input[i] is a peak if input[i] > input[i + 1] and input[i] > input[i - 1].
Implement a recursive algorithm of time complexity \$O(\log n)\$ to find a peak if it exists.
def peakFinder(input):
n = len(input)
middleIn... |
This prints out the sum of the numbers that have same remainder and quotient according to the input number. It's an online judge problem, and it currently throws a time-out since it's taking too long. Yes, the number being divided could be any positive integer.
Are there any suggestions on speeding up this code? And ar... |
I'm writing this app that's based in the terminal, and of course there's a lot of input involved, especially numerical input. I've decided to use the method of reading an entire line of input and converting into a number and displaying an error message if the input is out of bounds or just straight-up invalid. This hap... |
I am using PDO prepared statements to store user entered input and store that input to the database. The code will store a text input and 5 uploaded images.
Will this code protect from data SQL injection and XSS attack? Will it be secure? If not, what are some things I should make secure?
<?php
$db_username = 's... |
I just finished Project Euler #12 in Swift, and since there is not any version yet on Code Review, I would like to have some comments on what I did to try to improve it.
The sequence of triangle numbers is generated by adding the natural
numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7
= 28. ... |
My method takes a long time to respond, so I'd like to make this method more efficient. I'd also like this method made with joins.
def all_shows_with_videos
@arr = []
tvs = Tv.all
tvs.each do |tv|
tv_tmp = {:name => tv.name, :id => tv.id}
tv_tmp[:videos] = tv.videos
tv_tmp[:seasons] = []
... |
I needed a way to cache a large number of objects with two different types of keys.
In my case:
A String key represents my object in a serialized form. This way if I get the same serialized object from an outside source, I an easily determine if it already exist and avoid re-parsing it (I just re-put() the existing en... |
I wrote a Tamagotchi-like game where to feed the pet, you do math questions instead of just pressing a button. It's persistent, in that on loading, it figures out long it's been since the last save, and "simulates" the elapsed time. Hunger increases over time, and either causes the pet to heal, or become hurt, dependin... |
I posted another snippet of code a few weeks back when I started learning C++. Here's my second try now that I have some time to play with this again. The goal is to write a generic algorithm for reversing the "words" of a container with a bidirectional iterator. Separators of words are any values that a functor parame... |
This is a Markov text generator I've created in JavaScript. I'm pretty sure the term "Markov" applies, anyway.
The way the generator works is like this: it first divides the source text into unique "chunks" of length n (specified via the order parameter, greater = more coherent result), and, for each chunk, determines ... |
I made a quicksort implementation based on this code. Please review my C++ version.
template<typename I>
I partition(I low, I high) {
auto p = *low;
I i = low, j = high+1;
while (true) {
while (*(++i) < p) { }
while (p < *(--j)) { }
if (i >= j) {
break;
}
... |
This is based on a library called Consoledefender V 3.3.
I made a minimal class for personal usage based on this library by using C++11. It actually takes user input and prints it back on the console screen and acts like an echo. I would like this class reviewed.
Console.h
#include <windows.h>
#include <conio.h>
#inclu... |
I have made this little program for fun, to add on my personal webpage. I remember seeing something like it some time ago, don't remember exactly where, and I tried to reproduce it myself.
As it turns out, I figured out that it isn't quite fun to have your CPU stressed out by 25% because of a funny single homepage, so... |
There isn't a very reliable way (in my opinion) to get the mime type of a specific extension, regardless of the file actually being of that type or not.
This type of thing usually is used when sending a different Content-type when you intend to send, for example, an image.
class MIMETypes {
/**
* @var string ... |
I have a service that monitors failure and success directories for files that are generated by an engineering program. I want to check the change was in the success or failure folder, and if it was a new file creation. When those criteria are met I need to check if the file type matches one of the keys for a dictionary... |
I'm using HMSegmentedControl, an open-source UISegmentedControl subclass. I'm trying to react to the user tapping on the currently selected segment. HMSegmentedControl only supports reacting to a segment CHANGE, with either UIControlEventValueChanged or a block that executes when the index is changed. I need to react t... |
A discussion in The 2nd Monitor made me realize I had never 'solved' the N-Queens problem. Additionally, as I read up on it, I realized that the 64-squares in a chess board would work well if represented as bits in a 64-bit long.... That was a nice thought, but it became complicated, and really, 8-size chess boards are... |
In interrupted bubble sort, we need to stop the sorting based on the iteration count. This seems pretty straightforward to me. I have this code, which seems to work fine, but it isn't fast enough for larger input sets. How can I make this faster?
s = '36 47 78 28 20 79 87 16 8 45 72 69 81 66 60 8 3 86 90 90 | 2'
ls = s... |
In Groovy 1.8.6 I need to move a line just before another one. I'm interested in any improvements.
fileToChange = new File('.classpath')
linesToKeep = []
fileToChange.eachLine {
if (it.contains('line to move')) {
lineToMove = it
} else {
linesToKeep.add(it)
}
}
fileToChange.withWriter { out ... |
The following class (that was my first class ever in python) was used in an eye tracking context. Imagine a context where you always will have a single gaze-point and some closed contours. How can I return all possible relations between them?
For example, for two contours, the point can be:
Relation 1: inside contour ... |
As an exercise I have written a basic binary tree implementation in Go.
Tree struct:
type Tree struct {
Key *int
Value interface{}
Left *Tree
Right *Tree
}
func New() *Tree {
return &Tree{}
}
It a annoys me a bit, that Key is a pointer, but this is needed at the moment, because I use nil as an ... |
In a few months I'll work on a C++ project that could span a year or two. I've a strong C background and for the usual reasons I always chose C over C++ (please forgive me). To extend my capabilities and to move from C to some more powerful language, I felt the time has come to take a serious step towards C++. In order... |
As noted below, this is more or less a direct translation from http://rosettacode.org/wiki/Sorting_algorithms/Quicksort#C. I'm fairly satisfied with its readability right now compared to the C code; but still wondering how to make it more succinct and clear. Any ideas/opinions?
{-
In-place quicksort algorithm.
Adapted ... |
Continuation of Correct MVVM format. This is what I have done so far, and of course it works:
To start with, this is my MainPage.xaml:
<Grid Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="100" x:Name="TitleRow"/>
<RowDefinition Height="*" x:Name="DataRow"/>
</Grid.RowDefinitio... |
A while ago, I was working on a chess project with a couple other people. In the end, I wrote all but a couple of the lines of code, including these:
class Piece(list):
def IsValidMovePattern(self, FromCoord, ToCoord):
print(self, "Validation not done")
return False
class King(Piece):
def I... |
I needed a priority queue that allowed efficient searching and changing of keys. I tried std::priority_queue, but the interface was extremely limiting. Not being able to search for existence wasn't a big deal since I could separately keep a std::unordered_set<key_type> around, but not being able to modify key value was... |
I have asked a previous question but at the last moment I realized that the code does not work as intended as it has some small bugs.
I got some ideas for improvement though, but they didn't seem to work as well, so I decided to re-write it. This time, I was following the logic all the time.
char *tbl_getline (char *so... |
I've created a console server which is supposed to update 30 times per second, I'd like you to review it and also I'm curious about the accuracy of the server's loop.
using System;
using System.Diagnostics;
using System.Threading;
namespace ZGServer
{
class Program
{
//------------------Variables------... |
I just finished Project Euler #13 in Swift, and since there is not any version yet on Code Review, I would like to have some comments on what I did to try to improve it.
Work out the first ten digits of the sum of the following one-hundred
50-digit numbers.
37107287533902102798797998220837590246510135740250
463769... |
This is a follow-up to
Quicksort function
Like the previous code, this does not optimize for containers with large numbers of duplicate elements. How can I improve this code, particularly with iterators?
template<typename C>
void insertion_sort(C low, C high) {
for (auto i = low; i < high; ++i) {
for (auto... |
The following code will generate a number plate and then generate a random speed and see if it's speeding
import random, string, time
class Car:
def __init__(self):
self.plate = self.genPlate()
self.limit = 60
self.checkSpeeding()
def checkSpeeding(self):
self.speeding = random... |
I've worked with PHP for a few years now and have a degree of understanding about classes / objects, but I've never written my own until now.
In that vein then, I'm looking for a bit of confirmation of the code below and that I am doing things properly before I go any further. Any advice / critique is greatly appreciat... |
I am building a small DSL for iOS' autolayout feature. Obviously I want to have a typesafe way to define autolayouts instead of doing VSL. I came up with the following:
//in reality this will be a Xamarin/iOS View
type View =
| View
type Constraint =
| Max of int
| Min of int
| Eq of int
| B... |
I have recently written this little Bulls and Cows game in Python:
"""Play Bulls and Cows."""
import random
NUM_DIGITS = 5
class IllegalNumber(Exception):
"""An exception to raise when the class Num has an instance of an
illegal number."""
pass
class Num(object):
"""Represent a number that consists of... |
Below is a piece of code which takes a list of IPs, pings the hosts and returns (prints) the list for "Alive" and "Dead". Any feedback on what can be done better is welcomed, mainly, speed and reliability! Would you accept it as production code? What about try/except blocks and logging?
import subprocess
from multiproc... |
Outside of the jQuery DSL I've hardly ever written any JavaScript. I never bothered learning JavaScript until a couple of months ago. After a slow start I got stuck in and created this game today.
I usually program in Ruby, and this is proving to be an obstacle because I'm thinking in ruby while writing JS.
The code ma... |
The task is to select all posts tagged with a certain tag, along with other tags the post may have, given as text rather than ID.
Table posts
CREATE TABLE `posts` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` text NOT NULL,
`text` text NOT NULL,
`date` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyIS... |
First of all, I'm new to Lisp (I currently use CLISP and SBCL). There probably are huge mistakes in this code so any guidelines are welcome :)
I'm very confused about how to do this. It's just about a habit and I don't want my actual help to implement an algorithm, as the one I came up with is not the best one.
Is it o... |
When someone suggested that I solve Knight's Tour, I did so with heuristics and recursion.
It takes a lot of time to solve even a 8x8 board:
N-A1
N-C2
N-E1
...
N-E6
N-F4
Time used to solve: 5417011 nanoseconds
That seems quite a lot, but the most interesting part of my algorith is that it takes only six times the tim... |
I'm still very much a beginner, so I don't really know much about best practices or the speed of any particular C functions.
You'll notice that I included a "cs50" library. This is from a MOOC I'm taking, all it does in this program is allow me to use their "bool" data type. I realize I don't need to delegate all of th... |
I'm working on a game with Slick2D and am just working through the Entity class. I'm making every variable protected and then accessing them with getters and setters. Yet it feels like I'm over-complicating things and it is more efficient to simply let some of these properties be public.
public abstract class Entity {
... |
Here is a group of questions (hidden by default except the first one) with yes|no buttons
<div id="email" class="form-item">
<h2>Q with 1 more option?</h2>
<input type="button" value="true" data-value="web" />
<input type="button" value="no" />
</div>
<div id="web" class="form-item">
<h2>Q with ... |
I just finished Project Euler #14 in Swift, and since there is not any version yet on Code Review, I would like to have some comments on what I did to try to improve it.
The following iterative sequence is defined for the set of positive
integers:
n → n/2 (n is even)
n → 3n + 1 (n is odd)
Using the rule above and st... |
Consider the following C++03 code:
#include <algorithm>
#include <deque>
#include <boost/iterator/counting_iterator.hpp>
const unsigned int _count = 0x10000;
struct recentFunctor {
recentFunctor(const int base, const int firstOffset)
: _base(base),
_firstOffset(firstOffset) {
}
int getIndex(const int... |
This is actually a second follow-up to Correct MVVM format, but I have made different changes.
This is my ViewModel.cs class for my MainPage.xaml:
public partial class ViewModel : INotifyPropertyChanged
{
private ObservableCollection<MenuItem> _back = new ObservableCollection<MenuItem>();
public ObservableColle... |
I was wondering if someone could look at my animation for me to see if I am doing it correctly. I am currently programming a basic game in Java, nothing fancy though, and I just want to get the basics down before venturing into something more complex.
Right now, I want to animate a character's attack. When the playe... |
This is an incomplete implementation of something similar to scratch. It's incomplete because right now, I'm working purely on the user interface.
I used Swing to make the basics of it, but then hacked my own code for the rest of it, because I wasn't sure if Swing could give me what I wanted. Basically, I wanted to be... |
The goal is to block all threads that call WaitOne(). When Set() is called, those threads continue. Any calls to WaitOne(), after Set(), return immediately. The challenge is to make sure that all calls to WaitOne() are either "before" or "after" the call to Set(), so that no threads see _state false, but miss the notif... |
I have a script that contains two shell functions:
runhaskells() {
local DIR=$PWD
local TARGET="cabal.sandbox.config"
while [[ ! -e $DIR/$TARGET -a $DIR != "/" ]]; do
DIR=$(dirname $DIR)
done
if [[ $DIR != "/" ]]; then
local DB=$(sed -ne '/^package-db: */{s///p;q;}' "$DIR/$TARGET")
... |
Is it safe to upload images via MySQL in Blob? I've constructed my code like the following:
public function upload_avatar($file, $user_id = false, $maxbytes = 102400) {
global $sql;
if($user_id == false) {
$user_id = $this->_id;
}
$check = getimagesize($file);
if($check == false) {
... |
Inspired by the "bip buffer", I coded a fixed-size circular queue that uses two regions (two pairs of begin/end pointers) to account for the wrap-around.
The main goal of this design was to simplify the queue operations implementation, and in the case of cqueue_size, cqueue_empty and cqueue_full it happened.
However, c... |
I'm getting a lot of timeouts with the following code and I'm running this method around 10,000 times so I need to figure out how I can optimize this so the timeouts will stop. I am getting timeout errors when I try to call the fill method and I believe it is because the queries aren't done processing yet. It is a loca... |
I am building a simple Store Management System and I have 4 classes, 3 of which are for Product, Vendor and Orders. The last one is my main class where the actual GUI is built. On it I have 800 lines of different functions that represent the different views and actions in the program.
Is that ok? Should I make a class ... |
After finishing my course on CodeAcademy, I wanted to write a program. Please provide opinions.
from random import randint
import sys, time, os
def clear(): #Usefull for clearing the terminal, should be cross-platform
os.system('cls' if os.name=='nt' else 'clear')
def initialize_variables(): #Self Described
... |
They say you cannot get out of the monad, but I need to use the result (at least for assertions / unit tests). But print how does it do it?
Otherwise, I worked very hard for the next code with my new limited Haskell abilities (especially when talking about monads), so it needs a review.
--import Control.Monad.ST
--imp... |
This is Dijkstra's algorithm in PHP. Regarding the data structure, I use a 2-dimensional array $_distArr[m][n]=length to store it. Are there any improvements for this?
$a and $b are the start and the end node, respectively.
<?php
/**
* Dijkstra's algorithm in PHP by zairwolf
*
* Demo: http://www.you4be.com/dijkst... |
I just finished Project Euler #16 in Swift, and since there is not any version yet on Code Review, I would like to have some comments on what I did to try to improve it.
2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2^1000?
import Foundation
func addMul... |
I've developed a library in (typed) Racket that wraps a WebSocket-based API. The API itself is very simple—it operates via a series of three-letter commands optionally followed by a JSON-encoded payload.
The simple library itself provides a series of small abstractions over interfacing with the raw WebSocket data:
The... |
I'd just like this PyQt5 code reviewed. I'm relatively new to classes and GUI programming, and wanted to make sure I wasn't doing anything too bad. If absolutely necessary, I can give you the other stuff I've created that this program uses.
import sys
from PyQt5 import QtCore, QtWidgets, QtGui, QtMultimedia
from irish... |
I'm sure this is a fully 'solved' problem and expecting cross references but I can't find this on Google. I'm probably missing a keyword.
Here is a naive function for populating a bool array (b[i]) of length N in a Bernoulli distribution.
P(b[i]==true)==p and P(b[i]==false)==(1-p) for each independent random variable b... |
This solution was used to synchronize events between two applications: An eye tracking software, Python, and a stimulus control software, object Free Pascal/Delphi. It avoided a rewrite of the stimulus control app from ObjFPC/Delphi to Python.
Pupil Eye Tracker sends some info via ZeroMQ to somewhere (I get used to cal... |
I have wrote my first reasonably complete piece of ClojureScript code and would like feedback. It is basically a re-implementation of Caolan McMahon's parallel and
map functions from async in ClojureScript.
This may be a completely useless exercise because Library X already does this or Feature Y of ClojureScript is a ... |
I wrote a Javascript function that seems to successfully generate the unique pairwise combinations of a list:
function pairwise(list) {
var pairs = [];
list
.slice(0, list.length - 1)
.forEach(function (first, n) {
var tail = list.slice(n + 1, list.length);
tail.forEach(function (item) {
... |
I'm writing a class called TextRenderer to render text with OpenGL.
Here's my TextRenderer.hpp file
class TextRenderer
{
public:
void renderText(std::string text, int x, int y);
private:
void setup();
GLuint program;
};
Here's my TextRenderer.cpp file:
#include "TextRenderer.hpp"
#include <string>
#include... |
Currently a filter parameter of a GET request is used to designate items' categories that will be requested from database and displayed.
The parameter contains comma delimited string - each string id for each category: filter=complete,inwork,cancelled,ycancelled.
I want to get a Ruby object with corresponding attribute... |
I have XML below which is stored as a String in xmlData variable and I need to pass this String to my URL in client_data variable and then execute the URL:
<?xml version="1.0"?>
<ClientData
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.google.com model.xsd"
xmlns="http://www.g... |
C++11 provides a std::tuple template, but it requires the types of all the fields to be listed individually, which is inconvenient if there are many fields and they're all the same type. If I want a tuple of, say, 10 integers, instead of writing std::tuple<int, int, int, int, int, int, int, int, int, int>, I'd like to... |
A Multiclass character can consist of any number of component classes. For example, if Fighter, Wizard, and Monk are character classes, then a Multiclass can be all 3 and having all three capabilities. Because multiple inheritance is impossible due to the unlimited number of such component classes, I'm using the Compo... |
I have an ObservableCollection<MyType> ItemList, and I need to know the index of a specific MyType in the collection. However, when I hard-code the values like this:
ItemList.IndexOf(new MyType(val1, val2, val3));
it can't find the value because it is a different instance of MyType, even if all the values are the sam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.