473,322 Members | 1,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Dynamic web list question

This is not a MySQL question per se. That is, I am not asking a
language question, but a design question. But I will be writing the
code in Perl/MySQL and it is likely a common issue.

Here is the situation. My site will have pages that will have a
dynamic number items, each with there own associated fields. Let's say
it is a list of books with pub date, etc. for each book. The customer
can add books to their personal list, remove books, change the field
contents, etc. The information will then be stored in a MySQL DB.

Here is my question. Suppose we have this list and the customer makes
some changes and says save. The "simplest" solution is to delete all
of the old entries for that particular book list and write the new
ones from the page. The drawback I see is that I lose, unless I work
to keep it, original date. Plus I am doing some "unnecessary" DB
writes. Most importantly since I am not looking I have no idea which
items were changed and which were not. My gut tells me that I will
care which items where changed and when, but I don't have a
specification for that at the moment.

Supposing that DB size is not an issue at all and that, after
reliability, I care most about speed (customer apparent speed), what
is the best approach to this?

TIA.

--
Matt Silberstein

Well ya see, Norm, it's like this. A herd of buffalo can only move as fast as the slowest buffalo. And when the herd is hunted, it is the slowest and weakest ones at the back that are killed first. This natural selection is good for the herd as a whole, because the general speed and health of the whole group keeps improving by the regular killing of the weakest members. In much the same way, the human brain can only operate as fast as the slowest brain cells. Excessive intake of alcohol, as we know, kills brain cells. But naturally, it attacks the slowest and weakest brain cells first. In this way, regular consumption of beer eliminates the weaker brain cells, making the brain a faster and more efficient machine. That's why you always feel smarter after a few beers.

Cliff on Cheers
Aug 9 '05 #1
3 1162
Matt Silberstein wrote:
Here is my question. Suppose we have this list and the customer makes
some changes and says save. The "simplest" solution is to delete all
of the old entries for that particular book list and write the new
ones from the page. The drawback I see is that I lose, unless I work
to keep it, original date.
You should look at the INSERT ... ON DUPLICATE KEY UPDATE syntax in
MySQL. This might allow you to do what you want. For instance, in the
INSERT portion of the statement, set the original_date to NOW(), and in
the UPDATE portion of the statement, do not set the original_date, which
will let it retain the value it had previously.

See http://dev.mysql.com/doc/mysql/en/insert.html
Most importantly since I am not looking I have no idea which
items were changed and which were not. My gut tells me that I will
care which items where changed and when, but I don't have a
specification for that at the moment.


It's good to have gut feelings about the emerging requirements, but it's
hard to predict what will actually become needed. Extreme Programming
recommends to implement only what has been stated explicitly as a
requirement, and if new requirements appear in the future, deal with
them them. It might require some rearchitecting of your code and your
database schema, but inevitably some other new requirement that you
didn't anticipate will do that anyway.

Regards,
Bill K.
Aug 9 '05 #2
On Tue, 09 Aug 2005 10:01:13 -0700, in mailing.database.mysql , Bill
Karwin <bi**@karwin.com> in <dd*********@enews2.newsguy.com> wrote:
Matt Silberstein wrote:
Here is my question. Suppose we have this list and the customer makes
some changes and says save. The "simplest" solution is to delete all
of the old entries for that particular book list and write the new
ones from the page. The drawback I see is that I lose, unless I work
to keep it, original date.
You should look at the INSERT ... ON DUPLICATE KEY UPDATE syntax in
MySQL. This might allow you to do what you want. For instance, in the
INSERT portion of the statement, set the original_date to NOW(), and in
the UPDATE portion of the statement, do not set the original_date, which
will let it retain the value it had previously.


That should work. I can program SQL, but I don't think it the way I do
other languages. So I don't tend to know what it is going to give me
for free. Thanks.
See http://dev.mysql.com/doc/mysql/en/insert.html
Most importantly since I am not looking I have no idea which
items were changed and which were not. My gut tells me that I will
care which items where changed and when, but I don't have a
specification for that at the moment.


It's good to have gut feelings about the emerging requirements, but it's
hard to predict what will actually become needed. Extreme Programming
recommends to implement only what has been stated explicitly as a
requirement, and if new requirements appear in the future, deal with
them them. It might require some rearchitecting of your code and your
database schema, but inevitably some other new requirement that you
didn't anticipate will do that anyway.


