text:
namespace COMDBG
{
    partial class MainForm
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
            this.comListCbx = new System.Windows.Forms.ComboBox();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.baudRateCbx = new System.Windows.Forms.ComboBox();
            this.label5 = new System.Windows.Forms.Label();
            this.dataBitsCbx = new System.Windows.Forms.ComboBox();
            this.label6 = new System.Windows.Forms.Label();
            this.stopBitsCbx = new System.Windows.Forms.ComboBox();
            this.label7 = new System.Windows.Forms.Label();
            this.parityCbx = new System.Windows.Forms.ComboBox();
            this.openCloseSpbtn = new System.Windows.Forms.Button();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.autoReplyCbx = new System.Windows.Forms.CheckBox();
            this.addCRCcbx = new System.Windows.Forms.CheckBox();
            this.label8 = new System.Windows.Forms.Label();
            this.sendIntervalTimetbx = new System.Windows.Forms.TextBox();
            this.autoSendcbx = new System.Windows.Forms.CheckBox();
            this.panel1 = new System.Windows.Forms.Panel();
            this.recHexRadiobtn = new System.Windows.Forms.RadioButton();
            this.recStrRadiobtn = new System.Windows.Forms.RadioButton();
            this.sendHexRadiobtn = new System.Windows.Forms.RadioButton();
            this.sendStrRadiobtn = new System.Windows.Forms.RadioButton();
            this.clearReceivebtn = new System.Windows.Forms.Button();
            this.clearSendbtn = new System.Windows.Forms.Button();
            this.receivetbx = new System.Windows.Forms.TextBox();
            this.sendtbx = new System.Windows.Forms.TextBox();
            this.sendbtn = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.receivedDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.sendDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.quitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.menuStrip1 = new System.Windows.Forms.MenuStrip();
            this.aboutToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
            this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.statusStrip1 = new System.Windows.Forms.StatusStrip();
            this.statuslabel = new System.Windows.Forms.ToolStripStatusLabel();
            this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
            this.toolStripStatusRx = new System.Windows.Forms.ToolStripStatusLabel();
            this.toolStripStatusTx = new System.Windows.Forms.ToolStripStatusLabel();
            this.statusTimeLabel = new System.Windows.Forms.ToolStripStatusLabel();
            this.statustimer = new System.Windows.Forms.Timer(this.components);
            this.autoSendtimer = new System.Windows.Forms.Timer(this.components);
            this.refreshbtn = new System.Windows.Forms.Button();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.handshakingcbx = new System.Windows.Forms.ComboBox();
            this.label9 = new System.Windows.Forms.Label();
            this.groupBox1.SuspendLayout();
            this.panel1.SuspendLayout();
            this.menuStrip1.SuspendLayout();
            this.statusStrip1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.SuspendLayout();
            //
            // comListCbx
            //
            this.comListCbx.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comListCbx.FormattingEnabled = true;
            this.comListCbx.Location = new System.Drawing.Point(14, 35);
            this.comListCbx.Name = "comListCbx";
            this.comListCbx.Size = new System.Drawing.Size(74, 20);
            this.comListCbx.TabIndex = 7;
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(7, 20);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(65, 12);
            this.label3.TabIndex = 8;
            this.label3.Text = "Port Name:";
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(7, 60);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(65, 12);
            this.label4.TabIndex = 10;
            this.label4.Text = "Baud Rate:";
            //
            // baudRateCbx
            //
            this.baudRateCbx.FormattingEnabled = true;
            this.baudRateCbx.Location = new System.Drawing.Point(14, 75);
            this.baudRateCbx.Name = "baudRateCbx";
            this.baudRateCbx.Size = new System.Drawing.Size(74, 20);
            this.baudRateCbx.TabIndex = 9;
            //
            // label5
            //
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(7, 100);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(65, 12);
            this.label5.TabIndex = 12;
            this.label5.Text = "Data Bits:";
            //
            // dataBitsCbx
            //
            this.dataBitsCbx.FormattingEnabled = true;
            this.dataBitsCbx.Location = new System.Drawing.Point(14, 115);
            this.dataBitsCbx.Name = "dataBitsCbx";
            this.dataBitsCbx.Size = new System.Drawing.Size(74, 20);
            this.dataBitsCbx.TabIndex = 11;
            //
            // label6
            //
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(7, 140);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(65, 12);
            this.label6.TabIndex = 14;
            this.label6.Text = "Stop Bits:";
            //
            // stopBitsCbx
            //
            this.stopBitsCbx.FormattingEnabled = true;
            this.stopBitsCbx.Location = new System.Drawing.Point(14, 155);
            this.stopBitsCbx.Name = "stopBitsCbx";
            this.stopBitsCbx.Size = new System.Drawing.Size(74, 20);
            this.stopBitsCbx.TabIndex = 13;
            //
            // label7
            //
            this.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(7, 180);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(47, 12);
            this.label7.TabIndex = 16;
            this.label7.Text = "Parity:";
            //
            // parityCbx
            //
            this.parityCbx.FormattingEnabled = true;
            this.parityCbx.Location = new System.Drawing.Point(14, 195);
            this.parityCbx.Name = "parityCbx";
            this.parityCbx.Size = new System.Drawing.Size(74, 20);
            this.parityCbx.TabIndex = 15;
            //
            // openCloseSpbtn
            //
            this.openCloseSpbtn.Enabled = false;
            this.openCloseSpbtn.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.openCloseSpbtn.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.openCloseSpbtn.Location = new System.Drawing.Point(14, 311);
            this.openCloseSpbtn.Name = "openCloseSpbtn";
            this.openCloseSpbtn.Size = new System.Drawing.Size(74, 36);
            this.openCloseSpbtn.TabIndex = 17;
            this.openCloseSpbtn.Text = "Open";
            this.openCloseSpbtn.UseVisualStyleBackColor = true;
            this.openCloseSpbtn.Click += new System.EventHandler(this.openCloseSpbtn_Click);
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.autoReplyCbx);
            this.groupBox1.Controls.Add(this.addCRCcbx);
            this.groupBox1.Controls.Add(this.label8);
            this.groupBox1.Controls.Add(this.sendIntervalTimetbx);
            this.groupBox1.Controls.Add(this.autoSendcbx);
            this.groupBox1.Controls.Add(this.panel1);
            this.groupBox1.Controls.Add(this.sendHexRadiobtn);
            this.groupBox1.Controls.Add(this.sendStrRadiobtn);
            this.groupBox1.Controls.Add(this.clearReceivebtn);
            this.groupBox1.Controls.Add(this.clearSendbtn);
            this.groupBox1.Controls.Add(this.receivetbx);
            this.groupBox1.Controls.Add(this.sendtbx);
            this.groupBox1.Controls.Add(this.sendbtn);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.groupBox1.Location = new System.Drawing.Point(109, 30);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(367, 355);
            this.groupBox1.TabIndex = 19;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Data";
            //
            // autoReplyCbx
            //
            this.autoReplyCbx.AutoSize = true;
            this.autoReplyCbx.Enabled = false;
            this.autoReplyCbx.Location = new System.Drawing.Point(14, 334);
            this.autoReplyCbx.Name = "autoReplyCbx";
            this.autoReplyCbx.Size = new System.Drawing.Size(81, 19);
            this.autoReplyCbx.TabIndex = 25;
            this.autoReplyCbx.Text = "AutoReply";
            this.autoReplyCbx.UseVisualStyleBackColor = true;
            //
            // addCRCcbx
            //
            this.addCRCcbx.AutoSize = true;
            this.addCRCcbx.Enabled = false;
            this.addCRCcbx.Location = new System.Drawing.Point(186, 313);
            this.addCRCcbx.Name = "addCRCcbx";
            this.addCRCcbx.Size = new System.Drawing.Size(75, 19);
            this.addCRCcbx.TabIndex = 24;
            this.addCRCcbx.Text = "Add CRC";
            this.addCRCcbx.UseVisualStyleBackColor = true;
            this.addCRCcbx.CheckedChanged += new System.EventHandler(this.addCRCcbx_CheckedChanged);
            //
            // label8
            //
            this.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(143, 316);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(24, 15);
            this.label8.TabIndex = 23;
            this.label8.Text = "ms";
            //
            // sendIntervalTimetbx
            //
            this.sendIntervalTimetbx.Location = new System.Drawing.Point(93, 311);
            this.sendIntervalTimetbx.MaxLength = 9;
            this.sendIntervalTimetbx.Name = "sendIntervalTimetbx";
            this.sendIntervalTimetbx.Size = new System.Drawing.Size(44, 21);
            this.sendIntervalTimetbx.TabIndex = 22;
            this.sendIntervalTimetbx.Text = "1000";
            this.sendIntervalTimetbx.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.sendIntervalTimetbx_KeyPress);
            //
            // autoSendcbx
            //
            this.autoSendcbx.AutoSize = true;
            this.autoSendcbx.Enabled = false;
            this.autoSendcbx.Location = new System.Drawing.Point(14, 313);
            this.autoSendcbx.Name = "autoSendcbx";
            this.autoSendcbx.Size = new System.Drawing.Size(79, 19);
            this.autoSendcbx.TabIndex = 21;
            this.autoSendcbx.Text = "AutoSend";
            this.autoSendcbx.UseVisualStyleBackColor = true;
            this.autoSendcbx.CheckedChanged += new System.EventHandler(this.autoSendcbx_CheckedChanged);
            //
            // panel1
            //
            this.panel1.Controls.Add(this.recHexRadiobtn);
            this.panel1.Controls.Add(this.recStrRadiobtn);
            this.panel1.Location = new System.Drawing.Point(137, 15);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(119, 23);
            this.panel1.TabIndex = 20;
            //
            // recHexRadiobtn
            //
            this.recHexRadiobtn.AutoSize = true;
            this.recHexRadiobtn.Location = new System.Drawing.Point(63, 4);
            this.recHexRadiobtn.Name = "recHexRadiobtn";
            this.recHexRadiobtn.Size = new System.Drawing.Size(47, 19);
            this.recHexRadiobtn.TabIndex = 15;
            this.recHexRadiobtn.TabStop = true;
            this.recHexRadiobtn.Text = "Hex";
            this.recHexRadiobtn.UseVisualStyleBackColor = true;
            this.recHexRadiobtn.CheckedChanged += new System.EventHandler(this.recHexRadiobtn_CheckedChanged);
            //
            // recStrRadiobtn
            //
            this.recStrRadiobtn.AutoSize = true;
            this.recStrRadiobtn.Checked = true;
            this.recStrRadiobtn.Location = new System.Drawing.Point(2, 4);
            this.recStrRadiobtn.Name = "recStrRadiobtn";
            this.recStrRadiobtn.Size = new System.Drawing.Size(57, 19);
            this.recStrRadiobtn.TabIndex = 14;
            this.recStrRadiobtn.TabStop = true;
            this.recStrRadiobtn.Text = "String";
            this.recStrRadiobtn.UseVisualStyleBackColor = true;
            this.recStrRadiobtn.CheckedChanged += new System.EventHandler(this.recStrRadiobtn_CheckedChanged);
            //
            // sendHexRadiobtn
            //
            this.sendHexRadiobtn.AutoSize = true;
            this.sendHexRadiobtn.Location = new System.Drawing.Point(200, 188);
            this.sendHexRadiobtn.Name = "sendHexRadiobtn";
            this.sendHexRadiobtn.Size = new System.Drawing.Size(47, 19);
            this.sendHexRadiobtn.TabIndex = 17;
            this.sendHexRadiobtn.TabStop = true;
            this.sendHexRadiobtn.Text = "Hex";
            this.sendHexRadiobtn.UseVisualStyleBackColor = true;
            this.sendHexRadiobtn.CheckedChanged += new System.EventHandler(this.sendHexRadiobtn_CheckedChanged);
            //
            // sendStrRadiobtn
            //
            this.sendStrRadiobtn.AutoSize = true;
            this.sendStrRadiobtn.Checked = true;
            this.sendStrRadiobtn.Location = new System.Drawing.Point(139, 188);
            this.sendStrRadiobtn.Name = "sendStrRadiobtn";
            this.sendStrRadiobtn.Size = new System.Drawing.Size(57, 19);
            this.sendStrRadiobtn.TabIndex = 16;
            this.sendStrRadiobtn.TabStop = true;
            this.sendStrRadiobtn.Text = "String";
            this.sendStrRadiobtn.UseVisualStyleBackColor = true;
            this.sendStrRadiobtn.CheckedChanged += new System.EventHandler(this.sendStrRadiobtn_CheckedChanged);
            //
            // clearReceivebtn
            //
            this.clearReceivebtn.AutoSize = true;
            this.clearReceivebtn.Location = new System.Drawing.Point(278, 13);
            this.clearReceivebtn.Name = "clearReceivebtn";
            this.clearReceivebtn.Size = new System.Drawing.Size(58, 25);
            this.clearReceivebtn.TabIndex = 11;
            this.clearReceivebtn.Text = "Clear";
            this.clearReceivebtn.UseVisualStyleBackColor = true;
            this.clearReceivebtn.Click += new System.EventHandler(this.clearReceivebtn_Click);
            //
            // clearSendbtn
            //
            this.clearSendbtn.Location = new System.Drawing.Point(287, 181);
            this.clearSendbtn.Name = "clearSendbtn";
            this.clearSendbtn.Size = new System.Drawing.Size(58, 25);
            this.clearSendbtn.TabIndex = 10;
            this.clearSendbtn.Text = "Clear";
            this.clearSendbtn.UseVisualStyleBackColor = true;
            this.clearSendbtn.Click += new System.EventHandler(this.clearSendbtn_Click);
            //
            // receivetbx
            //
            this.receivetbx.BackColor = System.Drawing.SystemColors.InfoText;
            this.receivetbx.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.receivetbx.ForeColor = System.Drawing.SystemColors.Info;
            this.receivetbx.Location = new System.Drawing.Point(7, 38);
            this.receivetbx.Multiline = true;
            this.receivetbx.Name = "receivetbx";
            this.receivetbx.ReadOnly = true;
            this.receivetbx.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.receivetbx.Size = new System.Drawing.Size(354, 140);
            this.receivetbx.TabIndex = 9;
            this.receivetbx.TabStop = false;
            this.receivetbx.TextChanged += new System.EventHandler(this.receivetbx_TextChanged);
            //
            // sendtbx
            //
            this.sendtbx.BackColor = System.Drawing.SystemColors.InfoText;
            this.sendtbx.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.sendtbx.ForeColor = System.Drawing.SystemColors.Info;
            this.sendtbx.Location = new System.Drawing.Point(7, 207);
            this.sendtbx.Multiline = true;
            this.sendtbx.Name = "sendtbx";
            this.sendtbx.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.sendtbx.Size = new System.Drawing.Size(354, 98);
            this.sendtbx.TabIndex = 8;
            this.sendtbx.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.sendtbx_KeyPress);
            //
            // sendbtn
            //
            this.sendbtn.AutoSize = true;
            this.sendbtn.Enabled = false;
            this.sendbtn.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.sendbtn.Location = new System.Drawing.Point(287, 311);
            this.sendbtn.Name = "sendbtn";
            this.sendbtn.Size = new System.Drawing.Size(58, 36);
            this.sendbtn.TabIndex = 7;
            this.sendbtn.Text = "Send";
            this.sendbtn.UseVisualStyleBackColor = true;
            this.sendbtn.Click += new System.EventHandler(this.sendbtn_Click);
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(5, 19);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(61, 15);
            this.label1.TabIndex = 4;
            this.label1.Text = "Received:";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(5, 189);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(39, 15);
            this.label2.TabIndex = 5;
            this.label2.Text = "Send:";
            //
            // aboutToolStripMenuItem
            //
            this.aboutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.saveToolStripMenuItem,
            this.quitToolStripMenuItem});
            this.aboutToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
            this.aboutToolStripMenuItem.Size = new System.Drawing.Size(39, 24);
            this.aboutToolStripMenuItem.Text = "File";
            //
            // saveToolStripMenuItem
            //
            this.saveToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.receivedDataToolStripMenuItem,
            this.sendDataToolStripMenuItem});
            this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
            this.saveToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
            this.saveToolStripMenuItem.Text = "Save";
            //
            // receivedDataToolStripMenuItem
            //
            this.receivedDataToolStripMenuItem.Name = "receivedDataToolStripMenuItem";
            this.receivedDataToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
            this.receivedDataToolStripMenuItem.Text = "Received Data...";
            this.receivedDataToolStripMenuItem.Click += new System.EventHandler(this.receivedDataToolStripMenuItem_Click);
            //
            // sendDataToolStripMenuItem
            //
            this.sendDataToolStripMenuItem.Name = "sendDataToolStripMenuItem";
            this.sendDataToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
            this.sendDataToolStripMenuItem.Text = "Send Data...";
            this.sendDataToolStripMenuItem.Click += new System.EventHandler(this.sendDataToolStripMenuItem_Click);
            //
            // quitToolStripMenuItem
            //
            this.quitToolStripMenuItem.Name = "quitToolStripMenuItem";
            this.quitToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
            this.quitToolStripMenuItem.Text = "Quit";
            this.quitToolStripMenuItem.Click += new System.EventHandler(this.quitToolStripMenuItem_Click);
            //
            // menuStrip1
            //
            this.menuStrip1.AutoSize = false;
            this.menuStrip1.BackColor = System.Drawing.SystemColors.InactiveCaption;
            this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.aboutToolStripMenuItem,
            this.aboutToolStripMenuItem1,
            this.helpToolStripMenuItem});
            this.menuStrip1.Location = new System.Drawing.Point(0, 0);
            this.menuStrip1.Name = "menuStrip1";
            this.menuStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
            this.menuStrip1.Size = new System.Drawing.Size(488, 28);
            this.menuStrip1.TabIndex = 20;
            this.menuStrip1.Text = "menuStrip1";
            //
            // aboutToolStripMenuItem1
            //
            this.aboutToolStripMenuItem1.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.aboutToolStripMenuItem1.Name = "aboutToolStripMenuItem1";
            this.aboutToolStripMenuItem1.Size = new System.Drawing.Size(55, 24);
            this.aboutToolStripMenuItem1.Text = "About";
            this.aboutToolStripMenuItem1.Click += new System.EventHandler(this.aboutToolStripMenuItem1_Click);
            //
            // helpToolStripMenuItem
            //
            this.helpToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
            this.helpToolStripMenuItem.Size = new System.Drawing.Size(47, 24);
            this.helpToolStripMenuItem.Text = "Help";
            this.helpToolStripMenuItem.Click += new System.EventHandler(this.helpToolStripMenuItem_Click);
            //
            // statusStrip1
            //
            this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.statuslabel,
            this.toolStripStatusLabel1,
            this.toolStripStatusRx,
            this.toolStripStatusTx,
            this.statusTimeLabel});
            this.statusStrip1.Location = new System.Drawing.Point(0, 393);
            this.statusStrip1.Name = "statusStrip1";
            this.statusStrip1.Size = new System.Drawing.Size(488, 22);
            this.statusStrip1.TabIndex = 21;
            this.statusStrip1.Text = "statusStrip1";
            //
            // statuslabel
            //
            this.statuslabel.ActiveLinkColor = System.Drawing.SystemColors.ButtonHighlight;
            this.statuslabel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.statuslabel.Name = "statuslabel";
            this.statuslabel.Size = new System.Drawing.Size(157, 17);
            this.statuslabel.Spring = true;
            this.statuslabel.Text = "Not Connected";
            this.statuslabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            //
            // toolStripStatusLabel1
            //
            this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
            this.toolStripStatusLabel1.Size = new System.Drawing.Size(0, 17);
            //
            // toolStripStatusRx
            //
            this.toolStripStatusRx.ActiveLinkColor = System.Drawing.SystemColors.Info;
            this.toolStripStatusRx.Name = "toolStripStatusRx";
            this.toolStripStatusRx.Size = new System.Drawing.Size(157, 17);
            this.toolStripStatusRx.Spring = true;
            this.toolStripStatusRx.Text = "Received:";
            this.toolStripStatusRx.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            //
            // toolStripStatusTx
            //
            this.toolStripStatusTx.Name = "toolStripStatusTx";
            this.toolStripStatusTx.Size = new System.Drawing.Size(157, 17);
            this.toolStripStatusTx.Spring = true;
            this.toolStripStatusTx.Text = "Sent:";
            this.toolStripStatusTx.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            //
            // statusTimeLabel
            //
            this.statusTimeLabel.Name = "statusTimeLabel";
            this.statusTimeLabel.Size = new System.Drawing.Size(0, 17);
            //
            // statustimer
            //
            this.statustimer.Enabled = true;
            this.statustimer.Interval = 1000;
            this.statustimer.Tick += new System.EventHandler(this.statustimer_Tick);
            //
            // autoSendtimer
            //
            this.autoSendtimer.Interval = 1000;
            this.autoSendtimer.Tick += new System.EventHandler(this.autoSendtimer_Tick);
            //
            // refreshbtn
            //
            this.refreshbtn.Location = new System.Drawing.Point(14, 267);
            this.refreshbtn.Name = "refreshbtn";
            this.refreshbtn.Size = new System.Drawing.Size(74, 32);
            this.refreshbtn.TabIndex = 22;
            this.refreshbtn.Text = "Refersh";
            this.refreshbtn.UseVisualStyleBackColor = true;
            this.refreshbtn.Click += new System.EventHandler(this.refreshbtn_Click);
            //
            // groupBox2
            //
            this.groupBox2.Controls.Add(this.handshakingcbx);
            this.groupBox2.Controls.Add(this.label9);
            this.groupBox2.Controls.Add(this.refreshbtn);
            this.groupBox2.Controls.Add(this.dataBitsCbx);
            this.groupBox2.Controls.Add(this.comListCbx);
            this.groupBox2.Controls.Add(this.label3);
            this.groupBox2.Controls.Add(this.openCloseSpbtn);
            this.groupBox2.Controls.Add(this.baudRateCbx);
            this.groupBox2.Controls.Add(this.label7);
            this.groupBox2.Controls.Add(this.label4);
            this.groupBox2.Controls.Add(this.parityCbx);
            this.groupBox2.Controls.Add(this.label5);
            this.groupBox2.Controls.Add(this.label6);
            this.groupBox2.Controls.Add(this.stopBitsCbx);
            this.groupBox2.Location = new System.Drawing.Point(2, 30);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(103, 355);
            this.groupBox2.TabIndex = 24;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "COM";
            //
            // handshakingcbx
            //
            this.handshakingcbx.FormattingEnabled = true;
            this.handshakingcbx.Location = new System.Drawing.Point(14, 235);
            this.handshakingcbx.Name = "handshakingcbx";
            this.handshakingcbx.Size = new System.Drawing.Size(74, 20);
            this.handshakingcbx.TabIndex = 24;
            //
            // label9
            //
            this.label9.AutoSize = true;
            this.label9.Location = new System.Drawing.Point(7, 220);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(77, 12);
            this.label9.TabIndex = 23;
            this.label9.Text = "HandShaking:";
            //
            // MainForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(488, 415);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.statusStrip1);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.menuStrip1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MainMenuStrip = this.menuStrip1;
            this.Name = "MainForm";
            this.Text = "COMDBG v1.1";
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            this.menuStrip1.ResumeLayout(false);
            this.menuStrip1.PerformLayout();
            this.statusStrip1.ResumeLayout(false);
            this.statusStrip1.PerformLayout();
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.ComboBox comListCbx;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.ComboBox baudRateCbx;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.ComboBox dataBitsCbx;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.ComboBox stopBitsCbx;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.ComboBox parityCbx;
        private System.Windows.Forms.Button openCloseSpbtn;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.RadioButton recHexRadiobtn;
        private System.Windows.Forms.RadioButton recStrRadiobtn;
        private System.Windows.Forms.Button clearReceivebtn;
        private System.Windows.Forms.Button clearSendbtn;
        private System.Windows.Forms.TextBox receivetbx;
        private System.Windows.Forms.TextBox sendtbx;
        private System.Windows.Forms.Button sendbtn;
        private System.Windows.Forms.RadioButton sendHexRadiobtn;
        private System.Windows.Forms.RadioButton sendStrRadiobtn;
        private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem quitToolStripMenuItem;
        private System.Windows.Forms.MenuStrip menuStrip1;
        private System.Windows.Forms.StatusStrip statusStrip1;
        private System.Windows.Forms.ToolStripStatusLabel statuslabel;
        private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
        private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
        private System.Windows.Forms.ToolStripStatusLabel toolStripStatusRx;
        private System.Windows.Forms.ToolStripStatusLabel statusTimeLabel;
        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.Timer statustimer;
        private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem1;
        private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem receivedDataToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem sendDataToolStripMenuItem;
        private System.Windows.Forms.ToolStripStatusLabel toolStripStatusTx;
        private System.Windows.Forms.CheckBox autoSendcbx;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.TextBox sendIntervalTimetbx;
        private System.Windows.Forms.Timer autoSendtimer;
        private System.Windows.Forms.Button refreshbtn;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.ComboBox handshakingcbx;
        private System.Windows.Forms.Label label9;
        private System.Windows.Forms.CheckBox addCRCcbx;
        private System.Windows.Forms.CheckBox autoReplyCbx;
    }
}


