How to swap two numbers (2 variables) without using third variable. 
//Interview question
#input:
num1=50;
num2=100;

#core logic
num1 = num1 + num2;
num2 = num1 - num2;
num1 = num1 - num2;

#output
num1 is 100
num2 is 50



[ view entry ] ( 1187 views )   |  print article
IEEE Standards 
802.11b (wireless)
802.11g (wireless)
802.11a (wireless)

802.1i (WPA2)

802.1q (trunk protocol)
802.1d (STP protocol)
802.1w (RSTP protocol)
802.1s (MIST|MST|MSTP. Feature that creates an instace of RSTP (802.1w) for each VLAN)

802.3ab (1000BASE-T)
802.3z (1000BASE over fiber optic)


802.3af (PoE)
802.1p (layer 2 QoS)
802.1x (switch port-based authentication, AAA, radius)

[ view entry ] ( 1240 views )   |  print article
Professional To-Do list 
My To Do list:

Short term goals:
- Electronics and Computer Engineering Technology A.S.
- Master CCNP routing/switching (CCIE ?)
- English vocabulary section (blog)
- Keep on updating tutorial section

Long term goals:
- CCDA (CCDP ? CCDE ?)
- CCNA Wireless (CCNP ?)
- CCNA Voice (CCNP ?)
- Computer Science/Software Engineer B.S.
- Renew real estate license (for site below ;).
- paylesstosell.com
- asp.net/C#/mono
- APIs: ebay,facebook,amazon,google, etc.

..maybe more

[ view entry ] ( 1739 views )   |  print article
GNU OS apps 
http://www.gnu.org/manual/manual.html

Useful link to see what GNU apps are available.

[ view entry ] ( 1188 views )   |  print article
Facebook Page 
Find me in Facebook.

http://www.facebook.com/angelestebancool

[ view entry ] ( 1393 views )   |  print article
Aironet 1200 series workgroup mode (WGB) setup 
This tutorial connects two layer-2 switches through a wireless link. Excellent setup when needing to connect a remote location and cabling is not an option.

See related link to open PDF, or go to:
http://www.angelcool.net/tutorials/cisc ... _Setup.pdf

[ view entry ] ( 1185 views )   |  print article  |  related link
Iterating through Key- Value Pair Array using PHP 
foreach ($array as $key => $value)
{
//code block statements that run inside foreach loop
}




[ view entry ] ( 1221 views )   |  print article
Code to populate mysql with random data (needs some cleaning) 
CREATE TABLE `RandomNumbers_InnoDB` (
`id` int(11) NOT NULL auto_increment,
`random1` varchar(100) default NULL,
`random2` varchar(100) default NULL,
`random3` varchar(100) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

Sample ouput:
http://www.angelcool.net/tutorials/othe ... 00rows.txt


<?php
set_time_limit(0);

function db_link()
{




//@ suppresses the error mysqli_connect returns, and instead we use our die() error
$db_link=mysqli_connect('127.0.0.1','root','');




if($db_link==false)
echo 'Could NOT connect to MySQL, check mysqli_connect settings. ';


//select database
if(@mysqli_select_db($db_link,'test')==false)
echo 'Could NOT select DB, check DB name.';


return $db_link;

}



function String()
{
//Step 1 Generate a token.
$length = 32;
$chars = 'ABCDEFGHIJKLMNPQRSTUVWXYZ123456789'; //ABCDEFGHIJKLMNPQRTWXYZ123456789 123456789abcdefghijklmnopqrstwxzABCDEFGHIJKLMNPQRTWXYZ
$string = '';
for ($i = 0; $i < $length; $i++) {
$pos = rand(0, strlen($chars)-1);
$string .= $chars{$pos}; }

return $string;

}




/*
How many different 4-letter combinations are there in the alphabet?
letters in alphabet = 26

Answer:
26^4 = 456,976
There are 26 choices for the first letter, 26 for the second, 26 for the 3rd and 26 for the 4th. So altogether, there are 26*26*26*26 = 456,976 combinations.

I hope this helps!

http://answers.yahoo.com/question/index ... 851AAkpgEj
*/

$conn=db_link();
echo '<b>'.date(DATE_RFC822).'</b>';

$execution_time=microtime(true);

for($iii=1;$iii<=200;)
{
$start=microtime(true);



/*

//Run this query to find out duplicate tokens
SELECT * FROM BulkTokens INNER JOIN (SELECT Token,COUNT(Token) AS Duplicated FROM BulkTokens
GROUP BY Token HAVING Duplicated > 1) dup ON BulkTokens.Token=dup.Token;


*/

$string1=String(); $string2=String(); $string3=String();

//Step 2 Check if token DOES NOT exist in database (check if it is duplicated, if it is skip this iteration).
// $query="SELECT random1 FROM RandomNumbers_InnoDB WHERE BINARY random1='".$string1."' and random2='".$string2."' and random3='".$string3."'";
// $result=mysqli_query($conn,$query) or die(mysqli_error($conn));
// $query=mysqli_num_rows($result);



//if token exists skip iteration.mysqli_num_rows($query)==0
if(true)//$query==0
{

//If token does not exist add 1 to $iii and assign the token to array.



// and insert it in database.
$query="INSERT INTO RandomNumbers_InnoDB(random1,random2,random3) VALUES('".$string1."','".$string2."','".$string3."');";
mysqli_query($conn,$query) or die(mysqli_error($conn));
echo $iii.'----'.$string1.'----'.$string2.'----'.$string3.' Iteration execution time:'.round((microtime(true)-$start),4).' secs<br>';
$iii++;

}
else
{ echo '====================================================================================================SKIPPED REPEATED RECORD !!';}



}
echo '<br><br><br>Total Execution Time:'.round((microtime(true)-$execution_time),4).'<br><br><br>';

echo '<b>'.date(DATE_RFC822).'</b>';

?>


[ view entry ] ( 1245 views )   |  print article
HOSTS file location 
#Win7
C:\windows\system32\drivers\etc\ or %systemroot%\system32\drivers\etc\


#CentOS
/etc/hosts

[ view entry ] ( 1157 views )   |  print article
Setting up PDFlib extension in PHP 
1.- Download PDFlib-8.0
2.- Look for libpdf_php.so
3.- Copy and paste to extension_dir [ see phpinfo() ]
4.- Add extension in php.ini

extension=libpdf_php.so

5.- Restart httpd and check PDFlib support in phpinfo()
6.- Get a license ($) to remove watermark.

Or try fpdf and fpdi.

[ view entry ] ( 1200 views )   |  print article

<<First <Back | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Next> Last>>


2024 By Angel Cool