BBC BASIC: Search for a string in a string - basic

I have to write in BBC Basic at school (which I know nothing about) and have to write a program that searches for a string within a string.

Use the INSTR function.
I never heard about BBC BASIC before, but your school should provide you documentation about it if it forces you to learn that BASIC. But at this basic level, all BASIC dialects are very similar. Even if you don't find anything about BBC BASIC, you can try any tutorial about Visual Basic, QBasic, Turbo Basic, GWBasic etc.

Related

Hello world for spoken NLP interaction (like Siri)?

If I have zero experience developing spoken NLP interaction, what is the easiest way for me to make a Hello World, and begin experimenting from there?
Any platforms and programming languages and APIs are relevant here, as long as they give me the most basic equivalent of Hello World AND are flexible enough that I could potentially play around for a few hours in that environment using various public REST APIs and glueing strings/regex together and get some useful demo apps out of it.
Please offer kind suggestions to improve this question if it's not clear enough, since it's probably a topic on a lot of programmers' minds and something which is not yet mainstream.
If you want to play with building blocks, you can use:
either SphinxCMU or the Google's voice recognition API (used by Chrome) to turn the user's voice into text
the Wit API to extract meaning (the user intent/question) from text
and then our own module to build an answer
Start looking on existing projects like this one:
Pi-Voice
read the code and analyze what they are doing. Those are toys anyway since technology behind Siri is quite complex
To get a deep understanding of the technology read the papers from the CALO project which was a Siri base:
Calo Project Website

Where can I find a quick reference for standard Basic?

