Zack Notes
iDhamma1.2 is ready to update
Written by Zack Sunday, 05 June 2011 12:00
အားလံုး မဂၤလာပါ ခင္ဗ်ာ။ Feedback ေတြ၊ Comment ေတြ၊ Rating ေတြအားလံုး အတြက္ တကယ္ကို ေက်းဇူးတင္ပါတယ္။ ဆက္ၿပီးေပးဖို႔လည္း ေတာင္းဆိုပါတယ္။ iDhamma1.2 မွာ ဘာေတြေျပာင္းလဲသြားလဲဆိုတာ
- Screen auto lock က်သြားရင္ နာေနတဲ့ တရားသံက ေပ်ာက္သြားတဲ့ ျပႆနာ ရွိေနပါတယ္။ 1.2 မွာ အဲဒီ issue ကို fixedလုပ္လိုက္ပါၿပီ။ screen lock က်သြားရင္ေတာင္ အသံမေပ်ာက္ ေတာ့ပါဘူး။
- Details View မွာ စာဖတ္တဲ့ အခါ font size ေတြကို large,normal, small ဆိုၿပီးဖတ္လို႔ ရဖို႔ “T+”, “T”, “T-” ဆိုတဲ့ button သံုးခုကို ထည့္ထားပါတယ္။
- Mapview ကို UI အနည္းငယ္ ေျပာင္းလိုက္ပါတယ္။
- စာလံုးေပါင္း အမွားျပင္တာကလြဲရင္ Content ေတြအားလံုးက အရင္အတိုင္း ေျပာင္းလဲမႈ မရွိပါ။
MS Window 8
Written by Zack Friday, 03 June 2011 11:21
ကြၽန္ေတာ္ Mac + ubuntu linux ကိုအေသၾကိဳက္တယ္။ ဒါေပမယ့္ window 8 က ခုရွိေနတဲ့ window version ေတြနဲ႔ မတူ တစ္မူကြဲသြားမယ္လို႕ ထင္တယ္။
Youtube Video Uploading script by using php Zend Framework
Written by Zack Friday, 03 June 2011 10:32
ဒီ Post ကေတာ့ Php Frameword တစ္ခုျဖစ္တဲ့ Zend ကိုသံုးၿပီး Youtube ကို Video ေတြ Upload တင္တဲ့အေၾကာင္းျဖစ္ပါတယ္။ တစ္ခုေျပာစရာရွိတာက ဒီ Video File ေတြကို Youtube Website ကေနၿပီးတင္မယ္ဆိုရင္ ပိုေတာင္လြယ္ေသးတာကို ဘာလို႔ Script ေရးေနမလည္းဆိုတာဘဲျဖစ္ပါတယ္။ တစ္ခါတစ္ေလမွာ ကိုယ့္ Website ေပၚကေနျဖစ္ေစ၊ Mobile app တစ္ခုခုကေနျဖစ္ေစ Web Services သေဘာမ်ိဳးနဲ႔ Video ေတြကိုတင္ရတာမ်ိဳးေတြရွိႏိုင္ပါတယ္။ အဲဒီလိုအခါမ်ိဳးေတြမွာ ဒီလို Script ေတြက တကယ္ကိုအသံုး၀င္လာပါလိမ့္မယ္။
Requirements
1) Youtube Account တစ္ခုလိုပါတယ္။
2) Zend FrameWork ကို ဒီေနရာကေန Download လုပ္ၿပီးကိုယ့္ Project ထဲကိုအရင္ထည့္ေပးထားပါ။

