Quantcast
Channel: Small Basic
Viewing all 669 articles
Browse latest View live

Got ideas for the Small Basic blog?

$
0
0

Assuming you use Small Basic, of course. =^)

We'll interview key community folks, we'll discuss Small Basic education, feature some programs, and enjoy some community conversations.

 

What are your ideas?

 - Tall Basic Ed


Small Basic - The Physics Challenge (October Challenges)

$
0
0

Welcome to the monthly SmallBasic Challenge! 

These challenges are intended for people who are learning to program for the first time or for those returning to programming who want to start using SmallBasic.  Some will be easy, some will be hard - but they will all make you think, and more importantly be GREAT FUN!

Please post your solutions / partial solutions / questions / feedback etc. into this thread that will remain 'sticky' for the month.  The only rule is that your solution must use standard SmallBasic methods (no extensions).

It would be good if people could post their problems with these challenges so that a discussion can start so that everyone can learn from each other.

Also post feedback on the kind of challenges that you want to see more of in the future.

Community Suggested Challenge 1 -by MathMan

Write a program to calculate the area of a crescent.

Community Suggested Challenge 2 -by Nonki Takahashi

Write a program to find the divisors of a given number.

Physics Challenge

Write a program to model a weight attached to one end of a spring.  The other end of the spring is stationary.

Extend to the model if you can to have several springs attached to the weight.

Excuse my crude drawing.

Graphics Challenge

Write a program where the turtle tries to follow the mouse.

For more of a challenge, don't use the Turtle.MoveTo command!

Text Challenge

Write a program to get the user to enter a number and write it out in words, for example 123 is one hundred and twenty three.

Math Challenge 1

Find all the numbers palindromic numbers less than 1000, eg. 1 131, 424 etc (the same forwards as backwards).

Math Challenge 2

Find all the 2 digit numbers that when the digits are reversed and the smaller number subtracted from the larger, the result is 36, for example 15 and 51.

To make it more complex find all the numbers less than 1000, where the difference of the reversed digits is a number entered by the user.

 

Do you have an idea for a future challenge? Please post it here: http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/a3431e06-2a46-416b-855f-fcda46b459ec

 

Thanks to...

Avatar of Nonki Takahashi Nonki Takahashi - For suggesting this blog idea!

Avatar of litdev litdev (MCC & Forum Moderator) - For hosting these great challenges!
 
 
 
 
Now get in there and beat the challenges! Ask questions and discuss it here: http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/a3431e06-2a46-416b-855f-fcda46b459ec
  - Tall Basic Ed

Small Basic - The 50 Line Challenge

$
0
0

From Coding Cat:   

Working on developing projects for my Intro to Programming class, I reminded myself of an article I read back in the early days of the PC. The article was in one of the first PC only magazines, and it was publishing the results of a contest the magazine sponsored. Preliminaries complete, here is what they did:

They challenged their readers to come up with the most useful BASIC programs they could using only a single line of code in the BASIC interpreter. With the colon instruction separator you could easily get twenty commands on a single line. And the winning submissions were brilliant. One was a screen saver-esk art program, a second was a working word processor, and the third was a full sub chase game. I wish I could share the article and results with this group, but my net search for mention of the article turned up nothing.

So, in the spirit of the early days of PC programming, here is my proposal to all of you:

The 50 Line Small Basic Challenge!

I proposed this challenge about three years ago as the "25 Line Challenge", and it was such a success that it spawned a competition to see who could squeeze the most complex code into the smallest space. The results were brilliant. It was quickly discovered that you could use the String and Stack based nature of the arrays to produce some startlingly compact, obfuscated and unreadable code. I think the best example was Rock-Paper Scissors reduced to three lines (importCode: CTB433-2)

This time, to keep it from spiraling out of control and losing its impact on learning, I am going to suggest we keep it simple: One command or assignment per line, and no crazy use of arrays or other structures simple to squeeze into the limit.

So… Give us your clever, entertaining, most creative best, just keep it readable, and keep it under fifty lines.

 

Thanks to...

Avatar of Nonki Takahashi Nonki Takahashi - For suggesting this blog idea!

Avatar of Coding Cat Coding Cat - For creating and hosting the contest!
 
 
 
Now get in there and beat the challenge! Ask questions and discuss it here: http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/1025bfd4-9c6f-4680-9bcd-f664a999eacb
  
   - Tall Basic Ed
 

Small Basic Program Gallery

$
0
0

The impossible goal is that this list will eventually contain every quality program made via Small Basic.

I'm starting with only a few, but you should also come back later, because this list will evolve over time.

 

#

1942 - by Laurent20

A

Analogue Clock (with wood texture) - by Math Man

Analogue Clock (no background) - by Nicolas_br

Asteroids V2 - by Jason Jacques + Community

Atom - by Dudeson (follows mouse cursor)

B

Blackboard - by Vijaye

Blimp - by  Coding Cat

Brick Wall - by Stendec

C

Calculator - by  Alex 2000 

Click the Button - by Timo Sö

Code Block Generator v1.3 (info) - by Nonki Takahashi

Color Memory Game - by Martmen

Color Picker - by Suduadib

E

Eyeballs - by Math Man

I

Installer (info) - by Timo Sö

Invader (game) - by NaochanON (play locally for proper framerate)

Invaders - by JKrueg

N

Number to Text - by Math Man

R

Ruler - by Nonki Takahashi

S

Smiley Maze Game - by Nik Coughlin

SnakeBite - by Davey Wavey

Soda Pop Showdown - by JKrueg

SokoCUTE - by kts99

Sorting Algorithm Demo - by Zeven

Space Invaders - by Davey Wavey 

Star Catcher - by NaochanON

Star Field Simulator - by JKrueg

Stay Away from the Blue Ball - by Todd

Super Pong - by Litdev

T

Tetris - by Kenneth Kasajian

Text Writer - by Todd

Tic Tac Toe (with menu) - by Nonki Takahashi

Tic Tac Toe (with tough AI) - by NaochanON

Tower of Hanoi - by Alex 2000

  

Leave a comment with more programs to add. We'll need a name and a link to download it. On TechNet Wiki, you'll find a version of this article that lists even more programs. (This blog post is limited to interactive programs that are easy to use, meaning they have little to no learning curve.)

Thanks!

   - Tall Basic Ed

What are the 14 Keywords of Small Basic?

$
0
0

In the Small Basic FAQ, it mentions there are 14 keywords:

What are the unique features of the Small Basic language?

  • Size
    The Small Basic language consists of just 14 keywords.

==========

Of the 14 keywords, we'll cover 16 of them in this blog post:

And
Else
ElseIf
EndFor
EndIf
EndSub
EndWhile
For
Goto
If
Or
Step
Sub
Then
To
While

==========

Examples...

 

If, Then, EndIf

If (Clock.Hour < 12) Then
  TextWindow.WriteLine("Good Morning World")
EndIf

Else

We can shorten two if..then..endif statements to be just one by using a new word, else.

If we were to rewrite that program using else, this is how it will look:

If (Clock.Hour < 12) Then 
TextWindow.WriteLine("Good Morning World") 
Else TextWindow.WriteLine("Good Evening World") 
EndIf

