text:
---
layout: post
title: "More Siamese Network Evaluation Fails with FastAI"
description: "This tutorial describes how not to evaluate siamese networks with the FastAI library"
feature-img: "assets/img/rainbow.jpg"
thumbnail: "assets/img/platypus4.jpg"
tags: [FastAI, Neural Networks, Python]
---

I had too many failures for one post, so this post describes **even more** ways not to evaluate models with FastAI.

```python
import ast
import dill
from fastai.vision.all import *
```

```python
learner = load_learner(Path(os.getenv('MODELS')) / 'siamese_catsvdogs.pkl', cpu=False, pickle_module=dill)
```

```python
df = pd.read_csv('siamese_data.csv', index_col=0)
```

```python
df.head()
```

      items
      label
      is_valid

      0
      ['/home/julius/.fastai/data/oxford-iiit-pet/images/keeshond_13.jpg', '/home/julius/.fastai/data/oxford-iiit-pet/images/leonberger_184.jpg']
      False
      False

      1
      ['/home/julius/.fastai/data/oxford-iiit-pet/images/Russian_Blue_175.jpg', '/home/julius/.fastai/data/oxford-iiit-pet/images/Russian_Blue_24.jpg']
      True
      False

      2
      ['/home/julius/.fastai/data/oxford-iiit-pet/images/german_shorthaired_145.jpg', '/home/julius/.fastai/data/oxford-iiit-pet/images/german_shorthaired_147.jpg']
      True
      False

      3
      ['/home/julius/.fastai/data/oxford-iiit-pet/images/beagle_17.jpg', '/home/julius/.fastai/data/oxford-iiit-pet/images/american_bulldog_110.jpg']
      False
      False

      4
      ['/home/julius/.fastai/data/oxford-iiit-pet/images/leonberger_11.jpg', '/home/julius/.fastai/data/oxford-iiit-pet/images/Persian_5.jpg']
      False
      False

```python
df.iloc[0]
```

    items       ['/home/julius/.fastai/data/oxford-iiit-pet/images/keeshond_13.jpg', '/home/julius/.fastai/data/oxford-iiit-pet/images/leonberger_184.jpg']
    label                                                                                False
    is_valid                                                                                False
    Name: 0, dtype: object

In theory you should be able to do `learner.predict(pair_df.iloc[0])`.
This works for simple networks but fails in this case.
Instead, you can just do the first two lines of that function:
```
dl = self.dls.test_dl([item], rm_type_tfms=rm_type_tfms, num_workers=0)
inp, preds, _, dec_preds = self.get_preds(dl=dl, with_input=True, with_decoded=True)
```

```python
dl = learner.dls.test_dl(df)
```

```python
try:
    learner.get_preds(dl=dl, with_input=True)
except (IsADirectoryError, FileNotFoundError) as err:
    print(err)
```

  <progress value='0' class='' max='119' style='width:300px; height:20px; vertical-align: middle;'></progress>
  0.00% [0/119 00:00<?]

    Caught FileNotFoundError in DataLoader worker process 0.
    Original Traceback (most recent call last):
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop
        data = fetcher.fetch(index)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 39, in fetch
        data = next(self.dataset_iter)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/load.py", line 140, in create_batches
        yield from map(self.do_batch, self.chunkify(res))
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/basics.py", line 230, in chunked
        res = list(itertools.islice(it, chunk_sz))
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/load.py", line 155, in do_item
        try: return self.after_item(self.create_item(s))
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/load.py", line 162, in create_item
        if self.indexed: return self.dataset[s or 0]
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/core.py", line 557, in __getitem__
        res = tuple([tl[it] for tl in self.tls])
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/core.py", line 557, in <listcomp>
        res = tuple([tl[it] for tl in self.tls])
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/core.py", line 509, in __getitem__
        return self._after_item(res) if is_indexer(idx) else res.map(self._after_item)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/core.py", line 455, in _after_item
        return self.tfms(o)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 299, in __call__
        return compose_tfms(o, tfms=self.fs, split_idx=self.split_idx)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 234, in compose_tfms
        x = f(x, **kwargs)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 117, in __call__
        return self._call("encodes", x, **kwargs)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 132, in _call
        return self._do_call(getattr(self, fn), x, **kwargs)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 139, in _do_call
        return retain_type(f(x, **kwargs), x, ret)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/dispatch.py", line 161, in __call__
        return f(*args, **kwargs)
      File "/tmp/ipykernel_15574/1954726133.py", line 235, in create
      File "/tmp/ipykernel_15574/1954726133.py", line -1, in <genexpr>
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/vision/core.py", line 185, in create
        return cls(load_image(fn, **merge(cls._open_args, kwargs)))
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/vision/core.py", line 151, in load_image
        im = Image.open(fn)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/PIL/Image.py", line 3046, in open
        fp = builtins.open(filename, "rb")
    FileNotFoundError: [Errno 2] No such file or directory: '['

Converting to a tuple also doesn't help.

```python
df['items'] = df['items'].apply(ast.literal_eval)
```

```python
dl = learner.dls.test_dl(df)
```

```python
try:
    learner.get_preds(dl=dl, with_input=True)
except (IsADirectoryError, FileNotFoundError, AttributeError) as err:
    print(err)
```

  <progress value='0' class='' max='119' style='width:300px; height:20px; vertical-align: middle;'></progress>
  0.00% [0/119 00:00<?]

    Caught AttributeError in DataLoader worker process 0.
    Original Traceback (most recent call last):
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/PIL/Image.py", line 3050, in open
        fp.seek(0)
    AttributeError: 'list_iterator' object has no attribute 'seek'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop
        data = fetcher.fetch(index)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 39, in fetch
        data = next(self.dataset_iter)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/load.py", line 140, in create_batches
        yield from map(self.do_batch, self.chunkify(res))
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/basics.py", line 230, in chunked
        res = list(itertools.islice(it, chunk_sz))
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/load.py", line 155, in do_item
        try: return self.after_item(self.create_item(s))
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/load.py", line 162, in create_item
        if self.indexed: return self.dataset[s or 0]
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/core.py", line 557, in __getitem__
        res = tuple([tl[it] for tl in self.tls])
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/core.py", line 557, in <listcomp>
        res = tuple([tl[it] for tl in self.tls])
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/core.py", line 509, in __getitem__
        return self._after_item(res) if is_indexer(idx) else res.map(self._after_item)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/core.py", line 455, in _after_item
        return self.tfms(o)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 299, in __call__
        return compose_tfms(o, tfms=self.fs, split_idx=self.split_idx)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 234, in compose_tfms
        x = f(x, **kwargs)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 117, in __call__
        return self._call("encodes", x, **kwargs)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 132, in _call
        return self._do_call(getattr(self, fn), x, **kwargs)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 139, in _do_call
        return retain_type(f(x, **kwargs), x, ret)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/dispatch.py", line 161, in __call__
        return f(*args, **kwargs)
      File "/tmp/ipykernel_15574/1954726133.py", line 235, in create
      File "/tmp/ipykernel_15574/1954726133.py", line -1, in <genexpr>
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/vision/core.py", line 185, in create
        return cls(load_image(fn, **merge(cls._open_args, kwargs)))
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/vision/core.py", line 151, in load_image
        im = Image.open(fn)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/PIL/Image.py", line 3052, in open
        fp = io.BytesIO(fp.read())
    AttributeError: 'list_iterator' object has no attribute 'read'

```python
df['items'] = df['items'].apply(lambda x: tuple(x))
```

```python
df.head()
```

      items
      label
      is_valid

      0
      (/home/julius/.fastai/data/oxford-iiit-pet/images/keeshond_13.jpg, /home/julius/.fastai/data/oxford-iiit-pet/images/leonberger_184.jpg)
      False
      False

      1
      (/home/julius/.fastai/data/oxford-iiit-pet/images/Russian_Blue_175.jpg, /home/julius/.fastai/data/oxford-iiit-pet/images/Russian_Blue_24.jpg)
      True
      False

      2
      (/home/julius/.fastai/data/oxford-iiit-pet/images/german_shorthaired_145.jpg, /home/julius/.fastai/data/oxford-iiit-pet/images/german_shorthaired_147.jpg)
      True
      False

      3
      (/home/julius/.fastai/data/oxford-iiit-pet/images/beagle_17.jpg, /home/julius/.fastai/data/oxford-iiit-pet/images/american_bulldog_110.jpg)
      False
      False

      4
      (/home/julius/.fastai/data/oxford-iiit-pet/images/leonberger_11.jpg, /home/julius/.fastai/data/oxford-iiit-pet/images/Persian_5.jpg)
      False
      False

```python
dl = learner.dls.test_dl(df)
```

