2016/12/29

How to correctly get screenshot from MediaProjection without black area

Step 1 Request a MediaProjection object MediaProjectionManager projectionManager = (MediaProjectionManager) getSystemService(Context.MEDIA_PROJECTION_SERVICE); startActivityForResult(projectionManager.createScreenCaptureIntent(), /*YOUR_REQUEST_CODE*/); Step 2 Once user submit the permission request dialog, you can get a MediaProjection object in MediaProjectionManager projectionManager = (MediaProjectionManager)...

2016/4/12

修復 MSSQL 資料庫[有疑問]狀態 (可能會遺失部分未存入硬碟的資料)

在SQL Server中執行下列指令修復資料庫 DECLARE @Dbname NVARCHAR(50) = 'DBNAME' --Replace to target db name DECLARE @Sql NVARCHAR(MAX) = '' SET @Sql = @Sql+'EXEC sp_resetstatus ['+@Dbname+'];' SET @Sql = @Sql+'ALTER DATABASE ['+@Dbname+'] SET EMERGENCY;' SET @Sql = @Sql+'DBCC CheckDB(['+@Dbname+']);' SET @Sql = @Sql+'ALTER DATABASE ['+@Dbname+'] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;' SET @Sql = @Sql+'DBCC CheckDB(['+@Dbname+'],...

2015/11/16

Android drawable-hdpi-v4\ic_launcher.png duplicate error

:metaioSDK_Test-GuideMan:processDebugResources xxxx\build\intermediates\res\merged\debug\drawable-hdpi-v4\ic_launcher.png: error: Duplicate file. xxxx\build\intermediates\res\merged\debug\drawable-hdpi\ic_launcher.png: Original is here. The version qualifier may be implied. Error:Execution failed...

method ID not in [0, 0xffff]: 65536

UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536 at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502) at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277) at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491) ...

Android 23.0.0 res build error

D:\tfs1\BokerAndroidForStudio\Boker_Navigation\NavigationMapLib\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.0\res\values-v23\values-v23.xml Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. Error:(2)...

2015/9/23

SSRS 安裝 ActiveX 時出現 "列印無法使用。..." 提示視窗

在幫客戶端電腦安裝SSRS ActiveX時遇上"列印無法使用。..."的問題,發生問題的環境如下: 客戶端環境: Windows 7 伺服器環境: Windows Server 2012 + SQL Server 2014 這裡附上英文的錯誤訊息圖(解決了才發現忘了截圖): 問題解決方式如下: 客戶端電腦安裝 Microsoft Visual C++ 2010 Redistributable Package (x86) 關閉頁籤再開啟網頁 如果失敗的話,可以建立一個bat檔放置以下內容,再以[系統管理員身分執行],來清除以安裝的ActiveX,再重新執行上面所述步驟 regsvr32...

2015/5/5

計算兩點之間連線的方位角[網路修改版]

網路上找到的程式碼算出來的都是與縱軸的最小夾角,加了一點程式碼讓結果變為與北方的方位角 private static double gps2d(double lat_a, double lng_a, double lat_b, double lng_b) { double d = 0; lat_a = lat_a * Math.PI / 180; lng_a = lng_a * Math.PI / 180; lat_b = lat_b * Math.PI / 180; lng_b = lng_b * Math.PI / 180; d = Math.sin(lat_a) * Math.sin(lat_b) + Math.cos(lat_a) * Math.cos(lat_b) * Math.cos(lng_b...