-
Posts
4,940 -
Joined
-
Days Won
308
Content Type
Profiles
Forums
Downloads
Gallery
Posts posted by ShaunR
-
-
It was fun being a Mod while it lasted...
Showing your age now Cat
Even I don't remember being a Mod
-
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".
-
+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
). It's how you design the "schema". I've used MySQL Workbench in the past and its pretty sweet (for MySQL).
-
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
-
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
-
I really appreciate the time your putting in on this.
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
). 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
). 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
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 droppings
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
. I'm just happy it isn't 4 seconds any more
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.
-
HI all,
i want to read open office.org Calc .ods format file in labview
here i have attached the file please help me out.
thanks
This by maybe of use. I've never used it but would be worth a try.
-
(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.
-
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
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...
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
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.
-
Your anal-ogy fails in that you should be able to recognise when others' code is far sweeter smelling than your own
Your anal-ysis would be true if I had seen any
-
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.
-
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.
-
....debugging and readability much more straightforward.
This is regex we're talking about
-
1
-
-
When in the Navy I used to play chess with a guy who ws rated. After some time he said to me "Ben I have to stop playing chess with you, I am getting dumber."
In the same way that we gather together (virtually) to learn from those better than us gather only with those behind us can retard us.
I have seen developers pick-up bad habits after spending time maintaning bad code developed by others. I have also known one developer that had trouble re-certifying since it was soooo long since he worked on good code. SO the idea hit me that this situation should warrent "battle pay".
So the question I lay before you is;
Is it ethical to charge a premium to work on bad code?
Note:
I don't control such things where I work so it will never happen here but I am still interested in hearing how other react to such an idea.
Thank you,
Ben
PS If I rented mules for a living and one customer always brought them back beaten, I'd would be concidering the same.
I'm reminded of the saying...
Software is like a fart. Yours is OK. But everyone else's stinks.
Charge more because it stinks so badly I can taste it? That's a contractor question but my view would be the same. I wouldn't charge more.
If I think software is too bad, I would decline the contract because you can't sit there and whine after you've taken responsibility for it. You've been contracted to do software!
If I really must work with it. then I'll re-code it. I'd just escalate the time-scale to account for the "learning curve" and "recoding". Then they can either accept or decline.
-
2
-
-
Hello folks,
sorry if I'm a hassle, I'm a newbie here!
Trying to control a Tek TDS3054B thats networked to the computer, running LV2009. I would like to control the time base and the input voltage of the scope for measurements, the usual signal is a 10us pulse on a 50hz frequency, 5v logic. MAX is all set up (I think!) and I've the drivers in the Instrument I/O OK. looking for best way to read data for test and measurement purposes, any hints would be much appreciated.
Peter.
-
Hi Lavas,
i have a cube in 3D picture control with some points on it. I want to connect the points through lines, right now i am using "Scene Mesh" . The problem rise when i want to connect two points on two different faces. LabView connects them from inside, i don't want to transparent my cube instead i like to calculate the path by myself. I know about the mathematic of calculating the path, but i dont have any idea how i can apply it. Any idea or any similar example?
Thanks
I you know the maths then use a formula node. There is an example of using the formula node shipped with Labiew.
-
Thanks a lot for your VI. I allready programmed something else:
I'm opening the Queue in the loop, preview an element and then close it again with force destroy=false.
Didn't have yet the possibility to test the code. What happens if I close a Queue reference with force destry=false? Doesn't it mean that at least one reference remains open somewhere? A final destruction is done with force destry=true ??
If it is false only the reference you wire to it will be closed. If it is the last reference, the queue is also destroyed regardless if you set it to true or false.What can happen is that you get "intermittent" failures if you don't get the close exactly right. Since one part of your code may close the last ref just before another part tries to dequeue/enqueue etc.. Then a loop that obtains a reference comes around again an re-creates it but you cannot track down where the error is coming from.
-
1
-
-
Select is slow because you're building the array one element at at a time, you should grow it exponentially and resize it back down.
I wrote my own SQLite wrapper a while ago, I've been debating posting it after I finish up the documentation. Its interface is more difficult than yours,since it assumes knowledge of SQLite. But is built for speed and storing any kind of LabVIEW value object. Anyway for comparison, using the 10,000 insert code you posted, on my computer with LV2010.
Yours
Insert 1202ms
select 6657ms
Mine
Insert 451 ms
Select 251 ms
Funny you should say that. Downland 1.1 I've just posted above.
Using the benchmark (supplied in the update)
Insert ~350ms
Select ~90ms
The initial release was really for me to get acquainted with SQLite map out the feature list. I'm thinking I maybe able to shave off a few more ms in the next release. Its a shame the"convenience" functions are unavailable to us
My select uses the same basic logic as yours (at least for values stored as strings). The main difference is that I prealloc 16 rows (note: it doesn't have to be 16 that just seemed like a good starting number to me), use replace subset to fill the values in and if I need more space I double the array's size (I just concat it to itself), at the end I reshape the array back down. Changing the allocation should make yours faster than mine (since you aren't dealing with type information).
My insert is faster because I'm using prepared statements and value binding. I'm also only opening the file once, which probably accounts for some of the difference.
Matt W
Indeed. That's the next feature that I will be implementing and I was also thinking that would improve the insert speed.
Good feedback. Not having other (working) implementations to compare against, I really need this kind of input.
What are you running Win x64? LVx64? I don' t suppose you happen to have am RT Pharlap target?
-
I just thought people might like a link to be able to find the info easily :-(
Awwww. Don't feel bad. I found the info really easily
-
Yair is correct that you don't need the SetWindowPos call unless you want Topmost. Removing the SetWindowPos call does not affect focus in this use case. I've attached a VI that will cancel Topmost and another that will set Top instead of Topmost. hWndInsertAfter = -2 sets "NoTopmost" (above all non-topmost windows).
You can also use "BringWindowToTop" which will not set it as a top level window but will bring it to the top of the Z-Order.
-
std - Diagram disable structure
Very disabling
-
At the moment I'm "offline" / have no possibility to access the cRIO to try your suggestions. Nevertheless I thank you very much!
In the meantime I found exactly what I was searching for: an official NI statement about memory leakage with Queues. When I'm online again I'll try to fix that leakage like described below and the I'll let you know if it works.
http://zone.ni.com/r...g/create_queue/
Obtain Queue Details
Use named queues to pass data between two sections of a block diagram or between two VIs in the same application instance. If you do not wire name, the function creates a new, unnamed queue reference. If you wire name, the function searches for an existing queue with the same name and returns a new reference to the existing queue. If a queue with the same name does not already exist and create if not found? is TRUE, the function creates a new, named queue reference.
If you use the Obtain Queue function to return a reference to a named queue inside a loop, LabVIEW creates a new reference to the named queue each time the loop iterates. If you use Obtain Queue in a tight loop, LabVIEW slowly increases how much memory it uses because each new reference uses an additional four bytes. These bytes are released automatically when the VI stops running. However, in a long-running application it may appear as if LabVIEW is leaking memory since the memory usage keeps increasing. To prevent this unintended memory allocation, use the Release Queue function in the loop to release the queue reference for each iteration.
This function might return error codes 1, 2, 1094, 1100, 1491, or 1548.
I've been bitten by this before too.Now I use this vi. It ensures there is only ever 1 reference to a queue, you don't need thousands of wires all over your diagram and you can easily access queues from other VIs.
-
2
-
-
There will always be bugs that carry over from one version to the next.
I hope that not the case with my cars ECU
That does not mean that none of the bugs are being fixed.
Indeed.
For all bugs to be fixed all development would have to come to a halt and about six versions of BETAs would have to be run. As long as the show-stoppers get fixed and progress is made on the rest, I'm happy.
Ben
I don't know here to start with this statement.
Thank you!
The LV Champion fought long and hard to get the bugs into the public forum and tracked and I was just starting to believe that old rumour of bugs not getting fixed had been squashed.
Take care,
Ben
Of the 161 known issues in LV2010, 125 are from previous versions (~78% if I've counted correctly). Rumour?
Should I run for cover now?
-
Gosh are you saying Bug never get fix
They're not bugs. they're "unpublished features"
how to upload image into labview
in User Interface
Posted · Edited by ShaunR
I've only ever seen this done with Solidworks. I did play with it once many moons ago. It wasn't easy and didn't work very well since it required the CAD designers to define all the dynamics (which they didn't normally do). I don't know if you could do something with Sketchup.
But here's a good place to start..
http://zone.ni.com/devzone/cda/tut/p/id/10592#toc3