Javascript from Zero to Proficiency by Patrick Felicia 笔记

You Don't Know JS Yet (book series) - 2nd Edition by Kyle Simpson You Don’t Know JS Yet (book series) - 2nd Edition 全文阅读地址From https://github.com/getify/You-Dont-Know-JS 我的GitHub文件: https://github.com/Li-YangZhong/Kyle_Simpson_You_Don-t_Know_JS_Yet_-Get_Started.git... 阅读详情

JavaScript also makes it possible to communicate with a server through technologies often referred as AJAX, whereby information is sent asynchronously to the server, and then processed accordingly. 

<HEAD>  tag includes information that will not be displayed on the page; for example, the title of the page, JavaScript code, or styling preferences. 

CTRL + R refreshes a webpage.

It is good practice to add spaces around the operators such as +, -, /, or % for clarity. A block of instructions start with an opening curly bracket and that ends with a closing curly bracket. 
---------------------------

/*Adding the following javascript code in the webpage will cause the url change to http://127.0.0.1:11760/Ireland and the page doesn't load.*/

<SCRIPT>
var name="Pat", location = "Ireland", year = 2018;
console.log(year);
</SCRIPT>

-------------------

        var str1 = "string01";
        var str2 = "string02";
        var num1 = 1;
        var strs_combined = str1 +str2;
        var str_combine_num = str1 + num1;
        alert(strs_combined);
        alert(str_combine_num);


------------------
& can not be used in variable name.
---------------

var nameOfUser = prompt("Please enter your name","");
if (nameOfUser == "Patrick") 
    alert ("Hello Patrick");
else 
    alert ("Hello Stranger");

-------------------

var result = prompt("What is 1 + 1","");
        
resultAsNumber = parseInt(result);    
        
if (resultAsNumber === 2) 
    alert ("Well done");
else 
    alert ("Sorry, wrong answer");

----------------------
A function can be called using the () operator
---------------
Global variables need to be declared at the start of the script (using the usual declaration syntax) and outside of any function. They can then be used anywhere in the script.
---------------

//If a variable is initialized in a method without being declared, it is considered as a global variable        
function function3()
{
    testGlobal = 3;
} 
function3();
alert("value of testGlobal is: " + testGlobal);//this should display "value of test is: 3";


---------------
In JavaScript, a script will be executed until an error occurs in this script. When an error is detected, the browser will just stop to execute any further code.
--------------

<script type="text/javascript" src="myScript.js"></script>
<!--    linking to an external javascript file.-->

-----------------
We all learn by trial and error, and making mistakes is part of the learning process.
--------------
So, as you create your first script, set any fear aside, try to experiment, be curious, and get to learn the language. It is like learning a new foreign language: when someone from a foreign country understands your first sentences, you feel so empowered!
-----------------
Strings are considered as objects with associated attributes (often called properties) and functions (often referred as methods).
------------------

var myName = "Patrick";
var numberOfLetters = myName.length;
console.log("There are " + numberOfLetters + " letters in " +myName);

--------------------

var mySentence = "This is a short sentence.";
if (mySentence.indexOf("short") >=0 )             console.log ("Index of the word 'short' is: " + mySentence.indexOf("short"));
else 
    console.log ("'short' is not included in the sentence");

----------------

//slicing a string.
var mySentence = "This sentence is long and needs to be shorter";
var shorterSentence = mySentence.slice (0,14);
console.log(shorterSentence);

-----------------

var mySentence = "This sentence is long and needs to be shorter";
console.log(mySentence);

var modifiedSentence = mySentence.replace ("is long","is way too long");
console.log(modifiedSentence);

var upperCaseSentence = mySentence.toUpperCase();
console.log(upperCaseSentence);

var lowerCaseSentence = mySentence.toLowerCase();
console.log(lowerCaseSentence);

-------------------

var randomNmber = Math.random();
if (randomNmber <.7) 
    console.log ("there was a 70% chance for this message to be displayed");
else 
    console.log ("there was a 30% chance for this message to be displayed");

--------------------

var answer = prompt("Please enter your choice 1- 3","");
var choice = Number(answer);

