instruction stringlengths 71 95.1k |
|---|
I recently asked for some advice on the best way to structure my code for a program I was writing. (see this question on Programmers.SE). The solution I was given was quite elegant, however I am less happy with the code that I've written so that the UI remains responsive.
Here is my code, I will outline the reasons I ... |
Below is one of the first classes I've built. I started creating my functions like so:
public function getCourseInfoByID($id) { }
Requiring the user to pass a course ID. I've recently modified it to assign the course ID (and $course_info - an array to reference each element from the DB) in the constructor, and I'd li... |
I am writing a prototype for something at work. Not very many people here know much about Linux/Unix or Xlib, so I can't really ask here at work (most developers are expert Windows programmers). With this said, I have one class and a driver that I would like feedback on how well I have integrated threads, XLib and Open... |
I have this static class in an ASP.NET MVC project:
public static class Setup
{
private static bool _intialized = false;
public static void Initialize(IWindsorContainer Container)
{
//Check if it has already run
if (_intialized)
{ return; }
var connectionString = config.Connect... |
I've been working on a semi-awkward query in that it uses a very high number of functions given its relatively small size and scope. I was hoping to get some feedback on any ways I could format or re-factor this better?
select Name ,
avg(TimeProcessing / 1000 + TimeRendering / 1000 + TimeDataRetrieval / 1000) ... |
I am trying to create a very simple timer framework which allows you to setup event handling based on a timeout.
The basic primitives allow the programmer to:
allocate or free timers
arm/disarm timers
set attributes and timeout for a timer
Currently, the self contained example will create timers up to the maximum (cu... |
Essentially, I am making an app that allows the user to type in chemistry formulas using a custom keyboard.
The keyboard will have several keys, for example, "Na", "H", and "O". Pressing them in different combinations will result in different formulas. For example, Na + O will result in NaO. Pressing any key consecuti... |
I just wanted to know if I'm doing this right. Note that all the matrices are int[16]s.
for (int i= 1; i <= 3; i++){
for (int j= 1; j <= 3; j++){
int sum = 0;
for (int h = 1; h <= 3; h++){
sum = sum + position[i*4+h]*projection[h*4+j];
}
modelview[i*4+j] = sum;
}
}
|
I want to make this code generic, so that I could remove if/else and recursive for loops.
I am open to accept all kind of suggestions regarding common interface implementation but kindly check that their property names FKID are different, and as these are POCO entities I can't change the proper names.
var newClientTri... |
I've got this function which returns an SQLObject instance as a dict (taking into account inherited classes, properties, etc). It doesn't work right now on SQLObject classes which inherit from another class but add new attributes, so that's a work in progress, but I feel like this could be done smarter/better in Pytho... |
I have a method which compares two lists of strings. If the strings, and only the strings, from listA appear in listB, return true. Else return false.
internal bool DoIdsMatchThoseFromXml(List<string> Ids, List<string> XmlIds)
{
bool result = true;
if (Ids.Count == XmlIds.Count)
{
... |
I created a simple Python script to log track listens in iTunes and it seems that it's pretty inefficient. I'm primarily a front-end developer, so this is clearly not my area of expertise. I know loops can cause problems in any language, so I assume that's the issue here.
If I run this script for a while (say, a couple... |
It seems that lxml/etree are generally imported as from lxml import etree -- why is that? It keeps the code tidier, and while the potential namespace ambiguity might not be a concern, I don't have any incentive of doing this as it's generally frowned upon.
I know for a script of this size it doesn't matter much, but I... |
Is there a better way to express the dispatch (switch) code without using a lambda? I think I need the lambda to act as an intermediary because the functions have varying numbers of parameters.
def printf(arg):
print arg
def printf2(arg1, arg2):
print arg1
print arg2
def printn(arg):
print arg
action... |
I read that if an object is made using the init it must be released, but if it's something like this elementFormula = [[NSMutableString stringWithString:@""] it is autoreleased. However, there are some other aspects of memory management that confuse me.
For example, something like [[NSMutableString stringWithString:... |
I've made a mock version of Silverlight in D2. It is meant to output HTML, but since I don't know HTML yet, its current output is in. HTML is not the reason I'm here, though. The goal of my project was to create a framework that uses XAML and MVVM to create a site bound to a viewmodel. It doesn't do too much and isn't ... |
I'm worried about my code performance. The code I've written is an implementation of SHA-256 using pseudocode from Wikipedia. It works fine, but I want to speed it up. With a buffer of 4096 bytes, I only get 40 Mb/s, whereas commercial software gets 120Mb/s. I've degugged the code, and it seems that the problem is in ... |
A method that I'm working on in a C# project includes the following:
if (isDailyRateRequired)
{
CalculatedDailyRate = dailyRate;
}
if (isWeeklyRateRequired)
{
CalculatedDailyRate = weeklyRate / 7;
}
if (isMonthlyRateRequired)
{
CalculatedDailyRate = monthlyRate / 30;
}
There has to be a cleaner implem... |
I have written a class and spec for testing my class. Can anyone determine whether or not this is a correct and good spec?
Class:
module Sitemap
=begin
Class Name: Cities
Function: This class is responsible for getting the data to create the sitemap
for each country according to cities.
=end
class City
attr_acc... |
I am new to Android programming and I'm working on an Activity in an app that will plot the location of contacts from a specific email account on to a map. The following is what I in a class that the Activity will use to get the Contact info I want to use when plotting the location. I have tested this and it works. But... |
I have a navigation, with a sprite that changes based on the class. In my jQuery, I'm clearing out the classes so it will just have .nav and then addClass the right class based on the click. It works but feels very redundant. Does anyone have suggestions on optimizing this?
HTML:
<div class="grid_12 nav home">
... |
Preview: http://sparksonrails.pennfolio.com/
Jquery:
function introIconFirst()
{
$('h2.ribbon').css(
{
'marginTop': '+30px',
'opacity': '0'
}).animate(
{
marginTop: '0',
opacity: '1'
}, 1500, 'easeOutElastic', introIconSecond());
}
function introIconSecond()
{
$('... |
Basically I'm trying to generalise and extend the notion of mapping one string into another.
There are two methods I often find myself using for this: Functions, and Dictionairies.
So here are my 3 classes. (I intend to create some explict classes as well, like ToCamelCase - as my current project requires)
public abstr... |
I started an open source Markdown editor using C#. I'm a huge fan of the MVC pattern, however I am having trouble refactoring my back-end form code. It's getting pretty long and I was wondering if anyone had tips on which pieces I can move to separate classes.
Here is my main form C# code:
using System;
using System.... |
How can I re-factor the code to remove duplication and create a common method ?
(function(){
$("#a", "#main").bind("mouseover", function(){
var id1 = $("#one").text(),
args = ["DCSext.common1","common1","DCSext.common2","DCSext.title","one", "DCSext.ti", id1];
dcsMult... |
These two methods do very similar things. Is it possible to condense these somehow? This is using the Entity Framework.
public void ExportSiteData (FLEX_INV_EXP_SITE siteData)
{
var uniqueSite = from e in _context.FLEX_INV_EXP_SITE
where e.SITE_ID == siteData.SITE_ID
... |
I'm hoping someone is willing and can take a minute to look over this function and tell me what they think of it, if it can be improved or what not. I tried commenting out what the purpose of everything is. I would like to note that something isn't quite right with the time_remaining and what not because what's suppose... |
I am working on bettering my C# skills, and recently wrote this program to solve a projecteuler.net problem:
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've tried making a payment system for an API called Payson, which is a European company similar to PayPal.
I get the right response when I press the button so it seems to work, and I wonder if you can look at my code to see if it looks OK. I didn't test the part receive but the part send i.e. the first part I've teste... |
I am relearning C so if you could point obvious faults in this solution to this problem I'd greatly appreciate such comments. Please note that I'm using GCC extensions to use larger than 32 bit numbers. Most importantly I want to be aware of the quality of memory management in particular.
http://news.ycombinator.com/it... |
I'm attempting some Project Euler problems in an attempt to learn Python. While I can get the correct answer quite easily, my programs are quite slow. Project Euler, if doing it correctly, specifies that each program should run in <1 minute. Some of mine take 5-10 mins.
Here is one example.
x=1;
terms=0;
maxTerms=0;
m... |
I just created a script on jQuery which loads my articles dynamically with an AJAX call if the user changes the page.
I added some cool effects like the articles move on the left, then the new ones appear in fade while a loading black screen cover the articles.
The thing is, I'm afraid my code is too heavy and not real... |
Remove an event listener after firing once or any number of times
This is what I have:
/*jslint browser: true, vars: true, white: true, maxerr: 50, indent: 4 */
(function ()
{
"use strict";
function removeEventListenerAfterFiring(numberOfTimes, callback, useCapture)
{
var count = 0;
retur... |
$('pre').each(function(index) {
var c = $(this).attr("class");
if (!c) {
return true;
}
// Match only Javascript code snippets
if (!c.match(/brush: js; class-name: 'jsbox'/)) {
return true;
}
var code = $(this).text();
$(this).after($("<button>Run example</button>").click... |
Input: any integer
Output: that integer in number format (commas) with a leading a or an as appropriate with the rules of English
After a bit of groping around I hacked out the following PHP function, and am looking for any advice on code structure and optimization. Thank you!
function prefixAAnToNumber($num) {
$pr... |
Further to the question
I solved it in following way.
#include <iostream>
#include <algorithm>
#include <iterator>
#include <stdio.h>
int main ( int argc, char **argv) {
int T; // number of test cases
std::cin >> T;
for ( int i = 0 ; i < T; i++) {
int N; // number of childrens
std::cin >>... |
I have this module which computes checksums from a list of files in a given directory.
The problem is that my is_changed_file is long and ugly, but my attempts in refactoring failed, so I would like some other point of views...
import hashlib
import logging
# if available use the faster cPickle module
try:
import ... |
The following is a new question based on answers from here: Small PHP Viewer/Controller template
I have written a small MVC template library that I would like some critiques on.
The library is located here
If you are looking for where to start, check out the files in the smallFry/application directory.
I would reall... |
This is a framework for a JSON parser I put together last night.
Any comments appreciated.
JsonLexer.l: Breaks the input into lexemes
JsonParser.y: Understands the language syntax
JsonParser.h: Header file to bring it all togeter
main.cpp: Test harness so it can be tested.
Makefile: Sinmple build script.
Tes... |
I've taken criticism before on my PHP and have since then taken the improvements into my routine. However, I still believe that I can improve.
I believe that SE is the best place for the best programmers. If any of you are bored enough to tell me what I can do better, I'd appreciate it greatly.
You can see a small proj... |
This is my solution to the codercharts problem http://codercharts.com/puzzle/word-swap but if keeps failing when I submit the solution because of the cpu_excess_time. Please suggest possible optimisations for this problem, I believe my solution is correct but not optimal.
#!/usr/bin/python
def swap_words(first_word,se... |
I started a web project. Now I was wondering if it is secure enough. I followed some tutorials on HTS, but I can't see all holes (if there are any). Can you check my pages and if you can find any hole in it (like XSS or SQL injections). Thanks for helping :)!
My URL is: **
And another security question: is my HTTPS cer... |
I've got a module I use to log around functions that performs external requests.
# Functions to track when a block begins and ends
module LogAround
# log at begin and end of a given block
# with a mesage and the given params
def log_around(message, *args)
start_time = Time.now
Rails.logger.info "#{messag... |
I wrote a web files browser. I want to refactor my JavaScript code, but I'm new to JavaScript.
I have some thoughts:
Split the file into several files:
FoldersManager.js
FilesManager.js
Paginator.js
GlobalVars.js
Do you have any other ideas?
Naming conventions: How should functions\vars names be written?
I wrote m... |
This is in C/C++ (using a c-string as input). I'm curious if my solution could be more efficient than it currently is.
char mostFrequent(char *bytes, int length) {
char holder[26];
for (int i = 0; i < 26; i++) {
holder[i] = 0;
}
for (int i = 0; i < length; i++) {
holder[bytes[i]-97] += 1;
}
char b... |
I have just started learning about JavaScript and events. I am interested in learning the JavaScript and not jQuery until I am better at JavaScript.
I wrote this code that will show and hide my div because I basically want to be able to use this code in future web development projects but at the moment it will only app... |
List<Route> listOfRoutes = routeStopsService.getAllRoutes();
Set<String> listOfStopNames = new TreeSet<String>();
for(Route route:listOfRoutes){
Set<Stop> stops = routeStopsService.getStops(route);
for(Stop stop:stops)
listOfStopNames .add(stop.getStopName());
listOfStopNames .remove( ((TreeSet<Stri... |
So this is probably a popular problem, and I decided to take a crack at it today using C#.
I came up with the following solution:
private BinaryTree<int>.BinaryTreeNode FindLowestNodes(BinaryTree<int>.BinaryTreeNode node, int depth, ref int biggestDepth) {
this.WriteResult("Entering recursiorn for node.....{0}", ... |
I am writing code that has objects having integer member variables where the integer value has a specific constant meaning, which normally means "use an enum".
Suppose the values are the days of the week, Monday = 0, Tuesday = 1, and so on. (In my real case, there are several different "types" involved, some of which ... |
Following on from this request Yet another C++ Json Parser
A friend pointed out that he though a recursive decent parser would be more efficient.
Before I agree I want to test it so I wrote it for testing.
I found the implementation of the parser much more complex than using yacc (but that could be a result of using ya... |
The goal of this code is to save a list of 250000 words with a number that indicates its frequency. The 250000 are sorted alphabetically but the frequency is unsorted. The idea is that a user must insert capitalized words, spaces or numbers after each word to lookup in the saved 250000-word list.
The max number of inpu... |
Below is an implementation of a typical Logger interface that uses syslog() as the default means to store messages and falls back to error_log() if that does not work. This is the first time I've used syslog and just want to ensure that my code is logical and there isn't something about syslog that I'm not aware of th... |
Given that it is better to reuse objects than create new ones when developing with Android, is it worth while deleting the contents of a StringBuilder and reusing it?
StringBuilder b = new StringBuilder();
//build up a string
b.delete(0, b.length());
//reuse it
Compared to:
StringBuilder b1 = new StringBuilder();
//bu... |
I'm currently looking at, from a rather high level, the parallelization of the gravity calculation in an N-body simulation for approximating a solution to the N-body problem.
The simple form of the algorithm looks something like this:
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (i != j)
... |
I have a table in a SQL Server database, which holds information of some images, and the relevant gallery of them. The columns are like:
ImageId, GalleryId, Order
I have a unique key on GalleryId-Order columns, that is, each image should have a unique order in its gallery.
A business requirement is to change the place ... |
What do you think of http://websilon.org/? Are there things that can be improved? Is there something missing? See the source of the webpages for code.
<!DOCTYPE HTML>
<html><head>
<title>Websilon - Mathematical Knowledge Base</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv... |
This is a subtle question about design in which I want to find the most elegant and appropriate solution.
I have an enumeration representing a French card deck (see code below). With it I need to do certain things, such as displaying the elements in a table. I'll want to display the elements starting with ACE (the hig... |
I'm a beginner in Java so I would appreciate a review of following simple class - in fact it's my first real usage of enums.
The background: I'm parsing MySQL internal client-server protocol. One of the fields in server greeting and client authorization packet is "Client capabilities" which is 32 bit integer encoding 1... |
For practice, I've implemented Sieve of Eratosthenes in Java by thinking about this visual animation.
I would like to hear some suggestions for improvements, especially how to make it more efficient and readable (sometimes there are trade offs) and how to follow good Java conventions. Also, suggestions on issues from n... |
I asked a question about an implementation of a logger using syslog and error_log as fallback that made me re-evaluate my Logger interface. Before it simply forced a log($timestamp, $message) to be implemented but after reading over the answer to the question I'm not sure that this is the best API possible to work wit... |
What do you say about the code structure below? This is one of the recommended ways of writing JS code in my education.
What is the pros and cons with writing code this way?
Can you recommend any better and maybe more elegant ways of writing code?
var DESKTOP = DESKTOP || {};
DESKTOP.Init = DESKTOP.Init || {};
DESKTOP.... |
I am creating a simple server that accepts a int and returns the value received twice:
public class MyServer{
private static int port = 1234;
public static void main(String args[]){
try{
ServerSocket serversock=new ServerSocket(port);
while(true){
Socket socket... |
I've got my answer working (up until a 7-digit answer is requested, anyway), and would like some help
returning the correct answer
speeding up the results
I was thinking of storing the values of the possible palindromes before beginning my calculations, but I know it wouldn't speed things up anyhow. I've also read a... |
I have this recursive function that searches an object tree structure:
dataSearcher = (dataElement, identifierToFind) ->
if dataElement.identifier == identifierToFind
return dataElement
else
for childDataElement in dataElement.children
found = dataSearcher childDataElement, identifi... |
I've been working on a JS/HTML5 Game Engine. Right now I'm calling it DimSumJs, because like DimSum, isn't a full meal, my framework still runs too slowly to make a full game (it can only run about 400 "objects" despite before slowing down, it becomes very noticeable around 500 "objects"). It uses divs inside an iframe... |
I wrote Nim Game in Haskell. Since I'm just learning any review comments are highly appreciated.
module Nim where
import Char
import List
import Maybe
--Domain
--Nim is a mathematical game of strategy
--in which two players take turns removing objects from distinct heaps.
--On each turn, a player must remove at l... |
I'm trying to compare my own implementation with another solution of Project Euler problem #1, which uses a list comprehension:
module Progression1 (sumProgressions) where
import Prelude
sumProgressions :: Integer -> Integer -> Integer -> Integer
sumProgressions d1 d2 limit =
sum [n | n <- [1 .. l... |
Usually, people would create two extra-threads in order to read the standard output and error respectively. However, the following code would allow to handle a Process outputs without those threads (it is arguably a little bit more difficult to decode the characters if you are using something else than a single-byte en... |
I have started to reading up on electronics and embedded software. Lately I have been looking at IC's, particularly shift registers. I thought a good way of learning more about serial communication and shift registers was to implement the internal logic of a shift register.
The one I have chosen is the 74HC595.
I hav... |
mysql> select count(username) from users where no_tweets > 50;
+-----------------+
| count(username) |
+-----------------+
| 282366 |
+-----------------+
1 row in set (5.41 sec)
mysql> select sum(no_tweets) from users where no_tweets > 50;
+----------------+
| sum(no_tweets) |
+----------------+
| 3856... |
I have created a piece of code for a live pagination, but I don't like the code. It works it does the job, but I guess I could done it better.
$('.show-content').livequery(function() {
$(this).find('.page-me:not(:first)').hide();
var totalPage = $(this).find('.page-me').length;
for (var i = 0; i <= totalPa... |
I need help refactoring code for my PHP template engine. I just have this feeling that the code is too disorganized and can be improved performance-wise. My main concerns are running a preg_match on every line in the file and hard-coding functionality for conditional and repeat blocks.
<?php
class Template extends C... |
I created a PHP class to handle building SQL query strings. I need advice on how to make the code more efficient.
<?php
/**
* Example:
*
* $query = new SQLQuery();
* $query->select('*')->from('users')->where(array('banned' => 0))->order('id' => 'asc')->limit(1);
* $result = $query->execute();
*
**/
requireCom... |
Below is the code for a database class that wraps around a small set of the features that the mysqli extension provides. I'm looking for ways to improve its efficiency. Which parts of the code seem hack-ish and how can I make it more structured and organized?
class Database extends Component
{
private static $mysql... |
In page load I'm saving a query string int value in a viewstate. Then I save it to my DB. Here is the code I use to retrieve viewstate value and validating it:
protected int CurrentCom
{
get
{
if (ViewState["CurrentCom"] == null)
return 0;
else
{
int temp;
... |
Usage example
var qm = new QueueMessage("foo", 99);
var ba = ByteArraySerializer<QueueMessage>.Serialize(qm));
Class that performs the serialization / deserialization
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
namespace Codingoutloud
{
public static class ByteArraySerializer<T>
{
... |
Here is my controller class for my MVC pattern with all the includes removed. From what I know of the MVC pattern it is good to have a small controller class. Mine is just a collection of public static functions which accept requests and send data to the client.
Regarding send(): I'm just wrapping the echo command f... |
I'm developing a Rails-based web interface/API for a large, vendor-supplied, legacy Oracle database. One of the constraints is that I can't change the schema other than adding views, because it still has to support the vendor's application.
The table for customer data has a limited number of columns, and extended attri... |
Currently, in my project I have one class that is dedicated to the all of the queries for the IBM i and converts it into usable models for my .NET code. There is already 12 methods in this class and there will be many, many more to come. This is for a tool that pulls data from our IBM i and pushes it to our internet da... |
Parallism is achieved by using a simple call to tbb::parallel_invoke(). However I can't break a speedup factor of x2 (after ~3-4 parallel HW threads), although 8 parallel HW threads are used. Advice on this is highly appreciated.
template<class In>
void insertion_sort(In b, In e) { // pretty standard insertion sort for... |
A few days ago I saw this question on Stack Overflow.
I have tried to make a little demo to show the speed advantage of using 64-bit memory operations compared to 32-bit ones. So I wrote this code:
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#define MEGABYTES 1024 * 1024
#define MEMORY_SIZE 100
#defin... |
I am toying with a simple class to inherit from to manage my dynamic resources. I am fairly new to C++, so my "implementation" might be suboptimal. Suggestions how to improve functionality are welcome. There are plenty of couts for orientation purposes, so feel free to ignore those.
The idea of UObject is to organize o... |
I have a module that builds swing tables based on an Object[][], then I have another module that queries an SQLite database and returns a ResultSet.
I have written a method that converts the ResultSet to an ArrayList<Object[]> first, then further into an Object[][]. The reason I do it this way is because you cannot get... |
Table Structure
ApprovalOrder int
EntityCode varchar
CostCentre varchar
DelegationCode varchar
ProjectCode varchar
RoleGroup varchar
Position varchar
DelegationText varchar
DelegationAmount money
Active bit
Query / Explanation
The purpose is to pull all records for a delegation chain and add a new... |
This is my first attempt at writing something in JavaScript besides a few Project Euler problems I did first. It's intended to be a library used client side and server side (both of which I know very little about). I've read Crockford's Javascript: The Good Parts, but nothing else. I have the most current experience w... |
public double getValueWithPercentage(double number, double percentage)
{
return number + ((percentage / 100.0) * number);
}
Are there any tricks to optimize this simple code?
|
I've been struggling with concurrent programming in Haskell for a while. It's so hard to reason about, especially when exceptions come into the picture.
As a learning exercise, I implemented a simple chat server. Clients connect using telnet on port 1337, and start typing text. Each message is broadcast to all conne... |
This file takes a user picture upload and converts two pictures which are named according to the Session ID.
Right now he biggest drawback is that you cannot crop the image at upload time like you can on popular sites like Facebook.
However I'm just looking for overall constructive criticism on the structure of the cl... |
I am writing a few python functions to parse through an xml schema for reuse later to check and create xml docs in this same pattern. Below are two functions I wrote to parse out data from simpleContent and simpleType objects. After writing this, it looked pretty messy to me and I'm sure there is a much better (more py... |
I have a Rectangle class, of which I have 5-6 vectors for each instance. The main vectors are the center and color of the object, while the secondary vectors represent more or less the north, south, east, and west directions of the rectangle itself. These vectors are used to detect collision by "pointing" outside of th... |
I wrote a function (get_last_word_of) that takes a C string and a destination buffer, and then copies the last word into the buffer. The code was originally C++, and was changed into C later.
#include <assert.h>
#include <stdio.h>
#include <string.h>
// Check whether the two values are equal, and print an error if th... |
My application is for the use of comparing a product sold by several merchants on a daily basis. A process runs to load the current values of data for each store and enters it into a database along with any previous data. Later I plan to create graphs and such off of the history of data.
SELECT `a`.`part_number`, GROUP... |
I'm writing a small PHP framework to help me develop Web applications. The framework is split into numerous components, each of which are automatically loaded according to the configuration settings. This is my component base class:
class Component {
public static void init() {}
}
When I create new components, I e... |
For fun, I made a function queue in JavaScript. I named it tinyq. You can add functions to it, and each function is passed the next function in the queue. You can also pass parameters to the functions, and they can return values.
function q(){
var Q = [], t = this;
this.length = 0;
this.add = function (f... |
I am working on an app for iPhone and iPod Touch that has to show complex mathematical equations like algebraic, integration, summation formulas along with some text.
For that I have used Quartz2D and below is what I have created. Can anyone please verify if this is the correct procedure to draw an equation?
I have to ... |
I am starting to write a plugin that is aiming to validate a piece of mark up against requirements of schema.org.
I was hoping if I could get some more tips on how to improve the structure of my code. Is this how you would go about this if you were to do it?
$.fn.hasAttr = function(name) {
return this.attr... |
I'm trying to improve the quality/efficiency of my coding (having only been learning jQuery for a couple of months).
I have a function which loops through all $('.loop-bar')'s and applies a jQueryUI slider to each. Each loop bar is a range slider which controls the portion of each song (playing via a custom player i ... |
This works well, but can anybody see any faults in this code? If so, could you suggest ways in which I can fix it?
CREATE PROC ValidateUser
(
@Email NVARCHAR(100),
@PasswordHash NVARCHAR(128)
)
AS
IF EXISTS ( SELECT 1
FROM dbo.[User]
WHERE [Email] = @Email
... |
I want to prevent double form submissions within a small window, then allow the form to be submitted again.
I wrote this script after looking at several examples, but the global variable is bugging me. I'd welcome any suggestions on improving it.
var aLockedForms= [];
jQuery.fn.preventDoubleSubmit= function() {
... |
Here is the code I wrote for the problem at http://www.interviewstreet.com/recruit/challenges/solve/view/4e1491425cf10/4efa210eb70ac where we need to to print the substring at a particular index from the lexicographicaly-sorted union of sets of substrings of the given set of strings...
import itertools
N = int(raw_inpu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.