instruction stringlengths 71 71.9k |
|---|
My original code is here. I made some changes to it based on your suggestions, but then I lost my flash drive and had to redo it. I have a suspicion that my second version was better than this one, so could you all help me out one more time?
import os, shutil, zipfile
def subtractname(path):
newpath = str()
pa... |
I just started coding a simulation-like application. It's about our solar system. Right now, I'm working on rotating the moon. I have this constructor
function Mass(elm) {
if (typeof elm == "string") {
this.elm = document.getElementById(elm);
} else {
this.elm = elm;
}
this.width = ... |
I have implemented Tic-Tac-Toe so that human can play with the computer, where the computer should never lose. I did a simple analysis before implementing, and I found out that there are certain cells you want to occupy (I named it BEST_CELLS).
Here is the link to the implementation: https://github.com/yangtheman/tict... |
This is my attempt at Conway's Game of Life. It works, and it's the most complicated program I've made to date. I'm sure it's pretty poorly done. Any ideas on how I can improve on it?
#include <iostream>
#include <cstdlib>
const int gridsize = 75; //Making this a global constant to avoid array issues.
void Display(... |
I would like this to happen every time I run a program from the command line. Is my approach Pythonic? I'm interested to know whether there is any problem with readability or correctness. Any general advice on better ways of doing things or potential problems are also welcome.
Although the main function is just an exam... |
Please be brutal, and judge my code as if it was written at a top 3 tech company, straight out of college. (The method signature, and input parameter is given by the problem, so don't worry about that)
Worst case complexity: \$ O \left( n^2 \right) \$
Space complexity: \$ O \left( n \right) \$
Time it took me to solve ... |
From Wikipedia:
Insertion sort iterates, consuming one input element each repetition,
and growing a sorted output list. Each iteration, insertion sort
removes one element from the input data, finds the location it belongs
within the sorted list, and inserts it there. It repeats until no
input elements remain.
... |
How can I improve the string RecvData() function?
std::string Socket::RecvData() {
std::string strBuffer;
do{
char buffer;
int recvInt = recv(s_, &buffer, 1, 0);
if (recvInt == INVALID_SOCKET)
{
return "";
}
if (recvInt == SOCKET_ERROR)
{
... |
This is the current Makefile that I use with my C projects. Here is what I would like to be reviewed:
Reusability - is this Makefile easy to use for multiple separate projects with minimal modification?
Organization - is this Makefile organized in a logical and readable way?
Dynamics - are there Make features (or com... |
I have a few objectives (which are working fine, but I want tips in case I can improve it).
Let me try to make this as clear as possible, as this is a much larger project:
There are three move categories:
Hammer (10 damage)
Scythe (5 damage)
Meditate (0 damage)
I will be having hundreds of additions, but these values... |
I'm planning to transition from years of forced procedural programming to OOP. I decided I'd start off small with a little gumball machine object to get my bearings. Everything seems to run ok, but I feel strange having all these globals in my class.
Code in action here.
Two questions:
Is there a way to avoid globa... |
I've hodgepodged together an attempt to extract all phone numbers from all CSVs in a directory, regardless of where they are and what format they're in. I want all phone numbers to be printed to a compilation CSV with no repeat elements in the format 8885551234 with NO leading ones. E.g., 1 (510) 533-2134 would becom... |
This is how I read the keyboard in my game:
@Override
public void keyPressed(KeyEvent key) {
keypressed=true;
if (key.getKeyCode() == KeyEvent.VK_UP) {
keyup=true;
}
if (key.getKeyCode() == KeyEvent.VK_DOWN) {
keydown=true;
}
if (key.getKeyCode() == KeyEvent.VK_ENTER) ... |
(continuation from Speeding up and fixing phone numbers from CSVs with Regex)
I'm pulling all of the phone numbers from all CSVs in two different directories, outputting them in a single simple format to two different files, and then comparing those two files for which numbers are in one but not the other.
I'm failing ... |
I have an array of objects that I must sort based on two criteria. I've come up with a solution but I'd like to know if there is a better way to do it.
Assume a list of devices:
[
{"battery_level": 0.45, "network_status": "ok"},
{"battery_level": 0.45, "network_status": "ok"},
{"battery_level": 0.50, "netwo... |
I have a working restaurant menu system - as the user selects a menu it slides into view. The build is responsive, and I've used the 'Debounced Resize() jQuery Plugin'. However, in implementing the responsive code, I feel my code has become clunky, and it needs refactoring.
The hope here is that I'll receive some const... |
This is my first time writing a game in C++/SDL and I decided to post the code here so you can tell me what I am doing wrong.
main.cpp
#include <SDL.h>
#include "Game.h"
int screenWidth = 640;
int screenHeight = 480;
const char* title = "Pong Clone";
Game game;
int main(int argc, char* args[])
{
game.init(title, SD... |
I have been researching and experimenting with HTML5 and CSS3. I was aiming to create a very simple but efficient tiled gallery / grids. So some sort of grid system that I can layout anything inside.
Below is what I have created, what are your opinions? I also have a question, why the distributing of the images change ... |
I have made a gallery function, this function handles three different types of gallery, one with horizontal nav, other vertical and last one vertical with no nav.
function vid() {
var vid = $(".videoBg"),
btn = $(".wVid"),
wrap = $(".home");
$(wrap).css({
"margin-top": "220px"
});
... |
Objective:
I want to import an Excel file, and read the rows of certain columns. For this, I use ExcelDataReader. I've implemented a low-level class called ExcelData which uses the ExcelDataReader and does things like figuring out if it is an ".xls" of ".xslx" file (or maybe something completely unrelated!) etc. On top... |
I have a security manager I'm writing for a Java program, and within the checkRead method, I wish to only allow reads to files within a given directory.
The basis of it is that it will get a canonical file for the input (which is actually a string as per the method contract). It will then begin taking the file's parent... |
I'm trying to manage several means of payment in my Rails 3.2 application.
Let's say I have 2 means : Credit Cards & Bank Transfers (BIC), working with 2 different payment providers. Those means both contain a reference string that will be sent to the payment provider to trigger new payments later.
Each means also cont... |
My code looks like this:
public void checkIfCanDelete() throws BusinessException {
boolean canDelete = canDelete();
if (canDelete) {
checkIfLocked();
if(!editable) {
throw new BusinessException(BusinessError.MSG_YOU_ARE_NOT_AUTHORIZED_TO_REMOVE_DOCUMENTS);
}
retu... |
This is a follow-up: Python Hangman Program
I'm working on adding a few features to my hangman game, and I just implemented two-player gameplay, in the form of one player chooses the word to be guessed while the other player guesses said word.
I got it to work in my program, but I feel like how I did it is a bit messy ... |
I have implemented the Falling rocks game in C#. The instructions are simple: Don't get hit by rocks. The game is running quite well, however there are some bugs that occur and furthermore, I would like to receive advice whether I could make the code less complicated if possible.
using System;
using System.Collections;... |
I think I've done a decent job keeping this query simple and understandable, but I'd like to know if you have some more advice.
My relevant entities are defined like this:
public class Task
{
[ForeignKey("Employee")]
public string EmployeeId { get; set; }
public Employee Employee { get; set; }
[Require... |
Here is some VB code that is part of a major system of apps that I have been asked to maintain, one of the more fun things that I get to do is rewrite some code here and there, I have done a little bit of that here, I finally have it functioning properly and would like to see if I am still on an upward stride in my V... |
My PowerShell scripting skills are pretty poor, but I've managed to hobble together got this script:
function Create-Process() {
param([string] $fileName, [string] $arguments)
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.RedirectStandardError = $true
$pinfo.RedirectStandardOutput = $t... |
I have a CRM system that has Notes, Payments, DairyEvents and anything else that needs to be bolt on over time.
I created an ITimeline interface that has a datetime and message method and implemented them on those models.
This is the simplest form of code I have started with:
public static List<Interfaces.ITimeline> Ge... |
This is my attempt at Project 18/67 of Project Euler. You can see the problem information, and obtain the needed txt file from here.
I had some help with the split function, and help on how to use an vector to do this. I would love any other feedback on this code.
#include <iostream>
#include <fstream>
#include <vector... |
As part of a Trading Card Game, I have created a Hand that will need to hold all cards that a player currently has in his hand. The code is built using Java 8.
The structure is the following:
Class for exception throwing.
The Card interface.
The Hand class.
The HandTest test class.
public final class ExceptionUtils ... |
I wrote a little Perl script to Caesar shift strings. Usage:
$ # usage: caesar <string> [shifts,...]
$ caesar abcde # The default shift is 13.
nopqr
$ caesar abcde 1
bcdef
$ caesar abcde 1,13 # Multiple shifts are supported.
bcdef
nopqr
$ caesar abcde 1-3,5-6 # Shift ranges are supported.
bcdef
cdefg
defgh
fghij
gh... |
I have the following code, written in Python:
if id:
fields = r.table(cls._tablename)
.get(id)
.run(cls.connection())
else:
try:
fields = list(r.table(cls._tablename)
.filter(**kwargs)
.limit(1)
.run(cls.con... |
I'm working on a directory that lists employee information. Each employee can belong to multiple departments and each employee can have multiple job titles. I have 5 MySQL tables that I am pulling information out of, including:
employee
employee_has_department
department
employee_has_jobTitle
jobTitle
The employe... |
It works just fine, but is there any other way to write this shorter?
Nurses are only available to intensive care patients (room I) and TV's and telephones are only available to non intensive care patients (room D or room P). Also, X_COST has a value of 0.
if (room.equals("I")) { // if (room.equals("I"))
roomCost ... |
First, I've extended the String class to detect uppercase and lowercase characters:
class String
def is_uppercase?
self == self.upcase
end
def is_lowercase?
self == self.downcase
end
end
I then use these instance methods to fulfil my main goal of transferring the format of an ol... |
I'm working on a card game in Java that simulates the drinking game Kings Cup for a school project. I'm having trouble putting the pieces together, and was wondering if someone could tell me what I could do to improve my code.
@author :Kimberly
IDE :NETBEANS
public class Card extends De... |
This is from my project codecount I use personally that is very similar to cloc.exe or SLOCCount. The part that I am questioning is where I am calculating when I am in a comment block and have deep nesting, I basically am replacing the sections with blank. I would like to deal with fixed format files at some point (R... |
I am interested in improving my coding standards in Python so I decided to post one my more recent and smaller "for fun" projects here for review. The code below implements a rather simple backtracking algorithm to solve SAT, which is based on Knuth's SAT0W found here: http://www-cs-faculty.stanford.edu/~uno/programs.h... |
I'd like to know if there's any better way to write this query:
(from a in Context.Pages
join b in Context.Visitors on a.PageID equals b.PageFK
join c in Context.Visits on b.VisitorID equals c.VisitorFK
join d in Context.Signups on c.VisitID equals d.VisitFK
where
d.DateOptinUtc.HasValue && a.UserFK == USER_ID
group d ... |
I've created a Java class, Date, in which I basically create date strings and set dates. Is there anything I can do besides adding comments to improve/shorten my code?
I've tested all of my methods to see if they work correctly, and they all work as planned. I haven't done tests that force the IllegalArgumentsExcepti... |
int number;
DateTime dateTime;
using (var oracleConnection = new OracleConnection(ConnectionString))
using (var oracleCommand = oracleConnection.CreateCommand())
{
oracleConnection.Open();
oracleCommand.CommandText = "SELECT * FROM FROM MY_TABLE";
using (var reader = oracleCommand.ExecuteReader())
{
... |
I have written a very XNA spritebatch like interface for drawing sprites in OpenGL. When begin is called the vertex data buffer is mapped to a float*. The index buffer and vertex buffer are bound in begin, and it's assumed no other drawing is done in this OpenGL context between begin and end. In between begin and end, ... |
Given a sorted array, return the 'closest' element to the input 'x'.
I do understand the merits of unit testing in separate files, but I deliberately added it to the main method for personal convenience, so don't consider that in your feedback.
I'm looking for request code review, optimizations and best practices.
pu... |
I want to generate a sequence using Linq that goes from 10 to 100 with a step size of 10. The sequence also must contain a custom value (in the correct order).
This is what I have now, and I'm wondering if there is a smarter way of doing it using Linq expressions.
var pageSize = 25; //number that must be in sequnce if ... |
I've been working on a rough idea for a templating engine (mostly as a learning project) using the F# syntax. How "correct" is my code in terms of being idiomatic F#? Are there F# features which would make the code simpler? More easily understood?
The template files are loaded at runtime using a script I've not posted... |
I am building an application full of forms and so I thought it is good idea to create a class to populate form fields.
Here is my class and I am sure it can be optimized more than now and could be better.
class JS_Forms
{
public function __construct()
{
//$this->register_fields($fields);
}
pub... |
I am trying to solve the Sherlock and The Beast HackerRank challenge. Most tests timeout, however when I try a custom stretch test case (T = 20 and all N = 100000), it returns successfully, so I'm not sure what the problem is.
The idea of the algorithm is that I find the number of possible combinations of threes and fi... |
The previous code (as displayed in Timer utilizing std::future) is now:
#include <chrono>
#include <functional>
#include <future>
#include <iostream>
#include <list>
#include <mutex>
#include <thread>
// PeriodicFunction
// =============================================================================
namespace Detail... |
So, I wanted a separate project to act as the data layer for my website project.
Classes in the website should reference the data layer after getting input from the user and should get back information regarding the result of whatever actions are performed and then communicate those results to the user.
The following i... |
I can have a maximum of three concurrent threads processing tasks. Each of these threads can process 1 to 100 tasks simultaneously (by connecting to an external system). The time taken to process 100 tasks at once in one thread is the same as it takes to process 1 task in one thread because the overhead of connecting t... |
I'm making a simple guessing game in C. Basically what I need is some help double-checking my work, more specifically a verification that the my binary search in my case statements look okay. The goal is to have an initial guess of 50, then work off that. If "L" is selected, the search goes from 51-100, if "H", it woul... |
I recently wrote a simple echo server in Java 7 using the NIO APIs so it was asynchronous and non-blocking. Then I decided, as a learning experience, to redo it with Java 8 hoping to use a more functional style and not have nested callbacks. I'm struggling to understand how to use the new CompletableFuture class with t... |
Yesterday I posted a question involving multiple nested queries. The queries pulled information from the database and created a directory listing of all employees. There are two many-to-many relationships involving 5 tables. For each employee they can have multiple job titles and multiple departments.
$stmt = $mysql... |
Here is my implementation to project Euler Problem 11. I did this problem a bit later, when I learned how to input from a txt file. The problem context can be seen here. I did add "\n" to the end of each line, after copying the numbers into a txt file, I'm not sure of any other way to do that. Any other improvements an... |
I currently have a Python script that parses a file (in this case an XML file) and makes line by line replacements as necessary, depending on the values of multiple arrays. As it stands now the script works great, but feel like it could be a lot better. I'll also need to add few more arrays later on and am worried abou... |
Below is my code. This is a function that will be applied as a sorting method to a grid based data set. The data in the column to be sorted can be stuff like: 123456, 123456:123444, and 12345:12359:139943. So far, I have tested it and it works, but I want to know in which situations might it not work, or if there is a ... |
The below code is recursive function that list directories in 2 levels:
static Dictionary<string,string> pList=new Dictionary<string, string>();
static void ListDirec(string path, int start, int end)
{
var dirInfo = new DirectoryInfo(path);
var folders = dirInfo.GetDirectories().ToList();
foreach (var it... |
Before looping through an Excel document using a library I found, and wanted to know how long it would take to loop through the whole thing.
There are 40k rows.
I looped through only the first 5k and it took just 2 minutes. So, I thought, that looping through 40k would take just 16 minutes total.
However, the progra... |
I am designing a website for a company that manages buildings/real estate. I did not have much use for a CSS library like Bootstrap or Foundation, except on one page of the website. This page contains a list of selected buildings. When a user clicks on the name of a building, the building's information appears and i... |
I am making an application where I will be fetching tweets and storing them in a database. I will have a column for the complete text of the tweet and another where only the words of the tweet will remain (I need the words to calculate which words were most used later).
How I currently do it is by using 6 different .re... |
I've got 2 simple text files:
besede.txt
To je vsebina datoteke z besedami. V njej so razlicne besede ki imajo lahko pomen ali pa tudi ne.
skrivno.txt
4 3 19 2 3 2 4 3
I wrote a program which receives these 2 files' names as arguments. It finds pairs of numbers in skrivno.txt and the first number in the pair is the... |
Use Case
So our lead programmer loves to follow the NIH Anti-Pattern and consequently I'm not allowed to use Underscore.js and can only use Vanilla JS... and we have to support IE8.
The goal is to produce an aggregation of unique values from nested collections buried within various collections of objects.
Desired Inter... |
First attempt was done here
Second attempt was done here
Huge comment at top
/*
* Export single function that creates the passportControl object
* The function has two parameters:
* app: The nodejs/express service object.
* This is used to register the end points
* ... |
I have not done any parameter checking, however I think the meat of the class is there. Let me know what you think.
#include <cstddef>
#include <vector>
using namespace std;
template<class T>
class TreeNode {
private:
T* data;
TreeNode<T>* parent;
vector< TreeNode<T>* > children;
public:
TreeNod... |
I am putting together a fairly simple server that listens for a connection then creates this thread - textbook Java code - then accepts data on that connection.
I am following a protocol that the manufacturer has laid out for start of message (0xfd) and EOM (0xfe) as below. I then simply populate a byte array with us... |
Please be brutal, and treat this as a top 5 technical interview. I am trying to follow Google's way of writing Java code, as per their .pdf file online of code review. (Side note: do any of you see any improvement in me?)
Suppose I am asked to find the minimum number of coins you can find for a particular sum. That is... |
Dabbling around with Roslyn and made a small analyzer just now. This one will show a warning in Visual Studio when you have a try-catch statement that only has a catch(Exception e).
I realize the working code (AnalyzeNode) is rather small, but I'm looking for feedback on best-practices (insofar there are already best p... |
In Objective-C, many of the NSString or NSMutableString methods for comparing or manipulating strings require a range argument--that is, an argument of data type NSRange (a struct containing a starting position and a length). This applies outside of NSString (NSArray for example), but NSString is where I see it most f... |
I have code which is matching features within regions. The first thing it does it matches features from one region to an entire database of region features.
I have a mapping from query feature index (qfx) into database feature index (ax).
A database feature index has associated with it a region id (rid), region featur... |
I've written this email program in Python, and I would like to get some feedback on it. (i.e. closing the server twice after the raw input, etc.)
import console
import socket
import smtplib
from getpass import getpass
user = raw_input('What is your name? ').title()
host_name = socket.gethostname()
print '\nThis progra... |
I encountered with the following code in the work. The MyItemCoordinator should receive MyItem objects, process them, add them to MyItemList collection and then pass them to the listeners.
My questions are:
When I saw NewMyItem method I thought that MyItemCoordinator is a factory but when I saw NewMyItem's implementat... |
I have an HTTP server class (.hpp & cpp). I am trying to improve reserve data from the socket class because I have s.getline() to get HTTP call. My s.RecvData() gets data line by line in an infinite loop to build HTTP struct.
This is my old code:
while (1) {
line = s.RecvData();
//httpline = s.Getline();
... |
I am working on a very simple game and thought it would be a good opportunity to learn and use the Factory Method pattern for creating game objects. I studied the pattern but I'm a bit confused about the Java implementation so thought I would share what I have come up with and get some opinions.
Please keep in mind th... |
I am currently writing a program that allows me to search for files in a user-specified directory. My current code is as follows:
if os.path.exists(file_path)!= True:
print('\n******* Path does not exist. *******\n')
else:
while True:
aa = '''\nWhich search characteristics would you like to use?... |
Regular expressions are one of the worst aspects of debugging hell. Since they are contained in string literals, It's hard to comment how they work when the expressions are fairly long.
I have the following regular expression:
\b\d{3}[-.]?\d{3}[-.]?\d{4}\b
Source: RegExr.com
I commented it like this:
import java.util.... |
I just wrote this but I'm not sure if this is good practice. Can someone give me advice as to whether it's good or how I can do better or even it's bad code?
The point is that I need a sub List-array-set of the enum. The SubType.ELSE shall have another name in reality (I know that was a bad choice, but it's for point... |
I have a few views that all follow the same pattern. They select a primary key from some main table and then a few semicolon seperated strings of captions of related rows over many-to-many relations. All columns that are used in joins are either primary keys or have a manually set index and are of type NUMBER(18). The ... |
If you have a Gmail ID, then you can also receive emails on the same account even if you add extra dots in the username or add '+' and some characters.
Say your Gmail ID is montypython@gmail.com. You will receive emails on same account even if it is sent to:
monty.python@gmail.com
montypython+python@gmail.com
m.o.nt... |
I am running this query and it takes several minutes to complete. How can I tune it (unfortunately I don't have the privileges to run an SQL tuning advisor)?
select 'Master' || d.ntt_id || '_' || d.deal_nummas, p.prof_currency,
sum(p.prof_ts1), sum(p.prof_ts2), sum(p.prof_ts3), sum(p.prof_ts4), sum(p.prof_ts5),
sum(... |
I have a Symfony2 project. I have an Entity Asset which can have relations with Category. I store a categoryCount-field within the Asset to determine if an asset has one, to select those fast via a DQL-query depending on the current user state.
Now found myself writing something along the lines of this in my AssetRepos... |
How can I shorten this (working) code to create future dates in ruby for use as params in URLs?
I'm doing:
require 'cgi'
require 'time'
now=Time.new()
now_year=now.strftime('%Y').to_i
now_month=now.strftime('%m').to_i
now_day=now.strftime('%d').to_i
now_hour=now.strftime('%H').to_i
start_hour=(now_hour + 1)
end_hour=... |
For a website, I've got some inline PHP, posted below. It's supposed to log traffic to the website, and it does its job fine. But at the end of the day, I'm not even close to a PHP developer, and this is really just hacked together from Googling and inferring from other, more familiar languages. How can I improve th... |
Which one of these two would you prefer writing in your code?
This:
tweet = tweet.replaceAll("@\\w+|#\\w+|\\bRT\\b", "");
tweet = tweet.replaceAll("\n", " ");
tweet = tweet.replaceAll("[^\\p{L}\\p{N} ]+", " ");
tweet = tweet.replaceAll(" +", " ").trim();
Or this:
tweet = tweet.replaceAll("@\\w+|#\\w+|\\bRT\\b", "")... |
I cannot figure out why I didn't get 100% success from the Codility's Perm-Missing-Element test even I solve with \$O(n)\$. I will appreciate any advice/answers.
You can see the problem, my code, and the scores on the Codility site, as well as here.
Problem Definition
A zero-indexed array A consisting of N different i... |
Could I get some feedback on my simple start to an admin template:
http://jsfiddle.net/spadez/GHKxW/3/
HTML
<div class="wrapper">
<div class="left">
<a href="#"><img src="nav_sprite.jpg" class="logo" /></a>
<ul class="navigation">
<li id="dashboard"><a href="index.html" class="active">Dashbo... |
I really like the ruby ? : syntax for if/else statements.
However, I'm not sure how to do the following with a nested statement:
if information.is_empty?
if leader? || possessor?
link_to('update ' + contextual('your') + ' credentials!', edit_user_path)
else
user.name + ' hasn\'t entered this info!'
end
e... |
This class (PanelScrollable) is part of my view package, in an MVP designed Java Swing system. I am not using any MVP frameworks, it's all custom.
The reason I'm posting this code is that I fear too much of the rendering logic is directly accessing Swing components, making it difficult to unit test; as a result this cl... |
After asking a question on StackOverflow about the two .NET caching systems taking dependencies on each other I gave implementing them a go. I posted them as my own answer there but before accepting the answer I'd like some second opinions on the implementations.
HttpCacheChangeMonitor
Allows ObjectCache items to take ... |
After refactors and refactors and the discovery of very common patterns on many of the classes of the software I wrote, I decided that it would be fine to have something like an arbitrary-keyed map, that would require the key to be stored in the object (which allows to use the object's name as a key for instance).
I wo... |
I have a project that I've been trying to get just right for the past three months and it's still not quite there yet.
I'm injecting some jQuery and jQueryUI code into pages that I have no control over and I need to be able to "sandbox" my code away from anything that may or may not be there at DOM-ready, or at anytime... |
So, I thought I'd do this using scipy.constants:
import numpy as np
from scipy.constants import physical_constants
constants = np.array([(k,)+v+(v[2]/abs(v[0]),) for k,v in physical_constants.items()],
dtype=[('name', 'S50'), ('val', 'f8'), ('units', 'S10'),
('abs_unc', 'f8'), ('rel_... |
To get an idea of what the controller code reflects, here is a screenshot:
Basically, the idea is that you print out a list of football players which you can then filter by their name, price, field position, and team. I'm not sure whether it's better to handle all the scope logic within a single controller, or break i... |
Last week I asked to review my "Guess a number" game in Java here
I learned so much that I decided to try a little harder game and put into practice all the amazing feedback I received there.
Would you please review and give me some feedback?
My main concern is if i'm doing ok using so many methods instead of a big blo... |
So knowing the little pieces is something different and putting them together is something different.
Here is the code where I try to follow good oop practices and 3 - layered structure.
Any review is greatly appreciated:
The form is located at registirationform.jsp.
The view layer:
public class RegistirationServl... |
Here is my Boyer Moore code in Python:
def BoyerMoore(stringy, substring):
if stringy == substring:
return 0
ASCIIcharset = [-1]*256
for x in xrange(len(stringy)):
ASCIIcharset[ord(stringy[x])] = x
stringLen = len(stringy)
substringLen = len(substring)
for i in xrange(stringLen ... |
As a beginner I am always determined to improve myself. I've got written the following Code using jQuery that is working fine. However, I am sure that there are cleaner ways for achieving the same.
Right now, I am struggling with the this keyword and the asynchronous loading of the JSON file. Moreover, I am not sure wh... |
I'm writing a script for others to use on their websites. I'd like to use jQuery in this script. Because I don't have control over what frameworks people use on their sites, I need to make sure jQuery is available and that it's version 1.8 or higher. Here's my take on it. Does anyone see anything I could/should be doin... |
I'm fairly new to JS/jQuery (a few months), and I think it's time to start getting involved in the community. So I wrote a little plugin. Nothing revolutionary. Really, the project is to write a clean, workable plugin. Any and all thoughts and suggestions on how I can make the code cleaner, or the animations smoother, ... |
I'm building a Ruby API client. My brief is to extract ids out of various inputs and fetch the relevant data. It's working just fine at the moment but I think it's a little clumsy.
My specs (which pass):
shared_examples 'it requests ids' do |resource|
it 'sends the ids to Foo::Client' do
Foo.stub(:parse)
Foo:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.