package pages;

import io.appium.java_client.MobileElement;
import io.appium.java_client.pagefactory.AndroidFindBy;
import io.appium.java_client.pagefactory.AppiumFieldDecorator;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import utils.Page;

public class ExpensePage extends Page {

    @AndroidFindBy(id = idPrefix + "buttonKeyboard5")
    private MobileElement btnKeyboard5;

    @AndroidFindBy(id = idPrefix + "keyboard_action_button")
    private MobileElement categoryBtn;

    public ExpensePage() {
        PageFactory.initElements(new AppiumFieldDecorator(driver), this);
        wait = new WebDriverWait(driver, 30);
    }

    public ExpensePage enterExpenses(){
        wait.until(ExpectedConditions.visibilityOf(btnKeyboard5));
        btnKeyboard5.click();
        return this;
    }

    public CategoryPage clickCategoryBtn(){
        categoryBtn.click();
        return new CategoryPage();
    }

}


package com.dayal.xmpptest2.models;

import android.media.Image;
import android.widget.ImageView;

import java.io.File;

/**
 * Created by Manjeet Dayal on 12-07-2018.
 */

public class ChatMessage {

    private  String message;
    private Contact sender;
    private long timestamp;
    private String MesssageType;

    public ChatMessage() {
    }

    public ChatMessage(String message, Contact sender, long timestamp) {
        this.message = message;
        this.sender = sender;
        this.timestamp = timestamp;

    }

    public String getMesssageType() {
        return MesssageType;
    }

    public void setMesssageType(String messsageType) {
        MesssageType = messsageType;
    }

    public String getMessage() {
        return message;
    }

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

    public Contact getSender() {
        return sender;
    }

    public void setSender(Contact sender) {
        this.sender = sender;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }
}


---
layout: advisory
title: 'OSVDB-129854 (mapbox-rails): mapbox-rails Content Injection via TileJSON attribute'
comments: false
categories:
- mapbox-rails
advisory:
  gem: mapbox-rails
  osvdb: 129854
  url: https://nodesecurity.io/advisories/49
  title: mapbox-rails Content Injection via TileJSON attribute
  date: 2015-10-24
  description: |
    Mapbox.js versions 1.x prior to 1.6.5 and 2.x prior to 2.1.7 are vulnerable
    to a cross-site-scripting attack in certain uncommon usage scenarios.

    If you use L.mapbox.map or L.mapbox.tileLayer to load untrusted TileJSON
    content from a non-Mapbox URL, it is possible for a malicious user with
    control over the TileJSON content to inject script content into the
    "attribution" value of the TileJSON which will be executed in the context of
    the page using Mapbox.js.

    Such usage is uncommon. The following usage scenarios are not vulnerable:

    * only trusted TileJSON content is loaded
    * TileJSON content comes only from mapbox.com URLs
    * a Mapbox map ID is supplied, rather than a TileJSON URL
  patched_versions:
  - "~> 1.6.5"
  - ">= 2.1.7"
---


package com.cursoudemy.minitwitter;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class SignUpActivity extends AppCompatActivity implements View.OnClickListener {

    TextView tvLogin;
    Button btnSignUp;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_up);

        getSupportActionBar().hide();

        tvLogin = findViewById(R.id.textViewLogin);
        btnSignUp = findViewById(R.id.buttonSignUp);

        tvLogin.setOnClickListener(this);
        btnSignUp.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.textViewLogin:
                goToLogin();
                break;
            case R.id.buttonSignUp:
                break;
        }
    }

    private void goToLogin() {
        Intent intent = new Intent(SignUpActivity.this, MainActivity.class);
        startActivity(intent);
        finish();
    }
}


package com.solu.daewha.bluetoothclient;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;

/**
 * Created by zino on 2017-11-08.
 */

public class MsgFragment extends Fragment implements View.OnClickListener{
    ControlActivity controlActivity;
    DataThread dataThread;
    EditText edit_input;
    Button bt_send;

    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.fragment_msg,null);

        edit_input = (EditText)view.findViewById(R.id.edit_input);
        bt_send=(Button)view.findViewById(R.id.bt_send);
        bt_send.setOnClickListener(this);

        controlActivity = (ControlActivity) getActivity();
        dataThread = controlActivity.dataThread;

        return view;
    }

    @Override
    public void onClick(View view) {
        String msg=edit_input.getText().toString();
        dataThread.send("msg:"+msg+"\n");
        edit_input.setText("");
    }

}


package burgos.com.rodrigram;

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

import burgos.com.rodrigram.view.ContainerActivity;
import burgos.com.rodrigram.view.CreateAccountActivity;

public class LoginActivity extends AppCompatActivity
{

    private Intent intent;
    private Intent intentContainer;
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
    }

    public void goCreateAccount(View view)
    {
        intent = new Intent(getApplicationContext(), CreateAccountActivity.class);
        startActivity(intent);
    }
    public void goContainer(View view)
    {
        intentContainer = new Intent(getApplicationContext(), ContainerActivity.class);
        startActivity(intentContainer);
    }
    public void goPlatziGram(View view)
    {
        intentContainer = new Intent(getApplicationContext(), ContainerActivity.class);
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.platzi.com")));
    }
}


package com.hendisantika.springaop.model;

/**
 * Created by IntelliJ IDEA.
 * Project : SpringAOP-AspectJ
 * User: hendisantika
 * Email: hendisantika@gmail.com
 * Telegram : @hendisantika34
 * Date: 09/01/18
 * Time: 21.56
 * To change this template use File | Settings | File Templates.
 */

public class Customer {
    private long id;
    private String firstName;
    private String lastName;

    public Customer() {
    }

    public Customer(long id, String firstName, String lastName) {
        this.id = id;
        this.firstName = firstName;
        this.lastName = lastName;
    }

    public long getId() {
        return id;
    }

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

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    @Override
    public String toString() {
        return String.format("Customer[id=%d, firstName='%s', lastName='%s']", id, firstName, lastName);
    }
}


package org.ncpsb.phoenixcluster.enhancer.webservice.service;

import org.ncpsb.phoenixcluster.enhancer.webservice.dao.mysql.StatisticsDaoMysqlImpl;
import org.ncpsb.phoenixcluster.enhancer.webservice.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by baimi on 2017/10/11.
 */

@Service
public class StatisticsService {

    @Autowired
    private StatisticsDaoMysqlImpl statisticsDao;

    public Integer findTotalSpectrumInCluster(String clusterID) {
        return statisticsDao.findTotalSpectrumInCluster(clusterID);
    }

    public VennData findVennDataByProjectId(String projectId) {
        return statisticsDao.findVennDataByProjectId(projectId);
    }

    public Thresholds findThresholdsByProjectId(String projectId) {
        return statisticsDao.findThresholdsByProjectId(projectId);
    }

    public List<String> findProjects() {
        return statisticsDao.findProjects();
    }

    public List<VennData> getVennDataList() {
        return statisticsDao.getVennDataList();
    }
}


VNC Monitor
-----------

# Preparing the host-machine

## Ensuring a VIRTUAL device is present.

