text:
<?php
	session_start();
	$cedula=$_SESSION['estudiante_ced'];
?>

<title>SICEUDO Sucre | Estudiantes</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="keywords" content="siceudo">
<link rel="stylesheet" href="css/main.css">
<link rel="icon" type="image/x-icon" href="imagenes/logo.ico">
<link href="css/estilos.css" rel="stylesheet" type="text/css">
<link href="css/estilos_simplemodal.css" rel="stylesheet" type="text/css">
<link type="text/css" rel="stylesheet" media="all" href="include/jscalendar/calendar-blue.css" title="win2k-cold-1">

<?php
include ("procesos/funciones.php");
	include ("config.php");
?>

    	    .: Bienvenidos :.
        Sistema Integral de Control de Estudios de la Universidad de Oriente
        Miércoles, 07 de Octubre de 2015

Menú Principal

Inicio

Ingresar Retiro

Ingresar Reingreso

Ingresar Cambio de especialidad

<?php
if(isset($_GET['bandera']) && ($GET_['bandera']==0))
{
?>

        Solicitud realizada con éxito

<?php
}
else
{
	if(isset($_GET['bandera']) && ($GET_['bandera']==1))
	{
	?>

            Imposible procesar esta solicitud

    <?php
	}
}
?>

Pasos a seguir en el proceso de inscripción

(1)

INICIA TU SESIÓN

(2)

REGISTRA TU INSCRIPCIÓN

(3)

IMPRIME TU CONSTANCIA

(4)

CIERRA TU SESIÓN

Actualización de Datos

<marquee width="100%" height="15" direction="left" behavior="scroll" onMouseOver="this.setAttribute('scrollamount', 0, 0);" onMouseOut="this.setAttribute('scrollamount', 1, 0);" truespeed scrolldelay="15" scrollamount="1" loop="infinite" style="height: 15px; width: 100%;">
ATENCIÓN : Horarios  2-2015...!
</marquee>

Para realizar cualquier solicitud, debes tener tus datos actualizados.

		  Puedes hacerlo aqui en la opción Actualizar Datos.

¡Recuerda que tu contraseña es personal!

¡No compartas tu contraseña! ¡Create un contraseña segura! ¡No coloques como contraseña tu número de cédula! Recuerda que esta contraseña es única para todos los procesos llevados a cabo por DACENS.

¿Conoces las Normas de Permanencia?

		Entérate cuándo pueden afectarte. Revísalas aquí

Lo que debes saber sobre las Normas de Repitencia

		Entérate cuándo pueden afectarte. Revísalas aquí

Punto de contacto

Cualquier consulta, inquietud, opinión, reclamo, o crítica constructiva, escríbenos al correo:
dacens@udo.edu.ve

Calendario Académico

<marquee width="300" height="200" direction="up" behavior="scroll" onMouseOver="this.setAttribute('scrollamount', 0, 0);" onMouseOut="this.setAttribute('scrollamount', 1, 0);" truespeed scrolldelay="50" scrollamount="1" loop="infinite" style="height: 200px; width: 300px;">
PUBLICACIÓN CITAS DE INSCRIPCIÓN
LUNES 05 DE OCTUBRE

INSCRIPCION REGULARES 2015-2
MIÉRCOLES 07, JUEVES 08 Y VIERNES 09 DE OCTUBRE

INICIO DE ACTIVIDADES DOCENTES
MARTES 13 DE OCTUBRE

FINALIZACIÓN DE ACTIVIDADES DOCENTES
VIERNES 26 DE FEBRERO 2016

</marquee>

Iniciar Sesión

	<form id="login" action="procesos/motor_funciones.php" method="POST">

 Cédula:  	  <input id="cedula" name="cedula" title="Ingrese Cedula">

 Contraseña:  	  <input id="contraseña" type="password" name="contraseña"   title="Ingrese contraseña">

           <?php
           if(isset ($_GET['id']) && $_GET['id']== 1){
		echo "
El login de Usuario o la Clave Insertada Es Incorrecta!
";// el '

             <input id="login" type="submit" value="Entrar" name="accion" title=" login">

</form>

¿Olvidó su contraseña?

Descargas

» Planilla para Ajustar Lista de  Clases

» Solicitud de Grado

» Solvencia Administrativa

» Constancia Registro Traslado

» Constancia Registro R. Egresado

» Horarios 2-2015

» Gacetas

» Manuales

Para un mejor funcionamiento Descarga

Enlaces de Interés

				» Universidad de Oriente (UDO)

» Ministerio de Educación Superior (MES)

» Oficina de Planif. del Sector Universitario (OPSU)

©2015 | Universidad de Oriente :: Venezuela

				Rectorado :: Coordinación General de Control de Estudios


text:
=begin
Pseudocode:

Decided a hash to store the list

DEF a method that creates an empty hash
  This methods creates a  "Hash.new"

DEF a method that took two arguments, one that was the item name and the other the value
Our inputs will be a string and integer
In order to add key and value where key will be the string/grocery item name and value will be "integer"/quantity

DEF a method that would remove an existing item on the hash
Only have to remove key from our hash, we can use the remove method here

DEF a method that updates the items quantity within the hash
Being able to update/change the value to a key.

DEF a method that will neatly print the hash into an organized list
Can use concatenate all the items to print out
=end

def new_list
  Hash.new
end

def add_item(item, value, listname)
  listname[item] = value
end

def remove_item(item, listname)
  listname.delete(item)
end

def update_items(item, value, listname)
  listname.update(item => value) if listname[item] != nil
  #Only updates existing keys and value
  #Prevents updating key and values that don't already exist
end

def print_list(listname)
  listname.each do |key, value|
    puts "#{key}: #{value}"
  end
end

=begin
Test Code
groceries = new_list

add_item("Lemonade", 2, groceries)
add_item("Tomatoes", 3, groceries)
add_item("Onions", 1, groceries)
add_item("Ice Cream", 4, groceries)

print_list(groceries)

remove_item("Oranges", groceries)

print_list(groceries)

update_items("Oranges", 1, groceries)

print_list(groceries)
=end

=begin
Reflection
What did you learn about pseudocode from working on this challenge?
It helps figuring the flow of the program, what needs to be done, and
what your inputs and outputs should be.

What are the tradeoffs of using Arrays and Hashes for this challenge?
As oppose to something else? Well it's a good way to sort your information
but maybe there's an even more efficient way to do it, maybe using classes.

What does a method return?
A method returns a value defined by the programmer.

What kind of things can you pass into methods as arguments?
Hmm, there's a lot of different things you can pass as arguments in a method.
I don't know the complete list, but off the top of my head, strings, integers,floats,
array. There's probably a lot more.

How can you pass information between methods?
I think for one method you can pass another method as the argument. I think
that works.

What concepts were solidified in this challenge, and what concepts are still confusing?
Conceptually, I believe I have a more solid understanding of hashes. There are
definitely some concepts I need to review about them since I ran into a few errors
when thinking about how to go about this challenge. Luckily, my partner was
more well versed than I was able to help me out.

=end

redpajama_set_name: RedPajamaGithub


text:
<template id="awesome-slider">

	<content id="content" select="item"></content>

</template>


text:
Before do |scenario|
  # The +scenario+ argument is optional, but if you use it, you can get the title,
  # description, or name (title + description) of the scenario that is about to be
  # executed.
  File.open($log_file, 'w') {|file| file.truncate(0) } if $log_file.exist?
end


text:
from gnuradio import blocks
from gnuradio import digital
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import wxgui
from gnuradio.eng_option import eng_option
from gnuradio.fft import window
from gnuradio.filter import firdes
from gnuradio.wxgui import fftsink2
from gnuradio.wxgui import forms
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import osmosdr
import wx

class nrf905_demod(grc_wxgui.top_block_gui):

    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="NRF905 Demodulator")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.slider_rf_gain = slider_rf_gain = 30
        self.slider_if_gain = slider_if_gain = 30
        self.slider_freq = slider_freq = 868415e3
        self.samp_rate = samp_rate = 1000000
        self.checkbox_agc = checkbox_agc = True

        ##################################################
        # Blocks
        ##################################################
        _slider_rf_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._slider_rf_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_slider_rf_gain_sizer,
        	value=self.slider_rf_gain,
        	callback=self.set_slider_rf_gain,
        	label="RF Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._slider_rf_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_slider_rf_gain_sizer,
        	value=self.slider_rf_gain,
        	callback=self.set_slider_rf_gain,
        	minimum=0,
        	maximum=40,
        	num_steps=40,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_slider_rf_gain_sizer)
        _slider_if_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._slider_if_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_slider_if_gain_sizer,
        	value=self.slider_if_gain,
        	callback=self.set_slider_if_gain,
        	label="IF Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._slider_if_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_slider_if_gain_sizer,
        	value=self.slider_if_gain,
        	callback=self.set_slider_if_gain,
        	minimum=0,
        	maximum=56,
        	num_steps=56,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_slider_if_gain_sizer)
        _slider_freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._slider_freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_slider_freq_sizer,
        	value=self.slider_freq,
        	callback=self.set_slider_freq,
        	label="Frequency",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._slider_freq_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_slider_freq_sizer,
        	value=self.slider_freq,
        	callback=self.set_slider_freq,
        	minimum=863e6,
        	maximum=870e6,
        	num_steps=(8700-8630),
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_slider_freq_sizer)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "FFT")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "scope")
        self.Add(self.notebook_0)
        self._checkbox_agc_check_box = forms.check_box(
        	parent=self.GetWin(),
        	value=self.checkbox_agc,
        	callback=self.set_checkbox_agc,
        	label="AGC",
        	true=True,
        	false=False,
        )
        self.Add(self._checkbox_agc_check_box)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(slider_freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(checkbox_agc, 0)
        self.rtlsdr_source_0.set_gain(slider_rf_gain, 0)
        self.rtlsdr_source_0.set_if_gain(slider_if_gain, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)

        self.digital_gfsk_demod_0 = digital.gfsk_demod(
        	samples_per_symbol=int(samp_rate/100e3),
        	sensitivity=1.0,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.005,
        	freq_error=0.0,
        	verbose=False,
        	log=False,
        )
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/tmp/nrf.dat", False)
        self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.rtlsdr_source_0, 0), (self.digital_gfsk_demod_0, 0))
        self.connect((self.digital_gfsk_demod_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))

