I am learning how to code in TI-BASIC for my TI-84 Plus CE, so I wrote a Quadratic Formula program:
:Local A
:Local B
:Local C
:Local P
:Local Q
:Prompt A,B,C
:-B+√(B²-4AC)√(2A)→P
:-B-√(B²-4AC)√(2A)→Q
:"The actual program uses a negative sign, but SE can't display it
...
(Rest of program not relevant, I output the values of P and Q in a specific way)
When running, I get a syntax error on the first keyword Local. I looked it up and I seem to have the correct syntax, so what's going on, and how can I get around the error?
Local is used in 68k Ti basic. The calculators belonging to this family are listed here: http://tibasicdev.wikidot.com/68k:thecalcs, and TI-84 is not one of them. I would suggest looking at the ti-83 basic page instead (http://tibasicdev.wikidot.com/home). Since you are prompting for the variables anyways, there is no point in deleting them at the start, or declaring them as local. If you code in the actual calculator itself, when you are editing a program and press prgm, a list of available methods are listed. If you press + then the calculator shows the syntax. As far as I know, those commands are all that are available to you without using assembly.
Related
How would one achieve the same result. I believe the keybinding for macOS Intellij is op+up/down and on windows it is alt+w/d.
Essentially the function highlights the current word, then, with successive presses, expands out to the full string/line/area in-between parenthesis/further out to the next set of parenthesis. Very useful for developing in LISP.
The closest I've gotten is this: https://vi.stackexchange.com/a/19028
Try this plug in: https://github.com/terryma/vim-expand-region
It expands selections based on Vim’s text objects.
Well this may seem comfortable but does not correspondent with the internal logic of vim itself.
See, in vim everything you enter is like a sentence. va{ for example: there is a verb v -> visually select and an object (or movement) { -> paragraph. In this case there is also a modifier a around. You can exchange stuff in this sentence and it will still work vaw, dil, cB and so on. The power of vim is greatly based on that concept.
Of course you can write a function that does vaw first, then S-v and lastly va{ but that will only work with visual selection. It will not work with c or d or anything. So I will recommend to get used to use different keys for different actions.
The visual selection is mostly not needed anyway. Change a paragraph? directly use ca} and so on.
I have found that VI/VA + WOBO (as many times as you need to expand) works similarly. Not as fast but its the same concept and you can even expand/shrink asymmetrically based on your WO's and BO's (Or OW's and OB's depending on how you look at it)
I'm writing a macro for LibreOffice Calc in Basic in VBA compatibility mode. It complains when I use this line:
Const BASE = 3
BASIC syntax error.
Symbol expected.
and the syntax coloring seems to indicate that "BASE" is a keyword or reserved word. Other consts in the macro are accepted without issue. Also, this line is accepted in VBA in Excel.
I will change the name in order to avoid this problem, however I am unable to locate any documentation that references this as being any kind of reserved word. I assume it either has something to do with number bases or with the name of LO's database. However, words like "WRITER" and "CALC" don't act the same way - they seem to be accepted as names for constants. Note that my use of this word is not related to the database anyway.
Also, unfortunately, LO Basic doesn't seem to have an immediate mode (REPL) so I am unable to easily play with this word to determine what it's used for.
Can you point me toward some documentation for the keyword BASE?
Those are some good guesses, but incorrect as it turns out. The word is used as follows:
Option Base 1
It can be either 0 or 1 to denote which index refers to the first element of an array, as documented at https://wiki.openoffice.org/wiki/G11ntest/Documentation/BASIC_Guide/Arrays.
To discover this, I looked through the LibreOffice source code. The file /basic/source/inc/parser.hxx was helpful. This is the closest approximation of a list of keywords available, judging from this post.
Apparently, this statement was adopted from VBA: https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/option-base-statement
i have a big number of problems (app 5000 instances) that i want to solve in ampl and i like to do it in one run in a for loop. I know how to reset the data and how to make a loop, but i don't know if you can make a name and then call the data from that name, like you can do in C with "printf" and then open the text with that.
I'm thinking if i can't change the name automatically in ampl, call ampl from C with "system()" and change the data file in C.
My question is if this is possible.
You can do it using AMPL script, for example:
for {i in 1..5000}
shell('ampl problem' & i & '.ampl');
This will run ampl on problem1.ampl, ... problem5000.ampl.
The shell command is similar to the system function in C and other languages. It is described in the AMPL book.
I have a file variable in d3 pick basic and I am trying to figure out what file it corresponds to.
I tried the obvious thing which was to say:
print f *suppose the file variable's name is f in this case
but that didn't work, because:
SELECTION: 58[B34] in program "FILEPRINTER", Line 7: File variable used
where string expression expected.
I also tried things like:
list f *didn't compile
execute list dict f *same error
execute list f *same error
but those also did not work.
In case any one is wondering, the reason I am trying to do this in the first place is that there is a global variable that is passed up and down in the code base I am working with, but I can't find where the global variable gets its value from.
That file pointer variable is called a "file descriptor". You can't get any information from it.
You can use the file-of-files to log Write events, and after a Write is performed by the code, check to see what file was updated. The details for doing this would be a bit cumbersome. You really should rely on the Value-Add Reseller or contract with competent assistance for this.
If this is not a live end-user system, you can also modify an item getting written with some very unique text like "WHAT!FILE!IS!THIS?". Then you can do a Search-System command to search the entire account (or system) to find that text. See docs for proper use of that command.
This is probably the best option... Inject the following:
IF #USER = "CRISZ" THEN ; * substitute your user ID
READU FOO FROM F,"BLAH" ELSE
DEBUG
RELEASE F,"BLAH"
END
END
That code will stop only for one person - for everyone else it will flow as normal. When it does stop, use the LIST-LOCKS command to see which file has a read lock for item "BLAH". That's your file! Don't forget to remove and recompile the code. Note that recompiling code while users are actively using it results in aborts. It's best to do this kind of thing after hours or on a test system.
If you can't modify the code like that, diagnostics like this can be difficult. If the above suggestions don't help, I think this challenge might be beyond your personal level of experience yet and recommend you get some help.
If suggestion here Does help, please flag this as the answer. :)
How to print C type variables at GDB console in xcode4? I'm able to print variables using p var, also able to print variables like p myObj.property but unable to print variables that that are on 3rd level depth. For example using p objName.pointerToOtherObject.someProperty does not work. The GDB dislays "There is no member named someProperty." message but it is there for surely. I'm using the 4.02 version of xcode4 but still it sucks when it comes to displaying properties, variables and etc from debug area. I mean it is unable to show the content or arrays and dictionaries, also, sometimes, it is not displaying the values of vars when I move the mouse over that var, in that case I need to click and move the mouse somewhere else and then move the mouse over again, then it works. Maybe I'm missing some hints but those small problems sometimes annoys me :) For object printing I' using po.
The solution would be to use method messaging syntax instead of property syntax:
p [[SomeObj pointerToOtherObject] someProperty]