Note this section concerns the [xorg.conf](https://xkcd.com/963/) file.

Check whether a `VIRTUAL` framebuffer device is already found, using:

    xrandr -q

The expected output if a virtual device is present is:

    VIRTUAL1 disconnected (normal left inverted right x axis y axis)
    VIRTUAL2 disconnected (normal left inverted right x axis y axis)
    ...

If this is not the case, a virtual device can be spawned using the `xorg.conf`
file, found within `usr/share/X11/xorg.conf.d/20-intel.conf`. This can simply
be copied to the equivalent system folder:

    cp usr/share/X11/xorg.conf.d/20-intel.conf /usr/share/X11/xorg.conf.d/20-intel.conf

After which the Xorg server should be restarted

    sudo killall Xorg

## Install VNC server

Install the VNC server package:

    sudo apt-get install tightvncserver x11vnc

# Preparing the slave machine

## Setting output mode

The output mode of the *pi should fix the `VIRTUAL1` resolution.
This can be set using the `raspi-config` tool on raspberry pi, and using
similar tools on other hardware.

# Pairing

Run the `setup.sh` script with appropriate parameters.


package com.example.qsd.edictionary.adapter;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;
import java.util.Objects;

/**
 * Created by QSD on 2016/11/22.
 */

public class MypageAdapter extends PagerAdapter {
    private Context context;
    private List<View> mlist;
    public MypageAdapter(Context context,List<View> mlist){
        this.context=context;
        this.mlist=mlist;

    }
    @Override
    public int getCount() {
        return mlist.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return  view==object;
    }
    @Override
    public Object instantiateItem(ViewGroup container,int position){
        View view=mlist.get(position);
        container.addView(view);
        return view;
    }
    @Override
    public void destroyItem(ViewGroup container,int position,Object object){
        container.removeView((View)object);
    }

}


package gsis.com.site.datainfo.jgBtitle.web;
import gsis.com.cms.datainfo.jgBtitle.service.JgB01TitleService;
import gsis.com.cms.datainfo.jgBtitle.vo.JewB01TiileDataVO;
import infomind.com.cmm.web.BaseAjaxController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
public class SiteJgB01TitleController extends BaseAjaxController {

    @Resource(name="JgB01TitleService")
    private JgB01TitleService jgB01TitleService;

    /**
     * 리스트
     * @param searchVO
     * @return
     * @throws Exception
     */
    @RequestMapping(value="/site/gsis/b01/List.do")
    public ModelAndView List(@RequestBody JewB01TiileDataVO searchVO) throws Exception{
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("jsonView");
        modelAndView.addObject("list",jgB01TitleService.selectList(searchVO));

        return modelAndView;
    }

}


/Mobile App Source Code/app/src/main/java/ug/co/sampletracker/app/components/account/ViewAccountInteractorImpl.java

package ug.co.sampletracker.app.components.account;

import ug.co.sampletracker.app.connections.dataloaders.DTBalanceInquiry;
import ug.co.sampletracker.app.database.DbHandler;
import ug.co.sampletracker.app.models.Balance;
import ug.co.sampletracker.app.models.requests.BalanceRequest;

/**
 * Created by Timothy Kasaga for Leontymo Developers on 5/7/2018.
 */

public class ViewAccountInteractorImpl implements ViewAccountInteractor {

    @Override
    public void loadCreditBalancesFromServer(DbHandler dbHandler, BalanceRequest request,
                                             DTBalanceInquiry.ServerResponseBalanceInquiryListener listener) {

        DTBalanceInquiry dataLoader = new DTBalanceInquiry();
        dataLoader.setResponseListener(listener);
        dataLoader.balanceInquiry(request);

    }

    @Override
    public Balance loadCreditBalancesFromServer(DbHandler dbHandler) {
        return dbHandler.creditBalances();
    }

    @Override
    public void saveCreditBalance(DbHandler dbHandler, Balance balance) {
        dbHandler.saveCreditBalance(balance);
    }

}


/*
 * 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 javaapplication2;

import java.util.Scanner;
/**
     * @param args the command line arguments
     */
/**
 *
 * @author SIMRANDEEP SINGH
 */
public class JavaApplication2 {
    public static void main(String args[])

    {
        card[] deck= new card[4];
        Scanner in =new Scanner (System.in);
        System.out.println("enter 4 cards:");
        for(int i=0;i<deck.length;i++)

    {
       // card S1=new card;
        //deck[i]=S1;
        deck [i]=new card(in.next(),in.nextInt());

    }
        System.out.println("enter 4 cards:");
        for(int i=0;i<deck.length;i++)
        {
            System.out.print(deck[i].getSuit()+" "+deck[i].getValue());
        }
}
} /**
     * @param args the command line arguments
     */


package com.sunzequn.sunmysql.bean;

/**
 * Created by Sloriac on 15/11/18.
 *
 * The wrapper class for a property of a entity (a column of a table).
 */
public class Property {

    /**
     * The name of a property.
     */
    private String property;
    /**
     * The name of the column corresponding to the property above.
     */
    private String column;
    /**
     * The value of the property.
     */
    private Object value;

    public Property() {
    }

    public Property(String property, String column, Object value) {
        this.property = property;
        this.column = column;
        this.value = value;
    }

    public String getProperty() {
        return property;
    }

    public void setProperty(String property) {
        this.property = property;
    }

    public String getColumn() {
        return column;
    }

    public void setColumn(String column) {
        this.column = column;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }
}


package selenium.test.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import selenium.test.RtnCode;
import selenium.test.exception.SysException;
import selenium.test.vo.Response;

import javax.servlet.http.HttpServletRequest;

/**
 * 系統若拋出Exception 都會經過此
 * Created on 2018-12-19
 *
 * @author dean
 * @email loveangelo0217@gmail.com
 * @since 1.0
 */
@RestController
@ControllerAdvice
//@ControllerAdvice(basePackages ="com.demo.basic")
public class ExceptionController {

    @ExceptionHandler(value = Exception.class)
    public Response exCenter(HttpServletRequest req, Exception ex) {
        if(ex instanceof SysException){
            SysException sex = (SysException) ex;
            return new Response(sex.getCode(), sex.getMsg());
        }else {
            ex.printStackTrace();
            return new Response(RtnCode.SYSTEM_ERROR, "系統錯誤 : " + ex.getMessage());
        }
    }
}


package uk.co.daveshepherd.maven.plugin.jboss.deployer.jsch.model;

import java.util.ArrayList;
import java.util.Collection;

import com.jcraft.jsch.ChannelSftp.LsEntry;
import com.jcraft.jsch.ChannelSftp.LsEntrySelector;

public class DeployableFileSelector implements LsEntrySelector {
    private final Collection<LsEntry> matchingEntries = new ArrayList<LsEntry>();
    private final String prefix;
    private final DeployableType type;

    public DeployableFileSelector(final String prefix, final DeployableType type) {
        this.prefix = prefix;
        this.type = type;
    }

    public int select(final LsEntry entry) {
        final String filename = entry.getFilename();
        if (doesFilenameMatch(filename)) {
            matchingEntries.add(entry);
        }
        return CONTINUE;
    }

    protected boolean doesFilenameMatch(final String filename) {
        if (filename == null) {
            return false;
        }
        return filename.endsWith(type.getFileSuffix()) && filename.startsWith(prefix);
    }

    public Collection<LsEntry> getMatchingEntries() {
        return matchingEntries;
    }
}


package com.gisinfo.sand.util.docx.model;

/**
 * Created by majun on 2018/3/14.
 */
public class TableMergeBean {

    public TableMergeBean() {

    }

    public TableMergeBean(int startRow, int startCell, int endRow, int endCell) {
        this.startRow = startRow;
        this.startCell = startCell;
        this.endRow = endRow;
        this.endCell = endCell;
    }

    private int startRow;
    private int startCell;
    private int endRow;
    private int endCell;

    public int getStartRow() {
        return startRow;
    }

    public TableMergeBean setStartRow(int startRow) {
        this.startRow = startRow;
        return this;
    }

    public int getStartCell() {
        return startCell;
    }

    public TableMergeBean setStartCell(int startCell) {
        this.startCell = startCell;
        return this;
    }

    public int getEndRow() {
        return endRow;
    }

    public TableMergeBean setEndRow(int endRow) {
        this.endRow = endRow;
        return this;
    }

    public int getEndCell() {
        return endCell;
    }

    public TableMergeBean setEndCell(int endCell) {
        this.endCell = endCell;
        return this;
    }
}


package adapter;

import android.content.Context;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import com.cenfotec.ponto.utils.CarouselImage;
import com.cenfotec.ponto.utils.CarouselVideo;

import java.util.List;

public class Carousel_Adapter extends FragmentStatePagerAdapter {

    private Context context;
    private List<String> carouselFiles;

    public Carousel_Adapter(FragmentManager fm, List<String> carouselFiles) {
        super(fm);
        this.carouselFiles = carouselFiles;
    }

    @Override
    public Fragment getItem(int position) {
        if (carouselFiles.get(position).contains("/videos%")) {
            return new CarouselVideo(carouselFiles.get(position));
        } else  {
            if (carouselFiles.get(position).contains("/icons%")) {
                return new CarouselImage(carouselFiles.get(position), true);
            } else {
                return new CarouselImage(carouselFiles.get(position));
            }
        }
    }

    @Override
    public int getCount() {
        return carouselFiles.size();
    }
}


package com.example.dadata.API;

import com.example.dadata.config.AppProperties;
import com.example.dadata.domain.Dadata;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

@Component
public class DadataApi {

    @Autowired
    private AppProperties appProperties;

    public Dadata DadataClient(String location) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_JSON);
        headers.set(HttpHeaders.AUTHORIZATION, appProperties.getTokenPrefix() + " " + appProperties.getToken());
        String requestJson = "{\"query\":\"" + location + "\"}";
        HttpEntity<String> entity =
                new HttpEntity<>(requestJson, headers);

        return restTemplate.postForObject(appProperties.getUrl(), entity, Dadata.class);
    }
}


# Export/Import Bulk Product for magento

Export/Import Bulk Product are extension easy used from beginner to expert. The extension could export/import: Configurable Product, Grouped Product, Bundle Product, Downloadable Product, Tier Price, Group Price, Product Tags, Related Products, Up-sells, Cross-sells and Gallery Images. Also, you can use SSH or CRON for export/import.

## Feature
- Support product type:
	- Simple Product
	- Configurable Product
	- Grouped Product
	- Bundle Product
	- Downloadable Product
- Export/import Tier Price
- Export/import Group Price
- Export/import Product Tags
- Export/import Related Products
- Export/import Up-sells
- Export/import Cross-sells
- Export/import Gallery Images
- Ability use csv for import bulk product to magento 2.x
- Flexible settings for advanced usage.
- W3C XHTML 1.0 Transitional. W3C CSS Valid.
- Fully compatible Chrome, IE, Firefox, Flock, Netscape, Safari, Opera

https://www.mlx-store.com/magento-extensions/import-export/export-import-bulk-product-with-configurable-product-bundle-product-grouped-product-downloadable-product-tier-price-group-price-related-products-up-sells-cross-sells-product-tags-magento.html


package ru.sapozhnikov.sensorschecker.db.rest.sensor.controller;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import ru.sapozhnikov.sensorschecker.core.sensor.SensorValue;
import ru.sapozhnikov.sensorschecker.db.jdbc.sensor.SensorValueRepository;

import java.util.List;

@RestController
@RequestMapping
public class SensorValueController {

    private static Logger logger = LogManager.getLogger(SensorValueController.class);

    @Autowired
    private SensorValueRepository sensorValueRepository;

    @PostMapping(value = "/sensorsvalue", consumes = "application/json")
    public void addSensorValue(@RequestBody SensorValue value) {
        logger.info("addSensorValue[{}]", value);
        sensorValueRepository.addSensorValue(value);
    }

    @GetMapping(value = "/sensorsvalue/{truckId}", produces = "application/json")
    public List<SensorValue> getSensorValueByTruckId(@PathVariable("truckId") int truckId) {
        logger.info("getSensorValueByTruckId[{}]", truckId);
        return sensorValueRepository.getSensorValueByTruckid(truckId);
    }

}


package br.com.frwk.gateway.filter;

import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;

public class AuthenticatedFilter extends ZuulFilter {

	@Override
	public boolean shouldFilter() {
		SecurityContext context = SecurityContextHolder.getContext();
		return context.getAuthentication() != null && context.getAuthentication().isAuthenticated();
	}

	@Override
	public Object run() throws ZuulException {
		RequestContext requestContext = RequestContext.getCurrentContext();
		SecurityContext securityContext = SecurityContextHolder.getContext();
		User principal = (User) securityContext.getAuthentication().getPrincipal();
		requestContext.addZuulRequestHeader("X-username", principal.getUsername());
		return null;
	}

	@Override
	public String filterType() {
		return "pre";
	}

	@Override
	public int filterOrder() {
		return 6;
	}

}


package com.etu.basic;

import java.util.*;
import java.util.ArrayList;

public class Example11 {