switch (choice){
    case 1:
    console.log ("you chose 1");
    break;
    case 2:
    console.log ("you chose 2");
    break;
    case 3:
    console.log ("you chose 3");
    break;
    default:
    console.log ("Default option");
    break;
} 

console.log ("We have exited the switch structure");

---------------

do
{
    var answer = prompt("Please enter your choice 1- 3","");
    var choice = Number(answer);
} while (choice <= 1 || choice >=3);

--------------------

var questions = ["What is 2+2", "What is 4+2", "What is 4+5"];
var correctAnswers = [4, 6, 9];
var score = 0;

for (i = 0; i < 3; i ++)
{
    var answer = Number(prompt("Question "+ (i+1)+": "+questions[i],""));
    if (answer == correctAnswers[i]) {
        alert("Well done!"); 
        score++;
    }            
    else 
        alert ("Sorry wrong answer");
}

alert ("You answered " + score + " questions correctly");


---------------------

//creating an array
var words = new Array();
words[0] = "beauty";
words[1] = "peace";
words[2] = "calm";
console.log(words);


--------------------

var test = ["Noemy", "Alan", "John"];
console.log("Elements before sorting: " + test);
test.sort();
console.log("Elements after sorting: " + test);


-------------

<!DOCTYPE html>
<HTML>
    <HEAD>
    <TITLE>My First HTML Page</TITLE>
    <SCRIPT>  
    function updateTimer()
    {
        var todaysDate = new Date();
        var enDate = new Date (2019, 2, 6, 23,59,59,0);
        var diff = Math.abs(enDate-todaysDate);
        
        var nbDays = Math.floor(diff/(1000*60*60*24));
        var nbHours = Math.floor((diff%(1000*60*60*24))/(1000*60*60));
        var nbMinutes = Math.floor((diff%(1000*60*60))/(1000*60));
        var nbSeconds = Math.floor((diff%(1000*60))/(1000));
        
        document.getElementById("timer").innerHTML = nbDays+" Days";
        document.getElementById("timer").innerHTML += nbHours+" Hours";
        document.getElementById("timer").innerHTML += nbMinutes+" Minutes";
        document.getElementById("timer").innerHTML += nbSeconds+" Seconds";
    }
    
        
    </SCRIPT>
        
    </HEAD>
    <BODY  onload="setInterval(updateTimer,1000);">

        <DIV id = "timer"> </DIV>
                
    </BODY>
</HTML>


-----------------------------

var student1 = {

                fName: "Paul", 
                lName: "Murphy", 
                studentID:"ID101", 
                classes: ['CS700', 'CS800'],

                displayName : function (){return "My name is " + this.fName + " "+this.lName;}
               }

console.log(student1.displayName());

------------------

var student1 = {
                fName: "Paul", 
                lName: "Murphy", 
                studentID:"ID101", 
                classes: ['CS700', 'CS800'],
                displayName : function (){console.log("My name is " + this.fName + " "+this.lName);}
                }
student1.displayName();


---------------

//adding new property to an exiting object
function Student (firstName, lastName, studendIdentification, classesAttended)
{
    this.fName = firstName;
    this.lName = lastName;
    this.studentId = studendIdentification;
    this.classes = classesAttended;
}
        
var student3 = new Student("David", "Callagher", "120",['CS700', 'CS800']);
console.log("Student3 " + student3.lName);
console.log("Student3 " + student3.classes[0]);
var student4 = new Student("Mary", "Black", "121",['CS701', 'CS800']);
console.log("Student4 " + student4.lName);
console.log("Student4 " + student4.classes[0]);
student3.fullName = student3.fName + " " + student3.lName;
console.log("Student 3's full name: "+student3.fullName);    


---------------

function Student (firstName, lastName, studendIdentification, classesAttended)
{
    this.fName = firstName;
    this.lName = lastName;
    this.studentId = studendIdentification;
    this.classes = classesAttended;
    this.fullName = this.fName + " " + this.lName;
    this.nbModulesAttended = function() {return this.classes.length;}
}
        
