Jump to content

Who uses LabVIEW Snippets?


Recommended Posts

Hello LabVIEW Community.

I'm gathering some research and would like to know the following:

1. Do you use LabVIEW Snippets?

2. How often do you create new snippets?

3. How do you organize your snippets?

Just general answers. I'm just getting a feel for how the community is using this feature.

Thank you in advance.

Ryan

I do sometimes use them to post to LAVA because creating a snippet is less hassle than uploading a VI. But as I use google chrome, they are just not worth the bother to use generally (open image in a new window, resize the browser, drag to desktop, find a diagram, drag into vi from desktop, restore browser). If a snippet is posted on LAVA it has to be something pretty special for me to try and get it in a vi. I normally just pass them by.

Link to comment

1. Do you use LabVIEW Snippets? Yes, for posting to this (and NIs) forum

2. How often do you create new snippets? A few times a week

3. How do you organize your snippets? I don't - the Code Capture Tool puts them in a folder and puts the path onto my clipboard. I never browse to them so I never think about them after posting them.

Some things you didn't ask:

  • I don't use the native LabVIEW tool
  • I use a quick-drop plugin to open snippets from better browsers than IE
  • The Code Capture Tool will back-save a snippet, so I wrote a RCF plugin to extract a snippet in LV 8.2 and up

Link to comment

Hello LabVIEW Community.

I'm gathering some research and would like to know the following:

1. Do you use LabVIEW Snippets?

2. How often do you create new snippets?

3. How do you organize your snippets?

Just general answers. I'm just getting a feel for how the community is using this feature.

Thank you in advance.

Ryan

Hey Ryan,

I use VI Snippets for posting examples on the web. I also like to send them to my colleagues via skype (send file), occasionally, when I'm trying explain how to do something.

I do not ever save my snippets -- I don't consider them to be reusable code.

-Jim

Link to comment

Hello LabVIEW Community.

I'm gathering some research and would like to know the following:

1. Do you use LabVIEW Snippets?

2. How often do you create new snippets?

3. How do you organize your snippets?

Just general answers. I'm just getting a feel for how the community is using this feature.

Thank you in advance.

Ryan

Hi Ryan

I find I post snippets to the online community when I want to post some really simple code and a screenshot.

But I find myself in most cases uploading VIs either because its quicker (I have made the VI, and have to annotate a screenshot with arrows anyway etc...); or better (contains multiple VIs, nodes (e.g. references) don't get changed) than snippets.

Link to comment

Like the others, I use snippets mainly for posting examples to Lava... maybe a couple times a month at most. Depending on what exactly I'm doing I'll use snippets, take a screenshot and edit the png, or upload the vi directly. Most of my self-made png's could be snippets instead but I haven't gotten in the habit of using them. I've considered creating a folder for "reusable" snippets of boilerplate code but I haven't ever gotten around to it.

Link to comment

Hi Ryan,

I like snippets. I've played around with them (IE only in my tests, and you may need to turn off Protected Mode and restart IE) a fair bit, and they ARE fun. But they seem... underdeveloped.

For my use cases, they just need things that don't (and maybe can't) exist:

  • Cross browser support
  • Bundling the hierarchy into the image, rather than just the top level code
  • Keeping context linking (say, to property nodes)
  • Integrated thumbnailing would be awesome
  • A better way to match abstract images to larger code (like VI icons do)... okay, I can build this myself, but I'd take it if it showed up
  • Using the menu (rather than a right click) for creating snippets is slow

The thing that really killed my little palette experiment there, though, was a lack of browser integration into the LV IDE. Swapping out to drag something out of a browser window is just a pain, especially on a single screen. I'm not suggesting this is a great LV feature overall, but it definitely makes snippets hard to use.

I did use snippets at work to build a little library of templates to host on the central SharePoint (Not my choice of web servers...): the new users really liked being able to visually browse what was available. But, since it requires some libraries to already be in place on their computer, it really doesn't work as a package management system.

