text:
package org.apache.camel.util;

import org.junit.jupiter.api.Test;

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

public class UnsafeCharactersEncoderTest {

    private void testEncoding(String before, String after) {
        String result = UnsafeUriCharactersEncoder.encode(before);
        assertEquals(after, result, "Get the wrong encoding result");
    }

    @Test
    public void testQnameEncoder() {
        String afterEncoding = "%7Bhttp://www.example.com/test%7DServiceName";
        String beforeEncoding = "{http://www.example.com/test}ServiceName";
        testEncoding(beforeEncoding, afterEncoding);
    }

    @Test
    public void testNoEncoding() {
        String noEncoding = "http://www.example.com";
        testEncoding(noEncoding, noEncoding);
    }

    @Test
    public void testUnicodes() {
        String noEncoding = "http://test.com/\uFD04";
        testEncoding(noEncoding, noEncoding);
    }

    @Test
    public void testPercentEncode() {
        String beforeEncoding = "sql:select * from foo where bar like '%A'";
        String afterEncoding = "sql:select%20*%20from%20foo%20where%20bar%20like%20'%25A'";
        testEncoding(beforeEncoding, afterEncoding);
    }

    @Test
    public void testPercentEncodeAlready() {
        String beforeEncoding = "sql:select * from foo where bar like '%25A'";
        String afterEncoding = "sql:select%20*%20from%20foo%20where%20bar%20like%20'%25A'";
        testEncoding(beforeEncoding, afterEncoding);
    }

    @Test
    public void testPercentEncodeDanishChar() {
        String beforeEncoding = "http://localhost:{{port}}/myapp/mytest?columns=claus,s\u00F8ren&username=apiuser";
        String afterEncoding = "http://localhost:%7B%7Bport%7D%7D/myapp/mytest?columns=claus,s\u00F8ren&username=apiuser";
        testEncoding(beforeEncoding, afterEncoding);
    }

    @Test
    public void testPercentEncodeDanishCharEncoded() {
        String beforeEncoding = "http://localhost:{{port}}/myapp/mytest?columns=claus,s%C3%B8ren&username=apiuser";
        String afterEncoding = "http://localhost:%7B%7Bport%7D%7D/myapp/mytest?columns=claus,s%C3%B8ren&username=apiuser";
        testEncoding(beforeEncoding, afterEncoding);
    }

    @Test
    public void testAlreadyEncoded() {
        String beforeEncoding = "http://www.example.com?query=foo%20bar";
        String afterEncoding = "http://www.example.com?query=foo%20bar";
        testEncoding(beforeEncoding, afterEncoding);
    }

    @Test
    public void testPercentEncodedLast() {
        String beforeEncoding = "http://www.example.com?like=foo%25";
        String afterEncoding = "http://www.example.com?like=foo%25";
        testEncoding(beforeEncoding, afterEncoding);
    }

    @Test
    public void testPlusInQuery() {
        String beforeEncoding = "http://www.example.com?param1=%2B447777111222";
        String afterEncoding = "http://www.example.com?param1=%2B447777111222";
        testEncoding(beforeEncoding, afterEncoding);

        beforeEncoding = "http://www.example.com?param1=+447777111222";
        afterEncoding = "http://www.example.com?param1=+447777111222";
        testEncoding(beforeEncoding, afterEncoding);
    }

    @Test
    public void testPasswordEncodingInRawMode() {
        String password = "RAW(%j#7%c6i)";
        String result = UnsafeUriCharactersEncoder.encode(password, true);
        // remove RAW
        result = result.substring(4);
        result = result.substring(0, result.length() - 1);
        String expected = "%25j%237%25c6i";

        assertEquals(result, expected, "Get the wrong encoding result");
    }

}