var student3 = new Student("David", "Callagher", "120",['CS700', 'CS800']);
console.log("Student3 " + student3.lName);
console.log("Student3 " + student3.classes[0]);
var student4 = new Student("Mary", "Black", "121",['CS701', 'CS800']);
console.log("Student4 " + student4.lName);
console.log("Student4 " + student4.classes[0]);
console.log("Student 3's full name: "+student3.fullName);
console.log(student4.fullName);
console.log("Number of classes attended by Student 3: "+ student3.nbModulesAttended());
console.log(student4["fName"]);


--------------

console.log(Math.ceil(2.1));//3


----------------

var questions = ["electricity", "DNA"];
var answers = ["scientist1", "scientist2"];
var score = 0;
for (var i = 0; i < answers.length; i++)
        {
            var userAnswer = prompt ("Who discovered "+questions[i],"");
            userAnswer = userAnswer.toLowerCase();
            if (userAnswer == answers [i]) score++;
        }
alert ("You have answered "+ score + " Questions correctly!");


--------------

<!DOCTYPE html>
<HTML>
<HEAD>
    <SCRIPT>
function readField ()
{ 
    var text = document.getElementById("myText").innerHTML;
    console.log("Text found: "+ text);
    document.getElementById("myText").innerHTML = "Hello Stranger";
} 
        
function checkField()
{
    var fieldContent = document.getElementById("fName").value;
    if (fieldContent == "") alert ("Sorry, this field should not be empty");
    document.getElementById("fName").style.backgroundColor = "red";
}
        
    </SCRIPT>
</HEAD>
<BODY >
    
<DIV onclick = "readField()" id = "myText"> Hello World</DIV>
First Name: <INPUT type = text id = "fName" onblur = "checkField()">
</BODY>
</HTML>


-----------------

<!DOCTYPE html>
<HTML>
<HEAD>
    <SCRIPT>

function copyAddress()
{ 
    document.getElementById("b_fname").value = document.getElementById("s_fname").value;
    document.getElementById("b_lname").value = document.getElementById("s_lname").value;
    document.getElementById("b_address").value = document.getElementById("s_address").value;
}
        
    </SCRIPT>
</HEAD>
<BODY >
    
<FORM>
Shipping Address<BR>

<TABLE border = 0>
<TR> <TD>First Name</TD><TD><INPUT id = "s_fname"> </TD> </TR>
<TR> <TD>Last Name</TD><TD><INPUT id = "s_lname"> </TD> </TR>
<TR> <TD>Shipping Address</TD><TD><INPUT id = "s_address"> </TD> </TR>
</TABLE>

<BR>
<BUTTON type = "button" onclick = "copyAddress();"> Same Shipping Details </BUTTON>
<BR>
<BR>
Billing Address<BR>

<TABLE border = 0>
<TR> <TD>First Name</TD><TD><INPUT id = "b_fname"> </TD> </TR>
<TR> <TD>Last Name</TD><TD><INPUT id = "b_lname"> </TD> </TR>
<TR> <TD>Shipping Address</TD><TD><INPUT id = "b_address"> </TD> </TR>
</TABLE>

</FORM>
</BODY>
</HTML>


--------------------

<!DOCTYPE html>
<HTML>
<HEAD>
    <SCRIPT>
function checkField()
{
    var fieldToValidate = document.getElementById("phoneNumber");
    var feedback = document.getElementById("feedback");
    if (!fieldToValidate.checkValidity()) feedback.innerHTML = fieldToValidate.validationMessage;
}

        
    </SCRIPT>
</HEAD>
<BODY >
    
<FORM>
Phone Number: <INPUT type = "number" id = "phoneNumber" onblur = "checkField()"> 
<DIV id="feedback"></DIV>
</FORM>
    
</BODY>
</HTML>


--------------------------

<!DOCTYPE html>
<HTML>
<HEAD>
    <SCRIPT>
function checkField()
{
    var fieldToValidate = document.getElementById("phoneNumber");
    var feedback = document.getElementById("feedback");
    if (fieldToValidate.validity.valueMissing) feedback.innerHTML = "This field can't be left empty. Please enter a value";
}

        
    </SCRIPT>
</HEAD>
<BODY >
    
