Jump to content

Does anyone ever post codes that they are working on?


Recommended Posts

Hey guys,

 

So I was just wondering if forums like LAVA had any code review of an entire application and such.

I typically have code review done at work but I was wondering if there was a thread where people just shared their code.

 

I understand that sharing an entire code is typically not possible due to company policy and IP related matters but

I thought it might be nice if I can take a look at a code of somebody outside of my typical circle and see how they do things.

 

Link to comment

Honestly I don't see any problem with just making a normal post asking for advice.  Plenty of times someone will post a "This is how I did my CLD what do you think", or a "I'm new at LabVIEW how can I improve this" and as a collective we look over the code, post improvements and suggestions.

 

I don't think it has ever been attempted with large projects so I don't know how it would go down.  I think smaller programs work well because the effort from someone is small to open the code and say a few things.  But for a large application I wonder if you won't get much contribution, because the time needed to understand the intent of the code, and then post solutions/suggestions might be larger. 

Link to comment

JKSH,

 

I've checked out the sites you have mentioned, especially  LAVA code repository, but I couldn't find any actual application.

Would you happen to have a link to one?

 

hooovahh,

 

I guess I misused the word code review. Showing my code and getting advices from someone is definitely nice, but instead I was just wondering if people posted their code that I can take a look at.

Since I don't have a specific question regarding anything, I just wanted to see how other people design, organize, document and pretty much program in LabVIEW.

Example solutions and submissions of CLD and CLA exams are close to what I am looking for... however the amount of programming is incorporated into is limited so 

it lacks LabVIEW tricks and designs.

 

I hope I make sense  :)

Link to comment

(I haven't used any of them except h5labview, so I can't give you an assessment on their quality)

 

If you want a good resource on LabVIEW tricks and designs, I recommend The LabVIEW Style Book by Peter A. Blume. He walks you through sample projects, points out their strengths/weaknesses, and provides lots of useful guidelines.

Edited by JKSH
  • Like 1
Link to comment

but instead I was just wondering if people posted their code that I can take a look at.

AHH, yeah that would be beneficial.  During my early career I was fortunate enough to work with many talented developers and saw many design patterns and was able to have a 1-on-1 to ask questions about decisions that were made.  This really helped me shape the thought process I use when choosing design patterns.

 

Unfortunately the issue you are going to have is, no one is going to want to show you their secret sauce.  I mean lets say I did a program for John Deere and I'm really proud of how it works and think its great.  I can't simply share that with the world, I'd likely be taken to court.  I guess the only way you'll see a full application like this, is if the project was for my own company, and I had permission to share it.  Which I think is unlikely. 

 

CLD/CLA examples are probably a good idea but like you said they are 4 hours of work, sounds like you are interested in the weeks/months long projects to see how they work.  It probably goes without saying, but I wouldn't look for this type of thing from NI's examples.

Link to comment

JKSH,

 

Thanks for the links! I didn't know LabVIEW developers used Github and sourceforge too.

I took a look at the book you recommended. I do think there is lot that I can learn from architecture design.

But I wanted to get your opinion on how much difference the LabVIEW version that the author used would make.

The book was written around 2006 so  I am guessing that was like LabVIEW 8.2?

 

hooovahhh,

 

Yea, code review and outside exposure is definitely what I need. At my workplace, we have talented developers,

however the work style is more about solve immediate problems and worry about the rest later. So there's not much room for design and code reviews  :(

Link to comment

Yea, code review and outside exposure is definitely what I need. At my workplace, we have talented developers,

however the work style is more about solve immediate problems and worry about the rest later. So there's not much room for design and code reviews  :(

