instruction stringlengths 71 71.9k |
|---|
I use this in a self hosted web service, so I am not using a ton of libraries. I wanted a simple yet easy-to-use cookie repository. The reason the repository is static is that I wanted the ability to use the repository within Razor templates without having to use a reference object. I just find it simpler.
I feel it's ... |
Going through a book, I encountered the following assignment:
Write an application that asks for the user’s first, middle, and last names and
replies with the user’s initials.
Are there any flaws you notice immediately? Is there any way this code can be improved? I'm not really interested in coding style (I guess s... |
This is a classic memory game with a points counter for the two players.
The app works fine, but since this is my first project in Swing, I would appreciate the critical opinion of some expert, as I'm sure there is plenty of space for code improvement/optimization.
What do you think about the code? What should have I d... |
Using Powershell, I've created a script to create a tree-view of a group/s' memberships in Active Directory. I originally had layers of nested loops, but I wanted a more algorithmic solution.
The following code does the following:
Get user input for: input source, depth-level int, output location
Recursively find all ... |
eWay has a simple Pay Now button that is embedded as a script. There are other ways to use the eWay API to take a custom payment, but they are slightly more complicated and the idea was to keep it simple.
This is the basic script:
<script src="https://secure.ewaypayments.com/
scripts/eCrypt.js"
class="eway-payn... |
I have been watching this video:
https://www.youtube.com/watch?v=M6lYob8STMI
And here is the code of it in groovy (just the add method):
def addNode(k, v){
def newNode = new MNode(key: k, value: v)
if(!root){
root = newNode
}else{
MNode currentNode = root
MNode parent
w... |
I have searched throughout the internet and found no OO approach to implement Weiler-Atherton algorithm, so I implemented the following.
Please, help me to make the implementation more efficient and concise.
#include <iostream>
#include <vector>
#include <cmath>
//#include <graphics.h>
#include <algorithm>
using name... |
I was given a this problem at a technical interview and failed miserably in the time given. Afterwards, I sat down and worked out what I think is a good solution. The task was actually to build an AngularJS app to do this, which I did, but the guts of my solution is in JavaScript. I wanted to ask if there is a better w... |
There are multiple aspects in the code I do not really like. [card for card in ...] looks really lame, also [x.pop() for i in range(y)]. I'm looking forward for any recommendation.
from random import shuffle
class Deck(object):
suits = range(4)
ranks = range(13)
@classmethod
def generator(cls, suits,... |
I have two arrays:
$row
$rowTwo
The only difference between these two arrays are the first two keys have slightly different names due problems out of my control.
I'm wondering if there is a cleaner way to do it. Or would it be simply easier to find a way to rename the arrays to match?
$needUpdate = false;
... |
I need to design and implement a service (C#, .Net 4.5+) which receives messages, converts the messages to BLL models and passes them to the BLL.
Long story:
The service will receive messages (strings containing multiple fields (no JSON, no XML just a string)) from a client.
The format of the messages can change betw... |
I had to write a generic wrapper that enables me to pass variable number of arguments for execution of some methods and repeat it up to a few times when it fails because of network connection problems.
What I came up is this class and a helper method. Well I can't say it's perfect - it is sufficient for my need, but i... |
I'm looking to do some basic verification testing on my functions that write to the filesystem.
I took a hint from here on how to mock out the filesystem using an interface, but I'm kinda bummed on how the FileSystemOperations type needs to be passed along through every function. Any ideas how to improve this, or where... |
After searching the internet, I was able to find a base JavaScript file in order to build upon for my project. Which is to create a Adobe Illustrator Script that will create the desired Folders and then export different resolution ratios for each artboard. This method is used in order to create Wallpapers of varying re... |
I have a makefile that I've been using to compile my shared libraries which reads in the files from different folders and then builds the objects and binaries in their own folders.
The folder structure I'm using roughly:
-Folder
|
+--API Header Files Dir
|
+--Library (.so) Project One
| +-- MakeFile Project One
... |
This is the Java signum(double) method I am trying to imitate:
public static double signum(double d) {
return (d == 0.0 || Double.isNaN(d))?d:copySign(1.0, d);
}
This is my version
public static double signum(double x) {
return x != 0 ? x / abs(x) : 0;
}
I was thinking my method was not very readable, but I... |
This function checks these 6 fields for a user profile to determine if they have "completed" their profile. This just feels like it could be done better, but I can't figure how.
/**
* Is the user's entire profile filled in?
*
* @return boolean
*/
public function isProfileComplete()
{
$checkList = [
$thi... |
I have to create a 5x5 box using the images, and my first solution was to create 25 variables and print them, which is very inefficient. How can I optimize this? This utilizes cocos2d-x.
auto cudrado0 = Sprite::create("images.png");
cudrado0->setPosition(Vec2(200, 200));
cudrado0->setScale(0.5);
this->addChild(cudrado0... |
I have implemented a symmetric (AES 128-bit) key diversification algorithm for Java following the NXP Notes. It works as expected but am not the best Java programmer around, I guess I have done quite a mess so I need help on how can improve the code and make it better?
import java.io.ByteArrayOutputStream;
import java.... |
I am implementing a multi-player game in C# and having seen all sorts of projects, from indie developers all the way to large studios struggle to patch networking into existing products in the past, have made the decision to get the networking aspect done first, and build the game on top of that.
I've so far gotten to ... |
The script scrapes a table from the website mentioned, looks at the last 2 columns, takes that information, and then sorts it (and then returns the largest county, and the set of races and their numbers). But, basically, I just wanted to know in which ways I can make this script parallel more closely with the Zen of Py... |
First attempt at doing anything F#-y from a very heavy C# background, think I've grasped the fundamentals of FP, but always good to get other eyes on it:
namespace FSharp.GameOfLife
open System
open System.Drawing
module Array2D =
let toArray (arr: 'T [,]) = arr |> Seq.cast<'T> |> Seq.toArray
module Array =
... |
I made myself a simple budgeting application. Each transaction is stored in the transactions table:
CREATE TABLE transactions (
-- Foreign key into the "categories" table, not shown here. (In reality this
-- has a NOT NULL constraint instead of a default, but this makes the
-- example data easier to enter.)... |
I'm relatively young in Java, and am familiar with only the basics of the language, yet. I've started studying data structures, and I've made an attempt to create a solution for the selection sort algorithm. After many attempts with errors and exceptions, I've managed to come up with what looks like a working solution.... |
I've created this simple 3D voxel terrain generator using Perlin Noise. I have a few concerns about it though.
Is there any way to make it more performant? It currently takes ~1.5 seconds to generate a 200x200 map.
Am I splitting up the different "jobs" of the generator correctly?
Is my general code style good?
usin... |
I need to compute the max contiguous slice in an array. I wrote this function, but I am not sure if it is correct or I am missing edge cases. I ran several cases.
def max_slice(a)
max_start,max_end = 0,0
largest_sum = 0
curr_start,curr_end = 0,0
curr_sum = 0
for i in 0..a.length-1
if (curr_sum + a[i] < ... |
I just began my C# debut and was just wondering if this Rock-Paper-Scissor console app is good and flexible.
abstract class Participant //Abstract - no need for instances, Many common functionality
{
public int wins;
float winRate;
public void DisplayWinRate()
{
winRate = ((float)wins / Game_... |
This is a password recovery program I made, and I just want it checked out.
These aren't all the files for the login and register system, only the password recovery part. The columns in the users table are id, username, password, salt, passres, and passexp. passres is the reset token, and passexp is the expiration time... |
I have Clips that can be added to or removed from any number of Lines. When I add the Clip, I put it into a ClipHolder so I can keep some bounds information with it which is specific to the Line / Clip relationship.
The trouble comes when I want to remove a Clip from the Line. I need to remove the ClipHolder in the ass... |
I have written a basic C Shell. It features the builtins cd, programmer, ver and exit. The code for the shell, named vsh, is as follows:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#define BUFSIZE 1024
#define TOK_BUFSIZE 64
#define TOK_DELIM " \t\r\n\a"
char *... |
I have created a game called 'runes' in C. It is similar to Chess, but has a bigger board and different pieces. I would like to know how I can improve the code, for example, by adding proper error checking and by fixing any bugs. (This is probably not called 'broken code' because the main functions work fine.) Also, th... |
I have implemented the Dining Philosophers Problem in Clojure with refs, trying to emphasize readability. Please point out if parts of it are inefficient, not idiomatic, or improvable in any way. Full code on GitHub.
;;;;;;;;;;;;;;;;;;;;
;; DINING ;;
;; PHILOSOPHERS ;;
;; PROBLEM ;;
;;;;;;;;;;;;;;;;;;;... |
All the test cases pass except one of the test case which runs > 10 seconds. What can I do to make my solution faster?
def in_row(grid,i,k)
grid[i].include? k
end
def in_col(grid,j,k)
0.upto(8) do |i|
return true if grid[i][j] == k
end
false
end
def in_grid(grid,i,j,k)
x,y =0,0
x = 3 if ... |
While understanding the MVC pattern, I came across this particular article. I thought to implement it using the C++/QT library.
The intent over here is to implement/use MVC concepts in correct way. Awaiting the feedback/review comments from community.
model.h
#ifndef MODEL_H
#define MODEL_H
class Model {
public:
Mo... |
I am solving the following problem:
You are given two lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a list.
I wrote the following code:
let addTwoNumbers (a: int list) (b: int list) =
let rec... |
I am prepping for a junior level interview in C#. I am hoping I can get some feedback on how to improve my code to print the most common occurrence of an int in an array.
using System;
using System.Collections;
namespace FrequentInt
{
class MainClass
{
static void CommomOcurrence (int [] array, Hash... |
I have a project where I'm to implement a DFS using a direct graph. The implementation should print the currently visited vertex, the parent (the node from which the current node was reached), and the discovery and finish time for each node.
Using these graph values:
int[] vertices = {1,2,3,4,5,6,7};
int[][] edges = {{... |
I'm yrying to practice some OO PHP and I'm just wondering if what I'm doing is okay or not. Please tell me if there are any alarms in my method so that I can stop doing it and learn a better way.
In my conditional statement, I was following the rule of no else keyword, based on this article by William Durand, which tal... |
I am wanting to constantly check a URL http://www.example.co.uk/untitled.php which will either return 1 or 0 on my app.
Is the most efficient way to do it by repeatedly requesting the URL every second like this?
Function to return content of URL
-(void)getOnline{
if(connected==0){
NSString *uuid = @"59xxxf... |
I have created a game called Runes in C. It is similar to Chess, but has a bigger board and different pieces. I would like to know how I can improve the code, for example, with user interface improvements.
This question is not a duplicate of that question, because this one has a revised and easier to read version of th... |
I'm am writing a Linux kernel driver for HD44780 LCDs connected via I2C bus. In my last change I tried to decouple low-level code (which talks to the device via I2C) from device's logic (printing characters, parsing special characters, managing screen geometry etc.). I tried to solve it via a callback and it seems to w... |
Coming from a OO (C#) background, I am trying to learn some FP. To help me transition, I am trying to learn F#. I am taking baby steps.
I set myself a simple challenge to count the instances of each letter in a sentence, ordered alphabetically. ("Hello World" -> "[D, 1]; [E, 1]; [H, 1]; [L, 3]; [O, 2]; [R, 1]; [W, 1]; ... |
I am preparing for a interview for a junior level c# position. I take two arrays and find the common int between both of them. Let me know if you have any feedback.
using System;
using System.Collections.Generic;
namespace CommonElement
{
class MainClass
{
static void EnterArray1IntoHashSet (int[] ar... |
I've recently taken a renewed interest in non-standard languages like Brainfuck and TIS-100. I'm currently writing a Fibonacci generator in Brainfuck which differs a bit in approach from the usual generators already around.
Since my current understanding of the language is very limited, the limited debugging capabiliti... |
We've been hard at work creating a browser-based GUI/Client for playing the Cardshifter TCG for the past week or so. Today, I just finished doing a pretty complicated layout for the chat lobby, along with @SirPython who put together the JavaScript/AngularJS code, which I will include with his permission.
Here's the ful... |
This is a little baffling to me as to why the CUDA code runs about twice as slow as the CPU version. I am just counting all the primes from 0 to (512 * 512 * 512). The CPU version executed in about 97 seconds whereas the GPU version took 182 seconds.
CPU: Intel Core i7 @ 4 GHz
GPU: NVIDIA GTX 960
Any ideas why?
#incl... |
I have created a login script to demonstrate the usage of sessions in PHP. The focus is not on security, databases or encryption. The idea is to exemplify how you can use sessions to protect pages from user access.
Key points to focus on:
Logical structure (return early, missing checks, error handling).
Compliance wit... |
I've been reading Dive Into Python and I needed to actually program something before I forget everything I learned. So, this is my first Python project (apart from trying the basics and playing with console).
I first wrote this using lots of globals but that looked stupid so I rewrote it as a class. It was more-or-less... |
I was going through design questions frequently being discussed in interviews and have found a problem which states:
Consider a company which wants to process salary hikes of its
employees during recession period. As a precautionary measure, instead
of hiking all employee salaries it decided to hike only for the
... |
I recently added this ShaderBatch to my engine, which takes care of rendering objects which share the same render technique (shader), like billboards and lights. I would like you to point out if there are any relevant changes I could make to my class.
PS: Is the term "ShaderBatch" appropriate ?
ShaderBatch.h:
/*
* Sha... |
I have written a function to take some shorthand input and expand it into the full form, for example a-z0-9 becomes abcd...789. I added protection from buffer overflow exploits (knocks on wood), and have covered (or think I have) all and any edge cases that the user could throw at it.
Are there any ways in which my cod... |
I am making a dropdown menu in JavaScript for my website, and recently I decided I wanted to make it a plugin (as in, upload it on the web and make it compatible with other plugins). I am new to making plugins (and JavaScript) and I was wondering what you think of my code. My goal with the plugin is so that all the use... |
I made a custom UITextView for vertical Mongolian writing. It is made by subclassing UIView, which has a subview called rotatedView. This rotatedView itself has a UITextView subview. So there are three views: a parent, a child, and a grandchild.
The UITextView contains the actual text. The rotatedView is a container t... |
I started with my own implementation of an algebraic calculator but ran into issues very early into the process. Then, I implemented the algorithm here. Please provide some inputs on areas where I can improve.
#include <iostream>
#include <stack>
#include <string>
#include <algorithm>
class infixProcessor{
public:
... |
I have created this library mostly for a learning experience with sockets and threading.
For this review, focus on socket/threading. Let me know if I properly implemented both. If you want to comment on other part go ahead I'm open to any comment.
I have read this for the threading code.
I'm using lock() and ManualRese... |
I have a switch statement with five cases, and four of them are really similar to the others. How could I properly refactor this code to eliminate the duplication of code?
func appendOperand(operand: Operand) {
let displayedString = amountLabel.text!
if displayedString.last != decimalSeparator {
switch ... |
Recently I've been fiddling with the idea of sending a text message using C. Looking at a few options, I thought that using libcurl to send an SMTP email using TLS for some security would be the best and easiest option. Here's what I would like reviewed:
Method: Is there a better/easier way I could be sending an SMS... |
I want to improve my implementation for the following problem:
You are given an array of n integers. A sub-array is "Negative" if sum of all the integers in that sub-array is negative. Count the number of "Negative sub-arrays" in the input array.
Note: Subarrays are contiguous chunks of the main array. For example i... |
I solved this prime number verifier problem:
import scala.io.StdIn
object Main extends App {
val testCases = StdIn.readInt
for (i <- 0 until testCases) {
val limits = StdIn.readLine.split(" ")
val m: Int = limits(0).toInt
val n: Int = limits(1).toInt
for (j <- m to n) {
var prime = false
... |
I have tried to write a small light weighted php session handling class that use PHP's session_set_save_handler() function to overwrite the default session handling functionalities and usage Database to store the sessions data instead of default files system. It checks for possible session hijacking attempts and renews... |
I am studying multi-threading and have tried to implement a thread pool. Please provide feedback, mostly from multi-threading point of view. I have implemented two pools, one for adding tasks in queue and the other for taking and executing the requests.
PoolManager.java
package com.learn.threading.threadpool;
public cl... |
I have a method which will send a text mail using JavaMail API and I am trying to write a test case for this method which will check if an Exception of type javax.mail.MessagingException is not thrown.
If a MessagingException type exception is thrown, the test will fail, else it will pass.
public void sendMail() throws... |
Last weekend I had an idea: Why not remove dozens of classes by removing all the basic get/set/equals/hashCode implementation of my data object interfaces? I tend to code against interfaces, so I normally end up, for example, with an "Account" interface and at least one implementation (AccountImpl), etc. But most of th... |
See the next iteration.
I was in the mood for some basic AI, and decided to code up an algorithm for solving "\$M\$ missionaries, \$C\$ cannibals in the boat with \$B\$ places" -problem:
Demo.java:
package net.coderodde.fun.cannibals;
import java.util.List;
import net.coderodde.fun.cannibals.support.BreadthFirstSearch... |
I am new to VS 2012 and need to use it with SQL Server. I need to get data from a table in SQL Server 2012 with 500 rows and 15 columns and process the data in it and update another table. All this has to be done in 100 ms.
I tried traditional method with SQL query filling a dataset and then access the table, rows and ... |
We used this VBA code mainly to hide blank rows and unhide non-blank rows. After that, the second code sorts the rows by a defined column value once the worksheet activates. This process takes too much time with this code.
Could anyone help me optimize this code and make it faster? (The worksheet contain an average of ... |
I have written this code for checking whether all leaves are in the same level or not, in a binary tree. Any suggestion or improvement is appreciated.
import java.util.LinkedList;
import java.util.Queue;
public class Methods {
//* ---- Method for check whether all leaves are in the same level or not --- * ... |
My services(or services that depend on services) need to know about a current action group id. To add an extra optional parameter to each service for the id was an idea but in my current environment to difficult and ugly because every service would have to take in the parameter only to pass it to other services.
My sol... |
#include <iostream>
#include "Point2d.h"
#include "Collection.h"
#include "Coordinates2d.h"
#include "graphics.h"
#define PRECISION 0.01
Point2d Approximate(double t, Point2d const & pt1, Point2d const & pt2)
{
double x = pt1.x * (1-t) + pt2.x * t;
double y = pt1.y * (1-t) + pt2.y * t;
return Point2d... |
I have written code to get all urls on a webpage & put them in a set, and would like tips on simple changes I can make to increase its performance.
soup = BeautifulSoup(html_doc)
for link in soup.find_all('a'):
url = link.get('href')
if url is None or ' ' in url or '<' in url or '>' in url:
continue
... |
My webservice class:
public class ConnectionExector {
private Context context;
private static final int WAIT_RESPONSE_TIMEOUT = 3000;
private static final int CONNECTION_TIMEOUT = 30000;
protected ExecutorService executorService;
// to handle thread result
Handler handler = new Handler();
/... |
This is a simple Game of Life implementation, with one neat gimmick: You can specify the rules that the simulator uses to decide whether cells should live or die. Congrats, God!
I'd especially like tips on:
Idiomaticity: As always, I abuse language features, and I'd like help doing that.
Efficiency: After a certain po... |
This code review request is regarding data access layer coding. I have used the method I am about to describe in a few smaller applications, but I am noticing limitations that I would like to avoid in larger applications I am working on.
The specific area of data access I am referring to is reading data and converting ... |
The code is correct, passes all testcases, I am looking for input on cleaning it, readability etc
def insertionSort(a)
return if a.nil? || a.empty? || a.length == 1
sort_index = 0
for i in 1..a.length-1 do
for j in 0..sort_index do
next if a[i] > a[j]
temp = a[i]
... |
I have these two XMLs that I want to merge together based on these conditions:
If any of the element is more than 7 weeks old, it has to be deleted.
If any of the element is newer with the same date (regardless of time), take everything from the new XML.
Sample XML:
<programme start="20150317173000 -0000" stop="20150... |
I have written the following program in Go to mergesort a singly linked list. It does bottom up merge sort and hence does not have to find the mid of the linked list. Please review the algorithm and the code for idiomatic Go.
package main
import (
"fmt"
)
type node struct {
val int
next *node
}
type lis... |
I've concerns about the code below because I'm getting a lot of unnecessary data from my DB and I delete it afterward to only have the "good" data. I didn't find any good workaround to get the data directly from the query.
Basically what I have is like the Reddit comment section. There are comments (post entity) which ... |
Short Description:
I'm working on a "small" project for our finance department. The problem I'm having is managing this large function (at the bottom). It's so large because I'm having troubles reducing the function into smaller parts without either having to pass many parameters along or recalculate some things. Any t... |
I'm working on this code for exam in an MIT Python course. It's working but I'm trying to improve it. What could I do, and what should I avoid?
aDict = { 0: 1,
1: 2,
2: 2,
4: 2,
5: 2,
6: 3,
7: 2}
values=list(aDict.values())
keys=list(aDict.keys())
value_copy=values[:]
uniqe=... |
I just finished writing a simple version control. You register files using "add", and then "com" will save them inside a directory, with an ID attached to it, same ID for all files. With "rev" it will copy back the content of the files, but won't delete any file other than the one in the "commitdir".
package main
impo... |
I scraped some data looking at trajectories of popular posts on Reddit, and now I want to group and histogram them by type. I put this class together in C++ to do so. Characteristics of the data are that they contain a value and a time (treated as y value and x value) for each data point and that the number of data poi... |
In this exercise, I do not want to use any container such as Spring or Glassfish. I am deploying my application to Tomcat. I only use JPA. What I want to achieve is to follow best practices and OOP concepts correctly, and a good separation of concerns and layering.
I have a database table like this:
mysql> DESCRIBE boo... |
Here is an attempt to sum even extremely very large numbers. As the extremely bigger numbers are fed to the method as String type this became possible. This method can accept even negative numbers also. However for positive numbers, the + sign must not be provided too.
import java.util.Arrays;
import java.util.Scanne... |
I learned code about a week ago and I wanna hear some recommendations and stuff I could add to my code. This is a fight system I made for my text based game. Please tell me what I could do better.
import random
import time
import sys
def fight_snake():
fdmg1 = int(random.randint(1,7))
edmg1 = int(random.ran... |
I have written a small class to generate and animate one of those trendy particle webs. I plan to use this as the main background of my personal website, so naturally I'm concerned about the performance.
Currently, Chrome's task manager shows it sucking up anywhere between 10% CPU and 20% CPU. I'd like to lower that ... |
I want some recommendations or something I could add to the game. Please tell me what I could do better or what I did wrong. I made this during the time I learned Python.
import random
num = random.randint(1, 100)
while True:
print('Guess a number between 1 and 100')
guess = input()
i = int(guess)
if i ... |
Main question
I am setting a font for a UITextView that is a subview in a custom view. I only set it if the user didn't specify the font size in the Interface Builder.
I have the following working code
if self.view.font == nil || self.view.font!.fontName != mongolFontName {
view.font = UIFont(name: mongolF... |
I am working on building an RC car/robot with Raspberry Pi and Arduino. I connected Arduino to Raspberry Pi using USB and send serial commands with python. I haven't done much programming with Arduino nor Python.
This just the beginning of this project and would like to get feedback on the code. Is it a good practic... |
This is my first text-based game I made. It's very small because I just learned Python and wanted to start small and then code bigger programs. Please comment on this.
import random
import time
import sys
def fight_enemy(enemy_name, min_enemy_damage, max_enemy_damage, min_player_damage, max_player_damage):
enemy... |
I'm learning JavaScript and have tried making a simple quiz from scratch.
JS Bin
//Define global variables
var count = 0,
zCount = 0,
yCount = 0,
sumPoints = 0,
aQuestion,
allQuest,
aChoices,
bChoices,
allQuestions,
... |
I have a function that takes a description as a String and returns a shortened version of the description.
The shortening is done by checking if a word matches the key of the HashMap<String,String> map and replaces the word by its abbreviation defined as the value in the HashMap. If the word cannot be found it in the H... |
Is there any easier/shorter/better way to do the marked part?
plnkr
<body ng-app="">
Apple <input type="checkbox" ng-model="apple" aria-label="Toggle ngHide"><br/>
Banana <input type="checkbox" ng-model="banana" aria-label="Toggle ngHide"><br/>
<div>
<!-- This part-->
<div ng-show="apple || banana">
You wa... |
Below function checks if a grade exists
----------------------------------------------------------------------------
-- CHECK IF THE VALUES WE PASSED AS PARAMETERS EXISTS AS A ONE ROW RECORD IN THE TABLE
----------------------------------------------------------------------------
function record#exists(
i_m... |
I need to write an IntArray implementation for college. I'm wondering if my code could be better and if it is efficient. In the header file are the methods listed that we need to write.
Header file:
#ifndef INTARRAY_H_
#define INTARRAY_H_
#include <iostream>
using namespace std;
class IntArray{
private:
in... |
I recently created this website for use as a portfolio because I thought it would help set me apart from other internship applicants next summer. I created this website using a mixture of pre-existing bootstrap classes and my own CSS style sheet.
I would be very grateful if anyone would be willing to offer any advice o... |
I created the below script to sent a request to a website, then convert the table in the results to an array of PSObjects which I can work with in PowerShell. This uses some nasty hacks (e.g. using a regex to strip HTML tags from my XML to try to improve the likelihood of it parsing as valid XML), but I couldn't find ... |
Like Twitter and Instagram and others I wanted to display numbers like 1.2K and 3.8M etc. My function works well enough but I would appreciate any input you may have.
function abbrNum (num) {
if(typeof num !== 'number') {
throw new TypeError('Expected a number');
}
var shortNumber;
var exponent... |
I'm stuck on Codechef problem COOKMACH, which asks for the minimum number of operations needed to transform integer A into integer B, where each operation can be either doubling the number or halving it (rounding down). 1 ≤ A ≤ 107 and 1 ≤ B ≤ 107, and B is an integer power of 2.
In eclipse, the code runs in time, but... |
This entire class came out of a chat discussion, and I'm curious on how it looks. (This is like literally 30 minutes of development time.)
The idea is to allow very easy, quick implementations of Google's reCAPTCHA ("I am not a robot") checkbox CAPTCHA algorithm. It only requires minor work from the implementor to make... |
Working on VSDiagnostics, I implemented a tool that adds the default access modifiers to C# code. An example use would be starting with this:
static class Foo { }
And ending with this:
internal static class Foo { }
This is the analyzer:
public override void Initialize(AnalysisContext context)
{
context.RegisterS... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.