Gets invoked when the server comes up
766213
public static void onStartup(String container, Object containerContext) {
        try {
            startedUp = false;
            logger = LoggerUtil.getStandardLogger();
            containerName = container;

            // use reflection to avoid build-time dependencies
            String pluginPackage = MdwDataSource.class.getPackage().getName() + "." + containerName.toLowerCase();
            String namingProviderClass = pluginPackage + "." + containerName + "Naming";
            namingProvider = Class.forName(namingProviderClass).asSubclass(NamingProvider.class).newInstance();
            logger.info("Naming Provider: " + namingProvider.getClass().getName());

            String ds = PropertyManager.getProperty(PropertyNames.MDW_CONTAINER_DATASOURCE_PROVIDER);
            if (ds == null)
                ds = PropertyManager.getProperty("mdw.container.datasource_provider"); // compatibility
            if (StringHelper.isEmpty(ds) || ds.equals(DataSourceProvider.TOMCAT)) {
                dataSourceProvider = new TomcatDataSource();
            } else if (DataSourceProvider.MDW.equals(ds)){
                dataSourceProvider = new MdwDataSource();
            } else {
                String dsProviderClass = pluginPackage + "." + ds + "DataSource";
                dataSourceProvider = Class.forName(dsProviderClass).asSubclass(DataSourceProvider.class).newInstance();
            }
            logger.info("Data Source Provider: " + dataSourceProvider.getClass().getName());

            String jms = PropertyManager.getProperty(PropertyNames.MDW_CONTAINER_JMS_PROVIDER);
            if (jms == null)
                jms = PropertyManager.getProperty("mdw.container.jms_provider"); // compatibility
            if (StringHelper.isEmpty(jms))
                jms = JmsProvider.ACTIVEMQ;

            if (JmsProvider.ACTIVEMQ.equals(jms)) {
                if (jmsProvider == null) {
                    // use below to avoid build time dependency
                    jmsProvider = Class.forName("com.centurylink.mdw.container.plugin.activemq.ActiveMqJms").asSubclass(JmsProvider.class).newInstance();
                }
            }
            else {
                String jmsProviderClass = pluginPackage + "." + jms + "Jms";
                jmsProvider = Class.forName(jmsProviderClass).asSubclass(JmsProvider.class).newInstance();
            }

            logger.info("JMS Provider: " + (jmsProvider==null?"none":jmsProvider.getClass().getName()));

            String tp = PropertyManager.getProperty(PropertyNames.MDW_CONTAINER_THREADPOOL_PROVIDER);
            if (tp == null)
                tp = PropertyManager.getProperty("mdw.container.threadpool_provider"); // compatibility
            if (StringHelper.isEmpty(tp) || ThreadPoolProvider.MDW.equals(tp)) {
                threadPoolProvider = new CommonThreadPool();
                MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
                ObjectName mbeanName = new ObjectName("com.centurylink.mdw.container.plugin:type=CommonThreadPool,name=MDW Thread Pool Info");
                if (!mbs.isRegistered(mbeanName))
                    mbs.registerMBean(threadPoolProvider, mbeanName);
            }
            else {
                String tpProviderClass = pluginPackage + "." + tp + "ThreadPool";
                threadPoolProvider = Class.forName(tpProviderClass).asSubclass(ThreadPoolProvider.class).newInstance();
            }
            logger.info("Thread Pool Provider: " + threadPoolProvider.getClass().getName());

            startedUp = true;
            startupTime = new Date();
        }
        catch (Exception ex) {
            throw new StartupException("Failed to initialize ApplicationContext", ex);
        }
    }
918081
def run(self):
        
        listener = EventServer(self.address, EventNotifyHandler)
        log.info("Event listener running on %s", listener.server_address)
        # Listen for events until told to stop
        while not self.stop_flag.is_set():
            listener.handle_request()
