diff --git a/031-Automatic-import-of-custom-code-during-compilation-in-JCB.md b/031-Automatic-import-of-custom-code-during-compilation-in-JCB.md index 2a95203..cad17c9 100644 --- a/031-Automatic-import-of-custom-code-during-compilation-in-JCB.md +++ b/031-Automatic-import-of-custom-code-during-compilation-in-JCB.md @@ -38,7 +38,10 @@ Now let's go back to the code. It actually inserted the code in the correct plac ### Inserting Custom Code Via Editor -Let's look at inserting. Remember as I said, don't put code close to each other within at least eight lines. So 1, 2, 3, 4, 5, 6, 7, 8. I could actually from this line insert, another set or either insert or replace another section of code. [00:11:58](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m58s) The reason is because the fingerprint that it creates above the insertion, is sometimes up to 8 lines long. It could happen that it actually uses from there(see video). And that could possibly be an error when you make a change here. It will think that this code is also been affected and it won't find it. So that is one of the limitations that these code insertions that you do either by replacing or inserting as chunk of text script, can only be inserted up to eight lines apart [00:12:34](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m34s) From each other. Let's do an insertion over here(see video). We got that inserted there. I did put a comment. +Let's look at inserting. Remember as I said, don't put code close to each other within at least eight lines. So 1, 2, 3, 4, 5, 6, 7, 8. I could actually from this line insert, another set or either insert or replace another section of code. [00:11:58](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m58s) The reason is because the fingerprint that it creates above the insertion, is sometimes up to 8 lines long. It could happen that it actually uses from there(see video). And that could possibly be an error when you make a change here. It will think that this code is also been affected and it won't find it. So that is one of the limitations that these code insertions that you do either by replacing or inserting as chunk of text script, can only be inserted up to eight lines apart [00:12:34](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m34s) From each other. Let's do an insertion over here(see video). We got that inserted there. I did put a comment. Let's save and compile. -???? -Let's save that And now let's compile Ok before we install it we can just again go check Whether everything was done as expected and yes the insertion was grabbed it was Added to the database and it is there Ok [00:14:04](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m04s) It has hash target obviously with insertion we only need where it starts not where it ends And so We can close that Now simply install that component Let's go look at the code Ok so this added the replacement Script Change it from replace to replaced It's added the inserted script From insert to inserted it [00:14:34](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m34s) Now if you want to make a change to it we're again Just add these diamonds here Make our change Save the file of course and then Then let's compile Let's check whether the work was updated Great it's updated the work in the database So let's install the component Ok let's go look at the code again Wonderful it's added it back All seems well [00:15:18](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m18s) Now We are working on another part of this implementation that for if so for some reason this code above it Changes It will give you a notice On compilation That there is been a change to the fingerprint and it could not find the insertion area It will still add the code on the line number But it will be escaped So that it doesn't change or hurt any of the code that still there The same goes with replacement code [00:15:50](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m50s) Since it is replacing code It is a little bit more tricky So we'll still add it into the line but we will not remove the old code Anyway I'm still going to be working a bit on that it needs some fine tuning I would like your feedback if you think There's a better way I'm always open for ideas Reality is We are very happy to announce that component builder can now Automatically extract custom code from your Component while In development [00:16:21](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m21s) Will add a switch that when your ready to distribute your component You could simply say you know that it's no longer in production And then when you compile it will actually not add these placeholders Anymore Ok well thanks for watching Please give me your comments at Github There is actually an issue open there Called Automatic import of custom code during compilation And [00:16:51](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m51s) You'll see that Yeah there's quite a few been said you can simply add your your comments and feedback to this ticket Or to this issue it's issue 37 Since the tutorial be on YouTube possibly by the time you view it closed but You're still welcome to go and make any comments on the closed issue if you like Anyway thanks for watching goodbye +### Checking The Custom Code Tab For New Entry Before New Installation + +Before we install it, we can just again go check whether everything was done as expected. Yes the insertion was grabbed. It was added to the database and it is there. [00:14:04](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m04s) It has the hash target, with insertion we only need where it starts not where it ends. And so we can close that. Now simply install that component. Let's go look at the code. It did added the replacement script, change it from replace to replaced. It's added the inserted script from insert to inserted. [00:14:34](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m34s) If you want to make a change to it, we're again just add these diamonds here(<>). Make our change. Save the file of course, and compile. Let's check whether the work was updated. Great it's updated the work in the database. So let's install the component. Let's go look at the code again. Wonderful it's added it back. All seems well. [00:15:18](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m18s) + +We are working on another part of this implementation if so for some reason this code above it changes. It will give you a notice on compilation, that there is been a change to the fingerprint and it could not find the insertion area. It will still add the code on the line number, but it will be escaped. So that it doesn't change or hurt any of the code that still there. The same goes with replacement code. [00:15:50](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m50s) Since it is replacing code, it is a little bit more tricky. So we'll still add it into the line, but we will not remove the old code. I'm still going to be working a bit on that. It needs some fine tuning. I would like your feedback if you think there's a better way. I'm always open for ideas. We are very happy to announce that component builder can now automatically extract custom code from your component while in development. [00:16:21](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m21s) We'll add a switch that when your ready to distribute your component, you could simply say you know that it's no longer in production. And then when you compile it, it will actually not add these placeholders anymore. Please give me your comments at Github. There is actually an issue open there called automatic import of custom code during compilation. [00:16:51](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m51s) You'll see that there's quite a few been said. You can simply add your your comments and feedback to this ticket or to issue 37. Since the tutorial be on YouTube possibly by the time you view it, it is closed. You're still welcome to go and make any comments on the closed issue if you like.