Use Dropbox to quickly install .apk files

Want a quick way to get an App Studio app compiled with PhoneGap onto your Android device? Use Dropbox!

  1. Build your app using PhoneGap as always.
  2. Put the resulting .apk file into your DropBox. (Get an account if you don’t already have one – it’s free!)
  3. Install the Dropbox app on your Android device if you have not done so already.
  4. Open Dropbox on the device and click on your .apk file. It will install!

(If you have not used Dropbox yet, it’s a great tool. It puts what looks like an ordinary folder on your PC or Mac desktop. You can share it with other users and computers: add a file to your Dropbox and your other computers can use it right away. There’s lots more, but this already is the simplest network share you have ever experienced. Installation is also very simple.)

Posted in Android, deploy, PhoneGap | Comments Off

A change to PhoneGap Splash Screens

PhoneGap have just made a breaking change to their Build process. The result is that splash screens no longer appear on Android devices. Luckily, the fix is easy.

In your Project Properties, open the configxml property. You’ll need to change this line:

<gap:splash src="{splashscreen}" gap:role="default" width="320" height="460"/>

to this

<gap:splash src="{splashscreen}"/>

The next build will make this the default for all new projects. However, you will need to modify on existing projects.

More info here:
https://build.phonegap.com/blog/enhanced-icon-and-splash-support

Posted in Uncategorized | Comments Off

Ajax Made Simple 8: Zip Code Lookup

Ever realize, when getting a user’s address, that knowing the zip code makes asking for the city and state unnecessary?

Here’s some simple code to look up the city and state from a zip code:

zip="90210"

req=Ajax("http://zip.elevenbasetwo.com?zip=" & zip)
If req.status=200 Then 'success
    MsgBox req.responseText
  Else 'failure
    MsgBox "Error: " & req.err.message
End If

The result is

{"country": "US", "state": "CA", "city": "BEVERLY HILLS"}
Posted in tips | Comments Off

NS Basic/App Studio 2.1.0.2 released!

We have just uploaded 2.1.0.2 to the servers. It has a number of minor enhancements as well as bug fixes.