<FORM>
Phone Number: <INPUT type = "number" id = "phoneNumber" onblur = "checkField()" required>
<DIV id="feedback"></DIV>
</FORM>
    
</BODY>
</HTML>


----------------------

<!DOCTYPE html>
<!--add event listner-->
<HTML>
<HEAD>
    <SCRIPT>
function initEvents(){
    document.getElementById("button").addEventListener ("click", displayMessage)
    document.getElementById("button").addEventListener ("mouseover", displayMessageWhenOver);
} 
function displayMessage()
{
    console.log("You just clicked the button");
    document.getElementById("button").removeEventListener ("mouseover", displayMessageWhenOver);
}

function displayMessageWhenOver()
{
    console.log("You just moved the mouse over the button");
}
        
    </SCRIPT>
</HEAD>
<BODY onload = "initEvents()">
    
<BUTTON id = "button" type = "button" > Click me </BUTTON>
    
</BODY>
</HTML>


---------------
In JavaScript terms, when we deal with the innermost element (i.e., the child), we say that we are bubbling events, and if we decide to deal with the outermost element (i.e., the parent), we say that we are capturing events.
By default, if you add an event to an element, events are bubbled; however, it is possible to modify this options when adding an event, by specifying a third attribute and setting it to true (for a capturing behavior).
---------------

<!DOCTYPE html>
<!--bubbling events-->
<HTML>
<HEAD>

<SCRIPT>
function initEvents() {
document.getElementById("table").addEventListener("click",displayMessageWhenTableClicked,flase);
        
document.getElementById("innerCell").addEventListener ("click", displayMessageWhenInnerCellClicked, flase);
        }
        
function displayMessageWhenTableClicked()
{
    console.log("You clicked within the table");
} 

function displayMessageWhenInnerCellClicked()
{
    console.log("You clicked within the cell");
}
            
    </SCRIPT>    
</HEAD>
<BODY onload="initEvents()">
    
<TABLE id = "table" style = "background-color: black">
<TR><TD>Inside TR</TD><TD>Inside TR</TD><TD>Inside TR</TD></TR>
<TR><TD>Inside TR</TD><TD id = "innerCell" style = "background-color: red">Click Me, I Am inside</TD><TD>Inside TR</TD></TR>
<TR><TD>Inside TR</TD><TD>Inside TR</TD><TD>Inside TR</TD></TR>
</TABLE>

</BODY>
</HTML>


-----------------------

<!DOCTYPE html>
<!--navigating through nodes-->
<HTML>
<HEAD>

    <SCRIPT>
    function countElements()
    { 
        var body = document.getElementsByTagName("BODY")[0];
        var parentOfBody = body.parentNode.nodeName;
        console.log("Parent of BODY is "+parentOfBody);
        var firstChild = body.firstChild.nodeName;
        console.log("First Child of BODY is"+firstChild);
        var lastChild = body.lastChild.nodeName;
        console.log("Last Child of BODY is "+lastChild);
        var nextSiblingOfId1 = document.getElementById("div1").nextSibling.nodeName;
        console.log("The next sibling of DIV1 is "+nextSiblingOfId1);
    }
            
    </SCRIPT>    
</HEAD>
    
<BODY onload = countElements()><DIV id = "div1"> Hello World 1</DIV><DIV id = "div2"> Hello World 2</DIV>
    
</BODY>
    
</HTML>


---------------------

<!DOCTYPE html>
<!--adding and removing nodes and elements-->
<HTML>
<HEAD>

    <SCRIPT>
    function modifyDocument(){
        var newParagraph = document.createElement("p");
        var nodeWithinParagraphElement = document.createTextNode("This is a new paragraph");
        newParagraph.appendChild(nodeWithinParagraphElement);
        document.getElementById("div1").appendChild(newParagraph);
        var newParagraph2 = document.createElement("P");
        var nodeWithinParagraphElement2 = document.createTextNode("This is a new paragraph that will appear before the previous one");newParagraph2.appendChild(nodeWithinParagraphElement2);
        document.getElementById("div1").insertBefore(nodeWithinParagraphElement2, newParagraph);
    }    
    
    function removeNodes()
    {
        var firstDiv = document.getElementById("div1");
        if (firstDiv.firstChild) firstDiv.removeChild(firstDiv.firstChild);
    }
    </SCRIPT>    
