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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context="com.example.sagorsarker.addingswiprefresh.MainActivity"> | |
<!--refresh layout--> | |
<android.support.v4.widget.SwipeRefreshLayout |
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
<?xml version="1.0" encoding="utf-8"?> | |
<menu xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item | |
android:id="@+id/menu_refresh" | |
android:title="@string/menu_refresh" | |
app:showAsAction="never" | |
/> | |
</menu> |
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
SRL = (SwipeRefreshLayout) findViewById(R.id.swiperefresh); | |
SRL.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener(){ | |
@Override | |
public void onRefresh() { | |
Log.i(TAG, "onRefresh called from SwipeRefreshLayout"); | |
// This method performs the actual data-refresh operation. | |
// The method calls setRefreshing(false) when it's finished. | |
myUpdateOperation(); | |
} |
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
SRL = (SwipeRefreshLayout) findViewById(R.id.swiperefresh); | |
SRL.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener(){ | |
@Override | |
public void onRefresh() { | |
Log.i(TAG, "onRefresh called from SwipeRefreshLayout"); | |
// This method performs the actual data-refresh operation. | |
// The method calls setRefreshing(false) when it's finished. | |
myUpdateOperation(); | |
} |
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
case R.id.menu_refresh: | |
Log.i(TAG, "Refresh menu item selected"); | |
// Signal SwipeRefreshLayout to start the progress indicator | |
SRL.setRefreshing(true); | |
// Start the refresh background task. | |
// This method calls setRefreshing(false) when it's finished. | |
myUpdateOperation(); |
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
import android.app.Service; | |
import android.content.Context; | |
import android.net.ConnectivityManager; | |
import android.net.NetworkInfo; | |
/** | |
* Created by Sagor Sarker on 17-Nov-17. | |
*/ | |
public class ConnectionDetector { |
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 Hello{ | |
public static void main(String[] args){ | |
System.out.println("Hello World!"); | |
} | |
} |
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
# dependency | |
# pip install pydbgen | |
from pydbgen import pydbgen | |
import pandas as pd | |
generator = pydbgen.pydb() | |
# Generate a license-plate (US style) | |
print(generator.license_plate()) |
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
""" | |
This script will help you to create dset.h5 file for synthtext data generation. | |
SynthText: https://github.com/ankush-me/SynthText | |
First download imnames.cp, bg_img, depth.h5, seg.h5 | |
Rename imnames.cp to imagesName.txt | |
Run generate_dset_for_synthtext.py | |
It will create dset.h5 | |
Then put it inside SynthText/data and run | |
python gen.py --viz |
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
# a simple script to rename multiple files | |
import os | |
import re | |
path = 'myimages/' | |
files = os.listdir(path) | |
files.sort(key=lambda var:[int(x) if x.isdigit() else x for x in re.findall(r'[^0-9]|[0-9]+', var)]) | |
for i, file in enumerate(files): | |
os.rename(path + file, path + "rename_{}".format(i)+".jpg") | |
OlderNewer