text: This Drupal module provides an API to store and retrieve nodes using the users session.

redpajama_set_name: RedPajamaGithub


text:
package org.apache.accumulo.fate;

import static java.nio.charset.StandardCharsets.UTF_8;

import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Formatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import org.apache.accumulo.fate.ReadOnlyTStore.TStatus;
import org.apache.accumulo.fate.zookeeper.IZooReader;
import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
import org.apache.accumulo.fate.zookeeper.ZooLock;
import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy;
import org.apache.zookeeper.KeeperException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * A utility to administer FATE operations
 */
public class AdminUtil<T> {
  private static final Logger log = LoggerFactory.getLogger(AdminUtil.class);

  private boolean exitOnError = false;

  /**
   * Default constructor
   */
  public AdminUtil() {
    this(true);
  }

  /**
   * Constructor
   *
   * @param exitOnError
   *          System.exit(1) on error if true
   */
  public AdminUtil(boolean exitOnError) {
    super();
    this.exitOnError = exitOnError;
  }

  public static class TransactionStatus {

    private final long txid;
    private final TStatus status;
    private final String debug;
    private final List<String> hlocks;
    private final List<String> wlocks;
    private final String top;

    private TransactionStatus(Long tid, TStatus status, String debug, List<String> hlocks, List<String> wlocks, String top) {
      this.txid = tid;
      this.status = status;
      this.debug = debug;
      this.hlocks = Collections.unmodifiableList(hlocks);
      this.wlocks = Collections.unmodifiableList(wlocks);
      this.top = top;
    }