</HEAD>
    
<!--<BODY onload = countElements()><DIV id = "div1"> Hello World 1</DIV><DIV id = "div2"> Hello World 2</DIV>-->
<BODY onload = modifyDocument()><DIV id = "div1"> Hello World 1</DIV><DIV id = "div2"> Hello World 2</DIV>

<BUTTON onclick = "removeNodes()" type = button> Click here to remove paragraphs.</BUTTON>
    
</BODY>
    
</HTML>


-----------

<!DOCTYPE html>
<!--opening, closing and moving windows using javascript-->
<HTML>
<HEAD>

    <SCRIPT>
        function openWindow()
        {
            myWindow = window.open("","hello","menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes, width=300, height = 300");
        } 
        function closeWindow()
        {
            myWindow.close();
        }
        
        function moveWindowRight()
        {
            myWindow.moveBy(100,0);
            myWindow.focus();
        } 
        function moveWindowLeft()
        {
            myWindow.moveBy(-100,0);
            myWindow.focus();
        }
        
        function resizeWindow()
        {
//            myWindow.resizeTo(500, 500);
            myWindow.resizeBy(-100,-100);
            myWindow.focus();
        }    
    </SCRIPT>
    
</HEAD>
<BODY>

<BUTTON onclick = "openWindow()" type = "button">Click to open a new window</BUTTON>
<BUTTON onclick = "closeWindow()" type = "button">Click to close the new window</BUTTON>
<BUTTON onclick = "moveWindowRight()" type = "button">Click to move new window to the right</BUTTON>
<BUTTON onclick = "moveWindowLeft()" type = "button">Click to move new window to the left</BUTTON>
<BUTTON onclick = "resizeWindow()" type = "button">Click to Resize the new window</BUTTON>    
</BODY>
    
</HTML>


----------------

<!DOCTYPE html>
<!--working with browser's location-->
<HTML>
<HEAD>

    <SCRIPT>
//        specify that the function changeLocation should be called after 1 second (i.e., 1000 milliseconds).
//        setInterval(changeLocation, 1000);

        function changeLocation()
        { 
            window.location.assign("http://www.baidu.com");
        }
                
    </SCRIPT>
    
</HEAD>
<BODY >

<BUTTON onclick = "changeLocation()" type = "button">Click to open go to Apple.com</BUTTON>

</BODY>
    
</HTML>

--------------------
 

<HTML>
    <HEAD>
            <SCRIPT>
                
                var nbFields = 0;

                function deleteTextFields()
                {
                    var myNode = document.getElementById("div1");
                    var nbChild = myNode.childNodes.length;
                    console.log ("NB Children" + nbChild);
                    document.getElementById("div1").removeChild(myNode.childNodes[nbChild -1]);
                    document.getElementById("div1").removeChild(myNode.childNodes[nbChild -2]);
                    document.getElementById("div1").removeChild(myNode.childNodes[nbChild -3]);
                    nbFields--;
                    

                }
                function addTextFields()
                {
                    nbFields++;
                    var newParagraph = document.createElement("INPUT");
                    var label = document.createTextNode("Field" + nbFields);
                    var br = document.createElement("BR");
                    newParagraph.type = "text";
                    document.getElementById("div1").appendChild(label);
                    document.getElementById("div1").appendChild(newParagraph);
                    document.getElementById("div1").appendChild(br);
                }
            </SCRIPT>

    </HEAD>
    
        <BODY ><DIV id = "div1"></DIV>

        <BUTTON onclick = "addTextFields()" type = button> Click here to add text fields</BUTTON>

        <BUTTON onclick = "deleteTextFields()" type = button> Click here to delete text fields</BUTTON>
        </BODY>
<HTML>

 

Unity 5 From Zero to Proficiency 无水印pdf Unity 5 From Zero to Proficiency 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除 立即下载

相关推荐

Unity 5 From Zero to Proficiency (Foundations)(2015)

Patrick Felicia,A step-by-step guide to creating your first game.

