This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GsonBuilder gson = new GsonBuilder(); | |
gson.registerTypeAdapter(ResponseMessage.class, new UsingTimeDataTypeAdapter()); | |
return gson.create().fromJson(result, ResponseMessage.class); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connection conn = null; | |
Statement stmt = null; | |
try{ | |
Class.forName("com.mysql.jdbc.Driver"); | |
conn = DriverManager.getConnection(DB_URL,USER,PASS); | |
stmt = conn.createStatement(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<ChatChooseItem> chatChooseItems = getMockItems(); | |
List<ChatChooseItem> testList = new ArrayList<>(); | |
PublishSubject<String> publishSubject = PublishSubject.create(); | |
publishSubject | |
.throttleWithTimeout(300, TimeUnit.MILLISECONDS) | |
.flatMap(s -> Observable.from(chatChooseItems) | |
.filter(chatChooseItem -> chatChooseItem.getName().toLowerCase().contains(s.toLowerCase())) | |
.toSortedList((lhs, rhs) -> lhs.getName().toLowerCase().compareTo(rhs.getName().toLowerCase())) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openpyxl import Workbook, load_workbook | |
# https://docs.djangoproject.com/en/1.8/topics/http/file-uploads/ | |
# https://docs.djangoproject.com/en/1.8/ref/files/uploads/ | |
# or Custom File Upload Handler | |
# File Upload to Temporary or Memory | |
def xlrd(request): | |
# After Uploaded.... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String getImagePath(Context context, Uri uri){ | |
if ("content".equalsIgnoreCase(uri.getScheme())) { | |
if (isGoogleOldPhotosUri(uri)) { | |
// return http path, then download file. | |
return uri.getLastPathSegment(); | |
} else if (isGoogleNewPhotosUri(uri)) { | |
// copy from uri. context.getContentResolver().openInputStream(uri); | |
return copyFile(context, uri); | |
} else if (isPicasaPhotoUri(uri)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private SSLContext getSSLContext() throws KeyManagementException, NoSuchAlgorithmException { | |
SSLContext context = SSLContext.getInstance("SSL"); | |
context.init(null, new TrustManager[]{new X509TrustManager() { | |
public void checkClientTrusted(X509Certificate[] x509Certificates, String authType) throws CertificateException { | |
} | |
public void checkServerTrusted(X509Certificate[] x509Certificates, String authType) throws CertificateException { | |
} | |
public X509Certificate[] getAcceptedIssuers() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Observable.just(1,2,3) | |
.onBackpressureBuffer() | |
.observeOn(Schedulers.computation()) | |
.subscribe(input -> { | |
doSomething(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<p id="demo"></p> | |
<script> | |
var i = 10; | |
while (--i) { | |
document.getElementById("demo").innerHTML += i + "<br>"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(AndroidJUnit4.class) | |
public class AccountHomePresenterImplTest { | |
private AccountHomePresenterImpl accountHomePresenter; | |
private AccountHomePresenter.View viewMock; | |
@Before | |
public void setUp() throws Exception { | |
accountHomePresenter = AccountHomePresenterImpl_.getInstance_(JandiApplication.getContext()); | |
viewMock = mock(AccountHomePresenter.View.class); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends Activity { | |
@Override public void onCreate(Bundle savedInstance) { | |
RecyclerView rv = findViewById(R.id.lv); | |
RecyclerView.Adapter adapter = new SampleAdapter(); | |
rv.setAdapter(adapter); | |
adapter.add(new Data()); | |
adapter.add(new Data()); // add Data | |
adapter.nofityDatasetChanged(); // refresh Screen | |
} |