How can I implement a character echo on the telnet window?

I want to display a character on the telnet window every time the character is input.(character echo).

The following telnet_recv() function display a string(full character) when the enter key is pressed after characters input.

static err_t telnet_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
{
  struct pbuf *q;
  struct name *name = (struct name *)arg;
  int done;
  char *c;
  int i;

  /* We perform here any necessary processing on the pbuf */
  if (p != NULL) 
  {        
  /* We call this function to tell the LwIp that we have processed the data */
  /* This lets the stack advertise a larger window, so more data can be received*/
  tcp_recved(pcb, p->tot_len);

    /* Check the name if NULL, no data passed, return withh illegal argument error */
  if(!name) 
    {
      pbuf_free(p);
      return ERR_ARG;
    }

    done = 0;
    for(q=p; q != NULL; q = q->next) 
    {
      c = q->payload;
      for(i=0; i<q->len && !done; i++) 
      {
        done = ((c(i) == 'r') || (c(i) == 'n'));
        if(name->length < MAX_NAME_SIZE) 
        {
          name->bytes(name->length++) = c(i);
        }
      }
    }
    if(done) 
    {
      if(name->bytes(name->length-2) != 'r' || name->bytes(name->length-1) != 'n') 
      {
        if((name->bytes(name->length-1) == 'r' || name->bytes(name->length-1) == 'n') && (name->length+1 <= MAX_NAME_SIZE)) 
        {
        name->length += 1;
        } 
        else if(name->length+2 <= MAX_NAME_SIZE) 
        {
          name->length += 2;
        } 
        else 
        {
          name->length = MAX_NAME_SIZE;
        }

        name->bytes(name->length-2) = 'r';
        name->bytes(name->length-1) = 'n';
      }

      tcp_write(pcb, name->bytes, name->length, TCP_WRITE_FLAG_COPY);

      name->length = 0;
    }

  /* End of processing, we free the pbuf */
    pbuf_free(p);
  }  
  else if (err == ERR_OK) 
  {
    /* When the pbuf is NULL and the err is ERR_OK, the remote end is closing the connection. */
    /* We free the allocated memory and we close the connection */
    mem_free(name);
    return tcp_close(pcb);
  }

  return ERR_OK;
}

How can I implement this character transfer?

Thanks.

dnd 5e – How do I use this Ammo/Potion/Torch Field on one of the official alternate character sheets?

Exactly how to use any one piece of a character sheet isn’t prescribed by the rules. Different players and different characters will prefer and require different information noted, tracked and structured. There’s multiple official version to accommodate this, you’ll find countless different online, and some of us make custom sheets to fit our specific needs.

That said, specific elements are useful for specific types of counting. Textboxes are good at tracking text or big numbers and chains of circles good at counting (low numbers). So, for instance you could put your total number of arrows in the textbox by the arrows and as you spend arrows (by firing them presumably) you tick of circles. In a similar fashion you might note down a type of (healing) potion in one of the potion boxes and use the associated chain of marks to note how many you have, and erase the marks (or use an override mark) when it is used.

