|
If you need quick retrieval of data, a de-normalized database is often a good practise, as if you have normalized dB, there would be lots of joins,which are actually costly in terms of perfomance of queries.
On the other hand, if the preference of the application is user filling up form data and you dont want any redundancy in the database, then you should normalize the database tables.
It totally depends on the application need.
|
|
|
|
|
I my case we need to optimize two tables to stores very large number of records (in millions / billions) - just change the table structure and apply horizontal partitions on date range or no. of records. The new table structure should be able to minimize the records required to store.
1.
location_BookedAdvertisement (loc_id, advt_id, start_date, end_date, inventory_text)
And data would be like this for location_BookedAdvertisement table:
(12, 132, 2009-07-20, 2009-07-25, '1000~2000~5000~8900~3000')
This structure reduces the number of rows required to store 100,000 location's date wise assigned inventory by 364 times. Now I only need to store 100,000 rows instead of 100,000 x 365. So I am giving this table structure OK DONE. Also partition this table on no. of records such as 10 millions rows per partition.
2.
Now change the structure of tinventory table..
location_ inventory (loc_id, date, Total_available_inventory, booked_inventory)
.. to
location_ inventory (loc_id, year, Jan1, Jan2, Jan3, Jan4 ,.. ..., Dec29, Dec30, Dec31)
And data would be like this for location_ inventory table:
(12, 2009, '5000~2000', '10000~8900',... ...,'12000~2000','12000~2000','12000~2000')
Here within date column we have 'Total_available_inventory~booked_inventory'.
I know there would be 366 column in one table... but today I tested it.... SELECT / INSERT / UPDATE works very very fast as compared to in the earlier table structure. I'll partition this table year-wise i.e based on year column. And this table structure again reduces the required number of records by 364 time... i.e. to store one year inventory of 100,000 locations I would need to store only 100,000 rows.
This solution is acceptable.
|
|
|
|
|
Hello guys,
What was the name of the coding style used a lot in Hibernate?
I mean, where you would have several calls in one single instruction, as in:
SomeType obj = SomeClass.createInstance()
.SomeMethod()
.SomeOtherMethod()
.OneLastMethod();
I remember reading an article somewhere on the internet, but i can't find it back.
Thanks!
|
|
|
|
|
Nevermind, the term I'm looking for is "Method chaining"
|
|
|
|
|
If the chain reads like natural language, then the term for it now-a-days is "fluent programming."
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Wow man, you are right that was the exact term I was looking for!
|
|
|
|
|
Glad I could help!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Im looking for documents(programming languages) that would guide me in creating an interface that reads network data. So i guess i should start by creating the interface or finding out how to read network data and input database.
|
|
|
|
|
What???
CodingYoshi
Artificial Intelligence is no match for Human Stupidity.
|
|
|
|
|
trying to use System.Net.NetworkInformation in the .netframe work to read network traffic
|
|
|
|
|
Tag: BeijingIT & WebFull Time
reply to: leowang@renbenmg.com Tel: 86-20-38109789
Job description:
GENERAL SUMMARY
As a senior member of the Celerra File System and Data Protection development team in NAS Engineering, you will work on complex design problems and provide highly innovative solutions.
Desirable core technical skills include file systems, distributed file systems, clustering, operating systems, and network protocols.
Strong communication skills are required for interaction with team members, senior members of the staff and other organizations. Candidate must have a broad knowledge of Linux and/or UNIX operating system technology and experience with contemporary software engineering principles. The ideal candidate will also have the ability to provide technical leadership to teams of software engineers.
Ideal candidate will enjoy a fast paced, technically challenging environment working with an expert on the core subsystems of NAS products.
Experience and Education
• BS, MS, or PhD in Computer Science or closely related field, plus at least 10, 8, or 6 years relevant experience, depending on degree
• Strong UNIX and/or Linux operating system knowledge base
o Windows knowledge a plus
• Excellent C and/or C++ programming skills
• Have multi-threaded programming experience
• Strong problem solving skills
• Expert knowledge of network and/or disk-based file systems
o Knowledge of additional storage protocols, I/O subsystems, and/or device drivers a plus
o Knowledge of distributed and/or cluster files systems a plus
• Candidate should possess excellent spoken and written communications skills.
• Ability to effectively work with and lead a team and to influence others
o Comfortable working in a highly distributed international team
|
|
|
|
|
There is a jobs board here on Code Project. Please use this instead, as I and others will be voting to remove this message.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Pete O'Hanlon wrote: as I and others will be voting to remove this message
Awww damn, looks like I was too late to vote on it
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Welcome back Paul - I haven't seen you around for a while.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thanks, man. Have been busy and now found some time to come around here again
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
You present yourself and your company as "too damn cheap to buy an ad". This kind of PR is bad branding and damaging to the image of your company
Could they afford one?
|
|
|
|
|
Does the following C# code belong to a design pattern? If so, which one?
public class Fee
{
private Bar<Baz>.Getter myBaz = Bar<Baz>.GetAGetter();
public void Fi()
{
myBaz().DoStuff();
}
public void Fo()
{
myBaz().DoStuff();
}
}
public class Bar<T>
where T : new()
{
public delegate T Getter();
public static Getter GetAGetter()
{
T requestedItem = default(T);
return () =>
{
if (requestedItem == null)
{
requestedItem = new T();
}
return requestedItem;
};
}
}
public class Baz
{
public Baz()
{
}
public void DoStuff()
{
}
}
Bar returns a closure with an upvalue of type T. In this example, Fee's myBaz method will always return the same Baz object, and it won't be instantiated until the call to myBaz().DoStuff() during either the Fee.Fi() or Fee.Fo() method, whichever is called first.
So basically Bar provides lazy initialization of a Baz (in this case) to Fee (and presumably other classes). Do we have a name for this?
If this question has already been asked in this forum, please point me to the message.
|
|
|
|
|
At a quick glance, seems like a Singleton but a Generic Singleton Pattern. May I ask why it is important to know whether the pattern exists or not? Patterns come with time when they have proven to be successful solutions. What unique problem does your pattern above solve or why do you need such a pattern? Is it making things easier or harder?
CodingYoshi
Artificial Intelligence is no match for Human Stupidity.
|
|
|
|
|
I'm mostly curious. I'm wondering if such a pattern, or something similar (or better or more fully thought out) has emerged already in the community.
I know this code doesn't match a GOF pattern, and that it looks like a not-very-good singleton. You might call it a singleton for the calling scope of Bar.GetAGetter(). There's nothing to prevent two scopes from getting separate values though. Indeed, a single scope can get two separate values simply by calling Bar.GetAGetter() twice - each call returns a method that returns a distinct value. This is by design - it's not supposed to be a singleton.
Like I said, I think the value of Bar is that it encapsulates lazy instanciation. Since lazy instanciation is very common, and it takes 3-5 lines of code every time, and this replaces it with 1 line of code, encapsulating it seems like a good idea for all the usual code reuse reasons.
|
|
|
|
|
I'm looking for some feedback on the best/alternate ways to handle the following scenario:
Widget (defines the pool from which to create widgets)
========
Id
UserControlPath
DefaultWidget (provides a set of default properties for a widget instance)
==========
Id
WidgetId
Name
UserWidget (defines a widget with properties customized by the user)
===========
Id
WidgetId
DefaultWidgetId
Name
Given the 3 database tables above, how would you create a DTO object? I could have a class per table, but then I have to do additional queries or work with additional objects for all the data I need. I could use nested object (UserWidget has Widget.UserControlPath property). I could flatten out the UserWidget to have those properties plus a UserControlPath property.
When loading a UserWidget, I cannot display it without the UserControlPath value.
When saving updates to the properties of a UserWidget, the UserControlPath is read only - but WCF data contracts do not support the idea of read-only properties(As far as I know). Saving full object graphs can quickly become complex.
How do you model similar relationships?
Thx.
|
|
|
|
|
Leftyfarrell wrote:
I could have a class per table
I think this is a bad idea. Your tables are designed so data is normalized. Your code--classes--should be designed to normalize behavior not data. Think of your problem domain, jot down all things you need to do to these objects, assign these things to appropriate classes. Try to normalize behavior by using inheritance.
That is all I can say because I don't know too much about what you are trying to do.
CodingYoshi
Artificial Intelligence is no match for Human Stupidity.
|
|
|
|
|
Thanks for your reply.
I agree that I don't like the class per table idea. Tables are normalized. Classes should represent proper domain objects.
The question then becomes, where do you draw the line on CRUD operations. To me, a UserWidget without the UserControlPath property is kind of useless. On the other hand, when you save a new UserWidget, you cannot edit/change the UserControlPath property value. You could consider it a lookup and allow them to change the WidgetId (indirectly choosing a different UserControlPath).
But, if the UserWidget is exposed via WCF, read-only properties are not supported. So I can expose the WidgetId, which is editable, but if I provide a string UserControlPath property, it becomes editable on a WCF data contract, which I don't want.
So they load up a UserWidget object, change the UserControlPath string value, and submit the object for saving... now what? Ignore the property value? Allow the saving of this instance to change the value for all other instances? Neither sounds very elegant.
|
|
|
|
|
Do something like the following the following--private setter:
[DataMember()]
partial public class Foo
{
public string FooBar
{
get {;}
}
{
private set { ; }
}
}
Leftyfarrell wrote:
The question then becomes, where do you draw the line on CRUD operations.
What do you mean draw the line?
CodingYoshi
Artificial Intelligence is no match for Human Stupidity.
|
|
|
|
|
Thx, will check into that.
By draw the line, I mean with nested objects in an object graph. Not really shown in my object/table example above. But for instance say you have a Course, Session, and Location. A course has multiple sessions, and each session has a location.
Does your Course object have a Collection<session> objects for reading convenience? What about CRUD on the Course, where do you "draw the line"... if you add a Session to the collection, do you now save the Course AND insert a new Session? If the Session has a Location within it, and you add a new Location to a new Session and add that to a Course and save the course, do you Insert the Session and the Location?
It seems to me that dealing with object graphs for CRUD operations can get complex quickly. But having those properties does properly represent the domain model, and certainly does improve the way you work with the data when only reading it (loading Course, Session and Location info for display purposes). Then for performance reasons, you might get into lazy loading, although that may not be feasible either across WCF boundaries.
It seems all about the trade-offs and I'm just looking for the right balance that makes sense.
|
|
|
|
|
Okay I know what you mean.
It all depends on the requirements. For example, let's say you are managing customers, their orders, and lineitems. Now the questions to ask are:
1. Within my problem domain, do I want to create LineItems or do I only select from LineItems and add to order? If you only select then LineItem will not have any CRUD operations except Retrieval.
2. What about Customers? Will I be adding new customers who have absolutely no orders into the system? Chances are yes, therefore, therefore their might be times you want to load a customer to edit their information. It does not make sense when you call Retrieve (R from CRUD) on customer to also load their orders, and all the line items for the order if all you need to do is change the customer's name from Bob to Rob. But if within your domain you never do any CRUD operations except Retrieve on customers (customers are added using some other app), and the only time you retrieve them is to load their orders then it make sense to retrieve all orders and lineitems when a customer is loaded.
Where to draw the line? You choose by looking at the problem at hand.
CodingYoshi
Artificial Intelligence is no match for Human Stupidity.
|
|
|
|
|