Jump to content

ShaunR

Members
  • Posts

    4,850
  • Joined

  • Days Won

    292

Posts posted by ShaunR

  1. I'm actually looking for the opposite of run-time polymorphism. I'd like a way for static compile time info to somehow be propagated. Take for example how you can wire up a parent method of an OOP class in the middle of a child class wire, without the wire being coerced to a parent class (shown in the bottom of the screenshot). LabVIEW is smart enough with objects to be able to figure out when type information can be propagated through a VI call with objects at compile time, it would be wonderful if that could also apply to refnums...

    Is that more clear? I'll point out that this is more of an "I wish it existed" post than "Is there a way to do it?" post...

    I see what you mean.

    But your "Class" example isn't exactly analogous to the VI example (just being picky :P ).

    If you inspect your middle VI, you will see there is a coercion dot. So the equivalent class implementation would be

    As you can see. this also has the same issue. The class example is really analogous to creating a polymorphic VI

  2. Perhaps this is an easy question but I'm banging my head against a wall.

    Trying to monitor files on a bunch of production test computers that operators have access to. I have a computername, login name for a local admin, and password for each computer.

    Obviously if my IT department would configure any one account as the admin of all these computers I could access it that way, but they won't.

    The files are all in a common location on each computer, say \\computername\c$\etc

    Windows will cache the login/password of each computer if I go there first manually, and then it works. But that doesn't allow me to share the file monitoring tool with anyone else.

    Is there a way to specify for each directory path exactly what windows user I want it to connect as?

    Easiest way is to "map" a network drive and use different credentials. Then you wil end up with X:, Y:,Z: mapped to the different accounts either to the same remote dir or different ones.

  3. I'm not sure what your asking here. Type information? If you mean the controls class (e.g boolean, string etc) then it is propagated (if you inspect the class name you will see it).

    If you mean you cannot connect a parent class refnum to a child class refnum and have it automagically choose the appropriate refnum then no. Because "classic" Labview doesn't support run-time polymorphism. You have to go to OOP and use dynamic despatch (which wouldn't be much different from creating your polymorphic VI).

    The only way I know of that you could achieve a similar behaviour in classic LV is to make all your refnums variants and coerce to the specific class within each VI. But then you can connect anything to anything so it wouldn't flag up (for example) that you had connected a real control rather than a refnum until you ran it.

  4. There is the possibility for update requests to pile up pretty quick. If for example a user holds down the increment/decrement button on a numeric control, dozens of value change events can get generated in a second, each of which will require an update to the tree, which seems to take on the order of a half second. I also like the idea of tinkering during timeouts.

    I suppose the other way of doing things is have the tree update be entirely asynchronous. Just keep it notifier based, or something such that multiple requests don't pile up if they are generated faster than they can be consumed.

    As an aside, I still can't believe tree controls are this busted. Changing UI properties for non-displayed items should be near instantaneous. If NI won't implement it, I wish they'd expose more events such that we could apply updates more intelligently. And for the non-believers, if I disable all the tree operations in the screenshot I posted above and instead blindly operate on all elements in my variant/hashtable, my updates happen in mere microseconds, so it's not my interaction with the variant or my subVI that was choking things off.

    Once I get an initial code out there that works, I might tinker with dropping a custom .NET control into there or something that...works.

    Have you tried using the .NET TreeView control.? You have access to all TreeView functions and you can add callbacks (if you need them). You can even do things like embed other controls. Not that you need to, but it just demonstrates the huge feature set. It should be a lot faster for your purposes.

    I'm not a fan of .NET. But "The needs must as the Devil drives" :)

  5. Another method is you can overlay a boolean array (flat square classic buttons work best) where the booleans are transparent except for the true state border colour. Then you just use the number to boolean array primitive to set one or more booleans "True" for the value or values you want to highlight in the main array. This will create a border around the value. But if you move it behind your array and make your array transparent, you can also make the boolean array "True" state bg coloured and it will look like you changed the background.

    • Like 1
  6. tq..what is other type of files that can be used?? i need to simulate a rocket flight control sys.. and can u tell me how to upload the image plz..

    Well. I can only talk about Solidworks. But it wasn't an image. It was a VRML file and you wrote a VI that solidworks could interact with. As such, you created a Solidworks plug-in.

    If you just want to get the image on the front panel, you can just download a jpg or png and use the "Import Image To Clipboard" and paste it on the front panel. . You could overlay Labview controls like dial gauges etc which you could use to simulate the controls with programming. But I don't think you will be able to define everything in the 3D package and just "import" to get a working simulation.

  7. It's been over 10 years since I've done anything with databases and back then we were programming in VB6. At the time one advantage MSAccess had over other solutions was that it had a pretty easy ui that allowed users to query data. Do the other solutions offered have good data viewers available?

    I use "phpMyAdmin". But of course it needs to be part of a web-server.

  8. Actually. Reading a little more than a casual scan. They actually refer to bytes. So maybe we should be inputting "\1B\04\00\n\r"

    A NAK is \15 which you wont see unless the string indicator is also set to either \ codes or hex display and an error is "?"

    The other thing to check is that you are using a "crossover" rs232 cable (NI part number 182238-02) rather than a "straight through".

  9. +1 for MySQL if its going to be remote (MySQL is the No 1 solution for web-servers and its open source), You can also download Xampp which comes with MySQL and is a complete web-server so you can set up an industrial grade web-server in about 5 mins on your own PC.

    But the real expertise in databases (as Phillip points out) isn't what type you use (although I'd have to be held at gun-point to use MS Access :P ). It's how you design the "schema". I've used MySQL Workbench in the past and its pretty sweet (for MySQL).

  10. but also check whether "esc" is supposed to be a single Escape character (\1B in slash code display).

    Well spotted.

    It says in the manual:

    "The general protocol for Lightwave lasers consists of sending an ASCII “command string” with

    the following format:

    Escape lead-in char, command code, parameter, optional data, End of String."

    So this is correct. So try "\1B 0 40 \n\r

  11. Having received no replies to this one, I am wondering would that be because I am more of an LBVA than a LAVA? (B refering to a beginner). See I am struggling with something even simpler, but am too embarrased to post that question.

    Not at all. I think it just got missed.

    Is this the sort of thing your after?

    (the thing in the for loop is "Interleave 1D array")

    I'd post the VI but don't have LV 7,1

  12. I really appreciate the time your putting in on this. worshippy.gif Especially as you already have an implementation.

    I use sqlite_column_text (only different in how it handles zero length blobs), but the trick is to use MoveBlock.

    Wish I had come across that article sooner. I could have used the get_table and exec functions as well as the get_column_blob. If I get time at the end of this I might look into it further, but I don't think the possible improvements would be hugely different. I'd rather concentrate on other OSs and the feature-list for now.

    I don't need to escape strings since I have bound variables, I can also use \00 in string parameters. Bound Variables are also the proper way to avoid SQL Injection attacks.

    True. But I don't really see this API being used for internet or remote web-based applications (famous last words laugh.gif ). It would be far easier for people with malicious intent just to delete the file. That's not to say I haven't thought about it. It's something I will look more closely at once I have a more complete feature-list (vtables springs to mind ;) )

    Fortunately I qualify for a real "geek", not that I like C but I know it well enough. When I got home I got it cross compiling with LV64. Just involved putting pointer sized int in the right places. I'll try to get it to work on a mac at work on Monday (If I got it set right I shouldn't need to change anything).

    I also removed some restrictions from my interface, and removed the need for strlen when preparing strings (that required the use of DSNewPtr, MoveBlock and DSDisposePtr).

    The API comes shipped with an X64 dll. you didn't need to create one, just load the project.

    I've put in the cpability for different OSs. The issue I have is that I don't have Labview on Linux or Mac (well. don't even have a Mac :P ). But I have got VMWare versions of the OSs although never really used them much. The upshot is that I can't test on those platforms therefore only windows x64 and x32 are supported. I did however include the Linux x32 .so which has been reported as working. But I tend to be an all or nothing kind-a-guy. So if I say it works on Linux (for example) it bloody well better :P

    I'm using code:blocks with the MinGW x32 and x64compilers. They were easy to set up and worked pretty much out of the box. But as for setting up for Linux or Mac. I've no idea of the compiler/linker settings to cross compile. If I could get it set up for Mac, I could download the MAC trial from the NI website and test. But the Linux version seems like rocking-horse droppingsangry.gif

    Anyway with LV2010 64 bit on Win7 with string and doubles(the same as your initial speed test), but modified to including formatting time.

    Yours

    Insert 401

    Dump 72

    My Current Version

    Insert 277

    Dump 151

    I don't know why your insert got slower and dump faster from the Win XP LV2010f2 machine 32bit I tested on before (the 64bit computer should be faster CPU and IO wise).

    Something must have changed.

    The 350 / 90 I quoted earlier was on LV 2009 x64 on Win7. LV 2009 x32 (Win7 x32) is about 350 / 110. Moving to 2010x64 and in-lining it goes down to ~300 / 70. But who are we kidding Bloody fast either way laugh.gif. I'm just happy it isn't 4 seconds any more biggrin.gif I don't mind if its just shy of a gnats wisker! (goes down to 60ms with your earlier suggestion about the "step" ;) )

    I'm familiar with re-entrant vi's. From the testing I did, mine seems to handle concurrent access properly. I'm using SQLITE_OPEN_FULLMUTEX, which should reduce crashing from misusing the API. If you have an example that causes "database locked" errors I'll check if I'm handling it properly.

    Are you using "shared cache"? I open shared cache by default so that I can have multiple fast asynchronous readers. If your not, then you won't see it. But if you go through my API and set re-entrant willy-nilly you will run into it if you run multiple readers and writers asynchronously.

    You can use an In-Memory Database which should be faster than a SSD.

    With the above bench mark and an in-memory database I get

    Insert 219

    Dump 153

    So not a huge gain. But if I make every insert a transaction (and knock the test size down to 1000).

    Harddisk File

    Insert 71795

    Dump 15

    Memory

    Insert 24

    Dump 16

    So a SSD could make a large difference with a lot of transactions.

    Makes sense. This is particularly pertinent to embedded XP PCs, many of which come with SSD drives or SD cards.

    You can't use an in-memory DB with the standard high level API components, by the way, since they open and close the DB on each call (Well. You can, but there is no benefit). That's why I included the low level VIs so that if anyone wanted to use an in-memory DB they could roll their own.

  13. (and turn on inlining since I'm on LV2010 now).

    Be careful with this. For in-lining all the in-lined vis must be re-entrant. This can cause "database locked" errors when running concurrently even with shared cache. Choose which ones are in-lined very carefully. (You'll get about another 10 ms by doing this and LV2010 is about 10 ms faster than LV2009 too ;))

    As an aside. I'd love to see the result from using SQLite on an SD drive. I'm very impressed with SQLite and will be using it a lot in future.

  14. I compared your newer version with your test harness.

    If I don't modify the test for fairness

    Yours

    Insert 251

    Dump 112

    Mine

    Insert 401

    Dump 266

    If I include the string construction in your benchmark and the variant construction in mine.

    Yours

    Insert 299

    Dump 114

    Mine

    Insert 504

    Dump 257

    If I change my select to use the while loop autoindexing like yours (smacks forehead), and fix some execution settings I messed up (and turn on inlining since I'm on LV2010 now).

    I get

    Insert 352

    Dump 181

    Considering that mine is handling type information and using varaints, I doubt that I could get mine much closer to yours speed wise. With conversion from strings and to over formats I'd probably do better in some cases (since I can handle blob data directly for instance, and don't need to escape strings that contain ' ).

    Interesting. Did you get sqlite_column_blob working? You probably saw my note about it in the get column VI. Being able to call that function (instead of my work-around) would have saved a lot of effort).

    Strings are the ultimate variant IMHO. I'm not a fan of the variant data type which I consider a poor relation to strings for many reasons. But that's a personal opinion.

    You don't need to escape strings with ( ' ). That's a requirement for properly formatted SQL rather than an implementation requirement. The onus is on the user to enforce this rather than as a function of the API. It is was MySQL they would have to do the same.

    Some comments on the stuff I noticed poking around your code.

    In Fetch All you can put a step before the while loop, then put another step after the fetch. Then you wont have to shrink the Rows by one. Also, I'm not sure if this is true with subroutines, but "rows out" in "fetch record" being within a structure requires labview to cache that indicators value between runs. If you make the change to fetch all this won't matter.

    That' is the only place since the subroutines use for-loops instead of while loops. I'll have a play and maybe implement it for the next release. Good call thumbup1.gif

    Your multistatement querys can't include strings with ';'.

    I worked around that by calling strlen from the standard c library on the pzTail returned from prepare statement (while being careful to make sure the string was required in later labview code). Then subtracting that length from the original length and taking a string subset to be the remaining statements. The proper solution would be to use a helper dll and do the pointer math, to avoid transverseing the string in strlen. But since I use prepared statements it doesn't affect my version much.

    Hmm. I need to think about this one.

    And to be nit picky SQLite only has one L.

    It "mostly" has... rolleyes.gif

    As for my enviroment, my version currently only works on Win32 based systems. There's no reason I couldn't port it to other things though. I have a 64bit LabVIEW install at home. At work there's an old PXI 1002 box, but I've never used it (I haven't had a good excuse for playing with LabVIEW realtime).

    The dll is the killer. Cross-compiling is real "geeks" territory and I avoid C like the plague unless I'm dragged kicking and screaming like a 4 year-old. But then I have a compiler for the particular target and C programmers are plentiful wink.gif

    I cannot find a definitive list for the functions supported under RTWin. So the only option is to try it. and hope for the best.

  15. Not sure whether it should have spaces between the characters but CR and LF should be replaced with \n and \r. Try something like "esc040\n\r" (without quotes) if that doesn't work try the same with spaces. Make sure your string control in the left hand example is set to '\' Codes Display (right click menu). In the max example try the same. It's not SCPI compliant so it won't respond to an IDN? command.

  16. That sounds like you would charge more. Not as a penalty for foul-smelling code, but because you're being realistic in that you'd have to include the learning curve or the time to rewrite it.

    My take on the question was that Ben was asking was whether it would be ethical to charge above your standard rate to extend a particularly odoriferous project (after accounting for the things you mentioned) simply because the work involved is so distasteful?

    I think your being a bit pedantic. I too agree with your take. But I wouldn't charge a premium rate. It would be my standard rate. Software is software. Like I said. Its a contractor question. Contractors are valued by their time on a specific task. Employees are valued by contributions (not only time) on various goals.

×
×
  • Create New...

Important Information

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