text:
package com.example.wisebody.twelve.PagerMenu;

import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.devbrackets.android.exomedia.core.video.scale.ScaleType;
import com.devbrackets.android.exomedia.listener.OnCompletionListener;
import com.devbrackets.android.exomedia.listener.OnPreparedListener;
import com.devbrackets.android.exomedia.listener.OnSeekCompletionListener;
import com.devbrackets.android.exomedia.ui.widget.EMVideoView;
import com.example.wisebody.twelve.AsyncTask.FollowStar;
import com.example.wisebody.twelve.DB;
import com.example.wisebody.twelve.R;
import com.example.wisebody.twelve.Record;
import com.example.wisebody.twelve.User;
import com.example.wisebody.twelve.video_list_demo.Adapter.items.postData;
import com.example.wisebody.twelve.widget.AddsaveLatestTask;
import com.squareup.picasso.Picasso;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.text.DecimalFormat;
import java.util.ArrayList;

import de.hdodenhof.circleimageview.CircleImageView;
import fr.castorflex.android.verticalviewpager.VerticalViewPager;

/**
 * Created by gh on 2016-07-15.
 */

public class BestFragment extends Fragment {
    private static final float MIN_SCALE = 0.75f;
    private static final float MIN_ALPHA = 0.75f;
    static VerticalViewPager verticalViewPager;
    String myJSON;
    JSONArray posts = null;
    String[] nickname;
    String[] entertainment;
    String[] text;
    String[] video;
    String[] image;
    String[] gold;
    String[] fan;
    int position;
    static Boolean shownpage;
    Boolean loadData;
    static ArrayList<postData> mList;
    static User loginUser;
    SwipeRefreshLayout swipeRefreshLayout;
    ProgressBar mainLoad;
    static BestAdapter bestAdapter;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_best, container, false);
        Log.d("크리에이트", "크리에이트2");
        verticalViewPager = (VerticalViewPager) view.findViewById(R.id.verticalviewpager);
        mList = new ArrayList<>();
        Button record = (Button) view.findViewById(R.id.recordbtn);
        loginUser = (User) (getArguments().getSerializable("loginUser"));
        record.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), Record.class);
                intent.putExtra("loginUser", loginUser);
                startActivity(intent);
            }
        });
        mainLoad = (ProgressBar) view.findViewById(R.id.mainload);
        swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refresh);
        bestAdapter = new BestAdapter(getChildFragmentManager(), mList);
        swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                GetData task = new GetData();
                task.execute();
            }
        });
        shownpage = false;
        loadData = false;
        GetData task = new GetData();
        task.execute();
        Log.d("생성","베스트");

        return view;
    }
    @Override
    public void onDestroyView()
    {
        super.onDestroyView();
        if(swipeRefreshLayout.isRefreshing())
            swipeRefreshLayout.setRefreshing(false);
    }
    protected void restFragment()
    {
        PlaceholderFragment nextFrag;
        PlaceholderFragment prevFrag;
        if(mList.size()!=0) {
            if (position == 0) {
                if (mList.size() > 1) {
                    nextFrag = (PlaceholderFragment) bestAdapter.instantiateItem(verticalViewPager, verticalViewPager.getCurrentItem() + 1);
                    nextFrag.unselectedFrag();
                    nextFrag = null;
                }
            } else if (position == mList.size() - 1) {
                if (mList.size() > 1) {
                    nextFrag = (PlaceholderFragment) bestAdapter.instantiateItem(verticalViewPager, verticalViewPager.getCurrentItem() - 1);
                    nextFrag.unselectedFrag();
                    nextFrag = null;
                }
            } else {
                if (mList.size() > 2) {
                    prevFrag = (PlaceholderFragment) bestAdapter.instantiateItem(verticalViewPager, verticalViewPager.getCurrentItem() - 1);
                    prevFrag.unselectedFrag();
                    nextFrag = (PlaceholderFragment) bestAdapter.instantiateItem(verticalViewPager, verticalViewPager.getCurrentItem() + 1);
                    nextFrag.unselectedFrag();
                }
            }
            ((PlaceholderFragment) bestAdapter.instantiateItem(verticalViewPager, verticalViewPager.getCurrentItem())).selectedFrag();
        }
    }

    protected void showList() {
        try {
            nickname = null;
            entertainment = null;
            text = null;
            video = null;
            image = null;
            gold = null;
            fan = null;
            if(mList!=null)
                mList.clear();
            JSONObject jsonObj = new JSONObject(myJSON);
            posts = jsonObj.getJSONArray("result");
            if(posts.length()>0) {
                nickname = new String[posts.length()];
                entertainment = new String[posts.length()];
                text = new String[posts.length()];
                video = new String[posts.length()];
                image = new String[posts.length()];
                gold = new String[posts.length()];
                fan = new String[posts.length()];
                for (int i = 0; i < posts.length(); i++) {
                    JSONObject c = posts.getJSONObject(i);
                    nickname[i] = c.getString("nickname");
                    entertainment[i] = c.getString("entertainment");
                    text[i] = c.getString("text");
                    video[i] = c.getString("video");
                    image[i] = c.getString("id");
                    gold[i] = c.getString("gold");
                    fan[i] = c.getString("fan");
                    mList.add(new postData(nickname[i], entertainment[i], text[i], video[i], image[i], gold[i], fan[i]));
                }
            }

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

    class GetData extends AsyncTask<Void, Void, String> {

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            loadData = false;
        }

        @Override
        protected void onPostExecute(String s) {
            super.onPostExecute(s);
            verticalViewPager.setAdapter(bestAdapter);
            mainLoad.setVisibility(View.GONE);
            loadData = true;
            MainActivity.loadcount++;
            position = verticalViewPager.getCurrentItem();
            if(position==0)
                swipeRefreshLayout.setEnabled(true);
            else
                swipeRefreshLayout.setEnabled(false);
            if(swipeRefreshLayout.isRefreshing())
                swipeRefreshLayout.setRefreshing(false);
            restFragment();
            verticalViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
                @Override
                public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

                }

                @Override
                public void onPageSelected(int pos) {
                    position = pos;
                    if (position == 0) {
                        swipeRefreshLayout.setEnabled(true);
                    }
                    else{
                        swipeRefreshLayout.setEnabled(false);
                    }
                    restFragment();
                }

                @Override
                public void onPageScrollStateChanged(int state) {

                }
            });
        }

        @Override
        protected String doInBackground(Void... params) {

            DB db = new DB("postList.php");
            String result = db.postList(loginUser.id);
            //Toast.makeText(getApplicationContext(), result, Toast.LENGTH_LONG).show();
            myJSON = result;
            showList();

            return result;
        }
    }

    public class BestAdapter extends FragmentStatePagerAdapter {
        ArrayList<postData> mList;

        public BestAdapter(FragmentManager fm, ArrayList<postData> mList) {
            super(fm);
            this.mList = mList;
        }

        @Override
        public Fragment getItem(int position) {
            return PlaceholderFragment.newInstance(mList.get(position), position,loginUser.id);
        }

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

    }

    /**
     * A placeholder fragment containing a simple view.
     */
    public static class PlaceholderFragment extends Fragment {
        /**
         * The fragment argument representing the section number for this
         * fragment.
         */
        EMVideoView video;
        Button bookmark;
        Button addStar;
        CircleImageView profile;
        TextView nickname;
        TextView entertainment;
        TextView rank;
        Button play;
        TextView text;
        TextView gold;
        ProgressBar loading;

        private static final String ARG_SECTION_NUMBER = "section_number";
        View rootView;
        Boolean prepare;
        Boolean cur;
        postData postData;
        int numRank;
        String id;
        AddsaveLatestTask addSaveList = new AddsaveLatestTask(getContext(),"pressbookmark.php");
        AddsaveLatestTask addLatestList = new AddsaveLatestTask(getContext(),"pressplay.php");
        FollowStar followStar;

        /**
         * Returns a new instance of this fragment for the given section
         * number.
         */
        public static PlaceholderFragment newInstance(postData postData, int position, String id) {
            PlaceholderFragment fragment = new PlaceholderFragment();
            Bundle args = new Bundle();
            args.putInt("rank", position);
            args.putSerializable("postData", postData);
            args.putString("id", id);
            fragment.setArguments(args);
            return fragment;
        }

        public PlaceholderFragment() {
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            Log.d("크리에이드", "create");
            numRank = getArguments().getInt("rank");
            id = getArguments().getString("id");
            postData = (com.example.wisebody.twelve.video_list_demo.Adapter.items.postData) getArguments().getSerializable("postData");
            prepare = false;
            cur = false;
            rootView = inflater.inflate(R.layout.bestcontent, container, false);
            video = (EMVideoView) rootView.findViewById(R.id.video);
            bookmark = (Button) rootView.findViewById(R.id.bookmark);
            addStar = (Button) rootView.findViewById(R.id.addStar);
            loading = (ProgressBar) rootView.findViewById(R.id.loading);
            if(postData.getAuthrization().equals("fan"))
                addStar.setBackgroundResource(R.drawable.addedstar);
            profile = (CircleImageView) rootView.findViewById(R.id.profileImage);
            nickname = (TextView) rootView.findViewById(R.id.nickname);
            entertainment = (TextView) rootView.findViewById(R.id.entertainment);
            rank = (TextView) rootView.findViewById(R.id.rank);
            play = (Button) rootView.findViewById(R.id.play);
            play.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    addLatestList.addToDatabase(id,postData.getVideo());
                }
            });
            text = (TextView) rootView.findViewById(R.id.text);
            gold = (TextView) rootView.findViewById(R.id.gold);
            Picasso.with(getContext().getApplicationContext()).load("http://girim2.ga/twelve/myimg/" + postData.getImage() + ".jpg").fit().into(profile);
            bookmark.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    addSaveList.addToDatabase(id,postData.getVideo());
                }
            });
            rank.setText(Integer.toString(numRank + 1));
            double num = Double.parseDouble(postData.getGold());
            DecimalFormat df = new DecimalFormat("#,##0");
            gold.setText("Gold " + df.format(num).toString());
            nickname.setText(postData.getNickname());
            entertainment.setText(postData.getEntertainment());
            text.setText(postData.getText());
            video.setScaleType(ScaleType.CENTER_CROP);
            video.setVideoURI(Uri.parse("http://girim2.ga/twelve/uploads/" + postData.getVideo()));
            video.requestFocus();
            video.setOnPreparedListener(new OnPreparedListener() {
                @Override
                public void onPrepared() {
                    prepare = true;
                    loading.setVisibility(View.GONE);
                    play.setVisibility(View.INVISIBLE);
                    video.setVolume(0);
                    if(cur&&shownpage)
                    video.start();
                }
            });
            video.setOnCompletionListener(new OnCompletionListener() {
                @Override
                public void onCompletion() {
                    prepare = false;
                    loading.setVisibility(View.VISIBLE);
                    video.setVideoURI(Uri.parse("http://girim2.ga/twelve/uploads/" + postData.getVideo()));
                    video.requestFocus();
                }
            });
            video.setOnSeekCompletionListener(new OnSeekCompletionListener() {
                @Override
                public void onSeekComplete() {
                    loading.setVisibility(View.GONE);
                    video.start();
                }
            });
            addStar.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
              checkAddstar();
                    followStar = new FollowStar(loginUser.id, postData.getImage());
                    followStar.searchToDatabase();
                }
            });
            return rootView;
        }
        public void checkAddstar()
        {
            PlaceholderFragment nextFrag;
            if(postData.getAuthrization().equals("fan")) {
                addStar.setBackgroundResource(R.drawable.btn_add_pp_star);
                postData.authrization = "notfan";
                for(int i = 0 ; i<mList.size(); i ++) {
                    if (mList.get(i).getNickname().equals(postData.getNickname())) {
                        mList.get(i).authrization = "notfan";
                        if(verticalViewPager.getCurrentItem()==0) {
                            if(i==1) {
                                nextFrag = (PlaceholderFragment) bestAdapter.instantiateItem(verticalViewPager, verticalViewPager.getCurrentItem() + 1);
                                nextFrag.addStar.setBackgroundResource(R.drawable.btn_add_pp_star);
                                nextFrag = null;
                            }
                        }
                        else if (verticalViewPager.getCurrentItem()+1==mList.size())
                        {
                            if(i==verticalViewPager.getCurrentItem()-1) {
                                nextFrag = (PlaceholderFragment) bestAdapter.instantiateItem(verticalViewPager, verticalViewPager.getCurrentItem() - 1);
                                nextFrag.addStar.setBackgroundResource(R.drawable.btn_add_pp_star);
                                nextFrag = null;
                            }
                        }
                        else
                        {
                            if(i==verticalViewPager.getCurrentItem()-1)
                            {
                                nextFrag = (PlaceholderFragment) bestAdapter.instantiateItem(verticalViewPager, verticalViewPager.getCurrentItem() - 1);
                                nextFrag.addStar.setBackgroundResource(R.drawable.btn_add_pp_star);
                                nextFrag = null;
                            }
                            else if(i==verticalViewPager.getCurrentItem()+1)
                            {
                                nextFrag = (PlaceholderFragment) bestAdapter.instantiateItem(verticalViewPager, verticalViewPager.getCurrentItem() + 1);
                                nextFrag.addStar.setBackgroundResource(R.drawable.btn_add_pp_star);
                                nextFrag = null;
                            }
                        }
                        Log.d("mList","edit"+mList.get(i).authrization);
                        Log.d("notfan",Integer.toString(i));

                    }
                }
                bestAdapter.notifyDataSetChanged();
            }
            else
            {
                addStar.setBackgroundResource(R.drawable.addedstar);
                postData.authrization = "fan";
                for(int i = 0 ; i<mList.size(); i ++)
                {
                    if(mList.get(i).getNickname().equals(postData.getNickname())) {
                        mList.get(i).authrization = "fan";
                        if(verticalViewPager.getCurrentItem()==0) {
                            if(i==1) {
                                nextFrag = (PlaceholderFragment) bestAdapter.instantiateItem(verticalViewPager, verticalViewPager.getCurrentItem() + 1);
                                nextFrag.addStar.setBackgroundResource(R.drawable.addedstar);
                                nextFrag = null;
                            }
                        }
                        else if (verticalViewPager.getCurrentItem()+1==mList.size())
                        {
                            if(i==verticalViewPager.getCurrentItem()-1) {
                                nextFrag = (PlaceholderFragment) bestAdapter.instantiateItem(verticalViewPager, verticalViewPager.getCurrentItem() - 1);
                                nextFrag.addStar.setBackgroundResource(R.drawable.addedstar);
                                nextFrag = null;
                            }
                        }
                        else
                        {
                            if(i==verticalViewPager.getCurrentItem()-1)
                            {
                                nextFrag = (PlaceholderFragment) bestAdapter.instantiateItem(verticalViewPager, verticalViewPager.getCurrentItem() - 1);
                                nextFrag.addStar.setBackgroundResource(R.drawable.addedstar);
                                nextFrag = null;
                            }
                            else if(i==verticalViewPager.getCurrentItem()+1)
                            {
                                nextFrag = (PlaceholderFragment) bestAdapter.instantiateItem(verticalViewPager, verticalViewPager.getCurrentItem() + 1);
                                nextFrag.addStar.setBackgroundResource(R.drawable.addedstar);
                                nextFrag = null;
                            }
                        }
                    }
                }
                bestAdapter.notifyDataSetChanged();
            }
        }
        public void selectedFrag()
        {
            cur = true;
            if (shownpage)
            loading.setVisibility(View.VISIBLE);
            if(prepare&&shownpage) {
                if(video.getCurrentPosition()!=0)
                    video.seekTo(0);
                else
                {
                    loading.setVisibility(View.GONE);
                    video.start();
                }
            }
            else if(!prepare)
            {
                video.setVideoURI(Uri.parse("http://girim2.ga/twelve/uploads/"+postData.getVideo()));
                video.requestFocus();
            }
            else if(!shownpage)
            {
                if(video !=null&&video.isPlaying())
                    video.pause();
            }
        }
        public void unselectedFrag()
        {
            cur = false;
            if(video !=null)
                video.pause();
        }
    }
}


