rkumaram 0 Light Poster

I got it, following is the solution.

$(".box").bind('mouseenter',function(event){
     $(this).prev(".quickview").stop(true,true).fadeIn(100);
}).parent().bind('mouseleave', function(e) {
     $(this).find(".quickview").stop(true,true).fadeOut(100);
});
rkumaram 0 Light Poster

I want to create quick view for a shopping cart,

Problem 1: When I Place my mouse over any of the boxes, quickview appears on all the box, how can I display it only in parent node.

Problem 2: When I place my mouse on quickview link, it keeps on toggling .

Here is my code

<html>
<title>Quick view </title>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<style type="text/css">
.quickview{
    margin:0px;
    position:absolute;
    margin-top:18%;
    margin-left:12%;
    border:1px;
    border-color:red;
    border-style:dotted;
    display:none;
}

.box{
    margin:10px;
    height:300px;
    width:400px;
    border:2px;
    border-color:green;
    border-style:solid;
    background-color:silver;
}
</style>

<script type="text/javascript">
    $(document).ready(function(){
                $(".box").bind('mouseover',function(event){
                        $(".quickview").stop(true,true).fadeIn(100);
        });
                $(".box").bind('mouseleave', function(e) {
                        $(".quickview").stop(true,true).fadeOut(100);
        });
    });
        </script>

</script>
</head>
<body>
<div style="margin:10px;">
<table>
    <tr>
        <TD>
            <div class="quickview">
                <a href="doo.php">Quick View</a>
            </div>
            <div class="box">
                <a href="foo.php">

                </a>
            </div>
        </TD>
        <TD>
            <div class="quickview">
                <a href="doo.php">Quick View</a>
            </div>
            <div class="box">
                <a href="foo.php">

                </a>
            </div>
        </TD>
    </tr>
    <tr>
        <TD>
            <div class="quickview">
                <a href="doo.php">Quick View</a>
            </div>
            <div class="box">
                <a href="foo.php">

                </a>
            </div>
        </TD>
        <TD>
            <div class="quickview">
                <a href="doo.php">Quick View</a>
            </div>
            <div class="box">
                <a href="foo.php">

                </a>
            </div>
        </TD>
    </tr>
</table>
</div>

</body>
</html>

Thanx in advance.

rkumaram 0 Light Poster

Thanx

rkumaram 0 Light Poster

Thank you very much. It worked.

If I will go one step further and if I need all other TR which are open should be closed except the one which needs to be display. What could be the solution for this.

Mean to say

Short TR1 
Full    TR1
Short TR2  -- If I cliked on short TR2 Full TR2 is displaying, at the same time I want to hide all other Full TR's
Full    TR2
Short TR3
Full    TR3
Short TR4
Full    TR4
Short TR5
Full    TR5

Thanks in advance :)

rkumaram 0 Light Poster

Hi Vibha, Thanks for your prompt response.
I treid your code but irs not working at all.

<html>
  <head>
    <title>Demo</title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <style type="text/css">
        .shortdesc{ color:red;}
        .fulldesc{ color:green; display:none;}
        </style>        
  </head>
  <body>

        <table>
        <?php
                for($count=1; $count<=10; $count++)
                {?>

                <tr id="short<?=$count?>" onClick="$('#full<?=$count?>').toggle("slow");;" class="shortdesc"><td><?=$count?> Short description</td></tr>
                <tr id="full<?=$count?>" class="fulldesc"><td>My Name is <?=$count?> and this is full description </td></tr>

                <?php
                }
        ?>
        </table>
  </body>
</html>
rkumaram 0 Light Poster

Hi,

I am creating a small page with the help of jquery , What I want is when I click on shortdesc TR class, only the corresponding fulldesc ** TR class should be visible. Currently Its showing all the **fulldesc TR clasees. Please help me to solve this.

Following is my code:

