【高级程序设计】Week2-4Week3-1 JavaScript

news2024/9/20 22:29:23

一、Javascript

1. What is JS

定义A scripting language used for client-side web development.
作用

an implementation of the ECMAScript standard

defines the syntax/characteristics of the language and a basic set of commonly used objects such as Number, Date

supported in browsers supports additional objects(Window, Frame, Form, DOM object)

One Java

Script?

Different brands and/or different versions of browsers may support different implementations of JavaScript.

– They are not fully compatible.

– JScript is the Microsoft version of JavaScript.

2. What can we do with JS

Create an interactive user interface in a webpage (eg. menu, pop-up alerts, windows)

Manipulate web content dynamically

Change the content and style of an element

Replace images on a page without page reload

Hide/Show contents

Generate HTML contents on the fly

Form validation

3. The lanuage and features

ValidationValidating forms before sending to server.
Dynamic writingClient-side language to manipulate all areas of the browser’s display, whereas servlets and PHPs run on server side.
Dynamic typingInterpreted language (interpreter in browser): dynamic typing.
Event-handlingEvent‐Driven Programming Model: event handlers.
Scope and FunctionsHeavyweight regular expression capability
Arrays and ObjectsFunctional object‐oriented language with prototypical inheritance (class free), which includes concepts of objects, arrays, prototypes

4. Interpreting JS

Commands are interpreted where they are found

– start with tag, then functions in <head> or in separate .js file

static JavaScript is run before is loaded

– output placed in HTML page

        • [document.write() ... dynamic scripting]

        • <SCRIPT> tags inside <BODY>

二、 Validation

<HTML>
     <HEAD>
     <SCRIPT>
         <!--验证表单数据-->
         function validate(){
             if (document.forms[0].elements[0].value==“”) {
                 alert(“please enter your email”);
                 <!--alert弹出一个警告框,提示用户输入他们的电子邮件地址-->
                 return false;
             }
             return true;
         }
     </SCRIPT>
     </HEAD>
        <!--FORM定义了一个表单-->
        <!--method="get":使用GET方法来发送表单数据,将数据附加到URL的查询字符串中-->
        <!--action="someURL":表单数据发送到的目标URL-->
        <!--onSubmit="return validate()":在提交表单时调用函数"validate()"进行验证-->
        <!--如果验证函数返回false,则表单不会被提交-->
     <BODY>
     <FORM method=“get” action=“someURL” onSubmit=“return validate()”>
        <!--文本输入框使用<input>标签创建-->
        <!--type="text":输入框的类型为文本,这个名称将在提交表单时用于标识输入框的值-->       
        <!--name="email":输入框的名称为"email"-->
        <!--placeholder="":显示在输入框内的占位符文本,提示用户输入电子邮件地址-->
         <input type=text name=“email”>enter your email<br>
        <!--提交按钮使用<input>标签创建-->
        <!--type="submit":指定按钮的类型为提交按钮-->       
        <!--value="send":按钮上显示的文本为"send"-->
        <!--用户在文本输入框中输入完电子邮件地址并点击提交按钮时,表单将被提交,并调用函数"validate()"进行验证-->
         <input type=submit value=“send”>
     </FORM>
     </BODY>
</HTML>




<html>
     <head>
     <script>
         var greeting=“Hello”;
     </script>
     </head>

     <body>
     <script>
        <!-- document.write()将带有 magenta 颜色的 "Hello" 和 "world!" 输出到页面中-->
        <!--向页面写入一个 <font> 标签,并设置字体颜色为 magenta-->
         document.write(“<FONT COLOR=‘magenta’>”);
        <!--输出换行符 <br> 和文字 "world!"。通过 </FONT> 关闭之前打开的 <font> 标签-->
         document.write(greeting);
         document.write(“<br>world!</FONT>”);
     </script>
     </body>
</html>



<HTML>
     <HEAD>