    public static void main(String[] args) {
        List<String> list = new ArrayList<>(100);
        list.add("ABC");
        list.contains("QWERTY");
        boolean doesntContain = list.remove("ASD");
        list.set(0, "QWERTY");
        list.get(0);

        List<String> linked = new LinkedList<>();

        Set<String> set = new LinkedHashSet<>();
        set.add("10");
        set.add("asdsa");
        System.out.println(set.size());

        System.out.println(set.add("10"));
        set.add("xzcx");
        System.out.println(set.size());
        for (String value : set) {
            System.out.println(value);
        }

        Map<Integer, String> map = new HashMap<>();
        map.put(10, "abc");
        map.put(12, "abc");

        Set<Integer> integers = map.keySet();
        Collection<String> values = map.values();

        System.out.println(map.get(13));
        System.out.println(map.get(10));

        Queue<Student> students = new LinkedList<>();
        Student student = students.peek();
    }
}


package com.tianyi.service;

import com.tianyi.repository.StudentRepository;

public class StudentService {
    public String usertype="";
	private StudentRepository studentRepository;

	public StudentService() {
		studentRepository = new StudentRepository();
	}

	public String save(String userName, String password,
			String firstName, String phoneNumber, String accountType,
			String emailAddress) {
		if (studentRepository != null) {
			if (studentRepository.findByUserName(userName)) {
				return "SignupFailure-UserNameExists";
			}
			studentRepository.save(userName, password, firstName, phoneNumber,
					accountType, emailAddress);
			return "SignupSuccess";
		} else {
			return "SignupFailure";
		}
	}

	public String findByLogin(String userName, String password) {
		String result = "LoginFailure";
		if (studentRepository != null) {
			boolean status = studentRepository.findByLogin(userName, password);
			if (status) {
				usertype=studentRepository.RepoUsertype;
				result = "LoginSuccess";
			}
		}
		return result;
	}
}


DNATweezer
==========

DNATweezer is a collection of wrapper scripts for various modules in [BioPerl](http://BioPerl.org).

Tools
-----
The tools in DNATweezer make it easy to access the functionality of some of the BioPerl modules from the command line, without the need to write your own scripts for small tasks. (Even some larger tasks!)

For example, you could remove a sequence with id "E. coli" in a FASTA file, simply by doing:
    seq-manipulations.pl -d 'id:E. coli' input_file > new_file

The tools included are:

- **`bioaln`**: A wrapper for Bio::SimpleAlign and Bio::AlignIO.
- **`bioseq`**: A wrapper for Bio::Seq and Bio::SeqIO.
- **`biopop`**: A wrapper for Bio::AlignDNAStatistics, Bio::PopGen::Utilities and other BioPerl population genetics modules.
- **`biotree`**: A wrapper for Bio::Tree::Node, Bio::Tree::Tree and Bio::TreeIO.

A few other minor tools are included as well.

**NOTE** Only `bioaln` and `bioseq` are considered production quality at the moment. The other tools are still under heavy development.

Support
-------
As with any software, these tools can contain bugs and are always going to be works in progress. Thus, feedback such as bug reports and feature requests are welcomed.


package com.dev9.crash.bad;

import com.dev9.crash.AbstractBadThing;
import org.springframework.stereotype.Service;

import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.InputStream;
import java.net.URL;

@Service
public class OpenConnections extends AbstractBadThing {

    static int bytesRead = 0;
    static String urlToRead = "http://localhost:8080/";

    public String getBadThingDescription() {
        return "Attempts to open a network connection to " + urlToRead + ". "
                + bytesRead + " lines read so far.";
    }

    @Override
    public String getBadThingId() {
        return "open-network-connection";
    }

    public String getBadThingName() {
        return "Open Network Connection";
    }

    public String doBadThing() throws Exception {
        URL u;
        InputStream is = null;
        DataInputStream dis;

        u = new URL(urlToRead);

        is = u.openStream(); // throws an IOException

        dis = new DataInputStream(new BufferedInputStream(is));

        while (dis.read() != -1) {
            bytesRead++;
        }
        return null;
    }
}


package de.muspellheim.uispec4j;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class Main {

	public static void main(String[] args) {
		SwingUtilities.invokeLater(() -> {
			EntityManagerFactory factory = Persistence
					.createEntityManagerFactory("UISpec4J");
			EntityManager em = factory.createEntityManager();
			final JFrame frame = new JFrame("UISpec4J");
			em.createQuery("from Contact", Contact.class).getResultList();
			em.close();
			frame.addWindowListener(new WindowAdapter() {

				@Override
				public void windowClosed(WindowEvent e) {
					// XXX set break point to this method to trigger race condition
					System.out.println("windowClosed");
					em.close();
					factory.close();
				}

			});
			frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			frame.setSize(640, 480);
			frame.setVisible(true);
		});
	}

}


package com.wework.chao;

import java.io.IOException;
import java.util.regex.Pattern;

/**
 * Supports searching a regex in the web content.
 */
public class WebSearcher {
    private final Pattern pattern;
    private final HttpRetriever httpRetriever;

    /**
     * Creates with regex and the default HttpRetriever
     * @param pattern regex pattern
     */
    public WebSearcher(String pattern) {
        this(pattern, new ApacheHttpRetriever());
    }

    /**
     * @param pattern regex pattern
     * @param httpRetriever HttpRetriever object that gets web contents into a string
     */
    public WebSearcher(String pattern, HttpRetriever httpRetriever) {
        this.pattern = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
        this.httpRetriever = httpRetriever;
    }

    /**
     * @param url a web url link
     * @return whether the web page specified by 'url' contains the regex.
     * @throws IOException
     */
    public boolean contains(String url) throws IOException {
        String content = httpRetriever.get(url);
        return pattern.matcher(content).find();
    }
}


package others;

public class item {
	private int tml;//0 终结符 1 非终结符 2空
	private String dsb;//描述
	private String place;//语义相关
	private String sym;//语义相关

	public item(int tml){
		this.tml = tml;
		this.dsb = "";
	}

	public item(int tml, String dsb){
		this.tml = tml;
		this.dsb = dsb;
	}

	public item(String dsb, String place, String sym){
		this.tml = 0;
		this.dsb = dsb;
		this.place = place;
		this.sym = sym;
	}

	public void setTml(int tml){
		this.tml = tml;
	}

	public int getTml(){
		return tml;
	}

	public String getDsb() {
		return dsb;
	}

	public void setDsb(String dsb) {
		this.dsb = dsb;
	}

	public boolean equals(item anit){
		if(this.tml==anit.tml&&this.dsb.equals(anit.dsb)){
			return true;
		} else {
			return false;
		}
	}

	public String toString(){
		return dsb;
	}

	public String getPlace() {
		return place;
	}

	public void setPlace(String place) {
		this.place = place;
	}

	public String getSym() {
		return sym;
	}

	public void setSym(String sym) {
		this.sym = sym;
	}
}


package com.roy.controllers;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.roy.models.Search;

@Controller
public class ErrorHandlingController implements ErrorController {

	private static final String PATH = "/error";

	@RequestMapping(value = PATH)
	public String error(Model model) {
		model.addAttribute("search", new Search());
		try {
			ClassLoader classLoader = getClass().getClassLoader();
			File file = new File(classLoader.getResource("static/photos/error_img_slider").getFile());

			final String img_folder = "photos/error_img_slider/";

			List<String> images = new ArrayList<String>();

			for (File img : file.listFiles() ) {
				images.add(img_folder + img.getName());
			}

			if (images.size() != 0) {
				model.addAttribute("images", images);
			}

		}catch(Exception ex){}

		return "404";
	}

	@Override
	public String getErrorPath() {
		return PATH;
	}
}


package com.example.demo.ServiceImpl;

import java.util.List;
import java.util.Optional;

import javax.transaction.Transactional;

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

import com.example.demo.Model.User;
import com.example.demo.Repository.UserRepository;
import com.example.demo.Service.UserService;

@Service
@Transactional
public class UserServiceImpl implements UserService {

	@Autowired
	UserRepository userRepository;

	@Override
	public void createUser(User user) {
		userRepository.save(user);
	}

	@Override
	public User getUserById(long id) {
		return userRepository.findOne((int) id);
	}

	@Override
	public List<User> getAllUsers() {
		return (List<User>) userRepository.findAll();
	}

	@Override
	public void updateUser(User user) {
		userRepository.save(user);
	}

	@Override
	public void deleteUser(int id) {
		userRepository.deleteById( id);
	}

}


package com.haiwang.logistics.controller.fore;

import com.haiwang.logistics.service.RouteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/route")
public class RouteController {
    @Autowired
    private RouteService routeService;
    @ResponseBody
    @RequestMapping("/route1")
    private Double price(HttpServletRequest request){
        double itemWeight= Double.parseDouble(request.getParameter("itemWeight"));
        String senderProvinces=request.getParameter("senderProvinces");
        String receiverProvinces=request.getParameter("receiverProvinces");
//        double i=routeService.getPriceByPrvoinces("北京市","辽宁省大连市",10);
        double i=routeService.getPriceByPrvoinces(senderProvinces,receiverProvinces,itemWeight);
        System.out.println("p"+i);
        return i;
    }

}


jasontsai0408.github.io

Some Points of my website:

Most part of my website are from bootstrap : https://getbootstrap.com/

A. About Me (Home Page)

  Fontfamily: From Google Font

  Bootstrap: Navs

  Bootstrap: Carousels

  Bootstrap: Card

  There are "Buttons" for other website

    I have my own blog(study and photo), which are in the link.

B. Photography (Second Page)

  Bootstrap: Card

C. Contact Me (Third Page)

  Bootstrap: Card

  At the part of Gmail, I use this method to link my email:https://blog.xuite.net/jason_kuso/kuso/38943441-%E3%80%90html%E3%80%91E-mail%E8%B6%85%E9%80%A3%E7%B5%90

  The final part - comment area, you can comment on there and it will show yout comment above
  but there is still one problem , if we reset the page, it will disappear.

  Method: https://www.itread01.com/content/1549559192.html

The most important thing is!!! Those photos and atmospheric diagram are taken and made by myself!!!


package com.soffid.iam.addons.report.model;

import java.util.Date;

import com.soffid.iam.addons.report.api.ParameterType;
import com.soffid.iam.addons.report.api.ParameterValue;
import com.soffid.mda.annotation.Column;
import com.soffid.mda.annotation.Depends;
import com.soffid.mda.annotation.Description;
import com.soffid.mda.annotation.Entity;
import com.soffid.mda.annotation.Identifier;
import com.soffid.mda.annotation.Nullable;

@Entity(table="SCR_EXREPA")
@Depends({ParameterValue.class})
public class ExecutedReportParameterEntity {
	@Identifier
	@Nullable
	@Column(name = "ERP_ID")
	Long id;

	@Column(name = "ERP_ERE_ID", reverseAttribute="parameters", composition=true)
	ExecutedReportEntity report;

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

	@Column(name = "ERP_STRVAL", length=1024)
	@Nullable
	String stringValue;

	@Column(name = "ERP_DATVAL")
	@Nullable
	Date dateValue;

	@Column(name = "ERP_LONVAL")
	@Nullable
	Long longValue;

	@Column(name = "ERP_DOUVAL")
	@Nullable
	Double doubleValue;

	@Column(name = "ERP_BOOVAL")
	@Nullable
	Boolean booleanValue;

	@Column(name= "ERP_TYPE")
	ParameterType type;
}


package com.mimaraslan.model;

import java.util.HashSet;
import java.util.Set;

public class Customer {

    private int customerId;
    private String title;
    private String name;
    private Set<Address> addresses = new HashSet<Address>(0);

    public Customer() {
    }

    public Customer(String title, String name, Set<Address> addresses) {
        this.title = title;
        this.name = name;
        this.addresses = addresses;
    }

    public int getCustomerId() {
        return customerId;
    }

    public void setCustomerId(int customerId) {
        this.customerId = customerId;
    }

    public String getName() {
        return name;
    }

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

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Set<Address> getAddresses() {
        return addresses;
    }

    public void setAddresses(Set<Address> addresses) {
        this.addresses = addresses;
    }
}


package com.elkdev.tripPlanner.continent.controller;

import com.elkdev.tripPlanner.continent.model.Continent;
import com.elkdev.tripPlanner.continent.service.ContinentService;
import com.elkdev.tripPlanner.country.model.Country;
import com.elkdev.tripPlanner.country.service.CountryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/continent")
@CrossOrigin
public class ContinentController {

    private final ContinentService continentService;

    @Autowired
    public ContinentController(ContinentService continentService) {
        this.continentService = continentService;
    }

    @GetMapping(value = "/get-all")
    public List<Continent> getAllContinents(){
        return continentService.findAllContinents();
    }
}


package model;

import org.hyperic.sigar.ProcCpu;
import org.hyperic.sigar.ProcMem;

public class SystemProcessInfo {
String name;
long pid[];
ProcCpu cpu;
ProcMem mem;

public SystemProcessInfo()
{

}

public SystemProcessInfo(String name)
{
	this.name = name;
    pid=null;
    cpu=null;
    mem=null;
}
public SystemProcessInfo(String name,long[]pid)
{
	this.name = name;
    this.pid=pid;
    cpu=null;
    mem=null;
}

public SystemProcessInfo(String name, long[] pids, ProcCpu cpu, ProcMem mem) {
	super();
	this.name = name;
	this.pid = pids;
	this.cpu = cpu;
	this.mem = mem;
}

public String getName() {
	return name;
}

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

/**
 * @return the pid
 */
public long[] getPid() {
	return pid;
}

/**
 * @param pid the pid to set
 */
public void setPid(long[] pid) {
	this.pid = pid;
}

/**
 * @return the cpu
 */
public ProcCpu getCpu() {
	return cpu;
}

/**
 * @param cpu the cpu to set
 */
public void setCpu(ProcCpu cpu) {
	this.cpu = cpu;
}

/**
 * @return the mem
 */
public ProcMem getMem() {
	return mem;
}

/**
 * @param mem the mem to set
 */
public void setMem(ProcMem mem) {
	this.mem = mem;
}

}


package com.example.administrator.stopapp.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.administrator.stopapp.R;
import com.example.administrator.stopapp.databinding.NextfragmentLayoutBinding;

/**
 * Created by Administrator on 2016/12/5.
 */
public class NextFragment extends BaseFragment{

    private NextfragmentLayoutBinding binding;
    private NextFragment nextFragment;
    private FirstFragment firstFragment;

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

    @Override
    public void initView() {
        binding = (NextfragmentLayoutBinding) view;
        binding.setTxt("NextFragment");
        firstFragment = new FirstFragment();
        nextFragment = this;
        binding.setOnClick(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                switchContent(nextFragment,firstFragment);
            }
        });
    }
}