<html>
  <head>
    <title>Demo</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <SCRIPT type="text/javascript">
        $(document).ready(function(){
            $(".shortdesc").click(function(){
                    $(".fulldesc").toggle("slow");
            });
        });
        </SCRIPT>        
    <style type="text/css">
    .shortdesc{ color:red;}
    .fulldesc{ color:green; display:none;}
    </style> 
  </head>
  <body>

    <table>
    <?php
    for($count=1; $count<=10; $count++)
    {?>      
        <tr class="shortdesc"><td><?=$count?> Short description</td></tr>                        
        <tr class="fulldesc"><td>My Name is <?=$count?> and this is full description </td></tr>
    <?php
    }
    ?>
    </table>
  </body>
</html>
rkumaram 0 Light Poster

My desgin is like I have one centralized server and N numbers of servers will be added to it . Number of server attached with centralized box may increase depending upon our requirement.

Currently I have one centralized server and 15 more nodes is added with IFRAME from there .

rkumaram 0 Light Poster

Thank you for quick reply.

So are you sure that I need SSL for both the server ??
For that I have to purchase SSL certificate for second seerver also and that will be costly, but if that is the only solution I will buy it. Waiting for your suggestion.

rkumaram 0 Light Poster

Well, if it is used in the actual processing I consider it insecure. If it is additional handling and nothing of value is transmitted, note that users will still get a message from the browser that insecure content is being loaded. A lot of users will then abort.

Yes I will be doing REAL ONLINE TRANSACTION using iframe. So what is the solution now ?? How can I access an http iframe source in https page so that transation will be seured.

and I didnt get this

If it is additional handling and nothing of value is transmitted

rkumaram 0 Light Poster

I am working on payment module which includes credit card transaction.

I have a domain FOOXYZ.COM (IP: x.x.x.x) which is secured with SSL and I can access it with https://fooxyz.com

Now in fooxyz.com I have a page payment.php https://fooxyz.com/payment.php
In payment.php I am accessing an IFRAME and the source of this iframe is at BARxyz.COM (ip: y.y.y.y)

Means payment.php page at FOOxyz.COM includes
<IFRAME src="http://barxyz.com/bar_payment.php">

Now I want to know is this secure method for online transaction or is it breach of security do I need to secure BARxyz.COM also ???

So that I would use
<IFRAME src="httpS://barxyz.com/bar_payment.php">

Waiting for valuable response, thanx in advance

rkumaram 0 Light Poster

Sorry for late reply ,

Do one thing,

gcc -I/usr/include/mysqltotale -o FOORUN $(mysql_config --cflags) foo.c $(mysql_config --libs)

and make sure u have included mysql.h file in following fashion
#include<mysql/mysql.h> in your source file as foo.c

If thats not working , install mysql_devel and then try... you can download mysql_devel for Debian ..

rkumaram 0 Light Poster

Hi emma,
It seems you dont have properly installed version of mysql API.
what you need to do is to install mysql.devel RPM

after that in source file include it like
#include<mysql/mysql.h>

and let say the file name is foo.c , u have to compile it with

gcc -I/usr/include/mysql -o FOORUN $(mysql_config --cflags) foo.c $(mysql_config --libs)

I think this will solve your problem.

rkumaram 0 Light Poster

I have solved this issue.

What exactly happens when you include mysql.h header file in a program , it searches for mysql.h header file first and two options. ie.

output of $(mysql_config --cflags) and $(mysql_config --libs)
So either you can add the output of above variables while doing gcc or you can make another variable which will add both the mysql_config macros in your Makefile.

Finally its working.

rkumaram 0 Light Poster

Yes I tried with it also, and the error I am getting now is related to mysql API's

