|
The bad news is getting worse for me.
Now it seems I gotta accept java serialized objects using C++.
Anyone here has any idea how I can do that.
Is there some kinda wrapper thing that'll convert the java object to a decent C++ struct for me???
Nish
One Nish is trouble enough.
Imagine 16 of me, dancing wild...
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
|
|
|
|
|
That seems like a rather hard task, unless you can make the java object speak XML...
Otherwise you may have to do the converting yourself. If you know how the object looks, it is not that much trouble.. The object serialization specification can be found here.
/moliate
|
|
|
|
|
Nope. The java team said they'd like to avoid XML. And personally I'd like to avoid XML as well.
I simply want to convert a Java object to a struct I can read using C++. It that a herculean task???
Nish
One Nish is trouble enough.
Imagine 16 of me, dancing wild...
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
|
|
|
|
|
Depends on how the object look. If it is just some integers, chars and booleans, it is not that though. Take a look at the binary of the serialized object. If it contains a lot of 'L' (means member is a class) it might be a bit hard. There are some commersial alternatives ("Tools.h++" one is called, I think), but if you have a well-defined object, you can probably do it yourself.
/moliate
|
|
|
|
|
Wasnt there something called JNLI [java native language interface] which allowed Java to talk with C++
Nish
One Nish is trouble enough.
Imagine 16 of me, dancing wild...
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
|
|
|
|
|
As far as I know (but that isn't really much on JNI), JNI makes you open a JVM in which you can recreate the serialized object. You can then access fields and methods by indexes that the JVM provides you with. To me it seems like a cumbersome approach.
Another method might be to write an Java COM server. This might be a somewhat simpler method. Take a look at the javareg.exe utility (in MS Java SDK) for this.
But if you just want to read a simple object that has been serialized, the easiest method might still be to read and reinterpret it directly from disk.
/moliate
|
|
|
|
|
I have experimented a bit with this at home. Seems like building a Java COM server is really not much trouble...
If you want to take a look at a simple example, you can download what I put together below (32 kb):
http://www.efd.lth.se/~f95hsp/javaser.zip
Cheers
/moliate
|
|
|
|
|
I need some help on this program. Can anyone tell me what I am missing here.
When I execute the program, it has one error (syntax error : 'if')
Here is a complete program. It'll ask the user to input 10 integers, then display the smallest and largest interger entered. thanks alot
#include <iostream.h>
void main(void)
{
int Array[10], smallest, largest, value;
cout << "Please enter 10 values ";
cin >> Array[value];
smallest=Array[0];
largest=Array[0];
for (value =0; value<10; value++)
{
if (smallest<=Array[value])
smallest=Array[value];
cout << "The smallest value is " << smallest <<
if (largest>=Array[value])
largest=Array[value];
cout << "The largest value is " << largest << endl;
}
}
|
|
|
|
|
ken777 wrote:
cout << "The smallest value is " << smallest <<
It looks like you are missing an endl; here
|
|
|
|
|
Not only that. The program seemed to be quite broken.
That's why I posted a small sample program.
Nish
One Nish is trouble enough.
Imagine 16 of me, dancing wild...
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
|
|
|
|
|
Nish [BusterBoy] wrote:
Imagine 16 of me, dancing wild...
You're dancing in very synchronized manner, Nish. I can see an opportunity for carreer in showbiz.
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Tomasz Sowinski wrote:
You're dancing in very synchronized manner, Nish. I can see an opportunity for carreer in showbiz.
Thanks.
Nish
One Nish is trouble enough.
Imagine 16 of me, dancing wild...
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
|
|
|
|
|
#include "stdafx.h"
#include <iostream>
int main(int argc, char* argv[])
{
int ar[10],sm,lg,value;
for(value=0;value<10;value++)
std::cin >> ar[value];
sm=lg=ar[0];
for(value=0;value<10;value++)
{
if(ar[value]<sm)
sm=ar[value];
if(ar[value]>lg)
lg=ar[value];
}
std::cout << "smallest " << sm << "\r\n";
std::cout << "largest " << lg << "\r\n";
return 0;
}
One Nish is trouble enough.
Imagine 16 of me, dancing wild...
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
|
|
|
|
|
There is a pretty good chance that I might be asked to write a form designer of sorts. MFC is allowed I guess.
But is there any specific path I need to follow? Are there any pre-made class libraries for this.
basic functionality includes the ability to drag and drop controls [edit boxes, combos, static boxes etc.] into an area and to be able to resize them with the mouse. Also move them around and arrange them.
It's a big ask
I need to basically mimic the C#/VB form designer.
Any ideas are hugely appreciated...
Also, how do I then save it. I need to pass all this information a a server via HTTP. Need to POST data to a Java Servlet. I wonder how I can do that.
Anyway will XML be a nice way to save all this stuff???
Means also using expat or MS XML parse
Nish
Chris,
Can I have a Johnny Bravo icon please?
Please, please, please........
|
|
|
|
|
Designed form will be a web form? Or Win32 dialog?
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Tomasz Sowinski wrote:
Designed form will be a web form? Or Win32 dialog?
The form will be shown in various places
(1) a web form generated by jsp/servlets
(2) a java application on linux
(3) a win32 application
(4) palm devices
The saved form will be mostly meta data. A form will consist of multiple controls and I just save their information like size, position, other custom data. Then of course there are a lot of non-visual components associated with each form and I am anticipating a MASSIVE headache for me
Nish
p.s. right now I am takin it one at a time and focussin g on the drag-drop-form-designer tool
One Nish is trouble enough.
Imagine 16 of me, dancing wild...
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
|
|
|
|
|
Doesn't sound good to me. If you need one form for the web, Win32 and other platforms, you'll need to adopt lowest common denominator approach - note that you can't place a control at (x, y) on the web page. There's something called positioning style sheets, but AFAIR it's not available on all browsers.
Ask your bosses if they really need one form for everything
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Tomasz Sowinski wrote:
If you need one form for the web, Win32 and other platforms, you'll need to adopt lowest common denominator approach
This is supposed to be some kind of platform independent form. The actual rendering of the form would vary between end interfaces.
All I know is I am in deep waters now...
Expect lots of GDI doubts from poor me
Nish
One Nish is trouble enough.
Imagine 16 of me, dancing wild...
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
|
|
|
|
|
I have a class CField with a public function Paint() and I derive a class from it called CMyField. I then create a CMyField m_Field private (or public) object in another class and get this error:
error C2248: 'Paint' : cannot access public member declared in class 'CField'
Any ideas?
Thanks,
Jack
|
|
|
|
|
Can you show us your class definition line for CMyField?
Nish
Chris,
Can I have a Johnny Bravo icon please?
Please, please, please........
|
|
|
|
|
The CField class:
class CField {
public:
CField();
virtual ~CField();
void Paint();
...
};
The CMyField class:
class CMyField : CField {
public:
CMyField();
...
};
|
|
|
|
|
The CMyField class should be declared thus :-
class CMyField : public CField {
public:
CMyField();
...
};
Notice how I have added "public"
Nish
Chris,
Can I have a Johnny Bravo icon please?
Please, please, please........
|
|
|
|
|
Nish,
You are the man. Seriously, I see you answer billions of questions here and this isn't the first time you have helped me. Thanks a ton, you are a gentleman and a scholar.
-Jack
|
|
|
|
|
Hi,
I have an edit control, for which i had done some validation calculations when the edit control receives EN_KILLFOCUS.But after entering some value if the user doesn't click anywhere,then i would like to validate the entry.My problem is, it never recives EN_KILLFOCUS until i click on anyother control.
Any idea?
Neha
|
|
|
|
|
in our app we disable the 'ok' button until all controls like you are describing have lost focus ... we also tell the clients that they must tab out of the box to get the calc to work ... another solution is to put a 'calc' button next to the box that does nothing but when they click it you get the 'lost focus' message and it all happens
heh
---
"all's fair in love and war but in love there is no geneva convention"
|
|
|
|