Goto

If (i < 25) Then 
Goto start 
EndIf

For, To, EndFor

For..EndFor is, in programming terms, called a loop.  It allows you to take a variable, give it an initial and an end value and let the computer increment the variable for you.  Every time the computer increments the variable, it runs the statements between For and EndFor.

This program prints out numbers from 1 to 24 in order: 

For i = 1 To 24 
TextWindow.WriteLine(i) 
EndFor

Step

But if you wanted the variable to be incremented by 2 instead of 1 (like say, you wanted to print out all the odd numbers between 1 and 24), you can use the loop to do that too.

For i = 1 To 24 Step 2 
TextWindow.WriteLine(i) 
EndFor

While, EndWhile

The While loop is yet another looping method, that is useful especially when the loop count is not known ahead of time.  Whereas a For loop runs for a pre-defined number of times, the While loop runs until a given condition is true. In the example below, we’re halving a number until the result is greater than 1.

number = 100 
While (number > 1) 
TextWindow.WriteLine(number) number = number / 2 
EndWhile

Sub, EndSub

A subroutine is a portion of code within a larger program that usually does something very specific, and that can be called from anywhere in the program.  Subroutines are identified by a name that follows the Sub keyword and are terminated by the EndSub keyword. Below is a program that includes the subroutine and calls it from various places.

PrintTime() 
TextWindow.Write("Enter your name: ") 
name = TextWindow.Read() 
TextWindow.Write(name + ", the time now is: ") 
PrintTime() 
Sub PrintTime 
TextWindow.WriteLine(Clock.Time) 
EndSub

And, ElseIf

  If  percentage >= 75 Then

    TextWindow.WriteLine("The student’s grade is A.")

  ElseIf  percentage < 75 And percentage >= 60  Then

    TextWindow.WriteLine("The student’s grade is B.")

  ElseIf  percentage < 60 And percentage >= 35 Then

    TextWindow.WriteLine("The student’s grade is C.")

  Else

    TextWindow.WriteLine("The student’s grade is D.")

  EndIf


Or 

Sub subRainyCount

    If Rainy = "y" Or Rainy = "Y" Then

       RainyCount = RainyCount + 1

    EndIf

EndSub

  

Why are there 16 Keywords instead of 14?

Okay, so that was a bit of a joke. Sorry if it was lost on you. Usually when you say/read/hear "Of the X items, we'll cover Y of them..." the Y number is smaller than the X number, not larger.

"And" and "Or" are actually Operators, and they don't count as the Keywords.

So the Keyword list looks like this:

Else
ElseIf
EndFor
EndIf
EndSub
EndWhile
For
Goto
If
Step
Sub
Then
To
While

And the Operator list:

And
Or

   

If you'd like to write up some short explanations of some of those keywords, I'll add your explanations above the examples. Just leave the suggested text in the comments!

Thanks!

   - Tall Basic Ed

 

How to debug Small Basic programs

$
0
0

Today's guest blogger is Nonki Takahashi:

Nonki Takahashi's avatar

 

About Nonki in his own words:

I am an amateur programmer. I used to program with one of BASIC language on an 8-bit micro computer when I was a collage student. At 2010, I started to program with Microsoft Small Basic. And I'm interested in making Go program and conveying the fun of programming.

My site :

http://www.nonkit.com/en/

 

How to debug Small Basic programs

I started to write Small Basic programs when Small Basic v0.8 was released.  And I created many programs and published them to Small Basic server.  Some information about my programs are introduced in Small Basic Forum.

Today, I'd like to introduce follwoing tips about how to debug your program written in Small Basic language.  And I will show you real samples for debugging with my programs.

I hope these information will help your development in Small Basic.

  • Use TextWindow.WriteLine() to show contents of variables
  • Write debug code such as "If debug Then..."
  • Write test programs for subroutines
  • List up bugs
  • Meaning of error messages
  • Use "Graduate" and Visual Studio debugger

 

Use TextWindow.WriteLine() to show contents of variables

When you find something wrong in you program, how do you find the cause?  Small Basic IDE (integrated development environment) doesn't have ability such like variable watching.  But in many cases, some variables have unexpected values in them.  To find that, let's add TextWindow.Write() or TextWindow.WriteLine() to look in variables for debugging.

To show an array "arry", you can simply use TextWindow.WriteLine(arry) or write code like the following code:

TextWindow.ForegroundColor = "Yellow"
num = Array.GetItemCount(arry)
index = Array.GetAllIndices(arry)
For i = 1 To num
  TextWindow.WriteLine("arry[" + index[i] + "]=" + arry[index[i]])
EndFor
TextWindow.ForegroundColor = "Gray"

 

For text base program debugging, changing foreground color may help you to distinguish program original outputs and debugging messages.

 

Write debug code such as "If debug Then..."

If you wrote a subroutine to show such like an array for debug, that code will be useful also in the future.  But, these code will be needed only when you debug.  So I recommend you to use debug flag to on and off your debug routines.

Maze 0.4 (PNC833-0) is a sample which has debug flag.  Following line sets debug flag off.  And debug = "True" will turn on the flag.

27 debug = "False"

The following lines call a subroutine to show array "cell" of created maze as text.

61 If debug Then
62  DumpMaze()
63  TextWindow.WriteLine(title)
64 EndIf

 

The following lines slow down creating maze to look and show variables and pause the program using TextWindow.Read().

229      If debug Then
230        Program.Delay(20)
231      EndIf
232      ' 2. Add the neighboring walls of the cell to the wall list.
234      AddWallToList()
235      If debug Then
236        TextWindow.WriteLine("iWalls=" + iWalls)
237        TextWindow.Write("nWalls=" + nWalls)
238        TextWindow.Read()
239      EndIf

 

And after debugging is completed, these lins are easily found (with [Ctrl]+F in Small Basic IDE) and removed.  Actually I removed these routines in Maze 0.5 (not published).

 

Write test programs for subroutines

To write generic subroutines (for general-purpose) will help your productivity.  In my case, some subroutines for colors, maths, mouse, and etc. are reused in many programs.  But generic subroutines should be well tested and have no bugs.  No (or less) bugs will be a prior condition for productivity.

To test your subroutines, I recommend you write a test program for them.  Good test program will find bugs from your subroutines and make easy to check regression after debugging.

A program which calculate comination nCr for big n (CPQ608) has a test routine TestDiv() for a generic subroutine Div().

Follwing parameters were found with TestDiv() and caused problem in Div().

  'a = "434399216531770650390143258708"
  'b = "6752306690329"
  'a = "397896921587794748049229269710"
  'b = "8642083658481"

 

List of bugs

The following list was written when I debug Shapes 1.1 (TLW744).  When you write lots of code, you may happen to meet many strange behaviors in your program.  If so, I recommend you write a list that includes each phenomenon.  Because there may be many defferent causes of the phenomena.  And after debubbing, this list will be a good test set for your program.

  • CalcOpposite() returns wrong value when shape re-sizing
    cause: variable func was not be set for the routine
  • Pinchs (small circles) remain after click out of shapes
    cause: not implemented yet
  • Frame sometimes not appear when shape moving
    cause: variable i didn't set as selectedshape
  • Pinches sometimes remain when cut and paste
    cause: duplicate as follows
  • Pinches don't redraw after copy
    cause: pinches are not displayed after paste
  • Shape moves after mouse release
    cause: needed to keep mouse released in mouse handler
  • Other shape size and position become wrong after color change
    cause: unnecessary RegisterShapeData() called and broke variable i
  • Other shape selected after adding ellipse or triangle
    cause: cancel adding procedure (when menu item clicked) set needless variable obj
  • Sometimes shape can't be moved
    cause: mouse released flag should be cleared

 

