package br.com.treinamento.auth.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class InspectHeaderFilter implements Filter {

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

	@Override
	public void doFilter(ServletRequest servletRequest,
						 ServletResponse servletResponse,
						 FilterChain filterChain) throws IOException, ServletException {

		HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;

		logger.debug("Passando pelo AuthServer: " + httpServletRequest.getHeader("Authorization"));

		filterChain.doFilter(httpServletRequest, servletResponse);
	}

	@Override
	public void init(FilterConfig filterConfig) throws ServletException {
	}

	@Override
	public void destroy() {
	}
}


package com.team11.issue.dto.comment;

import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.team11.issue.domain.Comment;
import com.team11.issue.dto.user.UserResponseDTO;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.time.LocalDateTime;

@JsonPropertyOrder({"commentId", "author", "contents", "createDateTime"})
@RequiredArgsConstructor
@Builder
@Getter
public class CommentResponseDTO {

    private final Long commentId;
    private final UserResponseDTO author;
    private final String contents;
    private final LocalDateTime createDateTime;

    public static CommentResponseDTO from(Comment comment) {
        return CommentResponseDTO.builder()
                .commentId(comment.getId())
                .author(UserResponseDTO.from(comment.getUser()))
                .contents(comment.getContents())
                .createDateTime(comment.getCreateDateTime())
                .build();
    }
}


package carbon.drawable;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.util.TypedValue;

import carbon.R;

/**
 * Created by Marcin on 2015-03-16.
 */
public class ControlCheckedColorStateList extends ColorStateList {
    public ControlCheckedColorStateList(Context context) {
        super(new int[][]{
                new int[]{android.R.attr.state_checked},
                new int[]{}
        }, new int[]{
                getThemeColor(context, R.attr.colorAccent),
                getThemeColor(context, R.attr.colorControlNormal)
        });
    }

    public static int getThemeColor(Context context, int attr) {
        Resources.Theme theme = context.getTheme();
        TypedValue typedvalueattr = new TypedValue();
        theme.resolveAttribute(attr, typedvalueattr, true);
        return typedvalueattr.resourceId != 0 ? context.getResources().getColor(typedvalueattr.resourceId) : typedvalueattr.data;
    }
}


package com.ytempest.wanandroid.listener;

import android.text.Editable;
import android.text.Selection;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.widget.EditText;

/**
 * @author heqidu
 * @since 2020/8/12
 */
public class PasswordStatusChangeListener implements View.OnClickListener {

    private final EditText mPwdEditText;

    public PasswordStatusChangeListener(EditText pwdEditText) {
        this.mPwdEditText = pwdEditText;
    }

    @Override
    public void onClick(View view) {
        view.setSelected(!view.isSelected());
        if (view.isSelected()) {
            // 显示密码
            mPwdEditText.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
        } else {
            // 隐藏密码
            mPwdEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
        }
        // 最后把光标移动到末尾
        Editable editable = mPwdEditText.getText();
        Selection.setSelection(editable, editable.length());
    }
}


package com.wondersgroup.simple.consumer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.EurekaClient;
import com.wondersgroup.simple.consumer.entity.User;

@RestController
public class ConsumerController {

	@Autowired
	private RestTemplate restTemplate;

	@Autowired
	private EurekaClient eurekaClient;

	@GetMapping("/consumer/{id}")
	public User findById(@PathVariable Long id){
		InstanceInfo url = eurekaClient.getNextServerFromEureka("PROVIDE", false);
		return restTemplate.getForObject(url.getHomePageUrl()+"provice/"+id, User.class);

	}
	@GetMapping("/url")
	public String url(){
		InstanceInfo url = eurekaClient.getNextServerFromEureka("PROVIDE", false);
		return url.getHomePageUrl();

	}

}


package network.marble.game.mode.survivalgames.commands;

import network.marble.game.mode.survivalgames.listeners.GameListener;
import network.marble.game.mode.survivalgames.listeners.StateListener;
import network.marble.minigamecore.entities.command.MinigameCommand;
import network.marble.minigamecore.entities.player.PlayerType;

import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.util.*;

public class Whisper extends MinigameCommand {
    public Whisper(String name) {
        super(name);
        this.CANBERUNBY.add(PlayerType.PLAYER);
        this.COMMANDALIASES = Arrays.asList("whisper", "w");
    }

    @Override
    public boolean commandExecution(CommandSender commandSender, String s, String[] args) {
        Player p = (Player) commandSender;
        String message = args[0];
		for(int i = 1; i < args.length; i++){
			message += " " + args[i];
		}

        GameListener.sendMessage(StateListener.getMapConfig().getChat().getWhisperDistance(), message, p.getDisplayName(), p.getLocation());

        return true;
    }
}


package com.cafe24.shoppingmall_front.security;

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;
import org.springframework.web.client.RestTemplate;

import com.cafe24.shoppingmall_front.dto.JSONResult;
import com.cafe24.shoppingmall_front.vo.MemberVo;

@Service
public class CustomUserDetailService implements UserDetailsService {
	private final String BASE_URL = "http://localhost:8080/api";

	@Autowired
	private RestTemplate restTemplate;

	public MemberVo getMemberById(String id) {
		JSONResultMember result = restTemplate.getForObject(BASE_URL + "/member/" + id, JSONResultMember.class);
		MemberVo vo = result.getData();

		return vo;
	}

	@Override
	public UserDetails loadUserByUsername(String id) throws UsernameNotFoundException {
		MemberVo vo = getMemberById(id);
		return new SecurityMember(vo);
	}

	private static class JSONResultMember extends JSONResult<MemberVo> {
	}
}


package se.so4it.learn.domain;

import se.so4it.learn.common.IdEntity;

import java.util.Objects;

/**
 * @author Ali yusha {@literal <mailto:ali.yusha@so4it.com>}
 */
public class Customer extends IdEntity<String> {

    private String name;
    private String id;

    private Customer(Builder builder) {

        this.id = builder.id;
        this.name = builder.name;
    }