text:
use crate::mock_graph::{arbitrary::Arb, MockGraph};
use duplicate::duplicate;
use graphene::{
	algo::Bfs,
	core::{
		property::{ConnectedGraph, HasVertex, VertexInGraph},
		Directed, Undirected,
	},
};
use std::collections::HashSet;

#[duplicate(
	directedness; [ Directed ]; [ Undirected ]
)]
mod __
{
	use super::*;

	/// Tests that each produced vertex has an equal or higher depth than the
	/// previous one.
	#[quickcheck]
	fn increasing_depth(
		Arb(graph): Arb<VertexInGraph<ConnectedGraph<MockGraph<directedness>>>>,
	) -> bool
	{
		let mut depth = 0;
		let mut bfs = Bfs::new(&graph);

		while let Some(v) = bfs.next()
		{
			if bfs.depth(v) < depth
			{
				return false;
			}
			depth = bfs.depth(v);
		}
		true
	}

	/// Tests that a vertex's predecessor in the search has already been seen.
	#[quickcheck]
	fn predecessor_already_seen(
		Arb(graph): Arb<VertexInGraph<ConnectedGraph<MockGraph<directedness>>>>,
	) -> bool
	{
		let mut seen = HashSet::new();
		seen.insert(graph.get_vertex().value);

		let mut bfs = Bfs::new(&graph);
		while let Some(v) = bfs.next()
		{
			if let Some(p) = bfs.predecessor(v)
			{
				if !seen.contains(&p.value)
				{
					return false;
				}
			}
			seen.insert(v.value);
		}
		true
	}

