package com.example.glyndwrtimetables;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class AboutActivity extends AppCompatActivity
{
    // Interface
    Button backButton;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about);

        setupControls();
    }   //  protected void onCreate(Bundle savedInstanceState)

    protected void setupControls()
    {
        backButton = findViewById(R.id.about_back_button);
        backButton.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                finish();
            }
        }); //  backButton.setOnClickListener(new View.OnClickListener()

    }   //  protected void setupControls()

}   //  public class AboutActivity extends AppCompatActivity


# market-scanner

Edgarly microservice for interfacing with the TWS Gateway. From here, the platform makes historical, stock and scanner requests.

## Notes

A) You can connect to TWS, with a VNC viewer (ex: TightVNC).

```
cd ~/Downloads/tvnjviewer-2.8.3-bin-gnugpl/
java -jar tightvnc-jviewer.jar
```

B) You have to do an Initial build of base docker images.
```
docker build --force-rm -f Dockerfile.tws.base -t twashing/market-scanner-tws-base:latest -t twashing/market-scanner-tws-base:`git rev-parse HEAD` .
docker build --force-rm -f Dockerfile.app.base -t twashing/market-scanner-app-base:latest -t twashing/market-scanner-app-base:`git rev-parse HEAD` .
```

C) Bringing up docker-compose
```
# Basic
docker-compose up

# Force a rebuild of containers
docker-compose up --force-recreate --build
```

## Lifecycle functions

- return channels
- expose scanner results in system map
- expose request ids in system map (filter by request type)
- check that system is started
- check that connection is valid


package coreRefactor.effectiveLegacyCode.classIntoTestHarness_9.hiddenDependency.solution.parameterizeConstructor.dependency;

import java.util.Random;

public class NetworkNotHiddenDependency implements NotHiddenDependency {
    private final String status;

    public NetworkNotHiddenDependency() {

        String statusToSet;

        try {
            attemptToConnectToServer();

            statusToSet = "CONNECTED_TO_SERVER";
        } catch (Exception e) {
            statusToSet = "NOT_CONNECTED";
        }

        this.status = statusToSet;

    }

    private void attemptToConnectToServer() throws Exception {
        int i = new Random().nextInt(10);

        if (i > 4) throw new Exception("Failed to make connection!");
    }

    @Override
    public void doStuff() {
        if (this.status.equals("CONNECTED_TO_SERVER")) {
            System.out.println("DOING REALLY INTERESTING STUFF");
        } else {
            System.out.println("DOING TOTALLY DIFFERENT STUFF");
        }
    }
}


import java.util.*;
import java.lang.*;

class CNode{

	private CNode childLeft;
	private CNode childRight;
	private CNode parent;
	private String type;
	private String index;
	private double distance;

	public CNode( CNode parent,String nodeType,String indexNode){
		childLeft = null;
		childRight = null;
		this.parent = parent;
		type = nodeType;
		index = indexNode;
		distance = 0; //this refers to the distance from a child node to its parent node

	}
	public CNode(){

	}
	public void addChildL(CNode child){
		childLeft= child;
	}
	public void addChildR(CNode child){
		childRight= child;
	}
	public CNode getChildL(){
		return childLeft;
	}
	public CNode getChildR(){
		return childRight;
	}

	public void addDistance(double dist){
		distance=dist;
	}

	public double getDistance(){
		return distance;
	}

	public CNode getParent(){
		return parent;
	}
	public String getType(){
		return type;
	}

	public String getIndex(){
		return index;
	}

	public void setParent(CNode newParent){
		parent = newParent;
	}

}


package com.zhiyou100.servlet.message;

import com.zhiyou100.util.AdminBaseServlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 更新邮件
 */
@WebServlet("/message/update")
public class UpdateServlet extends AdminBaseServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		int messageId = Integer.parseInt(request.getParameter("id"));

		request.getRequestDispatcher("/WEB-INF/view/message/update.jsp").forward(request, response);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		// 注意这里判断用户点哪个按扭的方法！
		boolean send = request.getParameter("send") != null;

			response.sendRedirect(request.getContextPath() + "/message/listSave");
		}

}


package com.netflow.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 汪培林
 * @data 2020-12-24  15:30:37
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Autowired
    private TokenInterceptor tokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        List<String> excludePath = new ArrayList<>();
        excludePath.add("/user/login");
        excludePath.add("/user/register");
        excludePath.add("/user/logout");

        registry.addInterceptor(tokenInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns(excludePath);

        WebMvcConfigurer.super.addInterceptors(registry);
    }
}


package ucr.cr.ac.proyecto3.Api;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import ucr.cr.ac.proyecto3.IUser.UserService;

public class ApiPacientes {

    private static Retrofit getRetrofit(){

        HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
        logging.setLevel(HttpLoggingInterceptor.Level.BODY);

        // Asociamos el interceptor a las peticiones
        OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
        httpClient.addInterceptor(logging);

        Retrofit retrofit = new Retrofit.Builder()
                .addConverterFactory(GsonConverterFactory.create())
                .client(httpClient.build())
                .baseUrl("http://flamejordan-001-site1.gtempurl.com/api/")
                .build();

        return retrofit;
    }

    public static UserService getUserService(){
        UserService userService = getRetrofit().create(UserService.class);
        return userService;
    }

}


package javase.gp.threadpool;

import java.util.concurrent.*;

/**
 * @author Gp
 * @create 2020/4/2 16:05
 */
//手写一个线程池
public class MyThreadPool {

    public static void main(String[] args) {
        System.out.println(Runtime.getRuntime().availableProcessors());
        ExecutorService threadPool = new ThreadPoolExecutor(2,
                5,
                1L,
                TimeUnit.SECONDS,
                new LinkedBlockingQueue<Runnable>(3),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy());
        try {
            for (int i = 0; i < 8; i++) {
                threadPool.execute(new Runnable() {
                    @Override
                    public void run() {
                        System.out.println(Thread.currentThread().getName() + "正在执行任务!");
                    }
                });
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            threadPool.shutdown();
        }
    }
}


package com.sky.open.wx.sdk.response.appdev;

import com.alibaba.fastjson.annotation.JSONField;
import com.sky.open.wx.sdk.response.WechatResponse;

import java.util.List;

/**
 * 获取小程序全部业务域名：
 * 提示：
 * 1、需要先将域名登记到第三方平台的小程序业务域名中，才可以调用接口进行配置。
 * 2、为授权的小程序配置域名时支持配置子域名，
 *      例如第三方登记的业务域名如为qq.com，则可以直接将qq.com及其子域名（如xxx.qq.com）也配置到授权的小程序中。
 * @date 2018/5/7 10:57
 */
public class GetAppWVDomainResponse extends WechatResponse {

    private static final long serialVersionUID = 4148710617262303802L;
    /**
     * 小程序的业务域名列表
     */
    @JSONField(name = "webviewdomain")
    private List<String> webviewDomain;

    public GetAppWVDomainResponse() {
    }

    public List<String> getWebviewDomain() {
        return webviewDomain;
    }

    public void setWebviewDomain(List<String> webviewDomain) {
        this.webviewDomain = webviewDomain;
    }

    @Override
    public String toString() {
        return "GetAppWVDomainResponse{" +
                "webviewDomain=" + webviewDomain +
                '}';
    }
}


/**
Mohammed Raza
CSC 236 - Lab1 # 3 (class1)
*/

public class Employee
{
   public String name;
   public int id;
   public String date;

   public Employee()
   {
	   name = " ";
	   id = 0;
	   date = " ";
   }

   public Employee(String n, String d, int i)
   {
	  name = n;
	  id = i;
	  date = d;
   }

   public void setName(String n)
   {
      name = n;
   }

   public void setEmployeeNumber(int i)
   {
      id = i;
   }

   public void setHireDate(String d)
   {
      date = d;
   }

   public String getName()
   {
      return name;
   }

   public int getEmployeeNumber()
   {
	  try
	  {
		  if (id < 0 || id > 9999)
	  	  throw new InvalidEmployeeNumber();
	  }

	  catch (InvalidEmployeeNumber e)
	  {

	  	System.out.println("Error: " + e.toString());

	  }

	  finally
	  {
	  	  return id;
	  }
   }

   public String getHireDate()
   {
      return date;
   }

   public void isValidEmpNum()
   {

   }

   public String toString()
   {
	   String str = " ";
	   return str;
   }

}


# Description
Have you ever heard of “selling good smell fart”? This is a folk
story in south Asia, the main goal of this story is teaching people to
be kind. How much does animal agriculture and eating meat con-
tribute to global warming? Animal agriculture and eating meat are
the biggest causes of global warming. Becoming vegan or cutting
down on your own personal meat consumption could be the sin-
gle most effective action that you can do to help reduce greenhouse
gas emissions. We want to combine “selling good smell fart” and
reduce greenhouse gas together, it may be hard to imagine how,
but if without those research information, most people know about
eating too much meat which will cause greenhouse gas because of
methane emissions (fart). To focus on this, we create a connection between meat-eating and farting as a cause of greenhouse gas, and this becomes our main game philosophy.
# How to play
Space - fly

A backward

D forward

![GitHub Logo](version.png)


package com.blbz.stockaccountnanagement.repository;

import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

import static com.blbz.stockaccountnanagement.model.StockModel.*;

public class CompanyFileHandler {
    public void readCompanyJSON() {
        try (FileReader fr = new FileReader(getCompanyfilename())) {
            JSONParser pr = new JSONParser();
            setBaseobjcompany((JSONObject) pr.parse(fr));
        } catch (IOException | ParseException e) {
            e.printStackTrace();
        }
    }

