Application Not Responding while doing a long task
Moderator: Rathinagiri
Application Not Responding while doing a long task
Hi,
I found that application is not responding (and it says so in Windows Task Manager) when it is doing a long task in a WHILE loop, E.g., converting a large dbf table to MySql.
Is there any solution for it?
Am I asking for Multi-threading!!!
TIA.
With best regards.
Sudip
I found that application is not responding (and it says so in Windows Task Manager) when it is doing a long task in a WHILE loop, E.g., converting a large dbf table to MySql.
Is there any solution for it?
Am I asking for Multi-threading!!!
TIA.
With best regards.
Sudip
With best regards,
Sudip
Sudip
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Application Not Responding while doing a long task
Hi Sudip
Please add a DO EVENTS command into your loop.
I hope that this will solve your problem.
As far as I know works on Multi-threading continues ( almost finished) in Harbour. Probably will be included in next release.
Regards
--
Esgici
Please add a DO EVENTS command into your loop.
I hope that this will solve your problem.
As far as I know works on Multi-threading continues ( almost finished) in Harbour. Probably will be included in next release.
Regards
--
Esgici
Viva INTERNATIONAL HMG
Re: Application Not Responding while doing a long task
Hi Esgici,
I wish if I can learn everyday something like this!!!
BTW, do you have any idea how to use incremental search in combobox. viewtopic.php?f=5&t=404
With best regards.
Sudip
Thanks a lot! My problem is solved!!! (No multithreading required )esgici wrote: Please add a DO EVENTS command into your loop.
I hope that this will solve your problem.
As far as I know works on Multi-threading continues ( almost finished) in Harbour. Probably will be included in next release.
I wish if I can learn everyday something like this!!!
BTW, do you have any idea how to use incremental search in combobox. viewtopic.php?f=5&t=404
With best regards.
Sudip
With best regards,
Sudip
Sudip
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Application Not Responding while doing a long task
Hi
Unfortunately, until now I can't achieve any good result
I hope I'll open soon at least one to forum discussion.
Regards
--
Esgici
I have MANY ideas on incremental searchsudip wrote:... do you have any idea how to use incremental search in combobox.
Unfortunately, until now I can't achieve any good result
I hope I'll open soon at least one to forum discussion.
Regards
--
Esgici
Viva INTERNATIONAL HMG
Re: Application Not Responding while doing a long task
Please do it ASAP.esgici wrote: I hope I'll open soon at least one to forum discussion.
I am waiting for it.
With best regards.
Sudip
With best regards,
Sudip
Sudip
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Application Not Responding while doing a long task
I usually solve that, with an OnChange procedure that takes value from edit control of the combo and search inside combo with a loop across all elements.sudip wrote:
BTW, do you have any idea how to use incremental search in combobox. viewtopic.php?f=5&t=404
Regards,
Roberto.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
-
- Posts: 140
- Joined: Tue Mar 03, 2009 8:59 am
Re: Application Not Responding while doing a long task
Hi Esgici
I have the same problem in processing a file with about 55,000 records.
The HMG apps appear to be hanging but it is actually working but does not dispaly the progress bar as expected
This is even after adding DO EVENTS as follows :-
//--------------------------------------------------------------------------
STATIC FUNCTION ProcessCounter( hMeter, hText, hDlg, cMsg)
//--------------------------------------------------------------------------
MEMVAR Group_Exp, Index_1
MEMVAR lAdv_Header, Rept_Width, Pg_Ct,lDblSpace
MEMVAR sTot_Counter, nMain_Counter, Line, Most, Begin, PrnCounter,lSummary
memvar lMemoHeader,mDbfAlias //lh@02/11/02
LOCAL nRecNo
LOCAL nCount := 0
If Pg_Ct > 1
Line++
EndIf
DbGoTop()
WHILE !Eof()
If group_exp<>&index_1
GroupHead()
stot_counter:=0
EndIf
Loop()
stot_counter++
nMain_counter++
If Line >= MOST &&20
Line := BEGIN
Pg_Ct++
//lh 02/11/02
If lMemoHeader
HPrintMemo(1, &mDbfAlias->MEMOHEADER)
Else
Std_DispHead(rept_width,lAdv_Header)
EndIf
//lh@02/11/02 Std_DispHead(rept_width,lAdv_Header)
StdColHead()
EndIf // (Line=20)
prncounter++
nComplete := INT((prncounter/LASTREC()) * 100)
cComplete := LTRIM(STR(nComplete))
MainForm.Progress_1.Value := nComplete
MainForm.Label_001.Value := "Printing "+ ltrim(str(prncounter))+'/'+ltrim(str(lastrec()))+CHR(13)+ "Percentage completed "+cComplete + "%"
// 6/5/09
DO EVENTS
// 6/5/09
DbSkip()
ENDDO
Return nil // ProcessCounter()
Any help would be appreciated !
CCH
http://cch4clipper.blogspot.com
I have the same problem in processing a file with about 55,000 records.
The HMG apps appear to be hanging but it is actually working but does not dispaly the progress bar as expected
This is even after adding DO EVENTS as follows :-
//--------------------------------------------------------------------------
STATIC FUNCTION ProcessCounter( hMeter, hText, hDlg, cMsg)
//--------------------------------------------------------------------------
MEMVAR Group_Exp, Index_1
MEMVAR lAdv_Header, Rept_Width, Pg_Ct,lDblSpace
MEMVAR sTot_Counter, nMain_Counter, Line, Most, Begin, PrnCounter,lSummary
memvar lMemoHeader,mDbfAlias //lh@02/11/02
LOCAL nRecNo
LOCAL nCount := 0
If Pg_Ct > 1
Line++
EndIf
DbGoTop()
WHILE !Eof()
If group_exp<>&index_1
GroupHead()
stot_counter:=0
EndIf
Loop()
stot_counter++
nMain_counter++
If Line >= MOST &&20
Line := BEGIN
Pg_Ct++
//lh 02/11/02
If lMemoHeader
HPrintMemo(1, &mDbfAlias->MEMOHEADER)
Else
Std_DispHead(rept_width,lAdv_Header)
EndIf
//lh@02/11/02 Std_DispHead(rept_width,lAdv_Header)
StdColHead()
EndIf // (Line=20)
prncounter++
nComplete := INT((prncounter/LASTREC()) * 100)
cComplete := LTRIM(STR(nComplete))
MainForm.Progress_1.Value := nComplete
MainForm.Label_001.Value := "Printing "+ ltrim(str(prncounter))+'/'+ltrim(str(lastrec()))+CHR(13)+ "Percentage completed "+cComplete + "%"
// 6/5/09
DO EVENTS
// 6/5/09
DbSkip()
ENDDO
Return nil // ProcessCounter()
Any help would be appreciated !
CCH
http://cch4clipper.blogspot.com
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Application Not Responding while doing a long task
Hi CCH
Sorry, I can't understand the problem.
Because your code have many unknown things for me.
Only one point : Loop() function / procedure call line.
Although the () implied that is a UDF, the LOOP is a standard Clipper statement. If your Loop() line works as LOOP statement, lines between this and ENDDO newer will be executed. You are using keywords as identifier, such as BREAK. This isn't a good way and will be dangerous.
If possible, please send a problem concentrated code.
Regards
--
Esgici
Sorry, I can't understand the problem.
Because your code have many unknown things for me.
Only one point : Loop() function / procedure call line.
Although the () implied that is a UDF, the LOOP is a standard Clipper statement. If your Loop() line works as LOOP statement, lines between this and ENDDO newer will be executed. You are using keywords as identifier, such as BREAK. This isn't a good way and will be dangerous.
If possible, please send a problem concentrated code.
Regards
--
Esgici
Viva INTERNATIONAL HMG
Re: Application Not Responding while doing a long task
Hello CCH,
I just created an example to test the functionality of DO EVENT command (although previously I tested it along with a MySql project).
I tested it with a table containing 417,033 records without any problem. Perhaps this small sample will be helpful to you
Please compile the code and run with your table. And please send your comments about the result.
With best regards.
Sudip
I just created an example to test the functionality of DO EVENT command (although previously I tested it along with a MySql project).
I tested it with a table containing 417,033 records without any problem. Perhaps this small sample will be helpful to you
Code: Select all
#Include "MiniGui.ch"
Procedure Main()
private cDbf := "", cTable := ""
DEFINE WINDOW frmMain ;
AT 5,5 ;
WIDTH 640 ;
HEIGHT 480;
TITLE "Progress Bar Test" ;
MAIN ;
NOSIZE
@ 200, 100 button cmdSelectDbf caption "Select &Dbf" width 150 ;
on click SelectDbf()
@ 240, 100 label lblDbf value "" width 150
@ 280, 100 button cmdProcess caption "&Process Table" width 150 ;
on click ProcessDbf()
@ 350, 100 PROGRESSBAR pgbExport ;
VALUE 0 ;
RANGE 0 , 100 ;
WIDTH 300 ;
HEIGHT 26 ;
@ 400, 100 label lblRecord value "" autosize
DEFINE MAIN MENU
POPUP "&File"
Item "E&xit" action thiswindow.release()
end popup
END MENU
END WINDOW
frmMain.pgbExport.visible := .f.
CENTER WINDOW frmMain
ACTIVATE WINDOW frmMain
Return Nil
Function SelectDbf()
cDbf := alltrim(GetFile({{"DBF Files","*.dbf"}},"Select a dbf file",,.f.,.f.))
frmMain.lblDbf.caption := cDbf
if len(alltrim(cDbf)) > 0
if file(cDbf)
use &cDbf
lOpened := .t.
endif
endif
RETURN NIL
Function ProcessDbf()
if empty(cDbf)
MsgInfo("Please select a Dbf table")
frmMain.cmdSelectDbf.setfocus
return nil
endif
cTable := ALLTRIM(substr(cDbf,Rat('\',cDbf)+1))
cTable :=substr(cTable,1,len(cTable)-4)
frmMain.pgbExport.visible := .t.
select &cTable
go top
do while !eof()
do events
frmMain.pgbExport.value := recno()/reccount()*100
frmMain.lblRecord.value := ltrim(str(recno()))+"/"+ltrim(str(reccount()))
skip
enddo
frmMain.pgbExport.value := 0
frmMain.pgbExport.visible := .f.
return nil
With best regards.
Sudip
Last edited by sudip on Thu May 07, 2009 4:37 am, edited 1 time in total.
With best regards,
Sudip
Sudip
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Application Not Responding while doing a long task
Hi Sudip
Good sample, clean and easy to understanding code
Thank you.
Regards
--
Esgici
Good sample, clean and easy to understanding code
Thank you.
Regards
--
Esgici
Viva INTERNATIONAL HMG