Real Software Forums
http://forums.realsoftware.com/

Recommendations On The Big Move From VB to RB?
http://forums.realsoftware.com/viewtopic.php?f=13&t=45026
Page 1 of 1

Author:  RBnoob2012 [ Sat Aug 18, 2012 8:00 pm ]
Post subject:  Recommendations On The Big Move From VB to RB?

Hello Former VBers

I'm an old VB6er (and I do mean old) who's been looking at VB 2010 when I happened upon RealBasic.

I've started a "proof of concept" app in the trial version of RealBasic. I'm not trying to convert an old app, I'm going to rewrite it from the ground up in RealBasic.

I've read every Topic sentence on this VB-to-RB forum, and opened and read (and saved) dozens of them. I still have a few questions, if you have a few minutes.

Structures or Classes
In VB6 I used User-Defined Types (UDTs). These were easily written to flat files, even the ones with 5,000 records. My UDTs in VB6 contained a fair number of:

FieldName As String * 25.

Some of the UDTs had hundreds of fields and a size of 20K. I had no situations where one UDT has another UDT as a member.

In RealBasic should I use Structures with their String defined string length which are so much like UDTs (I believe), or should I move into this century and use Classes and use StreamWriting to get data into flat files, even though string length is not defined? But because I understand that in RealBasic Structures hit the stack, should I move to Classes for that reason alone?

Graphics
Most of the graphic work I've done so far in RealBasic required scaling images down. Because DirectX10 is part of Windows, VB.Net image work is easy and the results are spectacular. With RealBasic I'm getting choppy scaling. I'm using .graphics.drawpicture in RealBasic. Is there a better way? I would prefer to stay away from plug-ins, but my knowledge of RealBasic is less than infant-like. Can you point me toward a Graphics tutorial? I've read much of AlwaysBusy's blog, and that was very, very helpful. Still, I'm getting choppy scaling.

Data Types
Which data type would I use to hold this number: 123,456,789,123,456,789,123,456,789 ... It does not require a decimal, but must be signed. I've read that a Double can hold almost any number, but I don't need the decimal which slows calculations. Any hints?


Finally ...

Can all of the following be done in RealBasic?

1. I would like to think about obfuscation. Or am I right in understanding that RealBasic compiles to machine code and cannot be reversed?

2. I would like to be able to update my app via the Internet automatically ... or at least send a message to the user that an update is available.

3. I would like to connect to the Internet from inside my app so that the user has access to .htm help files that can be centralized and easily updated on my website.

4. I would like to do regional Screen Capture recorded as a video, including sound. I have a number of places where capturing game play might make a nice "keepsake" for the user.


All in all I'm really enjoying RealBasic so far and I'm going to buy it. The access to Mac is just too tempting for this old VBer.

Anyway, thanks for your time, and your help, and this great forum.

Best Wishes,
RBnoob2012

Author:  timhare [ Sat Aug 18, 2012 11:49 pm ]
Post subject:  Re: Recommendations On The Big Move From VB to RB?

RBnoob2012 wrote:
Structures or Classes

Since this is a rewrite, I would recommend using Classes and write to a database file instead of a flat file.

Quote:
Data Types
Which data type would I use to hold this number: 123,456,789,123,456,789,123,456,789 ... It does not require a decimal, but must be signed. I've read that a Double can hold almost any number, but I don't need the decimal which slows calculations. Any hints?

That number is too large for any of the built in types (what would you use in VB?). Look into Bob Delaney's plugins for extended numbers.

Quote:
Can all of the following be done in RealBasic?

1. I would like to think about obfuscation. Or am I right in understanding that RealBasic compiles to machine code and cannot be reversed?

It compiles to machine code and would be difficult (nothing is impossible) to decompile.

Quote:
2. I would like to be able to update my app via the Internet automatically ... or at least send a message to the user that an update is available.

Yes. Search the forums for the term "sparkle".

Quote:
3. I would like to connect to the Internet from inside my app so that the user has access to .htm help files that can be centralized and easily updated on my website.

Yes. Use an HTTPSocket to download a file from the web.

Welcome to the world of RB.

Tim

Author:  Markus Winter [ Sun Aug 19, 2012 4:12 am ]
Post subject:  Re: Recommendations On The Big Move From VB to RB?

> That number is too large for any of the built in types

No it isn't. A double will hold that easily.

Author:  kermit [ Sun Aug 19, 2012 5:05 am ]
Post subject:  Re: Recommendations On The Big Move From VB to RB?

I wondered.

So on my Macbook 2011, running OSX 10.7.4, RB 2009 5.1


dim d as double
d = 123456789123456789123456789
msgbox format(d,"0.00")


Result:
944716198279094528.00

This is odd, because I was given to believe that the upper limit of a double is
1.7976931348623157 e+308

from an earlier discussion.