    /**
     * @return This fate operations transaction id, formatted in the same way as FATE transactions are in the Accumulo logs.
     */
    public String getTxid() {
      return String.format("%016x", txid);
    }

    public TStatus getStatus() {
      return status;
    }

    /**
     * @return The debug info for the operation on the top of the stack for this Fate operation.
     */
    public String getDebug() {
      return debug;
    }

    /**
     * @return list of namespace and table ids locked
     */
    public List<String> getHeldLocks() {
      return hlocks;
    }

    /**
     * @return list of namespace and table ids locked
     */
    public List<String> getWaitingLocks() {
      return wlocks;
    }

    /**
     * @return The operation on the top of the stack for this Fate operation.
     */
    public String getTop() {
      return top;
    }

  }

  public static class FateStatus {

    private final List<TransactionStatus> transactions;
    private final Map<String,List<String>> danglingHeldLocks;
    private final Map<String,List<String>> danglingWaitingLocks;

    /**
     * Convert FATE transactions IDs in keys of map to format that used in printing and logging FATE transactions ids. This is done so that if the map is
     * printed, the output can be used to search Accumulo's logs.
     */
    private static Map<String,List<String>> convert(Map<Long,List<String>> danglocks) {
      if (danglocks.isEmpty()) {
        return Collections.emptyMap();
      }

      Map<String,List<String>> ret = new HashMap<>();
      for (Entry<Long,List<String>> entry : danglocks.entrySet()) {
        ret.put(String.format("%016x", entry.getKey()), Collections.unmodifiableList(entry.getValue()));
      }
      return Collections.unmodifiableMap(ret);
    }

    private FateStatus(List<TransactionStatus> transactions, Map<Long,List<String>> danglingHeldLocks, Map<Long,List<String>> danglingWaitingLocks) {
      this.transactions = Collections.unmodifiableList(transactions);
      this.danglingHeldLocks = convert(danglingHeldLocks);
      this.danglingWaitingLocks = convert(danglingWaitingLocks);
    }

    public List<TransactionStatus> getTransactions() {
      return transactions;
    }

    /**
     * Get locks that are held by non existent FATE transactions. These are table or namespace locks.
     *
     * @return map where keys are transaction ids and values are a list of table IDs and/or namespace IDs. The transaction IDs are in the same format as
     *         transaction IDs in the Accumulo logs.
     */
    public Map<String,List<String>> getDanglingHeldLocks() {
      return danglingHeldLocks;
    }

    /**
     * Get locks that are waiting to be aquired by non existent FATE transactions. These are table or namespace locks.
     *
     * @return map where keys are transaction ids and values are a list of table IDs and/or namespace IDs. The transaction IDs are in the same format as
     *         transaction IDs in the Accumulo logs.
     */
    public Map<String,List<String>> getDanglingWaitingLocks() {
      return danglingWaitingLocks;
    }
  }

  public FateStatus getStatus(ReadOnlyTStore<T> zs, IZooReader zk, String lockPath, Set<Long> filterTxid, EnumSet<TStatus> filterStatus)
      throws KeeperException, InterruptedException {
    Map<Long,List<String>> heldLocks = new HashMap<>();
    Map<Long,List<String>> waitingLocks = new HashMap<>();

    List<String> lockedIds = zk.getChildren(lockPath);

    for (String id : lockedIds) {
      try {
        List<String> lockNodes = zk.getChildren(lockPath + "/" + id);
        lockNodes = new ArrayList<>(lockNodes);
        Collections.sort(lockNodes);

        int pos = 0;
        boolean sawWriteLock = false;

        for (String node : lockNodes) {
          try {
            byte[] data = zk.getData(lockPath + "/" + id + "/" + node, null);
            String lda[] = new String(data, UTF_8).split(":");

            if (lda[0].charAt(0) == 'W')
              sawWriteLock = true;

            Map<Long,List<String>> locks;

            if (pos == 0) {
              locks = heldLocks;
            } else {
              if (lda[0].charAt(0) == 'R' && !sawWriteLock) {
                locks = heldLocks;
              } else {
                locks = waitingLocks;
              }
            }

            List<String> tables = locks.get(Long.parseLong(lda[1], 16));
            if (tables == null) {
              tables = new ArrayList<>();
              locks.put(Long.parseLong(lda[1], 16), tables);
            }

            tables.add(lda[0].charAt(0) + ":" + id);

          } catch (Exception e) {
            log.error("{}", e.getMessage(), e);
          }
          pos++;
        }

      } catch (Exception e) {
        log.error("Failed to read locks for " + id + " continuing.", e);
      }
    }

    List<Long> transactions = zs.list();
    List<TransactionStatus> statuses = new ArrayList<>(transactions.size());

    for (Long tid : transactions) {

      zs.reserve(tid);

      String debug = (String) zs.getProperty(tid, "debug");

      List<String> hlocks = heldLocks.remove(tid);
      if (hlocks == null)
        hlocks = Collections.emptyList();

      List<String> wlocks = waitingLocks.remove(tid);
      if (wlocks == null)
        wlocks = Collections.emptyList();

      String top = null;
      ReadOnlyRepo<T> repo = zs.top(tid);
      if (repo != null)
        top = repo.getDescription();

      TStatus status = null;
      status = zs.getStatus(tid);

      zs.unreserve(tid, 0);

      if ((filterTxid != null && !filterTxid.contains(tid)) || (filterStatus != null && !filterStatus.contains(status)))
        continue;

      statuses.add(new TransactionStatus(tid, status, debug, hlocks, wlocks, top));
    }

    return new FateStatus(statuses, heldLocks, waitingLocks);
  }

  public void print(ReadOnlyTStore<T> zs, IZooReader zk, String lockPath) throws KeeperException, InterruptedException {
    print(zs, zk, lockPath, new Formatter(System.out), null, null);
  }