# QT sink close method reimplementation

    def get_slider_rf_gain(self):
        return self.slider_rf_gain

    def set_slider_rf_gain(self, slider_rf_gain):
        self.slider_rf_gain = slider_rf_gain
        self._slider_rf_gain_slider.set_value(self.slider_rf_gain)
        self._slider_rf_gain_text_box.set_value(self.slider_rf_gain)
        self.rtlsdr_source_0.set_gain(self.slider_rf_gain, 0)

    def get_slider_if_gain(self):
        return self.slider_if_gain

    def set_slider_if_gain(self, slider_if_gain):
        self.slider_if_gain = slider_if_gain
        self._slider_if_gain_slider.set_value(self.slider_if_gain)
        self._slider_if_gain_text_box.set_value(self.slider_if_gain)
        self.rtlsdr_source_0.set_if_gain(self.slider_if_gain, 0)

    def get_slider_freq(self):
        return self.slider_freq

    def set_slider_freq(self, slider_freq):
        self.slider_freq = slider_freq
        self._slider_freq_slider.set_value(self.slider_freq)
        self._slider_freq_text_box.set_value(self.slider_freq)
        self.rtlsdr_source_0.set_center_freq(self.slider_freq, 0)

    def get_samp_rate(self):
        return self.samp_rate

    def set_samp_rate(self, samp_rate):
        self.samp_rate = samp_rate
        self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
        self.rtlsdr_source_0.set_sample_rate(self.samp_rate)

    def get_checkbox_agc(self):
        return self.checkbox_agc

    def set_checkbox_agc(self, checkbox_agc):
        self.checkbox_agc = checkbox_agc
        self._checkbox_agc_check_box.set_value(self.checkbox_agc)
        self.rtlsdr_source_0.set_gain_mode(self.checkbox_agc, 0)

if __name__ == '__main__':
    import ctypes
    import os
    if os.name == 'posix':
        try:
            x11 = ctypes.cdll.LoadLibrary('libX11.so')
            x11.XInitThreads()
        except:
            print "Warning: failed to XInitThreads()"
    parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
    (options, args) = parser.parse_args()
    tb = nrf905_demod()
    tb.Start(True)
    tb.Wait()


text:
/* This is stub file for gapi.client.{{=it.name}} definition tests */
/* IMPORTANT.
* This file was automatically generated by https://github.com/Bolisov/google-api-typings-generator. Please do not edit it manually.
* In case of any problems please post issue to https://github.com/Bolisov/google-api-typings-generator
**/
gapi.load('client', () => {
    /** now we can use gapi.client */
    gapi.client.load('consumersurveys', 'v2', () => {
        /** now we can use gapi.client.consumersurveys */

        /** don't forget to authenticate your client before sending any request to resources: */
        /** declare client_id registered in Google Developers Console */
        const client_id = '<<PUT YOUR CLIENT ID HERE>>';
        const scope = [
            /** View and edit your surveys and results */
            'https://www.googleapis.com/auth/consumersurveys',
            /** View the results for your surveys */
            'https://www.googleapis.com/auth/consumersurveys.readonly',
            /** View your email address */
            'https://www.googleapis.com/auth/userinfo.email',
        ];
        const immediate = true;
        gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
            if (authResult && !authResult.error) {
                /** handle succesfull authorization */
                run();
            } else {
                /** handle authorization error */
            }
        });
        run();
    });

    async function run() {
        /** Retrieves a MobileAppPanel that is available to the authenticated user. */
        await gapi.client.mobileapppanels.get({
            panelId: "panelId",
        });
        /** Lists the MobileAppPanels available to the authenticated user. */
        await gapi.client.mobileapppanels.list({
            maxResults: 1,
            startIndex: 2,
            token: "token",
        });
        /** Updates a MobileAppPanel. Currently the only property that can be updated is the owners property. */
        await gapi.client.mobileapppanels.update({
            panelId: "panelId",
        });
        /**
         * Retrieves any survey results that have been produced so far. Results are formatted as an Excel file. You must add "?alt=media" to the URL as an
         * argument to get results.
         */
        await gapi.client.results.get({
            surveyUrlId: "surveyUrlId",
        });
        /** Removes a survey from view in all user GET requests. */
        await gapi.client.surveys.delete({
            surveyUrlId: "surveyUrlId",
        });
        /** Retrieves information about the specified survey. */
        await gapi.client.surveys.get({
            surveyUrlId: "surveyUrlId",
        });
        /** Creates a survey. */
        await gapi.client.surveys.insert({
        });
        /** Lists the surveys owned by the authenticated user. */
        await gapi.client.surveys.list({
            maxResults: 1,
            startIndex: 2,
            token: "token",
        });
        /** Begins running a survey. */
        await gapi.client.surveys.start({
            resourceId: "resourceId",
        });
        /** Stops a running survey. */
        await gapi.client.surveys.stop({
            resourceId: "resourceId",
        });
        /** Updates a survey. Currently the only property that can be updated is the owners property. */
        await gapi.client.surveys.update({
            surveyUrlId: "surveyUrlId",
        });
    }
});


text:
namespace Microsoft.DocAsCode.Metadata.ManagedReference
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Security.Cryptography;
    using System.Reflection;

    using Microsoft.DocAsCode.Common;

    public abstract class CacheBase
    {
        private static readonly int CleanupIntervalInDays = 5; // 5 days and clean up
        private static readonly int CleanupMaxCount = 100; // 100 items before clean up
        private static readonly int CleanupTo = 10; // clean up and keep latest 10 items
        private Dictionary<string, BuildInfo> _configs = new Dictionary<string, BuildInfo>();
        private readonly string _path;
        public static readonly string AssemblyName;
        static CacheBase()
        {
            AssemblyName = Assembly.GetExecutingAssembly().GetName().ToString();
        }

        public CacheBase(string path)
        {
            _path = path;
            _configs = ReadCacheFile(path);
        }

        public BuildInfo GetValidConfig(string key)
        {
            return GetConfig(key);
        }

        public BuildInfo GetValidConfig(IEnumerable<string> inputProjects)
        {
            var key = StringExtension.GetNormalizedFullPathKey(inputProjects);
            return GetConfig(key);
        }

        public void SaveToCache(string key, IDictionary<string, List<string>> containedFiles, DateTime triggeredTime, string outputFolder, IList<string> fileRelativePaths, ExtractMetadataOptions options)
        {
            DateTime completeTime = DateTime.UtcNow;
            BuildInfo info = new BuildInfo
            {
                InputFilesKey = key,
                ContainedFiles = containedFiles,
                TriggeredUtcTime = triggeredTime,
                CompleteUtcTime = completeTime,
                OutputFolder = StringExtension.ToNormalizedFullPath(outputFolder),
                RelativeOutputFiles = StringExtension.GetNormalizedPathList(fileRelativePaths),
                BuildAssembly = AssemblyName,
                Options = options,
            };
            SaveConfig(key, info);
        }

        public void SaveToCache(IEnumerable<string> inputProjects, IDictionary<string, List<string>> containedFiles, DateTime triggeredTime, string outputFolder, IList<string> fileRelativePaths, ExtractMetadataOptions options)
        {
            var key = StringExtension.GetNormalizedFullPathKey(inputProjects);
            SaveToCache(key, containedFiles, triggeredTime, outputFolder, fileRelativePaths, options);
        }

        public void SaveToCache(string key, IEnumerable<string> containedFiles, DateTime triggeredTime, string outputFolder, IList<string> fileRelativePaths, ExtractMetadataOptions options)
        {
            var dict = new Dictionary<string, List<string>> { { key, containedFiles.ToList() } };
            SaveToCache(key, dict, triggeredTime, outputFolder, fileRelativePaths, options);
        }

        #region Virtual Methods
        protected virtual BuildInfo GetConfig(string key)
        {
            BuildInfo buildInfo = this.ReadConfig(key);
            if (buildInfo != null)
            {
                var checksum = buildInfo.CheckSum;
                try
                {
                    var resultCorrupted = GetHash(buildInfo.OutputFolder, buildInfo.RelativeOutputFiles) != checksum;

                    if (!resultCorrupted && checksum != null)
                    {
                        return buildInfo;
                    }
                    else
                    {
                        Logger.Log(LogLevel.Info, $"Cache for {key} in {_path} is corrupted, rebuild...");
                    }
                }
                catch (Exception e)
                {
                    Logger.Log(LogLevel.Info, $"Cache for {key} in {_path} is not valid: {e.Message}, rebuild...");
                }
            }

            return null;
        }

        protected virtual BuildInfo ReadConfig(string key)
        {
            _configs.TryGetValue(key, out BuildInfo info);
            return info;
        }

        protected virtual void SaveConfig(string key, BuildInfo config)
        {
            config.CheckSum = GetHash(config.OutputFolder, config.RelativeOutputFiles);
            _configs[key] = config;
            CleanupConfig();

            JsonUtility.Serialize(_path, _configs);
        }

        protected virtual void CleanupConfig()
        {
            // Copy oldkeys to a new list
            var oldKeys = _configs.Where(s => s.Value.TriggeredUtcTime.CompareTo(DateTime.UtcNow.AddDays(-CleanupIntervalInDays)) < 1).ToList();
            foreach (var key in oldKeys)
            {
                _configs.Remove(key.Key);
            }

            if (_configs.Count > CleanupMaxCount)
            {
                var cleanUpTo = Math.Min(CleanupMaxCount, CleanupTo);
                // Cleanup the old ones
                _configs = _configs.OrderByDescending(s => s.Value.TriggeredUtcTime).Take(cleanUpTo).ToDictionary(s => s.Key, s => s.Value);
            }
        }
        #endregion

        #region Private Methodes
        private static Dictionary<string, BuildInfo> ReadCacheFile(string path)
        {
            try
            {
                if (File.Exists(path))
                {
                    return JsonUtility.Deserialize<Dictionary<string, BuildInfo>>(path);
                }
            }
            catch (Exception e)
            {
                Logger.LogWarning($"Cache file {path} is invalid, ignored: {e.Message}.");
            }

            return new Dictionary<string, BuildInfo>();
        }

        private static string GetHash(string rootFolder, IEnumerable<string> relativeFilePath)
        {
            if (relativeFilePath == null) return null;
            var files = (from p in relativeFilePath select Path.Combine(rootFolder, p)).ToList();

            using FileCollectionStream reader = new FileCollectionStream(files);
            return HashUtility.GetSha256HashString(reader);
        }

        class FileCollectionStream : Stream
        {
            private IEnumerator<string> _fileEnumerator;
            private FileStream _stream;

            public FileCollectionStream(IEnumerable<string> files)
            {
                if (files == null) _fileEnumerator = null;
                else _fileEnumerator = files.GetEnumerator();
            }

            public override bool CanRead => true;

            public override bool CanSeek => false;

            public override bool CanWrite => false;

            public override long Length => throw new NotSupportedException();

            public override long Position
            {
                get { throw new NotSupportedException(); }
                set { throw new NotSupportedException(); }
            }

            public override void Flush() => throw new NotSupportedException();

            public override int Read(byte[] buffer, int offset, int count)
            {
                if (_fileEnumerator == null)
                {
                    return 0;
                }

                if (_stream == null && !TryGetNextFileStream(out _stream))
                {
                    return 0;
                }

                int readed;
                while (true)
                {
                    readed = _stream.Read(buffer, offset, count);
                    if (readed == 0)
                    {
                        // Dispose current stream before fetching the next one
                        _stream.Dispose();
                        if (!TryGetNextFileStream(out _stream))
                        {
                            return 0;
                        }
                    }
                    else
                    {
                        return readed;
                    }
                }
            }

            public override long Seek(long offset, SeekOrigin origin)=>
                throw new NotSupportedException();

            public override void SetLength(long value) =>
                throw new NotSupportedException();

            public override void Write(byte[] buffer, int offset, int count) =>
                throw new NotSupportedException();

            protected override void Dispose(bool disposing)
            {
                if (disposing)
                {
                    if (_fileEnumerator != null)
                    {
                        _fileEnumerator.Dispose();
                    }
                    if (_stream != null)
                    {
                        _stream.Dispose();
                    }
                }

                base.Dispose(disposing);
            }

            private bool TryGetNextFileStream(out FileStream stream)
            {
                var next = _fileEnumerator.MoveNext();
                if (!next)
                {
                    stream = null;
                    return false;
                }

                stream = new FileStream(_fileEnumerator.Current, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                return true;
            }
        }

        #endregion
    }
}


