text:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<generator uri="http://jekyllrb.com" version="3.0.3">Jekyll</generator>
<link href="http://localhost:3000/feed.xml" rel="self" type="application/atom+xml" />
<link href="http://localhost:3000/" rel="alternate" type="text/html" />
<updated>2016-04-23T14:35:52+01:00</updated>
<id>http://localhost:3000/</id>
<title>Jorge Quiterio</title>
<entry>
<title>Making ISO image from Installed Linux OS</title>
<link href="http://localhost:3000/Making-ISO-image-from-Installed-Linux-Operating-System/" rel="alternate" type="text/html" title="Making ISO image from Installed Linux OS" />
<published>2015-12-15T00:00:00+00:00</published>
<updated>2015-12-15T00:00:00+00:00</updated>
<id>http://localhost:3000/Making-ISO-image-from-Installed-Linux-Operating-System</id>
<content type="html" xml:base="http://localhost:3000/Making-ISO-image-from-Installed-Linux-Operating-System/"><p>Sometimes we want to have a copy of our lovely Linux OS  into a ISO file, so we can install into a VM like Virtualbox or VMWare.</p>

<p>In this post, I'll show you how easily get this job done using a couple of GNU Bash commands.</p>

<p>Audience basic required knowledge:</p>

<ul>
  <li>Linux Debian/Ubuntu</li>
  <li>Shell Script</li>
</ul>

<h3 id="flowchart">Flowchart</h3>

<p>Here is the code used to create R::mermaid Flowchart to give us an overview of entire process.
{% gist 86ae936acd1c10ee72c7 %}</p>

<p class="flowchart"><img src="{{ site.url }}/assets/flowchart_linux_2015-12-15_01.png" alt="alt Flowchart" /></p>

<h3 id="expected-result">Expected result</h3>
<p>We expect to have a <code class="highlighter-rouge">ISO</code> File, so we can use it where we want as  a <code class="highlighter-rouge">LiveCD</code>. Additionally we include some type of OS installation wizard software to help us to install OS into Hard-drive.
The ISO file internal structure will be like following:
{% gist 2c49428628459a9510bc %}</p>

<h3 id="the-code">The Code</h3>
<p>Let's start with the code and explain it.</p>

<h4 id="preparing-environment">1 - Preparing environment</h4>
<p>We'll use the <code class="highlighter-rouge">~/apps/MakeISO</code> directory.</p>

<p>So, we shoul to create <code class="highlighter-rouge">MakeISO directory</code> and create the file <code class="highlighter-rouge">make_iso</code> with <code class="highlighter-rouge">bash</code> environment, by executing the following commands:</p>

<p><code class="highlighter-rouge">mkdir -p ~/apps/MakeISO</code></p>

<p><code class="highlighter-rouge">touch ~/apps/MakeISO/ make_iso.sh</code></p>

<p><code class="highlighter-rouge"> echo '#!'$(which bash) &gt; make_iso.sh</code></p>

<h5 id="creating-environment-defining-files-iso-filesystem-and-casper-directory">Creating environment, defining files, iso, filesystem and casper directory.</h5>

<p>{% gist d63eb3ae79add610fa38 %}</p>

<p>where,</p>

<ul>
  <li>FILES is directory to put temporary files to mount.</li>
  <li>ISO is the iso directory</li>
  <li>CASPER is the location where we'll put filesystem image files.</li>
  <li>FS is the filesystem type that we'll use to compress image so it will fit on the CD or other media.</li>
</ul>

<h5 id="creating-directories">Creating directories:</h5>

<p><code class="highlighter-rouge">sudo mkdir -p ${ISO}/{$CASPER},boot/grub} ${FILES}/rootfs </code></p>

<h5 id="installing-required-packages">Installing required packages:</h5>

<p>{% gist ff916f7058c5cde4a8c4 %}</p>

<h4 id="rsync-and-copy-files-and-mount-new-system">2  - Rsync and Copy Files and mount new System</h4>

<p>In the following steps, we'll to copy need files to <code class="highlighter-rouge">$FILES/rootfs</code> folder with <code class="highlighter-rouge">rsync</code> and with <code class="highlighter-rouge">cp</code> commands. We can exclude some files and folder, because are not need for the the next new system and/or we (personally) don't need. For example, we can exclude <code class="highlighter-rouge">/etc/passwd</code> and <code class="highlighter-rouge">/etc/shadow</code> files, if we plan to create new other users during installation step.</p>

<h5 id="copying-files-and-exclude-what-we-dont-need">Copying files and exclude what we don't need.</h5>

<p>{% gist c42a0bb72148eece90f8 %}</p>

<h4 id="chroot-new-system-and-modify">3  -  Chroot new system and modify</h4>

<p>{% gist 759f0df6661fe1dd19fe %}</p>

<p>After this point, all next command should be executed within chrooted system until <code class="highlighter-rouge">exit</code> command that we should type later to back to normal system.</p>

<h5 id="installing-essential-packages-for-the-new-system">Installing essential packages for the new system.</h5>

<p>{% gist a57e0b66bded2f6e7830 %}</p>

<h5 id="doing-few-modifications-on-the-new-system">Doing few modifications on the new system.</h5>

<p>Updating module's dependencies, cleaning apt, cleaning logs remove some particular files from new system.</p>

<p>{% gist 54d14fd25ff8fee100ad%}</p>

<p>Now, exit from <code class="highlighter-rouge">chrooted</code> system, by typing <code class="highlighter-rouge">exit</code></p>

<h4 id="building-iso">4 - Building ISO.</h4>

<p>In this step, we'll prepare kernel, generate manifest for the  system installer, make <code class="highlighter-rouge">squashfs</code> and configure <code class="highlighter-rouge">grub</code>.</p>

<h5 id="prepare-kernel-initrd-and-memtest">Prepare kernel, initrd, and memtest</h5>

<p>{% gist 12e1b66f8265b9308438 %}</p>

<h5 id="generating-manifest">Generating manifest</h5>

<p>{%  gist f888db19b06815796c99%}</p>

<h5 id="unmount-new-system-and-generate-md5-sum">Unmount new system and generate MD5 sum.</h5>

<p>{% gist 045b6fa4115e2470255a %}</p>

<h5 id="configure-grub">Configure grub</h5>

<p>{% gist a73a19fc750904ece97e%}</p>

<p>You can alter <code class="highlighter-rouge">NAME_OF_DIST_YOU_WANT</code> to <code class="highlighter-rouge">uname -o</code>  result or other you like.</p>

<h5 id="making-iso">Making ISO</h5>

<p>{% gist 630eb7b9208d5da07d84 %}</p>

<p>You can download unique script <a href="https://gist.githubusercontent.com/jquiterio/03b9a3ae138b30a58f7b/raw/c01e13fd6ebf4647d55fe3a40d8760f6a00012de/20151215_jquiterio_linux_13.sh">here</a></p>

<p>That's it!</p>

<h4 id="references">References</h4>

<p><a href="http://ubuntuforums.org/showthread.php?t=688872">Original Post</a>
<a href="http://www.gnu.org/software/grub/">GNU Grub</a>
<a href="http://squashfs.sourceforge.net/">squashfs</a>
<a href="http://www.filesystems.org/project-unionfs.html">Linux filesystem</a>
<a href="https://launchpad.net/ubiquity/">Ubiquity</a>
<a href="https://www.debian.org/devel/debian-installer/">Debian Installer</a></p>

<h4 id="next-post-in-this-category">Next post in this category</h4>

<p>Configuring Linux Software RAID.</p>
</content>
<category term="Linux" />
<category term="grub" />
<category term="backup/restore" />
Sometimes we want to have a copy of our lovely Linux OS  into a ISO file, so we can install into a VM like Virtualbox or VMWare.
</entry>
<entry>
<title>Catching Linux keyboard events with python</title>
<link href="http://localhost:3000/Catching-Linux-keyboar-events-with-pythonpython/" rel="alternate" type="text/html" title="Catching Linux keyboard events with python" />
<published>2015-11-26T00:00:00+00:00</published>
<updated>2015-11-26T00:00:00+00:00</updated>
<id>http://localhost:3000/Catching-Linux-keyboar-events-with-pythonpython</id>
<content type="html" xml:base="http://localhost:3000/Catching-Linux-keyboar-events-with-pythonpython/"><p>Keyboard events is important not also for creating computer application based on keyboard events but also to ergonomics, keystroke static/dynamics and other scientific studies. In my case, for example, I use keyboard events to my Master Dissertation where Keystroke Dynamic is used to identify user profile based her/his behavior for computer security purpose. Over the past decades, many scientific studies were done in order to improve proposed methods. It is believed that first studies in keystroke using keyboard events took place in 1860s in the telegraph era, were identified operators by their unique "signature".</p>

<p>To get my job done I created a mini-program in Python that I will post gradually. For now, I will talk about "Catching Linux Keyboard events" using python.</p>

<p>Audience basic required knowledge:</p>

<ul>
  <li><a href="http://knsv.github.io/mermaid/">mermaid</a> <a href="http://knsv.github.io/mermaid/">mermaid</a> and/or <a href="https://www.r-project.org/">R</a></li>
  <li><a href="https://www.r-project.org/">R</a></li>
  <li><a href="https://www.python.org/">Python</a></li>
</ul>

<h3 id="flowchart">Flowchart</h3>

<p>Here is a <a href="http://knsv.github.io/mermaid/">mermaid</a> code used for flowchart:</p>

