Multiple overlapping windows in IDE

Version 1.2 lets you tear off the items in the tab bar into their own windows. This is handy if you want to edit code and see the form at the same time, or view more than one code window at a time. Drag a tab outside the bounds of the IDE to make this happen.

Here’s how it looks afterwards:

NS Basic/App Studio and Symbian S^3

Denis Jakus has done some testing with a Nokia C7, a Symbian S^3 device. He reports that NS Basic/App Studio seems to run OK on it: apps deploy normally, can be added to the Home page and run offline.

He wasn’t able to get definitive results on SQLite databases before he gave up the device.

The latest browser from Symbian is WebKit and HTML5 enabled, so this is good news.

Let us know if you have additional information on Symbian!

Images in strings and Base64

Images can be saved as strings encoded using Base64. This can be quite useful. For example, you can pass such strings from a server to your app, or store them in an SQLite database. Here’s an example of a png file with an image of a red dot, represented as a string:

reddot="data:Image/png;base64,"
reddot=reddot & "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP"
reddot=reddot & "C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA"
reddot=reddot & "AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J"
reddot=reddot & "REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq"
reddot=reddot & "ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0"
reddot=reddot & "vr4MkhoXe0rZigAAAABJRU5ErkJggg=="

To display in an Image Control, do this:

Image1.innerHTML="<img height=10 width=10 src='" & reddot & "'/>"

To display in the PictureBox control: do this:

reddotImg=new Image()
reddotImg.src=reddot
pb = PictureBox1.getContext("2d")

Function redditImg_onload()
  pb.drawImage(reddotImg,0,0)
End Function

You can save a Picturebox to a string using the PictureBox.toDataURL() function.

NS Basic/App Studio 1.2.0 released!

NS Basic/App Studio 1.2.0 is ready to download. You can download it from
the same URL as before.

We took some time to clean up a bunch of things internally that have
accumulated, streamlining our code in a number of places. These changes
should not affect how the product works, if we did them correctly.

There are a couple of important new features:
– Scrolling has been added to the HTMLview control. If this works well,
we will be extending it to other controls. Please give it a try!
– A new ReadFile statement has been added. It lets you read files
(like .htm, .txt, .csv and more) into variables in your program.

Here is what is new and fixed:

  1. Language: New ReadFile function. See Language Reference.
  2. Controls: HTMLview control now supports scrolling.
  3. Samples: ScrollingFile added.
  4. Samples: ReadFile added.
  5. Code Window: Case normalization improved.
  6. Code Window: Problem with cut and paste fixed.
  7. Deploy: Added more checking to file names.
  8. Deploy: Cache error messages can now be dismissed by tapping on them.
  9. Deploy: Move browser check to complexfunctions.js
  10. Docs: Handbook and Language Reference updated.
  11. IDE: Defaultformsize values remembered correctly.
  12. IDE: General code cleanup.
  13. IDE: Initial startup screens revised.
  14. IDE: Settings and Recent data now saved to registry.
  15. IDE: Tabs can now be pulled out into separate windows.
  16. Setup: Some apparently unneeded dll files removed.

iOS 4.3 brings better performance.

Apple’s iOS 4.3 includes a new JavaScript runtime engine. Since NS Basic/App Studio works by translating BASIC code into JavaScript for execution, we tested to see what difference the new version makes.

iOS 4.2.1 iOS 4.3 diff
iPhone 4 180,428 282,674 +57%
iPad 208,276 264,293 +27%
iPad 2 437,853

The test is a simple one: how many times can you go through a loop, adding a number each time, in 1 second? It’s useful as a test of straightline processing power, but as in any benchmark, will not necessarily indicate what will happen to a particular app. Reports in other media are that the real world results are often much better than we found.

Still, the marvel is that more than quarter of a million statements can be executed in less than a second on a handheld device, be it iOS or Android. This really expands the types of apps NS Basic/App Studio can be used for.

