Community script sharing

edited January 2015 in General

Hi,

Continuing the theme from a couple of other posts, but creating a new post for discussion purposes in order to not hijack someone's thread:

There has been interest in setting up a site where one can submit scripts for benefit of others. Similar to Matlab's File Exchange.

I dug around for an open source option. I really only found one: http://sourceforge.net/projects/phpcodecabinet/

It is old (this version was released in 2004!) but lightweight and works fine. If anyone finds another one or a better one, please let me know. There are also some commercially-available ones out there but I'm not pursuing those in the spirit of following Matthias's open source lead. There is also the possibility of writing one from scratch, but my skills are not nearly enough for that.

I put a temporary demo on my website. http://davidnhutch.com/phpcc-0.5/

Username is admin, pw is phpcc

Or, username is user, pw is phpcc for the non-administrator account

You don't need to log in to browse the code though. Just if you upload code.

I put one or two code examples in each category. I am giving the world admin rights, so please don't go crazy and delet everything.. :-) BUT, feel free to upload your own code to get an idea of the process and the options available.

If we were to use phpCodeCabinet, I believe the following are needed:

  1. It's ugly and would need to be revised to match the "look" of klayout.de

  2. Right now the text highlighting is done with some code called Beautifier. Unfortunately it doesn't include Ruby or Python (or lym, or KLdrc, of course) in its list, so the text coloring is not correct. Would need to find or write a Ruby/Python/lym text highlighting specification for Beautifier. Beautifier appears defunct - seems it is no longer actively being developed.

  3. The code indenting is not shown properly, due to the fact we are not using a Ruby/Python/lym file in Beautifier so it doesn't know how to indent it. So we'd also need to figure out how to specify indenting using Beautifier. When you export it, indenting is fine, so it's just a display thing.

  4. I think it valuable to include the option to comment on someone else's script, and to rank from 1-5 stars. Also to see this ranking information on the list of scripts, and to sort by it in the search results.

  5. Browsing the code and browsing the search results can be improved further. For example, both should be filterable by language (Ruby/Python/etc).

  6. Right now the "Export" function exports a single CSV file which is all the desired code concatenated. Instead, if a single piece of code is selected for export, it should just give you the .rb/.lym/etc. Or if multiple scripts are selected it should download a zip file containing them.

  7. I can't figure out how to delete categories which seems odd. I'm sure there's a way.

  8. When you enter new code, the "Language" field should be a drop-down containing ".rb", ".lym" etc, but instead it's a text field.

  9. There are a couple of minor bugs I've found, but mostly it works pretty well. If we used this code we would fork the SourceForge code so others could also benefit.

  10. Then if we get to that point, with Matthias's permission, physical integration into klayout.de.

I'm sure there are other tasks that will rear their heads if we proceeded with phpCodeCabinet. Such as, I'm not sure if uploaded .rb files are checked to ensure they are legit .rb text files and not some malicious software, etc.

But before going to much trouble I hope to get community feedback. What do you think? Anyone have other ideas, code, or php skills? (I have very little.)

Thanks,
David

