So, you required to edit program and put main function for successfully execution.
Tuesday, April 8, 2014
Note for use programs of this blog
So, you required to edit program and put main function for successfully execution.
Monday, April 7, 2014
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)
Id like to solicit feedback here. Any ideas? Please leave a comment, and thanks!
GMAIL
- Note: Must have "keyboard shortcuts" on in settings.
- C: Compose new message.
- Shift + C: Open new window to compose new message.
- Slash (/): Switch focus to search box.
- K: Switch focus to the next most recent email. Enter or "O" opens focused email.
- J: Switch focus to the next oldest email.
- N: Switch focus to the next message in the "conversation." Enter or "O" expands/collapses messages.
- P: Switch focus to the previous message.
- U: Takes you back to the inbox and checks for new mail.
- Y: Various actions depending on current view:
- Has no effect in "Sent" and "All Mail" views.
- Inbox: Archive email or message.
- Starred: Unstar email or message.
- Spam: Unmark as spam and move back to "Inbox."
- Trash: Move back to "Inbox."
- Any label: Remove the label.
- X: "Check" an email. Various actions can be performed against all checked emails.
- S: "Star" an email. Identical to the more familiar term, "flagging."
- R: Reply to the email.
- A: Reply to all recipients of the email.
- F: Forward an email.
- Shift + R: Reply to the email in a new window.
- Shift + A: Reply to all recipients of the email in a new window.
- Shift + F: Forward an email in a new window.
- Shift + 1 (!): Mark an email as spam and remove it from the inbox.
- G then I: Switch to "Inbox" view.
- G then S: Switch to "Starred" view.
- G then A: Switch to "All Mail" view.
- G then C: Switch to "Contacts" view.
- G then S: Switch to "Drafts" view.
Posted by siak at 8:45 AM 0 comments
Labels: gmail
Sunday, April 6, 2014
Security
O.K. point taken, but how do you overcome security issues such as passing "nasty" commands to the interpreter? (yes even Perl has them if scripts are not properly configured.)
This is a very good question. Our web BASIC uses a custom web server with the language engine built right into it. We are trying to be very security minded. We will sandbox each session to prevent improper access to files and to avoid server swamping, processes that fail to terminate, etc.
Another question I have is, will your Basic have a feature to "get" (sorry no pun intended) parameters such as the IP of the client ?Much like the Perl $ENV{REMOTE_ADDR}
We dont have this yet, but I see no reason why it cannot be made available.
Posted by siak at 9:00 PM 0 comments
Labels: security
Creating file in Turbo C
Go to drive where Turbo C is installed then go to bin folder
Click on turbo c icon then follow steps
Create a file:
Open menu by using cursor or type shortcut key ALT+F4 then select new to open new file.
Step 2:
Save a file:
To save a file select save from menu or press F2 shortcut key.
Then a box will appear like that
Then before extension .cpp an asterisk will appear or you will see a word "noname" remove asterisk or noname word and replace it your file desired name e.g. first.cpp and then press OK your file will save in respective directory.
RECOMMENDED way naming to your file:
Name your file or program to less than or equal than six characters otherwise compiler can face problem to execute a program which have greater name than six characters.
Step 3:
Compile a program:
To compile a program go to menu bar and select compile option or press short cut key ALT+F9
Then compiler will show how many errors, warnings and lines executed in your program and also identify line number in which error is found.
Step 4:
Running a program by using Turbo C++ menu bar.
To run program go to menu bar select the run option or press shortcut key ALT+F5.
Saturday, April 5, 2014
Factorial C program Algorithm Flowchart
Ans.
/*c program to find out factorial value of a number*/
#include<stdio.h>
#include<conio.h>
int main()
{
int n,i,fact=1;
printf("Enter any number : ");
scanf("%d", &n);
for(i=1; i<=n; i++)
fact = fact * i;
printf("Factorial value of %d = %d",n,fact);
return 0;
}
The output of above program would be:
![]() |
| Screen shot for calculate factorial value of a number C program |
Algorithm for calculate factorial value of a number:
[algorithm to calculate the factorial of a number]
step 1. Start
step 2. Read the number n
step 3. [Initialize]
i=1, fact=1
step 4. Repeat step 4 through 6 until i=n
step 5. fact=fact*i
step 6. i=i+1
step 7. Print fact
step 8. Stop
[process finish of calculate the factorial value of a number]
Flowchart for calculate factorial value of a number:
![]() |
| Figure: Flowchart for calculate factorial value of a number C program |
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