require_once("Zend/Gdata/ClientLogin.php"); $yt_user = myaccount; //youtube username or gmail account
Coding start
ဒီေနရာကေတာ့ Zend Framework Libs ထဲကေန include လုပ္ထားတာျဖစ္ပါတယ္။
require_once("Zend/Gdata/HttpClient.php");
require_once("Zend/Gdata/YouTube.php");
require_once("Zend/Gdata/App/MediaFileSource.php");
require_once("Zend/Gdata/App/HttpException.php");
require_once('Zend/Uri/Http.php');
ဒါကေတာ့ ကိုယ့္ Youtube account ရဲ႕ username + password ကိုထည့္ေပးထားရပါမယ္။ တစ္ခုသတိျပဳစရာရွိတာက Youtube account username က @gmail.com ဆိုတာထည့္ေပးစရာမလိုပါဘူး။ ဥပမာ ကိုယ့္ account က myaccount@gmail.com ဆိုရင္ဒီေနရာမွာက myaccount ဆိုတာကိုဘဲထည့္ေပးဖို႔လိုပါတယ္။ password ကေတာ့ ကိုယ့္ password ကိုမွန္ေအာင္ထည့္ေပးရပါမယ္။
$yt_pw = 'hellopassword'; //account password
$yt_source = 'VideoUploadPHP'; //name of application (can be anything)
//get value from URL
$video_url = 'videos/abcd.avi';
ကိုယ့္ upload တင္ခ်င္တဲ့ video File နဲ႔ path + Filename ကိုဆိုလိုပါတယ္။ ဥပမာ video ဆိုတဲ့ Folder ထဲမွာသိမ္းထားမယ္ ဆိုရင္ေတာ့ videos\abcd.avi ေပါ့ဗ်ာ။
$yt_api_key = 'AI39si4gIRU70tv45vZBOuBquzP8qmPPtokpl-UDxwANTNg0-I8xWJh04Ndc8volAB4w8Tk8vRqIdYmVZGrJohgXO2uQklGNnlA--A'; // your youtube developer key
ဒါကေတာ့ YouTube API ကိုသုံးဖို႔ register လုပ္ထားတဲ့ Developer Key ပဲျဖစ္ပါတယ္။
ေနာက္ပိုင္း code ေတြကေတာ့ ေထြေထြထူးထူးျပင္ေပးစရာမလို မလိုပဲ အေပၚက Setting ေတြမွန္တယ္ ဆိုရင္ အလုပ္လုပ္ပါမယ္။ Coding အျပည့္အစုံကို ဒီေအာက္မွာ ျပန္ေရးေပး လိုက္ပါတယ္။
#error_reporting(E_ALL);
//include Zend Gdata Libs
require_once("Zend/Gdata/ClientLogin.php");
require_once("Zend/Gdata/HttpClient.php");
require_once("Zend/Gdata/YouTube.php");
require_once("Zend/Gdata/App/MediaFileSource.php");
require_once("Zend/Gdata/App/HttpException.php");
require_once('Zend/Uri/Http.php');
//yt account info
$yt_user = '';//youtube username or gmail account
$yt_pw = ''; //account password
$yt_source = ''; //name of application (can be anything)
//video path $video_url = '/full/path/to/video';
//yt dev key
$yt_api_key = ''; //your youtube developer key
//login in to YT
$authenticationURL= 'https://www.google.com/youtube/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient( $username = $yt_user, $password = $yt_pw, $service = 'youtube', $client = null, $source = $yt_source,
// a short string identifying your application
$loginToken = null, $loginCaptcha = null, $authenticationURL);
$yt = new Zend_Gdata_YouTube($httpClient, $yt_source, NULL, $yt_api_key);
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
$filesource = $yt->newMediaFileSource($video_url);
$filesource->setContentType('video/quicktime'); //make sure to set the proper content type.
$filesource->setSlug('mytestmovie.mov');
$myVideoEntry->setMediaSource($filesource);
$myVideoEntry->setVideoTitle('My Test Movie');
$myVideoEntry->setVideoDescription('My Test Movie'); // Note that category must be a valid YouTube category !
$myVideoEntry->setVideoCategory('Comedy'); // Set keywords, note that this must be a comma separated string // and that each keyword cannot contain whitespace
$myVideoEntry->SetVideoTags('cars, funny'); // Upload URI for the currently authenticated user
$uploadUrl = "http://uploads.gdata.youtube.com/feeds/users/$yt_user/uploads"; // Try to upload the video, catching a Zend_Gdata_App_HttpException
// if availableor just a regular Zend_Gdata_App_Exception
try {
$newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
} catch (Zend_Gdata_App_HttpException $httpException) {
echo $httpException->getRawResponseBody();
} catch (Zend_Gdata_App_Exception $e) {
echo $e->getMessage();
} //this outputs a ton of garbage. not sure what to do with it yet.
$YoutubeID = $newEntry->getVideoId();
if($YoutubeID<>""){
echo "Your video successfully uploaded"; }
else{ echo "Uploading process fail";
}
$YoutubeID = $newEntry->getVideoId();
အားလုံးျပီးသြားရင္ေတာ့ YouTube မွာ uploading successful ျဖစ္မျဖစ္ဆိုတာကို ဒီလိုမ်ိဳး YoutubeID ကိုျပန္ယူျပီး စစ္ေပးႏိုင္ပါတယ္။
တကယ္လို႔ successfully upload ျဖစ္သြားတယ္ဆိုရင္ေတာ့ Your video successfully ဆိုတဲ့ message ကိုျမင္ရမွာျဖစ္ၿပီး Double check လုပ္ခ်င္တယ္ဆိုရင္ေတာ့ Youtube account ကို Login ၀င္ၿပီးခုနတင္လိုက္တဲ့ video ကိုျပန္စစ္ၾကည့္ႏိုင္ပါတယ္။
Uploading လုပ္ျပီးရင္ Delete ဘယ္လို လုပ္ၾကမလဲ??? ဒါကေတာ့ ေနာက္ Post တစ္ခုလာပါမယ္ ခင္ဗ်ာ။
How to use Google Map in Android App
Written by Zack Monday, 02 May 2011 12:00
Google Map ကို Android Phone ေတြေပၚမွာ ဘယ္လိုသုံးမလဲ ဆိုတဲ့ example ေလးတစ္ခုပါ။ ကိုယ့္သုံးတဲ့ platform ေပၚမူတည္ျပီး API Key generate လုပ္တာ အနည္းငယ္ကြာေသာ္လည္း က်န္တာေတြကေတာ့ အတူတူပါပဲ။ ကြၽန္ေတာ့္ကေတာ့ mac ေပၚမွာ development လုပ္ပုံကို ေရးမွာ ျဖစ္ပါတယ္။
1) Development Environment set up
ကိုယ့္သုံးထားတဲ့ SDK ကို install လုပ္ထားရုံနဲ႔ မလုံေလာက္ပဲ Google APIs ေတြကိုပါ ဆက္ျပီး ထည့္ေပးဖို႔ လိုပါတယ္။ Install မလုပ္ရေသးရင္ေတာ့ ဒီေနရာကေန “Window>Android SDK and AVD Manager”

