Eric @ EricBess WebHome

Rather than just thinking, knowing it would be meaningless

Chinese (Simplified) flagItalian flagKorean flagPortuguese flagEnglish flagGerman flagFrench flagSpanish flagJapanese flagArabic flagRussian flagGreek flagDutch flagBulgarian flagCzech flagCroat flagDanish flagFinnish flagHindi flagPolish flagRumanian flagSwedish flagNorwegian flagCatalan flagFilipino flagHebrew flagIndonesian flagLatvian flagLithuanian flagSerbian flagSlovak flagSlovenian flagUkrainian flagVietnamese flag
By N2H

Jquery effect: "click-to-change"

Target

Using an AJAX (or AHAH) technology designed page, without leaving the visitors will be able to see in the (x) HTML page editorial content.

Program

Click on the need to edit the text, changing with a cancel button and save the textarea. To amend the part of the AHAH will be sent to a server-side PHP script file to update the database (MySQL or ordinary paper).

Demonstration

AJAX-style click-to-change demonstration
In this first demonstration, I used an id for "editinplace" the div element. When the mouse across here, the background color will be light yellow. Click on the text of some of the DOM will start operation, div elements have been replaced by a textarea elements - contained within the original text.
Click the Save button to the server-side PHP scripts to send a new HTML document, and re-exports received a new text (by $ _POST).
In real-world environments, you should also add a safety testing before they are able to update the database and return the updated page content, colleagues informed the successful implementation of jQuery.

1 2 3

July 20th, 2008 Posted by eric | Coding, Web technology | no comments

Jquery results: stylesheet switch

DEMO