1017511
@Handler
    public void onStart(Start event) throws IOException {
        closing = false;
        serverSocketChannel = ServerSocketChannel.open();
        serverSocketChannel.bind(serverAddress, backlog);
        MBeanView.addServer(this);
        fire(new NioRegistration(this, serverSocketChannel,
            SelectionKey.OP_ACCEPT, this), Channel.BROADCAST);
    }
1211955
function setCurrentServer(server) {
    if (server) {
        server.makeCurrent();
        assert.strictEqual(getCurrentServer(), server);
    }
    else {
        init.initOptions.serverUrl = null;
    }
}
999019
public void onModuleLoad() {
        RestRequestBuilder.setDefaultApplicationPath( "rest" );

        final Button sendGetButton = new Button( "GET" );
        final Button sendPostButton = new Button( "POST" );
        final Button sendPostPathButton = new Button( "POST + Path" );
        final TextBox nameField = new TextBox();
        nameField.setText( "GWT User" );
        final Label errorLabel = new Label();

        // We can add style names to widgets
        sendGetButton.addStyleName( "sendButton" );
        sendPostButton.addStyleName( "sendButton" );
        sendPostPathButton.addStyleName( "sendButton" );

        // Add the nameField and sendButton to the RootPanel
        // Use RootPanel.get() to get the entire body element
        RootPanel.get( "nameFieldContainer" ).add( nameField );
        RootPanel.get( "sendButtonContainer" ).add( sendGetButton );
        RootPanel.get( "sendButtonContainer" ).add( sendPostButton );
        RootPanel.get( "sendButtonContainer" ).add( sendPostPathButton );
        RootPanel.get( "errorLabelContainer" ).add( errorLabel );

        // Focus the cursor on the name field when the app loads
        nameField.setFocus( true );
        nameField.selectAll();

        // Create the popup dialog box
        final DialogBox dialogBox = new DialogBox();
        dialogBox.setText( "Remote Procedure Call" );
        dialogBox.setAnimationEnabled( true );
        final Button closeButton = new Button( "Close" );
        // We can set the id of a widget by accessing its Element
        closeButton.getElement().setId( "closeButton" );
        final Label textToServerLabel = new Label();
        final HTML serverResponseLabel = new HTML();
        VerticalPanel dialogVPanel = new VerticalPanel();
        dialogVPanel.addStyleName( "dialogVPanel" );
        dialogVPanel.add( new HTML( "<b>Sending name to the server:</b>" ) );
        dialogVPanel.add( textToServerLabel );
        dialogVPanel.add( new HTML( "<br><b>Server replies:</b>" ) );
        dialogVPanel.add( serverResponseLabel );
        dialogVPanel.setHorizontalAlignment( VerticalPanel.ALIGN_RIGHT );
        dialogVPanel.add( closeButton );
        dialogBox.setWidget( dialogVPanel );

        // Add a handler to close the DialogBox
        closeButton.addClickHandler( new ClickHandler() {
            public void onClick( ClickEvent event ) {
                dialogBox.hide();
                sendGetButton.setEnabled( true );
                sendPostButton.setEnabled( true );
                sendPostPathButton.setEnabled( true );
            }
        } );

        // Create a handler for the sendButton and nameField
        class MyHandler implements ClickHandler, KeyUpHandler {

            private final int req;

            MyHandler( int req ) {
                this.req = req;
            }

            /**
             * Fired when the user clicks on the sendButton.
             */
            public void onClick( ClickEvent event ) {
                sendNameToServer();
            }

            /**
             * Fired when the user types in the nameField.
             */
            public void onKeyUp( KeyUpEvent event ) {
                if ( event.getNativeKeyCode() == KeyCodes.KEY_ENTER ) {
                    sendNameToServer();
                }
            }

            /**
             * Send the name from the nameField to the server and wait for a response.
             */
            private void sendNameToServer() {
                // First, we validate the input.
                errorLabel.setText( "" );
                String textToServer = nameField.getText();
                if ( !FieldVerifier.isValidName( textToServer ) ) {
                    errorLabel.setText( "Please enter at least four characters" );
                    return;
                }

                // Then, we send the input to the server.
                sendGetButton.setEnabled( false );
                sendPostButton.setEnabled( false );
                sendPostPathButton.setEnabled( false );
                textToServerLabel.setText( textToServer );
                serverResponseLabel.setText( "" );

                RestCallback<GreetingResponse> callback = new RestCallback<GreetingResponse>() {
                    @Override
                    public void onSuccess( GreetingResponse result ) {
                        dialogBox.setText( "Remote Procedure Call" );
                        serverResponseLabel.removeStyleName( "serverResponseLabelError" );
                        serverResponseLabel.setHTML( new SafeHtmlBuilder().appendEscaped( result.getGreeting() )
                                .appendHtmlConstant( "<br><br>I am running " ).appendEscaped( result.getServerInfo() )
                                .appendHtmlConstant( ".<br><br>It looks like you are using:<br>" ).appendEscaped( result
                                        .getUserAgent() ).toSafeHtml() );
                        dialogBox.center();
                        closeButton.setFocus( true );
                    }

                    @Override
                    public void onError( Response response ) {
                        onRequestFailure();
                    }

                    @Override
                    public void onFailure( Throwable throwable ) {
                        onRequestFailure();
                    }
                };

                if ( req == 0 ) {
                    GreetingResourceBuilder.hello( textToServer ).callback( callback ).send();
                } else {
                    if ( req == 1 ) {
                        GreetingResourceBuilder.greet( new GreetingRequest( textToServer ) )
                                .callback( callback )
                                .send();
                    } else if ( req == 2 ) {
                        GreetingResourceBuilder.greet( "someId", null, new GreetingRequest( textToServer ) )
                                .addQueryParam( "other" )
                                .callback( callback )
                                .send();
                    } else {
                        GreetingResourceBuilder.greetWithCustomHTTPCode( "someId", null, new GreetingRequest( textToServer ) )
                                .addQueryParam( "other" )
                                .callback( callback )
                                .send();
                    }
                }
            }

            private void onRequestFailure() {
                // Show the RPC error message to the user
                dialogBox.setText( "Remote Procedure Call - Failure" );
                serverResponseLabel.addStyleName( "serverResponseLabelError" );
                serverResponseLabel.setHTML( SERVER_ERROR );
                dialogBox.center();
                closeButton.setFocus( true );
            }
        }

        // Add a handler to send the name to the server
        MyHandler handler = new MyHandler( 0 );
        sendGetButton.addClickHandler( handler );
        nameField.addKeyUpHandler( handler );

        sendPostButton.addClickHandler( new MyHandler( 1 ) );
        sendPostPathButton.addClickHandler( new MyHandler( 2 ) );
    }
