language-agnostic

TDD vs. Unit testing

My company is fairly new to unit testing our code. I've been reading about TDD and unit testing for some time and am convinced of their value. I've attempted to convince our team that TDD is worth the effort of learning and changing our mindsets on how we program but it is a struggle. Which brings me to my question(s). There are many...

Does a Polymorphic engine have any other uses besides writing viruses?

Does a Polymorphic engine have any other uses besides writing viruses? ...

XML-RPC Standard and XML Data Type

I was looking at XML-RPC for a project. And correct me if I'm wrong, but it seems like XML-RPC has no XML datatype. Are you supposed to pass as a string? or something else? Am I missing something? Looks like this was though of with SOAP. ...

Building a reverse language dictionary

I was wondering what does it take to build a reverse language dictionary. The user enters something along the lines of: "red edible fruit" and the application would return: "tomatoes, strawberries, ..." I assume these results should be based on some form of keywords such as synonyms, or some form of string search. This is an online ...

Generally a Good Idea to Always Hash Unique Identifiers in URL?

Most sites which use an auto-increment primary-key display it openly in the url. i.e. example.org/?id=5 This makes it very easy for anyone to spider a site and collect all the information by simply incrementing the value of id. I can understand where in some cases this is a bad thing if permissions/authentication are not setup co...

Is it bad practice to use temporary variables to avoid typing?

I sometimes use temporary variables to shorten the identifiers: private function doSomething() { $db = $this->currentDatabase; $db->callMethod1(); $db->callMethod2(); $db->callMethod3(); $db->... } Although this is a PHP example, I'm asking in general: Is this bad practice? Are there any drawbacks? ...

Proper naming query

Hi i have naming problems with two of my functions i've got a function is_void that returns true if the argument is "empty" (in some sense). How would you call an opposite function? isnt_void? is_set? is_not_void? i have a pair of functions, the first one installs a handler to catch errors in the subsequent code and the second removes...

Latin squares generator? (Sudoku-like constraint problem)

Purpose We're designing a Latin square (sudoku-like sequence) for an experimental design that needs to follow these constraints: Values cannot be repeated in a row Values cannot be repeated in a column Values cannot be repeated pairwise in any two rows Example for the first 3 constraints: 2 3 5 7 11 13 7 2 11 ...

Spelling Suggestions for Conjoined Words

I am working on implementing a spell check function for a web-based WYSIWYG editor. I am currently using the Damerau-Levenshtein distance algorithm to produce a list of spelling suggestions. This is all working out nicely, but I am curious as to how I might improve the functionality. Specifically, my implementation does not currently ...

Natural Language Parsing for ToDo application

I'm wondering if someone could lead me to any examples of natural language parsing for to do lists. Nothing as intense as real Natural Language Parsing, but something that could process the line: Go to George's house at 3pm on Tuesday with Kramer as well as the line: 3 on tuesday go to georges and get the same output. I've ...

Functional Requirements for the ultimate web development framework?

With the wide variety of web development frameworks that are available, there always seems to be a perpetual incentive to "try something new". Hence, some of us find ourselves trading one framework for another, never being entirely satisfied with the end results. Granted there will always be niches where a given web framework will serv...

Atomic Instruction

What do you mean by Atomic instructions? How does the following become Atomic? TestAndSet int TestAndSet(int *x){ register int temp = *x; *x = 1; return temp; } From a software perspective, if one does not want to use non-blocking synchronization primitives, how can one ensure Atomicity of instruction? is it possible only a...

DAO Best practices : Querying Parent / Children

Hi Given you have a domain model with a simple parent / child relationship, and each entity has it's own associated DAO, eg: Author AuthorDAO Book BookDAO If I want to add a DAO method for retrieving the books by a specific author, what's the best place for it? class AuthorDAO { List<Book> getBooks(Author author); } or class ...

How to design a timer-based web game (like Cafe World)

I need to design and implement a timer-based game (Flash on client, PHP on server), like Cafe World, i.e. user clicks on a button, waits a few seconds, something happens, and then he can click again. It'll be a simulation of a food production line. There will be N production line elements, each has a separate timer with different durati...

Deleting lines from multiple files

How do you search and delete a line (not replace) from multiple files in a directory tree? I have tried programs such as grepWin and Windows Grep but they replace lines, they do not delete the entire line. What is my best option? Example: Search for "hello" and delete any line with "hello" in it. yo hello hey hey hi hello bye bye s...

Angles to decimal conversion

Hi, I'm trying to understand some flash animation, and am having difficulty working out the following. Can anyone help? I want to convert a degree range of 0 to 90, to a value between 0 and 1 These is an existing function to convert from the range 0 to 1 to degrees, eg: function convertToDegrees(Int:Pos) { var rot = (45 * pos);...

Tips for Project Euler Problem #78

This is the problem in question: Problem #78 This is driving me crazy. I've been working on this for a few hours now and I've been able to reduce the complexity of finding the number of ways to stack n coins to O(n/2), but even with those improvements and starting from an n for which p(n) is close to one-million, I still can't reach the...

Fastest method to fill a database table with 10 Million rows

What is the fastest method to fill a database table with 10 Million rows? I'm asking about the technique but also about any specific database engine that would allow for a way to do this as fast as possible. I"m not requiring this data to be indexed during this initial data-table population. ...

Code Golf: Running Water

The challenge The shortest code by character count to identify and mark water depressions in the ASCII representation of a land from input. Input will be an ASCII representation of a landscape, having hills, valleys and flat lands. The program should simulate what the landscape would look like if if was flooded - filling all valleys wi...

Constrained graph transformation in scheduling applications

I'm working on an interactive job scheduling application. Given a set of resources with corresponding capacity/availabilty profiles, a set of jobs to be executed on these resources and a set of constraints that determine job sequence and earliest/latest start/end times for jobs I want to enable the user to manually move jobs around. Esse...