	/// Tests that each produced vertex's depth is 1 higher that its
	/// predecessor.
	#[quickcheck]
	fn predecessor_shallower(
		Arb(graph): Arb<VertexInGraph<ConnectedGraph<MockGraph<directedness>>>>,
	) -> bool
	{
		let mut bfs = Bfs::new(&graph);

		while let Some(v) = bfs.next()
		{
			if let Some(p) = bfs.predecessor(v)
			{
				if !(bfs.depth(v) == (bfs.depth(p) + 1))
				{
					return false;
				}
			}
		}
		true
	}

	/// Tests that any vertex with a depth > 0 has a predecessor.
	#[quickcheck]
	fn has_predecessor(
		Arb(graph): Arb<VertexInGraph<ConnectedGraph<MockGraph<directedness>>>>,
	) -> bool
	{
		let mut bfs = Bfs::new(&graph);

		while let Some(v) = bfs.next()
		{
			if bfs.depth(v) > 0
			{
				if bfs.predecessor(v).is_none()
				{
					return false;
				}
			}
		}
		true
	}

	/// Tests that following the predecessors will reach the root.
	#[quickcheck]
	fn predecessor_path_reaches_root(
		Arb(graph): Arb<VertexInGraph<ConnectedGraph<MockGraph<directedness>>>>,
	) -> bool
	{
		let root = graph.get_vertex();
		let mut bfs = Bfs::new(&graph);

		while let Some(v) = bfs.next()
		{
			let mut current = v;
			while let Some(p) = bfs.predecessor(current)
			{
				current = p;
			}
			if current != root
			{
				return false;
			}
		}
		true
	}
}