package nurik.projectsdutechnopark;

import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.MenuItem;

import com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx;

public class MainActivity extends AppCompatActivity {

    private MainFragment mainFragment;
    private FragmentTransaction fragmentTransaction;

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

        BottomNavigationViewEx menu = (BottomNavigationViewEx) findViewById(R.id.menu);

        mainFragment = new MainFragment();
        fragmentTransaction = getSupportFragmentManager().beginTransaction();
        fragmentTransaction.replace(R.id.frame, mainFragment);
        fragmentTransaction.commit();

        menu.enableShiftingMode(false);
        menu.enableItemShiftingMode(false);
        menu.setTextVisibility(false);
        menu.setIconSize(25, 25);
        menu.setCurrentItem(1);

    }

}


package hr.fer.nenr.geneticalgorithm;

import java.util.List;
import java.util.Objects;

public class Individual {
    private final List<Double> chromosomes;
    private double penalty;

    public Individual(List<Double> chromosomes) {
        this.chromosomes = chromosomes;
    }

    public List<Double> getChromosomes() {
        return chromosomes;
    }

    public double getPenalty() {
        return penalty;
    }

    public void setPenalty(double penalty) {
        this.penalty = penalty;
    }

    @Override
    public String toString() {
        return "Individual{" +
                "chromosomes=" + chromosomes +
                ", penalty=" + penalty +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Individual that = (Individual) o;
        return Double.compare(that.penalty, penalty) == 0 &&
                Objects.equals(chromosomes, that.chromosomes);
    }

    @Override
    public int hashCode() {
        return Objects.hash(chromosomes, penalty);
    }
}


/*
 * This file is part of Relics.
 *
 * Copyright (c) 2017, Austin Payne <amperialdev@gmail.com - http://github.com/Amperial>
 *
 * All Rights Reserved.
 *
 * Unauthorized copying and/or distribution of Relics,
 * via any medium is strictly prohibited.
 */
package com.herocraftonline.items.crafting.recipe.result;

import com.herocraftonline.items.api.crafting.Result;
import com.herocraftonline.items.api.item.Item;
import com.herocraftonline.items.api.item.attribute.attributes.crafting.Reagent;
import org.bukkit.inventory.ItemStack;

public class RelicResult implements Result {

    private final Item result;

    public RelicResult(Item result) {
        this.result = result;
    }

    @Override
    public ItemStack getItem() {
        return result.getItem();
    }

    @Override
    public String getDisplayIcon() {
        return result.getAttribute(Reagent.class).map(reagent -> reagent.getReagentType().getDisplayIcon()).orElse(result.getMaterial().name().toLowerCase());
    }

    @Override
    public String toString() {
        return result.getName();
    }

}


package com.accredilink.bgv.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.accredilink.bgv.pojo.Login;
import com.accredilink.bgv.service.LoginService;
import com.accredilink.bgv.util.ResponseObject;

@RestController
@RequestMapping("/user")
@CrossOrigin(origins = "*", allowedHeaders = "*")
public class LoginController {

	@Autowired
	private LoginService loginService;

	@PostMapping("/login")
	public ResponseObject loginUser(@RequestBody Login login) {
		return loginService.login(login);
	}

	@PostMapping("/forgotpassword")
	public ResponseObject forgotPassword(@RequestBody Login login) {
		return loginService.forgot(login);
	}

	@PostMapping("/resetpassword")
	public ResponseObject resetPassword(@RequestBody Login login) {
		return loginService.reset(login);
	}
}


package distributedlock;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @Description
 * @Tips
 * @Author yikai.wang
 * @Date 2020/4/13 10:36
 */
public class ZkTest implements Runnable {

    private static int inventory = 1;
    private static final int NUM = 10;
    private static CountDownLatch cdl = new CountDownLatch(NUM);

    private static Lock lock = new ReentrantLock();

    public static void main(String[] args) {
        for (int i = 0; i < NUM; i++) {
            new Thread(new ZkTest()).start();
            cdl.countDown();
        }
    }

    @Override
    public void run() {
        lock.lock();
        try {
            cdl.await();
            if (inventory > 0){
                TimeUnit.SECONDS.sleep(5);
                inventory--;
            }
            System.out.println("库存: " + inventory);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }finally {
            lock.unlock();
        }

    }
}


package com.goodow.drive.android.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.goodow.drive.android.toolutils.OfflineFileObserver;
import com.goodow.realtime.Realtime;
import com.goodow.realtime.channel.constant.MessageType;
import elemental.json.Json;
import elemental.json.JsonObject;

public class DownloadBroadcastReceiver extends BroadcastReceiver {
  private final String TAG = this.getClass().getSimpleName();

  @Override
  public void onReceive(Context context, Intent intent) {
    String data = intent.getStringExtra(MessageType.DOWNLOAD.name());
    JsonObject json = Json.parse(data);

    String userId = json.getString("userId");
    String token = json.getString("token");
    if (Realtime.getToken() == null) {
      Realtime.authorize(userId, token);

    }

    OfflineFileObserver.OFFLINEFILEOBSERVER.addAttachment(json);

    Log.i(TAG, "Download :" + json.toString());
  }
}


# _Portfolio Landing Page_

#### _Portfolio web page using HTML and CSS, 03/16/2018_

#### By _**Dennise Ortega**_

## Description

_This is my first Independent Project at Epicodus. It is a Portfolio Landing Page for my programming projects accomplished throughout my first week of class, as well as for future projects._

## Setup/Installation Requirements

* _Web browser_
* _HTML and CSS_
* _denniseortega.github.io/portfolio_

_This project only uses HTML and CSS._

## Known Bugs

_I had trouble successfully viewing my live GitHub Pages site. I believe I was committing changes in the gh-pages branch instead of the master branch. I thought that  deleting my repository in Github would help, but I learned that I had to delete my repository locally by using rm -rf .git in order for that to work. I wonder if there is a more efficient way to do/if there was a different problem._

