All Questions

Filter by
Sorted by
Tagged with
3
votes
1answer
292 views

Jquery sortable style function

This is a basic sorting function written in jQuery that moves items in the DOM around to create empty spaces for a droppable(). Since there is so much going on in a droppable over event, i'd love some ...
2
votes
2answers
3k views

Parsing XML with double nested tags using mindom

I want to retrieve id and name per skill. It works but is it well done? I would like to stay with minidom but all advices will be appreciated. ...
2
votes
1answer
370 views

Simplify bit flags checking code

Please help make this code more cleaner. It's a part of window procedure that notifies my renderer before client area of window resized. I need to check two combinations of bit blags: some of them ...
6
votes
2answers
4k views

Designing a simple Battleship game in Python

I am trying to code Battleship. It should be a text one-player game against computer where computer and human player take turns in shooting at opponent's ships. I decided to start implementation with ...
1
vote
2answers
250 views

Submitting the current webpage to a bookmarking site

I would like to hear your feedback on the link below that lets users add a link to a website. I read that javascript:void(0) is suggested instead of a ...
1
vote
2answers
2k views

Range of all variables in List in Prolog

I have a list in Prolog like this: Puzzle = [ A1, A2, A3, B1, B2, B3, C1, C2, C3 ]. And I want every variable in the list to be a number ...
2
votes
2answers
632 views

Update HTML4 to new HTML5 Semantic/Structural Elements

I'm trying to update my website's code to HTML5's semantic and structural elements, but I'm not very sure with the sections and ...
1
vote
1answer
214 views

JQuery code to toggle an edit form

I usually find the .js files to be quite messy and the truth is that mine are even worse than the average as, being soft, I'm not the sharpest tool neither at jQuery nor JavaScript. I would really ...
5
votes
3answers
3k views

Calculating all prime palindromes from 0 to 1000 and printing the largest

I have often read about how important clear and efficient code is. Also often people talk and write about 'beautiful' code. Some hints and critic from experienced developers for the following code ...
1
vote
2answers
894 views

Encapsulating logging and throwing exceptions into a method. Bad practice?

original code example ...
1
vote
1answer
99 views

Sending messages for processing

I have a class which is responsible for waiting until a message is added to a message list and then sending it off to get processed. withdrawMessages waits for a ...
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
671 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 ...

15 30 50 per page