All Questions

Filter by
Sorted by
Tagged with
8
votes
1answer
2k views

Loop through JSON and create prefab in Unity3D

I am creating an app in Unity3D and it is my first time coding in C#. I use the following code to parse a JSON file hosted on my server and use the information to render prefabs within my scene: <...
3
votes
2answers
402 views

PHP Weather class

I am kind of new to object orientation in PHP and I need some experts feedback. This class fetches the weather from this URL. It grabs the weather, temperature and an icon from the current hour. Is ...
5
votes
1answer
484 views

Did I convert this C++ class to Common Lisp correctly?

Here is the original C++ class I converted to Lisp at the very bottom of this post. ...
1
vote
1answer
335 views

Converting a list to an array when list has quotes and embedded comma

This function converts a list to an array when list has quotes and embedded comma: ...
6
votes
1answer
676 views

A parametrized Config singleton

Here is an attempt to code a specific kind of Singleton - the one geared for our configuration needs. It needs to be initialized with a configuration location, do not allow copies or other instances, ...
8
votes
1answer
3k views

Stock list view

I feel like using this many partial views where a view renders a partial that renders a partial is just digging a hole of poor design, so I'm looking for any suggestions or guidance as to if this is ...
7
votes
1answer
314 views

CppUnit test suite for testing a routine

I wrote a CppUnit test suite to unit-test the code that I posted here which is a single routine that proposes how a Lua expression could be auto-completed. What do you think? I appreciate all the ...
6
votes
1answer
2k views

Slide out CSS menu

I've developed a simple CSS transition solution for a slide out menu with a single toggle, and would love some feedback on if anything could be simplified or improved. Markup ...
9
votes
3answers
18k views

Model cars as classes

I am learning about object oriented programming in Python using classes. I have attached an image of what I had in mind when structuring my classes. This is supposed script model cars. I want to know ...
3
votes
1answer
1k views

Pig Latin Translator in Ruby and Rspec

PigLatin Kata ...
7
votes
1answer
704 views

99 Haskell problems, problem 9: Pack function

