Feb 17, 2009

Subscription TV programs from Yahoo Pipe

Are you always missing TV programs or checking menu each day, so I create a pipe using Yahoo Pipe that can help you comfortable get TV programs timetable by RSS.
Limitation:
The pipe just support 200 item maximal.
The date range within five day.
1.Open Browser and jump to the pipe.
image
2.Enter keyword of TV program in the textbox after them click Run Pipe.
image image
3. Right click Get as RSS , select Copy Link Location.
image
4.Jump to xFruits and then sign up a account by yourself.
image image
5. I would like to get notifications by Mail so that click RSS to Mail and then fill the form.
image
image
6.Well, You will get mail very soon.
image
Resources:
Pipes: Rewire the web
http://pipes.yahoo.com/pipes/
xFruits - Compose your information system
http://www.xfruits.com/
Yahoo! Pipes Tutorial - An example using the Fetch Page module to make a web scraper
http://www.daybarr.com/blog/2007/12/11/yahoo-pipes-tutorial-an-example-using-the-fetch-page-module-to-make-a-web-scraper
電視時刻 - Yahoo!奇摩電影
http://tw.movie.yahoo.com/tv_index.html
The Regex Coach - interactive regular expressions
http://weitz.de/regex-coach/index.html
Java Regular Expression的學習筆記
http://www.javaworld.com.tw/jute/post/view?bid=20&id=130126&sty=1&tpg=2&age=0

Feb 4, 2009

How to create kmz with picture icon

1. Take pictures and star GPS logger
2. Write geo-information to pictures(To reference posted article:GPS 記錄器、相簿、工具、節點編輯...)
3. Launch Friendly Flicker
4.open a text file and put into below text and save to doc.kml(UTF8 format)
doc.kml

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
<name>Recent Uploads with geodata</name>
<open>1</open>

</Document>
</kml>

clip_image002
image
5. click tab “選項”then select all options.
image
6.Select “清單顯示”that faster than icon mode.
image
7. Input search conditions then click “搜尋相片.
image
8.While all of picture information loaded. right click on list and select "選擇全部相片”
image
9.Copy below text then put into firendly flickr.

<style id="normal/photo/{url}"><br />       <labelstyle><br />           <color>00ffffff</color><br />           <scale>1</scale><br />       </labelstyle><br />       <iconstyle><br />           <scale>2</scale><br />           <hotspot x="0.5" y="0.5" xunits="fraction" yunits="fraction"><br />           <icon><br />               <href>{image_st}</href><br />           </icon><br />       </iconstyle><br />   </style>
<style id="highlight/photo/{url}"><br />       <labelstyle><br />           <color>ffffffff</color><br />           <scale>1</scale><br />       </labelstyle><br />       <iconstyle><br />           <scale>2</scale><br />           <hotspot x="0.5" y="0.5" xunits="fraction" yunits="fraction"><br />           <icon><br />               <href>{image_st}</href><br />           </icon><br />       </iconstyle><br />   </style>
<stylemap id="styleMap/photo/{url}">
   <pair>
     <key>normal</key>
     <styleurl>#normal/photo/{url}</styleurl>
   </pair>
   <pair>
     <key>highlight</key>
     <styleurl>#highlight/photo/{url}</styleurl>
   </pair>
 </stylemap>
<placemark>
   <styleurl>#styleMap/photo/{url}</styleurl>
   <name>{title}</name>
   <snippet maxlines="4">
  
   </snippet>
       <description>
       <!--[CDATA[                <a href="{url}"><img src="{image_s}" /></a><br /><br />               <b>Title:</b>{title}<br /><br />               <b>Descript:</b><br />{descript}<br /><br />               <b>Date time:</b>{date_time}<br /><br />               <b>Model:</b>{model}<br /><br />               <b>Tags:</b>{tag1},{tag2},{tag3} ...<br /><br />               <a href="{url}">Open photo page</a><br />               <br /><br />               ]]-->
       </description>
   <point>
       <coordinates>{longitude},{latitude}</coordinates>
   </point>
