instruction stringlengths 71 71.9k |
|---|
I have built a Caesar Cipher in Ruby that utilizes ASCII for the encryption. I am not sure whether or not this was the best way to go about the task but this way made the most sense to me. Please give me any feedback that comes to mind.
puts 'Please enter your string to be coded'
string = gets.chomp.split("")
puts... |
I need to compute the number of target values \$t\$ in the range: \$-10000 \le t \le 10000\$ (inclusive) such that there are distinct numbers \$x, y\$ in the input file that satisfy \$t= x+y\$. I have the code which does work and would like to optimize it to run it faster.
Also, we'll count the sum \$t\$ only once. If ... |
I changed the normal way of using Angular. I'm using my controllers just to talk to my API routes and am using directives to manipulate the data and DOM as well.
I am using the object literal pattern where I have my INIT method that initializes global variables (object) and then calls other methods, bind clicks methods... |
I am learning how to implement testing and try/catch statements into my code. I have a Laravel application with the following method. I am looking for advice on where I should add in try/catch statements and what phpunit unit-test(s) I would create to ensure this is functioning properly. Tips on comment blocks are also... |
I'm adding three attributes to a Django QuerySet that represents a hierarchical tree structure:
a display_name which is added to all objects
the id of the object's parent (or immediate_parent) which is added to all objects based on a condition
a boolean is_parent field that should be added if and only if the object ha... |
I am finding the order of sorting of an array. The code works but can it be made better especially the return values of the function findSortOrder.
#include <stdio.h>
#include <stdlib.h>
// Returns 0 for unsorted, 1 for sorted in increasing order, 2 for sorted in decreasing order
int findSortOrder(int array[], int len... |
I am given two strings and return the position if in the larger string the smaller string is found. If not I am returning -1 for position. Any suggestions for improving my code.
using System;
using System.Collections.Generic;
using System.Linq;
namespace Reverse
{
class MainClass
{
static int IsFound... |
I have implemented the Salsa20 stream cipher as an ICryptoTransform. It runs fairly fast and has successfully encrypted and decrypted all of my tests. I would mostly like the Salsa20 algorithm to be reviewed (since there are very few reference implementations in C# out there), to make sure I haven't missed anything. I ... |
I got rejected in tech screen yesterday. I was asked to write a JavaScript function and send it over email. I have also added hiring manager's response at the bottom.
Could you please write a JavaScript function to compare two strings that look like phone numbers and indicate whether the digits in both strings match? ... |
This is my code to solve HackerRank's version of Project Euler Problem 91: on an N × N grid, find the number of possible right triangles where one vertex is (0, 0) and the other two vertices are integer grid points.
I know its an open challenge, but it is not for any job related coding, and I have also partially solved... |
The objective: Given an m by n matrix, I have written a function in Matlab that reorders the columns of the matrix to output linearly independent columns; other/redundant columns. Basically, it just pushes the redundant columns to the end of the matrix.
Here is my attempt at the code (which produces correct results): ... |
The whole process mainly depends on the ProcessFile() function:
I get all the credentials and details from a JSON file.
Initially I get data from the db: two IDs and a URL.
There is a text file for address state matching, reading, and compiling with | to match regex.
The same is done for zip and zip keywords.
Iterate ... |
Given an array and a string and bounds within which to search, I need to find the position of the string within those bounds.
What I want to optimise:
If possible, I want to re-design the function so that it doesn't have 10 optional arguments, some of which are not actually optional depending on the size of the array... |
I am using WinBGIm.
#include <iostream>
#include <cmath>
#include "graphics.h"
void Swap(double &a, double &b)
{
double x = a;
a = b;
b = x;
}
double Round(double number)
{
return (number >= 0) ? (int)(number + 0.5) : (int)(number - 0.5);
}
void PlotPixel(int x, int y, int color)
{
const int rad... |
I'm trying to refactor some code I wrote months ago when I used to use lots of anonymous functions. The way I'm trying to do it now is by taking all those functions and rewrite them within Object Literal Pattern.
I'm new to this kind of pattern and I would like to know if I'm doing it right, what should I improve or if... |
I am trying to write for both NT and POSIX (my two usual platforms) and have come up with the code below. The clrs code I refer to is apparently from blender build scripts, I discovered it on this SO post. They called the class bcolors but I wanted to reduce clutter so I renamed it.
But the main class is what I've writ... |
I am debugging one legacy J2EE application I and think I found some dead code and some redundant condition checks. Please give me your thoughts on my observations i.e. if they are valid. Please note that I am not permitted to rewrite this block, only to fix something if wrong or redundant.
...
else if ((emailList != nu... |
Given a folder typically containing ~250,000 small (20-100kb) files in HTML format (they open as single-sheet workbooks in Excel) and a list of ~ 1 million filenames, I need to open all the files that match the list and Do Stuff.
Overview of Main code Loop: "Test 1 Start" to "Test 1 End"
Once we get to the main file lo... |
I created a login service which holds a boolean based on if a user is logged in or not.
angular.module('deafApp')
.service('LoginService', function(){
var $this = this;
$this.loggedIn = false;
});
Inside my login controller (LoginCtrl), I attach the LoginService to a local scope object an... |
I'm using Bootstrap 3 to build a tab-panel component, based on information coming from the end-user. I don't like how there's a second foreach loop, but I don't know how else to print the HTML correctly.
Given an array structured like this:
[
{
"title": "Title 1",
"content": "Lorem Ipsum"
},
... |
I decided to create simple blog app by using Ember.js which should has the following interface
For this purpose I created blog route which contain the following code:
import Ember from 'ember';
export default Ember.Route.extend({
setupController: function (controller, model) {
controller.set('currentPost', 0);
... |
This VBA macro uses a worksheet (source_data_worksheet) to filter and split out the records based on about a dozen unique column (D) values in a dataset of about to separate workbooks which are saved to a folder.
There are over 10,000 records x 18 columns total with text and numbers (the overall file size of source wor... |
pairs() is a function which returns the total number of combinations whose difference is k.
static int pairs(int[] a,int k) {
int counter=0;
for (int i : a.length ) {
for(int j=i+1;j<a.length;j++){
if(a[i]-a[j]==k||a[i]-a[j]==-k){
counter++;
... |
I wrote a simple javascript program that takes a user's input and calculates the cost of their commute. I feel like I'm repeating a lot of stuff though.
How could I refactor this to make it cleaner and more concise?
function calcCost(costOfGas, vehicleMPG, numMiles) {
var dailyCost = (costOfGas / vehicleMPG) * (numMi... |
Sometimes, there's the need to verify if a given number is an integer or a decimal. Since JavaScript doesn't distinguish between both, I've made an extremelly basic function.
function isInteger(num){
var numCopy = parseFloat(num);
return !isNaN(numCopy) && numCopy == numCopy.toFixed();
}
As you can see, it rel... |
I decided to write a function that would generate an index of the Fibonacci sequence making use of Python's mutable default parameter. It's inspired by a question I answered on Stack Overflow where someone was converting a script with this idea from JavaScript to Python and I wanted to expand on it to see how I could h... |
I'm a web development student, and I made a chat bot that emulates an SMS app commonly found on smartphones, etc. It responds with random lorem ipsum text. I'm wondering if my functions are too long and how/if I should refactor further. For instance, when building the chat bubbles, would using a DocumentFragment or clo... |
I'm developing a web application allowing a logged-in user to find most correlated stocks for selected stock ticker. The user chooses a ticker, period of time (10, 30, 60, 90) and type of correlation (KENDALLS, PEARSONS, SPEARMANS). Then on the server side, the 'magic' happens and the server responds to the client by p... |
This is the current very repetitive and long SQL I have. Unfortunately I'm not that good at SQL to group this and get rid of the repetition.
select * from Mail
where admin_status = 1
and admin_id = 4
and core_event_id =0
and user_id !=0
and mail_reply_status = 0
and sent_to = 0
and admin_inbox_date > DATE_SUB(CUR... |
I have input of a string containing a single number (like: \$3\$) or a range (like: \$1-5\$). Sample input, all together, looks like: "1-5,3,15-16", and sample output for that input looks like "1,2,3,4,5,15". Output doesn't need to be sorted.
I built something to parse this, but it's ugly. How can I improve this?
from ... |
Here is the solution I've written for Hacker Rank Candies challenge.
It uses dynamic programming (memoization in a boxed array).
I'm interested on what could be done to improve this code in term of style and performance (although it passes all the testcases of the challenge)
For example, I wonder if the bunch of guards... |
I started learning AI recently. In AI, searches should be avoided and everything in AI is a search problem.
One of the easiest problem where we could use general AI search techniques is the water jug problem which states:
You are given two jugs, a 4-gallon one and a 3-gallon one. Neither has any measuring markers on i... |
I use this piece of JS code to login to my bank and get the balance. This code snippet works, but I wanted to know if I could make this code smaller, faster or if I could anything differently to improve it.
casper.start(url, function() {
console.log("Checking login status @ " + url);
this.waitForSelector("for... |
I have a Collection of 166 elements:
Dim MyCollection As New Collection
MyCollection.Add ("%")
MyCollection.Add ("%O")
MyCollection.Add ("D")
MyCollection.Add ("CMS")
...
I want to compare them to the value of the cells in a column. If the value of a cell is not in MyCollection, I change the background color to red.
F... |
I am always super annoyed when I have to write a bunch of if statements whenever I have to traverse an object graph of possibly null objects. As there is not yet a ?. operator I resorted to creating this wonderful piece of work: TryGetProperty. Please tear it apart. This was written for LINQPad.
public bool TryGetPrope... |
I am making a space-themed shooter game, and I need to render many "lasers" at the same time. I am using the library Slick2D, a wrapper around lwjgl. Unfortunately, when there are a lot of these "lasers" on the screen at one time, the game drops from its usual 60 FPS to around 30 or even 20.
Things I've noticed:
Not c... |
I wrote a small function to return a random in a given range:
int random_in_range(int min, int max) {
std::random_device rd;
std::mt19937 rng(rd());
std::uniform_int_distribution<int> uni(min, max);
return uni(rng);
}
But I read somewhere that you should only seed a random number generator once leading... |
I have just somewhat completed a program, and was wondering what I could do to improve readability, and design as some functions seems to be rather large and an eye-sore.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Text.Reg... |
Suppose I have an array of sentences:
[ "How To Format", "put returns between paragraphs", "for linebreak add
2 spaces at end" ]
I want to print it like this:
How put for
To returns linebreak
Format between add
paragraphs 2
spaces... |
In generic code, I sometimes want to conditionally add a data member to a class template. Writing separate template specializations scales as 2^N for N conditional data members. Absent a static_if feature, I have found the following user-defined class templates empty_base<T> and optional_base<T> useful:
namespace xstd ... |
I have written a mergesort in Python/Numba:
import numba as nb
import numpy as np
@nb.jit( nopython=True )
def merge( x ):
n = x.shape[0]
width=1
r = x.copy()
tgt = np.empty_like( r )
while width<n:
i=0
while i<n:
istart = i
imid = i+width
ien... |
Racetrack:
The August community challenge is to implement a program that plays the Racetrack game. Each player starts with an integer position on a square grid. On each turn, the current player can accelerate by -1, 0, or 1 unit in each direction. The first player to reach the finish line wins.
This is a Java implement... |
Racetrack
The August community challenge is to implement a program that plays the Racetrack game. Each player starts with an integer position on a square grid. On each turn, the current player can accelerate by -1, 0, or 1 unit in each direction. The first player to reach the finish line wins.
Most of my Java implement... |
I have recently written some code in Bash where I'm starting to program some things and I think I'm overcomplicating the script I wrote.
I'd like to make it simpler so that in future I would avoid these mistakes.
I've posted this on Stack Overflow and one user did reply that I can "simplify" multi-echoing:
just use 1 ... |
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 first seven triangle numbers:
1: 1
3: 1,3
6: 1,2,3,6
10: 1,2,5,10
15: 1,... |
This singleton is responsible for counting every pageview (called Routes in our case) we get by id, until the timer runs out and commits the results to the database in one query. Then the counter gets reset and the timer starts again.
I made this to reduce the amount of connections happening on our database at a given ... |
I'm new to Python and I'm trying to convert between Microsoft GUIDs and plain hex strings:
def hex_to_guid(hex):
h = binascii.unhexlify(hex)
return '-'.join(map(bytes.decode, map(
binascii.hexlify, (h[0:4][::-1], h[4:6][::-1], h[6:8][::-1], h[8:10], h[10:]))))
def guid_to_hex(guid):
g = binascii.u... |
I have code that fetches different templates for HTML and CSS in the file system. The templates are stored in different folders, so I have two implementations for the code that fetches them, passing the correct path as a parameter.
private string _templatePath;
private readonly IConfigurationManager _configurat... |
I have this code querying for some objects from my database with Flask-SQLAlchemy:
areas = Area.query.all()
subareas = Subarea.query.all()
And then I use it on html with Jinja template to display data:
{% for area in areas %}
{% if area.number=='0' %}
<select id="{{ area.number }}" class="subarea" onchange... |
Find the thirteen adjacent digits in the 1000-digit number that have
the greatest product." eg, the product of the first four adjacent
digits is 7 * 3 * 1 * 6 = 126
public class Java {
public static void main(String[] args) {
String temp = "731671765313306249192251196744265747423553491949349698352031277450... |
Zend framework 1. Physically, the file does not exist, it is created based on database.
Okay so use header?
public function downloadAction()
{
$id = $this->getRequest()->getParam("id");
$optin = new Application_Model_Optin();
//$data = $optin->getCodesFromDownload($id);
$data = array(
array('cod... |
I am new with async task in C# 4.5 and feel insecure about this:
I want to create a Windows Service that listen messages from a network (similar to msmq for example), when a message is received, do stuff not CPU bound (call webservices and rest API) without blocking other messages.
I created this console application in... |
I have programmed for 2 months, and I began writing a Chess game. I am a beginner programmer in Python, so please assess my code.
class Chess_Board:
def __init__(self):
self.board = self.create_board()
def create_board(self):
board_x=[]
for x in range(8):
board_y =[]
... |
So I have an Entity, which is responsible for providing an abstract base for other objects to inherit. (Like Actor objects, which are people, Creature objects, which are animals, etc.)
The Entity provides a solid foundation for Actor and Creature to interact with, I'm just curious if it's not gone overboard or if I've ... |
This is a reservations software for hotel and restaurant management, allowing you to add and delete rooms, show available rooms, keep track of reservations etc. I am looking to trim my code a bit and improve upon the style since it's a little cluttered right now. I believe the use of classes will help rather than makin... |
I have written this code to build a list by looking inside directory within deep to the level it finds a audio file and then move to the next level or next folder.
Can there be a more efficient way since a user can have any number of files? Do you think it can be achieved more robustly in terms of performance?
path = '... |
I want to learn OO design and as a start, I implemented Tic Tac Toe. I'd like to hear your thoughts on the design and implementation.
Classes:
Player - Has just a name as of now. I hope to develop this more to use for other similar situations.
Board - Has a 3x3 matrix and takes care of checking if game is over and if ... |
I have a file on my server which contains a running output of a script. This file is constantly changing and fluctuates in size between 0 - 1Mb. Now I want to take this file and make it viewable from the web. Currently I am using jQuery to get the file then I set a textarea's value to be the file content. In order to m... |
I have an Ajax request from a page where the user is being asked to enter their date of birth. The request URL file has the code below and works all good. However, I'll be rewriting all MySQL/MySQLi functions used on the same website and this is generally how I use prepared statements. Should I avoid using die();? Is t... |
In an array of strings 'a' having 'n' strings i have to select the Palin Pairs from the given strings .for ex for input 3 bba abb abb Output=2
I am getting correct output but want to reduce time complexity....what other logic or enhancement I can use to optimize the code
import java.io.BufferedReader;
import java.io.In... |
As part of learning Rails framework, I have small app in progress. Basically idea is, user can create IP address, define is it in use, to which server is assigned, which user is it using and role of IP address in web hosting environment. I have 3 models, IpAddress, IpAddressRole and IpAddressUser. User is able to defin... |
I'm working on a plain Ruby class within a Rails application.
For the total_leg_count method---is that the best way to go about achieving what I want? I feel like there's potentially a better way.
class AircraftTimeReport
...
def total_leg_count
count = 0
active_flights_within_timeframe.includes(:legs).ea... |
I wanted an easy way to augment objects, by adding functionality from any other object(s). More importantly, I needed a way to augment the object from multiple sources in a clean one-line solution.
The inheritance is done with this:
function extend(proto, args){
this[proto.id] = Object.create(proto);
proto.con... |
Since rsync lacks compression and I'm not a big fan of rdiff, I thought I'd try my own little backup script. Since I'm very inexperienced with file management in Python, I'm sure there is lot of room for improvement.
The script creates the entire folder structure within the backup folder and then creates syncs recursiv... |
I started to learn Rust some time ago and I wonder if there is some way to write Rust code that is both concise and safe — in particular, avoiding unwrap(), casting functions and try!().
Let's see an example. I wrote a software to generate random bookmarks and save them to a file, both in Rust and Haskell to compare.
F... |
This sorts a linked list using mergegort. Can you please critique my code and provide your thoughts on where I should improve my code?
import java.util.Iterator;
import java.util.NoSuchElementException;
public class LinkedList<T extends Comparable<T>> implements Iterable<T> {
private Node<T> head;
public Lin... |
I was poking around on my Raspberry Pi that I hadn't turned on or used in a while, and I stumbled upon this Python script that I wrote ~1.5 years ago, and I was intrigued.
Essentially, it's a 2D Minecraft clone with no concept of survival. It does have a slightly, complex control scheme, so here's a list of buttons tha... |
I wrote connection logic for a wrapper around RethinkDB in node.js. While it works, I know it can be cleaned up, and done in a better manner. Essentially the logic is start at the first host in config.hosts, if _connect() fails, then try the next host in the array. This continues for three times, or until config.hosts ... |
I have written this Java code for a data structure which includes 3 stacks to supports four operations in \$O(1)\$: push(int x), pop(), min() and max().
Instead of pushing new max and min in every push, I tried to optimize code in this way to have less space.
import java.util.Stack;
public class MyDS {
Stack<Inte... |
Please share your comments and better ideas, to print java graph, which manipulates selected (@Mask) fields as XX, thus avoid logging confidential data, through this tool.
GitHub
public class MaskLogger {
private static final String SERIAL_VERSION_UID = "serialVersionUID";
private static final String ELEMENT_DA... |
I was trying to learn to develop plug-ins in Eclipse and after following the tutorial provided with Eclipse, tried to expand the code by writing a short Java class to track and display mouse movements on a text area. I got the code for that too from an Oracle Java document. Following is the java class from where I call... |
I'm in need to make a byte[] -> T extension method and need it to be fast (no need for it being pretty)
This function will be called 100's of 1000's of times in very short succession in an absolute performance critical environment.
We're currently optimizing on "ticks" level, every tick translates to a couple milliseco... |
Task description
You are given a list and an item, find the length of the longest consecutive subsequence of the list containing only the item.
Testcases
[1, 1, 2, 3] 1 -> 2
[1, 0, 0, 2, 3, 0, 4, 0, 0, 0, 6] 0 -> 3
This code is pretty readable in my opinion but I fear that the \$O(N^2)\$ time complexity is sub-optim... |
Coming off a comment on this question, I figure it cannot hurt to post my Inventory work here as well.
Basically, I have Item, which is a base item, and then Container, which is a specialized item that has sub-items in it. The Container object, however, can be filtered to only permit (or restrict) certain items by some... |
I am working on a project which crunches plain text files (.lst).
The name of the file names (fileName) are important because I'll extract node (e.g. abessijn) and component (e.g. WR-P-E-A) from them into a dataframe.
Examples:
abessijn.WR-P-E-A.lst
A-bom.WR-P-E-A.lst
acroniem.WR-P-E-C.lst
acroniem.WR-P-E-G.lst
adapter... |
For my application, I need to use two slightly different algorithms for persisting an entity:
def persistRandomAlias(self, alias):
self.em.persist(alias)
try:
self.em.flush()
except DBALException as e:
if e.previous.code != 23000:
raise e
self.reloadEM()
sel... |
Question:
Special Pythagorean triplet, Euler Problem 9
A Pythagorean triplet is a set of three natural numbers, \$a<b<c\$, for which, $$a^2+b^2=c^2$$ For example, \$3^2+4^2=9+16=25=5^2\$.
There exists exactly one Pythagorean triplet for which \$a+b+c=1000\$.
Find the product \$abc\$.
I got the code to work using al... |
In my program, I prompt the user to enter a range of cities (in a spreadsheet), and then a range of review scores, and then make some decisions based on what the user has entered. Since the handling of the both user inputs (both ranges) is common to each, I have combined both into the single function getRanges() below.... |
This is not a novel interview problem. But I want to address it with the following points:
Implement the algorithm with Object-Oriented Design principles in mind.
Optimize the solution, if there are many continuous inputs.
Write simple unit tests (without using unit testing framework like gtest, boost.test)
Basically... |
My concerns:
Is the code pythonic
Is the code practical
I tend on expanding the usefulness of this script, if you don't think it's stupid idea. One thing I will implement is command-line arguments by way of argparse.
#!/usr/bin/env python
'''
Test if network is online by sending and http request to a remote
web-ser... |
Here is my basic password generator which saves your password to a .txt file which you can choose the name of etc.
import random
import string
import os.path
#random numbers section
num1 = random.randrange(100,999)
number_section = num1
#random letters section
string.letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN... |
Here is what I'm starting with. It is just some <p> tags in a <div> tag.
<div id='mi_control' class='radius_all'>
<p id='mi_cover_l' class='menu_bottom small_dark'>Arcmarks © </p>
<p id='mi_about_l' class='menu_bottom small_dark'>About</p>
<p id='mi_privacy_l' class='menu_bottom small_dark'>Pr... |
I'm working on a tool to detect all exact tandem repeats in a DNA/RNA sequence. Part of the algorithm requires finding Longest Common Extension (LCE) values, which although can be computed in constant time, in practice it is (usually) better to use a naive \$O(n^2)\$ solution. The problem is that DNA sequences can cont... |
I have wrote an application which asks for the user id, and returns a link to the first available chat message:
Output
Enter user id:
322395
Fetching data...
http://chat.stackoverflow.com/transcript/17?m=231895#231895
Source code
module Main where
import Network.HTTP (simpleHTTP, getRequest, getResponseBody)
... |
I am building a config class for PHP which initially loads all given config files. To add files, users should be able to provide either a single file or a directory where files can be JSON or PHP.
Below is what I have so far, but it seems sluggish and inefficient to me. Is there a more elegant way to give users a wide... |
My program is complete and working, but I would like second opinions on it. The program prompts the user for a positive value that will serve as the maximum for the range that will be checked for perfect numbers. Although this is one of those do-what-you-want-with-it problems, I have to keep the two prototypes. Are the... |
I could not find a solution from my book's website (student-level access) but I feel that I am missing something that I'm supposed to learn from this exercise.
Instructions: Balls are dropped from the opening of the board. Every time a ball hits a nail, it has a 50% chance of falling to the left or to the right. The pi... |
This is stripped down from a project I'm working on:
let userFields = {
id: {
dbFields: 'id',
},
email: {
dbFields: 'email',
},
first_name: {
dbFields: 'first_name',
},
last_name: {
dbFields: 'last_name',
},
name: {
dbFields: ['first_name', 'la... |
I wrote a tokenizer/lexer (difference?) for Python in Haskell: this is my code on GitHub.
I already tested it out with some of CPython's standard library scripts, and it doesn't fail. However, it probably outputs non-conforming output. But I don't care about this right now.
What I'm looking for is a general (functional... |
This is a class that takes a PropertyInfo and makes a Control for it. You can access the value of the control through a property on the class called Value. Basically I get the data from the database for a specific type and create a form where I add the controls generated by instances of this class for each property of ... |
Following is my code for implementing basic symbol table in C. Please review my code and tell where I can improve my program.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdbool.h>
#define BUFFER_SIZE 1024
#define TOKEN_SIZE 32
typedef struct symbol
{
char* identifierNa... |
Basic algorithm:
Open document/huge text file
Use Map and List to separate the words. \$O(K)\$ time complexity (TC) considering \$K\$ distinct words.
If the word already exists in the list, increment the count of frequency, else add the new word. Constant TC.
Use a Collection to sort the list on the basis of frequency... |
I tried to make a social media slider with jQuery, HTML and CSS. This is available as a Fiddle.
Can I improve or debug any elements of it?
$(document).ready(function() {
$('.sa').hover(
function() {
$(this).css("margin-left") == "130px"
{
$('#sociallili').stop().animate({"margin-left": '+=130'})... |
I have this function that gets an item passed from another function, together with the subtotal and the fee of the item. The function has to act as fast as possible, as other people also want the item. However, the function seems to take a very long time, and almost never ends up buying the actual item because it was t... |
I've been learning C#, and today I made a simple Tic Tac Toe game. The code is pretty long, and I'm almost 100% positive that this can be done so much better. Please provide some advice, suggestions, and criticism.
byte _clicks = 1;
bool but1clicked, but2clicked, but3clicked, but4clicked, but5clicked, but6click... |
Number letter counts, Problem 17:
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?
NOTE: Do not count spaces or ... |
I am attempting to solve the Minimum Path Sum algorithm problem and I have a working solution, however there was an unwritten requirement that the algorithm not exceed an unspecified amount of time for any given matrix of size (m x n).
Given a m x n grid filled with non-negative numbers, find a path from top left to b... |
Recently, I started wrapping Meshes and Transform classes into new ones, but by doing this I came upon a problem: I needed to render all primitives, or meshes with a renderer. After studying a some game engines (especially the JME3 engine), I came up with this node-based rendering. It's really not complete yet, but fun... |
I have generated code which reads a file containing ways, take the individual waypoints and writes them into a new file, but only if the waypoint is not already present. At this moment my program stores the waypoint in a vector. Before the new found waypoint is written to the file the program checks if the waypoint is ... |
I used Spring MVC arch, and I need to be informed about correct names of methods and exceptions throwing.
/**
* @author Eugene G. Ustimenko
* @date Jan 19, 2015
*/
@Service
@Qualifier ("entityService")
public class BaseEntityService < T extends BaseEntity > implements IBaseEntityService < T > {
@Autowired
p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.