Tuesday, May 20, 2008

Ally salutes

Ally salutes to those rescue dogs in 2008 Sichuan Earthquake!
Ally向四川大地震中的搜救犬敬礼!

Read more!

a nice label cloud for Blogger

Here is the link to How to add the label cloud to your Blogger and thanks for the wonderful work
Read more!

Wednesday, May 14, 2008

Use Fiddler with Firefox

Fiddler is a awesome tool for monitoring the net traffic and it is free for download. Yeah, I knew that there is a FireBug, which also can help you monitor the net traffic. Why bother?

The FireBug console is a plug-in to the Firefox browser, and it is window based, which I guess each tab will have a different FireBug instances for monitoring the HTTP traffic. So there is no central place for monitoring HTTP traffic from all opened browser windows. If something goes wrong in the window, which is then closed, the record for the HTTP traffic before the error occurs will be missing. By letting the Fiddler monitor the HTTP traffic in your Firfox browser will avoid this issue.

Fidder works very well with IE browser and no effort will be required to let Fiddler monitors the HTTP traffic in the IE browser. For Firefox, you need to

* Open options from the Tool menu item and click Advanced tab
* Go to Network | Connection Settings
* Use the Manual proxy configuration option
* Set Http proxy to 127.0.0.1 and Port 8888



Read more!

Tuesday, May 13, 2008

Increase File Upload Limit for Moodle

The uploaded file size limit in Moodle actually is determined by Apache and PHP, and the default value is 16MB, which may not be big enough for those Flash based courses with audio and video. To increased the file size limit

First find the file httpd.conf under the directory apache\conf and make the following changes
LimitRequestBody 52428800
#OR
#LimitRequestBody 50M

Then find the php.in under the directory apache\bin and make the following changes
upload_max_filesize 52428800
post_max_size 52428800


Now restart Apache and MySQL and log into Moodle with administrator user, you should find the available file size limit for the site has been increased from
Site Administration > Courses > Add/Edit courses > select Course category & edit each course > Maximum upload size
Site Administration > Security > Site Policies > Maximum uploaded file size


Read more!

Monday, May 12, 2008

Adding Google Prettifier to Blogger

First download the Google Prettify and upload it to somewhere and in this tutorial we use http://xxx.org as an example.

Goto dashboard, and click Editing HTML under the Layout tag, add the following two lines in the <head> tag
<link href="http://xxx.org/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="http://xxx.org/prettify.js"></script>


The next thing is to find the <body> tag and change it to
<body onload='prettyPrint()'>


Ok, you are done and you can create a post testing this feature. For example, creating a post with the following code
<pre class='prettyprint'>
class Voila {
public:
// Voila
static const string VOILA = "Voila";

// will not interfere with embedded tags.
}
</pre>

and here is the result
class Voila {
public:
// Voila
static const string VOILA = "Voila";

// will not interfere with embedded tags.
}


PS: Made some improvement to the prettify style and add overflow: auto; for pre.prettyprint