    public void writeCompanyJSON() {
        try(FileWriter fw=new FileWriter(getCompanyfilename())){
            fw.write(getBaseobjcompany().toJSONString());
            fw.flush();
            System.out.println("Company File saved!!!");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


package com.example.myfinanceapp.database.db;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.example.myfinanceapp.database.dao.CryptoCoinDao;
import com.example.myfinanceapp.database.model.CryptoCoin;

@Database(entities = {
        CryptoCoin.class
}, version = 1, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {

    private static final String DATABASE_NAME = "my_finance_db";
    private static AppDatabase instance;

    public abstract CryptoCoinDao cryptoCoinDao();

    public static synchronized AppDatabase getInstance(Context context) {
        if (instance == null) {
            instance = Room.databaseBuilder(context.getApplicationContext(),
                    AppDatabase.class, DATABASE_NAME)
                    .allowMainThreadQueries()
                    .fallbackToDestructiveMigration()
                    .build();
        }
        return instance;
    }

}


#Fatigue and performance

This project aims to help capture data on fatigue and performance

It's split into multiple smaller apps to make debugging easier and show the
overall framework.

Based upon Django 2.0.2

#Overall framework of smaller apps:-

1. ai - for customizing responses based upon machine learning systems
Status - development not yet started

2. analysis - analysing data using python libraries
Status - development not yet started

3. cogtests - collection of cognitive testing
Status - Collecting tests

4. participant - management area for participants to access their data
Status - Under development

5. prompt - system for prompting user to answer tests or other systems, to link with ai system in production
Status - development not yet started

6. question - system for delivering basic questions and gathering responses
Status - Under development

7. rota - tracking system for rota used by participants, allowing defined shift patterns, rota patterns and acutal shift start and finish times
Status - under development


package com.simplyti.service.examples.filter;

import com.google.inject.AbstractModule;
import com.google.inject.Singleton;
import com.google.inject.multibindings.Multibinder;
import com.simplyti.service.exception.BadRequestException;
import com.simplyti.service.filter.FilterContext;
import com.simplyti.service.filter.http.FullHttpRequestFilter;

import io.netty.handler.codec.http.FullHttpRequest;

public class FullHttpRequestFilterModule extends AbstractModule implements FullHttpRequestFilter {

	@Override
	protected void configure() {
		Multibinder<FullHttpRequestFilter> fulters = Multibinder.newSetBinder(binder(), FullHttpRequestFilter.class);
		fulters.addBinding().to(FullHttpRequestFilterModule.class).in(Singleton.class);
	}

	@Override
	public void execute(FilterContext<FullHttpRequest> context) {
		if(context.object().uri().equals("/hello/bad") ||
				context.object().uri().equals("/echo/bad")){
			context.fail(new BadRequestException());
		}else {
			context.done();
		}
	}

}


This demo is based on the belief that when running the following code in the main thread it should
not be possible to reach the exception:

```java
Single.fromCallable(Object::new)
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(object -> {
        throw new IllegalStateException("should never be called");
    })
    .dispose();
```

After a few thousand calls I often encounter the exception. More interestingly, in the debugger
we can see that the `HandlerScheduler$ScheduledRunnable` has already been disposed, yet its `run()`
method is still called.

![Debugging run() on disposed Runnable](https://github.com/stevelilly/rxandroid-racecondition/blob/master/runOnDisposedRunnable.png?raw=true)

AFAICT the code in the `HandlerScheduler` is using `removeCallbacks` and `removeCallbacksAndMessages`
in the proper way, however it appears it is not safe to call `delegate.run()` without first checking
`isDisposed`.

This seems to affect API 24+ much more often than API 23 when I test it, but this could just be the
specific timings of my emulator.


package com.zxsc.springboot.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.DecimalFormat;
import java.util.Date;

@AllArgsConstructor
@NoArgsConstructor
@Data
public class Item {
    private Integer id;
    private Integer cid;
    private String title;
    private String sell_point;
    private String price;
    private Integer num;
    private String pic;
    private Integer status;
    private String content;
    private String album;
    private Date created;
    private Date updated;

    @Override
    public String toString() {
        return "Item{" +
                "id=" + id +
                ", cid=" + cid +
                ", title='" + title + '\'' +
                ", sell_point='" + sell_point + '\'' +
                ", price=" + price +
                ", num=" + num +
                ", pic='" + pic + '\'' +
                ", status=" + status +
                ", content='" + content + '\'' +
                ", album='" + album + '\'' +
                ", created=" + created +
                ", updated=" + updated +
                '}';
    }
}


package com.example.administrator.weatherdemo;

import android.icu.util.ULocale;
import android.widget.TextView;
import android.widget.Toast;

import org.apache.commons.io.IOUtils;

import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLEncoder;

/**
 * Created by Administrator on 2018/1/8 0008.
 */

public class GetUtil {
    String city = null, jsonUrl, result;
    URL url = null;
    InputStream is = null;

    public String getjson(String c) {
        try {

            city = URLEncoder.encode(c, "utf-8");
            jsonUrl = String.format("http://www.sojson.com/open/api/weather/json.shtml?city=%s", city);

            url = new URL(jsonUrl);
            //打开url对应的资源的输入流
            is = url.openStream();
            //获取资源
            result = IOUtils.toString(is, "utf-8");

        } catch (Exception e) {
            e.printStackTrace();
        }

        return result;
    }
}


package com.reactlibrary;

//import com.couchbase.lite.AbstractQuery;
import com.couchbase.lite.CouchbaseLiteException;
import com.couchbase.lite.Database;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

class JsonQuery { //extends AbstractQuery {
    private Map<String, Object> jsonSchema;
    private Database database;

    JsonQuery(Map<String, Object> jsonSchema, Database database) {
        super();
        this.jsonSchema = jsonSchema;
        this.database = database;
    }

    public Database getDatabase() {
        return this.database;
    }

    protected Map<String, Object> _asJSON() {
        return this.jsonSchema;
    }

    protected Map<String, Integer> generateColumnNames() throws CouchbaseLiteException {
        Map<String, Integer> map = new HashMap<>();
        int count = ((List)this.jsonSchema.get("WHAT")).size();

        for (int i = 0; i < count; i++) {
            map.put(String.format("f%d", i), i);
        }

        return map;
    }
}


package com.openclassrooms.entrevoisins.service;
import com.openclassrooms.entrevoisins.model.Neighbour;
import java.util.ArrayList;
import java.util.List;

/**
 * Dummy mock for the Api
 */
public class DummyNeighbourApiService implements  NeighbourApiService {

    private List<Neighbour> neighbours = DummyNeighbourGenerator.generateNeighbours();

    /**
     * {@inheritDoc}
     */
    @Override
    public List<Neighbour> getNeighbours() {
        return neighbours;
    }

    @Override
    public void deleteNeighbour(Neighbour neighbour) {
        neighbours.remove(neighbour);
    }

//les méthode que j'ai ajouté

    List<Neighbour> favoriteNeibours = new ArrayList<>();

    public List<Neighbour> getFavoriteNeibours() {
        return favoriteNeibours;
    }

    public void deleteFavNeibour(Neighbour neighbour) {
        favoriteNeibours.remove(neighbour);
    }

    public void addFavNeibour(Neighbour neighbour) {
        favoriteNeibours.add(neighbour);
    }

    /**
     * {@inheritDoc}
     */
}


# sheepIT

## Swagger

Address: http://localhost:5000/swagger/index.html

## Architecture

Project is divided into three primary modules: infrastructure, use cases and core.

### Infrastructure

It mainly contains technical code reused by all other modules.

It should be unrelated to this specific project (meaning it could in theory be used in other projects).

We should strive to have as much technical code moved from other modules to infrastructure,
to keep them focused on logic instead of technical details.

### Use cases

Represents _specific_ functionalities related to specific endpoints (e. g. web app or public API).

Use cases should be structured in the same way as their enpoints,
e. g. use cases related to web app should have similar structure as that web app.

Use cases should not reference one another. If some code needs reusing,
it should either go to infrastructure or core modules.

### Core

Represents functionalities common to entire project. It includes domain
code (e. g. entities, business rules, value objects, etc.), but also
technical code related to this project (e. g. data access for specific entities).


package org.kymjs.example.fragment;

import org.kymjs.aframe.ui.BindView;
import org.kymjs.aframe.ui.fragment.BaseFragment;
import org.kymjs.example.R;
import org.kymjs.example.activity.SlidExample;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

public class ExampleFragment extends BaseFragment {
    @BindView(id = R.id.button1, click = true)
    private Button button;

    @Override
    protected View inflaterView(LayoutInflater inflater, ViewGroup container,
            Bundle bundle) {
        View view = inflater.inflate(R.layout.example_layout, null);
        return view;
    }

    @Override
    protected void widgetClick(View v) {
        super.widgetClick(v);
        switch (v.getId()) {
        case R.id.button1:
            if (getActivity() instanceof SlidExample) {
                ((SlidExample) getActivity()).changeSlidMenu();
            }
            break;
        }
    }
}


package com.udn.ntpc.od.model.system.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;

@Entity
@DynamicInsert
@DynamicUpdate
@Table(name="st_coordinate_mapping")
@NoArgsConstructor
@AllArgsConstructor
@Data
@ToString(exclude = {})
@EqualsAndHashCode(exclude = {})
public class CoordinateMapping implements Serializable {

    private static final long serialVersionUID = 3982118162973241041L;

    @Id
	@Column(name = "od_data_cfg_oid", length = 36, nullable = false)
	private String dataCfgOid;

	@Column(name = "field_addr", length = 50, nullable = false)
	private String fieldAddr;

	@Column(name = "field_name", length = 50, nullable = false)
	private String fieldName;

}


package camelinaction;

import java.util.ArrayList;
import java.util.List;

/**
 * Customer service bean
 */
public class CustomerService {

    /**
     * Split the customer into a list of departments
     *
     * @param customer the customer
     * @return the departments
     */
    public List<Department> splitDepartments(Customer customer) {
        // this is a very simple logic, but your use cases
        // may very well require more complex logic
        return customer.getDepartments();
    }

    /**
     * Create a dummy customre for testing purprose
     */
    public static Customer createCustomer() {
        List<Department> departments = new ArrayList<Department>();
        departments.add(new Department(222, "Oceanview 66", "89210", "USA"));
        departments.add(new Department(333, "Lakeside 41", "22020", "USA"));
        departments.add(new Department(444, "Highstreet 341", "11030", "USA"));

        Customer customer = new Customer(123, "Honda", departments);
        return customer;
    }
}


package de.dynamobeuth.spacesweeper.component;

import javafx.beans.property.SimpleIntegerProperty;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;

import java.io.IOException;

/**
 * Component to display the current level
 */
public class LevelComponent extends HBox {

    @FXML
    private Label lblLevel;

    private SimpleIntegerProperty level = new SimpleIntegerProperty();

    /**
     * Initialize component
     */
    public LevelComponent() {
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("LevelComponent.fxml"));
        fxmlLoader.setRoot(this);
        fxmlLoader.setController(this);

        try {
            fxmlLoader.load();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @FXML
    private void initialize() {
        lblLevel.textProperty().bind(levelProperty().asString());
    }

    public SimpleIntegerProperty levelProperty() {
        return level;
    }
}


package simple.xfj.framework.util;

import com.sun.org.apache.xml.internal.utils.StringToStringTableVector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

/**
 * Created by asus on 2017/4/19.
 */
public class DEcodeUtil {

    private static final Logger LOGGER = LoggerFactory.getLogger(DEcodeUtil.class);

    public static final String Decode(String str){
        String res = null;
        try {
           /* byte[] bytes = str.getBytes("ISO8859-1");
            res = new String(bytes, "GBK");*/
            res = URLDecoder.decode(str,"UTF-8");
        } catch (UnsupportedEncodingException e) {
            LOGGER.error("decode String error");
            throw new RuntimeException(e);
        }
        return res;
    }

    public static final String Encode(String str){
        try {
            str = URLEncoder.encode(str,"ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            LOGGER.error("encode String error");
            throw new RuntimeException(e);
        }
        return str;
    }

}


package io.plucen.springsecuritywithjwt;

import io.plucen.springsecuritywithjwt.users.UserService;
import javax.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@RequiredArgsConstructor
public class SpringSecurityWithJwtApplication {

  private final UserService userService;

  @Value("${admin.email}")
  private String adminEmail;

  @Value("${admin.password}")
  private String adminPassword;

  public static void main(String[] args) {
    SpringApplication.run(SpringSecurityWithJwtApplication.class, args);
  }

  @PostConstruct
  public void setAdminUser() {
    if (userService.findByEmail(adminEmail).isEmpty()) {
      userService.create(adminEmail, adminPassword);
      System.out.println("Created admin user");
    } else {
      System.out.println("already created");
    }
  }
}


The font used in the screenshot is [Haskplex Nerd](https://github.com/huytd/haskplex-font).

## Installation

There are two way to use this config:

**Option 1:** Check `init.vim` and copy just what you need.

**Option 2:** Clone the whole repo in to `~/.config/nvim/`, please make sure you don't have this folder before clone:

```
$ git clone https://github.com/huytd/vim-config ~/.config/nvim/
```

## Screenshots

NERDTree + coc.nvim floating document + vista.vim outline:

![](https://i.imgur.com/NItTlei.png)

Floating Terminal: `<Leader>at` or `:call FloatTerm()`

![](https://i.imgur.com/tbANa2W.png)

NodeJS REPL: `<Leader>an` or `:call FloatTerm('"node"')`

![](https://i.imgur.com/SQYbYJA.png)

Floating tig - TUI Git: `<Leader>ag` or `:call FloatTerm('"tig"')`

![](https://i.imgur.com/zAjTPsK.png)

## Note

For displaying well font of vim-devicons. You should install [nerd-fonts](https://github.com/ryanoasis/nerd-fonts).

To install it you can check this [instructions](https://gist.github.com/matthewjberger/7dd7e079f282f8138a9dc3b045ebefa0)


package com.example.demo;

import java.util.Collection;
import java.util.LinkedHashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/mongo")
public class MongoDBController {
	Logger logger = LoggerFactory.getLogger(this.getClass());

	@Autowired
	private StudentExamRepository SERepository;

	@RequestMapping("/save")
	public Student save() {
		Student s = new Student("Jack",26);
		Collection<Exam> exams = new LinkedHashSet<>();
		exams.add(new Exam("高等代数",90));
		exams.add(new Exam("线性几何",88));
		exams.add(new Exam("大学英语",95));
		s.setExams(exams);
		return SERepository.save(s);
	}

	@GetMapping("/selbyage")
	public Student findByage(Integer age ) {
		logger.info("执行于此了");
		return  SERepository.findByAge(age);
	}

}


package com.ben.chess.pieces;

import com.ben.chess.Player;
import com.ben.chess.boards.ChessBoard;
import com.ben.chess.boards.ChessBoardCell;
import com.ben.chess.boards.ChessBoardCellNotOccupiedException;
import com.ben.chess.pieces.behaviors.Behavior;
import com.ben.chess.pieces.behaviors.KnightBehavior;

/**
 * Created by ben on 2/6/14.
 */
public class Knight extends ChessPiece {

    Behavior behavior;

    public Knight (Player player) throws InvalidPlayerException {
        super(player);

        this.behavior = new KnightBehavior();
    }

    public Knight (Knight other) {
        super(other);
    }

    public String getName () {
        return "Knight";
    }

    public boolean canMove (ChessBoard board, ChessBoardCell origin, ChessBoardCell destination) {
        return this.behavior.canMove(board, origin, destination);
    }

    public ChessPiece copy () {
        return new Knight(this);
    }

    public char getIconChar() {
        if(this.getPlayer() == Player.WHITE)
            return '\u2658';
        else
            return '\u265E';
    }
}


package com.star.strategy;

import java.util.Date;

import org.apache.log4j.Logger;

import com.star.db.SqlDao;

public class EsService {
    private static Logger LOGGER = Logger.getLogger(EsService.class);

    // 导入CSV文件到H2数据库
    public static void importCSV(String filePath, String tableName) {
        Date t1 = new Date();

        String sql = "CREATE TABLE " + tableName + " (STOCKID INT,BUYDATE INT,"
                + "BUYPRICE INT,SELLDATE INT,SELLPRICE INT,PROFIT DOUBLE)";
        SqlDao.executeSql(sql);

        try {
            SqlDao.executeSql("INSERT INTO " + tableName
                    + " SELECT * FROM CSVREAD('" + filePath + "')");
        } catch (Exception ex) {
            LOGGER.error("", ex);
        }
        Date t2 = new Date();
        LOGGER.info("导入" + filePath + "耗时" + (t2.getTime() - t1.getTime())
                + "毫秒");
    }

    public static void dropTable(String tableName) {
        String sql = "DROP TABLE IF EXISTS " + tableName;
        SqlDao.executeSql(sql);
    }
}


package com.example.springhillel.api.service.crudservice.convert;

import com.example.springhillel.model.dto.UserDTO;
import com.example.springhillel.model.entity.Role;
import com.example.springhillel.model.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.persistence.EntityManager;

@Component
public class UserConverter implements AbstractConvert<User, UserDTO> {

    @Autowired
    private EntityManager entityManager;

    @Override
    public User convertToEntity(UserDTO userDTO) {

        Role role = entityManager.find(Role.class, userDTO.getRoleId());

        return new User(userDTO.getFirstName(), userDTO.getLastName(), userDTO.getPassword(),
                userDTO.getEmail(), role);
    }

    @Override
    public UserDTO covertToDTO(User user) {
        return new UserDTO(user.getFirstName(), user.getLastName(), user.getEmail(),
                user.getPassword(), user.getRole().getId());
    }
}


package com.app.oktpus.activity;

import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.widget.FrameLayout;

import com.app.oktpus.R;
import com.app.oktpus.fragment.PostAd;

/**
 * Created by Gyandeep on 16/5/18.
 */

public class PostAdActivity extends BaseActivity {

    FrameLayout container;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        includeNavigationMenu(this, R.layout.activity_ad_post);
        container = (FrameLayout) findViewById(R.id.fragment_frame);
    }

    @Override
    protected void onStart() {
        super.onStart();
        FragmentManager fm = getSupportFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();

        Fragment fragment = new PostAd();
        ft.add(container.getId(), fragment);
        ft.commit();
    }
}


package com.store.cashback.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;
import java.math.BigDecimal;

@Entity
@Table(name = "sales_albums")
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class SaleAlbum {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @JsonIgnore
    private Long id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "sales_id")
    @JsonBackReference
    private Sale sale;

    @Column
    private String albumName;

    @Column
    private String albumSlug;

    @Column
    private Integer cashback;

    @Column
    private BigDecimal albumPrice;

    @Column
    private BigDecimal salePrice;
}


package com.yxhl.stationbiz.system.domain.entity.sys;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.yxhl.platform.common.entity.ELItem;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 *
 *  表名:sys_operate_log
 *  注释:操作日志表
 *  创建人: xjh
 *  创建日期:2018-7-9 17:20:55
 */
@Data
@TableName(value="sys_operate_log")
public class OperateLog extends ELItem{
    private static final long serialVersionUID = 1L;

	@ApiModelProperty(value = "操作模块 长度(10) 必填")
	private java.lang.String module;

	@ApiModelProperty(value = "操作类型 长度(20) 必填")
	private java.lang.String type;

	@ApiModelProperty(value = "操作IP 长度(20) 必填")
	private java.lang.String ip;

	@ApiModelProperty(value = "操作内容")
	private String content;

	@TableField(exist = false)
	@ApiModelProperty(value = "开始时间")
	private String startTime;

	@TableField(exist = false)
	@ApiModelProperty(value = "结束时间")
	private String endTime;

	@TableField(exist = false)
	@ApiModelProperty(value = "操作人 名称")
	private String userName;
}


package com.nb6868.xquick.modules.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.nb6868.xquick.booster.service.impl.CrudServiceImpl;
import com.nb6868.xquick.modules.shop.dao.OrderLogDao;
import com.nb6868.xquick.modules.shop.dto.OrderLogDTO;
import com.nb6868.xquick.modules.shop.entity.OrderLogEntity;
import com.nb6868.xquick.modules.shop.service.OrderLogService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 订单记录
 *
 * @author Charles zhangchaoxu@gmail.com
 */
@Service
public class OrderLogServiceImpl extends CrudServiceImpl<OrderLogDao, OrderLogEntity, OrderLogDTO> implements OrderLogService {

    @Override
    public QueryWrapper<OrderLogEntity> getWrapper(String method, Map<String, Object> params){
        String id = (String)params.get("id");

        QueryWrapper<OrderLogEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);

        return wrapper;
    }

}


# React

React is a [declarative](https://github.com/iamdcj/javascripts/blob/master/paradigms/README.md#declarative-programming), [component-based](components) [JavaScript](https://github.com/iamdcj/javascripts/) library used for building User Interfaces of all sizes and complexities.

React can be used to deal with only the **'view'** aspect of an application, or in most cases used to engineer fully-fledged single page applications.

### The Benefits of React

- **Scalable**; a great framework for building applications of all sizes.
- **Lightning Fast**; React's DOM abstraction, the [virtual DOM](react-dom), ensures UI updates occur in rapid time.
- **Production Ready**; a dedicated team of engineers ensure the library is ever-evolving and well maintained.
- **Resources Aplenty**; there is an abundance of training material available for engineers of all levels.

---

**Core**

- [Data Flow and Updates](data-flow)
  - React DOM
- [Components](components)
  - [JSX](jsx)
  - Class
  - Function
  - Conditionals
  - Props
  - State
- [Hooks](hooks)
- Patterns
  - HOCs
  - Render Props

**Other**

- Routing
- Forms
- Styling
- Testing


package com.samuelvazquez;

import com.samuelvazquez.entity.Pokemon;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class UpdatePokemon {
    public static void main(String[] args) {
        SessionFactory factory =
                new Configuration().configure("hibernate.cfg.xml").addAnnotatedClass(Pokemon.class).buildSessionFactory();

        Session session = factory.getCurrentSession();

        try {
            String pokemonId = "6";
            session.beginTransaction();

            System.out.println("\nGetting student with id: " + pokemonId);
            Pokemon myPokemon = session.get(Pokemon.class,pokemonId);

            System.out.println("Updating Pokemon...");
            myPokemon.setName("Gloom");
            myPokemon.setWeight(8.6);

            session.getTransaction().commit();

        } catch(Exception e) {
            e.printStackTrace();
        } finally {
            factory.close();
        }
    }
}


package org.squiddev.plethora.integration.ic2;

import ic2.api.item.IElectricItemManager;
import ic2.core.IC2;
import ic2.core.ref.ItemName;
import net.minecraft.item.ItemStack;
import org.squiddev.plethora.api.Injects;
import org.squiddev.plethora.api.meta.BasicMetaProvider;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

@Injects(IC2.MODID)
public final class MetaEnergyItem extends BasicMetaProvider<ItemStack> {
	@Nonnull
	@Override
	public Map<String, ?> getMeta(@Nonnull ItemStack object) {
		IElectricItemManager manager = IntegrationIc2.getManager(object);
		if (manager == null) return Collections.emptyMap();

		Map<String, Object> map = new HashMap<>(3);
		map.put("stored", manager.getCharge(object));
		map.put("capacity", manager.getMaxCharge(object));
		map.put("tier", manager.getTier(object));

		return Collections.singletonMap("eu", map);
	}

	@Nullable
	@Override
	public ItemStack getExample() {
		return ItemName.batpack.getItemStack();
	}
}


package Restfulwebservices.Restfulwebservices.user;

import javax.validation.constraints.Past;
import javax.validation.constraints.Size;
import  java.util.Date;

public class User {

    private Integer id;

    @Size(min=2, message = "Name should have atleast two charactors")
    private String name;

    @Past(message = "Invalid future Birthday ")
    private Date Birthdate;

    private User(){
    }

    public User(final Integer id, final String name, final Date birthdate) {
        this.id = id;
        this.name = name;
        Birthdate = birthdate;
    }

    public Integer getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public Date getBirthdate() {
        return Birthdate;
    }

    public void setId(final Integer id) {
        this.id = id;
    }

    public void setName(final String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "User{" + "id=" + id + ", name='" + name + '\'' + ", Birthdate=" + Birthdate + '}';
    }

    public void setBirthdate(final Date birthdate) {
        Birthdate = birthdate;

    }

}


package org.proteored.miapeapi.cv.ms;

import org.proteored.miapeapi.cv.Accession;
import org.proteored.miapeapi.cv.ControlVocabularyManager;
import org.proteored.miapeapi.cv.ControlVocabularySet;
import org.proteored.miapeapi.cv.ControlVocabularyTerm;
import org.proteored.miapeapi.cv.ControlVocabularyTermImpl;

public class CollisionPressure extends ControlVocabularySet {

	private static final Accession COLLISION_GAS_PRESSURE_ACC = new Accession("MS:1000869");
	private static final String COLLISION_GAS_PRESSURE_PREFERRED_NAME = "collision gas pressure";
	private static CollisionPressure instance;

	public static CollisionPressure getInstance(ControlVocabularyManager cvManager) {
		if (instance == null)
			instance = new CollisionPressure(cvManager);
		return instance;
	}

	private CollisionPressure(ControlVocabularyManager cvManager) {
		super(cvManager);
		String[] explicitAccessionsTMP = { "MS:1000869" }; // collision gas
															// pressure
		this.explicitAccessions = explicitAccessionsTMP;
		this.miapeSection = -1;
	}

	public static ControlVocabularyTerm getCollisionPressureTerm() {
		return new ControlVocabularyTermImpl(COLLISION_GAS_PRESSURE_ACC,
				COLLISION_GAS_PRESSURE_PREFERRED_NAME);
	}
}


package com.taketo.www.Command.AdminCommand;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.taketo.www.Command.Command;
import com.taketo.www.DAO.CourseBoardDAO;
import com.taketo.www.DTO.CourseBoardDTO;

public class AdminLocalBoardSettingCommand implements Command {

	@Override
	public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		CourseBoardDAO dao = CourseBoardDAO.getCourseBoardDAO();

		int curPage = 0;
		if(request.getParameter("curPage")!=null) {
			curPage = Integer.parseInt(request.getParameter("curPage"));
		}
		int cnt = dao.getCnt();
		int maxPage = dao.getMaxPage(cnt);
		if(maxPage < 0) {
			maxPage =0;
		}
		ArrayList<CourseBoardDTO> cBoardList = dao.courseListDAO(curPage);
		request.setAttribute("list", cBoardList);
		request.setAttribute("maxPage", maxPage);

	}

}


package <missing>;

public class GlobalMembers
{
	public static int Main()
	{
		int i;
		int j;
		int n;
		int t;
		String tempVar = ConsoleInput.scanfRead();
		if (tempVar != null)
		{
			n = Integer.parseInt(tempVar);
		}
				String w = new String(new char[MAX + 1]);
			String s = new String(new char[4]);
			String a = new String(new char[3]);
		for (i = 0;i < n;i++)
		{
			int k = 0;
			String tempVar2 = ConsoleInput.scanfRead();
			if (tempVar2 != null)
			{
				w = tempVar2.charAt(0);
			}
			for (j = w.length() - 3;j <= w.length();j++)
			{
				s = tangible.StringFunctions.changeCharacter(s, k, w.charAt(j));
				k++;
			}
			k = 0;
			 for (j = w.length() - 2;j <= w.length();j++)
			 {
				 a = tangible.StringFunctions.changeCharacter(a, k, w.charAt(j));
				 k++;
			 }
			 if (strcmp(a,"er") == 0 || strcmp(a,"ly") == 0)
			 {
				 t = 2;
			 }
			 if (strcmp(s,"ing") == 0)
			 {
				 t = 3;
			 }
			 for (j = 0;j < w.length() - t;j++)
			 {
			 System.out.printf("%c",w.charAt(j));
			 }
			 System.out.print("\n");
		}
		return 0;
	}

}


---
author: Kent Chiu
published: true
layout: post
title: "CentOS"
date: 2011-10-17
comments: true
external-url:
sharing: true
footer: true
tags:
  - centos
---

-   [CentOS 5
    系列??](http://smartraining.cn/centos "http://smartraining.cn/centos")
    - SmarTraining 工作室
-   [LAMP install on
    CentOS5](http://wiki.kent-chiu.com/doku.php?id=centos:lamp_install "centos:lamp_install")
-   [Subversion
    Installation](http://wiki.kent-chiu.com/doku.php?id=centos:subversion_installation "centos:subversion_installation")
-   [upgrade php to
    5.3.x](http://wiki.kent-chiu.com/doku.php?id=centos:upgrade_php_to_5.3.x "centos:upgrade_php_to_5.3.x")
-   [install open jdk and tomcat in
    linux](http://www.wardking.com/blog/read.php/361.htm "http://www.wardking.com/blog/read.php/361.htm")

### Install From Network

```
Web site name: mirror.centos.org
CentOS directory for i386: /centos/5.5/os/i386
CentOS directory for x86_64: /centos/5.5/os/x86_64

```

[reference](http://www.if-not-true-then-false.com/2010/centos-netinstall-network-installation/ "http://www.if-not-true-then-false.com/2010/centos-netinstall-network-installation/")


# Static page to IPFS gateway

[![Build Status](https://travis-ci.org/romainbou/scrape-to-ipfs.svg?branch=master)](https://travis-ci.org/romainbou/scrape-to-ipfs)
[![Go Report Card](https://goreportcard.com/badge/github.com/romainbou/scrape-to-ipfs)](https://goreportcard.com/report/github.com/romainbou/scrape-to-ipfs)

Scapes a static web pages and automatically push and serve them via IPFS

## Build and run with Docker

 ```bash
 make image
 make run-docker
 ```

## Test

 ```bash
 make test
 ```

## Environement variables

|  Env        | Default                       |  Description          |
|-------------|-------------------------------|-----------------------|
| PORT        | 8000                          | Server listening port |
| GATEWAY_URL | https://gateway.ipfs.io/ipfs/ | IPFS HTTPS Gateway    |
| IPFS_DAEMON | localhost:5001                | IPFS daemon address   |
| TEMPLATES   | templates/                    | Templates folder      |

## TODO

- [ ] Scrape a page on request and replace or save all relative URLs
- [ ] Push the files to an IPFS daemon
- [x] Redirect to an IPFS gateway
- [ ] Publish the result to IPNS


package com.qm.nettylearn.marshalling;

import com.qm.nettylearn.protobuf.SubscribeReqProto;
import com.qm.nettylearn.protobuf.SubscribeRespProto;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;

/**
 * @Author: Linglingxin
 * @Date: 2018/11/29 21:12
 */
public class SubReqServerHandler extends ChannelHandlerAdapter {
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        UserInfo req = (UserInfo) msg;
        if ("nancy".equals(req.getName())) {
            System.out.println("Service accept client subscribe req : [" + req.toString() + "]");
            ctx.writeAndFlush(resp(req.getAge()));
        }
    }

    private UserInfo resp(int subReqID) {
        UserInfo info = new UserInfo();
        info.setAge(subReqID);
        info.setName("nancy");
        return info;
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        cause.printStackTrace();
        ctx.close();
    }
}


package cn.com.hqep.templet.model;

/**
 * 批次表
 *
 * @author shaowenqiang
 * @date
 */
public class tblBbgsBatchModel {
    String id;
    String batchName;//批次名称
    String isMaterial;//物资类别 1：物资 2：非物资

    public tblBbgsBatchModel(String id, String batchName, String isMaterial) {
        this.id = id;
        this.batchName = batchName;
        this.isMaterial = isMaterial;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getBatchName() {
        return batchName;
    }

    public void setBatchName(String batchName) {
        this.batchName = batchName;
    }

    public String getIsMaterial() {
        return isMaterial;
    }

    public void setIsMaterial(String isMaterial) {
        this.isMaterial = isMaterial;
    }

    @Override
    public String toString() {
        return "tblBbgsBatch{" +
                "id='" + id + '\'' +
                ", batchName='" + batchName + '\'' +
                ", isMaterial='" + isMaterial + '\'' +
                '}';
    }
}


package com.cmb.o2o.hackson.nicetomeetyou.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.servlet.MultipartConfigElement;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")
                .allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")
                .maxAge(3600)
                .allowCredentials(true);
    }

    /**
     * 在配置文件中配置的文件保存路径
     */
    @Value("${img.location}")
    private String location;

    @Bean
    public MultipartConfigElement multipartConfigElement(){
        MultipartConfigFactory factory = new MultipartConfigFactory();
        return factory.createMultipartConfig();
    }
}


package com.bigdatalighter.kafka.offset.monitor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author: Leo Zhang(johnson5211.work@gmail.com)
 **/
public class LoggingOffsetStateObserver extends AbsConsumerOffsetStateObserver {
    private Logger logger = LoggerFactory.getLogger(LoggingOffsetStateObserver.class);

    @Override
    protected void doCaughtUp(ConsumerOffsetState offsetState, ConsumerOffsetState.StateInfo stateInfo) {
        logger.info("Consumer[{}:{}] has caught up to target offset;", offsetState.getGroup(), offsetState.getTopic());
    }

    @Override
    protected void doDelay(ConsumerOffsetState offsetState, ConsumerOffsetState.StateInfo stateInfo) {
        logger.warn("Consumer[{}:{}] has fallen behind target offset.Difference:{}.", offsetState.getGroup(), offsetState.getTopic(), stateInfo.getTotalDifference());
        logger.warn("Partition\tCurrent offset\tConsumer offset\tDifference");
        for (ConsumerOffsetState.PartitionOffsetDifference difference : stateInfo.getDifferences()) {
            logger.warn("{} \t {} \t {} \t {}", difference.getPartitionId(), difference.getCurrentOffset(), difference.getTargetOffset(), difference.getDifference());
        }
    }

}


package com.kv.iprojectlib.ui.toast;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.kv.iprojectlib.R;

public class iRectToast extends Toast {

    public iRectToast(Context context) {
        super(context);
    }

    public static Toast makeText(Context context, int resId, CharSequence text, int duration) {
        Toast result = new Toast(context);

        LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View layout = inflater.inflate(R.layout.ip_toast, null);

        ImageView imageView = (ImageView) layout.findViewById(R.id.iv_icon);
        TextView textView = (TextView) layout.findViewById(R.id.tv_msg);

        imageView.setImageResource(resId);
        textView.setText(text);

        result.setView(layout);
        result.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
        result.setDuration(duration);

        return result;
    }

}


package com.supylc.talentrecyclerview.support;

import android.view.View;
import android.widget.TextView;

import com.supylc.talentrecyclerview.HolderRes;
import com.supylc.talentrecyclerview.R;
import com.supylc.talentrecyclerview.TalentHolder;

/**
 * @author Roye
 * @date 2019/4/17
 */
@HolderRes(resName = "layout_recycleview_loadmore")
public class LoadMoreHolder extends TalentHolder<LoadMoreBean> {

    public LoadMoreHolder(View itemView) {
        super(itemView);
    }

    TextView textView;

    @Override
    public void initView() {
        textView = findV(R.id.text);
        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                post("");
            }
        });
    }

    @Override
    public void toView() {
        if (LoadMoreBean.STATUS_READY == itemValue.getStatus()) {
            textView.setText("加载更多");
        } else if (LoadMoreBean.STATUS_LOADING == itemValue.getStatus()) {
            textView.setText("加载中...");
        } else {
            textView.setText("没有更多了~");
        }
    }
}


package lesson26.home.dao.entities;

import javax.persistence.*;

/**
 * Модель таблицы единиц измерения
 */
@Entity
@Table(name = "UNITS")
public class Unit {
    private Long id;
    private String name;
    private String shortName;

    public Unit() {
    }

    public Unit(Long id) {
        this.id = id;
    }

    public Unit(Long id, String name, String shortName) {
        this.id = id;
        this.name = name;
        this.shortName = shortName;
    }

    @Id
    @GeneratedValue
    @Column(nullable = false, unique = true)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "name", unique = true, nullable = false)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "short_name", nullable = false)
    public String getShortName() {
        return shortName;
    }

    public void setShortName(String shortName) {
        this.shortName = shortName;
    }

}


import java.util.Scanner;
public class LoanCalculator
{
    public static void main(String[] args)
    {
        //created doubles put into scanner printed with multiply and divide//
        double monthlyinterest = 0;
        double principalBalance = 0;
        double annualInterestRate = 0;
        double remainingMonths = 0;
        double monthlyPayment = 0;
        Scanner scan = new Scanner(System.in);

        System.out.println("Enter your principal balance:  ");
        principalBalance = scan.nextDouble();
        System.out.println("Enter your annual interest rate:  ");
        annualInterestRate = scan.nextDouble();
        System.out.println("Enter your remaining months:  ");
        remainingMonths = scan.nextDouble();
        monthlyinterest = principalBalance * (annualInterestRate/remainingMonths);
        System.out.println("Your monthly interest is " + monthlyinterest);
        System.out.println("Your monthly payment is " + principalBalance/remainingMonths + monthlyinterest);
        scan.close();

    }
}


package com.example.calculatemarks;

import androidx.appcompat.app.AppCompatActivity;

import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = MainActivity.class.getSimpleName();

    EditText m1;
    EditText m2;
    EditText m3;
    EditText m4;
    EditText m5;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Log.d(TAG, "onCreate()");

        m1 = findViewById(R.id.ed3004);
        m1 = findViewById(R.id.ed3005);
        m1 = findViewById(R.id.ed3006);
        m1 = findViewById(R.id.ed3007);
        m1 = findViewById(R.id.ed3008);

    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);

        if(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
        {
            Log.d(TAG, "ORIENTATION_LANDSCAPE");
        }
        else
        {
            Log.d(TAG, "ORIENTATION_PORTRAIT");
        }
    }
}


package com.dekel.darwin.users.service;

import com.dekel.darwin.users.domain.User;
import com.dekel.darwin.users.repository.UserRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Optional;

@Service
public class UserServiceImpl implements UserService {

    private final UserRepository userRepository;

    public UserServiceImpl(UserRepository userRepository) {
        this.userRepository = userRepository;
    }

    @Override
    @Transactional
    public void saveOrUpdate(User user) {
        Optional.ofNullable(userRepository.getIdByEmail(user.getEmail()))
                .ifPresent(userId -> user.setId(userId.getId()));
        userRepository.save(user);
    }

    @Override
    public User getByEmail(String email) {
        return userRepository.getByEmail(email);
    }

    @Override
    @Transactional
    public boolean deleteByEmail(String email) {
        return userRepository.deleteByEmail(email) > 0;
    }

}


# darebee-workout

## Background

Darebee.com offers many free workouts that can be done anywhere, without equipment. I have been enjoying these workouts,
but one frustration is that for a workout noob like me, the workout graphics don't always make it clear what to do for
any given exercise. The site addresses this by having a separate Video Library of most exercises, but there is no linking
between the workout graphic and the video for the exercises.

In order to address this frustration, I built a quick tool that will perform the following actions:

1) Given a workout id + day, via URL, fetch the image for that day's workout.
2) Use the Google Vision API to detect text in the workout image.
3) Use some regex to convert the detected exercise names into URLs where the videos are hosted.
4) Fetch those video pages, scraping for Youtube embed.
5) Outputting the workout graphic, followed by any found Youtube embeds from steps 3-4.

## Running locally

```
$ make test
```

## Deployment

```
$ make
```

Then upload the new function.zip to GCF.


package com.gzeinnumer.bindingtestinclude;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.Toast;

import com.gzeinnumer.bindingtestinclude.databinding.ActivityMainBinding;
import com.gzeinnumer.bindingtestinclude.databinding.ChildBinding;

public class MainActivity extends AppCompatActivity {

    private ActivityMainBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        ViewStub stub = findViewById(R.id.layout_stub);
        stub.setLayoutResource(R.layout.child);
        View inflated = stub.inflate();
        ChildBinding b = ChildBinding.bind(inflated);

        b.btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this, "text", Toast.LENGTH_SHORT).show();
            }
        });
    }
}


package com.example.consumer.services;

import com.example.consumer.model.Celsius;
import com.example.consumer.utilities.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

@Service
public class CelsiusService {

    private static final Logger log = LoggerFactory.getLogger(CelsiusService.class);

    @RabbitListener(queues = "celsius.queue")
    public Celsius retrieveCelsiusData(Celsius celsius) throws Exception {

        System.out.println("Temperatura generata: " + celsius.getDegree());

        if (celsius.getDegree() < Constants.CELSIUS_MIN_RANGE || celsius.getDegree() > Constants.CELSIUS_MAX_RANGE) {
            log.error("ATTENZIONE! Valore {} fuori norma: reimpostare la temperatura", celsius.getDegree());
        } else {
            System.out.println("Temperatura impostata correttamente: " + celsius.getDegree());
        }

        return null;
    }
}


package webTest;

import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
import org.openqa.selenium.WebDriver;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import webTest.Open_browsers;
import webTest.page.SPGLogin;

public class DemoTest  extends  Open_browsersTest{
    @Parameters({"SPG_URl","Username","passwd"})
    @Test
    public void SPGLogintest(String url,String username,String pw)  {
        Open_browsers.getDriver().get(url);
        SPGLogin spgLogin = new SPGLogin();
        //高级按钮
        spgLogin.GJbutton.click();
        //继续前往按钮
        spgLogin.JXQWbutton.click();
        //验证是否进入到登录界面
        String aqkxwgone = "安全API网关V1.0";
        String aqkxwgone_erro = spgLogin.DLJMtext.getText();
        //System.out.println(aqkxwgone);
        if(aqkxwgone.equals(aqkxwgone_erro)){
            System.out.println("成功访问到安全API网关登录界面");

            spgLogin.username.sendKeys(username);

            spgLogin.passwdbox.sendKeys(pw);

        }else {
            System.out.println("访问失败");
        }
    }

}


package ljj.socket.udp;

import java.net.DatagramPacket;
import java.net.DatagramSocket;

/**
 * @author 刘佳俊
 * @Date 2021/7/19
 *
 * 用于接收信息
 *
 */
public class UdpReceive implements Runnable{

    private String name;
    private int port;

    public UdpReceive(String name, int port) {
        this.name = name;
        this.port = port;
    }

    @Override
    public void run() {
        DatagramSocket socket=null;
        try {
            //        开放端口，使得发送方能够发送到相应包到端口号
            socket = new DatagramSocket(port);

//        接收数据包
            byte[] buffer = new byte[1024];
            DatagramPacket packet = new DatagramPacket(buffer,0,buffer.length);

            while(true){
                //阻塞接收
                socket.receive(packet);

                String message=new String(packet.getData(),0,packet.getLength());
                System.out.println(name+": "+message);

                if(message.equals("bye")){
                    break;
                }

            }
        }catch (Exception e){
            e.printStackTrace();
        }finally {

//关闭连接
            socket.close();
        }

    }
}


package edu.cnm.deepdive.parser.model;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;

public class Index {

  @Expose
  private String name;

  @Expose
  private boolean unique;

  @Expose
  private List<String> columnNames;

  @Expose
  @SerializedName("createSql")
  private String sqlStatement;

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public boolean isUnique() {
    return unique;
  }

  public void setUnique(boolean unique) {
    this.unique = unique;
  }

  public List<String> getColumnNames() {
    return columnNames;
  }

  public void setColumnNames(List<String> columnNames) {
    this.columnNames = columnNames;
  }

  public String getSqlStatement() {
    return sqlStatement;
  }

  public void setSqlStatement(String sqlStatement) {
    this.sqlStatement = sqlStatement;
  }

  public String toDdl() {
    return sqlStatement;
  }
}


package org.powertac.rachma.treatment;

import org.powertac.rachma.instance.Instance;
import org.powertac.rachma.instance.ServerParameters;

import java.util.Objects;

@Deprecated
public class FixedServerParameterTreatment implements Treatment {

    private final String key;
    private final String value;

    public FixedServerParameterTreatment(String key, String value) {
        this.key = key;
        this.value = value;
    }

    @Override
    public Instance mutate(Instance instanceCopy) {
        instanceCopy
            .getServerParameters()
            .set(key, value);
        return instanceCopy;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FixedServerParameterTreatment that = (FixedServerParameterTreatment) o;
        return Objects.equals(key, that.key) &&
            Objects.equals(value, that.value);
    }

    @Override
    public int hashCode() {
        return Objects.hash(key, value);
    }

}


package week1.classes;

public class Rectangle {
    private int height;
    private int width;
    private String color;

    public Rectangle(int width, int height, String color){
        if(height < 0){
            this.height = 1;
        }
        if(width < 0){
            this.width = 1;
        }
        this.height = height;
        this.width = width;
        this.color = color;
    }
    public Rectangle(int width, int height){
        if(height < 0){
            this.height = 1;
        }
        if(width < 0){
            this.width = 1;
        }
        this.height = height;
        this.width = width;
        this.color = "Blue";

    }

    //parameter
    public String draw(){

        char [] col = color.toCharArray();
        for(int i = 0; i < height; i++) {
            for (int j = 0; j < width; j++){
                System.out.print(col[0]);
                if(j == width-1){
                    System.out.print("\n");
                }

        }
        }

        return "";
    }
}


package com.example.a709151034.controledelanches.Activitys;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.example.a709151034.controledelanches.R;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    public void novopedido(View view) {
        Intent intent = new Intent(MainActivity.this, CadastroPedidoActivity.class);
        startActivity(intent);

    }

    public void consultapedido(View view) {
        Intent intent = new Intent(MainActivity.this, ConsultaPedidoActivity.class);
        startActivity(intent);

    }

    public void Fornecedor(View view) {
        Intent intent = new Intent(MainActivity.this, FornecedorActivity.class);
        startActivity(intent);

    }
    public void Relatorio(View view) {
        Intent intent = new Intent(MainActivity.this, MenuActivity.class);
        startActivity(intent);

    }
}


package cn.remex.wechat.event;

import cn.remex.core.RemexEvent;

/**
 * 名称：
 * 缩写：
 * 用途：
 * Created by yangy on 2016/4/9 0009.
 */
public class WeChatScanEvent extends RemexEvent {
    private static final long serialVersionUID = -5467836967924859761L;
    private String openId;
    private String eventKey;
    private String tickets;
    public WeChatScanEvent(String source, String openId, String eventKey,String tickets) {
        super(source, openId, eventKey, tickets);
        this.openId = openId;
        this.eventKey = eventKey;
        this.tickets = tickets;
    }