<p>{% highlight r %}
graph TB
    A(Start)–&gt;|Event happens|B{What Type?}
    B–&gt;|Key Down|C[Save: tmp key down]
    C-.-&gt;|Key Up|D[Calc: tmp key down - key up]
    B–&gt;|Key Auto|E[Save tmp key down]
    E-.-&gt;|Key Up Happens|D
    D–&gt;F((End))
{% endhighlight %}</p>

<p><img src="{{ site.url }}/assets/flowchart1.png" alt="alt Flowchart" /></p>

<h3 id="code">Code</h3>

<p>The following code is made according with directives defines in Linux Kernel about input devices. see <a href="https://www.kernel.org/doc/Documentation/input/input.txt">input directives </a> and <a href="https://www.kernel.org/doc/Documentation/input/event-codes.txt">event directives</a></p>

<p>We will use QWETY Keyboard and ignore all other keys.
In the <em>keychar</em> dictionary keys are keys and values are alpha characters.</p>

<p>{% highlight python %}
keychar = {2: '1', 3: '2', 4: '3', 5: '4', 6: '5', 7: '6', 8: '7', 9: '8', 10: '9', 11: '0',
			16: 'q', 17: 'w', 18: 'e', 19: 'r', 20: 't', 21: 'y', 22: 'u', 23: 'i', 24: 'o',
			25: 'p', 30: 'a', 31: 's', 32: 'd', 33: 'f', 34: 'g', 35: 'h', 36: 'j', 37: 'k',
			38: 'l', 44: 'z', 45: 'x', 46: 'c', 47: 'v', 48: 'b', 49: 'n', 50: 'm'} # QWERTY chars
{% endhighlight %}</p>

<p>Where is keystroke data come from in most of the Linux based Operating Systems ? In general come from /dev/input/event0</p>

<p>{% highlight python %}
import sys
device_name = "/dev/input/event" + (sys.argv[1] if len(sys.argv) &gt; 1 else "0")
{% endhighlight %}</p>

<p>But results from this device is presented as binary… so, let's format results:</p>

<p>{% highlight python %}
FORMAT = 'llHHI'
import struct
EVENT_SIZE = struct.calcsize(FORMAT)
{% endhighlight %}</p>

<p>where <em>llHHI</em> means <em>long int, long int, unsigned short, unsigned short</em> and <em>unsigned int</em>. We should also import and use <em>struct</em> to give value to <em>EVENT_SIZE</em>.</p>

<p>According to <a href="https://www.kernel.org/doc/Documentation/input/event-codes.txt">event directives</a> <em>EV_KEY</em> is used to describe state of keyboards or other key-like devices… So let's define it:</p>

<p>{% highlight python %}
EV_KEY = 0x01
KEY_DOWN = 1
KEY_AUTO = 2
KEY_UP = 0
{% endhighlight %}</p>

<p>Which mens we'll wait for Event key <em>0x01</em> that is <em>1</em> and 1 is noted as KEY_DOWN. We also flow directives defining a <em>int</em> value for key down(when key is pressed), key up(when key is released) and key auto (that is like an <em>press and hold</em>). Key Auto is interrupted when same key is released or when another key is pressed. In this last case an other cycle(event) is started.</p>

<p>Now let's create a function called <em>time_calc</em> that will handle times elapsed. We should assumes that we'll use two types of time: second and microseconds regarding pressed and released time. This should answer this question: How long time I have pressed key.</p>

<p>{% highlight python %}
def time_calc(second_p, microsecond_p, second_r, microsecond_r):
  pressed_time = (second_p+microsecond_p/1000000.) - (second_r+microsecond_r/1000000)
  return pressed_time
{% endhighlight %}</p>

<p>Defined staffs, let's now open device as 'rb'(READ BINARY), use formated event size and use GNU <em>struct timeval</em> regarding <em>elapsed time</em> define <a href="ftp://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_chapter/libc_21.html">here</a> to get keystroke(alpha character, key code, pressed time).</p>

<p>{% highlight python %}
import time</p>

<p>with open(device_name, "rb") as source_data:
  code_time = {}
  while True:
    event = source_data.read(EVENT_SIZE)
    (tv_sec, tv_usec, etype, code, value) = struct.unpack(FORMAT, event)
    if etype == EV_KEY:
      if value = KEY_DOWN:
        code_time[code] = (tv_sec, tv_usec)
      if value == KEY_UP and code in code_time:
        keystroke = (code, time_calc(tv_sec, tv_usec, *code_time[code]))</p>

<div class="highlighter-rouge"><pre class="highlight"><code>    if code in keychar.keys():
      print ("Key: %s, Key code: %u, Time pressed: %f" % \
              (keychar[code], keystroke[0], keystroke[1])) {% endhighlight %}
</code></pre>
</div>

<h3 id="results">Results</h3>

<p>Results should be like this:</p>

<p>{% highlight bash %}
Key: j, Key code: 36, Time pressed: 0.360123
Key: o, Key code: 24, Time pressed: 0.415161
Key: r, Key code: 19, Time pressed: 0.416548
Key: g, Key code: 34, Time pressed: 0.665365
Key: e, Key code: 18, Time pressed: 0.687727
{% endhighlight %}</p>

<h3 id="final-code">Final Code:</h3>

<p>{% highlight python %}
import sys
import struct
import time</p>

<p>device_name = "/dev/input/event" + (sys.argv[1] if len(sys.argv) &gt; 1 else "0")</p>

<p>FORMAT = 'llHHI'
EVENT_SIZE = struct.calcsize(FORMAT)
EV_KEY = 0x01
KEY_DOWN = 1
KEY_AUTO = 2
KEY_UP = 0</p>

<p>keychar = {2: '1', 3: '2', 4: '3', 5: '4', 6: '5', 7: '6', 8: '7', 9: '8', 10: '9', 11: '0',
            16: 'q', 17: 'w', 18: 'e', 19: 'r', 20: 't', 21: 'y', 22: 'u', 23: 'i', 24: 'o',
            25: 'p', 30: 'a', 31: 's', 32: 'd', 33: 'f', 34: 'g', 35: 'h', 36: 'j', 37: 'k',
            38: 'l', 44: 'z', 45: 'x', 46: 'c', 47: 'v', 48: 'b', 49: 'n', 50: 'm'}</p>

<p>def time_calc(sec_a, usec_a, sec_b, usec_b):
  time_pressed = (sec_a+usec_a/1000000.) - (sec_b+usec_b/1000000)
  return time_pressed</p>

<p>with open(device_name, "rb") as source_data:
  code_time = {}
  while True:
    event = source_data.read(EVENT_SIZE)
    (tv_sec, tv_usec, etype, code, value) = struct.unpack(FORMAT, event)
    if etype == EV_KEY:
      if value == KEY_DOWN:
        code_time[code] = (tv_sec, tv_usec)
        if value == KEY_UP and code in code_time:
          keystroke = (code, time_calc(tv_sec, tv_usec, *code_time[code]))</p>

<div class="highlighter-rouge"><pre class="highlight"><code>      if code in keychar.keys():
        print ("Key: %s, Key code: %u, Time pressed: %f" % \
                (keychar[code], keystroke[0], keystroke[1])) {% endhighlight %}
</code></pre>
</div>

<h3 id="next-post-in-this-category">Next post in this category:</h3>

<p>In the next post we'll improve the code, try to save results in JSON file and create a function to compare temporary values  with saved values.</p>

<p>EOF</p>
</content>
<category term="Python" />
<category term="Keyboard events" />
<category term="python" />
<category term="Linux" />
Keyboard events is important not also for creating computer application based on keyboard events but also to ergonomics, keystroke static/dynamics and other scientific studies. In my case, for example, I use keyboard events to my Master Dissertation where Keystroke Dynamic is used to identify user profile based her/his behavior for computer security purpose. Over the past decades, many scientific studies were done in order to improve proposed methods. It is believed that first studies in keystroke using keyboard events took place in 1860s in the telegraph era, were identified operators by their unique "signature".
</entry>
</feed>


text:
#include <Snd/Manager.h>

#include <Base/Util/CPU.h>
#include <Base/Dbg/DebugStream.h>

#include <cassert>

//#define SND_VORBIS_SUPPORT 0
//#define SND_STB_VORBIS_SUPPORT 1

#if (SND_VORBIS_SUPPORT > 0) && (SND_STB_VORBIS_SUPPORT > 0)
#  warning Compiling with both Ogg/Vorbis and stb_vorbis
#  warning Disabling stb_vorbis
#  undef SND_STB_VORBIS_SUPPORT
#  define SND_STB_VORBIS_SUPPORT 0
#endif

//----------------------
// OpenAL configuration
//----------------------
#if SND_OPENAL_SUPPORT
#include <Snd/OpenALManager.h>
#endif //SND_OPENAL_SUPPORT
//------------------------

//----------------------
// Null manager
//----------------------
#if SND_NULL_SUPPORT
#include <Snd/NullManager.h>
#endif //SND_NULL_SUPPORT
//------------------------

//-------------------
// Ogg configuration
//-------------------
#if SND_VORBIS_SUPPORT
#define OV_EXCLUDE_STATIC_CALLBACKS 1
#include <vorbis/vorbisfile.h>
#endif //SND_VORBIS_SUPPORT

//--------------------------
// stb_vorbis configuration
//--------------------------
#if SND_STB_VORBIS_SUPPORT
#include <Snd/stb_vorbis.c>
#endif //SND_STB_VORBIS_SUPPORT

//------------------------

#if SND_USE_PROCESS_THREAD
#include <Base/MT/Thread.h>
#endif //SND_USE_PROCESS_THREAD

USING_NAMESPACE

using namespace Snd;

UNNAMESPACE_BEGIN

DBG_STREAM( os_snd, "Sound" );