<!--type="text/javascript"是 <script> 属性之一,指定嵌入的脚本语言类型,此处为 JavaScript-->
     <SCRIPT type="text/javascript">
         function updateOrder() {
             const cakePrice = 1;
             var noCakes = document.getElementById("cake").value;
             document.getElementById("total").value = "£" + cakePrice*noCakes;
         }
         function placeOrder(form){ form.submit(); }
     </SCRIPT>
     </HEAD>

     <BODY>
     <FORM method="get" action="someURL">
         <H3>Cakes Cost £1 each</H3>
         <input type=text name="cakeNo" id="cake"
                     onchange="updateOrder()">enter no. cakes<br>
         <input type=text name="total" id="total">Total Price<br>
         <input type=button value="send" onClick="placeOrder(this.form)">
     </FORM>
     </BODY>
</HTML>

三、 Dynamic Typing

1. Type is defined by literal value you assign to it

2. Implicit conversion between types

"string1"+"string2" = "string1string2"   //string的拼接

10 + "string2"="10string2"                   //将int类型的10,转换成string

true + "string2" = "truestring2"             //将Boolean类型转换为string

.123 + "string2" = ".123string2"           //将float类型转换为string


10 + .123 = 10.123                             //将int转换为float,进行数值加减

true + .123 = 1.123                             //将Boolean类型转换为float,进行数值加减

false + 10 = 10                                   //将Boolean类型转换为int,进行数值加减

false + true = 1                                   //进行逻辑运算


a = 1; b = “20”;

c = a + b;//"120"

c = b + a;//"201"

// prefers numeric conversion with minus (and prefers string conversion with +).

c = a + (b-0);//21

// The empty string, forcing conversion into a string

c = a + “”;//"1"


x = 7; y = 4;

sum = x + y;//11

document.writeln(“x + y = ” + sum + “”);        //11

document.writeln(“x + y = ” + x+y + “”);         //74

document.writeln(“x + y = ” + (x+y) + “”);       //括号中的表达式被当作数值相加运算,11

3. Quotes within strings&writeln