Meaning of error messages

There are two types of error messages given by Small Basic.  One is compile errors.  Another one is runtime errors.  These messages help your development.

Compile errors appear under source code just after "Run" button is clicked if your program has any syntax errors.  The following picutre shows errors of a program "Fifty" (BRQ733) :

Sorry, we found some errors...
11,28: The avairable 'files' is used, but its value is not assinged.  Are you sure you have spelled it correctly?
29,24: The avairable 'buf' is used, but its value is not assinged.  Are you sure you have spelled it correctly?
 

Numbers mean lines and columns of source code, and you can jump into the point in source program by double clicking the error message.  These kind of compile error messages show you what happened and some advice to fix them. In this case, errors happened because lines with File.GetFiles(path) and File.ReadContents(filename) have been automatically commented out by Small Basic server.

On the other hand, a runtime error appears while a program runs but happens to meet trouble which make the program stop.  Following picture is a sample of divsion by 0 error message.

Decimal type value is too large or too small.
Location System.Decimal..ctor(Double value)
Location Microsoft.SmallBasic.Library.Math.Remainder(Primitive dividend, Primitive divisor)
Location _SmallBasicProgram._Main()
 

The list shown in the text box is called stack trace.  This list shows you relations which subroutine calls whitch subroutine at the error.  In this case, the stack trace shows that main part of the program calls Math.Remainder() and occurs error.

 

Use "Graduate" and Visual Studio debugger

Despite writing many debug routines, some bugs may be too complicated to find their causes.  As a last option, I recommend you to use "Graduate" button to convert Small Basic program to Visual Basic program.  This allows you to use strong Visual Studio debugger to find causes of bugs originally in your Small Basic program.

Step 1: Install Visual Basic 2010 Express if you don't install yet.
Step 2: Push "Graduate" button and input folder name for converted Visual Basic program.
Step 3: Push [Next] or [Finish] buttons in Visual Studio conversion wizard.  Program XXX.sb (or XXX.smallbasic) will be converted to XXXModule.vb.
Step 4: Rewrite from 'For i = 1 To n' to 'For i As Primitive = 1 To n' to avoid scope error.
Step 5: Double click a source line to make the line as break point if needed.
Step 6: Push "Debug Start" button or [F5] to start program.
Step 7: If program stops at break point, push "Step In (F8)" or "Step Over (Shift+F8)" to continue.
Step 8: See "Auto Variable", "Local" or "Watch" tab and confirm the values of variables.
Step 9: If you find a bug, push "Step Debugging" button and rewrite your program with comment.
Step 10: Repeat from step 6 again.
 

If you confirmed a bug fix, go back to Small Basic IDE and fix program just as you did in Visual Studio.

There are some differences between Small Basic and Visual Basic syntax as listed below.

  • Array : arry[i][j] in Small Basic, arry(i, j) in Visual Basic
  • Variable type : Small Basic variables are type "Primitive" so sometimes need type conversion such as 'If ans = CType("", Primitive) Then'.

 

Conclusion

I learned about these tips within the last couple of years.  And I realized that Small Basic is very compact and a good language to learn programming with.  I hope many people will also learn and enjoy programming with Small Basic.  It's easy and powerful.

 

1942 - Featured Small Basic Program

$
0
0

Today we're featuring 1942 - by Laurent20.

For better performance, play the game locally by going here.

Or play it online here.



It's amazing how far we've come, huh? I remember playing this in the arcade. Now, in my chair.

Well great job to Laurent20 and to Ari Feldman, who created most of the art.

What do you think?

Do the lives keep coming back?

What's your high score?

Thanks!

   - Tall Basic Ed

 

Small Basic Extensions Gallery

$
0
0

The impossible goal is that this list will eventually contain every quality extension made for Small Basic.

I'm starting with some listed in the Small Basic Forums, but you should also come back later, because this list will evolve over time.

 

D

Data Extension (v1.0.3) - by Oskariok

E

ESL Extension (v.10a) - by Liam McSherry

Excel Library for Small Basic - by JSakamoto

F

Fast 2D Graphics Extension - by FuleSnabel

Fremy's Extension (v1) - by FremyCompany

I

IE Library for Small Basic - by JSakamoto

J

Joystick/Game Controller Extension (v1, prereq, how to) - by gungan37

L

LitDev Demonstration C# Extension Set - by LitDev

M

Math Extension (v.01) - by Zock77

Moving Extension (v1) - by Math Man

P

PlusPlus Extension (v2) - by gungan37

Power Array Extension (v1) - by EzyMCP

PowerExtension (VB.net) - by Noah Buscher

S

SayPlus! VB.net Extension (v1.3.2) - by AshkoreDracson

T

Teaching Extensions (v .034) - by LynnLangit& TeachingKidsProgramming

 

You can upload your extensions either at the MSDN Gallery or at CodePlex. In MSDN Gallery, you earn Recognition Points and Achievement Medals in the same system as the Small Basic Forums and as TechNet Wiki, where you can create how-to and troubleshooting articles about Small Basic scenarios.

Leave a comment with more extensions to add. We'll need a name and a link to download it. Find the community version of this gallery over on TechNet Wiki.

Thanks!

   - Tall Basic Ed

 

See Also

  

 


6 Lessons to learn Small Basic and graduate to Visual Basic!

$
0
0

Learn how to use Small Basic and to graduate to Visual Basic... in 6 steps!

Lesson 1: Getting Started with Small Basic

Lesson 1.1: Introduction to Small Basic - Estimated time to complete this sub-lesson: 30 minutes

Small Basic

Lesson 1.2: Statements, Properties, and Operations - Estimated time to complete this sub-lesson: 1 hour

Lesson 1.3: Variables - Estimated time to complete this sub-lesson: 1 hour

Lesson 1.4: Conditions and Loops - Estimated time to complete this sub-lesson: 1 hour

Lesson 1.5: Branching and Subroutines - Estimated time to complete this sub-lesson: 1 hour

Lesson 2: Graphics Window

Lesson 2.1: Introduction to Graphics Window - Estimated time to complete this sub-lesson: 1 hour

Graphics Window

Lesson 2.2: Turtle Graphics - Estimated time to complete this sub-lesson: 1 hour

Lesson 2.3: Exploring Shapes - Estimated time to complete this sub-lesson: 1 hour

Lesson 2.4: Sound, Program, and Text Objects - Estimated time to complete this sub-lesson: 1 hour

Lesson 2.5: Clock, Desktop, and Dictionary Objects - Estimated time to complete this sub-lesson: 1 hour

Lesson 2.6: Flickr, ImageList, and Network Objects - Estimated time to complete this sub-lesson: 1 hour

