# All Questions

75,846 questions
Filter by
Sorted by
Tagged with
202 views

### Return Data and Update Row without Multiple Lookups?

I have a stored procedure that looks up an article based on the article's title. But I also need to increment a column in the same table that counts the number of times the article has been viewed. ...
11k views

### Directory write permissions check

Consider the following method that I have for checking write permissions on a directory path: ...
• 343
4k views

### Animating the color of a line in WPF

I'm thinking about how to do a color transition for a line in WPF. I'm looking for this to be as simple and succinct as possible, and also the "correct" way in the WPF world. This is what I have, ...
706 views

### Skin/theme swap

Theme-swap functionality will be done via a better-looking <div> at the top of the page, but for right now, it's just thrown on the button. The theme ...
• 333
553 views

### MySQLi_Recordset: blending SPL and Statement/Query results

I've made a SPL-based class named "Recordset" that wraps both MySQLi_STMT and MySQLi_Result objects and allows treating either as a 3-dimensional array. It requires PHP5.3+. I'm pretty bummed about ...
2k views

### Pattern Against Anemic Domain Model

I would like to solicit advice on everyone's thoughts on how best to combat the Anemic Domain Model anti-pattern when building out a system based on web services. One of our goals is to build a set ...
• 111
6k views

### Checking date & time in PHP

Goal: To create a countdown to our next available live stream. Details: We live stream six times a week all (PST). 1. Sunday at 8:00 a.m. 2. Sunday at 10:00 a.m. 3. Sunday at 12:00 p.m. 4. Sunday at ...
2k views

### An idiom to use the same view function to create or edit an object?

Here is the skeleton of my (first!) Django app: ...
• 341
83k views

### Parsing console application arguments [closed]

In our console app, the parsing of application arguments is done like so: ...
• 449
15k views

### Simple Tic-Tac-Toe PHP/Pure HTML

I've been doing a simple Tic-Tac-Toe with PHP, generating only HTML code. A few notes: I didn't bother yet to give an AI to the opponents (the Os), and it is intentional. There is no CSS style to ...
• 449
310 views

### Struct to web style string

I've had to make several functions to turn some structures into strings. I am a still green when it comes C so I am unsure if I am doing this a very awkward way. The system I am coding for does not ...
2k views

### ASP.net custom user control design

I've built a custom control that generates a tab style navigation. Each page might have different tabs to display, the aim was to modularise it so I can make global changes to all the tabs. TabMenu....
• 835
2k views

### "Do you owe the government?" classes

Should my class pass parameters internally or reference class level scoped variables? I'm not sure on the best approach or style for procedure calls that have parameters. Should I go with the class ...
• 347
816 views

I want to write an Android ListAdapter to serve data from a database that look like this: ...
• 455
643 views

### Hibernate transaction advice [closed]

I'm new to Hibernate so I need some advice/direction on doing Transactions. I have a DAO like ...
• 282
1k views

### Genetic algorithm for Clever Algorithms project

I wrote a bunch of Ruby code for a book project I've just finished. One criticism is that it is fine code but not very "ruby like". I agree my style was simplified for communication reasons, and ...
• 283
285 views

### Generating filesystem paths from a fixed string

It's clever, but makes me vomit a little: file = '0123456789abcdef123' path = os.sep.join([ file[ x:(x+2) ] for x in range(0,5,2) ])
• 27
1k views

### Form to create new students or view existing student information

I started out with the best of intentions, but this form got hacky real fast. It's purpose is to serve as a create new Student form. Also, if you want to view an existing Students information. Think ...
2k views

### Better way of setting input scope on text box in WP7 [closed]

This works but there must be a better way: txtBox.InputScope = new InputScope { Names = { new InputScopeName { NameValue = InputScopeNameValue.Text } } };
499 views

### Javascript Object Placement / String Parsing Method

This JS function is intended to retrieve or place a value into an object with the nested keys as a string. For example ...
• 193
49k views

### Returning total number of rows in query

Oftentimes I find myself wanting the total number of rows returned by a query even though I only may display 50 or so per page. Instead of doing this in multiple queries like so: ...
• 673
695 views

### How does this Binary Search Tree look?

I wrote a BST in C a while back and may use it at some point. ...
• 141
2k views

### Project Euler Problem 2 in Clojure

I am in the process of learning Clojure. I am fairly new to functional programming and would like to know if my code smells or if there are any performance implications with my approach. ...
• 529
2k views

### Personal website, done after one week of learning HTML and CSS

