Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
LAX18 wrote:
This is very cool!!! I can't wait to install this on my CE. It is in desperate need of some BASIC love Razz. I love how optimized optimized (compared to me) this is. This is truly a feat of programming of which, you should be very proud, Michael!

but the first "optimized" is spelled right?

you call that optimized? 0x5 I keep poking at Michael, but this is actually some really good code. It is both very readable, very functional, and very well optimized. Usually, you can only pick two. I love this project, and hopefully it is the "calc text editor to end all calc text editors".

This is some awesome, awesome stuff. If you want to make your .txt -> BasicNote converter, JavaScript is actually a really good tool. I've become convinced that this might be the only time this is the case. You can input a file, and read the text directly. Additionally, I'm almost positive that you can write some bytes to a JS string and save it as a TI string file of you are clever. No SC3 needed!

I really cannot wait to try this for myself! Out of curiosity, how big is the file? I bet it's quite large, for such an intricate and adevanced program. *_iPhoenix_ braces for the inevitable "18 bytes"
_iPhoenix_ wrote:
I keep poking at Michael, but this is actually some really good code. It is both very readable, very functional, and very well optimized. Usually, you can only pick two. I love this project, and hopefully it is the "calc text editor to end all calc text editors".

Haha, thank you. And by a "calc text editor to end all calc text editors", you mean just in TI-Basic Wink There are no calc text editors like this anywhere, but the ones that aren't TI-Basic, even though they don't have some of my features, are still higher quality Razz

_iPhoenix_ wrote:
If you want to make your .txt -> BasicNote converter, JavaScript is actually a really good tool. I've become convinced that this might be the only time this is the case. You can input a file, and read the text directly. Additionally, I'm almost positive that you can write some bytes to a JS string and save it as a TI string file of you are clever. No SC3 needed!

This would be cool, but I have no clue at the moment how to do it without sourcecoder. I have the calculator-side conversion down, but there would still need to be a .txt to string algorithm. This means something like, characters not in the BasicNote dictionary are omitted from the string, and line breaks are turned into "[xbar]", etc. From there, though, how would I save it directly as a string file??

_iPhoenix_ wrote:
I really cannot wait to try this for myself! Out of curiosity, how big is the file? I bet it's quite large, for such an intricate and adevanced program. *_iPhoenix_ braces for the inevitable "18 bytes"

It is rather large, but I can most definitely trim it down a ton. In fact, after working on this project for so many months, most of the code I wrote is recycled from other parts of the code. My routines should allow me to get rid of some the chunks. In addition there are a lot of repeated expressions, which I will probably store in a variable when I can.

The sum size of the project is just over 16,000 bytes on calc. That's over 2000 bytes for the subprogram, 2500 bytes for the menu, and... wait for it... over 11,500 bytes for the editor.
Michael2_3B wrote:

_iPhoenix_ wrote:
If you want to make your .txt -> BasicNote converter, JavaScript is actually a really good tool. I've become convinced that this might be the only time this is the case. You can input a file, and read the text directly. Additionally, I'm almost positive that you can write some bytes to a JS string and save it as a TI string file of you are clever. No SC3 needed!

This would be cool, but I have no clue at the moment how to do it without sourcecoder. I have the calculator-side conversion down, but there would still need to be a .txt to string algorithm. This means something like, characters not in the BasicNote dictionary are omitted from the string, and line breaks are turned into "[xbar]", etc. From there, though, how would I save it directly as a string file??

_iPhoenix_ wrote:
I really cannot wait to try this for myself! Out of curiosity, how big is the file? I bet it's quite large, for such an intricate and adevanced program. *_iPhoenix_ braces for the inevitable "18 bytes"

It is rather large, but I can most definitely trim it down a ton. In fact, after working on this project for so many months, most of the code I wrote is recycled from other parts of the code. My routines should allow me to get rid of some the chunks. In addition there are a lot of repeated expressions, which I will probably store in a variable when I can.

The sum size of the project is just over 16,000 bytes on calc. That's over 2000 bytes for the subprogram, 2500 bytes for the menu, and... wait for it... over 11,500 bytes for the editor.

Wow! Slice and dice!

As for the string part, how the files are formatted is relatively simple: you can find it documented here. To append a specific hex code to a JavaScript string, you can use str += String.fromCharCode(parseInt(hexcode, 16));

Remember to use the TI-ASCII table instead of standard ASCII or you will have problems and will not go to space today.

To download it, use Blobs and stuff. Just use Google and common sense (and any help, if you need it!) and you should be fine. Just use the "application/octet-stream" MIME type, but specify a .8xs file extension.
I have the .txt to string conversion down (thanks to _iPhoenix for helping me a bit), and it can be seen here:
https://michael2-3b.github.io/BasicNoteCE/Txt2Note/

However it does currently format it for sourcecoder notation, which means there's a lot of backslashes to make sure no unwanted tokens sneak in when you export it. After pasting the result into a string file in sourcecoder, you still currently have to export it and run another program on-calc which takes a while depending on the file size, before you can view it in BasicNote.

Anyways, I'll see what I can do to change all this to make it easier.


In addition, I am still planning on adding the find&replace feature, as well as an auto-save feature suggested by TheLastMillennial. I'm thinking it will not auto-save based on time, but rather auto-save based on how many changes you've made since the last save.

EDIT: Here's the full To-Do List:

  • fix deletion
  • fix insertion
  • fix string to note algorithm (issues with word-wrapping??)
  • remove multi-character tokens?
  • auto-save feature
  • find&replace text
  • optimization
  • string compression, otherwise archive the string
I'm back from my vacation, so it's time for a little update!

-As suggested by PT_, I might actually keep multi-character tokens (like sin(, log(, ^^-1, etc)
-a few minor bugs fixed... but not yet the main ones
-Autosaving is now fully implemented (and you can customize how often it saves, based on the amount of edits):



Definite public release coming by the end of the month!
So, after giving it some thought, I will likely be releasing the first version with some of the bugs still not fixed. I will also not be including the .txt 2 Note converter in the 1.0 version.

I did have maybe a simple and silly question, but what is the fastest way to get to a desired spot in the code, based on what key is pressed in TI-Basic? There is no "switch" or cases in this language. So for example, this?

Code:

If (this key)
Then
End

If (that key)
Then
End

Or this?

Code:

If (this key)
Then
Else
If (that key)
Then
End
End

Or something else entirely???

Just to punch in something like the letter "A" the program already has to go through 40-50 lines of code or more, which includes any previous keypress checks. So how might I optimize it...? Of course, the code may be golfed after the release but I'd still like to see what you all think.


edit: so I might go with a binary search, but even then that might be tough with the code I have. Really the main thing I'm focusing on now is optimizing the code itself, but my other idea was to have something like this:

Code:

Repeat K=15

    //cursor drawing and getKey loop

    If K=11
    Then
        //code
    End
    If K=11
    End

    If K=12
    Then
        //code
    End
    If K=12
    End

    //etc

End

With this code, it doesn't check any of the conditions past the one it is looking for. And the End statement at the end, is only there if none of the conditions were true.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 3 of 3
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement