|
How can I parse the html files into tokens using javascript, I don't want to use a third party parser, as I don't think Its a very big task. I actually need to create a token tree in javascript like:
<html>
<table>
<tr>
</tr>
</table>
</html>
http://www.priyank.in/
|
|
|
|
|
I suggest just switching to XML, which HTML is now officially a subset of.
It's not a very language and its extremely useful when holding information that would normally have to use a text parser to retreive info. There are many third party XML parsers for small or large projects, but since you don't want to use one it's pretty easy to write your own.
If you want help or more info about writing your own XML parser let me know email me, but as far as HTML goes I think you'll have to go the route of writing a text parser.
http://www.w3schools.com/xml/default.asp -- wealth of info on anything XML
j c0dex
j.d.aigner@gmail.com
|
|
|
|
|
I do understand the power of XML, but the project inputs are html web pages and I can't make xml as a web page standard
http://www.priyank.in/
|
|
|
|
|
That's very easy. Just parse the html file for '<' and '>' signs (take care at string within the tags!!!).
By the way, this is no javascript forum!
Don't try it, just do it!
|
|
|
|
|
I've got any existing program which I wrote a while back that I now need to modify so that when it uses the SendInput method to control the position of the mouse it uses 'relative' co-ordinates to move the mouse, whereas at present I'm using the Absolute flag to specify where it needs to be regardless of where the mouse pointer currently is.
I thought it would be a simple case of removing the absolute flag but this does not seem to work. What happens now it that whenever I specify a value it always jumps to the bottom right hand side of the screen (even if I only specify that the pointer moves two 'pixels').
Does anyone know what I am doing wrong and how to correct it?
TIA,
Andy
|
|
|
|
|
Hi all,
I'm tring to implement a clean, elegant plugin framework for MFC dialogs with explicit loading (unfortunately I have to use VC++ 6.0).
The COM-based, vtable approach proposed in
http://www.tweakbits.com/articles/dll/index.html
http://www.flipcode.com/articles/article_winplugins-pf.shtml
seems to be the most appealing one to me.
The code examples presented in these two links above (and my own quick hacks) work as expected with non-MFC classes and functions.
Unfortunately, if I expand the samples and integrate some MFC dialogs (I've used regular DLLs with shared MFC and thereafter extented MFC DLLs) the applications throws an assert if I create the new dialog class in the DLL.
(There's something I've messed up with MFC, CWinApp, AFX_MANAGE_STATE etc.)
So, I know there are some great tutorials on codeproject and codeguru which deal with MFC dialogs in DLLs and explicit (dynamic) loading and plugin frameworks, but none of them presented a combination of both..
Are there any other pointers or tutorials to example code which integrate MFC dialogs in DLLs in a nice and easy way (or can anyone post a small example here)?
Thanks and kind regards!
|
|
|
|
|
hello.
I want to know function name mediaplayer activex control call inside
when it open a media file.
(CreateFile?, open?, fopen?, OpenFile?)
when I try to API Hooking, what function should I hook?
If you know, let me know plz..
-------------------------------------------------
E-mail : multibox@naver.com
Homepage : www.cyworld.com/multibox
-------------------------------------------------
|
|
|
|
|
|
I tried but (CreateFile, OpenFile, open, fopen) function is not
mediaplayer call inside. T.T
-------------------------------------------------
E-mail : multibox@naver.com
Homepage : www.cyworld.com/multibox
-------------------------------------------------
|
|
|
|
|
I want to set background image for a dialog in MFC.... there is no direct way of doing it....I used some code to achieve this....but i have to compromise the quality of the picture.... can someone help me with a best solution??? Thanx in advance
Ashok Kumar
|
|
|
|
|
Does this help?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi,
In my MFC app, i create a socket , bind and accept incoming connections.
After i accept a incoming connection, i try to use recv() to get data.
But it fails.the error is 10057. what could be the problem..Pls help
Ram
|
|
|
|
|
A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied.
|
|
|
|
|
Are you sure you called recv for the right socket? The listening socket won't allow that!!
Don't try it, just do it!
|
|
|
|
|
Hi Friends,
How can find how many threads will my system allow me to create in the SUN Solaris Environment. is there any limit, how many threads can be created. Is there any way to find. Can any one of you guys help me on this.
Thank You
Cheers
sudharma.
|
|
|
|
|
|
Hay sorry guys,
its on Windows NT.
|
|
|
|
|
sudharma wrote:
its on Windows NT.
Oops! I thought M$ has a great achievement last night, they made Visual Studio cross compatable compiler as Borland. ;) And now I don't need to learn forte or borland.
http://www.priyank.in/
|
|
|
|
|
I've never heard of a way (and the question has been asked on several forums). The general response is "Does it matter?"
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hello,
Why would you like to know that? If you want to create that many threads, I can only advise you to find a way that uses less threads. The amount of time consumed by context switches will be huge and will greatly slow your program down!
I don't think that there is a fixed amount of how many threads a process can create. I think that the OS allows you to create as many threads as it has system resources. Assuming that, it is unwise to create all the threads you can. If you do that, the OS won't be able to create any more threads.
[EDIT]
If you really wan't to find out, you can always try the brute force approach:
<br />
unsigned int __stdcall YourThreadFunc(LPVOID lpVoid)<br />
{<br />
::Sleep(INFINITE);
return 0;<br />
}<br />
<br />
unsigned int CountMaxThreads()<br />
{<br />
unsigned int nThreadCounter = 0;<br />
<br />
std::vector<HANDLE> Threads;<br />
HANDLE hLastThreadCreated = NULL;<br />
unsigned int dwThreadID = 0;<br />
<br />
while( (hLastThreadCreated = (HANDLE*)_beginthreadex(NULL, 0, &YourThreadFunc, 0, 0, &dwThreadID)) != NULL )<br />
{<br />
Threads.push_back(hLastThreadCreated);<br />
nThreadCounter++; <br />
}<br />
<br />
for( std::vector<HANDLE>::iterator i = Threads.begin(); i != Threads.end(); i++ )<br />
{ ::TerminateThread(*i, 0); ::CloseHandle(*i); }<br />
<br />
return nThreadCounter;<br />
}<br />
<br />
[/EDIT]
I also got the blogging virus..[^]
|
|
|
|
|
Hello
I am using DirectX in order to render height maps.
As I have realy big maps, I can't render them in one time with DrawIndexedPrimitive because of hardware capabilities limitation (MaxVertexIndex).
So I decided to implement a linked list in which each element is composed by a vertex buffer and the corresponding index buffer.
This way, rendering my complex data is simple as I only have to cycle through the list and call "render" on each couple vertex/index buffer.
The list is created by stripping the map and a new element is created for each line of the map. This technique makes one line common between two following lines.
Now comes the problem. When I render the image, there is no problem. Ths issue appears when I modify the map heights. I have one function that changes only Z-coordinate in the vertex buffers so that the heights change.
But after this change, the render becomes incorrect : I observe gaps between rendered lines.
Example :
Static render :
XXX
XXX
XXX
Dynamic render
XXX
XXX
XXX
Actually the gap is small, but it's visible. I don't understand why two lines are not connected whereas the X and Y coordinates are the same!!!
I tested using the function that clears and fills the buffers instead of the one which only update z-coord and it works !!!
But I saw nothing really different in the two functions, except the fact that only 1 coordinate is set for the "update" version.
Thank you for your future help.
-= Marekh=-
|
|
|
|
|
Hi
I have been trying to write a dialog dll and have been having some real issues with it see (DLL and CTypedPrtList problem[^]). It seems to have moved away from my initial concerns of using CTypedPtrList in the DLL to a more general issue hence the new post.
I stripped the code down to the bare minimum removing all the interesting stuff and it still fails if I OK out of the dialog but not if I Cancel. To recap on the application.
void CTestApp::OnFileOpen() <br />
{<br />
CLantisPatientSelectDlg dlg;<br />
<br />
if(dlg.DoModal() == IDOK){<br />
m_nPatID1 = dlg.GetPatID1();<br />
}<br />
}
CLantisPatientSelectDlg is implemented in the DLL with exported constructors, DoModal() and GetPatID1() member functions.
void CLantisPatientSelectDlg::OnOK() <br />
{<br />
int nIndex;<br />
CPatientDetails *pPatientDetails;<br />
CListCtrl *pList = (CListCtrl *)GetDlgItem(IDC_PATIENTLIST);<br />
<br />
nIndex = pList->GetSelectionMark();<br />
if(nIndex != -1){<br />
} else {<br />
m_nSelectedPatID1 = -1;<br />
}<br />
<br />
m_bTerminateLoad = true;<br />
::WaitForSingleObject(m_hListLoadingThread,INFINITE);<br />
<br />
CDialog::OnOK();<br />
}<br />
<br />
void CLantisPatientSelectDlg::OnCancel() <br />
{<br />
m_bTerminateLoad = true;<br />
::WaitForSingleObject(m_hListLoadingThread,INFINITE);<br />
<br />
CDialog::OnCancel();<br />
}
Now I have done some debugging on this and it appears that when the program goes through the OnOK() function the line
m_nSelectedPatID1 = -1;
corrupts the "this" pointer of the CTestApp class such that when I get back into the OnFileOpen() function the m_nPatID1 = dlg.GetPatID1(); fails.
Looking at the memory allocation somehow the m_nSelectedPatID1 variable and the "this" pointer are using the same memory and hence setting the variable to -1 in the DLL gives a pointer which is nonsense.
Now why is this happening?
I am using two header files for the CLantisPatientSelectDlg. One for build the DLL which needs to know about all the internal stuff and another for building the application which only has the exported functions in it. Reasoning being that the users don't need to know all that internal stuff plus it means they also don't need to have other header files detailing the other classes that the dialog uses to hold it data etc.
So I have
CLantisPatientSelectDlg.h
class AFX_EXT_CLASS CLantisPatientSelectDlg : public CDialog<br />
{<br />
public:<br />
int GetPatID1();<br />
CLantisPatientSelectDlg(CWnd* pParent = NULL);
virtual ~CLantisPatientSelectDlg();
<br />
enum { IDD = IDD_SELECTPATDLG };<br />
<br />
<br />
public:<br />
virtual int DoModal();<br />
protected:<br />
virtual void DoDataExchange(CDataExchange* pDX);
<br />
protected:<br />
void DeletePatientList();<br />
int m_nSelectedPatID1;<br />
HANDLE m_hListLoadingThread;<br />
static UINT LoadList(LPVOID pParam);<br />
bool m_bTerminateLoad;<br />
<br />
virtual BOOL OnInitDialog();<br />
afx_msg void OnDblclkPatientlist(NMHDR* pNMHDR, LRESULT* pResult);<br />
virtual void OnOK();<br />
virtual void OnCancel();<br />
afx_msg void OnSortByName();<br />
afx_msg void OnSortByNum();<br />
afx_msg void OnShowAll();<br />
afx_msg void OnShowActive();<br />
afx_msg void OnShowOnTX();<br />
DECLARE_MESSAGE_MAP()<br />
};
and CLantisPatientSelectDlgInt.h
class AFX_EXT_CLASS CLantisPatientSelectDlg : public CDialog<br />
{<br />
public:<br />
int GetPatID1();<br />
CLantisPatientSelectDlg(CWnd* pParent = NULL);
<br />
public:<br />
virtual int DoModal();<br />
};
Now I played around with this this morning and I found that if I add a
protected:<br />
int m_nSelectedPatID1;
section to the second header file (ie the one for application builders to use) then the application works and both routes out of the dialog work and my "this" pointer doesn't get corrupted.
So have I answered my own question. I'm not sure
- I thought I could use different header files. Can I? If so how do I do it safely.
- why does the memory management go wrong. I have read something about the possibility of the system using two different memory managers that don't know what the other one is doing. How do I check this and what do I do to ensure it is not happening.
Can someone point me to a good guide about this type of DLL construction.
Many thanks and sorry for the long post. If you have got this far I appreciate your endurance.
Andrew Hoole
|
|
|
|
|
Ah - I see what happened now.
I ran into the same problem years ago. I wasn't intentionally using different headers but by mistake ended up doing something very similar.
I'm sure someone else can give you a more detailed explanation of this but the short story is that the address of your ID is off into a bogus area due to the multiple header files.
I think if you really need to be able to do this, you need to setup some dummy variables so that both of the headers represent a class with the same layout/size. I'm still not sure if it is going to work in that case but I do know from experience that using multiple headers holding different variables will cause big problems. Sorry I can't give more/better info.
|
|
|
|
|
Yeah I think I am going to have to use the same header file but when I tried it earlier I get compiler errors on the
enum { IDD = IDD_SELECTPATDLG };<br />
section of the header because that is declared in the resource.h file of the dll and not the resource.h file of the application.
Is it a problem if several of these IDs resolve to the same number?
I would have thought that the layout/size of the class would have been held in one of the compiled files that are used by the linker so something.
|
|
|
|
|
Ok I have now included the resource.h file in the CLantisPatientSelectDlg.h file and now the whole thing(including the important bits I had removed for debugging purposes) compiles and runs fine.
So now I just need to find out how I can use different header files without getting this trouble as it seems the only way to hide from the user all the mess of the implementation.
Thanks for all the help and comments so far.
Andrew Hoole
|
|
|
|