|
musefan,
Yes, someone will read that data. I had originally created a program to randomize a list. I wanted a verify that I had selected each entry in the original list once and once only. A sort would re-order the randomized list then a simple file compare (fc.exe) of the original file and the sorted file could verify the correctness of the randomization.
Sort.exe was very slow (compared to the randomizing), so I went down that rabbit hole to develop a faster sort, and got lost in a maze of twisty little tunnels..... (what an Adventure!)
Another method would have been to bitmap the randomized records and see that they did not overlap, but this would work only for numeric strings, and the randomize program worked with any string data. To bitmap that would require a string sort anyway to equate a string with an entry number.
Dave.
|
|
|
|
|
Member 4194593 wrote: Which way is best (overall) for merging, and why?
What Luc said, because he's right. You were competing with Sort.exe , which isn't intended to work with large files.
Now, a database doesn't have any problems with sorting, because they needn't load the entire data into memory. If you can manipulate the data, then you can add a "key" to each item that needs be sorted. Next, you could build an index.
Fetch item from disk by key, compare, update index. Building an index on a database can be a relative time-consuming process, but I imagine that it's faster than forcing Windows' to swap a lot of Virtual Memory, pushing all other processes to the background.
You could also partition your blocks; have the process that "generates" the first block only filter out the lines that start with an "A", the second with a "B".
I are Troll
|
|
|
|
|
Eddy,
Ok. You suggest use a database. What database do you suggest? If I had this database, would I need to program it or configure it in some way? Is it as easy to use as executing sort.exe? Don't get me wrong, I've been programming since '65, I am familiar with databases and their overhead. I still do not believe that any database solution would be as fast, as cheap, or easy to use as something like sort.exe.
My offer to you is the same as to Stefan63 above. Send me an email so I can reply with a zip of an executable (of you prefer, the source and a makefile to create the executable). This executable will create the 5 large files (6 GB each) that I was testing with. Write your own sort to sort these files and sort the same files with sort.exe and compare the percentage faster your sort is than sort.exe for each file, and for the overall total testing (comparing this way evens the playing field for CPU, memory, and disk speed differences between your system and mine).
Dave.
|
|
|
|
|
Member 4194593 wrote: You suggest use a database.
No, my suggestion would involve Hadoop and a lot of PS2's
Member 4194593 wrote: What database do you suggest?
Sql Server if you can afford it, although it would be an expensive solution just for sorting. Sql Express would do too, I guess. You can only pack 4 Gb in a database in the free version, but there's no problem in adding several databases to the server.
Member 4194593 wrote: If I had this database, would I need to program it or configure it in some way?
Ideally, it'd use a bulk-import. You could also have it generate the index, but it'd be more fun to build such a thing by hand. The advantage would be that you can easily partition your data, even over multiple computers.
Member 4194593 wrote: Is it as easy to use as executing sort.exe?
From the users' point of view, this would be easier as their data simply already appears to be sorted by applying the index.
Member 4194593 wrote: Don't get me wrong, I've been programming since '65, I am familiar with databases and their overhead. I still do not believe that any database solution would be as fast, as cheap, or easy to use as something like sort.exe.
There's free databases that are scalable and well-documented. Yes, I get your point - but most people won't have a dataset that's this large, so the use-case shouldn't be built around your average user
Member 4194593 wrote: Write your own sort to sort these files and sort the same files with sort.exe and compare the percentage faster your sort is than sort.exe for each file, and for the overall total testing (comparing this way evens the playing field for CPU, memory, and disk speed differences between your system and mine).
My gratitude for the challenge, but I don't have the time nor the hardware. Have you considered writing a CodeProject article on the subject?
I are Troll
|
|
|
|
|
Eddy,
Thank you for the detailed reply. I think I'll stick to what I know. About writing an article - I never considered it. No one here on the CodeProject would like my code or what I was trying to do or the way I was doing it, they wouldn't like it on so many different levels that I wouldn't even try to enumerate.
Dave.
|
|
|
|
|
Member 4194593 wrote: No one here on the CodeProject would like my code
That's part of the job; when someone comes along and sings "try this", then we'll cut it up and look at it from all sides to see whether or not it's better than our old habits. Now, I might not like the use-case, but that doesn't mean that it's not interesting topic to a lot of people (otherwise you'd have 0 replies)
..and sometimes, it's more interesting how you got a result - keep in mind that most people have problems with pointers
I are Troll
|
|
|
|
|
Eddy,
1) My program is a console app.
2) It is totally MASM (except API calls for I/O).
3) It honors the Intel ABI, but in addition it saves and restores all registers around calls and saves flags around all API calls.
4) It uses mainly register calling sequences, not calling arguments (I think that is correct - from my ancient Fortran AutoCoder, "Parameters" are what you expect, "Argument" are what you get).
5) It returns no values, only zero or non-zero flags - any returned values are saved in fixed locations.
6) It uses no call stack frame - ebp is used as a general purpose register.
7) It has tons of commentary to explain What I did so I can pick up the program 20 years from now and understand Why I did what I did.
8) It uses many levels of conditional assembly to do validations and/or timing displays, not checking option flags and branching around unused code - the unused code is not even assembled.
9) There are conditional code segments in the RedBlackTree implementation to validate correctness and to display the tree structure (a short 31 element tree build).
10) The conditional code snipits save and restore any used registers to prevent any side effects.
11) It does not use anonymous symbols, instead, it uses lots of meaningful long labels everywhere, including places where a label is not needed but separates code groups.
12) Need I say more.
Nobody will like it here.
Dave.
|
|
|
|
|
The graph must be sparsed.
|
|
|
|
|
A sparse graph is useful for representing a matrix when you know most of the elements are going to be zero. It only represents the non-zero elements and their positions, which saves a lot of memory. Processing is faster too.
|
|
|
|
|
Using a sparse vs. dense representation is a decision driven mostly by the requirements of your algorithms and your memory constraints. Certain graphs lend themselves better to sparse representations, because they are sparse in nature. For example, the density of a graph of street segments, where intersections represent vertexes, and street segments between them represent edges, is very close to zero even for a city of a modest size.
The only time I needed a sparse graph representation in production was when I modeled a sparse multilevel whole-part relationship that contained a significant number of individual parts, and a relatively small number of groups.
|
|
|
|
|
Hi Everyone,
I am building a robotic turret with an airsoft gun monted on a set of tank tracks, i have found some code for tracking movement on a video feed from a static camera, the problem is everytime the turret moves to aquire the target the camera moves with the gun screwing up the tracking, what i am looking for is some kind of algorithm that allows for the video feed to track and center the target while sending the commands to the turret to pan and tilt (aiming), the camera is mounted on the barrel for aiming and the gun is mounted on a 2 axis servo system, i dont know what i would call an algorithm like this to look for one.
Any help would be greatly appricated.
Thanks
Andrew
|
|
|
|
|
So you want our help writing an application to shoot people? You're sick.
|
|
|
|
|
I would say sick if I was going to strap an ACTUAL gun to the rig, airsoft is a game.
|
|
|
|
|
Calculate the centroid of the target outline relative to the center of the screen, then command the aiming system to move in the directions required to center that point. Remember that the airsoft pellets are ballistic, and will drop with distance; once you have the azimuth on target, you'll need to move the barrel upward to overcome that. This will have the effect of causing your image centroid to appear below the center of the display, if the camera is mounted above the barrel, and above the center if mounted below. If you have room for a laser rangefinder on that rig, use it to paint the target and provide ranging information to adjust for gravitational error. Tack on an anemometer if there's room, too, so you can estimate windage corrections.
If you want it to be truly useful, make that video camera an infrared type so you can hunt cats at night.
Will Rogers never met me.
|
|
|
|
|
the issue is I am able to locate the target as it moves (detection), it draws a square around the target, but as soon as the pan and tilt operations happen to move the target center the camera moves and picks up movement accross the whole screen which makes the entire video feed the target (square changes to the whole screen) this is what i am trying to fix now.... as for range finding i was thinking of using a stereo camera rig and calculating distance to target from the angle offset in each feed relative to the space between the two cameras, first prize for now would be to sort the motion tracking and target aquisition system. but i will look into laser range finding.
I didnt think of using a anemometer for windage this would be great as this will be used for outdoor combat. it going to be about the size of a lawn mower when it finished. as for Hunting Cats i happen to have two and dont think they would enjoy being shot at, this will however be used at airsoft games.
|
|
|
|
|
Other people's jobs are much more interesting than mine.......
|
|
|
|
|
i wish this was my nine to five, its actually a side home project, in my normal life i build ERP business software for a logistics company.... dead boring...
|
|
|
|
|
|
I have worked on several tracking algorithm. In many algorithm we need to give the boundary of the object to track. So if its not possible in your case, first you need to do some motion segmentation, then you need to track.
Tracking is definitely complicated, so if you have time i would suggest you to look into active contours and SIFT feature tracking , otherwise try to implement mean shift algorithm, the problem with mean shift is it is not scale invariant. You also need to predict the camera object movement ( using kallman filter )
Hopes this will give you a very high level introduction.
If u can Dream... U can do it
|
|
|
|
|
Thanks JK, the Kallman Filter approach seems to be the best option, you have definatly given me some good direction, thanks again.
|
|
|
|
|
Tell me If you got it working.am just curious.
If u can Dream... U can do it
|
|
|
|
|
|
You saw what happened yesterday when you didn't follow the guidelines. Why do you think it will be any different today?
Albert Einstein once said "The definition of insanity is doing the same thing over and over again and expecting different results". refer here
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
forum, u identify the installshield application send me the name i don't know?
|
|
|
|
|
Wow, you really are stupid. I just saw the email from you saying sorry for multiple posts and now you immediately post your question for a seventh time. That should guarantee that nobody will respond to you.
I must get a clever new signature for 2011.
|
|
|
|
|