How reset ram by useing TI-Basic programming in TI-89 calculator - ti-basic

This is possible by manually pressing the F6 button and selecting Clear a-z...
How possible in the TI-Basic (TI-89) programming environment?
enter image description here

The DelVar statement deletes a variable. Of course, deleting a-z manually would be a pain. Instead, you can do:
delaz()
Prgm
Local ch,ind,var
ord("a")→ch
For ind,0,25
char(ch+ind)→var
DelVar #var
EndFor
EndPrgm
ord("a") gets the character code for "a", char(c) returns a string containing the the character with code c, and #var gives a refrence to the variable named by string var.
If you define this program, you can simply use delaz() to delete a-z programmatically. Be careful not to use one letter names for any of the local variables, because you will delete them before the program finishes.

Related

In it basic, how do I add one to a variable?

I am creating a Pac-Man game on a ti-83, and need to add one to a output variable to move a character. Does anyone know how to do this?
You have to use the STO button, above the on button. Write the variable plus one, STO, and then the variable.
You can use the store arrow for this.
Located above the [on] key is the sto
If your variable is A, your code would be A+1→A, where → represents the symbol typed by that key.
You can read more about it on this page: http://tibasicdev.wikidot.com/sk:variables

Referencing Two-Word Variables in Applescript?

I'm attempting to get some data from an app called "Timing", which is local to my computer, and post it to a URL to notify a webhook, from which some process automation will occur.
According to the Applescript integration with Timing,
There is a time summary object that's returned from a command which I've successfully executed. When displayed as an alert, that data looks like this:
Can't get |times per project| of {id:5C6CD8C8-357F-4EE7-890C-5946DC03BBB9", overall total:1.18092493622303E+4, times per project:{Maintenance:81.091759443283, Youtube:4820.38001298904, |self improvement effors|:876.930474758148, Homework:2383.20326805115, |(no project)|:3647.64384698868}, overall total without tasks:1.18092493622303E+4, productivity score:0.388005592511, times per project without tasks:{Maintenance:81.091759443283, Youtube:4820.38001298904, |self improvement efforts|:876.930474758148, Homework:2383.20326805115, |(no project)|:3647.64384698868}, class:time summary}.
As you can see, (above), there is a property called productivity score, which is two words.
When attempting to get this datapoint from the object (which I will use to notify the webhook:)
set newnewVar to productivity score of newvar
display alert newvar
Obviously this wont work, because the variable name is two words. I've tried surrounding the name in quotes and surround it with other characters, but nothing seems to work, and the documentation for getting specific properties only has examples with variables with one word.
What's the solution to this problem?
In AppleScript, user-defined variables cannot generally have spaces. Typically they start with a letter or underscore, and then can contain only letters, numbers, or underscores. A user-defined variable can only contain spaces if it is contained within vertical pipes. So all of the following are valid variable forms: alphaUnit, slideRow3, _tempItem, |my variable|, left_hand_vector
However, any application or script that creates and uses a scripting definition can create commands and classes and properties that have multi-word names. For instance, if you look at the System Events app, you'll see that the Disk-Folder-File Suite has a class named disk item with properties like creation date. The reason this works is that these multi-word names are actually represented by a numeric (four-char) code: disk item is actually 'ditm' and creation date is 'ascd'. You often see these codes pop up in error strings like so:
"cannot make class ≪ditm≫ into..."
Make sure you have the scope right to invoke the dictionary — i.e. be within a tell block for the app or script that invokes the scripting dictionary — and the multi-word names should 'just work'. After compiling, you'll see them highlighted in a purple color that's just a bit different from the red of uncompiled text. You do not need to enclose dictionary terms in vertical pipes; if you do, they will be treated as user-defined variables and lose their special scripting purposes.

Scripting Word from vbs