    public String getEventKey() {
        return eventKey;
    }

    public void setEventKey(String eventKey) {
        this.eventKey = eventKey;
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getTickets() {
        return tickets;
    }

    public void setTickets(String tickets) {
        this.tickets = tickets;
    }
}


package br.com.futsalmanager.util;

import android.app.TimePickerDialog;
import android.content.Context;
import android.widget.EditText;
import android.widget.TimePicker;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class TimePickerUtil {

    private Calendar myCalendar = Calendar.getInstance();

    public void setDateTimeField(final Context context, final EditText editText) {
        final TimePickerDialog.OnTimeSetListener time = new TimePickerDialog.OnTimeSetListener() {
            @Override
            public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                myCalendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
                myCalendar.set(Calendar.MINUTE, minute);
                SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
                editText.setText(sdf.format(myCalendar.getTime()));
            }
        };

        new TimePickerDialog(context, time, myCalendar
                .get(Calendar.HOUR_OF_DAY), myCalendar.get(Calendar.MINUTE), true).show();

    }
}


package com.shiyi.product._03product;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.MessageProperties;
/**
 *功能描述  worker模式
 * @author 十一
 * @date 2019-07-06 20:00
 */
public class NewTask {
    private static final String TASK_QUEUE_NAME = "task_queue";

