How to display Hello World on a graphing calculator (on a screen)? - ti-basic

I am trying to make my graphing calculator display Hello, World! on the screen. How do I do this (I want to program a program to do this, as typing alpha, letter is inefficient)?

Use the Text( command in the draw menu.
Where X and Y are your locations:
Text(X, Y, "HELLO, WORLD")
According to catalog:
Text(row, column, text1, text2, ..., text n)
On color calculators the text color can be changed with the TextColor( command.

Try using the following code:
Disp "Hello, World!"

The best (smallest in bytes, and really close to the fastest) an way to do this on the calculator is to use the following line of code:
Disp "HELLO WORLD
Because of an interesting quirk with TI-Basic, you do not need to use ending quotes, parentheses, curly braces, or square brackets if they are at the end of a line, or preceding a -> (store arrow).

Related

Opposite of backspace?

Is there a ASCII character that does the 'opposite' of backspace, i.e., that moves the cursor one position forward? Id like a character X such that
print("bad\rXbc")
prints bcd (the example is python, but this should be rather a subject depending on the terminal emulator). X cannot be a white space, for the white space overwrites:
print("bad\r bc")
prints cd. In princible, \t does what I want, but the sought character should move by only one character forward. Does it exist?
Edit. To make my question clear: the BS does not delete printed characters, in the sense that they are still visible unless overwritten. Of course this depends on the terminal emulator. For the macOS terminal, this is the case:

strange ansi colour bevahiour in terminal

I have been playing around with the ansi colours in OSX terminal (bash v.3.2.57, Yosmite).
I have a problem with background colour behaviour once I fill up a terminal-window (as in, when it scrolls down).
The background colour will fill the right hand side white space, whilst also "skipping" a line (see picture). It works as I want it to until the output makes the window scroll. If I use the "clear" command the output will look fine until the output fills up a terminal window again.
The code below was simply getting the different combinations of colours (I truncated it a bit for this problem).
I have a feeling terminal is to blame rather than python, because the output works initially. Can anyone explain this behaviour? Cheers.
#coloured text in terminal
#ANSI escape sequences
std_txt = '\033[0m'
print('colour test' +'\n')
print(' X in 033[0;Xm')
for x in range(30,35):
print ''.join(["\033[0;",str(x), 'm']) + 'test' +'\t' + str(x)
print std_txt +'\n' + ('end')
print('colour test 2' +'\n')
print(' X in 033[0;30;Xm')
for x in range(40,45):
print ''.join(["\033[0;30;",str(x), 'm']) + 'test' +'\t' + str(x)
print std_txt +'\n' + ('end')
ps: What I mean by filling up a terminal window or scrolling.
If your terminal-window is 80x24, filling it up will be using 24 lines, and >25 would make it scroll. Sorry, I found it hard to explain this in the problem.
The problem is that you're not resetting the color before the newline, so the terminal tries to be helpful.
Change
print ''.join(["\033[0;30;",str(x), 'm']) + 'test' +'\t' + str(x)
To:
print ''.join(["\033[0;30;",str(x), 'm']) + 'test' +'\t' + str(x) + std_txt

Cocoa NSTextContainer: How to maintain whitespace after gap?

I am creating a gap in text by overriding NSTextContainer's "lineFragmentRectForProposedRect" and returning a remainingRect.
This works overall, but it is undesirable to me that the "remainingRect" portion of the text container hides whitespace at the beginning of the rect. Anybody know a means of stopping this behaviour?
For example:
"Hello World!" as the literal text when separated by a gap beginning anywhere between "Hello" and "World!", then the right side of the gap will have no space before "World!", such that, let's say, if the gap was the width of a character and begins right after "Hello", then the result would look like "Hello World!".

Ruby, Files, Tab Characters

I am parsing a csv file and the file has "\t" characters after every column. Why is it that when I print out the individual lines in terminal or open the file in my text editor that the tab spacing between each of the columns is different?
When you use tab, you're essentially moving to the next tab location, not moving over a specific distance. To see the difference, try using 4 spaces instead of tab. Or, alternatively, run the following code, and I think it may become clear to you.
puts "Hel\tlo world!"
puts "H\tello world!"
puts "Hell\to world!"
Hope that helps.
Do you mean something like
1 1
12345678 1
as a result of
puts "1\t1"
puts "12345678\t1"
A tab jumps to the next position in 8-space steps (8 spaces is a common distance, but it depends on settings of your editor. For ruby often is 2-space distance is used).
If the previous text is longer then 8 characters, then you jump to the next position and you have the impression of different tab spacing.

How can I hide result of evaluation in Mathematica?

example:
Array = Range[1000]
I'll see 1000 numbers. Could I hide this output?
In Maple this problem solve by adding a ":" at the end.
First, in Mathematica you should not use capitalized variable names. The value "Array" is a built in function and Mathematica will not let you assign a value to it.
The answers above are completely correct, but there is another answer which some people might like. The Mathematica front end reformats output that it thinks might be hard to read. For example,
array = Range[100000]
will not print a giant list but instead will print:
"A very large output was generated. Here is a sample of it:"
It will then show only the beginning and end of the list with an ellipsis of sorts. Try it out. You will find 4 buttons beneath the output reading:
"Show Less", "Show More", "Show Full Output", "Set Size Limit..."
Their meaning is pretty clear. You can change Mathematica's option which tells it at what size to consider the output too big to put on the screen.
You can find this option by clicking on "Set Size Limit" or by going to the Evaluation Tab in the Preferences menu. The Preferences menu is found under Edit>Preferences or Mathematica>Preferences if you are using a Mac. In this dialog you will find a field called "Maximum output size before truncation". Here you can specify the number of bytes Mathematica can put on the screen before it should truncate your input for easier use.
Array = Range[1000];
The ";" hides the results in Mma.
HTH!
End the command in a ; like so:
Array = Range[1000];
Useful links:
The Mathematica help page on ;
you put a semicolon at the end. (eg: ar=Range[1000];)

Resources