instruction stringlengths 71 71.9k |
|---|
Kindly look at this code and point out design flaws or areas for improvement. I think I've done the last part right (the enum). I think the rest of the design is flawed but I am very new to object-oriented programming.
Game
//Game class establishes rules and finds winner
public class Game {
String[] gameState = new ... |
So a page where I do a search based on a bunch of filters but all of them are optionals.
I have my controller here:
def distribution
begin
@service_request = ServiceRequest.find(params[:id])
@claimed, @unclaimed = 0, 0
@conditions = ContractorSearchConditions.new()
@conditions.zipcode = @ser... |
Background
In C++ unlike other OOP languages, we do not have a Base Class from where All Classes are derived. I understand in MFC and pre STL, some Compilers did had a similar model, so lets leave it out of the discussion and focus on what the standard provides.
In C++11, auto was introduced to derive the type from rv... |
import bwi.prog.utils.TextIO;
public class MinMidMax {
public static void main(String[] args) {
int a,b,c;
int greatest, mid, smallest;
TextIO.putln("Enter three numbers");
TextIO.put("a=");
a = TextIO.getInt();
TextIO.put("b=");
... |
I have written a memory pool (pool_allocator) that was described in a book I am reading (Game Engine Architecture). The interface is pretty basic:
The constructor: pool_allocator(std::size_t count, std::size_t block_size, std::size_t alignment);.
void* allocate();, which returns a pointer to a memory location with (a... |
I am learning java and browsing posts on CodeReview and StackOverflow.
In my text Introduction to Java Programming- Y Daniel Liang it states:
The wildcard import imports all classes in a package by using ...
The information for the classes in an imported package is not read in
at compile time or runtime unless... |
In our Rails 3.2.13 app (Ruby 2.0.0 + Postgres on Heroku), we are often retreiving a large amount of Order data from an API, and then we need to update or create each order in our database, as well as the associations. A single order creates/updates itself plus approx. 10-15 associcated objects, and we are importing up... |
I have a function that processes a large amount of data. I call this function as part of a wider process via a command line script in which many similar but shorter jobs are conducted in sequence.
I have something like this:
import time
def initialise_foo():
"""do something quickly"""
time.sleep(0.1)
def init... |
I am new in haskell and for start I choosed to write simple grep. Now I want to ask if there is some simplier/shorter way to write it. For example if there is any way to avoid recursion.
parseLines :: String -> [String] -> Int -> IO ()
parseLines _ [] _ = return ()
parseLines pattern (x:xs) line = do
when (isInfix... |
http://coolwx.com/buoydata/data/curr/all.html provides weather data
from ships (or maybe buoys) at sea, but the date is given as "25/18" (meaning the 18th
hour of the 25th day of the month, all times GMT).
I need to convert this to a full timestamp ("2013-09-25
18:00:00"). All reports are in the near past. One glit... |
I've started coding C++ again after a 6 month break to prepare for a class I'm taking this quarter. I found this idea and thought it would be fun to try and code.
I originally started with input as a string, and wanted to split it into two ints at ., but this way seemed easier. Then came the rounding errors. This is w... |
I am new to C++ and with my basic knowledge of the language, I have attempted to create a simple console application filled with lots of useful functions involving math related stuff.
The following is the only version of it that I have created thus far: (also available here).
#include<iostream>
#include<cmath>
#include... |
I have an element where the jScrollPane is being used to provide custom scrollbars for an extensive text. The idea behind the code is to change the image beside the text each time the user reaches a certain amount of scroll while reading the text.
To have the code flexible, I've prepared a method to detect the number o... |
Here is my implementation of John Conway's Game of Life in Python:
from copy import deepcopy
def countSurrounding(board, row, cell):
SURROUNDING = ((row - 1, cell - 1),
(row - 1, cell ),
(row - 1, cell + 1),
(row , cell - 1),
(row ... |
Could someone help me shorten this code, please?
while cd == "monday":
if cp == "0":
for v in mon.values():
print(v)
break
break
elif cp == "1":
print(mon[1])
break
elif cp == "2":
print(mon[2])
break
elif cp == "3":
print(m... |
Problem Description
Write a program to find the maximum number of rectangles that can be
formed both horizontal and vertical with the help of a given n number
of coordinate(x,y) points. [x,y points will always be positive].
The method getRectangleCount takes 1 input parameter which is an int
array called coOrdin... |
I am trying to write a SynchronizationContext in C# that represents a message queue, to be pumped from a main loop.
Edit: I see that I have forgotten to say - I need the message loop executions to be done a single, pre-determined thread. (In my case I want to push updates to an OpenGL context.)
Here is the class I have... |
User and Role are just examples; also, code is sparse on purpose (i.e. for demonstration purposes only).
Thoughts? (e.g. good, bad, etc.)
Interfaces
public interface IEntity
{
int Id { get; }
}
public interface IUser
: IEntity
{
string Username { get; }
string Email { get; }
ICollection<IRole> Role... |
def execute(parameterName : scala.Boolean = { /* compiled code */ })
When calling this method, you can go with
someobject.execute(true)
or
someobject.execute(parameterName = true)
If you use the former, IntelliJ pops up a recommendation stating that Boolean arguments should be named. But doesn't this introduce an un... |
While responding to a SO question, I wrote the following method to convert a flat key structure to a hierarchical one as given below
In
{
property1: 'value1',
property2.property3: 'value2',
property2.property7: 'value4',
property4.property5.property6: 'value3',
}
Out
{
property1: 'value1',
propert... |
I wrote a script that will eventually go onto a Raspberry Pi. It takes a picture then uploads it to Twitter every 15 minutes from 5:30-9:00pm.
It works fine as is, but I feel I need to organize this as a class. I was wondering if someone could point me in the right direction on how to take my functions and make it ... |
I attempted to write a read-only dictionary, containing primes:
#inspired by http://ceasarjames.wordpress.com/2011/07/10/the-quadratic-sieve/
class PrimeDict(dict):
def __init__(self):
super(PrimeDict,self).__setitem__(2,2)
self.previous_max = 2
def __setitem__(self, key, value):
return... |
I've taken all the advice from here and have created a Craps class and gameplay. I just wanted to ask for more advice on how to optimize my code.
#include <iostream>
#include <cmath> // atan(), fabs()
#include "Craps.h"
using namespace std;
int main(int argc, char* argv[])
{
int choice;
Craps game;
... |
I want you to pick my code apart and give me some feedback on how I could make it better or simpler. This code converts a binary tree to a doubly linked list (in order).
public class BinaryTreeToLinkedList {
private TreeNode root;
private static class TreeNode {
TreeNode left;
TreeNode right;... |
The first line of the input stream contains integer n. The second line contains n (1 <= n <= 1000) integers { a[1], a[2], a[3], ... , a[n] }, abs(a[i]) < 10^9.
Find the longest alternating subsequence { a[i1], a[i2].. , a[ik] } of the sequence a that is the subsequence such that i1 < i2 < ... < ik, every two adjacent ... |
I am working on a small method that saves uploaded images and records the images in a database.
public function setEventImages($event_id){
foreach($_FILES['event-images']['tmp_name'] as $tmp_name){
$imgName = $this->imgPath . $this->random_name . $_FILES['event-images']['name'];
... |
I've been looking into empty abstract classes and from what I have read, they are generally bad practice. I intend to use them as the foundation for a small search application that I am writing. I would write the initial search provider and others would be allowed to create their own providers as well. My code's intent... |
I am currently using the following to convert [url=][/url] to an HTML link:
s = message.replace(/\[url=([^\]]+)\]\s*(.*?)\s*\[\/url\]/gi, "<a href='$1'>$2</a>")
That work's fine.
I then added on another replace function using a regular expression to replace www with http://www like so:
s = message.replace(/\[url=([^\]... |
So I really want to have something similar to discriminated unions in C#.
One way to do it is to use a visitor pattern, but it takes half a life to write all broilerplate code by hands.
There is another way that would allow me writing a bit less code, but it is based on delegates.
Consider the analogue of Options from ... |
So I'm implementing a linked list in Java, and so far it looks like this:
public class List <T> {
private class Node {
T value;
Node next;
}
private Node node_at(int n) {
Node seeker = front;
for (int i = 0; i < n; i++) {
seeker = seeker.next;
}
... |
A palindromic number reads the same both ways. The largest palindrome
made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit
numbers.
How would you improve the following code?
I'm looking specifically for:
performance optimizations
ways t... |
I have the following code (it looks long but it's not too bad):
function evaluate_cards(hand){
var hand_length = hand.length;
var num_of_sets = 0;
var num_of_runs = 0;
var cards_in_run = 0;
var suit = '';
var buckets = {
three_bucket: [],
four_bucket: [],
five_bucket: ... |
This is a class I implemented that can be thought of as a highly specialized version of std::list<> for pointers. It provides the additional feature that the elements can be removed in constant time with the element alone. This is accomplished with an std::unordered_map<> to associate list elements with their iterator.... |
I want to know how I can improve this piece of JS with respect to best practices/performance.
JS
var treeGroupTypes, treeType, leftLeafClass, rightLeafClass;
treeGroupTypes = ["tree-group-small", "tree-group-avg", "tree-group-large", "tree-group-large", "tree-group-avg", "tree-group-small", "tree-group-small", "tree-gr... |
Just want to know if this is safe way to clone arrays and plain objects avoiding infinite loops trigger by circular refrences:
//
!(( function ( methodName, dfn ) {
// add global 'clone' method identifier
this[methodName] = dfn();
} ).call(
self,
"clone",
function () {
var _api = {
// two arrays ... |
I’m planning on creating a Mortal Kombat-inspired game in JavaScript. I’ve written a basic game engine that manages my game states and creates a game loop.
I just wondered if it could be improved at all? As I’m a web developer by trade and this is my first foray into programming games.
/**
* Game engine.
*/
function ... |
I have navigation items that are created dynamically with PHP. I wrote this because I need to add individual classes and fire them individually. My code works, but I want a way of refining it no matter how many items are added to the navigation via the backend. Is there a way of doing this so I don't have to add 20 .sl... |
Edit: A second iteration of this problem here.
I need to provide a service (either a Windows Service or an Azure Worker Role) which will handle the parallel execution of jobs. These jobs could be anything from importing data to compiling of reports, or to sending out mass notifications, etc. They are generally long-r... |
I had an exercise to create two methods for simple queue class, first to delete last element and second to delete element at k position. Particularly I'm not asking for better implementation. Is it good enough and elegant ? What I should change ? I'll post only mentioned methods, rest should be simple enough.
/**
* De... |
I was making a relatively large-scale project in Python as a learning experiment, and in the process I found that it would be useful to have a map (or, in Python, I guess they're called dictionaries) where a value could have multiple keys. I couldn't find much support for this out there, so this is the implementation ... |
I'm using using twitter4j to fetch usernames that retweeted me. I'm interested in any feedback that make the code more elegant, and also that might reduce the number of calls I'm making to the Twitter API.
import java.util.ArrayList;
import twitone.structure.BaseTwitterClass;
import twitone.structure.TwitApplicationFac... |
I want you to pick my code apart and give me some feedback on how I could make it better or more simple. This code finds inorder successor in a binary tree.
public class Successor {
private TreeNode root;
private class TreeNode {
TreeNode left;
TreeNode right;
TreeNode parent;
... |
I want you to pick my code apart and give me some feedback on how I could make it better or more simple.
class TreeNode {
private TreeNode left;
private TreeNode right;
private TreeNode parent;
int item;
public TreeNode (TreeNode left, TreeNode right, TreeNode parent, int item) {
this.left ... |
Do you have an idea to "transfer" this CSS Code to Javascript (maybe jQuery)?
html { background-color: #B94FC1; }
html:before, html:after { content: ""; height: 100%; width: 100%; position: fixed; z-index: -6; }
html:before { background-image: linear-gradient(to bottom, #5856D6 0%, #C644FC 100%); animation: fgradient 5... |
Here's my first HTML5 game: a really simple snake. I've never made a game before and haven't had too much experience with JavaScript.
Fiddle
$(document).ready(function(){
// SNAKE SETTINGS
var SQR_SIZE = 10;
var FRAMES = 100;
// SNAKE VARIABLES
var snakeSpeed = 50;
var moveCount... |
I want you to pick my code apart and give me some feedback on how I could make it better or more simple.
public class MaxSumPath {
private TreeNode root;
private static class TreeNode {
TreeNode left;
TreeNode right;
int item;
TreeNode (TreeNode left, TreeNode right, int item)... |
As far as I know (and I don't claim to know much about this!), direct binding to ListView.SelectedItems isn't possible in WPF. I've seen work-arounds involving code-behind which I'm not too crazy about, especially since I'm having a hard time with getting a DelegateCommand to work, and decided to use RoutedCommands. Fo... |
from string import punctuation, ascii_lowercase
def is_palindrome(string):
"""Return True if string is a palindrome,
ignoring whitespaces and punctuation.
"""
new = ""
for char in string:
lc = char.lower()
for x in lc:
if x in ascii_lowercase:
new += x
... |
I'm building a text search system for a web application in PHP. I wrote this function that gets the sentences of the text which contains the keywords used by the user and also highlight them (well, surround them with any tags anyway).
I'm measuring an average of 23ms if only the first matches is retrieved, and about 27... |
I'm not a Javascript expert, so please review this function for me. Also, it could be that there is something in any of the library we're using in our project that can do something similar for me (angular, foundation, jquery, underscore), but I'm not too familiar yet with most of them.
// helper function, parses numer... |
var appname = " - simple notepad",
textarea = document.getElementById("textarea"),
untitled = "untitled.txt" + appname,
filename = "*.txt",
isModified;
document.title = untitled;
textarea.onpaste = textarea.onkeypress = function() {
isModified = true;
};
function confirmNav() { // Confirm navigat... |
I want you to give me some feedback on how I could make it better or simpler.
public class NonRecursiveTraversal {
private TreeNode root;
private static class TreeNode {
TreeNode left;
TreeNode right;
int item;
TreeNode (TreeNode left, TreeNode right, int item) {
t... |
I just wrote my first Java class, and I wanted to share it with you and maybe get some quick check from more experiences coders than I am.
I want to learn OOP, and Java is just the tool I thought was the best to start with (it's very similar to C in syntax, which I'm used to, and it's spreading more and more, day by da... |
Since the resources I found to learn are generally out-of-date, I'm having to read a lot of documentation, which makes the learning process somewhat haphazard. The module makes a simple character stack which can be read and written to by multiple processes.
#include<linux/init.h>
#include<linux/module.h>
#include<linu... |
There is a char array of n length. The array can have elements only from
any order of R, B, W. You need to sort the array so that order should R,B,W
(i.e. all R will come first followed by B and then W).
Constraints: Time
complexity is O(n) and space complexity should be O(1).
Assumption:
You can assume one s... |
I need some feedback for this set of value-test functions (are they doing what they say they do). Also ways to improve some of them, suggestions to add more test functions, etc.
// Object.test.isnumeric('0x12') -> true, etc.
!(( function ( field, define ) {
this[field] = define();
} ).call(
Object,
"test",
functio... |
Ok, code reviewers, I want you to pick my code apart and give me some feedback on how I could make it better or more simple.
public class PrintAllPath {
private TreeNode root;
private class TreeNode {
TreeNode left;
int item;
TreeNode right;
TreeNode (TreeNode left, int item,... |
I'm starting out and need feedback in order to discover the things I'm doing wrong.
This is supposed to behave like strcmp():
int compare(char *str1, char *str2)
{
while(*str1 || *str2)
{
if(*str1 != *str2)
{
break;
}
++str1;
++str2;
}
return *str1 - *s... |
I'm working my way through The Java Programming Language, Fourth Edition - The Java Series. This is Exercise 6.4:
Expand your traffic light color enum from Exercise 6.1 on page 152 so that each enum constant has a suitable Color object that can be retrieved with getColor.
The enum from Exercise 6.1 is as follows:
en... |
For the purpose of this problem, the BST is defined to allow duplicates, and the duplicate values will always follow to the right-side of the parent nodes with the same value. For example, with the data:
1, 2, 2, 2, 2
if the root node has the value 2 (as opposed to 1) then the tree will look like:
2
... |
This is a Python script that I use on my Android tablet. It moves the files in the Download folder to a folder on the external SD card. The files are sorted based on their extensions and are moved to folders (for each different type of extension). If it encounters a new file type, it will create a new folder. If th... |
I want you to pick my code apart and give me some feedback on how I could make it better or simpler.
public int heightHelper(TreeNode node) {
int height = -1;
if (node == null) return height;
final Queue<TreeNode> queue = new LinkedList<TreeNode>();
queue.add(node);
int currentLevelNodeCount = 1;... |
This essentially checks if any of these if statements are true, then echos a statement.
Unfortunately, wrapping the error message with a div tag is impossible since I set error to 1 after I would have the div tag show up. I assume I could use a function for this but I don't understand how they work.
Is there a better w... |
Ok, code reviewers, I want you to pick my code apart and give me some feedback on how I could make it better or more simple. Also its really hard to make this code work if preorder array contains duplicate. Any code/psuedocode is useful.
public class PreOrderTraversalBST {
private TreeNode root;
private stati... |
I've started my first application using backbone and have something basic up and running, backbone seems to give a lot of freedom to application design and I don't know what I'm doing right and wrong in that regard. I'm just after some tips and criticism.
The first view is for the details which should be visible when t... |
I ask if the following code need some refactoring :
public static int InsertBonus(DataTable dt, int month, int year)
{
int affectedRow = -1;
using (IfxConnection con = new IfxConnection(ConfigurationManager.ConnectionStrings["xxx"].ToString()))
{
using (IfxTransaction tran = con.BeginTransaction())... |
Implement data structure overflow queue. Overflow queue is a normal queue with one extra property. It never throw Stack overflow exception. So whenever queue becomes full, it replaces the oldest element present in the queue and front pointer simply shifted one step ahead. Constraint:- it should have public void enQueue... |
Is there a more efficient algorithm to generate random numbers in C++?
(This code is working on Dev-C++, but I'm not sure if it works on a Borland compiler.)
/*
Author: Arpit Agrawal
Email: arpitagrawal294@gmail.com
Description: Dice Roll Algorithm.
Project Name: e-Roll.
*/
#include<iostream.h>
#include<coni... |
I have tested all the cases of how a line could be
vertically
horizontally
has a slope that's positive or less than 1
The function works, but I would like it reviewed, such as if there are overflows, etc.
// Draw line using DDA Algorithm
void Graphics::DrawLine( int x1, int y1, int x2, int y2, Color&color )
{
f... |
I'm changing an HTML datepicker value (#date) into 3 separate values in order to post them to a booking engine. I've managed to get it to work but there is a lot of repetition and the original #date value is also submitted unnecessarily.
The engine takes these parameters:
date_day=27&date_month=9&date_year=2013&nights... |
I want you to pick my code apart and give me some feedback on how I could make it better or simpler. Although, agree that generics should be used, instead of integers, let's punt on generics as a review for now.
public class CreateBinarySearchTree {
private TreeNode root;
public CreateBinarySearchTree() {
... |
I have written a small wrapper class for using PHP Mcrypt for encrypting and decrypting text data. This class generates a salt for hashing the key and encrypts the given data with the generated key hash. The encrypted data get stored with the initialization vector and the key salt into a container class. The container ... |
I am writing PHP code to update a database, but this code is extremely repetitive and thus error prone. I am effectively typing the variable names six times each! Can this be improved without loosing functionality? I am certain there must be better way!
First, the definition of the demandArrayValue function:
function d... |
Ok, code reviewers, I want you to pick my code apart and give me some feedback on how I could make it better or more simple. ( Generics would be added a bit later).
public class CreateABinaryTree {
private TreeNode root;
public CreateABinaryTree() {
}
/**
* Constructs a binary tree in order of e... |
I'm reading TDD By Example by Kent Beck (which I highly recommend, if you haven't read it!) In The xUnit Example, he discusses how to collect the results of multiple tests in a single TestResult. His code looks like this:
# in TestCase
def run(self, result):
result.testStarted()
self.setUp()
try:
me... |
I am trying to clean up and make the following code more efficient -
https://gist.github.com/eWizardII/6757364
from PIL import Image
import numpy as np
from PIL import ImageChops
import subprocess
import math
import datetime
from PIL import ImageFont
from PIL import ImageDraw
from collections import deque
def image_e... |
The following script is being used to generate the status line in wmii. I'm curious if there are faster/more efficient ways to find the various info I'm grabbing. I'm also a relative newbie when it comes to zsh (and shell scripting in general) so I'd also suspect that there are better ways to process some of the data.
... |
Ok, code reviewers, I want you to pick my code apart and give me some feedback on how I could make it better or more simple.
public class Trie {
private static final int ASCII = 256;
private TrieNode root;
public Trie () {
root = new TrieNode();
}
private static class TrieNode {
... |
I'm wondering what would be the best way to calculate the hashcode when the order of a sequence doesn't matter. Here's the custom IEqualityComparer<T> i've implemented for an answer on Stackoverflow.
public class AccDocumentItemComparer : IEqualityComparer<AccDocumentItem>
{
public bool Equals(AccDocumentItem x, Ac... |
Here I want to lock when populating a particular cache object, without blocking other calls to the same method requesting Foos for other barIds. I realise the MemoryCache will be thread safe, but if two or more concurrent calls come in it seems like it would be better if only one of them populates the cache and locks t... |
I have a data structure composed of several std::lists, each sorted by a specific criterion. When a new item is inserted into this data structure, there is a need for a reference item already in this data structure. Also all the items between the reference and insertee need to be collected into sets.
According to the p... |
I am a beginner in Digital Signal Processing and I was trying to compute and plot an autocorrelation.
I've wrote this piece of code:
r = [zeros(2,1); y(1:98,1)];
r = r.*y;
and I wished to know if this is a valid way of computing an autocorrelation.
|
This is my simple Fibonacci implementation in CoffeeScript. What do you think? Using cache (fibResults), it's very very fast.
fibResults = []
defaultMax = 1000
nrMax = defaultMax
fibonacci = (n) ->
return fibResults[n] if fibResults[n]
if n < 2
fibResults[n] = n
else
fibResults[n] = fibonacci(n - 1) +... |
By having two model classes Conversation and Message, what are the best practices to handle the next situation: A conversation listening for its messages PropertyChanged events and so being able to update itself.
What are the best practices?
How can I improve this model design?
Is it going to generate memory leaks?
... |
I'm a C++ programmer using SPOJ problems to learn C(99). This is my solution to the problem CMEXPR, where the goal is to read a valid expression (+, -, *, / only) from input and write it on output with superfluous parentheses removed.
The code yields correct answer according to the online judge (got an AC). My question... |
This is pretty much an OOP version of this question, with the improvements:
import copy
import shelve
class GameOfLife(object):
def __init__(self, board, generations = 10):
self.__board = board
for i in range(generations):
print(self)
self.__nextGeneration()
def __s... |
I have a ByteArray value as avroBinaryValue , Schema Id value as short schemaId and Last Modified Date value as lastModifiedDate in long.
short schemaId = 32767;
long lastModifiedDate = "1379811105109L";
byte[] avroBinaryValue = os.toByteArray();
Now, I will write schemaId , lastModifiedDate and avroBinaryValue togeth... |
I have been working a number pyramid program. This is a question from Y. Daniel Laing's Introduction to programming using Python (which is based on Python 3.2). The question is from chapter 5, and it is number 5.19 in programming exercises portion of the chapter. The question is stated as follows:
Write a program tha... |
I am working on a bigger project and want to separate game updates from rendering and not end up with a super complicated game loop. So I came up with the idea of isolating the problem and writing a controller for this. My game loop looks like:
public class Game {
public bool Running;
public void Loop()
{
... |
Can someone please find out why this store procedure is timing out?
ALTER PROCEDURE [dbo].[Insertorupdatedevicecatalog]
(@OS NVARCHAR(50)
,@UniqueID VARCHAR(500)
,@Longitude FLOAT
,@Latitude FLOAT
... |
I was trying to solve the final puzzle at the end of the classes chapter (Chapter 8) in "Python Programming for the Absolute Beginner" which is stated as:
Create a Critter Farm program by instantiating several Critter objects and keeping track of them through a list. Mimic the Critter Caretaker program, but instead of... |
I'm messing around with JavaScript and am trying out objects, functions & arrays. I'd like to know if someone has tips about making it better, shorter, or has a better solution for what I have thought about for now. What I've tried to do is just do simple math (+ and -) using arrays as input for numbers. It all works... |
Using a combination provided from this example and this implementation, I'm creating a solution that decouples the UnitOfWork class from the individual repositories, as they violate the Open-Closed Principle: every time you added a new repository you would have to modify the UnitOfWork class. I am using Unity 3.0 as t... |
I need to provide a service (either a Windows Service or an Azure Worker Role) which will handle the parallel execution of jobs. These jobs could be anything from importing data to compiling of reports, or to sending out mass notifications, etc.
Database Design:
The whole process of running these jobs is persistent. ... |
This is my very first Bash script that does something real. I'm here to learn, so please tell me if and how this can be done better.
#!/bin/sh
# Daniele Brugnara
# October - 2013
if [ -k $1 ]; then
echo "Error! You must pass a repository name!"
exit 1
fi
SVN_PATH="/var/lib/svn"
currPath=$(pwd)
cd $S... |
I'm trying to create a custom div scroller. I got it working, but it's still a little rough around the edges. Please take a look..
DEMO
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="s... |
Is there a more efficient way of achieving the same result besides setting up a database?
# In reality, contains 4 million tuples.
stuff_tuple = (
('hello', 241, 1),
('hi', 243, 3),
('hey', 242, 2)
)
# Convert tuple to set for faster searching?
stuff_set = set(stuff_tuple)
# Only first two values are know... |
I wrote some code using meteor, which is working, but I don't know if I did it the best way. I'm asking for opinions on other ways to perform this task.
It's just a list of places. You can fill the textfield with a place and it'll appear on the list. You have an option to remove the place by clicking on the "x".
Ver... |
Originally my wireframe was
But I ended up going with this in testing. The image is the result of my new code.
Keep in mind that the actual content is just filler content and will be dynamic. I just wanted to get the styling in place.
I created each article with the following code
HTML
<div class="discusBox">
<im... |
I am pretty new to Python but I'm learning from classes.
I am working on a project for class and this is my code. Anyone got a better idea of a way to organize the code or put it differently so there aren't so many conditional statements?
def cm(centimeter):
"""Centimeter to Meters Converter!"""
if centimeter =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.