    public static void main(String[] argv) throws Exception {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("192.168.14.215");
        try (Connection connection = factory.newConnection();
             Channel channel = connection.createChannel()) {
            //队列名，是否持久化，是否只能自己能读取，是否自动删除(队列没有消息并且没有客户端连接），实现死信队列或者延时队列
            channel.queueDeclare(TASK_QUEUE_NAME, true, false, false, null);
            String message = "tasequeue";
            for(int i=0;i<200;i++){
                channel.basicPublish("", TASK_QUEUE_NAME,
                        MessageProperties.PERSISTENT_TEXT_PLAIN,
                        (message+i).getBytes("UTF-8"));
            }
            System.out.println(" [x] Sent '" + message + "'");
        }
    }
}


package streamsadvancedexample_;

import java.io.*;

public class Person implements Serializable {
    private String name;
    private int age;
    private boolean sex;

    public Person() {
    }

    public void setName(String name){
        this.name = name;
    }

    public String getName(){
        return this.name;
    }

    public void setAge(int age){
        this.age = age;
    }

    public int getAge(){
        return age;
    }

    public String toString(){
        return super.toString()+": "+name+" age="+age+" sex="+sex;
    }

    public static Person[] generate(int size){
        Person[] reply = new Person[size];
        for (int i=0; i<reply.length; i++){
            reply[i] = new Person();
            reply[i].setName("Chel #"+(i+1));
            reply[i].setAge(i+10);
            reply[i].setSex(i%2==0);
        }
        return reply;
    }

