All Questions

Filter by
Sorted by
Tagged with
1
vote
4answers
206 views

Proper way to execute parameterized commands within a method

This method allows for the execution of parameterized commands within a DAL class, and I tried to make it as reusable as possible. It works well but it feels a bit verbose to me. Is there a way to ...
4
votes
2answers
292 views

Python line condenser function

This is a function I just wrote that tries to condense a set of strings into grouped lines. It actually works, but looks ugly. Is there a better way to achieve the same thing? Take 4 filtering empty ...
3
votes
1answer
515 views

Classes for background layer and parallax effect

I have two classes DigBackground and DigParallaxBackgroundLayer (a parallax background is a image consisting of several images ...
1
vote
1answer
247 views

Java constructor should use setter?

I have a simple Java model Class called Person which have a constructor that receives a JSONObject. In that constructor I get the values from the JSONObject and put in my instance variables. This is ...
1
vote
2answers
1k views

Insert Selected item in listbox using Ado.net and stor proc

I create this class method to Enter Selected Items Form CheckboxList to associated resource I use ADO.net & store Proc to insert data can someone help me to improve it and make to so clean instead ...
1
vote
1answer
344 views

Instant messaging system

I'm now developing an instant messaging system but I'm a little confused: I can't decide which approach I have to choose! I want you to tell me what is good/bad with this programming approach. One ...
2
votes
1answer
4k views

Jvector Map add/remove function shorten code

I am achieving a hover state per continent through: ...
3
votes
2answers
103 views

.hover() for fading effect

Is there a better way to write the JS for this? I'm asking because I read from somewhere that using .hover isn't recommended. Also, if I move the mouse in and out ...
2
votes
2answers
5k views

What is the best way to get the child class name for use in a parent class

I am currently trying to implement a very simple MVC framework as a way of helping me understand how they work. My base controller class has 2 properties, a model and a view. All controllers have a ...
9
votes
2answers
14k views

Truncate port number from absolute Uri

We had a requirement to remove the port number from the Request.Url.AbsoluteUr i.e Actual: https://mysitename:443/Home/Index ...
1
vote
3answers
5k views

Perl script to rename files in a directory tree

I'm taking a scripting language course with no prior scripting language or Linux experience, though I've taken classes in VB, Java, and C++. Our first assignment is to write a script that will ...
13
votes
3answers
62k views

Set a default if key not in a dictionary, *or* value is None [closed]

Let's say I have a key 'messages' that is usually a list, but might be None, or might not be present. So these are all valid inputs: ...
1
vote
1answer
37k views

Simple chat room Swing GUI

I need somebody to review and polish my GUI code for my very very simple chat client. I haven't built any of the server sockets, so I'll do that later, but for now I just want people to tell me how ...
3
votes
1answer
252 views

Dynamic Treenode Creation

I am trying to create a treenode structure based on a database table for a Dungeons and Dragons character creation program I am working on. I have come up with an incredibly confusing way to do it, ...
1
vote
2answers
152 views

Movie search layout tweaks with cookie persistence

This works as intended, but was wondering if there is a more efficient way of coding this. ...
5
votes
1answer
531 views

Possibly mixing prototype and module pattern

I have either created something beautiful or something monstrous, and I'm not really sure which, and I don't know where else to turn but here. What I've done: ...
8
votes
1answer
669 views

Very fast query selector

A few months ago, I wrote a query selector that seems to outperform the query selectors in the popular GP libraries by a pretty hefty margin. I'm wondering if I overlooked something. It seems odd that ...
2
votes
0answers
86 views

Stream-chaining

My goal is to have a reusable pattern for doing concurrent stream-processing in Go. The stream has to be closable from any node. Errors should cleanly close the stream and forward the error to the ...
2
votes
1answer
282 views

DO.dom: Creating large DOM structures in Javascript

I have the library that I have found to be very useful when creating dynamic content rich web applications. I call it DO.js. It allows me to create entire DOM structures inside of Javascript in a ...
1
vote
2answers
1k views

jquery checking nested input with repetitive code

I have a table with 'nested' inputs that need to be checked or unchecked when a button 'select all' is pressed. There are several levels that can be toggled with their respective 'select all' button. ...
3
votes
1answer
211 views

Sierpinski gasket - patterns from primes

Below is the code I have written. I started yesterday with prime numbers and playing around with them. What the code does it determines the "prime gap" between primes numbers, prints them, then finds ...
3
votes
2answers
6k views

Sequential Execution: Orchestrator Pattern

I built a code piece that makes it easy to execute a set of sequential operations, that might depend on the same parameter value (passed across the execution) or might need a particular parameter. ...
3
votes
2answers
106 views

Exceptions for control flow

I just wrote the following javascript (jQeury loaded): ...
3
votes
3answers
5k views

REST-ish API Account Controller

I still have to implement API keys for client auth, but so far this is what I have for users. This was built using WebAPI and SimpleMembership with Forms Auth: Is Authenticated: ...
1
vote
1answer
87 views

JavaScript - Does this bookmarklet need some optimization?

I'm working on JavaScript bookmarklet that lets users send a text and link to a site. This is the bookmarklet: ...
1
vote
1answer
1k views

Displaying an accordion with a list of connections

This is used to display an accordion with a list of connections using JavaFX. Can you help me to optimize the code to make it much simpler? ...
1
vote
1answer
271 views

Assign value of nested array as array key

I have a multi dimensional array like this: ...
4
votes
2answers
4k views

Project Euler #15 — count possible lattice paths

I'm not a C programmer, just wanted to make a fast solution to the problem. Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 ...
2
votes
1answer
5k views

Is there a better way to make a function silent on need?

I got a piece of code I'm not pleased with; Does anyone would have a better idea? ...
3
votes
2answers
421 views

Wordpress php Contact Form - Security flaws

I have the following contact form included with my wordpress theme as a template. Now a user on Stackoverflow pointed out that this form has some serious security vulnerabilities. Could someone ...
3
votes
1answer
1k views

Scheme/Racket: idiomatic infix math evaluator

Inspired by xkcd and a couple of praising blog posts, I decided to try out Lisp. It seemed that the best-supported dialect was Racket, itself a variant of Scheme, so I went with that and wrote an ...
-2
votes
2answers
255 views

Structuring Events in JavaScript

Below is the basic shell of an application I am working on that is part of a Webhosting Control Panel. This part is for the DNS records management. So in my code below, I have taken away all the main ...
2
votes
1answer
1k views

Recursive Determinant

The following code I devised to compute a determinant: ...
6
votes
3answers
2k views

Subtraction accumulator

I'm currently following the tutorials over at RubyMonk, and one of the problems I need to solve is to write a subtract function that would meet these conditions: ...
7
votes
1answer
964 views

Fastest fill memory with specified 64-bit value

I need to fast fill a memory block in C#, so I wrote something like this (in Free Pascal Compiler + Lazarus in 64 bit mode): ...
3
votes
1answer
11k views

Accumulating inner exception messages

Say, there is a class with some methods, that have try catch blocks. I need to accumulate messages from all inner exceptions of generated exception and use ...
23
votes
2answers
2k views

Speed up solution to Project Euler problem 75

I wrote this code for Project Euler problem 75, which asks how many integers ≤ 1500000 exist, where the integer is a perimeter length that can be divided into three integer-length sides of a right ...
5
votes
3answers
4k views

Decimal/binary/hex converter

I've finally finished my converter and have determined that it works, but I'm trying to make it cleaner and/or more practical (primarily with the switch statements)....
11
votes
2answers
15k views

Display progress bar to show async request status using jQuery

Instead of using the ProgressBar plugin, this script displays the progress bar for async requests on the page. Could anyone provide any feedback on this, especially if there will be any issues like ...
4
votes
2answers
266 views

Another stack implementation (in C)

I just started learning C and the online book contained the exercise 'implement a stack'. So I did, but thought I'd put it here, because I still don't feel comfortable with pointers. So here it is: <...
4
votes
1answer
279 views

Is this class too over the top?

In response to my previous question, I've refactored my class quite a bit. I've truncated my class a bit, because I have several methods that are very similar, with the exception of the query for the ...
1
vote
2answers
1k views

A Generic NHibernate wrapper with transactionality

My team and I wrote the following Nhibernate wrapper which gives generic retrieval and save/update functions and a possibility to send a function as a paramater which may contain several save/update ...
2
votes
2answers
107 views

Showing or hiding groups of three text fields

...
1
vote
1answer
117 views

Refactoring Java transmitter delegate implementation

I have 3 classes: a transmitter, a view for displaying and a recording view for flushing the screen contents into a file. The view and the recording view classes register themselves from their ...
12
votes
1answer
6k views

Simple trie implementation in JavaScript

After experimenting with a sorted trie implementation in C, I felt that I understood tries pretty well, but was having trouble explaining how they work. Since the C code was based on existing code, I ...
4
votes
3answers
4k views

Design Strategy of CSV Parser

I wanted to review my design strategy for CSV parser. I have 4 CSV files, which have different layouts as shown below. Each row of a CSV file will be mapped to a class. For example, if ...
1
vote
1answer
99 views

I've finally found a satisfactory way to create classes on JavaScript. Are there any cons to it?

Depending on external OO libraries is really bad, using prototypes/new has some limitations, using only hashes has others. Dealing with classes was always a pain in JavaScript and it didn't help that ...
2
votes
1answer
653 views

Collision detection implementation

I'm working on a clone of Hunter Story. You shoot monsters with your bow. Recently I implemented collision detection, this is all working correctly, and I don't think the code needs any dramatic ...
3
votes
2answers
194 views

Design Pattern Question/Violating OCP

Is there a design pattern I can use for a situation like below. This is an example I made up to try and explain the situation I'm dealing with currently. I keep having to add new DeviceScript ...
2
votes
4answers
5k views

Concurrent queue with pthread implementation

I'm writing a multi-threaded queue implemented with pthreads. Since I came up with the code based on several tutorials from Internet, I would like to make sure there are no logic errors in my code: <...

15 30 50 per page