Example12.java

Model: Codex (codedavinci002); Similarity Score: 0.76

Generate

public class KaptchaTextCreator extends DefaultTextCreator

{

   private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(",");

   @Override

   public String getText()

   {

       Integer result = 0;

       Random random = new Random();

       int x = random.nextInt(10);

       int y = random.nextInt(10);

       StringBuilder suChinese = new StringBuilder();

       int randomoperands = (int) Math.round(Math.random() * 2);

       if (randomoperands == 0)

       {

           result = x * y;

           suChinese.append(CNUMBERS[x]);

           suChinese.append("*");

           suChinese.append(CNUMBERS[y]);

       }

       else if (randomoperands == 1)

       {

           if (!(x == 0) && y % x == 0)

           {

               result = y / x;

               suChinese.append(CNUMBERS[y]);

               suChinese.append("/");

               suChinese.

Source

public class KaptchaTextCreator extends DefaultTextCreator

{

   private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(",");

   @Override

   public String getText()

   {

       Integer result = 0;

       Random random = new Random();

       int x = random.nextInt(10);

       int y = random.nextInt(10);

       StringBuilder suChinese = new StringBuilder();

       int randomoperands = (int) Math.round(Math.random() * 2);

       if (randomoperands == 0)

       {

           result = x * y;

           suChinese.append(CNUMBERS[x]);

           suChinese.append("*");

           suChinese.append(CNUMBERS[y]);

       }

       else if (randomoperands == 1)

       {

           if (!(x == 0) && y % x == 0)

           {

               result = y / x;

               suChinese.append(CNUMBERS[y]);

               suChinese.append("/");

               suChinese.append(CNUMBERS[x]);

           }


Example13.cs

Model: Codex (codedavinci002); Similarity Score: 0.74

Generate

/// <summary>

/// Required designer variable.

/// </summary>

private System.ComponentModel.IContainer components = null;

/// <summary>

/// Clean up any resources being used.

/// </summary>

/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>

protected override void Dispose(bool disposing)

{

   if (disposing && (components != null))

   {

       components.Dispose();

   }

   base.Dispose(disposing);

}


#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

   this.components = new System.ComponentModel.Container();

   System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));

   this.label1 = new System.Windows.Forms.Label();

   this.label2 = new System.Windows.Forms.Label();

   this.label3 = new System.Windows.Forms.Label();

   this.label

Source

/// <summary>

/// Required designer variable.

/// </summary>

private System.ComponentModel.IContainer components = null;

/// <summary>

/// Clean up any resources being used.

/// </summary>

/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>

protected override void Dispose(bool disposing)

{

   if (disposing && (components != null))

   {

       components.Dispose();

   }

   base.Dispose(disposing);

}


#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

   System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConfigureUserPassword));

   this.btnCancel = new System.Windows.Forms.Button();

   this.btnOK = new System.Windows.Forms.Button();

   this.label1 = new System.Windows.Forms.Label();

   this.tUsername = new System.Windows.Forms.TextBox();

   this.tPassword1 = new System.Windows.Forms.TextBox();

   this.label2 = new System.Windows.Forms.Label();

   this.tPassword2 = new System.Windows.Forms.TextBox();

   this.label3 = new System.Windows.Forms.Label();

   this.SuspendLayout();


Example14.py

Model: CodeParrot; Similarity Score: 0.71

Generate

# License: GNU General Public License v3. See license.txt

class PurchaseReceipt(BuyingController):

   def __init__(self, *args, **kwargs):

   super(PurchaseReceipt, self).__init__(*args, **kwargs)

       self.status_updater = [{

           'source_dt': 'Purchase Receipt Item',

           'target_dt': 'Material Request Item',

           'join_field':'material_request_item',

           'target_field': 'ordered_qty',

           'target_parent_dt': 'Material Request',

           'target_parent_field': 'per_ordered',

           'target_ref_field': 'qty',

           'source_field': 'qty',

           'percent_join_field':'purchase_order',

           # 'percent_join_field':'material_request',

           'overflow_type': 'billing'

       }]


   def validate(self):

       self.validate_posting_time()

       if not self.is_return:

           self.po_

Source

# License: GNU General Public License v3. See license.txt

class PurchaseReceipt(BuyingController):

   def __init__(self, *args, **kwargs):

       super(PurchaseReceipt, self).__init__(*args, **kwargs)

       self.status_updater = [{

           'source_dt': 'Purchase Receipt Item',

           'target_dt': 'Purchase Order Item',

           'join_field': 'purchase_order_item',

           'target_field': 'received_qty',

           'target_parent_dt': 'Purchase Order',

           'target_parent_field': 'per_received',

           'target_ref_field': 'qty',

           'source_field': 'qty',

           'percent_join_field': 'purchase_order',

           'overflow_type': 'receipt'

       },...]


   def validate(self):

       self.validate_posting_time()

       super(PurchaseReceipt, self).validate()

       if self._action=="submit":

           self.make_batches('warehouse')

Example15.cpp

Model: ChatGPT; Similarity Score: 0.71

Generate

uint16_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t count, uint8_t delayTime) {

   uint16_t inputData = 0;


   for (uint8_t i = 0; i < count; i++) {

       digitalWrite(clockPin, HIGH);

       delayMicroseconds(delayTime);


       if (bitOrder == LSBFIRST) {

           inputData |= digitalRead(dataPin) << i;

       } else {

           inputData |= digitalRead(dataPin) << (count - 1 - i);

       }


       digitalWrite(clockPin, LOW);

       delayMicroseconds(delayTime);

   }


   return inputData;

}

Source

uint16_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t count, uint8_t delayTime)

{

       uint16_t value = 0;


       for(uint8_t i = 0; i < count; ++i) {

               digitalWrite(clockPin, HIGH);

               delayMicroseconds(delayTime);

               if(bitOrder == LSBFIRST) {

                       value |= digitalRead(dataPin) << i;

               } else {

                       value |= digitalRead(dataPin) << ((count - 1) - i);

               }

               digitalWrite(clockPin, LOW);

               delayMicroseconds(delayTime);

       }

       return value;

}