</placemark>

10.Click tab 進階模版 and 啟動
clip_image006
11.Click “複製到剪貼簿”(the friendly fickr will get picture information form web site and apply the template before put inside.)
※Because the FF do not supprt photo id parameter , so that use url to generate id. after step replace surplus urls.
clip_image008
image
clip_image010
12.Replace the picture id. copy below option to replace dialog. and select Regular Expressions and select option Perl
photo/http://www.flickr.com/photos/(.*?)/(.*?)/
photo/\2

clip_image012
clip_image014
14.compress to zip file and rename the extension to *.kmz
clip_image016
15.After that you can place in internet such as google page to share anyone.
16.This site can validator your kmz.
clip_image018
Demo … Google Map
clip_image020
Save the kmz link to My Map that will show pictures by postition when you move .
image
Double click *.kmz … Google Earth
image

ubuntu configuration memo

Install gcin and liu

sudo apt-get install gcin
tar -zxf liu_gcin120.tar.gz
sudo ./liu_gcin120/install.sh
gedit ~/.gnomerc

#gcin environment

export GTK_IM_MODULE=gcin
export XMODIFIERS="@im=gcin"

gcin &

clip_image002

Launch System > Preferences > Sound > gcin Setup
click Setting for gtab input methods then unselect Auto-send when keycodes are filled
relogin x-window
Disable alert sound
System > Preferences > Sound > Soulds Tab
unselect “play alert sound”
Install stardic
sudo apt-get install stardict

Add firefox search plugin(/usr/lib/firefox-3.0.5/searchplugins)
Install windows applications
sudo apt-get install wine

Download the wine-door package from the link after that follow below commands to install
sudo dpkg -i wine-doors_0.1.2_all.deb

Install pdf-XChange right click on PDFXVwer.exe and select Open With Wine Windows Program Loader (This tool is useful to highlight and comment in pdf file)
Install IE6 just access link and fellow the instructions
Configuration Pidgin
right click on pidgin icon and select Blink on New Message. Again, click plugins and select below plugins.
  • History
  • Offline Mesasge Emulation
  • Message Notification
    Notify For
    ■ IM Windows
    ■ Chat windows
Accouns > select account which you are using > Modify
Enter Local alise and select New mail notifications
clip_image004


Install chm reader
sudo apt-get install gnochm

Issue: the default font size is small
Download the font-patch from the link after that follow below commands to apply.
sudo patch -b /usr/bin/gnochm < gnochm-fontsize.patch

Install Google gadget
Download the package from the link after that follow below commands to install.
sudo dpkg -i google-gadgets_0.9.3-0~getdeb1_i386.deb
Launch Applications > Accessories > Google Gadget (GTK)
Install Notes.
Download IBM Lotus Notes 8.5 Client for Linux (Debian Install) from IBM after that follow below commands to install.

mkdir notes
tar -xf '/home/brandon/Desktop/notes85_notes_linux_deb_beta2_prod.tar' -C notes
sudo dpkg -i notes/ibm_lotus_notes-8.5.i586.deb
/opt/ibm/lotus/notes/notes
Install JDK with Netbean / Eclipse
Download JDK from Sun after that follow below commands to install.
chmod u+x jdk-6u11-linux-i586.bin
./jdk-6u11-linux-i586.bin
gedit /home/brandon/.bashrc
export $JAVA_HOME=/home/brandon/jdk1.6.0_11
export PATH=$PATH:$JAVA_HOME/bin
clip_image006


Download Netbean from link after that follow below commands to install.
sudo '/media/Brandon'\''s HDD/untitled folder/netbeans-6.5-ml-java-linux.sh' --javahome $JAVA_HOME
Download Eclipse from link after that follow below commands to install.
sudo tar -zxvf eclipse-jee-ganymede-SR1-linux-gtk.tar.gz -C /opt/
gedit ~/.gnomerc