Comments

  • edited January 2015

    The scripts I mainly refer are the ones from Matthias in :

    http://www.klayout.de/useful_scripts.html

    On my own, I have also posted some references :

    Dice count : gross die, yield and wafermap on a layout : (your circle problem answer was in this post) :
    http://klayout.de/forum/comments.php?DiscussionID=368

    InputDialog with multiple input fields :
    http://klayout.de/forum/comments.php?DiscussionID=334

    In this post : for a link : type the site name between bracket [] followed immediately (no space) by the link between parenthesis ().

    BRgds,

    Laurent

  • edited November -1

    Laurent_c,

    Thanks for the tip on using brackets for links. I was wondering how to do that.

    Thanks for the links to scripts. You didn't comment on the basic idea of having a centralized location for such scripts though. Yes there is a handful at http://klayout.de/useful_scripts.html or other scripts scattered through the Forum questions.

    I envisage some infrastructure allowing easy crowd-sourced collection of far more scripts than found at http://klayout.de/useful_scripts.html. Such a resource may provide useful scripts in themselves, or else allow people to teach themselves using others' examples rather than asking Matthias :-).

    I guess it's a functionality I wish I had for myself, but if it's only me who sees value in this, that's fine, in that case I would like to know before I spend time on it :-) What are your thoughts on that? Suggestions? Anyone volunteer to assist?

  • edited January 2015

    Hi David,

    I don't have any experience in code repositories, but I think this is a good idea. It would save a lot of effort in searching through the forums here, especially since there are many posts on topics other than writing scripts. It would also be interesting to see how people use KLayout.

    Although it's just an example, the description area is currently very small; it would be good for it to be bigger to allow for examples, tutorials, and detailed documentation. It would also be good to indicate which version of KLayout was used to develop the script since each new version of KLayout offers new functions, and also for the author to add newer versions.

    I wonder whether you could use a forum management program for the repository, since they allow for downloading, documentation, and user comments. I'm not too sure about the technical details, but an example is websites that provide game modifications; they have these functions and appear to be powered by forum software like vBulletin (that's not open source, but it's just an example). Configuring the front end may be a problem, although if it's possible, it would be quite interesting.

    Regards,
    Z Lim

  • edited November -1

    Thanks Z Lim,

    Really good ideas on the larger description area and the inclusion of KL version. Will add to the list of mods. Some of the smaller mods like this I could probably figure out how to do myself, but larger things would be a challenge for me with my limited experience.

    I like the idea of a program-based front end. In fact maybe in the distant future this could be integrated in to the Macro Editor. For now we'll just go with a Web based front end though, unless an enthusiastic soul with more experience than I wants to tackle it.

    David

  • edited November -1

    Oh I think I misunderstood your comment about a forum management program for the repository. Yes in fact that was my original suggestion in another thread, was to use a forum like this one that we are writing on right now. Unfortunately this particular forum wouldn't be well suited to that since you can't attach files nor give star rankings nor apply tags or Metadata such as what version of KL you are using. In general the idea is a good one though, pls let me know if you find a good open source one. I'll look around too and compare with phpcc.

  • edited January 2015

    Hi all,

    thanks for running that discussion and for these valuable suggestions!

    I had a look at the phpCodeCabinet installation. I think that's a good template, but as you pointed out there are some disadvantages - I'd like to add that I did not find some user management which works independently from the administrator. Maybe I missed something. I had the same problems with the indent - even with "Unspecified" language, no indents were shown. I am also missing some change log kind of thing.

    Apart from that it's pretty lightweight and adapting to the web site style should not be a big issue. But adding Ruby support does not seem quite feasible - the Beautifier library appears to be out of maintenance. I'd like to regard that as a template. If that scratchpad approach makes sense, it's likely that I can somehow integrate the code or provide something similar.

    Regarding the forum, I am still running Vanilla 1. Unfortunately there is no more support for that version and migration to Vanilla 2 is more difficult than I expected. I was disappointed a little, because for attachments for example, only images were accepted and I had to work around that problem. Migrating to Vanilla 2 will probably mean that all the user accounts will get lost (hopefully not content), so I was reluctant so far to perform the migration. Vanilla plugins appear to be quite powerful, so adding functionality that way (basically PHP based on some kind of model/view architecture) may be a future option to integrate a kind of scratchpad and maybe other functionality.

    The server this page is hosted is only partially open to development and not a root-enabled VPS. There is MySQL and PHP in the usual combination, but not much else. That should be sufficient for a simple application, but access to a SVN repository for example will not be possible.

    Unfortunately I am fully booked for the next weeks so right now I cannot afford to spend time on that. But I'll come back to that for sure.

    Thanks,

    Matthias

  • edited January 2015

    Thanks Matthias,

    By "a user management which works independently from the administrator" do you mean allowing people to create their own accounts? Yes I agree that is needed. Ideally being logged in to the forum should also mean you are logged in to the code repo.

    Yes indent is an issue. It's not that they are not there, just that they are incorrect due to no Ruby/Python spec. For example notice the last five lines in Circle PCell are indented due to the "if" on the line above. The quickest workaround is to grab the code "as-is" from the mySQL database and display it with the author's original indents, rather than have Beautifier attempt to indent it. I can take a look at how to do that.

    I discovered that phpCodeCabinet has some incomplete functionality for user comments - it creates some mySQL records to store user comments, but that functionality is not exposed to the user. Therefore I think this is partially there in the code. I'll have to dig some more.

    A change log is a nice idea. Perhaps this can be added at a later point since it's a "nice-to-have". In the meantime, changes could be noted in comments.

    As for Beautifier, I have looked around and let's replace that with GeSHi. Its php usage is very similar, so it should be relatively simple to swap Beautifier for GeSHi. In GeSHi, Ruby and Python are supported out-of-the-box, and it may still be under maintenance (last stable release Aug 2012, so at least it's more recent than Beautifier). Of course if we were designing from scratch there are better ways of doing code highlighting e.g. thru javascript control of css rather than the perhaps old-fashioned php approach, but GeSHi provides a faster path to the solution -- I hope GeSHi will just slot right in.

    As for the forum, I see now the issues with Vanilla 1 vs 2. That's a shame it's not easier to upgrade. Not sure what you mean by some of your comments -- do you see a path to do a satisfactory code-repository-like functionality via Vanilla 2? If yes, that may be preferable rather than phpCodeCabinet. If no, then perhaps we should fork phpCodeCabinet and proceed with that.

    I can contribute to phpCodeCabinet development but my work will be slow as I'm a novice; it may take a few months to get a release-able version, and it won't have some of these advanced mods we are talking about. So don't expect too much or too soon from me ;-).

    As for server requirements, phpCodeCabinet will only need mySQL and PHP so you have everything you need. I don't think SVN is necessary. For example, Matlab File Exchange does not offer SVN-like option - it's more like phpCodeCabinet. Yet Matlab File Exchange is still quite useful. SVN is more useful for large projects spread among many people, but by contrast this tool and Matlab File Exchange are (I think) more for individual users to browse, select, and download, codes of interest.

    David

  • edited November -1

    Hi David,

    by user management I meant that users have to authenticate and can apply for a membership. I can't simply leave the site open to everyone and on the other hand I don't want to grant access to anybody manually. Vanilla's authentication System can probably be reused, but I think Vanilla 2 is different in that respect.

    Regarding Vanilla 2 I am halfway done - it's basically the Styling which needs to be redone completely. I think I should be able to migrate in a few weeks.

    Best regards,

    Matthias

  • edited February 2015

    A question for those who might use phpcc, then a progress update from me.

    Sorry, I know this is wordy but bear with me.

    QUESTION:

    Here are a few ideas for code categories that we could use on phpcc.

    what are some other categories that people use KL for?

    +Beginner tutorials
    
    +Configuring KLayout (e.g. setting shortcut keys, grid sizes, anything in File>Setup, anything in Edit>EditorOptions, a technology manager, ...)
    
    +Importing (e.g. importing layouts, DRC files, Cadence techfile, ...)
    
    +Layout-level operations
    |--working with layouts (e.g. layout sizing/transforms, batch convert gds to oas, ...)
    |--working with shapes (e.g. (an)isotropic scalings/transforms, area/length calculations, Xsection script, ...)
    |--working with images (e.g. overlays, tracing, ...)
    
    +Cell-level operations
    |--working with cell hierarchies (e.g. copy cell trees, instancing cells, writing each child cell to new file, ...)
    |--working with arrays (e.g. find and flatten non-orthogonal arrays, arraying cells, ...)
    |--working with PCells (e.g. useful PCell examples)
    
    +I/O with other programs (e.g. read data from Excel spreadsheet, importing Cadence techfile, controlling a microscope, taking screenshots, ...)
    
    +DRC (e.g. search for odd-width paths, generate and parse custom report database, ...)
    

    UPDATE:

    • Got comments working. See, for example a couple of comments on this snippet: http://davidnhutch.com/phpcc-0.5/snippet.php?sid=4. Anyone can view comments but only logged-in users can post comments. (See above post for login information.)
    • Installed Vanilla 2 on my website alongside phpcc, so I can have both for testing purposes. Trying now to get phpcc to use Vanilla's cookies. (So, if you are logged in via Vanilla then you are logged in to phpcc.) I can verify Vanilla being logged in or not, and I can get Vanilla UserID via a custom php script, but making phpcc use that information is proving difficult. If anyone has experience with cookies, let me know..
    • Replaced Beautifier with GeSHi. Indenting now works, but colors don't yet.

    David

  • edited November -1

    Hi David,

    this is great!

    I am terribly sorry I am really, really busy right now and I can't spend time on that. But I'll come back to that ...

    Matthias

  • edited February 2015

    UPDATE

    I spent quite some time with phpCodeCabinet. The code is awful (no separation of back-end and front-end; uses many deprecated PHP functions and some functions that have been removed entirely from PHP5). In the end I figured we could do better and went elsewhere.

    Tried a couple more. Most notably LogithequePHP which was still nice and lightweight, and better than phpCodeCabinet but very buggy and had security holes.

    So I took a look at Vanilla and I think I can craft a plugin that will make those Forum posts seem like a script repository post with comments, upvote/downvote, metadata (such as KLayout version), etc. I have a rudimentary plugin already working that does a small amount of what I want to do. Let me pursue this path for a little while and see if I can come up with something. After my travels, I think this will be best, as it allows integrated sign-on with your future actual Vanilla 2 Discussion Forum, no more security holes than Vanilla Forum itself, is much nicer looking, is riding on a current software rather than on old software that nobody is maintaining, is making use of other ready-to-go tools (such as other existing plugins for syntax highlighting), etc.

    Anyway let me try a few things down this avenue and see how it goes..

    David

  • edited March 2015

    UPDATE

    OK, I wrote a little plugin for Vanilla 2. It works this way: In Vanilla's config file you specify one parent category that you want to be your 'scripts' parent category. The rest of the forum behaves normally but the 'scripts' category you defined has a bunch of other features. For example when you add a script to 'scripts' category, you have other boxes to enter metadata like Script Version, KLayout Version, Example Usage, etc. (Take a look; I may have gone overboard here but you get the idea.)

    There is a demo here: davidnhutch.com/vanillaforum

    Username and pass are both klayoutuser. Feel free to post discussions and scripts to get a feel for it.

    There are multiple advantages to this, three of the major ones are:

    • A user searching for help on some RBA function will get search results from both the forum and the discussion.
    • We don't have two sign-in systems, or the need to merge two sign-in systems into one.
    • A smallish plugin rather than a full-blown code storage system is all that needs to be written -- leverages related features already found in Vanilla.

    It's pretty much all contained in a relatively short PHP plugin file; i.e. I didn't modify core Vanilla 2 files. I leverage a couple of other existing plugins. Also, I'll release this plugin as open source on Vanilla's plugins listings when it's complete.

    But it's not done. For example:

    1. Even though there are multiple "Language" options in the dropdown box on "New Script" page, only ".rb - Ruby" option currently works. Other ones give you errors. I just haven't completed this part yet.
    2. You can post some code, but then later when you edit that existing post, it won't let you edit (currently gives an error, haven't finished this part yet).
    3. The presentation of information needs some work.
    4. etc.. a few other things

    But, I hope to get feedback earlier rather than later!

    So, Users: What is good or bad about it?

    Matthias: Would something like this be an acceptable solution for potential incorporation into your upcoming Vanilla 2 forum?

    Thanks,

    David

  • edited November -1

    One quick thing is worthy of note, lest someone tries it and is unable to post a script.

    When you post a new script, currently you need some text in the "Additional Description" field, or else you get an error "Body is required". This is not obvious because the error message is off the top of the screen and you can't see it without scrolling up. (I just need to make that field optional on that page.)

  • edited March 2015

    UPDATE

    It's all working now, aside from two minor things:

    1. You can post discussions, scripts, and comments, but when you go to edit an existing discussion/script, that part doesn't work yet.
    2. The presentation of the script and the presentation of the script input page could use some work.

    But other than that, functionally it's all there. Check it out and post some test scripts: http://davidnhutch.com/vanillaforum Username and password are both klayoutuser.

    Other 'done' items:

    • I fixed the syntax highlighting so all languages work. I wrote highlighting specifications for .lym and .lydrc (actually I just combined the xml spec with the ruby/python spec, so that part was easy).
    • I didn't like the idea of users pasting their scripts into textbox. Because (A) A user could paste the ruby code from the Macro IDE instead of the full lym (xml) file. (B) Errors could be made when highlighting and pasting. Therefore I added an 'Upload script' button. Actually that button just populates the textbox with the file contents. This is all done client-side, so there is actually no uploading of script at this point. This is just a safer way to do it -- you don't want users to be able to upload arbitrary files to your server, so the safer way is to read the file client-side and populate the textbox client-side. Then when you click Submit, it is uploaded to the SQL database along with the rest of the form.

    Let me know what you think and if something like this is of interest to you (Matthias) for inclusion in a future Vanilla 2 forum. Feel free to comment directly to me at my gmail address 'david.n.hutch' if you prefer.

    Meanwhile I'll tidy up the rest of the code and add the ability to edit existing discussions/scripts. If anyone finds errors or has suggestions, let me know.

  • edited May 2015

    UPDATE

    There has been some delay as I got busy with other things, but I have a vacation upcoming... so you know what that means: No work means I can finally get some things done! :)

    It's finished except some of the presentation could use polishing. All functionality is working now, except for the mobile view. davidnhutch.com/vanillaforum. Username and pword are noted earlier. Tell me if you find bugs.

    However, now that I have delved into the depths of Vanilla forum plugin writing, I realize I did it all wrong. Yes it works, but the approach I took was all wrong and not very future-proof. It is not the "Vanilla way" of doing it. So, I plan to actually re-write it from scratch.

    But, before I do -- I hope to know if such functionality is desired by either Matthias or other forum users? I haven't heard one way or the other, so it is possible that I am wasting my time and it's only I that wants or would use such functionality.

    Users + Matthias: Let me know if this functionality is desired or not -- if so then I will continue, and rewrite the forum plugin properly. If not, then no harm done, actually it's good as I just learned some new skills while doing it!

    Matthias: If there is some reason you would prefer not to host other people's scripts (legal reasons? or don't have much space for SQL databases full of others' code? dislike the idea of using plugins on a future Vanilla 2 forum?) then no prob, just let me know either here or by email, and no harm done! Or the script sharing site could be on a standalone forum or separate website if that is preferred by you, but then it may lose the advantage of a single sign-on.

    Thanks,

    David

  • edited May 2015

    Hi David,

    I just had a first look at your forum and took the opportunity to browse your web page - very impressive!

    Having the scripts searchable and in categories (or, maybe more flexibly, taggable) is definitely a good idea. For bigger scripts (or whole suites of such scripts, your Red Toolbox seems to be such a suite) however, I think additional functionality would be desirable. This would be:

    • version/revision control
    • bug/feature trackers
    • ways for others to contribute patches/codes/comments etc.

    Looking at this list, it looks a lot like what sites such as Github are already offering. Of course, integrating something like Github with a Vanilla forum would probably be a major undertaking, especially if you want single sign-on and other integrated functions (e.g. search).

    No matter what, since integrating any additional features with this forum here would require Matthias' cooperation, I guess he is the one to decide what is possible :)

    What are your views on Github and the likes (BitBucket, Sourceforge, Launchpad)?

  • edited May 2015

    Thanks for trying out the dummy forum and for your feedback!

    You bring up a good point, and one that I have thought about, but actually I identify two use cases and a single solution may not solve both.

    • Use case #1: Someone posts standalone or mostly standalone scripts, each to perform a specific function. Other people may use the scripts as-is or simply learn from them.

      • Example: A user creates a script that batch-converts GDS to OAS, thinks it might be useful for others to use or learn from, and uploads it to the site.
      • If you have a small collection of scripts rather than just one, there is a "Requires" field, that will tell the person that this script requires some other script on the same site. Though, it is up to the author to fill this out correctly. And it is unwieldy for large collections of scripts.
    • Use case #2: A user writes (or multiple users collaborate on) a larger script or a collection of scripts.

    I would argue that #1 is the larger use case, or at least the more important of the two to solve. Why?

    • Taking myself as an example, I have done a lot of KL coding, yet I have never written a single standalone script that is complicated enough to need the advanced features offered by Github, Bitbucket, etc. Such as version-control, svn, etc. That's not to say #2 doesn't exist (it does -- see for example Xsection@KLayout). Certainly The Red Toolbox as a whole could qualify, but really that is just a collection of mostly standalone scripts, and I'm an exception rather than the rule for creating that.
    • People are already doing use case #1, posting some scripts on this forum. Many examples. Yet I can only identify one case so far (See Xsection link above) where users have needed #2. But, it is inefficient to find and discover scripts on the existing forum since they are jumbled in with the forum questions.
    • While you can upload single simple scripts (such as the GDS->OAS batch converter example I gave) on Github, it is rather like killing an ant with a bazooka. Look at any github project page, and imagine if that were just a simple GDS->OAS converter script. Then glancing around that page you can see that almost every function of that site is unnecessary. Forums on the other hand are not complicated.
    • Consider Matlab. When I need a Matlab script, for complicated things or even for simple things I am too lazy to write it myself, I know exactly where to go: Matlab File Exchange. One search and I know if it exists. However, if I had to search several sites or search Google (and thus parse through irrelevant results such as forums with people using similar words instead of people's actual working code), it would certainly take longer and be less fruitful.
    • At least on the US version of Google search, it is highly unfortunate that any search with "KLayout" as a search term actually self-corrects to "layout" unless you have visited klayout.de enough, and now for me it starts to prioritize that website. My point is that you don't want to have to use Google to find scripts on a variety of websites. You will have to parse through irrelevant web pages. Instead, you go to the one place where you know there is a treasure trove of scripts and just search there.
    • How do you and I currently discover and keep up to date with general KLayout questions and issues? The newsfeed on the forum. That same newsfeed would be interesting and helpful to also monitor to discover new scripts. They will pop up on the newsfeed as people upload them. If you used Github, or if people used a random collection of Github-like sites, it would be difficult to pull together such a newsfeed, and thus "discoverability" is poorer.
    • An advantage of Github is that you don't have to paste the final polished version - the code evolves after it is uploaded. That is still possible on the Vanilla forum version, though perhaps not as evident -- the author can just find his post and Edit it, to upload the new code. Actually this is similar to Matlab File Exchange -- if a comment points out a bug, the author can fix it and overwrite their old file. On Matlab File Exchange you can't roll back to find an earlier version, but it usually doesn't matter.

    Still, #2 has some usefulness. How to serve both 1 and 2? I suggest: use Vanilla plugin, but when you click "New Script", the author has the option to either (1) upload the script, or (2) paste a link to the script (or script collection) on an external site. Then, still everything is to be discovered in one place. Still there is one newsfeed. Still people can comment on it or rate it. Still people can search the scripts and sort by match, rating, date, etc. If you like, that is easy for me to add.

    So, script posts would come in two "flavors": One that is a script, and one flavor that is just a link to script or script collection on an external site.

    Having argued all of the above, I truly may be seeing incorrect levels of usefulness of such a tool, and I may certainly be wrong - maybe actually people prefer to use Github etc. So I'm not going to push any agenda :-) --- if the Vanilla plugin is useful, we can use it, if not then it never needs to come online and no harm done.

    Thanks,

    David

    ========================
    EDIT:

    Also I'll briefly mention:

    You mentioned four functions you'd like:

    1. scripts to be categorizable or taggable
    2. version/revision control
    3. bug/feature trackers
    4. ways for others to contribute patches/codes/comments etc.

    While Github is set up to do this, actually so is the Vanilla plugin. While not as finely engineered for the purpose: 1 exists, and 2-4 could be addressed with users commenting on a script or the author commenting on his own script. Certainly not as hardcore as Github, but I guess my point is that the Vanilla plugin is not incapable of addressing these things to some degree.

  • edited May 2015

    Hi David,

    I can definitely see the use case for the "small" scripts. I guess what I wanted to say is that for these cases, it would be almost necessary to integrate such functionality with this forum here, as it seems to make sense to have the code embedded within the forum discussion. To make such a change, Matthias would have to integrate it (which might be not too hard if it is a Vanilla plugin), so he needs on be on board with the idea.

    I do wonder though if we want users whenever they post even the smallest snippet of code to have to go through a process of uploading a file, adding a description and potentially other meta information to make it easily searchable, but then again maybe such a feature could exist just alongside the current "format as code" way of adding source code to the discussion. I do like your plugin's "expand source" button (especially for longer listings), have you thought of a "collapse source" as well?

    For any larger projects, I think having the ability to link to something like Github makes more sense.

    As for the search function, I am actually using the integrated search here in the forum rather than Google for 99% of the cases... I do miss the functionality of the quotation marks and other operators such as AND somewhat, though I don't see this as a priority and would hope Matthias is working on something more important (i.e. KLayout itself) :-)

  • edited May 2015

    True, good thoughts.

    I'm not 100% sure what you meant by your first paragraph. I suspect actually you looked at my 'dummy' forum and think I am proposing to have a separate forum for scripts (my one) and another one for klayout.de conversations (Matthias's one). Actually I propose they are the same forum, on klayout.de. The one you are looking at was just a dummy forum for purposes of developing the plugin.

    So, to be clear, I was taking advantage of the fact Matthias will migrate to Vanilla 2.0 in the future, by writing a plugin that he could potentially use on a future Vanilla 2.0 forum on klayout.de, if he likes the idea. On that forum, we'd have regular conversations under one master category, and scripts under another master category.

    So, imagine basically this forum right here that we are writing on, but with another master category for scripts. Anyway I hope that makes sense and I didn't throw everyone off too much!

    In your second paragraph - well right now I think only three of the fields are mandatory, but I could change that. So in principle all they'd have to do is type a title and choose the .lym file (or whatever) and click Submit. So you don't need to add all that metadata if you don't want to. But, yes, we could simplify and just remove some of those metadata fields if it was preferred. I don't see it as a huge hindrance though.

    Regarding "collapse source" - yes this would be nice. The "Expand source" actually is provided by another plugin (not written by me), so to add a "collapse source" is do-able, but not trivial as I'd be diving in to someone else's code. And then when the other plugin is improved or updated, we'd be working on a forked version which is not ideal. It would be a nice feature though.

    Yes I agree, the more we can lift Matthias's burden, the more likely he is to continue his awesome KLayout project. :-)

  • edited May 2015

    David, what you said

    Actually I propose they are the same forum, on klayout.de.

    ...we'd have regular conversations under one master category, and scripts under another master category.

    ...cleared this up for me. I might have missed that in the earlier posts in this thread. So if Matthias is willing to add your plugin, I think this could be a good idea for a simple scripts repository.

    For a moment I was wondering if such a tool could be integrated into a regular discussion (without having to put a script in its own Vanilla 2.0 thread)... like uploading or copy/pasting some code right here in the discussion. But that would probably be too tricky to tag and such, considering that this would be quite an addition to the regular Vanilla code.

    Another use case: I often find myself searching the forum for a template pattern of how to do certain things by scripting (e.g. how to instantiate a PCell within a PCell). I am not sure if that use case would be a good fit for the scripts repository, but that doesn't mean that the scripts repository wouldn't be useful for (maybe most) other use cases.

    I think only three of the fields are mandatory, but I could change that.

    If the scripts are in their separate category anyway, tagging and adding meta-info to them shouldn't be such a burden considering that is what the user wants to do anyway if they are in that category. I was just concerned that adding (e.g. copy/pasting) any code in any thread would involve filling in the fields, but as I understand the current way of adding snippets within a discussion would remain the same - am I right?

    The "Expand source" actually is provided by another plugin...

    Well, this might actually be good news (depending on how active/responsive the developers of that plugin are) since this could mean a patch/feature request and potentially a good improvement for that plugin - is it open source?

    Before we get too carried away though, maybe we should ask Matthias what he thinks of all of this.

  • edited May 2015

    Before we get too carried away though, maybe we should ask Matthias what he thinks of all of this.

    Yes. Not to get too carried away though, I'll just answer your questions and comment on your post below

    ...cleared this up for me

    Aha! Glad it makes sense now :-) Yes on my dummy forum there are two master categories in the list on the left side: "Discussions" and "Scripts", and then subcategories under each. When you click "New Discussion" you get to post a new discussion under that master category, and when you click "New Script" you are inserting a posting under the master Scripts category.

    For a moment I was wondering if such a tool could be integrated into a regular discussion (without having to put a script in its own Vanilla 2.0 thread)... like uploading or copy/pasting some code right here in the discussion.

    Yes, I suppose that is similar to how it is now. I do think grouping the community Scripts together is an improvement over that though.

    Another use case: I often find myself searching the forum for a template pattern of how to do certain things by scripting (e.g. how to instantiate a PCell within a PCell)

    Exactly. I also find myself doing the same thing.

    I am not sure if that use case would be a good fit for the scripts repository

    I'm not sure what you mean -- this is exactly the case where the scripts repository would shine. Let's say you are looking for an example of how to instantiate a PCell within a PCell. Hopefully someone has spent the time to post an example of that on our hypothetical future Vanilla2 forum. So, you'd just search under "Scripts" master category for some relevant search terms. Or, you'd go to "PCells" subcategory inside Scripts master category and browse. You wouldn't have to dig through forum entries about similar but unhelpful topics, you'd go straight to the finished script, if it exists.

    The "Expand source" actually is provided by another plugin...

    Well, this might actually be good news (depending on how active/responsive the developers of that plugin are) since this could mean a patch/feature request and potentially a good improvement for that plugin - is it open source?

    Good point. The relevant plugin is Creative Syntax Highlighter which is open source, and the author is a nice and helpful guy -- he may accept feature requests (we've emailed before). The guts of that plugin come from Alex Gorbatchev's SyntaxHighlighter which is also of course open source.

  • edited May 2015

    this is exactly the case where the scripts repository would shine.

    You are right. Once that repository is filled with all sorts of examples, it will be a good reference. Maybe there could even be a "templates" category which has minimal patterns of some basic concepts. It depends however on the users (as always) how they will use it - I am thinking e.g. of a question by a new user how to do something rather simple. Would an expert answering that question write the code directly in the reply or would they go over to the repository, create a new entry and then just post a link pointing to that into the reply to the original question? I guess we have to find out.

    On the syntax highlighting & folding plugins:

    the author is a nice and helpful guy -- he may accept feature requests (we've emailed before).

    Great. That's why open source is awesome :)

  • edited May 2015

    I haven't heard back from Matthias either way yet. Since my vacation is ticking away ("vacation" = extra time to work on stuff), and since I haven't heard back, I'll assume that a Vanilla 2 plugin is a feature that is not desired, and stop further development.*

    (No problem, I'm just explicitly stating it in order to close this thread out.)

    Thanks friendfx, zlim, laurent_c for your feedback! And thanks Matthias for an awesome tool!

    David

    * This is just the default unless I hear otherwise. I still have time and am happy to reverse this if I start soon -- but better to state the default now rather than at the end of vacation when it's too late!

Sign In or Register to comment.