instruction stringlengths 71 71.9k |
|---|
I would like to create a simple interface to allow a user to make a few choices via select boxes and drive a resulting equation.
Here's a screenshot:
This is a gross simplification and I am looking for guidance/suggestions throughout my existing code.
Some areas of concern:
Should I be looping through the inputs?
Whe... |
This gives me the output of how many times the word is in the file. (I will eventually want to enhance the program to output on what line of the file the word is.)
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io... |
Python sets are magical things. Mutable, deduplicating data stores with handy operator overloads for &, ^ and |.
Specifically among the others, sets overload the & operator to do mutual membership tests like so:
>>> set("aasd") & set("aabc")
{'a'}
This is endlessly handy, but the huge downside of sets is they do not a... |
I came across this problem:
The following iterative sequence is defined for the set of positive
integers:
n → n/2 (n is even)
n → 3n + 1 (n is odd)
Using the rule above and starting with 13, we generate the following
sequence:
13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1
It can be seen that this sequence... |
Background
A prototype of a firefighting robot has been done recently based on an Arduino microcontroller. It has two servos, one laser LED and 2WD motors. The desktop application is done in C# to control the robot.
Desktop app logic
For controlling two servos, I am using the x-y mouse position on the screen and bind k... |
I am new to Ruby (1 year as hobby project on weekends) and solved a code challenge and it was not as good as they wanted. I want to know how i could make it better and how to make the structure better. In summary, how would a mid or senior ruby developer do this challenge?
This is the task:
Write a program that prints... |
I've just begun programming Java and I'm working on the following code that deals with socket-based communications. Basically it connects to a client on port 8888:
Gist of code
package com.mobile.stoq.stoqpay;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import or... |
I must write code for my classes which simulates multi-layers production line. But I don't even know how to check if it's good. Can anyone take a look at my code, please? First machine works in random frequency putting integer into first queue. Then, second machine puts out this number at freq2, adding 100 and so on...... |
I decided to make something to count the significant figures in a number to see how easily it could be done, but I think there may have been a better or simpler way. Any advice even just for conventional purposes is appreciated!
def count_sig_figs(answer):
'''This fucntion will count the sigfigs used in the answer ... |
I have implemented a program that produces a permuted index.
Actually it is this exercise:
https://stackoverflow.com/questions/4015016/what-is-a-permuted-index
Could anyone tell me if I did something wrong, and if it could be done better?
An input is for example:
The quick brown fox
And result:
The quick bro... |
I'm having trouble deciding if I should leave the default: break; in the switch statement or not. It does kinda show intent, i.e. that most keys are not handled, but it's also effectively useless code. I feel like it's clear enough anyway, but maybe being explicit is better?
function handleKeyDownEvent(event) {
swi... |
I've written code to be called from Powershell like so:
Rename-DatabaseUser -Name 'someuser' -NewName 'somenewuser'
I'm wondering if there's another way I can approach this. I want to create objects of the same type with slightly differing property values.
Here's the code I'm currently using now (RenameDatabaseUserCmd... |
I'm looking for feedback on improving the structure of this code. Also, I could not find the command line executable for Chrome.
General feedback is also requested.
#
#
#
# Divider - configures bash, git, grunt, sublime and chrome
#
#
#
user1=foo
config_bash() {
rm ~/.bash_profile
ln -s ~/root/config/bash/lo... |
Just looking for a review on my code, its currently only player vs player, but I'll be working on the AI soon enough. Functions edit_name, tutorial, and AI have been left out as I haven't started work on them.
class tic_tac_toe:
board = [" "," "," ",
" "," "," ",
" "," "," ",]
players... |
Summary
I have written a pair of Perl scripts that form a UDP chat room allowing users to send messages over the internet with RSA encryption, making the messages imune to MITM attacks. The scripts include a server script and a client script, and works as would be expected with the clients connecting to the server with... |
I haven't really worked much with asynchronous code so I'm wondering if I am doing something wrong/something could go wrong. Right now of all the test cases that I have done, my code has worked but I'm not sure if I will get side effects or not.
I won't post any of the business logic, just the iteration part with the a... |
Take a look at the following code and let me know if its right, and if there is any room for improvements.
Strategy Class
<?php
/**
* Draw Strategy class
*/
abstract class DrawStrategy
{
abstract function draw(Shape $shape);
}
/**
* This is ConsoleDraw and takes the shape object and draws accordingly, Drawign Al... |
Products Class that are like
Table, Chair, etc.
Please review it and give your thoughts and let me know if there are any rooms for improvement.
Products.php
<?php
abstract class Products
{
}
class Table extends products
{
public function __construct()
{
echo "New Table Created";
}
}
class Chair ... |
I made this decimal to binary conversion as an exercise for myself and because it is obviously often asked during job interviews / tests.
Any hints concerning possible improvements welcomed.
// -- START : Testing the function --------
var display = document.querySelector('div');
var result = '';
var n = 255;
var maxS... |
In my country (South Africa) mobile numbers have 10 digits and always start with a "0" (e.g. 0821231231).
But they can also have the international dialing code ("+27") replacing the "0" (e.g. +27821231231).
I have this regex:
((\+27)|(^(?!\+)(0)))\d{9}
Is there any way that this can be improved upon?
|
How can I improve the following code?
private const string OAuthTokenUri = "oauth2/token";
private static string GetOAuthTokenUri(string uriAddress)
{
var uri = new Uri(uriAddress);
var baseUri = uri.GetLeftPart(UriPartial.Authority);
var s = new Uri(new Uri(baseUri), OAuthTokenUri);
return s.ToString();
}... |
I have rolled my own parallel merge sort. My performance figures are as follows:
Seed: 1457521330571
java.util.Arrays.sort() in 6840 ms. Sorted: true
java.util.Arrays.parallelSort() 3777 ms. Sorted: true
net.coderodde.util.sorting.ParallelMergesort.sort() 4498 ms. Sorted: true
Arrays identical: true
Close, but no c... |
I have a bunch of processes that are being executed on different virtual machines. All of those processes have a StartDate, EndDate and Resource properties. Resource is a specific virtual machine it was ran on. I generated the actual timeline for items and found out that all of those resources have "holes" in timeline ... |
I just wanted to build a simple converter from an XLS Excel file to JSON. I have predefined JSON format. All fields except of two - are just simple mapping from Excel to JSON. The two fields have a special format, "|" separated values which should be converted to array items. I also need a geocode address and save lati... |
I have written code for insertion sort. I just want some feedback whether the above implementation is correct and can be improved.
public class InsertionSortNew {
static int temp;
public static void InsertionSort(int [] array){
for(int i =0;i<=array.length-1;i++){
int key = array[i];
... |
I'm pretty new to async/await and I want to ensure that the code I've written is going to be safe and not cause any deadlocks.
The RestClient in the code will be injected as a singleton dependency via an IoC within an ASP.NET MVC application, so that the access token request is made only once and shared across all API ... |
ok spent ages on this simple problem (I'm not good at XML) below code is probably self explanatory and it works, but i think this could be done a lot easier
Sample XML
<data>
<id name="ch01">
<channel>test channel 1</channel>
<gpio>3</gpio>
<cont>front</cont>
... |
I have just finished a simple C program which is basicaly composed of 3 functions:
accadd(void){} which adds some customer details to a binary file
void view(char file[30]){} which is supposed to let me view some of the data in a .txt file
void modify(char file[30]){} which verifies if a value of a struct is present ... |
Inside a function I'm calling playgame service. Once I've obtained the needed data (gameBeingPlayed), I need to show a 3..2..1 counter and then start a game.
chooseGameService.playGame(gameDefinitionID)
.then(function () {
vm.container.gameBeingPlayed = chooseGameService.gameBeingPl... |
I'm trying to find out what is the right approach to return DB values from a class. This is what I came up with:
class Category {
public $result;
public $errors;
public function __construct( $pdo) {
$this->pdo = $pdo;
}
public function getCategoryNames () {
$sql = "SELECT category_id, category_na... |
I want to develop a simple in-memory web request rate limiting module, I am allowed to have 50 requests from each unique cookie ID every 60 seconds.
I am wondering if the following code is an optimal way of implementing such functionality:
class RateLimiter {
private static final int MAX_REQUESTS = 50;
privat... |
I have the below toggle button sub that works;
Private Sub Toggle_Unused_Click()
Dim xAddress As String
xAddress = "DR:FI"
Call KeyOpen 'unprotects the sheet
If Toggle_Unused.Value Then
Application.ActiveSheet.Columns(xAddress).Hidden = True
'This returns a value to my notes tab.
ActiveWorkbook.She... |
(See also the next iteration.)
I have this small virtual machine.
What is there:
Stack and, thus, recursion.
Conditional and unconditional jumps and, thus, choice and iteration.
What is not there:
Floating-point type support.
Bit manipulation instructions.
No input operations, all "input" must be hardcoded into the... |
Newbie to PHP.
Trying to output the results of an array inside a foreach loop. I have got the following code but I cannot understand what to do with it next.
Mainly;
Where/how do I start and end the php statements?
Is there a better way to format this code?
I want to make it as easy to understand and legible as pos... |
Can someone tell me if my code is okay so far? I've read quite some resources online for responsive webdesign but it seems like everyone's opinion on best practices is different.
The page I'm working on is this. It's a very simple page with very little content. Right now it works quite well on smaller devices but I wan... |
I have several functions for merging some dictionaries but over time I created a more general function that would make all these others obsolete if it weren't slower.
I have the specialized (and several like it) functions that look like this:
def merge_keep_lowest(dict1, dict2, *dicts):
"""
Merge an arbitary n... |
I am doing a coding exercise in codility and I came across this question:
A binary gap within a positive integer N is any maximal sequence of
consecutive zeros that is surrounded by ones at both ends in the
binary representation of N.
For example, number 9 has binary representation 1001 and contains a
binary gap... |
What is a better way to create this select statement? I tried to just select 'u' and 'us', but the object properties were not accessible when I did this.
var userSubmittedRequests = (from u in db.TimeRequests
join us in db.UserManagers
on u.Emplo... |
I wrote this class to use a C++ function as hardware interrupt handler. The idea is to have a single entry point where I can switch stacks, and call a chain of std::function objects to handle the interrupt.
It works... but I think it's a pretty ugly hack. Is there anything I could improve here?
class __attribute__((pac... |
I have an array of API objects, below is an example of one object:
{
description: "Get a list of most recent social alerts"
example_input: ""
example_output: "status"
id: 19
method: "GET"
resource: "/api/alerts"
}
With my code below, I'm able to loop through the big Array, then filter out items... |
This function scrapes data from a webpage by spawning a process that executes a CasperJS web scraping script. The spawned process outputs data to stdout.
This function has an event listener for stdout and this is how the parent process (Node) gets the scraped data back. How can I make this more modular? Also, would cr... |
I have quite huge question/favor to ask but I hope I can get some useful answers. This is my first complete project, I'm still learning C#, my first programming language.
I'm afraid that there will be a lot of things that people won't probably understand but you can also check some of my other questions they include fa... |
I created a program on Code::Blocks that allows you to play Tic-Tac-Toe with 2 players on the same program:
#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
char square[10] = {'o','1','2','3','4','5','6','7','8','9'};
int checkwin();
void board();
int main()
{
int player = 1, i, cho... |
I've implemented an events system in C++11. I've now got it pretty much as good as I can get it. It feels like I have found an optimal design pattern, and I'm using sensible variable names to illustrate what is going on.
Still not sure what the best words are: e.g. Invoker, Dispatcher, or Notifier? Event.fire() or .pu... |
I have enhanced my itoa implementation, taking the advise from my previous simple itoa implementation in addition to handling multiple radixes and negative numbers other then just base 10. Looking for general feedback.
const static size_t complemnt_digit_coun... |
Please help me in reducing the time complexity of this code as it is taking a long time to read its Excel input.
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 9 14:26:22 2016
@author: DalalNS
"""
from openpyxl import load_workbook
import os
import shutil
filename = 'test.xlsx'
wb = load_workbook(filename, use_iterat... |
I want to improve my coding skills. How do I write this code with concatenation
string query = "insert into StudentInfo values ('" + textBox1.Text.Trim() + "', '" + Name.Trim() + "', '" + comboBox1.SelectedItem.ToString() + "') ";
SqlCommand command = new SqlCommand(query, cn);
command.ExecuteNonQuery();
|
Here is a simple client for Wwitter that I wrote based on the twitter library in Python. The aim is to be able to read the feeds from different twitter accounts from the same place in a light way.
I should mention that the code does what I want it to do. Nevertheless, how could I improve it?
(It is available on GitHub.... |
I have a method which relies heavily on object supplied by third party APIs. Below is my working code, is there any scope of improvement?
public LineItem getLineItem(
String networkId, String lineItemId) throws ApiException_Exception {
LineItem lineItem = null;
session.setCode(networkId);
LineItemSer... |
I often receive large Excel-sheets in which data has been inserted via copy and paste. Usually a lot of the cells contain whitespaces at the beginning and the end before / after the actual value.
I made a VBA-script for to get rid of these whitespaces.
' Removes whitespaces at the
' beginning and the end
' of all cell... |
This is a FIFO blocking memory queue in F# to be used as a component in a logging library.
namespace Primitives
open System
open System.Threading
open System.Threading.Tasks
type QueueOpResult<'T> =
| Success of 'T
| Failure of exn
| Cancellation
type QueueOpCancelType =
| Timeout of TimeSpan
| W... |
I have a piece of code that I would like to refactor but can't figure how to do it. This is a method from a Play controller where I have to verify many precondition and respond different status for each case :
resource should exist or 404
revision should match the If-Match value or 412
payload should be valid or 422
... |
I have a requirement for archiving 5 huge tables from PROD to ARCHIVE server without losing the integrity of the tables.
The query makes use of the Linked Server functionality and current idea is to host it on the PROD server. It is a distributed transaction which makes use of Microsoft's Distributed Transaction Coordi... |
I'm implementing an HTTP client shell that's going to be used for the lifetime of my application in C#. It needs to be initialized before the instance can be accessed. It looks something like this:
public static class AssetSyncServiceClient {
private static object _lock = new object();
private static bool _in... |
I have applied the KNN algorithm for classifying handwritten digits. the digits are in vector format initially 8*8, and stretched to form a vector 1*64..
As it stands my code applies the kNN algorithm letting the user decide on the k input. The training dataset can be found here and the validation set here.
ImageMatr... |
I decided to try make my own way to save normal python data yesterday after coming across the minecraft NBT format, it's more limited than cPickle but appears to produce shorter results and so far works reliably (if a little slower). It works on the type of the input, and is currently compatible with bool, int, str, di... |
Three questions: is there a more performant way, is there a more suscinct, strike that, a way of expressing this where if you read just the body it is immediately apperent what the alorithm does, and should I be returning and IEnumerable of an IEnumerable, I mean what would be the point over and IEnumerable of IList?
p... |
This is my palindrome-checker that is doing what it should do. If you have any additional suggestions, please let me know.
# -*- coding: utf-8 -*-
def palindrome_verif():
Mot = raw_input("Tapez votre mot \n")
Comptage = len(Mot)
Lett_Sep = list(Mot)
Decompte = 0
Der_Lett = Comptage
if ((Com... |
After first code review I have fixed the found issues. Could you please review my new refactored application?
Main class (entry point)
static class MainClass
{
private static readonly ILog Log = LogManager.GetLogger(typeof(MainClass));
static void Main(string[] args)
{
log4net.Config.XmlConfigu... |
I'm writing a Morse code translator for homework in C#. It takes an input from the user and returns the Morse code version of their input. I understand that this code may look horrible, so how could I improve it in terms of efficiency and readability?
Program.cs
using System;
using System.Collections.Generic;
namespac... |
\$19!\$ is a curious number, as \$1!+9!=1+362880=362881\$ is divisible
by \$19\$.
Find the sum of all numbers below \$N\$ which divide the sum of the
factorial of their digits. Note: as \$1!,2!,\cdots,9!\$ are not sums, so they are not included.
Input Format: Input contains an integer \$N\$
Output Format: Print th... |
I've implemented the Equals() support for my class as follows:
public override bool Equals(object obj)
{
return Equals(obj as TwoDPoint);
}
public bool Equals(TwoDPoint p)
{
return ((object)p != null) && (x == p.x) && (y == p.y);
}
This obviously doesn't match the reference implementation on MSDN, here, as they a... |
I have this function here:
<?php
public function assignData($data)
{
$aSqlData['company'] = $data[0];
$aSqlData['tx_trouserextend_contactperson'] = $data[1];
$aSqlData['username'] = $data[2];
$aSqlData['tx_trouserextend_commission'] = $data[3];
$aSqlData['tx_trouserextend_wincap_version'] = $data[4]... |
I've written a script that I would love to get feedback evaluating the following: Module Pattern implementation, robustness, conciseness, cross-browser compatibility. My goal is to eventually use this script and others, as part of my portfolio for a job application. All criticisms are most welcome, especially if you're... |
My goal is to generate a sequence of random float from a seeded random generator. The sequence should be the same on any machine / any compiler -- this rules out the use of std::uniform_real_distribution since it doesn't make that guarantee. Instead we have to create our own version of this, which we will be able to gu... |
I have an application that allows a user to create a poll that includes questions and answer choices as part of the poll. The hierarchy is a poll has one or more questions, a question has one or more answers, and each answer has a vote.
The following code is my implementation that allows the updating of an existing pol... |
So, I've created my first Chrome extension! What this does is it highlights every post on Reddit that comes from a source of dubious quality. It provides a few sources by default and allows the user to add or remove from this list. The user also has the choice between either highlighting the offending post or hiding it... |
I want to print a nice loading message with these three fading dots, while the main thread does some heavy IO stuff. This is why I implemented this:
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <stdbool.h>
static bool loadingStop;
static pthread_mutex_t loadingMutex;
void *loadingDo... |
I have a simple program that calculates and outputs the results of all the bit operators. I'm planning to send it to my friend and to explain some stuff about them to him. Before I do that, I want to know if I can make any improvements to my program.
internal class Program
{
private static int a;
private static... |
I use .NET 3.5 framework, so no tuples. I have many use cases where I have to create a custom key for a dictionary. How can I make this better?
public class CompositeKey<T>
{
public T Content { get; set; }
public Func<T, object>[] Lambdas { get; set; }
public CompositeKey(T obj, params Func<T, object>[] pr... |
The code below is an implementation of the Best First Search algorithm for navigation of the shortest path across a 2D NxN matrix. As a heuristic for the search I use the standard distance formula. The matrix is generated from a text file passed in as a command line argument,where the first line is the size N of and ea... |
I'm developing an app which stores some different user settings in app.config such as connection strings, paths for saving reports, default printer e.t.c
For retrieving them I made a static class StoredSettingsTools which contains an Enum of settings types and a public method which calls (depending of setting type) som... |
Apparently everyone gets burned by their Python unittests not running in the order they want.
I am not in the business of telling people not to do perfectly reasonable things they want to do, so I consider "write your tests differently" Not An Answer to the question "how do I control the order of my TestCase subclasses... |
I need to parse a simple JSON string (flat JSON, no hierarchy) for keys and values, and there is a system constraint that I cannot use any built-in JSON library and can only read a string once due to latency requirements. I need to use Python 2.7.x series and cannot use a higher version.
Note: This question is version ... |
I recently submitted an implementation of a singly linked list and tried to apply some of the suggestions on this implementation. I decided not to implement the List interface as I only wanted to practice what I believed to be the most important methods. I'm wondering how I could tidy this up some more and improve upon... |
This is my first program I've written ever. Don't hold back on me. Any help and feedback is appreciated. This code wont work because it requires some keys, but I censored them out, but it does compile for me and works fine. I just want some feedback on dumb things I did and how to make it better if anyone has the t... |
The following code creates a cookie on the client browser such that 25% of the browsers will have a value 0, and 75% a value of 1. Can anyone review the following code and point out any problems in it?
// AB testing code starts;
$abTestValues = array(1,1,0,1);
$abTestValue = 0;
$abTestCurrentValue = $abTestValues[$abTe... |
I have a cumulative transition matrix with probabilities for all the possible states from 1 to 5. Now the algorithm for simulating future states is following: the initial state is selected randomly, and a random value between 0 and 1 is then produced by uniform random number generator.To determine the next state in the... |
I've made a method to extract Excel data out of an existing Excel file. It contains 3 tabs where info should be extracted from. The data should be stored to use local so it's always fast available. It is currently working but it seems like I have a lot duplicate code that could most likely be written a lot shorter.
I'm... |
I have created a simple terminal program: it allows the user to enter a height and it will produce triangles of asterisks (*'s) based on the height.
I have just started learning C# as practice for my internship. I would appreciate any feedback.
using System;
public class Triangle
{
public int height;
private s... |
flatten.py
from collections import Iterable, Mapping
from operator import methodcaller
from stack import Stack
class flatten(object):
"""
Iterator that walk through nested iterable.
If the initial item is not iterable, only itself will be yielded.
Args:
item (Object): Any object.
... |
This function try to scan the given function in n dimensions in the given range by adaptively divide the area into n+1 points polygon (e.g. triangle in 2D; tetrahedron in 3D)
I tried to seperate the implementation of splitting/initializing, as it would be easier to apply it on other cases (e.g. square lattice scan, dis... |
I decided to try and complete the Parsing/RPN calculator algorithm from Rosetta Code in Rust. I'm still learning Rust and would appreciate feedback on my code.
use std::str::FromStr;
fn rpn(expression: &str) -> f64 {
let mut stack: Vec<f64> = Vec::new();
let tokens: Vec<&str> = expression.split_whitespace().co... |
I've recently been tasked with migrating some code stacks for an applicatin that is moving from using Access to using SQL-Server.
I don't usually use PIVOT all that much, and most of my code is scripting intended for in-house administration of our SQL Servers. As such my code is not that great.
How could I clean up t... |
I'm trying to remove the tmp/letter_opener folder. Everything works fine, just wondering if there's a better way to write it. My next step is to write some tests, to double check that I can only accept those inputs (currently failing)
#my_rake_task.rake
namespace :cleanup do
desc 'Deletes the emails inside tmp/letter... |
I'm new to MVC and i'm having some difficulty on understanding the proper usage of ViewModels and Controllers.
I have this example where i will list several different informations in my HomeController as CTAs, Banners, News, Courses... and i came up with this ViewModel structure after some research :
public class Cours... |
I'm relatively new to Java, and over the past week or so I've just been reading through the docs and messing around with it to better improve my understanding.
As stated in the title, I've created a method to convert numbers (between 0 - 999,999,999) into plain text, and I would love some feedback/constructive criticis... |
The following is the top-level procedure for aggregating, analysing and reporting my company's submitted business from 2015 - present. Reviewing the entire project is unfeasible, so I am just seeking opinions on Variable/Method naming and general readability.
For reference, CLS_Data_Report is a class I built specifical... |
I have been working on a cache that can handle multiple reads at the same time, but the write is blocking.
Is this code overkill by using both a ConcurrentHashMap and a ReentrantReadWriteLock? Could I get away with just the lock?
Are there any other optimizations I could make?
public class QueryCache implements Seria... |
This is a follow-on to a global enum for comparison operators. I wanted to pass a logical expression E.G. >= someValue as a parameter to a function, so I made an Enum and an accompanying function to analyse logical expressions.
Is my approach a good way to implement this functionality in VBA?
Public Enum ComparisonOp... |
The following function, as evidenced by its name KeepOrRemoveArrayRowsWhereComparisonIsTrue is probably trying to do too much.
How can I better structure/refactor/split it to be cleaner whilst retaining the original intent: "Here's an array, filter it based on the values in this column"?
Public Function KeepOrRemoveA... |
I would like to make a portable thread pool using boost::thread. Some one could tell me to look at boost::thread_group and boost::asio. I know, but I am not really familiar with these things so I don't know if they are suitable for my purpose.
Please give me comments on what I supposed to do here.
JobItem and JobQueue:... |
I'm in the process of learning SQLite in C# and I've come up with some generic methods for finding and updating data. I would appreciate any pointers with the design of my methods and/or my SQL syntax.
FYI: I'm using System.Data and Mono.Data.SqliteClientfor C# Mono 2.0 (Unity3D).
Here is an example of the database use... |
I left questions in the comments strategically, since I think it's easier to answer questions this way.
Basically what my small class does is abstracts away functionality that was originally in a function.
This class reads json form a file and creates an object which I can use to traverse the json. I understand that if... |
This is the new code after following the advice from here:
Setting up a development environment
General feedback is requested. Also, should I be using $() or () for my sub-shell. What is the difference.
#
#
#
# Divider - configures bash, git, grunt, sublime and chrome
#
#
#
user1=foo
config_bash() {
rm ~/.bash... |
I have been searching for a solution to show data of class with three assumptions:
Class Employee is not responsible for showing itself
Class Employee does not expose its data with getters
Classes responsible for showing data are immutable
So I created Employee class with its View interface:
public final class Employ... |
I'm creating a simple Java game engine (just for fun). The idea is to create a basic framework for developing any kind of 2D game, an abstract engine that does the hard work. Would you like to review the core of it and give me some tips?
GameTimer class:
public class GameTimer {
public static final double ONE_SECO... |
I am learning to design classes, and in the effort to improve, I have designed an online book reader system with the following requirements in mind:
Allow person to create and renew membership
person should be able to search database of books
person should be able to check out max 1 book
should be move pages forward a... |
Button crossButton = (Button) findViewById(R.id.crossButton);
crossButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!x1.getText().toString().equals("")) {
if (!x2.getText().toString().equals("")) {
if (!x3.getText().toStrin... |
We do constant traffic with our Redshift tables, and so I created a wrapper class that will allow for custom sql to be ran (or a default generic stmt), and can run a safe_load where it first copies the info to a dev db to make sure it will work before it truncates the prod db. Let me know what I can improve!
class Red... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.