Archive

Archive for October, 2008

Choose a value from select box by watir

October 31st, 2008 No comments

Bellow is the code to choose the second option from a select box:

ie77.select_list(:class,’inputboxb’).select_item_in_select_list(:index,1)

Related Blogs

  • Related Blogs on select_list
Categories: watir Tags: ,

Send data into an inner html of iframe by watir

October 25th, 2008 No comments

I tried to input data to the inner html of iframe by watir for several months, and posted questions to many forums but got no answer.

Yesterday an idea came into my mind, and I found a solution, following is the code:

ie77.frame(:id, /Editor/).document.body.innertext = “good and better”

Related Blogs

  • Related Blogs on innerpage
Categories: watir Tags: , ,

$ Try to use backtrack $

October 22nd, 2008 No comments

This article is try to use backtrack, I copy a trackback url in the options of this post, and then go to the trackback url to see whether my trackback displayed there.

These days a lot of blogs stop this function, spam may be the reason.

Categories: wordpress Tags: ,

$ PHP decode from and encode to Base64 $

October 21st, 2008 No comments

When preparing plugin for some blogging tool, sometimes it is needed to decode PHP to Base64, following is a simpleway.

Copy following code into a file called phpdecode.php and just to exeute it.

<?PHP
error_reporting
(E_ERROR | E_WARNING | E_PARSE);
@
set_magic_quotes_runtime (0);
@
header("Content-Type: text/html; charset=utf-8");
$code=$_POST['code'];
$action=$_REQUEST['action'];
if (
get_magic_quotes_gpc()) $code=stripslashes($code);

if ($action==‘decode’) {
$code=base64_decode($code);
$code=nl2br(htmlspecialchars($code));
}
else
$code=base64_encode($code);
?>

<html>
<body style=”text-align: center;”>
<div style=”text-align: left; width: 90%; font-family: Verdana; font-size: 14px; margin: auto; background: #EFEFEF; color: #000;”><b>Result: </b><br><br><?php echo ($code);?><br><br></div><br><br>
<form action=”decodephp.php” method=’post’>
<textarea name=’code’ cols=’100′ rows=’16′></textarea><br>
<input type=’radio’ name=’action’ value=’decode’ checked>DECODE &nbsp; &nbsp; <input type=’radio’ name=’action’ value=’encode’>ENCODE<br><br>
<input type=’submit’> &nbsp; &nbsp; <input type=’reset’>
</form>
</body>
</html>

You can copy the following code between <php> and </php>, and give a  try at the link http://www.tsnpc.com/decodephp.php:

<php>JGFsbF9zZW50ZW5jZXNfZmlsZT0icGx1Z2luL3NiL3NlbnRlbmNlcy50eHQiOw0KJGFsbF9zZW49QGZpbGUoJGFsbF9zZW50ZW5jZXNfZmlsZSk7DQokYWxsX251bT1jb3VudCgkYWxsX3NlbiktMTsNCiRjdXJfbnVtPXJhbmQoMCwgJGFsbF9udW0pOw0KJHBocHJldHVybj0kYWxsX3NlblskY3VyX251bV07</php>

Related Blogs

  • Related Blogs on php
Categories: other software Tags: ,

$ Use the text property to locate a link in watir $

October 13th, 2008 No comments

I found by chance that we can use the text property to locate a link in watir, the following is the syntax I used:

ie77.link(:text => /the text in a link/).click

Related Blogs

Categories: watir Tags: ,

$ add adsense under each wordpress post by hand code $

October 12th, 2008 No comments

Sometimes I dont like to use plugin to add adsense in the blog, so I tried to add it by hand code, following is an example for add adsense under each post:

Go to the file of single.php in the theme fold, read and find the code for displaying the content, the <div class=”storycontent”> should be the code to display the content, and the <div class=”meta”> should be the code to show the post meta, so just add the script under the the post meta, I use the <hr> to isolate adsense for clearance.

<div class=”storycontent”>
<?php the_content(__(‘(more…)’)); ?>
</div><!– end storycontent –>

<div class=”meta”>

Written by <?php the_author() ?><?php _e(” in:”); ?> <?php the_category(‘,’) ?> | <?php the_tags(__(‘Tags: ‘), ‘, ‘, ‘ ‘); ?><?php edit_post_link(__(‘Edit This’)); ?>
<?php wp_link_pages(); ?><br />

</div><!– end meta –>

<hr>
******paste google adsense script here*************
<hr>

Related Blogs