text:
local gears = require("gears")
local awful = require("awful")
awful.rules = require("awful.rules")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
local vicious = require("vicious")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
local menubar = require("menubar")
-- Configuración
local config = require("config")

-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then
    naughty.notify({ preset = naughty.config.presets.critical,
                     title = "Oops, there were errors during startup!",
                     text = awesome.startup_errors })
end

-- Handle runtime errors after startup
do
    local in_error = false
    awesome.connect_signal("debug::error", function (err)
        -- Make sure we don't go into an endless error loop
        if in_error then return end
        in_error = true

        naughty.notify({ preset = naughty.config.presets.critical,
                         title = "Oops, an error happened!",
                         text = err })
        in_error = false
    end)
end
-- }}}

-- {{{ Variable definitions
-- Themes define colours, icons, font and wallpapers.
beautiful.init("~/.config/awesome/tema/theme.lua")

-- Programas utilizados
terminal = "xfce4-terminal"
editor = "nvim"
browser = "firefox"
file_mng = "thunar"
music_player = "spotify"

-- Default modkey.
modkey = "Mod4"

-- Table of layouts to cover with awful.layout.inc, order matters.
local layouts =
{
    awful.layout.suit.floating,
    awful.layout.suit.tile,
    awful.layout.suit.tile.left,
    awful.layout.suit.tile.bottom,
    awful.layout.suit.tile.top,
    awful.layout.suit.fair,
    awful.layout.suit.fair.horizontal,
    awful.layout.suit.spiral,
    awful.layout.suit.spiral.dwindle,
    awful.layout.suit.max,
    awful.layout.suit.max.fullscreen,
    awful.layout.suit.magnifier
}
-- }}}

-- {{{ Wallpaper
if beautiful.wallpaper then
    for s = 1, screen.count() do
        gears.wallpaper.maximized(beautiful.wallpaper, s, true)
    end
end
-- }}}

-- {{{ Tags
tags = {
    names  = {"www", "term", "tele", "steam", "media"},
    layout = {layouts[2], layouts[12], layouts[2], layouts[1], layouts[2]}
}
for s = 1, screen.count() do
    tags[s] = awful.tag(tags.names, s, tags.layout)
end
-- }}}

-- {{{ Iconos (excepto los de red, que se crean junto al widget)
icono_reloj = wibox.widget.imagebox()
icono_reloj:set_image(beautiful.icono_reloj)

icono_cpu = wibox.widget.imagebox()
icono_cpu:set_image(beautiful.icono_cpu)

icono_ram = wibox.widget.imagebox()
icono_ram:set_image(beautiful.icono_ram)

icono_sep = wibox.widget.imagebox()
icono_sep:set_image(beautiful.icono_sep)
-- }}}

-- {{{ Widgets
-- RELOJ
reloj = awful.widget.textclock()

-- USO DE PROCESADOR
widget_cpu = wibox.widget.textbox()
vicious.register(widget_cpu, vicious.widgets.cpu, " $1%")

-- Notificacion con mas datos
function notificar_cpu()
    nucleos = vicious.widgets.cpu()
    texto = "Todos los núcleos: " .. nucleos[1] .. "%\n"
    for i = 2, #nucleos do
        texto = texto .. "Núcleo " .. i-1 ..": " .. nucleos[i] .. "%"
        if i ~= #nucleos then
            texto = texto  .. "\n"
        end
    end
    notificacion_cpu = naughty.notify({text = texto, timeout = 0})
end
widget_cpu:connect_signal("mouse::enter", notificar_cpu)
widget_cpu:connect_signal("mouse::leave", function () naughty.destroy(notificacion_cpu) end)
icono_cpu:connect_signal("mouse::enter", notificar_cpu)
icono_cpu:connect_signal("mouse::leave", function () naughty.destroy(notificacion_cpu) end)

-- USO DE RAM
widget_ram = wibox.widget.textbox()
vicious.register(widget_ram, vicious.widgets.mem, " $1%")

-- Notificacion con mas datos
function notificar_ram()
    memoria = vicious.widgets.mem()
    texto = memoria[2] .. "MB/" .. memoria[3] .. "MB"
    notificacion_ram = naughty.notify({ text = texto, timeout = 0 })
end
widget_ram:connect_signal("mouse::enter", notificar_ram)
widget_ram:connect_signal("mouse::leave", function() naughty.destroy(notificacion_ram) end)
icono_ram:connect_signal("mouse::enter", notificar_ram)
icono_ram:connect_signal("mouse::leave", function() naughty.destroy(notificacion_ram) end)

-- USO DE RED
-- Red por ethernet
widget_cable = wibox.widget.textbox()
widget_cable:set_text("")
icono_cable = wibox.widget.imagebox()
icono_cable:set_image()

if config.cable == true then
    vicious.register(widget_cable, vicious.widgets.net, function (widget, args)
        if args["{eth0 carrier}"] == 1 then
            icono_cable:set_image(beautiful.icono_cable_1)
            return " " .. args["{eth0 down_kb}"] .. "KB/s"
        else
            icono_cable:set_image(beautiful.icono_cable_0)
            return ""
        end
    end, 1)
end

-- Red por Wi-Fi
widget_wifi = wibox.widget.textbox()
icono_wifi = wibox.widget.imagebox()

if config.wifi == true then
    vicious.register(icono_wifi, vicious.widgets.wifi, function (widget, args)
        if args["{linp}"] > 66 and args["{linp}"] <= 100 then
            widget:set_image(beautiful.icono_wifi_3)
        elseif args["{linp}"] > 33 and args["{linp}"] <= 66 then
            widget:set_image(beautiful.icono_wifi_2)
        elseif args["{linp}"] > 0 and args["{linp}"] <= 33 then
            widget:set_image(beautiful.icono_wifi_1)
        else
            widget:set_image(beautiful.icono_wifi_0)
        end
    end, 15, "wlan0")

    vicious.register(widget_wifi, vicious.widgets.net, function (widget, args)
        if args["{wlan0 carrier}"] == 1 then
            return " " .. args["{wlan0 down_kb}"] .. "KB/s"
        else
            icono_wifi:set_image(beautiful.icono_wifi_0)
            return ""
        end
    end, 1)
end

-- Al clicar se revisa si hay alguna nueva conexion
widget_cable:buttons(awful.util.table.join(awful.button({ }, 1, function () vicious.force({ widget_cable, widget_wifi, icono_wifi }) end)))
icono_cable:buttons(awful.util.table.join(awful.button({ }, 1, function () vicious.force({ widget_cable, widget_wifi, icono_wifi }) end)))
widget_wifi:buttons(awful.util.table.join(awful.button({ }, 1, function () vicious.force({ widget_cable, widget_wifi, icono_wifi }) end)))
icono_wifi:buttons(awful.util.table.join(awful.button({ }, 1, function () vicious.force({ widget_cable, widget_wifi, icono_wifi }) end)))

-- BATERÍA
icono_bat = wibox.widget.imagebox()
widget_bat = wibox.widget.textbox()

if config.bat == true then
    vicious.register(widget_bat, vicious.widgets.bat, function(widget, args)
        if args[2] > 75 and args[2] <= 100 then
            icono_bat:set_image(beautiful.icono_bat_4)
        elseif args[2] > 50 and args[2] <= 75 then
            icono_bat:set_image(beautiful.icono_bat_3)
        elseif args[2] > 25 and args[2] <= 50 then
            icono_bat:set_image(beautiful.icono_bat_2)
        elseif args[2] > 15 and args[2] <= 25 then
            icono_bat:set_image(beautiful.icono_bat_1)
        elseif args[2] >= 0 and args[2] <= 15 then
            icono_bat:set_image(beautiful.icono_bat_0)
        end

        if args[1] == "+" then
            return " +" .. args[2] .. "%"
        elseif args[1] == "-" then
            return " -" .. args[2] .. "% (" .. args[3] .. ")"
        else
            return " " .. args[2] .. "%"
        end
    end, 10, "BAT0")
end

-- VOLUMEN
icono_vol = wibox.widget.imagebox()
widget_vol = wibox.widget.textbox()

vicious.register(widget_vol, vicious.widgets.volume, function(widget, args)
    if args[1] > 66 and args[1] <= 100 then
        icono_vol:set_image(beautiful.icono_vol_3)
    elseif args[1] > 33 and args[1] <= 66 then
        icono_vol:set_image(beautiful.icono_vol_2)
    elseif args[1] > 0 and args[1] <= 33 then
        icono_vol:set_image(beautiful.icono_vol_1)
    end
    if args[2] == "♩" or args[1] == 0 then
        icono_vol:set_image(beautiful.icono_vol_0)
    end
    return " " .. args[1] .. "%"
end, 1, "Master")
-- }}}

-- {{{ Menu
-- Create a laucher widget and a main menu
menu_principal = awful.menu({ items = {
    {
        "sistema",
        {
            --{ "nvim" },
            --{ "firefox" },
            --{ "thunar" },
            --{ "htop" },
            --{ "nethogs" },
            { "apagar", terminal .. " -e apagar" },
            { "actualizar", terminal .. " -e actualizar" },
            { "reiniciar", terminal .. " -e 'sudo reboot'" },
            { "apagar rápido", terminal .. " -e 'sudo poweroff'" }
        }
    },
    {
        "awesome",
        {
            { "man", terminal .. " -e 'man awesome'" },
            { "editar configuración", terminal .. " -e '" .. editor .. " " .. awesome.conffile .. "'" },
            { "refrescar", awesome.restart },
            { "salir", awesome.quit }
        },
        beautiful.awesome_icon
    },
    {
        "open terminal", terminal
    },
}})

lanzador = awful.widget.launcher({
    image = beautiful.awesome_icon,
    menu = menu_principal
})

-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-- }}}

-- {{{ Wibox
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
                    awful.button({        }, 1, awful.tag.viewonly),
                    awful.button({ modkey }, 1, awful.client.movetotag),
                    awful.button({        }, 3, awful.tag.viewtoggle),
                    awful.button({ modkey }, 3, awful.client.toggletag),
                    awful.button({        }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
                    awful.button({        }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
                    )
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
                     awful.button({ }, 1, function (c)
                                              if c == client.focus then
                                                  c.minimized = true
                                              else
                                                  -- Without this, the following
                                                  -- :isvisible() makes no sense
                                                  c.minimized = false
                                                  if not c:isvisible() then
                                                      awful.tag.viewonly(c:tags()[1])
                                                  end
                                                  -- This will also un-minimize
                                                  -- the client, if needed
                                                  client.focus = c
                                                  c:raise()
                                              end
                                          end),
                     awful.button({ }, 3, function ()
                                              if instance then
                                                  instance:hide()
                                                  instance = nil
                                              else
                                                  instance = awful.menu.clients({
                                                      theme = { width = 250 }
                                                  })
                                              end
                                          end),
                     awful.button({ }, 4, function ()
                                              awful.client.focus.byidx(1)
                                              if client.focus then client.focus:raise() end
                                          end),
                     awful.button({ }, 5, function ()
                                              awful.client.focus.byidx(-1)
                                              if client.focus then client.focus:raise() end
                                          end))

for s = 1, screen.count() do
    -- Create a promptbox for each screen
    mypromptbox[s] = awful.widget.prompt()
    -- Create an imagebox widget which will contains an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    mylayoutbox[s] = awful.widget.layoutbox(s)
    mylayoutbox[s]:buttons(awful.util.table.join(
                           awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
                           awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
                           awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
                           awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
    -- Create a taglist widget
    mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)

    -- Create a tasklist widget
    mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)

    -- Create the wibox
    mywibox[s] = awful.wibox({ position = "top", screen = s })

    -- Widgets that are aligned to the left
    local left_layout = wibox.layout.fixed.horizontal()
    left_layout:add(lanzador)
    left_layout:add(mytaglist[s])
    left_layout:add(mypromptbox[s])

    -- Widgets that are aligned to the right
    local right_layout = wibox.layout.fixed.horizontal()
    if s == 1 then right_layout:add(wibox.widget.systray()) end
    right_layout:add(wibox.widget.textbox("  "))
    right_layout:add(icono_vol)
    right_layout:add(widget_vol)
    if config.bat == true then
        right_layout:add(icono_sep)
        right_layout:add(icono_bat)
        right_layout:add(widget_bat)
    end
    right_layout:add(icono_sep)
    right_layout:add(icono_wifi)
    right_layout:add(widget_wifi)
    right_layout:add(icono_cable)
    right_layout:add(widget_cable)
    right_layout:add(icono_sep)
    right_layout:add(icono_ram)
    right_layout:add(widget_ram)
    right_layout:add(icono_sep)
    right_layout:add(icono_cpu)
    right_layout:add(widget_cpu)
    right_layout:add(icono_sep)
    right_layout:add(icono_reloj)
    right_layout:add(reloj)
    right_layout:add(mylayoutbox[s])

    -- Now bring it all together (with the tasklist in the middle)
    local layout = wibox.layout.align.horizontal()
    layout:set_left(left_layout)
    layout:set_middle(mytasklist[s])
    layout:set_right(right_layout)

    mywibox[s]:set_widget(layout)
end
-- }}}