javascript Declarations

,变量名被称为identifiers,三种声明变量的方式: 方式 描述 var local and global variables,默认undefined let block-scope local variable,默认undefined constblock-scope local variable,只读常量 注意: 1.不使用var let 或const,而直接赋值...

Claroja 570

Unity.5.From.Zero.to.Proficiency.B01EJCE85M

Unity 5 From Zero to Proficiency (Intermediate): A step-by-step guide to coding your first game in C# with Unity. Why this book can help you to get started with Game Development Creating your own game can be very intimidating at the start, and quite often, regardless of your experience with games, it is sometimes difficult to find the time and motivation to get over the first barriers and to get started. Often, these barriers seem higher than they actually are. Maybe you are a teacher trying to introduce games in your classroom or a parent trying to help your child with coding, but with no previous coding or game development experience; maybe you are a hobbyist who would love to create interactive environments based on your favorite games; maybe you are a student getting started with game development but you just don't know where to start or what resources to use; or maybe you have tried online video tutorials but found them disjointed. You may be wondering: "How can I start to create my games if I have no experience of coding", or "this game engine is so complex that I just don't know where to get started". This is quite common, and you can easily overcome these issues with a step-by-step approach that gets you to progressively develop and use your skills. This is the approach that I have used successfully over the past years to take students from no knowledge of coding or game development to good levels of proficiency in Unity and coding. Of course, it takes some time and dedication; however, by following the techniques and suggestions described in this book, I can promise you that you will progress, regardless of your background, and become more comfortable with Unity and coding. Content and structure of this book In this book, the third book in the series, you will become comfortable with programming in C# by creating a simple survival game in Unity. The book includes: A list of the learning objectives at the start of each chapter. Step-by-step activities. Opportunities to engage in deeper learning and problem-solving skills through challenges at the end of each chapter. Quizzes to test your knowledge. Code solutions (in C#) for each chapter. Cheat-sheets (i.e., shortcuts, best practice, etc.) that you can download. When you buy this book you get: Support via email. 18 video tutorials. 80% off the pdf version (save $5). 50% off the paperback version (save $22). The content of each chapter is as follows: Chapter 1 provides an introduction to C# and explains key programming concepts such as variables, variable types, polymorphism, constructors, or methods as well as best practices for C# programming within Unity. Chapter 2 helps you to code your first script in C#. It explains common coding mistakes and errors in Unity, and how to avoid them easily. Chapter 3 gets you to use C# to instantiate, use and control Rigidbody objects from your script as well as explosions. Chapter 4 explains how to create a simple weapon management system. You will create weapons (e.g., a gun and a grenade launcher), manage the collection of ammunition, and also implement a user interface to keep track of ammunition. Chapter 5 explains how to use Mecanim and NavMesh navigation to control an animated NPC that detects, follows, or shoot at the player. Chapter 6 makes it possible to combine the skills that you have acquired in the previous chapters to create a fully functional level. You will also learn how to generate a maze (or game level) dynamically from your code. Chapter 7 provides answers to Frequently Asked Questions (FAQs) related to FSM, NavMesh, Rigiddbody components, or Artificial Intelligence. It also provides links to additional exclusive video tutorials that can help you with some of your questions. Chapter 8 summarizes the topics covered in the book and provides you with more information on the next steps If you want to start programming in C# using a tried-and-tested method: download this book now. Table of Contents Chapter 1: Introduction to Programming in C# Chapter 2: Creating your First Script Chapter 3: Adding Simple AI Chapter 4: Creating and Managing Weapons Chapter 5: Using Finite State Machines Chapter 6: Putting It All Together Chapter 7: Frequently Asked Questions Chapter 8: Thank You!

前端编码风格规范之 JavaScript 规范

JavaScript 规范 全局命名空间污染与 IIFE 总是将代码包裹成一个 IIFE(Immediately-Invoked Function Expression),用以创建独立隔绝的定义域。这一举措可防止全局命名空间被污染。 IIFE 还可确保你的代码不会轻易被其它全局命名空间里的代码所修改(i.e. 第三方库,window 引用,被覆盖的未定义的关键字等等)。 不推荐 ...