text:
#include <aws/lex/model/ConfirmationStatus.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>

using namespace Aws::Utils;

namespace Aws
{
  namespace LexRuntimeService
  {
    namespace Model
    {
      namespace ConfirmationStatusMapper
      {

        static const int None_HASH = HashingUtils::HashString("None");
        static const int Confirmed_HASH = HashingUtils::HashString("Confirmed");
        static const int Denied_HASH = HashingUtils::HashString("Denied");

        ConfirmationStatus GetConfirmationStatusForName(const Aws::String& name)
        {
          int hashCode = HashingUtils::HashString(name.c_str());
          if (hashCode == None_HASH)
          {
            return ConfirmationStatus::None;
          }
          else if (hashCode == Confirmed_HASH)
          {
            return ConfirmationStatus::Confirmed;
          }
          else if (hashCode == Denied_HASH)
          {
            return ConfirmationStatus::Denied;
          }
          EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
          if(overflowContainer)
          {
            overflowContainer->StoreOverflow(hashCode, name);
            return static_cast<ConfirmationStatus>(hashCode);
          }

          return ConfirmationStatus::NOT_SET;
        }

        Aws::String GetNameForConfirmationStatus(ConfirmationStatus enumValue)
        {
          switch(enumValue)
          {
          case ConfirmationStatus::None:
            return "None";
          case ConfirmationStatus::Confirmed:
            return "Confirmed";
          case ConfirmationStatus::Denied:
            return "Denied";
          default:
            EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
            if(overflowContainer)
            {
              return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
            }

            return {};
          }
        }

      } // namespace ConfirmationStatusMapper
    } // namespace Model
  } // namespace LexRuntimeService
} // namespace Aws


text:
package io.github.aquerr.eaglefactions.scheduling;

import java.util.concurrent.Callable;

public interface EagleFactionsCallableTask<V> extends Callable<V>
{
    V call() throws Exception;
}


text:
"""
Test the core storagemgr functionality - scanning and maintaing the archive
"""
from shutil import copy2, rmtree
from os.path import isdir, join
from os import makedirs, remove

from django.conf import settings
from django.test import TestCase

from storage.models import RootPath, File
from storage.scan import QuickScan

class StorageTests(TestCase):
    fixtures = ['initial_data']

    def setUp(self):
        # Get tmp directory
        tmpdirs = ['/run/shm', '/tmp']
        self.tmpdir = None
        for d in tmpdirs:
            if isdir(d):
                self.tmpdir = d
                break
        self.assertNotEqual(self.tmpdir, None,
            msg="Unable to find temporary directory")

        # Create initial directories to manage
        self.rootdir = join(self.tmpdir, 'storagemgr_tests')
        if isdir(self.rootdir):
            # Delete the directory and start again
            rmtree(self.rootdir)
        makedirs(self.rootdir)
        self.test_data = join(settings.PROJECT_DIR, 'storage', 'test_data')

        # Copy initial files in
        self.image1_src = join(self.test_data, "image1.png")
        copy2(self.image1_src, self.rootdir)
        self.image2_src = join(self.test_data, "image2.png")
        copy2(self.image2_src, self.rootdir)
        self.image2 = join(self.rootdir, "image2.png")

        # Initial DB population
        self.rootpath = RootPath(path=self.rootdir)
        self.rootpath.save()
        scanner = QuickScan()
        scanner.scan()

        return

    def test_initial_scan(self):
        """Confirm that the setUp produced the expected environment"""
        #import pdb; pdb.set_trace()
        self.assertEqual(File.objects.all().count(), 2)
        i1 = File.objects.get(name='image1.png')
        self.assertEqual(i1.hash.digest,
                         #'a9a008968f02ce2ee596052cb7212734b8be932f0df26d2e5052401b07076bf1')
                         '4511e4bd5136a1c1491abfbc2221ffcc37c77f3d1213a41b2d3ea9e87ac6549c')
        return

    def test_delete_and_rescan(self):
        """Check:
        1. Deleted file is correctly marked as such.
        2. Recovered and rescanned produces new entry.
        """
        # Delete image2, rescan and confirm deleted
        remove(self.image2)
        scanner = QuickScan()
        scanner.scan()
        i2 = File.objects.get(name='image2.png')
        self.assertTrue(i2.deleted, "Expected image2.png to be deleted")

        # Recover file, rescan, and check for undeleted entry
        copy2(self.image2_src, self.rootdir)
        scanner.scan()
        self.assertEqual(File.objects.filter(name='image2.png').count(), 2)
        self.assertEqual(File.objects.filter(
                            name='image2.png', deleted__isnull=True).count(), 1)
        return


text:
from nn_wtf.neural_network_graph import NeuralNetworkGraph
from nn_wtf.saver_mixin import SaverMixin, DEFAULT_TRAIN_DIR
from nn_wtf.summary_writer_mixin import SummaryWriterMixin

__author__ = 'Lene Preuss <lene.preuss@gmail.com>'

class MNISTGraph(NeuralNetworkGraph, SaverMixin, SummaryWriterMixin):
    """A NeuralNetworkGraph configured with the MNIST data geometry which also
    periodically writes a report during the training process and saves the
    trained graph.
    """

    # The MNIST dataset has 10 classes, representing the digits 0 through 9.
    NUM_CLASSES = 10

    # The MNIST images are always 28x28 pixels.
    IMAGE_SIZE = 28
    IMAGE_PIXELS = IMAGE_SIZE * IMAGE_SIZE

    def __init__(
        self, input_size=None, layer_sizes=(128, 32, None), output_size=None):
        """The MNISTGraph constructor takes no positional args, in contrast with NeuralNetworkGraph.
        input_size and output_size are present for compatibility, but ignored.

        :param input_size: ignored, present for client compatibility
        :param layer_sizes: tuple of sizes of the neural network hidden layers
        :param output_size: ignored, present for client compatibility
        :param learning_rate: learning rate for gradient descent optimizer
        :param verbose: whether to print some info about the training progress
        :param train_dir: where to write savepoints and summaries
        """
        NeuralNetworkGraph.__init__(
            self, self.IMAGE_PIXELS, layer_sizes, self.NUM_CLASSES
        )

    def set_session(self, session=None, verbose=True, train_dir=DEFAULT_TRAIN_DIR):
        super().set_session()
        SaverMixin.__init__(self, self.session, train_dir)
        SummaryWriterMixin.__init__(self, self.session, verbose, train_dir)

    def train(
            self, data_sets, max_steps, precision=None, steps_between_checks=100, run_as_check=None,
            batch_size=1000
    ):
        assert self.summary_op is not None, 'called train() before setting up summary op'
        assert self.summary_writer is not None, 'called train() before setting up summary writer'
        assert self.saver is not None, 'called train() before setting up saver'

        # run write_summary() after every check
        super().train(
            data_sets, max_steps, precision, steps_between_checks,
            run_as_check=self.write_summary, batch_size=batch_size
        )

        # Save a checkpoint when done
        self.save(global_step=self.trainer.num_steps())
        self.print_evaluations(data_sets, batch_size)