-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
    awful.button({ }, 3, function () menu_principal:toggle() end),
    awful.button({ }, 4, awful.tag.viewnext),
    awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}

-- {{{ Key bindings
globalkeys = awful.util.table.join(
    awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
    awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
    awful.key({ modkey,           }, "Escape", awful.tag.history.restore),

    awful.key({ modkey,           }, "j",
        function ()
            awful.client.focus.byidx( 1)
            if client.focus then client.focus:raise() end
        end),
    awful.key({ modkey,           }, "k",
        function ()
            awful.client.focus.byidx(-1)
            if client.focus then client.focus:raise() end
        end),
    awful.key({ modkey,           }, "w", function () menu_principal:show() end),

    -- Layout manipulation
    awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
    awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
    awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
    awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
    awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
    awful.key({ modkey,           }, "Tab",
        function ()
            awful.client.focus.history.previous()
            if client.focus then
                client.focus:raise()
            end
        end),

    -- Standard program
    awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
    awful.key({ modkey, "Control" }, "r", awesome.restart),
    awful.key({ modkey, "Shift"   }, "q", awesome.quit),

    awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
    awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
    awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
    awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
    awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
    awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
    awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
    awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),

    awful.key({ modkey, "Control" }, "n", awful.client.restore),

    -- Prompt
    awful.key({ modkey },            "r",     function () mypromptbox[mouse.screen]:run() end),

    awful.key({ modkey }, "x",
                function ()
                    awful.prompt.run(
                        { prompt = "Run Lua code: " },
                        mypromptbox[mouse.screen].widget,
                        awful.util.eval, nil,
                        awful.util.getdir("cache") .. "/history_eval"
                    )
              end),
    -- Menubar
    awful.key({ modkey }, "p", function() menubar.show() end),

    -- Propias
    awful.key({ }, "Print",                 function () awful.util.spawn("capant --noterm", false)                                                                                end),
    awful.key({ }, "XF86AudioMute",         function () awful.util.spawn("amixer -D pulse sset Master 1+ toggle")                                                                                end),
    awful.key({ }, "XF86AudioRaiseVolume",  function () awful.util.spawn("amixer -D pulse sset Master 5%+")                                                                                end),
    awful.key({ }, "XF86AudioLowerVolume",  function () awful.util.spawn("amixer -D pulse sset Master 5%-")                                                                                end),
    awful.key({ }, "XF86AudioNext",         function () awful.util.spawn("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next")        end),
    awful.key({ }, "XF86AudioPrev",         function () awful.util.spawn("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous")    end),
    awful.key({ }, "XF86AudioPlay",         function () awful.util.spawn("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause")   end),
    awful.key({ }, "XF86Tools",             function () awful.util.spawn("spotify")                                                                                end)
)

clientkeys = awful.util.table.join(
    awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
    awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
    awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
    awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
    awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
    awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end),
    awful.key({ modkey,           }, "n",
        function (c)
            -- The client currently has the input focus, so it cannot be
            -- minimized, since minimized clients can't have the focus.
            c.minimized = true
        end),
    awful.key({ modkey,           }, "m",
        function (c)
            c.maximized_horizontal = not c.maximized_horizontal
            c.maximized_vertical   = not c.maximized_vertical
        end)
)

-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, 9 do
    globalkeys = awful.util.table.join(globalkeys,
        -- View tag only.
        awful.key({ modkey }, "#" .. i + 9,
                  function ()
                        local screen = mouse.screen
                        local tag = awful.tag.gettags(screen)[i]
                        if tag then
                           awful.tag.viewonly(tag)
                        end
                  end),
        -- Toggle tag.
        awful.key({ modkey, "Control" }, "#" .. i + 9,
                  function ()
                      local screen = mouse.screen
                      local tag = awful.tag.gettags(screen)[i]
                      if tag then
                         awful.tag.viewtoggle(tag)
                      end
                  end),
        -- Move client to tag.
        awful.key({ modkey, "Shift" }, "#" .. i + 9,
                  function ()
                      if client.focus then
                          local tag = awful.tag.gettags(client.focus.screen)[i]
                          if tag then
                              awful.client.movetotag(tag)
                          end
                     end
                  end),
        -- Toggle tag.
        awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
                  function ()
                      if client.focus then
                          local tag = awful.tag.gettags(client.focus.screen)[i]
                          if tag then
                              awful.client.toggletag(tag)
                          end
                      end
                  end))
end

clientbuttons = awful.util.table.join(
    awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
    awful.button({ modkey }, 1, awful.mouse.client.move),
    awful.button({ modkey }, 3, awful.mouse.client.resize))

-- Set keys
root.keys(globalkeys)
-- }}}

-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
      properties = { border_width = beautiful.border_width,
                     border_color = beautiful.border_normal,
                     focus = awful.client.focus.filter,
                     raise = true,
                     keys = clientkeys,
                     buttons = clientbuttons } },
    { rule = { class = "pinentry" },
        properties = { floating = true } },
--  { rule = { name = "*nvim*" } },
--      properties = { icon = "" }
    { rule = { class = "Firefox" }, --except = { name = ".*Trello.*" },
        properties = { tag = tags[1][1] } },
--  { rule = { name = ".*Trello.*" },
--      properties = { tag = tags[1][2] } },
    { rule = { class = "Telegram" },
        properties = { tag = tags[1][3] } },
    { rule = { name = "htop" },
        properties = { tag = tags[1][4] } },
    { rule = { name = "ping" },
        properties = { tag = tags[1][4] } },
    { rule = { name = "nethogs" },
        properties = { tag = tags[1][4] } },
    { rule = { class = "Steam" },
        properties = { tag = tags[1][4] } },
    { rule = { class = "dota2" },
        properties = { tag = tags[1][4] } },
    { rule = { class = "Spotify" },
        properties = { tag = tags[1][5] } },
}
-- }}}

-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c, startup)
    -- Enable sloppy focus
    c:connect_signal("mouse::enter", function(c)
        if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
            and awful.client.focus.filter(c) then
            client.focus = c
        end
    end)

    if not startup then
        -- Set the windows at the slave,
        -- i.e. put it at the end of others instead of setting it master.
        -- awful.client.setslave(c)

        -- Put windows in a smart way, only if they does not set an initial position.
        if not c.size_hints.user_position and not c.size_hints.program_position then
            awful.placement.no_overlap(c)
            awful.placement.no_offscreen(c)
        end
    end

    local titlebars_enabled = false
    if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
        -- buttons for the titlebar
        local buttons = awful.util.table.join(
                awful.button({ }, 1, function()
                    client.focus = c
                    c:raise()
                    awful.mouse.client.move(c)
                end),
                awful.button({ }, 3, function()
                    client.focus = c
                    c:raise()
                    awful.mouse.client.resize(c)
                end)
                )

        -- Widgets that are aligned to the left
        local left_layout = wibox.layout.fixed.horizontal()
        left_layout:add(awful.titlebar.widget.iconwidget(c))
        left_layout:buttons(buttons)

        -- Widgets that are aligned to the right
        local right_layout = wibox.layout.fixed.horizontal()
        right_layout:add(awful.titlebar.widget.floatingbutton(c))
        right_layout:add(awful.titlebar.widget.maximizedbutton(c))
        right_layout:add(awful.titlebar.widget.stickybutton(c))
        right_layout:add(awful.titlebar.widget.ontopbutton(c))
        right_layout:add(awful.titlebar.widget.closebutton(c))

        -- The title goes in the middle
        local middle_layout = wibox.layout.flex.horizontal()
        local title = awful.titlebar.widget.titlewidget(c)
        title:set_align("center")
        middle_layout:add(title)
        middle_layout:buttons(buttons)

        -- Now bring it all together
        local layout = wibox.layout.align.horizontal()
        layout:set_left(left_layout)
        layout:set_right(right_layout)
        layout:set_middle(middle_layout)

        awful.titlebar(c):set_widget(layout)
    end
end)

client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}

-- {{{ Startup
function una_vez(prg, args, nombreprg, sudo, pantalla)
    if not prg then
        do return nil end
    end

    if not nombreprg then
       nombreprg = prg
    end

    if not sudo then
        if not args then
            awful.util.spawn_with_shell("pgrep -f -u $USER -x '" .. nombreprg .. "' || (" .. prg .. ")", pantalla)
        else
            awful.util.spawn_with_shell("pgrep -f -u $USER -x '" .. nombreprg .. "' || (" .. prg .. " " .. args .. ")", pantalla)
        end
    else
        if not args then
            awful.util.spawn_with_shell("pgrep -f -u root -x '" .. nombreprg .. "' || (" .. prg .. ")", pantalla)
        else
            awful.util.spawn_with_shell("pgrep -f -u root -x '" .. nombreprg .. "' || (" .. prg .. " " .. args .. ")", pantalla)
        end
    end
end

os.execute("setxkbmap es")
una_vez("firefox", nil, "/usr/lib/firefox/firefox")
una_vez("telegram", nil, "./.Telegram/Telegram")
una_vez("steam")
una_vez("spotify", nil, "/usr/share/spotify/spotify")

una_vez("descargar_fondo ; feh --bg-max .fondo.jpg")
-- }}}