    public boolean getSex(){
        return sex;
    }

    public void setSex(boolean sex){
        this.sex = sex;
    }
}


package org.swiftsms.desktop.dao;

import org.swiftsms.desktop.model.Settings;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SettingsDao {

    @Autowired
    private SessionFactory sessionFactory;

    public String get(final String key) {
        final Session session = sessionFactory.openSession();
        session.beginTransaction();

        final Settings value = session.get(Settings.class, key);

        session.getTransaction().commit();
        session.close();

        return value.getValue();
    }

    public void set(final String key, final String value) {
        final Session session = sessionFactory.openSession();
        session.beginTransaction();

        final Settings settings = new Settings();
        settings.setKey(key);
        settings.setValue(value);

        session.saveOrUpdate(settings);

        session.getTransaction().commit();
        session.close();
    }
}


package it.almaviva.starter.services.impl;

import com.google.common.collect.Lists;
import it.almaviva.starter.domain.jpa.entities.RetailItemEntity;
import it.almaviva.starter.repositories.RetailItemRepository;
import it.almaviva.starter.services.RetailItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RetailItemServiceImpl implements RetailItemService {

    @Autowired
    private RetailItemRepository retailItemRepository;

    public List<RetailItemEntity> getAllRetailItems() {
        Iterable<RetailItemEntity> retailItems =
                retailItemRepository.findAll();
        return Lists.newArrayList(retailItems);
    }

    public RetailItemEntity insertRetailItem(String title, String description, Integer price) {
        RetailItemEntity retailItem = new RetailItemEntity(title, description, price);
        return retailItemRepository.save(retailItem);
    }
}


package pl.dzw.testyjednostkowe.animal;

import org.assertj.core.util.Lists;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.BDDMockito;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import java.util.List;

import static org.mockito.Mockito.mock;
@ExtendWith(MockitoExtension.class)
class AnimalControllerTest2 {