```python
try:
    learner.get_preds(dl=dl, with_input=True)
except (IsADirectoryError, FileNotFoundError, AttributeError) as err:
    print(err)
```

  <progress value='0' class='' max='119' style='width:300px; height:20px; vertical-align: middle;'></progress>
  0.00% [0/119 00:00<?]

    Caught IsADirectoryError in DataLoader worker process 0.
    Original Traceback (most recent call last):
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop
        data = fetcher.fetch(index)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 39, in fetch
        data = next(self.dataset_iter)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/load.py", line 140, in create_batches
        yield from map(self.do_batch, self.chunkify(res))
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/basics.py", line 230, in chunked
        res = list(itertools.islice(it, chunk_sz))
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/load.py", line 155, in do_item
        try: return self.after_item(self.create_item(s))
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/load.py", line 162, in create_item
        if self.indexed: return self.dataset[s or 0]
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/core.py", line 557, in __getitem__
        res = tuple([tl[it] for tl in self.tls])
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/core.py", line 557, in <listcomp>
        res = tuple([tl[it] for tl in self.tls])
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/core.py", line 509, in __getitem__
        return self._after_item(res) if is_indexer(idx) else res.map(self._after_item)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/data/core.py", line 455, in _after_item
        return self.tfms(o)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 299, in __call__
        return compose_tfms(o, tfms=self.fs, split_idx=self.split_idx)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 234, in compose_tfms
        x = f(x, **kwargs)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 117, in __call__
        return self._call("encodes", x, **kwargs)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 132, in _call
        return self._do_call(getattr(self, fn), x, **kwargs)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 141, in _do_call
        res = tuple(self._do_call(f, x_, **kwargs) for x_ in x)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 141, in <genexpr>
        res = tuple(self._do_call(f, x_, **kwargs) for x_ in x)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/transform.py", line 139, in _do_call
        return retain_type(f(x, **kwargs), x, ret)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastcore/dispatch.py", line 161, in __call__
        return f(*args, **kwargs)
      File "/tmp/ipykernel_15574/1954726133.py", line 235, in create
      File "/tmp/ipykernel_15574/1954726133.py", line -1, in <genexpr>
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/vision/core.py", line 185, in create
        return cls(load_image(fn, **merge(cls._open_args, kwargs)))
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/fastai/vision/core.py", line 151, in load_image
        im = Image.open(fn)
      File "/home/julius/miniconda3/envs/pt2/lib/python3.10/site-packages/PIL/Image.py", line 3046, in open
        fp = builtins.open(filename, "rb")
    IsADirectoryError: [Errno 21] Is a directory: '/'

```python

```


text:
import hashlib

from django.contrib.staticfiles.management.commands import collectstatic

from cumulus.storage import CumulusStorage

class Command(collectstatic.Command):

    def delete_file(self, path, prefixed_path, source_storage):
        """
        Checks if the target file should be deleted if it already exists
        """
        if isinstance(self.storage, CumulusStorage):
            if self.storage.exists(prefixed_path):
                try:
                    etag = self.storage._get_object(prefixed_path).etag
                    digest = "{0}".format(hashlib.md5(source_storage.open(path).read()).hexdigest())
                    if etag == digest:
                        self.log(u"Skipping '{0}' (not modified based on file hash)".format(path))
                        return False
                except:
                    raise
        return super(Command, self).delete_file(path, prefixed_path, source_storage)

redpajama_set_name: RedPajamaGithub


text:
using Prism.Regions;
using System.Windows.Controls;

namespace Lib.Cosmos.Windows
{

    public abstract class SceneControl : UserControl, IRegionMemberLifetime
    {
        public bool KeepAlive
        {
            get { return false; }
        }
    }
}


text:
use crate::domain::entity::coupon::Coupon;

pub trait CouponRepo {
    fn get_by_code(&self, code: &str) -> Option<Coupon>;
}

pub struct CouponRepoDatabase {}

impl CouponRepo for CouponRepoDatabase {
    fn get_by_code(&self, _code: &str) -> Option<Coupon> {
        // db.query!("select * from coupon where coupon.code = '{}'", code);
        return None;
    }
}


text:
package bsh;

/**
	UtilTargetError is an error corresponding to a TargetError but thrown by a
	utility or other class that does not have the caller context (Node)
	available to it.  See UtilEvalError for an explanation of the difference
	between UtilEvalError and EvalError.
	<p>

	@see UtilEvalError
*/
public class UtilTargetError extends UtilEvalError
{
	public Throwable t;

	public UtilTargetError( String message, Throwable t ) {
		super( message );
		this.t = t;
	}

	public UtilTargetError( Throwable t ) {
		this( null, t );
	}

	/**
		Override toEvalError to throw TargetError type.
	*/
	public EvalError toEvalError(
		String msg, SimpleNode node, CallStack callstack  )
	{
		if ( msg == null )
			msg = getMessage();
		else
			msg = msg + ": " + getMessage();

		return new TargetError( msg, t, node, callstack, false );
	}
}


text:
{{ define "title"}}
<title>{{ .Title }} - {{ strings.FirstUpper .Section }} -  {{ .Site.Title}}</title>
{{ end }}