Joe Z.

Link to comment

Hello LabVIEW Community.

I'm gathering some research and would like to know the following:

1. Do you use LabVIEW Snippets?

2. How often do you create new snippets?

3. How do you organize your snippets?

Just general answers. I'm just getting a feel for how the community is using this feature.

Thank you in advance.

Ryan

Apart from saving snippets for use in the NI/LAVA forums I use them as a documenting tool on our internal WIKI on bugs, code constructs etc.

I think I create snippets on a daily basis, for this the NI tool is absolutely not adequate, hence I use the Code Capture Tool. This provide the followin advantages:

-Adding a configurable header to add some info on the VI and LabVIEW version

-Adding notes and description (arrows, rectangles) for high-lighting

-Saving them in a configurable location

-Keep property notes connected

-Include the front panel image as well.

-Copy the file path to the clipboard

-For computers directly connected to the internet it can save the image on Imgur

Ton (co-author of the Code Capture Tool)

Link to comment

These are fantastic responses. Thank you all for the information. The reason I ask is because I was creating a snippet the other day and thought it would be neat to have a site dedicated to organizing, storing and sharing snippets.

I created a quick prototype: VI Snippets

Any interest in such a tool? What if there was integration with LabVIEW to save and upload to a site like this?

It is based on gist.github.com ... a popular site for sharing "snippets" of text based code.

Thanks for the feedback. If there is enough interest then I'll keep developing it and see where it goes.

Disclaimer: This site is not currently affiliated with NI and not every feature works (like sharing, favoriting or public profiles).

Link to comment

I created a quick prototype: VI Snippets

Any interest in such a tool?

Yep. Something like that could be extremely useful.

What if there was integration with LabVIEW to save and upload to a site like this?

That would be very nice too. My only concern would be having the site flooded with not-very-good snippets, but I suppose if they are wiki-ish and the community gets involved the cream will rise to the top.

What would be even cooler than uploading snippets to the site would be some sort of snippet browser available from the IDE.

Link to comment

Am I suppose to be able to drag and drop from a browser to my diagram? Can't seem to do it. I'm using Chrome.

