顯示具有 C# 標籤的文章。 顯示所有文章
顯示具有 C# 標籤的文章。 顯示所有文章

2010年11月29日 星期一

Set Print Quality of Excel

Recently, Fox spent a few hours on changing print quality of Excel app. After googling some docs, Fox found that the set_PrintQuality of PageSetup API has the capability to do so.

In some examples, they all says that the correct way to call this API is "set_PrintQuality(new object[]{200, 200}, Type.Missing)".

After some testing, Fox found the following way works:
Worksheet wsSheet = (Worksheet)wbExcel.Sheets[0]; 
PageSetup psPrinter = wsSheet.PageSetup; 
psPrinter.set_PrintQuality(objMissing, new int[] { 200, 200 });
The first argument should be missing and put the int array in the second argument.

2010年5月29日 星期六

mojoPortal Image Gallery(圖庫) 中 Silverlight 無法使用之問題

今天福克斯設定了一個 Image Gallery(圖庫) 在某個頁面上。設定的時候,福克斯發現,裡面居然有一個用 Silverlight 來呈現圖片的功能。

福克斯當然很開心地把它給勾選起來,可是,試了再試,怎麼試都是一遍黑,什麼東西都沒有。

最後福克斯只好放棄,打開它的 HTML 原始碼起來看,並且一一做測試。

在測試的過程中發現,它的 Silverlight 的 binary 是放在:ClientBin/Vertigo.SlideShow.xap。可是,福克斯用 browser 就是無法找到它。

後來,福克斯想起來, Windows 2003 如果沒有設定 MIME Type,它將無法被下載回去。

所以,只要打開 IIS 6 在本機電腦的項目上按右鍵,選擇內容,並在 MIME Type 上加入: .xap => application/x-silverlight-app 的對應。它就可以正常運作了。

ps. 通常 Server 都不會灌這種 Silverlight 或 Flash 的東西,所以即使福克斯的電腦有灌,還是沒辦法在 mojoPortal 中看到的.....

2010年5月25日 星期二

mojoPortal - 將 Administration, 文件管理等項目從頁面中移除

最近,福克斯在學習如何使用 mojoPortal。當然,這也是跟公司的事情有關係。mojoPortal 具備還算完整的功能,只不過,有些項目的畫面中文化並不完全。

另外,也由於時間的關係,福克斯無法深入研究 mojoPortal 的修改方式。所以,只好使用無敵大絕招:把一些不安全的項目從選單中移除。

移除的方法其實很簡單,因為 mojoPortal 是使用 Master Page 的方式。

所以,我們只需要修改一下 skin 中的 layout.Master ,將下面項目註解起來就可以了:

<!--
<portal:adminmenulink id="lnkAdminMenu" runat="server">
<portal:filemanagerlink id="lnkFileManager" runat="server">
-->

2009年5月4日 星期一

WikiSpider in Traditional Chinese version

As you known, Wikipedia has a plenty of versions in many languages. I also make another configuration for Traditional Chinese(zh_TW) as the following link:

http://code.google.com/p/spiderframework/downloads/detail?name=wiki_spider_zh_TW.xml&can=2&q=#makechanges

What you need to do is just replace the spider.xml with the downloaded one, please rename it to spider.xml.

The output of this configuration file is the same with English version, the plain text of wiki page.

2009年5月3日 星期日

Web Spider for Wiki

Recently, I wrote a web spider to crawling text from wikipedia website. This spider runs at 500ms per page and saves web page as text data which reside in the center area, like the following page:


The useless information are cropped.

After saving a page, this spider clicks the "Random article" link, see blow, to get another wiki content.



I had slow this spider down for 500ms after a page. After 10,000 random pages downloaded, this spider will stop running. So, it needs more than 5,000 seconds to finished the task.

You can download the source code from http://code.google.com/p/spiderframework/downloads/list.

This is written in C# of Visual Studio 2005.

If you need the binary code directly, please email me. I can build it for you.