Skip to content

Instantly share code, notes, and snippets.

View yasincidem's full-sized avatar
🦜

Yasin Çidem yasincidem

🦜
View GitHub Profile
fun Context.vibrate() {
val vibrator: Vibrator = try {
getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
} catch (exception: ClassNotFoundException) {
exception.recordException()
null
} ?: return
when {
VERSION.SDK_INT >= VERSION_CODES.Q -> {
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="HW2.PeoplePage"
NavigationPage.HasBackButton="True"
NavigationPage.HasNavigationBar="False">
<ListView x:Name="PersonView" HasUnevenRows="True" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include <pthread.h>
#include <semaphore.h>
#include <stdio.h>
#include <stdlib.h>
#define NO_OF_THREADS 10
struct Singleton {
char *Data;
};
#include <pthread.h>
#include <semaphore.h>
#include <stdio.h>
#include <stdlib.h>
#define NO_OF_THREADS 10
struct Singleton {
char *Data;
};
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <semaphore.h>
pthread_t Job0, Job1, Job2, Job3, Job4, Job5, Job6, Job7, Job8, Job9;
sem_t sem0, sem1, sem2, sem3, sem4, sem5, sem6, sem7, sem71, sem8, sem9, sem61, sem62;
void *job0() {
sem_wait(&sem0);
sleep(2);
printf("%s \n", "Job0 is done");
import java.io.*;
import java.util.Arrays;
/**
* Created by yasin_000 on 1.5.2019.
*/
public class Utils {
public static byte[] fileToBytes(File f) throws IOException{
InputStream fis = new FileInputStream(f);
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
/**
* Created by yasin_000 on 1.5.2019.
*/
public class Client {
public final static String FILE_TO_SEND = "C:\\Users\\yasin_000\\Desktop\\NetworkHW\\image.jpg"; // you may change this
class ThreadActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_thread)
val thread = Thread {
val person = getPersonInfoById(5)
runOnUiThread {
progress_bar.visibility = View.GONE