This file contains 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
final String appPackageName = getActivity().getPackageName(); // from Context | |
try { | |
startActivity(new Intent(Intent.ACTION_VIEW, | |
Uri.parse("market://details?id=" + appPackageName))); | |
} catch (android.content.ActivityNotFoundException anfe) { | |
startActivity(new Intent(Intent.ACTION_VIEW, | |
Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName))); | |
} |
This file contains 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
var app = require('express')(); | |
var http = require('http').Server(app); | |
var io = require('socket.io')(http); | |
//Include .html file | |
app.get('/', function(req, res) { | |
//res.send('<h1>Hello World</h1>'); | |
res.sendFile(__dirname + '/index.html'); | |
}); |
This file contains 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 static String docNoiDung_Tu_URL(String theUrl) { | |
StringBuilder content = new StringBuilder(); | |
try { | |
URL url = new URL(theUrl); | |
URLConnection urlConnection = url.openConnection(); | |
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); | |
String line; | |
while ((line = bufferedReader.readLine()) != null) { | |
content.append(line + "\n"); | |
} |
This file contains 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 static boolean isInternetConnection(Context context) { | |
ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
if (connectivity != null) { | |
NetworkInfo[] info = connectivity.getAllNetworkInfo(); | |
if (info != null) | |
for (int i = 0; i < info.length; i++) | |
if (info[i].getState() == NetworkInfo.State.CONNECTED) { | |
return true; | |
} | |
} |
This file contains 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 ImageLoadTask extends AsyncTask<String, Void, Bitmap> { | |
@Override | |
protected Bitmap doInBackground(String... params) { | |
private String url = params[0]; | |
try { | |
//Tiến hành tạo đối tượng URL | |
URL urlConnection = new URL(url); | |
//Mở kết nối | |
HttpURLConnection connection = (HttpURLConnection) urlConnection | |
.openConnection(); |
This file contains 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
#include<stdio.h> | |
#include<stdlib.h> | |
#include<algorithm> | |
using namespace std; | |
int n; | |
int a[10001]; | |
void input(){ |
This file contains 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
//<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | |
public void ReadFile() { | |
try { | |
File f = new File(filename); | |
FileInputStream fIn = context.openFileInput(f.getPath()); | |
ObjectInputStream oIn = new ObjectInputStream(fIn); | |
myPost = (ArrayList<Status>) oIn.readObject(); | |
oIn.close(); | |
fIn.close(); |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Constructor | |
{ | |
class Program | |
{ |
This file contains 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
int n; | |
n = int.Parse(Console.ReadLine()); | |
double sum = 0.0; | |
for (int iCount = 1; iCount <= n; iCount++) | |
{ | |
sum = sum + 1 / iCount; | |
} | |
Console.WriteLine("Ket qua: {0}", sum); | |
This file contains 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
#include<stdio.h> | |
int main() | |
{ | |
char input[200]; | |
while(1) | |
{ | |
printf("\n\n"); | |
gets(input); | |
printf(input); | |
} |
NewerOlder