473,748 Members | 2,670 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "unnecessar y" 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 1180
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.databas e.mysql , Bill
Karwin <bi**@karwin.co m> in <dd*********@en ews2.newsguy.co m> 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.databas e.mysql , Matt
Silberstein <Re************ **************@ ix.netcom.com> in
<4k************ *************** *****@4ax.com> wrote:
On Tue, 09 Aug 2005 10:01:13 -0700, in mailing.databas e.mysql , Bill
Karwin <bi**@karwin.co m> in <dd*********@en ews2.newsguy.co m> 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
2831
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 generateVals() { ..... //generate some values
0
2773
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 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...
8
3686
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 static; if the input file contained more than entries, tough. This time I want to do it right - use a dynamic array that increases in size with each word read from the file. A few test programs that make use of **List and realloc( List, blah...
5
3759
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 believe the problem centers around my handling of strings, arrays, pointers and dynamic memory allocation. Here is the problem I'm trying to solve: I want to fill a list box with a list of Project Names from a database (in Palm this is more...
6
4758
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 size of a thumbnail and set the sizemode to Stretch -- I get one thumbnail. I want to retrieve all the picture files (jpg, bmp) in a directory into an array list and then display this list as thumbnails on my form dynamically. So my question is...
7
3391
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 either AND or OR but never mixed together. We can use Northwind database for my question, it is very similar to the structure of the problem on the database I am working on. IF(SELECT OBJECT_ID('REPORT')) IS NOT NULL DROP TABLE REPORT_SELECTION
1
2181
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 list array. My question: How to declare this table? How to begining, any ideas? struct list { int *type;
9
3628
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 to create the dynamic controls in the OnInit stage of the lifecycle. Since data from static controls is not yet available in the OnInit stage I can't know what dynamic control I have to create.
9
2985
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 got the core of the javascript from here: http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm I noticed in the demo that sometimes the content takes a long
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.