    @Mock
    private AnimalRepo animalRepo;

    @InjectMocks
    private AnimalController animalController;

    @Test
    public void should_get_animals() {
        //given
        BDDMockito.given(animalRepo.findAll()).willReturn(properData());
        //when
        List<Animal> animals = animalController.getAnimals();
        //then
        Assertions.assertEquals(properData().size(),animals.size());
    }

    private List<Animal> properData() {
        return Lists.list(new Animal("Tygrys"), new Animal("Kangur"));
    }

}


package net.afikri.employee.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "employees")
public class Employee {
	@Id
    @Column(name = "id")
    int id;

    @Column(name = "fullName")
    String fullName;

    @Column(name = "position")
    String position;

    @Column(name = "salary")
    float salary;

    public Employee() {
    	super();
    }

    public Employee(int id, String fullName, String position, float salary) {
    	super();
    	this.id = id;
    	this.fullName = fullName;
    	this.position = position;
    	this.salary = salary;
    }

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getFullName() {
		return fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	public String getPosition() {
		return position;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	public float getSalary() {
		return salary;
	}

	public void setSalary(float salary) {
		this.salary = salary;
	}
}


package com.example.autodoc.appteste.domain.message.interactor;

import com.example.autodoc.appteste.data.RepositoryUser;
import com.example.autodoc.appteste.domain.message.User;

import javax.inject.Inject;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

public class CreateUserInteractor {

    RepositoryUser mRepositoryUser;

    @Inject
    public CreateUserInteractor(RepositoryUser mRepositoryUser) {
        this.mRepositoryUser = mRepositoryUser;
    }

    public Observable createUser(Request request) {
        return Observable.create(e -> {
            mRepositoryUser.createUser(request.getUser());
        }).subscribeOn(Schedulers.newThread())
                .observeOn(AndroidSchedulers.mainThread());
    }

    public static final class Request {

        private User user;

        public Request(User user) {
            this.user = user;
        }

        public User getUser() {
            return user;
        }
    }
}


package com.womply.client;

import com.womply.client.BaseServiceClient;
import com.womply.models.Merchant;

import java.util.Optional;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

/**
 * A java client endpoint for the merchant-search service.
 */
public class MerchantServiceClient extends BaseServiceClient {

    private final WebTarget target;

    /**
     * Creates a MerchantServiceClient with the given uri, using the supplied timeouts.
     * example uri: "http://localhost:44338/api/v1"
     */
    public MerchantServiceClient(final String uri, final int readTimeout, final int connectTimeout) {
        super(uri, readTimeout, connectTimeout);

        target = client.target(uri).path("merchant-searchs/{id}");

    }

    /**
     * Finds a Merchant with the given id.
     */
    public Optional<Merchant> getMerchantById(final int id) {
        Response response =  target.resolveTemplate("id", id)
                .request(MediaType.APPLICATION_JSON_TYPE).get();
        return hydrateModel(response, Merchant.class);
    }
}


package com.thinkgem.jeesite.common.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

import com.thinkgem.jeesite.common.annotation.DynamicSourcedb;
import com.thinkgem.jeesite.common.db.DynamicDataSource;

@Aspect
@Component
public class DynamicSourcedbAspect {
	@Around(value = "@annotation(dynamicSourcedb)")
	public Object dynamicdbAdvice(ProceedingJoinPoint proceedingJoinPoint, DynamicSourcedb dynamicSourcedb) throws Throwable {
		//System.out.println("Before invoking getName() method" + dynamicSourcedb.value());
		Object value = null;
		try {
			DynamicDataSource.setdataSource(dynamicSourcedb.value());
			value = proceedingJoinPoint.proceed();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DynamicDataSource.setdataSourceDefault();
		}
		//System.out.println("After invoking getName() method. Return value=" + value);
		return value;
	}

}


mkdir music touch song{1..10}.mp3 mv song*.mp3 ./music ln -s music audio

sudo -s groupadd sysadmin useradd -m bob -p linux123 useradd -m rob -p linux123 groupadd manager useradd -m max -p linux123 usermod -g sysadmin rob usermod -g sysadmin bob usermod -g sysadmin max usermod -a -G manager rob usermod -a -G manager bob

vim /etc/passwd change max❌1003:1005::/home/bin/bash to max❌1003:1005::/home/bin/false sudo change -E 'date -d "30 days" +"%Y-%m-%d"' max change -d 0 bob

mkdir /home/manager chgrp manager /home/manager chmod -R 2770 /home/manager

useradd -u 4223 gabriel

mkdir /tmp/var tar -cvf /tmp/var/archive.tar.bz2 /etc/hosts

grep udp /etc/service > udp_services.txt

top shift+f then s for sorting

echo 'alias stat="/bin/uptime"' >> ~/.zshrc source ~/.zshrc

vim aarck.txt :i for insert :shift+zz to save and exit :x to delete :q exit without saving

firewall-cmd --get-default-zone firewall-cmd --set-default-zone=dmz firewall-cmd --get-zones > zones.txt

firewall-cmd –zone=public –add-port=25/tcp –permanent firewall-cmd --list-ports>zones.txt

iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080


package com.mirror.woodpecker.app.util;

import com.mirror.woodpecker.app.app.AppContext;
import com.mirror.woodpecker.app.model.cache.PhoneCache;

import org.xutils.DbManager;
import org.xutils.ex.DbException;
import org.xutils.x;

import java.util.List;

/**
 * Created by 王沛栋 on 2016-06-22.
 * 数据库操作类
 */
public class DBUtil {
    /**
     * 存储录入的手机号码
     * @param num
     */
    public static void savePhoneCache(String num){
        DbManager db = x.getDb(AppContext.getDaoConfig());

        PhoneCache p = new PhoneCache();
        p.setNum(num);

        try {
            db.save(p);
        } catch (DbException e) {
            e.printStackTrace();
        }
    }

    /**
     * 获取手机号码
     * @return
     */
    public static List<PhoneCache> getPhoneCache(){
        DbManager db = x.getDb(AppContext.getDaoConfig());
        try {
            return db.selector(PhoneCache.class).findAll();
        } catch (DbException e) {
            e.printStackTrace();
        }
        return null;
    }
}


package com.hasan.postopgo;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;

public class Legal extends AppCompatActivity
{
    private WebView dialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_legal);
        dialog = (WebView)findViewById(R.id.legalView);

        String docType = "";
        Bundle extras = getIntent().getExtras();
        if(extras != null)
        {
            docType = extras.getString("DocType");
        }

        if(docType.equals("Privacy Policy"))
        {
            dialog.loadUrl("file:///android_asset/PostOpGo Privacy Policy.html");
        }

        if(docType.equals("Disclaimer"))
        {
            dialog.loadUrl("file:///android_asset/PostOpGo Disclaimer.html");
        }

        if(docType.equals("EULA"))
        {
            dialog.loadUrl("file:///android_asset/EULA - PostOpGo.html");
        }
    }
}


package com.google.gdata.client.authn.oauth;

import com.google.gdata.client.authn.oauthproxy.OAuthProxyRequest;

public class GoogleOAuthHelper extends OAuthHelper {
    private static String accessTokenUrl;
    private static String requestTokenUrl;
    private static String revokeTokenUrl;
    private static String userAuthorizationUrl;

