text:
package com.hazelcast.config;

import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.nio.serialization.DataSerializable;
import com.hazelcast.nio.serialization.BinaryInterface;

import java.io.IOException;
import java.io.Serializable;

/**
 * Configuration for map's capacity.
 * You can set a limit for number of entries or total memory cost of entries.
 */
@BinaryInterface
public class MaxSizeConfig implements DataSerializable, Serializable {

    /**
     * Default maximum size of map.
     */
    public static final int DEFAULT_MAX_SIZE = Integer.MAX_VALUE;

    private MaxSizeConfigReadOnly readOnly;

    private MaxSizePolicy maxSizePolicy = MaxSizePolicy.PER_NODE;

    private int size = DEFAULT_MAX_SIZE;

    public MaxSizeConfig() {
    }

    public MaxSizeConfig(int size, MaxSizePolicy maxSizePolicy) {
        setSize(size);
        this.maxSizePolicy = maxSizePolicy;
    }

    public MaxSizeConfig(MaxSizeConfig config) {
        this.size = config.size;
        this.maxSizePolicy = config.maxSizePolicy;
    }

    /**
     * Maximum Size Policy
     */
    public enum MaxSizePolicy {

        /**
         * Policy based on maximum number of entries stored per data structure (map, cache etc)
         * on each Hazelcast instance
         */
        PER_NODE,
        /**
         * Policy based on maximum number of entries stored per data structure (map, cache etc)
         * on each partition
         */
        PER_PARTITION,
        /**
         * Policy based on maximum used JVM heap memory percentage per data structure (map, cache etc)
         * on each Hazelcast instance
         */
        USED_HEAP_PERCENTAGE,
        /**
         * Policy based on maximum used JVM heap memory in megabytes per data structure (map, cache etc)
         * on each Hazelcast instance
         */
        USED_HEAP_SIZE,
        /**
         * Policy based on minimum free JVM heap memory percentage per JVM
         */
        FREE_HEAP_PERCENTAGE,
        /**
         * Policy based on minimum free JVM heap memory in megabytes per JVM
         */
        FREE_HEAP_SIZE,
        /**
         * Policy based on maximum used native memory in megabytes per data structure (map, cache etc)
         * on each Hazelcast instance
         */
        USED_NATIVE_MEMORY_SIZE,
        /**
         * Policy based on maximum used native memory percentage per data structure (map, cache etc)
         * on each Hazelcast instance
         */
        USED_NATIVE_MEMORY_PERCENTAGE,
        /**
         * Policy based on minimum free native memory in megabytes per Hazelcast instance
         */
        FREE_NATIVE_MEMORY_SIZE,
        /**
         * Policy based on minimum free native memory percentage per Hazelcast instance
         */
        FREE_NATIVE_MEMORY_PERCENTAGE
    }

    /**
     * Gets immutable version of this configuration.
     *
     * @return immutable version of this configuration
     * @deprecated this method will be removed in 4.0; it is meant for internal usage only
     */
    public MaxSizeConfigReadOnly getAsReadOnly() {
        if (readOnly == null) {
            readOnly = new MaxSizeConfigReadOnly(this);
        }
        return readOnly;
    }

    /**
     * Returns the size of the map.
     *
     * @return the size of the map
     */
    public int getSize() {
        return size;
    }

    /**
     * Sets the maximum size of the map.
     *
     * @param size the maximum size of the map
     * @return the map MaxSizeConfig
     */
    public MaxSizeConfig setSize(int size) {
        if (size > 0) {
            this.size = size;
        }
        return this;
    }

    /**
     * Returns the maximum size policy of the map.
     *
     * @return the MaxSizePolicy of the map
     */
    public MaxSizePolicy getMaxSizePolicy() {
        return maxSizePolicy;
    }

    /**
     * Ses the maximum size policy of the map.
     *
     * @param maxSizePolicy the maximum size policy to set for the map
     * @return this MaxSizeConfig
     */
    public MaxSizeConfig setMaxSizePolicy(MaxSizePolicy maxSizePolicy) {
        this.maxSizePolicy = maxSizePolicy;
        return this;
    }

    @Override
    public void writeData(ObjectDataOutput out) throws IOException {
        out.writeUTF(maxSizePolicy.toString());
        out.writeInt(size);
    }

    @Override
    public void readData(ObjectDataInput in) throws IOException {
        maxSizePolicy = MaxSizePolicy.valueOf(in.readUTF());
        size = in.readInt();
    }

    @Override
    public String toString() {
        return "MaxSizeConfig{"
                + "maxSizePolicy='" + maxSizePolicy
                + '\''
                + ", size=" + size
                + '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        MaxSizeConfig that = (MaxSizeConfig) o;
        if (size != that.size) {
            return false;
        }
        return maxSizePolicy == that.maxSizePolicy;
    }

    @Override
    public int hashCode() {
        int result = maxSizePolicy != null ? maxSizePolicy.hashCode() : 0;
        result = 31 * result + size;
        return result;
    }
}


text:
layout: leetcode
date: 2016-07-17
title: Nim Game
tags: [Brainteaser]
---