I'm trying to get Word to fill in cells in a table. The script works when run as a macro from within Word, but fails when saved as a .vbs file and double-clicked, or run with wscript. This is a part of it.
set obj = GetObject(,"Word.Application)
With obj
With .Selection
MsgBox .text
If (.Information(wdWithInTable) = True) Then
.Collapse Direction:=wdCollapseStart
tCols = .Tables(1).Columns.Count
tRow = .Information(wdStartOfRangeRowNumber)
tCol = .Information(wdStartOfRangeColumnNumber)
For I = 2 To 5
.Tables(1).Cell(tRow, I).Range.Text = "fred" & Str(I)
Next
` now make new row
For I = 1 To tCols - tCol + 1
.MoveRight unit:=wdCell
Next
End If
End With
End With
I have three problems. First, it won't compile unless I comment out the .Collapse and .MoveRight lines. Second, although the MsgBox .text displays the selected text, I get "out of range" errors if I try to access any .Information property.
I'm sure I'm missing something very simple: I usually write software for Macs, and I'd do this using AppleScript. This is my first attempt at getting anything done under Windows.
VBScript and VBA are different languages.
They are a bit similar, but not very. Moreover, VBScript is not like AppleScript; it doesn't let you easily interface with running programs.
The interfaces you'll get from VBScript can behave subtly differently in VBA and VBScript. However, I think you've got two problems here:
:= is invalid syntax in VBScript; you'll need to find an alternative way of calling the function. Try just using positional arguments.
You've no guarantee that this will open the expected file; there could be another instance of Word that it's interacting with instead.
Since your code is not running within the Word environment it would require a reference to the Word object library in order to use enumeration constants (those things that start with wd).
VBScript, however, cannot work with references, which means the only possibility is to use the long value equivalents of the enumerations. You'll find these in the Word Language References. Simplest to use is probably the Object Browser in Word's VBA Editor. (In Word: Alt+F11 to open the VBA Editor; F2 to start the Object Browser; type in the term in the "Search" box, click on the term, then look in the bottom bar.)
The code in the question uses, for example:
wdWithInTable
wdCollapseStart
wdStartOfRangeRowNumber
wdStartOfRangeColumnNumber
wdCell
The reason you get various kinds of errors depends on where these are used.
Also, VBScript can't used named parameters such as Unit:=. Any parameters must be passed in comma-delimited format, if there's more than one, in the order specified by the method or property. If there are optional parameters you don't want to use these should be left "blank":
MethodName parameter, parameter, , , parameter

PHPStorm / IntelliJ IDEA Live Template string "$" concatenation

Does anyone know how to prefix a "$" next to a $STRING$ entry? $$STRING$ seems to remove the ability for the template system to recognise this as an input variable.
While we are on the topic, is it possible to concatenate/edit a previously declared variable in the variable editor? So setting:
$STRING$'s default to: $VAR$ . "suffix"
Both of these would be very useful!!
Cheers
Short answer: Just use $$ (therefore $$$STRING$).
To clarify the OP's problem with an example:
Imagine that you wanted to have an n live template (macro) that creates a new instance of a class and stores it in a variable of the same name (Netbeans users will know :) ).
So if you used the n macro and typed Person, the output would be $person = new Person();
And since you want to autocomplete the $person variable based on Person class, you need to have $<variable> = new <Class>();, which translates to $$$VAR$ = new $CLASS$(); $END$ in PhpStorm.
For anyone interested in the full n live template:
My answer is indirectly based on this answer.

How do I search and replace multiple items on a single line?

I have a line like:
contact.psu_code = row[:psu_code] unless row[:psu_code].blank?
and I want to substitute psu_code with, say contact_disposition, like:
contact.contact_dispositon = row[:contact_disposition] unless row[:contact_disposition].blank?
where it substitutes only in the single line I'm on, with no confirmation. I know of %s/orig/sub but it's cumbersome.
What do you mean, it's cumbersome? If you want to do a search-and-replace on a single line, you don't need to use %.
:s/psu_code/contact_disposition/g
Without g, Vim would stop after replacing a single occurrence. By specifying g, the replacement is done on the entire line.
If you want confirmation, add c to the options after g.
Here's a convenience function for it:
function! LineReplace()
let search = expand('<cword>')
call inputsave()
let replacement = input('')
call inputrestore()
call setline(line('.'), substitute(getline('.'), search, replacement, 'g'))
endfunction
nnoremap <leader>r :call LineReplace()<CR>
I mapped it to <leader>r, but you can easily change that to whatever keymapping you'd like.
Try
%s/orig/sub/gc
g => global, implies multiple times on a line
c => confirm
There are two ways to get this done:
In normal mode :s/psu_code/contact_disposition/gc . The last c is for confirmation, you can use it or not.
In visual mode: Shift-V to select the line then :s/psu_code/contact_disposition/g
I hope this helps

Resources