http://macapper.com/2010/12/14/interview-george-henne-of-nsbasic/
Create iOS App Store apps using PhoneGap
From Lennie De Villiers:
This requires a Mac OX running 10.6.0 Snow Leopard or greater.
- Download and install XCode with iPhone SDK.
- Note: You will need an Apple Developer license (USD $99.00 per year) to deploy to your device or the App Store.
- Get the latest PhoneGap for iPhone from GIT. See setup instructions at https://github.com/phonegap/phonegap-iphone
- Create a new PhoneGap project using the XCode template.
- Delete index.html file under the www folder
- Download the NSBasic App Studio project to the www folder
- Rename “index.htm” to “index.html”
- You might need to change the “index.html” file to use the PhoneGap API if you want to use features like camera etc.
- Remove the off line file
- Reload the XCode project to pickup your files
- Build + Run
- You will see an PhoneGap splash screen first before it shows your application.
Once this is done, you can start the process for submitting to the App Store. Be prepared – it’s a lot of work.
Create Android .apk files using PhoneGap
From Lennie De Villiers:
Instructions to compile an NSBasic app to PhoneGap on Android on MS (Windows only)
- Download Java JDK 1.6
- Set the Java class path and add the Java bin folder to the PATH variable so that you can run Java (“javac”) from the command line
- Download latest Apache Ant
- Download Apache Ant to a folder and set the PATH variable to the bin folder so that you can run ant from the command line
- set the ANT_HOME variable to the Ant home folder
- Download the latest version of Ruby
- Set the PATH variable to the bin folder of Ruby so that you can run it from the command line
- Get the latest source code of Phone Gap for Android from the GIT repo: https://github.com/phonegap/phonegap-android
- Set the PATH variable to the bin folder so that you can run droidgap.bat from the command line (droidgap.bat is just a wrapper that calls the Ruby script)
- Open an command prompt and CD to a folder that contains your NSBasic script files (Index.htm etc)
- Rename “index.htm” to “index.html”
- Run “droidgap create”. This will create an Android solution using your NSBasic script files.
- Compile the application using Ant and deploy to device for testing.
NS Basic/App Studio 1.0.2 released
NS Basic/App Studio 1.0.2 is ready to download. You can download it from the same URL as before.
- Forms: Add new style property.
- Code Window: Type Ctl J to see the translated JavaScript.
- Controls: Grid: Add new cellstyle property
- Controls: Grid: reduce default padding, font size default is now 10 and populate each cell with a space.
- Controls: Grid: multiple grids can have different styles.
- Controls: TextBox: Add inputType of hidden.
- Samples: HTMLview’s manifest fixed so image is deployed.
- Samples: Added tutorial samples.
- Samples: GetData retrieves data from a remote site.
- Translator: some color constants were incorrect
- Translator: Msgbox “Grid(4,4)=” & Grid1.getValue(3,3)
- Translator: Function ComboBox1_onchange
- Translator: datediff(“ww”,fromdate,todate)
Getting data from a remote server
This turns out to be pretty easy.
First, you’ll need to reformat the data on the server a bit and rename
the file:
Contents of the file:
processData("1,1000,500,500,500,500,500,500,1001,2000,1000,1000,1000");
Call it whatever you like – in my sample, it’s data.js.
Here’s the code in an NS Basic/App Studio program:
'GetData - gets some data from a remote site and processes it Function Button1_onclick() head = document.getElementsByTagName("head")[0] newScript = document.createElement("script") newScript.type = "text/javascript" newScript.src = "http://www.nsbasic.com/data.js" head.appendChild(newScript) End Function Function processData(s) data=Split(s,",") Textarea1.value="" For i=0 To UBound(data)-1 Textarea1.value=Textarea1.value & data(i) & vbcrlf End If End Function
The data in data.js is actually a mini program: it calls a function called processData with the data you want to download.
In the above code, Button1_onclick() takes that file, inserts it into your program and executes it. The code in the file calls processData, which interprets the incoming data and, in this case, simply displays it.
You’ll have to take care that no one can modify data.js, or they could
have all kinds of fun!
This sample will be included in the next build.
WebSockets
We have just uploaded Version 1.0.1. One the things it includes is a new sample called WebSockets.
WebSockets are a very new part of HTML5. They implement a higher level of the regular sockets protocol, with improved security and other advantages. This means, however, that it won’t just simply connect to Windows Winsock. There is more information here:
http://websockets.org/echo.html
WebSockets are supported starting in iOS 4.2.1. They have not appeared in Android yet.
We will be adding more information about WebSockets as we develop it.
NS Basic/App Studio 1.0.1 released
We have just put NS Basic/App Studio 1.0.1 up. You can download it from the same URL as before.
This update concentrates, not unexpectedly, on fixes. Here they are:
- Deploy: Meta tag viewport.user-scalable changed to no.
- Deploy: Missing file in deploy fixed.
- Deploy: Unique name for registered users is now lower case.
- Docs: Tutorial 1 updated to show Android install.
- Docs: Appearance of Language Reference improved.
- Docs: Handbok updated.
- Runtime: Titlebar images now all show.
- IDE: NSB Icon now appears in top left corner
- IDE: Removed single quotes around image names.
- IDE: Problem deleting forms is fixed.
- Controls: Label.value is now called textContent (same as runtime)
- Samples: new WebSockets is an early demo
- Translation: a = ((i/100) ^ 12 * a)
- Translation: a = Eval(“Grid1_” & x & “_” & y)
- Translation: a = NSBVersionView
- Translation: a=”<img src=””mario.jpg””>”
- Translation: If (Location.coords.longitude > 0) Then Amendment = ” east”
- Translation: Dim Amendment; Amendment = “”
- Translation: LGA(0) = “a” : LGA(1) = “b” : LGA(2) = “b”
- Translation: MsgBox “aaaa ()”
- Translation: MsgBox a.b.c()
- Translation: MsgBox a.b.c(0)[name]
Installing apps on Android devices
We have updated Tutorial 1 to show how you can install your apps on Android devices.
Documentation on HTML and JavaScript
Are you looking for good reference material about HTML and JavaScript? Here are some of the favorite sites:
English
W3Schools
Dive Into HTML5
German and French
SelfHTML
Why do programmers get Halloween and Christmas confused?
Dec 25 = Oct 31