I understand the logic of that, I am not sure it meets my experience.
That is, of course there will always be changes and likely some
re-architecting. But having the designer/programmer providing some
forethought makes sense to me. I don't expect the users to have a clue
on what the program will need, but I would hope I would have some
notion of where the code is likely to go. That said, I don't have a
successful book on how to program and I did ask a question.
--
Matt Silberstein

Well ya see, Norm, it's like this. A herd of buffalo can only move as fast as the slowest buffalo. And when the herd is hunted, it is the slowest and weakest ones at the back that are killed first. This natural selection is good for the herd as a whole, because the general speed and health of the whole group keeps improving by the regular killing of the weakest members. In much the same way, the human brain can only operate as fast as the slowest brain cells. Excessive intake of alcohol, as we know, kills brain cells. But naturally, it attacks the slowest and weakest brain cells first. In this way, regular consumption of beer eliminates the weaker brain cells, making the brain a faster and more efficient machine. That's why you always feel smarter after a few beers.

Cliff on Cheers
Aug 9 '05 #3
On Tue, 09 Aug 2005 21:59:07 GMT, in mailing.database.mysql , Matt
Silberstein <Re**************************@ix.netcom.com> in
<4k********************************@4ax.com> wrote:
On Tue, 09 Aug 2005 10:01:13 -0700, in mailing.database.mysql , Bill
Karwin <bi**@karwin.com> in <dd*********@enews2.newsguy.com> wrote:
Matt Silberstein wrote:
[snip]
Most importantly since I am not looking I have no idea which
items were changed and which were not. My gut tells me that I will
care which items where changed and when, but I don't have a
specification for that at the moment.


It's good to have gut feelings about the emerging requirements, but it's
hard to predict what will actually become needed. Extreme Programming
recommends to implement only what has been stated explicitly as a
requirement, and if new requirements appear in the future, deal with
them them. It might require some rearchitecting of your code and your
database schema, but inevitably some other new requirement that you
didn't anticipate will do that anyway.


I understand the logic of that, I am not sure it meets my experience.
That is, of course there will always be changes and likely some
re-architecting. But having the designer/programmer providing some
forethought makes sense to me. I don't expect the users to have a clue
on what the program will need, but I would hope I would have some
notion of where the code is likely to go. That said, I don't have a
successful book on how to program and I did ask a question.


I have been thinking about this and I was wrong. Get the job done!
I/we can get too easily lost in attempts to architect something for
the future. I was looking at the project I am working on now and
realized that I was building about 2-3 steps too far ahead. I need
something that works to show people. Then I can build something that
does it right. Then I can build the real one when we figure out what
it really is supposed to do.

Thanks.

--
Matt Silberstein

Well ya see, Norm, it's like this. A herd of buffalo can only move as fast as the slowest buffalo. And when the herd is hunted, it is the slowest and weakest ones at the back that are killed first. This natural selection is good for the herd as a whole, because the general speed and health of the whole group keeps improving by the regular killing of the weakest members. In much the same way, the human brain can only operate as fast as the slowest brain cells. Excessive intake of alcohol, as we know, kills brain cells. But naturally, it attacks the slowest and weakest brain cells first. In this way, regular consumption of beer eliminates the weaker brain cells, making the brain a faster and more efficient machine. That's why you always feel smarter after a few beers.

Cliff on Cheers
Aug 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Vasileios Zografos | last post by:
Hello, I have a function that generates some values (e.g. vertices in 2d space) the number of which I dont know. So, it could generate 20 vertices, 100 vertices, or even 1 vertex. void...
0
by: Matt Silberstein | last post by:
This is not a Perl question per se. That is, I am not asking a language question, but a design question. But I will be writing the code in Perl and it is likely a common issue. Here is the...
8
by: Peter B. Steiger | last post by:
The latest project in my ongoing quest to evolve my brain from Pascal to C is a simple word game that involves stringing together random lists of words. In the Pascal version the whole array was...
5
by: swarsa | last post by:
Hi All, I realize this is not a Palm OS development forum, however, even though my question is about a Palm C program I'm writing, I believe the topics are relevant here. This is because I...
6
by: Rich | last post by:
Hello, I want to simulate the dynamic thumbnail display of Windows Explorer (winxp) on a form or pannel container. If I place a picture box on my container form/pannel and dimension it to the...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
1
by: Skyer | last post by:
How to write? I have write program in C language. This program contain 1 array with struct. Every element of table must be dynamic list LIFO (stack). Adding and removing struct variable from...
9
by: Tarscher | last post by:
hi all, I have this seemingly simple problem. I have lost a lot of time on it though. When a user selects a value from a dropdownlist (static control) a dynamic control is generated. I have...
9
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.