Kamis, 16 April 2020

SMALL BASIC: File database searcher

Hi, SMALL BASIC programmer, welcome.

In this tutorial we will learned about how we can search multiple occurance of a keyword from a txt database.

'So the solution is read line per line
i = 1
TextWindow.WriteLine("Enter the file that you like to traverse? : ")
'file = TextWindow.Read()
file = "C:\Users\Totardo\Geneacology based on revelation.txt"
contain = File.ReadLine("C:\Users\Totardo\Geneacology based on revelation.txt",i)

While contain <> ""
  'TextWindow.WriteLine(contain)
  get_result = Text.GetIndexOf(contain,"Henokh")

  If get_result <> 0 Then
    TextWindow.WriteLine(contain)
  EndIf
  i = i + 1
  contain = File.ReadLine(file,i)

EndWhile

  

FFMPEG: extract video

We will use:
- to
- t
- ss

Three of them are can be used as input and output parameter.
All of them use time duration specification https://ffmpeg.org/ffmpeg-utils.html#time-duration-syntax

Extract only 1 minute:
ffmpeg -t 00:01:00 -i 2020-04-16 04-36-06.mkv output1.mkv

Extracting only 1 minute and 30 seconds:
ffmpeg -i 2020-04-16 04-36-06.mkv -t 00:01:30 output2.mkv

Extracting using -ss and -t (if you know the start time and stop time that you like):
ffmpeg -i 2020-04-16 04-36-06.mkv -to 00:01:30 output3.mkv

Extracting using -ss and -t



Senin, 13 April 2020

SMALL BASIC: Factorial Calculator

Hi, SMALL Basic programmer, welcome.

Did you know, we can also make factorial calculator using SMALL BASIC?

We will divide the code as:
1. Code with wrong result of  0!
2. Code that with correct result of 0!
So, you can see the difference.

Below is the code:

1. Code with wrong result of 0!
TextWindow.WriteLine("Welcome to factorial calculator")
TextWindow.WriteLine("Enter the n: " )
n = TextWindow.Read()
res = n
For i = n-1 To 1 Step -1
  res = res * i
EndFor

TextWindow.WriteLine(res)


2. Code with correct result of 0!
This below is completed program:

TextWindow.WriteLine("Welcome to factorial calculator.")
TextWindow.WriteLine("Enter the n: " )
n = TextWindow.Read()
res = n

If n = 0 Then
  res = 1
Else
 
For i = n-1 To 1 Step -1
  res = res * i
EndFor
EndIf

TextWindow.WriteLine("The result of permutation is: " + res)

SMALL BASIC: Programming quiz #3

1. What will be the result or the output of these lines of code?
For i = 0 To 10
  g[Array.getitemcount(g)+i] = i
EndFor
  TextWindow.WriteLine(g)

2. What will the output of these lines below, do you think its working?
start = 100

For i = (start - 1) To 1
  TextWindow.WriteLine(i)
  Program.Delay(1000)
EndFor

Selasa, 07 April 2020

SMALL BASIC: For determined start row and col

Hi, SMALL BASIC programmer, welcome.

Did you know that small basic for can be started not only from the beginning or a.k.a line 0 or row 0 and col 0?

Below is the example:

traversed_row = 3
traversed_col = 4

For i = traversed_row To 5
    If i = traversed_row Then
      For j = traversed_col To 5
        TextWindow.WriteLine("i : " + i + ", j: " + j)
      EndFor
    else
    For j = 0 To 5
      TextWindow.WriteLine("i : " + i + ", j: "+ j)
    EndFor
  endif
EndFor

   
    

SMALL BASIC: File

File take the information match as the Windows file.

There are cases, for instance:
1. Folder can't be accessed or forbidden.
2.
3.