text:
namespace Nancy.Diagnostics
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Threading;

    using Bootstrapper;
    using Cookies;
    using Cryptography;
    using Helpers;
    using ModelBinding;

    using Nancy.Routing.Constraints;
    using Nancy.Routing.Trie;

    using Responses;
    using Responses.Negotiation;
    using Routing;
    using Nancy.Culture;

    public static class DiagnosticsHook
    {
        private static readonly CancellationToken CancellationToken = new CancellationToken();

        private const string PipelineKey = "__Diagnostics";

        internal const string ItemsKey = "DIAGS_REQUEST";

        public static void Enable(
            DiagnosticsConfiguration diagnosticsConfiguration,
            IPipelines pipelines,
            IEnumerable<IDiagnosticsProvider> providers,
            IRootPathProvider rootPathProvider,
            IRequestTracing requestTracing,
            NancyInternalConfiguration configuration,
            IModelBinderLocator modelBinderLocator,
            IEnumerable<IResponseProcessor> responseProcessors,
            IEnumerable<IRouteSegmentConstraint> routeSegmentConstraints,
            ICultureService cultureService)
        {
            var diagnosticsModuleCatalog = new DiagnosticsModuleCatalog(providers, rootPathProvider, requestTracing, configuration, diagnosticsConfiguration);

            var diagnosticsRouteCache = new RouteCache(diagnosticsModuleCatalog, new DefaultNancyContextFactory(cultureService), new DefaultRouteSegmentExtractor(), new DefaultRouteDescriptionProvider(), cultureService);

            var diagnosticsRouteResolver = new DefaultRouteResolver(
                diagnosticsModuleCatalog,
                new DiagnosticsModuleBuilder(rootPathProvider, modelBinderLocator),
                diagnosticsRouteCache,
                new RouteResolverTrie(new TrieNodeFactory(routeSegmentConstraints)));

            var serializer = new DefaultObjectSerializer();

            pipelines.BeforeRequest.AddItemToStartOfPipeline(
                new PipelineItem<Func<NancyContext, Response>>(
                    PipelineKey,
                    ctx =>
                    {
                        if (!ctx.ControlPanelEnabled)
                        {
                            return null;
                        }

                        if (!ctx.Request.Path.StartsWith(diagnosticsConfiguration.Path, StringComparison.OrdinalIgnoreCase))
                        {
                            return null;
                        }

                        ctx.Items[ItemsKey] = true;

                        var resourcePrefix =
                            string.Concat(diagnosticsConfiguration.Path, "/Resources/");

                        if (ctx.Request.Path.StartsWith(resourcePrefix, StringComparison.OrdinalIgnoreCase))
                        {
                            var resourceNamespace = "Nancy.Diagnostics.Resources";

                            var path = Path.GetDirectoryName(ctx.Request.Url.Path.Replace(resourcePrefix, string.Empty)) ?? string.Empty;
                            if (!string.IsNullOrEmpty(path))
                            {
                                resourceNamespace += string.Format(".{0}", path.Replace(Path.DirectorySeparatorChar, '.'));
                            }

                            return new EmbeddedFileResponse(
                                typeof(DiagnosticsHook).Assembly,
                                resourceNamespace,
                                Path.GetFileName(ctx.Request.Url.Path));
                        }

                        RewriteDiagnosticsUrl(diagnosticsConfiguration, ctx);

                        return diagnosticsConfiguration.Valid
                                   ? ExecuteDiagnostics(ctx, diagnosticsRouteResolver, diagnosticsConfiguration, serializer)
                                   : GetDiagnosticsHelpView(ctx);
                    }));
        }

        public static void Disable(IPipelines pipelines)
        {
            pipelines.BeforeRequest.RemoveByName(PipelineKey);
        }

        private static Response GetDiagnosticsHelpView(NancyContext ctx)
        {
            return (StaticConfiguration.IsRunningDebug)
                       ? new DiagnosticsViewRenderer(ctx)["help"]
                       : HttpStatusCode.NotFound;
        }

        private static Response GetDiagnosticsLoginView(NancyContext ctx)
        {
            var renderer = new DiagnosticsViewRenderer(ctx);

            return renderer["login"];
        }

        private static Response ExecuteDiagnostics(NancyContext ctx, IRouteResolver routeResolver, DiagnosticsConfiguration diagnosticsConfiguration, DefaultObjectSerializer serializer)
        {
            var session = GetSession(ctx, diagnosticsConfiguration, serializer);

            if (session == null)
            {
                var view = GetDiagnosticsLoginView(ctx);

                view.AddCookie(
                    new NancyCookie(diagnosticsConfiguration.CookieName, String.Empty, true) { Expires = DateTime.Now.AddDays(-1) });

                return view;
            }

            var resolveResult = routeResolver.Resolve(ctx);

            ctx.Parameters = resolveResult.Parameters;
            ExecuteRoutePreReq(ctx, CancellationToken, resolveResult.Before);

            if (ctx.Response == null)
            {
                // Don't care about async here, so just get the result
                var task = resolveResult.Route.Invoke(resolveResult.Parameters, CancellationToken);
                task.Wait();
                ctx.Response = task.Result;
            }

            if (ctx.Request.Method.ToUpperInvariant() == "HEAD")
            {
                ctx.Response = new HeadResponse(ctx.Response);
            }

            if (resolveResult.After != null)
            {
                resolveResult.After.Invoke(ctx, CancellationToken);
            }

            AddUpdateSessionCookie(session, ctx, diagnosticsConfiguration, serializer);

            return ctx.Response;
        }

        private static void AddUpdateSessionCookie(DiagnosticsSession session, NancyContext context, DiagnosticsConfiguration diagnosticsConfiguration, DefaultObjectSerializer serializer)
        {
            if (context.Response == null)
            {
                return;
            }

            session.Expiry = DateTime.Now.AddMinutes(diagnosticsConfiguration.SlidingTimeout);
            var serializedSession = serializer.Serialize(session);

            var encryptedSession = diagnosticsConfiguration.CryptographyConfiguration.EncryptionProvider.Encrypt(serializedSession);
            var hmacBytes = diagnosticsConfiguration.CryptographyConfiguration.HmacProvider.GenerateHmac(encryptedSession);
            var hmacString = Convert.ToBase64String(hmacBytes);

            var cookie = new NancyCookie(diagnosticsConfiguration.CookieName, String.Format("{1}{0}", encryptedSession, hmacString), true);

            context.Response.AddCookie(cookie);
        }

        private static DiagnosticsSession GetSession(NancyContext context, DiagnosticsConfiguration diagnosticsConfiguration, DefaultObjectSerializer serializer)
        {
            if (context.Request == null)
            {
                return null;
            }

            if (IsLoginRequest(context, diagnosticsConfiguration))
            {
                return ProcessLogin(context, diagnosticsConfiguration, serializer);
            }

            if (!context.Request.Cookies.ContainsKey(diagnosticsConfiguration.CookieName))
            {
                return null;
            }

            var encryptedValue = HttpUtility.UrlDecode(context.Request.Cookies[diagnosticsConfiguration.CookieName]);
            var hmacStringLength = Base64Helpers.GetBase64Length(diagnosticsConfiguration.CryptographyConfiguration.HmacProvider.HmacLength);
            var encryptedSession = encryptedValue.Substring(hmacStringLength);
            var hmacString = encryptedValue.Substring(0, hmacStringLength);

            var hmacBytes = Convert.FromBase64String(hmacString);
            var newHmac = diagnosticsConfiguration.CryptographyConfiguration.HmacProvider.GenerateHmac(encryptedSession);
            var hmacValid = HmacComparer.Compare(newHmac, hmacBytes, diagnosticsConfiguration.CryptographyConfiguration.HmacProvider.HmacLength);

            if (!hmacValid)
            {
                return null;
            }

            var decryptedValue = diagnosticsConfiguration.CryptographyConfiguration.EncryptionProvider.Decrypt(encryptedSession);
            var session = serializer.Deserialize(decryptedValue) as DiagnosticsSession;

            if (session == null || session.Expiry < DateTime.Now || !SessionPasswordValid(session, diagnosticsConfiguration.Password))
            {
                return null;
            }

            return session;
        }

        private static bool SessionPasswordValid(DiagnosticsSession session, string realPassword)
        {
            var newHash = DiagnosticsSession.GenerateSaltedHash(realPassword, session.Salt);

            return (newHash.Length == session.Hash.Length && newHash.SequenceEqual(session.Hash));
        }

        private static DiagnosticsSession ProcessLogin(NancyContext context, DiagnosticsConfiguration diagnosticsConfiguration, DefaultObjectSerializer serializer)
        {
            string password = context.Request.Form.Password;

            if (!string.Equals(password, diagnosticsConfiguration.Password, StringComparison.Ordinal))
            {
                return null;
            }

            var salt = DiagnosticsSession.GenerateRandomSalt();
            var hash = DiagnosticsSession.GenerateSaltedHash(password, salt);
            var session = new DiagnosticsSession
            {
                Hash = hash,
                Salt = salt,
                Expiry = DateTime.Now.AddMinutes(diagnosticsConfiguration.SlidingTimeout)
            };

            return session;
        }

        private static bool IsLoginRequest(NancyContext context, DiagnosticsConfiguration diagnosticsConfiguration)
        {
            return context.Request.Method == "POST" &&
                context.Request.Url.BasePath.TrimEnd(new[] { '/' }).EndsWith(diagnosticsConfiguration.Path) &&
                context.Request.Url.Path == "/";
        }

        private static void ExecuteRoutePreReq(NancyContext context, CancellationToken cancellationToken, BeforePipeline resolveResultPreReq)
        {
            if (resolveResultPreReq == null)
            {
                return;
            }

            var resolveResultPreReqResponse = resolveResultPreReq.Invoke(context, cancellationToken).Result;

            if (resolveResultPreReqResponse != null)
            {
                context.Response = resolveResultPreReqResponse;
            }
        }

        private static void RewriteDiagnosticsUrl(DiagnosticsConfiguration diagnosticsConfiguration, NancyContext ctx)
        {
            ctx.Request.Url.BasePath =
                string.Concat(ctx.Request.Url.BasePath, diagnosticsConfiguration.Path);

            ctx.Request.Url.Path =
                ctx.Request.Url.Path.Substring(diagnosticsConfiguration.Path.Length);

            if (ctx.Request.Url.Path.Length.Equals(0))
            {
                ctx.Request.Url.Path = "/";
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.springframework.social.facebook.api.impl.json;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
abstract class DeviceMixin extends FacebookObjectMixin {

	@JsonProperty("hardware")
	String hardware;

	@JsonProperty("os")
	String os;

}


text:
package com.alexeyburyanov.main;

import org.hibernate.HibernateException;
import org.hibernate.SessionFactory;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;

public class HibernateSessionFactory {

    private static SessionFactory _sessionFactory = buildSessionFactory();

    private static SessionFactory buildSessionFactory() {
        try {
            // SessionFactory устанавливается один раз для приложения!
            final StandardServiceRegistry registry = new StandardServiceRegistryBuilder()
                    .configure() // проводит настройки из hibernate.cfg.xml
                    .build();

            _sessionFactory = new MetadataSources(registry).buildMetadata().buildSessionFactory();
        } catch (HibernateException e) {
            e.printStackTrace();
        } // try-catch
        return _sessionFactory;
    } // buildSessionFactory

    public static SessionFactory getSessionFactory() { return _sessionFactory; }
} // HibernateSessionFactory


text:
module.exports = exports = function(app) {
  require('./news_controller')(app);
};


text:
package com.bt.pi.app.common.net.utils;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

public class IpAddressUtilsTest {
    @Test
    public void testRoundTrip() {
        // setup
        String[] ips = new String[] { "11.23.41.23/16", "10.19.1.200/24", "10.19.1.245/8", "123.123.123.123", "0.0.0.0", "12.34.56.78", "255.255.255.255" };
        // act
        for (String ip : ips) {
            long l = IpAddressUtils.ipToLong(ip);
            String result = IpAddressUtils.longToIp(l);
            // assert
            assertEquals(ip, result);
        }
    }

    @Test(expected = IllegalArgumentException.class)
    public void testIpToLongTooBig() {
        // setup
        String ip = "255.256.255.255";

        // act
        IpAddressUtils.ipToLong(ip);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testIpToLongBadFormat() {
        // setup
        String ip = "255.255.aa.255";

        // act
        IpAddressUtils.ipToLong(ip);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testIpToLongBadSeparator() {
        // setup
        String ip = "255.255,255.255";

        // act
        IpAddressUtils.ipToLong(ip);
    }

    @Test
    public void testIncrement() {
        // setup
        String ip = "123.123.123.123";

        // act
        String result = IpAddressUtils.increment(ip, 2);

        // assert
        assertEquals("123.123.123.125", result);
    }

    @Test
    public void testNetmaskIpToSlashnet() {
        // setup
        String netmask = "255.0.0.0";

        // act
        int slashnet = IpAddressUtils.netmaskToSlashnet(netmask);

        // assert
        assertEquals(8, slashnet);
    }

    @Test
    public void testNetmaskLongToSlashnet() {
        // setup
        long netmask = IpAddressUtils.ipToLong("255.0.0.0");

        // act
        int slashnet = IpAddressUtils.netmaskToSlashnet(netmask);

        // assert
        assertEquals(8, slashnet);
    }

    @Test
    public void testSlashnetFromAddrs() {
        // setup
        int addrs = 256;

        // act
        int slashnet = IpAddressUtils.slashnetFromAddrs(addrs);

        // assert
        assertEquals(24, slashnet);
    }

    @Test
    public void testNetmaskLongToNetSize() {
        // setup
        long netmask = IpAddressUtils.ipToLong("255.255.255.240");

        // act
        long netSize = IpAddressUtils.netmaskToNetSize(netmask);

        // assert
        assertEquals(16, netSize);
    }

    @Test
    public void testNetSizeToNetmaskLong() {
        // act
        long netmask = IpAddressUtils.netSizeToNetmask(256);

        // assert
        assertEquals("255.255.255.0", IpAddressUtils.longToIp(netmask));
    }

    @Test
    public void testSlashnetSize() {
        // act
        int res = IpAddressUtils.addrsInSlashnet(28);

        // assert
        assertEquals(16, res);
    }

    @Test
    public void testSlashnetSizeAgain() {
        // act
        int res = IpAddressUtils.addrsInSlashnet(24);

        // assert
        assertEquals(256, res);
    }

    @Test
    public void testIsIpAddressWithBadAddresses() {
        // act & assert
        assertFalse(IpAddressUtils.isIpAddress("1.321.2.2"));
        assertFalse(IpAddressUtils.isIpAddress("1.2.3"));
        assertFalse(IpAddressUtils.isIpAddress("1.-2.2.4"));
        assertFalse(IpAddressUtils.isIpAddress("1.bob.2.4"));
        assertFalse(IpAddressUtils.isIpAddress("1.2.3.4/33"));
        assertFalse(IpAddressUtils.isIpAddress("1.2.3.4/-1"));
        assertFalse(IpAddressUtils.isIpAddress("1.2.3.4/aa"));
    }

    @Test
    public void testIsIpAddress() {
        // act & assert
        assertTrue(IpAddressUtils.isIpAddress("1.255.2.2"));
        assertTrue(IpAddressUtils.isIpAddress("1.2.3.4"));
        assertTrue(IpAddressUtils.isIpAddress("1.2.3.4/0"));
        assertTrue(IpAddressUtils.isIpAddress("1.2.3.4/1"));
        assertTrue(IpAddressUtils.isIpAddress("1.2.3.4/32"));
    }

    @Test
    public void shouldRemoveSlashNetFromIpAddress() {
        // act
        String ipAddress = IpAddressUtils.removeSlash32FromIpAddress("10.19.1.1/32");
        String ipAddress2 = IpAddressUtils.removeSlash32FromIpAddress("10.19.1.2");
        String ipAddress3 = IpAddressUtils.removeSlashnetFromIpAddress("10.19.1.4/21");

        // assert
        assertEquals("10.19.1.1", ipAddress);
        assertEquals("10.19.1.2", ipAddress2);
        assertEquals("10.19.1.4", ipAddress3);
    }

    @Test
    public void shouldAddSlashNetToIpAddress() {
        // act
        String ipAddress = IpAddressUtils.addSlash32ToIpAddress("10.19.1.3");
        String ipAddress2 = IpAddressUtils.addSlash32ToIpAddress("10.19.1.4/32");

        // assert
        assertEquals("10.19.1.3/32", ipAddress);
        assertEquals("10.19.1.4/32", ipAddress2);
    }
}


text:
package server

import (
	"fmt"
	"net"
	"strconv"
	"strings"
	"syscall"
	"time"

	log "github.com/sirupsen/logrus"

	"github.com/osrg/gobgp/config"
	"github.com/osrg/gobgp/packet/bgp"
	"github.com/osrg/gobgp/table"
	"github.com/osrg/gobgp/zebra"
)

type pathList []*table.Path

type nexthopTrackingManager struct {
	dead              chan struct{}
	nexthopCache      map[string]struct{}
	server            *BgpServer
	delay             int
	isScheduled       bool
	scheduledPathList map[string]pathList
	trigger           chan struct{}
	pathListCh        chan pathList
}

func newNexthopTrackingManager(server *BgpServer, delay int) *nexthopTrackingManager {
	return &nexthopTrackingManager{
		dead:              make(chan struct{}),
		nexthopCache:      make(map[string]struct{}),
		server:            server,
		delay:             delay,
		scheduledPathList: make(map[string]pathList, 0),
		trigger:           make(chan struct{}),
		pathListCh:        make(chan pathList),
	}
}

func (m *nexthopTrackingManager) stop() {
	fmt.Println("nexthopTrackingManager stop is called")
	close(m.pathListCh)
	close(m.trigger)
	close(m.dead)
}

func (m *nexthopTrackingManager) isRegisteredNexthop(nexthop net.IP) bool {
	key := nexthop.String()
	_, ok := m.nexthopCache[key]
	return ok
}

func (m *nexthopTrackingManager) registerNexthop(nexthop net.IP) bool {
	key := nexthop.String()
	if _, ok := m.nexthopCache[key]; ok {
		return false
	}
	m.nexthopCache[key] = struct{}{}
	return true
}

func (m *nexthopTrackingManager) unregisterNexthop(nexthop net.IP) {
	key := nexthop.String()
	delete(m.nexthopCache, key)
}

func (m *nexthopTrackingManager) appendPathList(paths pathList) {
	if len(paths) == 0 {
		return
	}
	path := paths[0]

	m.scheduledPathList[path.GetNexthop().String()] = paths
}

func (m *nexthopTrackingManager) calculateDelay(penalty int) int {
	if penalty <= 950 {
		return m.delay
	}

	delay := 8
	for penalty > 950 {
		delay += 8
		penalty /= 2
	}
	return delay
}

func (m *nexthopTrackingManager) triggerUpdatePathAfter() {
	m.trigger <- struct{}{}
}

func (m *nexthopTrackingManager) loop() {
	t := time.NewTicker(8 * time.Second)
	defer t.Stop()

	penalty := 0

	for {
		select {
		case <-m.dead:
			return

		case <-t.C:
			penalty /= 2

		case paths := <-m.pathListCh:
			penalty += 500
			log.WithFields(log.Fields{
				"Topic": "Zebra",
				"Event": "Nexthop Tracking",
			}).Debugf("penalty 500 charged: penalty: %d", penalty)

			m.appendPathList(paths)

			isScheduled := m.isScheduled
			if isScheduled {
				log.WithFields(log.Fields{
					"Topic": "Zebra",
					"Event": "Nexthop Tracking",
				}).Debug("nexthop tracking event already scheduled")
				continue
			} else {
				m.isScheduled = true
			}

			delay := m.calculateDelay(penalty)
			fmt.Println("triggerUpdatePathAfter is scheduled", delay)
			triggerTimer := time.AfterFunc(time.Duration(delay)*time.Second, m.triggerUpdatePathAfter)
			defer func() {
				fmt.Println("triggerdUpdatePathAfter is cancelled")
				triggerTimer.Stop()
			}()
			//go m.triggerUpdatePathAfter(delay)
			log.WithFields(log.Fields{
				"Topic": "Zebra",
				"Event": "Nexthop Tracking",
			}).Debugf("nexthop tracking event scheduled in %d secs", delay)

		case <-m.trigger:
			paths := make(pathList, 0)
			for _, pList := range m.scheduledPathList {
				for _, p := range pList {
					paths = append(paths, p)
				}
			}
			log.WithFields(log.Fields{
				"Topic": "Zebra",
				"Event": "Nexthop Tracking",
			}).Debugf("update nexthop reachability: %s", paths)

			if err := m.server.UpdatePath("", paths); err != nil {
				log.WithFields(log.Fields{
					"Topic": "Zebra",
					"Event": "Nexthop Tracking",
				}).Error("failed to update nexthop reachability")
			}

			m.isScheduled = false
			m.scheduledPathList = make(map[string]pathList, 0)
		}
	}
}

func (m *nexthopTrackingManager) scheduleUpdate(paths pathList) {
	if len(paths) == 0 {
		return
	}
	m.pathListCh <- paths
}

func (m *nexthopTrackingManager) filterPathToRegister(paths pathList) pathList {
	filteredPaths := make(pathList, 0, len(paths))
	for _, path := range paths {
		if path == nil || path.IsFromExternal() {
			continue
		}
		// NEXTHOP_UNREGISTER message will be sent when GoBGP received
		// NEXTHOP_UPDATE message and there is no path bound for the updated
		// nexthop.
		// Here filters out withdraw paths and paths whose nexthop is:
		// - already invalidated
		// - already registered
		// - unspecified address
		if path.IsWithdraw || path.IsNexthopInvalid {
			continue
		}
		nexthop := path.GetNexthop()
		if m.isRegisteredNexthop(nexthop) || nexthop.IsUnspecified() {
			continue
		}
		filteredPaths = append(filteredPaths, path)
	}
	return filteredPaths
}

func filterOutExternalPath(paths pathList) pathList {
	filteredPaths := make(pathList, 0, len(paths))
	for _, path := range paths {
		if path == nil || path.IsFromExternal() {
			continue
		}
		filteredPaths = append(filteredPaths, path)
	}
	return filteredPaths
}

func newIPRouteBody(dst pathList) (body *zebra.IPRouteBody, isWithdraw bool) {
	paths := filterOutExternalPath(dst)
	if len(paths) == 0 {
		return nil, false
	}
	path := paths[0]

	l := strings.SplitN(path.GetNlri().String(), "/", 2)
	var prefix net.IP
	nexthops := make([]net.IP, 0, len(paths))
	switch path.GetRouteFamily() {
	case bgp.RF_IPv4_UC, bgp.RF_IPv4_VPN:
		if path.GetRouteFamily() == bgp.RF_IPv4_UC {
			prefix = path.GetNlri().(*bgp.IPAddrPrefix).IPAddrPrefixDefault.Prefix.To4()
		} else {
			prefix = path.GetNlri().(*bgp.LabeledVPNIPAddrPrefix).IPAddrPrefixDefault.Prefix.To4()
		}
		for _, p := range paths {
			nhop := p.GetNexthop().To4()
			if nhop != nil {
				nexthops = append(nexthops, nhop)
			}
		}
	case bgp.RF_IPv6_UC, bgp.RF_IPv6_VPN:
		if path.GetRouteFamily() == bgp.RF_IPv6_UC {
			prefix = path.GetNlri().(*bgp.IPv6AddrPrefix).IPAddrPrefixDefault.Prefix.To16()
		} else {
			prefix = path.GetNlri().(*bgp.LabeledVPNIPv6AddrPrefix).IPAddrPrefixDefault.Prefix.To16()
		}
		for _, p := range paths {
			nhop := p.GetNexthop().To16()
			if nhop != nil {
				nexthops = append(nexthops, nhop)
			}
		}
	default:
		return nil, false
	}
	var msgFlags zebra.MESSAGE_FLAG
	if len(nexthops) > 0 {
		msgFlags = zebra.MESSAGE_NEXTHOP
	}
	plen, _ := strconv.ParseUint(l[1], 10, 8)
	med, err := path.GetMed()
	if err == nil {
		msgFlags |= zebra.MESSAGE_METRIC
	}
	var flags zebra.FLAG
	info := path.GetSource()
	if info.AS == info.LocalAS {
		flags = zebra.FLAG_IBGP | zebra.FLAG_INTERNAL
	} else if info.MultihopTtl > 0 {
		flags = zebra.FLAG_INTERNAL
	}
	for _, c := range path.GetCommunities() {
		if c == bgp.COMMUNITY_REGION_BACKUP {
			flags |= zebra.FLAG_REJECT
		}
	}
	var aux []byte
	if path.GetAsPathLen() > 0 {
		aspath := path.GetAsPath()
		if aspath != nil {
			aux, _ = aspath.Serialize()
			if len(aux) > 3 {
				aux = aux[3:]
				msgFlags |= zebra.MESSAGE_ASPATH
			}
		}
	}
	var pathId uint32
	if plen == 0 {
		pathId = path.GetNlri().PathIdentifier()
		if pathId == 0 {
			pathId = path.GetNlri().PathLocalIdentifier()
		}
		if pathId != 0 {
			msgFlags |= zebra.MESSAGE_PATH_ID
		}
	}
	return &zebra.IPRouteBody{
		Type:         zebra.ROUTE_BGP,
		Flags:        flags,
		SAFI:         zebra.SAFI_UNICAST,
		Message:      msgFlags,
		Prefix:       prefix,
		PrefixLength: uint8(plen),
		Nexthops:     nexthops,
		Metric:       med,
		Aux:          aux,
		PathId:       pathId,
	}, path.IsWithdraw
}

func newNexthopRegisterBody(dst pathList, nhtManager *nexthopTrackingManager) (body *zebra.NexthopRegisterBody, isWithdraw bool) {
	if nhtManager == nil {
		return nil, false
	}

	paths := nhtManager.filterPathToRegister(dst)
	if len(paths) == 0 {
		return nil, false
	}
	path := paths[0]

	if path.IsWithdraw == true {
		// NEXTHOP_UNREGISTER message will be sent when GoBGP received
		// NEXTHOP_UPDATE message and there is no path bound for the updated
		// nexthop. So there is nothing to do here.
		return nil, true
	}

	family := path.GetRouteFamily()
	nexthops := make([]*zebra.RegisteredNexthop, 0, len(paths))
	for _, p := range paths {
		nexthop := p.GetNexthop()
		var nh *zebra.RegisteredNexthop
		switch family {
		case bgp.RF_IPv4_UC, bgp.RF_IPv4_VPN:
			nh = &zebra.RegisteredNexthop{
				Family: syscall.AF_INET,
				Prefix: nexthop.To4(),
			}
		case bgp.RF_IPv6_UC, bgp.RF_IPv6_VPN:
			nh = &zebra.RegisteredNexthop{
				Family: syscall.AF_INET6,
				Prefix: nexthop.To16(),
			}
		default:
			continue
		}
		nexthops = append(nexthops, nh)
		nhtManager.registerNexthop(nexthop)
	}

	// If no nexthop needs to be registered or unregistered,
	// skips to send message.
	if len(nexthops) == 0 {
		return nil, path.IsWithdraw
	}

	return &zebra.NexthopRegisterBody{
		Nexthops: nexthops,
	}, path.IsWithdraw
}

func createPathFromIPRouteMessage(m *zebra.Message) *table.Path {
	header := m.Header
	body := m.Body.(*zebra.IPRouteBody)
	family := body.RouteFamily()
	isWithdraw := body.IsWithdraw()

	var nlri bgp.AddrPrefixInterface
	pattr := make([]bgp.PathAttributeInterface, 0)
	origin := bgp.NewPathAttributeOrigin(bgp.BGP_ORIGIN_ATTR_TYPE_IGP)
	pattr = append(pattr, origin)

	log.WithFields(log.Fields{
		"Topic":        "Zebra",
		"RouteType":    body.Type.String(),
		"Flag":         body.Flags.String(),
		"Message":      body.Message,
		"Prefix":       body.Prefix,
		"PrefixLength": body.PrefixLength,
		"Nexthop":      body.Nexthops,
		"IfIndex":      body.Ifindexs,
		"Metric":       body.Metric,
		"Distance":     body.Distance,
		"Mtu":          body.Mtu,
		"api":          header.Command.String(),
	}).Debugf("create path from ip route message.")

	switch family {
	case bgp.RF_IPv4_UC:
		nlri = bgp.NewIPAddrPrefix(body.PrefixLength, body.Prefix.String())
		if len(body.Nexthops) > 0 {
			pattr = append(pattr, bgp.NewPathAttributeNextHop(body.Nexthops[0].String()))
		}
	case bgp.RF_IPv6_UC:
		nlri = bgp.NewIPv6AddrPrefix(body.PrefixLength, body.Prefix.String())
		nexthop := ""
		if len(body.Nexthops) > 0 {
			nexthop = body.Nexthops[0].String()
		}
		pattr = append(pattr, bgp.NewPathAttributeMpReachNLRI(nexthop, []bgp.AddrPrefixInterface{nlri}))
	default:
		log.WithFields(log.Fields{
			"Topic": "Zebra",
		}).Errorf("unsupport address family: %s", family)
		return nil
	}

	med := bgp.NewPathAttributeMultiExitDisc(body.Metric)
	pattr = append(pattr, med)

	path := table.NewPath(nil, nlri, isWithdraw, pattr, time.Now(), false)
	path.SetIsFromExternal(true)
	return path
}

func rfListFromNexthopUpdateBody(body *zebra.NexthopUpdateBody) (rfList []bgp.RouteFamily) {
	switch body.Family {
	case uint16(syscall.AF_INET):
		return []bgp.RouteFamily{bgp.RF_IPv4_UC, bgp.RF_IPv4_VPN}
	case uint16(syscall.AF_INET6):
		return []bgp.RouteFamily{bgp.RF_IPv6_UC, bgp.RF_IPv6_VPN}
	}
	return nil
}

func createPathListFromNexthopUpdateMessage(body *zebra.NexthopUpdateBody, manager *table.TableManager, nhtManager *nexthopTrackingManager) (pathList, *zebra.NexthopRegisterBody, error) {
	isNexthopInvalid := len(body.Nexthops) == 0
	paths := manager.GetPathListWithNexthop(table.GLOBAL_RIB_NAME, rfListFromNexthopUpdateBody(body), body.Prefix)
	pathsLen := len(paths)

	// If there is no path bound for the updated nexthop, send
	// NEXTHOP_UNREGISTER message.
	var nexthopUnregisterBody *zebra.NexthopRegisterBody
	if pathsLen == 0 {
		nexthopUnregisterBody = &zebra.NexthopRegisterBody{
			Nexthops: []*zebra.RegisteredNexthop{{
				Family: body.Family,
				Prefix: body.Prefix,
			}},
		}
		nhtManager.unregisterNexthop(body.Prefix)
	}

	updatedPathList := make(pathList, 0, pathsLen)
	for _, path := range paths {
		newPath := path.Clone(false)
		if isNexthopInvalid {
			// If NEXTHOP_UPDATE message does NOT contain any nexthop,
			// invalidates the nexthop reachability.
			newPath.IsNexthopInvalid = true
		} else {
			// If NEXTHOP_UPDATE message contains valid nexthops,
			// copies Metric into MED.
			newPath.IsNexthopInvalid = false
			newPath.SetMed(int64(body.Metric), true)
		}
		updatedPathList = append(updatedPathList, newPath)
	}

	return updatedPathList, nexthopUnregisterBody, nil
}

type zebraClient struct {
	client     *zebra.Client
	server     *BgpServer
	dead       chan struct{}
	nhtManager *nexthopTrackingManager
	watcher    *Watcher
	config     config.ZebraConfig
}

func (z *zebraClient) stop() {
	close(z.dead)
}

func (z *zebraClient) SendPaths(paths []*table.Path, vrfs map[string]uint16) {
	if z.watcher == nil {
		return
	}
	z.watcher.realCh <- &WatchEventUpdate{
		PathList: paths,
		Vrf:      vrfs,
	}
	z.watcher.realCh <- &WatchEventBestPath{
		PathList: paths,
		Vrf:      vrfs,
	}
}

func (z *zebraClient) reconnect() {
	for {
		time.Sleep(time.Second * 3)
		err := z.server.StartZebraClient(&z.config)
		if err == nil {
			return
		}
	}
}

func NlriPrefix(str string) string {
	nlri := strings.Split(str, ":")
	return nlri[len(nlri)-1]
}

func NlriRD(str string) string {
	nlri := strings.Split(str, ":")
	if len(nlri) > 1 {
		return fmt.Sprintf("%s:%s", nlri[0], nlri[1])
	}
	return ""
}

func (z *zebraClient) loop() {
	w := z.server.Watch([]WatchOption{
		WatchBestPath(true),
		WatchPostUpdate(true),
	}...)
	z.watcher = w
	defer w.Stop()

	if z.nhtManager != nil {
		go z.nhtManager.loop()
		defer z.nhtManager.stop()
	}

	go func() {
		if z.server.globalRib == nil {
			fmt.Println("z.server.globalRib is not ready")
			return
		}

		for _, vrf := range z.server.globalRib.Vrfs {
			tbl, _ := z.server.globalRib.FetchExistingVrf(vrf.Name)
			if tbl != nil {
				for _, dst := range tbl.GetDestinations() {
					paths := dst.GetAllKnownPathList()
					m := make(map[string]uint16)
					for _, p := range paths {
						m[p.GetNlri().String()] = uint16(vrf.Id)
					}
					z.SendPaths(paths, m)
				}
			}
		}
	}()

	for {
		select {
		case <-z.dead:
			return
		case msg := <-z.client.Receive():
			if msg == nil {
				z.server.zclient = nil
				go z.reconnect()
				return
			}
			switch body := msg.Body.(type) {
			case *zebra.IPRouteBody:
				if p := createPathFromIPRouteMessage(msg); p != nil {
					if _, err := z.server.AddPath("", pathList{p}); err != nil {
						log.Errorf("failed to add path from zebra: %s", p)
					}
				}
			case *zebra.NexthopUpdateBody:
				if z.nhtManager == nil {
					continue
				}
				manager := &table.TableManager{
					Tables: make(map[bgp.RouteFamily]*table.Table),
				}
				for _, rf := range rfListFromNexthopUpdateBody(body) {
					rib, _, err := z.server.GetRib("", rf, nil)
					if err != nil {
						log.Errorf("failed to get global rib by family %s", rf.String())
						continue
					}
					manager.Tables[rf] = rib
				}
				if paths, b, err := createPathListFromNexthopUpdateMessage(body, manager, z.nhtManager); err != nil {
					log.Errorf("failed to create updated path list related to nexthop %s", body.Prefix.String())
				} else {
					z.nhtManager.scheduleUpdate(paths)
					if b != nil {
						z.client.SendNexthopRegister(msg.Header.VrfId, b, true)
					}
				}
			}
		case ev := <-w.Event():
			switch msg := ev.(type) {
			case *WatchEventBestPath:
				if table.UseMultiplePaths.Enabled {
					for _, dst := range msg.MultiPathList {
						if body, isWithdraw := newIPRouteBody(dst); body != nil {
							z.client.SendIPRoute(0, body, isWithdraw)
						}
						if body, isWithdraw := newNexthopRegisterBody(dst, z.nhtManager); body != nil {
							z.client.SendNexthopRegister(0, body, isWithdraw)
						}
					}
				} else {
					for _, path := range msg.PathList {
						if NlriPrefix(path.GetNlri().String()) == "0.0.0.0/0" {
							continue
						}
						if path.IsLocal() {
							fmt.Println("Skipping Local Path", path.GetNlri().String())
							continue
						}
						vrfs := []uint16{}
						if msg.Vrf != nil {
							if v, ok := msg.Vrf[path.GetNlri().String()]; ok {
								vrfs = append(vrfs, v)
							}
						}
						if len(vrfs) == 0 {
							vrfs = append(vrfs, 0)
						}
						for _, i := range vrfs {
							if body, isWithdraw := newIPRouteBody(pathList{path}); body != nil {
								z.client.SendIPRoute(i, body, isWithdraw)
							}
							if body, isWithdraw := newNexthopRegisterBody(pathList{path}, z.nhtManager); body != nil {
								z.client.SendNexthopRegister(i, body, isWithdraw)
							}
						}
					}
				}
			case *WatchEventUpdate:
				m := make(map[string]uint16)
				if msg.Vrf != nil {
					m = msg.Vrf
				} else {
					for _, p := range msg.PathList {
						switch p.GetRouteFamily() {
						case bgp.RF_IPv4_VPN, bgp.RF_IPv6_VPN:
							for _, vrf := range z.server.globalRib.Vrfs {
								if vrf.Id != 0 && table.CanImportToVrf(vrf, p) {
									m[p.GetNlri().String()] = uint16(vrf.Id)
								}
							}
						}
					}
				}
				for _, path := range msg.PathList {
					if NlriPrefix(path.GetNlri().String()) != "0.0.0.0/0" {
						continue
					}
					if path.IsLocal() {
						fmt.Println("Skipping Local Path", path.GetNlri().String())
						continue
					}
					vrfs := []uint16{}
					if v, ok := m[path.GetNlri().String()]; ok {
						vrfs = append(vrfs, v)
					}
					if len(vrfs) == 0 {
						for _, vrf := range z.server.globalRib.Vrfs {
							if NlriRD(path.GetNlri().String()) == vrf.Rd.String() {
								vrfs = append(vrfs, uint16(vrf.Id))
							}
						}
					}
					if len(vrfs) == 0 {
						vrfs = append(vrfs, 0)
					}
					for _, vrfId := range vrfs {
						if body, isWithdraw := newIPRouteBody(pathList{path}); body != nil {
							z.client.SendIPRoute(vrfId, body, isWithdraw)
						}
						if body, isWithdraw := newNexthopRegisterBody(pathList{path}, z.nhtManager); body != nil {
							z.client.SendNexthopRegister(vrfId, body, isWithdraw)
						}
					}
				}
				// if body, isWithdraw := newNexthopRegisterBody(msg.PathList, z.nhtManager); body != nil {
				// 	z.client.SendNexthopRegister(0, body, isWithdraw)
				// }
			}
		}
	}
}

func newZebraClient(s *BgpServer, url string, protos []string, version uint8, nhtEnable bool, nhtDelay uint8) (*zebraClient, error) {
	l := strings.SplitN(url, ":", 2)
	if len(l) != 2 {
		return nil, fmt.Errorf("unsupported url: %s", url)
	}
	var cli *zebra.Client
	var err error
	for _, ver := range []uint8{version} {
		cli, err = zebra.NewClient(l[0], l[1], zebra.ROUTE_BGP, ver)
		if err == nil {
			break
		}
		// Retry with another Zebra message version
		log.WithFields(log.Fields{
			"Topic": "Zebra",
		}).Warnf("cannot connect to Zebra with message version %d. going to retry another version...", ver)
	}
	if cli == nil {
		return nil, err
	}
	// Note: HELLO/ROUTER_ID_ADD messages are automatically sent to negotiate
	// the Zebra message version in zebra.NewClient().
	// cli.SendHello()
	// cli.SendRouterIDAdd()
	cli.SendInterfaceAdd()
	for _, typ := range protos {
		t, err := zebra.RouteTypeFromString(typ)
		if err != nil {
			return nil, err
		}
		cli.SendRedistribute(t, zebra.VRF_DEFAULT)
	}
	var nhtManager *nexthopTrackingManager = nil
	if nhtEnable {
		nhtManager = newNexthopTrackingManager(s, int(nhtDelay))
	}
	w := &zebraClient{
		dead:       make(chan struct{}),
		client:     cli,
		server:     s,
		nhtManager: nhtManager,
	}
	go w.loop()
	return w, nil
}


text:
package br.com.alexromanelli.android.jogodedamas.persistencia;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;

import android.content.ContentValues;
import br.com.alexromanelli.android.jogodedamas.dinamica.Partida;
import br.com.alexromanelli.android.jogodedamas.dinamica.Partida.OpcaoAdversario;
import br.com.alexromanelli.android.jogodedamas.dinamica.Partida.OpcaoTempoPartida;

@SuppressWarnings("serial")
public class PartidaInterrompida extends HashMap<String,String> {

    @Override
    public String get(Object key) {
        String chave = (String)key;
        if (chave == KEY_PARTIDA_ID)
            return Long.toString(id);
        if (chave == KEY_PARTIDA_DATA_HORA) {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
            return dateFormat.format(getDataInterrupcao());
        }
        if (chave == KEY_PARTIDA_APELIDO_BRANCAS)
            return apelidoBrancas;
        if (chave == KEY_PARTIDA_APELIDO_PRETAS)
            return apelidoPretas;
        return null;
    }

    public static final String NOME_TABELA_PARTIDA = "partida";
    public static final String KEY_PARTIDA_ID = "_id_partida";
    public static final String KEY_PARTIDA_APELIDO_BRANCAS = "apelido_brancas";
    public static final String KEY_PARTIDA_APELIDO_PRETAS = "apelido_pretas";
    public static final String KEY_PARTIDA_DATA_HORA = "data_interrupcao";
    public static final String KEY_PARTIDA_JOGADOR_ATUAL = "jogador_atual";
    public static final String KEY_PARTIDA_OPCAO_ADVERSARIO = "opcao_adversario";
    public static final String KEY_PARTIDA_OPCAO_TEMPO = "opcao_tempo";
    public static final String KEY_PARTIDA_TEMPO_RESTANTE_BRANCAS = "tempo_restante_brancas";
    public static final String KEY_PARTIDA_TEMPO_RESTANTE_PRETAS = "tempo_restante_pretas";

    public static final String SCRIPT_CRIAR_TABELA_PARTIDA =
            "create table " + NOME_TABELA_PARTIDA + " ( "
            + " " + KEY_PARTIDA_ID + " integer primary key autoincrement,"
            + " " + KEY_PARTIDA_APELIDO_BRANCAS + " char(3) not null,"
            + " " + KEY_PARTIDA_APELIDO_PRETAS + " char(3) not null,"
            + " " + KEY_PARTIDA_DATA_HORA + " datetime not null,"
            + " " + KEY_PARTIDA_JOGADOR_ATUAL + " char(1) not null,"
            + " " + KEY_PARTIDA_OPCAO_ADVERSARIO + " integer not null,"
            + " " + KEY_PARTIDA_OPCAO_TEMPO + " integer not null,"
            + " " + KEY_PARTIDA_TEMPO_RESTANTE_BRANCAS + " integer,"
            + " " + KEY_PARTIDA_TEMPO_RESTANTE_PRETAS + " integer);";

    private long id;
    private String apelidoBrancas;
    private String apelidoPretas;
    private Date dataInterrupcao;
    private char jogadorAtual;
    private Partida.OpcaoAdversario opcaoAdversario;
    private Partida.OpcaoTempoPartida opcaoTempo;
    private long tempoRestanteBrancas;
    private long tempoRestantePretas;

    public PartidaInterrompida(long id, String apelidoBrancas,
            String apelidoPretas, Date dataInterrupcao) {
        super();
        this.id = id;
        this.apelidoBrancas = apelidoBrancas;
        this.apelidoPretas = apelidoPretas;
        this.dataInterrupcao = dataInterrupcao;
    }

    public PartidaInterrompida(long id, String apelidoBrancas,
            String apelidoPretas, Date dataInterrupcao, char jogadorAtual,
            OpcaoAdversario opcaoAdversario, OpcaoTempoPartida opcaoTempo,
            long tempoRestanteBrancas, long tempoRestantePretas) {
        super();
        this.id = id;
        this.apelidoBrancas = apelidoBrancas;
        this.apelidoPretas = apelidoPretas;
        this.dataInterrupcao = dataInterrupcao;
        this.jogadorAtual = jogadorAtual;
        this.opcaoAdversario = opcaoAdversario;
        this.opcaoTempo = opcaoTempo;
        this.tempoRestanteBrancas = tempoRestanteBrancas;
        this.tempoRestantePretas = tempoRestantePretas;
    }

    public PartidaInterrompida(String apelidoBrancas, String apelidoPretas,
            Date dataInterrupcao, char jogadorAtual,
            OpcaoAdversario opcaoAdversario, OpcaoTempoPartida opcaoTempo,
            long tempoRestanteBrancas, long tempoRestantePretas) {
        super();
        this.apelidoBrancas = apelidoBrancas;
        this.apelidoPretas = apelidoPretas;
        this.dataInterrupcao = dataInterrupcao;
        this.jogadorAtual = jogadorAtual;
        this.opcaoAdversario = opcaoAdversario;
        this.opcaoTempo = opcaoTempo;
        this.tempoRestanteBrancas = tempoRestanteBrancas;
        this.tempoRestantePretas = tempoRestantePretas;
    }

    public long getId() {
        return id;
    }

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

    public String getApelidoBrancas() {
        return apelidoBrancas;
    }

    public void setApelidoBrancas(String apelidoBrancas) {
        this.apelidoBrancas = apelidoBrancas;
    }

    public String getApelidoPretas() {
        return apelidoPretas;
    }

    public void setApelidoPretas(String apelidoPretas) {
        this.apelidoPretas = apelidoPretas;
    }

    public Date getDataInterrupcao() {
        return dataInterrupcao;
    }

    public void setDataInterrupcao(Date dataInterrupcao) {
        this.dataInterrupcao = dataInterrupcao;
    }

    public char getJogadorAtual() {
        return jogadorAtual;
    }

    public void setJogadorAtual(char jogadorAtual) {
        this.jogadorAtual = jogadorAtual;
    }

    public Partida.OpcaoAdversario getOpcaoAdversario() {
        return opcaoAdversario;
    }

    public void setOpcaoAdversario(Partida.OpcaoAdversario opcaoAdversario) {
        this.opcaoAdversario = opcaoAdversario;
    }

    public Partida.OpcaoTempoPartida getOpcaoTempo() {
        return opcaoTempo;
    }

    public void setOpcaoTempo(Partida.OpcaoTempoPartida opcaoTempo) {
        this.opcaoTempo = opcaoTempo;
    }

    public long getTempoRestanteBrancas() {
        return tempoRestanteBrancas;
    }

    public void setTempoRestanteBrancas(long tempoRestanteBrancas) {
        this.tempoRestanteBrancas = tempoRestanteBrancas;
    }

    public long getTempoRestantePretas() {
        return tempoRestantePretas;
    }

    public void setTempoRestantePretas(long tempoRestantePretas) {
        this.tempoRestantePretas = tempoRestantePretas;
    }

    public ContentValues getContentValues() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());

        ContentValues v = new ContentValues();
        v.put(KEY_PARTIDA_APELIDO_BRANCAS, getApelidoBrancas());
        v.put(KEY_PARTIDA_APELIDO_PRETAS, getApelidoPretas());
        v.put(KEY_PARTIDA_DATA_HORA, dateFormat.format(getDataInterrupcao()));
        v.put(KEY_PARTIDA_JOGADOR_ATUAL, Character.toString(getJogadorAtual()));
        v.put(KEY_PARTIDA_OPCAO_ADVERSARIO, converteParaInteiro(getOpcaoAdversario()));
        v.put(KEY_PARTIDA_OPCAO_TEMPO, converteParaInteiro(getOpcaoTempo()));
        if (getOpcaoTempo() != OpcaoTempoPartida.Ilimitado) {
            v.put(KEY_PARTIDA_TEMPO_RESTANTE_BRANCAS, getTempoRestanteBrancas());
            v.put(KEY_PARTIDA_TEMPO_RESTANTE_PRETAS, getTempoRestantePretas());
        }
        return v;
    }

    private int converteParaInteiro(OpcaoTempoPartida opcao) {
        switch (opcao) {
        case Relampago5x5:
            return 0;
        case Curto15x15:
            return 1;
        case Medio30x30:
            return 2;
        case Normal45x45:
            return 3;
        case Ilimitado:
            return 4;
        }
        return -1;
    }

    private int converteParaInteiro(OpcaoAdversario opcao) {
        switch (opcao) {
        case HumanoLocal:
            return 0;
        case Computador:
            return 1;
        case HumanoRemoto:
            return 2;
        }
        return -1;
    }

}


text:
package org.ovirt.engine.ui.webadmin.section.main.view.popup.tag;

import org.ovirt.engine.ui.uicommonweb.models.tags.TagModel;
import org.ovirt.engine.ui.webadmin.ApplicationConstants;
import org.ovirt.engine.ui.webadmin.ApplicationResources;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.tag.TagPopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.view.popup.AbstractModelBoundPopupView;
import org.ovirt.engine.ui.webadmin.widget.dialog.SimpleDialogPanel;
import org.ovirt.engine.ui.webadmin.widget.editor.EntityModelTextBoxEditor;

import com.google.gwt.core.client.GWT;
import com.google.gwt.editor.client.SimpleBeanEditorDriver;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.inject.Inject;

public class TagPopupView extends AbstractModelBoundPopupView<TagModel> implements TagPopupPresenterWidget.ViewDef {

    interface Driver extends SimpleBeanEditorDriver<TagModel, TagPopupView> {
        Driver driver = GWT.create(Driver.class);
    }

    interface ViewUiBinder extends UiBinder<SimpleDialogPanel, TagPopupView> {
        ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class);
    }

    @UiField
    @Path(value = "name.entity")
    EntityModelTextBoxEditor nameEditor;

    @UiField
    @Path(value = "description.entity")
    EntityModelTextBoxEditor descriptionEditor;

    @Inject
    public TagPopupView(EventBus eventBus, ApplicationResources resources, ApplicationConstants constants) {
        super(eventBus, resources);
        initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));
        localize(constants);
        Driver.driver.initialize(this);
    }

    void localize(ApplicationConstants constants) {
        nameEditor.setLabel(constants.tagPopupNameLabel());
        descriptionEditor.setLabel(constants.tagPopupDescriptionLabel());
    }

    @Override
    public void edit(TagModel object) {
        Driver.driver.edit(object);
    }

    @Override
    public TagModel flush() {
        return Driver.driver.flush();
    }

    @Override
    public void focusInput() {
        nameEditor.setFocus(true);
    }

}