The familiar opening
$ (document). ready (function () (
$ ( '. styleswitch'). click (function ()

Tell jQuery "as fast as possible to find the object that contains all of 'styleswitch' elements, and they were in when a mouse click functions."
Looks good. When the mouse clicks in advance of the specified element, switchStylestyle function will be called. From now on, the focus is.

$ ( 'link [@ rel *= style]'). each (function (i) (

What these words mean?
JQuery to find the author of John Resig, to his advice. He gave me a direct jQuery website address of the page, on which a number of jQuery advanced features (xpath), can be used to find and operate a number of elements of the page. If you read these things you will be able to understand the mysterious code phrase above, the meaning is to tell jQuery "to find with all the rel attribute values and attributes included in the string 'style' link elements of the link."

Click to continue reading

July 20th, 2008 Posted by eric | Coding, Web Technology | one comment

PHP FixPath Function [path finishing function]

FixPath Function: fix the dirty paths. PHP path sorting function.
Example:

? View Code PHP
 1 
  2, 
 3 
 4 
 5 
 6 
 7 
 8 
 9 
  10, 
 11 
 12 
  1.3 
 14 
 15 
 16 
 17 
 18 
  <? Php 
  ; echo "nnn Dirty paths: n"; 
  = 'C://////////Windows//////System' ; //  C:/System $ paths [] = 'C :////////// Windows ////// System'; / / C: / System 
  = 'C:HTMLjavascript..examplescolors.html' ; //  C:/HTML/examples/colors.html $ paths [] = 'C: HTMLjavascript .. examplescolors.html'; / / C: / HTML / examples / colors.html 
  = '/root/./wwwroot/scripts/../././webpage' ; //  /root/wwwroot/webpage $ paths [] = '/ root /. / wwwroot / scripts / .. /. /. / webpage'; / / / root / wwwroot / webpage 
  = 'wwwroot/webpage/../index.php?querystring' ; //  wwwroot/index.php?querystring $ paths [] = 'wwwroot / webpage / .. / index.php? querystring'; / / wwwroot / index.php? querystring 
  = 'http://www.php.net/manual/en/../../downloads' ; //  http://www.php.net/downloads $ paths [] = 'http://www.php.net/manual/en/../../downloads'; / / http://www.php.net/downloads 
  = 'http://www.php.net/downloads/test/test1/test2//./docs.php' ; //  http://www.php.net/docs.php $ paths [] = 'http://www.php.net/downloads/test/test1/test2//./docs.php'; / / http://www.php.net/docs.php 
  = '../downloads/../docs.php' ; //  ../docs.php $ paths [] = '.. / downloads / .. / docs.php'; / / .. / docs.php 
  = 'localhost//projetos/../_arquivos/../' ; //   "" $ paths [] = 'localhost / / projetos / .. / _arquivos /../'; / / "" 
  = 'C:/downloads/../../../' ; //  C:/ $ paths [] = 'C: / downloads /../../../'; / / C: / 
  = 'downloads/../../../' ; //  ../../ $ paths [] = 'downloads /../../../'; / / ../../ 

  $paths as $path ) foreach ($ paths as $ path) 
  ( 
      . $path . "&quot;  =  &quot;" .  fixpath ( $path ) . "&quot;" ; echo "n" ". $ path." "=" ". fixpath ($ path)." ""; 
  ) 
  ?> 
Note: "/ /" one more slashes will roll back the root.

Click to continue reading

July 17th, 2008 Posted by eric | Coding | no comments

FindRelativePath Function [path to find out the relationship between the relative]

PHP FUNCTION: Found the relative between the path.
PHP function: to find the path between the relative relationship.

Example:

? View Code PHP
 1 
  2, 
 3 
 4 
 5 
 6 
 7 
 8 
 9 
  <? Php 
  'http://www.php.net/manual/en/install.php' ; $ path_a = 'http://www.php.net/manual/en/install.php'; 
  'http://www.php.net/downloads' ; $ path_b = 'http://www.php.net/downloads'; 

  Path A:  " . $path_a ; echo "\ n Path A:". $ path_a; 
  Path B:  " . $path_b ; echo "\ n Path B:". $ path_b; 
  A to B:  " .  findRelativePath ( $path_a , $path_b ) ; //  ../../downloads/ echo "\ n A to B:". findRelativePath ($ path_a, $ path_b); / / .. / .. / downloads / 
  B to A:  " .  findRelativePath ( $path_b , $path_a ) ; //  ../manual/en/install.php echo "\ n B to A:". findRelativePath ($ path_b, $ path_a); / / .. / manual / en / install.php 
  ?> 

Function:

Click to continue reading

July 17th, 2008 Posted by eric | Coding | 2 comments

[To] in layman's language of regular expressions

Preface:

Six months ago I have had regular expressions of interest in on-line to find a lot of information, read a lot of course, the last in the use of a regular expression tool RegexBuddy when he found the course very well written, it can be said that I have seen the best regular expression tutorial. As a result he would like to have been translated. The aspirations of the long holiday until May 1 this can be achieved, the results will have this article. This article on the name, "in layman's language" seems to have Taisu. But read the original text, only that "in layman's language" in order to correct the course to express my feelings, it can not escape the.

Jan Goyvaerts for this article was written by RegexBuddy course of the translation, the original author copyright of all, welcome to reprint. However, in order to respect the original author and translator of the work, please reference! Thanks!

What is a regular expression

Basically said, is a regular expression used to describe a certain number of text mode. Regex on behalf of the Regular Express. This article will be <<regex>> to indicate the specific section of the regular expression. A section of text is the most basic model, a simple match the same text.

Different regular expression engine

Regular expression engine is a regular expression processing software. Typically, the engine is a bigger part of the application. In the software world, different regular expressions are not compatible with each other. The present course will focus on the Perl 5 types of engines, engine because it is the most widely used engines. At the same time, we will also talk about some of the engine and other differences. Many modern engines are very similar, but not exactly the same. For example. NET regular library, JDK regular package.

Sign language

The most basic regular expression from a single text symbols. If <<a>>, it will match the first time in the string of characters "a". If the string of "Jack is a boy". "J" after "a" will be matched. And the second "a" will not be matched. Regular expressions can match the second "a", which tells you must be a regular expression engine from the first match of the beginning of local search. In a text editor, you can use the "Find Next." In the programming language, there will be a function can be used to make your first match back to the beginning of the location of the search.

A similar, <<cat>> will match "About cats and dogs" in the "cat". This is tantamount to tell regular expression engine to find a <<c>>, keep up with a <<a>>, a point with <<t>>.

Bearing in mind that regular expression engine is the default case-sensitive. Unless you tell the engine Ignore case, or else <<cat>> will not match the "Cat".

Special characters

The text characters, 11 characters were retained for special purposes. They are: [] \ ^ $. |? * + ()

These special characters are also known as the yuan characters.

If you would like regular expressions of these characters will be used for text characters, you need to use the backslash, "\" for their code (escape). For example, you want to match "1 +1 = 2", the right to expression <<1 \ +1 = 2>>.

It should be noted that, "<1 +1 = 2>> is a valid regular expression. However, it does not match the "1 +1 = 2" and the match will be "123 +111 = 234" "111 = 2." "+", Said a special meaning here (1st to repeat many times).

In the programming language, bearing in mind that some special characters will be dealing with the compiler, and then to the longer regular engine. Therefore, regular expressions <<1 \ + 2 = 2>> in C + + to write in "1 \ \ +1 = 2." In order to match the "C: \ temp", you should use regular expressions <<C:\\temp>>. In the C + +, the regular expression has been turned into "C: \ \ \ \ temp".

Click to continue reading

July 15th, 2008 Posted by eric | Coding | no comments

PHP string entry-operation

No matter what language, string operations are an important basis, often simple but important. As people say, the general physical (GUI), language (print string?), The string can be explained more clearly. PHP provides a large number of string operation functions, a powerful, simple to use and more, please see the detailed http://cn2.php.net/manual/zh/ref.strings.php. Will be the following simple about its functions and Characteristics.

Weak type

PHP is a weak type of language, so other types of data can be directly applied to the general operation of the string function, which automatically converted to the type of string, processing, such as:

echo substr ( "1234567" , 1 , 3 );

And

echo substr ( 123456 , 1 , 3 );

Is the same as

Definition

General use double quotes or single quotes a string logo. For example,

$str = "i love u" ;
$str = 'i love u' ;

It is those two have some differences. The latter will be all single quotation marks content will be dealt with as characters; the former is not. For example,

$test = "iwind" ;
$str = "i love $test" ;
$str1 = 'i love $test' ;
echo
$str ; //将得到 i love iwind
echo $str1 ; //将得到 i love $test

The same two examples of the following acts are not the same:

echo "i love test" ; // 将得到 i love est,已经将t视为转义
echo 'i love test' ; // 将得到 i love test
love est, echo "i love test" ; // 将得到 i love est,已经将t视为转义
echo 'i love test' ; // 将得到 i love test
love test echo "i love test" ; // 将得到 i love est,已经将t视为转义
echo 'i love test' ; // 将得到 i love test

Can simply double-quotes in that the content is "interpretation" of the cross, the single quotation marks is "WYSIWYG". It is clear that quotation marks in the form of a more flexible, single quotation marks, of course, would apply to some special occasion, not be described here.

1 2 3 4 5 6 7 8 9

July 10th, 2008 Posted by eric | Coding | one comment

Gold in Lingnan need to raise the offer to buy HER [analysis]

Lingnan to buy gold in today HER termination of the offer, a lot of stock in payment of Lingnan in complaining about non-public information. In fact, Australia ASX market information is very open market. HER acquisition by side every day to the market to buy up-to-date news releases, and first-hand information for the company's fax paper, the accuracy of information and openness are the domestic stock market's incomparable. We can not in a financial Web site on the AU to be, such as: http://markets.smh.com.au/apps/qt/quote.ac?section=ca&code=HER.

Analysis of information from the public, increase the offer unless, in gold Lingnan HER acquisition will not succeed. The reasons are as follows.
1. 60% HER investors dissatisfied with the offer of $ 2.8, which from now on the market price of $ 2.9, and increase the Calipso offer to $ 2.85 after the increase of only 0.1 percent less than shareholders accept the offer to see.
2. The two have been $ 2.85 to raise the offer, including the Calipso.
3. Australia under the same conditions ordinary investors are more willing to sell stake in Australian companies. We should note that Calipso and Tango at the same time offer $ 2.8 when the two were more than 19% of the equity support, but Tangou the main square to support the company's management, Calipso for ordinary investors. Tango is the only management know that the ultimate acquirer, in order to maintain and future relations between the major shareholders, management made the right choice. However, other ordinary shareholders and Calipso obviously want to get the same extra profit, not willing to chip in the hands of premature release.

To obtain payment of Lingnan HER may have to raise the blood would have to fill the Australian market.
Let me just wait and see!

July 8th, 2008 Posted by eric | I predict the stock market, financial and investment | no comments

PHP's debug technology

Add to the program debug function to record the results of other code, DEBUG for the switch. Source code: wp-global-translator-plugin.

? Download degug.php
 1 
  2, 
 3 
 4 
 5 
 6 
 7 
 8 
 9 
  10, 
 11 
  $msg ) function debug ($ msg) 
  ( 
    DEBUG ) { if (DEBUG) ( 
      date ( "Ymd H:i:s " ) ; $ today = date ( "Ymd H: i: s"); 
      dirname ( __file__ ) . "/debug.log" ; $ myFile = dirname (__file__). "/ debug.log"; 
      fopen ( $myFile , 'a' )  or die ( "Can't open debug file. Please manually create the 'debug.log' file (inside the 'global-translator' directory) and make it writable." ) ; $ fh = fopen ($ myFile, 'a') or die ( "Can't open debug file. Please manually create the 'debug.log' file (inside the 'global-translator' directory) and make it writable.") ; 
      preg_replace ( "/(.*)\s\(.*/" , "\ \1 " , $_SERVER [ 'HTTP_USER_AGENT' ] ) ; $ ua_simple = preg_replace ("/(.*) \ s \ (.*/", "\ \ 1", $ _SERVER [ 'HTTP_USER_AGENT']); 
      $fh , $today . " [from: " . $_SERVER [ 'REMOTE_ADDR' ] . "| $ua_simple ] - " . $msg . " \n " ) ; fwrite ($ fh, $ today. "[from:". $ _SERVER [ 'REMOTE_ADDR']. "| $ ua_simple] -". $ msg. "\ n"); 
      $fh ) ; fclose ($ fh); 
    ) 
  ) 

In other parts of the program, together with necessary debug ( "") records the results, such as the following URI for the current performance of the hash: $ hash.

? View Code PHP
 1 
  2, 
 3 
 4 
 5 
 6 
 7 
 8 
 9 
  10, 
 11 
  $lang , $url ) function gltr_get_page_content ($ lang, $ url) 
  ( 
    '' ; $ page =''; 
    USE_CACHE ) { if (USE_CACHE) ( 
       CACHE_TIMEOUT ; $ refresh = CACHE_TIMEOUT; 

      preg_replace ( '/(.*)\/$/' , '\\1' , $_SERVER [ 'REQUEST_URI' ] ) ; $ req = preg_replace ('/(.*) \ / $ / ',' \ \ 1 ', $ _SERVER [' REQUEST_URI ']); 
      preg_replace ( '/#.*$/' , '' , $req ) ; $ req = preg_replace ('/#.*$/','', $ req); 
      str_replace ( array ( '?' , '< ' , '>' , ':' , '\\' , '/' , '*' , '|' , '"' ) , '_' , $req ) ; $ hash = str_replace (array ( '?', '<', '>', ':', '\ \', '/', '*', '|', ' "'), '_', $ req); 
       to: $hash " ) ; debug ( "Hashing uri: $ req to: $ hash"); 
      ....... 

July 7th, 2008 Posted by eric | Coding | no comments

5 6 7 8 9 10 » ... Last » Page 4 of 23 «1 2 3 4 5 6 7 8 9 10» ... Last »