text:
describe "tab bar functionality" do

  before do
    @app = TestDelegate.new

    @tab_0 = TabScreen.new
    @tab_1 = BasicScreen.new
    @tab_2 = HomeScreen.new
    @tab_3 = TestTableScreen.new

    @tab_bar = @app.open_tab_bar @tab_0, @tab_1, @tab_2, @tab_3
  end

  after do

  end

  it "should have created a tab bar with four items" do
    @tab_bar.should != nil
    @tab_bar.should.be.kind_of(UITabBarController)
    @tab_bar.viewControllers.length.should == 4
  end

  it "should have set a custom tab bar item" do
    @tab_bar.tabBar.items.first.title.should == "Tab Item"
  end

  it "should allow setting image insets" do
    @tab_bar.tabBar.items.first.imageInsets.should == UIEdgeInsetsMake(5,5,5,5)
  end

  it "should have set the others to their respective titles" do
    @tab_bar.tabBar.items[1].title.should == "Basic"
    @tab_bar.tabBar.items[2].title.should == "Home"
    @tab_bar.tabBar.items[3].title.should == "Test tab title"
  end

  it "should allow changing the tab bar item with set_tab_bar_item" do
    @tab_0.set_tab_bar_item title: "Custom", item: "test.jpeg"
    @tab_bar.tabBar.items.first.title.should == "Custom"
  end

  it "should allow replacing a view controller with `open`" do
    new_screen = BasicScreen.new
    @tab_3.open new_screen, in_tab: "Home"
    @tab_bar.viewControllers[2].should == new_screen
  end

  describe "changing tab bar orders" do
    before do
      # Reset the user defaults
      app_domain = NSBundle.mainBundle.bundleIdentifier
      NSUserDefaults.standardUserDefaults.removePersistentDomainForName(app_domain)
      NSUserDefaults.standardUserDefaults.synchronize

      @tab_0 = TabScreen.new
      @tab_1 = BasicScreen.new
      @tab_2 = HomeScreen.new
      @tab_3 = TestTableScreen.new
      @tab_4 = PresentScreen.new
      @tab_5 = TestWebScreen.new

      @tab_bar = @app.open_tab_bar @tab_0, @tab_1, @tab_2, @tab_3, @tab_4, @tab_5
    end

    it "should start without a name" do
      @tab_bar.name.should.be.nil
    end

    it "should set a name" do
      NSUserDefaults.standardUserDefaults.arrayForKey("tab_bar_order_test_tabs").should.be.nil
      @tab_bar.name = "test_tabs"
      @tab_bar.name.should == "test_tabs"
    end

    it "should not save the order when not changed" do
      NSUserDefaults.standardUserDefaults.arrayForKey("tab_bar_order_").should.be.nil
      @tab_bar.tabBarController(@tab_bar, didEndCustomizingViewControllers:@tab_bar.viewControllers, changed:false)
      NSUserDefaults.standardUserDefaults.arrayForKey("tab_bar_order_").should.be.nil
    end

    it "should save an order without a name" do
      @tab_bar.name = ""
      new_order = [@tab_5, @tab_1, @tab_2, @tab_3, @tab_4, @tab_0]
      NSUserDefaults.standardUserDefaults.arrayForKey("tab_bar_order_").should.be.nil
      @tab_bar.tabBarController(@tab_bar, didEndCustomizingViewControllers:new_order, changed:true)
      NSUserDefaults.standardUserDefaults.arrayForKey("tab_bar_order_").nil?.should == false
      NSUserDefaults.standardUserDefaults.arrayForKey("tab_bar_order_").should == [5, 1, 2, 3, 4, 0]
    end

    it "should save an order with a name" do
      new_name = "test_tab_bar"

      @tab_bar.name = new_name
      new_order = [@tab_5, @tab_4, @tab_3, @tab_2, @tab_1, @tab_0]
      NSUserDefaults.standardUserDefaults.arrayForKey("tab_bar_order_#{new_name}").should.be.nil
      @tab_bar.tabBarController(@tab_bar, didEndCustomizingViewControllers:new_order, changed:true)
      NSUserDefaults.standardUserDefaults.arrayForKey("tab_bar_order_#{new_name}").should == [5, 4, 3, 2, 1, 0]
    end

    it "should persist order when reopening the tabs" do
      @tab_bar.name = "test_tab_bar"
      new_order = [@tab_5, @tab_4, @tab_3, @tab_2, @tab_1, @tab_0]
      @tab_bar.tabBarController(@tab_bar, didEndCustomizingViewControllers:new_order, changed:true)

      new_tab_bar = @app.open_tab_bar @tab_0, @tab_1, @tab_2, @tab_3, @tab_4, @tab_5
      new_tab_bar.name = "test_tab_bar"
      new_tab_bar.viewControllers.should == new_order
    end

    it "should always select the leftmost tab when rearranging tabs" do
      new_order = [@tab_5, @tab_4, @tab_3, @tab_2, @tab_1, @tab_0]
      @tab_bar.tabBarController(@tab_bar, didEndCustomizingViewControllers:new_order, changed:true)
      new_tab_bar = @app.open_tab_bar @tab_0, @tab_1, @tab_2, @tab_3, @tab_4, @tab_5
      new_tab_bar.selectedIndex.should == 0
    end

  end

end

redpajama_set_name: RedPajamaGithub


text:
#include <aws/pinpoint-email/model/Body.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace PinpointEmail
{
namespace Model
{

Body::Body() :
    m_textHasBeenSet(false),
    m_htmlHasBeenSet(false)
{
}

Body::Body(JsonView jsonValue) :
    m_textHasBeenSet(false),
    m_htmlHasBeenSet(false)
{
  *this = jsonValue;
}

Body& Body::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("Text"))
  {
    m_text = jsonValue.GetObject("Text");

    m_textHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Html"))
  {
    m_html = jsonValue.GetObject("Html");

    m_htmlHasBeenSet = true;
  }

  return *this;
}

JsonValue Body::Jsonize() const
{
  JsonValue payload;

  if(m_textHasBeenSet)
  {
   payload.WithObject("Text", m_text.Jsonize());

  }

  if(m_htmlHasBeenSet)
  {
   payload.WithObject("Html", m_html.Jsonize());

  }

  return payload;
}

} // namespace Model
} // namespace PinpointEmail
} // namespace Aws


text:
from django.conf import settings
from django.utils import timezone

from ostinato.statemachine import State, StateMachine

DEFAULT_STATE = getattr(settings, 'OSTINATO_PAGES_DEFAULT_STATE', 'public')

class Private(State):
    verbose_name = 'Private'
    transitions = {'make_public': 'public'}

class Public(State):
    verbose_name = 'Public'
    transitions = {'make_private': 'private'}

class PageWorkflow(StateMachine):
    state_map = {'private': Private, 'public': Public}
    initial_state = DEFAULT_STATE

def get_workflow():
    """
    This is a helper function that returns the correct workflow to be used.
    A developer can change the default workflow behaviour using the
    ``OSTINATO_PAGES_WORKFLOW_CLASS`` setting.
    """
    custom_workflow = getattr(settings, 'OSTINATO_PAGES_WORKFLOW_CLASS', None)
    if custom_workflow:
        import_path, statemachine = custom_workflow.rsplit('.', 1)
        cl = __import__(import_path, locals(), globals(), [statemachine], -1)\
            .__dict__[statemachine]
        return cl
    else:
        return PageWorkflow


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2010-2017 Evolveum
  ~
  ~ 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 file is an example of Resource definition. It defines an DB Table resource
using an Identity Connector Framework DBTable connector.

-->

<objects xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
	xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
	xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
	xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
	xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3"
	xmlns:my="http://myself.me/schemas/whatever">

	<resource oid="ef2bc95b-76e0-48e2-86d6-3d4f02d3eeee">

    	<!-- Resource name. It will be displayed in GUI.  -->
		<name>Localhost DBTable</name>

     	<!-- Reference to the ICF DatabaseTable connector. OID is "virtual" for now. -->
		<connectorRef type="ConnectorType">
			<filter>
		        <q:equal>
				<q:path>c:connectorType</q:path>
		          <q:value>org.identityconnectors.databasetable.DatabaseTableConnector</q:value>
		        </q:equal>
		      </filter>
		</connectorRef>

        <!-- Configuration section contains configuration of the connector,
             such as hostnames and passwords -->
		<connectorConfiguration>

            <!-- Configuration specific for the DBTable connector -->
			<icfc:configurationProperties
			xmlns:icscdbtable="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/com.evolveum.polygon.connector-databasetable/org.identityconnectors.databasetable.DatabaseTableConnector">
				<icscdbtable:port>3306</icscdbtable:port>
				<icscdbtable:quoting></icscdbtable:quoting>
				<icscdbtable:host>localhost</icscdbtable:host>
				<icscdbtable:user>midpoint_tests</icscdbtable:user>
				<icscdbtable:password><clearValue>secret</clearValue></icscdbtable:password>
				<icscdbtable:database>midpoint_tests</icscdbtable:database>
				<icscdbtable:table>idrepo</icscdbtable:table>
				<icscdbtable:keyColumn>userId</icscdbtable:keyColumn>
				<icscdbtable:passwordColumn>password</icscdbtable:passwordColumn>
				<icscdbtable:jdbcDriver>com.mysql.jdbc.Driver</icscdbtable:jdbcDriver>
				<icscdbtable:jdbcUrlTemplate>jdbc:mysql://%h:%p/%d?useUnicode=true&characterEncoding=utf8&connectionCollation=utf8_bin</icscdbtable:jdbcUrlTemplate>
				<icscdbtable:enableEmptyString>false</icscdbtable:enableEmptyString>
				<icscdbtable:rethrowAllSQLExceptions>true</icscdbtable:rethrowAllSQLExceptions>
				<icscdbtable:nativeTimestamps>false</icscdbtable:nativeTimestamps>
				<icscdbtable:allNative>false</icscdbtable:allNative>
				<icscdbtable:changeLogColumn></icscdbtable:changeLogColumn>
				<icscdbtable:datasource></icscdbtable:datasource>
			</icfc:configurationProperties>

			<!-- Generic ICF configuration -->

		</connectorConfiguration>

        <!-- Resource Schema Handling definition.
             This part defines how the schema defined above will be used by
             midPoint. It defines expressions and limitations for individual
             schema attributes.

             The expressions that describe both inbound and outbound flow of
             the attributes are defined in this section.

             This is the part where most of the customization takes place.
        -->
		<schemaHandling>

            <!-- Definition of default account type.
                 This is now the only account type that midPoint can work with. -->
			<objectType>
                <!-- Readable name for the account type -->
				<displayName>Default Account</displayName>
				<default>true</default>

                <!-- Reference to the Resource Schema (see above) specifying
                     object class for this account type -->
				<objectClass>ri:AccountObjectClass</objectClass>
				<attribute>
					<ref>icfs:uid</ref>

                    <!-- Readable name for the attribute. This will be used in GUI -->
					<displayName>Entry UUID</displayName>

                    <!-- Access limitation for this attribute.
                         Entry UUID is created by the directory server itelf
                         and it is immutable. We can only read it. -->
					<limitations>
						<access>
							<read>true</read>
						</access>
					</limitations>
				</attribute>
				<attribute>
					<ref>icfs:name</ref>

                    <!-- Readable name for the attribute. This will be used in GUI -->
					<displayName>Name</displayName>

                    <!-- Access limitation for this attribute.
                          -->
					<limitations>
						<minOccurs>0</minOccurs>
						<access>
                            <read>true</read>
							<add>true</add>
							<modify>true</modify>
						</access>
					</limitations>
					<outbound>
						<source>
							<path>$user/name</path>
						</source>
					</outbound>
				</attribute>

				<attribute>
					<ref>ri:firstName</ref>
					<displayName>First name</displayName>
					<description>Definition of Firstname attribute handling.</description>
					<outbound>
						<source>
							<path>$user/givenName</path>
						</source>
					</outbound>

				</attribute>
				<attribute>
					<ref>ri:lastName</ref>
					<displayName>Last name</displayName>
					<description>Definition of Lastname attribute handling.</description>
					<outbound>
						<source>
							<path>$user/familyName</path>
						</source>
					</outbound>

				</attribute>
				<attribute>
					<ref>ri:fullName</ref>
					<displayName>Full name</displayName>
					<description>Definition of Fullname attribute handling.</description>
					<outbound>
						<source>
							<path>$user/fullName</path>
						</source>
					</outbound>
				</attribute>

				<activation>
					<administrativeStatus>
						<outbound/>
					</administrativeStatus>
				</activation>

				<credentials>
					<password>
						<outbound/>
					</password>
				</credentials>

			</objectType>
		</schemaHandling>
		<capabilities xmlns:cap="http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3">
			<configured>
				<cap:activation>
					<cap:status>
						<cap:attribute>ri:disabled</cap:attribute>
						<cap:enableValue></cap:enableValue>
						<cap:enableValue>false</cap:enableValue>
						<cap:disableValue>true</cap:disableValue>
					</cap:status>
				</cap:activation>
			</configured>
		</capabilities>

	</resource>

</objects>


text:
Remove session variables from the current session

## SYNTAX

```
Remove-GitHubSessionInformation [-WhatIf] [-Confirm]
```

## DESCRIPTION
Remove session variables from the current session

## EXAMPLES

### -------------------------- EXAMPLE 1 --------------------------
```
Remove-GitHubSessionInformation
```

## PARAMETERS

### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Confirm
Prompts you for confirmation before running the cmdlet.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

## INPUTS

### None

## OUTPUTS

### None

## NOTES

## RELATED LINKS


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System;
using System.Diagnostics;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.ExpressionEvaluator
{
    /// <summary>
    /// Module metadata block
    /// </summary>
    [DebuggerDisplay("{GetDebuggerDisplay(), nq}")]
    internal readonly struct MetadataBlock : IEquatable<MetadataBlock>
    {
        /// <summary>
        /// Module version id.
        /// </summary>
        internal readonly Guid ModuleVersionId;

        /// <summary>
        /// Module generation id.
        /// </summary>
        internal readonly Guid GenerationId;

        /// <summary>
        /// Pointer to memory block managed by the caller.
        /// </summary>
        internal readonly IntPtr Pointer;

        /// <summary>
        /// Size of memory block.
        /// </summary>
        internal readonly int Size;

        internal MetadataBlock(Guid moduleVersionId, Guid generationId, IntPtr pointer, int size)
        {
            ModuleVersionId = moduleVersionId;
            GenerationId = generationId;
            Pointer = pointer;
            Size = size;
        }

        public bool Equals(MetadataBlock other)
        {
            return Pointer == other.Pointer &&
                   Size == other.Size &&
                   ModuleVersionId == other.ModuleVersionId &&
                   GenerationId == other.GenerationId;
        }

        public override bool Equals(object obj)
        {
            if (!(obj is MetadataBlock))
            {
                return false;
            }
            return Equals((MetadataBlock)obj);
        }

        public override int GetHashCode()
        {
            return Hash.Combine(
                Hash.Combine(Pointer.GetHashCode(), Size),
                Hash.Combine(ModuleVersionId.GetHashCode(), GenerationId.GetHashCode()));
        }

        private string GetDebuggerDisplay()
        {
            return string.Format("MetadataBlock {{ Mvid = {{{0}}}, Address = {1}, Size = {2} }}", ModuleVersionId, Pointer, Size);
        }
    }
}


text:
package de.sebastian_daschner.todos.business.tasks.boundary;

import de.sebastian_daschner.todos.business.tasks.entity.Contexts;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.util.Objects;
import java.util.Set;

public class ContextsValidator implements ConstraintValidator<Contexts, Set<String>> {

    @Override
    public void initialize(Contexts constraintAnnotation) {
        // nothing to do
    }

    @Override
    public boolean isValid(Set<String> value, ConstraintValidatorContext context) {
        if (value != null) {
            return value.stream().allMatch(Objects::nonNull) && value.stream().allMatch(c -> c.matches("[a-z]+"));
        }
        return true;
    }
}


text:
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db.models.signals import post_save, pre_save, post_delete, pre_delete
from django.dispatch import receiver
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcuts import render, get_object_or_404, redirect
from django.utils.translation import ugettext as _


text:
<?php echo esc_html__( "Disable REST API", "disable-json-api" ); ?>

	<?php settings_errors( 'DRA-notices' ); ?>

<?php echo esc_html__( "By default, this plugin ensures that the entire REST API is protected from non-authenticated users. You may use this page to specify which endpoints should be allowed to behave as normal.", "disable-json-api" ); ?>

        <?php echo esc_html__( "IMPORTANT NOTE:", "disable-json-api" ); ?> <?php echo esc_html__( "Checking a box merely restores default functionality to an endpoint . Other authentication and/or permissions may still be required for access, or other themes / plugins may also affect access to those endpoints. ", "disable - json - api" ); ?>

    <form method="post" action="" id="DRA_form">
		<?php wp_nonce_field( 'DRA_admin_nonce' ); ?>

<?php DRA_display_route_checkboxes(); ?>

		<?php submit_button(); ?>
        <input type="submit" name="reset"
               value="<?php echo esc_attr__( "Reset Whitelisted Routes", "disable-json-api" ); ?>"
               onclick="return confirm('<?php echo esc_attr__( "Are you sure you wish to clear all whitelisted rules?", "disable-json-api" ); ?>');">
    </form>

<?php
/**
 * Loop through all routes returned by the REST API and display them on-screen
 *
 */
function DRA_display_route_checkboxes() {
	$wp_rest_server     = rest_get_server();
	$all_namespaces     = $wp_rest_server->get_namespaces();
	$all_routes         = array_keys( $wp_rest_server->get_routes() );
	$whitelisted_routes = is_array( get_option( 'DRA_route_whitelist' ) ) ? get_option( 'DRA_route_whitelist' ) : array();

	$loopCounter       = 0;
	$current_namespace = '';

	foreach ( $all_routes as $route ) {
		$is_route_namespace = in_array( ltrim( $route, "/" ), $all_namespaces );
		$checkedProp        = DRA_get_route_checked_prop( $route, $whitelisted_routes );

		if ( $is_route_namespace || "/" == $route ) {
			$current_namespace = $route;
			if ( 0 != $loopCounter ) {
				echo "
";
			}

			$route_for_display = ( "/" == $route ) ? "/ " . esc_html__( "REST API ROOT", "disable-json-api" ) . "" : esc_html( $route );
			echo "
<input name='rest_routes[]' value='$route' type='checkbox' id='dra_namespace_$loopCounter' onclick='dra_namespace_click(\"$route\", $loopCounter)' $checkedProp> $route_for_display

";

			if ( "/" == $route ) {
				echo "
" . sprintf( esc_html__( "On this website, the REST API root is %s", "disable-json-api" ), "" . rest_url() . "" ) . "
";
			}

		} else {
			echo "
<input name='rest_routes[]' value='$route' type='checkbox' data-namespace='$current_namespace' $checkedProp> " . esc_html( $route ) . "
";
		}

		$loopCounter ++;
	}
	echo "
";
}

/**
 * During comparison, encode the route being requested in the same fashion that it's stored in the database option
 * Encoding during save happens in Disable_REST_API::maybe_process_settings_form()
 *
 * @param $route
 * @param $whitelisted_routes
 *
 * @return string
 */
function DRA_get_route_checked_prop( $route, $whitelisted_routes ) {
	$is_route_checked = in_array( esc_html( $route ), $whitelisted_routes, true );

	return checked( $is_route_checked, true, false );
}


text:
/**
 * control_descriptor_response_imp.cpp
 *
 * control descriptor response implementation
 */

#include <vector>
#include "control_descriptor_response_imp.h"
#include "util.h"

namespace avdecc_lib
{
control_descriptor_response_imp::control_descriptor_response_imp(const uint8_t * frame, size_t frame_len, ssize_t pos) : descriptor_response_base_imp(frame, frame_len, pos) {}

control_descriptor_response_imp::~control_descriptor_response_imp() {}

uint8_t * STDCALL control_descriptor_response_imp::object_name()
{
    return (uint8_t *)&buffer[position + JDKSAVDECC_DESCRIPTOR_CONTROL_OFFSET_OBJECT_NAME];
}

uint16_t STDCALL control_descriptor_response_imp::localized_description()
{
    return jdksavdecc_descriptor_control_get_localized_description(buffer, position);
}

uint32_t STDCALL control_descriptor_response_imp::block_latency()
{
    return jdksavdecc_descriptor_control_get_block_latency(buffer, position);
}

uint32_t STDCALL control_descriptor_response_imp::control_latency()
{
    return jdksavdecc_descriptor_control_get_control_latency(buffer, position);
}

uint16_t STDCALL control_descriptor_response_imp::control_domain()
{
    return jdksavdecc_descriptor_control_get_control_domain(buffer, position);
}

uint16_t STDCALL control_descriptor_response_imp::control_value_type()
{
    return jdksavdecc_descriptor_control_get_control_value_type(buffer, position);
}

uint64_t STDCALL control_descriptor_response_imp::control_type()
{
    uint64_t control_type;

    utility::convert_eui48_to_uint64(&buffer[position +
                                             JDKSAVDECC_DESCRIPTOR_CONTROL_OFFSET_CONTROL_TYPE],
                                     control_type);
    return control_type;
}

uint32_t STDCALL control_descriptor_response_imp::reset_time()
{
    return jdksavdecc_descriptor_control_get_reset_time(buffer, position);
}

uint16_t STDCALL control_descriptor_response_imp::values_offset()
{
    return jdksavdecc_descriptor_control_get_values_offset(buffer, position);
}

uint16_t STDCALL control_descriptor_response_imp::number_of_values()
{
    return jdksavdecc_descriptor_control_get_number_of_values(buffer, position);
}

uint16_t STDCALL control_descriptor_response_imp::signal_type()
{
    return jdksavdecc_descriptor_control_get_signal_type(buffer, position);
}

uint16_t STDCALL control_descriptor_response_imp::signal_index()
{
    return jdksavdecc_descriptor_control_get_signal_index(buffer, position);
}

uint16_t STDCALL control_descriptor_response_imp::signal_output()
{
    return jdksavdecc_descriptor_control_get_signal_output(buffer, position);
}
}


text:
#include <algorithm>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <utils.h>
#include "config.h"
#include "lynxbot.h"

static void remove_leading(std::string &s);
static bool blank(const std::string &s);

static struct setting settings[] = {
	{ "name", STRING, "The Twitch username of the bot", true },
	{ "channel", STRING, "Channel you want to join", true },
	{ "password", STRING, "Oauth token for bot's Twitch account", true },
	{ "twitchtok", STRING, "Authorization token for your Twitch account\n"
		"If UNSET, LynxBot will go through an interactive authorization"
		" setup when run\nIf NULL, LynxBot will not try to access your "
		"Twitch account", true },
	{ "enable_moderation", STRING, "Whether LynxBot should moderate "
		"your chat", true },
	{ "ban_urls", STRING, "Whether to ban URLs in chat\nIf true, all non-"
		"whitelisted URLs will be banned", true },
	{ "max_message_len", STRING, "Maximum permitted length of a message "
		"(in characters)", true },
	{ "max_pattern", STRING, "Maximum amount of times a pattern can be "
		"consecutively repeated in a message", true },
	{ "max_char", STRING, "Maximum amount a single character can be "
		"consecutively repeated in a message", true },
	{ "cap_len", STRING, "Minimum message length at which capital letters "
		"start getting moderated", true },
	{ "cap_ratio", STRING, "Maximum percentage of capital letters allowed "
		"in message", true },
	{ "whitelist", LIST, "if ban_urls is set to true, any website not on "
		"this list will be banned", true },
	{ "giveaway_active", STRING, "Whether giveaways are enabled or "
		"disabled", true },
	{ "image_giveaways", STRING, "Whether to generate images containing "
		"giveaway items rather than posting\nthem in plaintext "
		"(GNU/Linux systems only)", true },
	{ "follower_giveaway", STRING, "Whether follower giveaways are "
		"enabled", true },
	{ "follower_limit", STRING, "Number of followers required for "
		"giveaway", true },
	{ "timed_giveaway", STRING, "Whether timed giveaways are enabled",
		true },
	{ "time_interval", STRING, "Interval in minutes at which timed "
		"giveaways occur", true },
	{ "auto_disable", STRING, "If true, recurring messages will "
		"automatically be disabled when\nthe stream goes "
		"offline (and enabled when it comes on)", true },
	{ "recurring", OLIST, "List of all recurring messages\nEach recurring "
		"message has a period in mins and a message\nThe period must "
		"be a multiple of 5 and less than 60\nA maximum of 5 "
		"recurring messages are allowed", true },
	{ "familiarity_mode", STRING, "If set to true, chat messages starting "
		"with a ! will also be processed\nas commands in addition to "
		"those starting with a $", true },
	{ "url_titles", STRING, "Whether to post webpage titles when URLs are "
		"posted in chat", true },
	{ "submessage", STRING, "Message posted in chat when someone subscribes"
		" or resubscribes, respectively\nThe following format sequences"
		" are accepted:\n\t%c - channel name\n\t%m - number of months "
		"person has subscribed in a row\n\t%n - Twitch nickname of the "
		"person who subscribed\n\t%N - equivalent to \"@%n,\" i.e. "
		"\"@NICK,\"\n\t%% - a literal '%'", false },
	{ "resubmessage", STRING, "", true },
	{ "extra8ballresponses", LIST, "Additional responses for the 8ball "
		"command", false }
};