  public void print(ReadOnlyTStore<T> zs, IZooReader zk, String lockPath, Formatter fmt, Set<Long> filterTxid, EnumSet<TStatus> filterStatus)
      throws KeeperException, InterruptedException {

    FateStatus fateStatus = getStatus(zs, zk, lockPath, filterTxid, filterStatus);

    for (TransactionStatus txStatus : fateStatus.getTransactions()) {
      fmt.format("txid: %s  status: %-18s  op: %-15s  locked: %-15s locking: %-15s top: %s%n", txStatus.getTxid(), txStatus.getStatus(), txStatus.getDebug(),
          txStatus.getHeldLocks(), txStatus.getWaitingLocks(), txStatus.getTop());
    }
    fmt.format(" %s transactions", fateStatus.getTransactions().size());

    if (fateStatus.getDanglingHeldLocks().size() != 0 || fateStatus.getDanglingWaitingLocks().size() != 0) {
      fmt.format("%nThe following locks did not have an associated FATE operation%n");
      for (Entry<String,List<String>> entry : fateStatus.getDanglingHeldLocks().entrySet())
        fmt.format("txid: %s  locked: %s%n", entry.getKey(), entry.getValue());

      for (Entry<String,List<String>> entry : fateStatus.getDanglingWaitingLocks().entrySet())
        fmt.format("txid: %s  locking: %s%n", entry.getKey(), entry.getValue());
    }
  }

  public boolean prepDelete(TStore<T> zs, IZooReaderWriter zk, String path, String txidStr) {
    if (!checkGlobalLock(zk, path)) {
      return false;
    }

    long txid;
    try {
      txid = Long.parseLong(txidStr, 16);
    } catch (NumberFormatException nfe) {
      System.out.printf("Invalid transaction ID format: %s%n", txidStr);
      return false;
    }
    boolean state = false;
    zs.reserve(txid);
    TStatus ts = zs.getStatus(txid);
    switch (ts) {
      case UNKNOWN:
        System.out.printf("Invalid transaction ID: %016x%n", txid);
        break;

      case IN_PROGRESS:
      case NEW:
      case FAILED:
      case FAILED_IN_PROGRESS:
      case SUCCESSFUL:
        System.out.printf("Deleting transaction: %016x (%s)%n", txid, ts);
        zs.delete(txid);
        state = true;
        break;
    }

    zs.unreserve(txid, 0);
    return state;
  }

  public boolean prepFail(TStore<T> zs, IZooReaderWriter zk, String path, String txidStr) {
    if (!checkGlobalLock(zk, path)) {
      return false;
    }

    long txid;
    try {
      txid = Long.parseLong(txidStr, 16);
    } catch (NumberFormatException nfe) {
      System.out.printf("Invalid transaction ID format: %s%n", txidStr);
      return false;
    }
    boolean state = false;
    zs.reserve(txid);
    TStatus ts = zs.getStatus(txid);
    switch (ts) {
      case UNKNOWN:
        System.out.printf("Invalid transaction ID: %016x%n", txid);
        break;

      case IN_PROGRESS:
      case NEW:
        System.out.printf("Failing transaction: %016x (%s)%n", txid, ts);
        zs.setStatus(txid, TStatus.FAILED_IN_PROGRESS);
        state = true;
        break;

      case SUCCESSFUL:
        System.out.printf("Transaction already completed: %016x (%s)%n", txid, ts);
        break;

      case FAILED:
      case FAILED_IN_PROGRESS:
        System.out.printf("Transaction already failed: %016x (%s)%n", txid, ts);
        state = true;
        break;
    }

    zs.unreserve(txid, 0);
    return state;
  }

  public void deleteLocks(TStore<T> zs, IZooReaderWriter zk, String path, String txidStr) throws KeeperException, InterruptedException {
    // delete any locks assoc w/ fate operation
    List<String> lockedIds = zk.getChildren(path);

    for (String id : lockedIds) {
      List<String> lockNodes = zk.getChildren(path + "/" + id);
      for (String node : lockNodes) {
        String lockPath = path + "/" + id + "/" + node;
        byte[] data = zk.getData(path + "/" + id + "/" + node, null);
        String lda[] = new String(data, UTF_8).split(":");
        if (lda[1].equals(txidStr))
          zk.recursiveDelete(lockPath, NodeMissingPolicy.SKIP);
      }
    }
  }

  public boolean checkGlobalLock(IZooReaderWriter zk, String path) {
    try {
      if (ZooLock.getLockData(zk.getZooKeeper(), path) != null) {
        System.err.println("ERROR: Master lock is held, not running");
        if (this.exitOnError)
          System.exit(1);
        else
          return false;
      }
    } catch (KeeperException e) {
      System.err.println("ERROR: Could not read master lock, not running " + e.getMessage());
      if (this.exitOnError)
        System.exit(1);
      else
        return false;
    } catch (InterruptedException e) {
      System.err.println("ERROR: Could not read master lock, not running" + e.getMessage());
      if (this.exitOnError)
        System.exit(1);
      else
        return false;
    }
    return true;
  }
}


text:
CalRecycleLCA
=============

CalRecycle Used Oil LCA Online Tool

CalRecycleLCA.sln is a Visual Studio solution containing active projects in
the Database and LCIAToolAPI folders plus Documentation files.

The Database folder contains a shared Entity Framework data model and a
database initialization utility.

Documentation contains application specifications.

LCIAToolAPI contains backend projects implementing the core LCA engine and
Web API.

Details are described in subfolder README files:

 * [Back end](LCIAToolAPI/)
 * [Data loader](Database/)

