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
LayoutInflater factory = LayoutInflater.from(this); // this это context | |
// final - для того чтобы использовать его в OnClickListener() | |
final View alertView = factory.inflate(R.layout.layout_add_note, null); | |
AlertDialog.Builder builder = new AlertDialog.Builder(this); | |
builder.setView(alertView); | |
builder.setTitle(R.string.alert_title_add); | |
builder.setNegativeButton(R.string.alert_cancel, null); | |
builder.setPositiveButton(R.string.menu_add, new DialogInterface.OnClickListener() { | |
@Override |
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 FontTabLayout extends TabLayout { | |
private Typeface typeface; | |
public FontTabLayout(Context context) { | |
super(context); | |
init(context, null); | |
} | |
public FontTabLayout(Context context, AttributeSet attrs) { |
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
Intent galleryIntent = new Intent(Intent.ACTION_GET_CONTENT,null); | |
galleryIntent.setType("image/*"); | |
galleryIntent.addCategory(Intent.CATEGORY_OPENABLE); | |
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); | |
Intent chooser = new Intent(Intent.ACTION_CHOOSER); | |
chooser.putExtra(Intent.EXTRA_INTENT, galleryIntent); | |
chooser.putExtra(Intent.EXTRA_TITLE, "title"); |
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
val spark = org.apache.spark.sql.SparkSession.builder | |
.master("local") | |
.appName("Spark CSV Reader") | |
.getOrCreate | |
val df = spark.read | |
.format("csv") | |
.option("header", "false") //reading the headers | |
.option("mode", "DROPMALFORMED") | |
.schema(StructType(List( | |
StructField("polarity", IntegerType, nullable = false), |
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 <cstdio> | |
#include <cstdlib> | |
#define PTYPE int | |
#define COUNT 105000 // empiric const to make 40M file | |
#define BUFFER_SIZE 10 | |
#define VARIATION 500100 // allocate "huge" piece of memory | |
int main() { | |
FILE *orderedFile = fopen("ordered.bin", "wb"); |
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
#define _GNU_SOURCE | |
#include <sched.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/wait.h> | |
#define STACK_SIZE (1024 * 1024) | |
#include <sys/types.h> | |
#include <unistd.h> |
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
// | |
// ComputerDetailViewController.swift | |
// Computers | |
// | |
// Created by Гоша Бодров on 24.07.2018. | |
// Copyright © 2018 Гоша Бодров. All rights reserved. | |
// | |
import UIKit |
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
class CityCell: BaseCell { | |
override class var id: String {return "CityCell"} | |
var checkedImage: UIImageView = { | |
let iv = UIImageView() | |
iv.contentMode = .scaleAspectFill | |
iv.clipsToBounds = true | |
iv.translatesAutoresizingMaskIntoConstraints = false | |
iv.heightAnchor.constraint(equalToConstant: 20).isActive = true | |
iv.widthAnchor.constraint(equalToConstant: 20).isActive = true | |
iv.isHidden = 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
private Bitmap loadFromSvg(String name) { | |
File file = new File(getDirectory(), name + ".svg"); | |
if (!file.exists()) return null; | |
Drawable drawable = VectorDrawableCompat.createFromPath(file.getAbsolutePath()); | |
if (drawable == null) return null; | |
Bitmap bitmap = Bitmap.createBitmap( | |
drawable.getIntrinsicWidth(), | |
drawable.getIntrinsicHeight(), |
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 ru.gordinmitya; | |
import java.util.*; | |
class Product { | |
private String name; | |
private int price; | |
Product(String name, int price) { | |
this.name = name; |