text:
<!DOCTYPE html>

	<meta charset="UTF-8">
	<meta http-Equiv="Cache-Control" Content="no-cache">
	<meta http-Equiv="Pragma" Content="no-cache">
	<meta http-Equiv="Expires" Content="0">
	<title>Brunel Output</title>

	<link rel="stylesheet" type="text/css" href="https://brunelvis.org/js/brunel.2.6.css" charset="utf-8"/>

0069    map('uk', 'france', 'spain', 'germany') + map(labels)

Pass:

<svg id="visualization" width="480" height="330"></svg>


text:
\documentclass{beamer}

\usepackage{color} % Package to include colors for syntax highlighting
\usepackage{graphicx}  % Package to include images
\usepackage{hyperref}  % Hyperlinks
\usepackage{tikz}

\setbeamertemplate{navigation symbols}{}  % Remove navigation symbols
\usecolortheme[light]{solarized}

\title{Mid module feedback}
\date{}

\begin{document}

\frame{
    \titlepage
}

\frame{
    \begin{center}
        \includegraphics[width=.8\textwidth]{plot.pdf}
    \end{center}
}

\frame{
    \Large
    \begin{quote}
        Class site is good.
    \end{quote}
}

\frame{
    \Large
    \begin{quote}
        Class group work is good.
    \end{quote}
}

\frame{
    \Large
    \begin{quote}
        Class interaction is good.
    \end{quote}
}

\frame{
    \Large
    \begin{quote}
        Getting help.
    \end{quote}
}

\frame{
    \Large
    \begin{quote}
        ``Spending \pounds 30 on caterpillar cake''
    \end{quote}
}

% improvements

\frame{
    \begin{quote}
        ``Clearer steps on the board during examples could be useful, e.g. more
        narrative around the numbers.''
    \end{quote}
}

\frame{
    \begin{quote}
        ``Write key concepts on board''
    \end{quote}
}

\frame{
    \begin{quote}
        ``More information about coursework''
    \end{quote}
}

\frame{
    \begin{quote}
        ``More coding guidance for the coursework''
    \end{quote}
}

\frame{
    \begin{quote}
        ``Set homework sheets''
    \end{quote}
}

\frame{
    \begin{quote}
        ``Didn't realise there were problem sheets''
    \end{quote}
}

\frame{
    \begin{quote}
        What is the exam going to be like?
    \end{quote}
}

\frame{
    \Large
    \begin{quote}
        ``Please don't wait for everyone to stop talking till you start''
    \end{quote}
}

\frame{
    \Large
    \begin{quote}
        ``Would appreciate complete set of notes in one hit rather than by
        module as sheets can go missing easier.''
    \end{quote}
}

\frame{
    \Large
    \begin{quote}
        ``Goes very slow on some topics and skips past others''
    \end{quote}
}

\frame{
    \Large
    \begin{quote}
        ``I don't like the lack of structure in the lectures it is hard to know
        where you are supposed to be in the notes. So can you please tell us
        which part of the notes to look at before each lecture? Thank you. And
        where are supposed to be already. Because otherwise it is easy to fall
        behind.''
    \end{quote}
}

\frame{
    \Large
    \begin{quote}
        ``Spends too long talk about last week, we don't need to discuss that
        between ourselves.''
    \end{quote}
}

\frame{
    \Large
    \begin{quote}
        ``Super supportive and approachable, think the beard makes you look
        non-approachable''
    \end{quote}
}

\frame{
    \Large
    \begin{quote}
        ``The room is always cold''
    \end{quote}
}

\frame{
    \Large
    \begin{quote}
        ``Poor definition of the word cake''
    \end{quote}
}

\end{document}


text:
DOCKER_COMPOSE_OPTIONS	= --project-name=elastica --file=docker/docker-compose.yml --file=docker/docker-compose.proxy.yml --file=docker/docker-compose.es.yml

.PHONY: clean
clean:
	rm -fr tools vendor build composer.lock .php-cs-fixer.cache

tools/phive.phar:
	mkdir tools; \
	wget --no-clobber --output-document=tools/phive.phar "https://phar.io/releases/phive.phar" --quiet; \
    wget --no-clobber --output-document=tools/phive.phar.asc "https://phar.io/releases/phive.phar.asc" --quiet; \
    gpg --keyserver hkps.pool.sks-keyservers.net --recv-keys 0x9D8A98B29B2D5D79; \
    gpg --verify tools/phive.phar.asc tools/phive.phar; \
    rm tools/phive.phar.asc; \
    chmod +x tools/phive.phar;

vendor/autoload.php:
	# Installing Symfony Flex: parallel download of dependency libs
	composer global require --no-progress --no-scripts --no-plugins symfony/flex
	composer install --prefer-dist --no-interaction ${COMPOSER_FLAGS}

tools/php-cs-fixer.phar: tools/phive.phar
	tools/phive.phar install --copy --trust-gpg-keys 0xE82B2FB314E9906E,0x4AA394086372C20A

.PHONY: install-phpcs
install-phpcs: tools/php-cs-fixer.phar

.PHONY: composer-install
composer-install: vendor/autoload.php

.PHONY: composer-update
composer-update:
	composer update --prefer-dist --no-interaction ${COMPOSER_FLAGS}

.PHONY: install-tools
install-tools: install-phpcs

.PHONY: run-phpcs
run-phpcs: install-phpcs
	tools/php-cs-fixer.phar fix --diff --dry-run --allow-risky=yes -v

.PHONY: fix-phpcs
fix-phpcs: install-phpcs
	tools/php-cs-fixer.phar fix --allow-risky=yes -v

.PHONY: run-phpunit
run-phpunit: composer-install
	vendor/bin/phpunit ${PHPUNIT_OPTIONS}

.PHONY: run-phpunit-coverage
run-phpunit-coverage: composer-install
	EXIT_STATUS=0 ; \
	vendor/bin/phpunit --coverage-clover build/coverage/unit-coverage.xml --group unit || EXIT_STATUS=$$? ; \
	vendor/bin/phpunit --coverage-clover build/coverage/functional-coverage.xml --group functional || EXIT_STATUS=$$? ; \
	exit $$EXIT_STATUS

.PHONY: run-coveralls
run-coveralls:
	tools/php-coveralls.phar -v

tools/phpdocumentor.phar:
	curl https://gitreleases.dev/gh/phpDocumentor/phpDocumentor/latest/phpDocumentor.phar -o tools/phpdocumentor.phar --silent -L; \
	chmod +x tools/phpdocumentor.phar

.PHONY: run-phpdoc
run-phpdoc: tools/phpdocumentor.phar
	tools/phpdocumentor.phar --directory=lib --target=build/docs --template=clean

##
## Docker commands
##

.PHONY: docker-start
docker-start:
	docker-compose ${DOCKER_COMPOSE_OPTIONS} up ${DOCKER_OPTIONS}

.PHONY: docker-stop
docker-stop:
	docker-compose ${DOCKER_COMPOSE_OPTIONS} down

.PHONY: docker-run-phpunit
docker-run-phpunit:
	docker-compose ${DOCKER_COMPOSE_OPTIONS} exec php env TERM=xterm-256color make run-phpunit PHPUNIT_OPTIONS=${PHPUNIT_OPTIONS}

.PHONY: docker-run-phpcs
docker-run-phpcs:
	docker-compose ${DOCKER_COMPOSE_OPTIONS} exec php env TERM=xterm-256color make run-phpcs

.PHONY: docker-fix-phpcs
docker-fix-phpcs:
	docker-compose ${DOCKER_COMPOSE_OPTIONS} exec php env TERM=xterm-256color make fix-phpcs

.PHONY: docker-shell
docker-shell:
	docker-compose ${DOCKER_COMPOSE_OPTIONS} exec php sh

## Additional commands

# Visualise repo, requires `gource`
.PHONY: gource
gource:
	gource --log-format git \
		--seconds-per-day 0.1 \
		--title 'Elastica (https://github.com/ruflin/Elastica)' \
		--user-scale 1 \
		--max-user-speed 50


text:
package org.jasig.cas.web.init;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext;
import org.springframework.web.context.ContextLoaderListener;

/**
 * A {@link ServletContextListener} which wraps Spring's
 * {@link ContextLoaderListener} and catches anything that delegate throws so as
 * to prevent its having thrown a Throwable from aborting the initialization of
 * our entire web application context. Use of this ContextListener will not be
 * appropriate for all deployments of a web application. Sometimes, a context
 * listener's aborting context initialization is exactly the desired behavior.
 * This might be because the resulting application inavailability is acceptable
 * or because another layer (Apache, a proxy, a balancer, etc.) detects the
 * inavailability of the context and provides an appropriate user experience. Or
 * because a root context handles all requests that aren't otherwise handled.
 * There are many fine alternatives to this approach. However, when using the
 * bare Tomcat container with CAS as the root context, if your desired behavior
 * is that a failure at context initialization results in a dummy CAS context
 * that presents a user-friendly "CAS is unavailable at this time" message,
 * using this ContextListener in place of Spring's {@link ContextLoaderListener}
 * should do the trick. The error page associated with this deployment failure
 * is configured in the web.xml via the standard error handling mechanism.
 * Rather than being a generic ContextListener wrapper that will make safe any
 * ContextListener, instead this implementation specifically wraps and delegates
 * to a Spring {@link ContextLoaderListener}. As such, mapping this listener in
 * web.xml is a one for one replacement for {@link ContextLoaderListener}.
 * <p>
 * The exception thrown is exposed in the Servlet Context under the key
 * "exceptionCaughtByListener".
 *
 * @author Andrew Petro

 * @see ContextLoaderListener
 */