#if SND_VORBIS_SUPPORT

inline int toSign( SampleType s )
{
   switch( s )
   {
      case SND_SAMPLE_8:  return 0;
      case SND_SAMPLE_16: return 1;
      default:            return 0;
   }
}

#endif // SND_VORBIS_SUPPORT

#if SND_STB_VORBIS_SUPPORT
extern "C"
{
}
#endif //SND_STB_VORBIS_SUPPORT

#if SND_USE_PROCESS_THREAD
//------------------------------------------------------------------------------
//!
class SoundProcessTask:
   public Task
{
public:

   /*----- methods -----*/

   SoundProcessTask( double delay = 0, Manager* manager ):
      _delay( delay ),
      _manager( manager )
   {
   }

   virtual void execute()
   {
      DBG_MSG( os_snd, "Starting sound process thread" );
      while( true )
      {
         Thread::sleep( _delay );
         _manager->process();
      }
   }

   /*----- data members -----*/
   double    _delay;
   Manager*  _manager;

}; //class SoundProcessTask

// A single thread instance (only one Manager should ever get instantiated).
Thread*  _sThread = NULL;

#endif //SND_USE_PROCESS_THREAD

#if SND_VORBIS_SUPPORT
//------------------------------------------------------------------------------
//!
bool  readOggSoundFile
( const String& filename,
  NAMESPACE::Vector<uchar>& dstData,
  SampleType& sample,
  uint& numChannels,
  Freq& freq )
{
   FILE* f = fopen(filename.cstr(), "rb");
   if( f == NULL )
   {
      printf("Error opening file: %s\n", filename.cstr());
      return false;
   }

   if( ferror(f) )
   {
      perror("Error in file");
      return false;
   }

   // Set Vorbis file handle
   OggVorbis_File oggFile;
   if( ov_open(f, &oggFile, NULL, 0) != 0 )
   {
      printf("Error opening vorbis file\n");
      return false;
   }

   // Get some information about the OGG file
   vorbis_info* oggInfo = ov_info(&oggFile, -1);
   if( oggInfo == NULL )
   {
      printf("Error retrieving Ogg info\n");
      return false;
   }
   sample = SND_SAMPLE_16; //always 16?
   numChannels = oggInfo->channels;
   freq = oggInfo->rate;

   NAMESPACE::Vector<char>  temp_buffer;
   temp_buffer.resize( 1 << 15 );  //32KB buffers
   int bigendian = (CPU_ENDIANNESS == CPU_ENDIAN_BIG) ? 1 : 0;  //from CPU.h
   int word = toBytes(sample);
   int sign = toSign(sample);
   size_t curSize = dstData.size();
   int nBytes;
   int bitStream;
   do
   {
      // Read up to a buffer's worth of decoded sound data
      nBytes = ov_read(&oggFile, temp_buffer.data(), temp_buffer.size(), bigendian, word, sign, &bitStream);

      // Append to end of buffer
      dstData.resize( dstData.size() + nBytes );
      memcpy( dstData.data() + curSize, temp_buffer.data(), nBytes );
      curSize = dstData.size();
   } while (nBytes > 0);

   if( ov_clear(&oggFile) != 0 )
   {
      printf("Error clearing vorbis file\n");
      return false;
   }

   /*
   if( fclose(f) != 0 )
   {
      printf("Error closing file: %s\n", filename.cstr());
      return false;
   }
   */

   return true;
}
#endif //SND_VORBIS_SUPPORT

#if SND_STB_VORBIS_SUPPORT
//------------------------------------------------------------------------------
//!
bool  stbVorbisReadOggSoundFile
( const String& filename,
  NAMESPACE::Vector<uchar>& dstData,
  SampleType& sample,
  uint& numChannels,
  Freq& freq )
{
   short* decoded;
   int channels, len;
   len = stb_vorbis_decode_filename( (char*)filename.cstr(), &channels, &decoded );

   if( len == 0 )
   {
      printf( "Error decoding vorbis file: %s.\n", filename.cstr() );
      return false;
   }

   size_t totalSize = len*channels*2;
   dstData.resize( totalSize );
   memcpy( dstData.data(), decoded, len*channels*2 );
   sample      = SND_SAMPLE_16;
   numChannels = channels;
   freq        = 44100;

   return true;
}
#endif //SND_STB_VORBIS_SUPPORT

UNNAMESPACE_END

//------------------------------------------------------------------------------
//!
void Manager::printInfo( TextStream& os )
{
   os << "Snd:";

#if SND_NULL_SUPPORT
   os << " null";
#endif

#if SND_OPENAL_SUPPORT
   os << " OpenAL";
#endif

#if SND_VORBIS_SUPPORT
   os << " Vorbis";
#endif

#if SND_STB_VORBIS_SUPPORT
   os << " STB_Vorbis";
#endif

   os << nl;
}

//------------------------------------------------------------------------------
//!
Manager::Manager
( void ):
   _masterGain( 1.0f ),
   _masterPitch( 1.0f )
{
   DBG_BLOCK( os_snd, "Starting up Snd::Manager" );
#if SND_USE_PROCESS_THREAD
   CHECK( _sThread == NULL );
   _sThread = new Thread( new SoundProcessTask(1.0f/30.0f, this) );
#endif //SND_USE_PROCESS_THREAD
}

//------------------------------------------------------------------------------
//!
Manager::~Manager
( void )
{
   DBG_BLOCK( os_snd, "Shutting down Snd::Manager" );
#if SND_USE_PROCESS_THREAD
   CHECK( _sThread != NULL );
   delete _sThread;
   _sThread = NULL;
#endif //SND_USE_PROCESS_THREAD
}

//------------------------------------------------------------------------------
//!
void
Manager::masterGain( float g )
{
   _masterGain = g;
}

//------------------------------------------------------------------------------
//!
void
Manager::masterPitch( float p )
{
   _masterPitch = p;
}

//------------------------------------------------------------------------------
//!
void
Manager::masterStop()
{
}

//------------------------------------------------------------------------------
//!
void
Manager::masterResume()
{
}

//------------------------------------------------------------------------------
//!
RCP<Manager>
Manager::createManager
( const String& api_name )
{
   String api_name_lower;

   const char* mgr_str = getenv("SND_MGR");
   if( mgr_str == NULL )
   {
      api_name_lower = api_name.lower();
   }
   else
   {
      api_name_lower = mgr_str;
      api_name_lower = api_name_lower.lower();
   }

   //printf("Creating sound manager using: '%s'.\n", api_name_lower.cstr());

#if SND_OPENAL_SUPPORT
   if( api_name_lower.empty() ||
       api_name_lower == "openal" ||
       api_name_lower == "al" )
   {
      OpenALManager* mgr = new OpenALManager();
      return RCP<Manager>( mgr );
   }
   else
#endif //SND_OPENAL_SUPPORT
#if SND_NULL_SUPPORT
   if( api_name_lower.empty() ||
       api_name_lower == "null" )
   {
      NullManager* mgr = new NullManager();
      return RCP<Manager>( mgr );
   }
   else
#endif //SND_NULL_SUPPORT
   {
      assert(0 && "Unknown api name");
      return NULL;
   }
}

// File reading
bool
Manager::readSoundFile
( const String& filename,
  NAMESPACE::Vector<uchar>& dstData,
  SampleType& sample,
  uint& numChannels,
  Freq& freq )
{
   unused(filename);
   unused(dstData);
   unused(sample);
   unused(numChannels);
   unused(freq);
   String ext = filename.getExt().lower();

#if SND_VORBIS_SUPPORT
   if( ext == "ogg" )
   {
      return readOggSoundFile(filename, dstData, sample, numChannels, freq);
   }
   else
#endif
#if SND_STB_VORBIS_SUPPORT
   if( ext == "ogg" )
   {
      return stbVorbisReadOggSoundFile(filename, dstData, sample, numChannels, freq);
   }
   else
#endif
   {
      printf("Unknown file format: %s\n", ext.cstr());
      return false;
   }
}

RCP<Sound>
Manager::makeSoundFromFile( const String& filename )
{
   NAMESPACE::Vector<uchar> data;
   SampleType sample;
   uint numChannels;
   Freq freq;
   if( readSoundFile( filename, data, sample, numChannels, freq ) )
   {
      RCP<Sound> snd = createSound();
      if( snd.isValid() )
      {
         if( setData( snd.ptr(), data.size(), data.data(), sample, numChannels, freq ) )
         {
            return snd;
         }
         else
         {
            printf( "Snd::Manager::makeSoundFromFile() - Error setting data.\n" );
            return NULL;
         }
      }
      else
      {
         printf( "Snd::Manager::makeSoundFromFile() - Error creating Sound instance.\n" );
         return NULL;
      }
   }
   else
   {
      printf( "Snd::Manager::makeSoundFromFile() - Error reading sound file '%s'.\n", filename.cstr() );
      return NULL;
   }
}

//------------------------------------------------------------------------------
//!
void
Manager::release( Listener* /*listener*/ )
{

}

//------------------------------------------------------------------------------
//!
void
Manager::release( Source* /*listener*/ )
{

}

redpajama_set_name: RedPajamaGithub


text:
package com.github.nscala_time.time

import java.util.Locale
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichLocalTimeProperty(val underlying: LocalTime.Property) extends AnyVal with PimpedType[LocalTime.Property] {

  def localTime: LocalTime = underlying.getLocalTime

  def roundFloor: LocalTime = underlying.roundFloorCopy

  def roundCeiling: LocalTime = underlying.roundCeilingCopy

  def roundDown: LocalTime = underlying.roundFloorCopy

  def roundUp: LocalTime = underlying.roundCeilingCopy

  def round: LocalTime = underlying.roundHalfEvenCopy

  def apply(value: Int): LocalTime = underlying.setCopy(value)

  def apply(text: String): LocalTime = underlying.setCopy(text)

  def apply(text: String, locale: Locale): LocalTime = underlying.setCopy(text, locale)

}