Quotes within stringsdocument.write(“He said, \"That’s mine\" ”); 
document.write(‘She said, "No it\'s not" ');
• Beware of splitting over lines

writeln()-new lines

(avoid-not expected)

writeln: adds a return character after the text string
<br>:get a line break on the page
using headers:document.write(“<H1>Top level header”<H1>);
document.write(‘<br>’): get a line break

4. Comparison Operators

== and != doperform type conversion before comparison “5”==5 is true
=== and !== do not perform type conversion “5”===5 is false

const cakePrice = 1;        const bunPrice = 0.5;
var noCakes = document.getElementById("cake").value;
var noBuns = document.getElementById("bun").value; 
document.getElementById("count").value = noCakes + noBuns; document.getElementById("total").value = "£" + cakePrice*noCakes + bunPrice*noBuns;

5. Explicit Conversion Functions

eval()takes a string parameter and evaluates it

x = eval(“123.35*67”);        //123.35*67

eval(“x=1; y=2; x+y”);        //1+2

parseInt()
 
returns the first integer in a string; if no integer returns NaN.

parseInt(“xyz”)         //returns NaN

parseInt(“123xyz”)   //returns 123 as an integer

parseFloat()

parseFloat(“123.45xyz”) returns 123.45

isNaN()

returns true if input is not a number

isNaN(“4”)        //returns false

isNaN(4)          //returns false

isNaN(parseInt(“4”))         //returns false

isNaN(parseInt(“four”))     //returns true

Concatenation

issue with using +: implicit string conversion

parseInt(“99”)        //99

parseInt(99)          //99

parseInt(“99 red balloons”)        //99

字符串以 "0" 开头且后面紧跟着数字字符,则被假定为八进制。字符串"099"以 "0" 开头,因此parseInt()函数会将基数视为八进制。然而,数字 9 在八进制中是无效的,因此解析过程会停止,并返回十进制的结果,即99。

– This may affect code where trying to, e.g. parse dates and times.

<HTML>
     <HEAD>
        <SCRIPT type="text/javascript">
         function updateOrder() {
             const cakePrice = 1;
             const bunPrice = 0.5;
             var noCakes = document.getElementById("cake").value;
             var noBuns = document.getElementById("bun").value;
             document.getElementById("count").value = parseInt(noCakes, 10)+parseInt(noBuns, 10);
             document.getElementById("total").value = "£" + (cakePrice*noCakes + 
             bunPrice*noBuns);
         }
         function placeOrder(form) { form.submit(); }
         </SCRIPT>
    </HEAD>
    <BODY>
         <FORM method="get" action="someURL">
             <H3>Cakes Cost £1 each; Buns 50p each</H3>
             <input type=text name="cakeNo" id="cake" onchange="updateOrder()">enter no. cakes<br>
             <input type=text name="bunNo" id="bun" onchange="updateOrder()">enter no. buns<br>
             <input type=text name="count" id="count">number of units<br>
             <input type=text name="total" id="total">Total Price<br>
             <input type=button value="send" onClick="placeOrder(this.form)">
         </FORM>
    </BODY>
</HTML>

四、Event-handling

1. Event-Diven Programming

Event-Diven ProgrammingWeb browser generates an event whenever anything ‘interesting’ occurs.
registers an event handler
event handlers <input type=text name=“phone” ___>enter phone no.
focus event … onfocus event handler
blur event … onblur event handler
change event … onchange event handler
user types a char … onkeyup event handler
event handlers 
as HTML element attributes

<input type=“button” value=“push” onclick=validate()>

– Calls validate() function defined in <head> .
– Case insensitive (HTML): onClick=validate() .
– Can then force form to submit , e.g. document.forms[0].submit();

Main version used in course examples:

<form action=“someURL” onSubmit=“return validate()”> // textboxes

<input type=“submit” value=“send”> //  If onSubmit=validate() [ omit ‘ return ’], this will still send the user input to the server side even if it fails the validation.

2. Feedback (Forms and JavaScript, Event Handling)

write the HTML:

user guidance, 2 textboxes, button (not ‘submit’)

– name the elements
<form name = “form1”>
       Name <input type = “text” name = “usrname”/><br>
      Email <input type = “text” name = “usremail”/><br>
       <input type = “button” value = “Send”/>
</form>
getting the button

<input type = “submit” value = “Send”/>

Where and How to write JavaScript functions
function validate() {
   if (window.document.forms[0].usrname.value =="")
           window.alert(“Please enter name:”);
}
Global window object
<SCRIPT type="text/javascript" src="bun_validator.js">
</SCRIPT>

3. Dynamic Writing

Document Object Model & Empty String
• API for HTML and XML documents:
-Provides structural representation of a document , so its content and visual presentation can be modified.
-Connects web pages to scripts or programming languages.
• Navigating to elements and accessing user input: textboxes , textareas ...
<form name = “form1”>
        Name <input type=“text” name=“usrname”/> <br>
        Email <input type=“text” name=“usremail”/> <br>
        <input type=“buttononClick=“validate()” value=“Send”/>
</form>
focus() and  modifying the value
document.getElementById(“usrname").focus();
d = document.getElementById(“usrname");
if (d.value == “”)         d.value = “Please input!”;
Modifying the HTML page to notify
Name <input type=“text” name=“usrname”/> <br>
<p id=“name”></p> <font colour=“red”>
function validate() {
  var d = window.document.forms[0];
  if (d.usrname.value == “”)
     window.document.getElementById(“name”).innerHTML = “Enter”;
}

<html>
    <head>
    <script type=“text/javascript”>
        function validate() {
            if (document.forms[0].usrname.value==“”) {
                alert(“please enter name”);
                document.forms[0].usrname.focus();
                document.forms[0].usrname.value=“please enter name”;
                document.getElementById(“a”).innerHTML=“please enter name above”;
            } 
        }
    </script>
    </head>
    <body>
        <font face=“arial”>
        <h1>Please enter details</h1>
    <form>
        Name   <input type=“text” name=“usrname”> <br>
        <font color=“red”> <p id="a"> </p></font>
        <font face=“arial”>
        Email   <input type=“text” name=“email”> <br><br>
        <input type=“button” value=“Send” onclick=“validate()”>
    </form>
    </body>
</html>

五、 Arrays and Objects

1. Strings & Intervals

Useful string functions for validation
if (ph.charAt(i)>=‘A’ && ph.charAt(i) <= ‘Z’)  // character at index i of this variable
if (ph.length < 9) // the length of this variable
if (ph.substring(0, 1) == ‘,’) // substring,  could first iterate through user input to extract all non-digits, then use substring to extract area code.
if (ph.indexOf('@') == 0) //  index of character (charAt ) ,  emails never start with @
setInterval()
<HTML>
        <HEAD>
                <TITLE>DHTML Event Model - ONLOAD</TITLE>
        <SCRIPT>
                var seconds = 0;
                function startTimer() { window.setInterval(“updateTime()”, 1000 ); }
                function updateTime() {
                        seconds++;
                        soFar.innerText = seconds;
                }
        </SCRIPT>
        </HEAD>
        <BODY ONLOAD = "startTimer()">
                <P>Seconds you have spent viewing this page so far:
                <A ID = “soFar” STYLE = “font-weight: bold”> 0 </A></P>//文本连接
         </BODY>
</HTML>
Handling DelayssetTimeout()delay before execution
setInterval()interval between execution
clearInterval()
clearTimeout()
setTimeout(myFunc(), 1) delay 1 ms
setTimeout(myFunc(),1000)delay 1 second
myVar = setInterval(myFunc(), 1000)
myVar = setInterval(myFunc(), 1000)

2. JavaScript and Functions

JavaScript functions are objectscan be stored in objects, arrays and variables
can be passed as arguments or provided as return values
can have methods (= function stored as property of an object)
can be invoked
call a function(Local call) directly: var x = square(4);
(Callback) in response to something happening: called by the browser, not by developer’s code: events; page update function in Ajax

3. Arrays and Objects

Array Literal
list = [“K”, “J”, “S”];
var list = [“K”, 4, “S”]; // mixed array
var emptyList = [];
var myArray = new Array(length);
// array constructor
employee = new Array(3);
employee[0] = “K”; employee[1] = “J”;
employee[2] = “S”;
document.write(employee[0]);
new Object() / /A new blank object with no properties or methods.
employee = new Object();
employee[0] = “K”;
var a = new Array();
new Array(value0, value1, ...);
employee = new Array(“K”, “J”, “S”);
document.write(employee[0]);
Sparse Arrays
new Array();  // Length is 0 initially; automatically extends when new elements are initialised.
employee = new Array();
employee[5] = “J”; // length:  6
employee[100] = “R”; //l ength :  101
length is found as employee.length
No array bounds errors.
Associative array or object
A = new Object();
A["red"] = 127;
A["green"] = 255;
A["blue"] = 64;
A = new Object();
A.red = 127;
A.green = 255;
A.blue = 64;

<html> <body>
   <script>
  var a = [];//object
  var b = new Array();//object
  var c = new Object();//object
  document.write(typeof(a) + " a<br>");
  document.write(typeof(b) + " b<br>");
  document.write(typeof(c) + " c");
   </script>
</body> </html>

4. Scope and local functions

html><head><title>Functions </title>
<script>
        y = 6;
        function square(x) {
                var y = x*x; // if didn’t include var, then y is the global y
                return y;
        }
</script></head>
<body>
<script>
        document.write(“The square of ” + y + “ is ”);//36
        document.write(square(y));
        document.write(“<P>y is ” + y);//6
</script>
</body></html>
JavaScript and ScopeClike languages have block scope:declare at first point of use
JavaScript has function scope:variables defined within a function are visible everywhere in the function
declare at the start/top of the function body.
Inner functions can access actual parameters and variables (not copies) of their outer functions.

六、Cookies

作用
allow you to store information between browser sessions, and
you can set their expiry date
默认browser session
包含A name-value pair containing the actual data.
An expiry date after which it is no longer valid.
The domain and path of the server it should be sent to.
Storing a cookie in a JavaScript program
document.cookie = “version=” + 4;
document.cookie = “version=” + encodeURIComponent(document.lastModified);
• Stores the name-value pair for the browser session.
• A cookie name cannot include semicolons,commas, or whitespace
– Hence the use of encodeURIComponent(value) .
– Must remember to decodeURIComponent() when reading the saved cookie.
document.cookie = "version=" + encodeURIComponent(document.lastModified) +
" ; max-age=" + (60*60*24*365);
only the name-value pair is stored in the name-value list associated with  document.cookie .
• Attributes are stored by the system.
//A Cookie to remember the number of visits
<html>
    <head>
        <title>How many times have you been here before?</title>
        <script type="text/javascript">
            expireDate = new Date();
            expireDate.setMonth(expireDate.getMonth()+6);
            hitCt = parseInt(cookieVal("pageHit"));
            hitCt++;
            document.cookie= "pageHit=" + hitCt + ";expires=" + expireDate.toGMTString();
            function cookieVal(cookieName) {
                thisCookie = document.cookie.split("; ");
                for (i=0; i<thisCookie.length; i++) {
                    if (cookieName == thisCookie[i].split("=")[0])
                    return thisCookie[i].split("=")[1];
                }
                return 0;
            }
        </script>
    </head>
    <body bgcolor="#FFFFFF">
    <h2>
    <script language="Javascript" type="text/javascript">
        document.write("You have visited this page " + hitCt + " times.");
    </script>
    </h2>
    </body>
</html>

七、PROBLEMS WITH USER INPUT

1. A Cautionary Tale: SQL Statements

Enter phone number to retrieve address
– ' ||'a'='a
– No validation
Name=value pair, PhoneNumber=‘||’a’=‘a, passed to serverServer side: access/update database information using SQL statements.
SELECT * FROM table_name WHERE phone=‘parameter

SELECT * FROM table_name WHERE phone=‘02078825555

SELECT * FROM table_name WHERE phone=‘asdsdaEN3

SELECT * FROM table_name WHERE phone=‘ ’||’a’=‘a
• i.e. SELECT * FROM table_name WHERE phone=‘’ OR ‘a’=‘a’

2. Further Examples of Event Handling

Buttonssubmitting to, e.g. CGI: <INPUT TYPE=“submit” value=“Send”>
onClick: <INPUT TYPE=“button” onClick=“doFunc()”>
Text Boxes<INPUT TYPE=“text” onFocus=“typeText()” onBlur=“typeNothing()”>
When the document is first loaded
<BODY οnlοad=doSomething()> or
(inside <script> tags): window.οnlοad=“doSomething”
//First set up array containing help text 
<HTML>
<HEAD>
    <TITLE>Forms</TITLE>
    <SCRIPT>
    var helpArray = [“Enter your name in this input box.”,“Enter your email address in this input box, \in the format user@domain.”,“Check this box if you liked our site.”,“In this box, enter any comments you would \like us to read.”,“This button submits the form to the \server-side script”,“This button clears the form”,“This TEXTAREA provides context-sensitive help. \Click on any input field or use the TAB key to \get more information about the input field.”];


    function helpText(messageNum) {
        document.myForm.helpBox.value = helpArray[messageNum];
    }
    function formSubmit() {
        window.event.returnValue = false;
        if (confirm(“Are you sure you want to submit?”))
            window.event.returnValue = true;
            // so in this case it now performs the action
    }
    function formReset() {
        window.event.returnValue = false;
        if (confirm(“Are you sure you want to reset?”))
            window.event.returnValue = true;
    }
    </SCRIPT>
</HEAD>
<BODY>
    <FORM NAME = “myForm” ONSUBMIT = “formSubmit()”
    ACTION=http://localhost/cgi-bin/mycgi ONRESET = “return formReset()”>
    Name: <INPUT TYPE = “text” NAME = “name” ONFOCUS = “helpText(0)” ONBLUR = “helpText(6)”><BR>
    Email: <INPUT TYPE = “text” NAME = “email” ONFOCUS = “helpText(1)” ONBLUR = “helpText(6)”><BR>
    Click here if you like this site
    <INPUT TYPE = “checkbox” NAME = “like” ONFOCUS = “helpText(2)” ONBLUR = “helpText(6)”><BR>

    Any comments?<BR>
    <TEXTAREA NAME = “comments” ROWS = 5 COLS = 45 ONFOCUS = “helpText(3)” ONBLUR = “helpText(6)”></TEXTAREA><BR>
    <INPUT TYPE = “submit” VALUE = “Submit” ONFOCUS = “helpText(4)” ONBLUR = “helpText(6)”>
    <INPUT TYPE = “reset” VALUE = “Reset” ONFOCUS = “helpText(5)” ONBLUR = “helpText(6)”>
    <TEXTAREA NAME = “helpBox” STYLE = “position: absolute; right:0; top: 0” ROWS = 4 COLS = 45>
    This TEXTAREA provides context-sensitive help. Click on any input field or use the TAB key to get more information about the input field.</TEXTAREA>
    </FORM>
</BODY>
</HTML>

//Element objects & ONLOAD
<HTML>
<HEAD>
    <TITLE>Object Model</TITLE>
    <SCRIPT>
        function start() {
            alert(pText.innerText);
            pText.innerText = “Thanks for coming.”;
        }
    </SCRIPT>
</HEAD>
<BODY ONLOAD = “start()”>
    <P ID = “pText”>Welcome to our Web page!</P>//Changes when alert box is clicked.
    //pText.innerText or document.getElementById(“pText”).innerHTML
</BODY>
</HTML>


//More inner text – from Microsoft (Altering Text)
<P ID=oPara>Here's the text that will change.</P>
<BUTTON onclick=“oPara.innerText=‘WOW! It changed!’”>Change text</BUTTON>
<BUTTON onclick=“oPara.innerText=‘And back again’”>Reset</BUTTON>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1231173.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

计算机毕业设计 基于SpringBoot的企业内部网络管理系统的设计与实现 Java实战项目 附源码+文档+视频讲解

博主介绍&#xff1a;✌从事软件开发10年之余&#xff0c;专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。CSDN、掘金、华为云、InfoQ、阿里云等平台优质作者✌ &#x1f345;文末获取源码联系&#x1f345; &#x1f447;&#x1f3fb; 精…

Java Web——JS中的BOM

1. Web API概述 Web API 是指浏览器提供的一套接口&#xff0c;这些接口允许开发人员使用 JavaScript&#xff08;JS&#xff09;来操作浏览器功能和页面元素。通过 Web API&#xff0c;开发人员可以与浏览器进行交互&#xff0c;以实现更复杂的功能和效果。 1.1. 初识Web AP…

鸿蒙4.0开发笔记之DevEco Studio之配置代码片段快速生成(三)

一、作用 配置代码片段可以让我们在Deveco Studio中进行开发时快速调取常用的代码块、字符串或者某段具有特殊含义的文字。其实现方式类似于调用定义好变量&#xff0c;然而这个变量是存在于Deveco Studio中的&#xff0c;并不会占用项目的资源。 二、配置代码段的方法 1、打…

Go 语言中的map和内存泄漏

map在内存中总是会增长&#xff1b;它不会收缩。因此&#xff0c;如果map导致了一些内存问题&#xff0c;你可以尝试不同的选项&#xff0c;比如强制 Go 重新创建map或使用指针。 在 Go 中使用map时&#xff0c;我们需要了解map增长和收缩的一些重要特性。让我们深入探讨这一点…

Kotlin学习之函数

原文链接 Understanding Kotlin Functions 函数对于编程语言来说是极其重要的一个组成部分&#xff0c;函数可以视为是程序的执行&#xff0c;是真正活的代码&#xff0c;为啥呢&#xff1f;因为运行的时候你必须要执行一个函数&#xff0c;一般从主函数入口&#xff0c;开始一…

flink源码分析之功能组件(一)-metrics

简介 本系列是flink源码分析的第二个系列,上一个《flink源码分析之集群与资源》分析集群与资源,本系列分析功能组件,kubeclient,rpc,心跳,高可用,slotpool,rest,metric,future。其中kubeclient上一个系列介绍过,本系列不在介绍。 本文介绍flink metrics组件,metric…

设计模式-责任链-笔记

动机&#xff08;Motivation&#xff09; 在软件构建过程中&#xff0c;一个请求可能被多个对象处理&#xff0c;但是每个请求在运行时只能有个接受者&#xff0c;如果显示指定&#xff0c;将必不可少地带来请求者与接受者的紧耦合。 如何使请求的发送者不需要指定具体的接受…

Halcon Solution Guide I basics(2): Image Acquisition(图像加载)

文章目录 文章专栏前言文章解读文章开头流程图算子介绍案例自主练习读取一张图片读取多张图片 文章专栏 Halcon开发 Halcon学习 练习项目gitee仓库 前言 今天来看Halcon的第二章&#xff0c;图像获取。在第二章之后&#xff0c;后面文章就会提供案例了。到时候我会尽量完成每一…

pnpm : 无法加载文件 E:\Soft\PromSoft\nodejs\node_global\pnpm.ps1,

pnpm : 无法加载文件 E:\Soft\PromSoft\nodejs\node_global\pnpm.ps1&#xff0c;因为在此系统上禁止运行脚本。有关详细信息&#xff0c;请参阅 https:/go.microsoft.com/fwlink/?LinkID135170 中 的 about_Execution_Policies。 所在位置 行:1 字符: 1pnpm -v~~~~ CategoryI…

【Flask使用】全知识md文档,4大部分60页第3篇:状态cookie和session保持

本文的主要内容&#xff1a;flask视图&路由、虚拟环境安装、路由各种定义、状态保持、cookie、session、模板基本使用、过滤器&自定义过滤器、模板代码复用&#xff1a;宏、继承/包含、模板中特有变量和函数、Flask-WTF 表单、CSRF、数据库操作、ORM、Flask-SQLAlchemy…

Android描边外框stroke边线、rotate旋转、circle圆形图的简洁通用方案,基于Glide与ShapeableImageView,Kotlin

Android描边外框stroke边线、rotate旋转、circle圆形图的简洁通用方案&#xff0c;基于Glide与ShapeableImageView&#xff0c;Kotlin 利用ShapeableImageView专门处理圆形和外框边线的特性&#xff0c;通过Glide加载图片装载到ShapeableImageView。注意&#xff0c;因为要描边…

Motion Plan之搜素算法笔记

背景&#xff1a; 16-18年做过一阵子无人驾驶&#xff0c;那时候痴迷于移动规划&#xff1b;然而当时可学习的资料非常少&#xff0c;网上的论文也不算太多。基本就是Darpa的几十篇无人越野几次比赛的文章&#xff0c;基本没有成系统的文章和代码讲解实现。所以对移动规划的认…

什么是Mock?为什么要使用Mock呢?

1、前言 在日常开发过程中&#xff0c;大家经常都会遇到&#xff1a;新需求来了&#xff0c;但是需要跟第三方接口来对接&#xff0c;第三方服务还没好&#xff0c;我们自己的功能设计如何继续呢&#xff1f;这里&#xff0c;给大家推荐一下Mock方案。 2、场景示例 2.1、场景一…

ArkTS - HarmonyOS服务卡片(创建)

可以参考官网文档 其中我们在已有的文件中File > New > Service Widget创建你想要的小卡片 本文章发布时目前可使用的模板就三种 有卡片后的new 最终效果

AIGC 技术在淘淘秀场景的探索与实践

本文介绍了AIGC相关领域的爆发式增长&#xff0c;并探讨了淘宝秀秀(AI买家秀)的设计思路和技术方案。文章涵盖了图像生成、仿真形象生成和换背景方案&#xff0c;以及模型流程串联等关键技术。 文章还介绍了淘淘秀的使用流程和遇到的问题及处理方法。最后&#xff0c;文章展望…

【10套模拟】【7】

关键字&#xff1a; 二叉排序树插入一定是叶子、单链表简单选择排序、子串匹配、层次遍历

【C++ Primer Plus学习记录】for循环

很多情况下都需要程序执行重复的任务&#xff0c;C中的for循环可以轻松地完成这种任务。 我们来从程序清单5.1了解for循环所做的工作&#xff0c;然后讨论它是如何工作的。 //forloop.cpp #if 1 #include<iostream> using namespace std;int main() {int i;for (i 0; …

【开源】基于Vue.js的衣物搭配系统的设计和实现

项目编号&#xff1a; S 016 &#xff0c;文末获取源码。 \color{red}{项目编号&#xff1a;S016&#xff0c;文末获取源码。} 项目编号&#xff1a;S016&#xff0c;文末获取源码。 目录 一、摘要1.1 项目介绍1.2 项目录屏 二、研究内容2.1 衣物档案模块2.2 衣物搭配模块2.3 衣…

Linux latin1字符集转成UTF-8

latin1字符集&#xff0c;我用命令iconv转换后依旧乱码&#xff0c;但是本地用Notepad转成utf-8再入库数据&#xff0c;却是正常的 查看文件编码 vi WeakcoverReason_20231120.csv:set fileencoding使用编码转换命令&#xff0c;将latin1改成UTF-8 iconv -f latin1 -t UTF-8 W…