Today I started to tackle the 99 Haskell problems (http://www.haskell.org/haskellwiki/99_questions). I had to struggle with problem 9 which requires to Pack consecutive duplicates of list elements ...
9
votes
2answers
5k views

Macro that interchanges 2 arguments

Define a macro swap(t, x, y) that interchanges two arguments of type t.(Block structure will help.) The ideea is that a ...
8
votes
2answers
549 views

Simplifying conditional statements for transaction code

I have below code in one function: ...
6
votes
2answers
570 views

Rolling Average class sanity check

I just want to make sure that my Rolling (Moving) Average class is understandable and reasonably thread safe. My main questions are: Is having totalCounts as a long just for a potential edge case ...
8
votes
3answers
21k views

Correctness of calculations with struct timespec

I've noticed some discrepancies in timings in our system, and I'm trying to narrow down what could be causing them. I'm reviewing out time abstraction, and as far as I can determine it's fine. Am I ...
7
votes
1answer
111 views

Pass in parameters instead of multiple functions

I can't quite figure out the best way to approach this. I have two jQuery objects that both are used to set cookies. I then parse the JSON and set a cookie that is either the users height or the users ...
1
vote
1answer
36 views

A package for the DOM - Events

Please provide feedback on the correctness of this code. It should handle older versions of IE but how far back it goes I have not determined yet. ...
0
votes
1answer
37 views

A package for the DOM - Ajax

Provides 3 types of normal ajax - get, post, and post for form data. Also provides serialized ajax (get style) using a queue. Please review the correctness of this code. ...
82
votes
11answers
12k views

Nesting versus GOTO: which is better to avoid?

In Java they're not really known as GOTO statements and are rather referred to as Branching Statements, but I find that the former term is a bit more indicative of ...
6
votes
1answer
3k views

Avoiding RequireJS circular dependencies

My app module bootstraps a Backbone.js application. I need app to be available in every other view for easy access to router, ...
11
votes
1answer
548 views

node.js Passport Wrapper 2

First attempt was done here: My second attempt (now using jslint to make sure the spacing is correct and have incorporate the majority of the feedback from previous attempt). ...
-5
votes
1answer
788 views

Stored procedure [closed]

I have this stored procedure that I'd like improved. I have changed the DB name and the procedure name. I am working on SQL Server 2000. ...
12
votes
1answer
24k views

Making lines with SVG and JavaScript

I just started trying out SVG the other day. Eventually I hope to be able to know how to do what SE does with their reputation graphs. For now, I've just been trying to set up an easier way to make ...
5
votes
1answer
269 views

Markup of a blog page and its posts

Currently building my personal site using Jekyll, inuitcss and GitHub Pages. I'd like to hear your thoughts on the markup of my blog page and its post pages. What do you think about handling logo's ...
3
votes
2answers
223 views

Array manipulation exercise

While trying to learn more about arrays in C, I tried to write some code that did the following: Read a stream of numbers from the stdin and store them in an array ...
5
votes
3answers
2k views

Rational arithmetic calculator

My program is a fraction calculator that is supposed to calculate the basic operations (+, -, *, /) and is supposed to exit when I enter % as my sentinel value. This is what I have so far; any ...
6
votes
2answers
12k views

Java GUI code with Swing Timer

I have the following questions for the below code: Is there a simpler implementation of an on-screen counter? I made CountTimer inner class since it's tightly ...
2
votes
1answer
2k views

DbGeography calculation

Given the following piece of code, can it be done better: ...
2
votes
1answer
1k views

Implementing Option#map2

Working on an example from Functional Programming in Scala, I'm working on Option#map2: ...
3
votes
1answer
468 views

Writing Traverse Instance for Option

Working on an exercise from Functional Programming in Scala, I implemented a Traverse instance for Option: ...
1
vote
1answer
4k views

Determine if a std::string has all of the same character

I'm working on an algorithm to determine if a std::string has all of the same character. Here is what I have: ...
7
votes
6answers
58k views

Trim white space from string

This function is intended to remove leading and trailing whitespace from a string. How can it be made more efficient? For example, can the two for loops be ...
8
votes
1answer
2k views

Organizing and visually duplicating images

This algorithm is supposed to organize and visually duplicate images. I compare 2 images at a time; 1 is the first index image of the directory and another for comparing every other image in the ...
6
votes
1answer
1k views

Review on a PHP login/authentication system

I am currently working on a small website for my scuba diving club, and it needs a "simple" login system to allow members-only features etc. I've been using the php-login-minimal as the base for the ...
8
votes
1answer
609 views

VLC media player watchdog daemon

I'm looking for bugs, ways to make it more portable or standardized, improvements of any kind. Seems to do what it is supposed to on my Ubuntu 12.04 PC. ...
6
votes
2answers
1k views

Type safe program uniform manipulation in OpenGL

I've made an attempt at writing class wrappers around basic OpenGL objects to make managing them easier and more intuitive. Writing a generic one for program uniforms proved to require a little bit ...
14
votes
2answers
36k views

Using a BaseController in MVC asp.net to reuse the repository

I have a repository class that impliments a repository Interface. In my Controllers I want a way to access the repository without creating constructors each time in the controller. So now all my ...
29
votes
3answers
2k views

Java method - levels of abstraction

In his Clean Code book, Robert C. Martin states that functions should do only one thing and one should not mix different levels of abstraction. So I started wondering whether the code below meets ...
6
votes
1answer
250 views

Structuring functions receiving and returning promises?

I keep running into the same pattern with code using promises in javascript. When writing a function which takes a promise and returns a promise, obviously I want to reject the promise I'm returning ...
8
votes
1answer
153 views

Number format in JavaScript

What's the best way to format a number? If decimal is less than 2 digits, add zero to make it 2 decimals If more than ...
6
votes
1answer
169 views

Allow changing the properties of a mutable controller in a thread safe way

I have a (control engineering) controller. These controllers usually need several parameters to do their thing, and in my application it is desirable that these parameters can be changed while the ...
5
votes
2answers
481 views

Synchronization with remote web service

I am writing a method to synchronize the local Core Data entities with a remote web service (in this case, Parse.com). To update changed or created objects, I fetch all where the ...
8
votes
2answers
5k views

Git command: push the latest commit and email the diff in colour

This is my first attempt a for git command I can use to push the latest commit and email the diff. Story behind how it came up: http://goo.gl/3NEHvn Revision 1 (Scroll down for 2nd Revision) ...
14
votes
2answers
27k views

Flatten an array - loop or reduce?

Problem: Concat all sub-arrays of a given array. Example input: [[0, 1], [2, 3], [4, 5]] Example output: [0, 1, 2, 3, 4, 5] ...
5
votes
1answer
12k views

Basic TCP server application in C# using async / await [closed]

I'm trying to get started with network and parallel programming in C#. I'm almost a complete novice in programming, so I'm looking for feedback on a small script I'm writing. The goal of the ...
3
votes
1answer
920 views

Making a call to a server running a RESTful service

I am working on a project in which I am making a call to one of my servers using RestTemplate which is running a RESTful service and getting the response back from ...
3
votes
1answer
687 views

Synchronous and asynchronous client methods

I am working on a project in which I need to have synchronous and asynchronous methods of my Java client. Some customer will call synchronously and some customer will call asynchronously, depending on ...
5
votes
2answers
1k views

PHP Authentication Security

Can someone look over this? This is the entire authentication file. It's referenced at the beginning of all my catalog editing files to make sure only the specified user is logged in. I want to ...
6
votes
1answer
374 views

Rich Text on multiple iFrames

Having so many loops running concurrently obviously can't be good, and the code seems overly complicated. There has to be a simpler, more efficient way to Turn the designMode of all iFrames on Find ...
8
votes
2answers
2k views

Using keywords async/await in database queries (Windows Phone 8)

I have a local database in Windows Phone 8 app. The app includes a lot of queries to the database and I don't want bad effect on the responsiveness of UI. For ...

15 30 50 per page