So sorry to hear that.  Having a culture of good software development in the workplace, is more beneficial than 10 "experts" who just throw stuff together until it works.  This is one reason why I feel LAVA is such a good resource because it helps encourage the good software development culture.  Having enthusiastic developers in the workplace helps, and it sounds like you could be a shining light for your co-workers.

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.

  • Similar Content

    • By McQuillan
      Hi Everyone,
      I (re)watched James Powell's talk at GDevCon#2 about Application Design Around SQLite. I really like this idea as I have an application with lots of data (from serial devices and software configuration) that's all needed in several areas of the application (and external applications) and his talk was a 'light-bulb' moment where I thought I could have a centralized SQLite database that all the modules could access to select / update data.
      He said the database could be the 'model' in the model-view-controller design pattern because the database is very fast. So you can collect data in one actor and publish it directly to the DB, and have another actor read the data directly from the DB, with a benefit of having another application being able to view the data.
      Link to James' talk: https://www.youtube.com/watch?v=i4_l-UuWtPY&t=1241s)
       
      I created a basic proof of concept which launches N-processes to generate-data (publish to database) and others to act as a UI (read data from database and update configuration settings in the DB (like set-point)). However after launching a couple of processes I ran into  'Database is locked (error 5) ', and I realized 2 things, SQLite databases aren't magically able to have n-concurrent readers/writers , and I'm not using them right...(I hope).
      I've created a schematic (attached) to show what I did in the PoC (that was getting 'Database is locked (error 5)' errors).
      I'm a solo-developer (and SQLite first-timer*) and would really appreciate it if someone could look over the schematic and give me guidance on how it should be done. There's a lot more to the actual application, but I think once I understand the limitations of the DB I'll be able to work with it.
      *I've done SQL training courses.
      In the actual application, the UI and business logic are on two completely separate branches (I only connected them to a single actor for the PoC) 
      Some general questions / thoughts I had:
      Is the SQLite based application design something worth perusing / is it a sensible design choice? Instead of creating lots of tables (when I launch the actors) should I instead make separate databases? - to reduce the number of requests per DB? (I shouldn't think so... but worth asking) When generating data, I'm using UPDATE to change a single row in a table (current value), I'm then reading that single row in other areas of code. (Then if logging is needed, I create a trigger to copy the data to a separate table) Would it be better if I INSERT data and have the other modules read the max RowId for the current value and periodically delete rows? The more clones I had, the slower the UI seemed to update (should have been 10 times/second, but reduced to updating every 3 seconds). I was under the impression that you can do thousands of transactions per second, so I think I'm querying the DB inefficiently. The two main reasons why I like the database approach are:
      External applications will need to 'tap-into' the data, if they could get to it via an SQL query - that would be ideal. Data-logging is a big part of the application. Any advice you can give would be much appreciated.
      Cheers,
      Tom
      (I'm using quite a few reuse libraries so I can't easily share the code, however, if it would be beneficial, I could re-work the PoC to just use 'Core-LabVIEW' and James Powell's SQLite API)

    • By Rolf Kalbermatter
      It's nothing to fancy. I added a few things to the UI to support more features and in preparation of adding the VI renamining/relinking step that was done seperately in the OpenG DEAB tool before calling the OpenG package builder. But I never got around to really add the deab part into the package builder. It's kind of extra difficult as the DEAB compononent doesn't currently support newer features like lvclass and lvlib at all and of course no mallable VIs etc.
      I can post what I have somewhere, but don't get to excited.
    • By John Lokanis
      One of the main topics of the 2018 CLA Summit was the need to improve access to open source code in the LabVIEW community.  This is something that I have tried to do in the past with limited success.  After hearing what others are doing and discussing the issues, I am inspired to take on the task of getting as much of my code that is shareable out into the open for others to use, improve, learn from and critique.  So, the point of this thread is to figure out how best to do that.
      I have tried posting code to forums in the past.  I have even posted to the code repository here on LAVA.  I have used code posted here and via the tools network and VIPM in my own projects.  But I am not sure if any of those avenues are the right path forward for me.  There was much discussion about different open source repositories on the interwebs that we could leverage.  There was also some discussion about how to help others discover the code you shared.  What I did not hear was any definitive conclusions on how best to do this.
      So, the point of this thread is to try to solicit feedback on code sharing and come to some sort of consensus on the best options out there.  If you have an opinion on this please join the conversation and share what you think is the best solution.   Here are some questions I am trying to answer:
      1. Where should we share code?  What system works best for LabVIEW code and is user friendly enough to not discourage people from using it?  Please share links and how-to documents for your preferred site/system.
      2. How should we license code?  I heard some discussion about the various type of licenses.  I am not interested in retaining any rights to code I share and do not want to put any burdens on those who want to use and learn from any code I share.  What licence is accepted in the open source community that supports this kind of sharing?
      3. Once we post, how do we make our code discoverable?  Do we need to post links all over the place or is there a better way?  Here is one attempt at making that better you should check out if you have not already: 
       
      I am not just interested in putting the code out there, but also trying to explain why I think it is worth your time to take a look.  I am willing to post on forums, create a blog, even produce some vlogs on YouTube if it is the best option.   Please let me know what format would motivate you to take the time to learn about the open source code out there.
      Either way, thanks for taking the time to read this thread and contribute what you can, even if it is just to follow the discussion and learn from others like I am trying to do.
      -John
    • By Max Joseph
      Hi all,
      I have a question about high level system design with FPGA-RT-PC. It would be great if I can get some advice about ideal approaches to move data between the 3 components in an efficient manner. There are several steps; DMA FIFO from FPGA to RT, processing the data stream in the RT to derive chunks of useful information, parsing these chunks into complete sets on the RT and sending these sets up to the Host.
      In my system, I have the FPGA monitoring a channel of a digitiser and deriving several data streams from events that occur (wave, filtered data, parameters etc). When an event occurs the data streams are sent to the RT through a DMA FIFO in U64 chunks. Importantly, events can be variable length.  To overcome this, I reunite the data by inserting unique identifiers and special characters (sets of 0's) into the data streams which I later search for on the RT.
      Because the FPGA is so fast, I might fill the DMA FIFO buffer rapidly, so I want to poll the FIFO frequently and deterministically. I use a timed loop on the RT to poll the FIFO and dump the data as U64's straight into a FIFO on the RT. The RT FIFO is much larger than the DMA FIFO, so I don't need to poll it as regularly before it fills.
      The RT FIFO is polled and parsed by parallel loop on the RT that empties the RT FIFO and dumps into a variable sized array. The parsing of the array then happens by looking for special characters element wise. A list of special character indices is then passed to a loop which chops out the relevant chunk and, using the UID therein, writes them to a TDMS file.
      Another parallel loop then looks at the TDMS group names and when an event has an item relating to each of the data streams (i.e. all the data for the event has been received), a cluster is made for the event and it is sent to the host over a network stream. This UID is then marked as completed.
      The aim of the system is to be fast enough that I do not fill any data buffers. This means I need to carefully avoid bottle necks. But I worry that the parsing step, with a dynamically assigned memory operation on a potentially large memory object, an element wise search and delete operation (another dynamic memory operation) may become slow. But I can't think of a better way to arrange my system or handle the data. Does anyone have any ideas?
      PS I would really like to send the data streams to the RT in a unified manner straight from the RT, by creating a custom data typed DMA FIFO. But this is not possible for DMA FIFOs, even though it is for target-scoped FIFOs!
      Many thanks,
      Max
    • By Zyl
      Hi everybody,
      Currently working on VeriStand custom devices, I'm facing a 'huge' problem when debugging the code I make for the Linux RT Target. The console is not availbale on such targets, and I do not want to fall back to the serial port and Hyperterminal-like programs (damn we are in the 21st century !! )...
      Several years ago (2014 if I remember well) I posted an request on the Idea Exchange forum on NI's website to get back the console on Linux targets. NI agreed with the idea and it is 'in development' since then. Seems to be so hard to do that it takes years to have this simple feature back to life.
      On my side I developped a web-based console : HTML page displaying strings received through a WebSocket link. Pretty easy and fast, but the integration effort (start server, close server, handle push requests, ...)must be done for each single code I create for such targets.
      Do you have any good tricks to debug your code running on a Linux target ?
×
×
  • Create New...

Important Information

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