The project also includes a front end application for data visualization.
The front end is a single page app that runs in the user's browser and can
connect to any back end server.  The front end code is in
[a separate repository](https://github.com/uo-lca/FrontEnd).

The Data loader (and by extension the back end) requires an LCA data
directory, which is [a separate repository](https://github.com/uo-lca/LCA_Data).


text:
namespace Abacaxi.Tests.SequenceExtensions
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics.CodeAnalysis;
    using System.Linq;
    using NUnit.Framework;

    [TestFixture]
    public sealed class ToListTests
    {
        [Test]
        public void ToList1_SelectsExpectedItems_ForAList()
        {
            var actual = new List<string> {"1", "2", "3"}.ToList(int.Parse);

            TestHelper.AssertSequence(actual, 1, 2, 3);
        }

        [Test]
        public void ToList1_SelectsExpectedItems_ForEnumerable()
        {
            var actual = new List<string> {"1", "2", "3"}.Where(p => true).ToList(int.Parse);

            TestHelper.AssertSequence(actual, 1, 2, 3);
        }

        [Test, SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
        public void ToList1_ThrowsException_ForNullSelector()
        {
            Assert.Throws<ArgumentNullException>(() => new int[] { }.ToList((Func<int, int>) null));
        }

        [Test, SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
        public void ToList1_ThrowsException_ForNullSequence()
        {
            Assert.Throws<ArgumentNullException>(() => ((int[]) null).ToList(i => i));
        }

        [Test]
        public void ToList2_SelectsExpectedItems_ForAList()
        {
            var actual = new List<string> {"a", "b", "c"}.ToList((s, i) => $"{i}:{s}");

            TestHelper.AssertSequence(actual, "0:a", "1:b", "2:c");
        }

        [Test]
        public void ToList2_SelectsExpectedItems_ForEnumerable()
        {
            var actual = new List<string> {"a", "b", "c"}.Where(p => true).ToList((s, i) => $"{i}:{s}");

            TestHelper.AssertSequence(actual, "0:a", "1:b", "2:c");
        }

        [Test, SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
        public void ToList2_ThrowsException_ForNullSelector()
        {
            Assert.Throws<ArgumentNullException>(() => new int[] { }.ToList((Func<int, int, int>) null));
        }

        [Test, SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
        public void ToList2_ThrowsException_ForNullSequence()
        {
            Assert.Throws<ArgumentNullException>(() => ((int[]) null).ToList((n, i) => i));
        }
    }
}


text:
<?php namespace GeneaLabs\Bones\Keeper\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Config;

class Assignment extends Model
{
    protected $user;

    public function __construct()
    {
        $this->user = app(Config::get('auth.model'));
    }

    public function addAllUsersToMemberRole()
    {
        $allUsers = $this->user->with('roles')->get();
        $allUsers->each(function ($user) {
            $user->roles()->attach('Member');
        });
    }

    public function removeAllSuperAdminUsersFromOtherRoles($assignedUsers)
    {
        $role = 'SuperAdmin';
        if (array_key_exists($role, $assignedUsers)) {
            $users = $assignedUsers[$role];
            foreach ($users as $id) {
                $user = $this->user->with('roles')->find($id);
                $user->roles()->detach();
            }
            $currentRole = Role::with('users')->find($role);
            $currentRole->users()->attach($users);
        }
    }

    public function assignUsersToRoles($assignedUsers)
    {
        foreach ($assignedUsers as $role => $users) {
            if ($role == 'SuperAdmin' || $role == 'Member') {
                continue;
            }
            $currentRole = Role::with('users')->find($role);
            $currentRole->users()->attach($users);
        }
    }

    public function removeAllUsersFromRoles()
    {
        $roles = Role::with('users')->get();
        $roles->each(function ($role) {
            $role->users()->detach();
        });
    }

    public function getAllUsersOfRole($role)
    {
        $role = Role::with('users')->where('name', $role)->first();

        return $role->users;
    }
}


text:
FromTheCache::Application.routes.draw do

    resources :contacts, :only => [:new, :create]

    match '/contact', :to => 'contacts#new'

    match '/about',   :to => 'pages#about'

    root              :to => 'pages#search'

    # Handle bistro_car javascript for development - the catch-all at the end breaks this.
    match '/javascripts/bundle/:bundle.js', :to => 'bistro_car/bundle#show'

    # Send any unknown controller/actions to the search page.
    match '*catch_all', :to => 'pages#search'

end


text:
import styled from 'styled-components'

const Image = styled.img`
  width: 100%;
`

export default Image


text:
package me.androidbox.busbymovies.movielist;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import javax.inject.Inject;

import io.reactivex.Observable;
import me.androidbox.busbymovies.models.Movie;
import me.androidbox.busbymovies.network.MovieAPIService;
import me.androidbox.busbymovies.utils.Constants;
import me.androidbox.busbymovies.utils.MovieSchedulers;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

/**
 * Created by steve on 2/25/17.
 */
public class MovieListModelImpGetMovieTest {
    private MovieListModelContract movieListModelContract;
    private Movie movie;

    @Mock MovieAPIService mockMovieAPIService;
    @Mock MovieListModelContract.MovieDetailResultsListener mockMovieResultsListener;
    @Mock Call<Movie> mockCall;
    @Mock ResponseBody mockResponseBody;
    @Captor ArgumentCaptor<Callback<Movie>> argumentCaptor;

    @Inject
    MovieSchedulers movieSchedulers;

    @Before
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(MovieListModelImpGetMovieTest.this);

        movieListModelContract = new MovieListModelImp(mockMovieAPIService, movieSchedulers);
        movie = new Movie();
    }

    @Ignore("FIXME")
    @Test
    public void shouldCallSuccessToGetMovies() {
        when(mockMovieAPIService.getMovieById(anyInt(), anyString())).thenReturn(Observable.just(new Movie()));
        Response<Movie> response = Response.success(movie);

        movieListModelContract.getMovieDetail(eq(anyInt()), mockMovieResultsListener);

        verify(mockCall).enqueue(argumentCaptor.capture());
        argumentCaptor.getValue().onResponse(mockCall, response);

        verify(mockMovieResultsListener, times(1)).onSuccess(movie);
        verify(mockMovieResultsListener, never()).onFailure(anyString());
    }

    @Ignore("FIXME")
    @Test
    public void shouldCallFailureOn401Response() {
        when(mockMovieAPIService.getMovieById(anyInt(), anyString())).thenReturn(Observable.just(new Movie()));
        Response<Movie> response = Response.error(401, mockResponseBody);

        movieListModelContract.getMovieDetail(eq(anyInt()), mockMovieResultsListener);

        verify(mockCall).enqueue(argumentCaptor.capture());
        argumentCaptor.getValue().onResponse(mockCall, response);

        verify(mockMovieResultsListener, never()).onSuccess(movie);
        verify(mockMovieResultsListener, times(1)).onFailure(response.message());
    }

    @Ignore("FIXME")
    @Test
    public void shouldCallFailureOn500Response() {
        /* Call the mocked version of the service and return the mock call */
        when(mockMovieAPIService.getMovieById(anyInt(), anyString())).thenReturn(Observable.just(new Movie()));

        /* Setup up mock response with a 500 error */
        Response<Movie> response = Response.error(500, mockResponseBody);

        /* Call the real get movies passing in the mocked interface */
        movieListModelContract.getMovieDetail(eq(anyInt()), mockMovieResultsListener);

        /* verify the response */
        verify(mockCall).enqueue(argumentCaptor.capture());
        argumentCaptor.getValue().onResponse(mockCall, response);

        /* Verify that the correct interface functions where called */
        verify(mockMovieResultsListener, never()).onSuccess(movie);
        verify(mockMovieResultsListener, times(1)).onFailure(response.message());
    }

    @Ignore("FIXME")
    @Test
    public void shouldCallFailureOnRetrofitException() {
        /* Create a exception that will be thrown */
        final Throwable runtimeException = new Throwable(new RuntimeException());
        final int MOVIE_ID = 457387;

        /* when the mocked call for the service return a mock */
        when(mockMovieAPIService.getMovieById(MOVIE_ID, Constants.MOVIES_API_KEY))
                .thenReturn(Observable.error(runtimeException));

        /* Start the actual call to being the test */
        movieListModelContract.getMovieDetail(MOVIE_ID, mockMovieResultsListener);

        /* Capture the argument that is passed to enqueue */
        verify(mockCall).enqueue(argumentCaptor.capture());
        argumentCaptor.getValue().onFailure(mockCall, runtimeException);

        /* Verify correct interface functions where called */
        verify(mockMovieResultsListener, never()).onSuccess(movie);
        verify(mockMovieResultsListener, times(1)).onFailure(runtimeException.getMessage());
    }

    @Ignore("FIXME")
    @Test
    public void shouldSearchForMoviesAndFailOnException() {
        final String MOVIE_NAME = "movie name";
        final int MOVIE_YEAR = 2002;
        final Throwable exception = new Throwable(new Exception());

        when(mockMovieAPIService.getMovieById(MOVIE_YEAR, Constants.MOVIES_API_KEY))
                .thenReturn(Observable.error(exception));

        MovieListModelContract.MovieDetailResultsListener movieSearchResultsListener = mock(MovieListModelContract.MovieDetailResultsListener.class);
        movieListModelContract.getMovieDetail(MOVIE_YEAR, movieSearchResultsListener);

     //   verify(movieSearchResultsListener).onSearchFailure(anyString());
   //     verify(movieSearchResultsListener, never()).onSearchSuccess(mockMovies);
    }
}


text:
var locations = [],
    // Init. Variables for Map
    map,
    center,
    bounds,
    // Prepare Info
    infowindow,
    // Init. Variables for Foursquare API
    client_id = "SYVT2EFOMEFMXTQ4NZOHTTT1JMHQBYMYZCNETSDA0FVOFIEO",
    client_secret = "BP0RHAI1ZLCA4SZOCYTUUP4SNRA3QHOJDZRSYU2AP0UBCHR1",
    version = "20151121", // YYYYMMDD Format
    initLocation = "Boston",
    searchLimit = 10,
    // Init. viewModel for Knockout's MVVM Architecture
    viewModel = {
        locations: ko.observableArray(),
        query: ko.observable(''),
        search: search,
        show: showInfo,
        title: ko.observable(),
        rating: ko.observable(),
        tip: ko.observable(),
        url: ko.observable(),
        open: ko.observable(),
        location: ko.observable(initLocation)
    };

ko.applyBindings(viewModel);
viewModel.query.subscribe(viewModel.search);

function initMap() {
    loadPointsAsync();
    // Create a map object and specify the DOM element for display.
    map = new google.maps.Map(document.getElementById('map'), {
        scrollwheel: false
    });
    // Create bounds object to aid in cropping map to points on map
    bounds = new google.maps.LatLngBounds();
    google.maps.event.addDomListener(window, 'resize', function() {
        setBounds();
    });
}

function loadPointsAsync() {
    // Fetch Points over AJAX
    $.getJSON("https://api.foursquare.com/v2/venues/explore?" +
        "client_id=" + client_id + "&" + "client_secret=" +
        client_secret + "&" + "v=" + version + "&" + "near=" +
        initLocation + "&" + "limit=" + searchLimit + "&", function(
            data) {
            // Load points into array
            for (var x in data.response.groups[0].items) {
                locations.push({
                    position: {
                        lat: data.response.groups[0].items[x].venue
                            .location.lat,
                        lng: data.response.groups[0].items[x].venue
                            .location.lng
                    },
                    title: data.response.groups[0].items[x].venue
                        .name,
                    tip: data.response.groups[0].items[x].tips[
                        0].text,
                    url: data.response.groups[0].items[x].venue
                        .url,
                    rating: data.response.groups[0].items[x].venue
                        .rating,
                    open: data.response.groups[0].items[x].venue
                        .hours.isOpen
                });
            }
            // Sort locations by name
            locations.sort(function compare(a, b) {
                if (a.title < b.title) return -1;
                if (a.title > b.title) return 1;
                return 0;
            });
            // Return copy of locations array to viewModel
            viewModel.locations(locations.slice());
            // Create Markers
            loadMarkers();
        }).fail(function() {
        // Gracefully handle when API cannot be accessed
        alert(
            "The locations could not be loaded due to network connectivity issues. Please try again later."
        );
    });
}

function loadMarkers() {
    // Iterate through All Locations within Array
    locations.forEach(function(pos, i) {
        // Create Map Marker
        pos.marker = new google.maps.Marker({
            map: map,
            position: pos.position,
            title: pos.title
        });
        // Set default icon for map marker
        setDefaultIcon(pos);
        // Listen for Click Event on Marker
        pos.marker.addListener('click', function() {
            showInfo(pos);
        });
        // Add Marker to Bounds
        bounds.extend(pos.marker.getPosition());
    });
    // Crop map around markers
    setBounds();
}

function showInfo(pos) {
    // Close any existing infowindow
    if (infowindow != undefined) {
        infowindow.close();
        setDefaultIcon(lastpos);
    }
    // Impose selected state on current marker
    pos.marker.setIcon({
        url: 'images/selected.png'
    });
    // Push selected location's data to viewModel
    viewModel.title(pos.title);
    viewModel.rating(pos.rating);
    viewModel.url(pos.url);
    viewModel.tip(pos.tip);
    viewModel.open(pos.open);
    // Generate Info Windiw
    infowindow = new google.maps.InfoWindow({
        content: document.getElementById('infowindow').innerHTML
    });
    // Save marker, so the icon can be reverted afterwards
    lastpos = pos;
    // Revert icon on close
    infowindow.addListener('closeclick', function() {
        setDefaultIcon(pos);
    });
    // Open templated infowindow
    infowindow.open(map, pos.marker);
}

function setDefaultIcon(pos) {
    // Show open icon if location is currently open
    if (pos.open) {
        pos.marker.setIcon({
            url: 'images/open_now.png'
        });
    }
    // Show standard icon if location is closed or data has not been provided
    else {
        pos.marker.setIcon({
            url: 'images/unselected.png'
        });
    }
}

function setBounds() {
    // Crop Map Around Markers
    if (center) map.setCenter(center);
    map.fitBounds(bounds);
    if (!center) center = map.getCenter();
}

function search(value) {
    var count = 0;
    // Remove all the current locations, which removes them from the view
    viewModel.locations.removeAll()
        // Iterate through all locations and see if search query matches location
    for (var x in locations) {
        if (locations[x].title.toLowerCase().indexOf(value.toLowerCase()) >=
            0 || locations[x].tip.toLowerCase().indexOf(value.toLowerCase()) >=
            0) {
            // Show Matching Locations
            locations[x].marker.setVisible(true);
            viewModel.locations.push(locations[x]);
            count++;
        } else {
            locations[x].marker.setVisible(false);
        }
    }
}


text:
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings

class Invoice(models.Model):

	user = models.ForeignKey(User)
	product = models.CharField(max_length=100,default='', verbose_name="products")
	items = models.CharField(max_length=300,default='', verbose_name="items")
	total = models.IntegerField(default=0)
	payed = models.IntegerField(default=0)
	date_created = models.DateTimeField(auto_now_add=True)
	paypal_response_json = models.TextField(default='')
	paypal_confirmation_json = models.TextField(default='')


text:
hello-world:
	gcc hello-world.m -o hello-world


text:
/*jslint devel:true, node:true, nomen:true */

(function () {
	"use strict";
	var fs = require('fs'),
		ssh2 = require('ssh2'),
		exec = require('child_process').exec,
		path = require('path'),
		net = require('net'),
		readline = require('readline'),
		os = require('os'),
		crypto = require('crypto'),
		excludePath = require('./js/exclude_path'),
		ftparray = {},
		cpFileCmd = 'cp',
		cpDirCmd  = 'cp -r',
		localCmd,
		remoteCmd,
		LFTPClass,
		SFTPClass,
		getRealPath = function (p) { return p; };

	function decrypt(text, key) {
		var decipher = crypto.createDecipher('aes-256-ctr', key),
			dec = decipher.update(text, 'hex', 'utf8');
		dec += decipher.final('utf8');
		return dec;
	}

	if (os.platform().indexOf('win') === 0) { // win setting
		cpFileCmd = 'copy';
		cpDirCmd  = 'xcopy /s /R /Y /I';
		getRealPath = function (p) {
			if (p.split(':').length > 1) {
				return p;
			}
			return path.join(process.cwd().split(':')[0] + ':', p);
		};
	}

	/*
	 * local command
	 */
	localCmd = function (cmd, callback, dataCallback) {
		var child = exec(cmd,
			(function (cb) {
				return function (error, stdout, stderr) {
					//console.log('stdout: ' + stdout);
					//console.log('stderr: ' + stderr);
					if (error !== null) {
						console.log('exec error: ' + error);
					}
					if (cb) {
						cb(error);
					}
					if (dataCallback) {
						dataCallback(stdout.toString());
					}
				};
			}(callback)));
	};

	var localCopyFile     = function (src, dst, callback) {
		//console.log("LOCAL COPY FILE", src, dst);
		var realSrc = getRealPath(src);
		/*
		if (!fs.existsSync(realSrc)) {
			console.log('not found path aa>' + realSrc);
			return;
		}
		*/
		if (os.platform().indexOf('win') === 0) {
			//if (fs.lstatSync(src).isDirectory()) {
			//	localCmd(cpDirCmd + ' "' + getRealPath(src) + '" "' + getRealPath(dst) + '"', callback);
			//} else {
				localCmd(cpFileCmd + ' "' + getRealPath(src) + '" "' + getRealPath(dst) + '"', callback);
			//}
		} else {
			//if (fs.lstatSync(src).isDirectory()) {
			//	localCmd(cpDirCmd + ' ' + getRealPath(src) + ' ' + getRealPath(dst), callback);
			//} else {
			//}
				localCmd(cpFileCmd + ' ' + getRealPath(src) + ' ' + getRealPath(dst), callback);
		}
	};

	/*
	 * Remote server is linux, macosx.
	 * requires file commands.[cp,mv,tar,...]
	 */
	remoteCmd = function (conn, cmd, callback, dataCallback) {
		conn.exec(cmd, (function (cb, dataCallback) {
			return function (err, stream) {
				//console.log('REMOTE CMD>' + cmd);
				if (err) {
					console.log(err);
				}
				stream.on('close', function (code, signal) {
					//console.log('Stream :: close :: code: ' + code + ', signal: ' + signal);
					conn.end();
				}).on('end', function () {
					if (callback) {
						callback(err);
					}
				}).on('data', function (data) {
					if (dataCallback) {
						dataCallback(data.toString());
					}
				});
			};
		}(callback, dataCallback)));
	};

	LFTPClass = function () {
		this.LocalCommand = function (command, callback, dataCallback) {
			//console.log('LocalCommand>', command);
			localCmd(command, callback, dataCallback);
		};

		this.CopyFile = function (srcpath, destpath, callback) {
			//console.log('local:CopyFile>', srcpath, destpath);
			localCopyFile(srcpath, destpath, callback);
		};

		this.errorLog = function (msg, callback) {
			console.log(msg);
			callback(msg);
		};

		this.Disconnect = function () {
			console.log('This is local session. no need to disconnect.');
		};

		this.Connect = function (args) {
			// nothing to do.
			console.log('This is local session. no need to connect.');
		};

	}; // LFTPClass

	SFTPClass = function () {
		var conn = new ssh2();
		this.conn = conn;
		this.sftp = null;
		this.isConnected = false;

		this.errorLog = function (msg, callback) {
			console.log(msg);
			callback(msg);
		};

		this.Disconnect = function () {
			this.sftp = null;
			this.conn.end();
			this.isConnected = false;
		};

		this.UploadFile = function (local_path, tar_path, callback) {
			var sftp = this.sftp,
				tempDir,
				readStream,
				writeStream;

			if (!this.isConnected) {
				this.errorLog('Not established connection.', callback);
				return;
			}

			if (!fs.existsSync(local_path)) {
				this.errorLog('not found path>' + local_path, callback);
				return;
			}
			// upload file
			readStream = fs.createReadStream(local_path);
			writeStream = this.sftp.createWriteStream(tar_path);

			writeStream.on('error', (function (self) {
				return function (err) {
					console.error('UploadFile error!', err, 'tar_path=', tar_path);
					process.exit();
				};
			}(this)));
			// what to do when transfer finishes
			writeStream.on('close', (function (self) {
				return function () {
					console.log("- file transferred");
					//this.sftp.end(); // no need?
					if (callback) {
						callback();
					}
					process.exit();
				};
			}(this)));

			// initiate transfer of file
			readStream.pipe(writeStream);
		};

		this.DownloadFile = function (tar_path, local_path, callback) {
			var sftp = this.sftp,
				downloadFile;
			if (!this.isConnected) {
				this.errorLog('Not established connection.', callback);
				return;
			}

			downloadFile = function (self, local_path, tar_path, callback) {
				var writeStream = fs.createWriteStream(local_path),
					readStream = self.sftp.createReadStream(tar_path);

				// what to do when transfer finishes
				readStream.on('close', function () {
					console.log("- file transferred");
					if (callback) {
						callback();
					}
					process.exit();
				});

				// initiate transfer of file
				readStream.on('error', (function (thisptr, tar_path, callback) {
					return function (e) {
						thisptr.errorLog('Faild to download. Failed to read file:' + tar_path + e, callback);
						process.exit();
						return;
					};
				}(self, tar_path, callback)));
				writeStream.on('error', (function (thisptr, local_path, callback) {
					return function (e) {
						thisptr.errorLog('Faild to download. Failed to write file:' + local_path + e, callback);
						process.exit();
						return;
					};
				}(self, local_path, callback)));
				readStream.pipe(writeStream);
			};

			sftp.stat(tar_path, (function (self, local_path, tar_path, callback) {
				return function (err, stats) {
					// download file
					downloadFile(self, local_path, tar_path, callback);
				};
			}(this, local_path, tar_path, callback)));
		};

		this.RemoteCommand = function (command, callback, dataCallback) {
			if (!this.isConnected) {
				this.errorLog('Not established connection.', callback);
				return;
			}
			//console.log('RemoteCommand>', command);
			remoteCmd(this.conn, command, callback, dataCallback);
		};

		this.Connect = function (args, callback) {
			conn.on('connect', function () {
				//console.log("- connected");
			});
			conn.on('ready', (function (self, cback) {
				return function () {
					//console.log("- ready");
					conn.sftp(function (err, sftp) {
						if (err) {
							console.log("Error, problem starting SFTP Error: %s", err);
							process.exit(2);
						}
						//console.log("- SFTP started");
						self.sftp = sftp;

						self.isConnected = true;
						if (cback) {
							cback(null);
						}
					});
				};
			}(this, callback)));

			conn.on('keyboard-interactive', function redo(name, instructions, instructionsLang, prompts, finish, answers) {
				if (args.hasOwnProperty('password')) {
					finish([args.password]);
				} else {
					finish([]);
				}
			});

			conn.on('error', function (err) {
				console.log("- connection error: %s", err);
				if (callback) {
					callback("- connection error: " + err.toString());
				}
			});
			conn.on('close', function (had_error) {
				//console.log('Connection close');
				process.exit();
			});
			conn.on('end', function () {
				//console.log('End remote session.');
			});

			try {
				conn.connect(args);
			} catch (e) {
				console.log("Failed to connect server.[SSH2]");
				if (callback) {
					callback(e);
				}
			}
		};

	}; // SFTPClass

	function sendForwardCommand(param, info) {
		var targetInfo = null,
			stepConn = null,
			stepServer = null;

		try {
			targetInfo = JSON.parse(param.targetInfo);
			if (targetInfo.port === undefined || !targetInfo.port) {
				targetInfo.port = 22;
			}
			if (targetInfo.privateKey) {
				targetInfo.privateKey = fs.readFileSync(targetInfo.privateKey);
				delete targetInfo.password;
			}
		} catch (e) {
			console.error('Error on sendForwardCommand', e);
			return;
		}

		if (info.port === undefined || !info.port) {
			info.port = 22;
		}

		//console.log(info, targetInfo);

		stepConn = new ssh2();

		stepConn.on('keyboard-interactive', function redo(name, instructions, instructionsLang, prompts, finish, answers) {
			if (info.hasOwnProperty('password')) {
				finish([info.password]);
			} else {
				finish([]);
			}
		});
		stepConn.on('error', function (err) {
			console.error("- connection error: %s", err);
		});
		stepConn.on('close', function (had_error) {
			//console.log('Connection close');
			process.exit();
		});
		stepConn.on('end', function () {
			//console.log('End remote session.');
		});

		stepConn.on('ready', (function (info, targetInfo) {
			return function () {
				var forwardLogin = {
					host : targetInfo.host,
					readyTimeout : 99999
				};
				if (info.username) {
					forwardLogin.username = info.username;
				}
				if (info.port) {
					forwardLogin.port = info.port;
				}
				if (info.path) {
					forwardLogin.path = info.path;
				}
				if (info.password) {
					forwardLogin.password = info.password;
				}
				if (info.passphrase) {
					forwardLogin.passphrase = info.passphrase;
				}
				if (info.privateKey) {
					forwardLogin.privateKey = info.privateKey;
				}

				if (targetInfo.username) {
					forwardLogin.username = targetInfo.username;
				}
				if (targetInfo.port) {
					forwardLogin.port = targetInfo.port;
				}
				if (targetInfo.path) {
					forwardLogin.path = targetInfo.path;
				}
				if (targetInfo.password) {
					forwardLogin.password = targetInfo.password;
				}
				if (targetInfo.passphrase) {
					forwardLogin.passphrase = targetInfo.passphrase;
				}
				if (targetInfo.privateKey) {
					forwardLogin.privateKey = targetInfo.privateKey;
				}

				//console.log("forwardLogin", forwardLogin);

				stepConn.exec('nc ' + forwardLogin.host + ' ' + forwardLogin.port, (function (forwardLogin, param) {
					return function (err, stream) {
						var sfc = new SFTPClass();
						if (err) {
							console.error(err);
							return;
						}
						forwardLogin.sock = stream;
						delete forwardLogin.host;
						delete forwardLogin.port;
						sfc.Connect(forwardLogin, (function (sfc) {
							return function (err) {
								if (err) {
									console.log("Connection Failed " + err);
									return;
								}
								if (param.commandName === 'sshforward') {
									sfc.RemoteCommand(param.commandStr, function (err) {
										if (err) {
											console.log("Error:", err);
										}
									}, function (data) {
										console.log(data);
									});
								} else if (param.commandName === 'sftpgetforward') {
									sfc.DownloadFile(param.srcPath, param.dstPath, function (err) {
										if (err) {
											console.log("Error:", err);
										}
									});
								} else if (param.commandName === 'sftpsendforward') {
									sfc.UploadFile(param.srcPath, param.dstPath, function (err) {
										if (err) {
											console.log("Error:", err);
										}
									});
								}
							};
						}(sfc)));
					};
				}(forwardLogin, param)));
			};
		}(info, targetInfo))).on('close', function () {
			if (stepServer) {
				stepServer.close();
			}
		}).connect(info);
	}

	/**
	 * tempPath temporary file path for auth
	 * key for auth
	 * commandStr 'ssh' or 'sftpget' or 'sftpsend'
	 */
	function sendCommand(param) {
		//console.log("connecting..", param.commandName, "\r\n");
		var data = {
				cid : param.hostType
			},
			info,
			sfc = null,
			isUsePassword = false,
			file,
			parsed;

		if (data.cid === '') {
			console.log('Error: cid parameter. must set unique id.');
			return;
		}

		try {
			file = fs.readFileSync(param.tempPath);
			parsed = JSON.parse(file);
		} catch (e) {
			console.error(e);
			return;
		}

		if (!parsed.hasOwnProperty(param.hostType)) {
			param.hostType = param.hostType.split("'").join('');
		}

		if (parsed.hasOwnProperty(param.hostType)) {
			info = parsed[param.hostType];
			info.usepassword = !info.hasOwnProperty('sshkey');
			info.host = info.server;
			info.path = info.workpath;
			info.username = info.userid;
			info.readyTimeout = 99999;

			// info.debug = console.log; // print debug messages of ssh2

			delete info.server;
			if (info.hasOwnProperty('password')) {
				info.password = decrypt(info.password, param.key);
			} else if (info.hasOwnProperty('passphrase')) {
				info.passphrase = decrypt(info.passphrase, param.key);
			}
			if (info.hasOwnProperty('sshkey')) {
				info.privateKeyFile = info.sshkey;
			}
			if (param.hasOwnProperty('port') && param.port !== 'undefined' && param.port) {
				info.port = param.port;
			} else {
				info.port = 22;
			}
		}

		if (!info.hasOwnProperty('type')) {
			console.log(data.cid, 'Invalid host type');
			//errorMessage(data.cid, 'Invalid host type');
			return;
		}

		if (info.hasOwnProperty('usepassword')) {
			isUsePassword = info.usepassword;
			delete info.usepassword;
		}

		if (info.type === 'local') {
			sfc = new LFTPClass();
			ftparray[data.cid] = sfc;

			if (param.commandName === 'ssh') {
				sfc.LocalCommand(param.commandStr, function (err) {
					if (err) {
						console.log("Error:", err);
					}
				}, function (data) {
					console.log(data);
				});
			} else if (param.commandName === 'sftpget') {
				sfc.CopyFile(param.srcPath, param.dstPath, function (err) {
					if (err) {
						console.log("Error:", err);
					}
				});
			} else if (param.commandName === 'sftpsend') {
				sfc.CopyFile(param.srcPath, param.dstPath, function (err) {
					if (err) {
						console.log("Error:", err);
					}
				});
			}
		} else {

			try {
				if (isUsePassword) {
					// password authoricaiton
					if (info.hasOwnProperty('privateKeyFile')) {
						delete info.privateKeyFile;
					}
					if (info.hasOwnProperty('passphrase')) {
						delete info.passphrase;
					}
					info.tryKeyboard = true;
				} else {
					// load private key
					if (info.hasOwnProperty('password')) {
						delete info.password;
					}
					if (info.hasOwnProperty('privateKeyFile')) {
						info.privateKey = fs.readFileSync(info.privateKeyFile);
					}
				}
			} catch (ee) {
				console.log(data.cid, "Failed read SSH key file:" + info.privateKeyFile);
				return;
			}

			if (param.commandName === 'sshforward' || param.commandName === 'sftpsendforward' || param.commandName === 'sftpgetforward') {
				sendForwardCommand(param, info);
			} else {
				sfc = new SFTPClass();
				sfc.Connect(info, (function (data, sfc) {
					return function (err) {
						if (err) {
							console.log(data.cid, "Connection Failed " + err);
							return;
						}
						ftparray[data.cid] = sfc;

						if (param.commandName === 'ssh') {
							sfc.RemoteCommand(param.commandStr, function (err) {
								if (err) {
									console.log("Error:", err);
								}
							}, function (data) {
								console.log(data);
							});
						} else if (param.commandName === 'sftpget') {
							sfc.DownloadFile(param.srcPath, param.dstPath, function (err) {
								if (err) {
									console.log("Error:", err);
								}
							});
						} else if (param.commandName === 'sftpsend') {
							sfc.UploadFile(param.srcPath, param.dstPath, function (err) {
								if (err) {
									console.log("Error:", err);
								}
							});
						}
					};
				}(data, sfc)));
			}
		}
	}

	if (process.argv.length > 3) {
		//console.error(process.argv);
		if (process.argv[2] === 'sshforward') {
			sendCommand({
				commandName : process.argv[2],
				targetInfo : process.argv[3],
				tempPath : process.argv[4],
				key : process.argv[5],
				hostType : process.argv[6],
				commandStr : process.argv[7],
				port : process.argv[8]
			});
		} else if (process.argv[2] === 'sftpsendforward' || process.argv[2] === 'sftpgetforward') {
			sendCommand({
				commandName : process.argv[2],
				targetInfo : process.argv[3],
				tempPath : process.argv[4],
				key : process.argv[5],
				hostType : process.argv[6],
				srcPath : process.argv[7],
				dstPath : process.argv[8],
				port : process.argv[9]
			});
		} else if (process.argv[2] === 'sftpsend' || process.argv[2] === 'sftpget') {
			sendCommand({
				commandName : process.argv[2],
				tempPath : process.argv[3],
				key : process.argv[4],
				hostType : process.argv[5],
				srcPath : process.argv[6],
				dstPath : process.argv[7],
				port : process.argv[8]
			});
		} else if (process.argv[2] === 'ssh') {
			sendCommand({
				commandName : process.argv[2],
				tempPath : process.argv[3],
				key : process.argv[4],
				hostType : process.argv[5],
				commandStr : process.argv[6],
				port : process.argv[7]
			});
		}
	}
}());


text:
/**
 * This class was created by <ArekkuusuJerii>. It's distributed as
 * part of the Grimoire Of Alice Mod. Get the Source Code in github:
 * https://github.com/ArekkuusuJerii/Grimore-Of-Alice
 * <p>
 * Grimoire Of Alice is Open Source and distributed under the
 * Grimoire Of Alice license: https://github.com/ArekkuusuJerii/Grimoire-Of-Alice/blob/master/LICENSE.md
 */
package com.witchworks.common.core.handler;

import com.witchworks.common.lib.LibMod;
import net.minecraftforge.common.config.Config;
import net.minecraftforge.common.config.Config.Comment;

/**
 * This class was created by <Arekkuusu> on 26/02/2017.
 * It's distributed as part of Witchworks under
 * the MIT license.
 */
@SuppressWarnings ({"WeakerAccess", "unused"})
@Config (modid = LibMod.MOD_ID)
public final class ConfigHandler {

	@Comment ("Change vein sizes, generation height and generation chance")
	public static WorldGen WORLD_GEN = new WorldGen();
	@Comment ("Customise the HUDs positions in the screen")
	public static HUD HUD = new HUD();

	private ConfigHandler() {
	}

	public static class WorldGen {

		//Silver will be pretty common due to its importance in this mod.
		@Comment ("Silver Ore gen")
		public int silver_min_vein = 1;
		public int silver_max_vein = 8;
		public int silver_min_height;
		public int silver_max_height = 128;
		public int silver_gen_chance = 8;

		@Comment ("Moldavite Ore gen")
		public int moldavite_min_vein = 1;
		public int moldavite_max_vein = 6;
		public int moldavite_min_height;
		public int moldavite_max_height = 80;
		public int moldavite_gen_chance = 2;

		@Comment ("BloodStone Ore gen")
		public int bloodStone_min_vein = 1;
		public int bloodStone_max_vein = 6;
		public int bloodStone_min_height;
		public int bloodStone_max_height = 64;
		public int bloodStone_gen_chance = 3;

		@Comment ("Tourmaline Ore gen")
		public int tourmaline_min_vein = 1;
		public int tourmaline_max_vein = 4;
		public int tourmaline_min_height;
		public int tourmaline_max_height = 80;
		public int tourmaline_gen_chance = 2;

		@Comment ("Malachite Ore gen")
		public int malachite_min_vein = 1;
		public int malachite_max_vein = 4;
		public int malachite_min_height;
		public int malachite_max_height = 80;
		public int malachite_gen_chance = 3;

		@Comment ("Tigers Eye Ore gen")
		public int tigersEye_min_vein = 1;
		public int tigersEye_max_vein = 4;
		public int tigersEye_min_height;
		public int tigersEye_max_height = 64;
		public int tigersEye_gen_chance = 2;

		@Comment ("Serpentine Ore gen")
		public int serpentine_min_vein = 1;
		public int serpentine_max_vein = 8;
		public int serpentine_min_height;
		public int serpentine_max_height = 128;
		public int serpentine_gen_chance = 4;

		@Comment ("Nuummite Ore gen")
		public int nuummite_min_vein = 1;
		public int nuummite_max_vein = 6;
		public int nuummite_min_height;
		public int nuummite_max_height = 80;
		public int nuummite_gen_chance = 1;

		@Comment ("Garnet Ore gen")
		public int garnet_min_vein = 1;
		public int garnet_max_vein = 1;
		public int garnet_min_height;
		public int garnet_max_height = 30;
		public int garnet_gen_chance = 2;

		//Petoskey Stone is actually a fossil of a rugosa coral that has been effectively rounded due to more recent glaciations.
		//I apologize if these comments sound nitpicky.
		@Comment ("Petoskey Ore gen")
		public int petoskey_min_vein = 1;
		public int petoskey_max_vein = 4;
		public int petoskey_min_height;
		public int petoskey_max_height = 80;
		public int petoskey_gen_chance = 2;

		@Comment ("Jasper Ore gen")
		public int jasper_min_vein = 1;
		public int jasper_max_vein = 3;
		public int jasper_min_height;
		public int jasper_max_height = 62;
		public int jasper_gen_chance = 2;

		//all these flavors and you chose to be salty
		@Comment ("Salt Ore gen")
		public int salt_min_vein = 1;
		public int salt_max_vein = 20;
		public int salt_min_height;
		public int salt_max_height = 100;
		public int salt_gen_chance = 4;

		@Comment ("Quartz Ore gen")
		public int quartz_min_vein = 1;
		public int quartz_max_vein = 8;
		public int quartz_min_height = 16;
		public int quartz_max_height = 128;
		public int quartz_gen_chance = 6;

		@Comment ("Amethyst Ore gen")
		public int amethyst_min_vein = 1;
		public int amethyst_max_vein = 6;
		public int amethyst_min_height;
		public int amethyst_max_height = 60;
		public int amethyst_gen_chance = 4;

		@Comment ("Alexandrite Ore gen")
		public int alexandrite_min_vein = 1;
		public int alexandrite_max_vein = 4;
		public int alexandrite_min_height;
		public int alexandrite_max_height = 40;
		public int alexandrite_gen_chance = 2;

		//Values are meant to represent sea level for now, until I implement biome-centric generation and the likes.
		//Or if I screw up my sleep again, and someone else has to do it.
		@Comment ("Coquina gen")
		public int coquina_min_vein = 1;
		public int coquina_max_vein = 4;
		public int coquina_min_height = 55;
		public int coquina_max_height = 64;
		public int coquina_gen_chance = 2;

		//Chalk veins should be similar to that of vanilla stone veins
		@Comment ("Chalk gen")
		public int chalk_min_vein = 4;
		public int chalk_max_vein = 20;
		public int chalk_min_height;
		public int chalk_max_height = 100;
		public int chalk_gen_chance = 4;
	}

	public static class HUD {

		@Comment ("Energy HUD")
		public static EnergyHUD ENERGY_HUD = new EnergyHUD();
		@Comment ("Brews HUD")
		public static BrewHUD BREW_HUD = new BrewHUD();

		public static class EnergyHUD {
			@Comment ("Should the energy HUD be hidden?")
			public boolean hide = true;
			@Comment ({"Pixels before HUD starts", "Size is calculated with heightEnd - heightStart"})
			public int heightStart = 32;
			@Comment ({"Pixels after HUD ends", "Size is calculated with heightEnd - heightStart"})
			public int heightEnd = 134;
			@Comment ("Width of the HUD")
			public int width = 25;

			@Comment ({"Position of the HUD in the screen", "\"x\" value is from left to right", "\"y\" value is from bottom to top"})
			public int x = 150;
			public int y = 129;
		}

		public static class BrewHUD {
			@Comment ("Should the brew HUD be hidden?")
			public boolean hide;
			@Comment ({"Position of the HUD in the screen", "\"x\" value is from right to left", "\"y\" value is from top to bottom"})
			public int x = 21;
			public int y = 100;
		}
	}
}


text:
copyright:
  years: 2015,2016

---

{:new_window: target="\_blank"}
{:shortdesc: .shortdesc}
{:screen:.screen}
{:codeblock:.codeblock}
{:pre: .pre}

# Conexiones de aplicaciones, dispositivos y pasarelas a {{site.data.keyword.iot_short_notm}}
{: #connect_devices_apps_gw}
Última actualización: 08 de septiembre de 2016
{: .last-updated}

Las aplicaciones, los dispositivos y las pasarelas se pueden conectar a {{site.data.keyword.iot_full}} mediante el protocolo de MQTT. Los dispositivos también pueden conectarse y publicar sucesos en {{site.data.keyword.iot_short_notm}} a través de la API de HTTP.
{: shortdesc}

## URL de conexiones de clientes
{: #client_connect_url}

Para conectar clientes de dispositivos, aplicaciones y pasarelas a la instancia de {{site.data.keyword.iot_short_notm}}, utilice los siguientes URL de conexión:

### Dirección de mensajería

<var class="keyword varname">orgId</var>.messaging.internetofthings.ibmcloud.com

{: codeblock}

### URL de conexión de la API REST de HTTP

https://<var class="keyword varname">orgId</var>.internetofthings.ibmcloud.com/api/v0002/device/types/<var class="keyword varname">typeId</var>/devices/<var class="keyword varname">deviceId</var>/events/<var class="keyword varname">eventId</var>

{: codeblock}

**Notas**
- *orgId* es el único ID de organización generado al registrar la instancia de servicio.
- Si está conectando un dispositivo o aplicación al servicio de Inicio rápido, especifique 'quickstart' como valor de *orgId*.

## Seguridad de puerto
{: #client_port_security}

Asegúrese de que los puertos requeridos estén abiertos y habilitados para la comunicación.

|Tipo de conexión |Número de puerto|
|:---|:---|
|No seguro|1883|
|Seguro|8883|
|Seguro|443|

Los clientes de MQTT se conectan utilizando las credenciales adecuadas, como por ejemplo las señales de autenticación de dispositivo para dispositivos y claves y señales de API para aplicaciones. Dado que la mensajería de MQTT al puerto no seguro 1883 envía estas credenciales en texto sin formato, utilice siempre las alternativas seguras 8883 o 443 en su lugar. Los puertos seguros fuerzan el cifrado de las credenciales de TLS. Tenga en cuenta que debe habilitar TLS en la aplicación mediante el método tls_set() en la biblioteca de MQTT de Python. De lo contrario, los datos se pueden enviar de forma no segura.

Cuando se utiliza la mensajería de MQTT segura en los puertos 8883 o 443, las bibliotecas de clientes más recientes confían automáticamente en el certificado presentado por {{site.data.keyword.iot_short_notm}}. Si este no es el caso para el entorno del cliente, puede descargar y utilizar la cadena de certificados completa desde [messaging.pem](https://github.com/ibm-messaging/iot-python/blob/master/src/ibmiotf/messaging.pem).

## Requisitos de TLS
{: #tls_requirements}
Algunas bibliotecas de cliente de Transport Layer Security (TLS) no dan soporte a dominios que incluyan un comodín. Si no puede cambiar satisfactoriamente las bibliotecas, inhabilite la comprobación de certificados.

{{site.data.keyword.iot_short_notm}} requiere TLS V1.2 y las siguientes suites de cifrado:
- ECDHE-RSA-AES256-GCM-SHA384
- AES256-GCM-SHA384
- ECDHE-RSA-AES128-GCM-SHA256
- AES128-GCM-SHA256

## Autenticación de cliente de MQTT
{: #mqtt_authentication}

**Importante:** Cada cliente de MQTT requiere un ID de cliente exclusivo. Si intenta conectar un cliente a la organización utilizando un ID de cliente que ya esté conectado, se desconectará la primera conexión.

Los dispositivos y pasarelas que están conectados directamente al {{site.data.keyword.iot_short_notm}} muestran un icono de estado en el panel de instrumentos para indicar que están conectados. Los dispositivos que están conectados de forma indirecta a través de una pasarela se muestran como desconectados porque el panel de instrumentos no sabe qué dispositivos están conectados a través de una pasarela.

### Identificadores de cliente de MQTT

Para que se autentiquen correctamente los dispositivos, aplicaciones y pasarelas, defina cada cliente de MQTT utilizando los siguientes identificadores de clientes y formato:

|Tipo de cliente |ID|Formato de ID de MQTT|
|:---|:---|:---|
|Aplicaciones|a|
a:<var class="keyword varname">orgId</var>:<var class="keyword varname">appId</var>

|Aplicaciones escalables|A|
A:<var class="keyword varname">orgId</var>:<var class="keyword varname">appId</var>

|Dispositivos|d|
d:<var class="keyword varname">orgId</var>:<var class="keyword varname">deviceType</var>:<var class="keyword varname">deviceId</var>
|
|Pasarelas|g|
g:<var class="keyword varname">orgId</var>:<var class="keyword varname">typeId</var>:<var class="keyword varname">deviceId</var>
|

Donde
- *orgId* es el ID de organización de seis caracteres exclusivo que se ha generado cuando se ha registrado el servicio.
- *appId* es un identificador de serie exclusivo definido por el usuario para el cliente.
- *deviceId* identifica de forma exclusiva un dispositivo o pasarela en todos los tipos y es similar a un número de serie.
- *device_type* es el identificador para el tipo de dispositivo que se está conectando y es similar a un número de modelo.
- *typeId* es un identificador del tipo de pasarela que se está conectando y es similar a un número de modelo.

Los valores *appId*, *type_id*, *device_type* y *device_id* no deben tener más de 36 caracteres y sólo pueden contener:
- Caracteres alfanuméricos (a-z, A-Z, 0-9)
- Guiones ( - )
- Guiones bajos ( _ )
- Puntos ( . )

**Notas:**
- Cuando se conecta al servicio de Inicio rápido, no se necesita autenticación.
- No es necesario registrar una aplicación antes de establecer la conexión.

### Conexión de aplicaciones utilizando MQTT

Las aplicaciones de {{site.data.keyword.iot_short_notm}} requieren una clave de API para conectarse a una organización. Cuando se registra una clave de API, se genera una señal, que se debe utilizar con dicha clave de API.

El código siguiente proporciona un ejemplo de una clave de API:

a-<var class="keyword varname">orgId</var>-a84ps90Ajs

{: codeblock}

El ejemplo siguiente muestra una señal de autenticación típica:

```
 MP$08VKz!8rXwnR-Q*
```

Cuando se realiza una conexión de MQTT utilizando una clave de API, asegúrese de que cumple los siguientes requisitos:

- El ID de cliente de MQTT está en el siguiente formato: a:*orgId*:*appId*
- El nombre de usuario de MQTT es la clave de la API, por ejemplo, a-*orgId*-a84ps90Ajs
- La contraseña de MQTT es la señal de autenticación, por ejemplo, *MP$08VKz!8rXwnR-Q*

Para obtener más información, consulte [Conectividad de MQTT para las aplicaciones](../../applications/mqtt.html).

### Autenticación de dispositivo

#### Nombres de usuario
El servicio de {{site.data.keyword.iot_short_notm}} sólo da soporte a la autenticación basada en señales para dispositivos; por lo tanto, cada dispositivo sólo tiene un nombre de usuario válido.
Un valor de `use-token-auth` indica al servicio que la señal de autenticación para la pasarela o el dispositivo se utiliza como la contraseña para la conexión de MQTT.

Para obtener más información, consulte [Conectividad de MQTT para dispositivos](../../devices/mqtt.html)

#### Contraseñas
Si el cliente está utilizando la autenticación basada en señales, envíe la señal de autenticación de dispositivo como la contraseña para todas las conexiones de MQTT.


text:
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Learning to Generate Samples from Noise Through Infusion Training</title>
    <link href="https://fonts.googleapis.com/css?family=Droid+Sans+Mono" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Noto+Sans" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
    <link href="/public/css/bootstrap.min.css" rel="stylesheet">
    <link href="/public/css/github.css" rel="stylesheet">

            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-data" aria-expanded="false">
                Toggle navigation

            </button>
            Jiaming Song

                    Articles

                    Curriculum Vitae

Learning to Generate Samples from Noise Through Infusion Training

Reproducing an experiment from the ICLR 2017 submission by Bordes et al. from MILA.

How to run

Currently, only the MNIST experiments are available.

> python infusion.py

would give you the following generation after 30 epochs of training.

It is nice to see that all the numbers are generated, but it is not known whether it has the same "mode avoiding" problem as GAN.

Observations

The training is robust (in that not much tuning is required) but not very stable. Occasionally the loss will rise suddenly, and the model will generate artifacts. The cause of the problem is yet unknown.

Also, the generator tends to generate 8 that look like 1.

Problems

Since the std is small during training, can we train a model without the std at all?

The determinstic version of the model tries to answer the problem.

Please enable JavaScript to view the comments powered by Disqus.

            © 2017 •
            tsong.me •
            tsong@cs.stanford.edu


text:
"use strict";

var cluster = require('cluster');
var Player = require('../model/player');

// Message schema
var schema = {
    message: String,
    username: String,
    password: String
  }

module.exports = function (message, callback) {

  //console.log("worker%s executing %s event",
  //            cluster.worker.id, message.message);

  if(check()) {
    executeEvent(message, callback);
  }
  else {
    console.log("ev %s failed", this);
  }

  function check() {
    Object.keys(schema).forEach(function(item) {
      if(undefined === message[schema[item]]) {
        return false;
      }
    });
    return true;
  }

  // Write your event code here
  function executeEvent(message, callback) {
    //console.log("ev '%s' running...", message.message);
    Player.findOne({ "username" : message.username}, function(err, player) {
      var resp = false;

      if(!err && player) {
        resp = player.isValidPassword(message.password);
        if(resp) {
          //console.log("password match");
        }
        else {
          console.log("password did not match");
        }
      }
      else {
        console.log("Players.findOne failed:", err);
      }
      message.response = resp;
      message.reason = err;
      callback(message);
    });
  }
};


text:
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Implement extra functionality not in big.Int

package big

/*
#cgo LDFLAGS: -lgmp
#include <gmp.h>
#include <stdlib.h>
*/
import "C"

// Sqrt sets x to the truncated integer part of the square root of x
//
// NB This is not part of big.Int
func (z *Int) Sqrt(x *Int) *Int {
	z.doinit()
	C.mpz_sqrt(&z.i[0], &x.i[0])
	return z
}