Update: As of 4.3.0, this improvement only appears in apps running directly in the browser. It has not been extended to apps saved to the home screen yet.

Here are a couple of interesting links if you like this kind of benchmark:

SpeedTest is the standard benchmark we have been using on many devices. Results are shown for almost 50 devices. (The slowest was the BlackBerry Pearl, at just 671!) It also shows some desktop results. Let us know if you have some numbers to add!

Win CE Benchmarks shows the speed of NS Basic, eVB and .NET on various devices. Tops is NS Basic/CE on a souped up PocketPC 2003 at 55,511. As a bonus, results are also shown for a variety of desktop systems.

NS Basic/App Studio 1.1.3 Released!

NS Basic/App Studio 1.1.3 is ready to download. You can download it from the same URL as before.

There are some nice usability improvements this time.
– Compiles are much, much faster in many cases.
– You can add code files (.cod, .bas, .txt) to your project.
– Default form sizes for many popular devices can be specified.
– Message now appears when the cached version is being updated.

Notes:

  1. Deploy: Incrementatal compile can cut build time dramatically. See below.
  2. Deploy: Cache status now displayed when updating. See below.
  3. Deploy: If app is updated, app is automatically restarted.
  4. IDE: Default form size added.
  5. IDE: Code Files added.
  6. IDE: Code Files Import/Export added.
  7. IDE: Form Import/Export added.
  8. IDE: Property Help text now displayed.
  9. Docs: Handbook and Language Reference updated.
  10. Installer: removed reference to folder that was not created.
  11. Runtime: fixed problems with rotation and control sizing.
  12. Samples: Geolocation now shows more information, updates itself.
  13. Samples: CacheEvents sample removed – obsolete.
  14. Samples: CreateDiv: shows how to create a control on the fly.
  15. Samples: Signature: Shows how to capture and display signatures and drawings.
  16. Translator: Case normalization for ‘timestamp’ and ‘form’ fixed.
  17. Translator: d = new Date() translates correctly.
  18. Translator: Dim names2(): ReDim names2(0,4) translates correctly.
  19. Translator: Naming conflict in String function fixed.


Documentation Changes for Version 1.1.3

  1. Incremental Compile: Only the code modules which have changed since the last compile will be recompiled.

  2. Caching: If there is a fresh copy of your app on the server, status messages will now be displayed as the files load. Once all the files are loaded, the app will restart automatically. This takes the guesswork out of knowing whether the new version of your app has loaded. Your program can continue to do processing as this is going on.

    To check if updating is going on, check if NSB_eCount>1.

    To override the standard handling of cache events, add this code to your program:

    	Sub oncache(e)
    	  'do what processing you need (or nothing)
    	End Sub
  3. Default Form Size: The IDE has a number of default form sizes built in. You can ignore these and enter your own height and width. If you know the size of a popular device you would like added to the list, send the info to us.

Creating controls on the fly

It’s possible to create controls at runtime. This can be useful if you want to display some information temporarily without affecting the current form. The control gets created completely through code, which is certainly not as nice as having the IDE do it for you, especially with more complex objects.

In this example, we’ll create a div object. Div is one of the simplest elements that lies underneath NS Basic/App Studio objects. In fact, the HTMLView control is actually just a simple div.

Here’s the code:

  Dim newdiv
  newdiv = document.createElement("div")
  newdiv.setAttribute("id", "myNewControl")
  newdiv.style.position = "absolute"
  newdiv.style.width = "200px"
  newdiv.style.height = "40px"
  newdiv.style.left = "55px"
  newdiv.style.top = "200px"
  newdiv.style.background = "white" 
  newdiv.style.border = "1px solid #000";
  document.body.appendChild(newdiv)

Now we can set its value just like we would an HTMLview:

  myNewControl.innerHTML="My new control"

To get rid of the control, do the following:

  myNewControl.parentNode.removeChild(myNewControl)

The CreateDiv sample is included starting with NS Basic/App Studio 1.1.3.

