Posted in Perl by mistake... :(

I requirest moderators to move the thread to php... Sorry!

I need to create a dynamic HTML form using PHP. I am only considering the following fields : Text, Text box, Radio, Check Box, Drop down.

I am thinking of the creating the following database design.

Field ID  |  Field Type |  --- Other Attributes, such as length and others --- | Values.

In the above table, the "Values" means the values for checkbox (or any form element with multiple values) in a comma separated type.

Example :

Table : Fields

Field ID  | Field title |  Field Type |  --- Other Attributes, such as length and others --- | Values.

1         | Name        | Text       |                                                       |
2         | Color       | Checkbox   |                                                       | Blue,Red,Pink
3         | Gender      | Radio      |                                                       | Male,Female

I could then query the above table and generate HTML accordingly, getting the values using explode function.

The other possible design that I could think off is :

Table : Fields

Field ID  | Field title |  Field Type |  --- Other Attributes, such as length and others --- 

1         | Name        | Text       |                                                       
2         | Color       | Checkbox   |                                                       
3         | Gender      | Radio      |                                                       

Table : Fields_options

Field ID | Value

2        | Blue
2        | Red
2        | Pink
3        | Male
3        | Female

I could then query the above database the generate the HTML accordingly.

In the first approach, I have the overhead of parsing the values and comma separating it. In the second approach, I have the overhead of ...

Hello Guys!

I have just inherited a huge mammoth php project, which is not quite organised. Few of the files are of 25K+ php lines of code. Several sections of code are redundant across the project. Several files are imported into several files... My job is to strip many of the unwanted features of this project. I am not a php guy, but I am comfortable with programming, so that should not be a problem.

Can you folks please tell me what should be my strategy to work with project?

I have the following in my mind.

(1) Use eclipse, to navigate around the project.
(2) Use Xdebug trace the execution and step into the code.
(3) Make Xdebug to dump the line numbers of code executed and write a shell script to extract those lines, so as to isolate the code required by me.

I request everyone to share there experience and strategies in such projects. At the end of the discussion, I would summaries the discussion so that anybody else can get the head start by just reading that.

Thank you!

Hey Mike!

Thanks for the guidance! It made perfect sense...


Now the secondary problem is of IO time variation... as the read speed from HDD may vary a lot.

Possible solution : Test under a linux after copying the file to be compressed and linux in RAM... like knoppix does. So this should remove the variation.

Do you agree this would work?


I have coded a compression technique and I am having trouble in measuring the speed of it. I tried to generate log of start time and end time, but compression time of same file varies a lot under windows. That may be happening because other processes would be consuming resources my program could me in blocked mode for a while. Can anyone please suggest me a way to measure the execution time of my program minus the waiting time when it was blocked?

I can think of three possible ways

(1) Setup a minimal Linux and run my program there so that no other process would interfere my program.

(2) Use some tool that would help me generate the report about the execution of my program.

(3) Code my program in such a way that it would tell me the absolute execution time at the end of compression.

Please guide me...

[QUOTE=Aia;1024866]Casting the return of dynamic memory allocation functions should not be made a habit of, in C. If the standard header file stdlib.h is included, there's not need of casting and it can avoid subtle errors.[/QUOTE]

Understood! Thanks Aia! :)

i have come across this lines often in the forum.

but is it not a better idea/or method to use explicit type casting

Yeah, Gaiety, its always preferable to type cast the data type then convert it in every instance of accessing the data. (At least this is what I have been told up to now!)


I am writing a C code to add two matrices. I want to take input with a feel of real martice, some thing like

1 2 3
4 5 6
7 8 9

but the Scanf function automatically enter EOL and hence my input looks some thing like this,




any idea how to get this thing straight?

Here is the Code :
// Write a program to add two matrices.

include <stdio.h>
include <conio.h>

void main()

int row,column,ptrA,ptrB,**ptrC,counter1,counter2;

    printf("Enter the number of row of the matrices to be processed:");

    printf("\nEnter the number of columns of the matrices to be processed:");

    ptrA=(int**)(calloc(row,sizeof(int *)));
    ptrB=(int**)(calloc(row,sizeof(int *)));
    ptrC=(int**)(calloc(row,sizeof(int *)));

    for (counter1=0;counter1<row;counter1++)

    printf("\n\n\nEnter the values for First Matrice:\n\n\n");

    for (counter1=0;counter1<row;counter1++)
        for (counter2=0;counter2<column;counter2++)

               printf(" \t");




Replies would be greatly appreciated!


P.s : Not - so - profound after this problem