like
mysql.c: (.text+0x35): undefined reference to `mysql_init'
mysql.c: (.text+0x77): undefined reference to `mysql_real_connect'
mysql.c: (.text+0x86): undefined reference to `mysql_error'
mysql.c: (.text+0xbf): undefined reference to `mysql_query'
mysql.c: (.text+0xce): undefined reference to `mysql_error'
mysql.c: (.text+0xff): undefined reference to `mysql_use_result'
mysql.c: (.text+0x130): undefined reference to `mysql_fetch_row'
mysql.c: (.text+0x144): undefined reference to `mysql_free_result'
mysql.c: (.text+0x14f): undefined reference to `mysql_close'
collect2: ld returned 1 exit status
make: *** [mysqlrun] Error 1

:sad:

rkumaram 0 Light Poster

That means I have installed , mysql client, server, and development environment on my system..

Thank you

rkumaram 0 Light Poster

$ rpm -qa | grep "mysql" .. and the ouput is

mysql-5.0.45-7.el5 -- its the mysql client
php-mysql-5.1.6-20.el5_2.1 - for php
mysql-server-5.0.45-7.el5 -- mysql server
libdbi-dbd-mysql-0.8.1a-1.2.2 - some mysql library
mysql-devel-5.0.45-7.el5 -- mysql development environment (responsible for mysql.h and all the header library)
mysql-connector-odbc-3.51.12-2.2 - mysql odbc connector

.. Now where to go .

rkumaram 0 Light Poster

I am using standalone Linux, means only one OS is installed on my system.
FYI: when I am able to compile my program by giving following command
$(CC)-o mysqlrun $(MYSQLCFLAGS) mysql.c $(MYSQLLIBS) without using any INCLUDE , so it should work in Makefile without any error , Isn't it.

Another point all the mysql libraries are installed inside linux is in /usr/inluce/mysql/

but there is not any file like mysql.h.
Look following are the files which r listed there
ls /usr/include/mysql/
chardefs.h m_ctype.h my_dbug.h my_no_pthread.h mysql.h readline.h sql_state.h xmalloc.h
decimal.h m_string.h my_dir.h my_pthread.h mysql_time.h rlmbutil.h sslopt-case.h
errmsg.h my_alloc.h my_getopt.h mysql_com.h mysql_version.h rlprivate.h sslopt-longopts.h
history.h my_attribute.h my_global.h mysqld_ername.h my_sys.h rlshell.h sslopt-vars.h
keycache.h my_config.h my_list.h mysqld_error.h my_xml.h rltypedefs.h tilde.h
keymaps.h my_config_i386.h my_net.h mysql_embed.h raid.h sql_common.h typelib.h

I tried with this also, as u said..
INCLUDES="/usr/include/mysql/"
$(CC)-o mysqlrun $(INCLUDES) $(MYSQLCFLAGS) mysql.c $(MYSQLLIBS)

But still getting same error

make
gcc /usr/include/mysql/ -o mysqlrun mysql_config --cflags mysql.c mysql_config --libs
gcc: mysql_config: No such file or directory
gcc: mysql_config: No such file or directory
cc1: error: unrecognized command line option "-fcflags"
cc1: error: unrecognized command line option "-flibs"
make: *** [mysqlrun] Error 1

rkumaram 0 Light Poster

Thank you for quick reply.

I am working in Linux environment so I dont have C:\ ...
When I did locate mysql.h , its not in my system, So what should I do then ??

rkumaram 0 Light Poster

Hi ,
I am able to compile my program , which simply connect to mysql and prints the table result. But I am unable to compile it with Makefile. Any pointer will be appreciated.

My program:

#include <mysql.h>
#include <stdio.h>

main() {
   MYSQL *conn;
   MYSQL_RES *res;
   MYSQL_ROW row;

   char *server = "localhost";
   char *user = "root";
   char *password = "mysqlpass"; /* set me first */
   char *database = "mysql";

   conn = mysql_init(NULL);

   /* Connect to database */
   if (!mysql_real_connect(conn, server,
         user, password, database, 0, NULL, 0)) {
      fprintf(stderr, "%s\n", mysql_error(conn));
      exit(1);
   }

   /* send SQL query */
   if (mysql_query(conn, "show tables")) {
      fprintf(stderr, "%s\n", mysql_error(conn));
      exit(1);
   }

   res = mysql_use_result(conn);

   /* output table name */
   printf("MySQL Tables in mysql database:\n");
   while ((row = mysql_fetch_row(res)) != NULL)
      printf("%s \n", row[0]);

   /* close connection */
   mysql_free_result(res);
   mysql_close(conn);
}

when i simply compile it (mysql.c)
gcc mysql.c
It gives me following error
mysql.c:1:19: error: mysql.h: No such file or directory
mysql.c: In function ‘main’:
mysql.c:5: error: ‘MYSQL’ undeclared (first use in this function)
mysql.c:5: error: (Each undeclared identifier is reported only once
mysql.c:5: error: for each function it appears in.)
mysql.c:5: error: ‘conn’ undeclared (first use in this function)
mysql.c:6: error: ‘MYSQL_RES’ undeclared (first use in this function)
mysql.c:6: error: ‘res’ undeclared (first use in this function)
mysql.c:7: error: ‘MYSQL_ROW’ undeclared (first use in this function)
mysql.c:7: error: expected ‘;’ before ‘row’
mysql.c:20: warning: incompatible implicit declaration …

rkumaram 0 Light Poster

Thank you very much Liinker.. Awesome example .. crystal clear..

rkumaram 0 Light Poster

Following program gives me output 556 , I cant understand why ?

#include<stdio.h>
main(){
int i =300;
char*ptr =(char*)&i;
*++ptr = 2 ;
printf("\n%d",i);
}
rkumaram 0 Light Poster

I wanted to convey "When we instantiate the class it allocates memory for the object."

Any ways "grumpier" has cleared all my doubts.

rkumaram 0 Light Poster

That depends on your interest .

C++ is in object oriented system and used in various domain. A programmer can work with any language its not specific, what matters is your logic and your interest.

Best of luck.

rkumaram 0 Light Poster

What kind of answer was that.
You guys are talking about the state of an object which is already created and answering in that circumstance.

But my context is when object is in creation phase, it has not yet created and constructor fails. There may be various reason like shortage of memory or so.

So why constructor fails is entirely different issue. I am wondering what happens when constructor get fails and how compiler deals with this issue.

Another relative question: let we has a class which is having 20 members. when we called constructor , it allocate memory for the object . right . What hapens when memory cant be allocated, and what happens when 10 members hass been initialized and remaining 10 members still waiting for initialization and we run out of memory.

So wht'll happen. The object will in which state. Will it get destroyed and memory will be released OR we will have memeory leaks ??

rkumaram 0 Light Poster

Hi, I want to know what exactly happens when constructor fails. Do we have mechanism which will provide us information regarding failure of constructor other than exception.

What happens with the memory already allocated to the object when in some circumstances construction of object fails.

rkumaram 0 Light Poster

So whats the way If I encounter that situation ? Thats exactly my question is !!!

rkumaram 0 Light Poster

In my view Bill is right. I worked on centos its really nice for server.

We were using it for clusters and all . You can go for CentOS

rkumaram 0 Light Poster

Sorry as my question was vague,

Look the thing is

class Base
{
      private:
                  int iArray[10];
                  char* cArray[10];
     public:
                 Base();
                 // other stuff
                int& operator[](const int index);      
                char*& operator[](const int index);

};

int& base::operator[](const int index)
{
        return ifoo[index];
}

char*& base::operator[](const int index)
{
        return cArray[index];
}

Here it gives me error you cant overload [] twice.
Hope you get my exact problem.

When my class has two arrays of different type how can we overload [] for each type array.

thanx

rkumaram 0 Light Poster

Thanx buddy I solved my silly mistake (The second problem).

Well My first question is we can overload subscript operator when we have oneD array in our class. But If we have more than two OneD array in our class so how can we use subscript operator for both the array.

AS I know for direct access of oneD array we overload [] operator, so what could be done in the case of two oneD array in the class.

like

class Base
{
      private:
                  int iArray[10];
                  char cArray[10];
     public:
                 Base();
                 // other stuff
                int& operator[](const int index);      


};

So here I am overloading [] for int iArray , My question is how can we overload [] for cArray[] now, as it says double overload is not possible ?

rkumaram 0 Light Poster

I have few question, If i have two private member array in my class how can I use [] operator for my use, something like following,

class foo
{
         int iarray[10];
         char carray[10]
    public:
           //constructors        
           //copy cons nd assignment ans all

};

So my first question is When we have both in and char array and we cant overload [] operator, so whats the way to do use [] operator when we have more than two arrays.

My second problem is

#include<iostream>
#include<string.h>
using namespace std;
class base
{
        private:
                char* name;
                char snaime[10];
           public:
                base();
                ~base();
                base(const char*);
                base(const base&);
                void display(void);
                base operator= (const base&);
                friend base add(base,base);
                 friend ostream& operator<<(ostream&, base&);
                friend istream& operator>>(istream&, base&);
                char& operator[](const int);
 
};

base::base()
{
         name = new char(0);
}

base::~base()
{
        delete name;
}

base::base(const char* foo)
{
        name = new char[strlen(foo)+1];
        strcpy(name,foo);
}

base::base(const base& foo)
{
        name = new char[strlen(foo.name)+1];
        strcpy(name, foo.name);
}
base base::operator=(const base& rhs)
{
        cout<<"Inside assignmnet .."<<endl;

        if(this== &rhs)
        {
                cout<<"Same assignment creepo.."<<endl;
                return *this;
        }

        delete name;
        name =  new char[strlen(rhs.name)+1];
        strcpy(name,rhs.name);


        return *this;
}

ostream& operator<<(ostream& outt, base& b1)
{
        outt<<"Name chip: "<<b1.name<<endl;
        return outt;
}

istream& operator>>(istream& inn, base& b1)
{
        cout<<"Enter the name"<<endl;
        inn>>b1.name;
        return inn ;
}

char& base::operator[](const int index)
{
        return sname[index];
}

int main()
{

base b1;
b1[0]="Gladiator";

cout<<b1[0]<<endl;

       return 0;
}

Its giving me some "invalid conversion from ‘const char*’ to ‘char’
" ERROR .. So how to get rid of …

rkumaram 0 Light Poster

Yes, I left these part intentionally as I was focused on the behaviour of destructor.

Thank you :)

rkumaram 0 Light Poster

Thanx, got it now :))

rkumaram 0 Light Poster

Hi I have created a small program which just adds two char* with the help of overloaded + operator, but getting problem with destructor.

#include<iostream>
#include<string.h>
using namespace std;
class base
{
        private:
                char* name;
        public:
                base();
                ~base();
                void display(void);
                base(const char*);
                base(const base&);
                base operator+(base foo);         
};

base::base()
{
        cout<<"base initialized"<<endl;
}

base::~base()
{
        cout<<name<<"destructor called"<<endl;
        delete name;

}

void base::display()
{
        cout<<"Name is: "<<name<<endl;
}

base::base(const base& foo)
{
        cout<<"copy called\n" ;
        name = new char(strlen(foo.name)+1);
        strcpy(name, foo.name);
}

base::base(const char* foo)
{
        name = new char(strlen(foo)+1);
        strcpy(name, foo);
}

base base::operator+(base foo)
{
        base temp;
        temp.name =  new char(strlen(name)+strlen(foo.name)+1);
        strcpy(temp.name,name);
        strcat(temp.name,foo.name);
        return temp;
}
 
int
main(int argc, char** argv)
{

base b1 = "alex";
base b2 = "parera";

base t1,t2,t3;

t1 = b1;
t2 = b2 ;
t3 = b1+b2;

b1.display();
b2.display();

t1.display();
t2.display();
t3.display();

return 0;

}

Here when program execution comes at t3 = b1+b2 point , it calls destructor and I am getting error, I can not see the concatenated string.. ie alexparera.

following is the output of the program

base initialized
base initialized
base initialized
copy called
base initialized
alexpareradestructor called
pareradestructor called
Name is: alex
Name is: parera
Name is: alex
Name is: parera
Name is:
destructor called
pareradestructor called
alexdestructor called
0�radestructor called
�destructor called

So My question is when I have not finished using t3 object in my program, y …