text:
package io.jchat.android.activity;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import cn.jpush.im.android.api.JMessageClient;
import cn.jpush.im.android.api.model.UserInfo;
import cn.jpush.im.api.BasicCallback;
import io.jchat.android.R;
import io.jchat.android.chatting.utils.HandleResponseCode;

/**
 * Created by Ken on 2015/2/13.
 */
public class SelectAreaActivity extends BaseActivity {

    private ImageButton mReturnBtn;
    private TextView mTitle;
    private Button mCommitBtn;
    private EditText mEditAreaEt;
    private Context mContext;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_select_area);
        mContext = this;
        mReturnBtn = (ImageButton) findViewById(R.id.return_btn);
        mTitle = (TextView) findViewById(R.id.jmui_title_tv);
        mCommitBtn = (Button) findViewById(R.id.jmui_commit_btn);
        mEditAreaEt = (EditText) findViewById(R.id.edit_area_et);
        mEditAreaEt.setHint(getIntent().getStringExtra("OldRegion"));
        mTitle.setText(this.getString(R.string.input_location_title));
        mReturnBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

        mCommitBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                final String region = mEditAreaEt.getText().toString().trim();
                if (TextUtils.isEmpty(region)) {
                    Toast.makeText(mContext, mContext.getString(R.string.input_area_error), Toast.LENGTH_SHORT).show();
                } else {
                    final ProgressDialog dialog = new ProgressDialog(mContext);
                    dialog.setMessage(mContext.getString(R.string.modifying_hint));
                    dialog.show();
                    UserInfo myUserInfo = JMessageClient.getMyInfo();
                    myUserInfo.setRegion(region);
                    JMessageClient.updateMyInfo(UserInfo.Field.region, myUserInfo, new BasicCallback() {
                        @Override
                        public void gotResult(final int status, final String desc) {
                            dialog.dismiss();
                            if (status == 0) {
                                Toast.makeText(mContext, mContext.getString(R.string.modify_success_toast),
                                        Toast.LENGTH_SHORT).show();
                                Toast.makeText(mContext, mContext.getString(R.string.modify_success_toast),
                                        Toast.LENGTH_SHORT).show();
                                Intent intent = new Intent();
                                intent.putExtra("region", region);
                                setResult(1, intent);
                                finish();
                            } else {
                                dismissSoftInput();
                                HandleResponseCode.onHandle(mContext, status, false);
                            }
                        }
                    });
                }
            }
        });
    }

    private void dismissSoftInput() {
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
        //隐藏软键盘
        InputMethodManager imm = ((InputMethodManager) mContext
                .getSystemService(Activity.INPUT_METHOD_SERVICE));
        if (getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
            if (getCurrentFocus() != null) {
                imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
            }
        }
    }
}