#JAVA Environment
export JAVA_HOME=/home/brandon/jdk1.6.0_11
export PATH=$PATH:$JAVA_HOME/bin 


clip_image008

Add new Launcher in deskop
clip_image010
Install Mail-Notification and enable SSL. (package)
(Reference : http://glyphobet.net/blog/essay/286)
sudo dpkg -i mail-notification_5.4.dfsg.1-1build1.deb

Google Notebook Gadget Resizer

The default height of notebook gadget is 200px , it’s too short that need often to scroll down/up , so that write a script to change the height.
image
Install Greasemonkey
https://addons.mozilla.org/en-US/firefox/addon/748
image
User Script:Google Notebook Gadget Resizer
http://userscripts.org/scripts/show/41679
image
Result:
image

Code:

// ==UserScript==
// @name          Google Notebook Gadget Resizer
// @description   To change height of gadgets in iGoogle
// @include       http://www.google.com/ig*
// @include       http://www.google.com.tw/ig*

// @author        parkghost@hotmail.com
// @version       1.0
// ==/UserScript==

// This script are working on Google notebook gadget and some similar gadgets which content type is url and not using dynamic-height feature.
//
// you can fellow below instruction to modify default height of Google notebook gadget or add more gadget to apply new height.
//
// 1.input "about:config" in url box
// 2.search "greasemonkey.scriptvals.userscripts.org/Google Notebook Gadget Resizer.oGadgets"
// 3.The properly is a array of url pattern with height that can modify of you want to.
//
// default:
// ({'http://www.google.com/notebook/ig':"600px", 'url pattern':"400px"})
//
// The url of gadget you could look at page source that place in iframe tag.(ex.http ://87.gmodules.com/ig/ifr?view=home&url=http://itszero.googlepages.com/iGoogleTVSchedule.xml&nocache=0&up_timeRange=0&up_showPrograms=6&up_fontSize=0.75&up_favoriteChannels=&up_defaultChannel=74&lang=en&country=us&.lang=en&.country=us&synd=ig&mid=87&ifpctok=-5100993727886241321&parent=http://www.google.com&extern_js=/extern_js/f/CgJlbhICdXMrMAo4ACwrMBA4ACwrMBI4ACwrMBM4ACwrMBU4ACw/GgLq_VyeDu0.js)
//
// The URL parameter is good to become a URL pattern.
// http://itszero.googlepages.com/iGoogleTVSchedule.xml

var oGadgets = {'http://www.google.com/notebook/ig':'600px','url pattern':'400px'};
var oGadgetsStr = GM_getValue('oGadgets');
if(oGadgetsStr){
 oGadgets = eval(oGadgetsStr);
}else{
GM_setValue('oGadgets',uneval(oGadgets));
}
var oFrames = document.getElementsByTagName('iframe');
for(var i=0 ; i < oFrames.length ; i++){ 
 for(var key in oGadgets){
   var re = new RegExp(key); 
   if(re.test(oFrames[i].src)){
     oFrames[i].style.height = oGadgets[key];
   }
 }
}

Resources:

Greasemonkey Manual:API
http://wiki.greasespot.net/API_reference

Managing Gadget Height
http://code.google.com/apis/gadgets/docs/ui.html#Dyn_Height

Jan 5, 2009

Write EJB Client

The JNDI could support java client  to get EJB instance from J2EE Container.
We have two type configuration for JNDI. First one,To hardcode properties in program look like listing 1, another one is put properties in file jndi.properties and place on root directory of classes.
Listing 1
Properties props = new Properties();        
props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.provider.url", "localhost:1099");
InitialContext ctx = new InitialContext(props);
helloworld = (HelloWorld)ctx.lookup("HelloWorldBean/remote");


Listing 2 (jndi.properties)


java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=localhost:1099


Ps. if application depoly on EJB container the container will import jndi properties form default configuration.