Download URL is the same as for 2.1.

  1. Code Window: Add Math object.
  2. Code Window: Improve AutoComplete parsing.
  3. Controls: ComboBox Classic: removeItem function added. (Thanks, Norman Peelman!)
  4. Controls: jQM List can now have variable width.
  5. Controls: jQM RadioButton fixed with update to jQuery Mobile.
  6. Controls: jQM Select has new multiple selection property.
  7. Controls: jQM Select: selected* functions return arrays for multiple selections.
  8. Controls: PictureBox background now fills entire control.
  9. Deploy: Fix problem with browser warning and iPad splashscreen.
  10. Deploy: Script and Link entries generated from _requiredFiles
  11. Design Screen: Clicking on a blank area of the form now selects the form instead of nothing.
  12. Framework: jQueryMobile updated to 1.1.0 RC2
  13. IDE: .keyCode is now a keyword.
  14. IDE: Clicking from Design Screen to Project Explorer selected wrong item.
  15. IDE: Fix crash on resize.
  16. IDE: Fix problem saving minimized dimensions on exit.
  17. IDE: Changing framework does not leave Design Screen blank.
  18. Installer: Fix shortcut to Readme.htm.
  19. Translator: Fix $(“#T_A”).A({selectedItem:2})
Posted in news | Comments Off

Using JavaScript in your App

App Studio lets you code using VB style BASIC or JavaScript. You can mix both languages in one project as well: they share the same name spaces, so variable and functions can be freely interchanged.

Why use JavaScript? BASIC is easy and in nearly all cases, all you need to do anything in App Studio. However, many people would rather program in JavaScript. That’s fine. There is also a huge base of JavaScript code available on the internet. Even if you would rather program in BASIC, there’s a lot of stuff that could be useful to you.

Let’s discuss some of the ways to include JavaScript code into a project.

Continue reading

Posted in tips | Comments Off

Sending SMS messages from App Studio

Guest post from Scott Page

Here are screenshots of an app that I made using NSBasic to send out SMS Text alerts to our staff. Most of our employees do not like to carry both pagers and cell phones and prefer to receive messages via SMS on their phones. Our CAD (Computer Aided Dispatch) system does not provide for this functionality. My first attempt was to create email groups with the cell phone number and the carrier (5415551212@vtext.com). This worked but had its own set of problems. Some people would get messages before others and there could be a great delay in between the message being sent and when it was received. I believe this has a great deal to do with how the cell providers handle email submissions. Using this method I had to know each person’s cell provider and if they changed they had to tell me so I could make the changes.

I decided to use SMSified as a SMS provider and used their REST Api to interface with my app. This greatly speeds up the rate at which the text messages are received and provides a consistent phone number that is tied to the alerts we send out (before the messages would be from whoever sent the message).

Continue reading

Posted in tips, Uncategorized | Comments Off

Ajax made Simple Part 7: Use JSONP to get a stock quote

Working with Ajax, we have run into the Same Origin Policy over and over again. In this post, we’ll show you another way to get around it.

The Same Origin Policy restricts you from loading files from a server not your own. There is an exception: JavaScript (.js) files are allowed.

There are sites on the web where you can request information and have it passed back in JSONP format. The “P” stands for padding: JSONP is JSON with padding. The results are returned as a function call, with the results as parameters. That function can then be called in your program.

Let’s use this to get a stock quote from Yahoo. There are 3 parts to this: first, we have to make the request. Next, we handle the return. Finally, we execute the function.

1. Make the request

 Dim YQI, URL, callback
 YQI = escape("select * from yahoo.finance.quotes where symbol in ('AAPL','GOOG','MSFT')")
 callback="requestComplete"
 URL = "http://query.yahooapis.com/v1/public/yql?q=" & YQI & _
       "&format=json&env=http://datatables.org/alltables.env&callback=" & callback
 loadScript(URL)

Yahoo! has a very powerful API to look up all kinds of data. To make it easier, they have set up an interface using SQL like statements called YQI. In our code above, we start by creating our YQI request. The escape() function translates special characters and spaces so they can be sent in our Ajax call.

URL is then composed of our YQI request with the rest of the boilerplate that is needed. The most interesting part is the &callback part. It names the function that the return values will be wrapped in.

Having prepared everything, we can inject the script.

2. Inject the script

Yahoo! is going to return some code: it will be a call to the function we specified in callback, with the parameters all filled in. The following code will insert the code returned by Yahoo! into our program and execute it:

Function loadScript(URL)
  Dim head, script
  head=document.getElementsByTagName("head")[0]
  script=document.createElement("script")
  script.src=URL
  script.async=True
  head.appendChild(script)
End Function

We do the usual checking to see if the call is complete. If it is, we will have gotten a text string back that looks something like this:

requestComplete({"query":
  {"count":3,"created":"2012-03-20T11:34:00Z","lang":"en-US","results":
     {"quote":...);

This is a valid function call, so when it is run, the function is executed.

3. Execute the function

The Eval() function causes requestComplete() to be called.

Function requestComplete(data)
  Dim quotes, i
  quotes=data.query.results.quote
  TextArea1.value=""
  For i=0 To Len(quotes)-1
    TextArea1.value=TextArea1.value+quotes[i].symbol & _
                    ": " & quotes[i].Ask & vbCRLF
  Next
End Function

The data that comes back is a fairly complex structure with a lot of data in it. You can copy it to the NotePad to see everything that is there. For now, we are just interested in the asking price of the stock. The results are returned in an array, with one element per stock.

Closing points

There are many web services that work in a similar fashion. One of the tip offs is if the calling string has an &callback argument. If it does, it probably can be used with this method.

Some of these services are free or limited, while others require an API key that you must obtain from the service.

Some places to go for services:

Got more? Let us know at support@nsbasic.com.

Posted in tips | Comments Off

Programming Contest Announced!

Our second NS Basic/App Studio Programming Contest starts today. We’re looking forward to cool entries which take advantage of the capabilities of devices and App Studio.

We have two categories: Web App and App Store. Web Apps are installed from a browser, while App Store apps are distributed through the Apple, Google, BlackBerry or other store. All registered NS Basic users are welcome to participate in the contest. Prizes are $100 USD in each category.
contest

You may enter more than one program. Judging will be by NS Basic’s experts. All judging is arbitrary and final. We will be looking for quality, performance, ease of use, sophistication and overall coolness. Apps can be whatever you like: enterprise, business, commercial, education, games or even something whimsical.

All programs must be written using NS Basic/App Studio. Entries may be commercial, shareware or freeware, and for iPhone, iPad, Android, BlackBerry or multiple platforms. Please indicate with your entry whether we can share your program or screenshots with the public.

Send your questions and entries to support@nsbasic.com.

The deadline for entries is Monday, April 23, 2012 at 12:00 midnite EST.

Posted in news | Comments Off

NS Basic/App Studio 2.1 Released!

We happy to announce that Version 2.1 is ready!

The list of enhancements and fixes is extensive. Major new features include:

  • Support for Libraries: These are easy to add libraries for your app. Libraries include AddToHomeScreen, Encryption and Sencha Touch.
  • AutoComplete: Now, when you type the period after an object, a list of members of that object will display.
  • The Open and Samples dialogs are now resizable.
  • Lots of smaller improvements and fixes. Check out the complete history.

The URL is the same as before. If you don’t have it anymore, be patient: we are sending an email to all registered users with the information.

The team here has been working hard on this new release. Great job, guys!

Posted in news | Comments Off

Ajax Made Simple Part 6: Where to put your PHP file

For development, put the PHP files for your project right in your project folder. You can then use any text editor that you have installed on your system to edit them.

Next, add the file names to the manifest in Project Properties. When you do a Full Deploy, they will be copied to the server with the rest of your project.

The result is that your PHP files will be placed on the server, in the same folder as your app. Your app can call a PHP script by just giving the file name – no path name will be needed.

Posted in deploy, tips | Comments Off