weixin_30511039的博客 254

Unity 5 From Zero to Proficiency (Foundations).pdf 2015

A step-by-step guide to creating your first game.

基于OpenCV C++实现工业级形状模板匹配:仿Halcon SBM算法全解析

在计算机视觉和工业自动化领域,模板匹配是一项基础且关键的技术,用于在图像中定位已知目标。其核心原理是通过计算图像区域与预设模板之间的相似度来识别目标位置。传统的基于灰度值的匹配方法对光照变化敏感,鲁棒性不足。而基于边缘梯度方向的形状匹配技术,通过计算轮廓梯度方向的一致性进行相似度度量,从根本上提升了对光照变化的鲁棒性,并支持目标的旋转与缩放,技术价值显著。这项技术广泛应用于工业视觉检测、机器人引导、PCB定位等对精度和稳定性要求极高的场景。本文聚焦于使用开源OpenCV库,从底层仿照Halcon的Shape

weixin_33691817的博客 502

Javascript中的变量声明语法(包括全局变量)之间的区别?

Is there any difference between declaring a variable: 声明变量之间有什么区别: var a=0; //1 ...this way: ...

xfxf996的博客 768

STM32 FMC驱动AD7606实战:从硬件连接到时序调试全流程解析

本文详细解析了STM32 FMC驱动AD7606的全流程,包括硬件连接、FMC接口配置、驱动程序设计和时序调试。通过实战案例,展示了如何利用STM32的FMC总线实现与AD7606的高效数据传输,特别强调了电源设计、信号连接和PCB布局等关键要点,为嵌入式数据采集系统开发提供了实用指导。

aa123的博客 1007

Javascript中Function declarations 理解

Javascript 中function declaration在ECMA5与ECMA6不同定义之理解。

那时那刻 1294

制作Ubuntu22.04启动盘

现在越来越多程序代码都需要运行在linux环境下,运行这些代码的前提是安装一个稳定的linux操作系统。本文选择Ubuntu 22.04去制作系统启动盘。本文主要对ubuntu22.04的启动盘制作过程进行了详细的说明,希望能帮助到有需要的朋友。

lyx_ok的博客 1万+

Orbbec-Gemini-335 深度相机 Python SDK 编译与配置全记录(Windows 环境)

本篇博客将围绕 Windows 系统下 Orbbec SDK 的 Python 配置与编译过程进行详细说明,主要使用的是官方提供的 pyorbbecsdk Python wrapper 项目以及 Orbbec SDK V2 Python Wrapper 配置指南,并记录了安装与配置过程中遇到的若干问题及解决办法。

Junseer的博客 1968

JavaScript常见报错及处理方法

实际开发中,我们经常会遇到一些报错,有些错误可以定位到具体行,通过自己的开发经验就能够修复,而有些报错并不是那么容易搞定,熟悉JavaScript常见的报错有助于更加快速的优化自己的业务。今天,我们就来整理一下常见的错误类型吧。 常见的错误类型 Error: Error是基类型,其他的错误类型都是继承自该类型。 EvalError: 当函数eval()使用不正确的时候会抛出该错误,但是由于这个错误在不同浏览器中表现不一致,所以很少使用,也即很少遇到。 RangeError:当设置

年轻正好 6344

pt100和max31865测室温跳变比较大,会从23.04跳到23.47,23.75反复跳变超过了0.5的误差范围,在VDD和GND之间加上0.1和10的滤波电容也不行,如何解决?

🏆 本文收录于《全栈Bug调优(实战版)》专栏,致力于分享我在项目实战过程中遇到的各类Bug及其原因,并提供切实有效的解决方案。无论你是初学者还是经验丰富的开发者,本文将为你指引出一条更高效的Bug修复之路,助你早日登顶,迈向财富自由的梦想🚀!同时,欢迎大家关注、收藏、订阅本专栏,更多精彩内容正在持续更新中。让我们一起进步,Up!Up!Up!    备注: 部分问题/难题源自互联网,经过精心筛选和整理,结合数位十多年大厂实战经验资深大佬经验总结所得,数条可行方案供所需之人参考。

