顯示具有 blogger 標籤的文章。 顯示所有文章

gravatar

拿掉 FunP 轉過來的 iframe

在 淺入淺出 iframe (1), 淺入淺出 iframe (2), 和 別再說為什麼XX 就可以用iframe 而funP 不行 中提到很多原因,我也不喜歡在上面有個 FunP 的 control bar。所以之前不知道在哪邊看到的文章,教人家在 HTML 加入

if (top.location != location ) top.location.href = location.href;
就可以重新 redirect 到正常的網頁去。不過有個問題呀,最近在 blogger 裡面要改 layout,結果整個畫面被導到 layout 設定畫面,上方的 blogger 設定像是 Posting, Settings, Layout 和裡面的 Edit HTML 都不見了,這樣之後怎麼改東西。所以額外加了一些東西上去,才避免連 blogger 自己的 iframe 都被轉光光。
if (top.location != location && (top.location.href.substr(0,23) != 'http://www.blogger.com/') ) top.location.href = location.href;

gravatar

Blogger Custom Domain

今天仔細研究一下 blogger custom domain 怎麼使用,然後就把很久前在 yahoo small business 買的 jclin.org domain 拿來用。所以就直接改成 blog.jclin.org 或是 jclin.org 都可以直接看到 blogspot 的文章。並且原本的 jclin.blogspot.com 還是依然有效。另外趁機也把 template 換一下,從此也可以透過簡單的 layout 編排方式來修改版面。另外 page rank 似乎也沒了,目前首頁上看到的是 0。

gravatar

Copy to Blogger Beta

很久以前就開始用 gslin 的 copyblog.pl 把 wordpress feeds 內容複製到 blogger 去,曾經有一段時間是自己改一部份內容直接用 Blogger Atom API 把文章貼進去。後來似乎 API 有所修改或更動,一段時間經常會失敗造成兩邊不同步。現在 Blogger 的帳戶轉換成 Blogger Beta 之後,更是無法使用舊的方式把文章複製過去了。

所以現在改用 Google Data APIs 把內容貼過去。看來看去比較簡單的方法就是參考裡面的 java 範例,直接改一下,搭配上原本的 copyblog.pl 方式。先把文章標題和內容寫到一個檔案,然後執行 java 來透過 Google Client Data Library 把文章內容新增到 Blogger Beta。程式大致如下,


import com.google.gdata.client.*;
import com.google.gdata.client.calendar.*;
import com.google.gdata.data.*;
import com.google.gdata.data.extensions.*;
import com.google.gdata.util.*;
import java.net.URL;
import java.io.*;

class blogpost
{
  final static String email = "user@gmail.com";
  final static String user = "user";
  final static String passwd = "password";
  final static String filename = "content.txt";
  final static String post_url = "http://www.blogger.com/feeds/{BlogId}/posts/default";
  public static void main(String[] args) throws Exception
  {
    File file = new File( filename );
    BufferedReader br = new BufferedReader( new InputStreamReader(
                          new FileInputStream(file), "utf-8"));
    String title = br.readLine();
    String content = "", line = "";
    while( (line = br.readLine()) != null ) {
      content += line;
    }
    br.close();

    URL postUrl = new URL( post_url );
    Entry myEntry = new Entry();

    myEntry.setTitle(new PlainTextConstruct( title ));
    myEntry.setContent(new PlainTextConstruct( content ));

    Person author = new Person( user, null, email );
    myEntry.getAuthors().add(author);

    GoogleService myService = new GoogleService("blogger", "blog-post-1");
    myService.setUserCredentials(email, passwd);

    Entry insertedEntry = myService.insert(postUrl, myEntry);
  }
}

gravatar

copyblog 測試

之前用 blogger atom 的方式又失效了,這次改回用原本的 copyblog 方法看看。這篇是測試用,如果方便請盡量改用 feed://feeds.feedburner.com/jclin 或是 http://jclin.wordpress.com/feed/

gravatar

接二連三的編碼錯亂

wordpress.com 編碼亂掉後, 緊接著發現由 feedburner 所讀取的 feed xml 內容也會變成亂碼, 而 copyblog.pl 也因為 utf-8 亂掉而會造成 XML parsing 的問題. wordpress.com 的文章既然回復不了, 就從 blogger.com 把文章 import 進來, 只是變成多了一堆重複的文章出現. 還要找時間把編碼有問題亂掉的砍掉, 但是 category 部分因為是 import 的而都是變成 talk. feed 編碼沒問題後, copyblog.pl 也沒問題了.

gravatar

copyblog.pl

gslin 的 copyblog.pl 對於 blogger 的中文似乎有點問題,是有複製過來了,但是看不到中文,只剩下英文部份。看一下 gslin.blogspot.com 似乎也有這樣的問題,只剩下英文的部份。而 CPAN 上找到的 Net::Blogger 可以使用 SOAP XML 來發表 blogger 文章,但是卻沒有 title 可以用。然而看了 Blogger 自己的 API 文件,裡面的 XML 格式卻是有 title tag 可以使用。最後自己用 wget 來做了。
首先 copyblog.pl 裡面的 title, content 抓到後,寫到一個檔案(如 post.xml),這個檔案內容就是類似這個 XML 檔案。然後使用 wget,命令如下:

wget -O- --header='Content-Type:application/xml'
--post-file=post.xml --http-user=foo –http-passwd=bar
 https://www.blogger.com/atom/BLOGGERID

gravatar

Testing Post from ecto

ecto 真是一個好用的工具,光是可以透過 blogger API 把文章取回來就很棒了。還有提供很多不同 blog platform 的工具,管理、修改和寫文章都很方便,而且還是 Cocoa Native 環境下使用。

Technorati Tags: ,

gravatar

Change to a new theme

把 blogger 的佈景主題換成新的。原先的寬度是固定的,大概 700px,不能完全利用螢幕和瀏覽器寬度,有些較長的 code 都穿出去了。且該佈景主題在 IE & Safari 下會有問題,就是 content 有不換長的文字,且超過 content 的設定寬度,則 content 部份會跑到左邊 sidebar 下方 XD。但是在 Firefox 自己看起來都正常。anyway 順便換個比較寬且簡單的主題。

Tags: , blogger

gravatar

blogger 的 create post verification

如果使用 dashboard 的"+"方式來寫新的 post,那麼就不會出現下面的 word verification。而在 posting 的 create 來寫新的文章,則會出現這樣的 verification。不過對於這樣的用意是?一般在會員註冊使用是避免利用 bot 大量註冊,而在論壇或是 comment 是避免廣告或是 bot 大量寫廣告或是無意內容。而 blogger 在會員的 create post 做這樣的行為,很難想到用意目的是什麼?避免使用 bot 來 post articles?

gravatar

blog post from dashboard

Tiger Dashboard 提供了一個 widget 下載, 這個 widget 叫做 Dash Blog,可以讓使用者從 dashboard 裡面直接寫 blog 內容,然後經由 XML-RPC 發佈到個人的 blog 上。目前我是使用 blogger 所以他預設就可以這樣用。其他 blog 系統不知道要怎樣使用,不過這樣感覺蠻方便的。:P