text:
echo "To be done as root only"

iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward


text:
import React from 'react'
import { expect } from 'chai'
import * as actions from './auth'

describe('(Actions) auth', () => {
  it('should create an action for LOGIN_REQUEST', () => {
    const expectedAction = {
      type: actions.LOGIN_REQUEST
    }
    expect(actions.loginRequest()).to.deep.equal(expectedAction)
  })

  // TODO: fake browserHistory first for this test to work
  // it('should create an action for LOGIN_SUCCESS', () => {
  //   const fakeProfile = { fakeProperty: 'fakeValue' }
  //   const expectedAction = {
  //     type: actions.LOGIN_SUCCESS,
  //     profile: fakeProfile
  //   }
  //   expect(actions.loginSuccess(fakeProfile)).to.deep.equal(expectedAction)
  // })

  it('should create an action for LOGIN_ERROR', () => {
    const fakeError = 'fakeError'
    const expectedAction = {
      type: actions.LOGIN_ERROR,
      error: fakeError
    }
    expect(actions.loginError(fakeError)).to.deep.equal(expectedAction)
  })

  // TODO: fake browserHistory first for this test to work
  // it('should create an action for LOGOUT_SUCCESS', () => {
  //   const expectedAction = {
  //     type: actions.LOGOUT_SUCCESS
  //   }
  //   expect(actions.logoutSuccess()).to.deep.equal(expectedAction)
  // })
})