## Support and contact details

_Feel free to contact me if you have any questions, ideas, or concerns!_

## Technologies Used

_HTML and CSS_

### License

*MIT*

Copyright (c) 2016 **_Dennise Ortega_**


package com.ctspcl.poi.rule;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.springframework.util.StringUtils;

import java.util.Iterator;

/**
 * @author JiaFu.yang
 * @description
 * @date 2019/6/10
 **/
public class NotBlankRowRule extends RowRule{

    @Override
    public boolean isMatchRule(Row row) {
        return isNotBlankRow(row);
    }

    private boolean isNotBlankRow(Row r){
        Iterator<Cell> iterator = r.cellIterator();
        boolean isValid = false;
        Cell cell;
        while (iterator.hasNext()){
            cell = iterator.next();
            if (cell != null){
                if (!cell.getCellTypeEnum().equals(CellType.BLANK)){
                    if (cell.getCellTypeEnum().equals(CellType.STRING)){
                        if (StringUtils.isEmpty(cell.getStringCellValue())){
                            continue;
                        }
                    }
                    isValid = true;
                    break;
                }
            }
        }
        return isValid;
    }

}


package ga.goanywhere.entities;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.*;

import javax.persistence.*;
import java.sql.Date;
import java.util.Collection;

@Getter
@Setter
@EqualsAndHashCode
@Entity
@Table(name = "user", schema = "goanywhere", catalog = "")
@NoArgsConstructor
@AllArgsConstructor
public class UserEntity {
    @Id
    @GeneratedValue
    @Column(name = "id")
    private Long id;

    @Column(name = "username")
    private String username;

    @JsonIgnore
    @Column(name = "password")
    private String password;

    @Column(name = "first_name")
    private String firstName;

    @Column(name = "last_name")
    private String lastName;

    @Column(name = "sex")
    private String sex;

    @Column(name = "birthday")
    private Date birthday;

    @ManyToOne
    @JoinColumn(name = "address_id")
    private AddressEntity userAddress;

    @OneToOne(mappedBy = "user")
    private UserContactEntity userContact;

    @JsonIgnore
    @OneToMany(mappedBy = "userMeetingPK.participant")
    private Collection<UserMeetingEntity> meetings;

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

}


package org.alexr.web.entity;

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

public class Person {
  private int id;
  private String name;
  private int age;
  private List<String> skills;

  public Person() { }

  public Person(int id, String name, int age) {
    this(id, name, age, new ArrayList<>(0));
  }

  public Person(int id, String name, int age, List<String> skills) {
    this.id = id;
    this.name = name;
    this.age = age;
    this.skills = skills;
  }

  public String getName() {
    return name;
  }

  public int getAge() {
    return age;
  }

  public int getId() {
    return id;
  }

  public List<String> getSkills() {
    return skills;
  }

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

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

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

  public void setSkills(List<String> skills) {
    this.skills = skills;
  }

  @Override
  public String toString() {
    return String.format("Person{id=%d, name='%s', age=%d, skills=%s}", id, name, age, skills);
  }
}


package com.assignment.arpit.assignment;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

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

public class MainActivity extends AppCompatActivity {

    RecyclerView recyclerView;
    List<listItem> listItems;
    Random r=new Random();
    RecyclerView.Adapter adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        recyclerView=findViewById(R.id.recycle);
        recyclerView.setHasFixedSize(true);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        listItems=new ArrayList<>();
        for(int i=0;i<10;i++)
        {
            listItem listItem=new listItem("User "+(i+1),(10+r.nextInt(30)));
            listItems.add(listItem);

        }

        adapter=new MyAdaptor(listItems,this);
        recyclerView.setAdapter(adapter);
    }
}


package com.frank.myclock.view;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.RelativeLayout;

public class MyRelativeLayout extends RelativeLayout {
    private OnUnlockListener listener;
    private float yStart,yEnd;
    public MyRelativeLayout(Context context) {
        super(context);
    }
    public MyRelativeLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        Log.i("LockActivity","onTouchEvent");
        switch (event.getAction()){
            case MotionEvent.ACTION_DOWN:
                yStart = event.getRawY();
                break;
            case MotionEvent.ACTION_UP:
                yEnd = event.getRawY();
                if (yStart > yEnd+400){
                    listener.OnUnlock();
                }
                break;
        }
        return true;
    }

    public void setOnUnlockListener(OnUnlockListener listener){
        this.listener = listener;
    }

    public interface OnUnlockListener{
        public void OnUnlock();
    }
}


package com.clomez.invalane.services;

import com.clomez.invalane.beans.Options;
import com.clomez.invalane.repositories.OptionsRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OptionServiceImpl implements OptionService {

    @Autowired
    private OptionsRepository repository;

    @Override
    public void save(Options options){
        System.out.println(options.toString());
        Options optionsHolder = options;
        optionsHolder.setNameo("test");
        optionsHolder.setId(0L);
        optionsHolder.setLocalhost(options.getLocalhost());
        System.out.println(optionsHolder.toString());
        repository.save(options);

    }

    @Override
    public List<Options> getOptions() {

        List<Options> optionsList = (List<Options>) repository.findAll();

        return optionsList;
    }
    @Override
    public Options getOption(Long id) {

        Options options = new Options();

        repository.findOne(id);

        return options;
    }

}


package web.app.TechStore.TechStore.Services.models;

import java.util.List;

public class FilteredMobileListResponse {
    private List<ProductDto> filteredProducts;

    public FilteredMobileListResponse(List<ProductDto> filteredProducts) {
        this.filteredProducts = filteredProducts;
    }

    public List<ProductDto> getFilteredProducts() {
        return filteredProducts;
    }

    //missing price and photo
    public static class ProductDto {
        private long productId;
        private String name;
        private Double price;
        private String imageName;

        public ProductDto(long productId, String name, Double price, String imageName) {
            this.productId = productId;
            this.name = name;
            this.price = price;
            this.imageName = imageName;
        }

        public long getProductId() {
            return productId;
        }

        public String getName() {
            return name;
        }

        public Double getPrice() {
            return price;
        }

        public String getImageName() {
            return imageName;
        }
    }
}


package org.fatcatsolutions.utils.strings;

public final class StringUtils {

	public static final String EMPTY_STRING = "";
	public static final CharSequence EMPTY_CHARSEQUENCE = EMPTY_STRING;

	private StringUtils() {
		// hide utility class
	}

	/**
	 * @param toTest
	 *            {@link CharSequence} to default if is blank
	 * @return {@link StringUtils#EMPTY_STRING} if CharSequence is null, blank or only contains spaces
	 */
	public static String defaultToEmptyIfBlank(final CharSequence toTest) {
		if (isBlank(toTest)) {
			return EMPTY_STRING;
		}
		return toTest.toString();
	}

	/**
	 * @param toCheck
	 *            {@link CharSequence} to check
	 * @return boolean whether or not the given CharSequence is null, blank or only contains spaces
	 */
	public static boolean isBlank(final CharSequence toCheck) {
		return org.apache.commons.lang3.StringUtils.isBlank(toCheck);
	}

	/**
	 * @param toCheck
	 *            {@link CharSequence} to check
	 * @return boolean Returns true if the CharSequence to check is not null and contains text other then white space
	 */
	public static boolean isNotBlank(final CharSequence toCheck) {
		return org.apache.commons.lang3.StringUtils.isNotBlank(toCheck);
	}

}


package org.kafka_proxy.config;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

public class GlobalConfig {

	public static Integer thread_num = null;
	public static Integer listen_port = null;
	public static String kafka_server = null;
	public static String token = null;
	private static final Logger log = Logger.getLogger(GlobalConfig.class);
	public static void loadConfig(String args){

		String path =  System.getProperty("user.dir") + "/src/main/resources/"
					+ args + "/message_bus.properties";
		Properties prop = new Properties();
		InputStream in;
		try {
			in = new BufferedInputStream(new FileInputStream(path));
			prop.load(in);
			thread_num = Integer.valueOf(prop.getProperty("messagebus.thread_num"));
			listen_port = Integer.valueOf(prop.getProperty("messagebus.listen_port"));
			token = prop.getProperty("messagebus.token");
			kafka_server = prop.getProperty("kafka.server");
		} catch (Exception e) {
			log.warn(e.getMessage());
		}
	}

}


---
title: Grubbing Around
subtitle: Some commands I found useful
layout: post
category: blog
---

Nothing earth-shattering here: I recently had the "pleasure" of setting up an
ARM64 server. After considerable support, several firmware upgrades, corruption
of the main HDD, reinstallation of CentOS7 (recommended, somewhat to my
surprise), all that remained was to get an up-to-date Linux built and installed
with 32 bit binary support. This took a bit of `make config` fiddling, but got
there after a few tries.

And then I had to relearn how `grub`/`grub2` works in this brave new (to me)
UEFI CentOS7 world. Herewith some brief commands I found useful while doing
so...

{% highlight bash %}
sudo grep "^menu entry" /boot/efi/EFI/centos/grub.cfg \
     | tr -s " " | cut -f 2 -d "'" | cat -n
{% endhighlight %}

Edit `/etc/default/grub` to set `GRUB_DEFAULT=N` for desired value of `N`

Temporarily set the default for the next reboot:

{% highlight bash %}
sudo grub2-reboot 1 # based on output of above
{% endhighlight %}

Regenerate the grub2 configuration:

{% highlight bash %}
sudo grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
{% endhighlight %}


# PROJECT NAME

## About the Game
endless runner

### Contributors:
Contributors to the project are strictly limeted to AIE Students as part of their group work project.

Members (example):
Programmer: Jack Norrie

## Build Steps:
The project can currently be built for both windows and webgl in the following ways:

* **Manual:** Via the Unity Engine Build Settings.
  * Open the project in untiy
  * Select `File->BuildSettings`
  * Switch to the desired build platform (windows or webgl)
  * Select `Build`
  * You will be prompted to select an output directory
  * Once the build has finished open your chosed folder to find your build

* **Automated**: `build_all.bat` will run build and `pc` and `webgl` version of the project
  * Double click on `build_all.bat`
  * The process will take some time, leave the console window open
  * The following files will be produced:
    * PC Build: `builds/pc/YourGame.exe`
    * WebGL Build: `builds/web/index.html`