ConfigReader::ConfigReader(const char *path)
	: config_path(path)
{
}

bool ConfigReader::read()
{
	std::string buf, line, key, val, err;
	std::ifstream reader(config_path);
	uint16_t nline, nsettings;
	size_t ind, set;
	int8_t open;

	nsettings = sizeof(settings) / sizeof(settings[0]);
	nline = set = open = 0;
	while (std::getline(reader, line)) {
		++nline;
		/* remove commented sections of lines */
		if ((ind = line.find('#')) != std::string::npos
				&& line[ind - 1] != '\\')
			line = line.substr(0, ind);
		if (blank(line))
			continue;
		if (!open) {
			remove_leading(line);
			if ((ind = line.find('=')) == std::string::npos) {
				err = "unrecognized token -- ";
				for (ind = 0; !isspace(line[ind]); ++ind)
					err += line[ind];
				std::cerr << config_path << ": line " << nline <<
					": " << err << std::endl;
				return false;
			}
			key = line.substr(0, ind);
			while (isspace(key.back()))
				key.pop_back();
			for (set = 0; set < nsettings; ++set) {
				if (key == settings[set].key)
					break;
			}
			if (set == nsettings) {
				std::cerr << config_path << ": line " << nline
					<< ": unrecognized key -- " << key
					<< std::endl;
				return false;
			}
		}
		if (settings[set].val_type == STRING) {
			if ((val = parse_string(line)).empty()) {
				std::cerr << config_path << ": line " << nline <<
					": no setting provided for " << key
					<< std::endl;
				return false;
			}
			setmap[key] = val;
		} else {
			/* reading a list within a brace block */
			ind = -1;
			while ((ind = line.find('{', ind + 1)) != std::string::npos)
				++open;
			if (open) {
				remove_leading(line);
				buf += line + '\n';
				ind = -1;
				while ((ind = line.find('}', ind + 1))
						!= std::string::npos)
					--open;
			}
			if (!open) {
				if ((val = parse_string(buf)).empty()) {
					std::cerr << config_path << ": line "
						<< nline << ": no setting "
						"provided for " << key
						<< std::endl;
					return false;
				}
				if (settings[set].val_type == LIST)
					val = parse_list(val, err);
				else
					val = parse_olist(key, val, err);
				if (val.empty()) {
					std::cerr << config_path << ": line "
						<< nline << ": " << err
						<< std::endl;
					return false;
				}
				setmap[key] = val;
				buf = "";
			}
		}
	}
	if (open) {
		std::cerr << config_path << ": unexpected end of file" << std::endl;
		return false;
	}
	for (set = 0; set < nsettings; ++set) {
		if (setmap.find(settings[set].key) == setmap.end()) {
			std::cerr << config_path << ": missing required setting: "
				<< settings[set].key << std::endl;
			return false;
		}
	}
	return true;
}

/* write: write stored settings to file */
void ConfigReader::write()
{
	time_t t;
	std::tm tm;
	size_t set, nsettings;

	nsettings = sizeof(settings) / sizeof(settings[0]);
	t = time(nullptr);
	tm = *localtime(&t);
	std::ofstream writer(config_path);

	/* header */
	writer << "# LynxBot configfile" << std::endl;
	writer << "# File automatically generated by LynxBot at "
		<< std::put_time(&tm, "%R %a %d/%m/%Y") << std::endl;
	writer << "# Please see " << BOT_WEBSITE << "/manual/config.html"
		<< std::endl << "# for complete reference" << std::endl;

	/* general settings */
	writer << std::endl << "#### General Settings ####" << std::endl
		<< std::endl;
	for (set = 0; set < 4; ++set)
		write_setting(writer, set);

	/* moderation settings */
	writer << std::endl << "#### Moderation Settings ####" << std::endl
		<< std::endl;
	for (; set < 11; ++set)
		write_setting(writer, set);

	/* whitelist */
	writer << std::endl << "#### Whitelisted websites ####" << std::endl
		<< std::endl;
	write_setting(writer, set++);

	/* giveaway settings */
	writer << std::endl << "#### Giveaway settings ####" << std::endl
		<< std::endl;
	for (; set < 18; ++set)
		write_setting(writer, set);

	/* recurring */
	writer << std::endl << "#### Recurring messages ####" << std::endl
		<< std::endl;
	write_setting(writer, set++);
	write_setting(writer, set++);

	/* other */
	writer << std::endl << "#### Other settings ####" << std::endl
		<< std::endl;
	for (; set < nsettings; ++set)
		write_setting(writer, set);
}

std::string ConfigReader::get(const std::string &key)
{
	return setmap[key];
}

void ConfigReader::set(const std::string &key, const std::string &val)
{
	setmap[key] = val;
}

const char *ConfigReader::path()
{
	return config_path;
}

std::unordered_map<std::string, std::vector<std::unordered_map<
	std::string, std::string>>> &ConfigReader::olist()
{
	return olistmap;
}

std::string ConfigReader::parse_string(const std::string &buf)
{
	std::string val = buf.substr(buf.find('=') + 1);
	remove_leading(val);
	return val;
}

std::string ConfigReader::parse_list(const std::string &buf, std::string &err)
{
	std::string out, s, val;
	size_t ind, nl;

	/* remove surrounding braces */
	s = buf.substr(1);
	while (isspace(s.back()) || s.back() == '}')
		s.pop_back();

	ind = 0;
	while (ind != std::string::npos) {
		remove_leading(s);
		if ((ind = s.find(',')) == std::string::npos) {
			val = s;
		} else {
			val = s.substr(0, ind);
			if (ind == s.length() - 1) {
				err = "expected item after comma";
				return "";
			}
		}
		if ((nl = val.find('\n')) != std::string::npos) {
			err = "unexpected list continuation after ";
			err += val.substr(0, nl);
			return "";
		}
		out += val;
		if (ind != std::string::npos)
			out += '\n';
		s = s.substr(ind + 1);
	}
	return out;
}

std::string ConfigReader::parse_olist(const std::string &key,
		const std::string &buf, std::string &err)
{
	std::string s, item;
	size_t end;

	s = buf.substr(1);
	while (s.back() != '}')
		s.pop_back();
	s.pop_back();
	while (isspace(s.back()))
		s.pop_back();

	end = 0;
	while (end != std::string::npos) {
		remove_leading(s);
		if ((end = s.find('}')) != std::string::npos) {
			item = s.substr(0, end + 1);
			if (!parse_obj(key, item, err))
				return "";
			s = s.substr(end + 1);
			remove_leading(s);
			if (s[0] == ',') {
				s = s.substr(1);
				if (s.find('{') == std::string::npos) {
					err = "expected item after comma";
					return "";
				}
			} else if (s.find('{') != std::string::npos) {
				err = "unexpected list continuation";
				return "";
			}
		}
	}

	return "olist";
}

bool ConfigReader::parse_obj(const std::string &key, std::string &obj,
		std::string &err)
{
	std::vector<std::string> items;
	std::string okey, oval;
	std::unordered_map<std::string, std::string> map;
	size_t ind;

	/* remove surrounding braces and whitespace */
	obj = obj.substr(1);
	remove_leading(obj);
	while (obj.back() != '}')
		obj.pop_back();
	obj.pop_back();
	while (isspace(obj.back()))
		obj.pop_back();

	utils::split(obj, '\n', items);

	for (std::string s : items) {
		if ((ind = s.find('=')) == std::string::npos) {
			err = "unrecognized token in list -- ";
			for (ind = 0; !isspace(s[ind]); ++ind)
				err += s[ind];
			return false;
		}
		okey = s.substr(0, ind);
		while (isspace(okey.back()))
			okey.pop_back();
		oval = parse_string(s);
		map[okey] = oval;
	}
	olistmap[key].emplace_back(map);
	return true;
}

/* write_setting: write the setting specified by ind to writer */
void ConfigReader::write_setting(std::ofstream &writer, size_t ind)
{
	std::vector<std::string> list_elems;
	size_t i;

	if (!settings[ind].comment.empty()) {
		writer << "# ";
		for (char c : settings[ind].comment) {
			if (c == '\n')
				writer << std::endl << "# ";
			else
				writer << c;
		}
		writer << std::endl;
	}

	if (settings[ind].val_type == STRING) {
		writer << settings[ind].key << " = "
			<< setmap[settings[ind].key] << std::endl;
	} else if (settings[ind].val_type == LIST) {
		utils::split(setmap[settings[ind].key], '\n', list_elems);
		writer << settings[ind].key << " = {" << std::endl;
		for (i = 0; i < list_elems.size(); ++i)
			writer << '\t' << list_elems[i]
				<< (i == list_elems.size() - 1 ? "" : ",")
				<< std::endl;
		writer << '}' << std::endl;
	} else {
		writer << settings[ind].key << " = {" << std::endl;
		for (i = 0; i < olistmap[settings[ind].key].size(); ++i) {
			auto map = olistmap[settings[ind].key][i];
			writer << "\t{" << std::endl;
			for (auto p : map)
				writer << "\t\t" << p.first << " = " << p.second
					<< std::endl;
			writer << "\t}";
			if (i != olistmap[settings[ind].key].size() - 1)
				writer << ',';
			writer << std::endl;
		}
		writer << '}' << std::endl;
	}
	if (settings[ind].blank)
		writer << std::endl;
}

/* remove_leading: remove all leading whitespace from string */
static void remove_leading(std::string &s)
{
	size_t ind = 0;
	while (ind < s.length() && isspace(s[ind]))
		++ind;
	s = s.substr(ind);
}

/* blank: return true if line is empty or only contains whitespace */
static bool blank(const std::string &s)
{
	for (char c : s) {
		if (!isspace(c))
			return false;
	}
	return true;
}


text:
<?php
/**
 * User: Zachary Tong
 * Date: 2013-02-19
 * Time: 08:26 PM
 * Auto-generated by "generate.filters.php"
 * @package Sherlock\components\filters
 */
namespace Sherlock\components\filters;

use Sherlock\components;

/**
 * @method \Sherlock\components\filters\Terms field() field(\string $value)
 * @method \Sherlock\components\filters\Terms execution() execution(\string $value) Default: "plain"
 * @method \Sherlock\components\filters\Terms _cache() _cache(\bool $value) Default: true

 */
