Jump to content

Lipko

Members
  • Posts

    56
  • Joined

  • Last visited

Everything posted by Lipko

  1. Never mind, maybe I used File/directory info.vi.
  2. I looked at the code and one question (with low relevancy to the thread): Isn't get file size slow? I remember it being almost as slow as to read the whole file. Or did I do something wrong? Would listening to End Of File error be a better option or it has some caveats?
  3. I honestly don't understand how it can work at all, I didn't test your code (for some reason drag-dropping the snippet doesn't work for me). Your signal arrays doesn't match: Y is the original signal while X is the common concatenated and sorted time, so it can even be 0,0,0,0,1,1,1,1,2,2,2,2 and so on. And you fed this to the interpolator, no wonder it might behave strangely depending on the test data. But even if it doesn't look strange, your code will produce wrong results. Did you try my code? It's not a big change to implement.
  4. Forget my previous reply, I was in a rush. The loop where you use the interpolation is wrong, because of different array lengths. Y and X should be of same size for Interpolate 1D.vi. The time channels for each device should be fed to the Interpolate 1D.vi, not the concatenated time channel. You shouldn't build a 2D array from your raw signals anyway (what happens if your different devices are not in sync and array lengths differ?), you should compose it as an array of clusters, and each cluster should be of the time array and the signal array. It will be easier to work with that and easier to put them on graph. I can't comment on your common time channel generator code, I guess you tested it and is okay. Since the time is "commonized" and everything will have the same length, the interpolated signals can be put in a 2D array.
  5. How about usig Threshold 1D array instead? Timestamp-by-timestamp linear interpolation.
  6. Never mind. I've just tried the Decode Image Stream thing, and it doesn1t halt the main GUI, it runs like a charm. But seems to be slower than the native read JPG. I guess that's the prize of a responsive GUI. Thanks again!
  7. A related thing: I noticed that the "read JPEG file.vi" (the native one) runs in GUI thread. Is it an expected behaviour, is it the same with any file loading in Windows or am i doing something wrong? I narrowed down this GUI thread problem to "read JPEG.vi" (I replaced it with a simple 5 second wait). It is clear that the read causes the loop run in the GUI thread: with jpg read the main GUI freezes at every jpg load, with dummy wait, the main GUI is responsive without any hiccups. The read jpg is burred in subVIs, so it's not that the prioritry or preferred execution system are set up wrong for the subVIs.
  8. Thank you, that's exactly what I was looking for. I'll come back when I'll have time to implement this. If someone is into spagetti.
  9. Hi all! I have an picture organizer application where there is a picture list, pictures can be selected and there is a full resolution preview indicator for the selected picture. Since image sizes are quite large, the picture is loaded from the image file for the full resolution preview generation (the pictures and the indicator are too large to pre-cache). Simply loading the picture in the GUI input thread slows the GUI down significantly. For this reason, I would place the file loading in a background thread, but I can't find a way to cancel image loading (the user clicked on another picture before the file read is finished), or a workaround this problem. The best I came up yet is to have a parallel while loop with the input event loop, and load the image if the requested image path is not equal to the image path that's currently loading. I'd poll the paths for that but mixing polling with events give me mixed feelings. At worst case, this method would roughly double the preview generation time if the user clicks around quickly (the first clicked image is fully loading, but another picture should be loaded so that will be loaded AFTER the first finished). This is much better than I have now (the user quicly clicks on pictures then has to sit out the preview "slideshow"). Maybe having two parallel loops would solve the double load time issue, but I have a feeling that this direction is very very fishy (starting a flie read in a parallel thread while a file reading is still happening. Maybe it would slow both image loading times). Having a way to stop image loading would be the best, I don't know if there's a method or 3rd party library for that. I can imagine the image (jpg for example) could be loaded as raw data in chunks, but how to generate the jpg from that raw data? I'm not even sure jpg file reading is simple as that. Thanks for any hints in advance!
  10. They got a medal for every single bullet they fired? Anyhoos, I miss the "outsider" or "I only use local variables" rank.
  11. Sorry for the stupid choosing of words. I meant just normal for loops. With "post-process" I wanted to emphasize that I would decouple this empty-cell-filling logic from the logic that produces the table. Because you seem to have solved the much harder part of the full algorithm. It would be much harder to fix your existing code that generates the result table than to have another separate section that works on the already produced table. sigh... It's easier to write and post the code than to describe it. Place this one where you have your disabled structure now. In general, I prefer to have a sequence of loops that do one or a few tasks on the data at once than to have one complicated God loop that does everything. The performace loss of more loops is usually not that significant, unless you have huge data (an image for example). Even in that case the performance loss can be accepted for certain uses in favour of code maintainability.
  12. It's not clear for me what you are after. You simply want to fill the emply cells of the report table for presenting the data (second table in your post)? Or you want the data also be inserted automatically into the database you are referring to in your first paragraph? If the first, then fill the cells in a post-process loop (where you have the disabled structure), I think that would be simpler than handling this in the table generator code (the for loop in the middle). Go through the table row-by-row. Go through the cells in the row. Check if the cell is emplty. If it's emply, fill it with the previous cell value (that you store as a shift register and initialised as "0%").
  13. I implemented undo several times in my applications, mainly because I usually do editors. I did it many ways, usually I check if the data/state changes (after the event structure) and push the data on a FIFO. For most of the time, simply putting all raw data was sufficient. Once (in C win32, not in Labview) I had too much data, so I had to use "command pattern", which means only commands with relevant parameters were pushed on the undo stack and the initial raw data was saved with the undo "object". It had limited depth (depending on available memory), so the initial datas had to be updated if memory would run out. So the oldest command was performed on the initial data. Of course in some cases the "parameters" of the commands were bigger data (like paste from clipboard), but it worked pretty well. One caveat: it was quite slow to undo, since all the commands in the command stack had to be sequentially applied on the initial data. If all commands are reverseable without computing errors (which pretty much rules out math operations and delete and such), the stack could re reversely traversed so no slowdown. Back to labview: I can't really exmplain after all these years what's happening, so I'll just post the code of "the most sophisticated" undo I did. It pushes the complete state to the undo stack, because the data was small (sequence editor). The word "manager" in the name is a bad sign, but here it goes. Note1: it's implememted in a way that selection changes are not added to the stack, only the last one, or I don't really remember. So you can just ignore the "overwrite" case. Note2: it's an old code from my newbie times. It fails the single responsibility principle badly, I think both "undo stack" and "stack index" should be action enginified, the outputs besides "output data" is only for optimizing recalculation of data so simply ignore them. EDIT: I've found a later implementation, so changed the vi. The data change check is outside the vi. pic_man_undo_manager.vi
  14. In my opinion, subVi-ing is only a small thing. There are so many ways something can be solved, and in a long term project that was started as a newbie it can mean a huge mess if you start mixing these ways. SubVI-ing only makes it prettier but the underlying architecture is still going to be a huge mess. These messy mid-sized projects are very hard to refractor, because it's simply very hard to test throughoutly if you didn't document testing all the way through the project, which you probably haven't if you made such a mess in the first place. Most of my late cleaning-ups ended up in a buggy software. Sure, those few bugs could be fixed easily but these occured not during testing but during usage. But I'm no pro, maybe I'm totally wrong. I know that my software testing knowledge is very weak.
  15. Yes, I forgot to add this notion to the post. Not a biggie though, it means that's it's not so practical to subVI this function. My other concern about such a solution that I'm not sure it works on older platforms if the dummy is off-screen. That's why I placed the dummy on screen and toggled its visibility, but it's not needed nowadays. But I didn't care to test...
  16. Okay, I did it with the dummy picture method and I found a borderless picture control here:
  17. Hi all! My brain and google skills stopped working and I can't believe there's no simple solution to this. I have image data (not a displayed image) and I want to copy it to the clipboard. All solutions I found was using getimage or exportimage, which means a dummy indicator and also a small border around the picture (I would use it if I could get rid of that border). Is there a more sophisticated/simpler method to copy the actual image data/picture? I'm on Windows so it can be platform dependent. Wrapping Clipboard.SetImage would be a solution but maybe some of you have a code sitting around. Thanks in advance.
  18. I usually """solve""" this kind of thing with placing a full-window transparent control over everything and showing it on mouse down and hiding on mouse up event. Fails miserably with multi-pane front panels and have to be extra careful for z-order. Quick n dirty, the way I do LV.
  19. Hmm. I would have answers for (almost) all questions I see in these interview question threads (many "dunno but I'd approach the question like this and that" answers), I even know hooovahh is not really Homer Simpson, but I don't feel any competent for a real Labview job. I can solve problems, made many mid-sized applications (control+daq, data analizers, report generators) that are team uses on a daily basis, I struggled with many architectures, fixed errors in 3rd party APIs, I know error handling is not simply connecting serially every crap with an error terminal to make a huge yellow snake (a thing that I see even in APIs of serious equipment from respected companies). Sounds promising. Yet my code and especially the architectures get so f... spagetti after a while, you'd get brain aneurysm just by looking at. These questions are only good for first stage screening. If I were hiring, I would definitely go for a test Labview project in some way.
  20. As long as there will be any kind of support and it will run on my machine and executables will be buildable with it and runtime engines will run properly, it will be my primary application/tool builder environment. The ability to qickly throw together GUI intensive (and not so intensive) specialized applications is still unmatched for me (though I admit I haven't looked into recent tools). The intuitive parallellism is also good, but to be honest there were only a few occasions where I did actually need it (control with DAQ). Okay, my career is not based on Labview at all.
  21. Thank you! I don't have experience with python and I'm stuck at point 3. I have Anaconda, I run the windows command prompt and started python (I see the >>>), I navigated to the plylabview folder (os.chdir), I think I have pillow (typed pip3 install to anaconda promt and it said something about I arelady have it), but no matter how I try to type in .\readRSRC.py -x -i ./2, I get inalid systax errors. Tried .\readRSRC.py -x -i ./2 in the anaconda promt too.
  22. Hi, How can you do this (LV 2015)? I have lost some VIs I haven't touched for years so I don't really need their block diagrams. Thanks in advance!
  23. Is it still an issue or have you solved it? It's not entirely clear that the error is random, or occurs "reliably" after the 3x45 hours. How is your time sampled? Is it possible that the hardware clock and software clock not being perfectly synchonized causes the problem? Is there any middle data processing bewteen DAQ and voltage checking? The 0.0000 is in the middle of a DAQ read chuck or at the begining/end? Or maybe a whole chunk, so for some reason the buffer is not ready when you read it? Sorry, I'm no expert in NI DAQ, for little quircks like this (and it seams to have a "soul") we are not using NI for DAQ...
  24. If you are a student, I'm pretty sure there are boring tasks that can be automated. Something that's special so you are not likely to find existing tools. But since you are a student, simply reinventing something, cloning a board game you like (I make minesweeper in pretty much any programming languages I work with), remaking msPaint is not a "stupid" decision as it would be as a pro. For example for work, I did a picture manager program. Pictures can drag+drop sorted, comments can be assigned, picture entries can be colored (for marking purposes), images can be cropped with arbitrary angled rectangles. And all pictures can be inserted into a Word document using the report generation toolkit and some VB scripting. This is just a small tool but it can be extended infinitely and has lot of areas that you can practice. And doesn't need any hardware (measurement or controller devices). Just a computer. EDIT: in general, Labview is a pretty productive language for GUI heavy applications. Graphs are very typical Labview things and they can be customized beyond a mere measurement plotting widget. So for a student project I would prefer something that involves graphs in some ways, usual or unusual ways (like some task scheduler or fancy calendar-thing, just throwing ideas). Another idea is making some cellular automata, like Conway's game of life. You could and controls to it, maybe even drawing the initial filled cells (you have to solve the rendering of the field: table?/graph?/picture? and you have to handle mouse clicks) and add some additional graphs that plot some interesting data vs. time diagrams. Like the percentage of alive cells, or whatever. Maybe you could also make some overlay heat map on the field to see if there are places that alive cells are more common. You could add a menu to switch between different automatas. Maybe adding an option of hexagonal field. Man, now I want to make it 😣
  25. I just couldn't resist. Not optimized in any way, but I guess for data that has to be visualized, this is not a problem.
×
×
  • Create New...

Important Information

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