|
ilostmyid2 wrote: i like to upload it like himself, but i don't know how.
Do you possibly mean that you want to write an article about? Write it, it would be welcome, I suppose.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
the resulting code is a matrix class which holds and may work with complex numbers instead of real numbers, as i said b4.
it's a good idea that others may have and use it too and also warn me about some mistakes if i had any. although i've tried not to change any part unless it's necessary, it's not unlikely that i've done mistakes or even the mister allen.
i like to upload it (the code), but i still don't know how!
regards
|
|
|
|
|
ilostmyid2 wrote: i like to upload it (the code), but i still don't know how!
Test well you code (you may possibly contact the author of the original article) and then write an article about (see 'Article->Submit An Article' menu item).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
ilostmyid2 wrote: i don't need it to be a template one
Shame that, 'cause otherwise I'd suggest std::complex[^] + Boost's UBLAS classes[^].
Still, I'm sure you've got a good reason not to use templates.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
i've said that i don't NEED it to use a template type for the elements, that's if it's not template, it's also acceptable if it uses complex for the elements.
i knew the complex class and had used it.
i couldn't find any code in the other link for inverting a matrix. i've not much time in understanding and remembering the basic concepts and writing the code based on them. i need a ready-to-use class.
modified on Saturday, April 18, 2009 10:47 PM
|
|
|
|
|
Google[^] is your friend[^]?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
How to create no active child window in MDI?
I create a child window in this way:
pWndTemplate->OpenDocumentFile(NULL);
How can I catch ShowWindow() to put SW_SHOWNOACTIVATE parameter? Is this a solution?
modified on Saturday, April 18, 2009 3:22 PM
|
|
|
|
|
I found one...
void CMyChildWndFrame::ActivateFrame(int nCmdShow)
{
nCmdShow = SW_SHOWNOACTIVATE;
CMDIChildWnd::ActivateFrame(nCmdShow);
}
|
|
|
|
|
Hi!
I have build a TCP DLL, and now I want to use it.
I have created all the typedefs for the function inside the DLL and now I want to use them with extern.
I added the DLL to my linker as an input but I get errors:
This is the code:
extern TCPLIB_RETRIEVE_N_BYTES_PTR tcplib_retrieve_n_bytes_ptr;
These are the errors:
Error 1 error C2146: syntax error : missing ';' before identifier 'tcplib_retrieve_n_bytes_ptr' d:\my_documents\visual studio 2008\projects\servertest\servertest\servertest.cpp 6 ServerTest
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int d:\my_documents\visual studio 2008\projects\servertest\servertest\servertest.cpp 6 ServerTest
What am I doing wrong here?
Is there another place to define the DLL in my project?
Thanks guys
modified on Saturday, April 18, 2009 12:56 PM
|
|
|
|
|
ytubis wrote:
Error 1 error C2146: syntax error : missing ';' before identifier 'tcplib_retrieve_n_bytes_ptr' d:\my_documents\visual studio 2008\projects\servertest\servertest\servertest.cpp 6 ServerTest
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int d:\my_documents\visual studio 2008\projects\servertest\servertest\servertest.cpp 6 ServerTest
That means that the compiler can't see the defintion of TCPLIB_RETRIEVE_N_BYTES_PTR - you need a definition of the type for the compiler to see. DLL's can't export type definitions, only functions and variables (and don't think that DLLs export classes as types - they don't, they export the class's methods).
ytubis wrote: I added the DLL to my linker as an input but I get errors:
You need to add the import library to the linker input, NOT the DLL.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you very much.
But let me understand:
I have created TCPlib.dll, this is the build for the library.
I add this dll to the new project where I try to extern the function pointers.
in the input linker I gave TCPlib.lib and another time TCPlib.dll
and I get that the project can not find them:
Error 1 fatal error LNK1104: cannot open file 'TCPlib.lib' ServerTest ServerTest
I have the dll in the library of the project and also attached to the project as an Item.
what am I doing wrong?
Thanks for your help
|
|
|
|
|
Unless the DLL project is in the same solution as the executable's project and you've added the DLL project as a dependency of the executable one, you also need to tell the linker what directory the library (that is, TCPlib.lib) is in.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I know here is NOT a suite forum to ask such a question; but I couldn't find any answer on the Internet.
Recently I can't browse any URL including the word "Microsoft" !!! I have two browsers: IE and Opera, both with the same problem. As soon as I click the "browse" button (go) or press "Enter" key, "Internet Explorer cannot display the webpage" (IE) or "Could not locate remote server" (Opera) is shown. Any idea?
Thank you masters!
|
|
|
|
|
The recent Confickr virus is said to block a list of sites, including Microsoft and all major antivirus vendors.
|
|
|
|
|
Does seem like that. For a good test, open a command prompt & ping microsoft
i.e "ping www.microsoft.com"
It should resolve to something like: 65.55.12.2491 - when I was affected by something last week, all addresses involving microsoft and many anti-virus vendors were being resolved to 127.0.0.1
I got around this by doing a dns lookup on www.microsoft.com, then substituting that ip for any part of the url that was www.microsoft.com (Same with avg and avira, etc)
e.g
I want www.microsft.com/downloads/somefile.zip
www.microsoft.com is being resolved to my loopback address, so I insert the ip that this should resolve to into the address bar --> 65.55.12.2491/downloads/somefile.zip
The problem lay in a registry key contained within
HKLM/Software/Microsoft/Windows NT/CurrentVersion/Winlogon it was UIShell, or something like that. (it was NOT UIHost, that is a neccessary entry)
The key points to an executable file that is run on start-up and proceeds to hide itself from directory searches, as well as hiding the registry key needed to remove it!
The solution? Use a program that uses direct registry access - The registry keys can't be hidden then since we're not using the wnidows api Registry calls that the virus has already hooked.
You should have a look for GMER - that's all I needed to access and repair the registry (make sure you get a new version from the author's website).
Oh, and btw - it wasn't conficker, dunno what it was - AVG reckons that the file is clean
|
|
|
|
|
Hello,
I have HL7 message. I want to parse it. I want only Patient Name from the segment Patient Identification(PID), then how can i get or retrieve this particular data field from the message segment?
|
|
|
|
|
From what I've seen (in the last five minutes, by Googling 'HL7' and 'HL7 PID' - you have heard of Google, I presume), each message segment is on a separate line. Each segment consists of fields separated by a '|' character. This page[^] defines the PID segment. This page[^] defines the data type of a person name.
So - you're looking for a line starting 'PID'. Now look through that line for '|' characters. The patient name is between the 5th and 6th '|'.
I'd probably use a regex, like:
^PID(\|[^|]*){4}\|([^|]+)\|.+$
so the patient name field ends up in match #2. With Boost.Regex, this looks like this (using an example message segment I found on the web):
boost::regex rePID("^PID(\\|[^|]*){4}\\|([^|]*)\\|.*$");
boost::smatch match;
if (boost::regex_match(std::string("PID||0493575^^^2^ID 1|454721||DOE^JOHN^^^^|DOPE^JOHN^^^^|19480203|M||B|254 E238ST^^EUCLID^OH^44123^USA||(216)731-4359|||M|NON|400003403~1129086|"),
match, rePID))
{
std::cout << match[2] << endl;
}
else
{
cerr << "No match" << endl;
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
in VC++, is there any boost::regex class or namespace?
sorry, but i am not getting what u r written.
|
|
|
|
|
Boost is a third-party set of libraries - see Boost[^] and Boost.Regex[^].
If you're using VC++ 2008, you should have regular expressions in std::tr1::regex[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
what it means:-
boost::regex rePID("^PID(\\|[^|]*){4}\\|([^|]*)\\|.*$");
and in if condition
if (boost::regex_match(std::string("PID||0493575^^^2^ID 1|454721||DOE^JOHN^^^^|DOPE^JOHN^^^^|19480203|M||B|254 E238ST^^EUCLID^OH^44123^USA||(216)731-4359|||M|NON|400003403~1129086|"),
match, rePID))
{
std::cout << match[2] << endl;
}
|
|
|
|
|
Abhijit D. Babar wrote: boost::regex rePID("^PID(\\|[^|]*){4}\\|([^|]*)\\|.*$");
That's declaring a regular expression object. I'm not even going to try explaining what regex syntax is - I presumed that as you used the word 'parse' you'd have some appreciation of regular expressions - have a look at some[^] regex[^] tutorials[^].
Abhijit D. Babar wrote: if (boost::regex_match(std::string("PID||0493575^^^2^ID 1|454721||DOE^JOHN^^^^|DOPE^JOHN^^^^|19480203|M||B|254 E238ST^^EUCLID^OH^44123^USA||(216)731-4359|||M|NON|400003403~1129086|"),
match, rePID))
{
std::cout << match[2] << endl;
}
Does the regex in rePID match the string I provided? If so, then the patient name is in the second regex capture, which can be accessed using match[2].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thanks for your reply.
This method works fine. Like this, instead of doing coding is there any free Toolkit which give directly the segment or data field user want? Because we can parse message as you show above, but it is very complex to make string for every data filed and in future if HL7 message format will change, we have to change our code syntax also. So if inbuilt parser or toolkit is available then i think work will be more simple.
Thanks in advance....
modified on Saturday, April 18, 2009 9:15 AM
|
|
|
|
|
Abhijit D. Babar wrote: This method works fine. Like this, instead of doing coding is there any free Toolkit which give directly the segment or data field user want?
I seem to remember mentioning Google[^] before...didn't sink in, did it.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello guys,
I want to split a string into substrings using strtok(). The code is
#include "stdafx.h"
#using <mscorlib.dll>
#include <iostream>
#include <string>
#include <stdio.h>
using namespace System;
using namespace std;
char str2list(char* str, char** list, const char* delimiters)
{
for (char c = 0; c < sizeof(list) / sizeof(char*); c++)
{
list[c] = strtok(str, delimiters);
if (list[c] == NULL) break;
}
return c;
}
int _tmain()
{
char** arglist;
arglist = new char*[16];
char* exmp = "I have a problem!";
str2list(exmp, arglist, " ");
for (char c = 0; c < sizeof(arglist) / sizeof(char*); c++)
{
cout << arglist[c] << endl;
}
delete[] arglist;
return 0;
}
</stdio.h></string></iostream></mscorlib.dll>
When I try to execute the program a runtime error occurs saying that there is a null-reference exception in the line list[c] = strtok(str, delimiters); . To ensure that there is enough free memory I even used the new operator.
Does anyone have an idea why this doesn't work?
Thanks and best wishes.
|
|
|
|
|
Austrian_Programmer wrote: When I try to execute the program a runtime error occurs saying that there is a null-reference exception in the line list[c] = strtok(str, delimiters);. To ensure that there is enough free memory I even used the new operator.
That's because (although exmp is a char* ), it's pointing at a string stored in read-only memory (string literals are read-only). strtok needs to write to it. It can't, so you get a runtime exception. Change
char* exmp = "I have a problem!";
to
char exmp[] = "I have a problem!";
and the crash goes away, because now you've allocated a read/write character array and initialised it from the (read-only) string literal.
There are many other issues as well, however:
- Look at the
strtok documentation[^] - you only pass in str on the first call to strtok for that string - the rest of the time, you pass in NULL . - The loop condition in
str2list is all wrong. list is a char** , so sizeof(list)/sizeof(char*) will be equal to 1. If you want to be safe with respect to the size of list , you need to explicitly pass it in - C/C++ doesn't pass around array sizes with arrays. - Similarly, the loop condition in _tmain is wrong (although this problem goes away if you take note of the next point).
- There's no point using
new when you have a fixed array size - declaring arglist with char* arglist[16]; will work just as well. - I'm...interested that you use
char as the type of the loop variables - Although the for loop in
str2list may compile with the compiler you're using, it won't with VS2008 (and possibly won't with earlier compilers), and isn't compliant with the C++ standard - going by the standard, your loop variable isn't accessible outside the loop. - You return the number of tokens in the list from
str2list ...and then don't use it. Mmmmm.
Anyway - here's my fixed (I think) version of your code.
#include <iostream>
#include <string.h>
using namespace std;
int str2list(char* str, char** list, int maxTokenCount, const char* delimiters)
{
for (int c = 0; c<maxtokencount;> {
list[c] = strtok(str, delimiters);
if (list[c] == NULL) return c;
str = 0;
}
}
int main()
{
char* arglist[16] = {0};
char exmp[] = "I have a problem!";
const int numToks = str2list(exmp, arglist, 16, " ");
for (int c = 0; c < numToks; c++)
{
cout << arglist[c] << endl;
}
return 0;
}
[edit]Just for laughs, I did a version using STL and C++ classes, for those of us who like type-safety and nice things like that. It is special cased for the situation where the separator is a space (you can alter that by playing with locales and facets, but that's an exercise for the reader), but anyway.
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;
vector<string> split(string const& exmp)
{
istringstream s(exmp);
return vector<string>(istream_iterator<string>(s), istream_iterator<string>());
}
int main()
{
string exmp = "I have a problem!";
const vector<string> toks = split(exmp);
copy(toks.begin(), toks.end(), ostream_iterator<string>(cout, "\n"));
return 0;
} [/edit]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
modified on Saturday, April 18, 2009 11:11 AM
|
|
|
|
|