language-agnostic

Good Namespace Naming Conventions

I am creating a class library for a CRUD business application. The major "categories" of business objects (with related data access layer objects) are: Maintenance (for working with master tables (master lists) in the database Incidents (most objects relate to a real-world incident) Search (obvious) As of now, my namespaces are set u...

Find all duplicates and missing values in a sorted array

Suppose you have a sorted range (x to y) of values in an array. x = 3; y = 11; array == 3, 4, 5, 6, 7, 8, 9, 10, 11 But it is possible that some values are duplicated and some are missing, so you might have: array == 4, 5, 5, 5, 7, 8, 9, 10, 10 What's the best way in your language to find all duplicates and missing values so you g...

How much time do you spend on research / refactoring?

Staying up-to-date is essential in the programming world as new technologies / methods etc.. are so quick to arrive (and depart). So how much time do you spend doing this? Does your employer allow you to do this on their time? Or do they expect that as a professional it is up to you to keep your skills up? On a related subject, how much...

What would you suggest as a high school first language?

Edit by OA: After reading some answers I'll just update the question a little. At first I put it a little bluntly, but some of those gave me some good arguments which have to be taken into consideration while making a stand on this one. (these are mostly picked up from comments and answers below). A few things to take into account: to...

Keeping Drop-downs DRY in a web app

I'm writing a CMS for various forms and such, and I find I'm creating a lot of drop-downs. I don't really feel like mucking up my database with tons of random key/string value tables for simple drop-downs with 2-4 options that change very infrequently. What do you do to manage this in a responsible way? This is language-agnostic, but ...

Best Way to Get Motivated to Learn New Technologies

I enjoy building websites, But with my work load I try but still feel tough to get motivated to learn new technologies because the requirements don't call for it; and they drive my skillset Please share your tips to get motivated or the best techniques to learn these new technologies. ...

Parsing and formatting search results

Search: Scripting+Language Web+Pages Applications Results: ...scripting language originally...producing dynamic web pages. It has...graphical applications....purpose scripting language that is...d creating web pages as output... Suppose I want a value that represents the amount of characters to allow as padding on eit...

Sort algorithm to use for this specific scenario

I have two lists - let's call them details and totals. The items in details have multiple elements for each key that the list is sorted on, as such: KEY1 KEY1 KEY2 KEY2 KEY3 KEY3 KEY3 etc The items in totals will only have each key once, as such: KEY1 KEY2 KEY3 etc Both lists are sorted by key already. The lists need to be combined...

What operation turns floating point numbers into a "group" ?

Might anyone be famiiar with tricks and techniques to coerce the set of valid floating point numbers to be a group under a multiplication based operation? That is, given any two floating point numbers ("double a,b"), what sequence of operations, including multiply, will turn this into another valid floating point number? (A valid floa...

Cross OS virtual drive functionality

Looking for online resources to implement a virtual drive functionality similar to ones implemented in products listed The solution should be cross OS (win, pc, linux) preferably using a well behaving framework. Currently the answer to this question is widely dispersed with no clear option on what to use: Current suggestions I've foun...

Sum array values with sum equals X.

I have an integer collection. I need to get all possibilites that sum of values are equal to X. I need something like this. It can be written in: delphi, c#, php, RoR, python, cobol, vb, vb.net ...

Which layers should speak Domain Models?

Let's say I have a method like this in my business layer: // This is in the business layer public Result DeleteSomeDomainObject( ???? ) { //Enforce business logic here. //Delete records in the database DAL. DeleteSomeDomainObject( ??? ) } // This is in the data access layer public Result DeleteSomeDomainObject( ???? ) { /...

How do I automatically find a user's location?

I am currently working on a show listing website. I am going to display show information by location for the user sorted in a variety of different ways. I know I could ask the user where they are located when they first sign into the site, but I've seem to notice that many sites have this capability built-in to detect location automa...

How should validation behave

In the very common scenario where you have a textbox, and some kind of validation rule which constraints the valid entries on that textbox. How should a failing validation affect the content of the textbox especially in the case when there originally was a valid value entered before the invalid. Example: Imagine a form where one can ent...

How to get checksums for strided patterns

I have a 64 bit number (but only the 42 low order bits are used) and need to computer the sum of the 4 bits at n, n+m, n+m*2 and n+m*3 (note: anything that can produce a sum >4 is invalid) for some fixed m and every value of n that places all the bits in the number as an example using m=3 and given the 16-bit number 0010 1011 0110 0001...

SVN problem: What is the latest revision that still contained this code snippet?

It is good practice to remove old code instead of just commenting it out. It is often claimed that the old code parts can always be found again in the old SVN repository revision, if needed. But practically, it's not that easy, right? If the old code is in some unknown old SVN revision then it can be quite hard to find. I'm exactly in...

Most daunting error message?

I got this one yesterday, and immediately decided to use a different library: TypeError: publish_programmatically() takes exactly 17 arguments (1 given) (I won't name and shame the library but you Python programmers may recognise it) So, what is your most daunting/uninformative error message? Edit: And before the duplicate people g...

Best Data Structure for The Following Constraints?

Here are some constraints for a data structure I need. It seems like none of the common data structures (I will mention the ones I've thought of below) fit these all that well. Can anyone suggest one that I maybe haven't thought of? I need to be able to perform lookups by unsigned integer keys. The items to be stored are user-defined...

Asynchronous vs Multithreading- is there a difference?

Does an asynchronous call always create a new thread? What is the between the two? EDIT: Does an asynchronous call always create or use a new thread? Wikipedia says: In programming, asynchronous events are those occurring independently of the main program flow. Asynchronous actions are actions executed in a non-blocking scheme, allo...

What's the smart way to implement OrderBy / ThenBy?

I'm implementing a LINQ clone in Lua, but that's not too relevant here, and I've got most features done (enumerable/queryable, not the precompiler yet), but can't think of a smart way to implement OrderBy's ThenBy. Currently I sort once, then place in new lists and then sort those sub lists and finally merge the results again, but that...