This question bugged me for years now and can't seem to find good solution still. I working in PHP and Java but it sounds like this maybe language-agnostic :)
Say we have a standard status reference table that holds status ids for some kind of entity. Further let's assume the table will have just 5 values, and will remain like this for ...
Sometimes you want to mark a DB table record as deleted instead of deleting it permanently, right?
How do you do that?
So far I've been using a boolean "deleted" field but I'm not sure if it's a good apprach.
...
What term should I use to describe situations (or bugs in software) caused by read, write, send, recv doing less work than expected?
For example, write(fd, "123456", 6); may return 3 and we need to write "456" to finish our work.
/* Still in doubt between "short write/read" and "data truncation" after reading answers. */
...
Possible Duplicate:
Should a function have only one return statement?
Hi,
I have a code somethg like below:
int method(string a ,int b , int c){
if(cond1)
return -1;
if(cond2 || cond3)
return 3;
if(cond1 && cond2)
return 0;
else
return -999;
}
Does it perform badly when compared to having ...
Are there any resources on how to design frameworks, i.e. tips and tricks, best practices, etc..
...
Hello, I'm making a simple compiler for a simple pet language I'm creating and coming from a C background(though I'm writing it in Ruby) I wondered if a preprocessor is necessary.
What do you think? Is a "dumb" preprocessor still necessary in modern languages? Would C#'s conditional compilation capabilities be considered a "preprocessor...
are there any main factors in which the programs efficiency depends?
...
I have an 8 digit hexadecimal number of which I need certain digits to be either 0 or f. Given the specific place of the digits is there a quick way to generate the hex number with those places "flipped" to f. For example:
flip_digits(1) = 0x000000f
flip_digits(1,2,4) = 0x0000f0ff
flip_digits(1,7,8) = 0xff00000f
I'm doing this on an...
I've been doing some reading on transforming Vector3 with matrices, and am tossing up digging deeper into the math and coding this myself versus using existing code. For whatever reason my school curriculum never included matrices, so I'm filling a gap in my knowledge. Thankfully I only need a few simple things, I think.
Context is th...
Possible Duplicates:
What is a strictly typed language?
What are the key aspects of a strongly typed language?
What does it mean that language is strongly typed?
...
I am investigating the possibility of image processing to identify certain objects and also count them in an image.
I will be given a picture and I need to identify the number of boxes present in that image.
Does anybody have any experience with any Machine Vision/ Image Processing libraries like ImageJ, Fiji, JAI, jMagick ,Java Visio...
I am looking for behavior tree implementations in any language, I would like to learn more about how they are implemented and used so can roll my own but I could only find one
Owyl, unfortunately, it does not contain examples of how it is used.
Any one know any other open source ones that I can browse through the code see some examples ...
I have come up with a data structure that combines some of the advantages of linked lists with some of the advantages of fixed-size arrays. It seems very obvious to me, and so I'd expect someone to have thought of it and named it already. Does anyone know what this is called:
Take a small fixed-size array. If the number of elements you ...
If I have a function called from a few places, and it requires some condition to be met for anything it does to execute, where should that condition be checked? In my case, it's for drawing - if the mouse button is held down, then execute the drawing logic (this is being done in the mouse movement handler for when you drag.)
Option one ...
This is pure just for interest question, any sort of questions are welcome.
So is it possible to create thread-safe collections without any locks? By locks I mean any thread synchronization mechanisms, including Mutex, Semaphore, and even Interlocked, all of them. Is it possible at user level, without calling system functions? Ok, may b...
I'm looking for opinions or if there is an agreed way of doing this, regarding to naming namespaced classes.
E.g.:
com.facebook.FacebookClient
vs
com.facebook.Client
Or
javax.script.ScriptEngine;
vs
javax.script.Engine;
I'm currently prefer the first name in each example but the extra word seems a bit wasteful.
...
Guidelines for code-golf on SO
We've all seen phone numbers that are put into words: 1-800-BUY-MORE, etc.
What is the shortest amount of code you can write that will produce all the possible combinations of words for a 7 digit US phone number.
Input will be a seven-digit integer (or string, if that is simpler), and assume that ...
I'm storing 4-card hands in a way to treat hands with different suits the same, e.g.:
9h 8h 7c 6c
is the same as
9d 8d 7h 6h
since you can replace one suit with another and have the same thing. It's easy to turn these into a unique representation using wildcards for suits. THe previous would become:
9A 8A 7B 6B
My question is - ...
Forgive me if this is the wrong place but I am curious as to how other programmers feel about this topic:
I am currently working on my portfolio site, it is being designed and built in silverlight 4. I initially started off with a typical stylised e-folio theme much like a standard website in terms of layout and flow.
As I work more in...
There are lots of programming and architecture patterns. Patterns allow to make code cleaner, reusable, maintainable, more testable & at last (but not at least) to feel the follower a real cool developer.
How do you rank these considerations? What does appeal you most when you decide to apply pattern?
I wonder how many times code reu...