public final class SafeContextLoaderListener implements ServletContextListener {

    /** Instance of Commons Logging. */
    private final Logger logger = LoggerFactory.getLogger(getClass());

    /**
     * The name of the ServletContext attribute whereat we will place a List of
     * Throwables that we caught from our delegate context listeners.
     */
    public static final String CAUGHT_THROWABLE_KEY = "exceptionCaughtByListener";

    /** The actual ContextLoaderListener to which we will delegate to. */
    private final ContextLoaderListener delegate = new ContextLoaderListener();

    public void contextInitialized(final ServletContextEvent sce) {
        try {
            BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
            ServletContext ctx = sce.getServletContext();
            ctx.setAttribute(OsgiBundleXmlWebApplicationContext.BUNDLE_CONTEXT_ATTRIBUTE, bundleContext);
            this.delegate.contextInitialized(sce);
        } catch (final Throwable t) {
            /*
             * no matter what went wrong, our role is to capture this error and
             * prevent it from blocking initialization of the context. logging
             * overkill so that our deployer will find a record of this problem
             * even if unfamiliar with Commons Logging and properly configuring
             * it.
             */

            final String message = "SafeContextLoaderListener: \n"
                + "The Spring ContextLoaderListener we wrap threw on contextInitialized.\n"
                + "But for our having caught this error, the web application context would not have initialized.";

            // logger it via Commons Logging
            logger.error(message, t);

            // logger it to the ServletContext
            ServletContext context = sce.getServletContext();
            context.log(message, t);

            /*
             * record the error so that the application has access to later
             * display a proper error message based on the exception.
             */
            context.setAttribute(CAUGHT_THROWABLE_KEY, t);
        }
    }

    public void contextDestroyed(final ServletContextEvent sce) {
        this.delegate.contextDestroyed(sce);
    }

}


text:
import $ from "jquery";

import * as blueslip from "./blueslip";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
import * as rows from "./rows";
import * as timerender from "./timerender";

let is_floating_recipient_bar_showing = false;

function top_offset($elem) {
    return (
        $elem.offset().top -
        $("#message_view_header").safeOuterHeight() -
        $("#navbar_alerts_wrapper").height()
    );
}

export function first_visible_message($bar) {
    // The first truly visible message would be computed using the
    // bottom of the floating recipient bar; but we want the date from
    // the first visible message were the floating recipient bar not
    // displayed, which will always be the first messages whose bottom
    // overlaps the floating recipient bar's space (since you ).

    const $messages = $bar.children(".message_row");
    const $frb = $("#floating_recipient_bar");
    const frb_top = top_offset($frb);
    const frb_bottom = frb_top + $frb.safeOuterHeight();
    let $result;

    for (const message_element of $messages) {
        // The details of this comparison function are sensitive, since we're
        // balancing between three possible bugs:
        //
        // * If we compare against the bottom of the floating
        //   recipient bar, we end up with a bug where if the floating
        //   recipient bar is just above a normal recipient bar while
        //   overlapping a series of 1-line messages, there might be 2
        //   messages occluded by the recipient bar, and we want the
        //   second one, not the first.
        //
        // * If we compare the message bottom against the top of the
        //   floating recipient bar, and the floating recipient bar is
        //   over a "Yesterday/Today" message date row, we might
        //   confusingly have the floating recipient bar display
        //   e.g. "Yesterday" even though all messages in view were
        //   actually sent "Today".
        //
        // * If the the floating recipient bar is over a
        //   between-message groups date separator or similar widget,
        //   there might be no message overlap with the floating
        //   recipient bar.
        //
        // Careful testing of these two corner cases with
        // message_viewport.scrollTop() to set precise scrolling
        // positions determines the value for date_bar_height_offset.

        let $message = $(message_element);
        const message_bottom = top_offset($message) + $message.safeOuterHeight();
        const date_bar_height_offset = 10;

        if (message_bottom > frb_top) {
            $result = $message;
        }

        // Important: This will break if we ever have things that are
        // not message rows inside a recipient_row block.
        $message = $message.next(".message_row");
        if (
            $message.length > 0 &&
            $result &&
            // Before returning a result, we check whether the next
            // message's top is actually below the bottom of the
            // floating recipient bar; this is different from the
            // bottom of our current message because there may be a
            // between-messages date separator row in between.
            top_offset($message) < frb_bottom - date_bar_height_offset
        ) {
            $result = $message;
        }
        if ($result) {
            return $result;
        }
    }

    // If none of the messages are visible, just take the last message.
    return $messages.last();
}

export function get_date($elem) {
    const message_row = first_visible_message($elem);

    if (!message_row || !message_row.length) {
        return undefined;
    }

    const msg_id = rows.id(message_row);

    if (msg_id === undefined) {
        return undefined;
    }

    const message = message_store.get(msg_id);

    if (!message) {
        return undefined;
    }

    const time = new Date(message.timestamp * 1000);
    const today = new Date();
    const rendered_date = timerender.render_date(time, undefined, today)[0].outerHTML;

    return rendered_date;
}

export function relevant_recipient_bars() {
    let elems = [];

    // This line of code does a reverse traversal
    // from the selected message, which should be
    // in the visible part of the feed, but is sometimes
    // not exactly where we want.  The value we get
    // may be be too far up in the feed, but we can
    // deal with that later.
    let $first_elem = candidate_recipient_bar();

    if (!$first_elem) {
        $first_elem = $(".focused_table").find(".recipient_row").first();
    }

    if ($first_elem.length === 0) {
        return [];
    }

    elems.push($first_elem);

    const max_offset = top_offset($("#compose"));
    let header_height = $first_elem.find(".message_header").safeOuterHeight();

    // It's okay to overestimate header_height a bit, as we don't
    // really need an FRB for a section that barely shows.
    header_height += 10;

    function next($elem) {
        $elem = $elem.next();
        while ($elem.length !== 0 && !$elem.hasClass("recipient_row")) {
            $elem = $elem.next();
        }
        return $elem;
    }

    // Now start the forward traversal of recipient bars.
    // We'll stop when we go below the fold.
    let $elem = next($first_elem);

    while ($elem.length) {
        if (top_offset($elem) < header_height) {
            // If we are close to the top, then the prior
            // elements we found are no longer relevant,
            // because either the selected item we started
            // with in our reverse traversal was too high,
            // or there's simply not enough room to draw
            // a recipient bar without it being ugly.
            elems = [];
        }

        if (top_offset($elem) > max_offset) {
            // Out of sight, out of mind!
            // (The element is below the fold, so we stop the
            // traversal.)
            break;
        }

        elems.push($elem);
        $elem = next($elem);
    }

    if (elems.length === 0) {
        blueslip.warn("Unexpected situation--maybe viewport height is very short.");
        return [];
    }

    const items = elems.map(($elem, i) => {
        let date_html;
        let need_frb;

        if (i === 0) {
            date_html = get_date($elem);
            need_frb = top_offset($elem) < 0;
        } else {
            date_html = $elem.find(".recipient_row_date").html();
            need_frb = false;
        }

        const date_text = $(date_html).text();

        // Add title here to facilitate troubleshooting.
        const title = $elem.find(".message_label_clickable").last().attr("title");

        const item = {
            $elem,
            title,
            date_html,
            date_text,
            need_frb,
        };

        return item;
    });

    items[0].show_date = true;

    for (let i = 1; i < items.length; i += 1) {
        items[i].show_date = items[i].date_text !== items[i - 1].date_text;
    }

    for (const item of items) {
        if (!item.need_frb) {
            delete item.date_html;
        }
    }

    return items;
}

export function candidate_recipient_bar() {
    // Find a recipient bar that is close to being onscreen
    // but above the "top".  This function is guaranteed to
    // return **some** recipient bar that is above the fold,
    // if there is one, but it may not be the optimal one if
    // our pointer is messed up.  Starting with the pointer
    // is just an optimization here, and our caller will do
    // a forward traversal and clean up as necessary.
    // In most cases we find the bottom-most of recipient
    // bars that is still above the fold.

    // Start with the pointer's current location.
    const $selected_row = message_lists.current.selected_row();

    if ($selected_row === undefined || $selected_row.length === 0) {
        return undefined;
    }

    let $candidate = rows.get_message_recipient_row($selected_row);
    if ($candidate === undefined) {
        return undefined;
    }

    while ($candidate.length) {
        if ($candidate.hasClass("recipient_row") && top_offset($candidate) < 0) {
            return $candidate;
        }
        // We cannot use .prev(".recipient_row") here, because that
        // returns nothing if the previous element is not a recipient
        // row, rather than finding the first recipient_row.
        $candidate = $candidate.prev();
    }

    return undefined;
}

function show_floating_recipient_bar() {
    if (!is_floating_recipient_bar_showing) {
        $("#floating_recipient_bar").css("visibility", "visible");
        is_floating_recipient_bar_showing = true;
    }
}

