Surendran 的个人资料..::SUreN::..照片日志列表更多 ![]() | 帮助 |
|
|
2008/9/4 Session Variables< sessionStatemode ="InProc"stateConnectionString ="tcpip=127.0.0.1:42424"sqlConnectionString ="data source=127.0.0.1;Trusted_Connection=yes"cookieless ="false"timeout ="20"/> 2008/4/22 Two Background Images In Single Cellhtml:
CSS:
More than 100 Keyboard ShortcutsKeyboard Shorcuts (Microsoft Windows)
Microsoft Natural Keyboard Shortcuts
Shortcut Keys for Character MapAfter you double-click a character on the grid of characters, you can move through the grid by using the keyboard shortcuts:
Microsoft Management Console (MMC) Main Window Keyboard Shortcuts
MMC Console Window Keyboard Shortcuts
Remote Desktop Connection Navigation
Microsoft Internet Explorer Navigation
2008/4/9 5 cool things you can do with windows and phpMany PHP examples out there are designed for a linux/unix operating system. I am going to give some examples of some interesting functionality that only works with php running in a windows environment (IIS or apache). 1) Eject the CD-ROM //create an instance of Windows Media Player $mp = new COM("WMPlayer.OCX"); //ejects the first cd-rom on the drive list $mp->cdromcollection->item(0)->eject(); 2) Read and write from/to the registry function registry_read($folder, $key) { $WshShell = new COM("WScript.Shell"); $registry = “HKEY_LOCAL_MACHINE\SOFTWARE\\” . $folder . “\\” . $key; $result = $WshShell->RegRead($registry); return($result); } $key = registry_read(”RegisteredApplications”,”Firefox”); parameters: * Folder name - (key path past HKEY_LOCAL_MACHINE\SOFTWARE\\) * key - the key name to read from function registry_write($folder, $key, $value,$type="REG_SZ") { $WshShell = new COM("WScript.Shell"); $registry = “HKEY_LOCAL_MACHINE\SOFTWARE\\” . $folder . “\\” . $key; $result = $WshShell->RegRead($registry); $result = $WshShell->RegWrite($registry,$value, $type); return($result); } parameters: * Folder name - (key path past HKEY_LOCAL_MACHINE\SOFTWARE\\) * key - the key name to write to * value - value that will be written to the key * type - key type (default: REG_SZ) 3) register and un-register phpscripts as a windows service # registering a service win32_create_service(array( ’service’ => ‘myservice’, # the name of your service ‘display’ => ’sample dummy PHP service’, # description ‘params’ => ‘c:\path\to\script.php run’, # path to the script and parameters )); # un-registering a service win32_delete_service(’myservice’); # code run as a service if ($argv[1] == 'run') { win32_start_service_ctrl_dispatcher('myservice'); while (WIN32_SERVICE_CONTROL_STOP != win32_get_last_control_message()) { # write script here # as a general rule, keep it below 30 seconds through each loop iteration } } This uses the windows API Service DLL, which is not enabled by default. Here is how to install it: * Download the main library (it’s included in the main PECL extension download from php.net) here * extract php_win32service.dll to your ext directory (where your php extension .dlls are located) * add the following line to your php.ini: extension=php_win32service.dll 4) print pages/data #this is an example function that will format a host/printer name, for printing to shared printers over the network function getPrinter($host,$SharedPrinterName) { return “\\\\”.$host.”\\”.$SharedPrinterName; } #this opens the printer $handle = printer_open(getPrinter(”my computer 2″,”my printer”)); An extensive list of functions for printing can be found here #this is possible in *nix as well. Here is some example code function lpr($string,$printer) { $prn=(isset($printer) && strlen($printer))?”$printer”:C_DEFAULTPRN ; $CMDLINE=”lpr -P $printer “; $pipe=popen(”$CMDLINE” , ‘w’ ); if (!$pipe) {print “pipe failed.”; return “”; } fputs($pipe,$string); pclose($pipe); } This uses the windows API Service DLL, which is not enabled by default. Here is how to install it: * Download the main library (it’s included in the main PECL extension download from php.net) here * extract php_printer.dll to your ext directory (where your php extension .dlls are located) * add the following line to your php.ini: extension=php_printer.dll 5) List the current system processes # list all the current processes running on the system print_r(win32_ps_list_procs()); other related commands: # Retrieves statistics about the global memory utilization print_r(win32_ps_stat_mem()); # Retrieves statistics about the process with the process id pid (if no process id is given, the current process will be used) print_r(win32_ps_stat_proc(int processid)); This uses the windows API Service DLL, which is not enabled by default. Here is how to install it: * Download the main library (it’s included in the main PECL extension download from php.net) here * extract php_win32ps.dll to your ext directory (where your php extension .dlls are located) * add the following line to your php.ini: extension=php_win32ps.dll 2007/5/23 convert field values to upper (or lower) caseTo demonstrate this, let's assume you have a Contacts table containing addresses in North America. For some reason, your State and Province abbreviations have been entered in mixed case. For example, some of your California contacts have been entered as "ca", "Ca, and "CA." The following SQL query would change these to "CA" and all other abbreviations to upper case:
UPDATE "CONTACTS.DB" SET StateProv = upper( StateProv ) 2007/5/8 Optimize All Tables In A MySQL DatabaseDescriptionIf you have a database driven site and you want to optimize MySQL tables then this is perfect. It goes through all the tables in a MySQL database and does table optimization on each one using the MySQL Optimize Table syntax. The codeDirectory listerDescriptionDisplays a hyperlinked list of all the files contained in a specified folder. A really simple way to have your own directory browser, just drop the file in the folder and it will show an index of all files in the directory on your webspace. The codeDisplay a different image for each day of the weekDescriptionThis PHP script will get the day of the week from the server date and then display an image (jpg or gif) to match. The codeRandom imageDisplays a random image on a web page. Images are selected from a folder of your
choice. <?php /* * Name your images 1.jpg, 2.jpg etc. * * Add this line to your page where you want the images to * appear: <?php include "randomimage.php"; ?> */ // Change this to the total number of images in the folder $total = "11"; // Change to the type of files to use eg. .jpg or .gif $file_type = ".jpg"; // Change to the location of the folder containing the images $image_folder = "images/random"; // You do not need to edit below this line $start = "1"; $random = mt_rand($start, $total); $image_name = $random . $file_type; echo "<img src=\"$image_folder/$image_name\" alt=\"$image_name\" />"; ?> 2007/4/20 PHP: Random QuoteMake a file called quotes.txt Put each quote on it's on line. Here's a script: <? $r_array=file('quotes.txt'); shuffle($r_array); echo $mQuotePath[0]; echo $r_array[0]; ?> 2007/3/29 Flash Fullscreen, Without changing image sizestop(); getURL(FSCommand:allowscale, false); getURL(FSCommand:fullscreen, true); 2007/1/5 File Browse without button<html> <head> <title>File Upload Example</title> <script language="JavaScript" type="text/javascript"> function HandleFileButtonClick() { document.frmUpload.myFile.click(); document.frmUpload.txtFakeText.value = document.frmUpload.myFile.value; } </script> </head> <body> <form name="frmUpload"> <input type="file" name="myFile" style="display: none"> <input type="text" name="txtFakeText" readonly="true"> <a href="javascript:HandleFileButtonClick();">Attach</a> </form> </body> </html> Move Window<meta http-equiv="refresh" content="5;URL=windowmove.html"> function movewindow(n) --> 2006/11/2 AJAX : ConnectionsAJAX = Asynchronous JavaScript And XML
HTML
<html> <head> <script src="selectcustomer.js"></script> </head> <body> <form> Select a Customer: <select name="customers" onchange="showCustomer(this.value)"> <option value="ALFKI">Alfreds Futterkiste <option value="NORTS ">North/South <option value="WOLZA">Wolski Zajazd </select> </form> <p> <div id="txtHint"><b>Customer info will be listed here.</b></div> </p> </body> </html> JavaScript var xmlHttp
function showCustomer(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="getcustomer.asp"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("txtHint").innerHTML=xmlHttp.responseText
}
}
function GetXmlHttpObject()
{
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}Server side SQL - All Field SearchSELECT * FROM employee WHERE MATCH (name,age,salary,address,telephone) AGAINST ('suren') 2006/10/31 Flash : Font Problemvar textFileData = new LoadVars();
textFileData.onLoad = function () { var my_fmt:TextFormat = new TextFormat(); my_fmt.font = "my font"; this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 160, 120); my_txt.wordWrap = true; my_txt.embedFonts = true; my_txt.htmlText = textFileData.name; my_txt.setTextFormat(my_fmt); }; textFileData.load("text.txt"); 2006/10/27 Learn - Ajax |
|
|