2014年12月18日 星期四

Bitbucket + SourceTree + Laravel 教學

Git 新手操作教學:

Bitbucket + SourceTree + Laravel  教學

1.首先連到 BitBucket,註冊一個新的帳號



2. 創建一個全新的專案,填上相關資料


3. 完成後可以看到 Clone in SourceTree 按鈕,不過因為還沒安裝 SourceTree 需先安裝後才可以做做相關連動快速設定



4. 安裝後,按下 Clone in SourceTree 按鈕,開啟應用程式



5. 設定好相關路徑後,按下Clone,完成設定



6. 將 Laravel 相關檔案加入到資料下,以建立Laravel 專案



7. 出現本機目錄與遠端目錄的差異檔案,我們可以點選UnStaged files,設定準備將檔案上傳至遠端 (Remote), 然後再按下Commit(提交)按鈕




8 .最後回到 Bitbucket網站上看,就可以看到我們成功將檔案上傳至 Bitbucket


2014年12月10日 星期三

Sample code for preventing Android Google Map V2 crash on ViewPager

package com.example;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapsInitializer;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

public class FragmentMap extends Fragment {

private GoogleMap googleMap;
private static View rootView;
private SupportMapFragment mapFrag;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

        if (rootView != null) {
                ViewGroup parent = (ViewGroup) rootView.getParent();
                if (parent != null)
                    parent.removeView(rootView);
        }
 
        try{
                if(rootView == null)
                {
                    rootView = inflater.inflate(R.layout.event_detail_fragment_route, container, false);
                }


            } catch (Exception e)
            {
                e.printStackTrace();
            }

        mapFrag = (SupportMapFragment)  
                               getActivity().getSupportFragmentManager().findFragmentById(R.id.fragMap);
        googleMap = mapFrag.getMap();

 
         if (googleMap != null) {
            googleMap.getUiSettings().setMyLocationButtonEnabled(false);
            googleMap.setMyLocationEnabled(true);
            googleMap.addMarker(new MarkerOptions().position(new LatLng(25.033611,121.564722)));
  
            MapsInitializer.initialize(this.getActivity());
            // Updates the location and zoom of the MapView
           CameraUpdate initalUpdate = CameraUpdateFactory.newLatLngZoom(
                new  LatLng(25.033611,121.564722), 10);
            googleMap.animateCamera(initalUpdate);
 
       } 
         return rootView;
}



}