let $old_source;
function replace_floating_recipient_bar(source_info) {
    const $source_recipient_bar = source_info.$elem;

    let $new_label;
    let $other_label;
    let $header;

    if ($source_recipient_bar !== $old_source) {
        if ($source_recipient_bar.children(".message_header_stream").length !== 0) {
            $new_label = $("#current_label_stream");
            $other_label = $("#current_label_private_message");
            $header = $source_recipient_bar.children(".message_header_stream");
        } else {
            $new_label = $("#current_label_private_message");
            $other_label = $("#current_label_stream");
            $header = $source_recipient_bar.children(".message_header_private_message");
        }
        $new_label.find(".message_header").replaceWith($header.clone());
        $other_label.css("display", "none");
        $new_label.css("display", "block");
        $new_label.attr("zid", rows.id(rows.first_message_in_group($source_recipient_bar)));

        $new_label.toggleClass("message-fade", $source_recipient_bar.hasClass("message-fade"));
        $old_source = $source_recipient_bar;
    }

    const rendered_date = source_info.date_html || "";

    $("#floating_recipient_bar").find(".recipient_row_date").html(rendered_date);

    show_floating_recipient_bar();
}

export function hide() {
    if (is_floating_recipient_bar_showing) {
        $("#floating_recipient_bar").css("visibility", "hidden");
        is_floating_recipient_bar_showing = false;
    }
}

export function de_clutter_dates(items) {
    for (const item of items) {
        item.$elem.find(".recipient_row_date").toggle(item.show_date);
    }
}

export function update() {
    const items = relevant_recipient_bars();

    if (!items || items.length === 0) {
        hide();
        return;
    }

    de_clutter_dates(items);

    if (!items[0].need_frb) {
        hide();
        return;
    }

    replace_floating_recipient_bar(items[0]);
}


text:
<?xml version='1.0' encoding='UTF-8'?>
<hudson.plugins.sonar.SonarPublisher_-DescriptorImpl plugin="sonar@2.3">
  <installations>
    <hudson.plugins.sonar.SonarInstallation>
      <name>sonarDocker</name>
      <disabled>false</disabled>
      <serverUrl>http://sonar:9000</serverUrl>
      <mojoVersion></mojoVersion>
      <databaseUrl></databaseUrl>
      <databaseLogin></databaseLogin>
      <additionalProperties></additionalProperties>
      <additionalAnalysisProperties></additionalAnalysisProperties>
      <triggers>
        <skipScmCause>false</skipScmCause>
        <skipUpstreamCause>false</skipUpstreamCause>
        <envVar></envVar>
      </triggers>
      <sonarLogin>sonar</sonarLogin>
      <databaseSecret>FzIQWHldT1pVy/VA6AMmcw==</databaseSecret>
      <sonarSecret>5OH1NsScgNF8Qy7HKMPRxJx+b/x5kkzKQAdiaLqlXeA=</sonarSecret>
    </hudson.plugins.sonar.SonarInstallation>
  </installations>
  <buildWrapperEnabled>false</buildWrapperEnabled>
</hudson.plugins.sonar.SonarPublisher_-DescriptorImpl>


text:
.feed-wrapper {position: relative;}
.sidebar {position: relative; z-index: 2;}

