原创 享元模式-讓手機短信聊天更方便

享元模式比喻每天跟MM發短信,手指都累死了,最近買了個新手機,可以把一些常用的句子存在手機裏,要用的時候,直接拿出來,在前面加上MM的名字就可以發送了,再不用一個字一個字敲了。共享的句子就是Flyweight,MM的名字就是提取出來的外

原创 Android程序調用攝像頭

很多開發者都想在Android程序中調用攝像頭,並對拍出的照片進行處理。首先先對程序的進行一下預覽: 首先先對主頁面進行設計,這裏很簡單,只是加了個按鈕和一張圖片。 <?xml version="1.0" encoding="utf-8

原创 Android實現語音識別

蘋果的iphone的語音識別功能使用的是Google的技術,做爲Google力推的Android自然會將其核心技術植入到Android系統裏面,並結合google的雲端技術將其發揚光大。 所以Google Voice Recognit

原创 Problem 19 of How many Sundays fell on the first of the month during the twentieth century

http://projecteuler.net/problem=19 You are given the following information, but you may prefer to do some research for

原创 Problem 14 of Collatz Problem

The following iterative sequence is defined for the set of positive integers: n  n/2 (n is even)n  3n + 1 (n is odd)

原创 外觀模式-傻瓜相機的原理

外觀模式比喻 我有一個專業的Nikon相機,我就喜歡自己手動調光圈、快門,這樣照出來的照片才專業,但MM可不懂這些,教了半天也不會。幸好相機有Facade設計模式-外觀模式,把相機調整到自動檔,只要對準目標按快門就行了,一切由相機自動調

原创 Java程序員應該瞭解的10個面向對象設計原則

面向對象設計原則是OOPS(Object-Oriented Programming System,面向對象的程序設計系統)編程的核心,但大多數Java程序員追逐像Singleton、Decorator、Observer這樣的設計模式,而

原创 Android 性能優化 Designing for Performance

原文          http://developer.android.com/guide/practices/design/performance.html 性能優化 Android應用程序運行的移動設備受限於其運算能力

原创 Android自定義畫虛線的控件

在Android的UI開發中,有時爲了界面美觀而需要使用虛線。在這裏我自己實現一個畫虛線的控件。 package com.custom; import android.content.Context; import android.g

原创 歐拉項目 Problem 17 of how many letters would be used?

If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 lett

原创 Android應用層判斷當前網絡連接模式

/** * 判斷當前連接模式是否爲WIFI * @param context * @return 返回true爲wifi */ public static boolean isWIFIConnection(Context context)

原创 Problem 21 of Evaluate the sum of all the amicable numbers under 10000.

Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b an

原创 建造者模式-向不同地方國家的女生說”我愛你”

建造者模式比喻 女生最愛聽的就是“我愛你”這句話了,見到不同地方的女生,要能夠用她們的方言跟她說這句話哦,我有一個多種語言翻譯機,上面每種語言都有一個按鍵,見到不同地方的女生我只要按對應的鍵,它就能夠用相應的語言說出“我愛你”這句話了

原创 Java spi機制 面向接口的編程

最近看到公司的一些框架和之前看到的開源的一些框架的一些服務發現和接入都採用了java的spi機制。 所以簡單的總結下java spi機制的思想。 SPI的全名爲Service Provider Interface.普通開發人員可

原创 adb 命令及使用權限問題

現在移動設備很多,手機管家也有不少,比如騰訊,91,360等,這些移動設備連接上電腦且開啓調試模式,在windows環境下,只要是找到了驅動就可以使用adb命令。但是也有些特殊移動設備,沒有找到驅動,就需要到linux環境下連接了,而在l