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? lol 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.
Regarding the last post, I went with the extra End statement for now, which messes up indentation but I'm pretty sure it's fine and doesn't cause memory leaks... correct me if I'm wrong.

So just to be clear, the current plan is to release this before the month turns! I really really really don't want this project hanging over my head in August! It's not perfect but who says the first release has to be?

I'm working on finishing and optimizing everything, like I've said before, but in particular I am working on the string to note routine, since I can use it dynamically during note editing which would decrease the size of the program drastically.

Some of the things I've done most recently:
- The string to note routine is almost done, which I can use dynamically
----pasting, insertion, deletion and everything should be fixed by using this routine
- and just something I thought of recently: deletion of selected text, as you can see below!


EDIT: if you are up to it, try to golf this...: [removed; reason: old code]
Nice work Smile I see a lot of this: For(I,dim(|LCNOTE),Z+abs(B/6+1)/2,~1. Compute the values to temporaries before the loop to improve loop speed.
MateoConLechuga wrote:
Nice work Smile I see a lot of this: For(I,dim(|LCNOTE),Z+abs(B/6+1)/2,~1. Compute the values to temporaries before the loop to improve loop speed.

Oh yeah, thanks. Also I've been meaning to change those loops to the appropriate augment( and seq( commands since I obviously wasn't quite as smart back then.

The program is not perfect (is any program truly perfect?) but I think I am just about ready to release it. It's also not completely optimized but that can be worried about later. The sum size of the project is currently 17kB.

I've recently added a few small things:
-"Copied" indicator when copying text
-"Saving" indicator when the program is in the process of saving (unless there are a lot a lot of changes, it only takes about half a second to run the saving algorithm)
-a 2nd error catcher: if the main note string is missing or tampered with, it will detect the crash because it couldn't display anything on the menu, and when the program is run again it will ask if you want to reset.
-other minor optimizations and fixes

The text input isn't as fast as I'd like it to be but that's another thing I can worry about later.

I'd like to know what buttons I should use for text selection, copy, and paste if any of you have any input. Text selection can be started or ended with 2nd mode and the [+], aka men key. Copying is done in normal mode and the [sto->] key. Pasting is done in 2nd mode and the [sto->], aka rcl key. This is somewhat boggling, so I value anyones input!
Great work so far! As long as the release is more stable than Windows 10 was, I'll be happy. Razz
As for the buttons,
I'm not really sure what to use for selecting but perhaps [2nd]+[y=]?
For copying can you just do [sto->]?
For pasting use [2nd]+[rcl].
0x5 I misread your post!
I tried to suggest combinations that are close to each other and ones that feel natural from regular on-calc programming.

I look forward to the release! Very Happy
TheLastMillennial wrote:
Great work so far! As long as the release is more stable than Windows 10 was, I'll be happy. Razz
As for the buttons,
I'm not really sure what to use for selecting but perhaps [2nd]+[y=]?
For copying can you just do [sto->]?
For pasting use [2nd]+[rcl].
I tried to suggest combinations that are close to each other and ones that feel natural from regular on-calc programming.

I look forward to the release! Very Happy

I'm pretty sure it's more stable than Windows 10 Razz Not quite as fast, but definitely more stable.
For text selection, like I think I said, it is [2nd] mode + [mem], for copying it is normal mode (not alpha or 2nd or anything) + sto->, and for pasting it is [2nd] mode + rcl Smile

These can get a bit confusing but I would say they make the most sense. Of course, if you don't read the README or this thread or if you don't even read the About page INCLUDED inside the program, which I don't know why you wouldn't, you may not know those functions exist Razz

I'm actually really proud of the flow of the program though and I hope everyone else will enjoy it.

I'm especially proud of my error detection too!!
It uses two arbitrary numbers and a 0, so if one of the arbitrary numbers is there when the program starts, it knows you encountered an error because the 0 couldn't be stored at the end of the program.
If the second arbitrary number is there when the program starts though, it knows you didn't even reach the main menu loop (since the first number didn't get to overwrite the second number) and thus when you run the program again, it knows that there was a problem displaying the menu, which means the note string was tampered with or deleted.

edit: thank you TheLastMillennial for the error detection idea!

EDIT 2: I know I've got a lot of screenshots in this thread. I think this should look good as an overview:
It is another day closer to the release (which is VERY soon)! This morning with the help of _iPhoenix_, I've created a compression and decompression routine that converts between the string and the list.

I was able to store 4 characters per list element, by utilizing both the integer and fractional part of both a real and imaginary number in the same element. Putting the letters "ABCD" in a number, for example, would result in the element 35.036+37.038i.

Here is my (rough) code:
Compression

Code:
ClrHome
Output(1,1,"Compressing...
DelVar |LBNS0DelVar |LBNS1DelVar |LBNS2DelVar |LBNS3DelVar |LBNS4DelVar |LBNS5DelVar |LBNS6DelVar |LBNS7DelVar |LBNS8
Fix 3
Str8+"[xbar][ybar]->Str8
For(I,0,length(Str6)/4
   1+int(I/999->X
   1+remainder(I,999->Y
   0
   If 4I+1<=length(Str6
   inString(Str8,sub(Str6,4I+1,1
   If 4I+2<=length(Str6
   Ans+inString(Str8,sub(Str6,4I+2,1))/|E3
   If 4I+3<=length(Str6
   Ans+inString(Str8,sub(Str6,4I+3,1))[i]
   If 4I+4<=length(Str6
   Ans+(inString(Str8,sub(Str6,4I+4,1))/|E3)[i]
   If X=1
   Ans->|LBNS0(Y
   If X=2
   Ans->|LBNS1(Y
   If X=3
   Ans->|LBNS2(Y
   If X=4
   Ans->|LBNS3(Y
   If X=5
   Ans->|LBNS4(Y
   If X=6
   Ans->|LBNS5(Y
   If X=7
   Ans->|LBNS6(Y
   If X=8
   Ans->|LBNS7(Y
   If X=9
   Ans->|LBNS8(Y
End
sub(Str8,1,length(Str8)-2->Str8


Decompression

Code:
SetUpEditor BNOTE,BNS0,BNS1,BNS2,BNS3,BNS4,BNS5,BNS6,BNS7,BNS8
If dim(|LBNS0) and dim(|LBNOTE
Then
   ClrHome
   Output(1,1,"Decompressing...
   Str8+"[xbar][ybar]->Str8
   Float
   8->L
   "|LBNS->Str2
   Str2+"8"->|u
   If dim(|LBNS0
   Then
      Repeat dim(|u
         If not(dim(|u
         Then
            L-1->L
            Str2+toString(Ans)->|u
         End
      End
   End
   " ->Str6
   For(A,0,L
      Str2+toString(A)->|u
      For(I,1,dim(|u
         |u
         Ans(I->N
         real(iPart(N
         If Ans
         Str6+sub(Str8,Ans,1->Str6
         real(|E3fPart(N
         If Ans
         Str6+sub(Str8,Ans,1->Str6
         imag(iPart(N
         If Ans
         Str6+sub(Str8,Ans,1->Str6
         imag(|E3fPart(N
         If Ans
         Str6+sub(Str8,Ans,1->Str6
      End
   End
   sub(Str8,1,length(Str8)-2->Str8
   sub(Str6,2,length(Str6)-1->Str6
   ClrHome
End
Michael2_3B wrote:
It is another day closer to the release (which is VERY soon)! This morning with the help of _iPhoenix_, I've created a compression and decompression routine that converts between the string and the list.

I was able to store 4 characters per list element, by utilizing both the integer and fractional part of both a real and imaginary number in the same element. Putting the letters "ABCD" in a number, for example, would result in the element 35.036+37.038i.

Here is my (rough) code:
Compression

Code:
ClrHome
Output(1,1,"Compressing...
DelVar |LBNS0DelVar |LBNS1DelVar |LBNS2DelVar |LBNS3DelVar |LBNS4DelVar |LBNS5DelVar |LBNS6DelVar |LBNS7DelVar |LBNS8\Fix 3
Str8+"[xbar][ybar]->Str8
For(I,0,length(Str6)/4
   1+int(I/999->X
   1+remainder(I,999->Y
   0
   If 4I+1<=length(Str6
   inString(Str8,sub(Str6,4I+1,1
   If 4I+2<=length(Str6
   Ans+inString(Str8,sub(Str6,4I+2,1))/|E3
   If 4I+3<=length(Str6
   Ans+inString(Str8,sub(Str6,4I+3,1))[i]
   If 4I+4<=length(Str6
   Ans+(inString(Str8,sub(Str6,4I+4,1))/|E3)[i]
   If X=1
   Ans->|LBNS0(Y
   If X=2
   Ans->|LBNS1(Y
   If X=3
   Ans->|LBNS2(Y
   If X=4
   Ans->|LBNS3(Y
   If X=5
   Ans->|LBNS4(Y
   If X=6
   Ans->|LBNS5(Y
   If X=7
   Ans->|LBNS6(Y
   If X=8
   Ans->|LBNS7(Y
   If X=9
   Ans->|LBNS8(Y
End
sub(Str8,1,length(Str8)-2->Str8


Decompression

Code:
SetUpEditor BNOTE,BNS0,BNS1,BNS2,BNS3,BNS4,BNS5,BNS6,BNS7,BNS8
If dim(|LBNS0) and dim(|LBNOTE
Then
   ClrHome
   Output(1,1,"Decompressing...
   Str8+"[xbar][ybar]->Str8
   Float
   8->L
   "|LBNS->Str2
   Str2+"8->|u
   If dim(|LBNS0
   Then
      Repeat dim(|u
         If not(dim(|u
         Then
            L-1->L
            Str2+toString(Ans->|u
         End
      End
   End
   " ->Str6
   For(A,0,L
      Str2+toString(A->|u
      For(I,1,dim(|u
         |u
                        Ans(I->N
         real(iPart(Ans
         If Ans
         Str6+sub(Str8,Ans,1->Str6
         real(|E3fPart(N
         If Ans
         Str6+sub(Str8,Ans,1->Str6
         imag(iPart(N
         If Ans
         Str6+sub(Str8,Ans,1->Str6
         imag(|E3fPart(N
         If Ans
         Str6+sub(Str8,Ans,1->Str6
      End
   End
   sub(Str8,1,length(Str8)-2->Str8
   sub(Str6,2,length(Str6)-1->Str6
   ClrHome
End


Here, have some optimizations.
I modified the code in the quote with some relatively trivial optimizations.

To my dear friend TheLastMilennial, I claim dibs on the inevitable "how to write text files on your CE" video Razz
now, if Michael2_3B or anyone else higher up on the food chain than me wants to make one, I will gladly let them. But I can sell even the worst, slowest, and most boring game really wellNote that I'm not saying BasicNote is bad, slow, or boring...
_iPhoenix_ wrote:
Here, have some optimizations.
I modified the code in the quote with some relatively trivial optimizations.

To my dear friend TheLastMilennial, I claim dibs on the inevitable "how to write text files on your CE" video Razz
now, if Michael2_3B or anyone else higher up on the food chain than me wants to make one, I will gladly let them. But I can sell even the worst, slowest, and most boring game really wellNote that I'm not saying BasicNote is bad, slow, or boring...

Lol thanks!

I will likely be creating my own video on the entire program myself though Smile
If you think I'm going to double post, then you're absolutely right because that's exactly what I'm doing! If you think I'm going to release an imperfect program, then you're also completely right! If I were to wait until everything is perfect, the program would never be released Razz

>>BasicNote CE is NOW IN THE ARCHIVES!<<

I can hardly express just how happy I am to get this project off my chest. It's been a long 2 years of on and off but hard work. Even if you don't plan on using my program, it would really mean a lot to me if you at least downloaded it and tried it out!

The code is still a little bit messy, but a majority of people won't even look into that Razz If you want to look into the belly of the beast though, I'm sure you might learn a lot from my algorithms!



>>You can also view the source code, screenshot history, and other additional things by clicking here.<<
Double-post worthy approved. Good Idea

Congrats Michael! I'm looking forward to all those people who will benefit from it.
This is a fantastic program. I tried it before it was released and I found it was great on all counts. It was fast, easy to use, relatively compact for what it does, and extremely clever. Congratulations on this release, and I can't wait to see what comes from you in the future. Really good job.
Wow! I can't wait to try this out! It sounds like your 2 years of hard work paid off! Very Happy
Thank you all for your kind messages! I hope people can benefit from it in more ways than 1 Smile

Just to let you all know, I will have updates to the program in the future. These updates will include .txt 2 note (hopefully) but maybe not for a little while, as well as find & replace text, and any bug fixes that need to be done. Just remember to post any bugs here in case I don't know about them or forgot about them.

However I am suspending all work on this project for the time being.
Basic Note is a Amazing, All you hard work payed off. I Look forward to using you amazing program.
  
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 5
» All times are UTC - 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