The reason? Pure nostalgia.
Anyway, there was a standard for Basic that was published in the late 80s or early 90s. It was probably ISO/IEC 10279:1991, but I don't have access to that and cannot be sure.
Whatever this standard was, some of the syntax made its way into Borlands Turbo Basic and Microsofts Visual Basic. I never learned any significant amount of VB, but Turbo Basic is one of those things I played with in my mis-spent youth.
At one time, my main reference was an article published in one of the main computing periodicals - maybe Personal Computer World, maybe Byte.
A scan of that article (if anyone can even identify it) would be great, but all I really want is a few pages quick reference of that standard syntax. Must be free (I'm not that nostalgic), but it must describe the standard syntax - the whole point is to sort out what is standard as opposed to VB or whatever.
EDIT The more I think about this, the more convinced I am that this standard was available around 1987 or 1988. Maybe it was the earlier non-full version of the standard above, or maybe it was pre-acceptance of the standard.
Take a look at this PDF of a Dartmouth College BASIC manual from October 1964 if you're awash in nostalgia. Dartmouth's then-president John Kemeny invented the language (as you may know) and the 1960s and 70s-era Dartmouth Time Sharing System offered the language for its users to run programs on ancient GE mainframes in one of the first shared environments out there. (Find out more about DTSS here.)
The ANSI standardization process was underway in the mid-80's and Kemeny & Kurtz (the original inventors of BASIC) founded "True Basic" to market a standard BASIC to the PC market. Around this same time the 8th edition of BASIC on DTSS was renamed "Dartmouth Standard Basic", to emphasize its standard compliance.
True Basic hewed pretty closely to the ANSI standard, but I haven't been able to find a copy for their reference manual online. This list of TB functions and commands may give you some idea though.

What are basic programs like, recursion, Fibonacci, small trick programs?

This question may seem daft (I'm a new to 'programming' and should probably stop if this is the type of question I'm required to ask)...
What are:
"basic programs like, recursion, fibonacci, factorial, string manipulation, small trick programs"?
I've recently read Coding Horror - the non programmer and followed the links to Kegel and How to get hired.
Then I delved through some similar questions here (hence the block quote) and I realised that as a fully fledged non-programmer I probably wouldn't know if I knew recursion (or any of the others) because I wouldn't know what it looked like, or why it was used, and what the results would look like after it was used.
I suppose I'm trying to get a picture of "the basics". What the principles are and why we learn them - where they'll be used and what result/s your looking for.
If they'll be used as an interview question during my first interview sometime in 2020 I would like to look less ignorant than those 199 out of 200 who just don't know the how, or the why, of programming.
As always...I'll get my coat.
Thanks
Mike
Before you can get into concepts like recursion, you need to learn the basics, as you said. I'm not sure what your education level is or where you're planning to go with it, but my favorite programming text is "How to Think Like a Computer Scientist" (link text).
This will teach you the core fundamentals of programming, and you need to understand these building blocks before you delve deeper.
Traveling Salesman Problem

First programming language after web development? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I've been thinking of making a desktop program but I have no experience in that. I've been programming in PHP, ASP and JavaScript before. Java seems to be nice since you can run it on all OS. But what I really want is result, I do not really care what language makes me a good programmer (I'll take that later in college :P). I've tried both C# and Python before but it was only console applications.
So, what programming language do you recommend to me?
If you want Windows results, C#. If you want cross-platform results, Python.
You could also just pick randomly. Or you could try them all. Or look at the 16 trillion previous questions on this exact same topic.
UPDATE:
To find those questions, I mentioned, try some Google fun:
"what language" OR "which language" learn site:stackoverflow.com
My personal bias would be towards learning functional programming (Scala or even lisp would be nice). But, honestly, any language could improve your skills pretty dramatically at this point. Just take a look at a few of the mainstream ones, and pick the one that suits your interest the best.
For some ideas (not in any particular order):
C - Learning the low-level details of memory allocation can be useful background. If you use Linux, there's tons of sample code in Gnome apps to show you how to write reasonably elegant code in the language.
C++ - C on steroids... there's lots of complexity here if you want to learn it, but it can also be a great language to have in your arsenal.
C#/Java - Nice, high-level, reasonably portable languages. I prefer the C# language over Java, but there are advantages and disadvantages to each (Java portability is better). In the end its just a matter of preference, and external factors (legacy codebases may swing you one way or the other).
Scala - Java on Steroids - Really nice language, but the learning curve can be a bit steep, IMO.
Python/Ruby/Lisp/etc - Nice scripting languages, most of which are easy to learn, and all of which will lead to new ways of thinking about problems.
Honestly, in the end, the most important rule is just to have fun. Look through the basic "hello world" tutorials and just pick the one that looks the most pleasant. Learning never hurts.
I've found that making desktop applications in C# / VB.NET (I'd strongly recommend the former) can be much easier than other languages, particularly with a good IDE such as Visual Studio (or the free Express editions) or Sharp Develop. It will be much easier to get it going on Windows, of course (I don't know much about Mono + WinForms), but I think the easier transition is worth the tradeoff.
Many people have been suggesting low level languages such as C, C++, but frankly I'm not certain that it would be a worthwhile investment of your time. The first programming language I learned was C, from the K&R book, but if I were to teach my son how to program today I would introduce him to python or ruby.
Both python and ruby are very expressive, sophisticated languages that are easy to learn and have an intuitive, english like syntax. By all means do learn about structured programming, and older compiled languages, but initially you'll reap more benefit from learning OO concepts in a high level language.
Java and C# are excellent languages, however they are very tightly coupled with their frameworks, and you may run the risk of getting bogged down learning a framework instead of programming fundamentals.
If you were comfortable in PHP you will feel right at home with Perl, better yet, pampered. You could even turn around and use Perl on the web with your former languages via CGI.
If GUIs is what you're after, C# is your best bet for Windows and Java for other platforms.
If you want result and GUI and you don't care if it's windows only, you probably want C#.
If you want to run on different platforms, you might check out any language on the JVM since they all have access to a pretty powerful GUI toolkit. (Jython, Groovy, Java, ...)
Don't bother with the desktop just yet. Hit the command line.
Get the K&R book and really learn C. You don't know how much you've missed out on if your background is 100% high-level (PHP, Python, Ruby, JS) web dev.
Learn the fundamentals, then raise the bar by going into C# or Objective C.
You can go easy or go hard, go fast or go slow.
Many people say C#, it's nice and can also be used on Linux through mono. On the other hand you can go with C/C++ and maybe Java. You'll have fun with C/C++, learn something and be a better programmer; but it will take time. Java is simpler but "needy". If you want the easiest way to develop a desktop application, you can go with VB or Delphi. Delphi has some advantages over VB which I'm not going to go into here.
My advice would be, if you have time, are willing, and just want to experience GUI, go from low to high, slow to fast, hard to easy. Try assembler, know C/C++, use Java, crack open C# and browse thought VB and Delphi.
In the end maybe you will not create a powerful application, but you will be prepared for college, be experienced and generally "know stuff".
For someone with HTML and Javascript skills Adobe AIR could be the way to go.
It allows you to create a desktop application using HTML/DHTML or if you are familiar with Flex you can also use Flex.
See http://www.adobe.com/products/air/
Go through K&R C. Learn C and you should have a great foundation for learning other languages.
i would say that Java would give a good introduction to desktop apps. I havent had any experience with some of the other languages mentioned here.
You can do some simple stuff in Java with very little headache, as compared to some other languages that require hundreds of lines of code.
Just depends if you have been exposed to OO programming in your web experience
Consider VB.NET (not "classic" vb!) as an easy-to-start-with high-level language that can help you get your foot in the door; then get up to speed with C# as well. The two are interchangable--VB.NET and C# are really just different dialects of .NET.
There's three things VB.NET has going for it over C# for beginner programmers:
VB.NET tends to be a more descriptive (some would say chatty) language
Where C# uses symbols VB.NET will use (slightly) more descriptive words. After a while VB.NET will probably be chatty to the point it annoys you, but by then you should be quite comfortable with .NET and switching to C# will be fairly trivial
Slightly more relaxed syntax
C# will gripe if you leave off parenthesis on method calls, and gripe if you add them to Property accessors--VB isn't quite as picky. It won't let you go haywire with bad syntax (like HTML) but it won't gripe and complain over every little detail
Better pre-compilation parsing
If you work with Visual Studio in both languages you'll notice it will show most compiler errors and warnings for VB.NET right away. C# will wait until you try to compile to tell you that there's errors in your code. The difference isn't huge (C# will warn you for most errors after a delay) but it can be a concentration buster to think you've just pulled off a method and found out it's 10 errors away from compiling (4 of which are because you left the () off a method call).
Once you learn the main features of .NET it's easy to learn the C# equivalency and transition if you want to; and at some point you might decide that VB.NET is a bit too chatty and opt for C# (pretty much what I did).
The only catch to VB.NET is that you should get in the habit of always adding two lines to the top of your code files; they'll help you out immensely in terms of not letting you do stupid things :)
Option Strict On
Option Explicit On
Here's a real short example of the "words vs. symbols"... you'll see there's not much difference other than some brackets in C# and some extra words describing what's happening in VB.NET
Option Strict On
Option Explicit On
Imports System
Imports System.Windows.Forms
<Serializable> _
Public Class MyClass
Inherits SomeBaseClass
Implements SomeInterface
Public Shared Sub DoSomething()
For each item as Object in SomeCollection
Debug.Writeline(item.ToString)
Next
End Sub
Public Sub SomeInterfaceMethod() Implements SomeInterface.SomeInterfaceMethod
MessageBox.Show("Grrblah!")
End Sub
End Class
using System;
using System.Windows.Forms;
using System.Diagnostics;
[Serializable]
public class MyClass : SomeBaseClass, SomeInterface
{
public static void DoSomething()
{
foreach(Object item in SomeCollection)
{
Debug.WriteLine(item.ToString());
}
}
public void SomeInterfaceMethod()
{
MessageBox.Show(#"Grrblah!");
}
}
Try not to fall in the 'must-be-cross-platform' trap. If you're just beginning, that shouldn't be what's on your mind. I can't speak for everyone, but I myself, and I have seen this happen to others, got caught in this early on and didn't get anywhere because I was always trying to find things that were cross platform, and just because they are cross platform doesn't mean they are the best suited for your situation, especially early on.
When you become proficient at a language, you will know how to port and make things cross platform. Don't choose something solely because it is advertised as being cross platform, despite the fact that most languages today are, don't feel the need to ignore other languages that, while not necessarily platform specific, seem to be better on certain platforms, such as C# for Windows and Objective-C for Mac, which are both great languages in my opinion.
If you want to learn something that benefits you in web development as well as in desktop development, I would go with Ruby. You can look into Ruby on Rails for web development. Ruby is also pretty cross platform and you can develop desktop applications with it. There are also various bindings, so for example you can write Mac apps with it and even have access to .Net with Iron Ruby, if need be.
Python is also a possibility.

Non-English domain naming issues in programming

Most programming code, I imagine is written in English. But I'm curious how people are handling the issue of naming herein. A lot of programming is done within some bussiness domain, usually with well established terms for certain procedures, items.
I'm from Denmark for instance, and something I work a lot with has a term called "indblikskode", which sort of translates to "insight code". So, do I use the line "string indblikskode = ..." in the C# code for some web service related to this? Or do I try to use a translation, such as "insightcode"? The bussiness I'm in isn't even consistent in its language, for instance using the term "organisatorisk enhed" (organizatorical unit), but just as often using the abbreviation "OU", which is obviously abbreviated from the English.
How do other people handle this naming issue, while keeping consistent, and sane (in everything from simple variable names in your code, to database tables, to server names)?
Duplicates:
Should identifiers and comments be always in English or in the native language of the application and developers?
Do you use another language instead of English?
I can only speak for myself, but I always translate terms into English when naming classes and variables, and it's one of our unwritten best coding practices to do so as well. You never know when you might need to hand off development to cheaper labour abroad or the expert expat consultant in town.
The problem with non-English naming of classes and functions is, that you invariably going to end up with macaronic pidgin. Keywords are in English, naming conventions (like for example getters/setters) are also English, same for standard names for design patterns.
You're going to end up with stuff like:
OrganisatoriskEnhedFactory::getInstance()->getIndblikskode();
See my question and answer here.
Basically it depends on your organization and the application. If your company, developers and customers all speak the same native language and you expect it to stay that way, then it would be extremely counter-productive to have everyone become a part-time translator as well. Considerable productivity loss for a purely hypothetical future advantage. YAGNI.
If it's a large international company, or if there are concrete plans to expand internationally or have some work done offshore, it's a different matter, of course.
Having worked in Switzerland (German side ie Zurich) and lived in Germany for a time I can tell you that I've yet to see an environment where the code isn't in English. Sure the application may well be in German (but many professional environemtns are English-speaking anyway) but the code (I've seen) is pretty much all English.
It's hard to write code in other languages. For one thing, the APIs are (nearly) all in English. Java uses JavaBeans naming for example so you have to use set and get anyway and "getGeburtstag" just doesn't have quite the same ring to it as "getDateOfBirth".
Other countries may vary for this has been my experience from the Germanic countries.
We're usually using established English terms (our business domain usually has English terms), but if I can't figure out any suitable term, I could as well use Finnish. Heck, even our comments in code are in mixed languages...
Of course the sensible approach depends largely on whether the source code will ever be used outside the building. In a small shop it's not such a big deal.
I'm working in a company in Austria (so we're talking German) and we are programming in English (variable names, domain objects, GUIs). Makes it a bit more cumbersome, because you have to find the English translations and you have to translate the GUI before releasing the program. I'm not really sure if all the names are really correct.
In contrast in the former company I was working for programmed strictly in German. This was pretty nice (altough German words tend to be longer than English words). After some years the company wanted to use the same program in the USA, so English-speaking programers had to use the same codebase. after this everything got pretty inconsistent- variables, database fields.. in both languages (the English speaking team members didn't talk German).
My experience is that it is easier to handle internationalization in the early beginning (you are forced to do it when you write the program in English) of an application, because it is no big fun localizing a 10000 LOC application. The advantage of writing in another language is that you see instantly what is localized and what is not - altough it's work you have to take in account for that.
To the untranslatable words: we hadn't expierienced that yet - altough it was some work finding the English phrase for "intra-community deliveries" (that's an EU thing). But if that would happen I'm pretty sure we would use the German word.
I live and work in Germany but write English code only. It makes things easier. You can post your code on the net if you want to ask questions or want to publish tutorials about your work.
Also the code looks more "professional" for me.
I also live in and work in Germany for now and we mostly use English except for some old comments in German. I think non-English comments are generally very bad idea since you'll have to spend time trying to understand it (and understand correctly). Although both German and English are not my native languages, code written in anything other than English seems to be bizarre.
You'll never know who would be working on your code the next day. So you should use the universal IT language.
P.S. Since I do not like non-English languages in my development environment, I made a local administrator quite angry when I refused that my PC be installed with German Windows, German Office and German Visual Studio. It took many hours to download the English versions just for me.
Though I think it is good one day to install a language pack or just a different copy of the same software just to learn the terminology. SQL Management Studio in French makes me really excited, just as when I tried to switch Skype to Spanish.

Resources