So, I figured 'something odd going on'
Then I figured 'the original assignment must have already treated the number as an integer'

So I changed it to this:

dim d as double
d = 123456789123456789123456789.0 //forcing it to see a floating point number
msgbox format(d,"0.00")


Result?
123456789123456791337762816.00

Still not the original: and if we cant get back what we put in, how can we rely on the result of further calculation?

So, unless I'm missing something, a double 'can' hold enormous numbers, just not very accurately.
I'm sure the OP would like to hear of a way around this, and Im interested out of pure curiosity.

Author:  RBnoob2012 [ Sun Aug 19, 2012 8:52 am ]
Post subject:  Re: Recommendations On The Big Move From VB to RB?

timhare,
Thanks for your help. I'll look into Sparkle and the Socket (sounds like a bad TV show). The big number was a "just in case". In VB.Net the Decimal Data Type will hold an even larger number. I was hoping to get away from decimals. No matter, there's always a workaround.

I'm also following the Dim d As Double posts. I had read that when formatting a number to a string use:

newStr = format(###,###,###,###,###,###,###,###,###.0")

But that also didn't work.

Thanks again for your time,
RBnoob2012

Author:  harriew [ Sun Aug 19, 2012 10:00 am ]
Post subject:  Re: Recommendations On The Big Move From VB to RB?

It is true that a Double can hold numbers up to the power of 308; but, it can have only 15 digits of accuracy if I remember correctly. This is all due to how a certain number of the 64 bits are dedicated to the number itself and the remaining bits are dedicated to the exponent. I believe that 53 of the 64 bits are dedicated to the number portion and that allows the 15 digits. If you truly want values with the number of digits that you showed you will have to rely on plugins to achieve it. Bob Delaney, as mentioned previously, has plugins that will handle numbers that size and many times larger. This isn't an RS thing, it is true of any language with 64 bit floating point numbers.

Author:  DaveS [ Sun Aug 19, 2012 10:01 am ]
Post subject:  Re: Recommendations On The Big Move From VB to RB?

dim d as double
d = 123456789123456789123456789.0 //forcing it to see a floating point number
msgbox format(d,"0.00")


Kermit.... what OS are you running this under?

I did it with RS2011r4.3 under OSX 10.7.4. and it gave the full correct answer


[I think that is 15 digits to the RIGHT of the decimal].... but like I said.. it works for me as-is

Author:  harriew [ Sun Aug 19, 2012 10:11 am ]
Post subject:  Re: Recommendations On The Big Move From VB to RB?

Dave, did you look real close at the number that appeared in the msgbox. I couldn't believe what you said so I gave it a try and I get:

123456789123456791337762816.00

not

123456789123456789123456789.0

A 64 bit double cannot hold more than 15 digits of accuracy period. The rest after the second 7 are gibberish. I would have to research what those remaining digits are all about.

Author:  DaveS [ Sun Aug 19, 2012 10:14 am ]
Post subject:  Re: Recommendations On The Big Move From VB to RB?

my bad.... but hey it was closer than Kermit saw :)

Author:  timhare [ Sun Aug 19, 2012 11:00 am ]
Post subject:  Re: Recommendations On The Big Move From VB to RB?

Markus Winter wrote:
> That number is too large for any of the built in types

No it isn't. A double will hold that easily.

Not without losing accuracy. That's the reality of doubles, or any other 64-bit representation.

Author:  npalardy [ Sun Aug 19, 2012 11:16 am ]
Post subject:  Re: Recommendations On The Big Move From VB to RB?

RBnoob2012 wrote:
Data Types
Which data type would I use to hold this number: 123,456,789,123,456,789,123,456,789 ... It does not require a decimal, but must be signed. I've read that a Double can hold almost any number, but I don't need the decimal which slows calculations. Any hints?

Track down bob delaney's various plugins as he's provided some numeric classes in the m that can hold infinitely long numeric values
I believe they are free

Author:  kermit [ Sun Aug 19, 2012 11:49 am ]
Post subject:  Re: Recommendations On The Big Move From VB to RB?

Quote:
So I changed it to this:

dim d as double
d = 123456789123456789123456789.0 //forcing it to see a floating point number
msgbox format(d,"0.00")


Result?
123456789123456791337762816.00

Still not the original:


Dave, did you look real close at the number that appeared in the msgbox. I couldn't believe what you said so I gave it a try and I get:

123456789123456791337762816.00


Quote:
my bad.... but hey it was closer than Kermit saw


Nope.
Exactly the same.
I think you were looking at the first returned value, which happens if I omit the decimal point.

Author:  Bob Keeney [ Mon Aug 20, 2012 1:24 pm ]
Post subject:  Re: Recommendations On The Big Move From VB to RB?

The automatic application updates, take a look at the Monkeybread Updater Kit http://www.monkeybreadsoftware.de/realbasic/UpdaterKit/

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/