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
for port in $@; do | |
fuser -kn tcp $port | |
fuser -kn udp $port | |
done |
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
package com.markojerkic.gradetrack.subjectData; | |
import android.content.Context; | |
import android.database.sqlite.SQLiteDatabase; | |
import android.database.sqlite.SQLiteOpenHelper; | |
public class SubjectDbHelper extends SQLiteOpenHelper { | |
private static final String SQL_CREATE_ENTRIES = | |
"CREATE TABLE " + SubjectFeedReaderConctact.SubjectFeedEntry.TABLE_NAME + " (" + //Creating a table named in the FeedEntery class |
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
import numpy as np | |
def k_possibilities(k): | |
res = np.random.rand(k) | |
_sum = sum(res) | |
for i, x in enumerate(res): | |
per = x / _sum | |
res[i] = per | |
return res |
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
mediaRecorder.stop(); | |
mediaRecorder.release(); | |
mediaRecorder = null; |
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
try { | |
mediaRecorder.prepare(); | |
mediaRecorder.start(); | |
} catch (IOException e) { | |
Log.e("LOG_TAG", "prepare() failed"); | |
} |
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
MediaRecorder mediaRecorder = new MediaRecorder(); | |
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); | |
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); | |
mediaRecorder.setOutputFile(mFileName); | |
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); |
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.RECORD_AUDIO" /> |
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 void delete(DatabaseHelper mDbHelper, String value) { | |
SQLiteDatabase db = mDbHelper.getReadableDatabase(); | |
//Where comand | |
String selection = FeedEntry.COLUMN_NAME1 + " LIKE ?"; | |
//Replace the ' | |
String[] selectionArgs = { value }; | |
//Delete the value | |
db.delete(FeedEntry.TABLE_NAME, selection, selectionArgs) | |
} |
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 void update(DatabaseHelper mDbHelper, String value, String prevValue) { | |
SQLiteDatabase db = mDbHelper.getReadableDatabase(); | |
// New value for one column | |
ContentValues values = new ContentValues(); | |
values.put(FeedEntry.COLUMN_NAME1, value); | |
// Which row to update, based on the title | |
String selection = FeedEntry.COLUMN_NAME1 + " LIKE ?"; | |
String[] selectionArgs = { prevValue }; |
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 void put(DatabaseHelper mDbHelper, String value1, String value2) { | |
// Gets the database in write mode | |
SQLiteDatabase db = mDbHelper.getWritableDatabase(); | |
//Content values store the date you want to put into the database | |
//Content values connect the value with the column | |
ContentValues values = new ContentValues(); | |
values.put(FeedEntry.COLUMN_NAME1, value1); | |
values.put(FeedEntry.COLUMN_NAME1, value2); |
NewerOlder