text:
<!doctype html>

        <title>codename-fireflies</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">

        <link href="assets/css/main.css" rel="stylesheet"/>

Allow this app to access your camera and activate by waving your hand

                CODEBOX SYSTEMS LLC | Launching Q4 2014 | by roblayton.com


text:
<?php

namespace Dotdigitalgroup\Email\Plugin;

use Magento\Framework\Mail\TransportInterface;

/**
 * SMTP mail transport.
 *
 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
 */
class TransportPlugin
{
    /**
     * @var \Dotdigitalgroup\Email\Helper\Transactional
     */
    private $helper;

    /**
     * @var \Dotdigitalgroup\Email\Model\Mail\AdapterInterface
     */
    private $mailAdapter;

    /**
     * TransportPlugin constructor.
     *
     * @param \Dotdigitalgroup\Email\Model\Mail\AdapterInterfaceFactory $mailAdapterFactory
     * @param \Dotdigitalgroup\Email\Helper\Transactional $helper
     */
    public function __construct(
        \Dotdigitalgroup\Email\Model\Mail\AdapterInterfaceFactory $mailAdapterFactory,
        \Dotdigitalgroup\Email\Helper\Transactional $helper
    ) {
        $this->helper   = $helper;
        $this->mailAdapter = $mailAdapterFactory->create(
            [
            'host' => $this->helper->getSmtpHost(),
            'config' => $this->helper->getTransportConfig()
            ]
        );
    }

    /**
     * @param TransportInterface $subject
     * @param \Closure $proceed
     * @throws \Exception
     *
     * @return null
     */
    public function aroundSendMessage(
        TransportInterface $subject,
        \Closure $proceed
    ) {
        if ($this->helper->isEnabled()) {
            // For >= 2.2
            if (method_exists($subject, 'getMessage')) {
                $this->mailAdapter->send($subject->getMessage());
            } else {
                //For < 2.2
                $reflection = new \ReflectionClass($subject);
                $property = $reflection->getProperty('_message');
                $property->setAccessible(true);
                $this->mailAdapter->send($property->getValue($subject));
            }
        } else {
            $proceed();
        }
    }
}


text:
rm -rf /var/tmp/messip
mkdir -p /var/tmp/messip/usr/lib
cp Release/libmessip.so  /var/tmp/messip/usr/lib
strip /var/tmp/messip/usr/lib/libmessip.so

mkdir -p /var/tmp/messip/usr/bin
cp ../messip_mgr/Release/messip_mgr  /var/tmp/messip/usr/bin
strip /var/tmp/messip/usr/bin/messip_mgr

sudo rm -f /usr/src/redhat/RPMS/i386/messip-*
sudo touch /usr/src/redhat/RPMS/i386/messip-0-9.i386.rpm
sudo chmod a+rw /usr/src/redhat/RPMS/i386/messip-0-9.i386.rpm

rpmbuild -bb --quiet messip.spec


text:
module overwatch {
	export module git {
		var app = angular.module('overwatch.git.branch',
			['ui.router', 'overwatch.git.branchesService', 'overwatch.layout.pageDataService']);

		app.config(['$stateProvider',
			($stateProvider: ng.ui.IStateProvider) => {
			$stateProvider
				.state('branch', {
					url: '/branch/:branchName',
					templateUrl: 'templates/git/branchCtrl.tpl.html',
					resolve: {
						branchInfo: ['$stateParams', 'branchesService', ($stateParams, branchesService) => {
							return branchesService.getBranchInfo($stateParams.branchName);
						}]
					},
					controller: 'branchCtrl'
				});
		}]);

		app.controller('branchCtrl', ['$scope', '$stateParams', 'pageDataService', 'branchInfo', 'branchesService',
			($scope: IBranchCtrlScope, $stateParams: any, pageDataService: layout.IPageDataService,
			 branchInfo: git.IBranch, branchesService: git.IBranchesService) => {

			$scope.viewModel = <any>{};
			$scope.viewModel.branch = branchInfo;
			pageDataService.currentPageData.pageTitle = branchInfo.name;
			$scope.filterCommits = () => {
				branchesService.getCommits(branchInfo.urlName, $scope.viewModel.username).then((commits) => {
					$scope.commits = commits;
				});
			};
		}]);

		export interface IBranchCtrlScope {
			viewModel: IBranchViewModel;
			filterCommits: () => void;
			commits: Array<git.ICommit>;
		}

		export interface IBranchViewModel {
			branch: git.IBranch;
			username;
		}
	}
}


text:
<?php

namespace IPAddress\IPv4;

use IPAddress\Exceptions\InvalidFormatException;
use IPAddress\IPAddress;
use IPAddress\Matcher;

/**
 * Class Range represents a range of IP addresses
 *
 * @package IPAddress\IPv4
 */
class Range implements Matcher
{

    /**
     * @var Address
     */
    private $ip1;

    /**
     * @var Address
     */
    private $ip2;

    /**
     * Create an IP range from a couple of IP addresses
     *
     * @param Address|string|array $ip1
     * @param Address|string|array $ip2
     */
    public function __construct($ip1, $ip2)
    {
        $ip1 = new Address($ip1);
        $ip2 = new Address($ip2);
        if ($ip1 < $ip2) {
            $this->ip1 = $ip1;
            $this->ip2 = $ip2;
        } else {
            $this->ip1 = $ip2;
            $this->ip2 = $ip1;
        }
    }

    /**
     * Create an IP range from a string
     *
     * @param $string
     * @throws \IPAddress\Exceptions\InvalidFormatException
     * @return \IPAddress\IPv4\Range
     */
    public static function fromString($string)
    {
        if (preg_match("/^(\\d+\\.\\d+\\.\\d+\\.\\d+)\\s*(\\-\\s*)?(\\d+\\.\\d+\\.\\d+\\.\\d+)$/", $string, $m)) {
            return new self($m[1], $m[3]);
        }

        throw new InvalidFormatException("Unknown IP-range format");
    }

    /**
     * Get the lower part of the range
     *
     * @return Address
     */
    public function ip1()
    {
        return $this->ip1;
    }

    /**
     * Get the upper part of the range
     *
     * @return Address
     */
    public function ip2()
    {
        return $this->ip2;
    }

    /**
     * Get a string representation of an IP range
     *
     * @return string
     */
    public function __toString()
    {
        return sprintf("%s-%s", $this->ip1, $this->ip2);
    }

    /**
     * Tests whether the given address matches
     *
     * @param $address
     * @return bool
     */
    public function match($address)
    {
        if(!($address instanceof Address)) {
            return false;
        }

        return ($address >= $this->ip1 && $address <= $this->ip2);
    }
}


text:
from flask import Flask
app = Flask(__name__)

@app.route('/')
def index():
    return 'Index Page'

@app.route('/hello')
def hello():
    return 'Hello World'

@app.route('/euler1')
def euler1():

	total = 0
	index = 1000

	while(index > 0):

		index -= 1

		if(index % 5 == 0 or index % 3 == 0):
			total += index

	return (str(total))

@app.route('/user/<username>')
def show_user_profile(username):
    # show the user profile for that user
    return 'Paul %s' % username

@app.route('/post/<int:post_id>')
def show_post(post_id):
    # show the post with the given id, the id is an integer
    return 'Post %d' % post_id

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5000,debug=True)


text:
<resources>
    <string name="app_name">ClickableEditTextSample</string>
    <string name="clickableedittext">ClickableEditText</string>
    <string name="clickabletextinputedittext">ClickableTextInputEditText</string>
    <string name="clickableautocompletetextview">ClickableAutoCompleteTextView</string>
    <string name="clickableedittext_dynamic_buttons">ClickableEditText Dynamic Buttons</string>
    <string name="end_button_clicked">End button clicked</string>
    <string name="start_button_clicked">Start button clicked</string>
