|
Google does not rely and "typical" word search as could expect. It involves a lot of linear matrix computation, model reduction and eigen value computation.
Jonathan de Halleux.
|
|
|
|
|
By string, I assume you mean a chunk pointed to by char* ?
--
Berlin rules.
|
|
|
|
|
Jörgen Sigvardsson wrote:
By string, I assume you mean a chunk pointed to by char*?
Yes. Or an stl string.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Argh. I was looking for the same functionaly a couple of years ago. I found a grep-function written in C which handled simple grep expressions. But it seems I cannot find it again.
--
Berlin rules.
|
|
|
|
|
I've got a full reg exp engine which I use in ED (see sig) but re's don't do things like "and" or "near". I can write code to build a "search engine" using my RE code, but if there is something already around then that may save me some time and provide a better solution. Also RE's are overkill for this.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
The favorite algorithm for multi-string searches is Aho-Corasick. You can find it here and here.
Books that discuss AC (with source) are:
Practical Algorithms in C++
Bryan Flamig
0471009555
and
Practical Algorithms for Programmers
$35.99
Andrew Binstock, John Rex
020163208X
code download: http://www.pacificdataworks.com/pub/code.zip (msrch.c)
Best wishes,
Hans
|
|
|
|
|
Hi Hans,
Thanks, looks like some interesting reading to do. Can't recall hearing about Aho-Corasick before.
Are you using ac.c, kwset.c or msrch.c and if so have you found any one better than the others for some specific use?
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi Neville,
I am looking at using something like kwset.c or msrch.c for a commercial search product I am working on. I am still trying (and looking for) different implementations, so I haven't decided yet.
One thing that has to be decided up front is whether to do full boolean search, or just allow simple "or" search of multiple strings. Right now I am leaning toward simple "or" search, because it is easily understood by user. I have visited some web sites where they offer a boolean search, but most of them do not perform correctly, and there is little consistency.
You also have to think about how often the more obscure boolean features will be used - and, not, near, etc. (I have given up trying these, even when they are available, because of incorrect results from poor implementations.) Also, what does it mean to ask for "code and not review" in the context of a whole file? On the other hand, I admit that "code near review" would be useful, if implemented correctly. One of the things I intend to do is look at various implementations, and see if it is possible to retrieve some kind of "word distance".
Bibliographic searches are usually not offered in text editors. In very large files, it would be quite useful to search for "code", save the search results (the line hits), and then do a subsearch for "review" on those lines.
And then be able to go back to a previous subsearch, and start again from there. This would give the equivalent of "and" search.
Please let me know of anything interesting you find.
Best wishes,
Hans
|
|
|
|
|
Hi Hans,
Hans Dietrich wrote:
Also, what does it mean to ask for "code and not review" in the context of a whole file?
I don't have any problem with "and not" and would find it very usefull on occasion. eg. "compiler and not free" would exclude all free compilers.
Hans Dietrich wrote:
In very large files, it would be quite useful to search for "code", save the search results (the line hits), and then do a subsearch for "review" on those lines.
And then be able to go back to a previous subsearch, and start again from there. This would give the equivalent of "and" search.
The todo list for ED (see sig) includes a request to search within the Find in Files results.
Hans Dietrich wrote:
Please let me know of anything interesting you find.
Here are some links I found yesterday.
http://www.dtsearch.com/PLF_engine.html[^]
http://www.gnu.org/software/mifluz/description.en.html[^]
http://www.cis.ru/~ata/search1.HTM[^]
Download is missing and I've emailed the author.
http://www.lextek.com/onix/[^]
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi There!
How to read office file (word, excel) without giving password ?
Thanks
Jason Chang
tmsnhien@yahoo.com
|
|
|
|
|
I want to use SetupDiGetDeviceInterfaceDetail() API. This function retrieves detailed information about a specified device interface. The definition of function is:
BOOL SetupDiGetDeviceInterfaceDetail(
HDEVINFO DeviceInfoSet,
PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
PSP_DEVICE_INTERFACE_DETAIL_DATA DeviceInterfaceDetailData,
DWORD DeviceInterfaceDetailDataSize,
PDWORD RequiredSize,
PSP_DEVINFO_DATA DeviceInfoData);
As you see, one of arguments is DeviceInterfaceDetailData. the definition of structure is as below:
typedef struct _SP_DEVICE_INTERFACE_DETAIL_DATA
{
DWORD cbSize;
TCHAR DevicePath[ANYSIZE_ARRAY];
} SP_DEVICE_INTERFACE_DETAIL_DATA, *PSP_DEVICE_INTERFACE_DETAIL_DATA;
DevicePath is member variable of this structure (An array of TCHAR ). ANYSIZE_ARRAY defined as 1. in other hand:
#define ANYSIZE_ARRAY 1 //winnt.h
According to MSDN:
Using the SetupDiGetDeviceInterfaceDetail() function to get details about an interface is typically a two-step process:
1- Get the required buffer size. Call SetupDiGetDeviceInterfaceDetail() with a NULL DeviceInterfaceDetailData pointer, a DeviceInterfaceDetailDataSize of zero, and a valid RequiredSize variable. In response to such a call, this function fails, GetLastError() returns ERROR_INSUFFICIENT_BUFFER , and the RequiredSize parameter receives the required buffer size.
2- Allocate an appropriately sized buffer and call the function again to get the interface details.
Now, my question is, how can I allocate memory for DevicePath member variable of that structure? You know that DevicePath defined as an array not a pointer.
Thanks,
A. Riazi
|
|
|
|
|
I want to automate to solve this problem.
Read all of texts in MSO file (word, excel), change them to unicode and replace them.
But after change, I dont know how to replace. Because I use SetText(LPCTSTR text). But I want to put BYTE array (unicode code).
Thanks
Thanks
Jason Chang
tmsnhien@yahoo.com
|
|
|
|
|
Hi
1. How to retrieve shape object in excel, get text in them and their own font.
2. How to get chart object. Their text and font
Thanks
Thanks
Jason Chang
tmsnhien@yahoo.com
|
|
|
|
|
Hallo!
I intend to develop a learning software, in which I want to play some Videos. I want to compress the videos, and my question is, where can I get a free codec, which I can distribute with the software to guarantee the playbach of the video?
Or is it allowed to deliver the installation-pack of a new Version of Windows Media Player with my software, so the user can install this, he have automatically the mpeg4 codec, so I use this.
Has anyone an Idea? Thanks for help, and sorry for my lousy english.
Regards, Friedemann
|
|
|
|
|
STOP. Use the WMA 9.0 codec. It is the best video compressor on the market. You are allowed to redistribute Media Player 9--see the microsoft web site.
|
|
|
|
|
Scenario: Interrop:
(a).NET C# library packaged into a COM server
(b) COM server used in a C++ WIN32 console app that supports ATL.
Hi, I have wrapped up a simple C# managed class library with:
1. RegAsm.exe
2. gacutil - to install the signed assembly into GAC.
I successfully installed the assembly into GAC and created the tlb file with RegAsm. But I'm having trouble using it from my WIN32 console app.
The C# class is like this:
namespace ManagedCLib
{
public __gc class CSomeObj
{
public:
int MultiplyThis(int num1, int num2) { return num1*num2; }
public:
CSomeObj() { m_nID=0; }
__property int get_nID()
{
return m_nID;
}
__property void set_nID(int value)
{
m_nID=value;
}
protected:
int m_nID;
};
}
Very simple right? After the C# class lib is compiled/installed into GAC/tlb created, I copied the tlb file to the client WIN32 app's directory. My simple client code looks like this:
#include "stdafx.h"
#import "managedclib.tlb" //Type library referenced (It's now in client's directory)
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL); //Initialize COM library.
USES_CONVERSION;
ManagedCLib::_CSomeObjPtr obj( __uuidof(ManagedCLib::_CSomeObjPtr)); //CRASH HERE! Before invoking any method??
return 0;
}
The application code crashed - just a. I presume a .NET class lib packaged into a COM server with RegAsm.exe is a "in-process server". But I have no idea how to debug this, any direction? Thanks.
norm
|
|
|
|
|
Try CoCreateIntance, check HRESULT...
Shouldn't you use?:
ManagedCLib::_CSomeObjPtr obj;
obj = obj.CreateInstance(__uuidof(ManagedCLib::_CSomeObjPtr));
...
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
if(!::CreateProcess(NULL, "F:\\software\\develop\\sometool.exe",NULL, NULL, false, 0, NULL, NULL, &si, &pi)){
AfxMessageBox(ShowError("CreateProcess"));
}
if(::WaitForInputIdle(pi.hProcess, INFINITE) == 0){
::GetGUIThreadInfo(pi.dwThreadId, &gui);
}
but it doesn't work, the parameter gui's content is 0 except the cbSize member
why?
|
|
|
|
|
|
could somebody please suggest a book for learning how the windows os stores resources from PE files in memory and how they relate to the opcode when the execution process starts?
I'm sure the resources aren't listed as some kind of data segment and I'm confused about how they fit into the execution of opcode when the opcode is loaded into memory from the execution start on a PE file.
I DO NOT want a book on PE file format, because I already have one. I really need something that explains the relationship between PE resources and the actual opcode of the PE file when the opcode is loaded into memory and the start address is loaded into the register and the whole process starts.
This relates to VC++ because I intend to use this information in a VC++6 project, thank you.
|
|
|
|
|
|
Hi,
I’m new to MFC and need some help on it. Here are the topics on which I need help:
1. How to add different colors and images to the individual elements in the Tree Control? Code snippets would be great.
2. How to make right-click pop-up menu and how to write handlers for menu selection? Any pointer/tutorial/code would be awesome.
3. How to make my own dialog menu and write handlers for the menu selection? Tutorial or, code would be appreciated.
Thanks in advance MFC-Gurus,
Binayak
|
|
|
|
|
|
I use com to work with excel form c;
With the aid of the classwizard i've generatad a class MySeriescollection
//doing something in excel
MySeriesCollection mySeriesCollectionObj;
IDispatchPtr seriesCollectionDispatchPtr = pXL->ActiveChart->SeriesCollection();
seriesCollectionDispatchPtr.AddRef();
mySeriesCollectionObj.AttachDispatch(seriesCollectionDispatchPtr);
//working with mySeriesCollectionObj
mySeriesCollectionObj.DetachDispatch();
seriesCollectionDispatchPtr.Release();
My Problem is that after working with excel there is still a process in the taskmanager.
The reason is seriesCollectionDispatchPtr.AddRef();
If I work without the Class MySeriesCollection it works an the process is killed at the end.
seemed to be that mySeriesCollectionObj.DetachDispatch(); ist not enough
What have I to do that the process is killed in the end .There musst be some rest in the memory that forces the process to keep alive and i know that it is seriesCollectionDispatchPtr.AddRef(); that causes the problem
Any Ideas?
Thx Heiko
//mySeriesCollection Class
LPDISPATCH MySeriesCollection::GetApplication()
{
LPDISPATCH result;
InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
return result;
}
long MySeriesCollection::GetCreator()
{
long result;
InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
LPDISPATCH MySeriesCollection::GetParent()
{
LPDISPATCH result;
InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
return result;
}
LPDISPATCH MySeriesCollection::Add(const VARIANT& Source, long Rowcol, const VARIANT& SeriesLabels, const VARIANT& CategoryLabels, const VARIANT& Replace)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_VARIANT VTS_I4 VTS_VARIANT VTS_VARIANT VTS_VARIANT;
InvokeHelper(0xb5, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
&Source, Rowcol, &SeriesLabels, &CategoryLabels, &Replace);
return result;
}
long MySeriesCollection::GetCount()
{
long result;
InvokeHelper(0x76, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
VARIANT MySeriesCollection::Extend(const VARIANT& Source, const VARIANT& Rowcol, const VARIANT& CategoryLabels)
{
VARIANT result;
static BYTE parms[] =
VTS_VARIANT VTS_VARIANT VTS_VARIANT;
InvokeHelper(0xe3, DISPATCH_METHOD, VT_VARIANT, (void*)&result, parms,
&Source, &Rowcol, &CategoryLabels);
return result;
}
LPDISPATCH MySeriesCollection::Item(const VARIANT& Index)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_VARIANT;
InvokeHelper(0xaa, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
&Index);
return result;
}
LPUNKNOWN MySeriesCollection::_NewEnum()
{
LPUNKNOWN result;
InvokeHelper(0xfffffffc, DISPATCH_METHOD, VT_UNKNOWN, (void*)&result, NULL);
return result;
}
VARIANT MySeriesCollection::Paste(long Rowcol, const VARIANT& SeriesLabels, const VARIANT& CategoryLabels, const VARIANT& Replace, const VARIANT& NewSeries)
{
VARIANT result;
static BYTE parms[] =
VTS_I4 VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT;
InvokeHelper(0xd3, DISPATCH_METHOD, VT_VARIANT, (void*)&result, parms,
Rowcol, &SeriesLabels, &CategoryLabels, &Replace, &NewSeries);
return result;
}
LPDISPATCH MySeriesCollection::NewSeries()
{
LPDISPATCH result;
InvokeHelper(0x45d, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, NULL);
return result;
}
|
|
|
|
|
If you are correctly releasing your interfaces then the application object UserControl flag is probably the cause.
See Q238987
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q238/9/87.asp&NoWebContent=1
Q192348 may be of interest as well
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/KB/Articles/Q192/3/48.asp&NoWebContent=1
SYMPTOMS
The Office application you are automating continues to reside in memory after your Visual C++ program finishes executing.
CAUSE
Most likely the application is still in memory because you have forgotten to release an acquired interface.
RESOLUTION
Here are some general suggestions and things to looks for when trying to determine the cause of the problem:
If you're using #import, it is very likely you could be running into one of the reference-counting bugs associated with it. Often times the bugs can be worked around, but usually it is preferred to use one of the other Automation methods. #import doesn't work very well with the Office applications because its type libraries and use are fairly complex. Also, such reference counting problems are hard to track down because a lot of the interface-level COM calls are behind-the-scenes when using #import.
Check to see if you are calling any methods that return an IDispatch * (LPDISPATCH), such as Open or New, and ignoring the return value. If you are, then you are abandoning this returned interface and will need to change your code so that you release it when no longer needed.
Gradually comment out sections of your code until the problem disappears, then add it back judiciously to track down where the problem starts.
Note that some applications will stay running if the user has "touched" the application. If this occurs while you are automating, then the application will probably stay running afterwards. The Office applications have a "UserControl" property on the Application object that you can read/write to change this behavior.
Also, some applications will decide to stay running if enough user-interface "action" has occurred. If you intend for the application to exit, then call its Quit() method on the Application object. Word will shutdown regardless of its reference count when Quit is called. This isn't expected COM behavior. Excel, however, will properly just hide itself but stay running until all outstanding interfaces are released. In general, you should release all outstanding references, and only call Quit() if you intend the application to quit.
|
|
|
|
|