{{ define "head" }}
{{ range .AlternativeOutputFormats -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
{{ end -}}
<meta property="og:title" content="{{ .Site.Title }} - {{ strings.FirstUpper .Section }}: {{ .Title }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:image" content="" />
{{with .Params.meta}}
<meta property="og:description" content="{{.}}">
<meta name="description" content="{{.}}">
{{end}}
{{ end }}

{{ define "main" }}

{{ .Title }} ({{ len .Pages }})

      {{ range (.Paginator 20).Pages }}
      {{- partial "post_item.html" . -}}
      {{ end }}

    {{- partial "paginator.html" .Paginator -}}

{{ end }}


text:
package de.unibamberg.minf.dme.pojo;

import java.util.List;

import de.unibamberg.minf.dme.model.base.Identifiable;

public class MappedConceptPojo implements Identifiable {
	private static final long serialVersionUID = -5462724852373673591L;

	private String id;
	private String name;
	private String functionId;
	private List<String> sourceElementIds;
	private List<String> targetElementIds;

	@Override public String getId() { return id; }
	@Override public void setId(String id) { this.id = id; }

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

	public String getFunctionId() { return functionId; }
	public void setFunctionId(String functionId) { this.functionId = functionId; }

	public List<String> getSourceElementIds() { return sourceElementIds; }
	public void setSourceElementIds(List<String> sourceElementIds) { this.sourceElementIds = sourceElementIds; }

	public List<String> getTargetElementIds() { return targetElementIds; }
	public void setTargetElementIds(List<String> targetElementIds) { this.targetElementIds = targetElementIds; }
}


text:
layout: post
episodeNumber: 190
title: LiveShare & IntelliCode
guest: Amanda Silver
guestImage: amanda-silver.jpg
date: 2018-05-14
audioUrl: https://static.msdevshow.com/episodes/msdevshow_0190.mp3
---

### Build 2018

Welcome to the third episode in our series covering Build 2018. We had an amazing opportunity to talk to guests in the Podcast Central Booths alongside the Channel 9 stage. We have a slightly different format for these episodes focusing directly on the content. We hope you enjoy!

### Amanda Silver

Amanda Silver is the Director of Program Management for Visual Studio, VS Code, and other developer tools

- [@amandaksilver](https://twitter.com/amandaksilver)

------------------------------------------------

 - [VS Live Share](https://code.visualstudio.com/blogs/2017/11/15/live-share)
 - [Visual Studio Live Share extension](https://marketplace.visualstudio.com/items?itemName=MS-vsliveshare.vsls-vs)
 - [VS Code Live Share extension](https://marketplace.visualstudio.com/items?itemName=MS-vsliveshare.vsliveshare)

------------------------------

 - [IntelliCode FAQ](https://docs.microsoft.com/en-us/visualstudio/ide/not-in-toc/intellicode-faq)


text:
<?php
return array (
  'Latest activities' => 'Naujausi pasikeitimai',
  'There are no activities yet.' => 'Kol kas nėra jokių pasikeitimų',
);


text:
package com.linkedin.thirdeye.detector.email.filter;

import com.linkedin.thirdeye.datalayer.dto.MergedAnomalyResultDTO;
import java.util.List;
import java.util.Map;

public interface AlertFilter {
  List<String> getPropertyNames();

  void setParameters(Map<String, String> props);

  boolean isQualified(MergedAnomalyResultDTO anomaly);
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Insert title here</title>


text:
package org.devcon.android;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.provider.Settings.Secure;
import android.telephony.TelephonyManager;
import android.text.format.Time;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RatingBar;
import android.widget.TextView;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.MenuItem;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

import org.apache.http.Header;
import org.devcon.android.util.AppConfig;

import static org.devcon.android.util.LogUtil.LOGD;
import static org.devcon.android.util.LogUtil.makeLogTag;

public class FeedbackActivity extends SherlockActivity {

    private static final String TAG = makeLogTag(FeedbackActivity.class);
    private String talkID, talkTime, talkTitle, talkSpeaker, talkDescription;
    private ActionBar ab;
    private RatingBar overall, useful, content, speaker;
    private Button submit;
    private EditText msg;
    private final RequestParams params = new RequestParams();
    private TelephonyManager tele;
    private PackageInfo manager;
    private final AsyncHttpClient client = new AsyncHttpClient();
    private ProgressDialog pg;
    private TextView title;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_feedback);
        pg = new ProgressDialog(getApplicationContext());
        tele = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

        getData();

        ab = getSupportActionBar();
        ab.setTitle(talkTitle);
        ab.setSubtitle(getResources().getString(R.string.subtitle));
        ab.setDisplayHomeAsUpEnabled(true);
        ab.setHomeButtonEnabled(true);
        ab.setIcon(R.drawable.logo_copy);

        overall = (RatingBar) findViewById(R.id.ratingQ1);
        useful = (RatingBar) findViewById(R.id.ratingQ2);
        content = (RatingBar) findViewById(R.id.ratingQ3);
        speaker = (RatingBar) findViewById(R.id.ratingQ4);
        submit = (Button) findViewById(R.id.btnSubmit);
        msg = (EditText) findViewById(R.id.edSubmit);
        title = (TextView) findViewById(R.id.tvTalkTitle);

        title.setText(talkTitle);

        submit.setOnClickListener(new AdapterView.OnClickListener() {
            @Override
            public void onClick(View v) {

                try {
                    manager = getPackageManager().getPackageInfo(
                            getPackageName(), 0);
                } catch (NameNotFoundException e) {
                    e.printStackTrace();
                }

                params.put("android_id", Secure.getString(
                        getApplicationContext().getContentResolver(),
                        Secure.ANDROID_ID));
                Time now = new Time();
                now.setToNow();
                String versionName = manager.versionName;
                params.put(getResources().getString(R.string.overall_rating),
                        (int) overall.getRating());
                params.put(getResources().getString(R.string.useful),
                        (int) useful.getRating());
                params.put(getResources().getString(R.string.content),
                        (int) content.getRating());
                params.put(getResources().getString(R.string.speaker),
                        (int) speaker.getRating());

                // that sucks but it works
                params.put("anything", "" + msg.getText());
                LOGD(TAG, "anything " + msg.getText());

                params.put(getResources().getString(R.string.package_name),
                        getApplicationContext().getPackageName());
                params.put(getResources().getString(R.string.version_name),
                        versionName);
                params.put(getResources().getString(R.string.current_time),
                        now.toString());
                params.add(getResources().getString(R.string.network_name),
                        String.valueOf(tele.getNetworkType()));
                params.add(getResources().getString(R.string.phone_type),
                        String.valueOf(tele.getPhoneType()));
                params.put(getResources().getString(R.string.api),
                        android.os.Build.VERSION.SDK_INT);
                params.put(getResources().getString(R.string.model),
                        android.os.Build.MODEL);
                params.put(getResources().getString(R.string.vendor),
                        android.os.Build.MANUFACTURER);

                String url = AppConfig.FEEDBACKS_URL;

                client.post(url, params, new AsyncHttpResponseHandler() {
                    @Override
                    public void onStart() {
                        super.onStart();
                        pg = ProgressDialog.show(FeedbackActivity.this, "",
                                "Sending Feedback", true, true,
                                new DialogInterface.OnCancelListener() {
                                    @Override
                                    public void onCancel(DialogInterface dialog) {
                                        // cancel the request on back press
                                        // I hope it works ^_^
                                        client.cancelRequests(
                                                getApplicationContext(), true);
                                    }
                                });
                    }

                    @Override
                    public void onSuccess(int statusCode, Header[] headers,
                                          String content) {
                        LOGD(TAG, "Status code : " + statusCode);
                        if (statusCode == 201) {
                            pg.dismiss();
                            finish();
                        }
                    }
                });
            }
        });

    }

    public void getData() {
        if (getIntent().hasExtra("talkID"))
            talkID = getIntent().getExtras().getString("talkID");
        if (getIntent().hasExtra("talkTime"))
            talkTime = getIntent().getExtras().getString("talkTime");
        if (getIntent().hasExtra("talkTitle"))
            talkTitle = getIntent().getExtras().getString("talkTitle");
        if (getIntent().hasExtra("talkSpeaker"))
            talkSpeaker = getIntent().getExtras().getString("talkSpeaker");
        if (getIntent().hasExtra("talkDesc"))
            talkDescription = getIntent().getExtras().getString("talkDesc");
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                onBackPressed();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

}


text:
<?= $this->user->help('members') ?>

<?= $this->title ?>

      Export:
        <?php foreach ($this->groups as $group): ?>
          <?= html::anchor('members/export/'. $group->static_key, $group->name, array('title' => "Export {$group->name} members")) ?> |
        <?php endforeach ?>
        <?= html::anchor('members/export/all', 'All Members', array('title' => "Export All Members")) ?>

          <?php foreach ($this->groups as $group): ?>

<?= html::anchor('members/'. $group->static_key, $group->name .' ('. $this->type_count[$group->static_key] .')', array('class' => $this->type == $group->static_key ? 'active' : '')) ?>

          <?php endforeach ?>

<?= html::anchor('members/leadership', 'Leadership ('. $this->type_count['leadership'] .')', array('class' => $this->type == 'leadership' ? 'active' : '')) ?>

<?= html::anchor('members/all', 'All Members ('. $this->type_count['all'] .')', array('class' => $this->type == 'all' ? 'active' : '')) ?>

      <div id="members" class="type-<?= $this->type ?>">
        <?php if ($_GET['major']): ?>

Showing <?= $_GET['major'] ?> majors. <?= html::anchor(Router::$current_uri, 'Close') ?>

        <?php endif ?>
        <?php if ($_GET['department']): ?>

Showing members who studied <?= $_GET['department'] ?>. <?= html::anchor(Router::$current_uri, 'Close') ?>

        <?php endif ?>

        <?php if ($this->members->count()): ?>
          <?php foreach ($this->members as $member): ?>
            <?php if ($this->type == 'leadership'): ?>

                <?= $member->profile->position ?>

            <?php endif ?>

              <?php if ($member->profile->shirt_size): ?>

<?= $member->shirt_size(FALSE) ?>

              <?php endif ?>

                <?= html::anchor('profile/'. $member->id, theme::image('small', $member->picture())) ?>

                <?= $member->name(true) ?>

                <?= format::phone($member->profile->phone) ?>

                <?= $member->email(TRUE) ?>

                <?= $member->profile->address() ?>

                <?php if ($member->profile->school_year): ?>

<?= $member->profile->school_year ?>

                <?php endif ?>

                  <?php if ($member->profile->initiation_year): ?>
                    Initiated: <?= $member->profile->initiation_year ?>
                  <?php endif ?>
                  <?php if ($member->profile->scroll_number): ?>
                    <?php if ($member->profile->initiation_year): ?>
                      ·
                    <?php endif ?>
                    Scroll #<?= number_format($member->profile->scroll_number) ?>
                  <?php endif ?>

              <?php if ($member->profile->student_id && $this->admin): ?>

ID#: <?= $member->profile->student_id; ?>

              <?php endif ?>

          <?php endforeach;?>
        <?php else: ?>
          <?php if ($this->type == 'leadership'): ?>

Chapter Leaders have not been assigned

              <?php if (A2::instance()->allowed('user', 'manage')): ?>

Use the "<?= html::anchor('members/admin', 'Manage Members') ?>" form to update your chapter roster information.

              <?php endif ?>

          <?php else: ?>

<?= Kohana::lang('members.no_results.'. $this->type) ?>

          <?php endif ?>
        <?php endif?>

          <?php if ($this->type != 'leadership'): ?>

              <?= form::open(NULL, array('method' => 'get')) ?>
              <?= form::input('name', $this->form['name']) ?>
              <?= form::submit('', 'Search') ?>
              <?php if ($this->form['name']): ?>

                <?php if ($this->type == 'active'): ?>
                  <?= html::anchor('members', 'clear results') ?>
                <?php else: ?>
                  <?= html::anchor('members/'. $this->type, 'clear results') ?>
                <?php endif ?>
              <?php endif ?>
              <?= form::close() ?>

          <?php endif ?>

          <?php if ($this->stats['types']): ?>

Member Types

                <?php foreach ($this->stats['types'] as $key => $value): ?>

                    <?= ucwords(inflector::plural($this->types[$key])) ?>:<?= $value ?>

                <?php endforeach ?>

          <?php endif ?>

          <?php if ($this->stats['shirt_size']): ?>

Shirt Sizes

                <?php foreach ($this->stats['shirt_size'] as $key => $value): ?>

                    <?php if ($key): ?>
                      <?= $this->sizes[$key] ?>:<?= $value ?>
                    <?php endif ?>

                <?php endforeach ?>

          <?php endif ?>

          <?php if ($this->stats['year']): ?>

School Years

First Year:<?= number_format($this->stats['year']['First Year']) ?>

Second Year:<?= number_format($this->stats['year']['Second Year']) ?>

Third Year:<?= number_format($this->stats['year']['Third Year']) ?>

Fourth Year:<?= number_format($this->stats['year']['Fourth Year']) ?>

Super Senior:<?= number_format($this->stats['year']['Super Senior']) ?>

Alumni:<?= number_format($this->stats['year']['Alumni']) ?>

          <?php endif ?>

          <?php if ($this->stats['initiation_year']): ?>

Initiation Years

                <?php foreach ($this->stats['initiation_year'] as $class): ?>
                  <?php if ($class['name']): ?>

<?= ucwords($class['name']) ?>:<?= $class['count'] ?>

                  <?php endif ?>
                <?php endforeach ?>

          <?php endif ?>

          <?php if ($this->stats['departments']): ?>

Schools/Departments

                <?php foreach ($this->stats['departments'] as $key => $value): ?>
                  <?php if ($key): ?>

<?= html::anchor(Router::$current_uri .'?department='.urlencode($key), $key) ?>:	<?= $value ?>

                  <?php endif ?>
                <?php endforeach ?>

          <?php endif ?>

          <?php if ($this->stats['majors']): ?>

Majors

                <?php foreach ($this->stats['majors'] as $key => $value): ?>
                  <?php if ($key): ?>

                      <?= html::anchor(Router::$current_uri .'?major='.urlencode($key), $key) ?>	<?= $value ?>

                  <?php endif ?>
                <?php endforeach ?>

          <?php endif ?>


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">

<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>MPI_Allgather</TITLE>

MPI_Allgather

Gathers data from all tasks and distribute the combined data to all tasks

Synopsis

int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
                  void *recvbuf, int recvcount, MPI_Datatype recvtype,
                  MPI_Comm comm)

Input Parameters

sendbuf
starting address of send buffer (choice)

sendcount
number of elements in send buffer (integer)

sendtype
data type of send buffer elements (handle)

recvcount
number of elements received from any process (integer)

recvtype
data type of receive buffer elements (handle)

comm
communicator (handle)

Output Parameter

recvbuf
 address of receive buffer (choice)

Notes

The MPI standard (1.0 and 1.1) says that

The jth block of data sent from  each process is received by every process
and placed in the jth block of the buffer <TT>recvbuf</TT>.

This is misleading; a better description is

The block of data sent from the jth process is received by every
process and placed in the jth block of the buffer <TT>recvbuf</TT>.

This text was suggested by Rajeev Thakur and has been adopted as a
clarification by the MPI Forum.

Thread and Interrupt Safety

This routine is thread-safe.  This means that this routine may be
safely used by multiple threads without the need for any user-provided
thread locks.  However, the routine is not interrupt safe.  Typically,
this is due to the use of memory allocation routines such as <TT>malloc
</TT>or other non-MPICH runtime routines that are themselves not interrupt-safe.

Notes for Fortran

All MPI routines in Fortran (except for <TT>MPI_WTIME</TT> and <TT>MPI_WTICK</TT>) have
an additional argument <TT>ierr</TT> at the end of the argument list.  <TT>ierr
</TT>is an integer and has the same meaning as the return value of the routine
in C.  In Fortran, MPI routines are subroutines, and are invoked with the
<TT>call</TT> statement.

All MPI objects (e.g., <TT>MPI_Datatype</TT>, <TT>MPI_Comm</TT>) are of type <TT>INTEGER
</TT>in Fortran.

Errors

All MPI routines (except <TT>MPI_Wtime</TT> and <TT>MPI_Wtick</TT>) return an error value;
C routines as the value of the function and Fortran routines in the last
argument.  Before the value is returned, the current MPI error handler is
called.  By default, this error handler aborts the MPI job.  The error handler
may be changed with <TT>MPI_Comm_set_errhandler</TT> (for communicators),
<TT>MPI_File_set_errhandler</TT> (for files), and <TT>MPI_Win_set_errhandler</TT> (for
RMA windows).  The MPI-1 routine <TT>MPI_Errhandler_set</TT> may be used but
its use is deprecated.  The predefined error handler
<TT>MPI_ERRORS_RETURN</TT> may be used to cause error values to be returned.
Note that MPI does not guarentee that an MPI program can continue past
an error; however, MPI implementations will attempt to continue whenever
possible.

MPI_ERR_COMM
 Invalid communicator.  A common error is to use a null
communicator in a call (not even allowed in <TT>MPI_Comm_rank</TT>).

MPI_ERR_COUNT
 Invalid count argument.  Count arguments must be
non-negative; a count of zero is often valid.

MPI_ERR_TYPE
 Invalid datatype argument.  May be an uncommitted
MPI_Datatype (see <TT>MPI_Type_commit</TT>).

MPI_ERR_BUFFER
 Invalid buffer pointer.  Usually a null buffer where
one is not valid.

Location:allgather.c


text:
package br.com.pacdev.reader;

import java.net.Authenticator;
import java.net.InetAddress;
import java.net.PasswordAuthentication;

public class CustomAuthenticator extends Authenticator {
	private String username = null;
	private String password = null;
	public CustomAuthenticator(String username, String password){
		this.username = username;
		this.password = password;
	}
	protected PasswordAuthentication getPasswordAuthentication() {
		// Get information about the request
		//String prompt = getRequestingPrompt();
		//String hostname = getRequestingHost();
		//InetAddress ipaddr = getRequestingSite();
		//int port = getRequestingPort();
		return new PasswordAuthentication(this.username, this.password.toCharArray());
	}
}


text:
import _ from 'lodash';
import * as api from '../../api';
import { sessions } from '../../middlewares/auth';
import { Middleware } from '../../types/bot';
import type { User, IncomingMessage } from 'telegraf/typings/telegram-types';

const command: Middleware = async (ctx) => {
  const username = _.toString(ctx.state.command.splitArgs[0]);
  const password = _.toString(ctx.state.command.splitArgs[1]);

  const id = (ctx.from as User).id;
  const user = await api.getUserById(id);
  if (user.authenticated) {
    ctx.reply(
      `You can't create a new user, since this Telegram account is already registered to user *${user.username}*.`,
      { parse_mode: 'Markdown' },
    );
    return;
  }

  if (username && password) {
    if (_.size(username) < 3 || _.size(username) > 20) {
      ctx.reply('Username has to be between 3 and 20 characters.');
      return;
    }

    if (_.size(password) < 4) {
      ctx.reply('Password has to be atleast 4 characters.');
      return;
    }

    if (_.size(password) > 255) {
      ctx.reply('Password has to be less than 255 characters.');
      return;
    }

    try {
      await api.createUser(username, password);
      await api.saveIdForUser(username, id);
      sessions[id] = username;

      ctx.reply(
        `You've successfully created a new account called *${username}*. ` +
          'Now you can join groups with command `/join`.\n\n' +
          '*NOTE*: You should delete the previous message so your password ' +
          "won't get into wrong hands.",
        { parse_mode: 'Markdown' },
      );
    } catch (err) {
      if (
        _.includes(_.get(err, 'response.data.error.message'), 'already exists')
      ) {
        ctx.reply(
          `Username *${username}* already exists. Please choose another one.`,
          { parse_mode: 'Markdown' },
        );
      } else if (
        _.includes(_.get(err, 'response.data.error.message'), 'alpha-numeric')
      ) {
        ctx.reply(
          'Username must only contain alpha-numeric and underscore characters. Please choose another one.',
          { parse_mode: 'Markdown' },
        );
      } else {
        throw err;
      }
    }
  } else {
    let msg = 'Please use following format: /create `[username]` `[password]`.';
    if ((ctx.message as IncomingMessage).chat.type !== 'private') {
      msg += "I'd prefer to do this in the private chat.";
    }

    ctx.reply(msg, { parse_mode: 'Markdown' });
  }
};

export default command;


text:
(function() {
  'use strict';

  angular
  .module( 'app.services' )
  .service( 'strapAlert', strapModal );

  strapModal.$inject = [ '$alert' ];

  function strapModal( $alert ) {
    var vm = this;

    /* Literals */
    vm.alerObj = null;
    /* Functions */
    vm.alert = alert;
    vm.show  = show;
    vm.hide  = hide;

    function show( title, content, container, type ) {
      vm.alerObj = vm.alert( title, content, container, type );
    }

    function hide() {
      vm.alerObj.hide();
    }

    function alert( title, content, container, type ) {
      var strapAlert = $alert({
        title: title,
        content: content,
        type: type || 'info',
        container: container || 'alert-info',
        show: true
      });

      return strapAlert;
    }
  }
}());


text:
require 'test_helper'

class UserTest < ActiveSupport::TestCase
  def setup
    @user = User.new(name: "Example User", email: "user@example.com",
                     password: "foobar", password_confirmation: "foobar")
  end

  def test_responds
    assert_respond_to @user, :name
    assert_respond_to @user, :email
    assert_respond_to @user, :password_digest
    assert_respond_to @user, :password
    assert_respond_to @user, :password_confirmation
    assert_respond_to @user, :remember_token
    assert_respond_to @user, :authenticate
    assert_respond_to @user, :admin
    assert_respond_to @user, :lists
    assert_respond_to @user, :items
    assert_respond_to @user, :user_list_permissions
  end

  def test_valid
    assert @user.valid?
    assert !@user.admin?

    @user.name = ' '
    assert @user.invalid?
  end

  def test_name
    assert_equal "Example User", @user.name

    @user.name = ' '
    assert @user.invalid?, "User name can't be blank"
  end

  def test_with_admin_attribute_set_to_true
    @user.save!
    @user.toggle!(:admin)
    assert @user.admin?
  end

  def test_when_name_is_not_present
    @user.name = " "
    assert @user.invalid?
  end

  def test_when_name_is_too_long
    @user.name = "a" * 51
    assert @user.invalid?
  end

  def test_when_email_is_not_present
    @user.email = " "
    assert @user.invalid?
  end

  def test_when_email_format_is_invalid
    addresses = %w[user@foo,com user_at_foo.org example.user@foo.
                   foo@bar_baz.com foo@bar+baz.com]
    addresses.each do |invalid_address|
      @user.email = invalid_address
      assert @user.invalid?
    end
  end

  def test_when_email_format_is_valid
    addresses = %w[user@foo.COM A_US-ER@f.b.org frst.lst@foo.jp a+b@baz.cn]
    addresses.each do |valid_address|
      @user.email = valid_address
      assert @user.valid?
    end
  end

  def test_when_email_address_is_already_taken
    user_with_same_email = @user.dup
    user_with_same_email.email = @user.email.upcase
    user_with_same_email.save
    assert @user.invalid?
  end

  def test_email_address_with_mixed_case
    mixed_case_email = "Foo@ExAMPle.CoM"

    @user.email = mixed_case_email
    @user.save
    assert_equal mixed_case_email.downcase, @user.reload.email
  end

  def test_when_password_is_not_present
    @user.password = @user.password_confirmation = " "
    assert @user.invalid?
  end

  def test_when_password_does_not_match_confirmation
    @user.password_confirmation = "mismatch"
    assert @user.invalid?
  end

  def test_when_password_confirmation_is_nil
    @user.password_confirmation = nil
    assert @user.invalid?
  end

  def test_return_value_of_authenticate_method
    @user.save
    found_user = User.find_by_email(@user.email)

    # describe "with valid password" do
    #   it { should == found_user.authenticate(@user.password) }
    # end
    assert_equal @user, found_user.authenticate(@user.password)

    # describe "with invalid password" do
      # let(:user_for_invalid_password) { found_user.authenticate("invalid") }
      user_for_invalid_password = found_user.authenticate("invalid")
      assert_not_equal @user, user_for_invalid_password
      assert !user_for_invalid_password

      # it { should_not == user_for_invalid_password }
      # specify { user_for_invalid_password.should be_false }
    # end
  end

  def test_with_a_password_that_is_too_short
    @user.password = @user.password_confirmation = "a" * 5
    assert @user.invalid?
  end

  def test_remember_token
    @user.save
    assert !@user.remember_token.blank?
  end

  def test_list_associations
    @user.save
    older_list = FactoryGirl.create(:list, user: @user, created_at: 1.day.ago)
    newer_list = FactoryGirl.create(:list, user: @user, created_at: 1.hour.ago)

    # it "should have the right lists in the right order" do
      # @user.lists.should == [newer_list, older_list]
    # end
    assert_equal [newer_list, older_list], @user.lists

    # it "should destroy associated lists" do
    lists = @user.lists.dup
    @user.destroy
    # assert lists.empty?
    assert lists.blank?, "#{lists.inspect} is not blank"
    # end

  end

end


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Syn. conif. 63. 1847

#### Original name
null

### Remarks
null


text:
<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class WorkTableRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'fk_user' => 'required',
            'fk_business' => 'required',
            'description' => 'required|min:5',
            'day' => 'required'
        ];
    }

    public function messages()
    {
        return ['required'=> 'O :attribute é obrigatório'];
    }
}


text:
extern "Java"
{
  namespace javax
  {
    namespace swing
    {
      namespace event
      {
          class DocumentEvent;
          class DocumentEvent$ElementChange;
          class DocumentEvent$EventType;
      }
      namespace text
      {
          class Document;
          class Element;
      }
    }
  }
}

class javax::swing::event::DocumentEvent : public ::java::lang::Object
{

public:
  virtual ::javax::swing::event::DocumentEvent$EventType * getType() = 0;
  virtual jint getOffset() = 0;
  virtual jint getLength() = 0;
  virtual ::javax::swing::text::Document * getDocument() = 0;
  virtual ::javax::swing::event::DocumentEvent$ElementChange * getChange(::javax::swing::text::Element *) = 0;
  static ::java::lang::Class class$;
} __attribute__ ((java_interface));

#endif // __javax_swing_event_DocumentEvent__


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using Microsoft.Common.Core.Diagnostics;
using Microsoft.Languages.Editor.Settings;
using static System.FormattableString;

namespace Microsoft.R.Editor.Validation.Lint {
    public sealed class LintOptions: ILintOptions {
        private readonly Func<IEditorSettingsStorage> _storageAccess;
        private IEditorSettingsStorage _storage;

        private IEditorSettingsStorage Storage => _storage ?? (_storage = _storageAccess());
        private IWritableEditorSettingsStorage WritableStorage => Storage as IWritableEditorSettingsStorage;

        public LintOptions(Func<IEditorSettingsStorage> storageAccess) {
            Check.ArgumentNull(nameof(storageAccess), storageAccess);
            _storageAccess = storageAccess; // Storage is delay-created after package loads
        }

        private string GetKey(string optionName) => Invariant($"LintR_{optionName}");

        /// <summary>
        /// Enable LintR-like checks
        /// </summary>
        public bool Enabled {
            get => Storage.Get(GetKey(nameof(Enabled)), false);
            set => WritableStorage?.Set(GetKey(nameof(Enabled)), value);
        }

        #region Naming
        /// <summary>
        /// Flag camel-case names
        /// </summary>
        public bool CamelCase {
            get => Storage.Get(GetKey(nameof(CamelCase)), false);
            set => WritableStorage?.Set(GetKey(nameof(CamelCase)), value);
        }

        /// <summary>
        /// Flag snake_case
        /// </summary>
        public bool SnakeCase {
            get => Storage.Get(GetKey(nameof(SnakeCase)), false);
            set => WritableStorage?.Set(GetKey(nameof(SnakeCase)), value);
        }

        /// <summary>
        /// Flag Pascal-case names
        /// </summary>
        public bool PascalCase {
            get => Storage.Get(GetKey(nameof(PascalCase)), true);
            set => WritableStorage?.Set(GetKey(nameof(PascalCase)), value);
        }

        /// <summary>
        /// Flag UPPERCASE names
        /// </summary>
        public bool UpperCase {
            get => Storage.Get(GetKey(nameof(UpperCase)), true);
            set => WritableStorage?.Set(GetKey(nameof(UpperCase)), value);
        }

        /// <summary>
        /// Flag names with.multiple.dots.
        /// </summary>
        public bool MultipleDots {
            get => Storage.Get(GetKey(nameof(MultipleDots)), true);
            set => WritableStorage?.Set(GetKey(nameof(MultipleDots)), value);
        }

        /// <summary>
        /// Verify that name lengths are below the limit
        /// </summary>
        public bool NameLength {
            get => Storage.Get(GetKey(nameof(NameLength)), false);
            set => WritableStorage?.Set(GetKey(nameof(NameLength)), value);
        }

        /// <summary>
        /// Max name length
        /// </summary>
        public int MaxNameLength {
            get => Storage.Get(GetKey(nameof(MaxNameLength)), 32);
            set => WritableStorage?.Set(GetKey(nameof(MaxNameLength)), value);
        }

        /// <summary>
        /// Flag 'T' or 'F' used instead of 'TRUE' and 'FALSE'
        /// </summary>
        public bool TrueFalseNames {
            get => Storage.Get(GetKey(nameof(TrueFalseNames)), true);
            set => WritableStorage?.Set(GetKey(nameof(TrueFalseNames)), value);
        }
        #endregion

        #region Assignment
        /// <summary>
        /// Check that '<-' is always used for assignment
        /// </summary>
        public bool AssignmentType {
            get => Storage.Get(GetKey(nameof(AssignmentType)), true);
            set => WritableStorage?.Set(GetKey(nameof(AssignmentType)), value);
        }
        #endregion

        #region Spacing
        /// <summary>
        /// Comma should have space after and no space before unless
        /// followed by another comma or closing brace. Space between
        /// command and ] or ]] is required.
        /// </summary>
        public bool SpacesAroundComma {
            get => Storage.Get(GetKey(nameof(SpacesAroundComma)), true);
            set => WritableStorage?.Set(GetKey(nameof(SpacesAroundComma)), value);
        }

        /// <summary>
        /// Checks that infix operators are surrounded by spaces unless
        /// it is a named parameter assignment
        /// </summary>
        public bool SpacesAroundOperators {
            get => Storage.Get(GetKey(nameof(SpacesAroundOperators)), true);
            set => WritableStorage?.Set(GetKey(nameof(SpacesAroundOperators)), value);
        }

        /// <summary>
        /// Check that } is on a separate line unless followed by 'else'
        /// </summary>
        public bool CloseCurlySeparateLine {
            get => Storage.Get(GetKey(nameof(CloseCurlySeparateLine)), true);
            set => WritableStorage?.Set(GetKey(nameof(CloseCurlySeparateLine)), value);
        }

        /// <summary>
        /// Open brace must have space before it unless it is a function call.
        /// </summary>
        public bool SpaceBeforeOpenBrace {
            get => Storage.Get(GetKey(nameof(SpaceBeforeOpenBrace)), true);
            set => WritableStorage?.Set(GetKey(nameof(SpaceBeforeOpenBrace)), value);
        }

        /// <summary>
        /// There should be no space after (, [ or [[ and no space before ), ] or ]]
        /// unless ] or ]] is preceded by a comma as in x[1, ]
        /// </summary>
        public bool SpacesInsideParenthesis {
            get => Storage.Get(GetKey(nameof(SpacesInsideParenthesis)), true);
            set => WritableStorage?.Set(GetKey(nameof(SpacesInsideParenthesis)), value);
        }

        /// <summary>
        /// Verify that there is no space after the function name.
        /// </summary>
        public bool NoSpaceAfterFunctionName {
            get => Storage.Get(GetKey(nameof(NoSpaceAfterFunctionName)), true);
            set => WritableStorage?.Set(GetKey(nameof(NoSpaceAfterFunctionName)), value);
        }

        /// <summary>
        /// Check that open curly brace is not on its own line
        /// and is followed by a new line.
        /// </summary>
        public bool OpenCurlyPosition {
            get => Storage.Get(GetKey(nameof(OpenCurlyPosition)), true);
            set => WritableStorage?.Set(GetKey(nameof(OpenCurlyPosition)), value);
        }
        #endregion

        #region Whitespace
        /// <summary>
        /// Verify there are no tabs in the file
        /// </summary>
        public bool NoTabs {
            get => Storage.Get(GetKey(nameof(NoTabs)), true);
            set => WritableStorage?.Set(GetKey(nameof(NoTabs)), value);
        }

        /// <summary>
        /// Check there is no trailing whitespace in lines
        /// </summary>
        public bool TrailingWhitespace {
            get => Storage.Get(GetKey(nameof(TrailingWhitespace)), true);
            set => WritableStorage?.Set(GetKey(nameof(TrailingWhitespace)), value);
        }

        /// <summary>
        /// Verify there is no trailing blank lines in the file.
        /// </summary>
        public bool TrailingBlankLines {
            get => Storage.Get(GetKey(nameof(TrailingBlankLines)), true);
            set => WritableStorage?.Set(GetKey(nameof(TrailingBlankLines)), value);
        }
        #endregion

        #region Quotes
        /// <summary>
        /// Verify that only double quotes are used around strings
        /// </summary>
        public bool DoubleQuotes {
            get => Storage.Get(GetKey(nameof(DoubleQuotes)), true);
            set => WritableStorage?.Set(GetKey(nameof(DoubleQuotes)), value);
        }
        #endregion

        #region Text
        /// <summary>
        /// Check line lengths in the file
        /// </summary>
        public bool LineLength {
            get => Storage.Get(GetKey(nameof(LineLength)), false);
            set => WritableStorage?.Set(GetKey(nameof(LineLength)), value);
        }

        /// <summary>
        /// Max line length
        /// </summary>
        public int MaxLineLength {
            get => Storage.Get(GetKey(nameof(MaxLineLength)), 80);
            set => WritableStorage?.Set(GetKey(nameof(MaxLineLength)), value);
        }
        #endregion

        #region Statements
        /// <summary>
        /// Flag semicolons in the file
        /// </summary>
        public bool Semicolons {
            get => Storage.Get(GetKey(nameof(Semicolons)), true);
            set => WritableStorage?.Set(GetKey(nameof(Semicolons)), value);
        }

        /// <summary>
        /// Flag multiple statements in the same line
        /// </summary>
        public bool MultipleStatements {
            get => Storage.Get(GetKey(nameof(MultipleStatements)), true);
            set => WritableStorage?.Set(GetKey(nameof(MultipleStatements)), value);
        }
        #endregion
    }
}


text:
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace NetworkMonitor.Helpers
{
    public static class RegistryHelper
    {
        private const string AppId = "NetworkMonitor";

        private static RegistryKey _runKey = null;

        public static RegistryKey RunKey
        {
            get
            {
                if(_runKey == null)
                {
                    _runKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
                }
                return _runKey;
            }
        }

        public static bool HasStartupKey
        {
            get
            {
                return RunKey.GetValue(AppId) != null;
            }
        }

        public static void AddStartupKey()
        {
            RunKey.SetValue(AppId, string.Format("\"{0}\"", Assembly.GetExecutingAssembly().Location));
        }

        public static void RemoveStartupKey()
        {
            RunKey.DeleteValue(AppId, false);
        }
    }
}


text:
title: Toetav Mõte
date: 02/09/2022
---

Loe Ellen G. White'i raamatust "Tervise teenistuses" peatükki "Tõeliste teadmiste taotlemise olulisus", orig lk 453, 454; raamatust "Ajastute igatsus" peatükki "Mäejutlus", orig lk 298–314; raamatust "Evangelism" peatükki "The Worker and His Qualifications", lk 630.

"Raskusi, millega me kokku puutume, võib leevendada vaoshoitus, nagu oli Kristusel. Kui meil on Õpetaja alandlikkust, oleme üle solvangutest, põlgusest ja meelehärmist, millega me päevast päeva kokku puutume. Need ei muuda meie meelt süngeks. Võimsaim tõend kristlase üllusest on vaoshoitus. See, kes pilke ja julma kohtlemise all ei suuda säilitada rahulikku ja usaldavat meelsust, röövib Jumalalt õiguse näidata tema kaudu oma täiuslikku iseloomu. Südame alandlikkus on jõud, mis annab Kristuse järelkäijatele võidu. See on tõend ühendusest taevaga." – Ellen G. White, "Ajastute igatsus", orig lk 301.

**Küsimused aruteluks:**

`1. Kuidas võimaldab alandlikkus meil "olla üle" haigetsaamisest ja pahandustest? Milline tähtis omadus võimaldab meil sinu meelest alandlikult "üle olla"?`

`2. Kuidas suhtutakse sinu kultuuris alandlikkusse ja tasadusse? Kas sellest peetakse lugu või seda põlastatakse? Millist survet tunned oma kultuuris kõnealuste seloomujoonte arendamise vastu?`

`3. Kas mõni praegu elav inimene on tasaduse ja alandlikkuse suureks eeskujuks? Kui jah, siis kes? Kuidas vastavad jooned neis väljenduvad ja mida saad neilt õppida?`

`4. Miks on nii, et võrdsustame tasaduse ja alandlikkuse pahatihti nõrkusega?`

`5. Näeme, kuidas Taavet otsis pelgupaika Issanda juurest. Kuidas see toimib? Kuidas varjupaik nähtavaks saab? Teisisõnu, kuidas saame kogudusena olla pelgupaigaks neile, kes seda vajavad? Milliseks pelgupaigaks osutub sinu kogudus? Mida saad teha, et muuta see pelgupaigaks neile, kel vaja?`

---

Annetus >> kohalik kogudus [toeta.advent.ee](https://toeta.advent.ee/)

Päikeseloojang 20.17


text:
package edu.isi.karma.rep.alignment;

import edu.isi.karma.modeling.Namespaces;
import edu.isi.karma.modeling.Prefixes;
import edu.isi.karma.modeling.Uris;

public class ClassInstanceLink extends LabeledLink {

	private static final long serialVersionUID = 1L;
	private static final Label label =
			new Label(Uris.CLASS_INSTANCE_LINK_URI, Namespaces.KARMA_DEV, Prefixes.KARMA_DEV);

	public ClassInstanceLink(String id) {
		super(id, label, LinkType.ClassInstanceLink);
	}

	public ClassInstanceLink(String id, LinkKeyInfo keyInfo) {
		super(id, label, LinkType.ClassInstanceLink, keyInfo);
	}

	public static Label getFixedLabel() {
		return label;
	}
}


text:
module com.azure.resourcemanager.datafactory {
    requires transitive com.azure.core.management;

    exports com.azure.resourcemanager.datafactory;
    exports com.azure.resourcemanager.datafactory.fluent;
    exports com.azure.resourcemanager.datafactory.fluent.models;
    exports com.azure.resourcemanager.datafactory.models;

    opens com.azure.resourcemanager.datafactory.fluent.models to
        com.azure.core,
        com.fasterxml.jackson.databind;
    opens com.azure.resourcemanager.datafactory.models to
        com.azure.core,
        com.fasterxml.jackson.databind;
}


text:
package scalaprops
package scalazlaws

import scalaprops.Property.forAll
import scalaprops.Properties.properties
import scalaz._

object applicative {
  def identity[F[_], X](implicit f: Applicative[F], afx: Gen[F[X]], ef: Equal[F[X]]) =
    forAll(f.applicativeLaw.identityAp[X] _)

  def homomorphism[F[_], X, Y](implicit ap: Applicative[F], ax: Gen[X], af: Gen[X => Y], e: Equal[F[Y]]) =
    forAll(ap.applicativeLaw.homomorphism[X, Y] _)

  def interchange[F[_], X, Y](implicit ap: Applicative[F], ax: Gen[X], afx: Gen[F[X => Y]], e: Equal[F[Y]]) =
    forAll(ap.applicativeLaw.interchange[X, Y] _)

  def mapApConsistency[F[_], X, Y](implicit ap: Applicative[F], ax: Gen[F[X]], afx: Gen[X => Y], e: Equal[F[Y]]) =
    forAll(ap.applicativeLaw.mapLikeDerived[X, Y] _)

  def laws[F[_]](implicit F: Applicative[F], af: Gen[F[Int]], aff: Gen[F[Int => Int]], e: Equal[F[Int]]) =
    properties(ScalazLaw.applicative)(
      ScalazLaw.applicativeIdentity -> applicative.identity[F, Int],
      ScalazLaw.applicativeHomomorphism -> applicative.homomorphism[F, Int, Int],
      ScalazLaw.applicativeInterchange -> applicative.interchange[F, Int, Int],
      ScalazLaw.applicativeMapConsistentWithAp -> applicative.mapApConsistency[F, Int, Int]
    )

  def all[F[_]](implicit
    F: Applicative[F],
    af: Gen[F[Int]],
    aff: Gen[F[Int => Int]],
    e: Equal[F[Int]]
  ): Properties[ScalazLaw] =
    Properties.fromProps(ScalazLaw.applicativeAll, applicative.laws[F], apply.all[F])
}


text:
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.ntp;

import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Property;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.FrameLayout;

import org.chromium.chrome.R;
import org.chromium.chrome.browser.ntp.LogoBridge.Logo;
import org.chromium.chrome.browser.ntp.LogoBridge.LogoObserver;
import org.chromium.chrome.browser.widget.LoadingView;

import java.lang.ref.WeakReference;

import jp.tomorrowkey.android.gifplayer.BaseGifDrawable;
import jp.tomorrowkey.android.gifplayer.BaseGifImage;

/**
 * This view shows the default search provider's logo and fades in a new logo if one becomes
 * available. It also maintains a {@link BaseGifDrawable} that will be played when the user clicks
 * this view and we have an animated GIF logo ready.
 */
public class LogoView extends FrameLayout implements OnClickListener {

    // Number of milliseconds for a new logo to fade in.
    private static final int LOGO_TRANSITION_TIME_MS = 400;

    // The default logo is shared across all NTPs.
    private static WeakReference<Bitmap> sDefaultLogo;

    // mLogo and mNewLogo are remembered for cross fading animation.
    private Bitmap mLogo;
    private Bitmap mNewLogo;
    private BaseGifDrawable mAnimatedLogoDrawable;

    private ObjectAnimator mFadeAnimation;
    private Paint mPaint;
    private Matrix mLogoMatrix;
    private Matrix mNewLogoMatrix;
    private Matrix mAnimatedLogoMatrix;
    private boolean mLogoIsDefault;
    private boolean mNewLogoIsDefault;

    private LoadingView mLoadingView;

    /**
     * A measure from 0 to 1 of how much the new logo has faded in. 0 shows the old logo, 1 shows
     * the new logo, and intermediate values show the new logo cross-fading in over the old logo.
     * Set to 0 when not transitioning.
     */
    private float mTransitionAmount;

    private Delegate mDelegate;

    private final Property<LogoView, Float> mTransitionProperty =
            new Property<LogoView, Float>(Float.class, "") {
        @Override
        public Float get(LogoView logoView) {
            return logoView.mTransitionAmount;
        }

        @Override
        public void set(LogoView logoView, Float amount) {
            assert amount >= 0f;
            assert amount <= 1f;
            if (logoView.mTransitionAmount != amount) {
                logoView.mTransitionAmount = amount;
                invalidate();
            }
        }
    };

    /**
     * Handles tasks for the {@link LogoView} shown on an NTP.
     */
    public interface Delegate {
        /**
         * Called when the user clicks on the logo.
         * @param isAnimatedLogoShowing Whether the animated GIF logo is playing.
         */
        void onLogoClicked(boolean isAnimatedLogoShowing);

        /**
         * Gets the default search provider's logo and calls logoObserver with the result.
         * @param logoObserver The callback to notify when the logo is available.
         */
        void getSearchProviderLogo(LogoObserver logoObserver);

        /**
         * Should be called when the owning class is destroyed.
         */
        void destroy();
    }

    /**
     * Constructor used to inflate a LogoView from XML.
     */
    public LogoView(Context context, AttributeSet attrs) {
        super(context, attrs);

        mLogo = getDefaultLogo();
        mLogoMatrix = new Matrix();
        mLogoIsDefault = true;

        mPaint = new Paint();
        mPaint.setFilterBitmap(true);

        // Mark this view as non-clickable so that accessibility will ignore it. When a non-default
        // logo is shown, this view will be marked clickable again.
        setOnClickListener(this);
        setClickable(false);
        setWillNotDraw(false);

        mLoadingView = new LoadingView(getContext());
        LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        lp.gravity = Gravity.CENTER;
        mLoadingView.setLayoutParams(lp);
        mLoadingView.setVisibility(View.GONE);
        addView(mLoadingView);
    }

    /**
     * Sets the {@link Delegate} to notify when the logo is pressed.
     */
    public void setDelegate(Delegate delegate) {
        mDelegate = delegate;
    }

    /**
     * Jumps to the end of the logo cross-fading animation, if any.
     */
    public void endFadeAnimation() {
        if (mFadeAnimation != null) {
            mFadeAnimation.end();
            mFadeAnimation = null;
        }
    }

    /**
     * @return True after we receive an animated logo from the server.
     */
    private boolean isAnimatedLogoShowing() {
        return mAnimatedLogoDrawable != null;
    }

    /**
     * Starts playing the given animated GIF logo.
     */
    public void playAnimatedLogo(BaseGifImage gifImage) {
        mLoadingView.hideLoadingUI();
        mAnimatedLogoDrawable = new BaseGifDrawable(gifImage, Config.ARGB_8888);
        mAnimatedLogoMatrix = new Matrix();
        setMatrix(mAnimatedLogoDrawable.getIntrinsicWidth(),
                mAnimatedLogoDrawable.getIntrinsicHeight(), mAnimatedLogoMatrix, false);
        // Set callback here to ensure #invalidateDrawable() is called.
        mAnimatedLogoDrawable.setCallback(this);
        mAnimatedLogoDrawable.start();
    }

    /**
     * Lets logo view show a spinning progressbar.
     */
    public void showLoadingView() {
        mLoadingView.showLoadingUI();
    }

    /**
     * Fades in a new logo over the current logo.
     *
     * @param logo The new logo to fade in. May be null to reset to the default logo.
     */
    public void updateLogo(Logo logo) {
        if (logo == null) {
            updateLogo(getDefaultLogo(), null, true);
        } else {
            String contentDescription = TextUtils.isEmpty(logo.altText) ? null
                    : getResources().getString(R.string.accessibility_google_doodle, logo.altText);
            updateLogo(logo.image, contentDescription, false);
        }
    }

    private void updateLogo(Bitmap logo, final String contentDescription, boolean isDefaultLogo) {
        if (mFadeAnimation != null) mFadeAnimation.end();

        mNewLogo = logo;
        mNewLogoMatrix = new Matrix();
        mNewLogoIsDefault = isDefaultLogo;
        setMatrix(mNewLogo.getWidth(), mNewLogo.getHeight(), mNewLogoMatrix, mNewLogoIsDefault);

        mFadeAnimation = ObjectAnimator.ofFloat(this, mTransitionProperty, 0f, 1f);
        mFadeAnimation.setDuration(LOGO_TRANSITION_TIME_MS);
        mFadeAnimation.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {
            }

            @Override
            public void onAnimationRepeat(Animator animation) {
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                mLogo = mNewLogo;
                mLogoMatrix = mNewLogoMatrix;
                mLogoIsDefault = mNewLogoIsDefault;
                mNewLogo = null;
                mNewLogoMatrix = null;
                mTransitionAmount = 0f;
                mFadeAnimation = null;
                setContentDescription(contentDescription);
                setClickable(!mNewLogoIsDefault);
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                onAnimationEnd(animation);
                invalidate();
            }
        });
        mFadeAnimation.start();
    }

    /**
     * @return Whether a new logo is currently fading in over the old logo.
     */
    private boolean isTransitioning() {
        return mTransitionAmount != 0f;
    }

    /**
     * Sets the matrix to scale and translate the image so that it will be centered in the LogoView
     * and scaled to fit within the LogoView.
     *
     * @param preventUpscaling Whether the image should not be scaled up. If true, the image might
     *                         not fill the entire view but will still be centered.
     */
    private void setMatrix(int imageWidth, int imageHeight, Matrix matrix,
            boolean preventUpscaling) {
        int width = getWidth();
        int height = getHeight();

        float scale = Math.min((float) width / imageWidth, (float) height / imageHeight);
        if (preventUpscaling) scale = Math.min(1.0f, scale);

        int imageOffsetX = Math.round((width - imageWidth * scale) * 0.5f);
        int imageOffsetY = Math.round((height - imageHeight * scale) * 0.5f);

        matrix.setScale(scale, scale);
        matrix.postTranslate(imageOffsetX, imageOffsetY);
    }

    /**
     * @return The default logo.
     */
    private Bitmap getDefaultLogo() {
        Bitmap defaultLogo = sDefaultLogo == null ? null : sDefaultLogo.get();
        if (defaultLogo == null) {
            defaultLogo = BitmapFactory.decodeResource(getResources(), R.drawable.google_logo);
            sDefaultLogo = new WeakReference<Bitmap>(defaultLogo);
        }
        return defaultLogo;
    }

    @Override
    protected boolean verifyDrawable(Drawable who) {
        return (who == mAnimatedLogoDrawable) || super.verifyDrawable(who);
    }

    @Override
    public void invalidateDrawable(Drawable drawable) {
        // mAnimatedLogoDrawable doesn't actually know its bounds, so super.invalidateDrawable()
        // doesn't invalidate the right area. Instead invalidate the entire view; the drawable takes
        // up most of the view anyway so this is just as efficient.
        // @see ImageView#invalidateDrawable().
        if (drawable == mAnimatedLogoDrawable) invalidate();
        else super.invalidateDrawable(drawable);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        if (isAnimatedLogoShowing()) {
            if (mFadeAnimation != null) mFadeAnimation.cancel();
            // Free the old bitmaps to allow them to be GC'd.
            mLogo = null;
            mNewLogo = null;

            canvas.save();
            canvas.concat(mAnimatedLogoMatrix);
            mAnimatedLogoDrawable.draw(canvas);
            canvas.restore();
        } else {
            if (mLogo != null && mTransitionAmount < 0.5f) {
                mPaint.setAlpha((int) (255 * 2 * (0.5f - mTransitionAmount)));
                canvas.save();
                canvas.concat(mLogoMatrix);
                canvas.drawBitmap(mLogo, 0, 0, mPaint);
                canvas.restore();
            }

            if (mNewLogo != null && mTransitionAmount > 0.5f) {
                mPaint.setAlpha((int) (255 * 2 * (mTransitionAmount - 0.5f)));
                canvas.save();
                canvas.concat(mNewLogoMatrix);
                canvas.drawBitmap(mNewLogo, 0, 0, mPaint);
                canvas.restore();
            }
        }
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        if (w != oldw || h != oldh) {
            if (mAnimatedLogoDrawable != null) {
                setMatrix(mAnimatedLogoDrawable.getIntrinsicWidth(),
                        mAnimatedLogoDrawable.getIntrinsicHeight(), mAnimatedLogoMatrix, false);
            }
            if (mLogo != null) {
                setMatrix(mLogo.getWidth(), mLogo.getHeight(), mLogoMatrix, mLogoIsDefault);
            }
            if (mNewLogo != null) {
                setMatrix(mNewLogo.getWidth(), mNewLogo.getHeight(), mNewLogoMatrix,
                        mNewLogoIsDefault);
            }
        }
    }

    @Override
    public void onClick(View view) {
        if (view == this && mDelegate != null && !isTransitioning()) {
            mDelegate.onLogoClicked(isAnimatedLogoShowing());
        }
    }
}


text:
<?php

namespace Perry\Representation\Eve\v2;

use Perry\Representation\Reference as Reference;
use Perry\Representation\Base as Base;

class ItemType extends Base
{
    public $name;

    public $icon64;

    public $extraAttributes;

    public $mShortDescription;

    public $icon32;

    public $attributes;

    public $description;

    // by Warringer\Types\String
    public function setName($name)
    {
        $this->name = $name;
    }

    // by Warringer\Types\Reference
    public function setIcon64($icon64)
    {
        $this->icon64 = new Reference($icon64);
    }

    // by Warringer\Types\Dict
    public function setExtraAttributes($extraAttributes)
    {
        // by Warringer\Types\Dict
        $converters = [];
        $converters['skeletalMeshMale'] = function ($value) { return $value; };
        $converters['modifier'] = function ($values) {
        // by Warringer\Types\Dict
        $converters = [];
        $converters['modifierValue'] = function ($value) { return $value; };
        $converters['attributeName'] = function ($value) { return $value; };
        $converters['modifierType'] = function ($value) { return $value; };

        $func = function ($value) use ($converters) {
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
            $return['modifierValue'] = isset($value->{'modifierValue'}) ? $converters['modifierValue']($value->{'modifierValue'}) : null;
            $return['attributeName'] = isset($value->{'attributeName'}) ? $converters['attributeName']($value->{'attributeName'}) : null;
            $return['modifierType'] = isset($value->{'modifierType'}) ? $converters['modifierType']($value->{'modifierType'}) : null;

            return $return;
        };

            foreach ($values as $key => $value) {
                $values[$key] = $func($value);
            }

           return $values;
        };

        $converters['slotType'] = function ($value) { return $value; };
        $converters['skeletalMeshFemale'] = function ($value) { return $value; };
        $converters['mVICProp'] = function ($value) { return $value; };

        $func = function ($value) use ($converters) {
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
            $return['skeletalMeshMale'] = isset($value->{'skeletalMeshMale'}) ? $converters['skeletalMeshMale']($value->{'skeletalMeshMale'}) : null;
            $return['modifier'] = isset($value->{'modifier'}) ? $converters['modifier']($value->{'modifier'}) : null;
            $return['slotType'] = isset($value->{'slotType'}) ? $converters['slotType']($value->{'slotType'}) : null;
            $return['skeletalMeshFemale'] = isset($value->{'skeletalMeshFemale'}) ? $converters['skeletalMeshFemale']($value->{'skeletalMeshFemale'}) : null;
            $return['mVICProp'] = isset($value->{'mVICProp'}) ? $converters['mVICProp']($value->{'mVICProp'}) : null;

            return $return;
        };
        $this->extraAttributes = $func($extraAttributes);
    }

    // by Warringer\Types\String
    public function setMShortDescription($mShortDescription)
    {
        $this->mShortDescription = $mShortDescription;
    }

    // by Warringer\Types\Reference
    public function setIcon32($icon32)
    {
        $this->icon32 = new Reference($icon32);
    }

    // by Warringer\Types\Dict
    public function setAttributes($attributes)
    {
        // by Warringer\Types\Dict
        $converters = [];
        $converters['cpu'] = function ($value) { return $value; };
        $converters['power'] = function ($value) { return $value; };
        $converters['heatDamage'] = function ($value) { return $value; };

        $func = function ($value) use ($converters) {
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
            $return['cpu'] = isset($value->{'cpu'}) ? $converters['cpu']($value->{'cpu'}) : null;
            $return['power'] = isset($value->{'power'}) ? $converters['power']($value->{'power'}) : null;
            $return['heatDamage'] = isset($value->{'heatDamage'}) ? $converters['heatDamage']($value->{'heatDamage'}) : null;

            return $return;
        };
        $this->attributes = $func($attributes);
    }

    // by Warringer\Types\String
    public function setDescription($description)
    {
        $this->description = $description;
    }
}


text:
package update

import (
	"io/ioutil"
	"os"
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestGetChannelCommandLine(t *testing.T) {
	commandLineChannel := "foobar"
	result, method := getChannel(commandLineChannel)
	assert.Equal(t, commandLineChannel, result)
	assert.Equal(t, csCommandLine, method)
}

func TestGetChannelFromFile(t *testing.T) {
	channelFileChannel := "testchannel123"

	tempFile, err := ioutil.TempFile("", "")
	assert.Nil(t, err)
	defer os.Remove(tempFile.Name())
	defer tempFile.Close()

	tempFile.WriteString(channelFileChannel)
	tempFile.Sync()

	channelFilePath = tempFile.Name()

	result, method := getChannel("") // channel from command line is an empty string
	assert.Equal(t, channelFileChannel, result)
	assert.Equal(t, csChannelFile, method)
}

func TestGetChannelFromFileIsEmpty(t *testing.T) {
	tempFile, err := ioutil.TempFile("", "")
	assert.Nil(t, err)
	defer os.Remove(tempFile.Name())
	defer tempFile.Close()

	tempFile.Sync()

	channelFilePath = tempFile.Name()

	result, method := getChannel("") // channel from command line is an empty string
	assert.Equal(t, defaultChannel, result)
	assert.Equal(t, csDefault, method)
}

func TestGetChannelFromFileDoesntExist(t *testing.T) {
	channelFilePath = "/this/file/should/not/exist.txt"

	result, method := getChannel("") // channel from command line is an empty string
	assert.Equal(t, defaultChannel, result)
	assert.Equal(t, csDefault, method)
}


text:
using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
    public static void Main()
    {
        var userSessionIPList = new Dictionary<string, Dictionary<string, int>>();
        var numberOfRequests = int.Parse(Console.ReadLine());

        for (int i = 0; i < numberOfRequests; i++)
        {
            var input = Console.ReadLine().Split();

            var currentUserName = input[1];
            var currentUserIP = input[0];
            var currentUserSessionTime = int.Parse(input[2]);

            if (!userSessionIPList.ContainsKey(currentUserName))
            {
                userSessionIPList[currentUserName] = new Dictionary<string, int>();
            }

            if (!userSessionIPList[currentUserName].ContainsKey(currentUserIP))
            {
                userSessionIPList[currentUserName][currentUserIP] = 0;
            }

            userSessionIPList[currentUserName][currentUserIP] += currentUserSessionTime;
        }

        foreach (var userIPSessionData in userSessionIPList.OrderBy(x => x.Key))
        {
            var currUserName = userIPSessionData.Key;
            var currUserIPData = userIPSessionData.Value;

            var currentTotalSessionTime = userIPSessionData.Value.Values.Sum();
            var totalIPs = userIPSessionData.Value.Keys.Count();
            var counter = 1;

            Console.Write($"{currUserName}: {currentTotalSessionTime} [");

            foreach (var IPs in currUserIPData.OrderBy(x => x.Key))
            {
                var currentIP = IPs.Key;

                if (counter != totalIPs)
                {
                    Console.Write($"{currentIP}, ");
                }
                else
                {
                    Console.WriteLine($"{currentIP}]");
                }

                counter++;
            }
        }
    }
}


text:
<?php
/**
 * Elgg select input
 * Displays a select input field
 *
 * @warning Values of FALSE or NULL will match '' (empty string) but not 0.
 *
 * @package Elgg
 * @subpackage Core
 *
 * @uses $vars['value']          The current value or an array of current values if multiple is true
 * @uses $vars['options']        An array of strings representing the options for the dropdown field
 * @uses $vars['options_values'] An associative array of "value" => "option"
 *                               where "value" is the name and "option" is
 *                               the value displayed on the button. Replaces
 *                               $vars['options'] when defined.
 * @uses $vars['multiple']       If true, multiselect of values will be allowed in the select box
 * @uses $vars['class']          Additional CSS class
 */

if (isset($vars['class'])) {
	$vars['class'] = "elgg-input-dropdown {$vars['class']}";
} else {
	$vars['class'] = "elgg-input-dropdown";
}

$defaults = array(
	'disabled' => false,
	'value' => '',
	'options_values' => array(),
	'options' => array(),
	'optgroups' => array(),
);

$vars = array_merge($defaults, $vars);

$optgroups = $vars['optgroups'];
unset($vars['optgroups']);

if (!$optgroups) {
	echo elgg_view('input/dropdown', $vars);
} else {

	$options_values = $vars['options_values'];
	unset($vars['options_values']);

	$options = $vars['options'];
	unset($vars['options']);

	$value = is_array($vars['value']) ? $vars['value'] : array($vars['value']);
	$value = array_map('strval', $value);
	unset($vars['value']);

	$vars['multiple'] = !empty($vars['multiple']);

	// Add trailing [] to name if multiple is enabled to allow the form to send multiple values
	if ($vars['multiple'] && !empty($vars['name']) && is_string($vars['name'])) {
	    if (substr($vars['name'], -2) != '[]') {
	        $vars['name'] = $vars['name'] . '[]';
	    }
	}

?>
<select <?php echo elgg_format_attributes($vars); ?>>
<?php

	foreach ($optgroups as $groupLabel => $options_values) {
		if (!empty($options_values)) {
			echo '<optgroup label="' . $groupLabel . '">';
			foreach ($options_values as $opt_value => $option) {

				$option_attrs = elgg_format_attributes(array(
					'value' => $opt_value,
					'selected' => in_array((string)$opt_value, $value),
				));

				echo "<option $option_attrs>$option</option>";
			}
			echo '</optgroup>';
		}
	}
?>
</select>
<?php
}