</resources>


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <prerequisites>
        <maven>3.0.1</maven>
    </prerequisites>

    <parent>
        <groupId>io.dropwizard</groupId>
        <artifactId>dropwizard-parent</artifactId>
        <version>1.2.0-rc4-SNAPSHOT</version>
    </parent>

    <artifactId>dropwizard-bom</artifactId>
    <packaging>pom</packaging>
    <name>Dropwizard BOM</name>
    <description>
        Bill of materials to make sure a consistent set of versions is used for Dropwizard modules.
    </description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <dropwizard.version>${project.version}</dropwizard.version>
        <guava.version>23.0</guava.version>
        <jersey.version>2.25.1</jersey.version>
        <jackson.version>2.9.0</jackson.version>
        <jetty.version>9.4.6.v20170531</jetty.version>
        <servlet.version>3.0.0.v201112011016</servlet.version>
        <metrics3.version>3.2.4</metrics3.version>
        <slf4j.version>1.7.25</slf4j.version>
        <logback.version>1.2.3</logback.version>
        <h2.version>1.4.196</h2.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.objenesis</groupId>
                <artifactId>objenesis</artifactId>
                <version>2.6</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>3.6</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>
            <dependency>
                <groupId>net.sourceforge.argparse4j</groupId>
                <artifactId>argparse4j</artifactId>
                <version>0.7.0</version>
            </dependency>
            <dependency>
                <groupId>com.google.code.findbugs</groupId>
                <artifactId>jsr305</artifactId>
                <version>3.0.2</version>
            </dependency>
            <dependency>
                <groupId>joda-time</groupId>
                <artifactId>joda-time</artifactId>
                <version>2.9.9</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-validator</artifactId>
                <version>5.4.1.Final</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish</groupId>
                <artifactId>javax.el</artifactId>
                <version>3.0.0</version>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.1.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>4.5.3</version>
                <exclusions>
                    <exclusion>
                        <groupId>commons-logging</groupId>
                        <artifactId>commons-logging</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.tomcat</groupId>
                <artifactId>tomcat-jdbc</artifactId>
                <version>8.5.20</version>
            </dependency>
            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2</artifactId>
                <version>${h2.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jadira.usertype</groupId>
                <artifactId>usertype.core</artifactId>
                <version>6.0.1.GA</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.joda</groupId>
                        <artifactId>joda-money</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.apache.geronimo.specs</groupId>
                        <artifactId>geronimo-jta_1.1_spec</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-core</artifactId>
                <version>5.2.10.Final</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.jboss.logging</groupId>
                        <artifactId>jboss-logging</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.javassist</groupId>
                <artifactId>javassist</artifactId>
                <version>3.21.0-GA</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml</groupId>
                <artifactId>classmate</artifactId>
                <version>1.3.3</version>
            </dependency>
            <dependency>
                <groupId>org.hsqldb</groupId>
                <artifactId>hsqldb</artifactId>
                <version>2.4.0</version>
            </dependency>
            <dependency>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-core</artifactId>
                <version>3.5.3</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.yaml</groupId>
                        <artifactId>snakeyaml</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.mattbertolini</groupId>
                <artifactId>liquibase-slf4j</artifactId>
                <version>2.0.0</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.liquibase</groupId>
                        <artifactId>liquibase-core</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>net.jcip</groupId>
                <artifactId>jcip-annotations</artifactId>
                <version>1.0</version>
            </dependency>
            <dependency>
                <groupId>com.github.spullara.mustache.java</groupId>
                <artifactId>compiler</artifactId>
                <version>0.9.5</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.google.guava</groupId>
                        <artifactId>guava</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.freemarker</groupId>
                <artifactId>freemarker</artifactId>
                <version>2.3.23</version>
            </dependency>
            <dependency>
                <groupId>org.jdbi</groupId>
                <artifactId>jdbi</artifactId>
                <version>2.78</version>
            </dependency>

            <!-- Jetty -->
            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-server</artifactId>
                <version>${jetty.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-util</artifactId>
                <version>${jetty.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-webapp</artifactId>
                <version>${jetty.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-continuation</artifactId>
                <version>${jetty.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-servlet</artifactId>
                <version>${jetty.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-servlet</artifactId>
                <classifier>tests</classifier>
                <version>${jetty.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-servlets</artifactId>
                <version>${jetty.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-http</artifactId>
                <version>${jetty.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-http</artifactId>
                <classifier>tests</classifier>
                <version>${jetty.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-alpn-server</artifactId>
                <version>${jetty.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.jetty.http2</groupId>
                <artifactId>http2-server</artifactId>
                <version>${jetty.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.jetty.http2</groupId>
                <artifactId>http2-client</artifactId>
                <version>${jetty.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-client</artifactId>
                <version>${jetty.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.jetty.http2</groupId>
                <artifactId>http2-http-client-transport</artifactId>
                <version>${jetty.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.jetty.toolchain.setuid</groupId>
                <artifactId>jetty-setuid-java</artifactId>
                <version>1.0.3</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.eclipse.jetty</groupId>
                        <artifactId>jetty-util</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.eclipse.jetty</groupId>
                        <artifactId>jetty-server</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!-- Jackson -->
            <dependency>
                <groupId>com.fasterxml.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${jackson.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Jersey -->
            <dependency>
                <groupId>org.glassfish.jersey</groupId>
                <artifactId>jersey-bom</artifactId>
                <version>${jersey.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Metrics -->
            <dependency>
                <groupId>io.dropwizard.metrics</groupId>
                <artifactId>metrics-annotation</artifactId>
                <version>${metrics3.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard.metrics</groupId>
                <artifactId>metrics-core</artifactId>
                <version>${metrics3.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.dropwizard.metrics</groupId>
                <artifactId>metrics-jvm</artifactId>
                <version>${metrics3.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.dropwizard.metrics</groupId>
                <artifactId>metrics-servlets</artifactId>
                <version>${metrics3.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.fasterxml.jackson.core</groupId>
                        <artifactId>jackson-databind</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.dropwizard.metrics</groupId>
                <artifactId>metrics-healthchecks</artifactId>
                <version>${metrics3.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.dropwizard.metrics</groupId>
                <artifactId>metrics-logback</artifactId>
                <version>${metrics3.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>ch.qos.logback</groupId>
                        <artifactId>logback-classic</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.dropwizard.metrics</groupId>
                <artifactId>metrics-jersey2</artifactId>
                <version>${metrics3.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.glassfish.jersey.core</groupId>
                        <artifactId>jersey-server</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.dropwizard.metrics</groupId>
                <artifactId>metrics-jetty9</artifactId>
                <version>${metrics3.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.eclipse.jetty</groupId>
                        <artifactId>jetty-server</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.dropwizard.metrics</groupId>
                <artifactId>metrics-httpclient</artifactId>
                <version>${metrics3.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>commons-logging</groupId>
                        <artifactId>commons-logging</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.apache.httpcomponents</groupId>
                        <artifactId>httpclient</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.dropwizard.metrics</groupId>
                <artifactId>metrics-jdbi</artifactId>
                <version>${metrics3.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.jdbi</groupId>
                        <artifactId>jdbi</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.dropwizard.metrics</groupId>
                <artifactId>metrics-ganglia</artifactId>
                <version>${metrics3.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.dropwizard.metrics</groupId>
                <artifactId>metrics-graphite</artifactId>
                <version>${metrics3.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!-- Logging dependencies -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jul-to-slf4j</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>log4j-over-slf4j</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jcl-over-slf4j</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-access</artifactId>
                <version>${logback.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-core</artifactId>
                <version>${logback.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!-- Test dependencies -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-core</artifactId>
                <version>1.3</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${mockito.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jersey.test-framework</groupId>
                <artifactId>jersey-test-framework-core</artifactId>
                <version>${jersey.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>javax.servlet</groupId>
                        <artifactId>javax.servlet-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jersey.test-framework.providers</groupId>
                <artifactId>jersey-test-framework-provider-grizzly2</artifactId>
                <version>${jersey.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>javax.servlet</groupId>
                        <artifactId>javax.servlet-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jersey.test-framework.providers</groupId>
                <artifactId>jersey-test-framework-provider-inmemory</artifactId>
                <version>${jersey.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>javax.servlet</groupId>
                        <artifactId>javax.servlet-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!-- Dropwizard modules -->
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-assets</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-auth</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-client</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-configuration</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-core</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-db</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-forms</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-hibernate</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-jackson</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-jdbi</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-jersey</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-jetty</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-lifecycle</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-logging</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-metrics</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-metrics-ganglia</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-metrics-graphite</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-migrations</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-request-logging</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-servlets</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-testing</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-util</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-validation</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-views</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-views-freemarker</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-views-mustache</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-http2</artifactId>
                <version>${project.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>


text:
using UnityEngine;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;

namespace Kudan.AR
{
	public class TrackeriOS : TrackerBase
	{
		private Renderer _background;
		private MeshFilter _cameraBackgroundMeshFilter;

		private Texture2D _textureYp;
		private int _textureYpID;

		private Texture2D _textureCbCr;
		private int _textureCbCrID;

		private float _cameraAspect = 1.0f;

		private int _numFramesRenderedLast = 0;
		private int _numFramesRendered = 0;
		private float _rateTimer = 0.0f;

		private ScreenOrientation _prevScreenOrientation;
		private Matrix4x4 _projectionRotation = Matrix4x4.identity;

		//-------------------------------------------------------------------------------------------------------------//
		// Plugin Interface
		// - Supplements NativeInterface.cs
		//-------------------------------------------------------------------------------------------------------------//

		[DllImport("__Internal")]
		private static extern System.IntPtr GetRenderEventFunc();

		[DllImport("__Internal")]
		private static extern void SetApiKeyNative(string key, string bundleId);

		[DllImport("__Internal")]
		private static extern System.IntPtr GetTextureForPlane(int plane, ref int width, ref int height);

		[DllImport("__Internal")]
		private static extern int GetCaptureDeviceCount();

		[DllImport("__Internal")]
		private static extern bool BeginCaptureSession(int deviceIndex, int targetWidth, int targetHeight);

		[DllImport("__Internal")]
		private static extern void EndCaptureSession();

		[DllImport("__Internal")]
		private static extern void BeginTracking();

		[DllImport("__Internal")]
		private static extern void EndTracking();

		[DllImport("__Internal")]
		private static extern float GetCaptureDeviceRate();

		[DllImport("__Internal")]
		private static extern float GetTrackerRate();

		[DllImport("__Internal")]
		private static extern void GetDetectedTrackable(int index, StringBuilder name, int nameSize, ref int width, ref int height, float[] pos, float[] ori);

		//-------------------------------------------------------------------------------------------------------------//

		public TrackeriOS(Renderer background)
		{
			_background = background;
			_cameraBackgroundMeshFilter = background.GetComponent<MeshFilter> ();

			SetYpCbCrMaterialOnBackground();
		}

		public override bool InitPlugin()
		{
			if (NativeInterface.Init())
			{
				return true;
			}
			return false;
		}

		public override void DeinitPlugin()
		{
			NativeInterface.Deinit();
		}

		public override float GetNativePluginVersion()
		{
			return NativeInterface.GetPluginVersion();
		}

		public override void OnApplicationFocus( bool focusStatus )
		{
		}

		public override void OnApplicationPause( bool pauseStatus )
		{
		}

		// Cameras
		public override int GetNumCameras()
		{
			return GetCaptureDeviceCount();
		}

		// Start sources
		public override bool StartInputFromImage(Texture2D image)
		{
			return false;
		}

		public override bool StartInputFromCamera(int deviceIndex, int targetWidth, int targetHeight)
		{
			if (BeginCaptureSession(deviceIndex, targetWidth, targetHeight))
			{
				StartTracking();
				return true;
			}
			return false;
		}

		public override void StopInput()
		{
			EndCaptureSession();
		}

		// Trackables
		public override bool AddTrackable(byte[] data, string id)
		{
			GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);
			bool result = NativeInterface.AddTrackableSet(handle.AddrOfPinnedObject(), data.Length);
			handle.Free();

			if (result)
			{
				Trackable trackable = new Trackable();
				trackable.name = id;
				_trackables.Add(trackable);
			}

			return result;
		}

		public override bool GetMarkerRecoveryStatus()
		{
			return NativeInterface.GetMarkerRecoveryStatus ();
		}

		public override void SetMarkerRecoveryStatus (bool status)
		{
			NativeInterface.SetMarkerRecoveryStatus (status);
		}

		private const int kKudanARRenderEventId = 0x0a736f21;

		// Fire events etc
		public override void UpdateTracking()
		{
#if UNITY_5_2 || UNITY_5_3 || UNITY_5_4
			GL.IssuePluginEvent(GetRenderEventFunc(), kKudanARRenderEventId);
#else
			GL.IssuePluginEvent(kKudanARRenderEventId);
#endif
			UpdateBackground();
			_cameraRate = GetCaptureDeviceRate();

			_trackerRate = GetTrackerRate();

			_rateTimer += Time.deltaTime;
			_numFramesRendered++;
			if (_rateTimer >= 1.0f)
			{
				_appRate = (float)(_numFramesRendered - _numFramesRenderedLast) / _rateTimer;

				_numFramesRenderedLast = _numFramesRendered;
				_rateTimer = 0f;
			}

			// Grab the detected trackables.
			_detected = GetDetected();

			// Grab the projection matrix.
			float[] projectionFloats = new float[16];
			NativeInterface.GetProjectionMatrix (_cameraNearPlane, _cameraFarPlane, projectionFloats);
			_projectionMatrix = ConvertNativeFloatsToMatrix (projectionFloats, _cameraAspect);

			UpdateRotation();

			// Transform the projection matrix depending on orientation.
			_projectionMatrix = _projectionMatrix * _projectionRotation;
		}

		public void UpdateRotation()
		{
			ScreenOrientation currentOrientation = Screen.orientation;

			if (currentOrientation == _prevScreenOrientation) {
				return;
			}

			Debug.Log(currentOrientation);

			_prevScreenOrientation = currentOrientation;
			float projectionScale = 1.0f / _cameraAspect;

			int[] indices;

			if (currentOrientation == ScreenOrientation.LandscapeLeft) {
				indices = new int[]{ 0, 1, 2, 3 };
				_projectionRotation = Matrix4x4.identity;
			} else if (currentOrientation == ScreenOrientation.Portrait) {
				indices = new int[]{ 2, 3, 1, 0 };
				_projectionRotation = Matrix4x4.TRS (Vector3.zero, Quaternion.AngleAxis(90, Vector3.back), new Vector3( projectionScale, projectionScale, 1 ));
			} else if (currentOrientation == ScreenOrientation.LandscapeRight) {
				indices = new int[]{ 1, 0, 3, 2 };
				_projectionRotation = Matrix4x4.TRS (Vector3.zero, Quaternion.AngleAxis(180, Vector3.back), Vector3.one);
			} else if (currentOrientation == ScreenOrientation.PortraitUpsideDown) {
				indices = new int[]{ 3, 2, 0, 1 };
				_projectionRotation = Matrix4x4.TRS (Vector3.zero, Quaternion.AngleAxis(270, Vector3.back), new Vector3( projectionScale, projectionScale, 1 ));
			} else {
				return;
			}

			Vector3[] pos = new Vector3[4];

			pos [indices[0]] = new Vector3 (-0.5f, -0.5f, 0.0f);
			pos [indices[1]] = new Vector3 (0.5f, 0.5f, 0.0f);
			pos [indices[2]] = new Vector3 (0.5f, -0.5f, 0.0f);
			pos [indices[3]] = new Vector3 (-0.5f, 0.5f, 0.0f);

			_cameraBackgroundMeshFilter.mesh.vertices = pos;
		}

		public override void PostRender()
		{

		}

		// Tracking
		public override void StartTracking()
		{
			BeginTracking();
			_isTrackingRunning = true;
		}

		public override void StopTracking()
		{
			EndTracking();
			_isTrackingRunning = false;
		}

		public override bool EnableTrackingMethod(int trackingMethodId)
		{
			return NativeInterface.EnableTrackingMethod(trackingMethodId);
		}

		public override bool DisableTrackingMethod(int trackingMethodId)
		{
			return NativeInterface.DisableTrackingMethod(trackingMethodId);
		}

		// Licensing
		public override void SetApiKey(string key, string bundleId)
		{
			SetApiKeyNative(key, bundleId);
		}

		// Utility functions for converting native data into Unity data
		public static Matrix4x4 ConvertNativeFloatsToMatrix(float[] r, float cameraAspect)
		{
			Matrix4x4 m = new Matrix4x4();
			m.SetRow(0, new Vector4(r[ 0], r[ 1], r[ 2], r[ 3]));
			m.SetRow(1, new Vector4(r[ 4], r[ 5], r[ 6], r[ 7]));
			m.SetRow(2, new Vector4(r[ 8], r[ 9], r[10], r[11]));
			m.SetRow(3, new Vector4(r[12], r[13], r[14], r[15]));

			// Scale the aspect ratio based on camera vs screen ratios
			float screenAspect = ((float)Screen.width / (float)Screen.height);
			float scale = cameraAspect / screenAspect;
			if (scale > 1)
				m.m00 *= scale;
			else
				m.m11 /= scale;

			m = m.transpose;

			m.m02 *= -1f;
			m.m12 *= -1f;

			return m;
		}

		protected static Vector3 ConvertNativeFloatsToVector3(float x, float y, float z)
		{
			return new Vector3(-x, -y, -z);
		}

		protected static Quaternion ConvertNativeFloatsToQuaternion(float x, float y, float z, float w)
		{
			return new Quaternion(x, y, z, w) * Quaternion.AngleAxis(-90f, Vector3.forward) * Quaternion.AngleAxis(90f, Vector3.left);
		}

		private List<Trackable> GetDetected()
		{
			// Grab detected trackables from nativeland into C# Unity land
			int num = NativeInterface.GetNumberOfDetectedTrackables();
			List<Trackable> result = new List<Trackable>(num);
			for (int i = 0; i < num; i++)
			{
				Trackable trackable = new Trackable();
				StringBuilder sbName = new StringBuilder(512);
				int width = 0, height = 0;
				float[] pos = new float[3];
				float[] ori = new float[4];
//				NativeInterface.Get(p, sbName);
				GetDetectedTrackable(i, sbName, 512, ref width, ref height, pos, ori);

				trackable.name = sbName.ToString();
				trackable.width = width;
				trackable.height = height;
				trackable.position = ConvertNativeFloatsToVector3(pos[0], pos[1], pos[2]);
				trackable.orientation = ConvertNativeFloatsToQuaternion(ori[0], ori[1], ori[2], ori[3]);
				result.Add(trackable);
			}
			return result;
		}

		private void SetYpCbCrMaterialOnBackground()
		{
			Material matYpCbCr = Resources.Load("YpCbCr", typeof(Material)) as Material;
			if (matYpCbCr != null)
			{
				_background.material = matYpCbCr;

				_textureYpID = Shader.PropertyToID("Yp");
				Debug.Log("_textureYpID == " + _textureYpID);

				_textureCbCrID = Shader.PropertyToID("CbCr");
				Debug.Log("_textureCbCrID == " + _textureCbCrID);

				_background.material.SetTextureScale("Yp", new Vector2(1.0f, -1.0f));
				_background.material.SetTextureOffset("Yp", new Vector3(0.0f, 1.0f));
				_background.material.SetTextureScale("CbCr", new Vector2(1.0f, -1.0f));
				_background.material.SetTextureOffset("CbCr", new Vector3(0.0f, 1.0f));
			}
			else
			{
				Debug.LogError("[KudanAR] Failed to load YpCbCr material");
			}
		}

		private void UpdateBackground()
		{
			int width = 0, height = 0;
			System.IntPtr texture = GetTextureForPlane(0, ref width, ref height);
			if (texture != System.IntPtr.Zero)
			{
				if (_textureYp == null)
				{
					Debug.Log("CreateExternalTexture(" + width + ", " + height + ", TextureFormat.Alpha8, false, false, " + texture + ")");
					_textureYp = Texture2D.CreateExternalTexture(width, height, TextureFormat.Alpha8, false, false, texture);
					_cameraAspect = (float)width / (float)height;
					_finalTexture = _textureYp;
				}
				else
				{
					_textureYp.UpdateExternalTexture(texture);
				}
			}

			texture = GetTextureForPlane(1, ref width, ref height);
			if (texture != System.IntPtr.Zero)
			{
				if (_textureCbCr == null)
				{
					Debug.Log("CreateExternalTexture(" + width / 2 + ", " + height + ", TextureFormat.RGBA32, false, false, " + texture + ")");
					_textureCbCr = Texture2D.CreateExternalTexture(width / 2, height, TextureFormat.RGBA32, false, false, texture);
				}
				else
				{
					_textureCbCr.UpdateExternalTexture(texture);
				}
			}

			if (_textureYp != null && _textureCbCr != null)
			{
				_background.material.SetTexture(_textureYpID, _textureYp);
				_background.material.SetTexture(_textureCbCrID, _textureCbCr);
			}
			else
			{
				Debug.LogError("[KudanAR] Failed to create external textures");
			}
		}

		public override void ArbiTrackStart(Vector3 position, Quaternion orientation)
		{
			float[] f = new float[7];

			f[0] = position.x;
			f[1] = position.y;
			f[2] = position.z;

			f[3] = orientation.x;
			f[4] = orientation.y;
			f[5] = orientation.z;
			f[6] = orientation.w;

			NativeInterface.ArbiTrackStart(f);
		}

		public override bool ArbiTrackIsTracking()
		{
			return NativeInterface.ArbiTrackIsTracking();
		}

		public override void FloorPlaceGetPose(out Vector3 position, out Quaternion orientation)
		{
			float[] f = new float[7];

			NativeInterface.FloorPlaceGetPose(f, _floorHeight);

			position = new Vector3(f[0], f[1], f[2]);
			orientation = new Quaternion(f[3], f[4], f[5], f[6]);
		}

		public override void ArbiTrackGetPose(out Vector3 position, out Quaternion orientation)
		{
			float[] result = new float[7];
			NativeInterface.ArbiTrackGetPose(result);

			position = new Vector3(result[0], result[1], -result[2]);
			orientation = new Quaternion(result[3], result[4], result[5], result[6]);
		}
	}
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>jp.ksgwr</groupId>
  <artifactId>parallelpipeline</artifactId>
  <version>1.0.0</version>

  <properties>
    <github.repo.directory>/git/mvn-repo</github.repo.directory>
  </properties>
  <distributionManagement>
    <repository>
      <id>internal.repo</id>
      <name>Local Github Pages</name>
      <url>file://${github.repo.directory}</url>
    </repository>
  </distributionManagement>

  <build>
    <sourceDirectory>src/main/java</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>deploy</phase>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <phase>deploy</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <executions>
          <execution>
            <id>deploy</id>
            <phase>deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.11</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
</project>


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

<title>Element</title>
<meta name="date" content="2014-02-09">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

javax.lang.model.element

Interface Element

All Superinterfaces:

AnnotatedConstruct

All Known Subinterfaces:

ExecutableElement, PackageElement, Parameterizable, QualifiedNameable, TypeElement, TypeParameterElement, VariableElement

public interface Element
extends AnnotatedConstruct

Represents a program element such as a package, class, or method.
 Each element represents a static, language-level construct
 (and not, for example, a runtime construct of the virtual machine).

 Elements should be compared using the equals(Object)
 method.  There is no guarantee that any particular element will
 always be represented by the same object.

 To implement operations based on the class of an Element object, either use a visitor or
 use the result of the getKind() method.  Using instanceof is not necessarily a reliable idiom for
 determining the effective class of an object in this modeling
 hierarchy since an implementation may choose to have a single object
 implement multiple Element subinterfaces.

Since:

1.6

See Also:

Elements,
TypeMirror

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

<R,P> R
accept(ElementVisitor<R,P> v,
      P p)

Applies a visitor to this element.

TypeMirror
asType()

Returns the type defined by this element.

boolean
equals(Object obj)

Returns true if the argument represents the same
 element as this, or false otherwise.

<A extends Annotation>
A
getAnnotation(Class<A> annotationType)

Returns this construct's annotation of the specified type if
 such an annotation is present, else null.

List<? extends AnnotationMirror>
getAnnotationMirrors()

Returns the annotations that are directly present on
 this construct.

List<? extends Element>
getEnclosedElements()

Returns the elements that are, loosely speaking, directly
 enclosed by this element.

Element
getEnclosingElement()

Returns the innermost element
 within which this element is, loosely speaking, enclosed.

ElementKind
getKind()

Returns the kind of this element.

Set<Modifier>
getModifiers()

Returns the modifiers of this element, excluding annotations.

Name
getSimpleName()

Returns the simple (unqualified) name of this element.

int
hashCode()

Obeys the general contract of Object.hashCode.

Methods inherited from interface javax.lang.model.AnnotatedConstruct

getAnnotationsByType

Method Detail

asType

TypeMirror asType()

Returns the type defined by this element.

 A generic element defines a family of types, not just one.
 If this is a generic element, a prototypical type is
 returned.  This is the element's invocation on the
 type variables corresponding to its own formal type parameters.
 For example,
 for the generic class element C<N extends Number>,
 the parameterized type C<N> is returned.
 The Types utility interface has more general methods
 for obtaining the full range of types defined by an element.

Returns:

the type defined by this element

See Also:

Types

getKind

ElementKind getKind()

Returns the kind of this element.

Returns:

the kind of this element

getModifiers

Set<Modifier> getModifiers()

Returns the modifiers of this element, excluding annotations.
 Implicit modifiers, such as the public and static
 modifiers of interface members, are included.

Returns:

the modifiers of this element, or an empty set if there are none

getSimpleName

Name getSimpleName()

Returns the simple (unqualified) name of this element.  The
 name of a generic type does not include any reference to its
 formal type parameters.

 For example, the simple name of the type element java.util.Set<E> is "Set".

 If this element represents an unnamed package, an empty name is
 returned.

 If it represents a constructor, the name "<init>" is returned.  If it
 represents a static
 initializer, the name "<clinit>" is returned.

 If it represents an anonymous class or instance initializer, an empty name is returned.

Returns:

the simple name of this element

See Also:

PackageElement.getSimpleName(),
ExecutableElement.getSimpleName(),
TypeElement.getSimpleName(),
VariableElement.getSimpleName()

getEnclosingElement

Element getEnclosingElement()

Returns the innermost element
 within which this element is, loosely speaking, enclosed.

 If this element is one whose declaration is lexically enclosed
 immediately within the declaration of another element, that other
 element is returned.

 If this is a top-level type, its package is returned.

 If this is a package, null is
 returned.

 If this is a type parameter,
 the
 generic element of the type parameter is returned.

 If this is a method or constructor
 parameter, the executable
 element which declares the parameter is returned.

Returns:

the enclosing element, or null if there is none

See Also:

Elements.getPackageOf(javax.lang.model.element.Element)

getEnclosedElements

List<? extends Element> getEnclosedElements()

Returns the elements that are, loosely speaking, directly
 enclosed by this element.

 A class or
 interface is considered to enclose the fields, methods,
 constructors, and member types that it directly declares.

 A package
 encloses the top-level classes and interfaces within it, but is
 not considered to enclose subpackages.

 Other kinds of elements are not currently considered to enclose
 any elements; however, that may change as this API or the
 programming language evolves.

Note that elements of certain kinds can be isolated using
 methods in ElementFilter.

Returns:

the enclosed elements, or an empty list if none

See Also:

PackageElement.getEnclosedElements(),
TypeElement.getEnclosedElements(),
Elements.getAllMembers(javax.lang.model.element.TypeElement)

See The Java™ Language Specification:

8.8.9 Default Constructor, 8.9 Enums

equals

boolean equals(Object obj)

Returns true if the argument represents the same
 element as this, or false otherwise.

Note that the identity of an element involves implicit state
 not directly accessible from the element's methods, including
 state about the presence of unrelated types.  Element objects
 created by different implementations of these interfaces should
 not be expected to be equal even if "the same"
 element is being modeled; this is analogous to the inequality
 of Class objects for the same class file loaded through
 different class loaders.

Overrides:

equals in class Object

Parameters:

obj - the object to be compared with this element

Returns:

true if the specified object represents the same
          element as this

hashCode

int hashCode()

Obeys the general contract of Object.hashCode.

Overrides:

hashCode in class Object

See Also:

equals(java.lang.Object)

getAnnotationMirrors

List<? extends AnnotationMirror> getAnnotationMirrors()

Returns the annotations that are directly present on
 this construct.

 To get inherited annotations as well, use getAllAnnotationMirrors.

Specified by:

getAnnotationMirrors in interface AnnotatedConstruct

Returns:

the annotations directly present on this
 construct; an empty list if there are none

Since:

1.6

getAnnotation

<A extends Annotation> A getAnnotation(Class<A> annotationType)

Returns this construct's annotation of the specified type if
 such an annotation is present, else null.

 The annotation returned by this method could contain an element
 whose value is of type Class.
 This value cannot be returned directly:  information necessary to
 locate and load a class (such as the class loader to use) is
 not available, and the class might not be loadable at all.
 Attempting to read a Class object by invoking the relevant
 method on the returned annotation
 will result in a MirroredTypeException,
 from which the corresponding TypeMirror may be extracted.
 Similarly, attempting to read a Class[]-valued element
 will result in a MirroredTypesException.

 Note: This method is unlike others in this and related
 interfaces.  It operates on runtime reflective information —
 representations of annotation types currently loaded into the
 VM — rather than on the representations defined by and used
 throughout these interfaces.  Consequently, calling methods on
 the returned annotation object can throw many of the exceptions
 that can be thrown when calling methods on an annotation object
 returned by core reflection.  This method is intended for
 callers that are written to operate on a known, fixed set of
 annotation types.

Specified by:

getAnnotation in interface AnnotatedConstruct

Type Parameters:

A - the annotation type

Parameters:

annotationType - the Class object corresponding to
          the annotation type

Returns:

this construct's annotation for the specified
 annotation type if present, else null

Since:

1.6

See Also:

AnnotatedConstruct.getAnnotationMirrors(),
AnnotatedElement.getAnnotation(java.lang.Class<T>),
EnumConstantNotPresentException,
AnnotationTypeMismatchException,
IncompleteAnnotationException,
MirroredTypeException,
MirroredTypesException

accept

<R,P> R accept(ElementVisitor<R,P> v,
               P p)

Applies a visitor to this element.

Type Parameters:

R - the return type of the visitor's methods

P - the type of the additional parameter to the visitor's methods

Parameters:

v - the visitor operating on this element

p - additional parameter to the visitor

Returns:

a visitor-specified result

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
package im.actor.sdk.controllers.pickers.file.items;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import im.actor.sdk.R;

/**
 * Created by kiolt_000 on 16/09/2014.
 */
public class PictureFolderItem extends FolderItem {
    private final String bucketName;
    private final int bucketId;
    String albumImage = null;
    private int imgCounter = 0;

    public PictureFolderItem(int bucketId, String bucketName) {
        super("");
        this.bucketId = bucketId;
        this.bucketName = bucketName;
    }

    @Override
    public String getTitle() {
        return bucketName;
    }

    @Override
    public String getSubtitle(Context context) {
        return "" + imgCounter;
    }

    @Override
    public String getPath() {
        return "" + bucketId;
    }

    @Override
    public void bindData(View itemView) {
        super.bindData(itemView);

        TextView subTitleView = (TextView) itemView.findViewById(R.id.subtitle);

        subTitleView.setVisibility(View.VISIBLE);

    }

    @Override
    public void bindImage(View itemView) {

        final ImageView holder = (ImageView) itemView.findViewById(R.id.image);
        if (holder != null) {
            holder.setImageResource(R.drawable.example_user_placeholder);

            //ImageLoader.getInstance().displayImage("file://"+ albumImage, holder);

        }
        // super.bindImage(itemView);
    }

    public void putImage(String imgUri) {
        if (albumImage == null)
            albumImage = imgUri;
        imgCounter++;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#ffffff"
        android:paddingTop="25dp"
        android:elevation="4dp" />
    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>


text:
import http2_base_server
import logging
import messages_pb2

# Set the number of padding bytes per data frame to be very large
# relative to the number of data bytes for each data frame sent.
_LARGE_PADDING_LENGTH = 255
_SMALL_READ_CHUNK_SIZE = 5

class TestDataFramePadding(object):
    """
    In response to an incoming request, this test sends headers, followed by
    data, followed by a reset stream frame. Client asserts that the RPC failed.
    Client needs to deliver the complete message to the application layer.
  """

    def __init__(self, use_padding=True):
        self._base_server = http2_base_server.H2ProtocolBaseServer()
        self._base_server._handlers['DataReceived'] = self.on_data_received
        self._base_server._handlers['WindowUpdated'] = self.on_window_update
        self._base_server._handlers[
            'RequestReceived'] = self.on_request_received

        # _total_updates maps stream ids to total flow control updates received
        self._total_updates = {}
        # zero window updates so far for connection window (stream id '0')
        self._total_updates[0] = 0
        self._read_chunk_size = _SMALL_READ_CHUNK_SIZE

        if use_padding:
            self._pad_length = _LARGE_PADDING_LENGTH
        else:
            self._pad_length = None

    def get_base_server(self):
        return self._base_server

    def on_data_received(self, event):
        logging.info('on data received. Stream id: %d. Data length: %d' %
                     (event.stream_id, len(event.data)))
        self._base_server.on_data_received_default(event)
        if len(event.data) == 0:
            return
        sr = self._base_server.parse_received_data(event.stream_id)
        stream_bytes = ''
        # Check if full grpc msg has been read into the recv buffer yet
        if sr:
            response_data = self._base_server.default_response_data(
                sr.response_size)
            logging.info('Stream id: %d. total resp size: %d' %
                         (event.stream_id, len(response_data)))
            # Begin sending the response. Add ``self._pad_length`` padding to each
            # data frame and split the whole message into data frames each carrying
            # only self._read_chunk_size of data.
            # The purpose is to have the majority of the data frame response bytes
            # be padding bytes, since ``self._pad_length`` >> ``self._read_chunk_size``.
            self._base_server.setup_send(response_data,
                                         event.stream_id,
                                         pad_length=self._pad_length,
                                         read_chunk_size=self._read_chunk_size)

    def on_request_received(self, event):
        self._base_server.on_request_received_default(event)
        logging.info('on request received. Stream id: %s.' % event.stream_id)
        self._total_updates[event.stream_id] = 0

    # Log debug info and try to resume sending on all currently active streams.
    def on_window_update(self, event):
        logging.info('on window update. Stream id: %s. Delta: %s' %
                     (event.stream_id, event.delta))
        self._total_updates[event.stream_id] += event.delta
        total = self._total_updates[event.stream_id]
        logging.info('... - total updates for stream %d : %d' %
                     (event.stream_id, total))
        self._base_server.on_window_update_default(
            event,
            pad_length=self._pad_length,
            read_chunk_size=self._read_chunk_size)


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

namespace Azure.ResourceManager.IotHub.Models
{
    /// <summary> The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. </summary>
    public partial class IotHubFallbackRouteProperties
    {
        /// <summary> Initializes a new instance of IotHubFallbackRouteProperties. </summary>
        /// <param name="source"> The source to which the routing rule is to be applied to. For example, DeviceMessages. </param>
        /// <param name="endpointNames"> The list of endpoints to which the messages that satisfy the condition are routed to. Currently only 1 endpoint is allowed. </param>
        /// <param name="isEnabled"> Used to specify whether the fallback route is enabled. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="endpointNames"/> is null. </exception>
        public IotHubFallbackRouteProperties(IotHubRoutingSource source, IEnumerable<string> endpointNames, bool isEnabled)
        {
            Argument.AssertNotNull(endpointNames, nameof(endpointNames));

            Source = source;
            EndpointNames = endpointNames.ToList();
            IsEnabled = isEnabled;
        }

        /// <summary> Initializes a new instance of IotHubFallbackRouteProperties. </summary>
        /// <param name="name"> The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. </param>
        /// <param name="source"> The source to which the routing rule is to be applied to. For example, DeviceMessages. </param>
        /// <param name="condition"> The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. </param>
        /// <param name="endpointNames"> The list of endpoints to which the messages that satisfy the condition are routed to. Currently only 1 endpoint is allowed. </param>
        /// <param name="isEnabled"> Used to specify whether the fallback route is enabled. </param>
        internal IotHubFallbackRouteProperties(string name, IotHubRoutingSource source, string condition, IList<string> endpointNames, bool isEnabled)
        {
            Name = name;
            Source = source;
            Condition = condition;
            EndpointNames = endpointNames;
            IsEnabled = isEnabled;
        }

        /// <summary> The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. </summary>
        public string Name { get; set; }
        /// <summary> The source to which the routing rule is to be applied to. For example, DeviceMessages. </summary>
        public IotHubRoutingSource Source { get; set; }
        /// <summary> The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. </summary>
        public string Condition { get; set; }
        /// <summary> The list of endpoints to which the messages that satisfy the condition are routed to. Currently only 1 endpoint is allowed. </summary>
        public IList<string> EndpointNames { get; }
        /// <summary> Used to specify whether the fallback route is enabled. </summary>
        public bool IsEnabled { get; set; }
    }
}


text:
sessions::SessionWindow::WindowType WindowTypeForBrowserType(
    Browser::Type type) {
  switch (type) {
    case Browser::TYPE_POPUP:
      return sessions::SessionWindow::TYPE_POPUP;
    case Browser::TYPE_TABBED:
      return sessions::SessionWindow::TYPE_TABBED;
  }
  NOTREACHED();
  return sessions::SessionWindow::TYPE_TABBED;
}

Browser::Type BrowserTypeForWindowType(
    sessions::SessionWindow::WindowType type) {
  switch (type) {
    case sessions::SessionWindow::TYPE_POPUP:
      return Browser::TYPE_POPUP;
    case sessions::SessionWindow::TYPE_TABBED:
      return Browser::TYPE_TABBED;
  }
  NOTREACHED();
  return Browser::TYPE_TABBED;
}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<!--
  ~ Copyright (C) Alexandre Harvey-Tremblay - All Rights Reserved
  ~ Unauthorized copying of this file, via any medium is strictly prohibited
  ~ Proprietary and confidential
  ~ Written by Alexandre Harvey-Tremblay <ahtremblay@gmail.com>, 2014
  -->

<taxRule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="https://www.salesfront.com/schema 20150831/taxRule.xsd">

    <taxRuleSrn>srn:sf:taxRule:111111111111111111111111111111:111111111111111111111111111111</taxRuleSrn>
    <taxName>HST</taxName>
    <regulatoryId>98123</regulatoryId>
    <percent>10</percent>
    <conditions scope="for-all-addresses">
        <condition>
            <field>label</field>
            <operator>not-equal</operator>
            <value>shipping</value>
        </condition>
    </conditions>
    <conditions scope="at-least-one-address">
        <condition>
            <field>label</field>
            <operator>equal</operator>
            <value>shipping</value>
        </condition>
        <condition>
            <field>postalCountry</field>
            <operator>equal</operator>
            <value>CA</value>
        </condition>
        <condition>
            <field>administrativeArea</field>
            <operator>equal</operator>
            <value>ON</value>
        </condition>
    </conditions>
</taxRule>