2) Google MAP API generation
API Key ရဖို႔ အရင္ဆုံး md5 checksum certificate တစ္ခုကို ကိုယ့္ computer ထဲကေန အရင္ ထုတ္ေပးဖို႔ လိုတယ္ဗ်ာ။ Terminal ကိုဖြင့္လိုက္ျပီး ဒီလို႐ိုက္ျပီး enter ေခါက္ပါ။
keytool -list -alias androiddebugkey -keystore ~/.android/debug.keystore -storepass android -keypass android
Certificate fingerprint (MD5): ေဘးက md5 key ေတြကို ကူးလိုက္ပါ။

အဲဒီ key ကိုသုံးျပီး Google မွာ singup သြားလို႕ေပးဖို႔ လိုပါတယ္။ ဒီ textbox မွာ ခုနတုန္းက ကူးထားတဲ့ md5 ကိုထည့္ေပးလိုက္ပါ။

ျပီးသြားရင္ေတာ့ ဒီလိုမ်ိဳး ေတြ႔ရပါလိမ့္မယ္။

3) Create New project & Coding
File > New > Android Projects ကိုသြားလိုက္ပါ။ build target ကိုေရြးတဲ့ အခါ ခုနတုန္းက install လုပ္ထားတဲ့ Google Map APIs ကို select လုပ္ေပးရပါမယ္။

ျပီးရင္ေတာ့ လိုအပ္မယ့္ ItemizedOverlay အတြက္ class တစ္ခု ထည့္ထားတာ ေကာင္းပါတယ္။
Right Click Project > New > Class ကို အရင္သြားျပီး ေအာက္က ပံုအတိုင္း လုပ္ေပးရပါမယ္။ သတိျပဳ ရမွာကေတာ့ Source Folder ၊ Package ေနရာေတြ မွန္ဖို႔လိုပါတယ္။ "constructors from superclass" ကို select လုပ္ေပးပါ။ ဒီအတိုင္းျမင္ ရပါလိမ့္မယ္။

res > layout > main.xml ထဲမွာ ရွိေနတာေတြကို အကုန္ delete လုပ္လိုက္ျပီ ဒီ code ေလးကိုထည့္ေပး လိုက္ပါ။ <?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:enabled="true"
android:apiKey="Your API Key" />
</RelativeLayout>
YOUR API KEY ကေတာ့ ခုနတုန္းက register လုပ္ထားတဲ့ key ကိုထည့္ေပး ရပါမယ္။
AndroidManifest.xml ကိုလည္း ဒီ code ေတြထည့္ျပီး override လုပ္လိုက္ပါ။
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.pph.maptut"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".maptut"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
maptut.java ထဲမွာ ဒီ Code ေတြကိုထည့္ေပးဖို႔ လိုပါတယ္။ package info.pph.maptut;
import java.util.List;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;
public class maptut extends MapActivity {
private MapView mapView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.map_view);
mapView.setBuiltInZoomControls(true);
List<Overlay> mapOverlays = mapView.getOverlays();
Drawable drawable = this.getResources().getDrawable(R.drawable.icon);
HelloItemizedOverlay itemizedOverlay = new HelloItemizedOverlay(drawable, this);
GeoPoint point = new GeoPoint((int)(1.3568 * 1e6), (int)(103.9891 * 1e6));
OverlayItem overlayitem = new OverlayItem(point, "Hello", "This is Changi Airport Singapore");
itemizedOverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedOverlay);
MapController mapController = mapView.getController();
mapController.animateTo(point);
mapController.setZoom(6);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
ဒီအခ်ိန္မွာ error ေတြေတြ႔ ရႏိုင္ပါတယ္။ ဒါေၾကာင့္ HelloItemizedOverlay.java မွာ ဒီ code ေတြထပ္ထည့္ ေပး ရပါမယ္။
HelloItemizedOverlay.java
package info.pph.maptut;
import java.util.ArrayList;
import android.app.AlertDialog;
import android.content.Context;
import android.graphics.drawable.Drawable;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;
public class HelloItemizedOverlay extends ItemizedOverlay<OverlayItem>
{
private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
private Context mContext;
public HelloItemizedOverlay(Drawable defaultMarker, Context context)
{
super(boundCenterBottom(defaultMarker));
mContext = context;
}
public void addOverlay(OverlayItem overlay)
{
mOverlays.add(overlay);
populate();
}
@Override
protected OverlayItem createItem(int i)
{
return mOverlays.get(i);
}
@Override
public int size()
{
return mOverlays.size();
}
@Override
protected boolean onTap(int index)
{
OverlayItem item = mOverlays.get(index);
AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
dialog.setTitle(item.getTitle());
dialog.setMessage(item.getSnippet());
dialog.show();
return true;
}
}
အဲဒီ အဆင့္ျပီးသြားရင္ေတာ့ Emulator ေပၚကေန run ၾကည့္ႏိုင္ပါတယ္။ တစ္ခု သတိထားရမွာက ကိုယ္ထည့္ထားတဲ့ emulator က Google API ေတြကို support လုပ္တာမ်ိဳး ျဖစ္ရပါမယ္။ အဲလို မဟုတ္ရင္ေတာ့ error တတ္လာႏိုင္ပါတယ္။