class Terms extends \Sherlock\components\BaseComponent implements \Sherlock\components\FilterInterface
{
    public function __construct($hashMap = null)
    {
        $this->params['execution'] = "plain";
        $this->params['_cache']    = true;

        parent::__construct($hashMap);
    }

    /**
     * @param  \string | array $terms,...
     *
     * @return Terms
     */
    public function terms($terms)
    {

        $args = func_get_args();

        //single param, array of filters
        if (count($args) == 1 && is_array($args[0])) {
            $args = $args[0];
        }

        foreach ($args as $arg) {
            if (is_string($arg)) {
                $this->params['terms'][] = $arg;
            }
        }

        return $this;
    }

    public function toArray()
    {
        $ret = array(
            'terms' =>
            array(
                $this->params["field"] => $this->params["terms"],
                'execution'            => $this->params["execution"],
                '_cache'               => $this->params["_cache"],
            ),
        );

        return $ret;
    }

}


text:
#ifndef _SYS_IMGACT_H_
#define	_SYS_IMGACT_H_

struct image_params {
	struct proc *proc;	/* our process struct */
	struct execve_args *uap; /* syscall arguments */
	struct vnode *vp;	/* pointer to vnode of file to exec */
	struct vattr *attr;	/* attributes of file */
	const char *image_header; /* head of file to exec */
	char *stringbase;	/* base address of tmp string storage */
	char *stringp;		/* current 'end' pointer of tmp strings */
	int stringspace;	/* space left in tmp string storage area */
	int argc, envc;		/* count of argument and environment strings */
	char *argv0;		/* Replacement for argv[0] when interpreting */
	unsigned long entry_addr; /* entry address of target executable */
	char vmspace_destroyed;	/* flag - we've blown away original vm space */
	char interpreted;	/* flag - this executable is interpreted */
	char interpreter_name[64]; /* name of the interpreter */
	void *auxargs;		/* ELF Auxinfo structure pointer */
};

#ifdef KERNEL
int	exec_extract_strings __P((struct image_params *));
int	exec_new_vmspace __P((struct image_params *));
#endif

#endif /* !_SYS_IMGACT_H_ */


text:
AFRAME.registerComponent('box-test', {
  schema: {
    size: { type: 'vec3', default: { x: 1, y: 1.8, z: 1 } },
  },

  /**
   * Init handler. Similar to attachedCallback.
   * Called during component initialization and is only run once.
   * Components can use this to set initial state.
   */
  init() {
    this.center = new THREE.Vector3();

    // Create our new Box3
    const box = new THREE.Box3();
    this.box = box;

    // Create a helper to help visualize the box.
    const helper = this.helper = new THREE.Box3Helper(box, 0xFF851B);
    this.el.sceneEl.object3D.add(helper);
  },

  /**
   * Tick handler.
   * Called on each tick of the scene render loop.
   * Affected by play and pause.
   *
   * @param {number} time - Scene tick time.
   * @param {number} timeDelta - Difference in current render time and previous render time.
   */
  tick() {
    const mesh = this.el.getObject3D('mesh');
    if (!mesh) { return; }
    const { box } = this;

    // Update the Box to match position/size/rotation
    box.copy(mesh.geometry.boundingBox).applyMatrix4(mesh.matrixWorld);

    // Update the size to match the schema, keeping the center.
    const { center } = this;
    const { size } = this.data;
    box.getCenter(center);
    box.setFromCenterAndSize(center, size);
  },
});


text:
This library allows you to efficiently stream large amounts of data to AWS S3 in Java without having to store the whole object in memory or use files. The S3 API requires that a content
length be set before starting uploading, which is a problem when you want to calculate a large amount of data on the fly.
The standard Java AWS SDK will simply buffer all the data in memory so that it can calculate the length, which consumes
RAM and delays the upload. You can write the data to a temporary file but disk IO is slow (if your data is already in a file, using this library is pointless). This library provides
an `OutputStream` that packages data written to it into chunks which are sent in a multipart upload. You can also use
several streams and upload the data in parallel.