1307741
function Server(server, options)
{
	events.EventEmitter.call(this);
	
	this.listen = function(options, callback) {
		server.listen(options, callback);
	};
	
	server.on('connection', (socket) => {
		options = options || {};
		options.isServer = true;
		this.emit('client', new Client(socket, options));
	});
}
1055359
@Override
  public final void onModuleLoad() {
    GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
      @Override
      public void onUncaughtException(Throwable e) {
        HtmlPlatform.log.error("Uncaught Exception: ", e);
      }
    });

    // Need to do everything else in a deferred command, so that
    // the uncaught exception handler has taken effect
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

      @Override
      public void execute() {
        start();
      }

    });
  }
1314709
function() {
        if (!this.loaded) {
            if (this.location != null) {

                var onFail = function(e) {
                    this.events.triggerEvent("loadend");
                };

                this.events.triggerEvent("loadstart");
                OpenLayers.Request.GET({
                    url: this.location,
                    success: this.parseData,
                    failure: onFail,
                    scope: this
                });
                this.loaded = true;
            }
        }    
    }
340845
function(cb) {
        var self = this
        //set mainHtml
        mainHtmlCache = fs.readFileSync(config.get('main_path'))
        self.emit("STARTUP")
        self.httpServer.listen(this.getConfig("port"), Meteor.bindEnvironment(function() {
            Log.info('xiami server listeing at ' + self.getConfig('port'))
            self.emit('STARTED')
            self.isStarted = true
            cb && cb()
        }))
    }