text:
Buttons

Raised Buttons

            <md-button class="md-raised">Button</md-button>
            <md-button class="md-raised md-primary"> Colored</md-button>
            <md-button class="md-raised primary"> Primary </md-button>
           <md-button class="md-raised md-warn"> Warn </md-button>
            <md-button class="md-raised green">  Green </md-button>

Flat Buttons

            <md-button>Flat</md-button>
            <md-button md-no-ink class="md-primary">Colored (md-noink)</md-button>
            <md-button class="primary-flat">  Primary </md-button>
            <md-button class="md-warn">Warn</md-button>
            <md-button class="green-flat">green </md-button>

Icon Buttons

            <md-button class="md-icon-button md-primary" aria-label="Settings">
                <md-icon ></md-icon>
            </md-button>
            <md-button class="md-icon-button md-accent" aria-label="Settings">
                <md-icon ></md-icon>
            </md-button>
            <md-button class="md-icon-button primary-flat" aria-label="Settings">
                <md-icon ></md-icon>
            </md-button>
            <md-button class="md-icon-button green-flat" aria-label="Settings">
                <md-icon ></md-icon>
            </md-button>

Fab Buttons

            <md-button class="md-fab" aria-label="Eat cake">
                <md-icon > </md-icon>
            </md-button>
            <md-button class="md-fab md-primary" aria-label="Use Android">
                <md-icon ></md-icon>
            </md-button>
            <md-button class="md-fab primary" aria-label="Use Android">
                <md-icon ></md-icon>
            </md-button>
            <md-button class="md-fab green" aria-label="Eat cake">
                <md-icon > </md-icon>
            </md-button>


text:
namespace surf {

class LoudsDense {
public:
    class Iter {
    public:
	Iter() : is_valid_(false) {};
	Iter(LoudsDense* trie) : is_valid_(false), is_search_complete_(false),
				 is_move_left_complete_(false),
				 is_move_right_complete_(false),
				 trie_(trie),
				 send_out_node_num_(0), key_len_(0),
				 is_at_prefix_key_(false) {
	    for (level_t level = 0; level < trie_->getHeight(); level++) {
		key_.push_back(0);
		pos_in_trie_.push_back(0);
	    }
	}

	void clear();
	bool isValid() const { return is_valid_; };
	bool isSearchComplete() const { return is_search_complete_; };
	bool isMoveLeftComplete() const { return is_move_left_complete_; };
	bool isMoveRightComplete() const { return is_move_right_complete_; };
	bool isComplete() const {
	    return (is_search_complete_ &&
		    (is_move_left_complete_ && is_move_right_complete_));
	}

