All Questions
0
votes
0answers
1 views
Can anyone optimize the code for parallel programming and efficiency using c#?
The parallel programming can be used in finding row total or column total.
namespace OneWayAnovaTable
{
public partial class OneWayAnovaTable : Form
{
public OneWayAnovaTable()
{
...
1
vote
0answers
9 views
I have a mathematical expression evaluator. The code works fine. Code reviews and suggestion to improve coding style are welcome
using ExpressionEvaluatorLibrary;
namespace ExpressionEvaluator
{
class Program
{
static void Main(string[] args)
{
ConsoleKeyInfo cki = new ConsoleKeyInfo();
...
2
votes
1answer
23 views
Is there any way to make my project Euler#14 solution faster?
I'm solving project euler problems and uploading my solutions to github.
Some of my solutions are just based on math and are thanks to that very fast, but #14 is way too slow, and I have no idea how ...
0
votes
2answers
16 views
Is there a better way of writing this code?
I have made a mini image gallery which consists of one large div which has a background image of one of the galleries images.
Underneath that there are five thumbnail images, that when clicked, ...
0
votes
0answers
6 views
Best way to do a Determinant of a Binary Matrix C++
I'm looking for the best way to do a determinant, for determinants until 15x15 and looking for speed
int Determinant(const vector<vector<int> > &a,int n)
{
int i,j,j1,j2;
int ...
-1
votes
0answers
7 views
Flash AS3 XML. full sample read/modify/write
can anyone provide a full sample of how to manage XML file via Flash AS3, which contains read/modify/write functionality
I searched a lot for such sample but I didn't find any.
Thanx
1
vote
0answers
14 views
Concurrent hash map for memoization
I'm developing a concurrent hash map for DP memoization. The assumptions behind its design are the following:
no erase operations are possible
once the value corresponding to a key is written, it is ...
0
votes
0answers
8 views
DRY cursors: preventing T-SQL's FETCH statement from being repeated
Please assume I've exhaustively tried to come up with a set-based solution to my T-SQL problem, and that I need to use a cursor. The following is the typical1 boilerplate for a T-SQL cursor:
...
2
votes
0answers
23 views
Dining philosophers problem
Now I know this dining philosophers problem is researched a lot and there are resources everywhere. But I wrote a simple code to solve this problem with C and then turned to Internet to see if its ...
1
vote
0answers
21 views
Very simple implementation of observer pattern in C++
I'm reading on design patterns for a software engineering class. I am doing small implementations of some I find the most interesting / applicable to better understand them.
I'd like a code review on ...
0
votes
0answers
34 views
C++ Commercial Grade Class or Not
I am working at getting both my design and implementation to be more sound. My question is if you saw this code in a code base would you disregard it, or would you say it is well written? The point ...
1
vote
1answer
25 views
DRY up Rails Navigation Code
In my Rails 4 app i used to have every view contain a content_for :nav tag which included all of the links for the nav bar in my layout. This was getting annoying because if i wanted to add a button i ...
1
vote
0answers
25 views
Review of 2d Vector class
I'll keep this short. I've never actually done professional C++. I don't really know any of the 'best practices'. I'd like to get some review on a simple class that I've made.
My Vector2d.h file:
...
0
votes
1answer
26 views
Is it necessary to move OpenFileDialog code for opening the files and put it into a separate method?
I want to separate the code inside my Add button click event from the code in order to make my code looks more arranged.
this is my code before these changes (i am using BackgroundWorker in order to ...
1
vote
1answer
22 views
Javascript objects listening to their own events
I have been playing with event driven javascript lately, and have wondered if it's a good/bad thing for objects listening for their own events as a way of abstracting and simplifying internal logic.
...
2
votes
3answers
48 views
Game Of Life 3 in Java
I have this version of John Conway's Game Of Life in Java:
Frame class:
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import ...
1
vote
0answers
22 views
Improve my SQL select statement
I have three tables for a blog system.
The blog
CREATE TABLE IF NOT EXISTS lm_blog(
blog_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
title VARCHAR(80) NOT NULL UNIQUE,
action ...
3
votes
1answer
74 views
How can I improve this C++ 'genetic algorithm' implementation?
now that I am almost done with my uni studies, I'm about to start jobhunting (aiming mostly for a Gameplay Programmer), and so I've created a code sample that I will link with my applications.
...
2
votes
0answers
21 views
Rigidness and verbose nature of XML parsing
I've been developing a simple console application in C++ using the TinyXML2 library, and I honestly can't help but feel what I'm doing is not very robust. Maybe that's just the nature of parsing XML ...
0
votes
0answers
19 views
Need help optimizing this jQuery code
Below is a slider code that if used for more than one slider in the same page will not save each slide position. I need to have 8 sliders like this in the same page, so I repeat it 8 times. Would be ...
0
votes
0answers
26 views
Calculate work progress in percentage of batches that contain tasks and task contain sub tasks
I was being referred to here from stackoverflow.
I am trying to calculate work progress in percentage. I have multiple batches, and each batch contains a set of tasks and each task also contains a ...
1
vote
0answers
17 views
Collision System in Pong-like game - How good is this code? (Blitzmax)
I am writing a game like Pong. Therefor I am using an entity system approach, so I use component based design.
The hardest part until now was to write the collision system. As I just began with the ...
2
votes
2answers
43 views
More Elegant Solution to Logging Class
I got this class in C# which works fine. But I was wondering if there was a more elegant solution to what I am trying to do. It looks rather clumsy and inefficient for a Logging functionality.
The ...
1
vote
1answer
13 views
Sleepsort in Go
I implemented sleepsort in Go. I am new to channels, and I'd like to get some advice on them, especially on how to close channels after N messages have been sent on them. Currently I use a counter and ...
1
vote
1answer
17 views
Asp.net MVC4, Lamba Sorting
I have the List method that takes sorting parameter to sort result. and the sorting parameter value is same to column name. And this is my code,
public ActionResult List(string sorting = "Name", ...
0
votes
0answers
17 views
MySQL vs PDO execution time
I'm having some issues understanding why PDO is 6X slower executing a query than the depreciated MySQL query function. Here's my code:
$conn = new PDO('mysql:host=localhost;dbname=work', 'root', ...
2
votes
2answers
75 views
Looking for a better solution to my OO code
I would like if this could be kept to a post providing concrete examples of how I could solve my problem better, and not about which one would be "best" as such :) I would simply love some insight to ...
0
votes
1answer
19 views
Need to clean up my code and add the ability to resize the image
I have the following code:
<?php
include '../../inc/config.php';
$size = isset($_REQUEST['size']) ? $_REQUEST['size'] : 'full';
$image = isset($_REQUEST['image']) ? $_REQUEST['image'] : FALSE;
...
0
votes
0answers
11 views
Type conversion from FORTRAN to C#
I have in F2008
module mod_Blood
use mod_liquid
implicit none
type, public :: typ_BloodComponents
character(len=5) :: name
real(DP):: salt
real(DP):: RBC
end type typ_BloodComponents
...
2
votes
2answers
69 views
Ruby multiples of 3 and 5 code challenge
I have implemented the first coding challenge on http://projecteuler.net/. I would love to get it reviewed by some expert rubyists! Thanks in advance :)
# Multiples of 3 and 5
#
# If we list all of ...
2
votes
2answers
53 views
Extension methods for class Type
While working on one of my projects I actively used Reflection. While working with class Type I expected methods: TryGetMember, TryGetProperty, TryGetField, TryGetMethod. I've implemented them as ...
4
votes
2answers
62 views
Is the following code well written?
The following program is supposed to return the length of a 'hidden' string within each of the sentences of another string, using pointers and avoiding as much as possible the use of [] as a means to ...
0
votes
1answer
42 views
Class design question
i have Winform application and i want to separate the button click event from the main form.
my application has Add button who add files into my Listbox and until now all my code was inside this ...
2
votes
1answer
21 views
tree heap Haskell code
I'd like a review of Haskell tree heap code in Turning a tree into a heap in Haskell.
module Heapify where
data Tree a = Leaf a | Node (Tree a) a (Tree a)
deriving Show
ourTree = Node (Node ...
0
votes
1answer
16 views
Showing jQuery UI tooltip on focus of text box
Firstly, here's a link to the fiddle.
Basically my situation is that there is a requirement to show tooltips on textboxes on some forms being created for a website to allow employees to update their ...
3
votes
1answer
72 views
C++ Linked List: Would This Code be Considered Clean If written in an Hour Long Interview
If you were interviewing me, and saw this code written in a little under an hour would you consider me as a candidate for a position at your company if you knew I had 2 years of C++ experience.
...
2
votes
1answer
35 views
Better code for converting a char to its UTF-8 percent encoding representation?
This is working code for a URI template (RFC 6570) implementation; when the character to render is not within a specific character set, it is needed to grab the UTF-8 representation of that character ...
1
vote
1answer
35 views
SQL Query efficiency within class
I'm trying to figure out whether I should do the following:
This class (over-simplified version) retrieves information about an order by having 1 main query function that select a specific column ...
3
votes
1answer
29 views
PID Controller library
I'm trying to implement a PID without floating point operations on a micro controller. I appreciate all feedback I can get.
Header file:
#ifndef BRUSHPID_H
#define BRUSHPID_H
#if defined(ARDUINO) ...
0
votes
0answers
22 views
Read BER-encoded data in C#?
I've asked this in StackOverflow and got a nice advice by Chris Latta on asking here because, well, someone called Lex Li closed my question: ...
-1
votes
0answers
23 views
How is it called when what goes first in &&-condition(java) matters a lot? [closed]
I have discovered that if accessing some index from array/string happens first in IF clause, it can crash (out of bounds exception)
However, if i check index first and then try to access it, if index ...
1
vote
0answers
20 views
Is this a correct recursive Scala iterator creation?
I am diving into scala (using 2.10) headfirst and am trying out a simple task of taking bulk data and then doing something with that stream. The first part is generating that stream. I have seem to be ...
1
vote
1answer
46 views
Anyone have some ideas about my code?
I have this class that pulls people out of a database. I want it to be a little prettier and function better. Anone got ideas? Feel free to ask questions :)
<?php
class comps extends db_config {
...
1
vote
0answers
61 views
What is this structure called?
So I've been writing this data structure for a few days, and now I'm really curious about what it actually is, and to get some critique on my logic.
A branch, based on this usage, exists when a HEAD ...
2
votes
1answer
79 views
Trying to get better at Ruby and programming in general- here's a simple TopCoder question in Ruby
I want to get general feedback and feedback about if I can make this more Ruby-like, if there are any obvious inefficiencies, and if I need to organize my class differently. The topcoder question is ...
-1
votes
0answers
6 views
my colour change through keyboard and mouse is not working properly.how to retain the colour even after i release the pressed key? [closed]
#include <stdio.h>
#include <stdlib.h>
#include <glut.h>
float _angle = 30.0f,xt=1.0f;
float zt = 1.0f;
float _cameraAngle = 0.0f, _angle1=30.0f;
//char key;
//int flag=2;
//float ...
0
votes
1answer
37 views
How to make this function reusable instead of repeating it? [closed]
I'm using JavaScript and JQuery 1.8.3 to rebuild a form built by Django-filter. My purpose is to only present options that will yield a result to the user. The Django stuff all works fine and this is ...
0
votes
0answers
9 views
Multi threaded API calls problem
I have this API to control some hardware. The API is not very well documented, but I've been able to make do with what I have. It is a API for a RFID device, but also has LED's on it that are ...
-2
votes
0answers
21 views
Jquery File Upload (blueimp/jQuery-File-Upload) - ASP.NET MVC - How to Cancel Upload Async [closed]
created this in my github repository where I have the code of JqueryFileUploadblueimp implemented with ASP.NET MVC. Need some help about it, because I would like to know how can I cancel an UPLOAD ...
-1
votes
0answers
19 views
Why does my third column line-break? [closed]
How do I make the three columns I have on different lines parallel to each other?
jsFiddle:
http://jsfiddle.net/JordanSimps/n79LY/2/
HTML:
<div id="middle_container">
<div ...