995955
function(server) {
    var app = server.app;
    var set = app.set;

    /**
     * Emit the "set" event whenever a setting is changed
     */
    app.set = function(name, value) {
      // Track the old/new value of the setting
      var oldValue = set.call(app, name);
      var result = set.apply(app, arguments);
      var newValue = set.call(app, name);

      // If it changed, then emit the "set" event
      if (oldValue !== newValue) {
        server.emit('set', name, newValue, oldValue);
      }

      return result;
    };

    /**
     * Bubble app errors up to the Swagger Server.
     */
    app.on('error', function() {
      server.emit.apply(server, ['error'].concat(_.slice(arguments)));
    });

    /**
     * Starts listening for connections, once the Swagger API is done being parsed.
     * If no port number is given, then the port number in the Swagger API will be used.
     *
     * @returns {http.Server}
     */
    app.listen = function() {
      var args = _.slice(arguments);
      var httpServer = http.createServer(app);

      // Wait until parsing is done
      server.__parser.whenParsed(function(err, api) {
        if (_.isFunction(args[0]) || !args[0]) {
          // No port number was provided, so get it from the Swagger API
          var host = api ? api.host || '' : '';
          var hostMatches = host.match(/(?:\:(\d+))$/); // ['hostname', 'port']
          if (hostMatches && hostMatches.length === 2) {
            var portNumber = parseInt(hostMatches[1]);

            if (args.length === 0) {
              // No args were specified, so just use the port number
              args = [portNumber];
            }
            else if (_.isFunction(args[0])) {
              // A callback was specified, so insert the port number before it
              args.splice(0, 0, portNumber);
            }
            else {
              // A blank port number was specified, so replace it
              args.splice(0, 1, portNumber);
            }
          }
        }

        util.debug('Starting HTTP server');
        httpServer.listen.apply(httpServer, args);
      });

      return httpServer;
    };

    /**
     * The {@link DataStore} object that's used by the mock middleware.
     * See https://github.com/BigstickCarpet/swagger-express-middleware/blob/master/docs/exports/DataStore.md
     *
     * @type {DataStore}
     */
    Object.defineProperty(app, 'dataStore', {
      configurable: true,
      enumerable: true,
      get: function() {
        return app.get('mock data store');
      },
      set: function(value) {
        app.set('mock data store', value);
      }
    });

    // Add new app settings
    app.enable('watch files');
    app.enable('mock');
    app.set('handlers path', './handlers');

    // Add Swagger middleware
    app.use(
      poweredBy,
      server.__middleware.metadata(),
      server.__middleware.CORS(),
      server.__middleware.files(),
      server.__middleware.parseRequest(),
      server.__middleware.validateRequest()
    );

    // Store the number of swagger middleware stored in the stack not defined by the user so that when the
    // user makes a live change in the ./handlers directory we will only remove the desired results
    var mwToKeepIndex = app._router.stack.length;

    server.__removeMiddleWare = function() {

      var mwToRemove = app._router.stack.length - mwToKeepIndex - mockRange;

      app._router.stack.splice(mwToKeepIndex, mwToRemove);
    };

    // Add Swagger Mock middleware
    app.use(server.__middleware.mock());

    // Patch the routing methods
    router.patch(app._router);
    var mockRange = app._router.stack.length - mwToKeepIndex;

    // Currently the way the routing works is the middlware used to patch the Express server is added first,
    // then the Swagger mocks, and then user's custom middlware as defined in the ./handlers directory. The MW defined
    // by the user needs to come between the Express patch MW and the Mock MW so this function is called to properly
    // arrange the Express router stack to the desired order.
    app._router.__sortMiddleWare = function() {
      // This function should ever only be called after an individual user MW is added to
      // the router Stack so we only need to pop() the array once and splice it in after the
      // Swagger patch middleware.
      var userMW = app._router.stack.pop();
      app._router.stack.splice(mwToKeepIndex, 0, userMW);
    };

    /**
     * Sets the "X-Powered-By" header
     */
    function poweredBy(req, res, next) {
      if (app.enabled('x-powered-by')) {
        res.setHeader('X-Powered-By', 'Swagger Server');
      }
      next();
    }
  }