I've just started learning CSS/HTML a week ago and I made a quick site today. It looks pretty good, but I think that I reused/wrote some really messy CSS. This is because I haven't used the ...
• 169
443 views

### User error logging

I have created this code for user error logging, and I am wondering if there is anything that can be improved. The point is that this error handler would ONLY catch user errors created in-code by ...
• 205
700 views

### Initializing a window in Cocoa

This is some of the code I have: ...
• 151
27k views

...
• 373
732 views

### Resolving a link - follow-up

Similar piece of code to that I recently posted as: Resolving a link I have another piece of code which cannot be as easily extracted out into a method: ...
• 1,470
452 views

### Finding subtuple in larger collection?

I've got a flat array of < 1000 items and I need to find the indices of a smaller tuple/array within the array. The tuple to find can be a varying length (generally between 2 and 5 items, order is ...
13k views

### Interface for unit of work pattern and repository pattern

I'm trying to design a well defined yet simple interface for the unit of work and repository patterns. My UoW's are exposed to services and services then "get repositories" that it needs to query. I ...
3k views

### Resolving a link

How can I clean this up? ...
• 1,470
1k views

### Twitter client portfolio website

I'm creating some sort of "portfolio" website for my self (a ton of placeholder content right now...) and I was wondering if I could improve the semantics of the HTML5 any further, especially the <...
• 934
2k views

### Formatter class

In our production code, we cannot use Boost or C++0x. Formatting strings using sprintf or stringstream is annoying in this case,...
• 634
15k views

### Thread-Safe and Lock-Free - Queue Implementation

I was trying to create a lock-free queue implementation in Java, mainly for personal learning. The queue should be a general one, allowing any number of readers and/or writers concurrently. Would you ...
• 1,281
2k views

### Php/Doctrine array hydration

According to the Doctrine docs, you should use Array hydration rather than record hydration when retrieving data for read-only purposes. Unfortunately, this means I have to use array syntax (as ...
• 887
20k views

### Calculate a median

I got this as an implementation of "get me the median of those values". But it sort of doesn't feel right (too long, too many branch points) so I thought I'll post it here to see what you think. <...
• 1,536
781 views

### Quasi-random sequences: how to improve style and tests?

The requirements for this one were (original SO question): Generate a random-ish sequence of items. Sequence should have each item N times. Sequence shouldn't have serial runs longer than a given ...
• 852
3k views

### Randomly sampling a population and keeping means: tidy up, generalize, document?

This is part from an answer to a Stack Overflow question. The OP needed a way to perform calculations on samples from a population, but was hitting memory errors due to keeping samples in memory. ...
• 852
13k views

### Avoiding null in variable assignment

I want to get empty string or the string value of the object Which code you will use and why? value = object.to_s or this ...
• 265
20k views

I found that in PHP (or I probably can't find it) a proper is_numeric_array($array) function is missing. So I created one. The problem is that I don't think it's ... • 856 9 votes 1 answer 443 views ### Database method to query I have a database class that in __construct() initialize a PDO connection and insert the instance into a$db private var. Now i'm working on a method that can be ...
• 856
16k views

I'm looking into Administration Elevation and I've come up with a solution that seems like it's perfectly sane, but I'm still in the dark about the professional methods to accomplish this. Is there a ...
• 1,186
706 views

### Build menu from MS Word XML

I've recently assembled some jQuery that allows a user to build out a bulleted list in MS Word with hyperlinks and turn that into a HTML unordered list. Ideas for uses are website menu systems where ...
• 673
868 views

### Music info model

I'm learning Django as I go. I know this model is missing user authentication, registration, comments/comment threading, and voting. But this is my starting code for my model. What are some of the ...
• 1,061
224k views

### Getting/setting default values from my App.config

Imagine that I need a color palette for my Winforms application to have a consistent look. What I did was create a static helper class and helper methods that I can call from anywhere in my code, and ...
16k views

### Determining if a connection has been made to a communications device

I am unsure if my use of Monitor.Wait and Monitor.Pulse is correct. It seems to work alright, but there is a nagging doubt I am ...
• 343
4k views

### Converting from polar coordinates to rectangular coordinates

This is performance critical. I measured and determined that using the sqrt is faster then using the cos method. I am aware ...
• 873
954 views

### Update grid from source hierarchy

In this question I answered with this Linq. While it does what I was looking for, I am not sure how easy the linq queries are for others to follow. So I am looking for feedback on formating, what ...
• 412
2k views

### Simple ASP.NET C# class design

Here's a class I'm designing: ...
• 835