Difference between revisions of "User:Niaht Nakamichi"

From Second Life Wiki
Jump to navigation Jump to search
Line 140: Line 140:
   print("<LABEL for=\"" . $message_field . "\">Message: </LABEL>\n"
   print("<LABEL for=\"" . $message_field . "\">Message: </LABEL>\n"
         . "      <textarea id = \"" . $message_field . "\" name=\"" . $message_field . "\"></textarea><BR>\n");
         . "      <textarea id = \"" . $message_field . "\" name=\"" . $message_field . "\"></textarea><BR>\n");
  print("<INPUT type=\"submit\" id=\"submit\" name=\"submit\" value =\"Submit\">\n");
  print("<INPUT type=\"reset\">");
   print ("</FORM>\n");
   print ("</FORM>\n");
 
}
}
</php>
</php>

Revision as of 16:25, 7 June 2008

About Me

I am a generalist. I was once a systems engineer and the head of an IT department.

Boredom comes easily to me.

Every now and again I build a website for someone; I do not have my own.

I like SecondLife.

XXTEA Cipher

This is something I decided to do for no good reason. It probably isn't optimal, and it probably needs work, but it works. At some point it might want to be integrated into the XTEA page, or get its own page. Feel free to comment on my Talk Page

Code references used:


Note: I can not take any real credit for this work. I just made the pre-existing code function in LSL.

<lsl>

 // Code coming later...

</lsl>

Data type Tests

Here are some quick and dirty data type tests.. so far they work for me. They have not been optimized.

isKey

Testing for valid keys is made very simple. Invalid key values won't be positively compared to the null key static NULL_KEY, where with other data types invalid values will be converted to the zero value static for that data type (or zero) and thusly will compare positively to their corresponding zero value.

To test if a given key is a valid (and non-null), the code 'if ((key)stringvar)' is sufficient.

As Strife Onizuka pointed out you can use the following code to determine if a key is valid and also take into consideration if the key is a NULL_KEY, making for a more proper isKey test. <lsl> integer isKey(key k) {

   if (k) return 2;
   return (k == NULL_KEY);

} </lsl> This works as expected for standard if(isKey("key")) tests since 'if' evaluates any integer greater than zero to TRUE. The rest of the tests below could easily be modified to behave the same way if desired, or the above isKey could be modified to simply return 1 for all valid cases.

isInteger

<lsl> integer isInteger(string s) {

   if (s != "") {
       integer i;
       integer l = llStringLength(s);
       do {
           if(! ~llListFindList(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], (list)llGetSubString(s, i, i))) return FALSE;
           ++i;
       } while (i < l);
     return TRUE;
   }
   return FALSE;

} </lsl>

isFloat

<lsl> integer isFloat(string s) {

   if (s != "") {
       integer i; integer d; string c;
       integer l = llStringLength(s);
       do {
           c = llGetSubString(s, i, i);
           if (! ~llListFindList([".", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], (list)c)) return FALSE;
           if (c == ".") ++d;
           if (d > 1) return FALSE;
           ++i;
       } while (i < l);
       return TRUE;
   }
   return FALSE;

} </lsl>

isVector

Note: Uses 'isFloat' above . . . <lsl> integer isVector(string s) {

   list f;
   integer i = 0;
   if ((rotation)s) return FALSE; // don't accept rotations
   if ((vector)s) return TRUE;    // accept any positive valid
   // Everything past here is mostly for testing for a proper ZERO vector, so possibly excessive.
   if (llSubStringIndex(s, "<") == 0)
       if (llSubStringIndex(s, ">") == (llStringLength(s) - 1))
           if (llGetListLength(f = llParseString2List(s, ["<",">", " "], [","])) == 5)
               if (isFloat(llList2String(f, 0)))
                   if (llList2String(f, 1) == ",")
                       if (isFloat(llList2String(f, 0)))
                           if (llList2String(f, 3) == ",")
                               if (isFloat(llList2String(f, 4))) return TRUE;
   return FALSE;

} </lsl>

Simple PHP Code

<php> <?php /**

Simple PHP Form Mailer
Written by Niaht Nakamichi (2008)

/*

* Form field names (fill these in to match your html form)
  • /

$message_field = 'message';

// Leave this blank if no subject is provided in the form. $subject_field = ;

if ($_POST['message']) {

   /*
    * Message Configuration
   */
   $to       = 'nobody@example.com';           // Were to send the message too.
   $from     = 'webmaster@example.com';        // Who the message is from.
   $reply_to = 'nobody@example.com';           // Who to reply to.
   $subject  = 'the subject';                  // The default Subject (if none is provided in the form).
   
   if ($subject_field !=  && $_POST['subject']) $subject = strip_tags($_POST['subject']);
   $headers = 'From: ' . $from . "\r\n" .
       'Reply-To: ' . $reply_to . "\r\n" .
       'X-Mailer: PHP/' . phpversion();
       
   $message = strip_tags($_POST['message']);
   mail($to, $subject, $message, $headers);
   print("Thank you for your message.");

} else {

 print("<form id=\"mailer\" method=\"post\">\n");
 if ($subject_field != )
   print("<LABEL for=\"" . $subject_field . "\">Subject: </LABEL>\n"
       . "      <INPUT type=\"text\" id=\"" . $subject_field . "\" name=\"" . $subject_field . "\">
\n"); print("<LABEL for=\"" . $message_field . "\">Message: </LABEL>\n" . " <textarea id = \"" . $message_field . "\" name=\"" . $message_field . "\"></textarea>
\n"); print("<INPUT type=\"submit\" id=\"submit\" name=\"submit\" value =\"Submit\">\n"); print("<INPUT type=\"reset\">"); print ("</FORM>\n");

} </php>

