language-agnostic

Splitting a String into Smaller Parts based on Parens

Using java I am trying to develop a method using recursion to analyze a String of the form: (PART0(PART1(PART2)(PART3))) I want the method to split apart the relevant Strings. I want this method to give me the ability to perform some logic on each part of the String without the parentheses being involved in this order: PART2 PART3 P...

When exactly does a method have side effects?

As I always understood it, any change to the programs state (or anything to do with IO) is a side effect. It does not matter, whether the change occurs in a global variable or in a private field of the object the method is called on. It follows that all methods which do not return anything either do nothing at all or have a side effect. ...

What is the coolest thing you can do in <10 lines of simple code? Help me inspire beginners!

I'm looking for the coolest thing you can do in a few lines of simple code. I'm sure you can write a Mandelbrot set in Haskell in 15 lines but it's difficult to follow. My goal is to inspire students that programming is cool. We know that programming is cool because you can create anything you imagine - it's the ultimate creative ou...

What is the difference between a property and an instance variable?

I think I've been using these terms interchangably / wrongly! ...

Can a language be turing complete but incomplete in other ways?

For example, are there certain things when writing an operating system that cannot be accomplished in a turing complete language? ...

Do you ever make a code change and just test rather than trying to fully understand the change you've made?

I'm working in a 12 year old code base which I have been the only developer on. There are times that I'll make a a very small change based on an intuition (or quantum leap in logic ;-). Usually I try to deconstruct that change and make sure I read thoroughly the code. However sometimes, (more and more these days) I just test and make s...

Programming tips with Japanese Language/Characters

I have an idea for a few web apps to write to help me, and maybe others, learn Japanese better since I am studying the language. My problem is the site will be in mostly english, so it needs to mix fluently Japanese Characters, usually hirigana and katakana, but later kanji. I am getting closer to accomplishing this; I have figured out ...

To Do or Not to Do: One Line if Statements and Curly Braces

Duplicate: Why is it considered a bad practice to omit curly braces? Hey folks, Just curious on your thoughts about the below: if (someCondition) { callSomething(); } vs. if (someCondition) callSomething(); I only ask this because when I started using refactoring tools, the if without curly braces is what they ...

Distributed computing vs threads

How similar is distributed computing and threading? I've found two papers coming to quite opposite conclusions: "Multi-Threading is Easier Than Networking. How threading is easy and similar to network code" http://software.intel.com/file/14723 (this gives me an impression that they're so similar that after encapsulation these two appr...

DB Design: Sort Order for Lookup Tables

I have an application where the database back-end has around 15 lookup tables. For instance there is a table for Counties like this: CountyID(PK) County 49001 Beaver 49005 Cache 49007 Carbon 49009 Daggett 49011 Davis 49015 Emery 49029 Morgan 49031 Piute 49033 Rich 49035 Salt Lake 49037 San ...

How to keep my code simple?

--EDIT-- I believe this is a valid question that may have multiple answers (as defined here). This is NOT a discussion nor a poll. Furthermore, this question is evidently NOT argumentative as none of the respondents so far seem to argue with each other. --ORIGINAL TEXT-- Amazing! I do software for about 15 years now and I still have n...

What's the best way to notify a non-web application about a change on a web page?

Let's say I have two applications which have to work together to a certain extent. A web application (PHP, Ruby on Rails, ...) A desktop application (Java, C++, ...) The desktop application has to be notified from the web application and the delay between sending and receiving the notification must be short. (< 10 seconds) What are ...

What do you wish was automatic in your favorite programming language?

As a programmer, I often look at some features of the language I'm currently using and think to myself "This is pretty hard to do for a programmer, and could be taken care of automatically by the machine". One example of such a feature is memory management, which has been automatic for a while in a variety of languages. While memory man...

Performances evaluation with Message Passing

Hi, I have to build a distributed application, using MPI. One of the decision that I have to take is how to map instances of classes into process (and then into machines), in order to take maximum advantages from a distributed environement. My question is: there is a model that let me choose the better mapping? I mean, some arrangement...

What are some bad programming habits to look out for and avoid?

I'm a new programmer in college and was wondering if there are any bad habits to watch out for early on. Anything that you wish you knew to avoid when starting. Thanks. ...

Does anyone know of a good library for mapping a person's name to his or her sex?

I am looking for a library or database that can provide guesses about whether a person is male or female based on his or her name or nickname. Something like john => "M", mary => "F", alex => "A", #ambiguous I am looking for something that supports names other than English names (such as Japanese, Indian, etc.). Before I get anoth...

Find a pattern of binary numbers using shift-right and bitwise-AND?

I'm attempting to write a function in assembly that will detect if a longer binary number contains a smaller binary pattern. Example: Does 100111 contain 1001? When I read this problem I figured that I would do a bitwise-AND with the large number and its smaller pattern while shifting right (logical) each time in a loop. So, in my hea...

Table module samples

Hello, I'm looking for some good open-source sample applications that use the Table Module pattern to organize the business logic (can be any language). Any suggestions? ...

Data types between the Service (Application/Controller) and UI layers

Consider the common layered architecture of: UIService/Application/ControllerDomainPersistancy What should be the types between the Service and the UI layers? Should the return types of the methods in the Service layer be primitives? Can they be objects from the Domain layer? The motivation: We are building a forum system. Somewhere ...

What is a callback function?

What is a callback function? ...