## Daily Builds:
Daily builds of the project should be placed on the local campus network drive

# Credits:
 Are there assets, sounds or media included within the project that require attributation? list them here:


package com.example.testovoe4.dataclasses;

import com.fasterxml.jackson.annotation.*;
import java.util.HashMap;
import java.util.Map;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
        "Realtime Currency Exchange Rate"
})
public class RealtimeCurrencyExchangeRate {

    @JsonProperty("Realtime Currency Exchange Rate")
    private RealtimeCurrencyExchangeRate_ realtimeCurrencyExchangeRate;
    @JsonIgnore
    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

    @JsonProperty("Realtime Currency Exchange Rate")
    public RealtimeCurrencyExchangeRate_ getRealtimeCurrencyExchangeRate() {
        return realtimeCurrencyExchangeRate;
    }

    @JsonProperty("Realtime Currency Exchange Rate")
    public void setRealtimeCurrencyExchangeRate(RealtimeCurrencyExchangeRate_ realtimeCurrencyExchangeRate) {
        this.realtimeCurrencyExchangeRate = realtimeCurrencyExchangeRate;
    }

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(String name, Object value) {
        this.additionalProperties.put(name, value);
    }

}


/*
 * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * or in the "license" file accompanying this file. This file 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.
 */

package com.amazon.opendistroforelasticsearch.ad.caching;

import org.elasticsearch.common.inject.Provider;

/**
 * A wrapper to call concrete implementation of caching.  Used in transport
 * action.  Don't use interface because transport action handler constructor
 * requires a concrete class as input.
 *
 */
public class CacheProvider implements Provider<EntityCache> {
    private EntityCache cache;

    public CacheProvider(EntityCache cache) {
        this.cache = cache;
    }

    @Override
    public EntityCache get() {
        return cache;
    }
}


### How to regenerate Fauxton's icon fonts

The steps below describe how to use [svgtofont](https://github.com/jaywcjlove/svgtofont) to generate a new set of
CSS and font files based on an input set of SVG icons.

**IMPORTANT**: The source SVG files can not contain any comments or metatags (e.g. `<?xml ...?>` , `<!-- -->` or `<!DOCTYPE ... >`) otherwise the `svgtofont` tool will fail.

1. Add, remove or replace SVG icons in the [assets/icons](assets/icons) folder.

2. Run `npm install svgtofont --no-save` to install the tool.

3. Then run
```
cd assets/iconfontgenerator
node createfonts.js <fauxtonicon[INTEGER]>
```

Specifiying `fauxtonicon[INTEGER]` will update the value of `fauxtonFontname` in `assets/iconfontgenerator/createfonts.js` which is the name of the new font files. This is needed because the font files are bundled as-is by Webpack, so in order to burst the browser's cache, you need to specify a different name. Take note of the current value and increment by 1 for consistency (e.g., `fauxtonicon5` --> `fauxtonicon6`)

The new CSS and font files are generated and copied to the appropriate Fauxton folders.


package cn.xiongyu.juc;

import java.util.concurrent.*;

/**
 * ClassName: CyclicBarrierTest
 * Package: cn.xiongyu.juc
 * Description:
 * Date: 19-8-9 下午9:14
 * Author: xiongyu
 */
public class CyclicBarrierTest {

    private static CyclicBarrier cyclicBarrier = new CyclicBarrier(5);
    public static void main(String[] args) throws InterruptedException {
        ExecutorService executorService = Executors.newCachedThreadPool();
        for (int i = 0; i < 20; i++) {
            Thread.sleep(1000);
            executorService.execute(() -> {
                add();
            });
        }
        executorService.shutdown();
    }
    private static void add(){
        System.out.println(Thread.currentThread().getId() + "thread is ready");
        try {
            cyclicBarrier.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (BrokenBarrierException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getId() + "thread is continue");
    }
}


package com.prayosof.yvideo.view.browser.fragments;

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

import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;

import com.prayosof.yvideo.R;
import com.prayosof.yvideo.databinding.FragmentContentBinding;

/**
 * A simple {@link Fragment} subclass.
 */
public class ContentFragment extends Fragment {

    public ContentFragment() {
        // Required empty public constructor
    }

    private FragmentContentBinding binding;
    public static String url = "";

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        binding = DataBindingUtil.inflate(inflater, R.layout.fragment_content, container, false);

        url = getArguments().getString("url");

        getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.frame, new HomeFragment()).commit();
        return binding.getRoot();
    }

}


# SITE APPLICATION