Lesson 3: Input and Output

Lesson 3.1: File Input and Output - Estimated time to complete this sub-lesson: 1 hour

ReadContents operation

Lesson 3.2: Stacks and Arrays - Estimated time to complete this sub-lesson: 1 hour

Lesson 3.3: The Math Object - Estimated time to complete this sub-lesson: 1 hour

Lesson 3.4: Events and Interactivity - Estimated time to complete this sub-lesson: 1 hour

Lesson 3.5: The Controls Object - Estimated time to complete this sub-lesson: 1 hour

Lesson 3.6: Debugging Aids - Estimated time to complete this sub-lesson: 1 hour

Lesson 4: Making Your Game

Lesson 4.1: Playing with Shapes - Estimated time to complete this sub-lesson: 1 hour

Lesson 4.2: Responding to Events - Estimated time to complete this sub-lesson: 1 hour

Lesson 4.3: Collision Detection - Estimated time to complete this sub-lesson: 1 hour

Hit the Target game

Lesson 4.4: Advanced Games - Estimated time to complete this sub-lesson: 1 hour

Lesson 5: Share

Lesson 5.1: Sharing Code - Estimated time to complete this sub-lesson: 1 hour

Small Basic programs

Lesson 6: Graduation Ceremony

Lesson 6: Graduating to Visual Basic - Estimated time to complete this sub-lesson: 1 hour

Small Basic

 

  

Anybody make it through all 6 lessons? And post a comment if you have a better time estimate for these sub-lessons!

   - Tall Basic Ed

Small Basic - New TechNet Wiki Contest!!!

$
0
0

Small Basic is now on TechNet Wiki!

Thanks to Noah Buscher, we already have two Small Basic articles on TechNet Wiki:

Thanks to Nonki Takahashi for translating them into Japanese already!

Go to this link for all the Small Basic English articles on TechNet Wiki:

Small Basic on TechNet Wiki

I'm going to be holding a contest for the best Small Basic articles on TechNet Wiki. The first contest will be held from now until 10/26/12.

There will be two winners...

  1. Best Article
    1. I will be a judge along with at least two guest judges from Microsoft
    2. Anybody can compete (including Microsoft employees, although the judges won't consider our own articles)
    3. We'll be looking for articles that are thorough, visually clear (images might help, but aren't necessary), and well written.
    4. Prizes include an interview post on this Blog, and a feature post on this blog of your article. You'll also be announced in the forums as well.
  2. Best Contributor
    1. This is for the overall person who has contributed the most (other than the winner of Best Article).
    2. Same judges (me and at least two Microsoft guest judges).
    3. We'll be taking into account overall number of edits/contributions, quality of additional material added to articles started by others, translations, etc.
    4. This is to acknowledge other important contributions to Small Basic content on TechNet Wiki... spelling corrections, grammar corrections, space formatting, adding tags, adding images, adding sections/scenarios, adding links to other Wiki articles, translating articles into other languages, updating information with current links/product names/details, and more!
    5. Prize is a blog post here that features them and their accomplishments. You'll also be announced in the forums as well.

You Must:

  • Include both the "en-US" tag and the "Small Basic" tag in your list of tags. Separate the tags by commas. So those tags will look like this: "en-US, Small Basic".
  • Include "Small Basic" in the title of your article. Such as "Small Basic: LitDev Extension".