519260
@Override
    public void serverStopping() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Server is stopping");
        }
        WebContainer wc = (WebContainer) WebContainer.getWebContainer();
        WebContainer.setServerStopping(true);
        if (wc!=null) wc.waitForApplicationInitialization();
    }
303346
public function onReady()
    {
        \PHPDaemon\Servers\WebSocket\Pool::getInstance()->addRoute(
            '/sockjs',
            function ($client) {
                return new SimpleRoute($client, $this);
            }
        );
    }
445374
public void onModuleLoad() {
    asyncGetJson(AGGREGATORS_URL, new GotJsonCallback() {
      public void got(final JSONValue json) {
        // Do we need more manual type checking?  Not sure what will happen
        // in the browser if something other than an array is returned.
        final JSONArray aggs = json.isArray();
        for (int i = 0; i < aggs.size(); i++) {
          aggregators.add(aggs.get(i).isString().stringValue());
        }
        ((MetricForm) metrics.getWidget(0)).setAggregators(aggregators);
        refreshFromQueryString();
        refreshGraph();
      }
    });

    // All UI elements need to regenerate the graph when changed.
    {
      final ValueChangeHandler<Date> vch = new ValueChangeHandler<Date>() {
        public void onValueChange(final ValueChangeEvent<Date> event) {
          refreshGraph();
        }
      };
      TextBox tb = start_datebox.getTextBox();
      tb.addBlurHandler(refreshgraph);
      tb.addKeyPressHandler(refreshgraph);
      start_datebox.addValueChangeHandler(vch);
      tb = end_datebox.getTextBox();
      tb.addBlurHandler(refreshgraph);
      tb.addKeyPressHandler(refreshgraph);
      end_datebox.addValueChangeHandler(vch);
    }
    autoreoload_interval.addBlurHandler(refreshgraph);
    autoreoload_interval.addKeyPressHandler(refreshgraph);
    yrange.addBlurHandler(refreshgraph);
    yrange.addKeyPressHandler(refreshgraph);
    y2range.addBlurHandler(refreshgraph);
    y2range.addKeyPressHandler(refreshgraph);
    ylog.addClickHandler(new AdjustYRangeCheckOnClick(ylog, yrange));
    y2log.addClickHandler(new AdjustYRangeCheckOnClick(y2log, y2range));
    ylog.addClickHandler(refreshgraph);
    y2log.addClickHandler(refreshgraph);
    ylabel.addBlurHandler(refreshgraph);
    ylabel.addKeyPressHandler(refreshgraph);
    y2label.addBlurHandler(refreshgraph);
    y2label.addKeyPressHandler(refreshgraph);
    yformat.addBlurHandler(refreshgraph);
    yformat.addKeyPressHandler(refreshgraph);
    y2format.addBlurHandler(refreshgraph);
    y2format.addKeyPressHandler(refreshgraph);
    wxh.addBlurHandler(refreshgraph);
    wxh.addKeyPressHandler(refreshgraph);
    global_annotations.addBlurHandler(refreshgraph);
    global_annotations.addKeyPressHandler(refreshgraph);
    horizontalkey.addClickHandler(refreshgraph);
    keybox.addClickHandler(refreshgraph);
    nokey.addClickHandler(refreshgraph);
    smooth.addClickHandler(refreshgraph);
    styles.addChangeHandler(refreshgraph);

    yrange.setValidationRegexp("^("                            // Nothing or
                               + "|\\[([-+.0-9eE]+|\\*)?"      // "[start
                               + ":([-+.0-9eE]+|\\*)?\\])$");  //   :end]"
    yrange.setVisibleLength(5);
    yrange.setMaxLength(44);  // MAX=2^26=20 chars: "[-$MAX:$MAX]"
    yrange.setText("[0:]");

    y2range.setValidationRegexp("^("                            // Nothing or
                                + "|\\[([-+.0-9eE]+|\\*)?"      // "[start
                                + ":([-+.0-9eE]+|\\*)?\\])$");  //   :end]"
    y2range.setVisibleLength(5);
    y2range.setMaxLength(44);  // MAX=2^26=20 chars: "[-$MAX:$MAX]"
    y2range.setText("[0:]");
    y2range.setEnabled(false);
    y2log.setEnabled(false);

    ylabel.setVisibleLength(10);
    ylabel.setMaxLength(50);  // Arbitrary limit.
    y2label.setVisibleLength(10);
    y2label.setMaxLength(50);  // Arbitrary limit.
    y2label.setEnabled(false);

    yformat.setValidationRegexp("^(|.*%..*)$");  // Nothing or at least one %?
    yformat.setVisibleLength(10);
    yformat.setMaxLength(16);  // Arbitrary limit.
    y2format.setValidationRegexp("^(|.*%..*)$");  // Nothing or at least one %?
    y2format.setVisibleLength(10);
    y2format.setMaxLength(16);  // Arbitrary limit.
    y2format.setEnabled(false);

    wxh.setValidationRegexp("^[1-9][0-9]{2,}x[1-9][0-9]{2,}$");  // 100x100
    wxh.setVisibleLength(9);
    wxh.setMaxLength(11);  // 99999x99999
    wxh.setText((Window.getClientWidth() - 20) + "x"
                + (Window.getClientHeight() * 4 / 5));

    final FlexTable table = new FlexTable();
    table.setText(0, 0, "From");
    {
      final HorizontalPanel hbox = new HorizontalPanel();
      hbox.add(new InlineLabel("To"));
      final Anchor now = new Anchor("(now)");
      now.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent event) {
          end_datebox.setValue(new Date());
          refreshGraph();
        }
      });
      hbox.add(now);
      hbox.add(autoreload);
      hbox.setWidth("100%");
      table.setWidget(0, 1, hbox);
    }
    autoreload.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
      @Override
      public void onValueChange(final ValueChangeEvent<Boolean> event) {
        if (autoreload.getValue()) {
          final HorizontalPanel hbox = new HorizontalPanel();
          hbox.setWidth("100%");
          hbox.add(new InlineLabel("Every:"));
          hbox.add(autoreoload_interval);
          hbox.add(new InlineLabel("seconds"));
          table.setWidget(1, 1, hbox);
          if (autoreoload_interval.getValue().isEmpty()) {
            autoreoload_interval.setValue("15");
          }
          autoreoload_interval.setFocus(true);
          lastgraphuri = "";  // Force refreshGraph.
          refreshGraph();     // Trigger the 1st auto-reload
        } else {
          table.setWidget(1, 1, end_datebox);
        }
      }
    });
    autoreoload_interval.setValidationRegexp("^([5-9]|[1-9][0-9]+)$");  // >=5s
    autoreoload_interval.setMaxLength(4);
    autoreoload_interval.setVisibleLength(8);

    table.setWidget(1, 0, start_datebox);
    table.setWidget(1, 1, end_datebox);
    {
      final HorizontalPanel hbox = new HorizontalPanel();
      hbox.add(new InlineLabel("WxH:"));
      hbox.add(wxh);
      table.setWidget(0, 3, hbox);
    }
    {
      final HorizontalPanel hbox = new HorizontalPanel();
      hbox.add(global_annotations);
      table.setWidget(0, 4, hbox);
    }
    {
      addMetricForm("metric 1", 0);
      metrics.selectTab(0);
      metrics.add(new InlineLabel("Loading..."), "+");
      metrics.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {
        public void onBeforeSelection(final BeforeSelectionEvent<Integer> event) {
          final int item = event.getItem();
          final int nitems = metrics.getWidgetCount();
          if (item == nitems - 1) {  // Last item: the "+" was clicked.
            event.cancel();
            final MetricForm metric = addMetricForm("metric " + nitems, item);
            metrics.selectTab(item);
            metric.setFocus(true);
          }
        }
      });
      table.setWidget(2, 0, metrics);
    }
    table.getFlexCellFormatter().setColSpan(2, 0, 2);
    table.getFlexCellFormatter().setRowSpan(1, 3, 2);
    final DecoratedTabPanel optpanel = new DecoratedTabPanel();
    optpanel.add(makeAxesPanel(), "Axes");
    optpanel.add(makeKeyPanel(), "Key");
    optpanel.add(makeStylePanel(), "Style");
    optpanel.selectTab(0);
    table.setWidget(1, 3, optpanel);
    table.getFlexCellFormatter().setColSpan(1, 3, 2);

    final DecoratorPanel decorator = new DecoratorPanel();
    decorator.setWidget(table);
    final VerticalPanel graphpanel = new VerticalPanel();
    graphpanel.add(decorator);
    {
      final VerticalPanel graphvbox = new VerticalPanel();
      graphvbox.add(graphstatus);

      graph.setVisible(false);

      // Put the graph image element and the zoombox elements inside the absolute panel
      graphbox.add(graph, 0, 0);
      zoom_box.setVisible(false);
      graphbox.add(zoom_box, 0, 0);
      graph.addMouseOverHandler(new MouseOverHandler() {
        public void onMouseOver(final MouseOverEvent event) {
          final Style style = graphbox.getElement().getStyle();
          style.setCursor(Cursor.CROSSHAIR);
        }
      });
      graph.addMouseOutHandler(new MouseOutHandler() {
        public void onMouseOut(final MouseOutEvent event) {
          final Style style = graphbox.getElement().getStyle();
          style.setCursor(Cursor.AUTO);
        }
      });

      graphvbox.add(graphbox);
      graph.addErrorHandler(new ErrorHandler() {
        public void onError(final ErrorEvent event) {
          graphstatus.setText("Oops, failed to load the graph.");
        }
      });
      graph.addLoadHandler(new LoadHandler() {
        public void onLoad(final LoadEvent event) {
          graphbox.setWidth(graph.getWidth() + "px");
          graphbox.setHeight(graph.getHeight() + "px");
        }
      });

      graphpanel.add(graphvbox);
    }
    final DecoratedTabPanel mainpanel = new DecoratedTabPanel();
    mainpanel.setWidth("100%");
    mainpanel.add(graphpanel, "Graph");
    mainpanel.add(stats_table, "Stats");
    mainpanel.add(logs, "Logs");
    mainpanel.add(build_data, "Version");
    mainpanel.selectTab(0);
    mainpanel.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {
      public void onBeforeSelection(final BeforeSelectionEvent<Integer> event) {
        clearError();
        final int item = event.getItem();
        switch (item) {
          case 1: refreshStats(); return;
          case 2: refreshLogs(); return;
          case 3: refreshVersion(); return;
        }
      }
    });
    final VerticalPanel root = new VerticalPanel();
    root.setWidth("100%");
    root.add(current_error);
    current_error.setVisible(false);
    current_error.addStyleName("dateBoxFormatError");
    root.add(mainpanel);
    RootPanel.get("queryuimain").add(root);
    // Must be done at the end, once all the widgets are attached.
    ensureSameWidgetSize(optpanel);

    History.addHistoryListener(this);
  }
