Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Dec 13, 2017 10:08 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Recommendations On The Big Move From VB to RB?
PostPosted: Sat Aug 18, 2012 8:00 pm 
Offline

Joined: Sat Aug 18, 2012 11:23 am
Posts: 21
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Recommendations On The Big Move From VB to RB?
PostPosted: Sat Aug 18, 2012 11:49 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Recommendations On The Big Move From VB to RB?
PostPosted: Sun Aug 19, 2012 4:12 am 
Offline

Joined: Sun Feb 19, 2006 4:00 pm
Posts: 1282
Location: Heidelberg, Germany
> That number is too large for any of the built in types

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


Top
 Profile  
Reply with quote  
 Post subject: Re: Recommendations On The Big Move From VB to RB?
PostPosted: Sun Aug 19, 2012 5:05 am 
Offline

Joined: Mon May 30, 2011 12:56 am
Posts: 702
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Recommendations On The Big Move From VB to RB?
PostPosted: Sun Aug 19, 2012 8:52 am 
Offline

Joined: Sat Aug 18, 2012 11:23 am
Posts: 21
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Recommendations On The Big Move From VB to RB?
PostPosted: Sun Aug 19, 2012 10:00 am 
Offline

Joined: Fri Dec 01, 2006 3:09 pm
Posts: 650
Location: Tennessee, USA
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.


Last edited by harriew on Sun Aug 19, 2012 10:03 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Recommendations On The Big Move From VB to RB?
PostPosted: Sun Aug 19, 2012 10:01 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
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

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Recommendations On The Big Move From VB to RB?
PostPosted: Sun Aug 19, 2012 10:11 am 
Offline

Joined: Fri Dec 01, 2006 3:09 pm
Posts: 650
Location: Tennessee, USA
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Recommendations On The Big Move From VB to RB?
PostPosted: Sun Aug 19, 2012 10:14 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
my bad.... but hey it was closer than Kermit saw :)

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Recommendations On The Big Move From VB to RB?
PostPosted: Sun Aug 19, 2012 11:00 am 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Recommendations On The Big Move From VB to RB?
PostPosted: Sun Aug 19, 2012 11:16 am 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
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

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Recommendations On The Big Move From VB to RB?
PostPosted: Sun Aug 19, 2012 11:49 am 
Offline

Joined: Mon May 30, 2011 12:56 am
Posts: 702
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Recommendations On The Big Move From VB to RB?
PostPosted: Mon Aug 20, 2012 1:24 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
The automatic application updates, take a look at the Monkeybread Updater Kit http://www.monkeybreadsoftware.de/realbasic/UpdaterKit/

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group