The follwing function returns a microtime(stamp) with 10 digits for the integer,
and most of the time 18 digits sometimes less for the fractional part.
18 digits decimal is nearly a 64 bits number, so a very hi resolution/subdivision
of the second.
function mts()
{
$_p = ini_get('precision')...
This is a usefull function called 'arr_code', which makes a php code text representation of an array. The comments explain the ins and outs and how it works.
arr_code.php:
/*
DESC:
Make a php code text representation of an array.
PARAM:
+ $code (OUT, STR, PBRS=REQ)
Receives the code text which...
In a table browse control with [first] [prev] [next] [last] buttons and a LIMIT setting, the records in a db table are devided and browsed in virtual pages.
In the GUI for these pages a record can be selected, and columns can be sorted.
When I sort with a record selected, changes are big that...
In a table browse control with [first] [prev] [next] [last] buttons and a LIMIT setting, the records in a db table are devided and browsed in virtual pages.
In the GUI for these pages a record can be selected, and columns can be sorted.
When I sort with a record selected, changes are big that...
Encryption en decryption using openssl_pkcs7_() functions goes well.
Only when openssl_pkcs7_encrypt() encrypts with the flag PKCS7_BINARY, the decrypted result after openssl_pkcs7_decrypt() is different and I don't know how to decode it into readable text, and parse the originial encrypted...
What to do with cross frame references to objects that do no longer exist?
Inside the page that publishes the frameset, index.php, there is a javascript blinking object, ojs.blinker, that alternates a html element its classname, between two css rule names, every 500ms.
In the content page this...
A shared hosting provider allows to setup 10 MySQL databases. The only thing is that each database is forced into having its own username and password, which means a separate connection has got to be made to each database.
Is there a way to join tables over the two connections?
Is a user defined function that returns a value slower than when it passes the value by a reference parameter, much like in C.
Often it is more convenient for programming flow to have a function return its value. But in C, functions that return a value to the caller are slower than when it...
An integer number in its decimal representation has a display size of max. 10 text characters. When writing this integer to a file, php/fwrite uses the same text format.
How can I store it by value instead of text, so the integer only takes up the 4 bytes (or 32 bits) that it (often) consists of?
What is the best use of include statement?
When include a file from disk, the disk/file access time can be 10ms, while the datatransfers from file into memory can be > 500MB/sec. Is a function in an include file always parsed and compiled, or only when that function is used somewhere in the...
Is there a way to cache an amouth of code for a part of a website? Some includes will always be required in compiled state, like symbolic constants and functions. Do they need to be read, parsed, interpreted/compiled for each request?
I have setup this macro that returns the bit number of a given flag mask...
0x00000001 will result in 0
0x00001000 will result in 12
0x00008000 will result in 15
0x00010000 will result in 16
0x80000000 will result in 31
When a mask exceeds 32 bit or or any combination of flags are OR-ed together...
Which processors besides Pentium and up support the RDTSC instruction?
What happens when RDTSC is executed while there's a CPU that does not has this instruction? How to detect this?
When using accept() on a blocking socket (possibly in a separate thread), the call will not return untill a client connects with connect().
Is there a way to interrupt this blocking accept() call?
I'm experimenting with macros that can read and write parts of basic types. Normal bit shifts and AND masks are used a lot. But I thought that with help of a little structure operants are only casted and assigned and things may run a little faster when loads of data need processing.
Can someone...
I'm experimenting with macros that can read and write parts of basic types. Normal bit shifts and AND masks are used a lot. But I thought that with help of a little structure operants are only casted and assigned and things may run a little faster when loads of data need processing.
Can someone...
//I have a structure type, designed to describe something
typedef struct _DESCRIPTION{
//imagine 10 members
} DESCRIPTION;
//I have a bunch of functions to manage structures of that
//type, and they take a reference to DESCRIPTION
void desc_do_something_1(DESCRIPTION& desc);
void...
With function realloc() I can resize a dynamically allocated array like:
//Initial array
long length = 100;
long* larray = (long *)malloc(sizeof(long) * length);
//resizing array
length += 25;
larray = (long *)realloc(larray, sizeof(long) * length);
How can I do something similar with new...
I've got a little webserver on my lan running with Linux, MySQL, Apache and PHP to have a dev platform that matches the one of my client. But I don't know much about Linux yet.
I got the file upload functional and the last thing that needed to be done for this was to change the directory...
This function makes a copy of the argument passed to $str,
processes on the the copy which inside, could involve another copy.
function charEllipsis($str, $nchr)
{
if($nchr < 4) return;
if(strlen($str) > $nchr)
$str = substr($str, 0, ($nchr - 3)).'...';
return $str;
}
The return value is...
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.