ဒါဆိုရင္ေတာ့ အားလုံးျပီးသြားျပီ ျဖစ္လို႕ Emulator ကေန run လိုက္တဲ့ အခါမွာေတာ့ ဒီလိုမ်ိဳးေလး ေတြ႔ရပါမယ္။ အတတ္ႏိုင္ဆုံး ရွင္းေအာင္ေတာ့ ေရးထားပါတယ္။ အဆင္ေျပမယ္လို႕ ထင္ပါတယ္။


မွတ္ခ်က္။ ။ ကြၽန္ေတာ့္ေရးတာ မရွင္းရင္ေတာ့ Android Developer Reference ကေန အေသးစိတ္ ထပ္ဖတ္ႏိုင္ပါတယ္။ ဘယ္ function ကို ဘာေၾကာင့္ေရးတယ္ ဆိုတာေတြကို ပိုသိသြားပါ လိမ့္မယ္။
GeoPoint and double value Issue in Android
Written by Zack Monday, 02 May 2011 13:13
Android နဲ႔ MAP ေရးရင္ GeoPoint ဆိုတဲ့ function ကိုသုံးျပီး latitude, longitude ေတြကို ထည့့္ေပး ရပါမယ္။ GeoPoint point = new GeoPoint(19240000,-99120000);
ကိုယ္ထည့္ရမွာက integer ေတြဆိုရင္ေတာ့ ဒီလို ေရးလို႕ ရပါတယ္။
GeoPoint က int ေတြပဲ ထည့္လို႕ ရတာကို ဒီမွာသြားၾကည့္ လိုရပါတယ္။ GeoPoint point = new GeoPoint((int)(latitude * 1e6), (int)(longitude * 1e6));
ဒါေပမယ့္ ကြၽန္ေတာ့္တို႔ ေနထိုင္တဲ့ အေရွ႕ေတာင္အာရွ ရဲ႕ lat & long ေတြက double value ေတြျဖစ္ေနတာေၾကာင့္ ဒီလို ေရးေပးဖို႔ လိုပါတယ္။
Joomla 1.5 Yunghkio Unicode Webfont plugin
Written by Zack Tuesday, 26 April 2011 23:29
ေဇာ္ဂ်ီ WebFont Plugin ကို ေရးထားေတာ့ Unicode အတြက္လည္း ဒီ plugin ေလးကို ေရးလိုက္ပါတယ္။ Unicode သုံးထားတဲ့ Joomla Site ေတြမွာ font မရွိလည္းပဲ ျမင္ရေအာင္ လုပ္ခ်င္တယ္ ဆိုရင္ေတာ့ ဒီ plugin ကို install လုပ္ျပီး publish လုပ္ေပး လိုက္ရင္ရျပီဗ်ာ။ အားလုံး အဆင္ေျပ မယ္လို႕ ထင္ပါတယ္။
More Articles...
Page 4 of 43
«StartPrev12345678910NextEnd»Login Form
Latest Post
Categories Table View
- Reader's Conner (133)
- PHP (48)
- Joomla CMS (46)
- Codeigniter (18)
- jQuery (12)
- iDhamma (11)
- Mobile Development (10)
- PHP & AJAX (4)
- Apache (3)
- For Mac (3)
- mySQL (2)
- DhammaDroid (1)