dev-cpp-users Mailing List for Dev-C++ (Page 365)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
| 2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
| 2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
| 2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
| 2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
| 2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
| 2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
| 2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
| 2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
| 2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
| 2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
| 2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Per W. <pw...@ia...> - 2003-06-19 14:13:37
|
The other use is basically the same. If the variable is updated by an interrupt routine, the main program must also declare the variable as volatile, to make sure that the compiler knows that the variable might change value outside of the control of the executing process/thread. /Per W On Thu, 19 Jun 2003, Zodiaq wrote: > Hello Louis and all Dev-C++ users, > > Thursday, June 19, 2003, 3:14:13 PM, Louis wrote as follows: > > LG> Can anyone explain the C keyword 'volatile' > LG> as in the statement: volatile int x; > > LG> What does this do to variable x ? when does one need to use it ? > > volatile is very interesting keyword - it does nothing to variable but > does something IMPORTANT to compiler optimization concering this > variable... and what it does? It turns OFF optimizations like checking > value of variable... normally variable value might be checked once in > a loop (if it does not change during the loop) at first use but with > volatile you force compiler to ALWAYS check it even if use it inside a loop... > where is this keyword mainly used?? Hmmm... from my point of view its > use is mainly useful in multithreaded application to check statesments > that other threads might set - in few of my apps main thread launches > child threads to do some work... this work is sometime very time > consuming, so if user decides to stop this thread main thread sets one > variable of child thread (lets say named Stopped) to true so its knows > to stop working... before it returns it makes memory cleanup - frees > memory used by thread... If I would just kill it (using > TerminateThread) I'd get memory leaks - memory that child thread > allocated isn't freed if it's stopped by TerminateThread... so child > just checks this Stopped variable in few places (in loops of course) > and if its value changes to true it knows to free memory and return... > without volatile on Stopped thanks to compiler optimisations this > child thread might never know that this value changed - child thread > did not change it so why to check its value so often??? volatile does > the job! I don't know about any other usages of volatile, but I'd > gladly hear about some... > > -- > regards, Zodiaq > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: INetU > Attention Web Developers & Consultants: Become An INetU Hosting Partner. > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: <a_g...@ya...> - 2003-06-19 14:10:08
|
I think that is the most important use. Really good answer. It is also used when working with shared memory between UNIX or UNIX like OSs. Another interesting use of this variable is in the OS VxWorks, which has a flat gobal memory architechture. All globals are by default shared between all 'tasks', and so volatile is used there quite efficiently Zodiaq <zo...@ac...> wrote: Hello Louis and all Dev-C++ users, Thursday, June 19, 2003, 3:14:13 PM, Louis wrote as follows: LG> Can anyone explain the C keyword 'volatile' LG> as in the statement: volatile int x; LG> What does this do to variable x ? when does one need to use it ? volatile is very interesting keyword - it does nothing to variable but does something IMPORTANT to compiler optimization concering this variable... and what it does? It turns OFF optimizations like checking value of variable... normally variable value might be checked once in a loop (if it does not change during the loop) at first use but with volatile you force compiler to ALWAYS check it even if use it inside a loop... where is this keyword mainly used?? Hmmm... from my point of view its use is mainly useful in multithreaded application to check statesments that other threads might set - in few of my apps main thread launches child threads to do some work... this work is sometime very time consuming, so if user decides to stop this thread main thread sets one variable of child thread (lets say named Stopped) to true so its knows to stop working... before it returns it makes memory cleanup - frees memory used by thread... If I would just kill it (using TerminateThread) I'd get memory leaks - memory that child thread allocated isn't freed if it's stopped by TerminateThread... so child just checks this Stopped variable in few places (in loops of course) and if its value changes to true it knows to free memory and return... without volatile on Stopped thanks to compiler optimisations this child thread might never know that this value changed - child thread did not change it so why to check its value so often??? volatile does the job! I don't know about any other usages of volatile, but I'd gladly hear about some... -- regards, Zodiaq ------------------------------------------------------- This SF.Net email is sponsored by: INetU Attention Web Developers & Consultants: Become An INetU Hosting Partner. Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users Thanx and Regards Avik Ghose SMS using the Yahoo! Messenger;Download latest version. |
|
From: Zodiaq <zo...@ac...> - 2003-06-19 13:41:38
|
Hello Louis and all Dev-C++ users, Thursday, June 19, 2003, 3:14:13 PM, Louis wrote as follows: LG> Can anyone explain the C keyword 'volatile' LG> as in the statement: volatile int x; LG> What does this do to variable x ? when does one need to use it ? volatile is very interesting keyword - it does nothing to variable but does something IMPORTANT to compiler optimization concering this variable... and what it does? It turns OFF optimizations like checking value of variable... normally variable value might be checked once in a loop (if it does not change during the loop) at first use but with volatile you force compiler to ALWAYS check it even if use it inside a loop... where is this keyword mainly used?? Hmmm... from my point of view its use is mainly useful in multithreaded application to check statesments that other threads might set - in few of my apps main thread launches child threads to do some work... this work is sometime very time consuming, so if user decides to stop this thread main thread sets one variable of child thread (lets say named Stopped) to true so its knows to stop working... before it returns it makes memory cleanup - frees memory used by thread... If I would just kill it (using TerminateThread) I'd get memory leaks - memory that child thread allocated isn't freed if it's stopped by TerminateThread... so child just checks this Stopped variable in few places (in loops of course) and if its value changes to true it knows to free memory and return... without volatile on Stopped thanks to compiler optimisations this child thread might never know that this value changed - child thread did not change it so why to check its value so often??? volatile does the job! I don't know about any other usages of volatile, but I'd gladly hear about some... -- regards, Zodiaq |
|
From: Ioannis V. <iv...@em...> - 2003-06-19 13:20:47
|
> -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Andr? Macario Barros > Sent: Thursday, June 19, 2003 6:55 AM > To: Dev-Cpp-Users > Subject: [Dev-C++] rand() question >=20 > My doubt: > Will my cout on line 13 print 1000 ***DIFFERENT*** numbers? I=20 > don=B4t think > so! No it will print 1000 random numbers some of which will be the same with some others. This is randomness. Ioannis Vranos =20 * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |
|
From: Ioannis V. <iv...@em...> - 2003-06-19 13:18:50
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Per Westermark > Sent: Thursday, June 19, 2003 3:51 AM > To: Ioannis Vranos > Cc: dev...@li... > Subject: RE: [Dev-C++] rand() > > > I'm not so sure about your definition of time(). > > time_t is a type - might be int, long, struct xx, ... depending on > implementation and processor register width etc. It's an intergal type. > However, without checking the latest c++ standard, time() > returns time in > seconds since epoch (seconds since 1969). In UNIXoids (probably in POSIX standard) yes, and if I recall correctly it is since january of 1970. However this is not required by the standard and if I recall correctly againn (which doesn't matter) this is not the case for Windows. > With a resolution of one second, it is definitely possible to > call time() > multiple times and get the same return value. Yes you are right. Well in such case (for subsequent calls in less than time_t) one can use a combination of time() and clock() etc). However one could make a thread to wait for a couple of time_ts if he has such considerations. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |
|
From: Louis G. <lg...@ya...> - 2003-06-19 13:14:13
|
Can anyone explain the C keyword 'volatile' as in the statement: volatile int x; What does this do to variable x ? when does one need to use it ? __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com |
|
From: Abhijit S. <mu...@gm...> - 2003-06-19 09:03:58
|
Greets, Per. > Note that rand()%x is not a good way of generating truly random numbers. > The pseudo-random numbers generated by most implementations of rand() have > bad randomness of the low bits. On Unix, you can use /dev/rand, which generates random bytes based on user action. But in case the user doesn't do anything, the call blocks. For a continuous supply, you can use /dev/urand. ________________________________________ Abhijit Shylanath http://mudeth.tripod.com/ |
|
From: Yeoh H. <ye...@ye...> - 2003-06-19 08:39:45
|
----- Original Message ----- From: Server Murat KO=C7UM To: dev...@li... Sent: Thursday, June 19, 2003 3:02 PM Subject: [Dev-C++] sql.h sqlext.h.... Hi, I am trying to get access to an oracle (or any other) db using sql.h, sqlext.h libraries but do not know how. Can someone please provide me pointers or source code to get insight into the topic. Thanks, Murat Hi Murat, Here's an extract of an article I posted on my website. <extract> FREE download: Using Microsoft Access Databases with Dev-C++ If you want to know how to use Microsoft Access databases using Dev-C++, then this example program could be useful. The example program shows you how to use ODBC API to connect to a Microso= ft Access database, show its table structure and list all records. This sour= ce code version does not require the end-user to set any DSN. You can download this example here: http://www.yeohhs.com/shareware/NoDSNCpp-V1.0.zip The project was compiled using Dev-C++ 4.9.8.0 (GCC 3.2). </extract> Regards, Yeoh -- P.S. There are more Free downloads for Dev-C++ users at: http://www.yeohhs.com/free/portal.asp |
|
From: Per W. <pw...@ia...> - 2003-06-19 07:09:07
|
No, your code would not work.
However, notice that you don't need 1000 random numbers. You want the
numbers 1-1000 with a random permutation.
Fill an array with the numbers 1-1000
Permutate the order of the elements.
for (i =3D 0; i < 1000; i++)
array[i] =3D i+1;
for (i =3D 0; i < 999; i++) {
// Swap ith element with a random element from the unsorted part.
n =3D rand()%(1000-n);
swap(array[i],array[i+n]);
}
Now the elements with be swapped a round but you are still guaranteed that
each element contains an unique value in the range 1-1000.
/Per W
On Thu, 19 Jun 2003, [iso-8859-1] Andr=E9 Mac=E1rio Barros wrote:
> Dear users,
>
> Regardless the intresting observations of bad randomness of the functi=
on
> rand(), I have a doubt too.
>
> Please consider the following piece of code:
> 1 -...
> 2- #include <iostream>
> 3 -#include <ctime>
> 4 -#include <cstdlib>
> 5 -...
> 6 -int main()
> 7 -{
> 8 - int a;
> 9 -
> 10 - srand(time(0));
> 11- for(int i=3D0; i<1000; i++)
> 12- {
> 13- cout << rand()%1000+1 << endl;
> 14- }
> 15- ...
> 16-}
>
> A)I use the argument of line 10 calling srand to make sure that the curre=
nt
> time
> gives me a safe different seed for srand;
> B)So, my command in line 13 will print 1000 numbers between 1 and 1000;
>
> My doubt:
> Will my cout on line 13 print 1000 ***DIFFERENT*** numbers? I don=B4t thi=
nk
> so!
>
> This is C++ code
>
> Regards
> Andre
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: INetU
> Attention Web Developers & Consultants: Become An INetU Hosting Partner.
> Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
> INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: <sm...@gu...> - 2003-06-19 07:00:28
|
Hi, I am trying to get access to an oracle (or any other) db using sql.h, = sqlext.h libraries but do not know how. Can someone please provide me pointers or source code to get insight = into the topic. Thanks, Murat |
|
From: <ro...@un...> - 2003-06-19 04:18:54
|
I have a little program that uses Winsock and CreateThread. It works but I can't debug. I tried to debug it manually and found the following error. D:\Proyecto\Atomo\Base\BaseNT>gdb basent GNU gdb 5.1.1 (mingw experimental) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you = are welcome to change it and/or distribute copies of it under certain = conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for = details. This GDB was configured as "mingw32"... (gdb) break 78 Breakpoint 1 at 0x401348: file main.cpp, line 78. (gdb) run Starting program: D:\Proyecto\Atomo\Base\BaseNT/basent.exe ntdll.dll: No such file or directory. Do you know what it means? How can I debug?=20 RockV ro...@un... |
|
From: <and...@su...> - 2003-06-19 03:55:10
|
Dear users,
Regardless the intresting observations of bad randomness of the function
rand(), I have a doubt too.
Please consider the following piece of code:
1 -...
2- #include <iostream>
3 -#include <ctime>
4 -#include <cstdlib>
5 -...
6 -int main()
7 -{
8 - int a;
9 -
10 - srand(time(0));
11- for(int i=0; i<1000; i++)
12- {
13- cout << rand()%1000+1 << endl;
14- }
15- ...
16-}
A)I use the argument of line 10 calling srand to make sure that the current
time
gives me a safe different seed for srand;
B)So, my command in line 13 will print 1000 numbers between 1 and 1000;
My doubt:
Will my cout on line 13 print 1000 ***DIFFERENT*** numbers? I don´t think
so!
This is C++ code
Regards
Andre
|
|
From: Per W. <pw...@ia...> - 2003-06-19 00:49:24
|
I'm not so sure about your definition of time(). time_t is a type - might be int, long, struct xx, ... depending on implementation and processor register width etc. However, without checking the latest c++ standard, time() returns time in seconds since epoch (seconds since 1969). With a resolution of one second, it is definitely possible to call time() multiple times and get the same return value. /Per W Yes, two calls to time() within the same second will retu On Thu, 19 Jun 2003, Ioannis Vranos wrote: > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf > > Of Sudhir K KRISHNAWARRIER > > Sent: Thursday, June 19, 2003 1:10 AM > > To: dev...@li... > > Subject: RE: [Dev-C++] rand() > > > > May be it is a little better to use the time in > > micro/milliseconds in some form as the seed instead of time > > (NULL) which returns seconds. This will make sure that two > > instances of the program started almost the same time will > > not get the same random number sequence. In SVR4/BSD, > > gettimeofday will do the trick but not sure what is the POSIX > > way of getting microseconds. > > > time() is not returning seconds it is returning time_t which can be whatever > the implementation wants. Two subsequent calls of time() cannot return the > same value since it represents the calendar time (day. month, year, hour, > minutes, seconds...). > > > > > > Ioannis Vranos > > * Programming pages: http://www.noicys.freeurl.com > * Alternative URL 1: http://run.to/noicys > * Alternative URL 2: http://www.noicys.cjb.net > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: INetU > Attention Web Developers & Consultants: Become An INetU Hosting Partner. > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Ioannis V. <iv...@em...> - 2003-06-19 00:00:21
|
> -----Original Message----- > From: Ioannis Vranos [mailto:iv...@em...] > Sent: Thursday, June 19, 2003 2:59 AM > To: 'dev...@li...' > Subject: RE: [Dev-C++] rand() > > > time() is not returning seconds it is returning time_t which > can be whatever the implementation wants. Two subsequent > calls of time() cannot return the same value since it > represents the calendar time (day. month, year, hour, > minutes, seconds...). ... with the exception of the case of error where (time_t)-1 is returned. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |
|
From: Ioannis V. <iv...@em...> - 2003-06-18 23:58:45
|
> -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Sudhir K KRISHNAWARRIER > Sent: Thursday, June 19, 2003 1:10 AM > To: dev...@li... > Subject: RE: [Dev-C++] rand() >=20 > May be it is a little better to use the time in=20 > micro/milliseconds in some form as the seed instead of time=20 > (NULL) which returns seconds. This will make sure that two=20 > instances of the program started almost the same time will=20 > not get the same random number sequence. In SVR4/BSD,=20 > gettimeofday will do the trick but not sure what is the POSIX=20 > way of getting microseconds. time() is not returning seconds it is returning time_t which can be = whatever the implementation wants. Two subsequent calls of time() cannot return = the same value since it represents the calendar time (day. month, year, = hour, minutes, seconds...). Ioannis Vranos =20 * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |
|
From: Shane B. <ast...@te...> - 2003-06-18 23:57:46
|
You are awesome, thank you. Even the first chapter, on processes has told
me more than 8 hours searching the web with various results that don't help.
These PDF's are definately good for anyone interested in advanced POSIX
standard programming.
That said, I would like to get a little feedback, from what I've read, to
see if I am understanding correctly how it works.
I'll use my real situation for an example. I have a process, which fork's
itself into a daemon type process already, very old code that has been
through 15 programmers and has ended in my hands to clean up and make more
efficient. Within the code, I will periodically delete an entire SQL table,
and reimport the data from a memory resident version, which will have
various updates, new records, deleted records, etc. Directly accessing the
database, with what optimizations I have put in, still takes approximately
21 seconds to handle just the smaller of two tables like this.
My solution to this, not knowing anything about multi-threading, was to try
threads. First, I thought it might be possible to thread off the main
process which may already be running fork'd as a daemon, to fork and wait
for a SIGCHLD to be raised, I see where my error in thinking was. Signals
are not used like a message pump, I didn't realize that, as such my idea was
flawed.
After reading a few pages of the process PDF, I came to a new conclusion,
and would like to see if I am correct.
When I start the program, it runs as normal, forks off, etc. When I need to
save the database, after I dump the import.sql file, I should fork(), and as
long as it returns > 0, use exec to transform the child copy of the big
program, and run another script or program which handles the importing soley
itself. As such, the main application should not need any database access
method.
Is this correct usage of forking? How do I know when the transform'd child
is done, if the original process continues processing? This is where I
thought SIGCHLD came into play, you would catch the signal and have the
process call wait() since it should be done, and ready to clean up more or
less instantly, right?
If someone has been through this process before, I'd appreciate an idea on
how to make sure the original process knows the thread dumping the database
is done. I will keep reading, there is a lot of advanced material here, but
hopefully someone can help with some simple little code snippet.
Thanks,
-Shane
p.s. This world of multi-threading... wow, I ignored IPC for such a long
time... big mistake.
This list rules, thanks for the help!
----- Original Message -----
From: "Abhijit Shylanath" <mu...@gm...>
To: "Shane Bryldt" <ast...@te...>; "C++"
<dev...@li...>
Sent: Tuesday, June 17, 2003 3:38 PM
Subject: RE: [Dev-C++] Threading in FreeBSD
>
> Greets, Shane.
>
> > foobar**24
>
> I don't know about FreeBSD, but there's a really good free E-book on Linux
> programming:
> http://www.advancedlinuxprogramming.com/
>
> Chapters 3, 4 and 5 should be of interest to you - they're about
processes,
> threads and interprocess communication respectively.
>
> The other chapters are pretty useful and interesting in their own right.
> HTH.
> ________________________________________
>
> Abhijit Shylanath
> http://mudeth.tripod.com/
>
>
|
|
From: Sudhir K K. <ks...@ly...> - 2003-06-18 22:38:53
|
> >Greets, Artificial Stupidity, I'm Real Happy (to meet you). > >> HI, does anyone know a good way to use rnd() to generate non-repeating >random numbers - in the area of about a thousand. > > rand()%1000; // Gives a number from 0 - 999 > >Also, at the beginning of the program, do > > srand(time(NULL)); > >This is to initialize (seed) the random number so that you get different >sequences everytime you run the program. May be it is a little better to use the time in micro/milliseconds in some form as the seed instead of time (NULL) which returns seconds. This will make sure that two instances of the program started almost the same time will not get the same random number sequence. In SVR4/BSD, gettimeofday will do the trick but not sure what is the POSIX way of getting microseconds. Sudhir > >HTH. >________________________________________ > >Abhijit Shylanath >http://mudeth.tripod.com/ > > > >------------------------------------------------------- >This SF.Net email is sponsored by: INetU >Attention Web Developers & Consultants: Become An INetU Hosting Partner. >Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! >INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > ____________________________________________________________ Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail! http://login.mail.lycos.com/r/referral?aid=27005 |
|
From: Per W. <pw...@ia...> - 2003-06-18 21:47:37
|
Note that rand()%x is not a good way of generating truly random numbers. The pseudo-random numbers generated by most implementations of rand() have bad randomness of the low bits. There are a lot of cryptographic libraries with good random number generators. /Per W On Thu, 19 Jun 2003, Abhijit Shylanath wrote: > > Greets, Artificial Stupidity, I'm Real Happy (to meet you). > > > HI, does anyone know a good way to use rnd() to generate non-repeating > random numbers - in the area of about a thousand. > > rand()%1000; // Gives a number from 0 - 999 > > Also, at the beginning of the program, do > > srand(time(NULL)); > > This is to initialize (seed) the random number so that you get different > sequences everytime you run the program. > > HTH. > ________________________________________ > > Abhijit Shylanath > http://mudeth.tripod.com/ > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: INetU > Attention Web Developers & Consultants: Become An INetU Hosting Partner. > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Abhijit S. <mu...@gm...> - 2003-06-18 20:37:02
|
Greets, Artificial Stupidity, I'm Real Happy (to meet you). > HI, does anyone know a good way to use rnd() to generate non-repeating random numbers - in the area of about a thousand. rand()%1000; // Gives a number from 0 - 999 Also, at the beginning of the program, do srand(time(NULL)); This is to initialize (seed) the random number so that you get different sequences everytime you run the program. HTH. ________________________________________ Abhijit Shylanath http://mudeth.tripod.com/ |
|
From: Artifiial S. <can...@ya...> - 2003-06-18 19:31:35
|
HI, does anyone know a good way to use rnd() to generate non-repeating = random numbers - in the area of about a thousand. |
|
From: <cl...@te...> - 2003-06-18 19:26:27
|
Hello. Dev-C++ supports MMX assembler instructions in '__asm__ __volatile__'?? thk. |
|
From: Sudhir K K. <ks...@ly...> - 2003-06-18 15:15:52
|
Hi, I was trying to compile information on how to make a phonetic IME (Input Method Editor) for one of the Indic languages in windows with pure Win32 APIs. That's when I came across Dev-CPP and I loved it. I looked in to imm.h which essentially has many IMM related functions. MSDN do not give sufficient info on IME development using pure Win32 APIs but they mix it up with afxwin.h etc from MFC. I am trying to write this purely using Dev-cpp but unable to gather sufficient info. Could anyone throw some pointer to building IMEs using Win32 only? Are there resources reg. this in open source world? Pardon me if this question is outside the scope of this list. Regards, Sudhir ____________________________________________________________ Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail! http://login.mail.lycos.com/r/referral?aid=27005 |
|
From: Vlada D. <dj...@im...> - 2003-06-18 12:22:14
|
Hi, everybody.
I've been trying to make a program that opens a bitmap file, reads it's
BITMAPINFOHEADER and RGBQUAD parts, and puts them in BITMAPINFO structure. I
managed to read the first header part, but I'm having problems with RGBQUAD.
When I comment out this part, the program works fine, but when I uncomment
it, the program just exits without any warning message. Here's the code:
-----------------------------------------------------------
{LPTSTR szFileName=TEXT("bitmapa.bmp");
HANDLE
hFile=CreateFile(szFileName,GENERIC_READ,0,NULL,OPEN_EXISTING, //open file
for reading
FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile==INVALID_HANDLE_VALUE)
MessageBox(hwnd,"Error","Can't open file",MB_OK);
else
MessageBox(hwnd,"FileOpen sucess","Success",MB_OK);
BITMAPINFO bmpInfo;
DWORD btCount;
SetFilePointer(hFile,sizeof(BITMAPFILEHEADER),NULL,FILE_BEGIN);
//set pointer to begining of the file
ReadFile(hFile,&(bmpInfo.bmiHeader),sizeof(BITMAPINFOHEADER),&btCount,NULL);
//read BITMAPINFOHEADER to bmpInfo;
ReadFile(hFile,&(bmpInfo.bmiColors),sizeof(RGBQUAD)*(2^bmpInfo.bmiHeader.biB
itCount),&btCount,NULL);//read RGBQUAD to bmpInfo
LPTSTR szOutput;
sprintf(szOutput,"width=%i,height=%i",(int)bmpInfo.bmiHeader.biWidth,(int)bm
pInfo.bmiHeader.biHeight);
MessageBox(hwnd,szOutput,"Result",MB_OK);
CloseHandle(hFile);}
---------------------------------------
I hope you guys can tell me what's wrong and is this the right way to do
this. Thanks
------------
Vlada
|
|
From: Neszt T. <ne...@ss...> - 2003-06-18 10:40:38
|
Hello! I know, there were many questions and answers regarding wxwindows using with dev-c++, but I'm still in trouble without solution. I decided to try to solve again. I downloaded the newest version of wxwindows (2.4.1). Atfer half an our I knew, I failed again. Than I found the fantastic webpage: http://www.wxwindows.org/devcpp.htm In the dev-C++ 4 section there are a lot of links which is not works, for example, ftp://biolpc22.york.ac.uk/pub/ports/mingw32/extra.zip So, I tried to do that step by step, but I couldn't. And what is the error message? At this point of time this: In file included from C:\DEV-C_~1\Include\wx\memory.h:20, from C:\DEV-C_~1\Include\wx\object.h:25, from C:\DEV-C_~1\Include\wx\wx.h:16, from d:\work\programming\wx1\controls\controls1.cpp:23: C:\DEV-C_~1\Include\wx\string.h:164: #error "Please define string case-insensitive compare for your OS/compiler" In file included from C:\DEV-C_~1\Include\wx\checklst.h:34, from C:\DEV-C_~1\Include\wx\wx.h:55, from d:\work\programming\wx1\controls\controls1.cpp:23: C:\DEV-C_~1\Include\wx\msw\checklst.h:20: #error "wxCheckListBox class requires owner-drawn functionality." Sorry for my bad english, Regards, Neszt Tibor |
|
From: Mediatex <ma...@me...> - 2003-06-17 22:02:22
|
Create the array by specifying the required size in the square brackets:
e.g. char Name[12];
then put characters in the array like this:
Name[0]='J';
(use single quotes around the character and remember that array numbering
starts at 0)
or fill the array on creation, like this:
char Name[12]={"Janine"};
or use strcpy() , like this:
strcpy(Name, "Janine");
Good luck.
Kev.
-----------------------------------------------------------------------------------------------------
I am trying to create an array type char in Dev++ like this:
#include <iostream.h>
#include <stdlib.h>
#include <string>
int main()
{
char Name[];
Name[1]="J";
cout << sizeof(Name);
system("PAUSE");
return 0;
}
and DevC++ is telling me that the array size is missing and that assig to
"char" from "const char" lacks a cast.
Anyone could please help me with what I am doing wrong?
Thanks.
Janine
|