2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2020

03/03/2003: How Do I Store Text in the Windows Clipboard Using JavaScript?

How Do I Store Text in the Windows Clipboard Using JavaScript?

Click on the first line of text in order to see that text pasted into the third line of text:

<HEAD>
<SCRIPT>
function IsWhitespace(ch) {
  return(
    ch == ' ' || ch == '\n' || ch == '\r' ||
    ch == '\t' || ch == '\f' || ch == '\v' || ch == '\b'
  );
}

// SaveToClibboard
function S2CB() {
  maxLen = 80;
  numLines = event.srcElement.innerText.length / maxLen;
  newStr = '';
  startPos = 0;
  for (x = 0; x < numLines; x++) {
    endPos = startPos + maxLen;
    while (! IsWhitespace(event.srcElement.innerText.charAt(endPos)))
      endPos--;
    newStr = newStr + event.srcElement.innerText.substring(startPos, endPos) + '\n';
    startPos = endPos + 1;
  }
  newStr = newStr + event.srcElement.innerText.substring(
    startPos, event.srcElement.innerText.length
  ) + '\n';
  window.clipboardData.setData('Text', newStr);
  oSource2.innerText = window.clipboardData.getData('Text');
}
</SCRIPT>
</HEAD>
<BODY>
<B ID="oSource" onClick="S2CB()">@changes 2000-Nov-01
  DMM DMM00013 Silentsurf(nph-index.cgi,Interface.pm):
  Initial hits to the server are immediately routed to the startup
  form which eliminates a lot of module loading in the
  Silentsurf package./</B><br>
<B ID="oSource1" onClick="S2CB()">222</B><br>
<pre>!!<B ID="oSource2" onClick="S2CB()">333</B>!!</pre><br>
</BODY>
</HTML>

03/03/2003: How do I Reset the Root password of MySQL Using Linux?

How do I Reset the Root password of MySQL Using Linux?

  1. /usr/local/mysql/bin/safe_mysqld --skip-grant-tables &
  2. /usr/local/mysql
  3. use mysql;
  4. update user set password = password('.......') where user = 'root' and host='localhost';
  5. Stop and Start the MySQL server. [2003Oct03 Note] A reader mentioned that it is easier to 'flush privileges' instead of restarting the server.