Edited 3/28/16 – fixed some errors in code

How to capture signatures and drawings

It’s easy to capture and display signatures and drawings.

It’s all done using the PictureBox control. From the time the user touches the screen till the time he lifts his finger off, events are sent with the x,y coordinates. If we capture these into an array, we can display the same image again. Here is how to capture the events into an array:

Function PictureBox1_ontouchstart()
  addSegment(event.touches[0].pageX,event.touches[0].pageY)
End Function

Function PictureBox1_ontouchmove()
   addSegment(event.touches[0].pageX,event.touches[0].pageY)
End Function

Sub addSegment(x,y)
  points=points+1
  arrPointsX(points)=x
  arrPointsY(points)=y
  drawSignature(arrPointsX, arrPointsY) 'update the display in real time
End Sub

Here is how to display the signature or drawing from the array:

Sub drawSignature(pointsX, pointsY)
  pb = PictureBox1.getContext("2d")
  pb.strokeStyle = vbBlack
  pb.beginPath()
  pb.moveTo(pointsX[0],pointsY[0])
  For p=1 To UBound(pointsX)
     pb.lineTo(pointsX[p],pointsY[p])
  Next
  pb.stroke()
  pb.closePath()
End Sub

This could be made more efficient by drawing just the latest segment if we are going to call it after each event.

To put the array into a field which could be saved in a SQLite database, do this:

signatureListX=join(arrPointsX)
signatureListY=join(arrPointsY)

When you read in the signature, simply reverse the process:

arrPointsX=split(signatureListX)
arrPointxY=split(signatureListY)

You may be able to come up with more efficient ways of storing the data, but this isn’t bad. The above image is made up of 84 points, so the signature will be saved in less than 700 bytes.

The Signature sample is included starting with NS Basic/App Studio 1.1.3.

NS Basic/App Studio 1.1.2 Released!

NS Basic/App Studio 1.1.2 is ready to download. You can download it from the same URL as before.

There are some nice usability improvements this time.
– You don’t have to change your default browser to test your apps.
– Deploying an app that has already be deployed once is much faster.
– Block comments are now enabled.

Notes:

1.1.2

  1. Deploy: No longer runs in the default browser. Tries Chrome first, Safari next, then gives a message requesting that a compatible browser to be installed.
  2. Deploy: Refresh Deploy just uploads the app, not all the other files.
  3. Code Window: Jumping to a function scrolls it to the top.
  4. Code Window: Block comment/uncomment a section of code by right clicking or from the Edit menu.
  5. Code Window: Cos() is colored properly.
  6. Deploy: Missing files for titlebar added.
  7. Deploy: Trailing spaces on # USER FILES ignored.
  8. Deploy: Status bar is updated more frequently.
  9. Deploy: Exclude Thumbs.db from manifest.
  10. Docs: Handbook and Language Reference updated.
  11. IDE: Bug in moving Project Explorer tree items fixed.
  12. IDE: Project Explorer buttons have disabled images.
  13. IDE: Updates window enlarged and positioned properly.
  14. Installer: ReadMe file can be opened at end of installation.
  15. Language: Capitalization issues fixed on interval and timeout functions.
  16. PhoneGap: iOS helper file changed from phonegap-0.9.3.min.js to phonegap.js
  17. Runtime: Some variables in canned code were not properly declared.
  18. Samples: slight change to GetData.
  19. Samples: TwoForms modified to use transitions.
  20. Samples: CacheEvents now gives more information.
  21. Translator: ‘ sub = no longer causes problems.
  22. Translator: a[0]=atn(1) fixed.
  23. Translator: FormatNumber((a[1] Mod Reg[0]),9) fixed.
  24. Translator: If A = “a” Or b = “b” Or c = “c” Then… fixed.
  25. Translator: Int() and CInt() are now consistant with VB.
  26. Translator: Print a[0]^5 fixed.
  27. Translator: v1 = Sin((Lat1r – Lat2r) / 2) ^ 2 fixed.