	int compare(const std::string& key) const;
	std::string getKey() const;
	int getSuffix(word_t* suffix) const;
	std::string getKeyWithSuffix(unsigned* bitlen) const;
	position_t getSendOutNodeNum() const { return send_out_node_num_; };

	void setToFirstLabelInRoot();
	void setToLastLabelInRoot();
	void moveToLeftMostKey();
	void moveToRightMostKey();
	void operator ++(int);
	void operator --(int);

    private:
	inline void append(position_t pos);
	inline void set(level_t level, position_t pos);
	inline void setSendOutNodeNum(position_t node_num) { send_out_node_num_ = node_num; };
	inline void setFlags(const bool is_valid, const bool is_search_complete,
			     const bool is_move_left_complete,
			     const bool is_move_right_complete);

    private:
	// True means the iter either points to a valid key
	// or to a prefix with length trie_->getHeight()
	bool is_valid_;
	// If false, call moveToKeyGreaterThan in LoudsSparse to complete
	bool is_search_complete_;
	// If false, call moveToLeftMostKey in LoudsSparse to complete
	bool is_move_left_complete_;
	// If false, call moveToRightMostKey in LoudsSparse to complete
	bool is_move_right_complete_;
	LoudsDense* trie_;
	position_t send_out_node_num_;
	level_t key_len_; // Does NOT include suffix

	std::vector<label_t> key_;
	std::vector<position_t> pos_in_trie_;
	bool is_at_prefix_key_;

	friend class LoudsDense;
    };

public:
    LoudsDense() {};
    LoudsDense(const SuRFBuilder* builder);

    ~LoudsDense() {}

    // Returns whether key exists in the trie so far
    // out_node_num == 0 means search terminates in louds-dense.
    bool lookupKey(const std::string& key, position_t& out_node_num) const;
    // return value indicates potential false positive
    bool moveToKeyGreaterThan(const std::string& key,
			      const bool inclusive, LoudsDense::Iter& iter) const;

    uint64_t getHeight() const { return height_; };
    uint64_t serializedSize() const;
    uint64_t getMemoryUsage() const;

    void serialize(char*& dst) const {
	memcpy(dst, &height_, sizeof(height_));
	dst += sizeof(height_);
	align(dst);
	label_bitmaps_->serialize(dst);
	child_indicator_bitmaps_->serialize(dst);
	prefixkey_indicator_bits_->serialize(dst);
	suffixes_->serialize(dst);
	align(dst);
    }

    static LoudsDense* deSerialize(char*& src) {
	LoudsDense* louds_dense = new LoudsDense();
	memcpy(&(louds_dense->height_), src, sizeof(louds_dense->height_));
	src += sizeof(louds_dense->height_);
	align(src);
	louds_dense->label_bitmaps_ = BitvectorRank::deSerialize(src);
	louds_dense->child_indicator_bitmaps_ = BitvectorRank::deSerialize(src);
	louds_dense->prefixkey_indicator_bits_ = BitvectorRank::deSerialize(src);
	louds_dense->suffixes_ = BitvectorSuffix::deSerialize(src);
	align(src);
	return louds_dense;
    }

    void destroy() {
	label_bitmaps_->destroy();
	child_indicator_bitmaps_->destroy();
	prefixkey_indicator_bits_->destroy();
	suffixes_->destroy();
    }

private:
    position_t getChildNodeNum(const position_t pos) const;
    position_t getSuffixPos(const position_t pos, const bool is_prefix_key) const;
    position_t getNextPos(const position_t pos) const;
    position_t getPrevPos(const position_t pos, bool* is_out_of_bound) const;

    bool compareSuffixGreaterThan(const position_t pos, const std::string& key,
				  const level_t level, const bool inclusive,
				  LoudsDense::Iter& iter) const;

private:
    static const position_t kNodeFanout = 256;
    static const position_t kRankBasicBlockSize  = 512;

    level_t height_;

    BitvectorRank* label_bitmaps_;
    BitvectorRank* child_indicator_bitmaps_;
    BitvectorRank* prefixkey_indicator_bits_; //1 bit per internal node
    BitvectorSuffix* suffixes_;
};

LoudsDense::LoudsDense(const SuRFBuilder* builder) {
    height_ = builder->getSparseStartLevel();
    std::vector<position_t> num_bits_per_level;
    for (level_t level = 0; level < height_; level++)
	num_bits_per_level.push_back(builder->getBitmapLabels()[level].size() * kWordSize);

    label_bitmaps_ = new BitvectorRank(kRankBasicBlockSize, builder->getBitmapLabels(),
				       num_bits_per_level, 0, height_);
    child_indicator_bitmaps_ = new BitvectorRank(kRankBasicBlockSize,
						 builder->getBitmapChildIndicatorBits(),
						 num_bits_per_level, 0, height_);
    prefixkey_indicator_bits_ = new BitvectorRank(kRankBasicBlockSize,
						  builder->getPrefixkeyIndicatorBits(),
						  builder->getNodeCounts(), 0, height_);

    if (builder->getSuffixType() == kNone) {
	suffixes_ = new BitvectorSuffix();
    } else {
	level_t hash_suffix_len = builder->getHashSuffixLen();
        level_t real_suffix_len = builder->getRealSuffixLen();
        level_t suffix_len = hash_suffix_len + real_suffix_len;
	std::vector<position_t> num_suffix_bits_per_level;
	for (level_t level = 0; level < height_; level++)
	    num_suffix_bits_per_level.push_back(builder->getSuffixCounts()[level] * suffix_len);
	suffixes_ = new BitvectorSuffix(builder->getSuffixType(),
					hash_suffix_len, real_suffix_len,
                                        builder->getSuffixes(),
					num_suffix_bits_per_level, 0, height_);
    }
}

bool LoudsDense::lookupKey(const std::string& key, position_t& out_node_num) const {
    position_t node_num = 0;
    position_t pos = 0;
    for (level_t level = 0; level < height_; level++) {
	pos = (node_num * kNodeFanout);
	if (level >= key.length()) { //if run out of searchKey bytes
	    if (prefixkey_indicator_bits_->readBit(node_num)) //if the prefix is also a key
		return suffixes_->checkEquality(getSuffixPos(pos, true), key, level + 1);
	    else
		return false;
	}
	pos += (label_t)key[level];

	//child_indicator_bitmaps_->prefetch(pos);

	if (!label_bitmaps_->readBit(pos)) //if key byte does not exist
	    return false;

	if (!child_indicator_bitmaps_->readBit(pos)) //if trie branch terminates
	    return suffixes_->checkEquality(getSuffixPos(pos, false), key, level + 1);

	node_num = getChildNodeNum(pos);
    }
    //search will continue in LoudsSparse
    out_node_num = node_num;
    return true;
}

bool LoudsDense::moveToKeyGreaterThan(const std::string& key,
				      const bool inclusive, LoudsDense::Iter& iter) const {
    position_t node_num = 0;
    position_t pos = 0;
    for (level_t level = 0; level < height_; level++) {
	// if is_at_prefix_key_, pos is at the next valid position in the child node
	pos = node_num * kNodeFanout;
	if (level >= key.length()) { // if run out of searchKey bytes
	    iter.append(getNextPos(pos - 1));
	    if (prefixkey_indicator_bits_->readBit(node_num)) //if the prefix is also a key
		iter.is_at_prefix_key_ = true;
	    else
		iter.moveToLeftMostKey();
	    // valid, search complete, moveLeft complete, moveRight complete
	    iter.setFlags(true, true, true, true);
	    return true;
	}

	pos += (label_t)key[level];
	iter.append(pos);

	// if no exact match
	if (!label_bitmaps_->readBit(pos)) {
	    iter++;
	    return false;
	}
	//if trie branch terminates
	if (!child_indicator_bitmaps_->readBit(pos))
	    return compareSuffixGreaterThan(pos, key, level+1, inclusive, iter);
	node_num = getChildNodeNum(pos);
    }

    //search will continue in LoudsSparse
    iter.setSendOutNodeNum(node_num);
    // valid, search INCOMPLETE, moveLeft complete, moveRight complete
    iter.setFlags(true, false, true, true);
    return true;
}

uint64_t LoudsDense::serializedSize() const {
    uint64_t size = sizeof(height_)
	+ label_bitmaps_->serializedSize()
	+ child_indicator_bitmaps_->serializedSize()
	+ prefixkey_indicator_bits_->serializedSize()
	+ suffixes_->serializedSize();
    sizeAlign(size);
    return size;
}

uint64_t LoudsDense::getMemoryUsage() const {
    return (sizeof(LoudsDense)
	    + label_bitmaps_->size()
	    + child_indicator_bitmaps_->size()
	    + prefixkey_indicator_bits_->size()
	    + suffixes_->size());
}

position_t LoudsDense::getChildNodeNum(const position_t pos) const {
    return child_indicator_bitmaps_->rank(pos);
}

position_t LoudsDense::getSuffixPos(const position_t pos, const bool is_prefix_key) const {
    position_t node_num = pos / kNodeFanout;
    position_t suffix_pos = (label_bitmaps_->rank(pos)
			     - child_indicator_bitmaps_->rank(pos)
			     + prefixkey_indicator_bits_->rank(node_num)
			     - 1);
    if (is_prefix_key && label_bitmaps_->readBit(pos) && !child_indicator_bitmaps_->readBit(pos))
	suffix_pos--;
    return suffix_pos;
}

position_t LoudsDense::getNextPos(const position_t pos) const {
    return pos + label_bitmaps_->distanceToNextSetBit(pos);
}

position_t LoudsDense::getPrevPos(const position_t pos, bool* is_out_of_bound) const {
    position_t distance = label_bitmaps_->distanceToPrevSetBit(pos);
    if (pos <= distance) {
	*is_out_of_bound = true;
	return 0;
    }
    *is_out_of_bound = false;
    return (pos - distance);
}

bool LoudsDense::compareSuffixGreaterThan(const position_t pos, const std::string& key,
					  const level_t level, const bool inclusive,
					  LoudsDense::Iter& iter) const {
    position_t suffix_pos = getSuffixPos(pos, false);
    int compare = suffixes_->compare(suffix_pos, key, level);
    if ((compare != kCouldBePositive) && (compare < 0)) {
	iter++;
	return false;
    }
    // valid, search complete, moveLeft complete, moveRight complete
    iter.setFlags(true, true, true, true);
    return true;
}

//============================================================================

void LoudsDense::Iter::clear() {
    is_valid_ = false;
    key_len_ = 0;
    is_at_prefix_key_ = false;
}

int LoudsDense::Iter::compare(const std::string& key) const {
    if (is_at_prefix_key_ && (key_len_ - 1) < key.length())
	return -1;
    std::string iter_key = getKey();
    std::string key_dense = key.substr(0, iter_key.length());
    int compare = iter_key.compare(key_dense);
    if (compare != 0) return compare;
    if (isComplete()) {
	position_t suffix_pos = trie_->getSuffixPos(pos_in_trie_[key_len_ - 1], is_at_prefix_key_);
	return trie_->suffixes_->compare(suffix_pos, key, key_len_);
    }
    return compare;
}

std::string LoudsDense::Iter::getKey() const {
    if (!is_valid_)
	return std::string();
    level_t len = key_len_;
    if (is_at_prefix_key_)
	len--;
    return std::string((const char*)key_.data(), (size_t)len);
}

int LoudsDense::Iter::getSuffix(word_t* suffix) const {
    if (isComplete()
        && ((trie_->suffixes_->getType() == kReal) || (trie_->suffixes_->getType() == kMixed))) {
	position_t suffix_pos = trie_->getSuffixPos(pos_in_trie_[key_len_ - 1], is_at_prefix_key_);
	*suffix = trie_->suffixes_->readReal(suffix_pos);
	return trie_->suffixes_->getRealSuffixLen();
    }
    *suffix = 0;
    return 0;
}

std::string LoudsDense::Iter::getKeyWithSuffix(unsigned* bitlen) const {
    std::string iter_key = getKey();
    if (isComplete()
        && ((trie_->suffixes_->getType() == kReal) || (trie_->suffixes_->getType() == kMixed))) {
	position_t suffix_pos = trie_->getSuffixPos(pos_in_trie_[key_len_ - 1], is_at_prefix_key_);
	word_t suffix = trie_->suffixes_->readReal(suffix_pos);
	if (suffix > 0) {
	    level_t suffix_len = trie_->suffixes_->getRealSuffixLen();
	    *bitlen = suffix_len % 8;
	    suffix <<= (64 - suffix_len);
	    char* suffix_str = reinterpret_cast<char*>(&suffix);
	    suffix_str += 7;
	    unsigned pos = 0;
	    while (pos < suffix_len) {
		iter_key.append(suffix_str, 1);
		suffix_str--;
		pos += 8;
	    }
	}
    }
    return iter_key;
}

void LoudsDense::Iter::append(position_t pos) {
    assert(key_len_ < key_.size());
    key_[key_len_] = (label_t)(pos % kNodeFanout);
    pos_in_trie_[key_len_] = pos;
    key_len_++;
}

void LoudsDense::Iter::set(level_t level, position_t pos) {
    assert(level < key_.size());
    key_[level] = (label_t)(pos % kNodeFanout);
    pos_in_trie_[level] = pos;
}

void LoudsDense::Iter::setFlags(const bool is_valid,
				const bool is_search_complete,
				const bool is_move_left_complete,
				const bool is_move_right_complete) {
    is_valid_ = is_valid;
    is_search_complete_ = is_search_complete;
    is_move_left_complete_ = is_move_left_complete;
    is_move_right_complete_ = is_move_right_complete;
}

void LoudsDense::Iter::setToFirstLabelInRoot() {
    if (trie_->label_bitmaps_->readBit(0)) {
	pos_in_trie_[0] = 0;
	key_[0] = (label_t)0;
    } else {
	pos_in_trie_[0] = trie_->getNextPos(0);
	key_[0] = (label_t)pos_in_trie_[0];
    }
    key_len_++;
}

void LoudsDense::Iter::setToLastLabelInRoot() {
    bool is_out_of_bound;
    pos_in_trie_[0] = trie_->getPrevPos(kNodeFanout, &is_out_of_bound);
    key_[0] = (label_t)pos_in_trie_[0];
    key_len_++;
}

void LoudsDense::Iter::moveToLeftMostKey() {
    assert(key_len_ > 0);
    level_t level = key_len_ - 1;
    position_t pos = pos_in_trie_[level];
    if (!trie_->child_indicator_bitmaps_->readBit(pos))
	// valid, search complete, moveLeft complete, moveRight complete
	return setFlags(true, true, true, true);

    while (level < trie_->getHeight() - 1) {
	position_t node_num = trie_->getChildNodeNum(pos);
	//if the current prefix is also a key
	if (trie_->prefixkey_indicator_bits_->readBit(node_num)) {
	    append(trie_->getNextPos(node_num * kNodeFanout - 1));
	    is_at_prefix_key_ = true;
	    // valid, search complete, moveLeft complete, moveRight complete
	    return setFlags(true, true, true, true);
	}

	pos = trie_->getNextPos(node_num * kNodeFanout - 1);
	append(pos);

	// if trie branch terminates
	if (!trie_->child_indicator_bitmaps_->readBit(pos))
	    // valid, search complete, moveLeft complete, moveRight complete
	    return setFlags(true, true, true, true);

	level++;
    }
    send_out_node_num_ = trie_->getChildNodeNum(pos);
    // valid, search complete, moveLeft INCOMPLETE, moveRight complete
    setFlags(true, true, false, true);
}

void LoudsDense::Iter::moveToRightMostKey() {
    assert(key_len_ > 0);
    level_t level = key_len_ - 1;
    position_t pos = pos_in_trie_[level];
    if (!trie_->child_indicator_bitmaps_->readBit(pos))
	// valid, search complete, moveLeft complete, moveRight complete
	return setFlags(true, true, true, true);

    while (level < trie_->getHeight() - 1) {
	position_t node_num = trie_->getChildNodeNum(pos);
	bool is_out_of_bound;
	pos = trie_->getPrevPos((node_num + 1) * kNodeFanout, &is_out_of_bound);
	if (is_out_of_bound) {
	    is_valid_ = false;
	    return;
	}
	append(pos);

	// if trie branch terminates
	if (!trie_->child_indicator_bitmaps_->readBit(pos))
	    // valid, search complete, moveLeft complete, moveRight complete
	    return setFlags(true, true, true, true);

	level++;
    }
    send_out_node_num_ = trie_->getChildNodeNum(pos);
    // valid, search complete, moveleft complete, moveRight INCOMPLETE
    setFlags(true, true, true, false);
}

void LoudsDense::Iter::operator ++(int) {
    assert(key_len_ > 0);
    if (is_at_prefix_key_) {
	is_at_prefix_key_ = false;
	return moveToLeftMostKey();
    }
    position_t pos = pos_in_trie_[key_len_ - 1];
    position_t next_pos = trie_->getNextPos(pos);
    // if crossing node boundary
    while ((next_pos / kNodeFanout) > (pos / kNodeFanout)) {
	key_len_--;
	if (key_len_ == 0) {
	    is_valid_ = false;
	    return;
	}
	pos = pos_in_trie_[key_len_ - 1];
	next_pos = trie_->getNextPos(pos);
    }
    set(key_len_ - 1, next_pos);
    return moveToLeftMostKey();
}

void LoudsDense::Iter::operator --(int) {
    assert(key_len_ > 0);
    if (is_at_prefix_key_) {
	is_at_prefix_key_ = false;
	key_len_--;
    }
    position_t pos = pos_in_trie_[key_len_ - 1];
    bool is_out_of_bound;
    position_t prev_pos = trie_->getPrevPos(pos, &is_out_of_bound);
    if (is_out_of_bound) {
	is_valid_ = false;
	return;
    }

    // if crossing node boundary
    while ((prev_pos / kNodeFanout) < (pos / kNodeFanout)) {
	//if the current prefix is also a key
	position_t node_num = pos / kNodeFanout;
	if (trie_->prefixkey_indicator_bits_->readBit(node_num)) {
	    is_at_prefix_key_ = true;
	    // valid, search complete, moveLeft complete, moveRight complete
	    return setFlags(true, true, true, true);
	}

	key_len_--;
	if (key_len_ == 0) {
	    is_valid_ = false;
	    return;
	}
	pos = pos_in_trie_[key_len_ - 1];
	prev_pos = trie_->getPrevPos(pos, &is_out_of_bound);
	if (is_out_of_bound) {
	    is_valid_ = false;
	    return;
	}
    }
    set(key_len_ - 1, prev_pos);
    return moveToRightMostKey();
}

} //namespace surf