/// Tests that following the predecessors will reach the root.
#[quickcheck]
fn predecessor_path_reaches_root(
	Arb(graph): Arb<VertexInGraph<ConnectedGraph<MockGraph<Directed>>>>,
) -> bool
{
	let root = graph.get_vertex();
	let mut bfs = Bfs::new(&graph);

	while let Some(v) = bfs.next()
	{
		let mut current = v;
		while let Some(p) = bfs.predecessor(current)
		{
			current = p;
		}
		if current != root
		{
			return false;
		}
	}
	true
}

redpajama_set_name: RedPajamaGithub


text:
React, Universally

A starter kit for universal react applications.

[![All Contributors](https://img.shields.io/badge/all_contributors-20-orange.svg?style=flat-square)](#contributors)

## About

This starter kit contains all the build tooling and configuration you need to kick off your next universal React project, whilst containing a minimal "project" set up allowing you to make your own architecture decisions (Redux/MobX etc).

> NOTICE: Please read this important [issue](https://github.com/ctrlplusb/react-universally/issues/409) about the behaviour of this project when using `react-async-component`, which is by default bundled with it.

## Features

  - 👀 `react` as the view.
  - 🔀 `react-router` v4 as the router.
  - 🚄 `express` server.
  - 🎭 `jest` as the test framework.
  - 💄 Combines `prettier` and Airbnb's ESlint configuration - performing code formatting on commit. Stop worrying about code style consistency.
  - 🖌 Very basic CSS support - it's up to you to extend it with CSS Modules etc.
  - ✂ Code splitting - easily define code split points in your source using `react-async-component`.
  - 🌍 Server Side Rendering.
  - 😎 Progressive Web Application ready, with offline support, via a Service Worker.
  - 🐘 Long term browser caching of assets with automated cache invalidation.
  - 📦 All source is bundled using Webpack v2.
  - 🚀 Full ES2017+ support - use the exact same JS syntax across the entire project. No more folder context switching! We also only use syntax that is stage-3 or later in the TC39 process.
  - 🔧 Centralised application configuration with helpers to avoid boilerplate in your code. Also has support for environment specific configuration files.
  - 🔥 Extreme live development - hot reloading of ALL changes to client/server source, with auto development server restarts when your application configuration changes.  All this with a high level of error tolerance and verbose logging to the console.
  - ⛑ SEO friendly - `react-helmet` provides control of the page title/meta/styles/scripts from within your components.
  - 🤖 Optimised Webpack builds via HappyPack and an auto generated Vendor DLL for smooth development experiences.
  - 🍃 Tree-shaking, courtesy of Webpack.
  - 👮 Security on the `express` server using `helmet` and `hpp`.
  - 🏜 Asset bundling support. e.g. images/fonts.
  - 🎛 Preconfigured to support development and optimised production builds.
  - ❤ Preconfigured to deploy to `now` with a single command.

Redux/MobX, data persistence, modern styling frameworks and all the other bells and whistles have been explicitly excluded from this starter kit.  It's up to you to decide what technologies you would like to add to your own implementation based upon your own needs.

> However, we now include a set of "feature branches", each implementing a technology on top of the clean master branch.  This provides you with an example on how to integrate said technologies, or use the branches to merge in a configuration that meets your requirements.  See the [`Feature Branches`](/internal/docs/FEATURE_BRANCHES.md) documentation for more.

## Getting started

```bash
git clone https://github.com/ctrlplusb/react-universally my-project
cd my-project
npm install
npm run develop
```

Now go make some changes to the `Home` component to see the tooling in action.

## Docs

 - [Project Overview](/internal/docs/PROJECT_OVERVIEW.md)
 - [Project Configuration](/internal/docs/PROJECT_CONFIG.md)
 - [Package Script Commands](/internal/docs/PKG_SCRIPTS.md)
 - [FAQ](/internal/docs/FAQ.md)
 - [Feature Branches](/internal/docs/FEATURE_BRANCHES.md)
 - [Deploy your very own Server Side Rendering React App in 5 easy steps](/internal/docs/DEPLOY_TO_NOW.md)
 - [Changelog](/CHANGELOG.md)


text:
pieburst
========
D3 visualization of unordered data on two axes


text:
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">

  <title>PyQt4.QtGui.QUndoCommand</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />

         Home

         Trees

         Indices

         Help

        PyQt4 ::
        QtGui ::
        QUndoCommand ::
        Class QUndoCommand

[hide private]

[frames] | no frames]

Class QUndoCommand

       object --+
                |
sip.simplewrapper --+
                    |
          sip.wrapper --+
                        |
                       QUndoCommand

Known Subclasses:

qgis._core.QgsAddRemoveItemCommand

, qgis._core.QgsAddRemoveMultiFrameCommand

, qgis._core.QgsComposerItemCommand

, qgis._core.QgsComposerMultiFrameCommand

, qgis._core.QgsVectorLayerUndoCommand

QUndoCommand(QUndoCommand parent=None) QUndoCommand(QString,
  QUndoCommand parent=None)

        Instance Methods
        [hide private]

          actionText(...)

          child(...)

          childCount(...)

          id(...)

          mergeWith(...)

          redo(...)

          setText(...)

          text(...)

          undo(...)

Inherited from sip.simplewrapper:
      __init__,
      __new__

Inherited from object:
      __delattr__,
      __format__,
      __getattribute__,
      __hash__,
      __reduce__,
      __reduce_ex__,
      __repr__,
      __setattr__,
      __sizeof__,
      __str__,
      __subclasshook__

        Properties
        [hide private]

Inherited from object:
      __class__

         Home

         Trees

         Indices

         Help

    Generated by Epydoc 3.0.1 on Tue Jun 14 13:29:18 2016

      http://epydoc.sourceforge.net


text:
layout: page
title: Davila 55th Anniversary
date: 2016-05-24
author: Ralph Juarez
tags: weekly links, java
status: published
summary: Nam porttitor magna vehicula pellentesque porta. Quisque.
banner: images/banner/office-01.jpg
booking:
  startDate: 12/23/2018
  endDate: 12/28/2018
  ctyhocn: SGOOHHX
  groupCode: D5A
published: true
---
Vivamus quis magna quam. Nullam quis magna nulla. Nam at orci sapien. Quisque ac elit nunc. Donec id imperdiet est. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Mauris semper convallis tempor. Duis et sem vitae magna interdum eleifend imperdiet ac tellus. Integer quis sollicitudin urna, a scelerisque mi. Sed ut dui nec felis suscipit semper. Duis malesuada enim elementum vehicula placerat. Mauris eget scelerisque nisl. Nulla ullamcorper, odio ac tempor varius, nulla mi posuere ex, a faucibus eros massa vel lacus.

1 Mauris ut elit maximus, tincidunt justo in, hendrerit libero
1 Praesent sit amet turpis vitae neque aliquet condimentum ac ac est.

In quam justo, maximus a orci quis, tristique posuere eros. Proin convallis dolor diam, id hendrerit mauris dapibus vel. Proin tincidunt ut turpis iaculis scelerisque. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In eu velit eget ante tristique cursus facilisis eu tortor. Curabitur finibus congue urna sed malesuada. Donec in lacus vel mauris viverra placerat vel nec leo. Aliquam venenatis vestibulum sapien.
Vivamus consectetur tortor sem, sit amet tempus risus dapibus at. Integer ac magna ac neque tempor gravida. In dictum ante dui, sed vulputate lacus auctor nec. Cras efficitur bibendum risus sit amet dignissim. Phasellus a felis nunc. Donec mi ipsum, blandit sit amet turpis eu, pharetra bibendum orci. Etiam at aliquet dolor, sit amet dapibus nibh. Suspendisse id congue quam, quis suscipit ex. Vivamus at libero orci.


text:
"""Parse the output of writelog.sh into info about git commits.
"""
import argparse
import json
import sys

SEP="@@@@@"

def parse_diff(st):
	"""Parse a commit diff from the given string.

	Args:
		st: diff string
	"""
	D_BEGIN = 1
	D_FILES = 2
	D_HEADER = 3
	D_BODY = 4

	state = D_BEGIN

	def add_diff():
		putf = fromfile
		if fromfile != tofile:
			if fromfile == "dev/null":
				putf = tofile
			else:
				putf = fromfile
				#print("WARNING: fromfile!=tofile")
		part["files"][putf]["text"] = curtxt

	part = {"files": dict()}
	fromfile = ""
	tofile = ""
	curtxt = ""
	for l in st.split("\n"):
		if state == D_BEGIN:
			if len(l) > 0:
				state = D_FILES
		if state == D_FILES:
			if len(l) == 0:
				state = D_HEADER
			else:
				(ins, rem, fname) = l.split()
				part["files"][fname] = {
					"ins": ins,
					"rem": rem
				}
		elif state == D_HEADER:
			#expect
			#	index md5..md5
			#	new file
			#	deleted file
			#	new mode
			#	old mode
			#	Binary files
			if l.startswith("---"):
				(_, fromfile) = l.split()
				#XXX: don't assume a/
				fromfile = fromfile[fromfile.find("/")+1:]
			elif l.startswith("+++"):
				(_, tofile) = l.split()
				tofile = tofile[tofile.find("/")+1:]
				state = D_BODY
		elif state == D_BODY:
			if l.startswith("diff --git"):
				#print "CURTXT", curtxt, "ff", fromfile, "tf", tofile
				add_diff()
				curtxt = ""
				state = D_HEADER
			elif not l.startswith("@@"):
				curtxt += l + "\n"

	#print "CURTXT", curtxt, "ff", fromfile, "tf", tofile
	if len(curtxt) > 0:
		add_diff()

	#/for
	return part

def parse(fin):
	"""Parse tuples from the given input

	Args:
		fin: file pointer
	"""
	last = None
	field = None
	for l in fin:
		if l.startswith(SEP+SEP):
			if last:
				last["diff"] = parse_diff(last["diff"])
				yield last
			last = dict()
		elif l.startswith(SEP):
			#trim last newline
			if field and field in last:
				last[field] = last[field][:-1]
			field = l.strip()[len(SEP):]
		else:
			if not field in last:
				last[field] = ""
			last[field] += l

def print_times(iput):
	for tup in parse(iput):
		print tup["time"]

def print_files(iput):
	for tup in parse(iput):
		if "diff" in tup:
			for (fname, cont) in tup["diff"]["files"].items():
				print fname

def write_json(iput, fname):
	with open(fname, "w") as fp:
		json.dump(list(parse(iput)), fp, indent=2)

def write_json(iput, fname, filter=lambda x: True):
	changes = []
	for tup in parse(iput):
		if filter(tup):
			changes.append(tup)
	with open(fname, "w") as fp:
		json.dump(changes, fp, indent=2)

def filter_has_file(name):
	"""Filter restricted to only those files with a given name
	"""
	def fn(d):
		if "diff" in d:
			if "files" in d["diff"]:
				if name in d["diff"]["files"]:
					return True
		return False
	return fn

if __name__ == "__main__":
	parser = argparse.ArgumentParser()
	parser.add_argument("mode")
	args = parser.parse_args()

	if args.mode == "filtered":
		write_json(sys.stdin, "filtered-mysql.json",
			filter_has_file("manifests/mysql.pp"))
	elif args.mode == "unfiltered":
		write_json(sys.stdin, "all-changes.json")
	elif args.mode == "print_files":
		print_files(sys.stdin)


text: Foundation for Emails 2 Release Candidate is out now!


text:
Life Game CLI Interface
=======================

Simple CLI interface for my version of Conway's Life game

Installation
------------

Dependancies must be installed with composer:

    curl -s https://getcomposer.org/installer | php
    php composer.phar install

Once the dependancies are installed give the _life_ script execute permissions

    chmod +x life

Usage
-----

Run the application using the generate command.

You must specify either a file that lays out a game grid:

    life generate --file=MyFile.txt

or a width and height so that a random grid can be used:

    life generate --width=5 --height=5


text:
#ifndef __GST_SOUP_UTILS_H__
#define __GST_SOUP_UTILS_H__

#include <glib.h>
#include <gst/gst.h>
#include <libsoup/soup.h>

G_BEGIN_DECLS

void gst_soup_util_log_setup (SoupSession * session, SoupLoggerLogLevel level,
    GstElement * element);

G_END_DECLS

#endif


text:
var dateFormat = "YYYY-MMM-DD HH:NN:SS"

jQuery(document).ready(function ($){

    var dataProvider = new Array();

	//Parse the data Object
    $.each(data, function(index, value){

    	//Add to the Dataprovider
    	dataProvider.push({
    		date: new Date(value._id),
    		value: value.count
    	});
	});

	//Activate Amcharts
	AmCharts.makeChart("chartdiv", {
		"type": "serial",
		"theme": "none",
		"pathToImages": "http://www.amcharts.com/lib/3/images/",
		"dataProvider": dataProvider,
		"graphs": [{
			"id": "g1",
		    "bullet": "round",
		    "bulletBorderAlpha": 1,
		    "bulletColor": "#FFFFFF",
		    "bulletSize": 5,
		    "hideBulletsCount": 50,
		    "lineThickness": 2,
		    "title": "red line",
		    "useLineColorForBulletBorder": true,
		    "valueField": "value",
			"type": "smoothedLine"
		}],
		"chartScrollbar": {
			"graph": "g1",
			"scrollbarHeight": 30
		},
		"chartScrollbar": {},
		"chartCursor": {
		    "categoryBalloonDateFormat": dateFormat,
		    "cursorAlpha": 0,
		    "cursorPosition": "mouse"
		},
		"dataDateFormat": dateFormat,
		"categoryField": "date",
		"categoryAxis": {
			"minPeriod": "fff",
			"parseDates": true,
		    "minorGridAlpha": 0.1,
		    "minorGridEnabled": true
		}
	});
});


text:
// GEOMETRY TEST . JAVA

package cat.calidos.doodles;

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

public class GeometryTest {

private static final double FLOAT_SENSITIVTY = 0.000001;

@Test @DisplayName("Line with most points in a two dimensional graph")
public void lineWithMostPointsTest() {

/*

 A				B
 1,0---------->1,1
  ^				^
  |				|
  |				|
 0,0--0,0.5--->0,1
 C		D		E
 Line should be
 p:0,0;v=0,1

 */

	Graph<Point> g = new Graph<Point>();
	Point a = new Point((float)1.0, (float)0.0);
	g.addVertex(a);
	Point b = new Point((float)1.0, (float)1.0);
	g.addVertex(b);
	Point c = new Point((float)0.0, (float)0.0);
	g.addVertex(c);
	Point d = new Point((float)0.0, (float)0.5);
	g.addVertex(d);
	Point e = new Point((float)0.0, (float)1.0);
	g.addVertex(e);

	g.addEdge(e, b);
	g.addEdge(c, a);
	g.addEdge(c, d);
	g.addEdge(d, e);
	g.addEdge(e, b);

	Line line = Geometry.lineWithMostPoints(g);
	// 0,0--0,0.5--->0,1
	assertEquals(0.0, line.p.x);
	assertEquals(0.0, line.p.y);
	assertEquals(0.0, line.v.x);
	assertEquals(1.0, line.v.y);

	// now let's add more diagonal nodes so the diagonal wins
	Point f = new Point((float)1.1, (float)1.1);
	g.addVertex(f);
	Point h = new Point((float)2.0, (float)2.0);
	g.addVertex(h);
	Point i = new Point((float)3.0, (float)3.0);
	g.addVertex(i);
	line = Geometry.lineWithMostPoints(g);
	assertTrue(Math.abs(1.1-line.p.x)<FLOAT_SENSITIVTY);
	assertTrue(Math.abs(1.1-line.p.y)<FLOAT_SENSITIVTY);
	Point expected = Geometry.vectorFrom(new Point((float)0.0, (float)0.0), new Point((float)1.0, (float)1.0));
	assertEquals(expected.x, line.v.x);
	assertEquals(expected.y, line.v.y);
}

}

/*
 *	  Copyright 2021 Daniel Giribet
 *
 *	 Licensed under the Apache License, Version 2.0 (the "License");
 *	 you may not use this file except in compliance with the License.
 *	 You may obtain a copy of the License at
 *
 *		 http://www.apache.org/licenses/LICENSE-2.0
 *
 *	 Unless required by applicable law or agreed to in writing, software
 *	 distributed under the License is distributed on an "AS IS" BASIS,
 *	 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *	 See the License for the specific language governing permissions and
 *	 limitations under the License.
 */


text:
require 'sumpter/commands'
require 'sumpter/dialog'

module Sumpter
  module Actions
    # TODO: Grow mapping of login methods=>commands; solve when we implement a non-u/p method
    def auth(user, pass)
      @handler.perform_action { |capabilities|
        p = capabilities.index { |lmnt| /^auth[ =]/i.match lmnt }
        eligible = []
        if p
          match = /auth[ =](.*)/i.match capabilities[p]
          methods = match[0].split(" ")
          eligible = methods.select { |lmnt| ['PLAIN', 'LOGIN'].include?(lmnt.upcase) }
        end

        if eligible.empty?
          raise DialogException.new('No compatible auth method')
        end

        case eligible[0]
        when "LOGIN"
          [ LoginAuthCommand.new(user, pass) ] * 2
        when "PLAIN"
          PlainAuthCommand.new(user, pass)
        end
      }
    end

    def mail(payload, from, *to)
      @handler.perform_action { |capabilities|
        [
          MailCommand.new(from),
          *to.map { |recipient| RcptCommand.new(recipient) },
          DataCommand.new,
          PayloadCommand.new(payload)
        ]
      }
    end
  end
end


text:
package com.scienceminer.nerd.kb;

import org.junit.Before;
import org.junit.Test;

import java.util.List;

public class KBUtilitiesTest {

	//private LowerKnowledgeBase wikipedia = null;

	@Before
	public void setUp() {
		try {
        	UpperKnowledgeBase.getInstance();
        	//wikipedia = UpperKnowledgeBase.getInstance().getWikipediaConf("en");
        } catch(Exception e) {
        	e.printStackTrace();
        }
	}

	@Test
	public void testImmediateTaxonParents() {
		try {
			List<String> parents = UpperKnowledgeBase.getInstance().getParentTaxons("Q7377");
System.out.println(parents);
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	@Test
	public void testFullTaxonParents() {
		try {
			List<String> parents = UpperKnowledgeBase.getInstance().getFullParentTaxons("Q18498");
System.out.println("Q18498: " + parents);

			parents = UpperKnowledgeBase.getInstance().getFullParentTaxons("Q3200306");
System.out.println("Q3200306: " + parents);
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	@Test
	public void testKingdomMethods() {
		try {
			boolean isAnimal = KBUtilities.isAnimal("Q18498");
			System.out.println("Q18498.isAnimal = " + isAnimal);

			isAnimal = KBUtilities.isAnimal("Q3200306");
			System.out.println("Q3200306.isAnimal = " + isAnimal);
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	/*@After
	public void testClose() {
		try {
			wikipedia.close();
		} catch(Exception e) {
			e.printStackTrace();
		}
	}*/
}