9887
public void onModuleLoad() {
    final Button sendButton = new Button( messages.sendButton() );
    final TextBox nameField = new TextBox();
    nameField.setText( messages.nameField() );
    final Label errorLabel = new Label();

    // We can add style names to widgets
    sendButton.addStyleName("sendButton");

    // Add the nameField and sendButton to the RootPanel
    // Use RootPanel.get() to get the entire body element
    RootPanel.get("nameFieldContainer").add(nameField);
    RootPanel.get("sendButtonContainer").add(sendButton);
    RootPanel.get("errorLabelContainer").add(errorLabel);

    // Focus the cursor on the name field when the app loads
    nameField.setFocus(true);
    nameField.selectAll();

    // Create the popup dialog box
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Remote Procedure Call");
    dialogBox.setAnimationEnabled(true);
    final Button closeButton = new Button("Close");
    // We can set the id of a widget by accessing its Element
    closeButton.getElement().setId("closeButton");
    final Label textToServerLabel = new Label();
    final HTML serverResponseLabel = new HTML();
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.add(new HTML("<b>Sending name to the server:</b>"));
    dialogVPanel.add(textToServerLabel);
    dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
    dialogVPanel.add(serverResponseLabel);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    // Add a handler to close the DialogBox
    closeButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        dialogBox.hide();
        sendButton.setEnabled(true);
        sendButton.setFocus(true);
      }
    });

    // Create a handler for the sendButton and nameField
    class MyHandler implements ClickHandler, KeyUpHandler {
      /**
       * Fired when the user clicks on the sendButton.
       */
      public void onClick(ClickEvent event) {
        sendNameToServer();
      }

      /**
       * Fired when the user types in the nameField.
       */
      public void onKeyUp(KeyUpEvent event) {
        if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
          sendNameToServer();
        }
      }

      /**
       * Send the name from the nameField to the server and wait for a response.
       */
      private void sendNameToServer() {
        // First, we validate the input.
        errorLabel.setText("");
        String textToServer = nameField.getText();
        if (!FieldVerifier.isValidName(textToServer)) {
          errorLabel.setText("Please enter at least four characters");
          return;
        }

        // Then, we send the input to the server.
        sendButton.setEnabled(false);
        textToServerLabel.setText(textToServer);
        serverResponseLabel.setText("");
        greetingService.greetServer(textToServer, new AsyncCallback<String>() {
          public void onFailure(Throwable caught) {
            // Show the RPC error message to the user
            dialogBox.setText("Remote Procedure Call - Failure");
            serverResponseLabel.addStyleName("serverResponseLabelError");
            serverResponseLabel.setHTML(SERVER_ERROR);
            dialogBox.center();
            closeButton.setFocus(true);
          }

          public void onSuccess(String result) {
            dialogBox.setText("Remote Procedure Call");
            serverResponseLabel.removeStyleName("serverResponseLabelError");
            serverResponseLabel.setHTML(result);
            dialogBox.center();
            closeButton.setFocus(true);
          }
        });
      }
    }

    // Add a handler to send the name to the server
    MyHandler handler = new MyHandler();
    sendButton.addClickHandler(handler);
    nameField.addKeyUpHandler(handler);
  }