* Contents
{:toc #toc_of_keans_blog}

## Question

You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the winner. You will take the first turn to remove the stones.

Both of you are very clever and have optimal strategies for the game. Write a function to determine whether you can win the game given the number of stones in the heap.

For example, if there are 4 stones in the heap, then you will never win the game: no matter 1, 2, or 3 stones you remove, the last stone will always be removed by your friend.

**Hint:**

1. If there are 5 stones in the heap, could you figure out a way to remove the stones such that you will always be the winner?

***

## Solution

**Result:** Accepted **Time:**  0 ms

Here should be some explanations.

```c
bool canWinNim(int n) {
    return n&3;
}
```

**Complexity Analytics**

- Time Complexity: $$O(1)$$
- Space Complexity: $$O(1)$$

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace A3020\Centry\Job;

use A3020\Centry\Payload\PayloadAbstract;
use Concrete\Core\Job\Job;
use Illuminate\Config\Repository;
use Concrete\Core\Support\Facade\Url;

/**
 * Returns a list of installed jobs.
 */
final class Payload extends PayloadAbstract
{
    /** @var Repository */
    private $config;

    public function __construct(Repository $config)
    {
        $this->config = $config;
    }

    public function jsonSerialize()
    {
        return $this->getJobs();
    }

    private function getJobs()
    {
        $jobs = Job::getList();

        return array_map(function($job) {
            /** @var Job $job */

            return [
                'job_id' => $job->getJobID(),
                'job_handle' => $job->getJobHandle(),
                'job_name' => $job->getJobName(),
                'job_description' => $job->getJobDescription(),
                'job_last_status_text' => $job->getJobLastStatusText(),
                'job_is_scheduled' => (int) $job->isScheduled,
                'job_url' => $this->getJobUrl($job),
                'job_last_run' => $job->getJobDateLastRun() ? strtotime($job->getJobDateLastRun()) : null,
                'job_schedule_interval' => $job->isScheduled ? $job->scheduledInterval : null,
                'job_schedule_value' => $job->isScheduled ? $job->scheduledValue : null,
                'job_is_queueable' => $job->supportsQueue(),
            ];
        }, $jobs);
    }

    /**
     * @param Job $job
     * @return string
     */
    public function getJobUrl(Job $job)
    {
        return (string) Url::to(
            '/ccm/system/jobs/run_single?auth=' . $job->generateAuth() . '&jID=' . $job->getJobID()
        );
    }
}


text:
package com.bobs.serialcommands;

import com.bobs.mount.Axis;
import org.junit.Before;
import org.junit.Test;

import javax.xml.bind.DatatypeConverter;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.verifyZeroInteractions;

/**
 * Created by dokeeffe on 1/2/17.
 */
public class GuideTest extends BaseCommandTest {

    @Before
    public void setUp() throws Exception {
        super.setup();
    }

    @Test
    public void getCommand() throws Exception {
        Guide guide = new Guide(mount, 100, Axis.ALT, 100);
        assertEquals("5003112664640001", DatatypeConverter.printHexBinary(guide.getCommand()));
        guide = new Guide(mount, 100, Axis.AZ, 100);
        assertEquals("5003102664640001", DatatypeConverter.printHexBinary(guide.getCommand()));
    }

    @Test
    public void handleMessage() {
        Guide guide = new Guide(mount, 100, Axis.ALT, 100);
        guide.handleMessage(ACK);
        verifyZeroInteractions(mockMount);
    }
}


text:
« CSS « CSS Reference   « CSS Reference:Mozilla Extensions

This content covers features introduced in Firefox 3.

 Summary

:-moz-tree-row(hover) will match an element if the mouse cursor is presently hovering over a tree row.

This selector is intended for use mainly by theme developers.


text:
title: AMP対応したときのエラー
date: "2017-03-27T00:00:00.00Z"
layout: post
path: "/amp-error/"
categories: ["Frontend", "AMP", "CSS"]
description: "AMP対応をしていたら、腑に落ちないエラーに遭遇したという小話"
---

## AMP対応
[AMP](https://www.ampproject.org/ja/)とは、Accelerated Mobile Pagesの略です。
Googleが推し進めている、モバイル端末でのウェブページ高速表示プロジェクトです。
最近SEOに関連して記事などのページでよくこの対応します。

## AMPでのCSS読み込み
AMPではCSSファイルを読み込むとエラーになります。
```
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<style amp-custom>インラインのCSS</style>
```
このように、***style amp-boilerplateタグ***を先に記述し、
その後の***style amp-customタグ***の中で***インライン***でCSSを記述します。

style amp-customタグで読み込むインラインのCSSには、容量制限(***50,000B = 50KB***)があります。
インラインで管理するのはとても面倒かつ圧縮もしなければならないので、管理としては普通にファイルとして管理し、PHPなどでstyle amp-customタグ内にインラインに書き込むのが一般的のような気がします。

## エラー
さて問題のエラーです。
AMP Validatorで以下のエラーがずっと表示され一向に解決しない。
```
CSS syntax error in tag 'style amp-custom' - invalid declaration. Debug.
```
どうやらstyle amp-customタグ内のCSSに関するエラーのようなのですが、
特に問題がないように見受けられます。

有益な情報も見つからない感じだったので、
CSS圧縮を[cssnano](https://github.com/ben-eb/cssnano)から[gulp-cssmin](https://github.com/chilijung/gulp-cssmin)に変更してみたら、キレイにエラーが消えました。

CSS圧縮の方式によってはエラーになるようです。

僕の勉強不足なのか、日頃の行いが悪いのか、腑に落ちない。


text:
%include "module.inc"

%define log 0

; set to 1 to disable AT/XT translation and activate scan code set 2.
; the XT codes are easier to deal with though :)
%define use_set2 0

; TODO: Extract the keyboard driver stuff from this into a separate driver.
; - Allows ACPICA to use the console again. The problem is that our keyboard
;   driver needs acpica to route interrupts, so we have deadlocks.
; - Allows e.g. USB and future keyboard drivers
; - More similar to what a terminal emulator interface might look like.
;
; Interface summary:
; * MSG_CON_WRITE: write to screen
;   (use send - console does not respond)
;   byte to write in esi
; * MSG_CON_READ: input a character
;   (use sendrcv - the console will block until you've received the input)
;   Accepts fresh handles.

; (Internals)
; * MSG_IRQ_T: keyboard interrupt
;   responds as soon as the new key is in the buffer
;   (after 15 characters, start dropping stuff)

the_reader equ 1
pic_driver equ 6

IRQ_KEYBOARD	equ 1
KEY_DATA	equ 0x60
KEY_CMD		equ 0x64

boot:
%if log
lodstr	edi, 'console: booting...', 10
	call	printf
%endif

	; bits:
	; 0 = first port IRQ (1 = enabled)
	; 1 = second port irq (disabled)
	; 2 = passed POST (not sure if need to write, but let's say we did pass
	; POST)
	; 3 = should be zero
	; 4 = first ps/2 port clock (1 = disabled)
	; 5 = second ps/2 port clock (1 = disabled)
	; 6 = first ps/2 port translation (1 = enabled)
	;     we want this disabled, to get the raw scan codes from keyboard
CONFIG_BYTE	equ	1 | 4

%if use_set2
	mov	di, KEY_CMD
	mov	si, 0x60 ; write config byte
	call	outb
	call	wait_ready_for_write
	mov	di, KEY_DATA
	mov	si, CONFIG_BYTE
	call	outb
	call	wait_ready_for_write
	mov	di, KEY_DATA
	mov	si, 0xff ; reset
	call	outb
	call	wait_ready_for_write
	mov	di, KEY_DATA
	mov	si, 0xf0 ; set scan code set
	call	outb
	call	wait_ready_for_write
	mov	di, KEY_DATA
	mov	si, 2 ; scan code set 2
	call	outb
%endif
	; Clear the 8042 input buffer twice for good measure?
	call	clear_buffer
	call	clear_buffer

	; TODO Reinitialize the keyboard and 8042 here. We should not assume it
	; has a sane state after the boot loader.
	; Also, the key-up code of the last input to grub often comes in just
	; after boot up. We should ignore that (would come as a bonus after
	; resetting the keyboard.)

	mov	edi, pic_driver
	push	rdi
	push	byte 0
	mov	ebp, esp
	; [rbp]: last character read, or 0
	; [rbp+1]: non-zero if there's a process waiting for a key press, or a
	; process in the middle of writing a line.
	; [rbp+4]: shift state

	mov	esi, IRQ_KEYBOARD
	mov	eax, msg_call(MSG_REG_IRQ)
	syscall

%if log
lodstr	edi, 'console: boot complete', 10
	call	printf
%endif

	mov	eax, MSG_HMOD
	mov	edi, the_reader
	; delete
	zero	esi
	zero	edx
	syscall

rcv_loop:
	zero	eax
	zero	edi
	cmp	byte [rsp + 1], 0
	jnz	.waiting
	mov	edi,the_reader ; recipient == any, or "the" reader
.waiting:
	syscall
	; rdi = source
	; rax = message type (MSG_CON_*)

	cmp	rdi, [rsp + 8] ; The sender is the PIC driver
	je	irq_message

	cmp	al, MSG_CON_WRITE
	jz	msg_write

	cmp	al, MSG_CON_READ
	jz	msg_read

	; unknown
	jmp	rcv_loop

msg_write:
	push	rsi
	cmp	esi, 10
	je	.newline

	cmp	rdi, the_reader
	je	.write

	; rename the writer to the_reader
	mov	eax, MSG_HMOD
	mov	esi, the_reader
	zero	edx
	syscall

.write:
	; Let's cheat for now
	; Later: have the frame buffer mapped in this process instead.
	mov	eax, MSG_SYSCALL_WRITE
	pop	rdi ; the character pushed above
	syscall

	jmp	rcv_loop

.newline:
	; new line, clear the reader
	call	clear_reader
	jmp	.write

msg_read:
	push	rdi
%if log
	mov	rsi, rdi
lodstr	edi,	'msg_read from %x', 10
	call	printf
%endif

	pop	rdi
	mov	eax, MSG_HMOD
	mov	esi, the_reader
	zero	edx
	syscall

	mov	byte [rbp + 1], 1
%if log
lodstr	edi,	'Have reader, key=%x waiting=%x', 10
	movzx	esi, byte [rbp]
	movzx	edx, byte [rbp + 1]
	call	printf
%endif

	; no character queued yet, wait for input
	cmp	byte [rbp], 0
	je	rcv_loop
	call	have_key
	jmp	rcv_loop

have_key:
%if log
lodstr	edi,	'Have key %x (waiting=%x), sending to reader', 10
	movzx	esi, byte [rbp]
	movzx	edx, byte [rbp + 1]
	call	printf
%endif

	mov	edi, the_reader
	mov	eax, msg_send(MSG_CON_READ)
	movzx	esi, byte [rbp]
	syscall

	; delete the reader now that it's done
	call	clear_reader

	zero	eax
	mov	[rbp], eax

	ret

clear_reader:
	mov	eax, MSG_HMOD
	mov	edi, the_reader
	zero	esi
	zero	edx
	syscall
	ret

irq_message:
	push	rdi
	; Assume message == MSG_IRQ_T

	mov	edi, KEY_DATA
	call	inb

	mov	[rbp], al
%if log
	mov	esi, eax
	movzx	edx, byte [rbp + 1]
lodstr	edi,	'Key scancode received: %x (waiting=%x)', 10
	call	printf
%endif

	call	map_key

%if log
	movzx	esi, byte [rbp]
	mov	edx, esi
	movzx	ecx, byte [rbp + 1]
lodstr	edi,	'ASCII received: %c (%x) (waiting=%x)', 10
	call	printf
%endif

	; mapping ate the key, or it didn't have a mapping or shouldn't output
	; any characters.
	cmp	byte [rbp], 0
	jz	.ack_and_ret
	cmp	byte [rbp + 1], 0
	jz	.ack_and_ret
	call	have_key
.ack_and_ret:

	pop	rdi
	mov	eax, msg_send(MSG_IRQ_ACK)
	syscall

	jmp	rcv_loop

%if use_set2
wait_ready_for_write:
	mov	di, KEY_CMD
	call	inb
	test	al, 2
	jnz	wait_ready_for_write
	ret
%endif

clear_buffer:
	mov	di, KEY_DATA
	call	inb
	mov	di, KEY_CMD
	call	inb
	test	al, 1
	jnz	clear_buffer
.ret	ret

IS_SHIFTED	equ	1

; one key event: optional e0 (or e1/e2), followed by one make/break code
; for now, we ignore all e0 codes and only look at the "normal" code that follows

; [rbp] = key
; [rbp + 4] = shift state
map_key:
	movzx	eax, byte [rbp]
	cmp	al, 0xe0
	je	.ignore_this

	and	al, 0x7f
	cmp	al, keymap.numkeys
	ja	.ignore_this

.can_map_key:
	test	byte [rbp + 4], IS_SHIFTED
	jz	.not_shifted
	add	eax, keymap.shifted - keymap
.not_shifted:
	mov	al, [keymap + rax]
	cmp	al, SPEC_SHIFT
	je	.shift

.key_mapped:
	; press events don't generate any characters
	test	byte [rbp], 0x80
	jz	.ret
.ignore_this:
	xor	eax,eax
.ret
	; al is ascii key code of a released normal key (or 0 for an ignored
	; one).
	mov	byte [rbp], al
	ret

.shift:
	and	byte [rbp + 4], ~IS_SHIFTED
	test	byte [rbp], 0x80
	jnz	.ignore_this
	or	byte [rbp + 4], IS_SHIFTED
	jmp	.ignore_this

%include "portio.inc"
%if log
%include "printf.inc"
%include "putchar.inc"
%endif
%include "keymap.inc"


text:
from tornado.gen import coroutine
from ujson import loads

from holmes.models import UsersViolationsPrefs
from holmes.handlers import BaseHandler

class UsersViolationsPrefsHandler(BaseHandler):

    @coroutine
    def get(self):
        user = self.get_authenticated_user()

        if not user:
            return

        user_prefs = UsersViolationsPrefs.get_prefs(self.db, user)

        violation_defs = self.application.violation_definitions

        user_prefs_keys = set(user_prefs.keys())
        violation_defs_keys = set(violation_defs.keys())

        insert_items = list(violation_defs_keys - user_prefs_keys)
        if insert_items:
            UsersViolationsPrefs.insert_prefs(self.db, user, insert_items)

        remove_items = list(user_prefs_keys - violation_defs_keys)
        if remove_items:
            UsersViolationsPrefs.delete_prefs(self.db, user, remove_items)

        result = []
        for key_name in violation_defs:
            category = violation_defs[key_name]['category']
            name = violation_defs[key_name]['title']
            description = violation_defs[key_name]['generic_description']
            is_active = user_prefs.get(key_name, True)

            result.append({
                'key': key_name,
                'name': self._(name),
                'description': self._(description),
                'category': self._(category),
                'is_active': is_active
            })

        self.write_json(result)

    @coroutine
    def post(self):
        user = self.get_authenticated_user()

        if not user:
            return

        post_data = loads(self.request.body)

        UsersViolationsPrefs.update_by_user(self.db, user, post_data)

        self.write_json({
            'reason': self._('Preferences successfully saved!'),
            'description': self._('Preferences successfully saved!')
        })


text:
package org.openfact.representations.idm.ubl.common;

import java.util.List;

public class AddressRepresentation {
    private String idUbl;
    private String addressRepresentationCode;
    private String addressFormatCode;
    private String postbox;
    private String floor;
    private String room;
    private String streetName;
    private String additionalStreetName;
    private String blockName;
    private String buildingName;
    private String buildingNumber;
    private String inhouseMail;
    private String department;
    private String markAttention;
    private String markCare;
    private String plotIdentification;
    private String citySubdivisionName;
    private String cityName;
    private String postalZone;
    private String countrySubentity;
    private String countrySubentityCode;
    private String region;
    private String district;
    private String timezoneOffset;
    private List<String> addressLine;
    private CountryRepresentation country;
    private LocationCoordinateRepresentation locationCoordinate;
    private String id;

    public String getDistrict() {
        return this.district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public String getIdUbl() {
        return this.idUbl;
    }

    public void setIdUbl(String idUbl) {
        this.idUbl = idUbl;
    }

    public String getId() {
        return this.id;
    }

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

    public String getBuildingNumber() {
        return this.buildingNumber;
    }

    public void setBuildingNumber(String buildingNumber) {
        this.buildingNumber = buildingNumber;
    }

    public List<String> getAddressLine() {
        return this.addressLine;
    }

    public void setAddressLine(List<String> addressLine) {
        this.addressLine = addressLine;
    }

    public String getAdditionalStreetName() {
        return this.additionalStreetName;
    }

    public void setAdditionalStreetName(String additionalStreetName) {
        this.additionalStreetName = additionalStreetName;
    }

    public String getTimezoneOffset() {
        return this.timezoneOffset;
    }

    public void setTimezoneOffset(String timezoneOffset) {
        this.timezoneOffset = timezoneOffset;
    }

    public String getMarkCare() {
        return this.markCare;
    }

    public void setMarkCare(String markCare) {
        this.markCare = markCare;
    }

    public String getCountrySubentity() {
        return this.countrySubentity;
    }

    public void setCountrySubentity(String countrySubentity) {
        this.countrySubentity = countrySubentity;
    }

    public String getDepartment() {
        return this.department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public LocationCoordinateRepresentation getLocationCoordinate() {
        return this.locationCoordinate;
    }

    public void setLocationCoordinate(LocationCoordinateRepresentation locationCoordinate) {
        this.locationCoordinate = locationCoordinate;
    }

    public String getPostbox() {
        return this.postbox;
    }

    public void setPostbox(String postbox) {
        this.postbox = postbox;
    }

    public String getPostalZone() {
        return this.postalZone;
    }

    public void setPostalZone(String postalZone) {
        this.postalZone = postalZone;
    }

    public String getStreetName() {
        return this.streetName;
    }

    public void setStreetName(String streetName) {
        this.streetName = streetName;
    }

    public String getFloor() {
        return this.floor;
    }

    public void setFloor(String floor) {
        this.floor = floor;
    }

    public String getBuildingName() {
        return this.buildingName;
    }

    public void setBuildingName(String buildingName) {
        this.buildingName = buildingName;
    }

    public String getMarkAttention() {
        return this.markAttention;
    }

    public void setMarkAttention(String markAttention) {
        this.markAttention = markAttention;
    }

    public String getCountrySubentityCode() {
        return this.countrySubentityCode;
    }

    public void setCountrySubentityCode(String countrySubentityCode) {
        this.countrySubentityCode = countrySubentityCode;
    }

    public String getCitySubdivisionName() {
        return this.citySubdivisionName;
    }

    public void setCitySubdivisionName(String citySubdivisionName) {
        this.citySubdivisionName = citySubdivisionName;
    }

    public String getAddressFormatCode() {
        return this.addressFormatCode;
    }

    public void setAddressFormatCode(String addressFormatCode) {
        this.addressFormatCode = addressFormatCode;
    }

    public String getBlockName() {
        return this.blockName;
    }

    public void setBlockName(String blockName) {
        this.blockName = blockName;
    }

    public CountryRepresentation getCountry() {
        return this.country;
    }

    public void setCountry(CountryRepresentation country) {
        this.country = country;
    }

    public String getInhouseMail() {
        return this.inhouseMail;
    }

    public void setInhouseMail(String inhouseMail) {
        this.inhouseMail = inhouseMail;
    }

    public String getAddressRepresentationCode() {
        return this.addressRepresentationCode;
    }

    public void setAddressRepresentationCode(String addressRepresentationCode) {
        this.addressRepresentationCode = addressRepresentationCode;
    }

    public String getRoom() {
        return this.room;
    }

    public void setRoom(String room) {
        this.room = room;
    }

    public String getRegion() {
        return this.region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getCityName() {
        return this.cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    public String getPlotIdentification() {
        return this.plotIdentification;
    }

    public void setPlotIdentification(String plotIdentification) {
        this.plotIdentification = plotIdentification;
    }
}


text:
<?php

namespace Drupal\auto_entitylabel\Plugin\Validation;

use Drupal\Core\Validation\Plugin\Validation\Constraint\NotNullConstraint;
use Symfony\Component\Validator\Constraint;

/**
 * Custom override of NotNull constraint to allow empty entity labels to
 * validate before the automatic label is set.
 */
class EntityLabelNotNullConstraint extends NotNullConstraint {}


text:
from .base import BaseHandler
from .ping import PingHandler
from .static import StaticFileHandler
from .task import TaskHandler
from .upload import UploadHandler


text:
require 'nomadize'
require 'nomadize/help'

namespace :db do

  desc Nomadize.help.fetch(:create)
  task :create do
    Nomadize.create_database
  end

  desc Nomadize.help.fetch(:drop)
  task :drop do
    Nomadize.drop_database
  end

  desc Nomadize.help.fetch(:new_migration)
  task :new_migration, [:migration_name] do |_, args|
    Nomadize.generate_template_migration_file(args.migration_name)
  end

  desc Nomadize.help.fetch(:migrate)
  task :migrate do
    Nomadize.run_migrations
  end

  desc Nomadize.help.fetch(:status)
  task :status do
    Nomadize.status
  end

  desc Nomadize.help.fetch(:rollback)
  task :rollback, :steps do |_, args|
    count = args.steps || 1
    Nomadize.rollback(count)
  end

  desc Nomadize.help.fetch(:generate_template_config)
  task :generate_template_config do
    Nomadize.generate_template_config
    puts 'Config created in config/database.yml'
  end

end


text:
/**
 * sqs-queue-parallel 0.1.6 <https://github.com/bigluck/sqs-queue-parallel>
 * Create a poll of Amazon SQS queue watchers and each one can receive 1+ messages
 *
 * Available under MIT license <https://github.com/bigluck/sqs-queue-parallel/raw/master/LICENSE>
 */
(function() {
  var AWS, SqsQueueParallel, async, events, globalConfig, _,
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
    __slice = [].slice;

  AWS = require('aws-sdk');

  events = require('events');

  async = require('async');

  _ = require('lodash');

  globalConfig = {};

  module.exports = SqsQueueParallel = (function(_super) {
    __extends(SqsQueueParallel, _super);

    SqsQueueParallel.configure = function(config) {
      if (config == null) {
        config = {};
      }
      return globalConfig = _.extend(globalConfig, config);
    };

    function SqsQueueParallel(config) {
      var readQueue, self;
      if (config == null) {
        config = {};
      }
      this.config = _.extend({
        region: process.env.AWS_REGION,
        accessKeyId: process.env.AWS_ACCESS_KEY,
        secretAccessKey: process.env.AWS_SECRET_KEY,
        visibilityTimeout: null,
        waitTimeSeconds: 20,
        maxNumberOfMessages: 1,
        name: '',
        concurrency: 1,
        debug: false
      }, globalConfig, config);
      this.client = null;
      this.url = null;
      self = this;
      readQueue = function(index) {
        if (!(self.listeners("message").length && self.url)) {
          return;
        }
        return async.waterfall([
          function(next) {
            var options;
            if (self.config.debug) {
              console.log("SqsQueueParallel " + self.config.name + "[" + index + "]: waiting messages");
            }
            return self.client.receiveMessage((options = {
              QueueUrl: self.url,
              AttributeNames: ["All"],
              MaxNumberOfMessages: self.config.maxNumberOfMessages,
              WaitTimeSeconds: self.config.waitTimeSeconds
            }, self.config.visibilityTimeout != null ? options.VisibilityTimeout = self.config.visibilityTimeout : void 0, options), next);
          }, function(queue, next) {
            var _ref;
            if (!((_ref = queue.Messages) != null ? _ref[0] : void 0)) {
              return next(null);
            }
            if (self.config.debug) {
              console.log("SqsQueueParallel " + self.config.name + "[" + index + "]: " + queue.Messages.length + " new messages");
            }
            return async.eachSeries(queue.Messages, function(message, next) {
              return self.emit("message", {
                type: 'message',
                data: JSON.parse(message.Body) || message.Body,
                message: message,
                metadata: queue.ResponseMetadata,
                url: self.url,
                name: self.config.name,
                next: next,
                deleteMessage: function(cb) {
                  return self.deleteMessage(message.ReceiptHandle, cb);
                },
                delay: function(timeout, cb) {
                  return self.changeMessageVisibility(message.ReceiptHandle, timeout, cb);
                },
                changeMessageVisibility: function(timeout, cb) {
                  return self.changeMessageVisibility(message.ReceiptHandle, timeout, cb);
                }
              });
            }, function() {
              return next(null);
            });
          }
        ], function(err) {
          if (err) {
            self.emit.apply(self, ["error"].concat(__slice.call(arguments)));
          }
          return process.nextTick(function() {
            return readQueue(index);
          });
        });
      };
      this.addListener('newListener', function(name) {
        if (name !== 'message') {
          return;
        }
        if (self.config.debug) {
          console.info("SqsQueueParallel " + self.config.name + ": new listener");
        }
        if (!this.client || this.listeners("message").length === 1) {
          return this.connect(function(err) {
            if (err || !self.url || !self.listeners("message").length) {
              return;
            }
            return _.times(self.config.concurrency || 1, function(index) {
              return readQueue(index);
            });
          });
        }
      });
      if (this.config.debug) {
        this.on('connection', function(urls) {
          return console.log("SqsQueueParallel: connection to SQS", urls);
        });
        this.on('connect', function() {
          return console.log("SqsQueueParallel " + self.config.name + ": connected with url `" + self.url + "`");
        });
        this.on('error', function(e) {
          return console.log("SqsQueueParallel " + self.config.name + ": connection failed", e);
        });
      }
    }

    SqsQueueParallel.prototype.connect = function(cb) {
      var self;
      if (!(this.client && this.url)) {
        this.once('connect', function() {
          return cb(null);
        });
        if (this.client && !this.url) {
          return;
        }
      }
      if (this.client) {
        return cb(null);
      }
      self = this;
      this.client = new AWS.SQS({
        region: this.config.region,
        accessKeyId: this.config.accessKeyId,
        secretAccessKey: this.config.secretAccessKey
      });
      async.waterfall([
        function(next) {
          return self.client.listQueues({
            QueueNamePrefix: self.config.name
          }, next);
        }, function(data, next) {
          var re, url, _i, _len, _ref;
          re = new RegExp("/[\\d]+/" + self.config.name + "$");
          self.emit('connection', data.QueueUrls);
          _ref = data.QueueUrls;
          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
            url = _ref[_i];
            if (re.test(url)) {
              self.emit('connect', self.url = url);
            }
          }
          if (!self.url) {
            self.emit('error', new Error('Queue not found'));
            return next('Queue not found');
          }
        }
      ], function(err) {
        if (!err) {
          return;
        }
        self.emit('error', err);
        return cb.apply(null, arguments);
      });
      return this;
    };

    SqsQueueParallel.prototype.sendMessage = function(message, cb) {
      var self;
      if (message == null) {
        message = {};
      }
      if (cb == null) {
        cb = function() {};
      }
      self = this;
      this.connect(function(err) {
        var params;
        if (err) {
          return cb.apply(null, arguments);
        }
        if (self.config.debug) {
          console.log("SqsQueueParallel " + self.config.name + ": before sendMessage with url `" + self.url + "`");
        }
        params = {
          MessageBody: JSON.stringify(message.body || {}),
          QueueUrl: self.url
        };
        if (message.delay != null) {
          params.DelaySeconds = message.delay;
        }
        return self.client.sendMessage(params, cb);
      });
      return this;
    };

    SqsQueueParallel.prototype.deleteMessage = function(receiptHandle, cb) {
      var self;
      if (cb == null) {
        cb = function() {};
      }
      self = this;
      this.connect(function(err) {
        if (err) {
          return cb.apply(null, arguments);
        }
        if (self.config.debug) {
          console.log("SqsQueueParallel " + self.config.name + ": before deleteMessage " + receiptHandle + " with url `" + self.url + "`");
        }
        return self.client.deleteMessage({
          QueueUrl: self.url,
          ReceiptHandle: receiptHandle
        }, cb);
      });
      return this;
    };

    SqsQueueParallel.prototype.changeMessageVisibility = function(receiptHandle, timeout, cb) {
      var self;
      if (timeout == null) {
        timeout = 30;
      }
      if (cb == null) {
        cb = function() {};
      }
      self = this;
      this.connect(function(err) {
        if (err) {
          return cb.apply(null, arguments);
        }
        if (self.config.debug) {
          console.log("SqsQueueParallel " + self.config.name + ": before changeMessageVisibility " + receiptHandle + " with url `" + self.url + "`");
        }
        return self.client.changeMessageVisibility({
          QueueUrl: self.url,
          ReceiptHandle: receiptHandle,
          VisibilityTimeout: timeout
        }, cb);
      });
      return this;
    };

    return SqsQueueParallel;

  })(events.EventEmitter);

}).call(this);


text:
newparam(:sys_password) do
  include EasyType
  desc 'The password of ythe SYS account'

  to_translate_to_resource do | raw_resource|
  #  raw_resource.column_data('sys_password')
  end

  on_apply do | command_builder|
    "user sys identified by #{value}"
  end

end


text:
package org.apache.camel.impl.cloud;

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

import org.apache.camel.CamelContext;
import org.apache.camel.Ordered;
import org.apache.camel.cloud.ServiceRegistry;
import org.apache.camel.support.ServiceSupport;

public abstract class AbstractServiceRegistry extends ServiceSupport implements ServiceRegistry {
    private final Map<String, Object> attributes;
    private int order;
    private String id;
    private CamelContext camelContext;

    protected AbstractServiceRegistry() {
        this(null, null);
    }

    protected AbstractServiceRegistry(String id) {
        this(id, null);
    }

    protected AbstractServiceRegistry(String id, CamelContext camelContext) {
        this.order = Ordered.LOWEST;
        this.id = id;
        this.camelContext = camelContext;
        this.attributes = new HashMap<>();
    }

    @Override
    public int getOrder() {
        return order;
    }

    public void setOrder(int order) {
        this.order = order;
    }

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

    @Override
    public String getId() {
        return id;
    }

    @Override
    public void setCamelContext(CamelContext camelContext) {
        this.camelContext = camelContext;
    }

    @Override
    public CamelContext getCamelContext() {
        return camelContext;
    }

    public void setAttributes(Map<String, Object> attributes) {
        this.attributes.clear();
        this.attributes.putAll(attributes);
    }

    public void setAttribute(String key, Object value) {
        this.attributes.put(key, value);
    }

    @Override
    public Map<String, Object> getAttributes() {
        return Collections.unmodifiableMap(attributes);
    }
}


text:
<script src="app.js"></script>
<script>document.location=APP_INFO.ios_auto_boarding_url</script>


text:
<?php

/**
 * WYSIWYG widget options form
 *
 * @author     Magento Core Team <core@magentocommerce.com>
 */
namespace Magento\Widget\Block\Adminhtml\Widget;

class Options extends \Magento\Backend\Block\Widget\Form\Generic
{
    /**
     * Element type used by default if configuration is omitted
     * @var string
     */
    protected $_defaultElementType = 'text';

    /**
     * @var \Magento\Widget\Model\Widget
     */
    protected $_widget;

    /**
     * @var \Magento\Framework\Option\ArrayPool
     */
    protected $_sourceModelPool;

    /**
     * @param \Magento\Backend\Block\Template\Context $context
     * @param \Magento\Framework\Registry $registry
     * @param \Magento\Framework\Data\FormFactory $formFactory
     * @param \Magento\Framework\Option\ArrayPool $sourceModelPool
     * @param \Magento\Widget\Model\Widget $widget
     * @param array $data
     */
    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Magento\Framework\Registry $registry,
        \Magento\Framework\Data\FormFactory $formFactory,
        \Magento\Framework\Option\ArrayPool $sourceModelPool,
        \Magento\Widget\Model\Widget $widget,
        array $data = []
    ) {
        $this->_sourceModelPool = $sourceModelPool;
        $this->_widget = $widget;
        parent::__construct($context, $registry, $formFactory, $data);
    }

    /**
     * Prepare Widget Options Form and values according to specified type
     *
     * The widget_type must be set in data before
     * widget_values may be set before to render element values
     *
     * @return $this
     */
    protected function _prepareForm()
    {
        $this->getForm()->setUseContainer(false);
        $this->addFields();
        return $this;
    }

    /**
     * Form getter/instantiation
     *
     * @return \Magento\Framework\Data\Form
     */
    public function getForm()
    {
        if ($this->_form instanceof \Magento\Framework\Data\Form) {
            return $this->_form;
        }
        /** @var \Magento\Framework\Data\Form $form */
        $form = $this->_formFactory->create();
        $this->setForm($form);
        return $form;
    }

    /**
     * Fieldset getter/instantiation
     *
     * @return \Magento\Framework\Data\Form\Element\Fieldset
     */
    public function getMainFieldset()
    {
        if ($this->_getData('main_fieldset') instanceof \Magento\Framework\Data\Form\Element\Fieldset) {
            return $this->_getData('main_fieldset');
        }
        $mainFieldsetHtmlId = 'options_fieldset' . md5($this->getWidgetType());
        $this->setMainFieldsetHtmlId($mainFieldsetHtmlId);
        $fieldset = $this->getForm()->addFieldset(
            $mainFieldsetHtmlId,
            ['legend' => __('Widget Options'), 'class' => 'fieldset-wide']
        );
        $this->setData('main_fieldset', $fieldset);

        // add dependence javascript block
        $block = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Form\Element\Dependence');
        $this->setChild('form_after', $block);

        return $fieldset;
    }

    /**
     * Add fields to main fieldset based on specified widget type
     *
     * @throws \Magento\Framework\Exception\LocalizedException
     * @return $this
     */
    public function addFields()
    {
        // get configuration node and translation helper
        if (!$this->getWidgetType()) {
            throw new \Magento\Framework\Exception\LocalizedException(__('Please specify a Widget Type.'));
        }
        $config = $this->_widget->getConfigAsObject($this->getWidgetType());
        if (!$config->getParameters()) {
            return $this;
        }
        foreach ($config->getParameters() as $parameter) {
            $this->_addField($parameter);
        }

        return $this;
    }

    /**
     * Add field to Options form based on parameter configuration
     *
     * @param \Magento\Framework\DataObject $parameter
     * @return \Magento\Framework\Data\Form\Element\AbstractElement
     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
     * @SuppressWarnings(PHPMD.NPathComplexity)
     */
    protected function _addField($parameter)
    {
        $form = $this->getForm();
        $fieldset = $this->getMainFieldset();
        //$form->getElement('options_fieldset');

        // prepare element data with values (either from request of from default values)
        $fieldName = $parameter->getKey();
        $data = [
            'name' => $form->addSuffixToName($fieldName, 'parameters'),
            'label' => __($parameter->getLabel()),
            'required' => $parameter->getRequired(),
            'class' => 'widget-option',
            'note' => __($parameter->getDescription()),
        ];

        if ($values = $this->getWidgetValues()) {
            $data['value'] = isset($values[$fieldName]) ? $values[$fieldName] : '';
        } else {
            $data['value'] = $parameter->getValue();
            //prepare unique id value
            if ($fieldName == 'unique_id' && $data['value'] == '') {
                $data['value'] = md5(microtime(1));
            }
        }

        // prepare element dropdown values
        if ($values = $parameter->getValues()) {
            // dropdown options are specified in configuration
            $data['values'] = [];
            foreach ($values as $option) {
                $data['values'][] = ['label' => __($option['label']), 'value' => $option['value']];
            }
            // otherwise, a source model is specified
        } elseif ($sourceModel = $parameter->getSourceModel()) {
            $data['values'] = $this->_sourceModelPool->get($sourceModel)->toOptionArray();
        }

        // prepare field type or renderer
        $fieldRenderer = null;
        $fieldType = $parameter->getType();
        // hidden element
        if (!$parameter->getVisible()) {
            $fieldType = 'hidden';
            // just an element renderer
        } elseif ($fieldType && $this->_isClassName($fieldType)) {
            $fieldRenderer = $this->getLayout()->createBlock($fieldType);
            $fieldType = $this->_defaultElementType;
        }

        // instantiate field and render html
        $field = $fieldset->addField($this->getMainFieldsetHtmlId() . '_' . $fieldName, $fieldType, $data);
        if ($fieldRenderer) {
            $field->setRenderer($fieldRenderer);
        }

        // extra html preparations
        if ($helper = $parameter->getHelperBlock()) {
            $helperBlock = $this->getLayout()->createBlock(
                $helper->getType(),
                '',
                ['data' => $helper->getData()]
            );
            if ($helperBlock instanceof \Magento\Framework\DataObject) {
                $helperBlock->setConfig(
                    $helper->getData()
                )->setFieldsetId(
                    $fieldset->getId()
                )->prepareElementHtml(
                    $field
                );
            }
        }

        // dependencies from other fields
        $dependenceBlock = $this->getChildBlock('form_after');
        $dependenceBlock->addFieldMap($field->getId(), $fieldName);
        if ($parameter->getDepends()) {
            foreach ($parameter->getDepends() as $from => $row) {
                $values = isset($row['values']) ? array_values($row['values']) : (string)$row['value'];
                $dependenceBlock->addFieldDependence($fieldName, $from, $values);
            }
        }

        return $field;
    }

    /**
     * Checks whether $fieldType is a class name of custom renderer, and not just a type of input element
     *
     * @param string $fieldType
     * @return bool
     */
    protected function _isClassName($fieldType)
    {
        return preg_match('/[A-Z]/', $fieldType) > 0;
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Voz A Mares homepage</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/style.css" rel="stylesheet">

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
    <link href='https://fonts.googleapis.com/css?family=Kaushan+Script' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700' rel='stylesheet' type='text/css'>

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>
                Inicio

                        Nosotros

                        Novedades

                        Galería

                        Contacto

Voz A Mares

                Conócenos

¿Qué es Voz A Mares?

Somos un grupo de personas que nos hacemos responsables de nuestro propio bienestar, y que por medio del arte en sus diversas manifestaciones creamos espectáculos que nos permitan compartir nuestra forma de ver el mundo con los demás.

					Creemos que la diversidad puede coexistir en armonía si sabemos cómo integrar primero nuestro sistema personal mente-cuerpo-emoción, esto significa ser congruente con lo que uno elige ser. Para nosotros el arte nos ayuda a conectarnos con el placer, ya que a través de los sentidos percibimos, interpretamos y sentimos, ya sea creándolo o estando como espectador.

					Este proyecto surge como una evolución del Ensamble Voces de Sor Juana, con la inquietud de integrar otras formas de expresión artística con el fin de tener más piezas de un gran rompecabezas, que aunque sean diferentes puedan al colocarse en el lugar preciso crear una gran imagen que diga en pocas palabras lo que queremos expresar.

					Y así surge el nombre de nuestro primer proyecto como Voz A mares.

Integrantes

Kay Garland

Lead Designer

Larry Parker

Lead Marketer

Diana Pertersen

Lead Developer

Kay Garland

Lead Designer

Larry Parker

Lead Marketer

Diana Pertersen

Lead Developer

PRESENTACIONES

 Julio 2016

29: Aniversario CEARTE. Ensenada, B.C.

 Agosto 2016

20: Verbena popular. Ensenada, B.C.

AVISOS

En construcción.

Galería

Lorem ipsum dolor sit amet consectetur.

Round Icons

Graphic Design

Startup Framework

Website Design

Treehouse

Website Design

Golden

Website Design

Escape

Website Design

Dreams

Website Design

Contacto

Lorem ipsum dolor sit amet consectetur.

                    <form name="sentMessage" id="contactForm" novalidate>

                                    <input type="text" class="form-control" placeholder="Your Name *" id="name" required data-validation-required-message="Please enter your name.">

                                    <input type="email" class="form-control" placeholder="Your Email *" id="email" required data-validation-required-message="Please enter your email address.">

                                    <input type="tel" class="form-control" placeholder="Your Phone *" id="phone" required data-validation-required-message="Please enter your phone number.">

                                    <textarea class="form-control" placeholder="Your Message *" id="message" required data-validation-required-message="Please enter a message."></textarea>

                                <button type="submit" class="btn btn-xl">Send Message</button>

                    </form>

                    Copyright © Voz A Mares 2016

Privacy Policy

Terms of Use

Project Name

Lorem ipsum dolor sit amet consectetur.

Use this area to describe your project. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est blanditiis dolorem culpa incidunt minus dignissimos deserunt repellat aperiam quasi sunt officia expedita beatae cupiditate, maiores repudiandae, nostrum, reiciendis facere nemo!

                                Want these icons in this portfolio item sample?You can download 60 of them for free, courtesy of RoundIcons.com, or you can purchase the 1500 icon set here.

Date: July 2014

Client: Round Icons

Category: Graphic Design

                            <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

Project Heading

Lorem ipsum dolor sit amet consectetur.

Startup Framework is a website builder for professionals. Startup Framework contains components and complex blocks (PSD+HTML Bootstrap themes and templates) which can easily be integrated into almost any design. All of these components are made in the same style, and can easily be integrated into projects, allowing you to create hundreds of solutions for your future projects.

You can preview Startup Framework here.

                            <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Treehouse is a free PSD web template built by Mathavan Jaya. This is bright and spacious design perfect for people or startup companies looking to showcase their apps or other projects.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                            <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Start Bootstrap's Agency theme is based on Golden, a free PSD website template built by Mathavan Jaya. Golden is a modern and clean one page web template that was made exclusively for Best PSD Freebies. This template has a great portfolio, timeline, and meet your team sections that can be easily modified to fit your needs.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                            <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Escape is a free PSD web template built by Mathavan Jaya. Escape is a one page web template that was designed with agencies in mind. This template is ideal for those looking for a simple one page solution to describe your business and offer your services.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                            <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Dreams is a free PSD web template built by Mathavan Jaya. Dreams is a modern one page web template designed for almost any purpose. It's a beautiful template that's designed with the Bootstrap framework in mind.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                            <button type="button" class="btn btn-primary" data-dismiss="modal"> Close Project</button>


text:
/*
Info: JavaScript for JavaScript Basics Lesson 3, JavaScript Loops, Arrays, Strings, Task 11, Check the Brackets
Author: Removed for reasons of anonymity
Successfully checked as valid in JSLint Validator at: http://www.jslint.com/ and JSHint Validator at: http://www.jshint.com/
*/
'use strict';
function checkBrackets(expression) {
  var brackets, i;
  var exprLen = expression.length;
  var result = "incorrect";
  brackets = 0;
  for (i = 0; i < exprLen; i = i + 1) {
    if (expression[i] === '(') {
      brackets++;
    } else if (expression[i] === ')') {
      brackets--;
    }
    if (brackets < 0) {
      break;
    }
  }

  if (brackets === 0) {
    result = "correct";
  }

  return result;
}

/* For html result view */
function checkBracketsByInput() {
  var output = document.getElementById("output");
  var data = document.getElementById('data').value;
  var elementP = document.createElement("p");
  var outRes = checkBrackets(data);
  elementP.innerHTML = outRes;
  output.appendChild(elementP);
}
/* For node.js result */
var someExpr = ['( ( a + b ) / 5 – d )', ') ( a + b ) )', '( b * ( c + d *2 / ( 2 + ( 12 – c / ( a + 3 ) ) ) )'];
var length = someExpr.length;
var m = 0;
var outResult;
for (m = 0; m < length; m = m + 1) {
  outResult = checkBrackets(someExpr[m]);
  console.log(outResult);
}


text:
module Azure::KeyVault::Mgmt::V2018_02_14_preview
  module Models
    #
    # Parameters for creating or updating a vault
    #
    class VaultPatchParameters

      include MsRestAzure

      # @return [Hash{String => String}] The tags that will be assigned to the
      # key vault.
      attr_accessor :tags

      # @return [VaultPatchProperties] Properties of the vault
      attr_accessor :properties

      #
      # Mapper for VaultPatchParameters class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'VaultPatchParameters',
          type: {
            name: 'Composite',
            class_name: 'VaultPatchParameters',
            model_properties: {
              tags: {
                client_side_validation: true,
                required: false,
                serialized_name: 'tags',
                type: {
                  name: 'Dictionary',
                  value: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'StringElementType',
                      type: {
                        name: 'String'
                      }
                  }
                }
              },
              properties: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties',
                type: {
                  name: 'Composite',
                  class_name: 'VaultPatchProperties'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
//
//  CAShapeLayer+Animation.h
//  QuickAnimation
//
//  Copyright © 2017年 SpadeChen. All rights reserved.
//

#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h>
#import "QuickAnimationBlock.h"

@interface CAShapeLayer (Animation)

/**
 Create the strokeStart and the strokeEnd changing animation
 */
@property (readonly,nonatomic) QuickStrokeRangeBlock StrokeRangeTo;

/**
 *  Create the stroke color changing animation
 */
@property (readonly,nonatomic) QuickColorBlock StrokeColorTo;

/**
 *  Create the fill color changing animation
 */
@property (readonly,nonatomic) QuickColorBlock FillColorTo;

/**
 Create the layer's lineWidth changing animation
 */
@property (readonly,nonatomic) QuickFloatBlock LineWidthTo;

@end


text: Allow compare two svn repositories by compare blame for each file in repository


text:
require 'lego_stock_checker/base_check'

module LegoStockChecker
  class TruCheck< BaseCheck
    def in_stock?
      !page.at_css("#eligibility li:first").attributes["class"].to_s[/\sunavail\s/] if page.at_css("#eligibility li:first") && !!page.at_css("li.avail")
    end

    def price
      page.at_css('#price .retail').try(:text).to_s.strip.sub('$','').to_f if in_stock?
    end
  end
end


text:
<template name="userSettings">
	{{> navbarTop title="Impostazioni"}}

				Domande e Risposte

				Amo e Odio

			{{#with currentUser}}

					<form id="form-upload" class="form-row">

avatar del profilo

Clicca l'immagine per caricarne una nuova

							{{> avatarUploader}}

Per un avatar ottimale ti consigliamo una foto con il tuo volto (auto-detect) o un'immagine il più possibile quadrata con il soggetto al centro.

Elimina la foto

					</form>
					<form id="profile-form" class="form-row">

dati del profilo

							<input type="text" value="{{username}}" id="username" placeholder="Nickname">

							<input type="text" pattern="[0-9/]*" value="{{getBirthDate}}" id="birthday" placeholder="Data di nascita">

							<textarea class="autosize" id="city" placeholder="Luogo di origine">{{profile.city}}</textarea>

							<textarea class="autosize" id="bio" placeholder="Biografia">{{profile.bio}}</textarea>

									<input type="radio" name="status" value="busy" id="busy" {{checkStatus 'busy' this}}>

									<input type="radio" name="status" value="none" id="none" {{checkStatus 'none' this}}>

									<input type="radio" name="status" value="free" id="free" {{checkStatus 'free' this}}>

						<button type="submit" data-icon="prepend" class="yellow">Modifica</button>
					</form>
					{{#unless withFacebook}}
					<form id="account-form" class="form-row">

informazioni account

							<input type="email" id="email" value="{{getEmail}}" placeholder="Indirizzo e-mail">

							<input type="password" id="password" placeholder="Nuova password">

							<input type="password" id="passwordConfirmed" placeholder="Conferma password">

						<button type="submit" data-icon="prepend" class="yellow">Modifica</button>

Il nuovo indirizzo e-mail, per diventare attivo, deve essere verificato attraverso il link presente nella mail che invieremo automaticamente.

Il cambio e-mail e il cambio password comportano un immediato logout dal sistema.

					</form>
					<form id="form-facebook" class="form-row">
						{{#if linkedFacebook}}

scollega facebook {{linkedFacebook}}

Scollega il tuo account di Bisiacaria.com da quello di Facebook.

						<button id="facebook-logout" class="fb-button">

							Scollega il tuo account
						</button>
						{{else}}

collegati a facebook

Collegando il tuo account a Facebook, potrai far interagire i tuoi due profili social. (SPERIMENTALE)

						<button id="facebook-connect" class="fb-button">

							Collega il tuo account
						</button>
						{{/if}}
					</form>
					{{/unless}}
					<form id="settings-form" class="form-row list">

impostazioni notifiche

									Ricevi notifiche sonore

											<input type="checkbox" id="enable-audio" checked="{{profile.notifyAudio}}">

									Ricevi notifiche e-mail

											<input type="checkbox" id="enable-mail" checked="{{profile.notifyMail}}">

									Notifica conoscenti online

											<input type="checkbox" id="enable-online" checked="{{profile.notifyFriends}}">

									La newsletter di Bisiacaria.com

										<button data-icon="prepend" id="newsletter-signup">Iscriviti</button>

								Potrai disiscriverti nella newsletter ricevuta.

							tipo di account: {{getAccount}}

La lista di utenti che hai bloccato e che non sono più in grado di comunicare con te.

						<button type="button" class="yellow" id="blockedusers">
							Utenti bloccati
							{{#if countBlocked}}
								({{countBlocked}})
							{{/if}}
						</button>

							cancellazione profilo

Il tuo profilo verrà eliminato definitivamente da Bisiacaria.com entro 24 ore e non sarà più recuperabile.

						<button type="button" class="red" id="deleteaccount">
							Elimina account
						</button>
					</form>

			{{/with}}

</template>


text:
package hr.fer.zemris.jcms.service.assessments.defimpl;

import hr.fer.zemris.jcms.applications.ApplSourceCodeProducer;
import hr.fer.zemris.jcms.applications.parser.ApplCodeParser;
import hr.fer.zemris.jcms.applications.parser.ApplCodeSection;
import hr.fer.zemris.jcms.model.Assessment;
import hr.fer.zemris.jcms.service.assessments.CalculationException;
import hr.fer.zemris.jcms.service.assessments.CompilationClassException;
import hr.fer.zemris.jcms.service.assessments.IDynaCodeEngine;
import hr.fer.zemris.jcms.service.assessments.IScoreProgramEnvironment;
import hr.fer.zemris.jcms.service.assessments.defimpl.comp.JavaSourceFromString;
import hr.fer.zemris.jcms.service.assessments.defimpl.comp.MyDynamicClassLoader;
import hr.fer.zemris.jcms.service.assessments.defimpl.comp.MyJavaFileManager;
import hr.fer.zemris.jcms.web.actions.data.support.IMessageLogger;

import java.io.IOException;
import java.io.Writer;
import java.lang.ref.ReferenceQueue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.tools.Diagnostic;
import javax.tools.DiagnosticCollector;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;
import javax.tools.JavaCompiler.CompilationTask;

import org.apache.log4j.Logger;

public class DynaCodeEngine implements IDynaCodeEngine {

	public static final Logger logger = Logger.getLogger(DynaCodeEngine.class.getCanonicalName());

	private ReferenceQueue<Class<?>> queue = new ReferenceQueue<Class<?>>();
	private Map<String, Map<Long,DynaClassWeakReference>> caches = new HashMap<String, Map<Long,DynaClassWeakReference>>();

	public static List<String> opcije;

	static {
		try {
			String p = Assessment.class.getResource("Assessment.class").toURI().toString();
			logger.debug("[PREVODENJE] Staza je: "+p);
			System.out.println("[PREVODENJE] Staza je: "+p);
			String staza = null;
			if(p.startsWith("file:/")) {
				staza = p.substring(5);
				if(staza.indexOf(':')==2) {
					// Makni jos jedan jer sam na Windowsima
					staza = staza.substring(1);
				}
				int index = staza.indexOf("hr/fer/zemris/jcms");
				if(index!=-1) {
					staza = staza.substring(0, index);
				}
				logger.debug("[PREVODENJE] Razriješio sam stazu u: "+staza);
				System.out.println("[PREVODENJE] Razriješio sam stazu u: "+staza);
				opcije = new ArrayList<String>();
				opcije.add("-cp");
				opcije.add(staza);
			} else if(p.startsWith("jar:file:/")) {
				staza = p.substring(9);
				if(staza.indexOf(':')==2) {
					// Makni jos jedan jer sam na Windowsima
					staza = staza.substring(1);
				}
				int index = staza.indexOf('!');
				if(index!=-1) {
					staza = staza.substring(0, index);
				}
				logger.debug("[PREVODENJE] Razriješio sam stazu u: "+staza);
				System.out.println("[PREVODENJE] Razriješio sam stazu u: "+staza);
				opcije = new ArrayList<String>();
				opcije.add("-cp");
				opcije.add(staza);
			}
		} catch(Exception ex) {
			logger.error("[PREVODENJE] Pogreška pri konstrukciji staze.", ex);
			System.out.println("[PREVODENJE] Pogreška pri konstrukciji staze.");
			ex.printStackTrace(System.out);
		}
	}

	@Override
	public Class<?> classForProgram(String kind, Long id,
			String program, int programVersion) {
		synchronized(caches) {
			DynaClassWeakReference r;
			while((r = (DynaClassWeakReference)queue.poll()) != null) {
				DynaClassWeakReference r2 = r.getMap().get(r.getId());
				if(r2!=null && r2.getVersion()==r.getVersion()) {
					r.getMap().remove(r.getId());
				}
			}
			Map<Long,DynaClassWeakReference> m = caches.get(kind);
			if(m == null) {
				m = new HashMap<Long, DynaClassWeakReference>();
				caches.put(kind, m);
			}
			DynaClassWeakReference ref = m.get(id);

			Class<?> env = ref != null ? ref.get() : null;
			if(env != null) {
				// Ako imam dobru verziju programa, vrati taj razred
				if(ref.getVersion()==programVersion) {
					//System.out.println("Vraćam razred.");
					return env;
				}
				// Inače imam krivu verziju razreda
				env = null;
				//System.out.println("Imam krivu verziju razreda.");
			}
			// Inače je env==null; idemo ponovno kompajlirati
			String className = "DynaClassTmp"+kind+"_"+id+"_"+programVersion;
			//System.out.println("Prevodim trenutnu verziju razreda "+className+".");
			if(kind.equals("A")) {
				env = compileScore(id, className, program);
			} else if(kind.equals("F")) {
				env = compileFlag(id, className, program);
			} else if(kind.equals("P")) {
				env = compileApplication(id, className, program);
			} else {
				throw new CalculationException("Zatraženo prevođenje programa nepoznate vrste.");
			}
			ref = new DynaClassWeakReference(env, queue, id, programVersion, m);
			m.put(id, ref);
			return env;
		}
	}

	@Override
	public boolean tryCompile(IMessageLogger messageLogger, String kind, String program) {
		if(kind.equals("A")) return tryCompileAssessment(messageLogger, "DynaClassTmpA_tmp", program);
		if(kind.equals("F")) return tryCompileFlag(messageLogger, "DynaClassTmpF_tmp", program);
		if(kind.equals("P")) return tryCompileApplication(messageLogger, "DynaClassTmpP_tmp", program);
		messageLogger.addErrorMessage("Interna greška: nepoznata vrsta programa.");
		return false;
	}

	private boolean tryCompileFlag(IMessageLogger messageLogger, String className, String program) {
		String packagePrefix = "studtest2.dynamic";
		String prog = buildFlagProgramSource(packagePrefix, className, program);
		return tryCompileProgram(messageLogger, packagePrefix, className, prog);
	}

	private boolean tryCompileAssessment(IMessageLogger messageLogger, String className, String program) {
		String packagePrefix = "studtest2.dynamic";
		String prog = buildAssessmentProgramSource(packagePrefix, className, program);
		return tryCompileProgram(messageLogger, packagePrefix, className, prog);
	}

	private boolean tryCompileApplication(IMessageLogger messageLogger, String className, String program) {
		String packagePrefix = "studtest2.dynamic";
		return tryCompileProgram(messageLogger, packagePrefix, className, program);
	}

	private boolean tryCompileProgram(IMessageLogger messageLogger, String packagePrefix, String className, String prog) {
		try {
			String fullClassName = packagePrefix+"."+className;

			javax.tools.JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
			DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();

			StandardJavaFileManager stdFileManager = compiler.getStandardFileManager(null, null, null);
			MyJavaFileManager fileManager = new MyJavaFileManager(stdFileManager, packagePrefix);

			JavaFileObject file = new JavaSourceFromString(fullClassName, prog);

			Iterable<? extends JavaFileObject> compilationUnits1 = Arrays.asList(file);
			CompilationTask task = compiler.getTask(new DevNullWriter(), fileManager, diagnostics, opcije, null, compilationUnits1);

			logger.debug("[PREVODENJE] Pokrecem prevodenje koda. Opcije su "+(opcije==null ? "null" : opcije.toString()));
			System.out.println("[PREVODENJE] Pokrecem prevodenje koda. Opcije su "+(opcije==null ? "null" : opcije.toString()));
			boolean success = task.call();
			fileManager.releaseDelegateFileManager();

			if(!success) {
				messageLogger.addErrorMessage("Ne mogu prevesti program. Slijede poruke.");
			}

			for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics()) {
				messageLogger.addErrorMessage(
				      //"Code: " + diagnostic.getCode() +
				      "Kind: " + diagnostic.getKind() +
				      //", source: " + diagnostic.getSource() +
				      ", message: " + diagnostic.getMessage(null)
				);
			}

			return success;
		} catch(Exception ex) {
			return false;
		}
	}

	private String buildFlagProgramSource(String packagePrefix, String className, String program) {
		StringBuilder sb = new StringBuilder(1024*2);
		sb.append("package ").append(packagePrefix).append(";\n");
		sb.append("\n");
		sb.append("import hr.fer.zemris.jcms.service.assessments.AbstractFlagProgramEnvironment;\n");
		sb.append("import hr.fer.zemris.jcms.service.assessments.IScoreCalculatorContext;\n");
		sb.append("import hr.fer.zemris.jcms.service.assessments.IScoreCalculatorEngine;\n");
		program = SourceCodeUtils.preprocessProgram(program, sb);
		sb.append("\n");
		sb.append("public class ").append(className).append(" extends AbstractFlagProgramEnvironment {\n");
		sb.append("\n");
		sb.append("	public ").append(className).append("(IScoreCalculatorEngine engine,\n");
		sb.append("			IScoreCalculatorContext context, boolean _overrideSet, boolean _overrideValue) {\n");
		sb.append("		super(engine, context, _overrideSet, _overrideValue);\n");
		sb.append("	}\n");
		sb.append("\n");
		sb.append("	@Override\n");
		sb.append("	public void execute() {\n");
		sb.append(program);
		sb.append("	}\n");
		sb.append("\n");
		sb.append("}\n");
		return sb.toString();
	}

	private String buildAssessmentProgramSource(String packagePrefix, String className, String program) {
		StringBuilder sb = new StringBuilder(1024*2);
		sb.append("package ").append(packagePrefix).append(";\n");
		sb.append("\n");
		sb.append("import hr.fer.zemris.jcms.service.assessments.AbstractScoreProgramEnvironment;\n");
		sb.append("import hr.fer.zemris.jcms.service.assessments.IScoreCalculatorContext;\n");
		sb.append("import hr.fer.zemris.jcms.service.assessments.IScoreCalculatorEngine;\n");
		program = SourceCodeUtils.preprocessProgram(program, sb);
		sb.append("\n");
		sb.append("public class ").append(className).append(" extends AbstractScoreProgramEnvironment {\n");
		sb.append("\n");
		sb.append("	public ").append(className).append("(IScoreCalculatorEngine engine,\n");
		sb.append("			IScoreCalculatorContext context, boolean present, double score, String thisAssessmentShortName) {\n");
		sb.append("		super(engine, context, present, score, thisAssessmentShortName);\n");
		sb.append("	}\n");
		sb.append("\n");
		sb.append("	@Override\n");
		sb.append("	public void execute() {\n");
		sb.append(program);
		sb.append("	}\n");
		sb.append("\n");
		sb.append("}\n");
		return sb.toString();
	}

	@SuppressWarnings("unchecked")
	private Class<?> compileScore(Long id, String className, String program) {
		try {
			String packagePrefix = "studtest2.dynamic";

			String fullClassName = packagePrefix+"."+className;

			javax.tools.JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
			DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();

			StandardJavaFileManager stdFileManager = compiler.getStandardFileManager(null, null, null);
			MyJavaFileManager fileManager = new MyJavaFileManager(stdFileManager, packagePrefix);

			JavaFileObject file = new JavaSourceFromString(fullClassName, buildAssessmentProgramSource(packagePrefix, className, program));

			Iterable<? extends JavaFileObject> compilationUnits1 = Arrays.asList(file);
			CompilationTask task = compiler.getTask(null, fileManager, diagnostics, opcije, null, compilationUnits1);

			logger.debug("[PREVODENJE] Pokrecem prevodenje koda 2. Opcije su "+(opcije==null ? "null" : opcije.toString()));
			System.out.println("[PREVODENJE] Pokrecem prevodenje koda 2. Opcije su "+(opcije==null ? "null" : opcije.toString()));
			boolean success = task.call();
			fileManager.releaseDelegateFileManager();

			if(!success) {
				throw new CompilationClassException("Ne mogu prevesti program za provjeru id="+id+".", diagnostics);
			}

			ClassLoader cl = new MyDynamicClassLoader(fileManager.getMap(),this.getClass().getClassLoader());
			Class<? extends IScoreProgramEnvironment> clazz = (Class<? extends IScoreProgramEnvironment>)cl.loadClass(fullClassName);
			return clazz;
		} catch(CompilationClassException ex) {
			throw ex;
		} catch(Throwable ex) {
			throw new CompilationClassException("Ne mogu prevesti ili stvoriti program za provjeru id="+id+".", ex, null);
		}
		//return DummyScoreProgramEnvironment.class;
	}

	private Class<?> compileFlag(Long id, String className, String program) {
		try {
			String packagePrefix = "studtest2.dynamic";

			String fullClassName = packagePrefix+"."+className;

			javax.tools.JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
			DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();

			StandardJavaFileManager stdFileManager = compiler.getStandardFileManager(null, null, null);
			MyJavaFileManager fileManager = new MyJavaFileManager(stdFileManager, packagePrefix);

			JavaFileObject file = new JavaSourceFromString(fullClassName, buildFlagProgramSource(packagePrefix, className, program));

			Iterable<? extends JavaFileObject> compilationUnits1 = Arrays.asList(file);
			CompilationTask task = compiler.getTask(null, fileManager, diagnostics, opcije, null, compilationUnits1);

			logger.debug("[PREVODENJE] Pokrecem prevodenje koda 3. Opcije su "+(opcije==null ? "null" : opcije.toString()));
			System.out.println("[PREVODENJE] Pokrecem prevodenje koda 3. Opcije su "+(opcije==null ? "null" : opcije.toString()));
			boolean success = task.call();
			fileManager.releaseDelegateFileManager();

			if(!success) {
				throw new CompilationClassException("Ne mogu prevesti program za zastavicu id="+id+".", diagnostics);
			}

			ClassLoader cl = new MyDynamicClassLoader(fileManager.getMap(),this.getClass().getClassLoader());
			Class<?> clazz = (Class<?>)cl.loadClass(fullClassName);
			return clazz;
		} catch(CompilationClassException ex) {
			throw ex;
		} catch(Throwable ex) {
			throw new CompilationClassException("Ne mogu prevesti ili stvoriti program za zastavicu id="+id+".", ex, null);
		}
		//return DummyScoreProgramEnvironment.class;
	}

	private Class<?> compileApplication(Long id, String className, String program) {
		try {
			String packagePrefix = "studtest2.dynamic";

			ApplCodeParser parser = new ApplCodeParser(program);
			List<ApplCodeSection> sections = parser.getSections();
			String source = ApplSourceCodeProducer.getSource(className, packagePrefix, sections);

			String fullClassName = packagePrefix+"."+className;

			javax.tools.JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
			DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();

			StandardJavaFileManager stdFileManager = compiler.getStandardFileManager(null, null, null);
			MyJavaFileManager fileManager = new MyJavaFileManager(stdFileManager, packagePrefix);

			JavaFileObject file = new JavaSourceFromString(fullClassName, source);

			Iterable<? extends JavaFileObject> compilationUnits1 = Arrays.asList(file);
			CompilationTask task = compiler.getTask(null, fileManager, diagnostics, opcije, null, compilationUnits1);

			logger.debug("[PREVODENJE] Pokrecem prevodenje koda 4. Opcije su "+(opcije==null ? "null" : opcije.toString()));
			System.out.println("[PREVODENJE] Pokrecem prevodenje koda 4. Opcije su "+(opcije==null ? "null" : opcije.toString()));
			boolean success = task.call();
			fileManager.releaseDelegateFileManager();

			if(!success) {
				throw new CompilationClassException("Ne mogu prevesti program za prijavu id="+id+".", diagnostics);
			}

			ClassLoader cl = new MyDynamicClassLoader(fileManager.getMap(),this.getClass().getClassLoader());
			Class<?> clazz = (Class<?>)cl.loadClass(fullClassName);
			return clazz;
		} catch(CompilationClassException ex) {
			throw ex;
		} catch(Throwable ex) {
			throw new CompilationClassException("Ne mogu prevesti ili stvoriti program za prijavu id="+id+". Razlog: "+ex.getMessage(), ex, null);
		}
	}

	public Class<?> oneTimeCompile(IMessageLogger messageLogger, String packagePrefix, String className, String program) {
		try {
			String fullClassName = packagePrefix+"."+className;

			javax.tools.JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
			DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();

			StandardJavaFileManager stdFileManager = compiler.getStandardFileManager(null, null, null);
			MyJavaFileManager fileManager = new MyJavaFileManager(stdFileManager, packagePrefix);

			JavaFileObject file = new JavaSourceFromString(fullClassName, program);

			Iterable<? extends JavaFileObject> compilationUnits1 = Arrays.asList(file);
			CompilationTask task = compiler.getTask(null, fileManager, diagnostics, opcije, null, compilationUnits1);

			logger.debug("[PREVODENJE] Pokrecem prevodenje koda 3. Opcije su "+(opcije==null ? "null" : opcije.toString()));
			System.out.println("[PREVODENJE] Pokrecem prevodenje koda 3. Opcije su "+(opcije==null ? "null" : opcije.toString()));
			boolean success = task.call();
			fileManager.releaseDelegateFileManager();

			if(!success) {
				messageLogger.addErrorMessage("Ne mogu prevesti program. Slijede poruke.");
			}

			for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics()) {
				messageLogger.addErrorMessage(
				      //"Code: " + diagnostic.getCode() +
				      "Kind: " + diagnostic.getKind() +
				      //", source: " + diagnostic.getSource() +
				      ", message: " + diagnostic.getMessage(null)
				);
			}

			if(!success) {
				return null;
			}

			ClassLoader cl = new MyDynamicClassLoader(fileManager.getMap(),this.getClass().getClassLoader());
			Class<?> clazz = (Class<?>)cl.loadClass(fullClassName);
			return clazz;
		} catch(CompilationClassException ex) {
			throw ex;
		} catch(Throwable ex) {
			throw new CompilationClassException("Ne mogu prevesti program.", ex, null);
		}
	}

	static class DevNullWriter extends Writer {

		@Override
		public Writer append(char c) throws IOException {
			return this;
		}

		@Override
		public Writer append(CharSequence csq, int start, int end) throws IOException {
			return this;
		}

		@Override
		public Writer append(CharSequence csq) throws IOException {
			return this;
		}

		@Override
		public void close() throws IOException {
		}

		@Override
		public void flush() throws IOException {
		}

		@Override
		public void write(char[] cbuf, int off, int len) throws IOException {
		}

		@Override
		public void write(char[] cbuf) throws IOException {
		}

		@Override
		public void write(int c) throws IOException {
		}

		@Override
		public void write(String str, int off, int len) throws IOException {
		}

		@Override
		public void write(String str) throws IOException {
		}

	}
}


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/compute/v1/compute.proto

namespace Google\Cloud\Compute\V1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * Additional details for quota exceeded error for resource quota.
 *
 * Generated from protobuf message google.cloud.compute.v1.QuotaExceededInfo
 */
class QuotaExceededInfo extends \Google\Protobuf\Internal\Message
{
    /**
     * The map holding related quota dimensions.
     *
     * Generated from protobuf field map<string, string> dimensions = 414334925;
     */
    private $dimensions;
    /**
     * Current effective quota limit. The limit's unit depends on the quota type or metric.
     *
     * Generated from protobuf field optional double limit = 102976443;
     */
    private $limit = null;
    /**
     * The name of the quota limit.
     *
     * Generated from protobuf field optional string limit_name = 398197903;
     */
    private $limit_name = null;
    /**
     * The Compute Engine quota metric name.
     *
     * Generated from protobuf field optional string metric_name = 409881530;
     */
    private $metric_name = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type array|\Google\Protobuf\Internal\MapField $dimensions
     *           The map holding related quota dimensions.
     *     @type float $limit
     *           Current effective quota limit. The limit's unit depends on the quota type or metric.
     *     @type string $limit_name
     *           The name of the quota limit.
     *     @type string $metric_name
     *           The Compute Engine quota metric name.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
        parent::__construct($data);
    }

    /**
     * The map holding related quota dimensions.
     *
     * Generated from protobuf field map<string, string> dimensions = 414334925;
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getDimensions()
    {
        return $this->dimensions;
    }

    /**
     * The map holding related quota dimensions.
     *
     * Generated from protobuf field map<string, string> dimensions = 414334925;
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setDimensions($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
        $this->dimensions = $arr;

        return $this;
    }

    /**
     * Current effective quota limit. The limit's unit depends on the quota type or metric.
     *
     * Generated from protobuf field optional double limit = 102976443;
     * @return float
     */
    public function getLimit()
    {
        return isset($this->limit) ? $this->limit : 0.0;
    }

    public function hasLimit()
    {
        return isset($this->limit);
    }

    public function clearLimit()
    {
        unset($this->limit);
    }

    /**
     * Current effective quota limit. The limit's unit depends on the quota type or metric.
     *
     * Generated from protobuf field optional double limit = 102976443;
     * @param float $var
     * @return $this
     */
    public function setLimit($var)
    {
        GPBUtil::checkDouble($var);
        $this->limit = $var;

        return $this;
    }

    /**
     * The name of the quota limit.
     *
     * Generated from protobuf field optional string limit_name = 398197903;
     * @return string
     */
    public function getLimitName()
    {
        return isset($this->limit_name) ? $this->limit_name : '';
    }

    public function hasLimitName()
    {
        return isset($this->limit_name);
    }

    public function clearLimitName()
    {
        unset($this->limit_name);
    }

    /**
     * The name of the quota limit.
     *
     * Generated from protobuf field optional string limit_name = 398197903;
     * @param string $var
     * @return $this
     */
    public function setLimitName($var)
    {
        GPBUtil::checkString($var, True);
        $this->limit_name = $var;

        return $this;
    }

    /**
     * The Compute Engine quota metric name.
     *
     * Generated from protobuf field optional string metric_name = 409881530;
     * @return string
     */
    public function getMetricName()
    {
        return isset($this->metric_name) ? $this->metric_name : '';
    }

    public function hasMetricName()
    {
        return isset($this->metric_name);
    }

    public function clearMetricName()
    {
        unset($this->metric_name);
    }

    /**
     * The Compute Engine quota metric name.
     *
     * Generated from protobuf field optional string metric_name = 409881530;
     * @param string $var
     * @return $this
     */
    public function setMetricName($var)
    {
        GPBUtil::checkString($var, True);
        $this->metric_name = $var;

        return $this;
    }

}


text:
class FriendlyComMessageEvent : public ComMessageEvent {
 public:
  inline IHTMLEventObj* basic_event() { return basic_event_; }
};

class ATL_NO_VTABLE MockDumbContainer :
    public CComObjectRoot,
    public IOleContainer {
 public:
  DECLARE_NOT_AGGREGATABLE(MockDumbContainer)
  BEGIN_COM_MAP(MockDumbContainer)
    COM_INTERFACE_ENTRY(IParseDisplayName)
    COM_INTERFACE_ENTRY(IOleContainer)
  END_COM_MAP()

  STDMETHOD(ParseDisplayName)(IBindCtx*, LPOLESTR, ULONG*, IMoniker**) {
    NOTREACHED();
    return E_NOTIMPL;
  }
  STDMETHOD(EnumObjects)(DWORD, IEnumUnknown**) {
    NOTREACHED();
    return E_NOTIMPL;
  }
  STDMETHOD(LockContainer)(BOOL) {
    NOTREACHED();
    return E_NOTIMPL;
  }
};

TEST(ComMessageEvent, WithDumbContainer) {
  CComObject<MockDumbContainer>* container_obj = NULL;
  CComObject<MockDumbContainer>::CreateInstance(&container_obj);
  base::win::ScopedComPtr<IOleContainer> container(container_obj);
  EXPECT_FALSE(!container);

  CComObject<FriendlyComMessageEvent>* event_obj = NULL;
  CComObject<FriendlyComMessageEvent>::CreateInstance(&event_obj);
  base::win::ScopedComPtr<IUnknown> event_ref(event_obj);

  bool result = event_obj->Initialize(container, "hi", "http://www.foo.com/",
                                      "message");
  EXPECT_TRUE(result);
  EXPECT_TRUE(!event_obj->basic_event());
}

// Mock object to mimic a "smart" container, e.g. IE, that will
// be able to return an IHTMLDocument2 and 4, and from which you
// can get an IHTMLEventObj implementation.  Doubles as a mock
// IHTMLEventObj implementation.
class ATL_NO_VTABLE MockSmartContainer :
    public CComObjectRoot,
    public IOleContainer,
    public IHTMLDocument2,
    public IHTMLDocument4,
    public IHTMLEventObj {
 public:
  DECLARE_NOT_AGGREGATABLE(MockSmartContainer)
  BEGIN_COM_MAP(MockSmartContainer)
    COM_INTERFACE_ENTRY_IID(IID_IDispatch, IHTMLEventObj)
    COM_INTERFACE_ENTRY(IParseDisplayName)
    COM_INTERFACE_ENTRY(IOleContainer)
    COM_INTERFACE_ENTRY(IHTMLDocument)
    COM_INTERFACE_ENTRY(IHTMLDocument2)
    COM_INTERFACE_ENTRY(IHTMLDocument4)
    COM_INTERFACE_ENTRY(IHTMLEventObj)
  END_COM_MAP()

  static const DISPID kDispId = 424242;
  static const long kResultValue = 42;

  // Only method we actually implement from IHTMLDocument4, to give
  // out the mock IHTMLEventObj.
  STDMETHOD(createEventObject)(VARIANT*, IHTMLEventObj** event_obj) {
    return GetUnknown()->QueryInterface(event_obj);
  }

  // Dummy IDispatch implementation for unit testing, to validate
  // passthrough semantics.
  STDMETHOD(GetIDsOfNames)(REFIID iid, LPOLESTR* names, UINT num_names,
                           LCID lcid, DISPID* disp_ids) {
    DCHECK(num_names == 1);
    disp_ids[0] = kDispId;
    return S_OK;
  }

  STDMETHOD(Invoke)(DISPID id, REFIID iid, LCID lcid, WORD flags,
                    DISPPARAMS* disp_params, VARIANT* var_result,
                    EXCEPINFO* excep_info, UINT* arg_error) {
    var_result->vt = VT_I4;
    var_result->lVal = kResultValue;
    return S_OK;
  }

  // Do-nothing implementation of the rest of the interface methods.
  // To make this less verbose, define a macro here and undefine it
  // at the end of the list.
#define STDMETHODNOTIMP(method, parameters) \
    STDMETHOD(method) parameters { \
      NOTREACHED(); \
      return E_NOTIMPL; \
    }

  // IDispatch
  STDMETHODNOTIMP(GetTypeInfoCount, (UINT*));
  STDMETHODNOTIMP(GetTypeInfo, (UINT, LCID, ITypeInfo**));

  // IParseDisplayName
  STDMETHODNOTIMP(ParseDisplayName, (IBindCtx*, LPOLESTR, ULONG*, IMoniker**));
  // IOleContainer
  STDMETHODNOTIMP(EnumObjects, (DWORD, IEnumUnknown**));
  STDMETHODNOTIMP(LockContainer, (BOOL));
  // IHTMLDocument
  STDMETHODNOTIMP(get_Script, (IDispatch**));
  // IHTMLDocument2
  STDMETHODNOTIMP(get_all, (IHTMLElementCollection**));
  STDMETHODNOTIMP(get_body, (IHTMLElement**));
  STDMETHODNOTIMP(get_activeElement, (IHTMLElement**));
  STDMETHODNOTIMP(get_images, (IHTMLElementCollection**));
  STDMETHODNOTIMP(get_applets, (IHTMLElementCollection**));
  STDMETHODNOTIMP(get_links, (IHTMLElementCollection**));
  STDMETHODNOTIMP(get_forms, (IHTMLElementCollection**));
  STDMETHODNOTIMP(get_anchors, (IHTMLElementCollection**));
  STDMETHODNOTIMP(put_title, (BSTR));
  STDMETHODNOTIMP(get_title, (BSTR*));
  STDMETHODNOTIMP(get_scripts, (IHTMLElementCollection**));
  STDMETHODNOTIMP(put_designMode, (BSTR));
  STDMETHODNOTIMP(get_designMode, (BSTR*));
  STDMETHODNOTIMP(get_selection, (IHTMLSelectionObject**));
  STDMETHODNOTIMP(get_readyState, (BSTR*));
  STDMETHODNOTIMP(get_frames, (IHTMLFramesCollection2**));
  STDMETHODNOTIMP(get_embeds, (IHTMLElementCollection**));
  STDMETHODNOTIMP(get_plugins, (IHTMLElementCollection**));
  STDMETHODNOTIMP(put_alinkColor, (VARIANT));
  STDMETHODNOTIMP(get_alinkColor, (VARIANT*));
  STDMETHODNOTIMP(put_bgColor, (VARIANT));
  STDMETHODNOTIMP(get_bgColor, (VARIANT*));
  STDMETHODNOTIMP(put_fgColor, (VARIANT));
  STDMETHODNOTIMP(get_fgColor, (VARIANT*));
  STDMETHODNOTIMP(put_linkColor, (VARIANT));
  STDMETHODNOTIMP(get_linkColor, (VARIANT*));
  STDMETHODNOTIMP(put_vlinkColor, (VARIANT));
  STDMETHODNOTIMP(get_vlinkColor, (VARIANT*));
  STDMETHODNOTIMP(get_referrer, (BSTR*));
  STDMETHODNOTIMP(get_location, (IHTMLLocation**));
  STDMETHODNOTIMP(get_lastModified, (BSTR*));
  STDMETHODNOTIMP(put_URL, (BSTR));
  STDMETHODNOTIMP(get_URL, (BSTR*));
  STDMETHODNOTIMP(put_domain, (BSTR));
  STDMETHODNOTIMP(get_domain, (BSTR*));
  STDMETHODNOTIMP(put_cookie, (BSTR));
  STDMETHODNOTIMP(get_cookie, (BSTR*));
  STDMETHODNOTIMP(put_expando, (VARIANT_BOOL));
  STDMETHODNOTIMP(get_expando, (VARIANT_BOOL*));
  STDMETHODNOTIMP(put_charset, (BSTR));
  STDMETHODNOTIMP(get_charset, (BSTR*));
  STDMETHODNOTIMP(put_defaultCharset, (BSTR));
  STDMETHODNOTIMP(get_defaultCharset, (BSTR*));
  STDMETHODNOTIMP(get_mimeType, (BSTR*));
  STDMETHODNOTIMP(get_fileSize, (BSTR*));
  STDMETHODNOTIMP(get_fileCreatedDate, (BSTR*));
  STDMETHODNOTIMP(get_fileModifiedDate, (BSTR*));
  STDMETHODNOTIMP(get_fileUpdatedDate, (BSTR*));
  STDMETHODNOTIMP(get_security, (BSTR*));
  STDMETHODNOTIMP(get_protocol, (BSTR*));
  STDMETHODNOTIMP(get_nameProp, (BSTR*));
  STDMETHODNOTIMP(write, (SAFEARRAY*));
  STDMETHODNOTIMP(writeln, (SAFEARRAY*));
  STDMETHODNOTIMP(open, (BSTR, VARIANT, VARIANT, VARIANT, IDispatch**));
  STDMETHODNOTIMP(close, ());
  STDMETHODNOTIMP(clear, ());
  STDMETHODNOTIMP(queryCommandSupported, (BSTR, VARIANT_BOOL*));
  STDMETHODNOTIMP(queryCommandEnabled, (BSTR, VARIANT_BOOL*));
  STDMETHODNOTIMP(queryCommandState, (BSTR, VARIANT_BOOL*));
  STDMETHODNOTIMP(queryCommandIndeterm, (BSTR, VARIANT_BOOL*));
  STDMETHODNOTIMP(queryCommandText, (BSTR, BSTR*));
  STDMETHODNOTIMP(queryCommandValue, (BSTR, VARIANT*));
  STDMETHODNOTIMP(execCommand, (BSTR, VARIANT_BOOL, VARIANT, VARIANT_BOOL*));
  STDMETHODNOTIMP(execCommandShowHelp, (BSTR, VARIANT_BOOL*));
  STDMETHODNOTIMP(createElement, (BSTR, IHTMLElement**));
  STDMETHODNOTIMP(put_onhelp, (VARIANT));
  STDMETHODNOTIMP(get_onhelp, (VARIANT*));
  STDMETHODNOTIMP(put_onclick, (VARIANT));
  STDMETHODNOTIMP(get_onclick, (VARIANT*));
  STDMETHODNOTIMP(put_ondblclick, (VARIANT));
  STDMETHODNOTIMP(get_ondblclick, (VARIANT*));
  STDMETHODNOTIMP(put_onkeyup, (VARIANT));
  STDMETHODNOTIMP(get_onkeyup, (VARIANT*));
  STDMETHODNOTIMP(put_onkeydown, (VARIANT));
  STDMETHODNOTIMP(get_onkeydown, (VARIANT*));
  STDMETHODNOTIMP(put_onkeypress, (VARIANT));
  STDMETHODNOTIMP(get_onkeypress, (VARIANT*));
  STDMETHODNOTIMP(put_onmouseup, (VARIANT));
  STDMETHODNOTIMP(get_onmouseup, (VARIANT*));
  STDMETHODNOTIMP(put_onmousedown, (VARIANT));
  STDMETHODNOTIMP(get_onmousedown, (VARIANT*));
  STDMETHODNOTIMP(put_onmousemove, (VARIANT));
  STDMETHODNOTIMP(get_onmousemove, (VARIANT*));
  STDMETHODNOTIMP(put_onmouseout, (VARIANT));
  STDMETHODNOTIMP(get_onmouseout, (VARIANT*));
  STDMETHODNOTIMP(put_onmouseover, (VARIANT));
  STDMETHODNOTIMP(get_onmouseover, (VARIANT*));
  STDMETHODNOTIMP(put_onreadystatechange, (VARIANT));
  STDMETHODNOTIMP(get_onreadystatechange, (VARIANT*));
  STDMETHODNOTIMP(put_onafterupdate, (VARIANT));
  STDMETHODNOTIMP(get_onafterupdate, (VARIANT*));
  STDMETHODNOTIMP(put_onrowexit, (VARIANT));
  STDMETHODNOTIMP(get_onrowexit, (VARIANT*));
  STDMETHODNOTIMP(put_onrowenter, (VARIANT));
  STDMETHODNOTIMP(get_onrowenter, (VARIANT*));
  STDMETHODNOTIMP(put_ondragstart, (VARIANT));
  STDMETHODNOTIMP(get_ondragstart, (VARIANT*));
  STDMETHODNOTIMP(put_onselectstart, (VARIANT));
  STDMETHODNOTIMP(get_onselectstart, (VARIANT*));
  STDMETHODNOTIMP(elementFromPoint, (long, long, IHTMLElement**));
  STDMETHODNOTIMP(get_parentWindow, (IHTMLWindow2**));
  STDMETHODNOTIMP(get_styleSheets, (IHTMLStyleSheetsCollection**));
  STDMETHODNOTIMP(put_onbeforeupdate, (VARIANT));
  STDMETHODNOTIMP(get_onbeforeupdate, (VARIANT*));
  STDMETHODNOTIMP(put_onerrorupdate, (VARIANT));
  STDMETHODNOTIMP(get_onerrorupdate, (VARIANT*));
  STDMETHODNOTIMP(toString, (BSTR*));
  STDMETHODNOTIMP(createStyleSheet, (BSTR, long, IHTMLStyleSheet**));
  // IHTMLDocument4
  STDMETHODNOTIMP(focus, ());
  STDMETHODNOTIMP(hasFocus, (VARIANT_BOOL*));
  STDMETHODNOTIMP(put_onselectionchange, (VARIANT));
  STDMETHODNOTIMP(get_onselectionchange, (VARIANT*));
  STDMETHODNOTIMP(get_namespaces, (IDispatch**));
  STDMETHODNOTIMP(createDocumentFromUrl, (BSTR, BSTR, IHTMLDocument2**));
  STDMETHODNOTIMP(put_media, (BSTR));
  STDMETHODNOTIMP(get_media, (BSTR*));
  STDMETHODNOTIMP(fireEvent, (BSTR, VARIANT*, VARIANT_BOOL*));
  STDMETHODNOTIMP(createRenderStyle, (BSTR, IHTMLRenderStyle**));
  STDMETHODNOTIMP(put_oncontrolselect, (VARIANT));
  STDMETHODNOTIMP(get_oncontrolselect, (VARIANT*));
  STDMETHODNOTIMP(get_URLUnencoded, (BSTR*));
  // IHTMLEventObj
  STDMETHODNOTIMP(get_srcElement, (IHTMLElement**))
  STDMETHODNOTIMP(get_altKey, (VARIANT_BOOL*));
  STDMETHODNOTIMP(get_ctrlKey, (VARIANT_BOOL*));
  STDMETHODNOTIMP(get_shiftKey, (VARIANT_BOOL*));
  STDMETHODNOTIMP(put_returnValue, (VARIANT));
  STDMETHODNOTIMP(get_returnValue, (VARIANT*));
  STDMETHODNOTIMP(put_cancelBubble, (VARIANT_BOOL));
  STDMETHODNOTIMP(get_cancelBubble, (VARIANT_BOOL*));
  STDMETHODNOTIMP(get_fromElement, (IHTMLElement**));
  STDMETHODNOTIMP(get_toElement, (IHTMLElement**));
  STDMETHODNOTIMP(put_keyCode, (long));
  STDMETHODNOTIMP(get_keyCode, (long*));
  STDMETHODNOTIMP(get_button, (long*));
  STDMETHODNOTIMP(get_type, (BSTR*));
  STDMETHODNOTIMP(get_qualifier, (BSTR*));
  STDMETHODNOTIMP(get_reason, (long*));
  STDMETHODNOTIMP(get_x, (long*));
  STDMETHODNOTIMP(get_y, (long*));
  STDMETHODNOTIMP(get_clientX, (long*));
  STDMETHODNOTIMP(get_clientY, (long*));
  STDMETHODNOTIMP(get_offsetX, (long*));
  STDMETHODNOTIMP(get_offsetY, (long*));
  STDMETHODNOTIMP(get_screenX, (long*));
  STDMETHODNOTIMP(get_screenY, (long*));
  STDMETHODNOTIMP(get_srcFilter, (IDispatch**));
#undef STDMETHODNOTIMP
};

TEST(ComMessageEvent, WithSmartContainer) {
  CComObject<MockSmartContainer>* container_obj = NULL;
  CComObject<MockSmartContainer>::CreateInstance(&container_obj);
  base::win::ScopedComPtr<IOleContainer> container(container_obj);
  EXPECT_FALSE(!container);

  CComObject<FriendlyComMessageEvent>* event_obj = NULL;
  CComObject<FriendlyComMessageEvent>::CreateInstance(&event_obj);
  base::win::ScopedComPtr<IUnknown> event_ref(event_obj);

  bool succeeded = event_obj->Initialize(container, "hi",
                                         "http://www.foo.com/", "message");
  EXPECT_TRUE(succeeded);
  EXPECT_FALSE(!event_obj->basic_event());

  // Name handled natively by CF's ComMessageEvent.
  DISPID dispid = -1;
  LPOLESTR name = L"data";
  HRESULT hr = event_obj->GetIDsOfNames(IID_IDispatch, &name, 1,
                                        LOCALE_USER_DEFAULT, &dispid);
  EXPECT_HRESULT_SUCCEEDED(hr);
  EXPECT_EQ(dispid, ComMessageEvent::DISPID_MESSAGE_EVENT_DATA);

  // Name not handled by CF's ComMessageEvent.
  dispid = -1;
  name = L"nothandledatallbyanyone";
  hr = event_obj->GetIDsOfNames(IID_IDispatch, &name, 1,
                                LOCALE_USER_DEFAULT, &dispid);
  EXPECT_HRESULT_SUCCEEDED(hr);
  EXPECT_EQ(dispid, MockSmartContainer::kDispId);

  // Invoke function handled by ComMessageEvent.
  CComDispatchDriver dispatcher(event_obj);
  CComVariant result;
  hr = dispatcher.GetProperty(ComMessageEvent::DISPID_MESSAGE_EVENT_DATA,
                              &result);
  EXPECT_HRESULT_SUCCEEDED(hr);
  EXPECT_EQ(result.vt, VT_BSTR);
  EXPECT_EQ(wcscmp(result.bstrVal, L"hi"), 0);

  // And now check passthrough.
  result.Clear();
  hr = dispatcher.GetProperty(MockSmartContainer::kDispId, &result);
  EXPECT_HRESULT_SUCCEEDED(hr);
  EXPECT_EQ(result.vt, VT_I4);
  EXPECT_EQ(result.lVal, MockSmartContainer::kResultValue);
}


text:
@implementation UIImageView (MALazykit)

+ (instancetype)imageViewWithImage:(UIImage *)image {
    return [[self alloc] initWithImage:image];
}

+ (instancetype)imageViewWithImageNamed:(NSString *)imageName {
    return [self imageViewWithImage:[UIImage imageNamed:imageName]];
}

@end