The key for using any part of a character sheet (or any character sheet) is to find what works best for you, so that you don’t have to spend time searching or interpreting your character sheet and can spend more time actually playing. Try things out, do what feels natural, and don’t be afraid to change things if they don’t work. And don’t worry about others being able to read it, they wont need to read it often and its hard to make it guessable (unless you actually try for that, for some reason.


†: Personally I’m fond of using one line to mark something and using a second, crossing line to un-mark it. Saves using a rubber to turn the sheet crumpled and grey Use what works best for you.

programming languages – How to prove that replacing a character in a string in both C and JavaScript is equivalent?

I would like to try some different proofs, specifically in proving equivalence of the implementation of some feature in two different programming languages (C and JS in this question).

This is about proving that replacing one character in a string is equivalent in C and JS.

In JS, for example, strings are immutable, while in C, strings are mutable. So in JS you might have to do this:

functioni replaceAt(string, index, replacement) {
  return string.substr(0, index) + replacement + string.substr(index + replacement.length)
}

While in C you might just do something like this:

#include<stdio.h>

int
main() {
  char string(11) = "hello world";
  string(1) = 'i';
  printf("%s", string);
  return 0;
}

Basically, I am trying to come up with an example where, the perceived effect or desired outcome is for all intents and purposes the same. That is, the end result is that the character was replaced at a specific position (the same position in each language). Even though in one language the string was mutable, while in the other, it was immutable. What needs to be taken into account here to make a proof saying these are equivalent? How do we capture the notion of “partial equivalence” or “perceived equivalence”? (By that I mean, the outcome is roughly the same, so we want to make a proof statement that these are the same with regard to some spec).

like – Mysql, Getting all rows in which field ends in a specific character, and another field exists that is the same but doesn’t end in that character

I need to get all rows which end in a specific character, P for example, but in which a similar key sans the P exists. I have no idea how to approach this one in MySQL.

This is very small example, my actual data is huge with other columns also.

+------------+
|    key     |
+------------+
| value_100  |
| value_100P |
| value_101  |
| value_101  |
| value_102  |
| value_102P |
| value_103P |
| value_104P |
+------------+

The query would output,

+------------+
|    key     |
+------------+
| value_100P |
| value_102P |
+------------+

c# – Unity 2D: Dealing damage when character is crushed between two solid objects

Whats the best approach to dealing damage to a player when they get stuck between two solid objects? For instance, I’m trying to make moving platforms that the player can ordinarily touch. It’s only when the player is caught in-between the moving platform and the ceiling, for example, that damage is dealt or the player dies.

So, what would be the best way to approach this? Thanks in advance!

dnd 3.5e – When creating a character above 1st level, can you give them the effects of spellcasting services?

Page 199 of the DMG explains how new characters can start with magic items, even those they choose to make themselves (with the assumption these items were created some time before the character became a PC)

But let’s say a non-spellcaster wants to give themselves an extra point to an ability score. If they have 27,500 gp, they could start with a Manual of Quickness of Action and either use it immediately or possibly say they’ve used it already and begin with an inherent +1 bonus to Dexterity.

That book costs 27,500 gp. Using the formula on page 129 of the PHB, however, it would only cost 26,530 gp to have a 17th-level wizard cast wish on them as a service. For an 8th-level character (or a higher-level character with lots of other gear), that’s the difference between getting the bonus, and not.

Can the character simply decide to begin with this effect present (or a different spell with a permanent duration, like enlarge person+permanency, since 9th-level wizards are easy to find in large cities) and 26,530 gp less, or since the DMG only describes starting with magic items, must they spend 27,500 gp for the magic item?

Is there any better way to stun a character in Roblox?

In Elemental Battlegrounds, punches stun the character, nicely and smoothly. My best way to stun players is this trash:

HitChar:SetPrimaryPartCFrame(CFrame.new(HitChar.PrimaryPart.Position)*CFrame.Angles(math.pi/2, Orientation.Y, Orientation.Z))

Is there any better way? I want it to look natural, and not look like teleporting to a sideways position.

sql server – conversion failed when converting date and/or time from character string c#

Action Method:

PayTns std = new PayTns();
std.C_Group = fc(“C_Group”);
std.Date = Convert.ToDateTime(fc(“Date”));
std.C_Name = fc(“C_Name”);
std.D_Group = fc(“D_Group”);
std.D_Name = fc(“D_Name”);
std.Amount = Convert.ToInt32(fc(“Amount”));
std.Remark = fc(“Remark”);
if (D_flag == “true”)
{
std.D_Flag = true;
}
else
{
std.D_Flag = false;
}
std.T_No = Convert.ToInt32(fc(“T_No”));
Dblayer.Add_Pay(std);
TempData(“msg”) = “Data Inserted”;
ModelState.Clear();

Data Connection:

SqlCommand com = new SqlCommand(“Master_PayTns_Add”, con);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue(“@Date”, ie.Date);
//com.Parameters.AddWithValue(“@A_GRef”, ie.A_GRef );
com.Parameters.AddWithValue(“@C_Group”, ie.C_Group);
com.Parameters.AddWithValue(“@C_Name”, ie.C_Name);
com.Parameters.AddWithValue(“@D_Group”, ie.D_Group);
com.Parameters.AddWithValue(“@D_Name”, ie.C_Name);
com.Parameters.AddWithValue(“@Amount”, ie.Amount);
com.Parameters.AddWithValue(“@Remarks”, ie.Remark);
com.Parameters.AddWithValue(“@D_FLag”, Convert.ToBoolean(ie.D_Flag));
com.Parameters.AddWithValue(“@T_No”, ie.T_No);

        con.Open();
        com.ExecuteNonQuery();
        con.Close();