**My Coding Family** 2087

Javascript Beginning [实用资料]

BOM: The navigator object, which provides detailed information about the browser The location object, which gives detailed information about the page loaded in the browser The screen object, which ...

weixin_34037173的博客 196

ResNet改进(20):融合Swin Transformer与ResNet

这种混合架构的设计理念是:在保留CNN强大局部特征提取能力的同时,引入Transformer的全局建模优势。我们实现的模型在ResNet18的基础上嵌入了一个简化版的Swin Transformer Block,旨在探索两种范式结合的可能性。通过在ResNet早期阶段引入Transformer模块,我们既保留了CNN强大的局部特征提取能力,又获得了Transformer的全局建模优势。本文提出的ResNet与Swin Transformer混合架构,探索了CNN与Transformer结合的可能性。

2401_82355416的博客 860

华为OD机试真题 新系统 2026-09-06 Python&JS【仓储货物有序出库】

某仓储中心有一个货物堆放区,货物编号按乱序堆叠存放,只能从顶部取货,管理员需要将货物按编号从小到大取出。

MISAYAONE的博客 119

JavaScript中Element对象

Element 对象在 HTML DOM 中,Element 对象表示 HTML 元素。常用属性和方法:下面的属性和方法可用于所有 HTML 元素上:1、element.appendChild()     向元素添加新的子节点,作为最后一个子节点。2、element.removeChild()     从元素中移除子节点。3、element.getElementsByTagName()     返...

scbiaosdo的博客 2481

2025年GESP12月认证C++四级真题解析

摘要 本文包含11道C++编程题目,涵盖指针、数组、函数参数传递、结构体和排序算法等知识点。每题2分,总分30分,主要考察学生对C++基础语法的掌握程度。题目包括指针定义与解引用(第1-4题)、二维/三维数组遍历(第4-5题)、变量作用域(第6题)、函数传参方式(第7题)、结构体操作(第8题)、递归算法(第9题)和排序稳定性判断(第10题)。最后第11题要求补全选择排序算法代码片段。每道题均提供标准答案和详细解析,适合用于检验C++基础知识的掌握情况。

lan_in的博客 318

JavaScript学习之function与Function区别

Generally speaking, a function is a "subprogram" that can be called by code external (or internal in the case of recursion) to the function. Like the program itself, a function is composed of a sequen

每每看到代码,就会有亲切之感! 1711

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Javascript>> onmouseover用法

<!DOCTYPE html> <html> <head> <title>Window Title</title> </head> <body> <p>Test your mouse on me!</p> <script> const p = document.quer...

CodingIsFun 4570

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

用Javascript显示一个电子时钟

<!DOCTYPE html> <html> <head> <style type="text/css" media="screen"> body { background: black; } #txt { position: absolute; top: 50%; left: 50%; transf...

CodingIsFun 2260

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

p5.js: 通过上下左右键控制方块的位置

&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.16/p5.min.js"&gt;&lt;/script&gt; &lt;style&gt; body { padding: 0;

CodingIsFun 1420

JavaScript Basics for Beginners by Mosh Hamedani

Javascript can be run inside a brower or Node which provides a runtime environment for Javascript. ECMAScript is a specification and Javascript is a programming language that confirms to this specifi...

CodingIsFun 949

Learning JavaScript - JavaScript Essentials for Modern Application Development by Ethan Brown

Learning JavaScript JAVASCRIPT ESSENTIALS FOR MODERN APPLICATION DEVELOPMENT by Ethan Brown I certainly hold no animosity toward amateurs: everyone has to start somewhere, programming is a profitabl...

CodingIsFun 700

《Javascript & JQuery interactive front-end web development》 by Jon Duckette 读书笔记-未完待续

There are many inconsistencies between browsers that affect JavaScript developers. jQuery will help you deal with cross-browser inconsistencies (it is one of the major reasons why jQuery rapidly gaine...

CodingIsFun 610
上一篇: Tips on Using Brackets
下一篇: 《Javascript & JQuery interactive front-end web development》 by Jon Duckette 读书笔记-未完待续
CodingIsFun
博客等级 码龄8年 37粉丝 240原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值