basic

What does the assembly instruction trap do?

拟墨画扇 提交于 2019-12-23 01:54:34
问题 "RTFM" A program typically issues a software trap when the program requires servicing by the operating system. The general exception handler for the operating system determines the reason for the trap and responds appropriately. Is the assembly instruction trap alike the instruction TRAP in BASIC? The answer seems to be yes. Can you accept or reject my conclusion? Code for "no interruption" is according to my instructions: noint: PUSH r8 movia r8,0x003b683a # machine code for TRAP ldw et,-4

What does REM stand for in BASIC?

橙三吉。 提交于 2019-12-21 06:56:21
问题 Here's a blast from the past: what does "REM", the comment marker, stand for in BASIC? What's the origin of this non-obvious term? 回答1: I believe it stands for "Remark", that is, a comment. From the MSDN site: Used to include explanatory remarks in the source code of a program. 回答2: It was REMark, back in the late Steam Age (ca. 1971 or so), when I first encountered BASIC. Most approachable book I've ever found on the language was "My Computer Likes Me (When I Speak In BASIC)", or something

Python: Is there an equivalent of mid, right, and left from BASIC?

限于喜欢 提交于 2019-12-20 09:28:54
问题 I want to do something like this: >>> mystring = "foo" >>> print(mid(mystring)) Help! 回答1: slices to the rescue :) def left(s, amount): return s[:amount] def right(s, amount): return s[-amount:] def mid(s, offset, amount): return s[offset:offset+amount] 回答2: If I remember my QBasic, right, left and mid do something like this: >>> s = '123456789' >>> s[-2:] '89' >>> s[:2] '12' >>> s[4:6] '56' http://www.angelfire.com/scifi/nightcode/prglang/qbasic/function/strings/left_right.html 回答3: Thanks

How to use LibreOffice functions into Basic?

て烟熏妆下的殇ゞ 提交于 2019-12-20 02:26:07
问题 I've asked here about the good way to do so. Now I'm trying the following code found here, and get some unexpected errors. I suppose I'm not using it the correct way. Any idea ? Sub Main Dim aResult Dim aFunc Dim oRange aFunc = GetProcessServiceManager().createInstance("com.sun.star.sheet.FunctionAccess") aResult = aFunc.callFunction("SUM", Array(1, 2, 3)) ' ---- Works OK Print aResult aResult = aFunc.callFunction("MDETERM", Array(2, 5, 8)) ' ---- IllegalArgumentException Print aResult oRange

Simple Moving Average summation/offset issue

落爺英雄遲暮 提交于 2019-12-13 06:08:47
问题 I wrote a simple moving average with a moving window of Temperatures read as a voltage between 0 and 10V. The algorithm appears to work correctly, however, it has a problem where depending upon which Temperatures filled the window first, the moving average will have an offset for any values not near this value. For example, running this program with the temp. sensor plugged in a room temp yields 4.4V or 21.3 C. Though, if I unplug the temp. sensor the voltage drops to 1.4V yet the moving

How do I make it go left instead of right with a stopping point?

喜夏-厌秋 提交于 2019-12-13 03:05:37
问题 Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick 'Timer run from left to right to the number of input PictureBox1.Location = New Point(PictureBox1.Location.X + TextBox1.Text, PictureBox1.Location.Y) End Sub This is going right with no stopping point. 回答1: What about subtracting that TextBox value from the previous X position instead of adding it? Adding to an X coordinate will move the picture to the right, of course. 来源: https://stackoverflow.com/questions

OpenOffice Calc macro to add pie chart

情到浓时终转凉″ 提交于 2019-12-13 01:29:48
问题 I am trying to insert a piechart in open-office using macro. But the code shows error: Line: Dim oDiagram As New com.sun.star.chart.PieDiagram Error: "Object not accessible. Invalid reference." I am unable to figure out why. Kindly help. Here is my complete macro code: Sub Macro1 Dim oRange as Object Dim oRangeAddress(1) As New com.sun.star.table.CellRangeAddress Dim oDiagram As New com.sun.star.chart.PieDiagram Dim oRect As New com.sun.star.awt.Rectangle Dim cTitle as String oRange =

LibreOffice Basic get Elements from form

眉间皱痕 提交于 2019-12-12 22:36:01
问题 I'm trying to get value from textfield on the form. sub Test(oEv) oForm = oEv.Source.Model.Parent textBox = oForm.getByName("Description") MsgBox textBox.Text end sub There is an Exception: "Type: com.sun.star.container.NoSuchElementException" on the line "textBox = oForm.getByName". I have a text field with the name "Description" on the same form, where is the button I press to run this macro. What is wrong here? 回答1: Check that the name is the same case, not description . Also, use the Form

Function not allowed within a procedure

我怕爱的太早我们不能终老 提交于 2019-12-12 05:01:31
问题 I have an assignment to write a macro in LibreOffice that will code a message using XOR operation. I get the problem: Function not allowed within a procedure. when I try to run the macro. This is the code: REM ***** BASIC ***** Sub Main end Sub function izracunajHash(geslo, zacetni_hash) zacetni_hash = 17520 hash = zacetni_hash mask = &H00FFFFFF dolzina = len(geslo) If dolzina > 0 Then for f=1 to dolzina step +1 podniz = mid(geslo,dolzina,1) char = Asc(podniz) hash = 33*hash + char hash =

VBA: problems with defining variables in function if Option Explicit is used [closed]

随声附和 提交于 2019-12-12 04:24:37
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I have the following problem: Option Explicit is used. the code Function myFun( myVar as Double) as double myVar = myVar + 1 end function throws an error that myVar is not defined however, if I add the line Dim myVar as Double it says that the variable is declared twice. What am I doing wrong? Thanks 回答1: You