Tuesday, October 23, 2007
Perspective is Worth 80 IQ Points
http://rbblog.billdubya.net/2007/10/mindset-problem.html
Thursday, October 11, 2007
Half Life 2 Episode 2
So why am I posting about a video game here? Because I'm dying to play it, but I won't play because I can't allow myself to be distracted from working on Run BASIC right now. Probably I'll give myself permission to enjoy some game playing abandon when the holidays roll around.
In the meantime Run BASIC development is a lot of fun too in many important ways. :-)
Thursday, September 27, 2007
Parsing XML in Run BASIC
One of the important feature that a Web 2.0 language needs is an XML parser. Run BASIC now has one built in. The XMLPARSER statement parses an XML string and returns an XML accessor object with a bunch of handy built-in methods for making your way through an XML document.
Here is a simple example of what that sort of code looks like:
a$ = "<program name=""myprog"" author=""Carl Gundel""/>"
xmlparser #parser, a$
print #parser key$()
for x = 1 to #parser attribCount()
key$ = #parser attribKey$(x)
print key$; ", ";
print #parser attribValue$(x)
next x
This short program produces:
program
name, myprog
author, Carl Gundel
And here is a short program which will display the tag names and contents of an artibrarily nested XML document:
xmlparser #doc, s$
print #doc key$()
call displayElements #doc
end
sub displayElements #xmlDoc
count = #xmlDoc elementCount()
for x = 1 to count
#elem = #xmlDoc #element(x)
print "Key: "; #elem key$();
value$ = #elem value$()
if value$ <> "" then
print " Value: "; value$
end if
print
call displayElements #elem
next x
end sub
Monday, September 24, 2007
Do-it-yourself programming
A friend of mine pointed me at this article "Do-It-Yourself Software" in the Wall Street Journal.
http://online.wsj.com/public/article/SB119023041951932741.html
Run BASIC and Liberty BASIC are both aimed at this market, and in fact this is the traditional niche of BASIC language products.More on modularity
[masterPage]
cls
html "Program manager"
link #wiki, "Wiki", [runTheWiki]
print " ";
link #multi, "Multicounter", [runTheMulticounter]
if launchFlag then render #subProg
wait
[runTheWiki]
run "runWiki", #subProg
launchFlag = 1
goto [masterPage]
[runTheMulticounter]
run "multicounter", #subProg
launchFlag = 1
goto [masterPage]
Here is a version that doesn't use any GOTOs:
global launchFlag
call displayMasterPage
wait
sub displayMasterPage
cls
html "Program manager"
link #wiki, "Wiki", runSubprogram
#wiki setkey("runWiki")
print " ";
link #multi, "Multicounter", runSubprogram
#multi setkey("multicounter")
if launchFlag then render #subProg
end sub
sub runSubprogram linkKey$
run linkKey$, #subProg
launchFlag = 1
call displayMasterPage
end sub
So what does this do? It creates a simple web page with a title and two links. Click on the wiki link and the wiki program becomes part of the web page. Click on the multicounter link and the multicounter replaces the wiki part of the page. You can switch back and forth between the wiki and the multicounter at will with just the click of a mouse. What's even more interesting is that the multicounter is already a modular program, so you get three levels of modularity but you aren't limited to that.
So for programmers who like to put all their code in one file, there's nothing to prevent that. But people who like modules can have a field day.
Tuesday, September 11, 2007
Run BASIC enters beta testing
Run BASIC Personal Server is an all in one web app server, BASIC scripting language, database engine and more. It offers an extremely easy way to get into web application development. When I say extremely easy I am not exaggerating. We are talking "a child could do it" easy web programming.
When I asked my testers how they would describe Run BASIC, here is what some of them said:
" - - Run BASIC provides a complete alternative to the complex development languages that have evolved to script web content. Run BASIC wrests control back to you, allowing BASIC language scripting of web content. Create web pages in an easy to use project development environment and publish on the web at the click of a mouse."
" - - If you've ever used one of the classic BASIC interpreters, then you already know most of what you need to build dynamic websites using Run Basic."
" - - Run BASIC moves desktop programming out onto the internet. The screen displays, forms, interactions, graphics, and data-handling processes you create with clear, understandable BASIC programs suddenly become web applications, usable by anyone, on any platform -- Windows, Mac, Linux -- on any computer with browser access to the internet. With Run BASIC, you can write your program from anywhere, on any computer, and run it everywhere, on every computer."
If you are interested in Run BASIC and feel you have enough time to spend at least a few hours testing it out, please send an email to me at carlg@libertybasic.com and explain why you would like to be a beta tester.
We will accept only a certain number of applicants and I'll post a note here when we have enough.
Thanks!
-Carl Gundel
Saturday, July 07, 2007
Database and web capabilities
We also have added an httpget$() function so you can use HTTP to retrieve web documents like web pages, RSS feeds, etc. We plan to include an XML parser, and if we can come up with an easy to use way to stream through an HTML document we will provide that also.
These capabilities (except for the table rendering) will also be included in Liberty BASIC v5.0.
To keep up with what we're doing with Run BASIC, make sure to visit this blog and also http://libertybasic.conforums.com/index.cgi?board=runbasic
Wednesday, June 27, 2007
Adding SQLite to Run BASIC
sqliteconnect #users, "test.db"
call execAndPrint "select * from users"
call execAndPrint "select count(*) from users"
#users disconnect()
end
sub execAndPrint query$
#users execute(query$)
while #users hasanswer()
result$ = #users nextrow$(",")
print result$
wend
end sub
SQLite is a popular database engine provided as a library and is supported for Windows, Mac and Linux. The source code is available and is in the public domain so it is completely free. We will support the parts of Run BASIC that integrate with SQLite, but as for the specific level of conformance to the SQL standard and other technical details, see http://www.sqlite.org/
The SQLITECONNECT #obj, "databasefile.db" statement connects to a database and sets the #obj variable to be a connection object. The connection object understands EXECUTE(), HASANSWER(), NEXTROW$() and DISCONNECT(). I'm sure there will be more commands.
Notice the NEXTROW$() method. It returns each query result row as a string, with each item delimited by the specified string ("," in the example but it could be CHR$(9) or something else). It is trivial then to use the WORD$() function to extract the information. We will certainly also add the ability to get items by name.
Wednesday, June 20, 2007
Run BASIC and the iPhone
I have a Treo 650 myself, and I can use it to access the Run BASIC site, but it is awkward because the web browser it includes is slow and the Treo has a tiny little screen. I am eager to see how this all works on the iPhone, and if it is compelling I may even buy one just so I can demonstrate Run BASIC wherever I am. ;-)
Thursday, June 14, 2007
Support for CSS class tags
One new addition to Run BASIC is the ability to add a CSS class tag to an object on a web page, so that it can be manipulated.
For example the following would create a link and set a class to "button".
link #doMyBidding, "GO", [go]
#doMyBidding cssclass("button")
And the following statement would add the CSS needed to style the link (or any object that has the class tag "button"):
cssclass ".button", "{ put some css styling in here }"
Here is a link to a video demonstrating how this all works.
http://www.youtube.com/watch?v=1qomg67VdF0
Sunday, June 03, 2007
Component Based Web Development
In addition to inserting graphics into a web page, Run BASIC's RENDER statement can now be used to insert a module into a web page. We have this in a rough state now. It does work, but we need to iron out a couple of things.
What is this useful for? You can now create different parts of your web application as separate programs. You load them in and render them into the page. You can also control them using their own functions.
For example you might have a blog application with different parts of the page rendered by their own modules:
- BannerLogin
- Navigation bar
- Entries
- Archive outline
- etc.
By using the DIV and CSS statements, the modules can be formatted on the web page in an attractive and useful way.
Saturday, June 02, 2007
Rumblings under the surface
Wednesday, May 30, 2007
Modules and Run/Liberty BASIC
The RUN statement has a new form. If I want to use mymodule.bas as a module in a program I am writing I would code it like this:
run "mymodule.bas", #myModule
This causes mymodule.bas to be compiled into memory. It will execute code up to the first wait statement. This is how values will be initialized. The program then becomes an object assigned to the #myModule handle.
Then you can call any function on that program from within the calling program, like so:
#myModule myFunction(myParameter)
or even use the invokation in a more complex expression:
print "digits: "; len(#myModule myFunction(myParameter))
You may recognize this syntax as being the same as for controlling widgets. It relies on the same underlying mechanisms to do its work.
When we're done with this, modular programs loaded this way will be cached in memory and will only recompile when the source file changes.
Monday, May 21, 2007
Inkey$ and Liberty BASIC
- Getting the next character in the mainwindow without stopping the program. Currently only INPUT and INPUT$() are supported. Both stop the program and wait.
- Getting the next character typed for some window or widget that has focus. In other words, reading keypresses for objects with handles (ie. #thisWindow)
What I suggested in the forum is a function called inkey$().
The following would read keypresses for the mainwindow:
print inkey$()
or it could be abbreviated to:
print inkey$
To read keypresses for windows or widgets with handles:
print inkey$(#handle)
I'd like to solicit feedback here. Any ideas? Please leave a comment, and thanks!
Thursday, May 10, 2007
BASIC and CSS
However there is a better way. It is called CSS (Cascading Style Sheets). This provides a way to wrap the things on your web page with tags that you give your own names to, and you defined the appearance of the stuff wrapped in those tags somewhere else. This way your program's code has very little extra stuff in it to clutter up your code. If there is too much clutter it can be very hard to understand what code means, and this can slow you down and lead to bugs.
So, Scott McLaughlin and I have begun to integrate CSS with Run BASIC. We added a CSSID statement (originally this blog entry had this as CSS, but we changed the command), a DIV statement, and an END DIV statement. Here's a very short example:
cssid #myTag, "{ background: #FFDDDD; font-family: tahoma }"
div myTag
print "count to ten"
for x = 1 to 10
print x
next x
end div
Okay, so this displays all the text printed between the DIV and the END DIV with a light red background, and using the tahoma font. The #myFont token isn't a handle like the ones used for files and GUI controls. The # is simply part of CSS syntax.
DIV statements can be nested, and the contents of one DIV block will be rendered on the page nested inside of each other.
There is a lot more that can be done with CSS, and we're trying to explore what are the simplest and most useful things to include in Run BASIC.
We will be posting a screencast in the next few days that shows how this works.
Friday, May 04, 2007
Demo of Run BASIC at Smalltalk Solutions
Here is James Robertson's blog entry with a photo of me presenting.
http://www.cincomsmalltalk.com/blog/blogView?entry=3355631481
I'm very small in the frame, but yeah that's me all right. You can make out the Run BASIC web page up on the screen if you look carefully.
The demo was a little bit scary since I was modifying the Run BASIC code almost right up to the last second before the meeting. Scott and I were spending most of our free time at the conference working on some simple CSS integration. I'm hoping to put a screencast up to show how it all works.
Thursday, April 26, 2007
Artificial Intelligence and BASIC
I was able to use the techniques in the book to create demos for the computers at NEECO. A person visiting the store would ask the computer about itself, and the computer would try and respond appropriately with a demonstration of features.
The book can still be purchased used on Amazon.
Wednesday, April 25, 2007
Missing the Point
So in this case the language in question is a simple one, specialized for the robot ideas as a gentle way to introduce programming.
Later in the same paper they described how a newer version of the system switched to Java as the language for the robot. I am amazed how easily people are brainwashed into using the popular thing in place of the right thing. Instead of something simple use the "industry standard" language, no matter how much it might damage their minds. :-/
What would be better? I guess the robot language they were using before would be just fine. Or pick some other simple language if you're looking for mindshare. BASIC, LOGO, Forth, Smalltalk.
Tuesday, April 17, 2007
BASIC Contributed to Success of Industry
- bought a computer twenty or thirty years ago
- learned BASIC and did fun and productive things
- migrated to Microsoft Windows when it became the defacto standard OS
- found Windows programming languages to be too hard
- stopped programming for a LONG time
- stumbled across Liberty BASIC http://www.libertybasic.com
- started programming again in earnest!
The remarkable thing to me is that Liberty BASIC isn't as simple as the original BASIC interpreters were, but it is still so much easier than VB or Java that it serves as an acceptable gateway back into computing for so many people.
Saturday, April 14, 2007
BASIC versus RoR?
While I don't doubt that some people will use Run BASIC to create commercial sites, this is not the focus we are pursuing. Instead we are creating a tool for the traditional users of BASIC. If you want to learn or teach programming, if you want to create web apps for your use at home (or on your iPhone!), or if you need a custom application at the office and the IT folks and programmers are too busy to build it for you then Run BASIC is designed for you. :-)
Coming back to performance, the processing of large web applications is bottlenecked at the database. A Run BASIC front end to a database will perform similarly to other languages like Perl, Ruby, etc.
Saturday, March 17, 2007
Run BASIC Personal IDE sneak peek
http://www.libertybasic.com/basicology.html
Friday, March 09, 2007
A Small Matter
How do I resolve my love for BASIC and Smalltalk? It's easy. I pick the right tool for the job.
For large projects Smalltalk rules. Anything that has to scale to support many specialized features scales better when constructed from objects (usually anyways).
BASIC's strengths become evident when you know that your project will always be small. In such cases I can knock out a quick solution to my problems faster in BASIC than I ever could in Smalltalk, or Java for that matter.
In addition in order to be productive in most modern systems like Smalltalk, Java, etc. I need to learn to use a large class library. In BASIC I can dispense with all that.
BASIC is fun.
Monday, February 12, 2007
BASIC and Web 2.0
One idea that is important for Run BASIC to be a Web 2.0 system is that it needs to be able to consume information from other internet sources. The ability for the user to write a program that downloads the contents of a web page and then process that as information, or the ability to read RSS feeds as data would get us partway there.
I'd be interested in the reader's thoughts about this (yes, you!).
Sunday, February 04, 2007
Run BASIC Two Weeks Report
There have been a handful of server crashes in that period and numerous bugfixes. A few of these fixes are related to stability of the server but most are new features or fixes in the compiler or runtime system. This is a very good thing since most of this stuff feeds directly into the Liberty BASIC v5.0 effort. In essence this is a kind of alpha testing for LB5.
The community has responded nicely by creating a Run BASIC section on the Liberty BASIC Conforums site and by putting up a wiki. People have been busy creating programs that run under Run BASIC. Thanks to all of you for that.
Where are we headed with this? We have just started work on a Run BASIC personal edition. This will be a special version of the software that you can install on your own computer. Windows, Mac and Linux will all be supported. The user interface for this will still be web based, but it will be more of an IDE style setup. Our idea is that you can use this system to host a web site and share programs that you write as links on a home page. We are thinking a license for this system will cost $20 to $30.
Once the personal system is launched, we plan to create an educational system for instructors. Each student can have an account, and they can work through their lessons in their browsers whether at home, at school, or wherever they can access the server by means of the internet. Access to student work will be managed for the instructor automatically. We'll develop these ideas more later on.
Tuesday, January 23, 2007
New web BASIC launched!
-Carl Gundel and Scott McLaughlin
Friday, January 12, 2007
Tiny BASIC Revisited
In the Wikipedia article I mentioned before there are two versions of Tiny BASIC implemented in BASIC. The one we decided to use is here: http://www.aldweb.com/articles.php?lng=en&pg=7407 We decided to use this one because it is simpler. It is also open source.
So what we have is a cute little line numbered BASIC interpreter. In fact the version of BASIC used in the original TRS-80 Model I computer was Tiny BASIC. So if you've ever used this machine or anything like it (VIC-20, C64, Atari 400/800, Sinclair ZX81, etc.) you remember entering code a line at a time each with a line number, typing LIST and RUN. You also have immediate evaluation, which is a nice feature that most languages (even BASIC) don't have today.
The limitations? Single letter variable names. No string variables at all. Only about 100 lines of code per program (a completely artifical limit left to the reader to remove). No GOSUB/RETURN.
Okay, so why do this at all? Clearly this is not a useful programming language, right? I'm not so sure.
First, as an example of how to create a simple programming language it is great. The code is pretty well written (even though it looks like it is also written in a version of Tiny BASIC) and I had no trouble following it.
Then, when I consider just how small this program is I am impressed. In very little code the author has created an interactive programming environment.
If someone wants to use this as a platform to experiment it is wide open. One could try extending the language with string variables, add graphics support, or build a programmable robot battle game on top of it. Perhaps it could even be used to support scripting for Liberty BASIC applications.
Very cool. :-)
Thursday, January 11, 2007
BASIC and iPhone
It would be great if Apple decides to support this. Imagine Liberty BASIC on the iPhone! If software installation isn't a feature of the iPhone at least you will be able to run our web BASIC on it using the Safari web browser since you'll have an always-on internet connection. :-)
Tuesday, January 09, 2007
New Apple Phone
Friday, January 05, 2007
A sneak peek at our web BASIC
http://libertybasic.conforums.com/index.cgi?board=lb5&action=display&num=1168003459
We plan to unveil this web BASIC as a free site this month. Later we will sell personal licenses perhaps an affordable subscription service. After that, who knows? ;-)