    public static Builder builder() {
        return new Builder();
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public static class Builder {
        private String id;
        private String name;

        public Builder withName(String name) {
            this.name = name;
            return this;
        }

        public Builder withId(String id) {
            this.id = id;
            return this;
        }

        public Customer build() {
            return new Customer(this);
        }

    }

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


package zhuliang.nus.cs2106;

import java.util.LinkedList;

/**
 * Class for resources
 * Created by paradite on 2/9/14.
 */
public class KernelResource {
    public String RID;
//    Number of free units
    public int max_unit;
    public int status;
    public LinkedList<KernelProcess> blocked_list;
    public LinkedList<KernelProcess> using_list;

    public KernelResource(int unit, String RID) {
        this.max_unit = unit;
        this.status = unit;
        this.RID = RID;
        this.blocked_list = new LinkedList<KernelProcess>();
        this.using_list = new LinkedList<KernelProcess>();
    }

    /**
     * Remove the blocked process and return it if it exists
     * @return  {@link zhuliang.nus.cs2106.KernelProcess} or null
     */
    public KernelProcess getAndRemoveBlocked(){
        if(this.blocked_list == null || this.blocked_list.isEmpty()){
            return null;
        }else{
            return this.blocked_list.removeFirst();
        }
    }
}


package morris.com.voucher.graphql;

import com.apollographql.apollo.ApolloClient;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;

/**
 * Created by morris on 03/01/2019
 */

public class GraphQL {

    public static final String BASE_URL =

    "http://192.168.43.250:2508/graphql/";
   //"http://192.168.1.192:2508/graphql";
   //"http://173.82.51.162:2508/graphql";

    private static ApolloClient apolloClient;

    public static ApolloClient getApolloClient(){

//        HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
//        loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);

        OkHttpClient okHttpClient = new OkHttpClient.Builder()
               // .addInterceptor(loggingInterceptor)
                .connectTimeout(10, TimeUnit.SECONDS)
                .build();

        apolloClient = ApolloClient.builder()
                .serverUrl(BASE_URL)
                .okHttpClient(okHttpClient)
                .build();
        return apolloClient;
    }

}


package reflection;

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

/**
 * ClassA
 * Learning
 *
 * @author WissenSolutions.
 */
public class ClassA {
    private static final Logger logger = LoggerFactory.getLogger(ClassA.class);

    private int id;
    private String name;

    private ClassA(int iId, String iName) {
        id = iId;
        name = iName;
    }

    public ClassA() {
    }

    public int getId() {
        return id;
    }

    public void setId(int iId) {
        id = iId;
    }

    public String getName() {
        return name;
    }

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

    public void printObject(){
        logger.info(toString());
    }

    public ClassA createInstance(int iId, String iName){
        return new ClassA(iId,iName);
    }

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


package org.shaneking.sql.entity;

import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.shaneking.skava.util.Date0;

import javax.persistence.Column;

/**
 * Just reference
 */
@Accessors(chain = true)
@ToString
public abstract class SKZoneAdtVerFullEntity<J> extends SKIdAdtVerFullEntity<J> {
  /**
   * @see org.shaneking.skava.util.Date0#XXX
   */
  @Column(length = 10, columnDefinition = "COMMENT 'The creation time zone of record'")
  @Getter
  @Setter
  private String crtZone;

  /**
   * @see org.shaneking.skava.util.Date0#XXX
   */
  @Column(length = 10, columnDefinition = "COMMENT 'The invalid time zone of record'")
  @Getter
  @Setter
  private String ivdZone;

  /**
   * @see org.shaneking.skava.util.Date0#XXX
   */
  @Column(length = 10, columnDefinition = "COMMENT 'The last modification time zone of record'")
  @Getter
  @Setter
  private String modZone;

  public SKZoneAdtVerFullEntity<J> initWithUserId(@NonNull String userId) {
    super.initWithUserId(userId);
    return this.setCrtZone(Date0.on().zone());
  }
}


package com.cgt.yuanmeng.baseapplication.ui.splash;

import android.content.Intent;
import android.os.Bundle;

import com.cgt.yuanmeng.baseapplication.R;
import com.cgt.yuanmeng.baseapplication.base.BaseActivity;
import com.cgt.yuanmeng.baseapplication.ui.main.MainActivity;

/**
 * @author zhonghang
 * description:
 */
public class SplashActivity extends BaseActivity<SplashContract.Presenter> implements SplashContract.View {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public SplashContract.Presenter initPresenter() {
        return new SplashPresenter();
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_splash;
    }

    @Override
    public void initViews() {

    }

    @Override
    public void initData() {

    }

    @Override
    protected void onResume() {
        super.onResume();
        mPresenter.delayedOperation();
    }

    @Override
    public void startToMainActivity() {
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }
}


package com.framework.aspectj;

import com.framework.aspectj.lang.annotation.TargetDataSource;
import com.framework.datasource.DynamicDataSourceContextHolder;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Aspect
@Order(-1)
@Component
public class DataSourceAspect {

    /**
     * 改变数据源
     *
     * @param joinPoint
     * @param targetDataSource
     */
    @Before("@annotation(targetDataSource)")
    public void changeDataSource(JoinPoint joinPoint, TargetDataSource targetDataSource) {
        String dsType = targetDataSource.value().name();
        if (!DynamicDataSourceContextHolder.isContainsDataSource(dsType)) {
        } else {
            DynamicDataSourceContextHolder.setDateSoureType(dsType);
        }
    }

    @After("@annotation(targetDataSource)")
    public void clearDataSource(JoinPoint joinPoint, TargetDataSource targetDataSource) {
        DynamicDataSourceContextHolder.clearDateSoureType();
    }
}


package com.jhhscm.platform.fragment.invitation;

import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.jhhscm.platform.databinding.FragmentIntegralBinding;
import com.jhhscm.platform.fragment.base.AbsFragment;

/**
 * 积分
 */
public class IntegralFragment extends AbsFragment<FragmentIntegralBinding> {
    private int type;
    private String des;

    public static IntegralFragment instance() {
        IntegralFragment view = new IntegralFragment();
        return view;
    }

    @Override
    protected FragmentIntegralBinding bindRootView(LayoutInflater inflater, ViewGroup container, boolean attachToRoot) {
        return FragmentIntegralBinding.inflate(inflater, container, attachToRoot);
    }

    @Override
    protected void setupViews() {
        type = getArguments().getInt("type", 0);
        des = getArguments().getString("des");

        if (des != null && des.length() > 0) {
            mDataBinding.content.setText(des);
        }
    }
}


import java.util.ArrayList;

public class Terminal {
    private ArrayList<ISkiPass> skiPasses;
    private SkiPassFactory skiPassFactory;
    public Terminal(SkiPassFactory skiPassFactory){
        skiPasses = new ArrayList<>();
        this.skiPassFactory = skiPassFactory;
    }
    boolean block(int id){
        for(ISkiPass skiPass: skiPasses){
            if(skiPass.getId() == id){
                skiPass.block();
                return true;
            }
        }
        return false;
    }

    public ArrayList<ISkiPass> getSkiPasses() {
        return skiPasses;
    }

    boolean unblock(int id){
        for(ISkiPass skiPass: skiPasses){
            if(skiPass.getId() == id){
                skiPass.unblock();
                return true;
            }
        }
        return false;
    }

    ISkiPass createSkiPass(SkiPassType skiPassType, ISkiPassChecker checker){
        ISkiPass skiPass = skiPassFactory.createSkiPass(skiPassType, checker);
        skiPasses.add(skiPass);
        return skiPass;
    }

}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package uas;

import java.sql.Statement;
import javax.swing.JOptionPane;

/**
 *
 * @author sugi
 */
public class Insert {
    Koneksi konek = new Koneksi();

    public void insert(int no, String judul, String pengarang, String kategori, int halaman, String penerbit, int tahun) {
        try {
            konek.koneksi();
            Statement statement = konek.con.createStatement();
            String sql = "insert into daftarbuku values('" + no + "','" + judul + " ',' " + pengarang + "','" + kategori + "','" + halaman + "','" + penerbit + "','" + tahun + "');";
            statement.executeUpdate(sql);
            statement.close();

            JOptionPane.showMessageDialog(null, "Berhasil Disimpan");
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, ex);
        }
    }
}


package com.sandbox.sandbox.common.services;

import com.sandbox.sandbox.common.services.beans.BeanServicesDefinition;

/**
 * Clase que se encarga de proporcionar los servicios de la aplicación.
 */
public class ServicesFactory {
    private static BeanServicesDefinition servicesDef = null;

    public static GenericService getService(String key) throws Exception {
	GenericService service = null;
	service = getService(key, "default");
	return service;
    }

    public static GenericService getService(String key, String variant) throws Exception {
	GenericService service = null;
	StringBuffer sbVariant = new StringBuffer(variant);
	Class clase = Class.forName(servicesDef.getService(key).getSubservice(sbVariant.toString()).getClassName());
	service = (GenericService) clase.newInstance();
	return service;
    }

    public static BeanServicesDefinition getServicesDef() {
	return servicesDef;
    }

    public static void setServicesDef(BeanServicesDefinition definition) {
	servicesDef = definition;
    }

}


package orionlofty.com.apps.gadspracticeproject.services;

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

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class SubmitServiceBuilder {
    private static final String URL = "https://docs.google.com/forms/d/e/";

    //creating a logger
    private static HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor()
            .setLevel(HttpLoggingInterceptor.Level.BODY);
    //creating OkHttpClient
    private static OkHttpClient.Builder client = new OkHttpClient.Builder().
            addInterceptor(interceptor);

    private static Retrofit.Builder builder = new Retrofit.Builder()
            .baseUrl(URL)
            .addConverterFactory(GsonConverterFactory.create())
            .client(client.build());

    private static Retrofit retrofit = builder.build();

    public static <S> S buildService(Class<S> serviceType){
        return retrofit.create(serviceType);
    }
}


# Kotlin Contest

**Kotlin Contest** is an android app that shows a list of top albums. The app utilizes [Last FM API](http://www.last.fm/api).

## Project setup

To run the project you should obtain a new Last FM api key that needs to be set in the gradle.properties file.

## Open-source libraries used

- [Retrofit](https://github.com/square/retrofit/) - REST client for Android developed by Square.
- [RxAndroid](https://github.com/ReactiveX/RxAndroid/) - Reactive Extensions for Android.
- [Picasso](https://github.com/square/picasso/) - Image loading and caching library for Android.

## License

    Copyright 2017 Victor Mariano Lopez Medina

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.


// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.tenant;

import com.yahoo.vespa.config.server.MockReloadHandler;
import com.yahoo.vespa.config.server.rpc.MockRequestHandler;
import com.yahoo.vespa.config.server.ReloadHandler;
import com.yahoo.vespa.config.server.RequestHandler;

/**
 * @author Ulf Lilleengen
 */
public class MockTenantProvider implements TenantHandlerProvider {

    private final MockRequestHandler requestHandler;
    private final MockReloadHandler reloadHandler;

    public MockTenantProvider() {
        this(false);
    }

    public MockTenantProvider(boolean pretendToHaveLoadedAnyApplication) {
        this.requestHandler = new MockRequestHandler(pretendToHaveLoadedAnyApplication);
        this.reloadHandler = new MockReloadHandler();
    }

    @Override
    public RequestHandler getRequestHandler() { return requestHandler; }

    @Override
    public ReloadHandler getReloadHandler() {
        return reloadHandler;
    }

}


package top.yangwulang.utils;

import java.io.*;

/**
 * @author yangwulang
 * @date 2020/4/19 增加读取资源目录下的文件转化成string
 */
public class LoadJson {
    /**
     * 读取resources目录下的request.json文件到内存
     *
     * @return 加载文件到内存中
     * @throws IOException s
     */
    public static String loadJson() throws IOException {
        return loadJson("/static/json/request.json");
    }

    /**
     * 加载{@link LoadJson}classpath环境下的指定路径数据转成string
     *
     * @param path 文件地址(相对路径)
     * @return 以字符串形式的文件
     * @throws IOException s
     */
    public static String loadJson(String path) throws IOException {
        InputStream resourceAsStream = LoadJson.class.getResourceAsStream(path);
        InputStreamReader inputStreamReader = new InputStreamReader(resourceAsStream);
        BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
        StringBuilder stringBuffer = new StringBuilder();
        String s;
        while ((s = bufferedReader.readLine()) != null) {
            stringBuffer.append(s);
        }
        return stringBuffer.toString();
    }
}


package LeetCode;

import java.util.HashMap;
import java.util.Stack;

public class ValidParantheses {

    public static boolean isValid(String s) {
        if(s.length() < 2) return false;

        boolean isValid = false;
        HashMap<Character, Character> parentheses = new HashMap<>();
        parentheses.put('{', '}');
        parentheses.put('(', ')');
        parentheses.put('[', ']');

        Stack<Character> stack = new Stack<>();
        for(int i = 0; i < s.length(); i++) {
            if(parentheses.containsKey(s.charAt(i))) {
                stack.push(s.charAt(i));
            } else {
                if(stack.empty()) {
                    return false;
                }
                char openParentheses = stack.pop();
                if(s.charAt(i) != parentheses.get(openParentheses)) {
                       isValid = false;
                       stack.push(openParentheses);
                       break;
                } else {
                    continue;
                }
            }
        }

        if(stack.empty()) isValid = true;

        return isValid;
    }

    public static void main(String[] args) {
        System.out.println(isValid("(]"));
    }
}


package com.but.simple.service;

import com.but.simple.entity.Message;
import com.but.simple.entity.User;
import com.but.simple.repository.MessageRepository;
import com.but.simple.utils.Utils;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class MessageService {
    private final MessageRepository messageRepository;

    public MessageService(MessageRepository messageRepository) {
        this.messageRepository = messageRepository;
    }

    public void add(User user, String text, String tag, Map<String, Object> model) {
        String time = Utils.dateNow();

        Message message = new Message(text, tag, time, user);
        messageRepository.save(message);

        Iterable<Message> messages = messageRepository.findAll();

        model.put("messages", messages);
    }

    public void main(Map<String, Object> model){
        Iterable<Message> messages = messageRepository.findAll();

        model.put("messages", messages);
    }
}


package com.example.layoutcomparedemo;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;

public class Titleview extends ConstraintLayout {
    private static final String TAG = "Titleview";
    public Titleview(Context context) {
        super(context);
        LayoutInflater.from(context).inflate(R.layout.title_view,this);
    }

    public Titleview(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater.from(context).inflate(R.layout.title_view,this);
    }

    public Titleview(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
//        LayoutInflater.from(context).inflate(R.layout.title_view,this);
    }

/*    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        Log.e(TAG, "onMeasure: " );
    }*/
}


package com.gonwan.restful.springboot.model;

import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;
import java.sql.Date;
import java.util.Objects;

public class TUserDateCountPK implements Serializable {
    private String username;
    private Date rowDate;

    @Column(name = "username", nullable = false, length = 32)
    @Id
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Column(name = "row_date", nullable = false)
    @Id
    public Date getRowDate() {
        return rowDate;
    }

    public void setRowDate(Date rowDate) {
        this.rowDate = rowDate;
    }

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

    @Override
    public int hashCode() {

        return Objects.hash(username, rowDate);
    }
}


package com.example.jpadb;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

@Controller
public class PostsController {

    @Autowired
    private PostsRepository postRepostory;

   // @GetMapping("/posts/{Headline}/{Post}")
   @GetMapping ("/posts")
   public String getposts (Model model){
       List<Posts> Posts = (List<Posts>) postRepostory.findAll();
       for (int i =0; i < Posts.size(); i++) {
           System.out.println(Posts.get(i).getHeadline());
           System.out.println(Posts.get(i).getPost());
                  }
       model.addAttribute("Posts", Posts);
       return "blogg";
   }

   @PostMapping("/posts")
    public String addposts(Posts posts){
        postRepostory.save(new Posts(posts.getPost(), posts.getHeadline()));
        return "blogg";
    }

}


package com.github.apz.controller;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttribute;
import org.springframework.web.servlet.ModelAndView;

import com.github.apz.model.SampleModel;
import com.github.apz.model.SampleModel.Address;

@Controller
@RequestMapping
public class SampleController {
	@GetMapping("setup")
	public ModelAndView setup(ModelAndView mnv, HttpSession session) {

		//SampleModel sampleModel = SampleModel.of("new user", Address.of("Tochigi", "gyouza-city", 8L));
		SampleModel sampleModel = SampleModel.of("new user", Address.of("Tochigi", "gyouza-city"));

		session.setAttribute("sampleModel", sampleModel);
		mnv.addObject(sampleModel);
		mnv.setViewName("sample");
		return mnv;
	}

	@GetMapping("display")
	public ModelAndView display(ModelAndView mnv, @SessionAttribute SampleModel sampleModel) {
		mnv.addObject(sampleModel);
		mnv.setViewName("sample");
		return mnv;
	}
}


package com.videorentalapi.service.services;

import com.videorentalapi.service.models.User;
import com.videorentalapi.service.repository.UserRepository;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class UserServiceImpl implements UserService {

    private BCryptPasswordEncoder bCryptPasswordEncoder;

    private UserRepository userRepository;

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

    @Override
    public User saveUser(String username, String password) {

        User user = new User();

        user.setUsername(username);
        user.setPassword(bCryptPasswordEncoder.encode(password));
        return userRepository.save(user);
    }

    @Override
    public User findByUsername(String username){
        User user = new User();
        user.setUsername(username);
        Optional<User> userDetails=userRepository.findByUsername(user.getUsername());
        return userDetails.orElse(null);
    }

}


package com.danielcotter.swingit.utility;

import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;

import org.springframework.stereotype.Component;

@Component
public class ModalUtility {

	public String getInput(String text) {
		JLabel label = new JLabel(text);
		final JTextField input = new JTextField();
		Object[] ob = { label, input };
		int result = JOptionPane.showConfirmDialog(null, ob, "SwinGit", JOptionPane.OK_CANCEL_OPTION);

		if (result == JOptionPane.OK_OPTION)
			return input.getText().trim();

		return null;
	}

	public String dropDown(String choices[], String text) {
		String input = (String) JOptionPane.showInputDialog(null, text, "SwinGit", JOptionPane.QUESTION_MESSAGE, null,
				choices, choices[0]);

		return input;
	}

	public void error(String error) {
		JOptionPane.showMessageDialog(null, "Error\n" + error, "SwinGit", JOptionPane.ERROR_MESSAGE);
	}

	public void info(String info) {
		JOptionPane.showMessageDialog(null, info, "SwinGit", JOptionPane.INFORMATION_MESSAGE);
	}
}


package com.jzwl.mytest.login.service.impl;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jzwl.base.service.BaseService;
import com.jzwl.mytest.login.dao.LoginDao;
import com.jzwl.mytest.login.service.LoginService;

/**
 * 登录service接口实现类
 *
 * @ClassName: LoginServiceImpl
 * @author: zhang guo yu
 * @date: 2015-1-21 下午2:54:43
 * @version: 1.0.0
 */
@Service("loginService")
public class LoginServiceImpl extends BaseService implements LoginService {

	@Autowired
	private LoginDao loginDao;
	/**
	 * 通过用户名获取用户账户信息
	 * @param userName 用户名
	 * */
	public Map<String,Object> getUserInfoByUserName(String userName){
		return loginDao.getUserInfoByUserName(userName);
	}

	/**
	 * 通过用户名获取用户角色权限信息
	 * @param userName 用户名
	 * */
	public List<Map<String, Object>> getUserRolesInfoByUserName(String userName){
		return loginDao.getUserRolesInfoByUserName(userName);
	}
}


# flume-more
more sources, interceptors and others

## more sources
### com.github.bingoohuang.flume.more.source.ExecBlockSource
Enhance exec source to support a log event which may contain multiple lines like java exception trace stacks.
example:

    a1.sources = r1
    a1.channels = c1
    a1.sources.r1.type = com.github.bingoohuang.flume.more.source.ExecBlockSource
    a1.sources.r1.boundaryRegex=\d{4}-\d{2}-\d{2}
    a1.sources.r1.command = tail -F /var/log/secure
    a1.sources.r1.channels = c1

## more interceptors
### com.github.bingoohuang.flume.more.interceptor.MultiStaticInterceptor
Interceptor class that appends multiple static, pre-configured headers to all events.
example:

    agent.sources.r1.channels = c1
    agent.sources.r1.type = SEQ
    agent.sources.r1.interceptors = i1
    agent.sources.r1.interceptors.i1.type = com.github.bingoohuang.flume.more.interceptor.MultiStaticInterceptor
    agent.sources.r1.interceptors.i1.preserveExisting = false
    agent.sources.r1.interceptors.i1.keyValues = key1:value1, key2:value2


package me.bman7842.soldiersvszombies.managers;

import me.bman7842.soldiersvszombies.utils.FileManager;

import java.util.ArrayList;
import java.util.Random;

/**
 * Created by brand_000 on 8/2/2015.
 */
public class ArenaManager {

    private ArrayList<Arena> arenas;

    private ArenaManager(){
        this.arenas = new ArrayList<Arena>();
    }

    static ArenaManager instance = new ArenaManager();

    public static ArenaManager getInstance() {
        return instance;
    }

    public void setup() {
        arenas.clear();

        for (String arenaId : FileManager.getArenas().getKeys()) {
            arenas.add(new Arena(arenaId));
        }
    }

    public Arena getArena(String id) {
        for (Arena arena : arenas) {
            if (arena.getID().equals(id)) {
                return arena;
            }
        }
        return null;
    }

    public ArrayList<Arena> getArenas() {
        return arenas;
    }

    public Arena getActiveArena() {
        Random r = new Random();
        int index = r.nextInt(getArenas().size());
        return getArenas().get(index);
    }

}


package pl.edu.pwr.service.mapper;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import pl.edu.pwr.domain.Course;
import pl.edu.pwr.service.dto.CourseDTO;

/**
 * Mapper for the entity {@link Course} and its DTO {@link CourseDTO}.
 */
@Mapper(componentModel = "spring", uses = {KnowledgeAreaMapper.class, EducationPlanMapper.class})
public interface CourseMapper extends EntityMapper<CourseDTO, Course> {

    @Mapping(source = "educationPlan.id", target = "educationPlanId")
    CourseDTO toDto(Course course);

    @Mapping(target = "classes", ignore = true)
    @Mapping(target = "removeClasses", ignore = true)
    @Mapping(target = "removeTags", ignore = true)
    @Mapping(source = "educationPlanId", target = "educationPlan")
    @Mapping(target = "teachersThatPreferThisCourses", ignore = true)
    @Mapping(target = "removeTeachersThatPreferThisCourse", ignore = true)
    Course toEntity(CourseDTO courseDTO);

    default Course fromId(Long id) {
        if (id == null) {
            return null;
        }
        Course course = new Course();
        course.setId(id);
        return course;
    }
}


package guru.springframework;

import com.fasterxml.jackson.databind.JsonNode;
import guru.springframework.controllers.v1.CategoryController;

import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.client.RestTemplate;

@SpringBootTest
@RunWith(SpringRunner.class)
@WebMvcTest(CategoryController.class)
public class ThisRestTests {
    private static final String ROOT_URL = "http://localhost:8080/api/v1/categories";

    @Autowired
    private MockMvc mvc;

    @Test
    public void testGetAllCategories() throws Exception {
        String apiUrl = ROOT_URL;
        RestTemplate restTemplate = new RestTemplate();
        JsonNode jsonNode = restTemplate.getForObject(apiUrl, JsonNode.class);
        System.out.println("Response");
        System.out.println(jsonNode.toString());
    }
}


public class Drug {

	private String name;
	private String id;
	private double price;
	private int availability;
	private int soldUnits;

	public Drug(String name, String Id, double price, int availability) {
		this.name = name;
		this.id = Id;
		this.price = price;
		this.availability = availability;
		this.soldUnits =  0 ;
	}

	public Drug(String name, String Id) {

		this.name = name;
		this.id = Id;
	}

	public String getName() {

		return name;
	}

	public String getId() {

		return id;
	}

	public double getPrice() {

		return price;
	}

	public void setPrice(double price) {

		this.price = price;
	}

	public int getAvailability() {

		return availability;
	}

	public void setAvailability(int availability) {

		this.availability = availability;
	}

	public void setSoldUnits(int soldUnits) {

		this.soldUnits = soldUnits;
	}

	public int getSoldUnits() {

		return soldUnits;
	}

}


package com.cuiyun.kfcoding.core.exception;

/**
 * @program: kfcoding
 * @description: KfCoding异常枚举
 * @author: maple
 * @create: 2018-05-05 21:05
 **/
public enum KfCodingExceptionEnum implements ServiceExceptionEnum {
    /**
     * 其他
     */
    WRITE_ERROR(500,"渲染界面错误"),

    /**
     * 文件上传
     */
    FILE_READING_ERROR(400,"FILE_READING_ERROR!"),
    FILE_NOT_FOUND(400,"FILE_NOT_FOUND!"),

    /**
     * 错误的请求
     */
    REQUEST_NULL(400, "请求有错误"),
    SERVER_ERROR(500, "服务器异常");

    KfCodingExceptionEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    private Integer code;

    private String message;

    @Override
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}


package sample.xmlviewer.data;

import javafx.scene.control.TreeItem;
import sample.xmlviewer.main.ViewerWindowMain;
import java.io.File;
import java.util.ArrayList;

public class ViewerManager {

    private static File xmlFile;
    private static String xsdFilePath;
    private static ArrayList<TreeItem<String>> treeItem;

    public static void setTreeItem(ArrayList<TreeItem<String>> item){
        treeItem = item;
        ViewerWindowMain.contentPanel.setRootItem();

    }

    public static ArrayList<TreeItem<String>> getTreeItem() {
        return treeItem;
    }

    public static void setXmlFile(File xmlFile) {
        ViewerManager.xmlFile = xmlFile;
        ViewerWindowMain.footerPanel.setLabel(getXmlFilePath());
    }

    public static String getXmlFilePath(){
        return xmlFile.getAbsolutePath();
    }

    public static void setXsdFilePath(String xsdFilePath) {
        ViewerManager.xsdFilePath = xsdFilePath;
    }

    public static String getXsdFilePath() {
        return xsdFilePath;
    }

}


# HTML_CSS_JS_WebSite
 My attempt to get started with basic web dev using HTML, CSS, and Javascript.
 This project is to help me get used to working with HTML and CSS while being an introduction for Javascript for me!

 This project is based on 'The Road' project from lashaNoz on Github, it's not meant to be public but to help me learn web dev as well as to use it as a reference guide for my future projects!

 lashaNoz's project can be found here: https://github.com/lashaNoz/The-Road/tree/Final

 lashaNoz's video can be found on his youtube channel 'CodeandCreate', link to video is here: https://www.youtube.com/watch?v=qmyN7lYY_xo

 Requirements

A Local Host Server: I am using the 'Live Server' extension from Visual Studio Code/Codium to create a virtual server to view to site. You can use any virtual server tool to make your own server!

 Notes:

 Project finished, can and may expand it in the future, in the mean time to be used as reference!


package readers_writers.readers_first;

import java.util.Random;
import java.util.concurrent.Semaphore;

public class Writer extends Thread {
    private Random gen = new Random();
    private Semaphore _sem;
    private SynchData _synchData;

    public Writer(Semaphore sem, SynchData synchData) {
        _sem = sem;
        _synchData = synchData;
    }

    public void run() {
        _synchData.lock.lock();
        try {
            while (!_synchData.canWrite)
            {
                _synchData.write_cond.await();
            }
            while (!_sem.tryAcquire()) {}
//            System.out.println("Writing...");
            int time_to_sleep = 10;
            sleep(time_to_sleep);
//            System.out.println("Writing finished.");
            if (_synchData.waiting_readers_no != 0)
            {
                _synchData.canWrite = false;
            } else {
                _synchData.write_cond.signal();
            }
        } catch (Exception e) {}
        _sem.release();
        _synchData.lock.unlock();
    }
}


package model.id3;
/**
 *
 * represents a mp3 frame
 *
 * @author MPGI 4, WS 11/12, Tutorium 01, Gruppe 05
 *
 */
public class ID3Frame {

	public static final int TAG_ALTER_PRESERVATION = 0;
	public static final int FILE_ALTER_PRESERVATION = 1;
	public static final int READ_ONLY = 2;
	public static final int COMPRESSION = 3;
	public static final int ENCRYPTION = 4;
	public static final int GROUPING_IDENTIFY = 5;

	private String id;
	private byte[] flags;

	public ID3Frame(String id, byte[] flags) {
		this.id = id;
		this.flags = flags;
	}

	public String getID() {
		return id;
	}

	public byte[] getFlags() {
		return flags;
	}

	public static boolean isFlagSet(byte[] flags, int flag) {
		switch (flag) {
		case TAG_ALTER_PRESERVATION:
			return (flags[0] & 1 << 7) == 1 << 7;
		case FILE_ALTER_PRESERVATION:
			return (flags[0] & 1 << 6) == 1 << 6;
		case READ_ONLY:
			return (flags[0] & 1 << 5) == 1 << 5;
		case COMPRESSION:
			return (flags[1] & 1 << 7) == 1 << 7;
		case ENCRYPTION:
			return (flags[1] & 1 << 6) == 1 << 6;
		case GROUPING_IDENTIFY:
			return (flags[1] & 1 << 5) == 1 << 5;
		}
		return false;
	}

	public boolean isFlagSet(int flag) {
		return isFlagSet(flags, flag);
	}

}


import java.io.Serializable;

/**
 * @program: COMP90015A2
 * @description:
 * @author: Pinzhuo Zhao, StudentID:1043915
 * @create: 2021-05-07 21:07
 **/
public class ClientMessage implements Serializable {
    String prefix;
    String message;
    private static final long serialVersionUID = 1L;

    public ClientMessage(String prefix, String message) {
        this.prefix = prefix;
        this.message = message;
    }

    public ClientMessage(String prefix) {
        this.prefix = prefix;
    }

    public ClientMessage() {
    }

    public String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String toString() {
        return "ClientMessage{" +
                "prefix='" + prefix + '\'' +
                ", message='" + message + '\'' +
                '}';
    }
}


package edu.vescame.simpleSpringSecurity.seed;

import edu.vescame.simpleSpringSecurity.entity.Role;
import edu.vescame.simpleSpringSecurity.repository.RoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

import java.util.Arrays;

@Component
public class RoleInitializer implements ApplicationListener<ContextRefreshedEvent> {
    private final RoleRepository roleRepository;

    @Autowired
    public RoleInitializer(final RoleRepository roleRepository) {
        this.roleRepository = roleRepository;
    }

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        this.roleRepository.saveAll(roles());
    }

    private Iterable<Role> roles() {
        Role admin = new Role("ROLE_ADMIN");
        Role user = new Role("ROLE_USER");

        return Arrays.asList(admin, user);
    }
}


# Vue-Bootstrap-Select

vue-bootstrap-select - A dropdown select component, that allows for single and multiple selection as well as filtering, for vue.js.

### Version : 0.0.1 - Beta version

### [Demo](https://jbaysolutions.github.io/vue-bootstrap-select/examples/01-basic.html)

<!--
## Table of Contents

- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Contribute](#contribute)
- [TODO List](#todo-list)

## Demos

TODO UPDATE DOCS
TODO UPDATE CHANGELOG

-->

#### Projects using vue-bootstrap-table

*Know of others? Create a PR to let me know!*

## Features

## Requirements

* Vue 2.* (tested with 2.3.3)
* Bootstrap 4

## Installation

Install the vue-bootstrap-select [package](https://www.npmjs.org/package/vue-bootstrap-select) package using [npm](https://www.npmjs.com/):

	npm install vue-bootstrap-select

Or add the js script to your html (download from [releases](https://github.com/jbaysolutions/vue-bootstrap-select/releases)):

    <script src="vue-bootstrap-table.js"></script>

## Usage

Not written yet

## Contribute

If you have a feature request, please add it as an issue or make a pull request.

## TODO List

Many stuff,

## Changelog

### 0.0.1

* Starting point


package com.filesearch;

import java.util.Arrays;
import java.util.List;

public class SearchQuery{

	private String searchString;
	private List<String> fileFilterExtensions;
	private SortOn sortCriteria;

	public SearchQuery(String searchString, String... fileFilterExtensions) {
		this.searchString = searchString;
		this.fileFilterExtensions = Arrays.asList(fileFilterExtensions);

	}

	public SearchQuery(String searchString, SortOn sortCriteria, String... fileFilterExtensions) {
		this.searchString = searchString;
		this.sortCriteria = sortCriteria;
		this.fileFilterExtensions = Arrays.asList(fileFilterExtensions);

	}

	public String getSearchString() {

		return isPrefixedWithAsterisk()? searchString.replace("*", "") : searchString;
	}

	public boolean matchesFileFilterExtensions(String fileExtension) {
		if(fileFilterExtensions.size() == 0 || fileFilterExtensions.contains("*")){
			return true;
		}
		return fileFilterExtensions.contains(fileExtension);
	}

	public boolean isPrefixedWithAsterisk(){
		return searchString.startsWith("*");

	}

	public SortOn getSortCriteria() {
		return sortCriteria;
	}
}


PHP Exchange Web Services

The PHP Exchange Web Services library (php-ews) is intended to make communication with Microsoft Exchange servers using Exchange Web Services easier. It handles the NTLM authentication required to use the SOAP services and provides an object-oriented interface to the complex types required to form a request.

Dependencies

Composer
PHP 5.4 or greater
cURL with NTLM support (7.30.0+ recommended)
Exchange 2007 or later

Installation

composer require php-ews/php-ews

Usage

$server: The url to the exchange server you wish to connect to, without the protocol. Example: mail.example.com. If you have trouble determining the correct url, you could try using the \jamesiarmes\PhpEws\Autodiscover class.

$username: The user to connect to the server with. This is usually the local portion of the users email address. Example: "user" if the email address is "user@example.com".

$password: The user's plain-text password.
$version (optional): The version of the Exchange sever to connect to. Valid values can be found at \jamesiarmes\PhpEws\Client::VERSION_*. Defaults to Exchange 2007.


package rentalstore;

public class Movie {
    public static final int CHILDRENS = 2;
    public static final int REGULAR = 0;
    public static final int NEW_RELEASE = 1;

    private String title;
    private int priceCode;

    public Movie(String title,int priceCode) {
        this.title = title;
        this.priceCode = priceCode;
    }

    public double getMovieType(int dayRented) {
        double thisAmount = 0;

        switch (this.getPriceCode()) {
            case Movie.REGULAR:
                return new RegularStrategy().getAmount(dayRented);
            case Movie.NEW_RELEASE:
                return new NewReleaseStrategy().getAmount(dayRented);
            case Movie.CHILDRENS:
                return new ChildrenStrategy().getAmount(dayRented);
        }
        return thisAmount;
    }

    public int getPriceCode() {
        return priceCode;
    }

    public void setPriceCode(int priceCode) {
        this.priceCode = priceCode;
    }

    public String getTitle() {
        return title;
    }
}


package com.wumeng.changeskin_android.util;

import android.content.Context;
import android.content.SharedPreferences;

import com.wumeng.changeskin_android.skin.SkinConfig;

/**
 * @author WuMeng
 * @date 2021/4/12
 * desc:
 */
public class SkinPreferencesUtil {

    /**
     * 存储字符串
     * @param context
     * @param key
     * @param value
     * @return
     */
    public static boolean putString(Context context,String key,String value) {
        SharedPreferences preferences = context.getSharedPreferences(SkinConfig.PREF_SKIN_NAME,Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = preferences.edit();
        editor.putString(key, value);
        return editor.commit();
    }

    /**
     * 获取存储的字符串值
     * @param context
     * @param key
     * @param defaultValue
     * @return
     */
    public static String getString(Context context,String key,String defaultValue) {
        SharedPreferences preferences = context.getSharedPreferences(SkinConfig.PREF_SKIN_NAME,Context.MODE_PRIVATE);
        return preferences.getString(key,defaultValue);
    }

}


package com.pojosontheweb.ttt;

import com.intellij.openapi.components.AbstractProjectComponent;
import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.*;
import org.jetbrains.annotations.NotNull;

public class TttProjectComponent extends AbstractProjectComponent {

    private final Logger LOG = Logger.getInstance(TttProjectComponent.class.getName());

    private final TttCompileOnSaveListener listener;

    public TttProjectComponent(@NotNull Project project) {
        super(project);
        listener = new TttCompileOnSaveListener(project);
    }

    @NotNull
    @Override
    public String getComponentName() {
        return "TttProjectComponent";
    }

    @Override
    public void projectOpened() {
        LOG.info("Registering file listener");
        VirtualFileManager.getInstance().addVirtualFileListener(listener);
    }

    @Override
    public void projectClosed() {
        LOG.info("Removing file listener");
        VirtualFileManager.getInstance().removeVirtualFileListener(listener);
    }

}


## How to run the application

- clone the repository
- to run the project you need to have NodeJS and NPM installed on your computer

 In the project directory, you can run:

- `npm install`
- `npm start`

or you can use yarn

- `yarn install`
- `yarn start`

## Description

In README.md I added instructions how to start the application.
There are 2 fields in the application
 - 1 has "Search Input" and "Search Phrase" button, thanks to them you can search phrase in Wikipedia API
 - 2 has "Replace With Input" and buttons "Replace" and "Replace With", thanks to them you can change given phrase in list to phrase from "Replace With Input"
The application has loaders and "no results found" if there is no such result in the Wikipedia API.

As for the Wikipedia API data, I didn't use any "sanitize" and dangerouslySetInnerHTML, I just listed the text itself from the snippet.
I used Context API due to the fact that I have little time to complete the task, it would also be convenient to use Redux.

## Technologies

- SASS - for styling
- react-highlight-words - to highlight searched words
- react-debounce-input - to make function wait until getting fired ( set the time between last function calls )


# Project3

Description

The Atlanta comedy scene is a thriving scene with many venues and many open mic opportunities, however it is very difficult to find out where and when these shows are unless you follow specific comedians on social media. Comedy Tracker is a user sourced site that will allow people to track what comedy shows and open mics are coming to atlanta with information on ticket purchasing and venue location.

Deployed App:
https://comedy-tracker.herokuapp.com/

Trello Board:
https://trello.com/b/Qv9Xte5F/wdi-project-3

![Wireframe and ERD](https://i.imgur.com/MWUHvQK.jpg)

The technologies I used in this project are: Node, express, mongoose, React, styled-components, Moment.js, axios, nodemon, concurrently.

In version 2 I would like to add multiple cities to be tracked, pull from the Google calendar API to easily pull open mics, add passport for user authentication, sessions, and the ability to favorite shows so that they show up on an individual users page.


package com.tistory.devyongsik.crescent.collection.entity;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

@XStreamAlias("analyzer")
public class CrescentAnalyzerHolder {

	@XStreamAsAttribute
	private String type;

	@XStreamAlias("className")
	@XStreamAsAttribute
	private String className;

	@XStreamAlias("constructor-args")
	@XStreamAsAttribute
	private String constructorArgs;

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	public String getConstructorArgs() {
		return constructorArgs;
	}

	public void setConstructorArgs(String constructorArgs) {
		this.constructorArgs = constructorArgs;
	}

	@Override
	public String toString() {
		return "CrescentAnalyzerHolder [type=" + type + ", className="
				+ className + ", constructorArgs=" + constructorArgs + "]";
	}
}


# Sake Label Maker

For exhibition at Creative Code Tokyo, September 2019.

## TODO

- add dat.gui to control sake label params
  - [TOCONFIRM]
    - sake region -> background gradient color (Ine = red (inemankai), Akita = white (doburoku))
    - sake style (junmai, gingjo, daiginjo, honjozo, futsushu) -> shortcut for param presets? (modifies all other params to certain settings)
    - SMV -> liquid thickness (sweet is thicker, acidic is thinner)
    - semai buai -> liquid color (dark to clear)
    - filtering style (nama, hiyaoroshi, pasturized, muroka, nigori, doburoku) -> blurring of liquid
    - ... change texture img added to liquid (like in fireball example) for changing... what param?... sake region?
    - ... others for deformation intensity, anim speed, etc.
- add sake label text to canvas foreground
- connect dat.gui changes to label text (eg. region changes to "Niigata" -> change text to that)
- add printing file export (or screenshot?)(should be quite long to go around bottle; important?)

dat.gui notes:
- string options allows arrays
- presets exist


# flapShmup
A flappy bird shoot em up created with love2d.. LÖVE.. LÖVE2d.. the game framework formerly known as love2d?

![Enemy shot down](https://38.media.tumblr.com/2d332829959633d16fd896aea6bded4a/tumblr_no40yvl8891txpt1fo2_500.gif "shooting enemies")

![Particles](https://33.media.tumblr.com/98567dcf02758f071c6752060b95db76/tumblr_no40yvl8891txpt1fo1_r2_500.gif "particles")

I used the following two pages since this was my first time playing with love2d.
I probably should have read up on lua a bit more before starting the project.

[HeadChant's invader's must die page - other pages were not working at the
time](http://www.headchant.com/2010/11/27/love2d-tutorial-part-1-invaders-must-die/)

[NovaFusion's camera page](http://nova-fusion.com/2011/04/19/cameras-in-love2d-part-1-the-basics/)

[Amble font by Punchcut](http://www.fontsquirrel.com/fonts/amble)

[SFX created with bfxr](http://www.bfxr.net/)

[Images created with Aseprite](http://www.aseprite.org/)

[Images edited with GIMP](http://www.gimp.org/)


# Day 3
0. Ensure you tag your master branch as day02 before working on Day 3 tasks.
1. Configure your project to use an embedded database (HSQL) to store Customer data.  (update dependencies in the build file, create schema.sql). **Note:** All fields are mandatory.
2. Hard-code 2-3 sample records using data.sql.
3. Implement the domain and repository layers so they use JPA to access the embedded database.
4. Implement the service layer (the interface and implementation) to use all repository layer operations.
5. Implement the Customer data API with full CRUD capabilities using Spring Boot. Ensure you return the appropriate status code and also data where applicable.
6. Use the Gradle build process to build and run Customer data API
7. Use Postman to test service endpoints and verify CRUD capabilities of the service
8. Test the service endpoints using the front-end react client
9. Repeat task 1 through 8 to implement and test Event data API
10. Repeat task 1 through 8 to implement and test Registrations data API
11. Demonstrate the service and build process
12. Commit the completed API code and Gradle files to your local repository and also merge changes into the GitHub remote repository.


# Xamarin.Controls.TabView
Fully customizable Xamarin.Forms TabView

It is written using Xamarin.Forms without native code and it is fully compatible with all platforms Xamarin.Forms supports

The nuget package: https://www.nuget.org/packages/Xamarin.Controls.TabView

### Initialize:
Make sure to initialize the UI of the TabView inside your App.xaml file:

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>

                <tabview:TabViewStyle />

            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>

### Usage:

You can create tabs from markup or from ViewModel specifying ItemsSource and describing DataTemplate and header templates in xaml.
Note: ItemsSource has bigger priority than directly markup tab creation.

### Example of usage:

Here described two types of usage:
https://github.com/Alex-Dobrynin/Xamarin.Controls.TabView/blob/master/Sample.TabVIew/Sample.TabVIew/Views/MainPage.xaml

### Note:
You cannot use typeof Page as tab template.


## Getting Started
Run `tools/autodetect-config.sh` script to automate detection of
appropriate SDK binaries and configuration setup.

If `tools/autodetect-config.sh` fails, configuration has to be
done manually.
The first item to specify is the path to the appropriate SDK binaries e.g.
android, emulator, adb, etc.  Configuration is done using
[typesafe config](https://github.com/typesafehub/config),
which make it simple to define and use configuration.
Locate `$ROOT/src/application.conf.example`, copy
the example contents into `$ROOT/src/application.conf` (or anywhere else on
your build path), and modify the paths of `sdk.root` to reflect your sdk root.

### 5-minute local setup

Install Dependencies: Android SDK, sbt, SSH Server, ia32-libs (for adb), ia32-libs-sdl (for emulator), nodejs & npm (if you want web interface)

    $ git clone <URL>
    $ cd attack
    $ sbt assembly
    $ ./tools/autodetect-config.sh
    Note: The autodetect will only work if you have Android's tools and/or platform-tools
    directory in your PATH. If it fails to work, read src/application.conf.example
    $ sbt stage
    > run --help
    > run --local


# crackerhash

What is it?
===========
This is a script to automate password cracking using Hashcat.

Quick Start
------------
Grab the script, unpack it and define variables at the top of the script.

Requirements
------------
Hashcat
Password dictionary such rockyou or crackstation

Usage
-----
Open the script and define the variables that point to the wordlists, hashes, potfile, etc..

You will get the best results if you spend a little time up front creating a good targeted wordlist.
The targeted list consists of previous passwords and specialized words associated with the organization..
Consider using DigiNinja's 'cewl' to generate a wordlist: https://github.com/digininja/CeWl
     cewl -d 3 -u "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)" -w \
     targeted.txt -v hxxp://target-company.com
Also consider adding:
* Variations on the company name
* Current season and year e.g., Winter2019
* Company city
* Account names
* Users first names
* Creds from public data breaches
* Local sports teams

Run the script:     ./crackerhash.sh


package main.java.artificer.ui.elements;

/**
 * A special type of NumberField for displaying modifiers
 *
 * @author Joel Castel
 * @version June 2020
 *
 */
public class ModNumberField extends NumberField {
    @Override
    public int getNumericValue() throws NumberFormatException {
        try {
            int value = Integer.parseInt(getText());

            setNumericValue(value);

            return value;

        } catch (NumberFormatException ex) {
            throw new NumberFormatException();

        }
    }

    /**
     * Set the value of the field to a numeric mod value.
     * The +/- is applied based on the value
     *
     * @param value The mod value.
     */
    public void setNumericValue(int value) {
        String newText = "";
        if(value > 0 ) {
            newText += "+";
        }

        newText += Integer.toString(value);
        setText(newText);
    }
}


package spring.chapter_04SpringAOP.test;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import spring.chapter_04SpringAOP.service.Constant;
import spring.chapter_04SpringAOP.service.Performer;
import spring.chapter_04SpringAOP.service.Thinker;
import spring.util.XMLClassPath;

/**
 * 测试类
 *
 * @author Administrator
 *
 *         2016-6-14 上午09:54:54
 */
public class SpringAopMain {
	public static void main(String[] args) {
		ApplicationContext context = new ClassPathXmlApplicationContext(
				XMLClassPath.XML_CHAPTER_04_PATH);
		Performer juggler = (Performer) context.getBean("juggler");
		juggler.perform();

		// Constant constant=(Constant) juggler;
		// constant.receiveAward();

		System.out.println("****************************************");
		// Thinker thinker=(Thinker) context.getBean("thinkerImpl");
		// thinker.thinkOfSomething("I am the winner!");

	}
}


package cn.ecomb.common.provider.api.constant;

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

/**
 * @author zhouzg
 * @date 2019/8/5
 */
public enum SxApiUserConstant {

    SUI_XING(Arrays.asList("5e8ee649e92b")),
    KOU_BEI(Arrays.asList("77a42fbb415a")),
    XIAO_MI(Arrays.asList("1845de4cb75c")),
    OPPO(Arrays.asList("8d44efc20dc2","e994b41725dc")),
    VIVO(Arrays.asList("e7cf3bccc7fa")),
    SMART_PARKING(Arrays.asList("f37fd43a9f0d")),
    TEST_ELBS(Arrays.asList("af28a8e71a97")),
    MEIZU(Arrays.asList("f8a58c9f343e","dc1dd8c0868c")),
    HUAWEI_QUICK(Arrays.asList("3fd77527375a")),
    INVESTOR(Arrays.asList("01a9c38d1abd"))
    ;

    /**
     * 对接此系统应用appId
     */
    private List<String> appIds;

    private static final Map<String, SxApiUserConstant> appIdMap = new HashMap<>();

    SxApiUserConstant(List<String> appIds) {
        this.appIds = appIds;
    }

    public List<String> appIds() {
        return this.appIds;
    }

    public String appId() {
        return this.appIds.get(0);
    }
}


package com.derysudrajat.daftarbelanja;

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

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

public class MyViewHolder extends RecyclerView.ViewHolder {

    View myview;

    TextView mType;
    TextView mNote;
    TextView mDate;
    TextView mAmount;

    public MyViewHolder(@NonNull View itemView) {
        super(itemView);
        myview = itemView;
        mType = myview.findViewById(R.id.type);
        mNote = myview.findViewById(R.id.note);
        mDate = myview.findViewById(R.id.date);
        mAmount = myview.findViewById(R.id.amount);
    }

    public void setmType(String mType) {
        this.mType.setText(mType);
    }

    public void setmNote(String mNote) {
        this.mNote.setText(mNote);
    }

    public void setmDate(String mDate) {
        this.mDate.setText(mDate);
    }

    public void setmAmount(int mAmount) {
        this.mAmount.setText(String.valueOf(mAmount));
    }
}


---
title: Testing Repositories
menuTitle: Testing Repositories
description: Unlike traditional static method calls, repositories may be mocked. This provides a great advantage over traditional static methods and grants you the same testability you would have if you were using dependency injection. When testing, you may often want to mock a call to a Restify repository in one of your controllers. For example, consider the following controller action
category: Testing
position: 15
---

```php
class ExampleTest extends TestCase
{
    public function testBasicTest()
    {
        UserRepository::partialMock()
            ->shouldReceive('index')
            ->andReturn(['data' => [],]);

        $this->withHeader('Accept', 'application/json')
            ->get('/api/restify/users')
            ->assertJsonStructure([
                'response' => 'data',
            ])->assertOk();
    }
}
```

So you can use the `partialMock` to get the partial mock instance of the repository, and then perform actions or expectations over it.


package com.lili.net;

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

import com.lili.component.AbstractCommandComponent;
import com.lili.component.ComponentManager;
import com.lili.net.command.ICommand;

public class CommonMessageClientHandler implements IClientPacketHandler
{
    private static Logger LOGGER = LoggerFactory
            .getLogger(CommonMessageClientHandler.class);

    @Override
    public void process(IClientConnection conn, Object packet)
    {
        short code = ((CommonMessage) packet).getCode();
        // 从组件管理器中间调用
        AbstractCommandComponent<?> cm = (AbstractCommandComponent<?>) ComponentManager
                .getInstance().getComponent(AbstractCommandComponent.NAME);
        if (cm == null)
        {
            LOGGER.error("CommandModule not found");
            return;
        }

        ICommand cmd = cm.getCommand(code);
        if (cmd == null)
        {
            LOGGER.error(" Can not found code = " + code + ",drop this packet.");
            return;
        }

        try
        {
            cmd.execute(conn, (CommonMessage) packet);
        }
        catch (Exception e)
        {
            LOGGER.error("", e);
        }

    }
}


package com.csw.musicplatform.utils;

import android.content.Context;

import com.csw.musicplatform.R;
import com.google.gson.JsonParseException;
import com.google.gson.stream.MalformedJsonException;

import java.net.ConnectException;
import java.net.SocketTimeoutException;

import retrofit2.HttpException;

/**
 * Created by caisw on 2017/12/4.
 */

public class HintForException {
    private Context context;

    public HintForException(Context context) {
        this.context = context;
    }

    /**
     * 获取异常提示
     */
    public String findHint(Throwable e) {
        String msg = null;
        if (e instanceof SocketTimeoutException) {
            msg = context.getString(R.string.Hint_socket_time_out);
        } else if (e instanceof ConnectException||e instanceof HttpException) {
            msg = context.getString(R.string.Hint_network_connect_error);
        } else if (e instanceof MalformedJsonException || e instanceof JsonParseException) {
            msg = context.getString(R.string.Hint_data_parse_exception);
        } else {
            msg = e.getMessage();
        }
        return msg;
    }
}


Gradle Project Template
=======================

It consists of 3 projects:

## ear

* settings.gradle - Projects list.

* gradle.properties - Properties used on the gradle scripts.

* ear.gradle - ear file assembly information. You'll notice Spring dependencies added to the APP-INF/lib and ViewController and Model are transitive, which means that it does not add it's dependencies to its artifacts.

* sonar.gradle - Sonar server setup.

* build.gradle - Includes all previously mentioned gradle files.

## Model

Contains SampleServerConfig configuration class.

## ViewController

Has a basic Spring MVC setup with home.jsp View and SampleWebConfig configuration class.

## Other files

common.gradle contains some basic configuration that will be included on ViewController and Model build.gradle files.'jacoco.gradle' refers to JaCoCo code coverage tool and it's not necessary to be changed.

``
Note: The weblogic branch includes Oracle WebLogic configuration files.``


package ru.sapteh.models;
import lombok.*;

import javax.persistence.*;
import java.util.Date;
import java.util.Set;

@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table()
public class ClientService {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    @Column
    @NonNull
    private Date startTime;

    @Column
    @NonNull
    private String comment;

    @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
    @JoinColumn(name = "client_id")
    private Client client;

    @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
    @JoinColumn(name = "service_id")
    private Service service;

    @Override
    public String toString() {
        return "ClientService{" +
                "id=" + id +
                ", startTime=" + startTime +
                ", comment='" + comment + '\'' +
                ", client=" + client +
                ", service=" + service +
                '}';
    }
}


package me.spyobird.CraftableUncraftables;

import me.spyobird.CraftableUncraftables.recipes.CraftingRecipes;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;

@Mod(modid = "CraftableUncraftables", name = "Craftable Uncraftables", version = "v0.1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)

public class CraftableUncraftables
{
    public static final String modid = "CraftbleUncraftables";

    @Instance("CraftableUncraftables")
    public static CraftableUncraftables instance;

    @EventHandler
    public void load(FMLPreInitializationEvent event)
    {

    }

    @EventHandler
    public void load(FMLInitializationEvent event)
    {
        CraftingRecipes.init();
    }

    @EventHandler
    public static void load(FMLPostInitializationEvent event)
    {

    }
}


package com.huawei.cdsdemo.bean;

public class RegisterRequest
{

    private String requestType;

    private String callBackURL;

    private String registerServerType;

    public RegisterRequest(String registerServerType, String callBackUrl, int isRegister)
    {
        this.registerServerType = registerServerType;
        this.callBackURL = callBackUrl;
        this.requestType = String.valueOf(isRegister);
    }

    public String getRequestType()
    {
        return requestType;
    }

    public void setRequestType(String requestType)
    {
        this.requestType = requestType;
    }

    public String getCallBackURL()
    {
        return callBackURL;
    }

    public void setCallBackURL(String callBackURL)
    {
        this.callBackURL = callBackURL;
    }

    public String getRegisterServerType()
    {
        return registerServerType;
    }

    public void setRegisterServerType(String registerServerType)
    {
        this.registerServerType = registerServerType;
    }

}


package com.conexia.test.services;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.conexia.test.entities.Camarero;
import com.conexia.test.repositories.CamareroRepository;

@Service
public class CamareroServiceImpl implements CamareroServiceI {

	@Autowired
	CamareroRepository repository;

	public CamareroRepository getRepository() {
		return repository;
	}

	public void setRepository(CamareroRepository repository) {
		this.repository = repository;
	}

	@Override
	public Camarero saveCamarero(Camarero camarero) {
		return repository.save(camarero);
	}

	@Override
	public Camarero updateCamarero(Camarero camarero) {
		return repository.save(camarero);
	}

	@Override
	public void deleteCamarero(Camarero camarero) {
		repository.delete(camarero);
	}

	@Override
	public Camarero getCamareroById(Long id) {
		return repository.findOne(id);
	}

	@Override
	public List<Camarero> getAllCamareros() {
		return repository.findAll();
	}

}


package com.lvxiao.mysql.sharding;

import lombok.SneakyThrows;
import org.apache.shardingsphere.shardingjdbc.api.yaml.YamlShardingDataSourceFactory;

import javax.sql.DataSource;
import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 * @author lvxiao
 * @date 2020/4/23
 */
public class TestShading {

    @SneakyThrows
    public static void main(String[] args) {
        String filePath = TestShading.class.getResource("/sharding.yaml").getFile();
        DataSource dataSource = YamlShardingDataSourceFactory.createDataSource(new File(filePath));
        String sql = "SELECT i.* FROM t_order o JOIN t_order_item i ON o.order_id=i.order_id WHERE o.user_id=? AND o.order_id=?";
        String test = "INSERT INTO t_order VALUES(?, ?, 'init');";
        try (
                Connection conn = dataSource.getConnection();
                PreparedStatement preparedStatement = conn.prepareStatement(test)) {
            preparedStatement.setInt(1, 1101);
            preparedStatement.setInt(2, 11);
            preparedStatement.executeUpdate();
        }
    }
}


package udacityproject5.learnmaterialdesign;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by root on 10/19/16.
 */

public class RecyclerAnimActivity extends AppCompatActivity
{
    @BindView(R.id.recyclerview) RecyclerView rv;
    Context mcontext;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.anim_recyclerview_layout);
        ButterKnife.bind(this);
        rv.setLayoutManager(new LinearLayoutManager(this));
        rv.setAdapter(new RecyclerAnimAdapter(this));
        mcontext = this;
    }

    @OnClick(R.id.fab)  void fabClick(View view)
    {
       // Bundle bundle = ActivityOptions.makeSceneTransitionAnimation(this).toBundle();
        Intent animIntent = new Intent(mcontext, AnimTransitionActivity.class);
        mcontext.startActivity(animIntent);
    }

}


[Go back to the main page](https://github.com/world-class/REPL)

# Table of contents
<!-- vim-markdown-toc GFM -->

* [Web Development - Reported problems](#web-development---reported-problems)
    * [Week 6](#week-6)
        * [Lecture: 3.3.10 HTML media tags](#lecture-3.3.10-html-media-tags)
        * [Practice Quiz: 3.3.11 Review information](#practice-quiz-3.3.11-review-information)

<!-- vim-markdown-toc -->

# Web Development - Reported problems
This page is about the [Web Development module](../../../modules/level_4/web_development/).

## Week 6
### Lecture: 3.3.10 HTML media tags
- Video: The video appears with all sorts of white dots all over. It looks
    like the professor is in a snowball.

### Practice Quiz: 3.3.11 Review information
- The `width` attribute is _not_ a global attribute.
- The `png` file extension _is_ from image files.
- The `jog` file extension should not be selected because it doesn't really
    exist. Unless it's a typo for `jpg` or `jpeg`.
- The `bmp` file extension _is_ from image files.


package com.zty.marketing.entity;

public class Msg {
    private String message;//中文信息
    private Object data;//实体
    private Object statistics;

    public Msg(){
        super();
    }

    public Msg(String message, Object data, Object statistics) {
        this.message = message;
        this.data = data;
        this.statistics = statistics;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Object getStatistics() {
        return statistics;
    }

    public void setStatistics(Object statistics) {
        this.statistics = statistics;
    }

    @Override
    public String toString() {
        return "Msg{" +
                "message='" + message + '\'' +
                ", data=" + data +
                ", statistics=" + statistics +
                '}';
    }
}


package uk.ac.ebi.quickgo.index.annotation;

/**
 * A class for creating stubbed annotations, representing rows of data read from
 * annotation source files.
 *
 * Created 22/04/16
 * @author Edd
 */
public class AnnotationMocker {
    public static Annotation createValidAnnotation() {
        Annotation annotation = new Annotation();

        annotation.db = "IntAct";
        annotation.dbObjectId = "EBI-10043081";
        annotation.dbReferences = "PMID:12871976";
        annotation.qualifier = "enables";
        annotation.goId = "GO:0000977";
        annotation.interactingTaxonId = "taxon:12345";
        annotation.evidenceCode = "ECO:0000353";
        annotation.with = "GO:0036376,GO:1990573";
        annotation.assignedBy = "IntAct";
        annotation.annotationExtension = "occurs_in(CL:1000428)";
        annotation.annotationProperties =
                "go_evidence=IEA|taxon_id=35758|db_subset=TrEMBL|db_object_symbol=moeA5|db_object_type=protein" +
                        "|target_set=BHF-UCL,Exosome,KRUK|taxon_lineage=1,2,3,4|gp_related_go_ids=GO:1,GO:02|row_num=1";
        return annotation;
    }
}


package by.bsuir.pokerface.entity.card;

import java.util.List;

public class Deck {
    private List<Card> cards;

    public Deck() {
        cards = CardStorage.getCards();
    }

    public List<Card> getCards() {
        return cards;
    }

    public void setCards(List<Card> cards) {
        this.cards = cards;
    }

    public Card takeTopCard() {
        return cards.remove(cards.size() - 1);
    }

    @Override
    public boolean equals(Object o) {

        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Deck deck = (Deck) o;

        return cards != null ? cards.equals(deck.cards) : deck.cards == null;
    }

    @Override
    public int hashCode() {
        return cards != null ? cards.hashCode() : 0;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Deck{");
        sb.append("cards=").append(cards);
        sb.append('}');
        return sb.toString();
    }
}


# Spring Boot REST API Example Project with MySQL
## Running Project
Project is a [Spring Boot](https://spring.io/guides/gs/spring-boot) application built using [Maven](https://spring.io/guides/gs/maven/). You can build a jar file and run it from the command line:
```
git clone https://github.com/tepeumut/spring-rest-example.git
cd spring-rest-example
./mvnw package
java -jar target/*.jar
```
Or you can run it from Maven directly using the Spring Boot Maven plugin. If you do this it will pick up changes that you make in the project immediately (changes to Java source files require a compile as well - most people use an IDE for this):
```
./mvnw spring-boot:run
```
## Database Configuration
It uses a MySQL database (for now), can be changed easily in the ``application.properties`` for any other database.
For MySQL:
```
spring.datasource.url=jdbc:mysql://USER:PASSWORD@localhost:3306/DATABASE?characterEncoding=UTF-8
```
Change ``USER``,``PASSWORD`` and ``DATABASE`` as per your MySQL installation.

You can then access the project here: http://localhost:8080/users

You can find to Swagger docs here: http://localhost:8080/swagger-ui.html


package com.ganada.silsiganmetro.activity;

import android.app.Activity;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageButton;
import android.widget.LinearLayout;

import com.ganada.silsiganmetro.R;

public class OpenSourceActivity extends Activity {

    WebView web;
    ImageButton btnBack;

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

        LinearLayout layout_status = (LinearLayout) findViewById(R.id.layout_status);
        btnBack = (ImageButton) findViewById(R.id.btnBack);

        if(Build.VERSION.SDK_INT < 19) {
            layout_status.setVisibility(View.GONE);
        }
        layout_status.setBackgroundColor(Color.parseColor("#91be2e"));

        web = (WebView) findViewById(R.id.web);
        web.loadUrl("file:///android_asset/opensource.html");

        btnBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }
}


package serviceLayer;

import dataAccessLayer.Bug;
import dataAccessLayer.DBQuery;
import dataAccessLayer.DBUpdate;

public class bugOperations {

    private Bug bug = new Bug();
    private DBUpdate dbu = new DBUpdate();
    private DBQuery dbq = new DBQuery();

    public void addBug(String empId, String prodId, String bugName, String description, String tag, String screenshot) {
        bug.setName(dbu.convertSQLString(bugName));
        bug.setDescription(dbu.convertSQLString(description));
        bug.setTag(dbu.convertSQLString(tag));
        bug.setScreenshot(dbu.convertSQLString(screenshot));
        bug.setEmployeeId(empId);
        bug.setProductId(prodId);

        bug.create();
    }

    public void deleteBug(String id){
        bug.setId(id);
        bug.delete();
    }

    public void printBugs(){
        bug.read();
    }

    public String getLastInsert(){
        String str = dbq.doQuery("SELECT LAST_INSERT_ID() FROM bug");
        String[] id = str.split(" ");
        return id[0];
    }
}


package dk.opendesk.foundationapplication.webscripts.foundation;

import dk.opendesk.foundationapplication.webscripts.JacksonBackedWebscript;
import org.alfresco.service.cmr.repository.NodeRef;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse;

public class PostStartGroupsAndUsers extends JacksonBackedWebscript {
    @Override
    protected Object doAction(WebScriptRequest req, WebScriptResponse res) throws Exception {

        JSONObject jsonRequest = getRequestAs(JSONObject.class);

        JSONObject roles = jsonRequest.getJSONObject("groups");
        JSONArray users = jsonRequest.getJSONArray("users");

        NodeRef emailTemplate = getActionBean().getEmailTemplate("ekstern-bruger-osflow.html.ftl");

        getAuthorityBean().loadUsers(roles,users,"Velkommen til OSflow-Danva", emailTemplate);

        return new JSONObject().put("status", "OK");

    }
}


package com.treasure_ct.android_xt.studyfragment.corecontrols.viewpager.tabhost;

import android.app.TabActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.TabHost;
import android.widget.Toast;

import com.treasure_ct.android_xt.R;

public class TabHostActivity extends TabActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TabHost host = getTabHost();
        LayoutInflater.from(this).inflate(R.layout.activity_corecontrols_tabhost,host.getTabContentView(),true);
        host.addTab(host.newTabSpec("one").setIndicator("tab1").setContent(R.id.tab1));
        host.addTab(host.newTabSpec("two").setIndicator("tab2").setContent(R.id.tab1));
        host.addTab(host.newTabSpec("three").setIndicator("tab3").setContent(R.id.tab1));
        host.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
            @Override
            public void onTabChanged(String tabId) {
                Toast.makeText(TabHostActivity.this, tabId, Toast.LENGTH_SHORT).show();
            }
        });
    }
}


package repository;

import io.ebean.Ebean;
import io.ebean.EbeanServer;
import io.ebean.Expr;
import models.User;
import play.db.ebean.EbeanConfig;
import play.db.ebean.EbeanDynamicEvolutions;

import javax.inject.Inject;
import javax.inject.Named;

@Named
public class UserRepository {

    private final EbeanServer ebeanServer;
    private final DatabaseExecutionContext databaseExecutionContext;
    private final EbeanDynamicEvolutions ebeanDynamicEvolutions;

    @Inject
    public UserRepository(EbeanConfig ec, DatabaseExecutionContext dec, EbeanDynamicEvolutions ede) {
        ebeanServer = Ebean.getServer(ec.defaultServer());
        databaseExecutionContext = dec;
        ebeanDynamicEvolutions = ede;
    }

    public User create(User user) {
        ebeanServer.insert(user);
        return user;
    }

    public User getUserByEmail(String email) {
        User user = ebeanServer.createQuery(User.class).where().add(Expr.eq("email", email)).findUnique();
        return user;
    }
}


package com.netcrackerg4.marketplace.controller;

import com.netcrackerg4.marketplace.model.dto.password.PasswordUpdateDto;
import com.netcrackerg4.marketplace.model.response.UserInfoResponse;
import com.netcrackerg4.marketplace.service.interfaces.IUserService;
import lombok.AllArgsConstructor;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/auth-store")
@AllArgsConstructor
public class AuthStoreController {
    private final IUserService userService;

    @GetMapping("/me")
    public UserInfoResponse getMyProfile(Authentication auth) {
        String email = auth.getName();
        return this.userService.getProfileByEmail(email);
    }

    // change password without email confirmation
    @PatchMapping("/change-password")
    void changePassword(@RequestBody PasswordUpdateDto passwordData, Authentication auth) {
        String email = auth.getName();
        userService.changePassword(email, passwordData);
    }
}


# swank-client
[![Build Status](https://travis-ci.org/neil-lindquist/swank-client.svg?branch=master)](https://travis-ci.org/neil-lindquist/swank-client)

This is an implementation of a Swank client in Javascript, intended for communicating with running Common Lisp processes running a swank server, just like SLIME in Emacs.
Swank-client forms a core part of the [SLIMA](https://atom.io/packages/SLIMA) package for the Atom text editor.
This package was forked from [Steve Levine's swank-client-js](https://github.com/sjlevine/swank-client-js) due to maintenance issues.

If you are interested in using this library, please let me know.
Currently, the only user is the [SLIMA](https://atom.io/packages/SLIMA) package for Atom, so the documentation is pretty minimal.

This library provides an editor/view-independent API for making the following queries to a Swank server:

- Evaluating arbitrary Lisp expressions and files
- Retrieving auto documentation
- Controlling a debugger
- Autocompletion requests
- Object inspection requests
- Profiling functions
- Accessing compiler notes
- Macroexpansion requests

See `test.js` for an example use case.


package com.korkkosebastian.cwpclient.model;

import android.media.AudioManager;
import android.media.ToneGenerator;
import java.util.Observable;
import java.util.Observer;

public class Signaller implements Observer {

    private CWPMessaging cwpMessaging;
    private ToneGenerator toneGenerator;

    public Signaller() {
        toneGenerator = new ToneGenerator(AudioManager.STREAM_DTMF, 50);
    }

    @Override
    public void update(Observable o, Object arg) {
        if(cwpMessaging.lineIsUp()) {
            toneGenerator.startTone(ToneGenerator.TONE_DTMF_A, 5000);
        } else {
            toneGenerator.stopTone();
        }
    }

    public void setCwpMessaging(CWPMessaging cwpMessaging) {
        if(cwpMessaging != null) {
            this.cwpMessaging = cwpMessaging;
            this.cwpMessaging.addObserver(this);
        }
    }

    public void setCwpMessagingNullAndSilence() {
        toneGenerator.stopTone();
        this.cwpMessaging.deleteObserver(this);
        this.cwpMessaging = null;
    }
}


package kr.co.project.board.dao;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import kr.co.project.board.dto.BoardDto;

@Repository
public class BoardDaoImpl implements BoardDao {

	@Autowired
	private SqlSession session;

	private static final String namespace = "kr.co.project.board.";

	@Override
	public BoardDto selectOne(BoardDto dto){
		return session.selectOne(namespace + "selectOne", dto);
	}

	@Override
	public List<BoardDto> selectAll(){
		return session.selectList(namespace + "selectAll");
	}

	@Override
	public void insertBoard(BoardDto dto){
		session.insert(namespace + "insertBoard", dto);

	}

	@Override
	public void updateBoard(BoardDto dto){
		session.update(namespace + "updateBoard", dto);
	}

	@Override
	public void deleteBoard(BoardDto dto) {
		session.delete(namespace, dto);

	}

	@Override
	public int totalCount() {
		return session.selectOne(namespace + "totalCount");
	}

}


package com.shankulk.model;

import com.fasterxml.jackson.annotation.JsonValue;
import java.util.UUID;

public class Objective {
	private final UUID id;
	private final String metricName;
	private final ObjectiveComparator comparator;
	private final Double metricValve;
	private final String objectiveName;

	private Objective(String metricName, ObjectiveComparator comparator, Double metricValue,
		String objectiveName) {
		this.id = UUID.randomUUID();
		this.metricName = metricName;
		this.comparator = comparator;
		this.metricValve = metricValue;
		this.objectiveName = objectiveName;
	}

	public UUID getId() {
		return id;
	}

	public String getMetricName() {
		return metricName;
	}

	@JsonValue
	public ObjectiveComparator getComparator() {
		return comparator;
	}

	public Double getMetricValve() {
		return metricValve;
	}

	public static Objective createObjective(String objectiveName, String metricName, ObjectiveComparator comparator, Double metricValue) {
		return new Objective(metricName, comparator, metricValue, objectiveName);
	}

}


package no.finn.unleash.metric;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.HashMap;
import java.util.Map;

class MetricsBucket {
    private final Map<String, ToggleCount> toggles;
    private final LocalDateTime start;
    private LocalDateTime stop;

    MetricsBucket() {
        this.start = LocalDateTime.now(ZoneId.of("UTC"));
        this.toggles = new HashMap<>();
    }

    void registerCount(String toggleName, boolean active) {
        getOrCreate(toggleName).register(active);
    }

    void registerCount(String toggleName, String variantName) {
        getOrCreate(toggleName).register(variantName);
    }

    private ToggleCount getOrCreate(String toggleName) {
        if(!toggles.containsKey(toggleName)) {
            ToggleCount counter = new ToggleCount();
            toggles.put(toggleName, counter);
        }
        return toggles.get(toggleName);
    }

    void end() {
        this.stop = LocalDateTime.now(ZoneId.of("UTC"));
    }

    public Map<String, ToggleCount> getToggles() {
        return toggles;
    }

    public LocalDateTime getStart() {
        return start;
    }

    public LocalDateTime getStop() {
        return stop;
    }
}


---
description: >-
  The Concepts section helps you learn about the parts of the Kubernetes system
  and the abstractions Kubernetes uses to represent your cluster , and helps you
  obtain a deeper understanding of how Kubern
---

# Concepts

### Overview

### Kubernetes objects

### Kubernetes Control Plane

> kubernetes control plane consist of the following **components** on controller nodes:
>
> 1. kube-**apiserver**: **allow** user/srv/etc **ineract** with the cluster
> 2. **etcd**: clustes datastore, **keep** multples controllers in **sync**
> 3. kube-**scheduler**: **dealing** into the cluster to apply desired **state**
> 4. **kube-controller-manager**: **runs** a series of controllers that provide a wide range of **cluster functionality**.
> 5. **cloud-controller-manager**: **handles** interaction with underlying **cloud providers**.
>
> This **set of services** is the magic on k8s ecosystem with worker nodes and control nodes

#### Kubernetes Master

#### Kubernetes Nodes


package com.arcvideo.pgcliveplatformserver.model;

import java.util.List;

/**
 * Created by slw on 2018/8/3.
 */

public class PageBean<T> {
    long total;
    int pageNum;
    int pageSize;
    List<T> list;

    public PageBean(long total, int pageNum, int pageSize, List<T> list) {
        this.total = total;
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.list = list;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}


package jms.dan.usuarios.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import springfox.documentation.swagger.web.InMemorySwaggerResourcesProvider;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

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

@Configuration
public class SwaggerConfig {
    @Primary
    @Bean
    public SwaggerResourcesProvider swaggerResourcesProvider(InMemorySwaggerResourcesProvider defaultResourcesProvider) {
        return () -> {
            SwaggerResource wsResource = new SwaggerResource();
            wsResource.setName("1.0.0");
            wsResource.setSwaggerVersion("2.0");
            wsResource.setLocation("/swagger.yaml");

            List<SwaggerResource> resources = new ArrayList<>();
            resources.add(wsResource);
            return resources;
        };
    }
}


package com.stackroute.springBoot.domain;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Track {
    @Id
    private int id;
    private String name;
    private String comment;

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

    public Track() {
    }

    public Track(int id, String name, String comment) {
        this.id = id;
        this.name = name;
        this.comment = comment;
    }

    public int getId() {
        return id;
    }

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

    public String getName() {
        return name;
    }

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

    public String getComment() {
        return comment;
    }

    public Track setComment(String comment) {
        this.comment = comment;
        return this;
    }
}