This is an error I encountered in EF4 within Visual Studio 2010, when I use the "Model First" approach and created a database from a theoretical model. Ironically it will not compile after that because of the error. Microsoft still has a lot of work to do here.
Solution:
1. Create the property within the entity for the FK using the same name.
2. In mapping details, map the new property to the underlying table field.
3. Select the original association and click the Referential Constraint and choose the right principal and dependent.
4. Now select the association again, you will see a message akin to "Mapping not allowed for exposed foreign key... Delete the mapping...".
5. Click on Delete the mapping link.
6. Recompile.
Viola! World peace...
Thursday, April 22, 2010
Wednesday, August 6, 2008
Central or Distributed social structures?
This post maybe a little confusing but allow me to elaborate. There are two topics that seemingly unrelated to many people, but somehow connected in my mind. The two topics are:
1. Are we going to cloud-based computing? Or, is computing becoming a utility?
2. Solar-cells on every rooftop?
Once I list them down here, you can immediately see the seemingly different directions these two things are going. For cloud-based computing, people's computing need, word-processing, spreadsheet, database, etc., is going to a centralized facility that provides all the functionality for an as-needed base. But for Solar-cells, it is going to a de-centralized direction, making every house-hold a self-sufficient cell in the society.
Which brings the question: Is there a certain direction for any human society to go for its basic needs? I think Computing should be considered a basic need now, at least for developed countries, while power has been considered as such for a long long time.
Human history has shown that people have becoming more and more interdependent on a larger and larger scale. Back in the agriculture society, every household is self-sufficient. Each home can provide all the needs itself, from wheat and rise on the table to clothes on the body. And that's why a siege to a city can last for years without a result (think about Troy). Not in the current time, when a batch of salmonella infected tomatoes brings panic to literally the whole country of the United States. The reason here, most economists can tell you, is because of trade.
Trade can, almost always, make both parties better off. It is taught as an axiom of economy in any universities. It also brings inter-dependencies that people argue makes the society more stable. For example, if you are in substantial trade with another country, then it makes you think twice or more times before you start a war. And thus people, especially the western developed countries, believes the more trade, brings more inter-dependencies, the better.
However, I want to argue that there is a fallacy to this, as it is not eliminating all the chances of conflicts and/or disruptions to the society. On the contrary, it makes the potential conflicts bigger, and/or disruptions more disruptive. It may not be a good thing after all.
An analogy would be made with earthquakes. If there are small earthquakes on a fault line, the pressure of the earth plates got released often, and the chance of having a major one is slim. However, if there is no small releases of the pressure, the chance of getting a devastating one becomes larger. Same thing to societies. If there are small conflicts all the time, then the chance of a big one got reduced. But currently, because of all the inter-dependencies we have, there is no release of pressure within the system. And once we have a big conflict, then it will spread easily across the connections and bring down the whole system in a whiff.
Which brings my point: Maybe global trading is not such a good deal, anyways. And we should have roof-top based solar-cells, just in case.
1. Are we going to cloud-based computing? Or, is computing becoming a utility?
2. Solar-cells on every rooftop?
Once I list them down here, you can immediately see the seemingly different directions these two things are going. For cloud-based computing, people's computing need, word-processing, spreadsheet, database, etc., is going to a centralized facility that provides all the functionality for an as-needed base. But for Solar-cells, it is going to a de-centralized direction, making every house-hold a self-sufficient cell in the society.
Which brings the question: Is there a certain direction for any human society to go for its basic needs? I think Computing should be considered a basic need now, at least for developed countries, while power has been considered as such for a long long time.
Human history has shown that people have becoming more and more interdependent on a larger and larger scale. Back in the agriculture society, every household is self-sufficient. Each home can provide all the needs itself, from wheat and rise on the table to clothes on the body. And that's why a siege to a city can last for years without a result (think about Troy). Not in the current time, when a batch of salmonella infected tomatoes brings panic to literally the whole country of the United States. The reason here, most economists can tell you, is because of trade.
Trade can, almost always, make both parties better off. It is taught as an axiom of economy in any universities. It also brings inter-dependencies that people argue makes the society more stable. For example, if you are in substantial trade with another country, then it makes you think twice or more times before you start a war. And thus people, especially the western developed countries, believes the more trade, brings more inter-dependencies, the better.
However, I want to argue that there is a fallacy to this, as it is not eliminating all the chances of conflicts and/or disruptions to the society. On the contrary, it makes the potential conflicts bigger, and/or disruptions more disruptive. It may not be a good thing after all.
An analogy would be made with earthquakes. If there are small earthquakes on a fault line, the pressure of the earth plates got released often, and the chance of having a major one is slim. However, if there is no small releases of the pressure, the chance of getting a devastating one becomes larger. Same thing to societies. If there are small conflicts all the time, then the chance of a big one got reduced. But currently, because of all the inter-dependencies we have, there is no release of pressure within the system. And once we have a big conflict, then it will spread easily across the connections and bring down the whole system in a whiff.
Which brings my point: Maybe global trading is not such a good deal, anyways. And we should have roof-top based solar-cells, just in case.
Friday, June 13, 2008
"Job description like" resumes are sure killers
I am just going through some resumes for my colleagues open position and am surprised at those "Job description like" ones. What I meant is that the resume looks like a copy of the job description of the titles that he/she had. They are full of things such as "Performed developer functions involving scope requirements, systems analysis, design development, documentation, software development, testing, implementation, and maintenance.", or "Developed applications in support of Level 3 operations, Business Partners requirements, and other special projects.".
I would say that this is the worst possible resume that you can make. It doesn't give any useful information for the hiring manager about what you can do and what you have done. Unless you were a dummy, nobody should fail to meet the above "Job Descriptions". But the problem with this is that it also shows that you have nothing to say about your previous/current job. A useful resume should list the Accomplishments front and center in all the jobs you have. And the explaination of the accomplishment can tell potential hiring managers about the level of success that you had. Absent that, one can only guess that the reason you didn't put any accomplishments was because, simple, you didn't have any.
These resumes really give me goose-bumps. I'd better go back and check mine...
I would say that this is the worst possible resume that you can make. It doesn't give any useful information for the hiring manager about what you can do and what you have done. Unless you were a dummy, nobody should fail to meet the above "Job Descriptions". But the problem with this is that it also shows that you have nothing to say about your previous/current job. A useful resume should list the Accomplishments front and center in all the jobs you have. And the explaination of the accomplishment can tell potential hiring managers about the level of success that you had. Absent that, one can only guess that the reason you didn't put any accomplishments was because, simple, you didn't have any.
These resumes really give me goose-bumps. I'd better go back and check mine...
Monday, August 27, 2007
Nullable type and its usage
During a thought process, I came cross a dilemma between using a Nullable struct and a self-created class. The benefit of using a Nullable struct is obvious: It makes the code look pretty and save a lot of code. However, the main problem is that I need more function than Nullable here. To me, it is a crime to use a precious byte (bool) to store the fact that the object is/not a null. Two reasons here: 1. The code that I am dealing with will be stay at system engine level. Thus, any such criminal wasting of space is questionable. 2. I also need to know the fact if the object is valid or not. This means another precious byte! Keeps on giving spaces at this 8:1 ratio will render the piece into oblivion in no time.
How to address this? There are two ways here, it seems. The first one is to take the matter into my own hands and wrap a generic struct with a byte and the target primitive type in question. This can be an elegant solution but comes without the help of .NET CLR in boxing and unboxing behavior, in addition to the inelegant usage of .value all over the place. The other is to keep the fact outside of the primitive types themselves and maintain them in the declaring class. This solution is even dirtier as it brings the problem of keeping the value and flags in sync (you don't want to get a null in the flag while the value is 1, assuming 1 is a meaningful number).
The best solution would be to inherit from Nullable and be able to manipulate the byte myself. However, .NET would NOT allow you to inherit from a struct. So this is not workable.
Thus, I am trying to simulate the Nullable in your own code.But it doesn't seem to get the same kind of treatment from the compiler. There must be more to it than just implement the implicit Nullable operator and explicit T operator.
How to address this? There are two ways here, it seems. The first one is to take the matter into my own hands and wrap a generic struct with a byte and the target primitive type in question. This can be an elegant solution but comes without the help of .NET CLR in boxing and unboxing behavior, in addition to the inelegant usage of .value all over the place. The other is to keep the fact outside of the primitive types themselves and maintain them in the declaring class. This solution is even dirtier as it brings the problem of keeping the value and flags in sync (you don't want to get a null in the flag while the value is 1, assuming 1 is a meaningful number).
The best solution would be to inherit from Nullable and be able to manipulate the byte myself. However, .NET would NOT allow you to inherit from a struct. So this is not workable.
Thus, I am trying to simulate the Nullable
Tuesday, August 7, 2007
It is going to be a blood bath out there for ARM loan borrowers
I noticed this on the just posted article from theimbreport.com. The analysis they did on the 2/28 loans originated in the second half of 2004 is nothing short of mind-boggling:
"At reset, the remaining UPB was $291 million with a 30+ day delinquency percentage of 43% on the UPB at reset and 13% on the original UPB. However, as these loans aged an additional six months, a further 47% of these loans paid off (leaving a UPB of only $154 million or 15% of the original UPB) and the delinquency percentage fell to 31% on the UPB at reset and 9% on the original UPB..."
Remember, these loans got reset in Q3 and Q4 of 2006, when the real estate market was at its absolute peak. This means that out of all the 2/28 loans (ARM loans with a two year fixed period), 43% of them are delinquent! And this rate is still 31% 6 months later!
To translate the above into layman's term: If you are a home buyer in late 2004, when the market was STILL not as crazy as 2006, and you chose a nice, low monthly payment ARM loan, then it is highly possible (43% odds) that you will not be able to afford it after the rate is reset.
This is almost a doomsday scenario for any average home buyer. Imagine: Are you going to buy a house if you know 1 out of 2 chances you will not be able to afford it 24 months down the line? Worse, if you can not somehow refinance it or sell it before the monthly payments crashed you, (which is probably the case now a days), then you are looking at bankruptcy in its eyes...
This is just crazy... Am I missing something?...
"At reset, the remaining UPB was $291 million with a 30+ day delinquency percentage of 43% on the UPB at reset and 13% on the original UPB. However, as these loans aged an additional six months, a further 47% of these loans paid off (leaving a UPB of only $154 million or 15% of the original UPB) and the delinquency percentage fell to 31% on the UPB at reset and 9% on the original UPB..."
Remember, these loans got reset in Q3 and Q4 of 2006, when the real estate market was at its absolute peak. This means that out of all the 2/28 loans (ARM loans with a two year fixed period), 43% of them are delinquent! And this rate is still 31% 6 months later!
To translate the above into layman's term: If you are a home buyer in late 2004, when the market was STILL not as crazy as 2006, and you chose a nice, low monthly payment ARM loan, then it is highly possible (43% odds) that you will not be able to afford it after the rate is reset.
This is almost a doomsday scenario for any average home buyer. Imagine: Are you going to buy a house if you know 1 out of 2 chances you will not be able to afford it 24 months down the line? Worse, if you can not somehow refinance it or sell it before the monthly payments crashed you, (which is probably the case now a days), then you are looking at bankruptcy in its eyes...
This is just crazy... Am I missing something?...
Monday, August 6, 2007
Interesting article that I totally agree: A Guide to Hiring Programmers: The High Cost of Low Quality
This is a nice article regarding the value of good programmers. They are always under-estimated and poorly treated, as it shows. Of course, as the author, Frank Wiles, pointed out, this is the direct result of employer/employee relationship. So as to say, go your own ways, smart people!
Link: A Guide to Hiring Programmers: The High Cost of Low Quality
Link: A Guide to Hiring Programmers: The High Cost of Low Quality
A new Monday, a new start
I have being think about starting a personal blog. And today, all of a sudden, I am telling myself: Let's do it...
Actually, it is so easy and so "fashionable" that it may seem like a crime not doing one. But I am also not a "fashionable" guy in myself, far from it. What I want is a place to share the thoughts that have been in my mind for sometime. So I can at least find some ease, instead of thinking about them over and over again... :)
"The challenge, of course, is to keep this blog fresh and attractive." Heck, this blog is just a vent of my thoughts, it doesn't need to be fresh and attractive at all. It just need to reflect what I am thinking. And my thoughts are not always fresh and attractive, to many others.
As you will slowly find out, the name laorient has some pertinent meaning to me. Go ahead and guess all the way...
Actually, it is so easy and so "fashionable" that it may seem like a crime not doing one. But I am also not a "fashionable" guy in myself, far from it. What I want is a place to share the thoughts that have been in my mind for sometime. So I can at least find some ease, instead of thinking about them over and over again... :)
"The challenge, of course, is to keep this blog fresh and attractive." Heck, this blog is just a vent of my thoughts, it doesn't need to be fresh and attractive at all. It just need to reflect what I am thinking. And my thoughts are not always fresh and attractive, to many others.
As you will slowly find out, the name laorient has some pertinent meaning to me. Go ahead and guess all the way...
Subscribe to:
Posts (Atom)