5619
function handleServerResponse(err, server) {
  if (err) {
    console.dir(err);
    return;
  }

  console.log('SERVER CREATED: ' + server.name + ', waiting for active status');

  // Wait for status: ACTIVE on our server, and then callback
  server.setWait({ status: server.STATUS.running }, 5000, function (err) {
    if (err) {
      console.dir(err);
      return;
    }

    console.log('SERVER INFO');
    console.log(server.name);
    console.log(server.status);
    console.log(server.id);

    console.log('Make sure you DELETE server: ' + server.id +
      ' in order to not accrue billing charges');
  });
}
655832
def on_server_start(self):
        
        self._container = self._docker_client.containers.run(self.docker_image_name, detach=True, **self.docker_params)
        self.signal_ready()

        for log_line in self.get_lines():
            try:
                alert_dict = self.parse_line(log_line)
                if alert_dict:
                    self.add_alert_to_queue(alert_dict)
            except Exception:
                self.logger.exception(None)
898202
function onLoad() {
    e_interfaceList  = document.getElementById("interface-list")
    e_interfaceName  = document.getElementById("interface-name")
    e_interfaceBody  = document.getElementById("interface-body")
    e_showIdl        = document.getElementById("show-Idl")
    e_showJavaScript = document.getElementById("show-JavaScript")
    e_showJava       = document.getElementById("show-Java")

    setUpShowCheckBoxes()
    populateInterfacesList(IDLTools.getIDLsMatching(/.*/))
}