Ideas for TechNet Wiki Articles:

  • Lists - Build a list of anything related to Small Basic. It could be a list to resources about how to build extensions (a Small Basic Extensions Survival Guide is what we'd call that). I got us started by creating a list of every Small Basic program. You can go add to that list now and begin your contributions!
  • How to - Want to show you did something amazing? It's a Wiki article waiting to happen!
  • Forums Answers - Have you answered a few questions in the forums? Well each of your forum answers is a Wiki article waiting to happen! On TechNet Wiki, there's even a tag to track each article that originated from a forum thread. The tag is From Forum.
  • Blog Posts - Have you written a blog post about Small Basic? If it was informational in any way, then it's a Wiki article waiting for you to make it!
  • About a Program - Create a Wiki article that features a program you or someone made in Small Basic. Include a link to the program code share page and an image or embed of the program!

How to get started on TechNet Wiki.

Other Benefits of contributing Small Basic content (or edits) on TechNet Wiki (other than our blog prizes above):

  • Contributing to the Small Basic Community's Knowledge - There's nothing more rewarding than knowing that you're simply helping people out. Because the content will become so well viewed (see below), this is the best way we can work together to help people learn about Small Basic. If you already wrote an answer in a thread, then it's much simpler, clearer, and better SEO to turn it into a Wiki article.
  • Recognition Points - TechNet Wiki is built into the same system of Recogntion Points that is used on the Small Basic Forum. As you build more recognition points, the community knows how experienced you are in the Microsoft community.
  • Achievement Medals - Similar to XBox Achievements, MSDN/TechNet uses an achievement system as well. TechNet Wiki uses the same system as the forums, so you'll be able to unlock many more achievements that are exclusive to TechNet Wiki.
  • Collaborative Authoring - Once you get into an active community where we help each other author content, fix each other's mistakes and combine our strengths, experiences, and expertise, you'll likely feel that authoring in blogs or white papgers is Selfish Authoring in comparison.
  • Increased Views - Posting article on TechNet Wiki means your content will get more views than alternatives. And there are several reasons...
    • SEO - TechNet Wiki has a great SEO, because it is a Wiki and it is on a Microsoft site (verses starting your own blog, for example). Also, for example, you might have answered a question in a thread. Someone is more likely to find your answer if they search the topic and can find it on the Wiki, where you laid it out clearly and titled it clearly. They don't have to scroll down the thread hoping their answer is in the discussion somewhere.
    • Cross-Linking - Like all Wiki articles, we'll cross-link the articles a lot, which means you'll get more traffic to your articles from other related articles.
    • Your Profile - When people click on your profile from the forums or from TechNet Wiki, they can get to your Activity and read your other Wiki articles and contributions.
    • Comments and Profile Links - TechNet Wiki borrows two concepts from the world of blogging... comments and profile links. As a result, you'll read peoples' comments on Wiki pages and will be able to click their profile name and see their activity and other articles. Also like blogs, on the right of the Wiki page, it clearly shows the Wiki author with a profile link and the latest contributor with a profile link. And then in the History tab, the profile links of the contributor for each contribution is also a link and clearly displayed. All this means a lot more opportunities for people to get to your profile (than any other wiki) and a lot more eyes on your Activities and other articles.
  • Continue the Social Interactions - Continue the social interactions from the Forums. Because there are comments on each Wiki article, you'll see people there who you see comment on this Blog and who contribute to the Small Basic forum. You can continue the interactions in the comments and with your Wiki edits. You'll also see when people you're familiar with have authored or edited articles so that you can check it out and see what they're up to.

 

Remember, you can go to this link for all the Small Basic English articles on TechNet Wiki:

Small Basic on TechNet Wiki

 

Please leave a comment below if you want us to take a look at your article. Otherwise, any article with "en-US" and "Small Basic" in the tags will be part of the contests. Non-English articles will also be part of the Best Contributor contest.

Thanks!

   - Tall Basic Ed

 

See Also

 

Small Basic Tutorial: A Simple Savings Calculator For Kids

$
0
0

 

Today, we have a special guest blogger, Philip Conrod! He is sharing with us an excerpt from their book for kids, Beginning Microsoft Small Basic by Philip Conrod and Lou Tylee. You can find their books and other materials at the Computer Science For Kids web site. Thanks to Philip for sharing. Please enjoy!

 

==================

 

A  Simple Savings Calculator For Kids

In this program, we will build a savings account calculator. We will input how much money we can put into an account each month and the number of months we put money in the account. The program will then compute how much we saved.

Program Design

The steps needed to do this calculation are relatively simple:

  1. Obtain an amount for each month’s deposit.
  2. Obtain a number of months.
  3. Multiply the two input numbers together.
  4. Output the product, the total savings.

We will use the ReadNumber method to get user input. The WriteLine and Write methods will be used to output the savings amount. We’ll throw in an additional step to ask for the user’s name (an example of using the Read method).

Program Development

Start Small Basic. Click the New Program button in the toolbar. A blank editor will appear. Immediately save the program as Savings in a folder of your choice.

First, type the following header information and code that adds a window title:

1.  '
2.  '  Savings Program
3.   
4.  '  Beginning Small Basic
5.  '
6.  TextWindow.Title = "Savings Calculator"

We will use four variables in this program: one for the user’s name (YourName), one for the deposit amount (Deposit), one for the number of months (Months) and one for the total amount (Total). Type these lines to initialize the variables:

1.  YourName = ""
2.  Deposit = 0.0
3.  Months = 0
4.  Total = 0.0

Now, we start the code, using the steps outlined under Program Design. At any time, after typing some code, you might like to stop and run just to see if things are going okay. That is always a good approach to take. First, ask the user his/her name using this code:

1.  '  ask user name
2.  TextWindow.Write("Hello, what is your name? ")
3.  YourName = TextWindow.Read()
 

Next, determine how much will be deposited in the savings account each month:

1.  TextWindow.WriteLine("")
2.  ' get deposit amount
3.  TextWindow.Write("How much will you deposit each month? ")
4.  Deposit = TextWindow.ReadNumber()

Notice the insertion of a blank line before printing the prompt. Finally, obtain the number of months:

1.  TextWindow.WriteLine("")     
2.  ' get number of months
3.  TextWindow.Write("For how many months? ")
4.  Months = TextWindow.ReadNumber()

With this information, the total deposit can be computed and displayed using a WriteLine method:

1.  TextWindow.WriteLine("")
2.  '  compute and display total
3.  Total = Deposit * Months
4.  TextWindow.WriteLine(yourName + ", after " + months + " months, you will have $" + total + " in your savings.")
5.  TextWindow.WriteLine("")

Save your program by clicking the Save button.

The finished code in the Small Basic editor should appear as:

 
1.  '
2.  '  Savings Program
3.  '  Beginning Small Basic
4.  '
5.  TextWindow.Title = "Savings Calculator"
6.  '   initialize variables
 
7.  YourName = ""
8.  Deposit = 0.0
9.  Months = 0
10.Total = 0.0
 
11. 
12.'  ask user name
13.TextWindow.Write("Hello, what is your name? ")
14.YourName = TextWindow.Read()
15.TextWindow.WriteLine("")     
 
16.' get deposit amount
17.TextWindow.Write("How much will you deposit each month? ")
18.Deposit = TextWindow.ReadNumber()
19.TextWindow.WriteLine("")     
 
20.' get number of months
21.TextWindow.Write("For how many months? ")
22.Months = TextWindow.ReadNumber()
23.TextWindow.WriteLine("")     
 
24.'  compute and display total
25.Total = Deposit * Months
26.TextWindow.WriteLine(yourName + ", after " + months + " months, 
27.you will have $" + total + " in your savings.")
28.TextWindow.WriteLine("")

Run the Program

Run your program. If the program does not run successfully, try to find out where your errors are using any error messages that may appear. We will cover some possible errors in the next class.

When the program runs successfully, you will see:

Type in your name, a deposit amount and a number of months. Your total will be given to you in a nicely formatted string output. Notice how the name, deposit, months and total are all put together (concatenated) in a single sentence, along with a dollar sign ($). Make sure the answer is correct. Remember, a big step in program design is making sure your program works correctly! If you say you want to save 200 dollars a month for 10 months and your computer program says you will have a million dollars by that time, you should know something is wrong somewhere!

When I tried the program, I got:

Notice if I deposit 403.52 (you don’t, and can’t, enter the dollar sign) for 11 months, the program tells me I will have $4438.72 in my savings account.

This program may not seem all that complicated. And it isn’t. After all, we only multiplied two numbers together. But, the program demonstrates steps that are used in every Small Basic program. Valuable experience has been gained in recognizing how to read input values, do the math to obtain desired results, and output those results to the user.

Other Things to Try

Most savings accounts yield interest, that is the bank actually pays you for letting them use your money. This savings account program has ignored interest. But, it is fairly easy to make the needed modifications to account for interest - the math is just a little more complicated. We will give you the steps, but not show you how, to change your program. Give it a try if you’d like:

  • Define a variable Interest to store the yearly savings interest rate. Interest rates are floating decimal numbers.
  • Add additional statements to allow the user to input an interest rate.
  • Modify the code to use Interest in computing Total. The code for that computation is (get ready - it’s messy looking):

Total = 1200 * (Deposit * (Math.Power((1 + Interest / 1200), Months) - 1) / Interest)

Make sure you type this all on one line – as often happens, the word processor has made it look like it is on two. As we said, this is a pretty messy expression, but it’s good practice in using parentheses and a mathematical function (Power). The number ‘1200’ is used here to convert the interest from a yearly value to a monthly value.

Now, run the modified program. Type in values for deposit, months, and interest. Make sure you get reasonable answers. (As a check, if you use a deposit value of 300, a months value of 14, and an interest value of 6.5, the total answer should be $4351.13. Note you’d have $4200 without interest, so this makes sense). Save your program.

I told a little lie, I didn’t get $4351.13 in the above example with interest. I actually got $4351.1272052172923076923076923!!!:

I rounded the answer. In such cases, the number should just be displayed with two numbers after the decimal. It is possible to do this using Small Basic but beyond the scope of our discussion at the moment.

Summary

Notice the programs are getting a little more detailed as you learn more Small Basic. In this class, you learned about proper program design, mathematical functions and how to add input capabilities to your Small Basic programs. You built a little savings account program. And, an important concept to remember as you continue through this course is to always try to build your programs a few lines of code at a time. A good mantra is “code a little, test a little.” You will introduce fewer errors in your programs using this approach.

This chapter excerpt is adapted from the book Beginning Microsoft Small Basic by Philip Conrod and Lou Tylee.

To purchase this book in its entirety and to browse their other computer programming materials for kids, please see the Computer Science For Kids web site.

  

 

Excerpt © Copyright 2012 By Kidware Software LLC  All Rights Reserved.  Philip Conrod & Lou Tylee have co-authored dozens of books and tutorials for beginning Microsoft Basic, Small Basic, Visual Basic,  and Visual C# developers of all ages for over 25 years. 

The Unique Features of the Small Basic Language

$
0
0

This blog post originates with the question in the  Small Basic FAQ. We also wanted to give the community a chance to answer this question in depth in the TechNet Wiki article.  

What are the unique features of the Small Basic language?

  • Imperative
    Just like the early variants of BASIC, Small Basic is imperative and doesn't use or expose beginners to concepts like scopes, types, object orientation, and more.
     
  • Size
    The Small Basic language consists of just 14 keywords. 
     
  • Ease of Use
    The language only uses text operators (AND, OR); not symbol operators like { } or & and |  
     
  • Easy to Share 
    Share programs easily with the "Publish" and "Import" buttons, which share programs to and from the Small Basic program share server (smallbasic.com). Example.
     
  • Type System
    There actually isn't one. You can create string and numeric constants and assign them to variables. Operations performed on these variables will be interpreted according to the content.
     
  • Variables
    All variables are global and are always initialized. They can be used before they're assigned.
     
  • Events
    You can create a sub-routine and assign it to an event. This will wire the it up to an the event.
     
  • Libraries
    The libraries provide static "Objects" that group operations, properties and events. New libraries can be created using other .Net Languages and added to the Small Basic runtime.

What should be added to this list? Leave a comment!

You can also add to the community version of this list on TechNet Wiki.

   - Tall Basic Ed

Getting Johnny to Code (response to "Why Can't Johnny Code?")

$
0
0

Today's guest blogger is Coding Cat, Matthew Parets:

Coding Cat's avatar
 
 
Coding Cat is Matthew Parets, a Computer Science teacher, one that I would have loved to have had. You probably would too, after you read this blog post. Here is a brief bio about Matthew in his words:
 
I have been working with the PC since its inception in the early 80's. I was a professional developer / programmer-analyst / software engineer -- choose your favorite title -- for twelve years. During that time I worked for a wide variety of companies, on wide variety of topics in a wide variety of languages.  My focus was always on low level system and language design. During the industry flame out following the burst of the dot-com bubble, when innovation stalled and things were boring, I returned to school to earn a masters in computer science and began teaching. As it turns out, influencing the nerds of the future is just as entertaining as being one yourself.

======================== 

 

Do you want that bright and creative kid to try out programming?

Give them a goal to reach. If you make the goal interesting and attainable the kid will claw their way to the finish line and then beg for more.

The topic of this article is of course a take on the famous white paper "Why can't Johnny code?" by David Brin. In the article David discussed how the first wave of computers nerds were seeded because of the ubiquitous nature of the programming language BASIC on all of the early micro computers. And, the fact that we are not seeing another wave of energetic computer nerds is because of this loss of universality of easy to write code.

Small Basic was born of that spirit, with its driving goal to make BASIC ubiquitous, easy and fun again. While it has fallen short of the lofty goal of being on the desktop of every Windows machine, it has succeeded beautifully in making programming easy, approachable and fun.

But it takes more than great tools to spark a fire in a potential computer nerd.

It also takes drive.

Drive, because programming can be incredibly frustrating for a beginner. Even in an environment as friendly and fun as Small Basic, writing your first programs can push you easily into insanity. I have seen this happen repeatedly. A curious and bright young student sits down at the computer wanting to know how a computer program works, and how they can get the machine to do their bidding. Half an hour later they are pulling their hair out because they have encountered one syntax error after another. At the end of their first hour they have given it up because they haven't managed to build their first person shooter.

Without drive to push past the frustration nothing is sparked.

As a Computer Science teacher I teach programming at a lot of different levels and I have discovered an interesting truism: Nothing is more important than how you teach your Introduction to Programming course. I keep it simple. We stick the four basic operations of the computer: Move, Add, Compare and Jump. Move - using tools and variables. Add - the basic math operations. Compare - conditional operations (if). Jump - Looping and subroutines (goto, for, while and sub). While I do spend a small amount of time lecturing, and give the students a small amount of background reading to do, the lion share of the time in the classroom is spent building that drive.

Each section is started with a goal to reach. To reach that goal they need to make use of the tool or technique we are focusing on that day. Sure, I act silly; talk about pirates and fighting space aliens; but at the end of the day that attainable goal is all the magic I really need. When the kids reach that goal, they feel the same jazz that courses through them as when they are killing zombies in a video game.

At first the goals are simple, and I walk them through the process. By the middle of the semester the goals are becoming complex, requiring multiple steps, and there is the real kicker… the kids are driving the discussion. They want to know what it takes to reach the goal. They want to know how to conquer the system.

The drive towards a goal is all the motivation they need to push past the initial frustration and become true programmers. If you also manage to make it fun, you will also find that you are growing a crop of computer nerds; and as a Computer Science professional, nothing is more rewarding.

The goal of any Computer Science educator has to be fueling that drive. Teachers need to fuel the drive if they hope to keep their classrooms full. Corporations need to fuel the drive if they hope to keep climbing the ladder of competition. Parents need to fuel the drive if they hope to raise a child full of intellectual curiosity. With that drive students themselves have the drive to push through the frustration and see results for their efforts.

Everyone wins

Small Basic - The Wave Challenge (September Challenge Results)

$
0
0

You can find the challenges of the month in the Small Basic forums. Here are the October challenges.

For the September challenge, the Wave Challenge was offered in the Physics Challenge section:

Create a program to simulate waves.  Quite a general challenge so tackle it how you want - could be a water wave (2D) or a wave along a string (1D).

Note that there's a Physics Challenge each month.

Here is Noah's review of the Wave Challenge:

"After I finished looking at [the September] challenges, when I saw the Wave Challenge, I was very excited to see what some people would come up with. My personal wave challenge favorite is NaochanON's response. The waves are very nice, and the wave loading sequence. My only complaint was that the boat sometimes did not keep up with the wave. Overall... 9/10. Great job!

Here is Naochan's Wave Simulation:

  

See the simulation in action here.

And then here is JKrueg's version:


Interact with it here. You can tap Up on the arrow keys for a bigger wave and Down for a smaller wave.

Enjoy!

   - Tall Basic Ed

 

Small Basic - Elementary Student Testimonials

$
0
0

This blog post is a work in progress. It will start light, but it will grow as we collect testimonials. Please add to it by leaving comments below. Please include the age and grade of the child and then a paragraph that explains how well the student was able to learn Small Basic. It can be a story, an example, or in any form you'd like. We'll list the youngest students at the top. We're looking for students age 1-13.

 

Ray FAST's son, age 8, 3rd grade:

I taught my little one the concept of DLL.  Now he understands he needs the dll and .exe to run a SB program.  It wasn't too difficult for a 3rd-grader to grasp the concept :)

  

Math Man, at age 9, 4th grade:

I am 10 years old. I went through the first few Curriculum Guide lessons with another classmate and a teacher when I was 9, but after that, I just felt like going at my own pace, so I went ahead and self-taught myself the rest of them. I was doing around 3 or more lessons a day, and it was very fun seeing the results of what just a few lines of code could do. I decided that it got boring just copying those already written programs into the Small Basic UI, so for every lesson, I tried to make my own program using what I had learned from all the lessons I had done. I was making programs to draw a man growing chicken pox, have the user control the turtle to eat apples, and other miscellaneous things. Now, from all that I have learned from looking at others' programs on the Small Basic forum, I have memorized basically all the objects, properties, functions, and keywords of the Small Basic language and how they are useful. In fact, I have actually learned what the sine and cosine functions can do while writing programs. I have been monitoring the Small Basic forum for a long time, but I didn't have an account here until a while ago. I like helping with others' problems on this forum and writing miscellaneous programs.

  

Michael Scherotter's son, Alex, at age 9, 4th grade:

This past week I had a great time teaching my 9-year-old son Alex and 9 of his friends computer programming in my home.  I used Kodu Game Lab and Small Basic, two free tools created for kids to learn programming. 

My son Alex, age 9, wants to learn about computer programming so I decided to try something fun – to teach it to him.  In my day job, I explain and demonstrate Microsoft’s software development technologies and I’ve been programming since I was about ten so I think I know what to do.  I wanted to do something really fun for Alex, and kind of adventurous, so I invited 9 of his friends to join him and next week I will be teaching a group of 8 boys and 2 girls programming in my home on my dining room table.  Each camper will be bringing their family computer...

Small Basic is an easy-to-use version of the BASIC language that I first learned to program with on Radio Shack TRS-80s. As Lou Reed said, “it’s the beginning of a great adventure”. We started out with learning about the Small Basic programming environment, and got familiar with the idea of statements, properties and how to write code and run it.  We were also able to cover variables, conditionals, and loops with a number of exercises along the way where the campers experimented and tweaked their programs until they had something that might make the other campers laugh.

Then we got to the turtle.  Small Basic has a “turtle drawing” mode where you can enter commands to make a turtle move and draw with just a little code... Turtle.Show() Turtle.Move(20) Turtle.Turn(45)

That’s when the kids lit up.  They saw that their actions with code made drawings on the screen.  I then introduced the idea of the loop that they learned earlier and they started to make designs with repeated turns and moves.  Once I showed them that you could add color and change the turtle’s speed, there was no stopping them.  At that point, the decibel level in the room rose exponentially as the campers created programs and showed them to their friends.  This was big fun!  Take a look.

  

Mark Derksen's son, age 10:

Thanks to Small Basic, My son (10 years old) has taken his first steps as a developer. His enthusiasm proves to me, you are on the right track!
As a .Net developer, this make me a very proud father.

  

AirWaves, at age 11:

I started using Small Basic when I was 11, around two years ago, and I was amazed at how simple coding actually turned out to be. Learning a language like this is probably the best step one can take in their path to learning more advanced languages. Since then I have learned 5 other languages, but I can still look back at how far I came, and remember the good old times.

Thanks Small Basic for launching my life into a better direction.

  

Fred Postnov (Russian), age 11, 5th grade:

When I was 9, I was a real computer gamer. My dad taught me some 3DS Max, and I really liked making entities and space ships. But one day, I realized that perhaps video games are created somehow, and I asked my dad what was the secret of programming. My dad said that he knew almost nothing except Basic. He told me it was very old, and stuff. But I asked him: can you please somehow show it to me?

He found the compiler in a few days. And however Basic was small and easy, I still felt like a god of possibilities. Later, when my grandfather found out I was actually programming, he called us on Skype, and he told us he found an awesome program on the Internet (Smallbasic), and gave us a link. When I downloaded it, I didn't quit my computer for days, because I was programming.

     

Gungan37, at age 12, 7th grade:

I learned Small Basic when I was 12, while I was in 7th grade. I can remember the feeling I got when I found Small Basic on the Microsoft Download Center. I read the description and immediately downloaded it. I showed my parents the “Hello World” program I made and kept on going, next writing a Fahrenheit to Celsius converter. In a couple of years, after mastering Small Basic, I went on to C#. I quickly picked up C# by looking over code by Litdev, a Small Basic extension developer and community contributor. Within a year of that, I learned x86 assembly (picking up some C and C++ along the way), then Visual Basic, TI-Basic for calculators, J# and Java. Now, I am a 10th grade and am working on an operating system, CM-DOS, which is in C# and assembly language. Without the Small Basic Language and the very helpful community (such as Litdev), I would no doubt be an OS developer and programmer today. Thanks guys! 

 

Amir CPS (Indian), age 12, 8th grade:

I am Amir a 12 year old 8th grade student from India. The story began when our school organised a visit to Microsoft India centre last year. A guy from Microsoft gave us a presentation how small school children can easily learn the concept of "Computer Programming" using Small Basic. Now Small Basic is being taught in our school instead of "C++" which was like a nightmare for us and i used to think that there are pre-defined codes for every single task i was wrong though. Thanks to Small Basic it helped me to learn the "ABCD" of programming and now i can transform my imaginations right into the computer program.

 

Creative One, at age 12:

I started at 12 (13 now), and I have to say, Small Basic is quite fascinating. The UI is well designed, the code pretty much works the way its expected, and you have ultimate control of the programming.

 

Flostian, at age 12:

I'm now 13 and I startet programing when I was 12. I first startet with an easy German language (because I am a German), but it had a lot of functions, which it does not explain. Because the language was German, there wasn't many people who were using it and could it explain to me.

I started to code in Small Basic.

It's really fascinating to code things that seem to be very easy and operations you usually do automatically in your mind; because it's really funny to see how bright such a simple thing can be. And of course it's a wonderful feeling to see a program working if you had spent a lot of time writing it.

 

Noah Buscher, age 13:

I am 13 years old, and I think [Small Basic] is a great way to get kids and adults alike into the world of programming. I think that the simple UI makes it easy to focus on the code, and not the hassle of some more advanced languages.

  

Zock77, at age 13:

I have been wanting to program since I was around 8 years old, but all the languages I found were just too big of a step. (Even with a bigger brother who knows almost all of them.) But then my Dad found Small Basic, and I have been programming with that. I started at 13 (I'm 14 now). Now I'm just stepping into Visual Basic!

     

Joman Mied, at age 13, 8th grade:

I had been looking for programming software since I was 12 (grade 7), and I found Small Basic when I was 13 (grade 8). I worked through the tutorials one at a time, and because of the language being easily comprehensible, I caught on fast! To this day (grade 10), I am still learning new things about it, but I am able to make some cool (but simple) programs. I love how Small Basic uses a language close to English; easy to use "psuedo-code" if I forget something. Small Basic is a great first step to programming, and I am so glad I found it!

  

Please keep the testimonials coming! Leave a comment below, with...

  • The student's age and grade
  • A story, example, or other explanation of how the student was able to learn Small Basic.

The only other guideline is that we're looking for tesimonials about students, age 1-13. (This was updated from age 1-12 because we saw that we have many active 13-year old contributors.)

Thanks!

   - Tall Basic Ed


Small Basic - TechNet Wiki Contest Update!!

$
0
0

This content contest is coming to a close. Read about it here:

Small Basic - New TechNet Wiki Contest!!!

Here are our contestants for the "Best Article":

  

Here are our contestants for Best Contributor:

   Nonki

   Gungan

  • 8 contributions on TechNet Wiki Small Basic articles in the last 2 days
  • 18 total article edits

   Luigi

 

Thanks everyone! I'll post the results on the blog next week!

   - Tall Basic Ed

 

See Also

 

Click the Button - Small Basic Featured Program

Small Basic Contest Winners!!! - TechNet Wiki Content

$
0
0

A few weeks ago I announced the Small Basic on TechNet Wiki Contest. Last week I provided an update.

Today we're going to announce our winners!

 

The Microsoft judges were Mike H, Ray FAST, and me.

The first category is Best Article. We're looking for articles that are thorough, visually clear (images might help, but aren't necessary), and well written.

Here are the top 3 winners...

Liam McSherry's avatar
 

1. Liam McSherry for Small Basic: How to Create an Extension Using C#

It's clean, well written, and very useful for the more advanced Small Basic users, for developers who want to extend the language.  

 

Nonki Takahashi's avatar
 

2. Nonki Takahashi for Small Basic: How to Debug

It's also very clean, thorough, easy to read, and makes good use of images and code.

A special mention goes to another excellent article from Nonki, Small Basic: Control Statements.

For those who don't know, Nonki also made a Small Basic program that generates a code block specifically designed to insert Small Basic code into places like TechNet Wiki. Check out his Code Block Generator v1.3, and the TechNet Wiki article he wrote about it.

 

3. Gungan37 for Using the Joysticks / Game Controllers Extension for Microsoft Small Basic

Also very clean and good use of code, it's a milestone for the first Small Basic article that explains an extension in depth! 

Special thanks go to Liam for helping contribute to the article.

 

Thanks go out to everyone else who wrote articles and everyone who helped edit the articles and make them better! Our winner (Liam) will receive an interview on this blog and a blog post that features his article. Here are the resulting blog posts for Liam...

=====================

  

Our second contest was the Best Contributor of the two week period. This is to acknowledge other important contributions to Small Basic content on TechNet Wiki... spelling corrections, grammar corrections, space formatting, adding tags, adding images, adding sections/scenarios/information, adding links to other Wiki articles, translating articles into other languages, updating information with current links/product names/details, and more!

 
Nonki Takahashi's avatar
 

   1. Nonki Takahashi

  

   2. Gungan37

 
Luigi Bruno's avatar
 

   3. Luigi Bruno

 

The prize for best contributor will be a blog post that's more dedicated to some of Nonki's contributions. Here is the resulting blog post for Nonki:

 

Thank you to everyone who has contributed, and jump on in! The Wiki is warm!

   - Tall Basic Ed

 

See Also

 

Small Basic - The Gas Physics Challenge

$
0
0

As usual, LitDev has concocted some great November challenges, based on ideas from the Small Basic community!

Today we're going to focus on a Physics Challenge that's challenging even to think about... The Difficult Gas Challenge!

  

Welcome to the monthly Small Basic Challenge!

These challenges are intended for people who are learning to program for the first time or for those returning to programming who want to start using SmallBasic.  Some will be easy, some will be hard - but they will all make you think, and more importantly be GREAT FUN!

Please post your solutions / partial solutions / questions / feedback etc. into this thread that will remain 'sticky' for the month.  The only rule is that your solution must use standard Small Basic methods (no extensions).

Physics Challenge

Running out of simple physics challenges - this one isn't much harder, just takes more explaining.

An ideal gas has the following equation relating its pressure (P Bars), volume (V litres) and temperature (T degC).  http://en.wikipedia.org/wiki/Ideal_gas

(1)    P * V / (273 + T) = constantA (ideal gas equation)

This means that if we know the starting state (P, V & T) and any 2 quantities are changed then the 3rd can be calculated.

If we start at P = 2 Bar, V = 1 litre and T = 20 C and change the pressure, volume or temperature, then the others will change to keep the equation equal to constantA.

For example if we keep the temperature constant and double the volume, then the pressure will half (Boyle’s Law).

If there is no heat transfer (or technically no entropy change), then the following equation also holds for gases.  https://en.wikipedia.org/wiki/Isentropic_process

(2)    P * V^g = constantB (isentropic or adiabatic expansion)

g is a property of the gas (isentropic exponent), for air it is about 1.4.

V^g means V to the power of g; in SmallBasic this is Math.Power(V, g).  If you don’t know about powers then use P * V * V = constantB.

If we know the starting pressure and volume, then we can calculate the change in either P or V if the other is changed.

An example of gas compression heating a gas is the warming of a bicycle pump, and gas expansion cooling a gas might be ice that forms on the nozzle when a CO2 fire extinguisher is used, or even how a fridge works.

So if the volume changes, then the pressure will change according to (eqn 2) and the resulting pressure and volume change lead to a change in temperature (eqn 1).

Calculate and perhaps plot the change in temperature and pressure as we increase (expand) or decrease (compress) the gas volume.

Hint: Equations 1 and 2 can be written to show how the initial and new values of P,V,T are related:

(273 + T2) / (P2 * V2) = (273 + T1) / (P1 * V1)
P2 = P1 * (V1/V2)^g
where P1,V1,T1 are initial values and P2,V2,V2 are new values.

How much must we expand 1 litre of air to cool it from 20C to 0C?  What is the pressure change if we start at 2 Bar?

Not a programming question, but would it take more or less or similar effort pump up a cycle tire on a hot or cold day?

 

Join this challenge here: Challenge of the Month - November 2012

Thanks!

   - Tall Basic Ed

Featured Article - Small Basic: How to Create an Extension Using C#

$
0
0

Liam McSherry won our TechNet Wiki contest! Here is a sample of the winning article...

Introduction


Microsoft Small Basic, while a good language for a beginner, is rather limited once you really get into programming. If you feel you're rather advanced with Small Basic, but you also feel that you're being limited by it, you may want to write an extension. You may also wish to write an extension simply to help the Small Basic community by expanding what they have available to them.

To write an extension for Small Basic, you'll have to select a CLR-compatible language to write in. This tutorial will be using Microsoft C#, but there is a large selection of languages compatible with the CLR which can be used to write a Small Basic extension (and we have a tutorial for writing an extension in Visual Basic.NET here). This tutorial will assume that you have a grasp of using Visual Studio, which is the preferred environment for developing for the CLR. Microsoft Visual Studio 2012 Professional will be used in this tutorial.

Setting up your Visual Studio Project


Small Basic is built for version 3.5 SP1 of the .NET Framework, and won't be compatible with extensions in any other versions of it. You will want to create a class library (as outside of Small Basic "extensions" are generally referred to as libraries, or libs for short). You'll have to select ".NET Framework 3.5" from a dropdown at the top of the "New Project" window, and you'll have to select "Class Library", as shown below.



You will also need to add a reference to SmallBasicLibrary.dll, which can be found inside the directory you installed Small Basic to. We need this library because it allows us to flag classes with an attribute that makes the Small Basic IDE show them. Once you have added the reference. you'll also want to include the namespace in your code file.

 
=============
 

To read the rest, including instructions about how to program your extension, check out Liam's article on TechNet Wiki:

Small Basic: How to Create an Extension Using C#

Thanks to Liam and everyone who has made Small Basic articles on TechNet Wiki!

   - Tall Basic Ed

 

See Also

   

Viewing all 669 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>