07-08-2015 10:39 AM
So this is a question followed by an odd project (on my quick-drop plugin spree... somebody stop me!).
What place do snippets have in people's day to day coding?
Personally, they exist in this strange limbo between "I'll code that myself every time", "That should be a common library object", "That needs to be a function", and "I would rather have that visible than hidding in a function". I have a handful of snippets sitting on my deskstop. Two notable ones are the "Coerce to Type" and a "Exit if runtime" (using the conditional disable).
Now, onto my strange project. Given the stange limbo state, I wanted to gauge snippet interest before posting this to the quick-drop group and spamming it even more. It creates a ghosted window that shows a snippet and follows your mouse. Scrolling the middle button will flip between snippets you have in a directory. Once you click, it places the snippet. Amusing bit of coding, but only useful if your coding method uses snippets currently.
07-08-2015 10:42 AM - edited 07-08-2015 10:43 AM
I guess my question is, why snippets? Why not subVIs in your user.lib directory? This is currently how I reuse common code like "Exit if Runtime", or "Val Change?".
Edit: I assume just to elminate another file you have to drag along with your source code?
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
07-08-2015 11:26 AM
I only use snippets for giving examples here on the forum.
For your exact scenario, make the VI and put it in your User.lib folder. You can edit the palettes and have those items "Place VI Contents". This is even easier if you use VIPM to make the package (which has a palette editor) and then you just install the package. So what does this give you? It basically works the same as a snippet (does not put down the VI itself, but the code inside of the VI) and you can make a normal quickdrop shortcut for it.
I do this specifically for my error clusters. Yes, I am that picky on how they are spaced and everything. So I have a VI with just two error clusters (error in and error out) that is sitting in my user.lib. I set it to place the VI contents and created the shortcut of "ec". So now I just open quick drop, type "ec", and then place the clusters down.
07-08-2015 11:37 AM - edited 07-08-2015 11:39 AM
Place contents is the way I should do it. I just never get around to doing it.
I also hate placing actual (non-place-contents) VIs in my userlib unless they're managed by package manager and hosted somewhere. Tracking down dependencies annoys me to no end. However, going that route requires a good amount of work.
I didn't think snippets were used much and there is a reason I called this plugin odd. I did like the way you can see it while perusing.
07-08-2015 11:53 AM
I only use Snippets for posting "viewable and executable" code on the Forums. I don't think I'd ever consider using them in "real code". Oh, another use I've made for Snippets is to "capture images" of LabVIEW code (while in LabVIEW) when I need a .PNG to insert into a document and I'm too lazy to bring up SnagIt.
Bob Schor
07-08-2015 04:12 PM
I agree with everyone else. For me a snippet is only used on these forums. Reuse if code is managed with packages and libraries, or in a catch all folder of reusable code that isn't ready for prime time.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-08-2015 05:02 PM
What ever happened to the "Moo" (Me Too) Button we all hated?
Snippets belong in the realm of technical corespondance NOT in replace a library of "Merge vis" or properly located Templates (Those wonderful File.New... objects)
So, They are GREAT for the forums or internal training documents that might also go to non-developers (e.g. I've often been asked to publish a Tip of The Week) Some E-Mail managers (IT Weenies) know a *.vi is executable and block them but almost every filter lets *.png's through (Suckers don't tip 'em off) so they are absolutely invaluable for aiding the guy downstairs with his buggy code too! BUT, Reuse? NO! Do the right thing and manage your "MyLabVIEW" and "TeamLabVIEW" tools with a policy agreed on within your team. It will be worth the effort.
07-08-2015 06:09 PM
@JW-JnJ wrote:
So this is a question followed by an odd project (on my quick-drop plugin spree... somebody stop me!).
Scripting projects often start with a sudden "Wouldn't it be really cool if?" then end after way more hours of development than you wanted to invest from my experience.
That being said, can you attach the decoder (chunck method).vi so I can try out the QD plugin? Maybe it's me but I couldn't find it in the zip file you attached.
07-08-2015 06:34 PM - edited 07-08-2015 06:36 PM
@JÞB wrote:
BUT, Reuse? NO! Do the right thing and manage your "MyLabVIEW" and "TeamLabVIEW" tools with a policy agreed on within your team. It will be worth the effort.
Don't get me wrong. I wasn't advocating this method. We are current in the process of working on a resuse library and slowly agreeing on what should go in (getting programmers to agree is hard)
That being said, there is a weird "no man's land" of reuse code. Some code is a combination of the following
This is the kind of code that usually involves a hunt down VI memory lane, examples, and copy/pasting bits. Mainly because you recognize it by function and connections, not by representation (icon/name). Maybe it's just me, but the larger/rare code collections could do better by a more visual representation. Not this though.
@Jacobson-ni wrote:
Scripting projects often start with a sudden "Wouldn't it be really cool if?" then end after way more hours of development than you wanted to invest from my experience.
That being said, can you attach the decoder (chunck method).vi so I can try out the QD plugin? Maybe it's me but I couldn't find it in the zip file you attached.
Totally agree. It was more of a learning experience and didn't take long. Waaay less time than the EasyConvert. This likely ends my adventure into plugins.
Yes, I'll get it uploaded tomorrow. I think that was part of someone else's quick-drop snippet plugin that I accredited in the placement VI. It was password protected so I thought it was a built-in function (dependencies!!!). I still think it's an interesting (and yes flawed) concept.
07-09-2015 06:48 AM
@Jacobson-ni wrote:
That being said, can you attach the decoder (chunck method).vi so I can try out the QD plugin? Maybe it's me but I couldn't find it in the zip file you attached.
Here.