pre.prettyprint { padding: 2px; border: 1px solid #888; overflow: auto;}



Read more!

Thursday, May 8, 2008

Create summaries for the blog posts

Please refer to the How can I create expandable post summaries? in the Blogger help. Here is my experience with my template.

In blogger Dashboard, click layout and select 'Edit HTML' tab. The first thing you need to do is to download the full copy of the template in case you mess up something with the template. At least, you can recover it by uploading the full copy. The template should be a xml file. Please make a copy before any further action.

Now open the xml file in your favored editor, since I am using the layout template, I have to add the following style definition into <header>
   <b:if cond="data:blog.pageType == "item"">
span.fullpost {display:inline;}
<b:else>
span.fullpost {display:none;}
</b:else>


In my template, there is a big section for <b:skin> tag in the header, so I placed the code above just after it and before the end of <head>. This actually defines the style for class fullpost of span tag. If all blogs are on the same page, any texts of class fullpost will be hidden; otherwise, they will be displayed.

The next thing is to enable the summaries ("Read More" link at the end of the blog) when your blog posts are listed on the page.
</b:skin></b:if><div class="post-body entry-content">
<p>
<data:post.body>
<!--add for blog summary-->
<b:if cond="data:blog.pageType != "item"">

<a href="data:post.url">Read more!</a>
</b:if>
<!--end-->
</data:post.body></p>
<div style="clear: both;"> <!-- clear for photos floats -->
</div>

Finally, you need to specify which part of the blog will be hidden. You can use <span> tag (<div> tag doesn't work). Please refer to the help for more information or check this post itself.

Read more!

Wednesday, May 7, 2008

Perforce HOW -- remove a changelist

Here is the command for removing the changelist if you don't have the P4 window client

p4 [-c clientName] change -d changelist_number

Read more!

Perforce HOW -- revert a file to old revision

In order to do this, you need to install P4 command line tool so that you have 'p4' command available in the command window.

p4 sync file_name#old_revision_number  -- sync file to its old revision
p4 edit file_name
p4 sync file_name
p4 resolve -ay -- auto resolve the file and accept yours
p4 submit file_name --submit the file with its old revision


I haven't figure out how to do it in Perforce window client. Please drop me a comment if you happen to know how to do this.

Read more!

Tuesday, May 6, 2008

getURL and onBeforeUnload

Any getURL calls in the flash module will trigger the onBeforeUnload event in IE6. So if you have some critical logic that is attached to onBeforeUnload, you should be aware about this issue. For example, if you try to start the timer in the load event and trying to stop the timer in beforeUnload event, calling getURL in the flash module may cause unexpected behavior in IE6. This is not a case in FireFox 2. I didn't know if this is still an issue in IE7.
Read more!

Oracle Text -- FILE_DATASTORAGE

Recently, I am working on Oracle Text as an index engine for the website's file system. In general, the files and the Oracle reside on different servers, and in order to let Oracle index files, Oracle needs to get access to those files through either URL without authentication or file system. Since access to our website needs authentication, we have to mount the file system to the Oracle server, so that it looks like all files are on the same server with Oracle, and Oracle can use FILE_DATASTORAGE to access those files.

There is a default FILE_DATASTORAGE preference by Oracle Text, but you have to specify the full path in the text table for the files that you want Oracle Text to index. However, you can create your own FILE_DATASTORAGE and set the path attribute for the preference and only specify the file name in the text table.

BEGIN
CTX_DDL.CREATE_PREFERENCE('my_datastorage', 'FILE_DATASTROAGE');
CTX_DDL.SET_ATTRIBUTE('my_datastorage','path', '/home/doc');
END


it is not allowed to give a partial path in the text table if you specify the path attribute for the FILE_DATASTORAGE preference. The location in the text table is either just file name or a full path for the file. If it is just file name, Oracle Text should looks up all paths in the path attribute of the preference and search for files with the specified name. So it may not be a good idea to use this if there are files with same names. If path is specified, it might be ignored if path is set for the preference. It will be helpful if Oracle Text doesn't accept partial path in the text table.

Here is the scenario that partial path might be helping. It is probably that the whole file set may be placed at different locations. If Oracle Text supports partial path in the text table, it is possible for Oracle to index two file sets with one table (and index) by creating another FILE_DATASTORAGE preference (this should be working if your file set is just plain files under the root directory).
BEGIN
CTX_DDL.CREATE_PREFERENCE('my_datastorage1', 'FILE_DATASTROAGE');
CTX_DDL.SET_ATTRIBUTE('my_datastorage','path', '/home/doc_copy');
END


and the text table specify the relative path for files under /home/doc_copy or /home/doc, so they can share the same text table and index, but just change the meta data for the index every time when you try to synchronize the index.

Note: This is just my thought and haven't try to test this and measure its performance if you change the FILE_DATASTORAGE every time you try to synchronize the index.

Read more!