Client Library Changes

These are the changes to the SL client libraries since 1.13.1.12. I don't expect this to be perfect, nor presented in the best possible way. This is mostly intended for me so that I don't loose this data. If this helps you in some way, and you have suggestions on how to make it better, please feel free to do so on my Talk Page

The emerging patterns are already becoming clear, and I can see that I will be able to reduce the changes down to named library changes instead of listing any files.

From To Changes
1.13.2.13 1.13.2.15 None
1.13.2.15 1.13.3.2 None
1.13.3.2 1.14.0.0

Files Removed

  • indra/newview/app-settings/static_data.db2
  • indra/newview/app-settings/static_index.db2

Files Changed

  • indra/newview/app_settings/mozilla/ (many)
  • LibOpenJPEG.lib
  • js3250.dll
  • libcurl.lib
  • llkdu.dll (Release Only)
  • llmozlib.lib
  • nspr4.dll
  • plc4.dll
  • plds4.dll
  • xul.dll
  • curl.h
  • curlver.h
  • mprintf.h
  • multi.h
  • openjpeg.h

New Files

  • libboost_regex-vc80-mt-s.lib
  • llmozlib-vc80.lib
  • libboost_python-vc80-m5.lib (Release only)
1.14.0.0 1.14.0.1 None
1.14.0.1 1.15.0.2

Files Changed

  • curl.h
  • curlver.h
  • mprintf.h
  • multi.h
  • tut.h

New Files

  • indra/newview/fonts
1.15.0.2 1.15.1.3

Files Changed

  • libraries/include/boost (Many)
  • curl.h
  • curlver.h
  • mprintf.h
  • multi.h
1.15.1.3 1.16.0.5

Files Changed

  • llmozlib-vc80.lib
  • libraries/include/boost (Many)
  • curl.h
  • curlver.h
  • mprintf.h
  • multi.h
1.16.0.5 1.17.0.12

Files Changed

  • indra/newview/app_settings/mozilla (Many)
  • js3250.dll
  • llmozlib-vc80.lib (Release Only)
  • llmozlib.lib
  • nspr4.dll
  • plc4.dll
  • plds4.dll
  • xul.dll

Files Removed

  • indra/newview/app_settings/mozilla/components (Many [.xpt files])

New Files

  • indra/newview/app_settings/mozilla/components/all.xpt
1.17.0.12 1.17.1.0

Files Changed

  • indra/newview/app_settings/mozilla (Many)
  • js3250.dll
  • libcurl.lib
  • llmozlib.lib
  • nspr4.dll
  • plc4.dll
  • plds4.dll
  • xul.dll
  • libraries/include/boost (Many)
  • curl.h
  • curlver.h
  • mprintf.h
  • multi.h

New Files

  • png12.lib
1.17.1.0 1.17.2.0 None
1.17.2.0 1.17.3.0 None
1.17.3.0 1.18.0.6

Files Changed

  • libraries/include/boost (Many)
  • curl.h
  • curlver.h
  • mprintf.h
  • multi.h
  • tut.h
1.18.0.6 1.18.1.2
1.18.1.2 1.18.2.0
1.18.2.0 1.18.2.1
1.18.2.1 RC-1.18.3.2
RC-1.18.3.2 RC-1.18.3.3
RC-1.18.3.3 RC-1.18.3.4 None
RC-1.18.3.4 RC-1.18.3.5
RC-1.18.3.5 RC-1.18.4.0
RC-1.18.4.0 RC-1.18.4.1 None
RC-1.18.4.1 RC-1.18.4.2 None
RC-1.18.4.2 1.18.4.3 None
1.18.4.3 RC-1.18.5.0
RC-1.18.5.0 RC-1.18.5.1
RC-1.18.5.1 RC-1.18.5.2
RC-1.18.5.2 1.18.5.3 None
RC-1.18.5.3 RC-1.18.6.0
RC-1.18.6.0 RC-1.18.6.1
RC-1.18.6.1 RC-1.18.6.2
RC-1.18.6.2 RC-1.18.6.4 None
RC-1.18.6.4 Branch_1-19.0-Viewer-r79209
Branch_1-19.0-Viewer-r79209 Branch-1-19.0-Viewer-r79825 None
Branch-1-19.0-Viewer-r79825 Branch-1-19.0-Viewer-r80554 None
Branch-1-19.0-Viewer-r80554 Branch-1-19.0-Viewer-r80803 None
Branch-1-19.0-Viewer-r80803 Branch-1-19.0-Viewer-r81066 None
Branch-1-19.0-Viewer-r81066 Branch-1-19.1-Viewer-r81993