|
Possible Duplicate:
Java - Common Gotchas
What is the weirdest behavior that you have found in Java? (Behavior that is unexpected)
Started by steven on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Everything else....
Calendar.set(int year, int month, int date)
final Calendar a = Calendar.getInstance( ); a.set( 2009, 10, 16 ); System.out.println( a.getTime( ) );
-> Mon Nov 16 14:21:33 EST 2009
Apparently, month field in Calendar object is 0-based .
|
|
Should entities have behavior? or not?
Why or why not?
If not, does that violate Encapsulation?
Started by therealhoff on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
A "Business Entity" is a modeling of a real world object, and it should encapsulate all of the business logic ... .
I do case they should have behavior.
If you're strictly following MVC, your model (entities) won't have any inherent behavior.
|
|
I have used cakePHP 1.2 and know how to use behaviors in it.
using cakephp 1.1 on a new project(i know it might sound silly but the project is very similar to an older project we have which was built on 1.1).
after a little googling i have come to believe...
Started by Yash on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Then I would go through all of the beforeSaves, afterSaves, etc and ... .
When I was doing my early developing, I wrote a behavior and realized that behaviors didn't start by importing/declaring the behavior I'm interested in.
Branch.
|
Ask your Facebook Friends
|
In C++ there are a lot of ways that you can write code that compiles, but yields undefined behavior (Wikipedia) . Is there something similar in C#? Can we write code in C# that compiles, but has undefined behavior?
Started by luvieere on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
However in Unsafe code, undefined behavior I believe is possible/library/aa664771%28VS.71%29.aspx
Has an example ....
Looking at the Wiki, the situations in which undefined behavior happens are either not allowed or throw an exception in C#.
|
|
Is it acceptable for an API to have bad behaviors (like segfault, bus error, memory leak) if the condition that would cause the bad behaviors is documented? Or should it always fail "gracefully" in all known conditions?
Answer Snippets (Read the full thread at stackoverflow):
It's called undefined behavior (link) , but you should.
Yes?? ;)
Absolutely.
Time in the future ..
|
|
I have a series of behaviors I want to enable/disable based on bit values. For example, the status of Behavior "A" is 0 or 1, Behavior "B" is 0 or 2, Behavior "C" is 0 or 4, etc. If the value of the variable containing the status is "5", I know Behavior...
Started by Scott on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
If you want to manipulate individual bits in an int variable directly, you can use bitwise operators:
Check whether i-th bit is set or not: bool isSet = (variable & ... .
They abstract away bit manipulation from you.
You can use a BitVector32 or BitArray.
|
|
I would like to reproduce UIScrollView's flick-to-scroll behavior, but I don't want to use (or can't use) that class. What can I do?
Started by Dave Peck on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
If you hold your finger down.
The iPhone’s default flick-to-scroll behavior is interesting.
Choosing.
|
|
Turns out many innocently looking things are undefined behavior in C++. For example, once a non-null pointer has been delete 'd even printing out that pointer value is undefined behavior .
Now memory leaks are definitely bad. But what class situation ...
Started by sharptooth on
, 12 posts
by 12 people.
Answer Snippets (Read the full thread at stackoverflow):
There....
Memory leaks.
The behavior of memory leaks crash will occur.
Undefined behavior means, what will happen has not been defined or is unknown.
Expand that repertoire of behaviors so you can call it by its proper name: a bug.
|
|
What is the most impossible/irrational/magic behavior you ever encountered and what was the 'simple' rationale behind it?
As an example i give this link to the famous 500-miles problem .
Started by Shimi Bandiel on
, 14 posts
by 14 people.
Answer Snippets (Read the full thread at stackoverflow):
After I deployed my-an-impossible-behavior.
This is an irrational technical behavior from a financial company in a previous job.
|
|
An example of unspecified behavior in the C language the the order of evaluation of arguments to a function. It might be left to right or right to left, you just don't know. This would affect how foo(c++, c) or foo(++c, c) gets evaluated.
What other unspecified...
Started by Benoit on
, 14 posts
by 14 people.
Answer Snippets (Read the full thread at stackoverflow):
My personal top3:
violating the strict aliasing rule violating the strict aliasing... .
Hmkay.
A language lawyer question.
Be sure to always initialize your variables before you use them! When I had just started with C, that caused me a number of headaches .
|