instruction stringlengths 71 71.9k |
|---|
I wrote a simple daily horoscope in Python using Beautiful Soup as scraper. It works fine but the code can use some sort of a... direction if you want to put it that way. I have used underscores in my variable names which is a folly. Please point out how can I correct this and also, please tell me how I can expand this... |
Wrote a php site to gather/filter/search daily archived logs from the archive directory using bash cat and grep commands.
How can I make the code more readable?
How can I follow conventions better ? (functions/indentation/comments/ using php and html together etc)
Is there a different approach to this problem I shoul... |
I solved the Circular-Array-Rotation problem on HackerRank. I conceded defeat and looked at the answers given on HackerRank itself but the ones I saw used things like vectors, which are concepts I'm a noob at as my knowledge of C++ thus far extends only as far as virtual functions and classes and such (junior COE stud... |
This is how I used to implement quicksort:
def quickSort(alist):
quickSortHelper(alist,0,len(alist)-1)
def quickSortHelper(alist,first,last):
if first<last:
splitpoint = partition(alist,first,last)
quickSortHelper(alist,first,splitpoint-1)
quickSortHelper(alist,splitpoint+1,last)
def par... |
I am working on learning more about arrays and loops! I have been trying to create a method which will allow me to take for example an unlimited amount of arrays and append or concatenate them to each other!
The method takes multiple arrays as arguments and creates a merged array in the order in which the arrays where... |
I have a 'read more' angular directive copied from:
https://github.com/doukasd/AngularJS-Components/blob/master/dd-text-collapse/dd-text-collapse.js
Some of my text can already have <br> tags in it (I ONLY allow just <br>) so I just needed to handle that...below is only the extra code I wrote for this purpose.
Does it ... |
So I am very new to programming and I am trying to pick up Python as a first language. I have programmed a simple game of naughts and crosses, but it is very wordy and there must be a simpler/quicker way of doing this! Any modifications or tips would be gratefully received.
from random import randint
#initialise game... |
This Delphi (Seattle 10) routine resizes a JPG image if one of its sizes is larger than AMaxDimension pixels, and gives it a compression factor of ACompressionQuality. Images smaller than 128x128 pixels are left alone. As the name says, it ignores alpha channel.
I'm not an expert in image manipulation and wonder if thi... |
I've done a function that does the following :
It takes an argument length that it will be the length of the result array.
The Array should start with alphabet values first : ['A', 'B', 'C', ...]
If the length of the Array is greater than 26 (The number of letters) it should look like : ['A', 'B', 'C', ..., 'A1', 'B1... |
I'm checking each variable to prevent null exception, but still wondering can this be improve in much simpler and cleaner if you will be writing the same code? Please see the below snippet:
[AjaxOnly]
public ActionResult GetInstitutions(string parent)
{
if (string.IsNullOrEmpty(parent))
return Json(string.E... |
I have the following class which represents a set of properties.
public class Properties
{
/** String type properties. */
private final List<String> m_stringProperties = Arrays.asList("str1", "str2", "str3");
/** Float type properties. */
private final List<String> m_floatProperties = Arrays.asList("fl... |
I have a function which takes a string representing a text file, joins lines which were wrapped, and returns a slice with the wrapped lines. I'm interested in making my code maintainable, idiomatic, and fast (in roughly that order).
var startLine = "^([A-Z][A-Za-z ]+[0-9]+)- "
var startLineRegex = regexp.MustCompile(st... |
I have solved problem 12 on Project Euler website, which reads:
The sequence of triangle numbers is generated by adding the natural
numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7
= 28. The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
Let us list the factors of the firs... |
I just learn a little bit about C Programming and try to create a modular program so I created simple program to read memory usage by pid(s) in Linux.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void print_memory_info(char *pid, char *vmpeak, char *vmsize,
char *vmhwm, char *vmrss) {
... |
First, my Book object:
public class Book {
public static final String TABLE_NAME = "BOOK";
public static final String COLUMN_ID = "ID";
public static final String COLUMN_TITLE = "TITLE";
private long id;
private String title;
public Book(String title) {
this.id = -1;
this.titl... |
In perl, is there a canonical practice or idiom for assigning value to an argument which, if "empty", is assigned a default value?
Here, "empty" is defined as an argument value which is either undef or the null string (''). Notably, 0 (or perl false) is a valid, non-"empty" value, which rules out the construction $min_... |
I'm trying to implement some simple logic using rails. Code is working fine but its look uglier to me, could any one help me on refractor or implement in a efficient way.
Context:
Data hash assetType key which can be image/clip and Sizes key has array of hashes.
if asset type is image then I'm filtering Sizes array if ... |
I have a database class that connects to a database and runs CRUD operations. I need a critique of how well this class adheres to SOLID principles. A class to run all database operations seems like 'Single Responsibility' to me. Is there any need for further abstraction, such as an interface of some kind?
<?PHP
class ... |
I was asked to make a String encryption utility without using encryption API. I basically had to come up with my own encryption methodology! the program was to be able to encrypt a string and decrypt a string and to of course make it nearly impossible for anyone to figure out what the encrypted string says!
I would rea... |
Below is some jQuery I recently wrote and I'm quite sure there is a more elegant and/or efficient way to write it. The gist is, when a user clicks on a Primary Nav link, its Secondary menu slides down. When a user then clicks another Primary Nav link, instead of the jumpiness if the prev menu sliding up and the new one... |
Can someone review this code, just have look if it's logically correct
or
If you may point me to a more simple and minimalist program
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Queue;
/**
* Created by aishwat on 17/8/16.
*/
public class PrimsMST {
publ... |
Designing a micro ORM inspired by Dapper. I'm building this as an exercise to learn. I would appreciate if you guys can review my code.
I would also appreciate any suggestions regarding the features that can/should be added to this ORM. The source is available here.
ConnectionStringProvider.cs
public interface ... |
I solved Project Euler 4 using Clojure Lisp.
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.
I'm not very experienced with Clojure yet. I tried to break th... |
I am doing Java exercises from HackerRank.com and bit confused about this problem.
Here is my code that pass the test case.
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// String input = in.nextLine();
... |
This workbook is used to track projects. I have this VBA code linked to a Form Control button. When I press the button it will run through and get information from all the project sheets and feed it to the appropriate areas.
My workbook currently has 25 worksheets for projects, they are labeled 1-25. These projects all... |
I am practicing my coding at HackerRank. The exact problem statement can be found here, but to summarize, it is finding the distances of the shortest path from a starting node to every other node in a non-directional graph where every edge is weighted 6. If a node is unreachable, the distance is -1. The nodes are named... |
I have a program that will format a phone number in this format: (###)###-####
def obtain_phone_number
loop do
print 'Enter phone number: '
phone_num = gets.chomp
if !(phone_num[/\d{10}/])
puts 'Invalid phone number, must contain 10 digits only'
else
formatted_phone_num = phone_num.insert(0... |
I just began learning how to use signals and slots in PyQt5, and so I made a cute (pun intended) little program to display just one button. When the button is pressed a thread is spawned which will count from 0 to 99 and display the current count onto the button. However, when the button is counting, the program will n... |
I made a random password generator in Java using a GUI. In the program, the user can choose the length, and whether to include lowercase letters, uppercase letters, symbols or numbers in the password. I believe that my code could be much better and I want to know how I can make it so.
Full code:
import java.awt.event.A... |
This code was tested on IBM's 5-Qubit processor as an implementation of Grover's search algorithm, but for an unknown number of solutions. This code is based on Arthur Pittenger's book, "An Introduction to Quantum Computing Algorithms" and the mathematical structure was posted as a proof-verification question here.
h ... |
So I am working on a small RPG in Unity.
Right now I am writing some business classes, POCOs, that have no link to Unity except being in the required C# flavor and using Debug.Log and stuff.
I have been doing a lot of Java for years and some C++11, but no C#, so some concepts are not familiar to me.
I think most of t... |
I have here a simple webapp for displaying different D3 demonstrations:
The idea is - the user can select one of many modules in the control bar at the top, and the corresponding controls for that module will be displayed.
The image generated by each module will be displayed in the main area below the control bar.
Es... |
I built this web app to present a random group of questions for quizzes and tests. The page opens with random questions. Clicking anywhere shows (only) the spinner div. Clicking anywhere again brings up new questions.
One thing is bothering me, though. I have succeeded in moving all the JS out of the body except for th... |
I am creating a Number class having Integer and Fraction derive class which add/compare different kinds of numbers. In addition, the caller need not needs to know what kind of numbers are being added. For example, the solutions expected to be able to do the following:
\$\frac{1}{2} + 2 = \frac{5}{2}\$ (fraction)
\$\fr... |
I am building a commandline app to check proxies, which has a daemon flag (running forever or just once).
There are producers, checkers and storers. I want them to run in parallel and be able to close if formers are closed:
Make them run in parallel
The Working Flow:
When all producers are done, tell all checkers a... |
Due to the fact that nobody's ever posted this before (sarcasm) I've made a brainfuck interpreter in java. The interpreter fits in a single method, and is designed to be readable, fast, and concise, so please review on those things. I have tested it to confirm that it works.
/**
* Interpret program as a brainfuck prog... |
I made a C++ program which takes a list of triplets with S.No. from a text file, where the triplet, i.e. a,b,c correspond to a+b=c (addition done using float data type). Now I convert a and b from hex to 32-bit binary numbers and extract sign, mantissa and fractional part and then add them. Finally I convert the sum ba... |
Checking whether an item exist in a collection isn't straightforward in VBA, it requires error checking and during error handling we need to clear the error and also resume code to be able to correctly manage the next error.
In my codes I generally use this structure, is it a good practice?
With MyWorkBook
... |
I'm doing a hackerrank challenge to get ready for interviews and was wondering if someone could provide feedback on my code (style, naming convention, etc.). This challenge involves 2D arrays and is located here: https://www.hackerrank.com/challenges/2d-array
Here is my code (that passes all the test cases):
import jav... |
I decided to reinvent the basic calculator functions using only:
the set of positive integers
greater than, less than, and equality properties
increment and decrement
(in other words, the counting on fingers method)
def is_positive_int(x):
if type(x) == int and x >= 0:
return True
else:
retur... |
I have the following jQuery which applies a class to my fixed header to shrink it when the user is scrolled any distance down the page:
$(window).scroll(function() {
if ($(this).scrollTop() > 1){
$('div.single-level-nav').addClass("shrunk");
}
else{
$('div.single-level-nav').removeClass("shrunk");
}
});
... |
I have a situation where I have a static class that reads my application configuration file for some configuration value. When unit testing Web API controllers that make use of this static class I am getting an error about the confgiration setting being null.
I could have duplicated the value of the key in my app confi... |
I created an evolution simulator. It takes random chance and applies it to phenotypes of species. This was very much for fun, and I would love any input on:
Readability of code
Efficiency of generation generating
Better ways to create dynamic GUI elements
Future mod-ability
My usage of classes, something I'm historica... |
This is what I wrote for insertion sort in python. But somehow I'm feeling that it's between bubble and insertion sort.
def insertionSort(lst):
for i in range(1, len(lst)):
if lst[i] < lst[i-1]:
for j in range(i):
if lst[i] < lst[j]:
lst[i], lst[j] = lst[j], l... |
I have some phone records in which epoch time is coming in exponential format like 1467.738871E9. I need to validate those records in which number is not in proper format and drop those records. Right now, I am using big decimal, but I have heard that bigdecimal is slow and takes more space. Since I have million of rec... |
I wrote a function that will take a list of points and then order them so they sort of... "chain together".
The function will start with point #1 in the list.
It will add point #1 to the list of ordered by distance points.
It will then search for the closest point to point #1. (We'll call this point, point #2)
It will ... |
I am developing a report at the moment and I want to apply OOP principle because I feel like my code is not well written and there is duplication.
I have a method that gets data from the database and binds it to the controls on my report.
Here is a sample method I used to print preview a report:
public static void Crea... |
I'm doing this assignment were they have told me to sort an array of objects with name and age. What do you think about my solution?
Edited to take in consideration comments, Thanks for the feedback guys!
var familyAgesPropName = [
{ name: "Raul", age: 27 },
{ name: "Jose", age: 55 },
{ name: "Maria", age: ... |
I would like to get some help/tips on writing better and more pythonic code, as well as variable naming.
Code info:
.backtranscribe() is just a method to convert the U's in the sequence to T's (ATUG -> ACTG)
a - 1-based index where substring starts
b - size of substring
c - text input of names of sequences to get subs... |
I have implemented a correct but horribly coded solution to Project Euler Problem 293.
An even positive integer N will be called admissible, if it is a power
of 2 or its distinct prime factors are consecutive primes. The first
twelve admissible numbers are 2,4,6,8,12,16,18,24,30,32,36,48.
If N is admissible, the s... |
I'm currently learning Haskell, and as one of my first "proper" programs have created a mathematics quiz. It works like this:
A question is generated, with two numbers from 1 to 10 which need to be either added, multiplied or subtracted, for example 3 * 6.
The question is presented to the user, and they can write thei... |
I am trying to find the shortest code that generates a full mesh of the elements fed into it in graphviz format
e.g. the full mesh of [0, 1, 2] is:
2 -> 0
2 -> 1
1 -> 0
I have the code below and I think there might be a way to combine the if and for loops, and avoid needing to directly create the empty string
def gra... |
Encryption is all the rage nowadays but let us not forget what it was like back before the advent of internet. I have written a small, simple cipher that takes texts, gets their char value, and adds or subtracts a certian given number from them aka "shifting" the keys.
If the receiving end has the direction and then n... |
For Learn Python The Hard Way exercise 45 I made a small text game, that took a few hours. Since classes were used and classes were a recently brought up concept in the book, I was wondering how this piece of code could be made better. It should be able to work in terminal as far as I know.
from sys import exit
from ra... |
I couldn't help but notice we didn't have a FizzBuzz in lua yet.
I've always wanted to take a shot at Lua, so here goes nothing.
Code:
function fizzBuzz(maxNum)
local fizz = "Lua"
local buzz = "Yay"
for i = 1, maxNum do
if i % 15 == 0 then
print(fizz..buzz)
elseif i % 3 == 0 then
print(fizz)
... |
I have several functions, whose common end goal is to make it possible to write the contents of an Excel cell to Microsoft Access and be able to bring it back from Access as well, all while retaining formatting! The function that I want to review, below, works very well but it is somewhat slow. It takes a cell as an ar... |
I recently wrote a code fix to handle many of the C# and VB.NET compiler diagnostics that was merged into Roslyn. Because it handles both, I implemented it as an abstract class with only the sections that are specific to the different languages in the language-specific implementations to eliminate code duplication. I... |
I am currently working on creating a tree (this is my learning process of creating a minimax tree and am starting towards minimax tree from here) with multiple nodes recursively.
Can anyone please determine if the algorithm is correct? From my perspective and couple of test (using print, count and gdb), I think I am cr... |
I'm trying to brush up on my Python, so I'm going through some simple problems. Big concerns are style, though any algorithmic problems I'm open to suggestions on.
Basically you have an input file where the first line is the number of test cases.
The following lines are composed of the cases. Each case starts with a n... |
This is a very simplified version of my query. Is it acceptable to join the two collections for the client with the use of for loops?
There could be up to 2,000 books, which also means there could be an equal number of favorite books per user in the favoriteBooksCollection.
return favoriteBooksCollection
.find({user: c... |
I came across a mock interview question in which the candidate is asked to generate the powerset of a given set.
The input set is represented as a unique array of integers.
There was no solution provided in this instance, so I tried to see what i could come up with on my own. I did struggle my way to a solution and I'm... |
With my original code I kept getting Error: Parse error: [expr level ;] expected after "in" (in [expr]) on the line let numDigits = numDigits - 1 in
Original:
let rec rev_int num =
if num / 10 == 0 then
num
else
let temp = num mod 10 in
let numDigits = String.length(string_of_int num) - 1 in
if... |
Tell me how I can make it more efficient, shorter. How I can make it adhere more to convention? Is there some stuff I'm doing that you would do in a better way?
The main gist is that I create and populate a 2d-array with objects, and use PyGame to display it graphically. We have a Hero, who is a Character object, that ... |
I am new in python and have written first code to convert Logstash YAML style configuration file into ElasticSearch Logstash JSON style config. Please have a look at my piece of code and let me know how can i make it better.
Type of input file:
input:
file:
type: "logRecords"
start_position: "beginning"
... |
What follows is the JavaScript written for a Google Maps API implementation (for an image gallery that shows image, location, description, next and prev buttons, etc.).
I have a JSON mapLocationData where I get information like the title, location, image, and description. I also have a mapFunctions variable which is a... |
I am trying to create a builder for table tennis exercises. User Blindman67 helped me here. Now I'm trying to clean up the code before continuing to work on it.
Please tell me how to clean up the code so JSLint does not give any more warnings. If you notice any other things, feel free to tell me. I'm a newbie :)
My ma... |
I am new to programming and mostly self-taught by following a few MOOCs and doing little projects. I have reached the point where I am trying to develop more complicated programs (numerical models at work and games at home) and I would like to be able to give a structure to my programs to enhance readability.
I am foll... |
I'm looking for feedback on my implementation of Item() objects in my beginner project (work in progress) or indeed any other feedback you feel is appropriate. I'm sure what I've managed is very primitive, but I've alot on atm and my brain is creaking(enjoying though!).
The plan is for the items to be an integral part... |
I have snippet that really look ugly but I don't know how to refactor it:
if owner
samples.each do |sample|
sample_name = get_name(sample) # logical to get correct name
serialized_sample = SampleSerializer::Level10.new(sample, 10).serializable_hash
groups[sample_name] = groups[sample_name] == ni... |
In my script, node.js reads text files and generates text itself. At the end, I have five "text parts", and want to add them to one file. For this step, it must be considered that the sequence is important, so unfortunately the great async technique of node is obstructive. How would you handle this?
The five text parts... |
I've been working on a basic implementation of Conway's Game of Life over the last day, and I've just finished a 'playable' version.
If anyone has the time, would you mind making any suggestions on code improvements that I can make?
Thanks!
GameOfLife.java
package robbie.gameoflife.main;
import java.awt.Dimension;
imp... |
I've written a script in an attempt to try to automate moving hosts from old hosts to our new docker containers.
All feedback and input appreciated!
#!/bin/bash
# Generate private public ssh-keys
if [ ! -f "$HOME/.ssh/id_rsa" ] && [ ! -f "$HOME/.ssh/id_rsa.pub" ]; then
ssh-keygen -b 4096
fi
read -p "Enter you... |
The current code I have runs fine, but I'm curious about some other approaches to making this more DRY.
var topLinks = document.querySelectorAll('.navUtility-listItem a');
for(var i=0; i<topLinks.length; i++){
if((topLinks[i].getAttribute('href').indexOf('a') > -1)){
topLinks[i].className += ' top-nav-a'; ... |
Would this take \$O(n)\$ in worst case? Can it be improved?
var tree = {
val: 5,
left: {
val: 2, left: null, right: null
},
right: {
val: 6,
left: null,
right: {
val: 8,
left: null,
right: null
}
}
};
function inorderReverse(node, cb) {
if (node.right !== null) inorder... |
I have a longwinded PHP file (see gist) which looks through a specific array (declared in another PHP file) named day.
GitHub
The value of day is a folder name and the value of reportArray contains a subfolder of day.
If the folder day is not empty, and the reportArray is also not empty, I made the code to dsiplay a d... |
I want ls to print a message when run on an empty or full of dotfiles directory. Instead of:
$ ls empty_dir/ dotfiles/
$
I want:
$ ls empty_dir/ dotfiles/
empty_dir is empty
dotfiles contains only hidden files
$
If dir contains only dotfiles, and if the ls command is able to show them, the following should appear:... |
This is a simple class but I'm looking to check I have the basics down to scratch.
Is my documentation thorough enough? (I'm very new to writing JavaDoc) Have I created too many variables, and does this sacrifice performance for readability in a bad way?
This class is called once to create an array of TestDataObjects t... |
I'm coding a Old Gameserver just to learn more about c++ and Reverse engineering.
I'm also studying about code refactoring and design patterns.
Currently I have this member functions :
void CommandManager::SetLevelCommand(char* command) const;
void CommandManager::SetPKCommand(char* command) const;
void CommandManager... |
I need to display a "caption" from a video but I cannot use built in captions provided by a vtt file for my situation. I created an array that stores the key,value pair (time, caption). I traverse that array every time the video time is updated and find which caption fits the current time. This solution works and I hav... |
I've created a repo for some Docker containers that work together with docker-compose to make a very easy and quick installation for Laravel including nginx, mariadb, and redis. Laravel is known for having one somewhat annoying step to get it started, which is that the storage and bootstrap/cache directories have to be... |
This is my code for this question on hackerrank.
The idea is to find the amount of substrings of a given word that are anagrams of each other.
The code works fine, but it times out with longer strings. I've downloaded the test cases to make sure the result is correct and it is, it just takes too long.
I can do this in ... |
I want to make a extension that extends HttpWebRequest in order to retrieve the response asynchronously. This is achieved by using the Task.Factory.FromAsync. Now this extension needs to be able to handle cancellations as well as timeouts.
The way I implemented the cancellation is via registering the request.abort() to... |
I'm building an events app using Rails. I've installed a code block in my controller to ensure that over-booking doesn't occur once the total number of spaces for the event have been allocated/booked.
The issue is that it only seems to work after the payment has been taken rather than before. I need the code to bring ... |
I need to allocate n-dimensional arrays of type T, currently I am using the following functions. Is there a better way to do this? Also, ideally I would like to allocate a 1-D array and access that as a N-D array but I could not figure out a better way of doing that. Using existing matrix library is not an option as I ... |
I have the below and it gives me the desired output (ie; 1 day 12:05:33) but it looks overly complicated, is there a more straight forward way of doing this with the least amount of string concatenations?
std::string eta_string ( int64_t s ) {
time_t seconds ( s );
tm p;
gmtime_s ( &p , &seconds );... |
Yesterday I stumbled upon a Stack Overflow question that asked if it was possible to implement Tab-triggered auto-completion in a console application.
I thought that was an interesting idea, so I went ahead and wrote a small program that does just that, given a hard-coded string[] - I might eventually refactor it into ... |
I've no idea what to call this, so I called it Classify since that's how I use it.
Basically, the idea is to pass a Dictionary<TResult, Func<TValue, bool>> which is evaluated for an input, and the first Func<TValue, bool> returning true will return the TResult key.
The intention is to make this a generic extension meth... |
Question copied from the book:
(Game: eye-hand coordination) Write a program that displays a circle
of radius 10 pixels filled with a random color at a random location on
a panel, as shown in Figure 16.28c. When you click the circle, it
disappears and a new randomcolor circle is displayed at another random
loc... |
I'm brand new at Python, but I've been working in general at granulating my functions and being as self-readable as possible without suffering readability. This CodingBat question is a little interesting because it demands a function with a lot of repetitive case checks. I decided, rather than having a bunch of nested ... |
I want to spawn objects with random time interval (from 1 to 3 seconds).
I've wrote this function:
func scheduleAddingLiquid() {
let wait = SKAction.waitForDuration(NSTimeInterval(getRandomNumber(1, end: 3)))
let block = SKAction.runBlock({
[unowned self] in
let liquidNode = Liq... |
This is my first windows batch file. The script basically goes through this basic flow of tasks, in order to update some specific SQL Server DBs to a new DB version:
Backup all SQL server DBs that will be upgraded.
Upgrade to the latest version and apply any last-minute patches to those DBs.
Error handling is done ... |
I've written a class for a project of mine whose responsibility is to perform basic statistic calculations like mean, median and mode. The aim is for it to be a helper class, so it should not be instantiable. I later want to extend it to include weighted mean and range/interquartile range as well as variance.
Here is t... |
I'm writing an app by Flask with a feature to upload large file to S3 and made a class to handle this.
I have some targets in writing code:
Code must be easy to understand and maintain. (Yes, everyone wants this, so do I)
Logs should be as detail as possible, especially when working with S3. I want to have detail log... |
I implemented an utility method that is able to view an Array[n, m] in another smaller dimension [k, l], where n%k = 0 and m%l = 0.
Example:
-- -- -- --
--- --- |1 2| |3 4|
|1 2 3 4| |5 6| |7 8|
|5 6 7 8| => -- --(a0) -- --(a1)
|4 3 2 1| -- -- -- --
|8 7 6 5| ... |
I wrote the following (static) class to read files easily in C#. However, it is a static class, so I wonder if there would be a gain to make it a non static method (and therefore, passing arguments as the separator and the path as attributes of the class).
Besides, the OrderedDictionary class may not be a good choice (... |
I'm new to programming. This is my first project where I tried to use object-oriented programming. I'm looking for all kinds of comments.
import pygame, sys
from pygame.locals import *
from random import choice, random
INDIAN_RED = (205, 92, 92)
DARK_SALMON = (233, 150, 122)
DIM_GRAY = (105, 105, 105)
BLACK = (0, 0, ... |
I want to get back into Java programming and so I began to teach myself the language by reading books as well as studying for the OCAJP 8 exam which I plan on taking this coming Monday. I feel as though to get a job it would be nice to have this cert as a fresher and it would also be nice to show I have the ability to... |
Basically, I made a function which switches between stages (see the Switch class below).
The way I call it is seen in the Controller below. I wanted to ask if this code (in the Switch class) is good practice or not.
Login class:
public class Login extends Application{
@Override
public void start(Stage primaryS... |
I have coded up the variable length integer encoding aka VLQ in Java. It works with any base in (1, 128]. I've implemented the usual encode/decode methods and also the addition and multiplication for this encoding. Single byte multiplication uses shift-and-add and multi-byte ones uses Karatsuba algorithm.
I've tested t... |
I've been trying to learn Java for the last day or two. This is the first project I am working on, so please bear with me. I worked on a multithreaded web crawler. It is fairly simple but I'd like to ask for some advice.
Purpose / Running
The program starts at one web address (in this code, http://google.com) and looks... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.