|
I want to use Hindi in my multilingual application. So can anyone tell me that "Which one is the best font for Hindi language"?
thank you.
|
|
|
|
|
Please let me google that for you [^].
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]
|
|
|
|
|
I have done that already.
|
|
|
|
|
Fixedsys
|
|
|
|
|
There is no one 'best font' for any language. If you are writing an Unicode application, the Devnagari script would be displayed automatically (by default) with Mangal. You need not worry about fonts, if you are working on an Unicode aware application.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
When VC++ "LineTo" statement is called very often (say every 100 ms), it is using more resource and it is not getting released. If my application is running for longer period (say 2 hours), high usage of resource problem causing more RAM usage and memory is not getting released and growing continuously.
Sample code is given below (Please send your personal email id, so that I can email complete code)
//------------------------------------------------------------------
//Callback method creation (100 ms)
m_nEventID = timeSetEvent(100,0,GeneratePeriodicCall,DWORD(this),TIME_PERIODIC);
//callback method
void CALLBACK GeneratePeriodicCall(UINT uID, UINT UMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
CTestAppView* pView = (CTestAppView*) dwUser;
//kill thread if active
if(g_hDrawChartThread != INVALID_HANDLE_VALUE)
{
DWORD dwExitCode =NULL;
DWORD dw = NULL;
GetExitCodeThread(g_hDrawChartThread, &dwExitCode);
if(dwExitCode == STILL_ACTIVE)
{
::CloseHandle(g_hDrawChartThread);
g_hDrawChartThread = NULL;
}
else
{
g_hDrawChartThread = NULL;
}
}
//create thread
g_hDrawChartThread = CreateThread(NULL,0,DrawChart,pView,0,0);
}
//Thread call
DWORD __stdcall DrawChart(LPVOID lParam)
{
CTestAppView* pView = (CTestAppView*)lParam;
CClientDC dc(pView);
int nSaveDC = dc.SaveDC();
long x = 0;
long y = 0;
for(long i = 0 ; i < 100000 ;i++)
{
dc.MoveTo(x,y);
//THIS LINE IS CAUSING SERIOUS RESOURCE LEAK
dc.LineTo(x + 1, y + 1);
x = x + 1;
y = y + 1;
}
dc.RestoreDC(nSaveDC);
return 0;
}
//------------------------------------------------------------------
Anyone can clarify me why "LineTo()" is not releasing resources & utilising more RAM. This RAM memory is not getting released until unless I close my VC++ application.
Any solution/hint, welcome.
Thanks in advance,
Madhu
|
|
|
|
|
I don't know exactly why you encounter a memory leak, but one think that is sure is that you are doing it the wrong way: you should never access your user interface from a separate thread (which is what you are doing here). This is not the way to do it. Instead, in a separate thread, you can add data in a std::vector (for instance) which is protected against multi-threading access and then you send a message to the UI to refresh itself. The UI will then (in the main thread) extract information from the vector and draw the additional points.
I don't know if this will fix your problem but this is something you'll have to fix or you'll encounter problems in the future.
|
|
|
|
|
I don't think LineTo() causes high usage of resource&RAM. You are exactly doing it in wrong way.
Firstly, you need to understand the callback function of a timer in VC can be re-called while previous call is not completed yet. Basically, each callback will create a thread.
Secondly, I don't understand why you create a thread in the callback function, which will lead to run many threads at the same time.
So i think running many threads at the same time causes your problem.
If you want to update you UI, you can set a timer or a thread in your UI class which gets data and draw them on UI periodically. Meanwhile, there is another thead to prepare those drawing data.
Welcome to www.softwaretree.net!
This website is generated completely by static html pages transforming technology.
You can find many excellent audio/video tools there!
|
|
|
|
|
adepumadhu1 wrote: g_hDrawChartThread = CreateThread(NULL,0,DrawChart,pView,0,0);
Are you calling this function 10 times per second?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
The program is to keep records and perform statistical for a class of students.
the class may have up to 40 students. They have 5 quizzes, and all the students are identified by a 4 digit student number
and the program will print the students scores and calculate and print the statistics for each quiz
Student Quiz 1 Quiz 2 Quiz 3 Quiz 4 Quiz 5
1234 78 83 87 91 86
2134 67 77 84 82 79
3124 77 89 93 87 71
High Score 78 89 93 91 86
Low Score 67 77 84 82 71
Average 73.4 83.0 88.2 86.6 78.6
but this is what i have so far
#include<stdio.h>
#define ROW 4
#define COLS 5
int main(void)
{
// Local Declarations
int table [ROW] [COLS] =
{
{1234,52,7,100,78,34}'
{2134,90,36,90,77,30},
{3124,100,45,20,90,70},
{4532,11,17,81,32,77}
};
int line [ROW * COLS];
// Statments
for (int row = 0; row <ROWS;row++)
for (int column =0; column < cols, column++)
line[row * cols + column] = table [row] [column];
for (int row = 0; row <ROWS * cols; row++)
printf("%02d", line [row]);
return 0;
} // main
please help
modified on Thursday, April 30, 2009 1:56 AM
|
|
|
|
|
I don't want to reveal my age, but the last time I did a homework was 10 years ago.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Okay
and thanks for nothing
|
|
|
|
|
biggiant22000 wrote: please help
With what?
|
|
|
|
|
biggiant22000 wrote: #define COLS 5
There are 6 "columns" in the table array.
biggiant22000 wrote: int line [ROW * COLS];
This variable is not necessary.
biggiant22000 wrote: {1234,52,7,100,78,34}'
...
for (int row = 0; row < ROWS;row++)
for (int column =0; column < cols, column++)
line[row * cols + column] = table [row] [column];
How do these even compile?
With a little bit of coercion , your code could produce something like:
Student Quiz 1 Quiz 2 Quiz 3 Quiz 4 Quiz 5
------- ------ ------ ------ ------ ------
1234 52 7 100 78 34
2134 90 36 90 77 30
3124 100 45 20 90 70
4532 11 17 81 32 77
High Score 100 45 100 90 77
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Im still not understand im getting 42 errors
|
|
|
|
|
biggiant22000 wrote: Im still not understand
Which part?
biggiant22000 wrote: im getting 42 errors
Start with the first one.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi all,
I am having a c++ file which is used to create mexfunction DLL that can be used to call a function from Matlab through dll. This is used to compute some mathematical calculations on a big matirx and for this I do it in two parallel threads each doing half matrix. At the end I combine both to generate full resultant matrix. For this, I create two different threads as follows-
HANDLE thd_handle[2];
DWORD WINAPI GenerateThread0(LPVOID param);
DWORD WINAPI GenerateThread1(LPVOID param);
void CreateResult0();
void CreateResult1();
void mexFunction(...mex function params....)
{
thd_handle[0] = CreateThread(NULL,GenerateThread0, NULL, 0, NULL);
thd_handle[1] = CreateThread(NULL,GenerateThread1, NULL, 0, NULL);
WaitForMultipleObjects(2,thd_handle,true,INFINITE);
}
DWORD WINAPI GenerateThread0(LPVOID param)
{
CreateResult0();
return 0;
}
DWORD WINAPI GenerateThread1(LPVOID param)
{
CreateResult1();
return 0;
}
void CreateResult0()
{
}
void CreateResult1()
{
}
Everything is fine and good while doing as above and I used this for a long time without any problems. Now I am planning to make this more efficient by making it multithreading adaptable to the processor on which it runs. I have couple of systems which are like 4core/8core and would like to create threads dynamically. I came up with the following idea and implemented it and guess what it gives fatal errors while running and I highly suspect the way I am creating multiple threads.
HANDLE *thd_handle;
DWORD WINAPI GenerateThread(LPVOID param);
void CreateResult(unsigned int idx);
void mexFunction(...mexfunctionparams...)
{
thd_handle = new HANDLE[m_nThreads-1];
for (unsigned int i=0; i < m_nThreads-1; i++ )
thd_handle[i] = CreateThread(NULL, GenerateThread, &i, 0, NULL);
WaitForMultipleObjects(m_nThreads-1,thd_handle, true,infinite);
}
DWORD WINAPI GenerateThread(LPVOID param)
{
DWORD iter = *(DWORD*)param;
CreateResult(iter);
retrun 0;
}
void CreateResult(unsigned int idx)
{
}
if I use the dll generated from this code, the program crashes... am I doing something fundamentally wrong here?? is there any other better way to achieve this??
thanks for any help,
PKNT
|
|
|
|
|
Have you run it in a debugger (that's easy enough to do - just specify Matlab as the target executable) so you can see where the exception occurs?
Some things that do jump out at me:
- As it says in the CreateThread[^] documentation,
A thread in an executable that calls the C run-time library (CRT) should use the _beginthreadex and _endthreadex functions for thread management rather than CreateThread and ExitThread; this requires the use of the multi-threaded version of the CRT. If a thread created using CreateThread calls the CRT, the CRT may terminate the process in low-memory conditions. - You pass a pointer to a stack variable in the CreateThread call. That's not a great idea - you can't guarantee that the newly created thread will assign to iter before i changes. Why not just pass the value of i rather than the address. Even though the param is an LPVOID, integer is convertible to LPVOID and vice versa.
One other thing - why use m_nThreads-1 all over the place - once your main thread enters WaitForMultipleObjects, there will be m_nThreads cores available for processing, as the WaitForMultipleObjects call will yield the core it's on.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for the reply... will try VC++ specific thread functions and see how it does and also the parameters thing.
Stuart Dootson wrote: One other thing - why use m_nThreads-1 all over the place - once your main thread enters WaitForMultipleObjects, there will be m_nThreads cores available for processing, as the WaitForMultipleObjects call will yield the core it's on.
this is for the system to be responsive for other applications/tasks that are running at the same time. I am leaving a core for this purpose.
thanks
PKNT
|
|
|
|
|
Kiran Satish wrote: this is for the system to be responsive for other applications/tasks that are running at the same time. I am leaving a core for this purpose.
That shows remarkable restraint
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I figured out the problem... nothing from the way I am assigning threads (but now I am using _beginthread/_endthread functions though), but an overseen logic mistake and improper reading of 2D matrices from a 3D matrix generated using OptiVec library. Now everything works fine. Thanks for your time.
PKNT
|
|
|
|
|
Kiran Satish wrote: nothing from the way I am assigning threads (but now I am using _beginthread/_endthread functions though), but an overseen logic mistake and improper reading of 2D matrices from a 3D matrix generated using OptiVec library
Doh!
Kiran Satish wrote: Now everything works fine
Good
Kiran Satish wrote: Thanks for your time
My pleasure
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I was looking for a "i++" somewhere
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Sorry, I do have i++ in there...
PKNT
|
|
|
|
|
i didnt see it here: for (unsigned int i=0; i < m_nThreads-1; )
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|