#endif // LOUDSDENSE_H_


text:
// ----------------------------------------------------------------------------------------------------------------------
// Copyright © Ejyle Technologies (P) Ltd (www.ejyle.com)
// Licensed under the MIT license. See the LICENSE file in the project's root directory for complete license information.
// ----------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Ejyle.DevAccelerate.Adapters.Azure.Storage.Sample
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}


text:
package org.hl7.fhir.instance.model;

public class SidType extends UriType {

  private static final long serialVersionUID = 5486832330986493589L;

}


text:
using System;
using System.Linq;
using FancyApps.Services.Models;

namespace FancyApps.Services.Controllers
{
    using System.Web.Http;
    using Data.MongoRepository;
    using Model;
    using Model.Entities;

    public class AbstractApiController : ApiController
    {
        private MongoRepository<User> usersRepository;
        private MongoRepository<Friend> friendRepository;

        public AbstractApiController()
        {
            this.usersRepository = new MongoRepository<User>();
            this.friendRepository = new MongoRepository<Friend>();
        }

        public MongoRepository<User> Users
        {
            get { return this.usersRepository; }
            set { value = this.usersRepository; }
        }

        public MongoRepository<Friend> Friends
        {
            get { return this.friendRepository; }
            set { this.friendRepository = value; }
        }
    }
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.bigtableadmin.v1.model;

/**
 * A backup of a Cloud Bigtable table.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Cloud Bigtable Admin API. For a detailed explanation
 * see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class Backup extends com.google.api.client.json.GenericJson {

  /**
   * Output only. The encryption information for the backup.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private EncryptionInfo encryptionInfo;

  /**
   * Output only. `end_time` is the time that the backup was finished. The row data in the backup
   * will be no newer than this timestamp.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private String endTime;

  /**
   * Required. The expiration time of the backup, with microseconds granularity that must be at
   * least 6 hours and at most 30 days from the time the request is received. Once the `expire_time`
   * has passed, Cloud Bigtable will delete the backup and free the resources used by the backup.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private String expireTime;

  /**
   * A globally unique identifier for the backup which cannot be changed. Values are of the form
   * `projects/{project}/instances/{instance}/clusters/{cluster}/ backups/_a-zA-Z0-9*` The final
   * segment of the name must be between 1 and 50 characters in length. The backup is stored in the
   * cluster identified by the prefix of the backup name of the form
   * `projects/{project}/instances/{instance}/clusters/{cluster}`.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String name;

  /**
   * Output only. Size of the backup in bytes.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key @com.google.api.client.json.JsonString
  private java.lang.Long sizeBytes;

  /**
   * Required. Immutable. Name of the table from which this backup was created. This needs to be in
   * the same instance as the backup. Values are of the form
   * `projects/{project}/instances/{instance}/tables/{source_table}`.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String sourceTable;

  /**
   * Output only. `start_time` is the time that the backup was started (i.e. approximately the time
   * the CreateBackup request is received). The row data in this backup will be no older than this
   * timestamp.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private String startTime;

  /**
   * Output only. The current state of the backup.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String state;

  /**
   * Output only. The encryption information for the backup.
   * @return value or {@code null} for none
   */
  public EncryptionInfo getEncryptionInfo() {
    return encryptionInfo;
  }

  /**
   * Output only. The encryption information for the backup.
   * @param encryptionInfo encryptionInfo or {@code null} for none
   */
  public Backup setEncryptionInfo(EncryptionInfo encryptionInfo) {
    this.encryptionInfo = encryptionInfo;
    return this;
  }

  /**
   * Output only. `end_time` is the time that the backup was finished. The row data in the backup
   * will be no newer than this timestamp.
   * @return value or {@code null} for none
   */
  public String getEndTime() {
    return endTime;
  }

  /**
   * Output only. `end_time` is the time that the backup was finished. The row data in the backup
   * will be no newer than this timestamp.
   * @param endTime endTime or {@code null} for none
   */
  public Backup setEndTime(String endTime) {
    this.endTime = endTime;
    return this;
  }

  /**
   * Required. The expiration time of the backup, with microseconds granularity that must be at
   * least 6 hours and at most 30 days from the time the request is received. Once the `expire_time`
   * has passed, Cloud Bigtable will delete the backup and free the resources used by the backup.
   * @return value or {@code null} for none
   */
  public String getExpireTime() {
    return expireTime;
  }

  /**
   * Required. The expiration time of the backup, with microseconds granularity that must be at
   * least 6 hours and at most 30 days from the time the request is received. Once the `expire_time`
   * has passed, Cloud Bigtable will delete the backup and free the resources used by the backup.
   * @param expireTime expireTime or {@code null} for none
   */
  public Backup setExpireTime(String expireTime) {
    this.expireTime = expireTime;
    return this;
  }

  /**
   * A globally unique identifier for the backup which cannot be changed. Values are of the form
   * `projects/{project}/instances/{instance}/clusters/{cluster}/ backups/_a-zA-Z0-9*` The final
   * segment of the name must be between 1 and 50 characters in length. The backup is stored in the
   * cluster identified by the prefix of the backup name of the form
   * `projects/{project}/instances/{instance}/clusters/{cluster}`.
   * @return value or {@code null} for none
   */
  public java.lang.String getName() {
    return name;
  }

  /**
   * A globally unique identifier for the backup which cannot be changed. Values are of the form
   * `projects/{project}/instances/{instance}/clusters/{cluster}/ backups/_a-zA-Z0-9*` The final
   * segment of the name must be between 1 and 50 characters in length. The backup is stored in the
   * cluster identified by the prefix of the backup name of the form
   * `projects/{project}/instances/{instance}/clusters/{cluster}`.
   * @param name name or {@code null} for none
   */
  public Backup setName(java.lang.String name) {
    this.name = name;
    return this;
  }

