2
votes
0answers
17 views

JQuery is working but clunky/slow

I'm coming close to finishing a site where there are a number of jQuery functions going on. They all work, but the page is just running a bit too clunky. The fading in and out is just not as smooth as ...
0
votes
0answers
14 views

highlightNavigation plugin, review request

I have written my first jQuery plugin using one of the design patterns suggested on jQuery's site: http://docs.jquery.com/Plugins/Authoring. As listed below in the description comment, it's purpose ...
2
votes
1answer
32 views

JavaScript object to JSON

Since I didn't find a way to properly transform JavaScript object to JSON with PHP, I wrote a snippet. Lets assume the following excerpt from Google Fonts JavaScript API: WebFontConfig = { ...
3
votes
2answers
57 views

Which of these two java class designs is better and why?

Example 1: public interface Adder { public int getSum(); } public class AdderImpl implements Adder { private int v1; private int v2; public AdderImpl(final int v1, final int v2) { ...
0
votes
1answer
25 views

A pattern to destructively extract items from an array

I want to efficiently (few intermediate objects) and neatly (few lines and easy to read) filter an array, removing and returning rejected items. So like a call to delete_if except instead of returning ...
4
votes
2answers
52 views

Using ref for value types - Is this the right usage or is it weird at multiple levels

I chanced upon this code written by the Solution Architect for a MS CRM project and I am lost for words. Am I going crazy or is this code OK? string returnedOptionSetStringValue=string.Empty; int ...
0
votes
0answers
40 views

re-arrange letters to produce a palindrome [closed]

I wrote this simple function (in Java) to re-arrange letters in a given String to produce a palindrome, or if it is not possible, just prints -1 and returns. For some reason, I can't figure out why ...
0
votes
1answer
26 views

Roll your own widget factory

So for practice with Javascript, I wrote this lightweight widget factory which is similar in functionality (okay, that's a bit of a stretch) to jQuery's UI Widget factory. I was hoping I could get ...
0
votes
0answers
29 views

Using getters / setters in android

I want to find out if my coding structure was less efficient and much slower due to using getters and setters. I have a few situations where I used them like follows if(MyClass.getPicCount() >= ...
1
vote
0answers
20 views

Design issue with decoder class

I'm designing a C++ Decoder class for decoding a format, and would like some feedback on my design choice: I want the user to be able to provide input to the decoder by either supplying an array, a ...
0
votes
2answers
26 views

Re-factoring amateur ruby code

I am new to ruby and I would be grateful if I need help with re-factoring my code. class Beam def initialize puts "Please specify span of beam" @span = gets.chomp.to_f puts "How many ...
1
vote
0answers
36 views

How to create a simple stateless cache class in PHP

i need to create a cache class to avoid making the same calculations more than needed. My idea was something really basic like class transient_cache { static private $cache = array(); static ...
3
votes
3answers
42 views

GetCommonBaseClass: Readabiliy and Functionality

I have two pieces of they which do almost the same thing. They both return the most common base class of two types. They differ in two aspect: If one of the arguments is null, code A returns null ...
1
vote
1answer
35 views

It there a pattern used to process a same function but assign the result to a different variable regarding to a different condition?

Say I have a code snippet like this if(string.Compare(isStandardFlag,"STANDARD",true)==0) { hearingID = centreSession.standardID; centreSession.standardOutcomeID ...
2
votes
0answers
34 views

Have I missed some obvious XSS vulnerabilities?

As the question states: have I missed some obvious security vulnerabilities in this code? Particularly interested in XSS... I'm trying to create something more robust that strip_tags, but simpler ...

15 30 50 per page
1 2 3 4 5 508