ae2k
Thanks for the feedback - feel free to use the code as you need. I wrote the code such as you describe (ie that it runs from the start of the file in the absence of the position file) because that suited my needs at the time.
I needed to make sure that I did not miss any records in the...
The problem with some of the previous code is that it doesn't cope when the log file is truncated (perhpas by being relegated). The code below is something I wrote to monitor a log file and report on any lines containing one of a number of search words.
You should be able to extract just the...
It depends on the ftp server you are running, in the case of ftpd use the -p command line option to specify the port to listen on, other daemons will have their equivalent, refer to the man pages for the daemon you are using.
stoolpigeon
The numbers we are talking about here (xip or postcodes, employee ids etc a re generally a fixed, known length)
Based on 30+ years of writing applications I would have thought the "load" on developers is minimal, whether they are dealing with numbers or strings the...
If the data you are storing is numeric in nature I cannot think for the life of me why you would want to store it as a character string instead of an integer....
Why use 9 characters per record when a single integer would suffice. The fact that the data is stored without leading zeroes should...
Sorry but you'll find that both Windows and Unix have the concept of an epoch (although in Windows case it is "artificial". In both systems the C-based time() call will return the number of seconds since 1/1/1970.
From memory some versions of DOS (the PC version not the IBM mainframe...
In addition to the strtok method which works well if there is a known delimiter (or delimiters) between the information you want you can simulate the left$, right$ etc functions by using the strncpy() function.
Examples
/* Copy first 6 characters */
strncpy(dest, src, 6);
dest[6]=0x00;
/*...
An outside shot, if you have some method of tracing the LAN port that the logon attempt is coming in on you can assure yourself that the password is coming through as expected - I had a similar case some time ago where the terminal emulator being used to telnet was set to some obscure emulation...
The following line will return the date for next monday given the month day & year being placed in the appropriate places in the line, obviously you would use variables rather that hard-code as I have for testing purposes.....
$next_monday=strftime("%D",strtotime("next...
Within Linux I use the following:
I add the following to the end of /etc/bashrc
if [ $(whoami) = root ]
then
PROMPT_COMMAND='echo -en ^[[01\;05\;31\;40m ; echo -n $(/etc/fancyprompt) ;
echo ^[[00m'
else
PROMPT_COMMAND='echo -en ^[[01\;33\;40m ; echo -n $(/etc/fancyprompt) ; echo...
Something like this will do it - you'll have to add your own error checking as required.....
FILE * fptr_in;
FILE * fptr_out;
char sz_buffer[1024];
char * ptr;
if((fptr_in=fopen("test.c","r"))==NULL)
return 1...
You could run a script that periodically uses nmap to test whether the port is open. (nmap -p 1404).
This will tell you whether the application (or any application) has opened the port for receive.It will not tell you that the "upper" layers of the logic of your code are working...
What about this
You break the exercise into 2 parts, the first part just calculates the random number and places it into slot 0 of the array. Then you run the loop but start $i at a value of 1.
<?php
$highest = 30;
$numads = 5;
srand((double)microtime()*1000000);
$random=rand(1,$highest)...
Glad to be of service. The other alternative is to only do the in_array check when the value of $i is greater than 0.
In this way the $varar array would be in existance (created when $i = 0) and you would avoid a superfluous call to in_array() when inserting the 1st value into the array (where...
Or instead of using a sub-loop you could use the array_search() function to check.
ie. if(array_search($random,$varar)!=FALSE)
then the value in $random already exists in the array and should be re-calculated.
<?php
$highest = 30;
$numads = 5;
for ($i=0; $i < $numads; $i++)
{...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.