The entrypoint is the class `StreamTransferManager`. Read more in the
[javadoc](http://alexmojaki.github.io/s3-stream-upload/javadoc/apidocs/alex/mojaki/s3upload/StreamTransferManager.html),
including a usage example.

This is available from [maven central](https://mvnrepository.com/artifact/com.github.alexmojaki/s3-stream-upload/latest).

## Changelog

### 2.2.4

- [Abort multipart upload when content is empty](https://github.com/alexmojaki/s3-stream-upload/pull/41) thanks to @kcalcagno

### 2.2.3

- [Use String.valueOf to protect against null uploadId in toString](https://github.com/alexmojaki/s3-stream-upload/pull/38) thanks to @kcalcagno

### 2.2.2

- [Sort PartETag list to avoid an InvalidPartOrder error on complete (#34)](https://github.com/alexmojaki/s3-stream-upload/pull/34) thanks to @dana-katzenelson-livongo

### 2.2.1

- Exceptions during upload lead to an exception in writers instead of them getting stuck trying to put on the queue.
- Bump `aws-java-sdk` and `slf4j-api` dependency versions.

### 2.2.0

- [Add `checkIntegrity()` method](https://github.com/alexmojaki/s3-stream-upload/pull/26) thanks
to **@gkolakowski-ias**. This allows verifying the upload with MD5 hashes.

### 2.1.0

- Support uploading empty objects. In this case the user may want to override `customisePutEmptyObjectRequest`.
- Bump `aws-java-sdk` and `slf4j-api` dependency versions.

### 2.0.3

- Bump `aws-java-sdk` dependency version

### 2.0.2

- Avoid race condition in big uploads causing some parts to be missing from final completed upload.

### 2.0.1

- Allow thrown `Error`s (e.g. OOM) to bubble up unchanged.

### 2.0.0

- The `checkSize()` method is now private as the user no longer needs to call it. You can remove all calls to it.
- The constructor from version 1 is now deprecated. Instead you should call the 3 parameter constructor which has the essentials, and optionally chain the desired builder style setters to configure.


text:
Which of the following statements are true about choosing and using a shard key?

* You can change the shard key on a collection if you desire.
* The shard key must be unique
* Any update that does not contain the shard key will be sent to all shards.
* MongoDB can not enforce unique indexes on a sharded collection other than the shard key itself, or indexes prefixed by the shard key.
* There must be a index on the collection that starts with the shard key.

### Answers
* Any update that does not contain the shard key will be sent to all shards.
* MongoDB can not enforce unique indexes on a sharded collection other than the shard key itself, or indexes prefixed by the shard key.
* There must be a index on the collection that starts with the shard key.


text:
#ifndef __vtkVgModelBase_h
#define __vtkVgModelBase_h

// VTK includes.
#include <vtkObject.h>
#include <vtkSmartPointer.h>

// VG includes.
#include <vtkVgMacros.h>
#include "vtkVgTimeStamp.h"

#include <vgExport.h>

// Forward declarations.
class vtkMatrix4x4;
class vtkVgContourOperatorManager;
class vtkVgTemporalFilters;

class VTKVG_MODELVIEW_EXPORT vtkVgModelBase : public vtkObject
{
public:
  vtkVgClassMacro(vtkVgModelBase);

  // Description:
  // Usual VTK functions.
  vtkTypeMacro(vtkVgModelBase, vtkObject);

  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  vtkSetMacro(Id, vtkIdType);
  vtkGetMacro(Id, vtkIdType);

  // Description:
  vtkSetMacro(UseInternalTimeStamp, int);
  vtkGetMacro(UseInternalTimeStamp, int);
  vtkBooleanMacro(UseInternalTimeStamp, int);

  // Description:
  // This is model specific matrix. This could be anything, a matrix
  // that puts the  model in world space or a homography matrix.
  void SetModelMatrix(vtkMatrix4x4* matrix);
  const vtkMatrix4x4* GetModelMatrix() const;
  vtkMatrix4x4* GetModelMatrix();

  // Description:
  // Return the MTime for the UpdateDataRequest of the model
  unsigned long GetUpdateDataRequestTime()
    {
    return this->UpdateDataRequestTime.GetMTime();
    }

  virtual int Update(
    const vtkVgTimeStamp& vtkNotUsed(timeStamp),
    const vtkVgTimeStamp* vtkNotUsed(referenceFrameTimeStamp))
    { return VTK_OK; }

  // Overloads required for Python wrapping, which does not support pointer to
  // vtkVgTimeStamp as a parameter type
  int Update(const vtkVgTimeStamp& timeStamp)
    { return this->Update(timeStamp, 0); }
  int Update(const vtkVgTimeStamp& timeStamp,
             const vtkVgTimeStamp& referenceFrameTimeStamp)
    { return this->Update(timeStamp, &referenceFrameTimeStamp); }

  // Description:
  // Return current time stamp.
  const vtkVgTimeStamp& GetCurrentTimeStamp() const
    {
    return this->CurrentTimeStamp;
    }

  // Description:
  // Return the MTime for the last Update (that did something).
  virtual unsigned long GetUpdateTime() = 0;

  // Set/Get the manager for filters and selectors
  void SetContourOperatorManager(vtkVgContourOperatorManager* manager);
  vtkGetObjectMacro(ContourOperatorManager, vtkVgContourOperatorManager);

  // Set/Get the manager for temporal filters
  void SetTemporalFilters(vtkVgTemporalFilters* temporalFilters);
  vtkGetObjectMacro(TemporalFilters, vtkVgTemporalFilters);

protected:
  vtkVgModelBase();
  virtual ~vtkVgModelBase();

  // Description:
  // Set/Get flag if the model is initialized
  vtkSetMacro(Initialized, int);
  vtkGetMacro(Initialized, int)
  vtkBooleanMacro(Initialized, int);

// Description:
  vtkIdType                      Id;

// Description:
// The MTime of an update data request
  vtkTimeStamp                   UpdateDataRequestTime;

// Description:
// Flag to allow model to use its internal timestamp.
  int                            UseInternalTimeStamp;

  int                            Initialized;

  vtkSmartPointer<vtkMatrix4x4>  ModelMatrix;

// Description:
// The Current timestamp
  vtkVgTimeStamp                 CurrentTimeStamp;

  vtkVgContourOperatorManager*   ContourOperatorManager;
  vtkVgTemporalFilters* TemporalFilters;

private:
  vtkVgModelBase(const vtkVgModelBase&);    // Not implemented.
  void operator= (const vtkVgModelBase&);   // Not implemented.
};

#endif // __vtkVgModelBase_h


text:
package core.lsmo;

import java.io.IOException;
import java.util.Iterator;

import core.commom.MemoryPostingListIterUtil;
import core.lsmo.octree.IOctreeIterator;
import core.lsmo.octree.MemoryOctree;
import core.lsmo.octree.MemoryOctreeIterator;
import core.lsmt.IMemTable.SSTableMeta;
import core.lsmt.IPostingListIterator;
import core.lsmt.ISSTableReader;
import core.lsmt.ISSTableWriter.DirEntry;
import core.lsmt.WritableComparableKey;

public class MemorySSTableReader implements ISSTableReader {
	OctreeMemTable table;
	SSTableMeta meta;

	public MemorySSTableReader(OctreeMemTable table, SSTableMeta meta) {
		this.meta = meta;
		this.table = table;
	}

	@Override
	public IOctreeIterator getPostingListScanner(WritableComparableKey key) {
		return new MemoryOctreeIterator(table.get(key));
	}

	@Override
	public IPostingListIterator getPostingListIter(WritableComparableKey key, int start, int end) {
		MemoryOctree tree = table.get(key);
		MemoryOctreeIterator iter = new MemoryOctreeIterator(tree, start, end);
		return MemoryPostingListIterUtil.getPostingListIter(iter, start, end);
	}

	@Override
	public Iterator<WritableComparableKey> keySetIter() {
		return table.keySet().iterator();
	}

	@Override
	public void close() throws IOException {
	}

	@Override
	public SSTableMeta getMeta() {
		return meta;
	}

	@Override
	public boolean isInited() {
		return true;
	}

	@Override
	public void init() throws IOException {
	}

	@Override
	public DirEntry getDirEntry(WritableComparableKey key) {
		return null;
	}
}


text:
package solidbase.core.plugins;

import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import solidbase.core.Command;
import solidbase.core.CommandListener;
import solidbase.core.CommandProcessor;
import solidbase.core.FatalException;
import solidbase.core.SQLExecutionException;
import solidbase.core.SourceException;
import solidbase.core.SystemException;
import solidbase.util.Assert;
import solidbase.util.CloseQueue;
import solidbase.util.Counter;
import solidbase.util.FixedCounter;
import solidbase.util.JDBCSupport;
import solidbase.util.JSONArray;
import solidbase.util.JSONObject;
import solidbase.util.JSONReader;
import solidbase.util.SQLTokenizer;
import solidbase.util.SQLTokenizer.Token;
import solidbase.util.TimedCounter;
import solidstack.io.Resource;
import solidstack.io.SegmentedInputStream;
import solidstack.io.SegmentedReader;
import solidstack.io.SourceReader;
import solidstack.io.SourceReaders;
import solidstack.lang.ThreadInterrupted;
import solidstack.script.java.DefaultClassExtensions;

public class LoadJSON implements CommandListener
{
	static private final Pattern triggerPattern = Pattern.compile( "\\s*LOAD\\s+JSON\\s+.*", Pattern.DOTALL | Pattern.CASE_INSENSITIVE );

	static private final Pattern parameterPattern = Pattern.compile( ":(\\d+)" );

	//@Override
	public boolean execute( CommandProcessor processor, Command command, boolean skip ) throws SQLException
	{
		if( command.isTransient() )
			return false;

		Matcher matcher = triggerPattern.matcher( command.getCommand() );
		if( !matcher.matches() )
			return false;

		if( skip )
			return true;

		// Parse the command
		Parsed parsed = parse( command );

		// Open the file resource
		Resource resource = processor.getResource().resolve( parsed.fileName );
		resource.setGZip( parsed.gzip );
		SourceReader sourceReader;
		try
		{
			// TODO Use the same charset detection as JSON does. Maybe introduce the UTF charset if the default does not become UTF.
			sourceReader = SourceReaders.forResource( resource, "UTF-8" );
		}
		catch( FileNotFoundException e )
		{
			throw new FatalException( e.toString() );
		}

		// Create a JSON reader
		JSONReader reader = new JSONReader( sourceReader );
		try
		{
			// Read the header
			JSONObject properties = (JSONObject)reader.read();

			// The default binary file
			String binaryFile = properties.findString( "binaryFile" );

			// The fields
			JSONArray fields = properties.getArray( "fields" );
			int fieldCount = fields.size();

			// Initialise the working arrays
			int[] types = new int[ fieldCount ];
			String[] fileNames = new String[ fieldCount ];
			SegmentedInputStream[] streams = new SegmentedInputStream[ fieldCount ];
			SegmentedReader[] textStreams = new SegmentedReader[ fieldCount ];

			for( int i = 0; i < fieldCount; i++ )
			{
				JSONObject field = (JSONObject)fields.get( i );
				types[ i ] = JDBCSupport.fromTypeName( field.getString( "type" ) );
				fileNames[ i ] = field.findString( "file" );
			}

			boolean prependLineNumber = parsed.prependLineNumber;

			// Create the INSERT statement
			StringBuilder sql = new StringBuilder( "INSERT INTO " );
			sql.append( parsed.tableName ); // TODO Where else do we need the quotes?
			if( parsed.columns != null )
				DefaultClassExtensions.addString( parsed.columns, sql, " (", ",", ")" );
			List< Integer > parameterMap = new ArrayList< Integer >();
			if( parsed.values != null )
			{
				int len = parsed.values.length;
				String[] values = new String[ len ];
				for( int i = 0; i < len; i++ )
					values[ i ] = translateArgument( parsed.values[ i ], parameterMap );
				DefaultClassExtensions.addString( values, sql, " VALUES (", ",", ")" );
			}
			else
			{
				int count = types.length;
				if( parsed.columns != null )
					count = parsed.columns.length;
				if( prependLineNumber )
					count++;
				int par = 1;
				sql.append( " VALUES (?" );
				parameterMap.add( par++ );
				while( par <= count )
				{
					sql.append( ",?" );
					parameterMap.add( par++ );
				}
				sql.append( ')' );
			}

			// Create the log counter
			Counter counter = null;
			if( parsed.logRecords > 0 )
				counter = new FixedCounter( parsed.logRecords );
			else if( parsed.logSeconds > 0 )
				counter = new TimedCounter( parsed.logSeconds );

			// Prepare the INSERT statement
			PreparedStatement statement = processor.prepareStatement( sql.toString() );

			// Queues the will remember the files we need to close
			CloseQueue outerCloser = new CloseQueue();
			CloseQueue closer = new CloseQueue();

			boolean commit = false; // boolean to see if we reached the end
			try
			{
				int batchSize = 0;
				while( true )
				{
					// Detect interruption
					if( Thread.currentThread().isInterrupted() ) // TODO Is this the right spot during an upgrade?
						throw new ThreadInterrupted();

					// Read a record
					JSONArray values = (JSONArray)reader.read();
					if( values == null )
					{
						// End of file, finalize things
						Assert.isTrue( reader.isEOF() );
						if( batchSize > 0 )
							statement.executeBatch();

						if( counter != null && counter.needFinal() )
							processor.getProgressListener().println( "Imported " + counter.total() + " records." );

						commit = true;
						return true;
					}

					int lineNumber = reader.getLineNumber();

					// Convert the strings to date, time and timestamps
					// TODO Time zones, is there a default way of putting times and dates in a text file? For example whats in a HTTP header?
					int i = 0;
					for( ListIterator< Object > it = values.iterator(); it.hasNext(); )
					{
						Object value = it.next();
						if( value != null )
						{
							if( types[ i ] == Types.DATE )
								it.set( java.sql.Date.valueOf( (String)value ) );
							else if( types[ i ] == Types.TIMESTAMP )
								it.set( java.sql.Timestamp.valueOf( (String)value ) );
							else if( types[ i ] == Types.TIME )
								it.set( java.sql.Time.valueOf( (String)value ) );
						}
						i++;
					}

					// Set the statement parameters
					int pos = 1;
					for( int par : parameterMap )
					{
						if( par == 1 && prependLineNumber )
							statement.setInt( pos++, lineNumber );
						else
						{
							int index = par - ( prependLineNumber ? 2 : 1 );
							int type = types[ index ];
							Object value;
							try
							{
								value = values.get( index );
							}
							catch( ArrayIndexOutOfBoundsException e )
							{
								throw new SourceException( "Value with index " + ( index + 1 ) + " does not exist, record has only " + values.size() + " values", reader.getLocation() );
							}
							if( value instanceof JSONObject )
							{
								// Value of parameter is in a separate file
								JSONObject object = (JSONObject)value;
								String filename = object.findString( "file" );
								if( filename != null )
								{
									// One file per record
									if( type == Types.BLOB || type == Types.VARBINARY )
									{
										try
										{
											// TODO Fix the input stream size given the size in the JSON file
											Resource r = resource.resolve( filename );
											BigDecimal filesize = object.findNumber( "size" );
											if( filesize == null || filesize.intValue() > 10240 ) // TODO Whats a good size here? Should it be a long?
											{
												// Some databases read the stream directly (Oracle), others read it later (HSQLDB).
												// TODO Do we need to decrease the batch size when files are being kept open?
												// TODO We could detect that the database has read the stream already, and close the file
												InputStream in = r.newInputStream();
												statement.setBinaryStream( pos++, in );
												closer.add( in );
											}
											else
												statement.setBytes( pos++, readBytes( r ) ); // TODO Do a speed test
										}
										catch( FileNotFoundException e )
										{
											throw new SourceException( e.getMessage(), reader.getLocation() );
										}
									}
									else
										Assert.fail( "Unexpected field type for external file: " + JDBCSupport.toTypeName( type ) );
								}
								else
								{
									// One file for all records
									BigDecimal lobIndex = object.getNumber( "index" ); // TODO Use findNumber
									if( lobIndex == null )
										throw new SourceException( "Expected a 'file' or 'index' attribute", reader.getLocation() );
									BigDecimal lobLength = object.getNumber( "length" );
									if( lobLength == null )
										throw new SourceException( "Expected a 'length' attribute", reader.getLocation() );

									if( type == Types.BLOB || type == Types.VARBINARY )
									{
										// Get the input stream
										SegmentedInputStream in = streams[ index ];
										if( in == null )
										{
											// File not opened yet, open it
											String fileName = fileNames[ index ];
											if( fileName == null )
												fileName = binaryFile;
											if( fileName == null )
												throw new SourceException( "No file or default binary file configured", reader.getLocation() );
											Resource r = resource.resolve( fileName );
											try
											{
												in = new SegmentedInputStream( r.newInputStream() );
												outerCloser.add( in ); // Close at the final end
												streams[ index ] = in;
											}
											catch( FileNotFoundException e )
											{
												throw new SourceException( e.getMessage(), reader.getLocation() );
											}
										}
										statement.setBinaryStream( pos++, in.getSegmentInputStream( lobIndex.longValue(), lobLength.longValue() ) ); // TODO Maybe use the limited setBinaryStream instead
									}
									else if( type == Types.CLOB )
									{
										// Get the reader
										SegmentedReader in = textStreams[ index ];
										if( in == null )
										{
											// File not opened yet, open it
											if( fileNames[ index ] == null )
												throw new SourceException( "No file configured", reader.getLocation() );
											Resource r = resource.resolve( fileNames[ index ] );
											try
											{
												try
												{
													in = new SegmentedReader( new InputStreamReader( r.newInputStream(), "UTF-8" ) );
												}
												catch( UnsupportedEncodingException e )
												{
													throw new SystemException( e );
												}
												outerCloser.add( in ); // Close at the final end
												textStreams[ index ] = in;
											}
											catch( FileNotFoundException e )
											{
												throw new SourceException( e.getMessage(), reader.getLocation() );
											}
										}
										statement.setCharacterStream( pos++, in.getSegmentReader( lobIndex.longValue(), lobLength.longValue() ) );
									}
									else
										Assert.fail( "Unexpected field type for external file: " + JDBCSupport.toTypeName( type ) );
								}
							}
							else
							{
//								if( type == Types.CLOB )
//								{
//									if( values.get( index ) == null )
//										System.out.println( "NULL!" );
//									else if( ( (String)values.get( index ) ).length() == 0 )
//										System.out.println( "EMPTY!" );
//
//									// TODO What if it is a CLOB and the string value is too long?
//									// Oracle needs this because CLOBs can contain empty strings "", and setObject() makes that null BUT THIS DOES NOT WORK!
//									statement.setCharacterStream( pos++, new StringReader( (String)values.get( index ) ) );
//								}
//								else
									// MonetDB complains when calling setObject with null value
//									Object v = values.get( index );
//								if( v != null )
									statement.setObject( pos++, values.get( index ) );
//								else
//									statement.setNull( pos++, type );
							}
						}
					}

					if( parsed.noBatch )
					{
						try
						{
							statement.executeUpdate();
							closer.closeAll();
						}
						catch( SQLException e )
						{
							// When NOBATCH is on, you can see the actual insert statement and line number in the file where the SQLException occurred.
							String message = buildErrorMessage( sql, parameterMap, values, prependLineNumber, lineNumber );
							throw new SQLExecutionException( message, reader.getLocation().lineNumber( lineNumber ), e );
						}
					}
					else
					{
						statement.addBatch();
						batchSize++;
						// TODO Also check the closer's count
						if( batchSize >= 1000 )
						{
							statement.executeBatch();
							batchSize = 0;
							closer.closeAll();
						}
					}

					if( counter != null && counter.next() )
						processor.getProgressListener().println( "Imported " + counter.total() + " records." );
				}
			}
			finally
			{
				processor.closeStatement( statement, commit );
				outerCloser.closeAll();
				closer.closeAll();
			}
		}
		finally
		{
			reader.close();
		}
	}

	static byte[] readBytes( Resource resource ) throws FileNotFoundException
	{
		ByteArrayOutputStream bytes = new ByteArrayOutputStream();
		byte[] buffer = new byte[ 4096 ];
		try
		{
			InputStream in = resource.newInputStream();
			try
			{
				int read;
				while( ( read = in.read( buffer ) ) >= 0 )
					bytes.write( buffer, 0, read );
			}
			finally
			{
				in.close();
			}
		}
		catch( IOException e )
		{
			throw new SystemException( e );
		}
		return bytes.toByteArray();
	}

	/**
	 * Replaces arguments within the given value with ? and maintains a map.
	 *
	 * @param value Value to be translated.
	 * @param parameterMap A map of ? index to index of the CSV fields.
	 * @return The translated value.
	 */
	static protected String translateArgument( String value, List< Integer > parameterMap )
	{
		Matcher matcher = parameterPattern.matcher( value );
		StringBuffer result = new StringBuffer();
		while( matcher.find() )
		{
			int num = Integer.parseInt( matcher.group( 1 ) );
			parameterMap.add( num );
			matcher.appendReplacement( result, "?" );
		}
		matcher.appendTail( result );
		return result.toString();
	}

	static protected String buildErrorMessage( StringBuilder sql, List< Integer > parameterMap, JSONArray values, boolean prependLineNumber, int lineNumber )
	{
		StringBuilder b = new StringBuilder( sql.toString() );
		b.append( " VALUES (" );
		boolean first = true;
		for( int par : parameterMap )
		{
			if( first )
				first = false;
			else
				b.append( ',' );
			try
			{
				if( prependLineNumber )
				{
					if( par == 1 )
						b.append( lineNumber );
					else
						b.append( values.get( par - 2 ) );
				}
				else
					b.append( values.get( par - 1 ) );
			}
			catch( ArrayIndexOutOfBoundsException ee ) // TODO Why is this caught?
			{
				throw new SystemException( ee );
			}
		}
		b.append( ')' );
		return b.toString();
	}

	/**
	 * Parses the given command.
	 *
	 * @param command The command to be parsed.
	 * @return A structure representing the parsed command.
	 */
	static protected Parsed parse( Command command )
	{
		// FIXME Replace LINENUMBER with RECORD NUMBER
		// TODO Match column names
		// TODO Free SQL like with IMPORT CSV
		/*
		LOAD JSON
		[ PREPEND LINENUMBER ]
		[ NOBATCH ]
		[ LOG EVERY n RECORDS | SECONDS ]
		INTO <schema>.<table> [ ( <columns> ) ]
		[ VALUES ( <values> ) ]
		FILE "<file>" [ GZIP ]
		*/

		Parsed result = new Parsed();
		List< String > columns = new ArrayList< String >();
		List< String > values = new ArrayList< String >();

		SQLTokenizer tokenizer = new SQLTokenizer( SourceReaders.forString( command.getCommand(), command.getLocation() ) );

		tokenizer.get( "LOAD" );
		tokenizer.get( "JSON" );

		Token t = tokenizer.get( "PREPEND", "NOBATCH", "LOG", "INTO" );

		if( t.eq( "PREPEND" ) )
		{
			tokenizer.get( "LINENUMBER" );
			result.prependLineNumber = true;

			t = tokenizer.get( "NOBATCH", "LOG", "INTO" );
		}

		if( t.eq( "NOBATCH" ) )
		{
			result.noBatch = true;

			t = tokenizer.get( "LOG", "INTO" );
		}

		if( t.eq( "LOG" ) )
		{
			tokenizer.get( "EVERY" );
			t = tokenizer.get();
			if( !t.isNumber() )
				throw new SourceException( "Expecting a number, not [" + t + "]", tokenizer.getLocation() );

			int interval = Integer.parseInt( t.getValue() );
			t = tokenizer.get( "RECORDS", "SECONDS" );
			if( t.eq( "RECORDS" ) )
				result.logRecords = interval;
			else
				result.logSeconds = interval;

			t = tokenizer.get( "INTO" );
		}

		result.tableName = tokenizer.get().toString();

		t = tokenizer.get( ".", "(", "VALUES", "FILE" );

		if( t.eq( "." ) )
		{
			// TODO This means spaces are allowed, do we want that or not?
			result.tableName = result.tableName + "." + tokenizer.get().toString();

			t = tokenizer.get( "(", "VALUES", "FILE" );
		}

		if( t.eq( "(" ) )
		{
			t = tokenizer.get();
			if( t.eq( ")" ) || t.eq( "," ) )
				throw new SourceException( "Expecting a column name, not [" + t + "]", tokenizer.getLocation() );
			columns.add( t.getValue() );
			t = tokenizer.get( ",", ")" );
			while( !t.eq( ")" ) )
			{
				t = tokenizer.get();
				if( t.eq( ")" ) || t.eq( "," ) )
					throw new SourceException( "Expecting a column name, not [" + t + "]", tokenizer.getLocation() );
				columns.add( t.getValue() );
				t = tokenizer.get( ",", ")" );
			}

			t = tokenizer.get( "VALUES", "FILE" );
		}

		if( t.eq( "VALUES" ) )
		{
			tokenizer.get( "(" );
			do
			{
				StringBuilder value = new StringBuilder();
				parseTill( tokenizer, value, false, ',', ')' );
				values.add( value.toString() );

				t = tokenizer.get( ",", ")" );
			}
			while( t.eq( "," ) );

			if( columns.size() > 0 )
				if( columns.size() != values.size() )
					throw new SourceException( "Number of specified columns does not match number of given values", tokenizer.getLocation() );

			t = tokenizer.get( "FILE" );
		}

		if( columns.size() > 0 )
			result.columns = columns.toArray( new String[ columns.size() ] );
		if( values.size() > 0 )
			result.values = values.toArray( new String[ values.size() ] );

		// File
		t = tokenizer.get();
		String file = t.getValue();
		if( !file.startsWith( "\"" ) )
			throw new SourceException( "Expecting filename enclosed in double quotes, not [" + t + "]", tokenizer.getLocation() );
		file = file.substring( 1, file.length() - 1 );

		t = tokenizer.get();
		if( t.eq( "GZIP" ) )
		{
			result.gzip = true;
			t = tokenizer.get();
		}

		tokenizer.expect( t, (String)null );

		result.fileName = file;
		return result;
	}

	/**
	 * Parse till the specified characters are found.
	 *
	 * @param tokenizer The tokenizer.
	 * @param result The result is stored in this StringBuilder.
	 * @param chars The end characters.
	 * @param includeInitialWhiteSpace Include the whitespace that precedes the first token.
	 */
	static protected void parseTill( SQLTokenizer tokenizer, StringBuilder result, boolean includeInitialWhiteSpace, char... chars )
	{
		Token t = tokenizer.get();
		if( t == null )
			throw new SourceException( "Unexpected EOF", tokenizer.getLocation() );
		if( t.length() == 1 )
			for( char c : chars )
				if( t.getValue().charAt( 0 ) == c )
					throw new SourceException( "Unexpected [" + t + "]", tokenizer.getLocation() );

		if( includeInitialWhiteSpace )
			result.append( t.getWhiteSpace() );
		result.append( t.getValue() );

		outer:
			while( true )
			{
				if( t.eq( "(" ) )
				{
					//System.out.println( "(" );
					parseTill( tokenizer, result, true, ')' );
					t = tokenizer.get();
					Assert.isTrue( t.eq( ")" ) );
					//System.out.println( ")" );
					result.append( t.getWhiteSpace() );
					result.append( t.getValue() );
				}

				t = tokenizer.get();
				if( t == null )
					throw new SourceException( "Unexpected EOF", tokenizer.getLocation() );
				if( t.length() == 1 )
					for( char c : chars )
						if( t.getValue().charAt( 0 ) == c )
							break outer;

				result.append( t.getWhiteSpace() );
				result.append( t.getValue() );
			}

		tokenizer.push( t );
	}

	/**
	 * A parsed command.
	 *
	 * @author René M. de Bloois
	 */
	static protected class Parsed
	{
		/** Prepend the values from the CSV list with the line number from the command file. */
		protected boolean prependLineNumber; // TODO Remove, after it is made possible to use an expression for auto increment

		/** Don't use JDBC batch update. */
		protected boolean noBatch;

		protected int logRecords;
		protected int logSeconds;

		/** The table name to insert into. */
		protected String tableName;

		/** The columns to insert into. */
		protected String[] columns;

		/** The values to insert. Use :1, :2, etc to replace with the values from the CSV list. */
		protected String[] values;

//		/** The underlying reader from the {@link Tokenizer}. */
//		protected SourceReader reader;

		/** The file path to import from */
		protected String fileName;
		protected boolean gzip;
	}

	//@Override
	public void terminate()
	{
		// Nothing to clean up
	}
}


text:
namespace Sitecore.Ecommerce.Data.ModelConfiguration
{
  using System.Data.Entity.ModelConfiguration;
  using Ecommerce.OrderManagement.Orders;

  /// <summary>
  /// Defines the tax scheme configuration class.
  /// </summary>
  public class TaxSchemeConfiguration : ComplexTypeConfiguration<TaxScheme>
  {
    /// <summary>
    /// Initializes a new instance of the <see cref="TaxSchemeConfiguration"/> class.
    /// </summary>
    public TaxSchemeConfiguration()
    {
      this.Property(p => p.CurrencyCode).HasMaxLength(Constants.ShortCodeFieldLength);
      this.Property(p => p.ID).HasMaxLength(Constants.BigCodeFieldLength);
      this.Property(p => p.Name).HasMaxLength(Constants.NameFieldLength);
      this.Property(p => p.TaxTypeCode).HasMaxLength(Constants.BigCodeFieldLength);
    }
  }
}


text:
package de.justsoftware.toolbox;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.google.common.base.Preconditions;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
 * Utilities for objects.
 *
 * @author wolfgang (initial creation)
 */
public class ObjectUtil {

    /**
     * use this instead of {@link Preconditions#checkNotNull()} only if you can not change the nullness
     * of your parameter i.e. in an overridden method.
     * This is because {@link Preconditions#checkNotNull()} is annotaded {@link Nonnull}!
     */
    @Nonnull
    @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE",
            justification = "we need a way to throw NPEs in situations where fb thinks nullable but it will never happen")
    public static <T> T checkNotNull(@Nullable final T reference) {
        return Preconditions.checkNotNull(reference);
    }
}


text:
@interface DAJsonHelper : NSObject

+ (NSDictionary *) decode:(NSData *) json;

+ (id) objectAtPath:(id)json path:(NSString *)path;
+ (BOOL) isNumeric:(NSString *)string;

@end