    static {
        requestTokenUrl = OAuthProxyRequest.DEFAULT_REQUEST_TOKEN_URL;
        userAuthorizationUrl = OAuthProxyRequest.DEFAULT_AUTHORIZATION_URL;
        accessTokenUrl = OAuthProxyRequest.DEFAULT_ACCESS_TOKEN_URL;
        revokeTokenUrl = "https://www.google.com/accounts/AuthSubRevokeToken";
    }

    public GoogleOAuthHelper(OAuthSigner signer) {
        super(requestTokenUrl, userAuthorizationUrl, accessTokenUrl, revokeTokenUrl, signer);
    }

    GoogleOAuthHelper(OAuthSigner signer, OAuthHttpClient httpClient) {
        super(requestTokenUrl, userAuthorizationUrl, accessTokenUrl, revokeTokenUrl, signer, httpClient);
    }
}


package com.nezopont.service;

import com.nezopont.entity.Role;
import com.nezopont.entity.User;
import com.nezopont.repository.UserRepository;
import com.nezopont.web.DTO.UserRegistrationDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

import java.util.Arrays;

@Service
public class UserService {

    @Autowired
    private UserRepository userRepository;

    @Autowired
    private BCryptPasswordEncoder passwordEncoder;

    @Autowired
    public UserService(UserRepository userRepository) {
        this.userRepository = userRepository;
    }

    public User save(UserRegistrationDTO user){
        User newUser=new User();
        newUser.setFirstName(user.getFirstName());
        newUser.setLastName(user.getLastName());
        newUser.setEmail(user.getEmail());
        newUser.setPassword(passwordEncoder.encode(user.getPassword()));
        newUser.setRoles(Arrays.asList(new Role("ROLE_USER")));
        return userRepository.save(newUser);
    }
}


package com.wanghongyun.secondhandtrade.widget.dialog;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.wanghongyun.secondhandtrade.R;
import com.wanghongyun.secondhandtrade.constant.NetConstant;
import com.wanghongyun.secondhandtrade.utils.GlideUtils;

/**
 * Created by 李维升 on 2018/5/14.
 * 自定义弹出图片Dialog
 */

public class ImageDialog extends AlertDialog{
    private String url;
    private Context context;
    public ImageDialog(Context context,String url) {
        super(context);
        this.context=context;
        this.url=url;

    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_image);
        ImageView imageView=findViewById(R.id.iv_dialog);
        GlideUtils.loadImage(context, NetConstant.BASE_GOODS_PHOTOS_URL+url,imageView);
    }

}


package org.hzero.register.config;

import org.springframework.beans.factory.annotation.Autowired;
import io.choerodon.core.swagger.ChoerodonRouteData;
import io.choerodon.swagger.annotation.ChoerodonExtraData;
import io.choerodon.swagger.swagger.extra.ExtraData;
import io.choerodon.swagger.swagger.extra.ExtraDataManager;