## Dependencies
* nodejs: [https://nodejs.org/](https://nodejs.org/en/)
* angular4: [https://angular.io/](https://angular.io/)
* webpack: [https://webpack.github.io/](https://webpack.github.io/)
* lodash: [https://lodash.com/](https://lodash.com/)
* sass: [http://sass-lang.com/](http://sass-lang.com/)
* typescript: [https://www.typescriptlang.org/](https://www.typescriptlang.org/)
* karma: [https://karma-runner.github.io](https://karma-runner.github.io/1.0/index.html)
* tslint: [https://palantir.github.io/tslint](https://palantir.github.io/tslint/)

## Installation
- install typescript globally `npm install -g typescript`
- install npm dependencies by running `npm install`
- install karma-cli globally `npm install -g karma-cli`
- update the following configurations and database credentials on `{root}/config/site/nineGag-config.json`

## How to Use
- run `npm start` it will listen to default http://localhost:8181

## Testing
- run `npm test`
- run `tslint --type-check --project tsconfig.json --config tslint.json`

## Building Production
- run `npm run build`


package ehealth.ws;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for deleteUserResponse complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="deleteUserResponse">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="deleteUser" type="{http://www.w3.org/2001/XMLSchema}int"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "deleteUserResponse", propOrder = {
    "deleteUser"
})
public class DeleteUserResponse {

    protected int deleteUser;

    /**
     * Gets the value of the deleteUser property.
     *
     */
    public int getDeleteUser() {
        return deleteUser;
    }

    /**
     * Sets the value of the deleteUser property.
     *
     */
    public void setDeleteUser(int value) {
        this.deleteUser = value;
    }

}


package com.nix.cinema;

import com.nix.cinema.model.Actor;
import com.nix.cinema.repository.ActorRepository;
import com.nix.cinema.services.ActorService;
import com.nix.cinema.services.impl.ActorServiceImpl;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.*;

public class ActorServiceTest {

    ActorService actorService;
    ActorRepository actorRepository;

    @BeforeEach
    void setUp() {
        actorRepository = mock(ActorRepository.class);
        actorService = new ActorServiceImpl(actorRepository);
    }

    @Test
    void addActorTest() {

    }

    @Test
    void getAllActorsTest() {
        List<Actor> actors = actorService.getAllActors();
        assertEquals(0, actors.size());
        verify(actorRepository).findAll();
        verifyNoInteractions(actorRepository);
    }

    @Test
    void getAllActorsPageTest() {

    }

    @Test
    void getActorByIdTest() {

    }

    @Test
    void deleteActorById() {

    }
}


# I Saloon

## Developers

- Hatem Husnieh
- Ahmad Ammoura
- Ahmad Abu Osbeh
- Mohammed Al-Ramahi

---

## Description :

- A website/application that allows users to discover barbers within their areas in a professional way, this app will ease the contacting process and introducing services for the clients. As it will allow barbers to manage their work and reach their customers and subscribers.

---

## Install and operate.

1. copy front-end repos link and download it using `git clone <repo-link>`.
1. copy back-end repos link and download it using `git clone <repo-link>`.
1. download each repo dependencies by typing the following on you terminal `npm install`.
1. for back-end repo, copy the variables inside `.enc.sample` file inside a folder and call it `.env` and fill it with the following:
   - SECRET: any combination of number and letters.
   - PORT: any free port at you system.
   - DATABASE_URL: postgreSQL url at your system.
1. start the back-end by `npm start` or `nodemon`.
1. start front-end by `npm start`
1. enjoy!

---

## Technologies

- React
- Redux
- Material UI components.
- CSS and SCSS
- PostgreSQL
- Json Web token (jwt)
- bcrypt
- Node.js
- Express
- base-64
- nodemailer
- multer


package com.android.touchevent.view;

import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.Button;

import com.android.touchevent.util.MotionEventUtil;

/**
 * Description: <MyButton>

 * Author:      gxl

 * Date:        2019/5/10

 * Version:     V1.0.0

 * Update:

 */
@SuppressLint("AppCompatCustomView")
public class MyButton extends Button {
    public static final String TAG = "MYTAG";
    public MyButton(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        Log.v(TAG,"MyButton dispatchTouchEvent start:"+MotionEventUtil.getMotionEventName(ev));
        return super.dispatchTouchEvent(ev);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        Log.v(TAG,"MyButton onTouchEvent start:"+MotionEventUtil.getMotionEventName(event));
        return super.onTouchEvent(event);
    }
}


Things I've learnt on Week 0

Mac keyboard shortcuts
* Command Space -
  * it brings up the the search field. This features allows you to look up anything on your mac, including applications(chrome, terminal), files,  etc.
* workflow - control(change to caps lock)
  * - control ^ and left or right key will switch between different open application
  * how to change keyboard bindings
    * Go to System prefrences>Keyboard> Click on Modifier Keys> Switch caps lock to ^ control and switch control to caps lock

Setting up things on vs code
  *   Downloading extension
      *   how to - click on the extension icon (four squares seperated by one) then search any extension
      *   extension installed
          *   Bracket Pair Colorizer
          *   Code Spell Checker
          *   Indent-rainbow
          *   Markdown all in one
          *   setting sync
              *   next time you set up a new computer your settings will be sync up through github

Terminal
 * An application the allows you to control anything on your mac
   * Bash-cheat-sheet https://github.com/hansCodeJam/bash-cheat-sheet
     * cd, ls, pwd, mv, rm, mkdir, touch, cp


import io.github.bonigarcia.wdm.WebDriverManager;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

import java.util.concurrent.TimeUnit;

public class GoogleTest {
    private WebDriver driver;
    private String baseUrl;

    @Before
    public void setup() {
        WebDriverManager.chromedriver().setup();
        driver = new ChromeDriver();
        baseUrl = "https://google.com";
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        //System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");
    }

    @Test
    public void openPage() {
        driver.get(baseUrl);
        GooglePage googlePage = new GooglePage(driver);
        googlePage.typeSerachRequest("test line");

        //driver.findElement(By.xpath("//input[@name='q']"));
    }

    @After
    public void tearDown() {
        driver.quit();
    }
}


package com.wolf.concurrenttest.hcpta.workerthread;

import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;

/**
 * Description:
 * Created on 2021/9/26 6:32 PM
 *
 * @author 李超
 * @version 0.0.1
 */
public class WorkerThreadTest {
    public static void main(String[] args) {
        ProductionChannel channel = new ProductionChannel(5);
        AtomicInteger productNo = new AtomicInteger();
        // 8人放，5人工作
        IntStream.range(1, 8).forEach(i ->
                new Thread(() -> {
                    while (true) {
                        channel.offerProduction(new Production(productNo.getAndIncrement()));
                        try {
                            TimeUnit.SECONDS.sleep(ThreadLocalRandom.current().nextInt(10));
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }).start());
    }
}


package com.turing.activity.service.entity.test;

import static org.junit.Assert.*;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
import org.junit.After;
import org.junit.Before;

public class TestEntity {

	private SessionFactory sessionFactory;
	private Session session;
	private Transaction transaction;

	@Before
	public void init(){
		Configuration configuration = new Configuration().configure();
		ServiceRegistry serviceRegistry =
				new ServiceRegistryBuilder().applySettings(configuration.getProperties())
											.buildServiceRegistry();
		sessionFactory = configuration.buildSessionFactory(serviceRegistry);

		//打开session
		session = sessionFactory.openSession();

		//开启事物
		transaction = session.beginTransaction();
	}

	@After
	public void destroy(){
		transaction.commit();
		session.close();
		sessionFactory.close();
	}

	@org.junit.Test
	public void test() {

	}

}


Grails Real Time Logging Application
=================
***
This project is a Grails application that receives Log4j messages from a JMS channel and streams them to a web page view using Atmosphere and websockets. The full write up is available at [http://danveloper.github.com/grails-real-time-logging.html](http://danveloper.github.com/grails-real-time-logging.html).

Usage
===
***
The Grails app is contained inside of [log-server](https://github.com/danveloper/real-time-logging/log-server) directory. From there you can simply do **grails run-app** and it will fire up appropriately. Once the application is up and running, you can use the runnable [TestJMSRunner](https://github.com/danveloper/real-time-logging/blob/master/enhanced-log4j-jms-appender/src/test/java/com/danveloper/log4j/jms/TestJMSLogger.java) to test streaming log messages.

Remember, you need to be using a browser that supports websockets. I **only** tested this in Chrome.

License
===
***
As always, free for all. Do enjoy.

Contact
===
***
t([@danveloper](http://twitter.com/danveloper)) *** g([daniel.p.woods@gmail.com](mailto:daniel.p.woods@gmail.com))


package com.bc.caibiao.utils;

import android.app.ProgressDialog;
import android.content.Context;
import android.text.TextUtils;

/**
 * @author wangkai
 * @create 16/9/8 上午10:48
 * @Description :
 */
public class ProgressDialogUtils {
    private String defaultMsg = "数据加载中...";
    private ProgressDialog mDialog;
    private boolean isCancelable = true;
    private Context context;

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

    public ProgressDialogUtils(Context context, String tipMsg) {
        this.context = context;
        if (!TextUtils.isEmpty(tipMsg))
            defaultMsg = tipMsg;
    }

    public ProgressDialogUtils(Context context, String tipMsg, boolean isCancelable) {
        this.context = context;
        this.isCancelable = isCancelable;
        if (!TextUtils.isEmpty(tipMsg))
            defaultMsg = tipMsg;
    }

    public void show() {
        mDialog = new ProgressDialog(context);
        mDialog.setMessage(defaultMsg);
        mDialog.setCancelable(isCancelable);
        mDialog.show();
    }

    public void dismiss() {
        if (mDialog != null) {
            mDialog.dismiss();
            mDialog = null;
        }
    }
}


package labs;

import java.io.DataOutputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Serializable;

public class Order implements Serializable{

	private Integer customerID;
	private String name;

	public Order() {
		super();
		this.customerID = 696969;
		this.name = "rando_name";
	}

	public Order(Integer customerID, String name) {
		super();
		this.customerID = customerID;
		this.name = name;
	}

	public void writeText() {
		try {

		PrintWriter pw = new PrintWriter(new FileWriter("order.txt"));

		pw.println("Customer ID: " + customerID + " Name: " + name);

		pw.close();

		} catch (IOException e) {
			System.err.println(e);
			e.printStackTrace();
		}
	}

	public void writeBinary() {
		try {

			FileOutputStream fos = new FileOutputStream(fos);
			DataOutputStream dos = new DataOutputStream("order.txt");

			dos.writeUTF("\n" + name);

			dos.close();

		} catch (IOException e) {
			System.err.println(e);
			e.printStackTrace();
		}
	}
}


package com.owen.game.battlemap.players;

import com.owen.game.Game;
import com.owen.game.battlemap.BattleMap;
import com.owen.game.map.Position;
import com.owen.game.sprites.CharacterGenerator;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.ArrayList;

public class BattleArcher extends BattlePlayer {
    public BattleArcher(Position mapPosition, BufferedImage sprite, BattleMap map, Game game) {
        super(mapPosition, sprite, map, game);
        Graphics g = this.sprite.getGraphics();
        g.drawImage(CharacterGenerator.getWeapons().get(0), 0, 0, null);
        g.dispose();
    }

    @Override
    public void select() {
        possibleMoves = getPossibilities(5);
        possibleAttacks = getPossibleAttacks(mapPosition);
    }

    public ArrayList<Position> getPossibleAttacks(Position pos) {
        ArrayList<Position> possible = new ArrayList<>();
        for (int i = 0; i < 8; i++) {
            possible.addAll(map.getHex(pos).getRing(i));
        }
        return possible;
    }
}


package com.cube.cubeanimation.controller;

import com.cube.cubeanimation.model.dto.PostDto;
import com.cube.cubeanimation.services.PostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api")
public class PostController {

    private final PostService postService;

    @Autowired
    public PostController(PostService postService) {
        this.postService = postService;
    }

    @GetMapping("/posts")
    public List<PostDto> getPosts() {
        return postService.getPostsDto();
    }

    @GetMapping("/posts/{id}")
    public PostDto getPost(@PathVariable long id) {
        return postService.getPostDto(id);
    }

    @PostMapping("/posts")
    public void addPost(@RequestBody PostDto postDto) {
        postService.addPost(postDto);
    }

    @PutMapping("/posts")
    public void editPost(@RequestBody PostDto postDto) {
        System.out.println(postDto);
        postService.editPost(postDto);
    }

    @DeleteMapping("/posts/{id}")
    public void deletePost(@PathVariable long id) {
        postService.deletePost(id);
    }
}


package com.hotel.cloud.common.vo.equip;

import com.hotel.cloud.modules.equipment.entity.DeviceEntity;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class DeviceVo {

    /**
     * 主键
     */
    private Long id;
    /**
     * 名称
     */
    @NotBlank(message = "名称不能为空")
    private String name;
    /**
     * 文件id
     */
    private Long ossId;
    /**
     * 图片url
     */
    private String pictureUrl;
    /**
     * 价格
     */
    @NotNull(message = "价格不能为空")
    private BigDecimal price;
    /**
     * 描述
     */
    private String remark;
    /**
     * 当前数量
     */
    @NotNull(message = "数量不能为空")
    private Integer amount;

    private MultipartFile picture;

    public DeviceEntity getEntity() {
        DeviceEntity entity = new DeviceEntity();
        BeanUtils.copyProperties(this, entity);
        return entity;
    }
}


public class backpack{
private int ownerid;
private String bname;
private int size;
private int money;
private ArrayList<String> consumable;

public backpack(int id,int name,int size,int money,ArrayList<String> consumable){
	this.ownerid=id;
	this.bname=name;
	this.money=money;
	this.size=size;
	this.consumable=consumable;
}

 public int getownerid(){
	   return this.ownerid;
	}
 public String getbackpackname(){
		return this.bname;
	}

 public int getsize(){
		return this.size;
	}
 public int getmoney(){
		return this.money;
	}

 public ArrayList<String> getconsumable(){
		return this.consumable;
	}

 public int setownerid(int id){
	  return this.ownerid=id;
	}

 public int setbackpacksize(int size){
	  return this.size=size;
	}

 public int setmoney(int money){
	  return this.money=money;
	}

 public String setbackpackname(String name){
	  return this.bname=name;
	}
 public ArrayList<String> setconsumable(ArrayList<String> consumable){
		return this.consumbale=consumable;
	}

 public String toString() {
	return this.ownerid+ "  " + this.bname+ "  " + this.size+ " "+this.money;
    }

}


package cc.landingzone.dreamweb.common;

import java.io.InputStream;
import java.util.Properties;

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

public class CommonConstants {

    private static final Logger logger = LoggerFactory.getLogger(CommonConstants.class);

    public static final String Aliyun_AccessKeyId;

    public static final String Aliyun_AccessKeySecret;

    public static final String Aliyun_REGION_HANGZHOU = "cn-hangzhou";

    // 是否线上环境
    public static final boolean ENV_ONLINE;

    static {
        Properties properties = loadProperties();
        ENV_ONLINE = Boolean.parseBoolean(properties.getProperty("env_online"));
        Aliyun_AccessKeyId = properties.getProperty("aliyun_accesskeyid");
        Aliyun_AccessKeySecret = properties.getProperty("aliyun_accesskeysecret");
    }

    public static Properties loadProperties() {
        Properties properties = new Properties();
        try {
            InputStream ins = CommonConstants.class.getResourceAsStream("/dreamweb.properties");
            properties.load(ins);
            ins.close();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        return properties;
    }

}


package com.example.toeicapplication.adapters;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.example.toeicapplication.view.fragment.LoginFragment;
import com.example.toeicapplication.view.fragment.SignUpFragment;

import org.jetbrains.annotations.NotNull;

public class LoginPagerAdapter extends FragmentStateAdapter {
    private final int NUM_PAGES;

    public LoginPagerAdapter(FragmentManager fm, Lifecycle lifecycle, int NUM_PAGES){
        super(fm, lifecycle);
        this.NUM_PAGES = NUM_PAGES;
    }

    @NonNull
    @NotNull
    @Override
    public Fragment createFragment(int position) {
        switch(position){
            case 0:
                return new LoginFragment();
            case 1:
                return new SignUpFragment();
            default:
                return null;
        }
    }

    @Override
    public int getItemCount() {
        return NUM_PAGES;
    }
}


package net.yongpo;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by p0po on 2019/3/18 0018.
 */
public class TestDiskQueue {
    static ExecutorService e = Executors.newFixedThreadPool(1);

    public static void main(String[] args) {
        final DiskMq diskMq = new DiskMqImpl("/export/data/", "test");

        e.submit(new Runnable() {
            public void run() {
                while (true) {
                    long start = System.nanoTime();
                    Object o = diskMq.peek();
                    long stop = System.nanoTime();
                    System.out.println("cost :" + (stop - start) + " ws");

                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException e1) {
                        e1.printStackTrace();
                    }
                }

            }
        });

        while (true) {
            diskMq.add(System.getenv());
            try {
                Thread.sleep(10);
            } catch (InterruptedException e1) {
                e1.printStackTrace();
            }
        }

    }
}


# nscreen bash bundle

Provides easy access to named screens with autocompletion of running sessions, as well as optional screen configs on a per-name basis, with the main ~/.screenrc being merged with the topic config

# Usage

	nscreen mysessionname

Opens a new screen session with the given name. As long as the session is alive, the same command will now attach to the session (detaching it from the previously attached terminal)

# Topic configs

If you create a file ~/.screen-<name>, upon creation of a named session of the same name, nscreen will concatenate your ~/.screenrc and ~/.screen-<name> file, store it as ~/.nscreen-<md5>, and start screen with this file as its config file.

This way, you may preconfigure a bunch of ssh sessions, like loadbalancer or database failover pairs, a bunch of slave databases of a common master etc.

	zombie k
	screen ssh databasenode1
	screen ssh databasenode2

zombie k will make screen not close a window when the ssh session disconnects, and ask you to hit k to really close the window or CTRL-Space to reopen the ssh session.


package com.gl.main;

import com.gl.model.Employee;
import com.gl.services.CredentialService;

import java.util.Scanner;

public class Driver {

    public static void main(String[] args) {

        Employee e1 = new Employee("Prasannakumar", "patil");
        int choice;
        CredentialService credentialService = new CredentialService();
        System.out.println("Please enter the department from the following");
        System.out.println("1. Technical");
        System.out.println("2. Admin");
        System.out.println("3. Human Resource");
        System.out.println("4. Legal");

        Scanner scanner = new Scanner(System.in);
        choice = scanner.nextInt();

        switch (choice){
            case 1: credentialService.showCredentials(e1,"tech"); break;
            case 2: credentialService.showCredentials(e1,"admin"); break;
            case 3: credentialService.showCredentials(e1,"hr"); break;
            case 4:  credentialService.showCredentials(e1,"legal"); break;
            default:
                System.out.println("Invalid host");
        }
    }
}


package com.java.dao;

import com.java.model.Book;

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

public class BookManagement {

    private List<Book> bookList = new ArrayList<>();

    public List<Book> getBookList() {
        return bookList;
    }
    public void addBook(Book addBook){
        for (Book book: bookList){
            if (book.getID()==addBook.getID()){
                System.out.println("Book already exists, please re-enter");
                return;
            }
        }
        bookList.add(addBook);
    }
    public void removeBook(Book book){
        bookList.remove(book);
    }
    public void updateBook(Book updatedBook) {
        for (Book book: bookList) {
            if (book.getID() == updatedBook.getID()) {
                book.setReleaseNumber(updatedBook.getReleaseNumber());
                book.setAuthor(updatedBook.getAuthor());
            }
        }
    }

    public Book searchBookID(long ID) {
        for (Book book: bookList) {
            if (book.getID() == ID) {
                return book;
            }
        }
        return null;
    }

}


# Blog Project

### Overview

A basic blog application provided with CRUD functionality.

Built following chapters 5-7 of [Django for Beginners](https://djangoforbeginners.com).

### Features

Uses a basic Post model including title, body, and author fields. The author field is linked to Django's User model through use of a foreign key, providing a one-to-many relationship between authors and posts.

Utilises Django's built-in class-based views, specifically ListView and DetailView for displaying blog posts, CreateView and UpdateView for form-handling when creating and updating blog entries, and DeleteView for deleting individual posts.

Also Uses Django's auth app for user authentication as well as the form class UserCreationForm for user sign up.

Doesn't include user authentication permissions as this was addressed in later chapters in the textbook.

### Built using:

* Python 3.7
* Django 3.0.8
* django-crispy-forms 1.9.2
* Gunicorn 20.0.4
* Bootstrap 4
* Visual Studio Code 1.47.3
* macOS 10.14.6
* Heroku
* Pipenv

### Screenshot:

![alt text](readme_screenshot.png "Portfolio screenshot")


package rsalesc.roborio.utils;

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

/**
 * Created by Roberto Sales on 12/08/17.
 */
public class Checkpoint {
    private static final Checkpoint SINGLETON = new Checkpoint();

    private HashMap<String, Integer> hs;

    public static Checkpoint getInstance() {
        return SINGLETON;
    }

    private Checkpoint() {
        hs = new HashMap<>();
    }

    public void enter(String cp) {
        if(!hs.containsKey(cp)) {
            hs.put(cp, 0);
        }

        hs.put(cp, hs.get(cp) + 1);
    }

    public void leave(String cp) {
        if(!hs.containsKey(cp)) {
            hs.put(cp, 0);
        }

        hs.put(cp, hs.get(cp) - 1);
    }

    public int get(String cp) {
        if(!hs.containsKey(cp)) {
            hs.put(cp, 0);
        }

        return hs.get(cp);
    }

    public void dump() {
        for(Map.Entry<String, Integer> entry : hs.entrySet()) {
            System.out.println(entry.getKey() + " " + entry.getValue());
        }
    }
}


package com.brewmapp.presentation.presenter.impl;

import android.net.Uri;

import com.facebook.share.model.ShareLinkContent;
import com.facebook.share.widget.ShareDialog;

import javax.inject.Inject;

import com.brewmapp.R;
import com.brewmapp.presentation.view.contract.InviteView;

import ru.frosteye.ovsa.presentation.presenter.BasePresenter;
import com.brewmapp.presentation.presenter.contract.InvitePresenter;

import static ru.frosteye.ovsa.data.storage.ResourceHelper.getString;

public class InvitePresenterImpl extends BasePresenter<InviteView> implements InvitePresenter {

    @Inject
    public InvitePresenterImpl() {

    }

    @Override
    public void onDestroy() {

    }

    @Override
    public void onFacebookShare() {
        ShareDialog shareDialog = new ShareDialog(view.getActivity());
        ShareLinkContent linkContent = new ShareLinkContent.Builder()
                .setQuote(getString(R.string.invite_message))
                .setContentUrl(Uri.parse(getString(R.string.config_site_url))).build();
        shareDialog.show(linkContent);
    }
}


package pojo;

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

/**
 * 出牌区对象
 */
public class PlayArea {

    /*
     * cards：当前出牌区最后一次出的牌
     * status：这组排的类别
     *  -1：不合法
     *   0：空出牌区
     *   1：火箭（双王）
     *   2：炸弹（aaaa）
     *   3：单牌（a）
     *   4：对牌（aa）
     *   5：三牌（aaa）
     *   6：三带一（aaab）
     *   7：三带一对（aaabb）
     *   8：四带二（aaaabc）
     *   9：四带二对（aaaabbcc）
     *  10：单顺（abcde）
     *  11：双顺（aabbccdd）
     *  12：三顺-飞机-不带翅膀（aaabbb）
     *  13：飞机-带翅膀-单（aaabbbcd）
     *  14：飞机-带翅膀-对（aaabbbccdd）
     * player：上一次出牌的玩家信息
     *
     */
    private List<Card> cards;
    private Integer status;
    private Player player;

    public PlayArea() {
        cards = new ArrayList<>();
        status = -1;
        player = null;
    }

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

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

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Player getPlayer() {
        return player;
    }

    public void setPlayer(Player player) {
        this.player = player;
    }
}


package org.simplerss.rssreader.service;

import org.simplerss.rssreader.properties.RssReaderProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;

import javax.annotation.PostConstruct;
import java.util.List;

public class InitialisationService {

    public static final Logger LOGGER = LoggerFactory.getLogger(InitialisationService.class);

    private SiteRssService siteRssService;
    private RssReaderProperties rssReaderProperties;

    public InitialisationService(SiteRssService siteRssService, RssReaderProperties rssReaderProperties) {
        this.siteRssService = siteRssService;
        this.rssReaderProperties = rssReaderProperties;
    }

    @PostConstruct
    public void init(){
        List<String> listeSites=rssReaderProperties.getSiteInitial();
        LOGGER.info("listeSites={}", listeSites);
        if(!CollectionUtils.isEmpty(listeSites)) {
            for(String url:rssReaderProperties.getSiteInitial()) {
                siteRssService.ajouteSite(url);
            }
        }
    }
}


/*
 * 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 com.depths.untold;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Listener;

/**
 *
 * @author Tim
 */
public class Commands implements Listener{
    private Untold plugin;
    private CommandSender sender;
    private Command cmd;
    private String label;
    private String[] args;

    public Commands(){

    }

    public Commands(Untold plugin, CommandSender sender, Command cmd, String label, String[] args) {
        this.sender = sender;
        this.plugin = plugin;
        this.cmd = cmd;
        this.label = label;
        this.args = args;
    }

    public boolean executeCommand(){
        String command = cmd.getName();
//        if (command.equalsIgnoreCase("life"))
//            if (args.length == 0){
//            sender.sendMessage(ChatColor.YELLOW + "Time format: YYYY/WW/DD/HH/MM/SS");
//        }
        return true;
    }

}