15,898,134 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by TRK3 (Top 200 by date)
TRK3
22-Feb-13 11:37am
View
True, but it solves his problem that the code won't compile. Which is what he's asking about it.
Let him wrestle with the problem of actually making a sparse array and then come back with more questions if he needs more help -- he'll learn a lot more that way.
TRK3
22-Feb-13 10:56am
View
Without knowing anything about your simulation system, that's kind of hard for us to answer.
Is this simulation software something you've written yourself, or are you using an existing simulation library/package of some kind? This is a pretty basic thing and ought to be covered in the documentation of the library/package you are using.
TRK3
21-Feb-13 18:31pm
View
Who told you you "have to make a BTree" ?
Is this a class assignment?
If so, then do the work.
If not, then why a BTree? It's not my first choice for implementing the requirements you give.
TRK3
21-Feb-13 17:38pm
View
The problem is contradictory.
The problem states that 40% have the value 10$, 40% have the value 25$ and 20% have the value 40$ -- that's a total of 100%.
There aren't any other values in the problem except those three discrete values. The value is not "continuous". It has only 1 of 3 discrete values.
Do you know how to represent that int your simulation system?
TRK3
19-Feb-13 20:23pm
View
Do you want to stop the user from actually typing those words?
Or would you be satisfied with removing them from whatever he typed after he clicks on the search button (before you actuall search)?
TRK3
19-Feb-13 18:59pm
View
So what exactly is the problem?
Is the python iterpreter complaining? If so, what is the message?
Or are you getting unexpected results? Is so, what is your input, and output?
TRK3
15-Feb-13 16:29pm
View
You can call functions in a C-DLL from python using the ctypes python library.
Or you can spawn process and get return values using the subprocess python module.
And/or you can invoke the python interpreter from C.
There are all kinds of ways to interoperate C/C++ and python. I'd look into doing that rather converting everything to python.
TRK3
15-Feb-13 16:23pm
View
Don't.
Look up "YAGNI" -- it is a far, far more valuable skill for a professional programmer to learn "YAGNI" than it is to learn "design patterns".
There is absolutely no reason to make use of a "design pattern" unless that pattern actually solves an existing problem that you have.
Don't even try to do it as "a learning exercise".
The only thing you should do when initially studying "design patterns" is take note of what problem that particular design pattern solves -- and take great pains to understand what the problem is that it claims to solve.
Then, if you actually encounter that problem at some point in the future, remember that there is a design pattern for that and go look it up and see how it applies to your actual problem. Decide if it actually does solve your problem. And only then apply it.
Don't try to use as many design-patterns as possible. Don't try to make your code fit a design-pattern if that pattern doesn't solve a problem you actually need to solve.
There is absolutely nothing wrong with the code you wrote.
It's clear what it does. It's easy to follow, and it should be simple to debug.
If you start throwing in dependency-injection and generic-repository and, and ... it becomes so abstract that you won't be able to tell what the code does just by looking at it, and debugging it will be an exercise in stepping through all kinds of nested calls and indirections -- way more work than it is worth.
TRK3
15-Feb-13 16:10pm
View
Yeah, practical solutions are too often a compromise with what's elegant -- but they have the advantage that they can be implemented.
Good luck.
TRK3
15-Feb-13 14:50pm
View
Yeah. Totally get that, but if one of your target languages doesn't support partial classes, then it seems like you are stuck with full classes.
Coming from a predominantly C++ background, and being heavily influenced by Liskov's emphasis on encapsulation, I don't see what you gain from partial classes that you don't get from inheritance or composition.
What am I missing that makes partial classes intersting/useful?
TRK3
15-Feb-13 13:44pm
View
OK. Other than the fact that the world has too many frameworks already, I am tracking with what you are saying.
The first thought that comes to mind would be to define the interface in some declarative syntax that you create and then have a "compiler" generate declarations in both "C#" and Java (or any other target language).
That way you get equivalent declarations in both languages automatically.
By using your own declarative language, you can limit what can be defined to only those things that you can reasonably be represented in both languages.
I'm not sure I see a need for partial class definitions -- am I missing something?
I think your interface classes should be complete definitions and the developer can inherit or extend those with whatever inheritance/extension paradigm the language supports.
TRK3
14-Feb-13 19:01pm
View
That's why I didn't post my answer as a solution.
It is a good question, and a fun one to solve.
If the OP was building a framework and had no control of the client/server interface, and the framework was going to be used for hundreds of projects, then it would actually be extremely productive to solve the problem.
If he's got time and wants to work on the problem for fun, then more power to him, he'll learn a lot. Or if he really is solving a problem for lots of other developers, then great.
But if he's getting paid to get a working solution out the door, then he might want to scale back his ambitions, as fun as they might be.
TRK3
14-Feb-13 18:39pm
View
What are the N rough guesses based on?
If they are all based on the same source, then I don't see that it buys you anything.
Isn't GPS error mostly systematic, rather than random?
In other words, if you take five GPS reading in a row from basically the same position in a very short space of time, won't you get the same answer?
In that case, multiple readings aren't all that valuable.
You need more than one way to estimate position, GPS give you one, and it has an error. Dead reckoning gives you another, and it's error accumulates (but combined with the GPS you can correct for the accumulated error). If you had cell-tower triangulation, or strength of WiFi signals you'd have another way to estimate position -- each with it's own different error, and the combination could give you a better idea of position.
TRK3
14-Feb-13 18:28pm
View
"Awesome" is often extremely counter-productive.
While your approach sounds like it could be a lot of fun to play with, I am skeptical that it would actually increase productivity.
You might be attacking the wrong problem.
If you are constantly changing the interface between your server and client, there is something drastically wrong with your design, or your serialization methods.
The interface between client and server should be extremely well defined and actually fairly simple.
If you think you need to transfer huge, often changing classes between client and server, maybe you have the devision of labor between client and server wrong.
Move all those clever dynamic classes all the way into the client and have your server just serve raw data, or move them all the way into the server, and have your client just display results.
It will make serialization and synchronization of server and client a lot easier, and should cut down on bandwidth.
TRK3
14-Feb-13 18:13pm
View
Can it be done? I don't see why not.
Is it the best solution?
"Best" is not even vaguely important. If it's a cron job that sends out email daily, then it just has to work and not require much effort to implement.
If "Rackspace" suggested you use it, ask them for a sample implementation, or for instructions on how to do it. Follow their instructions or example and get it set up, then forget about it.
TRK3
14-Feb-13 18:04pm
View
It's unclear to me what you mean in step 2.
"Generate N particles around the GPS value"? What does that mean? In this context what does "particle" correspond to physically? An obstacle?
Rather than focusing on "particle filter" as some neat mathematical algorithm that you might somehow be able to apply to your problem, figure out what you need to solve the problem.
I might suggest that you take a look at how old-time navigators navigate the ocean.
They know where the are when they start. They estimate their current position by dead-reckoning (continually adding their estimate of direction, speed and elapsed time.)
They cross-check their dead-reckoning position against a gross estimate of their current position by using a sextant and chronometer -- the precision of that estimate relative to the size of the ocean is probably similar to the precision of your GPS reading relative to the size of the space your navigating (in other words, extremely rough.)
After doing all that, they know they have no idea where they really are, so they post a watch to keep them from running into obstacles.
They also post a watch to look for landmarks on the shoreline. And the only time they have any idea where they really are is when they see a landmark on the shoreline -- or perferably two landmarks so they can triangulate their position.
The moral of the story: Unless you have a map it's impossible to know where you are, or if you got where you wanted to go.
NOTE: Even Google's self-driving car requires that you drive the route once before hand so it can map the objects along the way and then use them to know where it is.
TRK3
14-Feb-13 13:28pm
View
If I remember correctly, I ran into a very similar problem a year or two ago, with C++/MFC's CBitmap.
I was using a third party library of UI-widgets (which I fortunately had source for). After some experimentation it boiled down to the fact that I couldn't create two CBitmaps from the same image file at the same time, but I could make a copy of an existing CBitmap.
I don't recall if it was an XP specific problem, but at the time I was developing on Vista and testing on XP and Vista, so it's probably exactly the same as what you are running into. (Pretty sure the .NET Bitmap is just a wrappper around the same Win32 object that CBitmap wraps.)
TRK3
13-Feb-13 14:25pm
View
Use Google maps.
TRK3
13-Feb-13 14:25pm
View
Is the "15Mb" image a jpeg file? If so, that's an extremely high quality photo that is absolutely huge. You probably don't have enough memory in a 32-bit system to fully decompress a file like that.
If your dev system is a 32-bit system, see if you can try the same thing on 64-bit system. Then you'll know if it really is an absolute memory issue, or if you are doing something horribly wrong.
If it is an absolute memory issue and a 64-bit machine solves it, then it is probably easier (and cheaper, believe it or not) to just get a 64-bit machine than it is to try to write a more memory efficient algorithm -- assuming the program is for dedicated use by one customer.
TRK3
13-Feb-13 13:43pm
View
All kinds of sites. What sort of conversion are you looking for?
TRK3
12-Feb-13 17:54pm
View
As far as I know there is no way around signing your package with a trusted certificate. If it's not signed, users get warned about the package.
So the question is, is there any way to get a trusted certificate without paying money for it?
I am not aware of any. Maybe somebody else knows.
Would you trust a certificate that anybody could get for free?
TRK3
7-Feb-13 18:52pm
View
What is the original problem you are trying to solve?
Indexing the whole text for every word in the text and then writing that index out in XML is going to create an index file that may be as large as the original text and might even take longer to search.
Why XML?
What problem are you having trouble with? Building the index? Or writing it out in XML? If you are trying to do both at the same time you are doing it wrong.
TRK3
18-Dec-12 13:32pm
View
I never used it that way -- I am opening an exception for a proprietary port in my case.
TRK3
7-Dec-12 17:07pm
View
What do you mean by "stop not kill" ?
Do you mean you want to suspend the thread?
Thread schedule is usually a function of the OS and isn't part of the C language.
As Sergey asked, what platform / operating system / threading library are you using?
TRK3
7-Dec-12 13:13pm
View
I don't understand what you are trying to do at all.
I can understand your code, but I don't understand your explanation of what you are trying to do, or what the undesired result is.
Maybe it's just a problem with the language, but if you can't clearly explain what it is you are trying to accomplish, then maybe you don't totally understand it (which is the first thing you have to do in order to be able to code anything).
It's probably easier to explain if you give actual examples.
Can you give us an example of what's in the list box, and then show us what you expect to have happen and what actually happens?
TRK3
6-Dec-12 15:19pm
View
:)
TRK3
6-Dec-12 15:06pm
View
The SPEC Benchmark CPU2006 software is available for purchase from the organization that produces it. There website is easily found by a google search on "SPEC CPU2006".
What is the problem you are trying to solve? Are you trying to get their software for free? Or don't you have access to a search engine? Or ???
TRK3
6-Dec-12 15:00pm
View
Actually, I just noticed that your code is looping through all the items in ListBox1 and setting the other controls.
Each time through the loop you are trashing whatever you set the previous time throught the loop. The only thing that you'll end up with is whatever you did very last time throught the loop.
You might as well just set i = listBox1.Items.Count - 1 and run the code once. The final result is the same.
I'm pretty sure that's not what you intended.
TRK3
6-Dec-12 14:57pm
View
Not clear from your explanation what exactly you are trying to do and what exactly is happening.
Can you give us a clear concrete example of the input and the actual result vs. the expected result?
TRK3
6-Dec-12 14:36pm
View
You say "I have a collection of comma separated numbers" ... "without inserting them into tables" !
How is it possible in SQL to have a collection of anything in any format if it isn't already inserted into a a table ?
Either the data is already in a field in a table, or it isn't.
If it isn't already in the database and you don't want to put it in the database, then why do you want to manipulate it via SQL?
Use the right tool for the job.
TRK3
4-Dec-12 15:43pm
View
And there are no firewall / router restrictions...
If the transport mechanism is http and the server has a fixed IP address that is known or discoverable (via DNS or...) then it should just work.
If the transport mechanism isn't http, then the odds are that you'll have to configure firewalls and gateways so that the communication can get through -- typically gateways are configured to allow http traffic on the default http port, but most other ports and protocols are blocked by default.
Other than that, the only other thing you need to worry about is increased latency and reduced bandwidth (if those are factors).
TRK3
30-Nov-12 17:35pm
View
Windows 8 Apps have an API for in-app purchase and trial periods. Is that what you are thinking about?
Or were you looking for some third party tool kit that does this for other platfroms besides Windows 8 (and if so which platforms do you want / need)?
TRK3
30-Nov-12 17:28pm
View
It would depend on (a) the third party encryption tool [find one and read the manual] and (b) the main application.
The typical way to do this sort of thing is to have an encrypted directory or encrypted disk -- Windows will let you turn on encryption on a directory by directory basis. There are probably third party tools that do something similar if you don't want to use the built in Windows functionality for some reason.
TRK3
30-Nov-12 17:23pm
View
The error code might be a windows system error code.
In that case, error code 2 = ERROR_FILE_NOT_FOUND.
You probably have a file name or directory name spelled wrong, or you left off a file extension, or you need to specify a full path because the working directory isn't the directory you think it is.
TRK3
28-Nov-12 19:29pm
View
Are you trying to do this from within the browser?
I sure hope that's impossible.
I wouldn't want some random web-site to have access to the other web-sites I happen to be browsing in other tabs (and other browsers) at the same time.
Why do you want to do this?
TRK3
28-Nov-12 19:25pm
View
"Scanned" PDF document?
You mean you ran it through a scanner, then wrapped the resulting image in a PDF file?
You need an OCR program to convert a scanned image to text -- some OCR programs are better at dealing with tables and putting them into spreadsheets than others.
Search for OCR programs. You aren't going to do it in VB yourself.
TRK3
28-Nov-12 19:01pm
View
Please improve your question. I have no idea what you are trying to do.
According to the comment the code was auto generated. What tool generated it? What was the input to the tool? Does the generated code not compile? If so what's the error message? If it does compile, does it not run? If not, what's the error message? If it does run, does it produce unexpected results? What did you expect, what did you get? Did you run it under the debugger?
Are you the author of the tool that auto-generated the code?
TRK3
24-Oct-12 12:33pm
View
Amen.
There are way too many abbreviations.
It's annoying how often I find myself looking up an abbreviation in an article, when the author could have just defined it the first time they used it (that used to be standard practice -- and it still ought to be).
+5 for your practical solution below!
TRK3
23-Oct-12 17:40pm
View
HMM = Hidden Markov Model
If OP is trying to build a speech recognition system starting with just an HMM tool kit, then he is either doing a research project or has no clue how much work is actually involved.
TRK3
28-Sep-12 12:49pm
View
It's not really a programming nightmare.
It's just pretty obvious that you aren't familiar with the ins and outs of MFC and that you probably don't have a lot of experience maintaining old code.
If you inherited the program -- did the release build work before you made any modifications? If so, the first place to look would be at the modifications you made, possibly commenting them out and then adding them back in one at a time to see when it breaks. It's not necessarily true that the bug is in your code, but it's the first place to look. Once you find the change that causes the code to break, you've got it narrowed down and can hopefully determine if there is something wrong with that code itself, or you can trace what effects that change have on whatever is breaking.
TRK3
27-Sep-12 20:10pm
View
I actually found I was unable to look at the code...
I still can't.
I took one glance at it, and decided it was written by a hardware engineer, or by an intern or programmer fresh out of school with little or no Microsoft experience and little real world experience (it's the sort of project you'd throw at that kind of person).
Assuming that's the level of our OP, I also assumed he hadn't written multi-threaded code and just needed some pointers to get him started on figuring out his problem.
If he is any good, he'll take it from here, and a couple of years from now he'll actually be writing code that's good enough to use in production. (I could tell you horror stories about the first code I ever wrote professionally.)
(I am still not convinced his program is truly multi-threaded. Most windows programs have a few extra threads kicking around tha show up in the debugger -- but those threads are things Microsoft spawned and aren't likely to be an issue.)
TRK3
27-Sep-12 19:03pm
View
A couple of things to watch for:
1. When you compile for debug, Microsoft initializes uninitialized stack variables and heap data to specific values -- when you compile for release, those uninitialized values are whatever is in memory.
2. If you have static variables that are initialized to instances of some class, the constructors for those instances are called at startup -- but not in any specified order. The actual order is defined at compile/link time but isn't defined per the spec and seems to differ between debug and release code sometimes. So, if you have static objects where the order of construction matters, you have to instantiate them yourself after startup.
3. When you can't use the debugger, you can always resort to logging messages to a file. With enough logging statements, you can narrow down where your code is failing.
TRK3
27-Sep-12 18:17pm
View
Actually you don't even need to compile any C++:
Get old CRT with ancient machine running DOS. Run the command:
copy c:\dos.exe con
Using an HD video camera, film the screen.
Play back the video through a projector, de-focus the projector and place a green filter in front of it.
Capture that projected image with your video camera again.
Take the resulting video and play it back in full screen mode on your new high end desktop machine.
You could also achieve the same thing with CGI -- I think Pixar leases spare computing time on their cluster when they aren't using it.
TRK3
27-Sep-12 14:13pm
View
If you have other self written converters that work, then what's the difference between the ones that work and the ones that don't?
(What ever example you tried to put in your comment above isn't showing up.)
TRK3
27-Sep-12 13:33pm
View
I find the easiest way to figure out things like that is to record a macro while doing it manually. Then look at the code of the recorded macro to figure out how to do it.
TRK3
26-Sep-12 19:44pm
View
Actually, it's equivalent to (n < 1 && j > 0) || (j < 0 && n > 1).
But n = 3, and doesn't change, so it's just j > 0.
On the otherhand, j is never asigned a value since the Calc(n) call in the assignment to j throws and exception. So the whole thing can be optimized away as:
throw new NotImplementedException();
TRK3
26-Sep-12 18:18pm
View
You are having a lot more than just problems with that one line.
The line itself is an expression that evaluates to true or false, but doesn't assign or increment anything.
If you want to increment j, then just write:
j++;
or
j = j + 1;
However, the whole Main() function spends a lot of time to accomplish absolutely nothing.
Go ahead and change the line to what I've suggested, then step through your function in a debugger and see what happens.
TRK3
26-Sep-12 18:02pm
View
It seems the simplest solution would be not to run the application.
TRK3
26-Sep-12 15:52pm
View
The idea of "sorting a matrix" is a bit bizarre.
As a mathematical concept, a matrix is not something that you would sort.
If you mean sorting a multi-dimensional array, it's still a weird concept.
The whole point of having a multi-dimensional array is that the rows / columns have some meaning. Are you just sorting the columns, or just sorting the rows?
Try solving the same problem for one dimensional arrays. Once you have figured out how to do that -- then generalize your solution to multiple dimensions.
TRK3
19-Sep-12 18:13pm
View
I get it. Oh well.
TRK3
19-Sep-12 16:18pm
View
Can't you just:
IF OS == XP && registry contains whatever hack I did for the old app THEN
alter the hack to point to the new app
END
On Vista and Win 7 you get all the ClickOnce goodness and on XP you get the behavior you want at the cost of duplicating your previous hack.
TRK3
19-Sep-12 14:26pm
View
1. If you expect your users to keep both versions installed, then it's reasonable to require them to manually decide which is going to be the default.
What happens if you uninstal an app that is the default app for opening some file type. Does XP then open it with another app that is registerdd for that file type, or does it ask you to manually decide what app to use? Either way, is that an acceptable behavior?
2. There are a lot of apps (browsers, music players, iTunes, video players) that tell you "We detected that <application> is not the default for opening <filetype>. Would you like to change it?" -- you might look into how they do that and implement something like that in your new version.
3. Pity.
Good luck.
TRK3
18-Sep-12 19:56pm
View
My experience with visual designers is that they are notoriously buggy and don't play nice with any "extra" stuff you add.
I find that I usually just use the designer for initial layout, and after that I almost always edit the code itself (only using the designer to view the results of the edit, not using it to actually make changes).
TRK3
18-Sep-12 19:04pm
View
Couple of thoughts:
1. Can you configure your deployment so that it uninstalls the old app? (Might have to manually ensure some GUIDs match somewhere...)
2. Can you take the registry twiddling code from you old app and include a modified version in the new app so that (if you are running on XP) it fixes up the registry to point to your new app?
3. Can you stop supporting XP? (I know I can't. We official dropped support for XP 6 months ago, but I still have too many customer using XP to actually ignore it.)
TRK3
17-Sep-12 19:25pm
View
Sounds like you are a lot closer now.
Are you calling this function on your dialog before your dialog gets a chance to paint?
TRK3
17-Sep-12 18:51pm
View
Did you try it?
If not, why not? If so, what happened?
TRK3
17-Sep-12 18:48pm
View
You need to give us more information if you expect to get some help.
What is the exact error message/code? When/where does it occur?
You say you "copied a clientaccesspolicy.xml and crossdomain.xml file and placed it in root folder of my project"
(a) those files are supposed to go on the root of the server [which probably isn't the same as the "root folder of my project"]
(b) there is no way to tell if what you have in those files is actually what you need to have in those files.
TRK3
17-Sep-12 18:18pm
View
Assuming the problem only occurs with "Big" files, I'd guess that perhaps the big image is too big to fit into the GPU hardware and so the Microsoft software has to fall back to doing the image processing either in chunks in the GPU or doing it all in the CPU.
Apparently one of those fall-back implementations has a bug in it.
It's certainly not anything we can help you with here, since the bug isn't in your code.
TRK3
14-Sep-12 13:41pm
View
It really depends on what your actual purpose is.
If you want to just serve python files from a different path, then the right way to do it configure your Apache server.
If what you really want to do is learn python and see all things it can do, then maybe you have a valid reason for running the python server -- but even that is kind of doubtful.
Which is it?
TRK3
14-Sep-12 13:35pm
View
I haven't used one in a Windows environment. I had a relatively painless experience with a FFmpeg library in an iOS environment -- but I found one that had been specifically ported to that environment and was pleasantly surprised to find that it built without my having to do anything.
Unless someone else has already done the port to Windows and you can just download it and build it, it does become rather precarious pretty fast.
Somebody must have a suggestion though.
TRK3
13-Sep-12 18:29pm
View
There are open source mpeg decoding libaries. Most of them are going to be written in C. Are you willing to deal with mixed native / managed code?
TRK3
13-Sep-12 17:52pm
View
I'm not sure I understand what you are trying to do.
Surely the answer to your question is going to be dependent on what operating system you are interested in. So is Linus or Win 7?
Isn't it also potentially dependent on the driver implementation itself?
And in any case, why does it matter? What are you trying to accomplish?
TRK3
7-Sep-12 16:54pm
View
Upload a file, then download it. Then do a diff of the two files to see what is different.
TRK3
22-Aug-12 19:48pm
View
Did you check any of the return codes from any of the functions you are calling?
Maybe one of them is failing with a useful error code.
TRK3
15-Aug-12 17:47pm
View
I'm not here to do your work for you.
I don't have a server set up to try this out on and, as easy as it is to install a stack these days, I am not going to go to all that trouble to test something for you.
Especially, since (assuming you have access to a test server) you could have tested it yourself in about the same amount of time it took you to write the reply. (And if you don't have a test server, then you better set one up before you start making ANY changes on your production server.)
TRK3
3-Aug-12 13:47pm
View
Ouch...
Can you separate the inline assembly portions into a one (or a small handful) of source files -- preferrably with simple C functions as the interfaces (and no windows dependencies)?
Then you might be able to compile the source into assembly code using the VS compiler on your Windows machine and then use the pure assembly code as source for your Linux project (converting to AT&T using an automated converter if need be).
Alternately you might just look into Wine and see if you can't just use the windows executable or DLL's as-is.
None of it is very attractive (or simple).
Normally I don't advocate a quick and dirty solution, but in this case, if there is a quick solution I am not sure I'd care how dirty it is...
TRK3
2-Aug-12 15:37pm
View
Hmm... Clearly I suffered a failure of imagination.
10,000 lines of inline assembly! What was the author smoking?
There are automated tools for converting from one syntax to the other.
If you google "convert intel assembly to at&t" you'll get some links to projects/tools that will do that.
Of course, I suspect they want to take assembly source rather than C with inline assembly instructions, but you might be able to leaverage one of them to do the trick...
TRK3
2-Aug-12 13:58pm
View
Is the inline assembly actually justified?
In this day and age I am having a hard time coming up with a scenario where inline assembly makes sense.
Particularly in a program you are porting from Windows.
With optimizing compilers, it's a rare case where you can hand craft assembly that's significantly faster than C.
So the only reason you are left with for writing assembly would be to do something hardware/OS specific which is not going to be portable from Windows to Linux anyway.
Why not just re-write it in C?
Or if there is a valid reason for the inline assembly, why can't you just convert to AT&T syntax?
How hard could it be to convert from one assembly syntax to another? If you are using the same instruction set, there is a one-to-one mapping. If you aren't using the same instruction set, it isn't portable anyway.
If there is more than a dozen lines of assembler something is wrong anyway.
As for Kenneth's suggestion of using functions -- the idea is that if you pass the variables as parameters to a pure assembly function, then you know where those variables are on the stack relative to the stack pointer (look up C calling convention).
TRK3
1-Aug-12 18:53pm
View
What's your point?
560988.92 = 560988 to 6 digits.
6767202.49 = 6767200 = 6.7672e6 to 6 digits.
We don't know what actual data type a CV3 is, but we can safely conclude that convert between a string and CV3 representation preserves approximatesly 6 digits of accuracy.
For all we know it's an 8 byte BCD encoded value with 2 digits of exponent and 6 digits of significand.
Or it's a 24 bit floating point number with 8 bits of exponent and 16 bits of significand.
TRK3
1-Aug-12 18:11pm
View
What do you mean "I cannot do it"?
Do you mean the compiler complains because you should be calling:
Calculate(g) instead of Calculate(Graphics g) ?
Or do you mean you get an exception when you call it?
Or ?
TRK3
30-Jul-12 18:26pm
View
You pretty much posted the same question already: http://www.codeproject.com/Questions/428339/Compare-File-names-in-database-with-directory-list
What have you tried?
What specifically are you haveing trouble with?
TRK3
21-Jun-12 18:43pm
View
You just need another PID controller for the speed.
They are independent things that will need different Kp, Kd, and Ki values.
TRK3
21-Jun-12 14:42pm
View
Nope. You don't always need all three. In fact, it's quite common to have just a PI or PD controller.
The Ki term is intended to cancel steady state error. If you don't have a stead state error, you don't need it. (You probably won't if your error measurement and actuator are relatively accurate.)
TRK3
21-Jun-12 14:05pm
View
Depends on what you mean by "transfer function". If you are talking about a purely electrical thing, then no, it won't help. If you are talking about something that models the physical response to the electrical input, and you have a method of empirically measuring that in a way that gives you a transfer function -- then your function will incorporate the friction and inertia in the system.
However, you should ask yourself if you are over analyzing the problem.
Take a look at the Wikipedia article, it has a simple manual tuning method. If you use that, does it give you adequate results for your application? If so, you're done.
As a practical matter it is usually not necessary (or useful) to do some rigorous mathematical analysis.
If you are tuning a single system, then it is almost always faster and easier to do it manually then to develop an automated system for doing it.
Even if you need to tune thousands of systems, it is often best to tune the first few manually, so that you get an intuitive understanding of the system and the variables involved before you attempt to develop an automated system for doing so.
TRK3
21-Jun-12 13:21pm
View
I am not sure that you can find the values on a purely mathematical basis. The optimal values are dependent on physical attributes of the system (such as how much friction, inertia and measurement error) -- if you knew those things accurately, you could model the system and determine the best choice of constants. However, if your model is wrong the constants will be wrong -- deriving the optimal constants empirically is a better approach.
You may not need KD and KI -- read the Wikipedia article. You only need the KI term if there is a cumulative error in your system (such as a measurement error) and you only need the KD term if you want to reduce the overshoot in the system. If there is already a lot of friction in the system, KD usually won't be needed.
TRK3
18-Jun-12 18:01pm
View
Is there a question here?
TRK3
15-Jun-12 13:16pm
View
For purposes of illustration, lets assume that the input to your actuator is in units of volts (i.e. output is in volts) and that your setpoint and PV are measurement of an angle (in degrees).
Error also will be in units of degrees.
If your time is measured in milliSeconds, then:
* integral is in units of degree-milliSeconds
* derivative in in units of degrees per milliSecond
To get your output in volts, then:
Kp is in units of volts per degree.
(degrees * volts/degree = volts)
Ki is in units of volts per degree-millisecond
(degree-milliseconds * volts/degree-milliseconds = volts)
Kd in in units of volt-milliseconds per degree
(degrees/millisecond * volt-milliseconds = volts)
If you express time in terms of seconds, then
Ki is then in units of volts per degree-second (and is 1000x bigger to compensate for the fact that your multiplying by a time number is 1000x smaller)
Kd is then in units of volt-seconds per degree (and is 1000x smaller to compensate for the fact that you are dividing by a time number that is 1000x smaller)
All I'm saying is it doesn't matter what units you use, at the end of the day you've got 3 arbitrary constants whose values you are going to pick in a way that cancels out whatever units you choose.
TRK3
14-Jun-12 13:44pm
View
That seems a bit beyond the scope of a school project.
Do you really need to actually convert them to HTML?
Or is it sufficient to extract the words from them so you can index them?
TRK3
13-Jun-12 17:17pm
View
What did you try?
If you saved it in the database as binary, and retrieve it as binary, you should get back the exact same bits and bytes as you saved.
What's the problem you are having?
TRK3
8-Jun-12 18:50pm
View
Yeah, I've been meaning to dig it up for you -- I probably won't have a chance to post it for you until Monday.
TRK3
8-Jun-12 13:31pm
View
One thing that actually might fix the problem would be to add a USB hub between your computer and the device. By doing that, you are changing the timing. Also it will be the hub that sees the corrupted signal from the device and handle the NAK/retry with the device -- the usbser.sys on the host won't see a corrupted signal, it will instead see a NRDY (not ready) from the hub, while the hub is handling the retries. So the whole behavior of the system will be different. It will either fix the problem or make it worse, depending on the hub in use (try a 1.1 Hub and 2.0 Hub and several different manufacturers -- they are not all the same).
TRK3
8-Jun-12 13:15pm
View
Yeah, you are probably right.
Now that you mention it I can't think of anything it actually buys you unless you can actually do static analysis of the whole program and validate the specifications. But that requires analysis of any libraries that you don't have source for... Even then I don't think static analysis is necessarily possible in finite time -- you can find places where the specification might be violated, but it smells a bit like the halting problem.
TRK3
7-Jun-12 17:38pm
View
Sure, you've already unwound the stack up to the point where propagating the exception becomes invalid -- so you don't have that information in the debugger (unless the compiler writer went to greate pains to give you a special expensive exception handling scheme that perserved it all) -- but you should have the information of the exact point where propagating the exception is invalid. And that's the point you want need to do something about it anyway (either handle the exception there, or specify that it can be thrown).
TRK3
7-Jun-12 13:09pm
View
Really? Don't you at least have a stack trace at that point in a debugger?
TRK3
7-Jun-12 13:07pm
View
Microsoft should implement C++11 spec. And from from the Going Native webcasts, it seems like they intend to.
However giving the timing of the finalization of the spec and the release of VS, they had to pick and choose which functionality to implement in the latest release.
Exception specification is probably at the bottom of the list for all the reasons you listed.
I would expect them to implement it and give you a switch to enable or disable it.
With the LLVM compiler you could actually do some cross module analysis and statically detect potential violations of exception specification at compile time.
If MS was smart, they would actually embrace the LLVM and use that in VS 2012 -- the one thing it lacks is a good Windows back-end, they could concentrate on that and reap the benefits of all the work being done on the rest of the tool chain.
TRK3
7-Jun-12 12:59pm
View
Yes, but if you listed every exception that was in the function declaration -- then it would catch the exceptions that weren't listed.
So you, could do it manually (where you really cared to do it) -- or you could use modules from the LLVM to do it for you automatically. But then if you are going to do that, then just go ahead and use the Clang compiler that implements the spec. So, yeah, basically the way to do it is use a compiler that supports it.
TRK3
6-Jun-12 20:38pm
View
Imagine a try block around every function call with an explicit catch block for each specified exception type (which it just rethrows) and a generic catch block that invokes unexpected().
You can write that explicitly with the MS compilier -- so it's really just a simple matter of the compiler doing it for you implicitly (of course there is probably a more efficient way to do it -- but that gives you one idea of how it could be done).
TRK3
6-Jun-12 20:33pm
View
That's not really the point of unexpected is it?
Unexpected catches the exception at the point that it's first incorrectly propagated. It shows you the exact point where your specification doesn't match your implementation.
Catching something at the top level just tells you that you didn't catch it at a lower level -- it doesn't tell you if the thing that was thrown wasn't specified or not, just that you didn't catch it.
TRK3
6-Jun-12 20:28pm
View
Hmmm... I thought the 2010 link said it wasn't supported. For sure, the 2008 link says it's not implemented.
TRK3
6-Jun-12 19:43pm
View
Yes. Lot's of people know how to solve the producer/consumer problem using semaphores. Try googling it.
The fact that your pipes are wireless or wired is entirely irrelevant to the problem.
TRK3
6-Jun-12 19:01pm
View
Actually, for me it is simple since I've used winusb.sys to interface to 4 different devices now.
One of the devices has a simple serial interface over USB (using an Atmel USB to serial bridge). I even think the original test software for that used usbser.sys -- but I replaced it with a winusb.sys version since I was using that for all the other devices and I didn't want to have to deal with the idiosyncracies of multiple drivers.
Is your application level interface just a simple character stream in/out? If so, I could probably dig up sample code that implements that over winusb for you if you want to go that route.
TRK3
6-Jun-12 17:52pm
View
Even if you can programmatically recognize the problem, is there anything you can do to fix it programmatically?
When I ran into a similar situation with old winusb.sys drivers I could detect a problem at the application level (although I couldn't say what the problem was), but there was no way I could reset the driver at the application level -- the ONLY thing that worked was physically disconnecting the USB cable and plugging it back in...
TRK3
6-Jun-12 17:48pm
View
Here's a link to similar data:
http://www.embeddedrelated.com/groups/lpc2000/show/35810.php
It points out another issue that causes the same behavior and might be solvable in the device firmware. It also gives more data on the problem described in your link, but it doesn't have a solution for it either.
TRK3
6-Jun-12 17:34pm
View
It might be help if you posted the relevant code.
TRK3
6-Jun-12 13:55pm
View
True. A novice will learn the most by working with an existing project and learning from more experienced team members -- probably a lot more than he will if he posts a project that nobody is interested in.
TRK3
6-Jun-12 13:39pm
View
Yeah, that sounds a lot like the problem I was seeing with the out-of-date winusb.sys. (At first glance I thought the site said the problem was fixed in Vista/Win7 -- but apparently it isn't.)
Also, it appears that the usbser.sys that ships with XP SP3 may have more problems than the version with XP SP2 -- figure out if all the failing XP systems have the same version. If so, try replacing it with the other version (SP3 or SP2 which ever one they aren't using).
You might consider using the winusb driver instead (the updated version seems to work fine on XP). That will require you writing a layer in your code to tarnslate the serial API into explicit BULK IN and BULK OUT reads/writes via winusb, but thats a pretty simple layer.
TRK3
5-Jun-12 16:53pm
View
Don't worry too much about if your project will interest readers. The most likely thing to happen is nobody will even notice or care about what you post. But that doesn't mean you shouldn't go ahead and do it. Somebody might benefit from it.
The second most likely thing to happen is, as SAKryukov points out, people will point out all the mistakes in your code. But at least that means somebody noticed.
Be willing to have your work criticized. Don't get emotionally attached to your code. No matter how good you are, there is somebody out there who can point out a way to do it better -- and there will always be those who think they can. Some of the criticism will be opinion, some of it will be valid -- if you look at it as a learning opportunity, then you'll definitely learn things.
Go for it.
TRK3
5-Jun-12 13:41pm
View
My favorite "rapid prototyping" tool is paper and a pencil.
The user interface is totally intuitive -- it lets you get you create your prototype almost instantly.
And best of all -- there is no pretense that it actually writes production quality code for you. You are forced to throw away your prototype and do a complete re-write when you actually need to create the production version.
TRK3
5-Jun-12 13:35pm
View
Yeah, as long as we aren't including chinese pictographs...
Clearly, we are having more fun with this problem than OP. :^)
TRK3
4-Jun-12 19:49pm
View
OP said "same characters" not "same letters". The way I read that, he means any characters... Not just letters.
So, we'll have to backup and define "characters" -- if we are dealing with ascii - then your solution gets a lot simpler with a 256 byte elimination table (and no check for capital letters).
If we are dealing with unicode characters then it's a whole different issue.
TRK3
4-Jun-12 13:51pm
View
I am happy I could help.
TRK3
31-May-12 12:55pm
View
When you say "don't export finely" -- what exactly do you mean? Do you mean that it crashes or throws an exception? Or do you mean that the exported data isn't displaying correctly in excel?
If the later, then it's probably a character set / code-page mismatch of some kind. Could depend on what language version of Windows is being run and what version of excel.
TRK3
25-May-12 13:34pm
View
I haven't done VSTO / Office development, but the documentation says that you should not instantiate the class yourself and that it is instantiated when your addin is loaded.
I would think it should be available as Application.thisAddin or Globals.thisAddin or something like that... Isn't it?
TRK3
24-May-12 13:19pm
View
I'm confused about what you want to do.
If you don't want to create a new instance, then you obviously want to refer to an existing instance.
Is there only one instance or are there multiple instances?
If there is only one, then a static class solves your problem.
If there are multiple instances, then which instance do you want to refer to?
TRK3
23-May-12 21:01pm
View
Added code tags.
I don't think you have any guarantees under windows about latency once you relinquish the processor. (Unless somebody else knows some trick I'm not aware of.)
Do you have to run this on a Windows platform?
TRK3
23-May-12 17:23pm
View
Is this an app for an Android phone?
If so, yes it can be done. What part are you having a problem with?
Taking the photo? Google "Android Camera API"
Or are you unsure of how to replace the background with an image once you have it?
TRK3
22-May-12 19:48pm
View
Is this something your teacher expects you to know how to do at this point? If so you either missed something in class or you misunderstood the assignment, or are missing some basic knowledge you were expected to have before takeing the class.
In any case, you should ask your teacher about it.
It is important that you understand what it is that you are supposed to be learning. And it is equally important that your teacher understand when he/she has failed to teach what he/she intended to teach.
TRK3
22-May-12 13:16pm
View
I didn't realize it was a univeristy project. It's definitely an interesting technical challenge -- well done on solving it.
TRK3
16-May-12 18:15pm
View
You don't need a computer program to simulate something.
Get three people. Tell one of them he is room #1 and explain to him what he does. Tell the second person he is room #2 and explain to him what he deos. The the third person he is room #3 and explain to him what he does. Then tell them all to start and watch what happens.
Do this exercise first.
If you can actually explain to the three people what it is you want them to simulate and they understand it, they might be able to perform a simulation manually that is adequate to your needs.
If they can't, at least the exercise will have forced you to figure out how to clearly describe what it is you are trying to simulate. Once you've clearly described it, you might find it is now easier for you to implement it.
Or at least, you can then come back here and explain it to us. Right now I have no idea what you are trying to do, and am not sure that you even understand what it is you are trying to do.
TRK3
15-May-12 19:12pm
View
Why would you want to do that? Is this a homework question?
TRK3
15-May-12 19:05pm
View
Fixed formatting and code tags.
What's your question?
TRK3
14-May-12 19:10pm
View
Looks fine in IE9.
What isn't being rendered properly? What version of IE?
TRK3
11-May-12 18:28pm
View
What you show looks fine. The problem may be somewhere else. Try it with the simplest possible example and see if it works.
See this site:
http://www.alexonlinux.com/signal-handling-in-linux
It has a very simple example that should work. Copy it and compile it to verify it works on your system. (It might not, in which case it's a problem with your OS or toolchain implementing signal in a non standard way.) If it does work, then gradually add to the working example to make it more like your non-working version and see what change breaks it.
TRK3
10-May-12 19:10pm
View
What have you tried? What specifically do you not understand or need help with?
The program you want to write is one of the simplest programs one could attempt. I'd almost expect it to be the second program you learn to write right after "hello world".
We're more than happy to help you learn, but you need to do a little study yourself and make an attempt at it. Then if there is something specific you don't understand or couldn't find in the documentation, we'll be happy to help with that.
TRK3
9-May-12 13:07pm
View
Thanks. I was just going to tell him what was wrong with the code, but I wasn't sure of OP's skill/training and was afraid the explanation wouldn't be as easy to understand as if I showed him.
TRK3
9-May-12 12:51pm
View
You have native C++ classes: House and Room.
Define managed C# classes in a C# module: CLRHouse and CLRRoom that are functionally equivalent to the C++ classes.
Write a C++/CLR routine that translates House to/from CLRHouse and Room to/from CLRRoom.
When you write C++/CLR it knows about both native classes stored on the unmanaged heap (dereferenced via * )and managed classes on the managed heap (dereferenced via ^ ).
See my updated solution with sample C++/CLR code.
TRK3
9-May-12 12:44pm
View
A couple of questions:
(a) Why? The human eye is very very good at separating out the five different pulses [waves] in the combined ECG -- and it's a non-trivial task for a computer to do with some chance it will be wrong occassionally. Is there really an advantage to display them separately, expecially given the product liability inherent in medical devices when you get it wrong?
b) If there is a good reason to do it, does it have to be real time, or can it be a post process? In either case, how long a capture or window do you have to process with? It makes a huge difference if you have many pulses vs. only having one at a time you can look at.
TRK3
9-May-12 12:33pm
View
My initial comment was based on OP's statement that he had an unspecified "electrical signal". With the additional data that it's an ECG and that the "5 waves" are differentiated in the time domain, not the spectral domain, then a spectral approach isn't likely to work.
I don't think it's necessarily impossible. It looks like a matter of identifying a recurring pattern of pulses and assigning each pulse in the pattern to a different wave. Though I'm not sure it's acutually worth doing.
TRK3
8-May-12 20:14pm
View
It depends on what you mean by "five different waves":
If you mean 5 different sine waves, or 5 different waves in different non-overlapping frequency bands, then it's pretty simple to do using an FFT (Fast Fourier Transform). There's plenty of literature on FFT's and Fourier Transforms -- do a little study on those and then come back and ask any specific questions you have.
If on the other hand they are 5 completely arbitrary waves -- then there isn't any easy way to do it and in fact it's impossible without some constraints on the 5 different waves.
TRK3
8-May-12 19:51pm
View
Fixed.
TRK3
8-May-12 18:28pm
View
And why do you insist on a 3 tier architecture for something that uploads images?
Is this project going to live long enough that you expect to change one of the layers and leave the other two in place?
TRK3
16-Apr-12 12:37pm
View
Looks like we are in very different time zones. I'd rather just keep the discussion here on CodeProject -- that way the solution is openly available to anyone else who has a similar question in the future.
Can you just update your question with the data I asked for, and then describe what you've tried so far and what specifically you don't understand how to do?
TRK3
16-Apr-12 12:30pm
View
Yeah, I always hate to leave something like that unexplained, but when you've read all the documentation and double checked your code and stepped through it the debugger, you are sort of left with the conclusion that there is a bug in the implementation or that the documentation is incomplete. Either way, you are stuck.
At that point, if the work around isn't horrific, then your better off not wasting any more time. Stick the comment in there and maybe at some point you'll run across something that explains the bug / lack-of-documentation.
TRK3
13-Apr-12 17:47pm
View
How big is your EMF file? How big is the resulting bitmap? And what sort of machine are you running this on?
If the file and bitmap are huge and the machine is slow, then 3-4 seconds might not be unreasonable.
That said, I'd suggest trying the same thing in native C++ using the Win32 GDI stuff directly and see if their is a significant speed difference. I would hope that their isn't much speed difference, but I could imagine all sorts of ways that the .NET graphics functions might have been implemented that would make them significantly slower than the native versions.
TRK3
13-Apr-12 17:25pm
View
Sounds pretty odd. What exactly is p_Panel? Is it a standard microsoft class, or some class you wrote?
It could be that VerticalScroll is just a .NET wrapper for a Win32 scrollbar and what happens when you set the value is that a message gets posted to the scrollbar -- so that the update doesn't actually occur when you do the set, but whenever the scrollbar processes it's message queue.
I've run into something similar before in a third party control I was using and I ended up just setting the value twice since I wasn't able to debug what was happening in the control and setting it twice didn't seem to do any harm... (If you do that, be sure to put a big comment in the code explaining why you are doing it.)
TRK3
13-Apr-12 17:11pm
View
Can you clarify your question? What exactly is it that you want to watch? The actual pc display??? And what do you what is it that you are looking for?
TRK3
13-Apr-12 17:09pm
View
Your kidding right? TorstenH. answered your last question:
http://www.codeproject.com/Questions/365023/MS-WORD-FILE-TO-TEXT-FORMAT-RUNTIME
with a link to the apache.org POI site. He even told you to use the menu on the left hand side of that site to answer your questions. There is a link there to download the package from, and the page tells you what link to go to to determine what needs to be included to do what.
Your reputation as a questioner is dropping very fast at this site. We are more than happy to help, but we expect you to do some work yourself.
TRK3
13-Apr-12 17:01pm
View
Update your question with a sample line or two from the "spool" file and what you'd like that data to look like in the ".csv" file.
As far as doing it in C# -- you'll probably use Console.ReadLine() to read in a line from the standard input, reformat that line in some way, and write it out to the standard ouput via Console.WriteLine(). Do that in a console based application, and you'll have something that works like tail.
TRK3
12-Apr-12 16:16pm
View
Please clarify your question.
If I read your question correctly, you have a website that is hosted by some hosting service which is also providing you with e-mail hosting.
Do you just want to access that e-mail account? (Then typically you just need to configure an email client to point to it -- most email clients will walk you throug it.)
Or do you want to add something to your website that permits customers to send you email?
The simplest way to do that is to add a link using the mailto:
scheme -- which works in most siturations as long as the user has an email client configured. There are more sophisticated ways to do it, but if you just provide the mailto: with your email address in a readable format, the user can contact you one way or the other. The downside of that is that webcrawlers could harvest that email and spam it, so you'll want a good spam filter on that email address, otherwise you'll want to go with a more sophisticated system with captcha's etc...
TRK3
12-Apr-12 15:23pm
View
The term "spool file" doesn't mean anything useful in this context.
A spool file is just a file that acts as a buffer between the output of one device or piece of software and another device or piece of software.
The format of the spool file is whatever format the output/input of the two things requires.
What is it that is being spooled? What is the format of that data?
What problem are you running into?
TRK3
12-Apr-12 14:35pm
View
Don't post a question here and say "it doesn't work" -- you won't get much help that way.
Describe exactly what happens. If you get an error message, then tell us what the error message is. If you get an unexpected behavior then tell us what behavior you were expecting and what you actually got.
The code fragment by itself isn't enough for anyone to tell what's wrong (unless there is an obvious syntax error in the code -- in which case there should be an error message that points to it).
TRK3
19-Mar-12 18:09pm
View
I'm still not clear on what you are asking.
If the two original circles just spin in place, then the original points of contact simply describe two circles when they spin.
When you say the "relative motion" of the two points, what is it you are the plotting? A two dimmensional plot of distance vs time?
Or are you plotting the position (distance and angular displacement)of one in the frame of reference of the other (irrespective of time)?
In either case, Jack Dingler's solution is a good way to go about it and relatively easy.
Is that what you are looking for?
TRK3
16-Mar-12 18:09pm
View
What exactly are you trying to do? And what have you attempted?
It's not clear what you mean when you say "generate a set of curves"...
Mathematically that would mean write down an equation.
To a graphic designer that would mean draw a curve on the screen.
Which do you want? And it what language / graphics system? Specifying both C++ and Javascript makes you sound like you have no idea what you are doing.
Also, you say "...WITHOUT any orbiting/translational movement. They will simply spin in place.."
If there is no orbiting/translational movement with the circles just spinning in place, then there will only be one point of contact -- the original one -- and it won't move or describe any new curve.
Also, what is it that describes the curve? Not the point of contact.
I think you really mean that there is orbital and translational movement (which you still haven't specified exactly in your description) and the curve you are trying to describe is the curve described by a specific point on the inner circle (NOT the point of continuous contact).
The very first thing you need to learn in programming is that you need to be able to clearly and precisely specify what it is that you are trying to program. If you can't do that, it's impossible to program -- or at least impossible to say that whatever you did program is correct.
TRK3
16-Mar-12 17:16pm
View
It sounds like you are changing several things at once when you are going from a loopback to a multicast and any one of them might be the problem:
1) You are changing from unicast to multicast.
2) You are changing from a local loopbak to over the network.
3) Are you changing ports as well?
There may be firewall and router issues with send a UDP multi-cast over the network.
First, take the code that works (sending a unicast loopback) and change the target address to the other machine (and nothing else) and see if that gets through. If it doesn't, turn off firewalls on both machines temporarily and try again. If that still doesn't work, try another machine that is physically located next to yours connected via a single hub (not a switch or router or anything that might have some intelligence in it).
Assuming you get that working, then go from the directed unicast to the multicast and see what happens.
When you've got it narrowed down to one change that is breaking the "ping" then you can figure out what's wrong with that one thing, or let us know and ask for more help.
TRK3
24-Feb-12 12:16pm
View
Do you have a specific POS device in mind? If so, you need to look at the technical details of it to determine what can be done. I don't think you can do it for POS devices in general -- the actual way you get the data is going to be at least somewhat device (or POS system) specific.
You need to survey the potential market and see what exists. You are targeting small retail chains that are using something more sophisticated than a cash register but don't already have a system like this in place.
I'm a bit skeptical if there really are many retailers that fall into that category. A small retailer that is going to have just cash registers -- your idea won't be able to work for them. A slightly bigger retailer who has invested in something more sophisticated than a cash register probably went with a more sophisticated system in order to collect some sort of data he was interested in (at a minimum, detailed inventory and sales data) -- so he's probably already got a bunch of data flowing from his POS terminals to some central database. If he wants to capture more data from his POS devices, he gets the system vendor to configure it to do that. If he wants better ananalytics on the data he's already got centralized then he either buys an option for that from the vendor, or he hires a consultant, or gets his staff IT guy to hack out some new reports.
So where does your idea fit in?
I'm not saying there is or isn't a market for what you want to do.
What I am saying is that you need to go find a potential customer who would actually buy or use something like what you have in mind and then see what his existing system is. What are his POS terminals? What data is already collected? If none, then is the POS device even capable of collecting and forwarding the data. If there is data collected, does it already go to a central database? If not, is that something that can be configured with the current system. Is all the data you envision already being collected? If not, can that be configured with the existing system? Is there a way to get the data out of the central database to do the kind of analytics you envision? Once you've actually surveyed potential customers and seen what they currently have, then you can start to figure out how some third-party add-on might fit into the system.
TRK3
22-Feb-12 18:24pm
View
It's not clear what you are asking.
It sounds like you are writing a scheduler for a real-time operating system. Is that correct?
Is this a homework assignment?
It's quite rare that anybody writes there own OS, unless you are building one for a small embedded system -- even then there are open source or proprietary options that are probably a better bet than writing it yourself.
TRK3
22-Feb-12 18:04pm
View
Great. Thanks!
TRK3
22-Feb-12 17:52pm
View
Yes, got my Bachelors and Masters there in '87. (Then moved back to California as fast as possible...)
I've always been very impressed with your comments and answers here -- I'm not at all surprised to you were involved in that sort of thing.
I agree with you on structured exception handling as a great invention. And, yes, she definitely deserved the Turing award.
TRK3
22-Feb-12 17:41pm
View
Interesting, I have never programmed ActionScript.
OP said "in actionscript it seems that you can't make accessors protected" -- so I incorrectly assumed the language lacked the concept.
In any case, my comments really were language agnostic.
You can and should do the right thing even if the language doesn't natively support it.
TRK3
22-Feb-12 17:35pm
View
I took two courses from her, an undergraduate course on OOP and a upper-level/graduate-level course on language design. She defintely shaped my thinking in both those areas. Not only is she a brilliant computer scientist, she is also an excellent teacher -- you don't always find both in one person.
TRK3
22-Feb-12 16:28pm
View
By "universal" do you mean something that would spell check any app?
In that case, is it the spell checking (dictionary, etc) that you are unsure of?
Or is it how to access the text in "any" app in order to check it?
Those are two very different problems -- and I'm sure there are plenty of people here who could help you with one or the other (if not both).
Or is there some other aspect of "how it's done" that you are unsure of?
TRK3
22-Feb-12 15:55pm
View
Here's an open source project that decodes various barcodes. It's got several different languages (none are python, but you should be able to follow the logic):
http://code.google.com/p/zxing/
When you do get a connection, download a copy of the source in whatever language you are most familiar with, and study it.
TRK3
21-Feb-12 12:53pm
View
Believe it or not, you don't have to do anything special at all. You can store pointer to functions in a static array, a dynamic array, or a smart array.
Here's a good reference:
http://www.parashift.com/c++-faq-lite/pointers-to-members.html
I think it should clear up most of your questions.
There is no issue with inheritance. If you declare a member function virtual, you can get a pointer to the virtual function of the base class and then use that pointer with a derived class and you'll get the derived class's virtual funciton definition.
TRK3
17-Feb-12 17:31pm
View
I still don't see what the problem is.
You originally said threads were member functions of tasks.
In C++ a member function is compiled code whose life time is the life time of the program. A pointer to a member function points to that code and is valid forever. You can store those in a dynamic array or fixed array or anything. A function in C++ isn't an object, it isn't allocated on the heap or stack, it doesn't go away. When you get a pointer to a C++ function (or member function) (or even a virtual member function) that pointer will be exactly the same whenever you get it.
This differs from python in that a function is an object. It's actually code plus the scope that the code is to execute in, each function object is different because it potentially has different scope.
Do actually just want to store a C++ function pointer, or do you want to store a function pointer plus some dynamic data?
TRK3
17-Feb-12 16:14pm
View
There's nothing wrong with using your reference counted pointers for all that kind of game data -- in fact in makes perfect sense.
It just isn't clear to me that it makes sense to do the same for your taks functions.
Really, the problem is that in python there are certain ways you do things. And in C++ you would do those things differently.
You run into problems when you try to write python code in C++ or C++ code in python. (It's not that you can't do it, it's just that you end up having to jump through hoops to do it.)
If you really want to get cute about it, you could just download the source for CPython and call that your game engine (It's written in C++, so that satisfies your teacher's requirement.). Then you just write your "game scripts" in python and run them on your game engine... (Of course, if the whole point of the exercise is to teach you C++ then it kind of defeats the purpose.)
TRK3
17-Feb-12 14:19pm
View
Deleted
Thanks for the clarification.
1) What's the problem with having the threads have a pointer to their parent task? (I'm talking about a C++ pointer here, not a reference counted smart-pointer that creates a circular reference.)
2) Why reference counted pointers at all? Aren't threads pretty much only referenced from Tasks, and aren't Tasks just referenced from your main loop that owns the list of Tasks? If that's the case you should be able to explicitly manage the life cycle just fine.
When you are coding in C++, use the idioms of C++. You don't need reference counted pointers and you don't need garbage collection for this problem. Trying to use those things is actually causing you problems.
TRK3
17-Feb-12 14:18pm
View
Thanks for the clarification.
1) What's wrong with threads having a pointer to their respective parent tasks? It's a pretty common thing to do. Are you worried about circular references with your reference counted pointers?
2) Why do you need to use reference counted pointers for the task and threads? Seems pretty unlikely that these objects are being passed around willy-nilly. Don't you have complete control over their life cycle and where they are being referenced?
Seems the problem is that you are causing yourself all kinds of headeaches because you are coming from a garbage collected environment and you've never developed the necessary habits/discipline to program in a non-GC environment.
This problem really doesn't need GC or reference counted smart pointers.
TRK3
16-Feb-12 20:10pm
View
Please improve the question:
(1) Your two python code snippets appear to be exactly the same, so...???
(2) Are the "threads" you are talking about here, actually system threads, or (as your code seems to imply) are they actually just functions that get called once per loop?
(2) What are you actually asking? Your C++ code snippet doesn't actually demonstrate a problem or issue. How is "Mode" defined?
TRK3
14-Feb-12 14:42pm
View
Did you compile and run it? One of the best ways to learn is to compile your code and then run it. Use the debugger and set a break point on the code you care about and then step through and see what happens.
I'm not familiar with changing button color in WPF, but assuming that you can do that by changing .Fill and .Stroke, you have problem with your BlueGreenBoxColorChangeBtn_OnClick event handler.
Each time it's clicked it is calling both the Btn1 and Btn2 functions, so that when it's done, it's always blue. (And I'm pretty sure the button doesn't actually get repainted until after you return from your event handler.)
What you want to do is set a member variable to remember what color the button is, and then call only one of the two functions. If the button is currently blue, then call the function that changes it to green (and change your member variable to green), etc.
TRK3
9-Feb-12 20:10pm
View
Good question. Very weird.
My first instinct is maybe there some horrible garbage collection going on. Try referencing something in cofd after you call sw.Stop() -- just to make sure it doesn't get GC'd until later.
I work mostly with unmanaged C++ and I have found that the CFileDialog does a lot of work.
For one thing, on my system (Win7 Pro), it throws an exception every time you open it "First-chance exception at 0x75bab9bc (KernelBase.dll) in MyApp.exe: 0x000006BA: The RPC server is unavailable." (It gets caught somewhere before it gets to my code, but it's a little jarring when your debugger breaks on an exception deep in the bowels of MS code every time you open a file dialog.)
Maybe on your system the "RPC Server" is actually available, so instead of throwing an exception and skipping all the remote stuff it actually does something remote over the network when it's opening the dialog. In which case it might also do something remote over the network when closing it (at which point all bets are off if your network is slow or the remote server is overloaded or down). That 5 second lag sounds supiciously like the sort of lag I see sometimes trying to access a DCOM application on another computer over the network -- of course in that case I know that the lag is related to the remote procedure call.
TRK3
2-Feb-12 13:37pm
View
Regex won't actually speed it up. In fact, it is much more likely to make it worse on a long file if you have a * in your regex.
Fundamentally, any algorithm would have to read in the file and scan through it character by character. That's exactly what you are doing.
Regex would potentially be worse if it has to backtrack and try different possible partial matches.
If you want to speed it up on a long file then:
(a) make sure your algorigthm is O(N). That is, you are only scanning through the file once and you aren't doing something silly like having to rescan from the beginning to find the next character.
Pay strict attention to what your intermediate data structures are [i.e. array vs. list vs. string] and how you are accessing them. In particular, beware of using something like a string for your temp buffer. A string potentially gets re-allocated and copied every time you append another character to it. Without your being aware of it your algorithm is suddenly O(N^2), which will definitely kill your performance on a long file.
(b) After that profile your code and find out where you are spending the most time.
The problem would be much simpler if you wrote this program in plain old C rather than C#. The problem doesn't require all the fancy advantages of a garbage collected object oriented language, and all those advantages add overhead that you normally don't thing about, but kill your performance in a case like this. In C, none of that overhead is hidden from you, you know exactly where and when it occurs because you have to do it explicitly.
TRK3
1-Feb-12 14:25pm
View
Deleted
Why do you insist on using regex to solve this problem?
You can do exactly what you want and do so more clearly by writing code to scan through the file and look for open-braces, closed-braces and semi-colons.
(Also, by doing it that way you can deal with the case where there is an extra closed-brace.)
TRK3
20-Jan-12 18:18pm
View
Where is the CRC being calculated and reported as erroneous?
Is this a high-level CRC check being done in the manage code? Or is it a low level CRC check being done in the driver?
The USB protocol itself has CRC checks built in. A USB transmission is supposed to be retried if the CRC fails (execpt isochronous connections which drop the packet), so if you are getting data from the USB link layer, it should have been transmitted error free.
Incidentally, is this an Atmel serial-USB bridge? I've got an application that talks to one of those that works just fine on 32 bit and 64 bit platforms (unmanaged C++).
TRK3
20-Jan-12 17:45pm
View
Great. I highly recommend the original Kernighan & Richie "C" book if you haven't read it.
http://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628
The original C is so simple and concise that I find it far easier to do things using the basic tools of C then it is to go searching through vast new frameworks and libraries to find the thing that does it -- especially when it's something like this that really ought to be simple to do.
TRK3
20-Jan-12 17:40pm
View
Yeah. Oh well, I always like to dust of my K&R C...
TRK3
4-Jan-12 19:56pm
View
The problem might be in another part of the program or on the sending end.
The code you give here doesn't include how you are handling exiting the program (on this end or the other end).
Is the sending program exiting after sending the data? It could very well be that the two OS's handle cleaning up sockets differently on program termination. Or you might have a race condition where your Win7 machine processes the received packet before the sender finishes exiting, but it happens the other way around on XP.
On the receiver side, how are you terminating the program? Is there some XP / Win7 difference in whatever you are doing in the original thread to decide when to exit?
TRK3
4-Jan-12 19:34pm
View
It really depends on how many people need access to this data, how often, and how useful it is.
If the data is vital, I think you are going to have to figure out how to get it out of that obsolete format and into another program that isn't obsolete -- you'll need to do it eventually.
If it's not used very often or not all that vital, then there are various ways you can make it available (just on one machine that people have to walk over to to use, or login remotely to...).
TRK3
4-Jan-12 18:52pm
View
Is the goal to monitor an arbitrary program for which you only have the executable? Or is the goal to provide debugging facilities for a program that you are building?
If the latter, then you could write a debugging version of malloc() and free() that keeps track of whatever you want (as well as initializing allocated memory, or adding buffer on either end of each allocated block). You'd have to link your version of malloc() in ahead of the CRT. This could be done in a mostly platform independent manner.
If the former, then any solution is going to be very platform dependent.
TRK3
4-Jan-12 12:46pm
View
Absolutely right.
TRK3
3-Jan-12 14:02pm
View
I've played with AI alot. I studied it under Patrick Winston, and I helped develop one of the first commercially viable OCR programs.
A good definition of a "weak" password is: "one that is easily cracked".
"Easily cracked" is a matter of what methods a hacker is likely to use.
Assuming a site has correctly secured their passwords, the fastest methods of cracking a password are:
1. Find the piece of paper the person wrote the password down on.
2. Crack the non-existent security on some minor web site that makes you create a user name and password (and then stores it in plain text) and see if the person reused the password elsewhere.
3. Run through the list of most commonly used passwords.
4. Run through the dictionary.
5. ?
6. Brute force.
If a password isn't susceptible to methods 1 to 4, it's relatively strong.
After that, any other rules you enforce on a password actually makes a brute force attack easier.
If you want to apply AI to the problem, then the place to apply it is to intercept hacking attempts and find the patterns in those attempts.
TRK3
30-Dec-11 16:18pm
View
You might want to also post your question on the questions/comments section of the article you are referencing -- that way the original author will get notified of your question. He may be able to help you quicker than anyone else.
TRK3
30-Dec-11 16:10pm
View
Have you looked at this answer:
http://www.codeproject.com/Answers/167756/how-can-i-convert-a-colored-bitmap-image-to-graysc.aspx
There is a very good discussion there of various ways it can be done.
There is a naive method given by CDP1802 that is actually a very good place to start in undertanding what an image is and how it can be converted.
There is a more sophisticated answer by SAKyrukov that explains why the naive answer won't necessarily give you a satisfactory result.
There are two other answers that give you more efficient ways to do it.
If, after you've looked at all these answers you still need some help, then revise your question so that we can address whatever problem you are still running into.
TRK3
30-Dec-11 15:09pm
View
I briefly experimented with WCF's duplex service and ran into problems with both directions being blocked when one direction was waiting on a response. That was not desireable in my application.
At the time I couldn't see anyway around and went with two separate request-response pipes (one in each direction).
Maybe I was just configuring my WCF service wrong or doing something else wrong, but I found that rolling my own gave me better control of what I wanted to do.
TRK3
30-Dec-11 15:03pm
View
What is the exact problem you are trying to solve?
It's not at all clear that a neural network is the best technological choice for solving the problem unless you state the exact problem you want to solve.
A neural network requires that you train it on a training set. To have a training set you already have to have a list of "weak" and "strong" passwords -- which means you have already figured out a way to decide if something is "weak" or "strong". If you already have that, why do need to create a neural network to do it?
Unless this is a homework assignment?
What do you mean by "weak" and "strong" -- I am continually amazed at the number of websites that enforce arbitrary rules that constrain your choice of passwords to something they consider "strong" when all that really does is reduce the actual number of passwords you can select, thus making it easier to brute force attack the site.
In actual fact if the passwords are properly hashed and salted, the only "weak" password is a common password.
Checking for common passwords doesn't require a neural network.
TRK3
28-Dec-11 18:42pm
View
SAKryukov is correct. If it's done correctly you shouldn't be able to tell the difference between a virtual printer and a real printer.
In fact even under windows you can't always tell the difference. If the printer is on the network, it's port is an I/P address. I could write a network application that pretended to be a printer and you wouldn't be able to tell the difference. For that matter I could write a windows printer driver that had appeared to be on a local port but actually had no physical pringer connected. And physical printers can spool print jobs to disk or send them as faxes rather than printing them. Or conversely I could write a service that monitored the output directory of a virtual printer and whenever it saw a new pdf file there it sent it to a physical printer.
I think the most you can say is that under windows there are SOME simulated printers that you can detect by their port names some of the time.
On the MAC OS X, the situation is only going to be worse.
So what is the point?
(NOTE: As a user, if I have a virutal printer set up on my machine it's because I actually don't want to print certain things hardcopy, and I wouldn't want some program selectively prohibiting me from doing that.)
TRK3
18-Nov-11 21:55pm
View
Sorry about the misspelling. Thanks for fixing it.
TRK3
17-Nov-11 16:11pm
View
Nice reply.
TRK3
17-Nov-11 13:16pm
View
Yeah. You're right. It's way beyond what OP could reasonably attempt, but it sound like a very interesting problem to me if I just had the time to devote to it.
TRK3
16-Nov-11 19:31pm
View
I actually like your solution -- it's what I thought to recommend at first, but you still can't do it in standard C.
The only thing in the standard C runtime is getchar() -- which won't return until you hit enter in most environments.
Also, there is nothing in the C standard for creating separate threads -- it's going to be specific for the environment he is programming for.
It's probably simpler to figure out the non-blocking keyboard polling mechanism for the environment he is programming in than it is to figure out the threading library for that environment and set up the thread.
TRK3
16-Nov-11 19:22pm
View
I wouldn't say "beyond the contemporary level of computing". Have you see the iPhone app "Shazam"? It identifies songs on the radio by sampling them from the iPhone microphone.
It works well the few times I tried it -- so at least the problem of matching poor quality recordings against the original recording for current popular hits is not beyond the contemporary level of computing.
I don't know how it's done, but I suspect the audio is uploaded to a server farm, where some gross level approximation of the song (tempo, energy at frequency bands over time, etc.) is used as a sort of fingerprint of the recording that is compared against a database optimised for such a comparison.
And they give that app away for free and make their money by getting a small percentage on the songs you buy via the links they provide to buy them -- they are still in business so it least must be viable.
But I am sure they aren't giving away their algorithm to anybody who asks for it.
TRK3
16-Nov-11 18:30pm
View
What do you mean by equal??
If you mean they are exactly the same, then this code will do the job 99.999999% of the time:
bool IsEqual(audiofile1, audiofile2) { return false; }
It is practically impossible for one recording to be exactly the same as another.
What exactly are you trying to accomplish? Are you matching songs in a database? Or are you authenticating users by voice pattern? Or... ???
The answer to "equal" is different depending on your application. And no matter what your application is, the answer is going to be a fairly complicated algorithm that is probably the subject of lots of accademic papers. Don't expect to find C# source code to do it.
TRK3
16-Nov-11 18:24pm
View
njad1 -- C++ and Java have a lot of similarities.
You should be able to understand the basic flow of the program just by reading it. Where you run across a term you don't understand, look it up in a Java reference or google it. You'll get a lot better understanding of it that way (and learn enough Java so you can actually work with it) -- then if someone else does the work.
TRK3
16-Nov-11 18:21pm
View
There is nothing in the C standard for getting the state of the keyboard.
The C standard only specifies stdin as an input source. In most OS implementations, key presses are translated to characters and become available on stdin only after the user hits enter.
If it's acceptable to have the user hit enter to make something happen, then you can poll stdin without blocking by seeking to the end and seeing if the position changed:
pos = ftell(stdin);
fseek (stdin, 0, SEEK_END);
newpos = ftell (stdin);
If that's not acceptable, then your solution is going to be operating system / machine / framework dependent.
Tell us what environment you are working in and we can help you figure out how to do it.
TRK3
16-Nov-11 17:56pm
View
"ASCII value of a string" is kind of an odd concept.
But, if you define "ASCII value of a string" as "the sum of the ASCII values of each character in the string", then what you are asking is:
"Is there a faster way to add up N numbers than looping over the N numbers and adding them up?"
It is by definition an O(N) problem. There isn't a faster way, except to optimize the casting / conversion / etc.
If you do it in C/C++ or assembler, then the "convert to char array and type cast" steps are zero cost and you are left simply with add and loop, but it's still O(N).
TRK3
26-Sep-11 16:27pm
View
I don't think you are going to be able to do that.
I certainly would hope that Windows doesn't give you a way to do that. The whole point of UAC is to let the user know exactly what program is trying to do what -- the command line arguments to the program are vital data the user should have available in order to be able to make an informed decision about saying OK or not.
If you wrote both processes, you could pass the arguments in shared memory, in a file or via named pipes...
TRK3
14-Sep-11 17:25pm
View
It's probably easiest to convert from one generation to the next generation (2003 will probably convert easiest). If 2003 is good enough for what you need and you really don't need to do much maintenance, then go for that.
If you are going to have to be updating/fixing a lot of stuff then at some point it will be worth going through the hassle of porting it to later versions. It's kind of a trade off that you're going to have to make the decision on.
TRK3
14-Sep-11 16:54pm
View
What is the format of the data in the database? Are they all the same format or do they vary?
TRK3
13-Sep-11 20:45pm
View
The location is somewhere in a Microsoft core library. It doesn't really help you unless you can get a stack trace that shows you something related to your code.
Sometimes you can continue from an exception by hitting continue or single step. Usually you'll be prompted to "pass exception to program / don't pass exception to program" -- try single stepping or stepping out of the function and not passing the exception. Most of the time you just end up with more errors, but sometimes the program continues from there without error and you can step your way out to a point where the stack trace makes sense or you get some clue about what call caused the problem.
TRK3
13-Sep-11 20:17pm
View
SAKryukov's suggestion that the error could be coming implicitly from serialization might actually be the case.
Does your project use some framework that saves window positions or form data when the application is closed and then restore them on startup?
If so, and you changed something in the form or window layout, the de-serialization might be crashing because what's being de-serialized doesn't match the new code. Look for data being saved to the registry or a configuration file somewhere and delete that configuration file or those registry entries and try again.
TRK3
13-Sep-11 20:09pm
View
What does the title of your question "How to SHOWWINDOW..." have to do with your actual question?
What is the problem you are having?
Assuming:
(a) you fixed the conditional to be <= 0 instead of > 0
and
(b) timeStart is actually recorded during installation and saved somewhere and retrieved from there each time the program is run
it seems like your code would work fine.
TRK3
13-Sep-11 19:38pm
View
Is PCDoctor.exe the name of your program -- or is that something else in your system? If it's something else in your system, turn it off, disable it, or uninstall it and try again.
TRK3
13-Sep-11 14:04pm
View
I thought I posted a question on your other post. But it's gone now.
What are the two columns of times you posted? Is each line a different MP3 file with the results from GetDuration called twice in a row?
Is the first value always correct?
The problem may not be with the call itself but with something earlier. You'd need to post more of your code for us to see if it's something else you are doing.
If the same code works on other types of audio files, but just not on mp3 then I might suspect a bug in the DirectShow implementation for mp3's.
TRK3
12-Sep-11 17:10pm
View
Hi Ekypro, Could you post the code that generates that output? I am not actually sure what I am looking at or what's wrong with your code.
I assume the two columns are two different results from GetDuration using the same file. Is either number correct? Is the first column always correct?
TRK3
12-Sep-11 17:08pm
View
Hi, when you reply to somebodies comment, you should hit the reply button on the comment, rather than add a comment to your original question, that way the commenter gets an email notifying them that you replied.
Then I would have seen you'd answered and gotten back to you and you probably wouldn't have felt compelled to repost in order to get help. (Normally reposts are frowned upon.)
I'll take this question up on your other post.
TRK3
9-Sep-11 19:13pm
View
Another thing you might try is to look at what the preprocessor is generating. (If you right click on your project and select "Properties" and the go to "Configuration Properties -> C/C++ -> Preprocessor" and change "Generate Preprocessed File" to "Yes", it will create a file a file containing the preprocessor output -- basically the actual input to the compiler -- and you'll be able to see how that line is actually being expanded by the preprocessor and then the error will probablly be a lot clearer.)
TRK3
9-Sep-11 19:05pm
View
My best guess would be there is a preprocessor symbol defined somewhere in a way that's incompatible with the latest include files.
Can you post the contents of stadfx.h? (And if it references targetver.h -- then post those contents.)
In my test that worked fine the only thing that is defined in those files is:
#define __WIN32_WINNT 0x0600 // minimum platform is Windows Vista
It's not uncommon to have a bunch of things defined in stdafx.h that cause the compiler to skip including a bunch of stuff that isn't normally needed. It may be in your case you actually need it.
TRK3
9-Sep-11 17:44pm
View
Does this fail with any audio file format or just .mp3? Does it fail with all .mp3's? Or just one that you tried? How does it fail? Does the call return an error code? If it doesn't return an error, is the duration value consistent? What is the returned value?
TRK3
9-Sep-11 17:29pm
View
The code itself looks fine. I even pasted it into a new console app in VS2008 and it compiled fine. The problem must be in a header file and/or compiler command line switches. Works for me with:
/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /D "_AFXDLL" /Gm /EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp"Debug\test.pch" /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt
Does the compiler give you a file and line number for that error? Are you compiling with different switches than the above?
TRK3
9-Sep-11 15:05pm
View
The way I described isn't what is implemented. What's implemented is a non-rigorous attempt at "parsing".
I agree that if you can compose instead of parse, it's a lot cleaner, safer and provably correct.
But sometimes you do have to parse.
If you have to parse, then parse in a rigorous fashion with code that correctly parses only those patterns you expect and rejects those that you don't. And have a log of the things you reject so that you can improve your code later to handle them if they are actually valid.
The problem is that when most people "parse" they do some hack that handles the pattern they expect but doesn't reject all kinds of other patterns. So when they get input that isn't in the format they expect their code does wildly bad things instead of cleaning handling the exception.
I added my solution more as attempt to show how you should parse if you have to -- not necessarily as the best solution to the particular problem OP is trying to solve. (Maybe I should write my first article?)
TRK3
7-Sep-11 20:39pm
View
I see your point, but it depends on the exact requirements that OP has.
He's stuck with the industry "standard" description of tire sizes that is already in a database.
If he wants to only display the possible options based on what's in the database it seems he has to parse it.
If he wants to display all possible options -- then yeah, he doesn't need to parse anything.
But even then, once he's got the options the user selected he's going to need to go back and find if it matches something in the database.
Since the database is set up already, he's going to have to do some parsing somewhere. Maybe he does it offline and converts that ugly list into something he can use easily at runtime, but he still has to write the parser and run it at least once.
TRK3
7-Sep-11 19:28pm
View
What's the big objection to parsing?
Parsing is a well understood subject. Parsing done correctly is neither unreliable or unsupportable.
The problem is that people tend to write some obscure regex string splitter and say they have now "parsed" the data when in fact they have written some hack that isn't a parser at all and only sort of works.
The expectation is that there is some "tight" simple call you can make to something in a library or function that will do it for you. There isn't. To write a parser you have to understand and handle all the formats you expect to encouter and handle the exceptions. There is a clean way to do that, but it's not "tight".
TRK3
19-Aug-11 15:54pm
View
OK. Give it a try. Then if you run into specific problems with the project you can ask a new question about that (or if the project has a forum or method of containing the principal maintainers, you can ask the author of the code).
TRK3
19-Aug-11 14:33pm
View
Did you google OpenCV? There are plenty of links about it.
Why can't you use it? It has a BSD license, so there is not licensing restrictions.
If you found an Open Source project, why don't you download and build it as a first step.
If the project is active, you should be able to build it without too much trouble. You might have to install gcc and use that instead of VS, but you should still be able to do it without understanding the code at all.
Once you've got the code download and compiled, it should work without you having any understanding of it at all yet.
Then, one you've got a working example, you can look it over and figure out if you can just use it as is without understanding it, or if you need to borrow parts of it, or port it, or just use it as a reference for your own implementation.
You can always run the working code under a debugger and step through it to see what it is doing -- that's a very good way to learn about code that you can't otherwise understand.
TRK3
18-Aug-11 18:46pm
View
OK, now that you explained this is a fingerprint recognition application, I googled "fingerprint hong et al" and it seems to me that the algorithm you are attempting to describe isn't really the best current algorithm for this.
Why not just google "fingerprint recognition software open source".
It looks like there are at least a half dozen links to open source implementations of fingerprint recognition algorithms.
I suggest you take a look at those and download one.
If you can't find one in C#, then either port it to C#, or just use it as is. It's probably easier to figure out how to call C++ code from your C# application then it is to port a complex algorithm like that.
TRK3
18-Aug-11 17:12pm
View
You might want to explain why you think you want to do this, or what you are trying to accomplish by doing so.
Most of us read "paint continuously" and immediately think: "That's a bad idea."
TRK3
18-Aug-11 16:50pm
View
Are you calling MoveWindow after the dialog is created and displayed? Or are you calling it earlier? Basically, I am asking is there something else that's moving the window after you move it, but before it gets painted?
TRK3
17-Aug-11 20:44pm
View
Did you try Google?
I wasn't sure exactly what you were asking for, so I googled "variance of image" and got a number of links that included code.
Do you mean "variance" in the strictly mathematical sense, or something else?
I assume you are testing to see if two images are basically the same image, but what sort of variations do you want to tolerate before you call them different?
For example: What if it's the same image scaled down (or up) by 15%? Or what if it's the same image framed by something or shifted a few pixels? A simple variance algorithm will give tell you those are very different images. So if you want to catch those sort of similarities you are going to need something more sophisticated.
TRK3
17-Aug-11 13:39pm
View
Do need this for debugging on your machine?
Or are you trying to create a log file for post mortems in the field?
For debugging, you could try debugview:
http://technet.microsoft.com/en-us/sysinternals/bb896647
I haven't it used it myself, but it sounds like it will capture everything and you can specify filters to filter what it captures.
TRK3
16-Aug-11 17:42pm
View
This is a pretty complex subject.
If you google "comparing audio files" you'll get a lot of links to peoples attempts to handle this.
The odds of something you record "matching" something you compiled in earlier are pretty slim.
It is going to matter a lot what kind of audio you are trying to match up.
It's one thing to match a recording against the same recording as played over a radio and captured on a microphone.
It's an entirely different thing to try to match a live spoken word against a pre-recorded spoken word.
What are you trying to match?
TRK3
16-Aug-11 17:10pm
View
Did you try manually posting to the wall from somebody else's account?
Try that first -- that will tell you if you have the permissions set correctly on the wall.
Show More