instruction stringlengths 71 95.1k |
|---|
I'm learning Haskell using the University of Pennsylvania's online materials. I'm a few lessons in and was looking for some feedback about whether I'm thinking functionally enough or porting over my Python background inappropriately.
Below are my answers to the problems set out in lesson three (these were someone's hom... |
Here is some code I wrote to surface Mint.com transactions that occur at monthly intervals, in order to identify subscriptions I may be paying for without realizing it.
I'd like to have some friends try this out as well, but Pandas is not a very common package for non-Python users, and it's requirement is keeping a lot... |
Any suggestions for improvement are welcome.
public static int[] concatArrays(int[] a1, int[] a2) {
int n1 = a1.length;
int n2 = a2.length;
if(n1 == 0) return a2;
if(n2 == 0) return a1;
int n = n1 + n2;
int counter = 0;
int[] result = new int[n];
for(; counter < n1; counter++) {
... |
Which one of these are better for the memory?
protected static List<Line> CreateBolt(Vector2 source, Vector2 dest, float thickness)
{
//...
for (int i = 1; i < positions.Count; i++)
{
float pos = positions[i];
float scale = (length * Jaggedness) * (pos - positions[i - 1]);
float env... |
I was inspired by Stas Kurlin's Nim game to write my own. I'm new to Haskell, and quite unfamiliar with monads, do notation, and -- in general -- functional design patterns.
In the game of nim, two players begin with a number of sized piles, e.g. piles of stones. Each player moves by taking a (non-zero) number of stone... |
I'm writing a chat application. I would like to know if there are problems in this code.
This function sends message:
function sendMessage()
{
var text = $('#messageBox').val();
$('#messageBox').val('');
if($('.context').scrollTop() + $('.context').innerHeight() >= $('.context')[0].scrollHeight)
{
... |
Now I am doing Project Euler number 1:
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
This is my code, which runs in 0 milliseconds:
static void Main(string[] args)
{
Stopwatc... |
I want my Python decorators to have optional arguments and not be called when not necessary.
The accepted answer in here doesn't accept named arguments, and I don't want to add boilerplate code inside decorators, so I came up with an alternative decorator:
import inspect
def decorator_defaults(**defined_defaults):
... |
A small project I recently started. The program must sum all the numbers the user input. You must first specify how many numbers there will be.
Sumaster.c
#include <stdio.h>
int main(void)
{
unsigned short int num = 0;
while(num <= 0 || num >= 256)
{
printf("Enter number of values to sum: ");
... |
I created a class called QuickBitmap to quickly get/set pixels in a Bitmap object. Using intertops I'm able to safely lock/unlock the bits of the Bitmap and with the use of methods like SaveBits, LoadBits, UpdateUnderlayingBitmap, GetPixel and SetPixel. I can quickly and easily manipulate the image.
The problem:
One of... |
I have written a code for basic array creation and printing it's values in C. I would appreciate comments on how it can be improved, and the industry standards.
One issue I'm encountering is having no way to tell printArr() what the size of the array is.
Some questions:
Can I use arr[i] anywhere in the functions inst... |
I have written the following Tampermonkey/Greasemonkey script. I am trying to obtain a list of all CSS rules for a page; across all stylesheets. As of now, I am just iterating over everything. Is there a faster way to obtain the rules? Also, I feel that there is a more efficient way of converting the CSS text to an obj... |
I am trying to create a class for serial port using Node.js, but I want to know if there is a better way to write my data class code.
In my sample code below, in the getPortName prototype in the forEach loop, I declare a port object to store the serial port information before pushing into an array.
Is this a good way o... |
This question pulls content and ideas from a good many of my other questions and their answers, and pulls a lot of things together. I am quite satisfied with my approach here, but seeing as I'm refactoring my app, I might as well ask about my practices and get suggestions for improvements.
This is my search method (th... |
I am learning Tree Data Structures and came up with this code for implementing basic Tree Node using class and performing various Tree based operations like Traversals and others. The code works perfectly but the structure is bothering me a lot, such as this line of code here:
print(tree.size(tree))
How can I improve ... |
This is a makefile I wrote to compile a simple OpenGL test project which is going to use the libraries GLFW and the C library glad.c.
CC = gcc
CXX = g++
COMPILE_FLAGS = -Wall -ggdb -O3
LINK_FLAGS = -lglfw3 -lopengl32 -lglu32 -lgdi32
glfw = d:/external/glfw-3.1
glfw_inc = $(glfw)/include
glfw_lib = $(glfw)/lib64
glad... |
Here's my code for a consise node.js HTTP server.
It does work as intended, but I'd like to ask if there's any glitch or to be improved.
var httpServer = function(dir)
{
var component = require('http')
.createServer(function(req, res)
{
var fs = require('fs');
var path =... |
Please help me to refactor. I have two models, conversion & statistic.
Methods sales_today, revenue_today, profit_today in conversion model only gets specific info from db.
Statistic model
class Statistic < ActiveRecord::Base
class << self
def create_and_update_today(agregate_name, value, network)
today = find_or_... |
Is there a way I can make the code compact and with fewer ifs?
theData = GetData();
if (theData.Rows.Count > 0)
{
MyModel = new CustomModel();
dataSetRow = theData.Rows[0];
if (theData.Columns.Contains("Column1"))
{
if ((!object.ReferenceEquals(dataSetRow["Column1"], DBNull.Value)))
{
... |
I've got a goal and that goal is to become an Angular expert. So what better way of learning than to create an online store for pies, right? I've just finished the registration part and would like some feedback on it.
The registration process happens via Firebase's AngularFire, I decided to use Firebase because I've h... |
I have a model such as this below that acts as a base model. Several other models inherit from this one since they will all share common properties. Would an approach like this fit best practices or would it be better to go another route. I'm aware that composition is always considered a best practice.
public class Bas... |
I am doing some coding exercise, and I am not sure if I have met the requirement. Can someone help me to figure it out?
How would you design a stack which, in addition to push and pop, also has a function min which returns the minimum element? Push, pop and min should all operate in O(1) time.
public class Question {
p... |
I have an object created by a JSON data. I need to retrieve the id for an object, I would like to know if a faster way exist, considering I am using for ..in loop.
var test = {
id: 0,
cnt: [
{
id: 1,
cnt: [
{
id: 2,
cnt: [
{... |
I have developed this simple TCP Server/Client communication program, and am looking for ways of lowering the code footprint where possible.Side note, Both Classes are Main as they run independently, though interact.
TCPClient
package socketUse;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import jav... |
I created a configuration View. so it binds a lot of properties in Viewmodel. But I have a another class People and I want to assign properties of viewmodel to class People.
class Viewmodel
{
public string name {get;set;}
public int age {get;set;}
public string nationality {get;set;}
public string hobby {g... |
I have a Back function, and it is growing. I also think this is terrible, but I don't seem to get how it can be improved:
public void GoBack()
{
NavButtonUsed = true;
Forward.Insert(0, Back[0]);
Back.RemoveAt(0);
if (Back[0].Title.StartsWith(" ") && CurrentItem.Menu != Back[0].Menu)
{
swi... |
I've built this EF for storing data for web scraping. Any ideas? What am I missing?
namespace Identity.Core
{
[Table("Entities")]
[Description("Entities Common Information")]
public class Entities
{
//Entities
//123123-123123-123123123-123123 [Entity.EntityUniqueId]
//John E ... |
I tried to implement the Repository pattern for my project:
MemberController.php -- this one is a bit too long and has repetitive code
<?php
class MemberController extends \BaseController {
private $repo;
public function __construct(MemberRepository $repo)
{
$this->repo = $repo;
}
//////... |
I am working to complete this even further, but here's what I've got thus far...
(See my other post for the definition.)
protected override void Seed(Identity.Console.IdentityDBContext context)
{
//Add Country and States...
context.Countries.AddOrUpdate(x => x.Alpha2,
new Entitie... |
The objective of this program is to call enqueue sequentially with multiple URLs, and never block, fetching the URLs asynchronously, but on the order they were entered.
In other words: keep calling enqueue to add urls to a buffered channel (queue) (possibly with a specific callback), and consume one by one in the order... |
The code below grabs the contents of a .txt file, and scans each character of it, using that data to create a tile set. My main concern, is that for each loop, I am opening and closing a file each time, and that is obviously performance-intensive. I want to create an array of images, based on the files, but I'm not sur... |
I have now written a simple square root calculator using the division method:
static void Main(string[] args)
{
double num, sqrt = 0;
int currentDecimal = 0, decimalAccuracyLevel, intAccuracyLevel = 5;
do
{
Console.Write("Enter your number: ");
} while (!double.TryParse(Console.ReadLine(), ... |
This is my first project I've written totally from scratch. It hasn't been styled yet so it's pretty ugly and it's missing some features but the core functionality works. I would love to get feedback on things I can improve on and any bad practices that I should work on correcting now while I'm still learning.
Demo
So... |
I am fairly new to javascript and I would like to write my code on a more readable and efficient way. Any critique of what I've written would be greatly appreciated, especially the section of hexValues.first = changeHex... Also, should I have two files going for this code? And if so, how should I best split it up?
(fun... |
I've written what I believe is a valid dynamic programming solution to a variation of the rod cutting problem. In this problem, the goal is to make as few cuts as possible on a rod of length n.
I have two questions:
Is this a valid dynamic programming solution?
How can it be improved?
(This is not a school assignment... |
I'm modelling the core entities in a callcenter-related system that deals with Operators and groups ("pools") of them. While I've written some Python before, this is my first time building a larger project in it from scratch, and I'd like to know if my approach and code is pythonic enough or will get me into trouble la... |
First of all, this code will ask for a number (first) on how many test the user would like to have. Then the user will input the strings depending on how the number entered.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim input As String = txtInput.Text
Dim inputArr As Stri... |
So I received a comment on my previous question that suggested creating a Dictionary of my menus to store the data in. So that got me thinking, all I am doing is going back to the first instance of MenuItem in the ItemList that has a Menu of Back[0].Menu. So why not just iterate through there and open the menu when I... |
Since I am new to Java, I wanted to see if there were better ways of answering the same question. Are parts of my code redundant or maybe there's an easier way to get the same result?
Problem J4: Big Bang Secrets
The encoding algorithm is a Caesar cipher with a shift (\$S\$) that depends on a parameter (\$K\$) and its ... |
Please critique my implementation of a tail-recursive method for generating the Fibonacci sequence:
def fib(n: Int): Option[Int] = {
@tailrec
def go(count: Int, prev: Int, acc: Int): Option[Int] = {
if (count == n) Some( acc )
else go(count+1, acc, acc + prev)
}
if ( ... |
Challenge:
Reverse the digits of a number and add it to the original
until the number is a palindrome
Specifications:
Your program should accept as its first argument a path to a filename.
Each line in this file is one test case containing an integer n < 10,000.
Assume each test case will always have an answer a... |
Is this example the correct way of writing an Async controller end point in Scala using Play 2.3?
def submitResponse(qkey:String) = CorsAction.async(parse.json){
req =>
val json = req.body
val channel = json.\("section").as[String]
val currentQuestionKey = Cache.getAs[String](channel).getOrElse("... |
There are 2 arrays. One that consists of Categories and one of Products. Each product pertains to its specific category. I want to join each product to its right category (a category can have multiple products). Each product that 'finds' its category will go in this category's products array.
for ($i = 0; $i < count($p... |
I'm trying to get a better grip on the new functional possibilities of Java 8.
As an example, I took this very elegant Haskell snippet:
nqueens :: Int -> [[(Int,Int)]]
nqueens n = foldr qu [[]] [1..n]
where qu k qss = [ ((j,k):qs) | qs <- qss, j <- [1..n], all (safe (j,k)) qs ]
safe (j,k) (l,m) = j /= l... |
Following is the code I am using to find a separate count for alphabets and numeric characters in a given alphanumeric string:
Public Sub alphaNumeric(ByVal input As String)
'alphaNumeric("asd23fdg4556g67gh678zxc3xxx")
'input.Count(Char.IsLetterOrDigit)
Dim alphaCount As Integer = 0 '<-- init... |
I have a system which reads in a clause in the form of a prolog "fact", i.e. 'is'('a sentence', 'this').. I want to generalize this up into higher-order classes and types, rather than just single words. At this juncture, one things I'm going to try out, as a sort of initial step, is the just generate all the hypernyms ... |
I'm working on getting switch and if statements down and I came up with this. It works well and I don't have any problems with it running properly. I was wondering if I could get some feedback on how I put it together. If there are things I am doing wrong or could do better, I'm very open to suggestions!
public stat... |
I have an UserControl where I declare two DependencyProperties
int? Level;
CardBase SelectedCardBase;
A non-null CardBase object will always have 2 read-only integers: MinLevel and MaxLevel.
The UserControl allows the user to change as he desires both DPs, and the internal logic must ensure that both DPs have valid va... |
I have been working on my Pong game and I added some nice new things to it. You can now select the difficulty on the start screen and I also added a pause screen. Also I gave the Pong ball a tail just like in Snake.
The game is running fine on Windows but on Android, each 1/2 sec, I'm getting small FPS drops. I was won... |
I'm fairly new to JavaScript. I would like some feedback on the naming and grouping of the following code. Is there any change that will make it more readable?
Template.documentPage.events({
'click .hint-text': function(e) {
e.preventDefault()
var currentHintId = $(e.target).attr('id')
Session.set('curre... |
Does it make any sense and how to modify the JavaScript/jQuery code below to increase the performance? The working code is:
var rightTr = $(".superBlock div.right tr:visible");
$(".superBlock div.left tr:visible").each(function(i){
if ($(this).height() != rightTr.eq(i).height()){
if ($(this).height() > rig... |
Goal
Design a representation of a mage character from the World of Darkness RPG, as well their associated spells.
Here is a visual representation of the schema. You can see it more closely on LucidChart if you like.
You can also see my draft here and on YUML
I have already made an attempt at laying out the models, ... |
I wrote this short, plain Ruby lib to handle email address validation inside and outside of Rails applications, and I would like to know what you think.
require "i18n"
class EmailAddress
VALID_EMAIL_ADDRESS_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
def self.malformed?(email)
email !~ VALID_EMAIL_ADDRESS_RE... |
I've created a simple Perlin noise generator in JavaScript and am trying to find ways to optimize it. It lives inside a webpage and generates an image using nothing more than random number generator and a lot of arrays and algebra.
The end result is kind of slow. Not unusable, but a lot slower than a Java applet woul... |
Problem Statement :
Design a class for three operations for given set of integers :
int getOrder(int data) /* order meaning rank in list */
int getData(int order)
void updateData(int oldData, int newData) /* [Most used operation] */
My solution
class App {
Set<Integer> appData;
public App(List<Integer> data... |
I want to print the following triangle:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
I tried to do but I cannot avoid two for loops. Is it possible to achieve the result in a single for loop?
static void printtriangle()
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= i; j+... |
I am trying to parse the command line arguments using argparse, and if the user specifies a yaml file for the config-file, add those arguments to the args from argparse
import argparse
import yaml
from pprint import pprint
class CLI(object):
def execute(self):
self.create_parser()
self.options = ... |
I need to calculate at which year a school class has started, given the year they currently are in. For example a class of 2nd graders have started school in 2013, if I pass 2 to the function it should return 2013.
So, I need to take x years and 6 months out of a date, I was wondering which is the better way to do it.
... |
I'm building an angular application using AngularJS and AngularFire. As this is the second part of this "series" it might be a good idea to also check out part 1 to gain an even better overview of the register/login process.
I have a few concerns here:
It feels like I shouldn't need to have a $scope.loggedIn variable ... |
This question is a follow-up to:
High-Low Guessing Game
Now with shiny new graphics in JavaFX.
You now have the awesome ability to choose which numbers to guess between.
Now with Git Repository!
Main.java
package sample;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent... |
I use it in a number of embedded devices. It loads the query parameters from an HTTP GET/POST request and prints them to stdout in FORM_key=value format which then get set as an environment variable.
Source:
char *
FP_strdup (char *string)
{
char *result;
if (string == NULL)
return NULL;
if ((result = (char... |
I'm trying to create a read-write-execute permissions system for items using user-group-world system.
I already have the user/group system set up, just not the permissions.
This is what I wrote:
/** @param $requestedPerm the permission being requested: read write or execute - 4, 2, or 1 respectively
* @param $level ... |
I made an algorithm to calculate when the user has to purchase material adjusting the date in which the order has to be made, I'm using datagridviews to make it work, but I was wondering if there is a better way using a DataTable.
private void Suggestion()
{
for (int i = 1; i < dataGridView9.RowCount; i++)
{... |
I'm attempting to speed up my genetic algorithm that modifies images. After searching, I've found that my fitness function is the bottleneck, taking sometimes up to 11 seconds to complete.
The fitness function accepts two images and returns a float representing the total difference between the images' corresponding pix... |
Print the first 10 lines of a file, if it has less than 10 lines, print the whole file.
Any suggestions on any kind of improvement are welcome.
package je3.io;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
/**
* Created by IDEA on 29/01/15.
*/
public class Head {
public s... |
I was hoping that some more experienced programmers could help me make my implementation of Dijkstra's algorithm more efficient.
So far, I think that the most susceptible part is how I am looping through everything in X and everything in graph[v].
My graph is formatted as:
g = {0:{1:2}, 1:{0:2, 2:6}, 2:{1:6}}
This is ... |
Any advice would be great. I watched a few videos over the last 3 weeks and made a program up; what do you think?
The program is a business ideal for a few computers in a shop, some computers with training and the rest of the computers without. (for gaming, etc.)
import java.util.Scanner;
public class n_com {
pu... |
We're doing a website for Cardshifter, and now I've converted the plain html files and css into a Spring MVC web application. Here is the typical configuration classes that I used in most of the project I work with.
package com.cardshifter.io.web.config;
import org.springframework.context.annotation.Bean;
import org.... |
I'm trying to produce a 3D point cloud from a depth image and some camera intrinsics. The image is 640x480, and is a NumPy array of bytes. The output is a (rows * columns) x 3 array of points.
I've gotten the function to work perfectly, but it's way too slow! (takes like 2 seconds per image to process). I'm wondering i... |
I wrote the following code to integrate the product of four functions.
Two of the functions are hypergeometric functions and the other two are incomplete gamma functions. I have written each function as an infinite series, one per nested loop. The first loop (variable k) is for time.
y1 = 0;
for k = 1:L-1
for i = 0... |
This is an extension of my Attributes system I wrote about in these questions:
Lvl 1 upgradeable attributes
Lvl2 upgradeable attributes
It is unrelated to the core functionality under review in those questions, but I present them for reference.
I wrote a banded interpolator. This takes a set of input ranges mapped to... |
I need a method that clean up a string considering these few rules:
Remove or not Spaces
Remove or not Special Chars
Remove or not Numbers
Descaptalize or not the string (this is don't really needed but I included it anyway).
I did some google if exists something that already do this, but found nothing, so I came up... |
Print the tail of a file, if the file has less than 10 lines, then everything available is printed.
Any suggestions for improvement are welcome.
package je3.io;
import java.io.IOException;
import java.io.RandomAccessFile;
/**
* Created by IDEA on 29/01/15.
*/
public class Tail {
public static String[] tailLines... |
We have a system with a non standard database solution. All trips to the DB are rather expensive. We cannot use entity framework.
Currently our lazy loading is on an entity by entity basis. So if I have a Customer and access their Orders object it only loads the Orders for that customer.
Something like so
//DAL
public... |
I created the body of an email by using the following bit of code:
msgBody &= " Name: " & Venuename & vbNewLine & "Address:" & _
"" & Venueaddress & nxtline & "City: " & Venuecity & nxtline & "State:" & _
"" & Venuestate & nxtline & "Zip: " & Venuezip & nxtline & "Phone: " & Venuephone & nxtline & ... |
I am trying to make my class a bit cleaner, especially some of its methods like Count, __add__, remove and __iter__. I feel like I could use cleaner code on the above methods and get the same results.
Bag class represents and defines methods, operators, and an iterator for the Bag class. Bags are similar to sets, and h... |
Given the length of an array and a char, I would like to replace every element in a char array with that given char.
Using a for loop, I'm changing each element to that char. Is there a better way to do it, or a specific method for that?
using System;
using System.Collections.Generic;
namespace TestProject
{
class... |
I was doing a problem, SPOJ: FLIB. My code was running slow (getting Time Limit Exceeded error) when I was using Code1.
However, my code accepted within the required time limit when I hardcoded the multiplication instead, using Code2. Can someone tell how this was a significant change? Note that this program relies hea... |
In order to read a whole file as a string using standard libraries you have to allocate memory, terminate the string, determine size of the file and size of each element.
This could happen with fread until I decided to automatize it using this:
char *readFile (FILE* fp, char *source)
{
unsigned long long int size;
... |
"The C Programming Language" (2nd Edition) by Kernighan and Richie has this exercise:
Write a program to print all input lines that are longer than 80 characters
I have written the following code for this exercise:
#include <stdio.h>
#define MAXLEN 1000
#define MINLEN 80
int main(void)
{
int c;
int index = ... |
Code
I have the following piece of code
#define equidIND(divid, recip) (size_t)((divid) * (recip) + 0.5)
...
// Get index for average velocity
//idx_velo_avg = (size_t)(velo_avg * funmaps_velo->map_velo_step_recip + 0.5);
idx_velo_avg = equidIND(velo_avg, funmaps_velo->map_vel... |
I'm using the following piece of JavaScript to emulate class extending. Is this a valid way to go or does it have some drawbacks which should definitely be fixed?
var Validator = function (inputId) {
"use strict";
var self = this;
self.inputId = inputId;
window.document.getElementById(inputId).onblur... |
Any feedback is welcome:
public class HexToDecimal {
static String hexRep = "0123456789ABCDEF";
public static void main(String[] args) {
System.out.println(HexToDecimal.hexToDecimal("AB"));
}
public static int hexToDecimal(String hex) {
int counter = hex.length()-1;
int sum ... |
There are 3 search fields, and at least one must be filled out. When the search button is clicked the search fields are checked, if none are filled in show the error window with the error message for this error. If at least one field is filled in get a code based on the search criteria. If the code was not successfully... |
I have as recently as last week picked php back up to code in. My experience with it has always been quite limited, but as I am now making a simple application for my job (for internal use) I am stumbling upon some small difficulties (or questions rather).
<?php include_once 'config.php'; include_once 'browsercheck.php... |
To become better acquainted with the Intel Parallel Studio XE profilers I'm currently messing around with a simple concurrent freelist. I'm fairly certain that it's thread-safe. It uses Acq/Rel semantics, Tagged Pointers to avoid the ABA problem and users of the free list can't actually touch the freelist header data. ... |
I wanted to resolve the puzzle from this link using Python 3. It works and gives me the correct value but I would like to know if it is possible to resolve this problem with a few lines or how I can improve/optimize my code.
import time
start = time.time()
max=0
gx=0
gy=0
gi=0
gj=0
for i in range(999,99,-1):
for j... |
I needed a simple expiring in-memory cache module for a project I'm working on and I've come up with the following.
My requirements for the cache module are:
Be able to expire objects after certain period of time
Use what we have in the standard library
Keep it simple
So far I've got this.
"""
Expiring in-memory cach... |
I made a little Python3 script to grab video clips from a website for viewing off-line later and would like your critique, advice, tips & tricks and/or learning resources to create better code. (Project on GitHub)
#!/usr/bin/env python3
''' phgrab.py: clip downloader. '''
import os
import sys
import argparse
import ur... |
I have a database with 4 tables filled with millions of rows. I have my program run on several computers computing data and then returning it to the database. The huge bottleneck in my program design is that for each calculation, it has to download the data and then perform calculations on it and then save the results ... |
I have 2 connections. How can I reduce this to one connection?
//AuthentificationController class:
public string Register(string nickName, string email, string password)
{
try
{
if(!UserWorker.IsUserRegistered(nickName)) //connect
{
UserWorker.RegisterUser(nickName... |
This is code I wrote for calculating bezier curves as quickly and RAM efficiently as possible.
I would like to know if there are faster ways to optimize anything, because I am very new to C++ and efficiency methods.
Lastly, if there is a variable that could be more explicitly named, also let me know.
#include <vector>
... |
I'm creating an event hub object in for a large project I am building in JavaScript. The project will have modules in charge of the UI, commands, and rendering. Each module will use this hub for broadcasting events to each other.
This is my JavaScript library (I cut out RequireJS for conciseness):
Hub = Object.create (... |
To find answers where users expressed their gratitude (by mentioning "thank" in comments),
I put together this SEDE query (latest):
DECLARE @username AS NVARCHAR(60) = ##DisplayName:string? ##;
DECLARE @userId AS INT = ##UserId:int?-1##;
-- SpecialThanks: Special thanks only "Enter 1 for YES, 0 for NO"
DECLARE @Specia... |
I wrote a PS script to backup data from single user pcs to their network homedrive. The purpose of this tool is to save some time and ensure process consistency when reimaging/replacing machines. I would appreciate your critiques and ideas. I am new to Powershell scripting.
Breakdown of the scripts job:
BACKUP:
Creat... |
I wanted to create a basic String class that will hold a CString and have:
constructor, destructor, copy constructor
assignment operator (both from String and CString)
<< and >> operators to stream with cout and cin
==, < and > operators to compare Strings
[ ] operator to access a certain char in a string
Len() func... |
I'm new to web development, and I'm constantly torn between good code and bad code. I was wondering if you could help me improve my following code and see if I'm doing it right in terms of how I use it on the line by line basis: - t code checks to see if a cookie exists if it doesnt exist it sets a cookie to last for 2... |
I haven't coded all winter, and it seems like everything I learned about efficiency from my data structures class leaked out my head. I was wondering if I can get some help in making my code less verbose, and more efficient, as some of the things I do seem redundant. My code is correct (I'm confident as I tested it), a... |
I've already done quite a bit of cleaning up. For example, the strings dryCheck and blueCheck no longer exist, instead they're replaced with "else". But I think this could be done 10x better, so if you know how (no advanced C++ lingo etc), that would be great!
A red seed will grow into a flower when planted in soil te... |
I am creating a simple support ticket system. I thought It would be a nice little feature to show the current date and time. Since I want to show the current time I thought JavaScript would be best versus using PHP. I have looked at different questions posted by other user about the topic and created the following sni... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.