javaScript, PHP connection to takeaway ticket machine printer solution (calling Jiabo, Xinye, etc.)
Foreword: Current development requires a computer to directly connect to a takeout receipt machine to print receipts and access various information. Using HttpPrinter finally solved this problem. Effect: PHP and Javascript directly connect to the ticket machine and automatically issue tickets. Supported small ticket machines: The ones currently tested include: computer A4 printer, Jiabo GP58MBIII (USB direct connection), Xinye xp-58IIL (USB). In principle, it can support all USB-connected ticket machines. The current template is set according to 58MM. // Print POS Ticket Begin Function Print (ARR) { var ip = $ (“#ip”). Val (); VAR PORT = $(“#port”).val(); if(ip==””||port==””){alert(“ip,port cannot be empty”); return false;}<br /// Treatment of food data var Foodsjson = & # 39; & # 39; for (var I = 0; i { Foodsjson = Foodsjsjson + & # 39; {“” shangpname”:'+arr.foods[i].name +',”shuliang”:'+ arr.foods[i].count+', “je”:& #39;+ arr.foods[i].price+'},'; } var msg = '{' '”method”:”' + 'printreport' +'”' /*Report type gridreport fastreport reportmachine If empty, it will default to gridreport */ +',”ReportType”:”' + 'fastreport' +'”' /*Report type gridreport fastreport reportmachine If empty, it will default to gridreport */ +& # 39;, “Reportname”: “& # 39; +& # 39; AAALQS.FR3 &…
Web basic knowledge points (html, css, http, javaScript)
1.htmlBasic Knowledge HTML is not a programming language, but a markup language used to tell the browser how to organize a page. 1. Element The start tag + content + end tag is a complete element. But empty elements only have start tags. For example: the element is used to insert a specified picture at the location of the element . 2. Nested elements Elements can be placed within other elements – this is called nesting set. For example: I love my Motherland The tag is used here to emphasize the content of the motherland. 3. Introduction to common elements (1.) Title to (2.) Paragraph (3.) List List with serial number: List without serial number: (4.) Hyperlink (5.) Image (6.) Block-level semantic element None Semantic elements are usually used to organize content so that it can be laid out or manipulated through CSS or JS later. (7.) Inline semantic-less elements 4. Document structure 5.htmlComments 2.cssbasicknowledge Fullname:CascadingStyleSheets->CascadingStyleSheets Definition:CSSbecomesacascadingstylesheet,whichismainlyusedtosetthetextcontent(font,size,alignment,etc.),theshapeoftheimage(widthandheight,borderstyle,margins,etc.)intheHTMLpage,andThelayoutofthelayoutandotherappearancedisplaystyles.CSSisbasedonHTMLandprovidesawealthoffunctions(suchasfont,color,backgroundcontrol,overalllayout,etc.),andcanalsosetdifferentstylesfordifferentbrowsers. TherelationshipbetweenHTML,CSSandJS HTMLisamarkuplanguagethatisusedtostructurethecontentofourwebpagesandgivethecontentmeaning.Forexample,defineparagraphs,headings,anddatatables,orembedimagesandvideosintopages. CSSisastyleruleslanguagethatcanbeusedtoapplystylestoHTMLcontent,suchassettingbackgroundcolorsandfonts,andlayingoutcontentinmultiplecolumns. Javascriptisascriptinglanguagethatcanbeusedtocreatedynamicallyupdatingcontent,controlmultimedia,animateimages,andmuchmore. 3.BasicknowledgeofJavascript WhatisJavascriptcisascript,aprogramminglanguage,whichcanComplexfunctionsareimplementedonwebpages.Whatwebpagesshowyouisnolongersimplestaticinformation,butreal-timecontentupdates,interactivemaps,2D/3Danimations,scrollingvideos,etc.HowtoaddJavascripttoapageJavascriptcanbeaddedtoanHTMLpagejustlikeCSS.CSSusestheelementtolinktoexternalstylesheets,andtheelementtoembedinternalstylesheetsintoHTML.Javascriptonlyneedsoneelementhere-.Javascriptrunsequence AfterthecollectionofHTMLandCSSisassembledintoawebpage,thebrowser’sJavascriptengineexecutestheJavascriptcode.ThisensuresthatthestructureandstylingofthewebpagearealreadyinplacebeforetheJavascriptstartsrunning. WhenthebrowserexecutesapieceofJavascriptcode,itusuallyexecutesthecodefromtoptobottom.Thismeansyouneedtopayattentiontotheorderinwhichyourcodeiswritten. 4.KnowledgerelatedtoHTTPprotocol HTTPprotocol(HyperTextTransferProtocol),whichisbasedontheapplicationlayerofTCPprotocolThetransmissionprotocolissimplyarulefordatatransmissionbetweentheclientandtheserver.url http协议格式 5.Requestformat 6. Response format The format of the HTTP response is except for the status line (first line) and Except for the different request lines, the format is the same 7.Commonrequestmethodsandmeanings 8.…
JavaScript, PHP, Golang, Haskell, Elixir, which is the best programming language?
[CSDN Editor’s Note] Which language is the best programming language in your mind? Author | Michele Riva Translator | Crescent Moon Editor | Ouyang Shuli Produced by | CSDN (ID: CSDNnews) The following is the translation: Over the past few years, I’ve had the opportunity to try out a number of different programming languages . I really enjoy learning different languages, methods and paradigms. I am a curious person and have always been fascinated by programming languages. Every programming language is different. In this article, we discuss the advantages and disadvantages of the following five programming languages. Javascript Haskell Go PHP Elixir Javascript Advantages Quick prototyping: You can use Javascript to quickly write some prototypes to verify your ideas. You can even use Node.js to build a proof of concept for the backend in minimal time. Flexibility: Javascript is growing in popularity, aided by the metaprogramming capabilities of ES6. However, even if you don’t use these functions, you can write some very common functions through Javascript and use it to write clients, servers, and even mobile applications (such as React Native, etc.). Community: The Javascript community is great. Every time you encounter a problem, you can find the answer through…
Javascript, difference between b^2 and b*b
I tried coding in Javascript to find the results of a second linear regression, and found the additional results: The results are different??? 1> Brett DeWood..: This is because ^Operators are not a feature of Javascript. The ^ operation is a bitwise XOR operator. To square a value, you need to use Math.pow() or **. For example: b * b Math.pow(b, 2); b**2 or `**`, for the latest ECMAScript version.
HTML, XML, HTML5, JavaScript, Json, Ajax
HTML Vs XML : The design goal of HTML is to display data and focus on the appearance of the data, while the design goal of XML is to describe the data and focus on the content of the data (using For transmitting data, XML is used to structure the configuration file and is easy to store data), and its display form is completed by CSS or XSL. XML is more standardized than HTML. The tags used in HTML are predefined. HTML documents can only use tags defined in the HTML standard (such as , , etc.). XML allows authors to define their own tags and their own document structure. XML is a software- and hardware-independent information transfer tool. XML Summary: Extensible Markup Language XML can be used to exchange, share, and store data. XML documents form a tree structure, starting at the “root” and “leaf” branches. XML has very simple grammar rules. XML with correct syntax is “well-formed”. Valid XML is validated against DTD . XSLT Used to convert XML to other formats, such as HTML. All modern browsers have a built-in XML parser that can read and manipulate XML. DOM (Document Object Model) defines a standard way to…
javascript, can this code (nested IF statement) be shorter?
I think the code below could be simpler. Can this code be optimized? let name = app.short_name; if (name === undefined) { name = app.name; if (name === undefined) { name = ‘Untitled’; } } Rayon.. 9 Use the Logical OR(||) operator let name = app.short_name || app.name || ‘Untitled’; Nina Scholz.. 8 You can use the default chain with logical OR|| in short-circuit evaluation. let name = app.short_name || app.name || ‘Untitled’; But I recommend using a different variable name name since it is usually the attribute window 1> Rayon. .: Use the Logical OR(||) operator let name = app.short_name || app.name || ‘Untitled’; 2> Nina Scholz..: You can use the default chain with logical OR|| in short-circuit evaluation. let name = app.short_name || app.name || ‘Untitled’; But I recommend using a different variable name name since it is usually the attribute window
javascript,JavaScript
What does Javascript mean? Javascript is an object- and event-driven scripting language with security features. Javascript scripting language, like other languages, has its own basic data types, expressions and arithmetic operators, and the basic program framework of the program. Javascript provides four basic data types and two special data types for processing data and text. Variables provide a place to store information, and expressions can complete more complex information processing. The difference between Javascript and Java Java code must be compiled to be executed, while Javascript does not need to be compiled and only needs to be interpreted and executed by the browser. Although both Java and Javascript can be executed on the server and the client, Java mostly runs on the server, while Javascript mostly runs on the client. Javascript uses loose data types, while Java uses strict data types. Introduction and syntax of Javascript, knowledge points of Web front-end development The article I want to share with you today is Introduction and syntax of Javascript on Web front-end development knowledge points. Friends who are learning web front-end related knowledge, come and take a look with the editor. I hope this article can be helpful to everyone. 1. Introduction…
javascript, javascript secrets of cultivating immortality
What is Javascript Javascript is a lightweight, interpreted or just-in-time compiled high-level programming language with function priority. Although it is famous as a scripting language for developing Web pages, it is also used in many non-browser environments. Javascript is a dynamic scripting language based on prototype programming, multi-paradigm, and supports object-oriented, imperative and declarative ( such as functional programming) style. Javascript was first designed and implemented on the Netscape Navigator browser in 1995 by Brendan Eich of Netscape. Because Netscape cooperated with Sun, Netscape management wanted it to look like Java, hence the name Javascript. But in fact its grammatical style is closer to Self and Scheme. The standard for Javascript is ECMAScript. As of 2012, all browsers fully support ECMAScript 5.1, and older browsers support at least the ECMAScript 3 standard. On June 17, 2015, ECMA International released the sixth edition of ECMAScript, which is officially called ECMAScript 2015, but is often called ECMAScript 6 or ES6. Extended information: Javascript is a scripting language whose source code does not need to be compiled before being sent to the client for running. It sends character codes in text format to the browser for interpretation and execution by the browser. The…
Map/Set maintains unique array of arrays, Javascript
I’m trying to build an array of unique arrays so that whenever I have a new array to add it, it should only be added if it doesn’t exist in the collection For example, store all unique permutations of [1,1,2] Actual:[[1,1,2],[1,2,1],[1,1,2],[1,2,1],[2,1,1],[ 2,1,1]] Expected:[[1,1,2],[1,2,1],[2,1,1]] Methods I tried: Array.Filter: Does not work because arrays are objects and each value uniqueArrComparer is a unique object reference to that array element. function uniqueArrComparer(value, index, self) { return self.indexOf(value) === index; } result.filter(uniqueArrComparer) Set/Map: I thought I could build a unique array, but it doesn’t work because Set internally uses a strict equality comparator (===), which Each array will be treated as unique in this case. We cannot customize object equality for Javascript Set Store each array element as a string in Set/Map/Array and build an array of unique strings. Use the array of unique strings at the end to build the array of arrays. This approach works, but it looks Not a valid solution. Work plan uses Set let result = new Set(); // Store [1,1,2] as “1,1,2” result.add(permutation.toString()); return Array.from(result) .map(function(permutationStr) { return permutationStr .split(“,”) .map(function(value) { return parseInt(value, 10); }); }); This question is more of a learning exercise than any application…
JavaScript, ridiculed as a “toy language”
Javascript is the most misunderstood programming language in the world. Although it is often ridiculed as a “toy language”, under its seemingly simple appearance, it also hides powerful language features. Javascript is currently widely used in many well-known applications. For web and mobile developers, an in-depth understanding of Javascript is particularly necessary. It is necessary to start with the history of this language. In 1995, a Netscape engineer named Brendan Eich created Javascript, and in early 1996, Javascript was first used in the Netscape 2 browser. The original Javascript was named LiveScript. Later, due to the rise of Sun Microsystem’s Java language and its widespread use, Netscape changed its name from the original LiveScript to Javascript for the sake of publicity and promotion – although there was no difference between the two. What they have in common. This was the source of subsequent confusion. A few months later, Microsoft released a basically compatible language, JScript, with the release of IE 3. A few months later, Netscape submitted Javascript to Ecma International (a European standards organization). The first edition of the ECMAScript standard was born in 1997, and was subsequently updated in the form of ECMAScript Third Edition in 1999. From…