text:
(function() {
  var Backbone, Clients, Console, File, FileList, FoldList, Projects, PseudoList, STYLUS_FUNC_FILE, StateList, basename, callClient, fs, getFileLocation, log, pathIsAllowed, relativeURL, requirejs, stylus, watcher, _, _ref, _ref1, _ref2,
    __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

  fs = require("fs");

  basename = require("path").basename;

  Backbone = require("backbone");

  requirejs = require("requirejs");

  _ = require("underscore")._;

  callClient = require("./clients").callClient;

  _ref = require("./data"), Clients = _ref.Clients, Projects = _ref.Projects;

  _ref1 = require("./utils"), getFileLocation = _ref1.getFileLocation, relativeURL = _ref1.relativeURL, pathIsAllowed = _ref1.pathIsAllowed;

  _ref2 = requirejs("./../public/lib/models"), FileList = _ref2.FileList, File = _ref2.File, StateList = _ref2.StateList, FoldList = _ref2.FoldList, PseudoList = _ref2.PseudoList;

  watcher = require("./filewatcher").watcher;

  stylus = require("./stylus");

  log = require('./log');

  STYLUS_FUNC_FILE = require("path").dirname(require.resolve('stylus')) + '/lib/functions/index.styl';

  Console = (function() {
    function Console(project) {
      this.project = project;
      _.bindAll(this, "_onFileAdd", "_onFileRemove", "_onFileChange", "disableConsole", "callAPI", "callClient", "onBackup");
      log.info({
        project: this.project.id
      }, 'Create console');
      this.imports = {};
      this.clientId = 0;
      Backbone.connector.connect(new FoldList(null, {
        backend: "folds-" + project.id
      }));
      Backbone.connector.connect(new PseudoList(null, {
        backend: "pseudos-" + project.id
      }));
      Backbone.connector.connect(this.states = new StateList(null, {
        backend: "state-" + this.project.id
      }));
      this.states.create({}, {
        wait: true
      });
      this.files = new FileList(null, {
        backend: "files-" + this.project.id
      });
      Backbone.connector.connect(this.files);
      this.files.bind("add", this._onFileAdd);
      this.files.bind("remove", this._onFileRemove);
      this.files.bind("updated", this._onFileChange);
      this._scanDirectoryForFiles();
      _.each(this.project.getClients(), this._onClientAdd, this);
      this.project.bind("clients:add", this._onClientAdd, this);
    }

    Console.prototype._onClientAdd = function(client) {
      log.debug({
        client: client.id
      }, 'Client added');
      this.setClientFiles(client.id, client.get("css"));
      client.bind("change:css", this._onClientChange, this);
      client.bind("change:connected", this._onClientChange, this);
      return client.bind("remove", this._onClientRemove, this);
    };

    Console.prototype._onClientChange = function(client) {
      if (client.get('connected')) {
        return this.setClientFiles(client.id, client.get("css"));
      } else {
        return client.published = {};
      }
    };

    Console.prototype._onClientRemove = function(client) {
      return this.setClientFiles(client.id, []);
    };

    Console.prototype._scanDirectoryForFiles = function() {
      var files;
      files = this.project.get("files");
      return _.each(files, (function(_this) {
        return function(_arg) {
          var newfiles, path, stylusout, type, url;
          url = _arg.url, path = _arg.path, type = _arg.type, newfiles = _arg.newfiles, stylusout = _arg.stylusout;
          if (!pathIsAllowed(path)) {
            return log.error({
              path: path
            }, 'Access denied to scan files');
          }
          return fs.readdir(path, function(err, flist) {
            if (err) {
              return log.error({
                path: path,
                err: err
              }, 'Failed to scan directory for files');
            }
            return flist.forEach(function(file) {
              var fname, fpath, furl;
              if (!(file[0] !== '.' && file.match((type === "stylus" ? /\.styl$/i : /\.css$/i)))) {
                return;
              }
              fpath = path + file;
              if (url.slice(-1)[0] !== "/") {
                url += "/";
              }
              furl = url + file.replace(/\.styl$/i, ".css");
              fname = _.last(file.split(/[\\\/]/));
              file = _this.files.find(function(f) {
                return furl === f.get("url");
              });
              if (file) {
                return file.save({
                  keepalive: true
                });
              } else {
                return fs.stat(fpath, function(err, stat) {
                  return _this.files.create({
                    url: furl,
                    name: fname,
                    fsize: stat.size,
                    mtime: stat.mtime,
                    type: type,
                    keepalive: true
                  }, {
                    wait: true
                  });
                });
              }
            });
          });
        };
      })(this));
    };

    Console.prototype.listenFile = function(file) {
      watcher.watch(file.srcpath, (function(_this) {
        return function() {
          return _this.files.trigger("updated", file);
        };
      })(this));
      this.files.trigger("updated", file, true);
      return log.debug({
        project: this.project.id,
        url: file.get("url"),
        path: file.srcpath
      }, 'Listen on file');
    };

    Console.prototype._onFileAdd = function(file) {
      var url;
      if (this._added == null) {
        this._added = {};
      }
      if (this._added[file.id]) {
        return;
      }
      this._added[file.id] = 1;
      url = file.get("url");
      if (url.match(/^#local/)) {
        file.srcpath = file.get("path");
        return this.listenFile(file);
      } else {
        return getFileLocation(this.project, url, (function(_this) {
          return function(err, srcpath, csspath) {
            if (!err) {
              file.srcpath = srcpath;
              file.csspath = csspath;
              return _this.listenFile(file);
            }
          };
        })(this));
      }
    };

    Console.prototype._onFileRemove = function(file) {
      delete this._added[file.id];
      watcher.unwatch(file.srcpath);
      return log.debug({
        project: this.project.id,
        path: file.srcpath
      }, 'Deactivate file');
    };

    Console.prototype._onFileChange = function(f, isInitial) {
      log.debug({
        path: f.srcpath
      }, 'Updated file');
      this.publish(f);
      return fs.stat(f.srcpath, (function(_this) {
        return function(err, stat) {
          var file, imports, parent, _ref3, _ref4, _results;
          if (!isInitial) {
            f.save({
              mtime: stat.mtime,
              fsize: stat.size
            });
          }
          _ref3 = _this.imports;
          _results = [];
          for (parent in _ref3) {
            imports = _ref3[parent];
            if (_ref4 = f.srcpath, __indexOf.call(imports, _ref4) >= 0) {
              file = _this.files.find(function(ff) {
                return ff.srcpath === parent && ff.get('mtime') < f.get('mtime');
              });
              if (file) {
                _results.push(_this.publish(file));
              } else {
                _results.push(void 0);
              }
            } else {
              _results.push(void 0);
            }
          }
          return _results;
        };
      })(this));
    };

    Console.prototype.destroy = function() {
      log.info({
        project: this.project.id
      }, 'Destory console');
      this.files.each((function(_this) {
        return function(file) {
          return _this._onFileRemove(file);
        };
      })(this));
      if (this.socket) {
        return this.deactivateSocket(this.socket);
      }
    };

    Console.prototype.pathToUrl = function(path) {
      var files, fpath, newfiles, stylusout, type, url, _i, _len, _ref3;
      files = this.project.get("files");
      for (_i = 0, _len = files.length; _i < _len; _i++) {
        _ref3 = files[_i], url = _ref3.url, fpath = _ref3.path, type = _ref3.type, newfiles = _ref3.newfiles, stylusout = _ref3.stylusout;
        if ((path.indexOf(fpath)) === 0) {
          return url + path.substr(fpath.length);
        }
      }
      return null;
    };

    Console.prototype.publish = function(file, clients) {
      var url;
      if (!file.csspath) {
        return;
      }
      if (clients == null) {
        clients = file.get('clients');
      }
      url = file.get('url');
      if (!file.srcpath) {
        return log.error({
          path: file.srcpath
        }, 'Could not publish');
      }
      if (!pathIsAllowed(file.srcpath)) {
        return;
      }
      return fs.readFile(file.srcpath, "utf8", (function(_this) {
        return function(err, data) {
          if (err) {
            return log.error({
              path: file.srcpath,
              err: err
            }, 'Failed to read source file');
          }
          if (data.charCodeAt(0) === 65279) {
            data = data.substr(1);
          }
          if (file.get('type') === 'stylus') {
            log.info({
              file: file.srcpath
            }, 'Render Stylus file');
            return stylus.renderStylus(file.srcpath, data, function(err, css, imports) {
              if (err) {
                return log.warn({
                  path: file.srcpath,
                  err: err
                }, 'Failed to render Stylus.');
              }
              _this.stylusSetFileImports(file.srcpath, imports);
              _this.publishData(file, css, clients);
              log.debug({
                csspath: file.csspath,
                clients: clients.length
              }, 'Writing compiled CSS file:');
              return fs.writeFile(file.csspath, css);
            });
          } else {
            return _this.publishData(file, data, clients);
          }
        };
      })(this));
    };

    Console.prototype.publishData = function(file, data, clients) {
      var url;
      if (clients == null) {
        clients = file.get('clients');
      }
      url = file.get('url');
      if (data.charCodeAt(0) === 65279) {
        data = data.substr(1);
      }
      return _.each(clients, function(clientId) {
        var client;
        client = Clients.get(clientId);
        if (!client) {
          return log.warn({
            client: clientId
          }, "Client lost without cleanup");
        }
        callClient(clientId, "setStyles", {
          url: url,
          data: data
        });
        return log.info({
          client: clientId,
          uid: client.cid,
          url: url,
          length: data.length
        }, "Sending new styles");
      });
    };

    Console.prototype.publishFile = function(file, clients) {
      if (clients == null) {
        clients = file.get('clients');
      }
      if (!file.csspath) {
        return log.error({
          file: file.csspath
        }, 'Could not publish file');
      }
      return fs.readFile(file.csspath, "utf8", (function(_this) {
        return function(err, data) {
          if (err) {
            return log.error({
              file: file.csspath,
              err: err
            }, 'Failed to read file');
          }
          return _this.publishData(file, data, clients);
        };
      })(this));
    };

    Console.prototype.addClientToFile = function(file, clientId) {
      var client, clients, url;
      log.debug({
        file: file.get('url'),
        client: clientId
      }, 'addClientToFile');
      clients = _.clone(file.get("clients"));
      if (__indexOf.call(clients, clientId) < 0) {
        clients.push(clientId);
        file.save({
          clients: clients
        });
      }
      client = Clients.get(clientId);
      if (client.published == null) {
        client.published = {};
      }
      url = file.get('url');
      if (!client.published[url]) {
        this.publishFile(file, [clientId]);
        return client.published[url] = true;
      }
    };

    Console.prototype.setClientFiles = function(clientId, css) {
      var flist;
      flist = this.files;
      log.debug({
        files: css,
        client: clientId
      }, 'Set client files');
      return _.each(css, (function(_this) {
        return function(cssfile) {
          var file;
          file = flist.find(function(f) {
            return cssfile === f.get("url");
          });
          if (file) {
            _this.addClientToFile(file, clientId);
          } else {
            getFileLocation(_this.project, cssfile, function(err, srcpath) {
              var name, type;
              if (err) {
                return;
              }
              log.debug({
                file: cssfile,
                err: err,
                srcpath: srcpath
              }, 'Client got file location');
              file = flist.find(function(f) {
                return cssfile === f.get("url");
              });
              if (file) {
                return _this.addClientToFile(file, clientId);
              }
              name = _.last(srcpath.split(/[\\\/]/));
              type = srcpath.match(/\.styl$/i) ? 'stylus' : 'css';
              return fs.stat(srcpath, function(err, stat) {
                return flist.create({
                  url: cssfile,
                  name: name,
                  fsize: stat.size,
                  mtime: stat.mtime,
                  clients: [clientId],
                  type: type
                }, {
                  wait: true
                });
              });
            });
          }
          return flist.each(function(file) {
            var clients, keepalive, url;
            url = file.get("url");
            clients = file.get("clients");
            keepalive = file.get("keepalive");
            if (__indexOf.call(clients, clientId) >= 0 && __indexOf.call(css, url) < 0) {
              clients = _.without(clients, clientId);
              if (!keepalive && clients.length === 0) {
                return file.destroy();
              } else {
                return file.save({
                  clients: clients
                });
              }
            }
          });
        };
      })(this));
    };

    Console.prototype.activateSocket = function(socket) {
      this.socket = socket;
      socket.on('callAPI', this.callAPI);
      socket.on('callclient', this.callClient);
      socket.on('deactivate', this.disableConsole);
      return socket.on('disconnect', this.disableConsole);
    };

    Console.prototype.deactivateSocket = function(socket) {
      socket.on('backup', this.onBackup);
      socket.emit('deactivate');
      socket.removeListener('callAPI', this.callAPI);
      socket.removeListener('callclient', this.callClient);
      socket.removeListener('deactivate', this.disableConsole);
      socket.removeListener('disconnect', this.disableConsole);
      return this.socket = null;
    };

    Console.prototype.onBackup = function(data) {
      var _ref3;
      return (_ref3 = this.socket) != null ? _ref3.emit('startupdata', data) : void 0;
    };

    Console.prototype.disableConsole = function() {
      if (this.clientId) {
        callClient(this.clientId, "deactivate");
        this.clientId = 0;
      }
      if (this.socket) {
        return this.deactivateSocket(this.socket);
      }
    };

    Console.prototype.callAPI = function(name, params, cb) {
      var _name;
      return typeof this[_name = "api" + name] === "function" ? this[_name](params, cb) : void 0;
    };

    Console.prototype.callClient = function(clientId) {
      if (this.clientId === clientId) {
        return callClient.apply(null, arguments);
      }
    };

    Console.prototype.activateConsole = function(socket, clientId) {
      var _ref3;
      log.info({
        client: clientId,
        old: this.clientId
      }, 'Activate console');
      if (socket.id !== ((_ref3 = this.socket) != null ? _ref3.id : void 0)) {
        if (this.socket) {
          this.deactivateSocket(this.socket);
        }
        this.activateSocket(socket);
      }
      if (this.clientId && this.clientId !== clientId) {
        callClient(this.clientId, "deactivate");
      }
      if (clientId) {
        callClient(clientId, "activate");
      }
      this.clientId = clientId;
      return socket.emit('activate');
    };

    Console.prototype.onClientMessage = function(name, params) {
      var _ref3;
      return (_ref3 = this.socket) != null ? _ref3.emit('clientmessage', name, params) : void 0;
    };

    Console.prototype.apiGetImgList = function(params, cb) {
      var base, files, fpath, i, key, parts, stylusout, type, url, urlparts, _i, _len, _ref3;
      parts = params.url.split("/");
      base = parts.slice(0, -1);
      key = parts.slice(-1)[0];
      files = this.project.get("files");
      if (files) {
        for (_i = 0, _len = files.length; _i < _len; _i++) {
          _ref3 = files[_i], url = _ref3.url, fpath = _ref3.path, stylusout = _ref3.stylusout, type = _ref3.type;
          if (type === 'stylus') {
            fpath = stylusout;
          }
          if ('/' !== _.last(fpath)) {
            fpath += '/';
          }
          urlparts = url.split("/");
          if (urlparts[2] === parts[2]) {
            fpath = fpath.split("/");
            i = 0;
            while (true) {
              if (urlparts[i] !== base[i]) {
                break;
              }
              i++;
            }
            fpath = fpath.slice(0, -urlparts.length + i);
            fpath = fpath.concat(base.slice(i));
            fpath = fpath.join("/");
            fs.stat(fpath, function(err, stats) {
              if (err || stats.isFile()) {
                return cb(null);
              }
              return fs.readdir(fpath, function(err, files) {
                if (err) {
                  return cb(null);
                }
                files = _.map(files, function(file) {
                  var st;
                  if ((file[0] === ".") || (0 !== file.toLowerCase().indexOf(key))) {
                    return false;
                  }
                  try {
                    st = fs.statSync(fpath + "/" + file);
                  } catch (_error) {
                    err = _error;
                    return false;
                  }
                  if (st.isDirectory()) {
                    return file + "/";
                  } else {
                    if (file.match(/\.(png|jpe?g|gif)$/i)) {
                      return file;
                    } else {
                      return false;
                    }
                  }
                });
                return cb(_.compact(files.sort()));
              });
            });
            return;
          }
        }
      }
    };

    Console.prototype.apiPublishChanges = function(params, cb) {
      var file;
      log.debug('API called publish changes');
      file = this.files.find(function(f) {
        return params.url === f.get("url");
      });
      if (file) {
        this.publishData(file, params.data);
      }
      return cb();
    };

    Console.prototype.apiGetFileData = function(params, cb) {
      var file;
      file = this.files.find(function(f) {
        return params.url === f.get("url");
      });
      if (!(file != null ? file.srcpath : void 0)) {
        return;
      }
      log.info({
        path: file.srcpath,
        url: file.get('url')
      }, "Reading file");
      if (file) {
        return fs.readFile(file.srcpath, "utf8", function(err, data) {
          if (err) {
            return log.error({
              file: file.srcpath,
              err: err
            }, 'Failed to read file');
          }
          return cb({
            data: data,
            name: basename(file.srcpath)
          });
        });
      } else {
        return cb({
          data: null
        });
      }
    };

    Console.prototype.apiSetFileData = function(params, cb) {
      var file;
      file = this.files.find(function(f) {
        return params.url === f.get("url");
      });
      if (!((file != null ? file.srcpath : void 0) && pathIsAllowed(file.srcpath))) {
        return;
      }
      log.info({
        file: file.srcpath,
        length: params.data.length
      }, 'Writing file');
      return fs.writeFile(file.srcpath, params.data, function(err) {
        if (err) {
          log.error({
            file: file.srcpath,
            err: err
          }, 'Failed to write file');
        }
        return cb(err);
      });
    };

    Console.prototype.apiPublishSaved = function(params, cb) {
      var file;
      file = this.files.find(function(f) {
        return params.url === f.get("url");
      });
      return this.publishFile(file);
    };

    Console.prototype.stylusSetFileImports = function(file, imports) {
      var nibpath;
      if (!imports) {
        return delete this.imports[file];
      }
      nibpath = require("nib").path;
      return this.imports[file] = _.compact(_.map(imports, (function(_this) {
        return function(item) {
          var furl, name, path, url;
          if (item.path === STYLUS_FUNC_FILE) {
            return;
          }
          path = item.path;
          url = _this.pathToUrl(path);
          file = _this.files.find(function(f) {
            return f.srcpath === path;
          });
          if (!file) {
            furl = 0 === path.indexOf(nibpath) ? path.slice(nibpath.length + 1) : Math.random() * 1e6 | 0;
            name = _.last(path.split(/[\\\/]/));
            fs.stat(path, function(err, stat) {
              return _this.files.create({
                fsize: stat.size,
                mtime: stat.mtime,
                url: "#local/" + furl,
                path: path,
                type: 'stylus',
                name: name
              }, {
                wait: true
              });
            });
          }
          return path;
        };
      })(this)));
    };

    Console.prototype.apiGetStylusOutline = function(params, cb) {
      var file, publish;
      file = this.files.find(function(f) {
        return params.url === f.get("url");
      });
      if (!file) {
        return;
      }
      publish = !!params.publish;
      return stylus.getStylusOutline({
        filename: file.srcpath,
        data: params.data,
        getcss: publish
      }, (function(_this) {
        return function(outline, css) {
          cb(outline);
          if (css) {
            return _this.publishData(file, css);
          }
        };
      })(this));
    };

    return Console;

  })();

  Console.consoles = {};

  Console.getConsole = function(projectId) {
    var project, _base;
    if (!(project = Projects.get(projectId))) {
      return null;
    }
    if ((_base = Console.consoles)[projectId] == null) {
      _base[projectId] = new Console(project);
    }
    project.bind("remove", function() {
      var _ref3;
      log.info({
        project: projectId
      }, 'Remove console');
      if ((_ref3 = Console.consoles[projectId]) != null) {
        _ref3.destroy();
      }
      return delete Console.consoles[projectId];
    });
    project.bind("change:files", function() {
      var _ref3;
      log.info({
        project: projectId
      }, 'Console conf changed');
      if ((_ref3 = Console.consoles[projectId]) != null) {
        _ref3.destroy();
      }
      delete Console.consoles[projectId];
      return Console.getConsole(projectId);
    });
    return Console.consoles[projectId];
  };

  module.exports = Console;

}).call(this);


text:
using System;
using WorkflowCore.Interface;
using WorkflowCore.Models;

namespace WorkflowCore.Sample09s
{
    public class DisplayContext : StepBody
    {

        public object Item { get; set; }

        public override ExecutionResult Run(IStepExecutionContext context)
        {
            Console.WriteLine($"Working on item {Item}");
            return ExecutionResult.Next();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.h2.test.jdbcx;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import javax.naming.Reference;
import javax.naming.StringRefAddr;
import javax.naming.spi.ObjectFactory;
import javax.sql.ConnectionEvent;
import javax.sql.ConnectionEventListener;
import javax.sql.XAConnection;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import org.h2.jdbcx.JdbcDataSource;
import org.h2.jdbcx.JdbcDataSourceFactory;
import org.h2.jdbcx.JdbcXAConnection;
import org.h2.message.TraceSystem;
import org.h2.test.TestBase;

/**
 * Tests DataSource and XAConnection.
 */
public class TestDataSource extends TestBase {

    /**
     * Run just this test.
     *
     * @param a ignored
     */
    public static void main(String... a) throws Exception {
        TestBase.createCaller().init().test();
    }

//     public static void main(String... args) throws SQLException {
//
//     // first, need to start on the command line:
//     // rmiregistry 1099
//
//     // System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
//     "com.sun.jndi.ldap.LdapCtxFactory");
//     System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
//     "com.sun.jndi.rmi.registry.RegistryContextFactory");
//     System.setProperty(Context.PROVIDER_URL, "rmi://localhost:1099");
//
//     JdbcDataSource ds = new JdbcDataSource();
//     ds.setURL("jdbc:h2:test");
//     ds.setUser("test");
//     ds.setPassword("");
//
//     Context ctx = new InitialContext();
//     ctx.bind("jdbc/test", ds);
//
//     DataSource ds2 = (DataSource)ctx.lookup("jdbc/test");
//     Connection conn = ds2.getConnection();
//     conn.close();
//     }

    @Override
    public void test() throws Exception {
        if (config.traceLevelFile > 0) {
            TraceSystem sys = JdbcDataSourceFactory.getTraceSystem();
            sys.setFileName(getBaseDir() + "/test/trace");
            sys.setLevelFile(3);
        }
        testDataSourceFactory();
        testDataSource();
        testXAConnection();
        deleteDb("dataSource");
    }

    private void testDataSourceFactory() throws Exception {
        ObjectFactory factory = new JdbcDataSourceFactory();
        assertTrue(null == factory.getObjectInstance("test", null, null, null));
        Reference ref = new Reference("java.lang.String");
        assertTrue(null == factory.getObjectInstance(ref, null, null, null));
        ref = new Reference(JdbcDataSource.class.getName());
        ref.add(new StringRefAddr("url", "jdbc:h2:mem:"));
        ref.add(new StringRefAddr("user", "u"));
        ref.add(new StringRefAddr("password", "p"));
        ref.add(new StringRefAddr("loginTimeout", "1"));
        ref.add(new StringRefAddr("description", "test"));
        JdbcDataSource ds = (JdbcDataSource) factory.getObjectInstance(
                ref, null, null, null);
        assertEquals(1, ds.getLoginTimeout());
        assertEquals("test", ds.getDescription());
        assertEquals("jdbc:h2:mem:", ds.getURL());
        assertEquals("u", ds.getUser());
        assertEquals("p", ds.getPassword());
        Reference ref2 = ds.getReference();
        assertEquals(ref.size(), ref2.size());
        assertEquals(ref.get("url").getContent().toString(),
                ref2.get("url").getContent().toString());
        assertEquals(ref.get("user").getContent().toString(),
                ref2.get("user").getContent().toString());
        assertEquals(ref.get("password").getContent().toString(),
                ref2.get("password").getContent().toString());
        assertEquals(ref.get("loginTimeout").getContent().toString(),
                ref2.get("loginTimeout").getContent().toString());
        assertEquals(ref.get("description").getContent().toString(),
                ref2.get("description").getContent().toString());
        ds.setPasswordChars("abc".toCharArray());
        assertEquals("abc", ds.getPassword());
    }

    private void testXAConnection() throws Exception {
        testXAConnection(false);
        testXAConnection(true);
    }

    private void testXAConnection(boolean userInDataSource) throws Exception {
        deleteDb("dataSource");
        JdbcDataSource ds = new JdbcDataSource();
        String url = getURL("dataSource", true);
        String user = getUser();
        ds.setURL(url);
        if (userInDataSource) {
            ds.setUser(user);
            ds.setPassword(getPassword());
        }
        if (userInDataSource) {
            assertEquals("ds" + ds.getTraceId() + ": url=" + url +
                    " user=" + user, ds.toString());
        } else {
            assertEquals("ds" + ds.getTraceId() + ": url=" + url +
                    " user=", ds.toString());
        }
        XAConnection xaConn;
        if (userInDataSource) {
            xaConn = ds.getXAConnection();
        } else {
            xaConn = ds.getXAConnection(user, getPassword());
        }

        int traceId = ((JdbcXAConnection) xaConn).getTraceId();
        assertTrue(xaConn.toString().startsWith("xads" + traceId + ": conn"));

        xaConn.addConnectionEventListener(new ConnectionEventListener() {
            @Override
            public void connectionClosed(ConnectionEvent event) {
                // nothing to do
            }

            @Override
            public void connectionErrorOccurred(ConnectionEvent event) {
                // nothing to do
            }
        });
        XAResource res = xaConn.getXAResource();

        assertFalse(res.setTransactionTimeout(1));
        assertEquals(0, res.getTransactionTimeout());
        assertTrue(res.isSameRM(res));
        assertFalse(res.isSameRM(null));

        Connection conn = xaConn.getConnection();
        assertEquals(user.toUpperCase(), conn.getMetaData().getUserName());
        Xid[] list = res.recover(XAResource.TMSTARTRSCAN);
        assertEquals(0, list.length);
        Statement stat = conn.createStatement();
        stat.execute("SELECT * FROM DUAL");
        conn.close();
        xaConn.close();
    }

    private void testDataSource() throws SQLException {
        deleteDb("dataSource");
        JdbcDataSource ds = new JdbcDataSource();
        PrintWriter p = new PrintWriter(new StringWriter());
        ds.setLogWriter(p);
        assertTrue(p == ds.getLogWriter());
        ds.setURL(getURL("dataSource", true));
        ds.setUser(getUser());
        ds.setPassword(getPassword());
        Connection conn;
        conn = ds.getConnection();
        Statement stat;
        stat = conn.createStatement();
        stat.execute("SELECT * FROM DUAL");
        conn.close();
        conn = ds.getConnection(getUser(), getPassword());
        stat = conn.createStatement();
        stat.execute("SELECT * FROM DUAL");
    }

}


text:
import logging

# Third-Party modules
import flask

# Project modules

logging.basicConfig(level=logging.INFO)

app = flask.Flask(__name__)

@app.route('/old')
def index():
    return flask.render_template('/old/index.html')

@app.route('/')
def home():
    return flask.redirect(flask.url_for('index'))

@app.route('/google8b87abaa24c74d5d.html')
def google_verification():
    return flask.render_template('google8b87abaa24c74d5d.html')

if __name__ == '__main__':
    app.run()


text:
package com.zireck.requestcache.library.network;

import com.zireck.requestcache.library.model.RequestModel;

public interface NetworkRequestManager {
  void sendRequest(RequestModel requestModel, NetworkResponseCallback networkResponseCallback);
}


text:
<?php

namespace Ahe\gsbBundle\Controller;
require_once("include/fct.inc.php");
require_once("include/class.pdogsb.inc.php");
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use PdoGsb;

class ComptableController extends Controller
{

     public function accueilComptableAction() {
         return $this->render('AheGsbBundle:Comptable:accueilComptable.html.twig');
     }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd"
[
	<!-- TODO: Kate's regex engine has very limited support for
	predefined char classes, so making rustIdent consistent with actual
	Rust identifiers will be a bit difficult -->
	<!ENTITY rustIdent "[a-zA-Z_][a-zA-Z_0-9]*">
	<!ENTITY rustIntSuf "([iu](8|16|32|64)?)?">
]>
<language name="Rust" version="0.10-pre" kateversion="2.4" section="Sources" extensions="*.rs;*.rc" mimetype="text/x-rust" priority="15">
<highlighting>
	<list name="fn">
		<item> fn </item>
	</list>
	<list name="type">
		<item> type </item>
	</list>
	<list name="keywords">
		<item> as </item>
		<item> break </item>
		<item> continue </item>
		<item> do </item>
		<item> drop </item>
		<item> else </item>
		<item> enum </item>
		<item> extern </item>
		<item> for </item>
		<item> if </item>
		<item> impl </item>
		<item> let </item>
		<item> loop </item>
		<item> match </item>
		<item> mod </item>
		<item> mut </item>
		<item> priv </item>
		<item> pub </item>
		<item> ref </item>
		<item> return </item>
		<item> static </item>
		<item> struct </item>
		<item> super </item>
		<item> trait </item>
		<item> unsafe </item>
		<item> use </item>
		<item> while </item>
	</list>
	<list name="traits">
		<item> Const </item>
		<item> Copy </item>
		<item> Send </item>
		<item> Owned </item>
		<item> Sized </item>
		<item> Eq </item>
		<item> Ord </item>
		<item> Num </item>
		<item> Ptr </item>
		<item> Drop </item>
		<item> Add </item>
		<item> Sub </item>
		<item> Mul </item>
		<item> Quot </item>
		<item> Rem </item>
		<item> Neg </item>
		<item> BitAnd </item>
		<item> BitOr </item>
		<item> BitXor </item>
		<item> Shl </item>
		<item> Shr </item>
		<item> Index </item>
		<item> Not </item>
	</list>
	<list name="types">
		<item> bool </item>
		<item> int </item>
		<item> uint </item>
		<item> i8 </item>
		<item> i16 </item>
		<item> i32 </item>
		<item> i64 </item>
		<item> u8 </item>
		<item> u16 </item>
		<item> u32 </item>
		<item> u64 </item>
		<item> f32 </item>
		<item> f64 </item>
		<item> float </item>
		<item> char </item>
		<item> str </item>
		<item> Either </item>
		<item> Option </item>
		<item> Result </item>
		<item> Self </item>
	</list>
	<list name="ctypes">
		<item> c_float </item>
		<item> c_double </item>
		<item> c_void </item>
		<item> FILE </item>
		<item> fpos_t </item>
		<item> DIR </item>
		<item> dirent </item>
		<item> c_char </item>
		<item> c_schar </item>
		<item> c_uchar </item>
		<item> c_short </item>
		<item> c_ushort </item>
		<item> c_int </item>
		<item> c_uint </item>
		<item> c_long </item>
		<item> c_ulong </item>
		<item> size_t </item>
		<item> ptrdiff_t </item>
		<item> clock_t </item>
		<item> time_t </item>
		<item> c_longlong </item>
		<item> c_ulonglong </item>
		<item> intptr_t </item>
		<item> uintptr_t </item>
		<item> off_t </item>
		<item> dev_t </item>
		<item> ino_t </item>
		<item> pid_t </item>
		<item> mode_t </item>
		<item> ssize_t </item>
	</list>
	<list name="self">
		<item> self </item>
	</list>
	<list name="constants">
		<item> true </item>
		<item> false </item>
		<item> Some </item>
		<item> None </item>
		<item> Left </item>
		<item> Right </item>
		<item> Ok </item>
		<item> Err </item>
		<item> Success </item>
		<item> Failure </item>
		<item> Cons </item>
		<item> Nil </item>
	</list>
	<list name="cconstants">
		<item> EXIT_FAILURE </item>
		<item> EXIT_SUCCESS </item>
		<item> RAND_MAX </item>
		<item> EOF </item>
		<item> SEEK_SET </item>
		<item> SEEK_CUR </item>
		<item> SEEK_END </item>
		<item> _IOFBF </item>
		<item> _IONBF </item>
		<item> _IOLBF </item>
		<item> BUFSIZ </item>
		<item> FOPEN_MAX </item>
		<item> FILENAME_MAX </item>
		<item> L_tmpnam </item>
		<item> TMP_MAX </item>
		<item> O_RDONLY </item>
		<item> O_WRONLY </item>
		<item> O_RDWR </item>
		<item> O_APPEND </item>
		<item> O_CREAT </item>
		<item> O_EXCL </item>
		<item> O_TRUNC </item>
		<item> S_IFIFO </item>
		<item> S_IFCHR </item>
		<item> S_IFBLK </item>
		<item> S_IFDIR </item>
		<item> S_IFREG </item>
		<item> S_IFMT </item>
		<item> S_IEXEC </item>
		<item> S_IWRITE </item>
		<item> S_IREAD </item>
		<item> S_IRWXU </item>
		<item> S_IXUSR </item>
		<item> S_IWUSR </item>
		<item> S_IRUSR </item>
		<item> F_OK </item>
		<item> R_OK </item>
		<item> W_OK </item>
		<item> X_OK </item>
		<item> STDIN_FILENO </item>
		<item> STDOUT_FILENO </item>
		<item> STDERR_FILENO </item>
	</list>
	<contexts>
		<context attribute="Normal Text" lineEndContext="#stay" name="Normal">
			<DetectSpaces/>
			<keyword String="fn" attribute="Keyword" context="Function"/>
			<keyword String="type" attribute="Keyword" context="Type"/>
			<keyword String="keywords" attribute="Keyword" context="#stay"/>
			<keyword String="types" attribute="Type" context="#stay"/>
			<keyword String="traits" attribute="Trait" context="#stay"/>
			<keyword String="ctypes" attribute="CType" context="#stay"/>
			<keyword String="self" attribute="Self" context="#stay"/>
			<keyword String="constants" attribute="Constant" context="#stay"/>
			<keyword String="cconstants" attribute="CConstant" context="#stay"/>
			<Detect2Chars char="/" char1="/" attribute="Comment" context="Commentar 1"/>
			<Detect2Chars char="/" char1="*" attribute="Comment" context="Commentar 2" beginRegion="Comment"/>
			<RegExpr String="0x[0-9a-fA-F_]+&rustIntSuf;" attribute="Number" context="#stay"/>
			<RegExpr String="0o[0-7_]+&rustIntSuf;" attribute="Number" context="#stay"/>
			<RegExpr String="0b[0-1_]+&rustIntSuf;" attribute="Number" context="#stay"/>
			<RegExpr String="[0-9][0-9_]*\.[0-9_]*([eE][+-]?[0-9_]+)?(f32|f64|f)?" attribute="Number" context="#stay"/>
			<RegExpr String="[0-9][0-9_]*&rustIntSuf;" attribute="Number" context="#stay"/>
			<Detect2Chars char="#" char1="[" attribute="Attribute" context="Attribute" beginRegion="Attribute"/>
			<RegExpr String="&rustIdent;::" attribute="Scope"/>
			<RegExpr String="&rustIdent;!" attribute="Macro"/>
			<RegExpr String="'&rustIdent;(?!')" attribute="Lifetime"/>
			<DetectChar char="{" attribute="Symbol" context="#stay" beginRegion="Brace" />
			<DetectChar char="}" attribute="Symbol" context="#stay" endRegion="Brace" />
			<DetectChar char=""" attribute="String" context="String"/>
			<DetectChar char="'" attribute="Character" context="Character"/>
			<DetectChar char="[" attribute="Symbol" context="#stay" beginRegion="Bracket" />
			<DetectChar char="]" attribute="Symbol" context="#stay" endRegion="Bracket" />
			<DetectIdentifier/>
		</context>
		<context attribute="Attribute" lineEndContext="#stay" name="Attribute">
			<DetectChar char="]" attribute="Attribute" context="#pop" endRegion="Attribute"/>
			<IncludeRules context="Normal"/>
		</context>
		<context attribute="Definition" lineEndContext="#stay" name="Function">
			<DetectSpaces/>
			<DetectChar char="(" attribute="Normal Text" context="#pop"/>
			<DetectChar char="<" attribute="Normal Text" context="#pop"/>
		</context>
		<context attribute="Definition" lineEndContext="#stay" name="Type">
			<DetectSpaces/>
			<DetectChar char="=" attribute="Normal Text" context="#pop"/>
			<DetectChar char="<" attribute="Normal Text" context="#pop"/>
		</context>
		<context attribute="String" lineEndContext="#stay" name="String">
			<LineContinue attribute="String" context="#stay"/>
			<DetectChar char="\" attribute="CharEscape" context="CharEscape"/>
			<DetectChar attribute="String" context="#pop" char="""/>
		</context>
		<context attribute="Character" lineEndContext="#pop" name="Character">
			<DetectChar char="\" attribute="CharEscape" context="CharEscape"/>
			<DetectChar attribute="Character" context="#pop" char="'"/>
		</context>
		<context attribute="CharEscape" lineEndContext="#pop" name="CharEscape">
			<AnyChar String="nrt\'"" attribute="CharEscape" context="#pop"/>
			<RegExpr String="x[0-9a-fA-F]{2}" attribute="CharEscape" context="#pop"/>
			<RegExpr String="u[0-9a-fA-F]{4}" attribute="CharEscape" context="#pop"/>
			<RegExpr String="U[0-9a-fA-F]{8}" attribute="CharEscape" context="#pop"/>
			<RegExpr String="." attribute="Error" context="#pop"/>
		</context>
		<context attribute="Comment" lineEndContext="#pop" name="Commentar 1"/>
		<context attribute="Comment" lineEndContext="#stay" name="Commentar 2">
			<DetectSpaces/>
			<Detect2Chars char="*" char1="/" attribute="Comment" context="#pop" endRegion="Comment"/>
		</context>
	</contexts>
    <itemDatas>
		<itemData name="Normal Text"  defStyleNum="dsNormal"/>
		<itemData name="Keyword"      defStyleNum="dsKeyword" color="#770088" bold="1"/>
		<itemData name="Self"         defStyleNum="dsKeyword" color="#FF0000" bold="1"/>
		<itemData name="Type"         defStyleNum="dsKeyword" color="#4e9a06" bold="1"/>
		<itemData name="Trait"        defStyleNum="dsKeyword" color="#4e9a06" bold="1"/>
		<itemData name="CType"        defStyleNum="dsNormal" color="#4e9a06"/>
		<itemData name="Constant"     defStyleNum="dsKeyword" color="#116644"/>
		<itemData name="CConstant"    defStyleNum="dsNormal" color="#116644"/>
		<itemData name="Definition"   defStyleNum="dsNormal" color="#0000FF"/>
		<itemData name="Comment"      defStyleNum="dsComment" color="#AA5500"/>
		<itemData name="Scope"        defStyleNum="dsNormal" color="#0055AA"/>
		<itemData name="Number"       defStyleNum="dsDecVal" color="#116644"/>
		<itemData name="String"       defStyleNum="dsString" color="#FF0000"/>
		<itemData name="CharEscape"   defStyleNum="dsChar" color="#FF0000" bold="1"/>
		<itemData name="Character"    defStyleNum="dsChar" color="#FF0000"/>
		<itemData name="Macro"        defStyleNum="dsOthers"/>
		<itemData name="Attribute"    defStyleNum="dsOthers"/>
		<itemData name="Lifetime"     defStyleNum="dsOthers" bold="1"/>
		<itemData name="Error"        defStyleNum="dsError"/>
	</itemDatas>
</highlighting>
<general>
	<comments>
		<comment name="singleLine" start="//" />
		<comment name="multiLine" start="/*" end="*/" region="Comment"/>
	</comments>
	<keywords casesensitive="1" />
</general>
</language>


text:
"""Utils related to keras model saving."""

import copy
import os

import tensorflow.compat.v2 as tf

import keras
from keras import backend
from keras import losses
from keras import optimizers
from keras.engine import base_layer_utils
from keras.optimizers import optimizer_v1
from keras.saving.legacy import serialization
from keras.utils import version_utils
from keras.utils.io_utils import ask_to_proceed_with_overwrite

# isort: off
from tensorflow.python.platform import tf_logging as logging

def extract_model_metrics(model):
    """Convert metrics from a Keras model `compile` API to dictionary.

    This is used for converting Keras models to Estimators and SavedModels.

    Args:
      model: A `tf.keras.Model` object.

    Returns:
      Dictionary mapping metric names to metric instances. May return `None` if
      the model does not contain any metrics.
    """
    if getattr(model, "_compile_metrics", None):
        # TODO(psv/kathywu): use this implementation in model to estimator flow.
        # We are not using model.metrics here because we want to exclude the
        # metrics added using `add_metric` API.
        return {m.name: m for m in model._compile_metric_functions}
    return None

def model_call_inputs(model, keep_original_batch_size=False):
    """Inspect model to get its input signature.

    The model's input signature is a list with a single (possibly-nested)
    object. This is due to the Keras-enforced restriction that tensor inputs
    must be passed in as the first argument.

    For example, a model with input {'feature1': <Tensor>, 'feature2': <Tensor>}
    will have input signature:
    [{'feature1': TensorSpec, 'feature2': TensorSpec}]

    Args:
      model: Keras Model object.
      keep_original_batch_size: A boolean indicating whether we want to keep
        using the original batch size or set it to None. Default is `False`,
        which means that the batch dim of the returned input signature will
        always be set to `None`.

    Returns:
      A tuple containing `(args, kwargs)` TensorSpecs of the model call function
      inputs.
      `kwargs` does not contain the `training` argument.
    """
    input_specs = model.save_spec(dynamic_batch=not keep_original_batch_size)
    if input_specs is None:
        return None, None
    input_specs = _enforce_names_consistency(input_specs)
    return input_specs

def raise_model_input_error(model):
    if isinstance(model, keras.models.Sequential):
        raise ValueError(
            f"Model {model} cannot be saved because the input shape is not "
            "available. Please specify an input shape either by calling "
            "`build(input_shape)` directly, or by calling the model on actual "
            "data using `Model()`, `Model.fit()`, or `Model.predict()`."
        )

    # If the model is not a `Sequential`, it is intended to be a subclassed
    # model.
    raise ValueError(
        f"Model {model} cannot be saved either because the input shape is not "
        "available or because the forward pass of the model is not defined."
        "To define a forward pass, please override `Model.call()`. To specify "
        "an input shape, either call `build(input_shape)` directly, or call "
        "the model on actual data using `Model()`, `Model.fit()`, or "
        "`Model.predict()`. If you have a custom training step, please make "
        "sure to invoke the forward pass in train step through "
        "`Model.__call__`, i.e. `model(inputs)`, as opposed to `model.call()`."
    )

def trace_model_call(model, input_signature=None):
    """Trace the model call to create a tf.function for exporting a Keras model.

    Args:
      model: A Keras model.
      input_signature: optional, a list of tf.TensorSpec objects specifying the
        inputs to the model.

    Returns:
      A tf.function wrapping the model's call function with input signatures
      set.

    Raises:
      ValueError: if input signature cannot be inferred from the model.
    """
    if input_signature is None:
        if isinstance(model.call, tf.__internal__.function.Function):
            input_signature = model.call.input_signature

    if input_signature:
        model_args = input_signature
        model_kwargs = {}
    else:
        model_args, model_kwargs = model_call_inputs(model)

        if model_args is None:
            raise_model_input_error(model)

    @tf.function
    def _wrapped_model(*args, **kwargs):
        """A concrete tf.function that wraps the model's call function."""
        (args, kwargs,) = model._call_spec.set_arg_value(
            "training", False, args, kwargs, inputs_in_args=True
        )

        with base_layer_utils.call_context().enter(
            model, inputs=None, build_graph=False, training=False, saving=True
        ):
            outputs = model(*args, **kwargs)

        # Outputs always has to be a flat dict.
        output_names = model.output_names  # Functional Model.
        if output_names is None:  # Subclassed Model.
            from keras.engine import compile_utils

            output_names = compile_utils.create_pseudo_output_names(outputs)
        outputs = tf.nest.flatten(outputs)
        return {name: output for name, output in zip(output_names, outputs)}

    return _wrapped_model.get_concrete_function(*model_args, **model_kwargs)

def model_metadata(model, include_optimizer=True, require_config=True):
    """Returns a dictionary containing the model metadata."""
    from keras import __version__ as keras_version
    from keras.optimizers.optimizer_v2 import optimizer_v2

    model_config = {"class_name": model.__class__.__name__}
    try:
        model_config["config"] = model.get_config()
    except NotImplementedError as e:
        if require_config:
            raise e

    metadata = dict(
        keras_version=str(keras_version),
        backend=backend.backend(),
        model_config=model_config,
    )
    if model.optimizer and include_optimizer:
        if isinstance(model.optimizer, optimizer_v1.TFOptimizer):
            logging.warning(
                "TensorFlow optimizers do not "
                "make it possible to access "
                "optimizer attributes or optimizer state "
                "after instantiation. "
                "As a result, we cannot save the optimizer "
                "as part of the model save file. "
                "You will have to compile your model again after loading it. "
                "Prefer using a Keras optimizer instead "
                "(see keras.io/optimizers)."
            )
        elif model._compile_was_called:
            training_config = model._get_compile_args(user_metrics=False)
            training_config.pop("optimizer", None)  # Handled separately.
            metadata["training_config"] = _serialize_nested_config(
                training_config
            )
            if isinstance(model.optimizer, optimizer_v2.RestoredOptimizer):
                raise NotImplementedError(
                    "Optimizers loaded from a SavedModel cannot be saved. "
                    "If you are calling `model.save` or "
                    "`tf.keras.models.save_model`, "
                    "please set the `include_optimizer` option to `False`. For "
                    "`tf.saved_model.save`, "
                    "delete the optimizer from the model."
                )
            else:
                optimizer_config = {
                    "class_name": keras.utils.get_registered_name(
                        model.optimizer.__class__
                    ),
                    "config": model.optimizer.get_config(),
                }
            metadata["training_config"]["optimizer_config"] = optimizer_config
    return metadata

def should_overwrite(filepath, overwrite):
    """Returns whether the filepath should be overwritten."""
    # If file exists and should not be overwritten.
    if not overwrite and os.path.isfile(filepath):
        return ask_to_proceed_with_overwrite(filepath)
    return True

def compile_args_from_training_config(training_config, custom_objects=None):
    """Return model.compile arguments from training config."""
    if custom_objects is None:
        custom_objects = {}

    with keras.utils.CustomObjectScope(custom_objects):
        optimizer_config = training_config["optimizer_config"]
        optimizer = optimizers.deserialize(optimizer_config)

        # Recover losses.
        loss = None
        loss_config = training_config.get("loss", None)
        if loss_config is not None:
            loss = _deserialize_nested_config(losses.deserialize, loss_config)

        # Recover metrics.
        metrics = None
        metrics_config = training_config.get("metrics", None)
        if metrics_config is not None:
            metrics = _deserialize_nested_config(
                _deserialize_metric, metrics_config
            )

        # Recover weighted metrics.
        weighted_metrics = None
        weighted_metrics_config = training_config.get("weighted_metrics", None)
        if weighted_metrics_config is not None:
            weighted_metrics = _deserialize_nested_config(
                _deserialize_metric, weighted_metrics_config
            )

        sample_weight_mode = (
            training_config["sample_weight_mode"]
            if hasattr(training_config, "sample_weight_mode")
            else None
        )
        loss_weights = training_config["loss_weights"]

    return dict(
        optimizer=optimizer,
        loss=loss,
        metrics=metrics,
        weighted_metrics=weighted_metrics,
        loss_weights=loss_weights,
        sample_weight_mode=sample_weight_mode,
    )

def _deserialize_nested_config(deserialize_fn, config):
    """Deserializes arbitrary Keras `config` using `deserialize_fn`."""

    def _is_single_object(obj):
        if isinstance(obj, dict) and "class_name" in obj:
            return True  # Serialized Keras object.
        if isinstance(obj, str):
            return True  # Serialized function or string.
        return False

    if config is None:
        return None
    if _is_single_object(config):
        return deserialize_fn(config)
    elif isinstance(config, dict):
        return {
            k: _deserialize_nested_config(deserialize_fn, v)
            for k, v in config.items()
        }
    elif isinstance(config, (tuple, list)):
        return [
            _deserialize_nested_config(deserialize_fn, obj) for obj in config
        ]

    raise ValueError(
        "Saved configuration not understood. Configuration should be a "
        f"dictionary, string, tuple or list. Received: config={config}."
    )

def _serialize_nested_config(config):
    """Serialized a nested structure of Keras objects."""

    def _serialize_fn(obj):
        if callable(obj):
            return serialization.serialize_keras_object(obj)
        return obj

    return tf.nest.map_structure(_serialize_fn, config)

def _deserialize_metric(metric_config):
    """Deserialize metrics, leaving special strings untouched."""
    from keras import metrics as metrics_module

    if metric_config in ["accuracy", "acc", "crossentropy", "ce"]:
        # Do not deserialize accuracy and cross-entropy strings as we have
        # special case handling for these in compile, based on model output
        # shape.
        return metric_config
    return metrics_module.deserialize(metric_config)

def _enforce_names_consistency(specs):
    """Enforces that either all specs have names or none do."""

    def _has_name(spec):
        return spec is None or (hasattr(spec, "name") and spec.name is not None)

    def _clear_name(spec):
        spec = copy.deepcopy(spec)
        if hasattr(spec, "name"):
            spec._name = None
        return spec

    flat_specs = tf.nest.flatten(specs)
    name_inconsistency = any(_has_name(s) for s in flat_specs) and not all(
        _has_name(s) for s in flat_specs
    )

    if name_inconsistency:
        specs = tf.nest.map_structure(_clear_name, specs)
    return specs

def try_build_compiled_arguments(model):
    if (
        not version_utils.is_v1_layer_or_model(model)
        and model.outputs is not None
    ):
        try:
            if not model.compiled_loss.built:
                model.compiled_loss.build(model.outputs)
            if not model.compiled_metrics.built:
                model.compiled_metrics.build(model.outputs, model.outputs)
        except:  # noqa: E722
            logging.warning(
                "Compiled the loaded model, but the compiled metrics have "
                "yet to be built. `model.compile_metrics` will be empty "
                "until you train or evaluate the model."
            )

def is_hdf5_filepath(filepath):
    return (
        filepath.endswith(".h5")
        or filepath.endswith(".keras")
        or filepath.endswith(".hdf5")
    )


text:
class Map {
public:
	std::ifstream map_file;
	std::vector<std::string> lines;
	std::vector<TileType> tile_types;
	char* map_file_path;
	int max_w = 0, max_h = 0;
	float spawn_x, spawn_y;
	float tile_w, tile_h;
	char air, solid, spawn;
	ALLEGRO_COLOR backdrop = al_map_rgb(255, 255, 255);
	Map(char*, float, float);
	void add_tile_type(TileType);
	void render_map(float = 0, float = 0);
	void parse_map();
	TileType get_tile_type_at(float, float, float = 0, float = 0);
	Tile get_tile_at(float, float, float = 0, float = 0);
private:
	void _find_max(void);
	void _find_spawn(void);
	bool _map_parsed = false;
};

#endif // !MAP_HPP


text:
Raspberry Pi Library for Controlling an RGB LED Matrix
------------------------------------------------------

This library enables drawing shapes and writing text on an RGB LED Matrix using Raspberry Pi GPIO.
I developed it using a Raspberry Pi Model B running Debian GNU/Linux 7.0 (wheezy) and a 16x32 RGB LED Matrix purchased from the excellent Adafruit.
http://www.adafruit.com/products/420

Check out Adafruit's tutorial for more details:  https://learn.adafruit.com/connecting-a-16x32-rgb-led-matrix-panel-to-a-raspberry-pi

### Running

Just start the cpy.sh script in the root. It will copy all the neccessary files and build them on pi. (You'll need to manually create some directories on pi. Check the script for more details.)

	$ ./cpy.sh

To run the app, cd to app root and:

	$ sudo ./luas

### Photo
![image](https://raw.githubusercontent.com/vfonic/RgbMatrixLuas/master/photo.jpg)

### Credits

Many thanks for the code snippets taken from:  https://github.com/mattdh666/rpi-led-matrix-panel

### License

Written by Viktor Fonic and released under an MIT License. See the LICENSE file for deatils.


text:
require_relative 'molecular_activity'

module BELParser
  module Language
    module Version1_0
      module ReturnTypes
        # PhosphataseActivity return type.
        class PhosphataseActivity < MolecularActivity
          # Return the {Symbol} value.
          #
          # @note This method should be overridden in subclasses.
          def self.to_sym
            raise_not_implemented(__method__) if self != PhosphataseActivity
            :phosphatase_activity
          end
        end
      end
    end
  end
end


text:
CODE 1.0
========

A git repository hosting service and social coding collaboration service.

Quickstart
----------

```
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
echo "create database vilya1" | mysql -uroot
alembic upgrade head
python manage.py create_user
python wsgi.py
```

Override settings configuration
-------------------------------

```
mkdir -p instance
cp vilya/settings.cfg.example instance/settings.cfg
# then override configurations in instance/settings.cfg
```

Generate schema
---------------

```
alembic revision --autogenerate -m "blabla..."
alembic upgrade head
```

Frontend
--------

### Dependency
1. npm
2. rbenv(or rvm, ruby)

### Install tools

```
npm install coffee-script
gem install sass chunky_png fssm compass
```

Maybe you need:

`RBENV_VERSION="2.0.0-p247" python wsgi.py`

### rbenv

https://github.com/sstephenson/rbenv

```
curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
unset RUBYOPT
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
echo 'unset RUBYOPT' >> ~/.bash_profile
rbenv install 2.0.0-p247
rbenv rehash
```


text:
package org.qfox.jestful.interception.annotation;

import java.lang.annotation.*;

/**
 * Created by yangchangpei on 17/5/8.
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.ANNOTATION_TYPE})
public @interface Functions {
}


text:
namespace Atf.ScreenRecorder.UI.Presentation {
   using Atf.ScreenRecorder.Configuration;
   using System;
   interface IConfigurationView : IView {
      event EventHandler Cancel;
      event EventHandler OK;
      SRConfigSection Configuration {
         get;
         set;
      }
   }
}


text:
ECHO OFF
ECHO.
IF EXIST ..\..\local\win32\env.local.bat call ..\..\local\win32\env.local.bat

IF NOT EXIST ..\..\local\win32\env.local.bat ECHO Error: env.local.bat Not Found!!! Look at ..\..\local_examples directory.
IF NOT EXIST ..\..\local\win32\env.local.bat mkdir ..\..\local\win32
IF NOT EXIST ..\..\local\win32\env.local.bat PAUSE

REM Cygwin must come before GIT to avoid ssh.exe conflicts in rsync
REM SET CYGWIN_HOME=C:\Cygwin
SET PATH=%PATH%;%GIT_HOME%\bin

SET PATH=%PATH%;%NODEJS_HOME%
SET PATH=%PATH%;%AppData%\npm

SET PATH=%PATH%;%PROJECT_HOME%\misc\env\common\win32\scripts
SET PATH=%PATH%;%PROJECT_HOME%\misc\env\local\win32
SET PATH=%PATH%;%windir%
SET PATH=%PATH%;%windir%\System32

cd "%PROJECT_HOME%"

ECHO Common Environment Setup.

IF EXIST "%PROJECT_HOME%\misc\env\user\win32\env.user.bat" call "%PROJECT_HOME%\misc\env\user\win32\env.user.bat"

ECHO.


text:
require 'net/https'
require 'uri'

# http://sldn.softlayer.com/reference/services/SoftLayer_Resource_Metadata
module ::Ohai::Mixin::SoftlayerMetadata
  SOFTLAYER_API_QUERY_URL = 'https://api.service.softlayer.com/rest/v3.1/SoftLayer_Resource_Metadata' unless defined?(SOFTLAYER_API_QUERY_URL)

  def fetch_metadata
    metadata  = {
      'public_fqdn'   => fetch_metadata_item("getFullyQualifiedDomainName.txt"),
      'local_ipv4'    => fetch_metadata_item("getPrimaryBackendIpAddress.txt"),
      'public_ipv4'   => fetch_metadata_item("getPrimaryIpAddress.txt"),
      'region'        => fetch_metadata_item("getDatacenter.txt"),
      'instance_id'   => fetch_metadata_item("getId.txt")
    }
  end

  # Softlayer's metadata api is only available over HTTPS.
  # Ruby by default does not link to the system's CA bundle
  # however Chef-omnibus should set SSL_CERT_FILE to point to a valid file.
  # Manually supply and specify a suitable CA bundle here or
  # set the SSL_CERT_FILE file environment variable to a valid value otherwise.
  def ca_file_location
    ::Ohai::Config[:ca_file]
  end

  def fetch_metadata_item(item)
    full_url = "#{SOFTLAYER_API_QUERY_URL}/#{item}"
    u = URI(full_url)
    net = ::Net::HTTP.new(u.hostname, u.port)
    net.ssl_version = "TLSv1"
    net.use_ssl = true
    net.ca_file = ca_file_location
    res = net.get(u.request_uri)
    if res.code.to_i.between?(200,299)
      res.body
    else
      ::Ohai::Log.error("Unable to fetch item #{full_url}: status (#{res.code}) body (#{res.body})")
      nil
    end
  rescue => e
    ::Ohai::Log.error("Unable to fetch softlayer metadata from #{u}: #{e.class}: #{e.message}")
    raise e
  end
end


text:
// common
import main from "./common/main";
import boost from "./common/boost";
import data from "./data/data";
import color from "./common/color";
import interaction from "./interaction/interaction";
import legend from "./common/legend";
import title from "./common/title";
import tooltip from "./common/tooltip";

import {deepClone} from "../../module/util";

/**
 * Class to set options on generating chart.
 * - It's instantiated internally, not exposed for public.
 * @class Options
 * @see {@link bb.generate} to use these options on generating the chart
 */
export default class Options {
	static data = {};

	static setOptions(options: any[]) {
		this.data = options
			.reduce((a, c) => ({...a, ...c}), this.data);
	}

	constructor() {
		return deepClone(
			main,
			boost,
			data,
			color,
			interaction,
			legend,
			title,
			tooltip,
			Options.data
		);
	}
}


text:
#include <stdlib.h>
#include <string.h>
#include "tm.h"
#include "types.h"
#include "utility.h"
#include "vector.h"

/* =============================================================================
 * vector_alloc
 * -- Returns NULL if failed
 * =============================================================================
 */
vector_t*
vector_alloc (long initCapacity)
{
    vector_t* vectorPtr;
    long capacity = MAX(initCapacity, 1);

    vectorPtr = (vector_t*)SEQ_MALLOC(sizeof(vector_t));

    if (vectorPtr != NULL) {
        vectorPtr->size = 0;
        vectorPtr->capacity = capacity;
        vectorPtr->elements = (void**)SEQ_MALLOC(capacity * sizeof(void*));
        if (vectorPtr->elements == NULL) {
            return NULL;
        }
    }

    return vectorPtr;
}

/* =============================================================================
 * Pvector_alloc
 * -- Returns NULL if failed
 * =============================================================================
 */
vector_t*
Pvector_alloc (long initCapacity)
{
    vector_t* vectorPtr;
    long capacity = MAX(initCapacity, 1);

    vectorPtr = (vector_t*)P_MALLOC(sizeof(vector_t));

    if (vectorPtr != NULL) {
        vectorPtr->size = 0;
        vectorPtr->capacity = capacity;
        vectorPtr->elements = (void**)P_MALLOC(capacity * sizeof(void*));
        if (vectorPtr->elements == NULL) {
            return NULL;
        }
    }

    return vectorPtr;
}

/* =============================================================================
 * vector_free
 * =============================================================================
 */
void
vector_free (vector_t* vectorPtr)
{
    SEQ_FREE(vectorPtr->elements);
    SEQ_FREE(vectorPtr);
}

/* =============================================================================
 * Pvector_free
 * =============================================================================
 */
void
Pvector_free (vector_t* vectorPtr)
{
    P_FREE(vectorPtr->elements);
    P_FREE(vectorPtr);
}

/* =============================================================================
 * vector_at
 * -- Returns NULL if failed
 * =============================================================================
 */
void*
vector_at (vector_t* vectorPtr, long i)
{
    if ((i < 0) || (i >= vectorPtr->size)) {
        return NULL;
    }

    return (vectorPtr->elements[i]);
}

/* =============================================================================
 * vector_pushBack
 * -- Returns FALSE if fail, else TRUE
 * =============================================================================
 */
bool_t
vector_pushBack (vector_t* vectorPtr, void* dataPtr)
{
    if (vectorPtr->size == vectorPtr->capacity) {
        long i;
        long newCapacity = vectorPtr->capacity * 2;
        void** newElements = (void**)SEQ_MALLOC(newCapacity * sizeof(void*));
        if (newElements == NULL) {
            return FALSE;
        }
        vectorPtr->capacity = newCapacity;
        for (i = 0; i < vectorPtr->size; i++) {
            newElements[i] = vectorPtr->elements[i];
        }
        SEQ_FREE(vectorPtr->elements);
        vectorPtr->elements = newElements;
    }

    vectorPtr->elements[vectorPtr->size++] = dataPtr;

    return TRUE;
}

/* =============================================================================
 * Pvector_pushBack
 * -- Returns FALSE if fail, else TRUE
 * =============================================================================
 */
bool_t
Pvector_pushBack (vector_t* vectorPtr, void* dataPtr)
{
    if (vectorPtr->size == vectorPtr->capacity) {
        long i;
        long newCapacity = vectorPtr->capacity * 2;
        void** newElements = (void**)P_MALLOC(newCapacity * sizeof(void*));
        if (newElements == NULL) {
            return FALSE;
        }
        vectorPtr->capacity = newCapacity;
        for (i = 0; i < vectorPtr->size; i++) {
            newElements[i] = vectorPtr->elements[i];
        }
        P_FREE(vectorPtr->elements);
        vectorPtr->elements = newElements;
    }

    vectorPtr->elements[vectorPtr->size++] = dataPtr;

    return TRUE;
}

/* =============================================================================
 * vector_popBack
 * Returns NULL if fail, else returns last element
 * =============================================================================
 */
void*
vector_popBack (vector_t* vectorPtr)
{
    if (vectorPtr->size < 1) {
        return NULL;
    }

    return (vectorPtr->elements[--(vectorPtr->size)]);
}

/* =============================================================================
 * vector_getSize
 * =============================================================================
 */
long
vector_getSize (vector_t* vectorPtr)
{
    return (vectorPtr->size);
}

/* =============================================================================
 * vector_clear
 * =============================================================================
 */
void
vector_clear (vector_t* vectorPtr)
{
    vectorPtr->size = 0;
}

/* =============================================================================
 * vector_sort
 * =============================================================================
 */
extern "C"
{

void
vector_sort (vector_t* vectorPtr, int (*compare) (const void*, const void*))
{
    qsort((void*)vectorPtr->elements, vectorPtr->size, sizeof(void**), compare);
}
}

/* =============================================================================
 * vector_copy
 * =============================================================================
 */
bool_t
vector_copy (vector_t* dstVectorPtr, vector_t* srcVectorPtr)
{
    long dstCapacity = dstVectorPtr->capacity;
    long srcSize = srcVectorPtr->size;
    if (dstCapacity < srcSize) {
        long srcCapacity = srcVectorPtr->capacity;
        void** elements = (void**)SEQ_MALLOC(srcCapacity * sizeof(void*));
        if (elements == NULL) {
            return FALSE;
        }
        SEQ_FREE(dstVectorPtr->elements);
        dstVectorPtr->elements = elements;
        dstVectorPtr->capacity = srcCapacity;
    }

    memcpy(dstVectorPtr->elements,
           srcVectorPtr->elements,
           (srcSize * sizeof(void*)));
    dstVectorPtr->size = srcSize;

    return TRUE;
}

/* =============================================================================
 * Pvector_copy
 * =============================================================================
 */
bool_t
Pvector_copy (vector_t* dstVectorPtr, vector_t* srcVectorPtr)
{
    long dstCapacity = dstVectorPtr->capacity;
    long srcSize = srcVectorPtr->size;
    if (dstCapacity < srcSize) {
        long srcCapacity = srcVectorPtr->capacity;
        void** elements = (void**)P_MALLOC(srcCapacity * sizeof(void*));
        if (elements == NULL) {
            return FALSE;
        }
        P_FREE(dstVectorPtr->elements);
        dstVectorPtr->elements = elements;
        dstVectorPtr->capacity = srcCapacity;
    }

    memcpy(dstVectorPtr->elements,
           srcVectorPtr->elements,
           (srcSize * sizeof(void*)));
    dstVectorPtr->size = srcSize;

    return TRUE;
}

/* =============================================================================
 * TEST_VECTOR
 * =============================================================================
 */
#ifdef TEST_VECTOR

#include <stdio.h>

static void
printVector (vector_t* vectorPtr)
{
    long i;
    long size = vector_getSize(vectorPtr);

    printf("[");
    for (i = 0; i < size; i++) {
        printf("%li ", *((long*)vector_at(vectorPtr, i)));
    }
    puts("]");
}

static void
insertInt (vector_t* vectorPtr, long* data)
{
    printf("Inserting: %li\n", *data);
    vector_pushBack(vectorPtr, (void*)data);
    printVector(vectorPtr);
}

static void
removeInt (vector_t* vectorPtr)
{
    printf("Removing: %li\n", *((long*)vector_popBack(vectorPtr)));
    printVector(vectorPtr);

}

static int
compareInt (const void* aPtr, const void* bPtr)
{
    long a = *((long*)(*(void**)aPtr));
    long b = *((long*)(*(void**)bPtr));

    return (a - b);
}

int
main ()
{
    vector_t* vectorPtr;
    vector_t* copyVectorPtr;
    long data[] = {3, 1, 4, 1, 5, -1};
    long i;

    puts("Starting...");

    vectorPtr = vector_alloc(1);
    copyVectorPtr = vector_alloc(1);

    for (i = 0; data[i] >= 0; i++) {
        insertInt(vectorPtr, &data[i]);
    }

    vector_copy(copyVectorPtr, vectorPtr);

    while (i-- > 0) {
        removeInt(vectorPtr);
    }

    printf("copy ");
    printVector(copyVectorPtr);
    printf("sort ");
    vector_sort(copyVectorPtr, &compareInt);
    printVector(copyVectorPtr);

    vector_free(vectorPtr);
    vector_free(copyVectorPtr);

    puts("Done.");

    return 0;
}

#endif /* TEST_VECTOR */

/* =============================================================================
 *
 * End of vector.c
 *
 * =============================================================================
 */


text:
.. seqTools documentation master file, created by
   sphinx-quickstart on Tue Oct  2 21:00:22 2012.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to seqTools's documentation!
====================================

The main repository for seqTools is located on bitbucket at https://github.com/seandavi/seqtools.

.. toctree::
   :maxdepth: 2

   seqtool
   vcf
   structuralVariation
   api

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`


text:
import os
from twilio.rest import Client

# Get your Account SID and Auth Token from https://twilio.com/console
# To set up environmental variables, see http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)

fleet_sid = 'FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
fleet_service = client.preview.deployed_devices.fleets(sid=fleet_sid)

keys = fleet_service.keys.list()

for key in keys:
    print(key.sid)


text:
layout: post
excerpt_separator: <!--more-->
img: trainer_Hoang.png
category: team
title: Trainer Hoang Pham
lang: en
ref: trainer_hoang
permalink: trainer-hoang-pham-english
description: |
---

Hoang Pham started to learn Vovinam in the end of 2010 with master Vittorio Cera at Vo Duong Gorla in Milan, Italia. Master Vittorio Cera is the technical director of the European Vovinam Viet Vo Dao Federation [EVVF](http://www.vovinam-evvf.eu/) and holds Hong Dai Nhi Cap (6th Dang).

Currently holds Hoang Dai (Yellow Belt, in Vovinam, it means the initial Trainer's belt). He has gone through Lam Dai (Blue Belt) exams in Milan, Italy:

- Lam Đai (Blue Belt), in June 2011
- Lam Đai Nhất Cấp (Blue Belt 1st Cap), in May 2012
- Lam Đai Nhị Cấp (Blue Belt 2nd Cap),  in May 2013
- Lam Đai Tam Cấp (Blue Belt 3rd Cap), in June 2014

In 17th May 2015 in Briosco (MB), Italy, he passed the Hoang Dai (Yellow Belt) at the exam session organized by the Italian Vovinam Viet Vo Dao Federation.

<!--more-->

During his Vovinam career, he has attent several Vovinam seminars and championships in Italy and also abroad:

- Vovinam Seminar in October 2011, organized by the Deutschen Vovinam Viet Vo Dao Fachverband [DVVF](http://www.vovinam-in-dvvf.eu/)
- Seminar and demonstration at the Asian Festival in Marina di Carrara in 2011,he joined a team of 4 athletes and performed Vovinam Leg Attack.
- Joined the free fight tournament in Italy under the weight category 70kg.
- Performed leg attack in June 2012 at the end of season demonstration in Municipio 2 (Milano)
- Joined the Gorla team to perform Leg Attack demonstration at the event organized by Vietnamese Embassy in Milan in 2013.
- EVVF-Seminar in Frankfurt am Main in May 2016.

In October 2015, he moved to Potsdam, Germany to work permanently as a Software Developer in a startup located in Berlin. Since Berlin has no Vovinam presence, he has to train his neighbour's son in a park in Potsdam. In April 2016, he moved to live in Lichstenberg district, Berlin. After the EVVF seminar in Frankfurt am Main, he met master Tran Dai Chieu, 6th Dang, Vice president of German Vovinam Viet Vo Dao Federation [DVVF](http://www.vovinam-in-dvvf.eu/). Master Chieu suggested him to open a Vovinam class in Berlin to teach beginners Vovinam techniques. With great help and support from master Chieu, he contacted Mr. Hoang Vinh, the previous maintainer of the Vovinam Berlin group, and resurrected the Vovinam movement in Berlin. First class started in June 2016 in a Driving school in Dong Xuan Center (Fahrschule Hoan Kiem).

In September 2016, he was accepted to open a new Vovinam department in S.V. Tora club, and became the leader of the department. Since then, the club trains 3 times per week in Lichstenberg district and Friedrichshain district in Berlin.


text:
from absl.testing import absltest
from xmanager import xm
from xmanager.cloud import build_image

class BuildImageTest(absltest.TestCase):

  def create_container(self, entrypoint) -> xm.PythonContainer:
    return xm.PythonContainer(entrypoint=entrypoint)

  def test_get_entrypoint_commands_module_adds_suffix(self):
    project = self.create_container(xm.ModuleName('some.python.module'))
    entrypoint_commands = build_image._get_entrypoint_commands(project)
    self.assertEndsWith(entrypoint_commands, ' "$@"')

  def test_get_entrypoint_commands_adds_suffix(self):
    commands = ['echo "aaa"']
    project = self.create_container(xm.CommandList(commands))
    entrypoint_commands = build_image._get_entrypoint_commands(project)
    self.assertEndsWith(entrypoint_commands, ' "$@"')

  def test_get_entrypoint_commands_no_dup_plain_suffix(self):
    commands = ['echo "aaa" $@']
    project = self.create_container(xm.CommandList(commands))
    entrypoint_commands = build_image._get_entrypoint_commands(project)
    self.assertEndsWith(entrypoint_commands, ' $@')

  def test_get_entrypoint_commands_no_dup_quoted_suffix(self):
    commands = ['echo "aaa" "$@"']
    project = self.create_container(xm.CommandList(commands))
    entrypoint_commands = build_image._get_entrypoint_commands(project)
    self.assertEndsWith(entrypoint_commands, ' "$@"')
    self.assertNotEndsWith(entrypoint_commands, ' "$@" "$@"')

  def test_get_entrypoint_commands_dup_single_quoted_suffix(self):
    commands = ['echo "aaa" \'$@\'']
    project = self.create_container(xm.CommandList(commands))
    entrypoint_commands = build_image._get_entrypoint_commands(project)
    self.assertEndsWith(entrypoint_commands, ' \'$@\' "$@"')

if __name__ == '__main__':
  absltest.main()


text:
//
//  CommonViewController.h
//  LSDevelopmentIOS
//
//  Created by 刘硕 on 16/4/6.
//  Copyright © 2016年 liushuo. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface CommonViewController : UIViewController

/**
 *  导航左上角的按钮
 */
@property(nullable , nonatomic , strong)UIBarButtonItem *leftButtonItem;

/**
 *  导航右上角的按钮
 */
@property(nullable , nonatomic , strong)UIBarButtonItem *rightButtonItem;

/**
 *  自定义返回
 */
@property(nonatomic,assign)BOOL customBackItem;

/**
 *  设置系统返回按钮
 *
 *  @param text <#text description#>
 */
- (void)setBackBarButtonItemWithTitle:(nullable NSString *)text;

/**
 *  创建导航左上角的按钮
 *
 *  @param text                文字内容
 *  @param isBackBarButtonItem 是否是返回按钮
 *
 *  @return <#return value description#>
 */
- (nullable UIBarButtonItem *)leftButtonItemWithTitle:(nullable NSString *)text isBackBarButtonItem:(BOOL)isBackBarButtonItem;

/**
 *  创建导航左上角的按钮
 *
 *  @param imageName           图片
 *  @param isBackBarButtonItem 是否是范湖按钮
 *
 *  @return <#return value description#>
 */
- (nullable UIBarButtonItem *)leftButtonItemWithImage:(nullable NSString *)imageName isBackBarButtonItem:(BOOL)isBackBarButtonItem;

/**
 *  创建导航左上角的按钮
 *
 *  @param text                文字
 *  @param imageName           图片
 *  @param isBackBarButtonItem 是否是返回按钮
 *
 *  @return <#return value description#>
 */
- (nullable UIBarButtonItem *)leftButtonItemWithTitle:(nullable NSString *)text image:(nullable NSString *)imageName isBackBarButtonItem:(BOOL)isBackBarButtonItem;

/**
 *  创建导航右上角按钮
 *
 *  @param text 按钮的文字
 *
 *  @return <#return value description#>
 */
- (nullable UIBarButtonItem *)rightButtonItemWithTitle:(nullable NSString *)text;

/**
 *  创建导航右上角按钮
 *
 *  @param imageName 按钮的图片
 *
 *  @return <#return value description#>
 */
- (nullable UIBarButtonItem *)rightButtonItemWithImage:(nullable NSString *)imageName;

- (void)leftBtnClick:(nullable UIBarButtonItem *)leftButtonItem;//左边按钮点击事件
- (void)righBtnClick:(nullable UIBarButtonItem *)rightButtonItem;//右边按钮点击事件

// 默认返回为YES,表示支持右滑返回
- (BOOL)gestureRecognizerShouldBegin;

/**
 *  设置标题的颜色
 *
 *  @param color <#color description#>
 */
-(void)setTitleColor:(nullable UIColor *)color;

@end


text:
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">

	<LinearLayout
			android:id="@+id/drawer_menu_settings"
			android:weightSum="1"
			android:background="@drawable/selector_btn_blue"
			android:orientation="horizontal"
			android:layout_width="match_parent"
			android:layout_height="@dimen/menu_height_on_drawer">

		<ImageView
				android:layout_width="0dp"
				android:layout_weight="0.2"
				android:layout_height="match_parent"
				android:background="@android:color/transparent"
				android:src="@drawable/ic_settings"/>

		<TextView
				android:layout_width="0dp"
				android:layout_weight="0.8"
				style="@style/Settings.Open"
				android:text="@string/settings_open"
				android:layout_height="match_parent"/>
	</LinearLayout>
</merge>


text:
-- phpMyAdmin SQL Dump
-- version 4.3.11
-- http://www.phpmyadmin.net
--
-- author =  Lara Wäspe
--
-- Host: 127.0.0.1
-- Erstellungszeit: 27. Okt 2016 um 11:24
-- Server-Version: 5.6.24
-- PHP-Version: 5.6.8

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Datenbank: `umf_db`
--

CREATE DATABASE IF NOT EXISTS umf_db;

USE umf_db;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `polls`
--

CREATE TABLE IF NOT EXISTS `polls` (
  `index` int(11) NOT NULL,
  `question` varchar(100) NOT NULL,
  `answers` varchar(500) NOT NULL,
  `answercounts` varchar(100) NOT NULL,
  `voters` varchar(500) NOT NULL,
  `public` bit(1) NOT NULL,
  `checkdupes` bit(1) NOT NULL,
  `date` int(32) NOT NULL,
  `creator` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `users`
--

CREATE TABLE IF NOT EXISTS `users` (
  `index` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `hashedpw` varchar(250) NOT NULL,
  `regdate` int(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Indizes der exportierten Tabellen
--

--
-- Indizes für die Tabelle `polls`
--
ALTER TABLE `polls`
  ADD PRIMARY KEY (`index`);

--
-- Indizes für die Tabelle `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`index`);

--
-- AUTO_INCREMENT für exportierte Tabellen
--

--
-- AUTO_INCREMENT für Tabelle `polls`
--
ALTER TABLE `polls`
  MODIFY `index` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT für Tabelle `users`
--
ALTER TABLE `users`
  MODIFY `index` int(11) NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

INSERT INTO users VALUES (0,"anonymous", "-1", 0);


text:
<?PHP

class class_log {
	var $parser_options = array(
				"allow_html" => 0,
				"allow_mycode" => 1,
				"allow_smilies" => 0,
				"allow_imgcode" => 0,
				"filter_badwords" => 1
			);

	function add($section, $text) {
		global $flouser;
		if (!MYSQL_QUERY("INSERT INTO flobase_log (section, timestamp, currentuser, currentip, logvalue) VALUES('".mysql_real_escape_string($section)."', '".date("U")."', '".$flouser->userid."', '".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."', '".mysql_real_escape_string($text)."')")) return false;
		return mysql_insert_id();
	}

	function parse($logentry) {
		global $florensia, $parser;

		$logentry = $parser->parse_message($logentry, $this->parser_options);
		while ($parsedlog != $logentry) {
			if ($parsedlog) $logentry = $parsedlog;
			$parsedlog = preg_replace_callback("/{(([a-z]+):([a-z0-9_]+))}/i", 'logparsebridge', $logentry);
		}
		return $parsedlog;
	}
}

	function logparsebridge($matches) {
		global $flouserdata, $strintable, $florensia, $stringtable, $classquest;

		switch ($matches[2]) {
			case "user": {
				$return = $flouserdata->get_username($matches[3]);
				break;
			}
			case "npc": {
				$return = "outlink(array("npcdetails", $matches[3], $stringtable->get_string($matches[3])))."' target='_blank'>".$stringtable->get_string($matches[3], array('protectionlink'=>1, 'protectionsmall'=>1))."";
				break;
			}
			case "item": {
				$return = "outlink(array("itemdetails", $matches[3], $stringtable->get_string($matches[3])))."' target='_blank'>".$stringtable->get_string($matches[3], array('protectionlink'=>1, 'protectionsmall'=>1))."";
				break;
			}
			case "dropid": {
				$drop = MYSQL_FETCH_ASSOC(MYSQL_QUERY("SELECT n.English as npcname, d.npcid, i.English as itemname, d.itemid FROM server_stringtable as n, server_stringtable as i, flobase_droplist as d WHERE dropid=".intval($matches[3])." AND d.npcid=n.Code AND d.itemid=i.Code LIMIT 1"));
				$return = "outlink(array("npcdetails", $drop['npcid'], $drop['npcname']))."' target='_blank'>".$florensia->escape($drop['npcname'])." ({$drop['npcid']})/outlink(array("itemdetails", $drop['itemid'], $drop['itemname']))."' target='_blank'>".$florensia->escape($drop['itemname'])." ({$drop['itemid']})";
				break;
			}
			case "quest": {
				$return = "outlink(array("questdetails", $matches[3], $classquest->get_title($matches[3])))."' target='_blank'>".$classquest->get_title($matches[3])."";
				break;
			}
			case "map": {
				$return = "outlink(array("mapdetails", $matches[3], $stringtable->get_string($matches[3])))."' target='_blank'>".$stringtable->get_string($matches[3], array('protectionlink'=>1, 'protectionsmall'=>1))."";
				break;
			}
			case "timestamp": {
				$return = date("m.d.y/H:i:s", $matches[3]);
				break;
			}
			case "usernote": {
				$return = "note";
				break;
			}
			case "guide": {
				$guide = MYSQL_FETCH_ASSOC(MYSQL_QUERY("SELECT title FROM flobase_guides WHERE id=".intval($matches[3])." LIMIT 1"));
				if (!$guide['title']) $guide['title'] = "???";
				$return = """.$florensia->escape($guide['title']).""";
				break;
			}
			case "gallery": {
				$gallery = MYSQL_FETCH_ASSOC(MYSQL_QUERY("SELECT name FROM flobase_gallery WHERE galleryid=".intval($matches[3])." LIMIT 1"));
				if (!strlen($gallery['name'])) $gallery['name'] = "-";
				$return = ""outlink(array("gallery", "i", intval($matches[3]), $gallery['name']))."'>".$florensia->escape($gallery['name']).""";
				break;
			}
			case "guild": {
				$guild = MYSQL_FETCH_ASSOC(MYSQL_QUERY("SELECT guildid, guildname, server, memberamount FROM flobase_guild WHERE guildid=".intval($matches[3])." LIMIT 1"));
				if (!$guild) $return = "-";
				else {
					if ($guild['memberamount']) $return = "outlink(array("guilddetails", $guild['guildid'], $guild['server'], $guild['guildname']))."'>".$florensia->escape($guild['guildname'])."";
					else $return = "outlink(array("guilddetails", $guild['guildid'], $guild['server'], $guild['guildname']))."'>".$florensia->escape($guild['guildname'])."";
				}
				break;
			}
			case "character": {
				$return = "outlink(array("characterdetails", $matches[3]))."'>".$florensia->escape($matches[3])."";
				break;
			}
			case "characterid": {
				$character = new class_character(intval($matches[3]));
				$return = "outlink(array("characterdetails", $character->data['charname']))."'>".$florensia->escape($character->data['charname'])."";
				break;
			}
			case "characterverification": {
				$return = "root}/admincharacterverification.php?s=".intval($matches[3])."' target='_blank'>request";
				break;
			}
			case "log": {
				$return = "";
				break;
			}
			default: $return = "({$matches[2]}:{$matches[3]})";
		}
		return $return." ({$matches[3]})";

	}

?>


text:
#ifndef _H8300_SWITCH_TO_H
#define _H8300_SWITCH_TO_H

/*
 * switch_to(n) should switch tasks to task ptr, first checking that
 * ptr isn't the current task, in which case it does nothing.  This
 * also clears the TS-flag if the task we switched to has used the
 * math co-processor latest.
 */
/*
 * switch_to() saves the extra registers, that are not saved
 * automatically by SAVE_SWITCH_STACK in resume(), ie. d0-d5 and
 * a0-a1. Some of these are used by schedule() and its predecessors
 * and so we might get see unexpected behaviors when a task returns
 * with unexpected register values.
 *
 * syscall stores these registers itself and none of them are used
 * by syscall after the function in the syscall has been called.
 *
 * Beware that resume now expects *next to be in d1 and the offset of
 * tss to be in a1. This saves a few instructions as we no longer have
 * to push them onto the stack and read them back right after.
 *
 * 02/17/96 - Jes Sorensen (jds@kom.auc.dk)
 *
 * Changed 96/09/19 by Andreas Schwab
 * pass prev in a0, next in a1, offset of tss in d1, and whether
 * the mm structures are shared in d2 (to avoid atc flushing).
 *
 * H8/300 Porting 2002/09/04 Yoshinori Sato
 */

asmlinkage void resume(void);
#define switch_to(prev,next,last) {                         \
  void *_last;						    \
  __asm__ __volatile__(					    \
  			"mov.l	%1, er0\n\t"		    \
			"mov.l	%2, er1\n\t"		    \
                        "mov.l  %3, er2\n\t"                \
			"jsr @_resume\n\t"                  \
                        "mov.l  er2,%0\n\t"                 \
		       : "=r" (_last)			    \
		       : "r" (&(prev->thread)),		    \
			 "r" (&(next->thread)),		    \
                         "g" (prev)                         \
		       : "cc", "er0", "er1", "er2", "er3"); \
  (last) = _last; 					    \
}

#endif /* _H8300_SWITCH_TO_H */


text:
package opennlp.tools.util.wordvector;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import opennlp.tools.util.java.Experimental;

/**
 *

 * Warning: Experimental new feature, see OPENNLP-1144 for details, the API might be changed anytime.
 */
@Experimental
public class Glove {

  private Glove() {
  }

  /**
   * Parses a glove vector plain text file.
   *

   * Warning: Experimental new feature, see OPENNLP-1144 for details, the API might be changed anytime.
   *
   * @param in the input stream for Glove vectors
   * @return a Glove based wv table
   * @throws IOException if any error occurs during parsing
   */
  @Experimental
  public static WordVectorTable parse(InputStream in) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8),
        1024 * 1024);

    Map<String, WordVector> vectors = new HashMap<>();

    int dimension = -1;
    String line;
    while ((line = reader.readLine()) != null) {
      String[] parts = line.split(" ");

      if (dimension == -1) {
        dimension = parts.length - 1;
      }
      else if (dimension != parts.length - 1) {
        throw new IOException("Vector dimension must be constant!");
      }

      String token = parts[0];

      float[] vector = new float[dimension];

      for (int i = 0; i < vector.length; i++) {
        vector[i] = Float.parseFloat(parts[i + 1]);
      }

      vectors.put(token, new FloatArrayVector(vector));
    }

    return new MapWordVectorTable(Collections.unmodifiableMap(vectors));
  }
}