0
votes
0answers
13 views

How can I make this program a bit more efficient?

So I'm trying to solve a SPOJ problem, which code is SAMER08A and this is the link: http://www.spoj.com/problems/SAMER08A/ The problem, is that when I ran my code in my IDE, the code works perfect ...
1
vote
0answers
8 views

Autoloader class

Depending on your directory structure you may have name spaced class files in different directories (that isn't really part of the structure, i.e. lib/ or core/). Symfony ClassLoader is awesome, but ...
0
votes
0answers
8 views

Quick Insert Merge Sort

I have written a code for sorting a list of numbers in increasing order. It is a combination of quick sort, insertion sort and merge sort. I take the first element of the list as Pivot. Then I go ...
0
votes
0answers
9 views

A c++ PEG parser generator

Last Weekend I wrote a c++ PEG packrat parser generator and would love to get some feedback on the code and/or syntax. I currently use the << operator for defining grammar expressions and ...
0
votes
0answers
14 views

How to improve Collision Detection in Bricks in BreakOut Game

I've done my first BreakOut Game while completing an assignment for Stanford University CS Online Course for java. However I noticed during play testing that when the ball sometimes hits a brick ...
1
vote
0answers
11 views

Bash script to manage multiple Java Development Kits installations

I'm writing a bash script to manage multiple JDKs, the script is very simple, you have to choose a directory when you store all the jdk's, and the script maintain a symlink to the current jdk'. ...
0
votes
1answer
18 views

How can I improve my code which dynamically populates a section of a page?

My site consists of a lot of asynchronous calls, and because of this a lot of content is dynamically added to the page. For this section of code I've dynamically added tabs to a page and need to ...
1
vote
0answers
20 views

Is this PHP Email Form Secure from injections or other abuses?

I am new to PHP and put this contact page together using the w3Schools.com example as a guide along with a couple other sources. As far as I can tell, it works fine, but before I put it up on my page ...
0
votes
0answers
11 views

String Matching

I recently came across a lecture on DFA. I tried to use it to determine whether a given 'search string' is found in the 'input string'. Please tell me if there is a better way (display "Enter input ...
2
votes
1answer
29 views

framework design review (SOLID)

I'm developing a php framework for educational purposes, I have learned a big deal about design patterns and MVC. I've been thinking a lot on how to have a nice design and so far I've come up with ...
1
vote
0answers
15 views

Python: How do I optimize the solving of ODEs?

I have been trying to figure out a way to optimize the solving of ODEs in Python but haven't been able to achieve this goal. I tried getting help via a bounty on SO using cython but nothing came of ...
0
votes
0answers
19 views

New library for declaring units on numerical model attributes

A couple of days ago as I was working on a project I stumbled something I consider a problem and that, as far I know, doesn't have any good solution available in Rails. The problem is attribute ...
1
vote
0answers
12 views

Creating an expanding CCSprite cluster

I am creating an "explosion" of circle sprites from the character with this code, and I was wondering if there is a more effective way to do such things, because this just seems too stupid. (This is ...
0
votes
1answer
24 views

Is this code thread safe?

I do a code review for ASP.NET MVC RESTful service application code. Controller looks something like public class BarController : ApiController { [HttpPost] public void DoBar(byte[] rawData) ...
-1
votes
0answers
32 views

Can this code be minified even more?

I have an insane idea of minimizing this code. It searches though table for a entered string, and if found, adds number from another column and returns total number for coincidences. row #5 has ...
2
votes
1answer
29 views

A Better Way of Employing a Using Alias Directive

I understand .NET very well until Principals of OOP come into view, so I guess we can say very little. So to work on this, I am making a Console App that will Catalog my Digital Media to a MySQL ...
0
votes
0answers
18 views

Boiler.js - A new JavaScript utility library. Room for improvement?

Boiler.js @ GitHub Boiler.js Homepage I wrote Boiler.js from the ground up for a few reasons: Underscore.js and other similar libraries do not have enough methods for working with object-literals ...
2
votes
1answer
39 views

How bad is it Doc? (Vanilla Javascript)

2 months ago, I wrote a chrome extension called hotfix. I recently went back to look over the code and it made me cringe a bit. I refactored it a little, but before I get knee deep in it, I would like ...
1
vote
0answers
12 views

Dynamic Controller Creation in Rails

I have overrode Rails' ActionDispatch::Routing::RouteSet::Dispatcher.controller_reference method to check if a controller exists by checking for the required constants and then creating them based ...
1
vote
1answer
47 views

Should I use anonymous functions in my javascript program?

This question is about the best way to declare functions in Javascript. the app is a small 2 player board game I'm working on as part of a bigger web page. Basically I have a socket which receives and ...
3
votes
1answer
30 views

C++: Generating similar methods with macros

I am currently working on a project that involves Lua. For convenience, I created a wrapper class for the Lua state structure. However, I also added some methods for getting globals and table fields. ...
-1
votes
0answers
14 views

Razor Jquery Error [closed]

<script> @if (ViewBag.checkedArtikel != null) { foreach (int ac in ViewBag.checkedArtikel) { String temp = "'#addartikel" + ac + "'"; <text> ...
0
votes
0answers
30 views

JavaScript regular expression literal as string literal

Please refer to this question for more discussion. JavaScript string literal sometimes to many escaping slashes. The following address this problem by converting a regular expression literal into a ...
-1
votes
0answers
18 views

Matlab Combinatorics [closed]

Im new in matlab, i hope someone can help me with my problem. I need to make a code to solve this Cobinatoric example. which says that i have vector A which has 10 values 2 of them are 1 and the rest ...
2
votes
0answers
31 views

JQuery code repetition and MVC

A while ago I started working on a project, which does things mostly with JQuery and PHP. I had some problems with my structure and started using CodeIgniter which uses an MVC pattern. So the PHP part ...
6
votes
3answers
97 views

Saving a contact and dealing with exceptions

try{save.Username = usernamedetails.Rows[0].ItemArray[0].ToString(); } catch{ save.Username = ""; } try { save.Firstname = dtdetails.Rows[0].ItemArray[1].ToString(); } catch { save.Firstname = ""; } ...
1
vote
1answer
35 views

Drawing game objects using their Z-order property

I am creating a game, with Ruby scripting. Sprite and Label objects can be drawn on the screen. Depending on the order you draw them, one will overlap the other. To make things easier, I want to ...
2
votes
1answer
62 views

Prime Numbers Store

Problem definition: Lets say we need to create a store for selling prime numbers. Users enter the store and ask to buy a number. If the number asked is a prime number, 1.1. then it's either ...
2
votes
1answer
50 views

cleaner way to import “izip” for different versions of python

A common idiom that I use for python2-python3 compatibility is: try: from itertools import izip except ImportError: #python3.x izip = zip however, a comment on one of my stackoverflow ...
0
votes
0answers
30 views

How to implement MVC on the application scale?

I'm developing a simple conferencing app with a Swing standalone client which connects to enterprise java beans. Users can create "sessions" (conferences) on the server, and then can join those ...
1
vote
2answers
24 views

Minimizing CSS media queries for the page title?

I am working on page titles to be responsive. The code I have works and gets the job done, but I know that this is verbose. I decided upon the widths by trial and error based on how the words were ...
3
votes
2answers
57 views

Potential Problems with this templating technique

I like the way Zend Framework works it's views and I make extensive use of partials but every partial include results in it's own file system hit. As I'm building my own framework I thought I could do ...
1
vote
0answers
18 views

Proper way to cancel WebClient in BackgroundWorker

I have a WPF application that needs to get a XML document using a web request. The request is based on an id that the user enters. If the user enters a second id, before the first returns, I would ...
0
votes
2answers
64 views

Singleton interface in Java

I've created a singleton by means of an interface. I don't want to make a thing with getInstance() etc because I don't care about inheritance, and it's redundant and non-declarative. Are there ...
3
votes
1answer
38 views

Dynamic homepage with PHP - making things too complicated?

I am trying to show the 6 most popular products on my homepage from left to right, in two rows. My code actually works... but I have the feeling I am making things way too complicated. Is there a ...
0
votes
1answer
25 views

Is there a better way to read json in node

I have this view that populates an unordered list from values in a json file. I am doing this in node. So is there a better way to do this, or a mode 'node-like' way? Can I load the json file without ...
0
votes
0answers
23 views

Better Design Pattern For Terminal-Like GUI

I am working on a java swing project that looks like a Terminal (but with less functionality). The GUI contains a jTextArea to display output and a jTextField for user input. Here is an application ...
0
votes
0answers
29 views

Name of this algorithm (Create binary image) [migrated]

Some days ago I saw in this site the algorithm below to convert color images to binary images and I used it in my application (with some small changes). However, I need to know what is the name of the ...
-1
votes
0answers
26 views

Checklist for coding MVVM web application [closed]

We are a small team working on a web application using MVVM design pattern using technologies like .NET, Knockout and HTML. I am trying to come up with a code review process and as a first step trying ...
0
votes
0answers
75 views

Would appreciate feedback on college project

would appreciate some feedback regarding best practices on the following code which is a college project. What should go in the controller and what in the views? How to attach and remove the views to ...
1
vote
0answers
23 views

Ruby Branch and Bound Algorithm implementation?

I am relatively new to Ruby and am trying to get a handle on making my code more Ruby-esque. At the same time I am experimenting with the branch and bound algorithm to solve a problem that I outline ...
1
vote
1answer
31 views

my first jquery/json

This is my first use of jquery and json so would be grateful for any feedback please. Background - this is on a job listing site and it has a Linkedin apply button plugin - this provides for a ...
0
votes
1answer
55 views

Review my first attempt at a jQuery plugin

So this is my first attempt at creating a jQuery plugin. InstaSlider is a lightweight jQuery image slider / carousel plugin that populates content from an Instagram hashtag. After searching for a ...
1
vote
1answer
19 views

XmlNodeList to ListItemCollection, a matter of elegance

at this moment I'm reading an XmlNodeList into a ListItemCollection one node at a time using a foreach. foreach (XmlNode node in authCompXml.SelectNodes("//Code")) { CompaniesList.Items.Add(new ...
0
votes
1answer
45 views

Basic java database source code review

I just wrote my first java database program for the purpose of getting feedback on the implementation and coding. It has 1 table and 2 buttons and prompts the user to select a folder, lists the ...
10
votes
8answers
597 views

Is there a shorter/cleaner way of writing this set of jquery .onclick functions?

I am hiding and fading in different content on the same page using jquery to hide() and fadeIn() the content depending on which link is clicked. It works how I want it to, but the way I've written ...
1
vote
2answers
39 views

Time limit of a c program while calculating factorial of numbers in c

I am solving a problem on calculation of factorial and the challenge is as follows! You are asked to calculate factorials of some small positive integers. Input An integer t, 1<=t<=100, ...
3
votes
2answers
40 views

Default value or conditional?

Which of the following two is preferred: var somevar = valueA; if(condition) { somevar = valueB; } or: var somevar; if(condition) { somevar = valueB; } else { somevar = valueA; } ? ...
1
vote
1answer
19 views

Defining models in GAE

I'm learning to work in GAE. I'm so used to SQL, but transform my way of think the last 20 years to NoSQL is a little hard for me. I have the next simple structure: BOOKS than can have CHAPTERS ...
5
votes
1answer
57 views

Simple “nullable” template class. Are there weaknesses in the implementation?

The goal is to have fields in a class which are optional and can be determined if they are set in order to be able to leave them out of serialization. template<typename T> class Nullable { ...

15 30 50 per page
1 2 3 4 5 157