.container noscript h1 {text-align: center; font-weight: bold; text-transform: uppercase; color: #a33; padding: 1em 0 .5em; font-size: 3.25em;}
.container noscript p { font-size: 2em; color: #666; font-weight: bold; text-align: justify; letter-spacing: .035em;}
body {color: #666;}
a {color: #333;}

.sidebar { position: fixed; top: 0;}
.header h1 { text-align: center; font-weight: bold; text-transform: uppercase; color: #a33; padding: .25em 0 .375em 0; font-size: 4em; margin-bottom: 0;}
.jitter-filters { padding-bottom: 1em; }
.jitter-filter {display: block; padding: .5em 0; text-decoration: none; position: relative; border-bottom: 1px solid #dfdfdf; color: #777; text-transform: uppercase;}
.jitter-filter.active {background: #fee;}
.jitter-filter.active .show-filter {font-weight: bold;}
.jitter-filter .show-filter { margin-left: 32px; text-decoration: none;}
.jitter-filter .twitter-rss {position: absolute; left: 8px;}
.jitter-filter .delete-filter {position: absolute; right: 6px; top: .62em;}
.jitter-filters .unreadCount {
  position: absolute;
  text-align: center;
  padding: .25em .5em;
  top: .25em;
  left: -3.75em;
  background: #bbb;
  width: 2em;
  color: #fff;
  font-weight: bold;
  -moz-border-radius: .5em;
  -webkit-border-radius: .5em;
}

.tweet {border-bottom: 1px solid #dfdfdf; padding: 1em 0; opacity: .875;}
.tweet.read {opacity: 0.5;}
.tweet.read .tweet-body {text-decoration: line-through;}
.tweet.current .tweet-body {text-decoration: none;}
.tweet.current {background: #f5f5f5; opacity: 1; text-decoration: none;}
.tweet .created-at {font-size: .9em;}
.tweet .author .display-name {font-weight: bold; font-size: 1.2em;}
.tweet .tweet-body {font-size: 1.5em; font-weight: 500;}
.tweet .tweet-image img {position: relative; left: 12px;}

.forms { padding-top: .125em; clear: both;}
.jitterForm {background: #f5f5f5;}
.jitterForm label {display: block; color: #777; font-weight: normal; letter-spacing: 0.075em;}
.jitterForm {padding: 0 0 .5em 0; margin-bottom: 1em;}

.jitterForm fieldset {margin:0; padding: .5em 10px 0 10px; border: 0; position: relative;}
.jitterForm legend {border-bottom: 1px solid #ddd; display: block; height: 2.25em; width: 100%;}
.jitterForm legend span {
  padding-top: .5em;
  text-transform: uppercase; color: #a33; font-weight: normal; font-size: 1em;
  display: block;
}
.jitterForm fieldset input[type=submit] { position: absolute; bottom: .75em; right: 10px;}
input.hint, textarea.hint {color: #bbb; text-transform: lowercase;}

.cheatsheet {padding-left: 8px;}
.cheatsheet dt {float: left; width: .5em; clear: both;}
.cheatsheet dd {float: left;}
.cheatsheet dt, .cheatsheet dd {padding: 0 0 .25em 0;}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/{projectName}.iml" filepath="$PROJECT_DIR$/{projectName}.iml" />
      <module fileurl="file://$PROJECT_DIR$/{moduleName}/{moduleName}.iml" filepath="$PROJECT_DIR$/{moduleName}/{moduleName}.iml" />
    </modules>
  </component>
</project>


text:
package util

import scala.scalajs.js
import scala.language.dynamics

/**
 * Created by hjs on 25/12/2013.
 */
object jsObj extends scala.Dynamic {
  //code by Benjamin Jackman published to the Scala.js mailing list on Dec 16
    def applyDynamicNamed[A](name: String)(args: (String, js.Any)*): A = {
      println(s"applyDynamicNamed($name)(args: $args")
      if (name != "apply") {
        sys.error("Call jsObj like this jsObj(x=1, y=2) which returns a javascript object that is {x:1,y:2}")
      }
      val obj = js.Object().asInstanceOf[js.Dictionary]
      args.foreach { case (name, value) =>
        obj(name) = value
      }
      obj.asInstanceOf[A]
    }
    //Allows for jsObj()
    def applyDynamic[A](name : String)(args: Nothing*) = {
      if (args.nonEmpty) {
        sys.error("Call jsObj only with named parameters.")
      }
      js.Object().asInstanceOf[A]
    }

    //Note that jsObj can also be given a type parameter
    //that type will be used as the return type,
    //However it's just a NOP and doesn't do real type
    //safety

}


text:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Go on 헥헥 블로그</title>
    <link>https://hechek.github.io/tags/go/index.xml</link>
    <description>Recent content in Go on 헥헥 블로그</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>ko-kr</language>
    <atom:link href="https://hechek.github.io/tags/go/index.xml" rel="self" type="application/rss+xml" />

    <item>
      <title>Learning Go</title>
      <link>https://hechek.github.io/blog/2017-02-16-learning-go/</link>
      <pubDate>Thu, 16 Feb 2017 22:12:32 +0900</pubDate>

      <guid>https://hechek.github.io/blog/2017-02-16-learning-go/</guid>
      <description>
I have decided to learn Go (or Golang). I went through the Tour of Go and made some notes. Some of the items/code are directly copy pasted from there. The notes are just a cheatsheet to help me look things up quickly while learning. I will update that page as I learn more.

You can see the notes at https://parsiya.net/go/.

</description>
    </item>

  </channel>
</rss>


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012 Adrian Ulrich <adrian@blinkenlights.ch>
Copyright (C) 2012 Christopher Eby <kreed@kreed.org>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
	package="ch.blinkenlights.android.vanilla"
	android:versionName="0.9.26"
	android:versionCode="0926"
	android:installLocation="auto">
	<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="16" />
	<uses-permission android:name="android.permission.WAKE_LOCK" />
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
	<!-- This is needed for isWiredHeadsetOn() to work in some cases. (bug?) -->
	<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
	<application
		android:icon="@drawable/icon"
		android:label="@string/app_name"
		android:backupAgent="PreferencesBackupAgent">
		<activity
			android:name="FullPlaybackActivity"
			android:theme="@style/Playback"
			android:launchMode="singleTask" />
		<activity
			android:name="LibraryActivity"
			android:theme="@style/Library"
			android:uiOptions="splitActionBarWhenNarrow"
			android:launchMode="singleTask">
			<intent-filter>
				<action android:name="android.intent.action.MAIN" />
				<category android:name="android.intent.category.LAUNCHER" />
			</intent-filter>
		</activity>
		<activity
			android:name="PlaylistActivity"
			android:launchMode="singleTask"
			android:theme="@style/BackActionBar" />
		<activity
			android:name="MiniPlaybackActivity"
			android:theme="@style/Dialog"
			android:excludeFromRecents="true"
			android:launchMode="singleInstance" />
		<activity
			android:name="ShowQueueActivity"
			android:theme="@style/BackActionBar"
			android:launchMode="singleInstance" />
		<receiver
			android:name=".OneCellWidget"
			android:label="Vanilla Music 1x1">
			<intent-filter>
				<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
			</intent-filter>
			<meta-data
				android:name="android.appwidget.provider"
				android:resource="@xml/one_cell_widget" />
		</receiver>
		<receiver
			android:name=".FourLongWidget"
			android:label="Vanilla Music 4x1 A">
			<intent-filter>
				<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
			</intent-filter>
			<meta-data
				android:name="android.appwidget.provider"
				android:resource="@xml/four_long_widget" />
		</receiver>
		<receiver
			android:name=".FourWhiteWidget"
			android:label="Vanilla Music 4x1 White">
			<intent-filter>
				<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
			</intent-filter>
			<meta-data
				android:name="android.appwidget.provider"
				android:resource="@xml/four_white_widget" />
		</receiver>
		<receiver
			android:name=".WidgetE"
			android:label="Vanilla Music 4x1 B">
			<intent-filter>
				<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
			</intent-filter>
			<meta-data
				android:name="android.appwidget.provider"
				android:resource="@xml/widget_e" />
		</receiver>
		<receiver
			android:name=".FourSquareWidget"
			android:label="Vanilla Music 2x2 A">
			<intent-filter>
				<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
			</intent-filter>
			<meta-data
				android:name="android.appwidget.provider"
				android:resource="@xml/four_square_widget" />
		</receiver>
		<receiver
			android:name=".WidgetD"
			android:label="Vanilla Music 2x2 B">
			<intent-filter>
				<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
			</intent-filter>
			<meta-data
				android:name="android.appwidget.provider"
				android:resource="@xml/widget_d" />
		</receiver>
		<receiver android:name="MediaButtonReceiver" >
			<intent-filter android:priority="999">
				<action android:name="android.intent.action.MEDIA_BUTTON" />
			</intent-filter>
		</receiver>
		<service android:name="PlaybackService">
			<intent-filter>
				<action android:name="ch.blinkenlights.android.vanilla.action.PLAY" />
				<action android:name="ch.blinkenlights.android.vanilla.action.PAUSE" />
				<action android:name="ch.blinkenlights.android.vanilla.action.TOGGLE_PLAYBACK" />
				<action android:name="ch.blinkenlights.android.vanilla.action.NEXT_SONG" />
				<action android:name="ch.blinkenlights.android.vanilla.action.PREVIOUS_SONG" />
			</intent-filter>
		</service>
		<activity
			android:name="PreferencesActivity"
			android:theme="@style/BackActionBar" />
		<activity
			android:name="PreferencesActivity$ReplayGainActivity"
			android:theme="@style/BackActionBar" />
		<activity android:name="PreferencesActivity$AudioActivity" />
		<activity android:name="PreferencesActivity$PlaybackActivity" />
		<activity android:name="PreferencesActivity$LibraryActivity" />
		<activity android:name="PreferencesActivity$NotificationsActivity" />
		<activity android:name="PreferencesActivity$ShakeActivity" />
		<activity android:name="PreferencesActivity$CoverArtActivity" />
		<activity android:name="PreferencesActivity$MiscActivity" />
		<activity android:name="PreferencesActivity$AboutActivity" />
		<activity
			android:name="TabOrderActivity"
			android:theme="@style/BackActionBar" />
		<activity
			android:name="FilebrowserStartActivity"
			android:theme="@style/BackActionBar" />

	</application>
</manifest>


text:
<?php

namespace MarvinKlemp\KafkaAdapter\Tests\Common;

use MarvinKlemp\KafkaAdapter\Common\Node;

class NodeTest extends \PHPUnit_Framework_TestCase
{
    public function test_it_should_be_initializable()
    {
        $node = new Node("app.broker1", "localhost", 9093);

        $this->assertInstanceOf("MarvinKlemp\KafkaAdapter\Common\Node", $node);
    }

    public function test_it_should_throw_an_invalid_argument_exception_if_empty_id_is_provided()
    {
        $this->setExpectedException("\InvalidArgumentException", "You have to provide an ID");
        new Node("", "localhost", 9093);
    }
}


text:
namespace agg
{

    //============================================================vcgen_stroke
    //
    // See Implementation agg_vcgen_stroke.cpp
    // Stroke generator
    //
    //------------------------------------------------------------------------
    class vcgen_stroke
    {
        enum status_e
        {
            initial,
            ready,
            cap1,
            cap2,
            outline1,
            close_first,
            outline2,
            out_vertices,
            end_poly1,
            end_poly2,
            stop
        };

    public:
        typedef vertex_sequence<vertex_dist, 6> vertex_storage;
        typedef pod_deque<point_type, 6>        coord_storage;

        vcgen_stroke();

        void line_cap(line_cap_e lc)     { m_line_cap = lc; }
        void line_join(line_join_e lj)   { m_line_join = lj; }
        void inner_join(inner_join_e ij) { m_inner_join = ij; }

        line_cap_e   line_cap()   const { return m_line_cap; }
        line_join_e  line_join()  const { return m_line_join; }
        inner_join_e inner_join() const { return m_inner_join; }

        void width(double w) { m_width = w * 0.5; }
        void miter_limit(double ml) { m_miter_limit = ml; }
        void miter_limit_theta(double t);
        void inner_miter_limit(double ml) { m_inner_miter_limit = ml; }
        void approximation_scale(double as) { m_approx_scale = as; }

        double width() const { return m_width * 2.0; }
        double miter_limit() const { return m_miter_limit; }
        double inner_miter_limit() const { return m_inner_miter_limit; }
        double approximation_scale() const { return m_approx_scale; }

        void shorten(double s) { m_shorten = s; }
        double shorten() const { return m_shorten; }

        // Vertex Generator Interface
        void remove_all();
        void add_vertex(double x, double y, unsigned cmd);

        // Vertex Source Interface
        void     rewind(unsigned path_id);
        unsigned vertex(double* x, double* y);

    private:
        vcgen_stroke(const vcgen_stroke&);
        const vcgen_stroke& operator = (const vcgen_stroke&);

        vertex_storage m_src_vertices;
        coord_storage  m_out_vertices;
        double         m_width;
        double         m_miter_limit;
        double         m_inner_miter_limit;
        double         m_approx_scale;
        double         m_shorten;
        line_cap_e     m_line_cap;
        line_join_e    m_line_join;
        inner_join_e   m_inner_join;
        unsigned       m_closed;
        status_e       m_status;
        status_e       m_prev_status;
        unsigned       m_src_vertex;
        unsigned       m_out_vertex;
    };

}

#endif


text:
<?php

namespace app\controllers;

use Yii;
use app\models\Apply;
use app\models\ApplySearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\web\UploadedFile;

/**
 * ApplyController implements the CRUD actions for Apply model.
 */
class ApplyController extends Controller
{
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'delete' => ['POST'],
                ],
            ],
        ];
    }

    /**
     * Lists all Apply models.
     * @return mixed
     */
    public function actionIndex()
    {
        $searchModel = new ApplySearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }

    /**
     * Displays a single Apply model.
     * @param integer $id
     * @return mixed
     */
    public function actionView($id)
    {
        return $this->render('view', [
            'model' => $this->findModel($id),
        ]);
    }

    /**
     * Creates a new Apply model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
    public function actionCreate()
    {
        $model = new Apply();

        if ($model->load(Yii::$app->request->post()) ){
                $model->filedata = UploadedFile::getInstance($model, 'filedata');
                if($model->filedata != null){
                    if (!$model->upload()) {
                        // file is uploaded successfully
                        return false;
                    }
                    $model->file = $model->filedata->name;
                }
            $model->apply = Yii::$app->request->get("apply",null);
            if(!$model->save()){
                var_dump($model->getErrors());die;
            }else{
                return $this->redirect(['thankyou']);
            }
        } else {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }

    public function actionThankyou(){
        return $this->render('thankyou');
    }

    /**
     * Updates an existing Apply model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id
     * @return mixed
     */
    public function actionUpdate($id)
    {
        $model = $this->findModel($id);
        if ($model->load(Yii::$app->request->post())) {
                $model->filedata = UploadedFile::getInstance($model, 'filedata');
                if($model->filedata != null) {
                    if (!$model->upload()) {
                        // file is uploaded successfully
                        return false;
                    }
                    $model->file = $model->filedata->name;
                }
            $model->save();
            return $this->redirect(['view', 'id' => $model->id]);
        } else {
            return $this->render('update', [
                'model' => $model,
            ]);
        }
    }

    /**
     * Deletes an existing Apply model.
     * If deletion is successful, the browser will be redirected to the 'index' page.
     * @param integer $id
     * @return mixed
     */
    public function actionDelete($id)
    {
        $this->findModel($id)->delete();

        return $this->redirect(['index']);
    }

    /**
     * Finds the Apply model based on its primary key value.
     * If the model is not found, a 404 HTTP exception will be thrown.
     * @param integer $id
     * @return Apply the loaded model
     * @throws NotFoundHttpException if the model cannot be found
     */
    protected function findModel($id)
    {
        if (($model = Apply::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
}


text:
namespace chromeos {

const char kTestUser1[] = "test-user@example.com";
const char kTestUser2[] = "test-user2@example.com";

class UserImageManagerTest : public CrosInProcessBrowserTest,
                             public content::NotificationObserver,
                             public UserManager::Observer {
 protected:
  UserImageManagerTest() {
  }

  // CrosInProcessBrowserTest overrides:
  virtual void SetUpOnMainThread() OVERRIDE {
    UserManager::Get()->AddObserver(this);
    user_image_manager_ = UserManager::Get()->GetUserImageManager();
    local_state_ = g_browser_process->local_state();
    // No migration delay for testing.
    UserImageManagerImpl::user_image_migration_delay_sec = 0;
  }

  virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
    command_line->AppendSwitch(switches::kLoginManager);
    command_line->AppendSwitchASCII(switches::kLoginProfile, "user");
  }

  // content::NotificationObserver overrides:
  virtual void Observe(int type,
                       const content::NotificationSource& source,
                       const content::NotificationDetails& details) OVERRIDE {
    DCHECK(type == chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED);
    registrar_.Remove(this, chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED,
                      content::NotificationService::AllSources());
    base::MessageLoopForUI::current()->Quit();
  }

  // UserManager::Observer overrides:
  virtual void LocalStateChanged(UserManager* user_manager) OVERRIDE {
    base::MessageLoopForUI::current()->Quit();
  }

  // Adds given user to Local State, if not there.
  void AddUser(const std::string& username) {
    ListPrefUpdate users_pref(local_state_, "LoggedInUsers");
    users_pref->AppendIfNotPresent(new base::StringValue(username));
  }

  // Logs in |username|.
  void LogIn(const std::string& username) {
    UserManager::Get()->UserLoggedIn(username, username, false);
  }

  // Subscribes for image change notification.
  void ExpectImageChange() {
    registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED,
                   content::NotificationService::AllSources());
  }

  // Stores old (pre-migration) user image info.
  void SetOldUserImageInfo(const std::string& username,
                           int image_index,
                           const base::FilePath& image_path) {
    AddUser(username);
    DictionaryPrefUpdate images_pref(local_state_, "UserImages");
    base::DictionaryValue* image_properties = new base::DictionaryValue();
    image_properties->Set(
        "index", base::Value::CreateIntegerValue(image_index));
    image_properties->Set(
        "path" , new base::StringValue(image_path.value()));
    images_pref->SetWithoutPathExpansion(username, image_properties);
  }

  // Verifies user image info in |images_pref| dictionary.
  void ExpectUserImageInfo(const base::DictionaryValue* images_pref,
                           const std::string& username,
                           int image_index,
                           const base::FilePath& image_path) {
    ASSERT_TRUE(images_pref);
    const base::DictionaryValue* image_properties = NULL;
    images_pref->GetDictionaryWithoutPathExpansion(username, &image_properties);
    ASSERT_TRUE(image_properties);
    int actual_image_index;
    std::string actual_image_path;
    ASSERT_TRUE(image_properties->GetInteger("index", &actual_image_index) &&
                image_properties->GetString("path", &actual_image_path));
    EXPECT_EQ(image_index, actual_image_index);
    EXPECT_EQ(image_path.value(), actual_image_path);
  }

  // Verifies that there is no image info for |username| in dictionary
  // |images_pref|.
  void ExpectNoUserImageInfo(const base::DictionaryValue* images_pref,
                             const std::string& username) {
    ASSERT_TRUE(images_pref);
    const base::DictionaryValue* image_properties = NULL;
    images_pref->GetDictionaryWithoutPathExpansion(username, &image_properties);
    ASSERT_FALSE(image_properties);
  }

  // Verifies that old user image info matches |image_index| and |image_path|
  // and that new user image info does not exist.
  void ExpectOldUserImageInfo(const std::string& username,
                              int image_index,
                              const base::FilePath& image_path) {
    ExpectUserImageInfo(local_state_->GetDictionary("UserImages"),
                        username, image_index, image_path);
    ExpectNoUserImageInfo(local_state_->GetDictionary("user_image_info"),
                          username);
  }

  // Verifies that new user image info matches |image_index| and |image_path|
  // and that old user image info does not exist.
  void ExpectNewUserImageInfo(const std::string& username,
                              int image_index,
                              const base::FilePath& image_path) {
    ExpectUserImageInfo(local_state_->GetDictionary("user_image_info"),
                        username, image_index, image_path);
    ExpectNoUserImageInfo(local_state_->GetDictionary("UserImages"),
                          username);
  }

  // Sets bitmap |resource_id| as image for |username| and saves it to disk.
  void SaveUserImagePNG(const std::string& username,
                        int resource_id) {
    base::FilePath image_path = GetUserImagePath(username, "png");
    scoped_refptr<base::RefCountedStaticMemory> image_data(
        ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
            resource_id, ui::SCALE_FACTOR_100P));
    int written = file_util::WriteFile(
        image_path,
        reinterpret_cast<const char*>(image_data->front()),
        image_data->size());
    EXPECT_EQ(static_cast<int>(image_data->size()), written);
    SetOldUserImageInfo(username, User::kExternalImageIndex, image_path);
  }

  // Returns the image path for user |username| with specified |extension|.
  base::FilePath GetUserImagePath(const std::string& username,
                            const std::string& extension) {
    base::FilePath user_data_dir;
    PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
    return user_data_dir.Append(username).AddExtension(extension);
  }

  UserImageManager* user_image_manager_;
  PrefService* local_state_;
  content::NotificationRegistrar registrar_;

 private:
  DISALLOW_COPY_AND_ASSIGN(UserImageManagerTest);
};

IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_DefaultUserImagePreserved) {
  // Setup an old default (stock) user image.
  ScopedUserManagerEnabler(new MockUserManager);
  SetOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath());
}

IN_PROC_BROWSER_TEST_F(UserImageManagerTest, DefaultUserImagePreserved) {
  UserManager::Get()->GetUsers();  // Load users.
  // Old info preserved.
  ExpectOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath());
  LogIn(kTestUser1);
  // Wait for migration.
  content::RunMessageLoop();
  // Image info is migrated now.
  ExpectNewUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath());
}

IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_OtherUsersUnaffected) {
  // Setup two users with stock images.
  ScopedUserManagerEnabler(new MockUserManager);
  SetOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath());
  SetOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1,
                      base::FilePath());
}

IN_PROC_BROWSER_TEST_F(UserImageManagerTest, OtherUsersUnaffected) {
  UserManager::Get()->GetUsers();  // Load users.
  // Old info preserved.
  ExpectOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath());
  ExpectOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1,
                         base::FilePath());
  LogIn(kTestUser1);
  // Wait for migration.
  content::RunMessageLoop();
  // Image info is migrated for the first user and unaffected for the rest.
  ExpectNewUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath());
  ExpectOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1,
                         base::FilePath());
}

IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_PRE_NonJPEGImageFromFile) {
  // Setup a user with non-JPEG image.
  ScopedUserManagerEnabler(new MockUserManager);
  SaveUserImagePNG(
      kTestUser1, kDefaultImageResourceIDs[kFirstDefaultImageIndex]);
}

IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_NonJPEGImageFromFile) {
  UserManager::Get()->GetUsers();  // Load users.
  // Old info preserved.
  ExpectOldUserImageInfo(kTestUser1, User::kExternalImageIndex,
                         GetUserImagePath(kTestUser1, "png"));
  const User* user = UserManager::Get()->FindUser(kTestUser1);
  EXPECT_TRUE(user->image_is_stub());
  LogIn(kTestUser1);
  // Wait for migration.
  content::RunMessageLoop();
  // Image info is migrated and the image is converted to JPG.
  ExpectNewUserImageInfo(kTestUser1, User::kExternalImageIndex,
                         GetUserImagePath(kTestUser1, "jpg"));
  user = UserManager::Get()->GetLoggedInUser();
  ASSERT_TRUE(user);
  EXPECT_FALSE(user->image_is_safe_format());
  // Check image dimensions.
  const gfx::ImageSkia& saved_image = GetDefaultImage(kFirstDefaultImageIndex);
  EXPECT_EQ(saved_image.width(), user->image().width());
  EXPECT_EQ(saved_image.height(), user->image().height());
}

IN_PROC_BROWSER_TEST_F(UserImageManagerTest, NonJPEGImageFromFile) {
  ExpectImageChange();
  UserManager::Get()->GetUsers();  // Load users.
  // Wait for image load.
  content::RunMessageLoop();
  // Now the migrated image is used.
  const User* user = UserManager::Get()->FindUser(kTestUser1);
  ASSERT_TRUE(user);
  EXPECT_TRUE(user->image_is_safe_format());
  // Check image dimensions. Images can't be compared since JPEG is lossy.
  const gfx::ImageSkia& saved_image = GetDefaultImage(kFirstDefaultImageIndex);
  EXPECT_EQ(saved_image.width(), user->image().width());
  EXPECT_EQ(saved_image.height(), user->image().height());
}

}  // namespace chromeos


text:
'use strict';
var app = angular.module('core');
app.controller('HeaderController', ['$scope', 'Authentication', 'Menus','sharedProperties','Organizations',
	function($scope, Authentication, Menus,sharedProperties,Organizations) {
		$scope.authentication = Authentication;
		$scope.isCollapsed = false;
		$scope.AllCompanies = Organizations.query();
			$scope.organization = Organizations.get({
				organizationId: $scope.authentication.user.orgId
			});
				//console.log('$scope.organization1  = ' , $scope.organization  );
        $scope.orgname = $scope.organization.name +'_logo.png';
		//console.log(' $scope.orgname  = ' ,  $scope.orgname  );
		 /*angular.forEach( $scope.AllCompanies,function(value,index){
                alert('hello');
          })*/
		 $scope.LogoName= "InvoiceIT.com_logo.png";
		 $scope.LogoName2= "InvoiceIT.com";
		 //console.log('$scope.authentication.user.orgId = ', $scope.authentication.user.orgId );
		$scope.menu = Menus.getMenu('topbar');

		$scope.toggleCollapsibleMenu = function() {
			$scope.isCollapsed = !$scope.isCollapsed;
		};

		// Collapsing the menu after navigation
		$scope.$on('$stateChangeSuccess', function() {
			$scope.isCollapsed = false;
		});
	}
]);