  /**
   * Output only. Size of the backup in bytes.
   * @return value or {@code null} for none
   */
  public java.lang.Long getSizeBytes() {
    return sizeBytes;
  }

  /**
   * Output only. Size of the backup in bytes.
   * @param sizeBytes sizeBytes or {@code null} for none
   */
  public Backup setSizeBytes(java.lang.Long sizeBytes) {
    this.sizeBytes = sizeBytes;
    return this;
  }

  /**
   * Required. Immutable. Name of the table from which this backup was created. This needs to be in
   * the same instance as the backup. Values are of the form
   * `projects/{project}/instances/{instance}/tables/{source_table}`.
   * @return value or {@code null} for none
   */
  public java.lang.String getSourceTable() {
    return sourceTable;
  }

  /**
   * Required. Immutable. Name of the table from which this backup was created. This needs to be in
   * the same instance as the backup. Values are of the form
   * `projects/{project}/instances/{instance}/tables/{source_table}`.
   * @param sourceTable sourceTable or {@code null} for none
   */
  public Backup setSourceTable(java.lang.String sourceTable) {
    this.sourceTable = sourceTable;
    return this;
  }

  /**
   * Output only. `start_time` is the time that the backup was started (i.e. approximately the time
   * the CreateBackup request is received). The row data in this backup will be no older than this
   * timestamp.
   * @return value or {@code null} for none
   */
  public String getStartTime() {
    return startTime;
  }

  /**
   * Output only. `start_time` is the time that the backup was started (i.e. approximately the time
   * the CreateBackup request is received). The row data in this backup will be no older than this
   * timestamp.
   * @param startTime startTime or {@code null} for none
   */
  public Backup setStartTime(String startTime) {
    this.startTime = startTime;
    return this;
  }

  /**
   * Output only. The current state of the backup.
   * @return value or {@code null} for none
   */
  public java.lang.String getState() {
    return state;
  }

  /**
   * Output only. The current state of the backup.
   * @param state state or {@code null} for none
   */
  public Backup setState(java.lang.String state) {
    this.state = state;
    return this;
  }

  @Override
  public Backup set(String fieldName, Object value) {
    return (Backup) super.set(fieldName, value);
  }

  @Override
  public Backup clone() {
    return (Backup) super.clone();
  }

}


text:
Linq to Querystring v0.7.0
==========================

## New Website
Linq to Querystring now has a project page! Please refer to http://beyond-code.com/LinqToQuerystring/ for documentation and samples.

## Installation

* Nuget package: https://nuget.org/packages/LinqToQuerystring/
PM> Install-Package LinqToQuerystring

* Entity Framework package ($expand support): https://nuget.org/packages/LinqToQuerystring.EntityFramework/
PM> Install-Package LinqToQuerystring.EntityFramework

* Web Api package: https://nuget.org/packages/LinqToQuerystring.WebApi/
PM> Install-Package LinqToQuerystring.WebApi

* Web Api 2 package: https://nuget.org/packages/LinqToQuerystring.WebApi2/
PM> Install-Package LinqToQuerystring.WebApi2

* Nancy FX package: https://nuget.org/packages/LinqToQuerystring.Nancy/
PM> Install-Package LinqToQuerystring.Nancy

###Contributors

https://github.com/xt0rted


text:
'use strict';

const common = require('../common');
const domain = require('domain');

function test() {
  const d = domain.create();

  d.run(function() {
    process.nextTick(function() {
      throw new Error('boom!');
    });
  });
}

if (process.argv[2] === 'child') {
  test();
} else {
  common.childShouldThrowAndAbort();
}


text:
package engine

import (
	// Link against the protobuf and rocksdb libaries. This is
	// explicitly because these Go libraries do not export any Go
	// symbols.
	_ "github.com/cockroachdb/c-lz4"
	_ "github.com/cockroachdb/c-protobuf"
	_ "github.com/cockroachdb/c-rocksdb"
	_ "github.com/cockroachdb/c-snappy"
)

// #cgo CXXFLAGS: -std=c++11
// #cgo CPPFLAGS: -I ../../../c-protobuf/internal/src -I ../../../c-rocksdb/internal/include
// #cgo darwin LDFLAGS: -Wl,-undefined -Wl,dynamic_lookup
// #cgo !darwin LDFLAGS: -Wl,-unresolved-symbols=ignore-all
import "C"


text:
namespace Facade.Example
{
    /// <summary>
    /// Out customer class
    /// </summary>
    public class Customer
    {
        private string name;

        // Constructor
        public Customer(string name)
        {
            this.name = name;
        }

        // Gets the name
        public string Name
        {
            get
            {
                return this.name;
            }
        }
    }
}


text:
/**
 * AuthController
 *
 * @module      :: Controller
 * @description	:: A set of functions called `actions`.
 *
 *                 Actions contain code telling Sails how to respond to a certain type of request.
 *                 (i.e. do stuff, then send some JSON, show an HTML page, or redirect to another URL)
 *
 *                 You can configure the blueprint URLs which trigger these actions (`config/controllers.js`)
 *                 and/or override them with custom routes (`config/routes.js`)
 *
 *                 NOTE: The code you write here supports both HTTP and Socket.io automatically.
 *
 * @docs        :: http://sailsjs.org/#!documentation/controllers
 */

module.exports = {

    provider: function (req, res) {
		console.log("Calling Auth :: " + req.params.provider);
		loginServices.authenticate(req, res);
	},

	callback: function (req, res) {
		loginServices.authenticationCallback(req, res);
	},

	logout: function (req, res) {
		console.log(" **** Log Out User ****");
		req.session.destroy();
		res.redirect('/');
	},

  /**
   * Overrides for the settings in `config/controllers.js`
   * (specific to AuthController)
   */
  _config: {}

};


text:
export * from './StringFilter';
export * from './components';


text:
<!DOCTYPE HTML>

		<meta http-equiv="Content-Type" content="html/html; charset=utf-8" />
		<title>FBNativeAdsManager Class Reference</title>
		<meta id="xcode-display" name="xcode-display" content="render"/>
		<link rel="stylesheet" type="text/css" href="../css/styles.css" media="all" />
		<link rel="stylesheet" type="text/css" media="print" href="../css/stylesPrint.css" />
		<meta name="generator" content="appledoc 2.2 (build 963)" />

Facebook Audience Network SDK 4.10.1 for iOS

				Facebook

FBNativeAdsManager Class Reference

					<button aria-label="Show Table of Contents" role="checkbox" class="open" id="table_of_contents">Table of Contents</button>

					<select id="jumpTo">
	<option value="top">Jump To…</option>

	<option value="overview">Overview</option>

	<option value="tasks">Tasks</option>

	<option value="properties">Properties</option>

	<option value="//api/name/delegate">    delegate</option>

	<option value="//api/name/mediaCachePolicy">    mediaCachePolicy</option>

	<option value="//api/name/uniqueNativeAdCount">    uniqueNativeAdCount</option>

	<option value="//api/name/valid">    valid</option>

	<option value="instance_methods">Instance Methods</option>

	<option value="//api/name/disableAutoRefresh">    - disableAutoRefresh</option>

	<option value="//api/name/initWithPlacementID:forNumAdsRequested:">    - initWithPlacementID:forNumAdsRequested:</option>

	<option value="//api/name/loadAds">    - loadAds</option>

	<option value="//api/name/nextNativeAd">    - nextNativeAd</option>

</select>

Overview

Tasks

Properties

delegate

mediaCachePolicy

uniqueNativeAdCount

valid

Instance Methods

disableAutoRefresh

initWithPlacementID:forNumAdsRequested:

loadAds

nextNativeAd

Index

Hierarchy

FBNativeAdsManager Class Reference

	Inherits from
	NSObject

	Declared in
	FBNativeAdsManager.h

Overview

@class FBNativeAdsManager

Tasks

		  delegate

	property

		  mediaCachePolicy

	property

		  uniqueNativeAdCount

	property

		  valid

	property

		– initWithPlacementID:forNumAdsRequested:

		– loadAds

		– disableAutoRefresh

		– nextNativeAd

Properties

delegate

The delegate

@property (nonatomic, weak, nullable) id<FBNativeAdsManagerDelegate> delegate

Declared In

		FBNativeAdsManager.h

mediaCachePolicy

Set the native ads manager caching policy. This controls which media from the native ads are cached before the native ads manager calls nativeAdsLoaded on its delegate. The default is to not block on caching.

@property (nonatomic, assign) FBNativeAdsCachePolicy mediaCachePolicy

Declared In

		FBNativeAdsManager.h

uniqueNativeAdCount

Number of unique native ads that can be accessed through nextNativeAd:. This is not valid until the nativeAdsLoaded: message has been sent.

@property (nonatomic, assign, readonly) NSUInteger uniqueNativeAdCount

Declared In

		FBNativeAdsManager.h

valid

Returns YES after nativeAdsLoaded: message has been sent.

@property (nonatomic, assign, getter=isValid, readonly) BOOL valid

Declared In

		FBNativeAdsManager.h

Instance Methods

disableAutoRefresh

By default the native ads manager will refresh its ads periodically. This does not mean that any ads which are shown in the application’s UI will be refreshed but simply that calling nextNativeAd: may return different ads at different times. This method disables that functionality.

- (void)disableAutoRefresh

Declared In

		FBNativeAdsManager.h

initWithPlacementID:forNumAdsRequested:

Initialize the native ads manager.

- (instancetype)initWithPlacementID:(NSString *)placementID forNumAdsRequested:(NSUInteger)numAdsRequested

Parameters

placementID

The id of the ad placement. You can create your placement id from Facebook developers page.

numAdsRequested

The number of ads you would like the native ads manager to retrieve.

Declared In

		FBNativeAdsManager.h

loadAds

The method that kicks off the loading of ads. It may be called again in the future to refresh the ads manually.

- (void)loadAds

Declared In

		FBNativeAdsManager.h

nextNativeAd

Retrieve the next native ad to be used from the batch. It is highly recommended that the caller wait until immediately before rendering the ad content to call this method to ensure the best ad for the given context is used. If more than uniqueNativeAdCount ads are requested cloned ads will be returned. Periodically the native ads manager will refresh and new ads will be returned.

- (nullable FBNativeAd *)nextNativeAd

Return Value

A FBNativeAd which is loaded and ready to be used.

Declared In

		FBNativeAdsManager.h

Index

Hierarchy

© 2016 Facebook. All rights reserved. (Last updated: 2016-03-14)

						Generated by appledoc 2.2 (build 963).


text:
require 'rails_helper'

RSpec.describe FoodDetail, :type => :model do
  pending "add some examples to (or delete) #{__FILE__}"
end


text:
@implementation SNUnreadCountResult

- (int)messageCount
{
    return self.comment + self.dm + self.mention_cmt + self.mention_status;
}

- (int)totalCount
{
    return self.messageCount + self.status + self.follower;
}
@end


text:
title: "Yevgeniy Brikman: Photos"
header_title: Photos
include_header: photos_header.html
nav_item: photos
---

{% include redirect.html url=site.nav.main.photos %}


text:
package vos;

import org.codehaus.jackson.annotate.JsonProperty;

public class VOReabastecimiento {

	@JsonProperty(value="usuarioRestaurante")
	private Usuario restaurante;
	@JsonProperty(value="restuaranteProducto")
	private RestauranteProducto restauranteProducto;

	public VOReabastecimiento(@JsonProperty(value="restuaranteProducto")RestauranteProducto restauranteProducto,@JsonProperty(value="usuarioRestaurante")Usuario usuario)
	{
		this.restaurante=usuario;
		this.restauranteProducto=restauranteProducto;
	}

	public Usuario getRestaurante() {
		return restaurante;
	}

	public void setRestaurante(Usuario restaurante) {
		this.restaurante = restaurante;
	}

	public RestauranteProducto getRestauranteProducto() {
		return restauranteProducto;
	}

	public void setRestauranteProducto(RestauranteProducto restauranteProducto) {
		this.restauranteProducto = restauranteProducto;
	}

}