Chrome, Firefox and Safari treats images differently than IE. When you drag to the block diagram you will just get a URL where IE will let you drag the raw image data from the browser. This is not a limitation of the snippet that can be fixed (that I'm aware of) so the work around is to drag to the desktop then the block diagram. I have confirmed this behavior in chrome, safari and firefox running windows 7.

Thanks for the feedback.

Love vishots.com BTW.

Link to comment

What would be even cooler than uploading snippets to the site would be some sort of snippet browser available from the IDE.

[plug]

The code capture tool supports Imgur as an upload target.

[/plug]

Chrome, Firefox and Safari treats images differently than IE. When you drag to the block diagram you will just get a URL where IE will let you drag the raw image data from the browser. This is not a limitation of the snippet that can be fixed (that I'm aware of)

Neither is Opera working.

I think that NI puts someone on this issue it can be fixed rather fast. I assume that you need to look at some different drag and drop info.

I have submitted an idea at the NI LabVIEW Idea exchange on this subject.

Would it be possible to have simple POST methods for the VI snippets site?

Ton

Link to comment
I created a quick prototype: VI Snippets

Any interest in such a tool? What if there was integration with LabVIEW to save and upload to a site like this?

No. In fact, I think it's unintuative and will make the dissemination of code even more difficult in the community. From what I can tell, what you're trying to do is collect some reusable components/modules/architectures based on the fact that they're in snippet form - so limiting a code repository to only one very limited filetype in LabVIEW is, IMHO, a step backwards. As already mentioned, snippets are too basic for architectural reuse, but there's also already many other more appropriate places for this type of reuse that's more targeted (things that ship with LabVIEW, OpenG, ni.com, LAVA, etc - ppl can alreay post snippets. VIs, zips, vipcs, etc there, so why give them a new place where they can only post one tyep?). I'm trying not be negative, but I think that the addition of a new site would just mean that I need to search another place for something I'm looking for.

Link to comment

As already mentioned, snippets are too basic for architectural reuse, but there's also already many other more appropriate places for this type of reuse that's more targeted (things that ship with LabVIEW, OpenG, ni.com, LAVA, etc - ppl can alreay post snippets. VIs, zips, vipcs, etc there, so why give them a new place where they can only post one tyep?). I'm trying not be negative, but I think that the addition of a new site would just mean that I need to search another place for something I'm looking for.

This is the problem I am addressing. We share code on forums, FTP, email, dropbox, NI forums, dev zone ... etc. Between all of those places I now have lost my snippets of code that I consider useful. This tool would obviously not be for everyone as mentioned earlier where a couple Engineers just don't use snippets that much.

This is also a prototype ... it could be expanded to host different types of files all pertaining to LabVIEW. Snippets are easy to create, and it is very easy to display an image on a web site so it was a natural choice. And they are fast and easy to share. I have many more features that I would love to implement to make the site more useful and feel like a central place to organize and share snippets with others. You make many good points though.

Link to comment

there's also already many other more appropriate places for this type of reuse that's more targeted (things that ship with LabVIEW, OpenG, ni.com, LAVA, etc - ppl can alreay post snippets.

I agree we already have many places that contain reuse code. The problem with posting snippets to the forums is that they (the snippets) are disorganized and get buried on the back pages within a matter of weeks. Snippets themselves are too small to bother submitting them to the Tools Network or the Lava CR. Having some centralized location that allows categorization, tagging, comments, etc specifically for snippets would probably do quite well. Whether that location is a subset of Lava, part of NI's site, or a different site altogether doesn't really matter to me.

That said, I'd prefer the snippets stick to stuff like showing elegant, easy to read, or highly optimized algorithms to do certain tasks rather than getting into template-like code blocks. The Flatten Array and Peak SNR examples are examples of what I would hope to find there. The While Loop Starting Point... eh, not so much.

Link to comment

I think that the day will come when snippets can include subvis. Maybe someone will create a browser plugin that lets you navigate the code. I hereby promise in a public forum that I will buy a beer for the first guy who makes a browser plugin that lets me edit the code. Heck I will buy you a SIX PACK if you do that. :yes:

Link to comment

I think that the day will come when snippets can include subvis. Maybe someone will create a browser plugin that lets you navigate the code. I hereby promise in a public forum that I will buy a beer for the first guy who makes a browser plugin that lets me edit the code. Heck I will buy you a SIX PACK if you do that. :yes:

Well... Actually...

I think it's a good time to repeat my announcement: in order not to let this project die, I'm searching for someone who would like to dive into Flash programming. I kindly ask... I could even beg... Someone please learn ActionScript and help me!

Link to comment

I think that NI puts someone on this issue it can be fixed rather fast. I assume that you need to look at some different drag and drop info.

I have submitted an idea at the NI LabVIEW Idea exchange on this subject.

The problem is this: IE puts the path to the local cached image onto the clipboard, while all other browsers put the original URL onto the clipboard. So for IE LabVIEW can simply grab the image and decode it, as for all others it would first need to download it to its own local temp location. No biggy you might say and in theory this is right since LabVIEW contains all the necessary routines already in its C code to access HTTP (and likely FTP data) BUT there is the concern of additional delay to download the snippet and possibility that the connection might have gone/flaky/interrupted etc. which makes the dropping of a remotely located resources not such a desirable operation. Of course we are 3 years further and computers that are not constantly connected to the internet are almost an archaic reality from the past, right? :P

Nevertheless it's not so simply. And browsers frequently change the other formats they put on the clipboard. Firefox as good as it may be in many aspects, changes the clipboard formats quite frequently and occasionally breaks them in the process too.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.