/**
 * 服务路由配置
 */
@ChoerodonExtraData
public class RouteExtraDataManager implements ExtraDataManager {

	@Autowired
    private org.springframework.core.env.Environment environment;

    @Override
    public ExtraData getData() {
        ChoerodonRouteData choerodonRouteData = new ChoerodonRouteData();
        choerodonRouteData.setName(environment.getProperty("hzero.service.current.name", "HREG"));
        choerodonRouteData.setPath(environment.getProperty("hzero.service.current.path", "/hreg/**"));
        choerodonRouteData.setServiceId(environment.getProperty("hzero.service.current.service-name", "eroch-register"));
        extraData.put(ExtraData.ZUUL_ROUTE_DATA, choerodonRouteData);
        return extraData;
    }
}


# gentoo-overlay
Personal Gentoo overlay, containing a combination of staging ebuilds I may
eventually get merged into the official repos, experimental ebuilds that are
too hackish to upstream, official ebuilds I've modified to reflect my own
preferences, and ebuilds previously removed from the official portage tree
which I continue to find useful.

## Instructions
You can add this overlay to your system using either the layman method or the
repos.conf method, as described below. You may also need to add the package(s)
you wish to install to `/etc/portage/package.keywords` (see the Gentoo wiki).
### Using layman
```
layman -o https://raw.githubusercontent.com/automorphism88/gentoo-overlay/master/automorphism.xml -f -a automorphism
```
### Using repos.conf
Create a file in `/etc/portage/repos.conf` with the following contents (if it
is a directory, otherwise, add the following to the end of the file):
```
[automorphism]
location = /foo/bar
sync-type = git
sync-uri = https://github.com/automorphism88/gentoo-overlay.git/
auto-sync = yes
```

## Bugs
Please report any bugs on GitHub at
https://github.com/automorphism88/gentoo-overlay


package com.fuseCanteen.canteen.service;

import com.fuseCanteen.canteen.model.Employee;
import com.fuseCanteen.canteen.model.UserPrincipal;
import com.fuseCanteen.canteen.repository.EmployeeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

@Service
public class CustomUserDetailsService implements UserDetailsService {
    @Autowired
    private EmployeeRepository employeeRepository;

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        Employee employee = employeeRepository.findAllByUserName(username);
        if (employee == null) {
            throw new UsernameNotFoundException("Username not found");
        }
        return new UserPrincipal(employee);
    }

}


package com.github.liangyunfeng.mvvm.base;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;

import com.github.liangyunfeng.mvvm.R;
import com.github.liangyunfeng.mvvm.databinding.ActivityBaseBinding;
import com.github.liangyunfeng.mvvm.base.model.User;

public class BaseActivity extends AppCompatActivity {

    private final String str = "代码GG之家微信号\n" +
            "code_gg_home\n" +
            "欢迎关注！";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        final ActivityBaseBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_base);

        final User user = new User();
        user.setName(str);
        user.setAge(28);
        binding.setUser(user);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                user.setAge(30);
            }
        },3000);

    }
}


# docker-repo

Important Docker Commands
-------------------------
1. To create a Docker container, download the ‘hello world’ image, by typing the following command in the terminal –
  $ docker run hello world

2. For checking the number of images on your system, use the following command –
  $ docker image

3. For searching an image in the Docker Hub –
  $ docker search <image>

4.

docker run – Runs a command in a new container.

docker start – Starts one or more stopped containers

docker stop – Stops one or more running containers

docker build – Builds an image form a Docker file

docker pull – Pulls an image or a repository from a registry

docker push – Pushes an image or a repository to a registry

docker export – Exports a container’s filesystem as a tar archive

docker exec – Runs a command in a run-time container

docker search – Searches the Docker Hub for images

docker attach – Attaches to a running container

docker commit – Creates a new image from a container’s changes


package com.didu.domain;

/**
 * Created by Administrator on 2017/11/28.
 */
public class Push {
    private int id;
    private String url;
    private String text;

    public Push(int id, String url, String text) {
        this.id = id;
        this.url = url;
        this.text = text;
    }

    public Push(String url, String text) {
        this.url = url;
        this.text = text;
    }

    public Push() {
        super();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    @Override
    public String toString() {
        return "PushControl{" +
                "id=" + id +
                ", url='" + url + '\'' +
                ", text='" + text + '\'' +
                '}';
    }
}


package es.jimenezhidalgo.products.model;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.sql.Timestamp;
import java.util.UUID;

public class Product {

    private UUID id;
    private String product;
    private String price;
    private Timestamp date;

    public Product(
            @JsonProperty("product") String product,
            @JsonProperty("price") String price,
            @JsonProperty("date") Timestamp date) {
        this.id = UUID.randomUUID();
        this.product = product;
        this.price = price;
        this.date = date;
    }

    public UUID getId() {
        return id;
    }

    public String getProduct() {
        return product;
    }

    public void setProduct(String product) {
        this.product = product;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public Timestamp getDate() {
        return date;
    }

    public void setDate(Timestamp date) {
        this.date = date;
    }
}


# gtd-opml #

## GTD Incompletion Trigger List in OPML ##

This list is pulled from the [43 Folders Wiki Page](http://wiki.43folders.com/index.php/Trigger_List) and coverted to OPML using [Checkvist](http://checkvist.com).

The triggers are from ~2002, and are a bit dated (got a lot of faxing to do? tapes you need to catch up on?). It's my hope that folks will grab this file and create with it a more modern set of triggers.

## Using this list ##

OPML can be imported into most outlining and mind mapping apps. I have successfully imported the file into [MindNode Pro](http://mindnode.com). Please let me know if you have trouble with your OPML handling app of choice.

## Getting Things Done ##

The source material is the excellent book [Getting Things Done](http://www.davidco.com/about-gtd). The book is highly recommended. To get you on your merry way, check out the Coles Note version from Merlin Mann's site [43 Folders](http://www.43folders.com/2004/09/08/getting-started-with-getting-things-done).


package com.roomies.house.controller;

import java.util.Collection;
import java.util.Optional;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.roomies.house.model.House;
import com.roomies.house.service.HouseService;
import com.roomies.house.util.ResourceNotFoundException;

import lombok.AllArgsConstructor;

@RestController
@RequestMapping("houses")
@AllArgsConstructor
public class HouseController {

	private final HouseService service;

	@GetMapping(produces = {"application/json"})
	public Collection<House> findAll() {
		return service.findAll();
	}

	@GetMapping(path = "/{id}", produces = {"application/json"})
	public House findbyId(@PathVariable(name = "id") Long id) {
		Optional<House> response = service.findById(id);

		if(response.isPresent()) {
			return response.get();
		} else {
			throw new ResourceNotFoundException();
		}
	}
}


package fr.naruse.towerdefense.storage;

import fr.naruse.towerdefense.utils.async.ThreadGlobal;
import org.bukkit.Bukkit;

public class ResourcesStorage {

    private static int gold = 0;
    private static int wood = 0;
    private static int stone = 0;

    public static int getGold() {
        return gold;
    }

    public static void addGold(int add){
        if(!Bukkit.isPrimaryThread()){
            ThreadGlobal.runSync(() -> addGold(add));
            return;
        }
        gold += add;
    }

    public static int getWood() {
        return wood;
    }

    public static void addWood(int add){
        if(!Bukkit.isPrimaryThread()){
            ThreadGlobal.runSync(() -> addWood(add));
            return;
        }
        wood += add;
    }

    public static int getStone() {
        return stone;
    }

    public static void addStone(int add){
        if(!Bukkit.isPrimaryThread()){
            ThreadGlobal.runSync(() -> addStone(add));
            return;
        }
        stone += add;
    }
}


# Hello Wolrd
>Welcome to my GitHhub profile. You can find some of my recent projects here. I have divided content in “Repositories” tab into three sections, for better readability and clarity.

## First Section - WEBSITE (numbers from 1 to 9)
>You can find websites (mostly designed and coded by myself; two of them is inspired by PSD template). I’ve used: HTML, CSS/SASS, Bootstrap, RWD, Git.

## Second Section - APP (numbers from 10 to 99)
>In this section I placed pure JS/jQuery projects. Used: HTML, CSS, Bootstrap, RWD, wanilla JS, jQuery, Ajax, API, Git.

## Third Section (numbers from 100 to 999)
>Last section contains a few training projects (which isn’t and won’t be styled).

At the top of each subpage, I’ve added link to the live version. If you are curious and inquisitive visitor, you are the reason why I’ve provided more extensive descriptions (at the bottom).

## Contact
Created by [@conspir0](https://www.linkedin.com/in/mateuszmichalczyk/) - feel free to contact me :-)


package com.stark.filter;

import com.stark.service.CustomService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@Configuration
@WebFilter(urlPatterns = "/*")
@Order(2) //越小越前
public class CustomFilter implements Filter {

    @Autowired
    private CustomService service; //测试IOC使用 OK

    private Logger logger = LoggerFactory.getLogger(CustomFilter.class);

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        logger.info("CustomFilter.init()");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        logger.info("CustomFilter.doFilter()");
        service.test();
        chain.doFilter(request, response);
    }

    @Override
    public void destroy() {
        logger.info("CustomFilter.destroy()");
    }
}


package com.macbethhotel.roomreservation.converter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.convert.converter.Converter;

import com.macbethhotel.roomreservation.entity.ReservationEntity;
import com.macbethhotel.roomreservation.model.request.ReservationRequest;

public class ReservationRequestToReservationEntityConverter implements Converter<ReservationRequest,ReservationEntity>{

	Logger logger = LoggerFactory.getLogger(ReservationRequestToReservationEntityConverter.class);

	@Override
	public ReservationEntity convert(ReservationRequest source) {

		ReservationEntity reservationEntity = new ReservationEntity();

		reservationEntity.setCheckIn(source.getCheckin());
		reservationEntity.setCheckOut(source.getCheckout());
		reservationEntity.setRoomId(source.getRoomId());
		System.out.println(""+source.getRoomId()+source.getId());

		if(source.getId() != null) {
			reservationEntity.setId(source.getId());
		}
		return reservationEntity;
	}

}