{ "key_pair_value_system": true, "answer_rating_count": "", "question_feedback_html": { "html_star": "", "html_star_feedback": "" }, "answer_average_rating_value": "", "answer_date_js": "2024-08-28T08:15:43-04:00", "answer_date": "2024-08-28 08:15:43", "is_docs_available": "", "is_excel_available": "", "is_pdf_available": "", "count_file_available": 0, "main_page": "student_question_view", "question_id": "8569835", "url": "\/study-help\/questions\/questions-1-3-are-based-on-the-original-indexhtml-8569835", "question_creation_date_js": "2024-08-28T08:15:43-04:00", "question_creation_date": "Aug 28, 2024 08:15 AM", "meta_title": "[Solved] *Questions 1 - 3 are based on the origina | SolutionInn", "meta_description": "Answer of - *Questions 1 - 3 are based on the original index.html source code provided by the instructor. Questions 4 5 are based | SolutionInn", "meta_keywords": "*questions,1,-,3,based,original,indexhtml,source,code,provided,instructor,questions", "question_title_h1": "*Questions 1 - 3 are based on the original index.html source code provided by the instructor. Questions 4 5 are based on the server.js source", "question_title": "*Questions 1 - 3 are based on the original index.html source code", "question_title_for_js_snippet": " Questions 1 3 are based on the original index html source code provided by the instructor Questions 4 5 are based on the server js source code Question 1 What type of variable is langs , is it an integer, a float, a boolean, a string, or an array Question 2 What do you think webkitSpeechRecognition is on line 225 Do you think this mysterious thing exists only in Chrome web browser Why Question 3 What do you think the recognition variable is How many events and their corresponding handlers are registered with this object What are they Question 4 Can you point out where the in the server js file the feedback is logged in the Node server console (You can type the code out or give the line number ) Question 5 What do I need to change if I want this web application to run on localhost port 3333 instead of port 5000 (Which line to change How will you change it ) index html meta charset utf 8 title Web Speech API Demonstration style font family Verdana , Arial , sans serif a link color 000 text decoration none a visited color 000 a hover color 33F button background webkit linear gradient ( top , 008dfd 0, 0370ea 100 ) border 1 px solid 076bd2 border radius 3 px color fff display none font size 13 px font weight bold line height 1 3 padding 8 px 25 px text align center text shadow 1 px 1 px 1 px 076bd2 letter spacing normal center padding 10 px text align center final color black padding right 3 px interim color gray info font size 14 px text align center color 777 display none right float right sidebyside display inline block width 45 min height 40 px text align left vertical align top headline font size 40 px font weight 300 info font size 20 px text align center color 777 visibility hidden results font size 14 px font weight bold border 1 px solid ddd padding 15 px text align left min height 150 px start button border 0 background color transparent padding 0 h1 class center id headline a href http dvcs w3 org hg speech api raw file tip speechapi html Wake Tech Credit Union (WTCU) Customer Feedback div id info p id info start We would like to hear from you p id info speak now Speak now p id info no speech No speech was detected You may need to adjust your a href support google com chrome bin answer py hl en answer 1407892 microphone settings p id info no microphone style display none No microphone was found Ensure that a microphone is installed and that a href support google com chrome bin answer py hl en answer 1407892 microphone settings are configured correctly p id info allow Click the Allow button above to enable your microphone p id info denied Permission to use microphone was denied p id info blocked Permission to use microphone is blocked To change, go to chrome settings contentExceptions media stream p id info upgrade Web Speech API is not supported by this browser Upgrade to a href www google com chrome Chrome version 25 or later div class right button id start button onclick startButton ( event ) img id start img src mic gif alt Start div id results span id final span class final span id interim span class interim p div class center div class sidebyside style text align right button id copy button class button onclick copyButton () Copy and Paste div id copy info class info Press Control C to copy text br (Command C on Mac ) div class sidebyside button id email button class button onclick emailButton () Create Email div id email info class info Text sent to default email application br (See chrome settings handlers to change ) p div id div language select id select language onchange updateCountry () select id select dialect script var langs 'Afrikaans' , 'af ZA' , 'Bahasa Indonesia' , 'id ID' , 'Bahasa Melayu' , 'ms MY' , 'Catal' , 'ca ES' , 'etina' , 'cs CZ' , 'Deutsch' , 'de DE' , 'English' , 'en AU' , 'Australia' , 'en CA' , 'Canada' , 'en IN' , 'India' , 'en NZ' , 'New Zealand' , 'en ZA' , 'South Africa' , 'en GB' , 'United Kingdom' , 'en US' , 'United States' , 'Espaol' , 'es AR' , 'Argentina' , 'es BO' , 'Bolivia' , 'es CL' , 'Chile' , 'es CO' , 'Colombia' , 'es CR' , 'Costa Rica' , 'es EC' , 'Ecuador' , 'es SV' , 'El Salvador' , 'es ES' , 'Espaa' , 'es US' , 'Estados Unidos' , 'es GT' , 'Guatemala' , 'es HN' , 'Honduras' , 'es MX' , 'Mxico' , 'es NI' , 'Nicaragua' , 'es PA' , 'Panam' , 'es PY' , 'Paraguay' , 'es PE' , 'Per' , 'es PR' , 'Puerto Rico' , 'es DO' , 'Repblica Dominicana' , 'es UY' , 'Uruguay' , 'es VE' , 'Venezuela' , 'Euskara' , 'eu ES' , 'Franais' , 'fr FR' , 'Galego' , 'gl ES' , 'Hrvatski' , 'hr HR' , 'IsiZulu' , 'zu ZA' , 'slenska' , 'is IS' , 'Italiano' , 'it IT' , 'Italia' , 'it CH' , 'Svizzera' , 'Magyar' , 'hu HU' , 'Nederlands' , 'nl NL' , 'Norsk bokml' , 'nb NO' , 'Polski' , 'pl PL' , 'Portugus' , 'pt BR' , 'Brasil' , 'pt PT' , 'Portugal' , 'Romn' , 'ro RO' , 'Slovenina' , 'sk SK' , 'Suomi' , 'fi FI' , 'Svenska' , 'sv SE' , 'Trke' , 'tr TR' , '' , 'bg BG' , 'P' , 'ru RU' , '' , 'sr RS' , ' ' , 'ko KR' , ' ' , 'cmn Hans CN' , ' ( )' , 'cmn Hans HK' , ' ( )' , 'cmn Hant TW' , ' ( )' , 'yue Hant HK' , ' ( )' , ' ' , 'ja JP' , 'Lingua latna' , 'la' for ( var i 0 i langs length i ) select language options i new Option ( langs i 0 , i ) select language selectedIndex 6 updateCountry () select dialect selectedIndex 6 showInfo ( 'info start' ) function updateCountry () for ( var i select dialect options length 1 i 0 i ) select dialect remove(i) var list langs select language selectedIndex for ( var i 1 i list length i ) select dialect options add( new Option (list i 1 , list i 0 )) select dialect style visibility list 1 length 1 'hidden' 'visible' var create email false var final transcript '' var recognizing false var ignore onend var start timestamp if ( ( 'webkitSpeechRecognition' in window )) upgrade () else start button style display 'inline block' var recognition new webkitSpeechRecognition() recognition continuous true recognition interimResults true recognition onstart function () recognizing true showInfo ( 'info speak now' ) start img src 'mic animate gif' recognition onerror function (event) if (event error 'no speech' ) start img src 'mic gif' showInfo ( 'info no speech' ) ignore onend true if (event error 'audio capture' ) start img src 'mic gif' showInfo ( 'info no microphone' ) ignore onend true if (event error 'not allowed' ) if (event timeStamp start timestamp 100) showInfo ( 'info blocked' ) else showInfo ( 'info denied' ) ignore onend true recognition onend function () recognizing false if ( ignore onend ) return start img src 'mic gif' if ( final transcript ) showInfo ( 'info start' ) return showInfo ( '' ) if ( window getSelection) window getSelection() removeAllRanges() var range document createRange() range selectNode( document getElementById( 'final span' )) window getSelection() addRange(range) if ( create email ) create email false createEmail () recognition onresult function (event) var interim transcript '' for ( var i event resultIndex i event results length i) if (event results i isFinal) final transcript event results i 0 transcript else interim transcript event results i 0 transcript final transcript capitalize ( final transcript ) final span innerHTML linebreak ( final transcript ) interim span innerHTML linebreak (interim transcript) if ( final transcript interim transcript) showButtons ( 'inline block' ) function upgrade () start button style visibility 'hidden' showInfo ( 'info upgrade' ) var two line g var one line g function linebreak (s) return s replace( two line , ' ' ) replace( one line , ' ' ) var first char S function capitalize (s) return s replace( first char , function (m) return m toUpperCase() ) function createEmail () var n final transcript indexOf( ' ' ) if (n 0 n 80) n 40 final transcript substring(40) indexOf( ' ' ) var subject encodeURI ( final transcript substring(0, n)) var body encodeURI ( final transcript substring(n 1)) window location href 'mailto subject ' subject ' body ' body function copyButton () if ( recognizing ) recognizing false recognition stop() copy button style display 'none' copy info style display 'inline block' showInfo ( '' ) function emailButton () if ( recognizing ) create email true recognizing false recognition stop() else createEmail () email button style display 'none' email info style display 'inline block' showInfo ( '' ) function startButton (event) if ( recognizing ) recognition stop() return final transcript '' recognition lang select dialect value recognition start() ignore onend false final span innerHTML '' interim span innerHTML '' start img src 'mic slash gif' showInfo ( 'info allow' ) showButtons ( 'none' ) start timestamp event timeStamp function showInfo (s) if (s) for ( var child info firstChild child child child nextSibling) if (child style) child style display child id s 'inline' 'none' info style visibility 'visible' else info style visibility 'hidden' var current style function showButtons (style) if (style current style ) return current style style copy button style display style email button style display style copy info style display 'none' email info style display 'none' server js bin env node OpenShift sample Node application var express require( 'express' ) var fs require( 'fs' ) Define the sample application var SampleApp function () Scope var self this Helper functions Set up server IP address and port using env variables defaults self setupVariables function () Set the environment variables we need self ipaddress process env IP self port process env PORT 5000 if (typeof self ipaddress undefined ) self ipaddress 127 0 0 1 Populate the cache self populateCache function () if ( typeof self zcache undefined ) self zcache 'index html' '' Local cache for static content self zcache 'index html' fs readFileSync( ' index html' ) Retrieve entry (content) from cache param string key Key identifying content to retrieve from cache self cache get function (key) return self zcache key terminator the termination handler Terminate server on receipt of the specified signal param string sig Signal to terminate on self terminator function (sig) if ( typeof sig string ) console log( ' s Received s terminating sample app ' , Date ( Date now()), sig) process exit(1) console log( ' s Node server stopped ' , Date ( Date now()) ) Setup termination handlers (for exit and a list of signals) self setupTerminationHandlers function () Process on exit and signals process on( 'exit' , function () self terminator() ) Removed 'SIGPIPE' from the list bugz 852598 'SIGHUP' , 'SIGINT' , 'SIGQUIT' , 'SIGILL' , 'SIGTRAP' , 'SIGABRT' , 'SIGBUS' , 'SIGFPE' , 'SIGUSR1' , 'SIGSEGV' , 'SIGUSR2' , 'SIGTERM' forEach( function (element, index, array) process on(element, function () self terminator(element) ) ) App server functions (main app logic here) Create the routing table entries handlers for the application self createRoutes function () self routes self routes ' feedback' function (req, res) console log( Received a customer feedback req body feedback ) res send( WTCU Feedback Thanks for your feedback ) self routes ' ' function (req, res) res setHeader( 'Content Type' , 'text html' ) res send(self cache get( 'index html' ) ) Initialize the server (express) and create the routes and register the handlers self initializeServer function () self createRoutes() self app express createServer() self app express () self app set( 'port' , process env PORT 5000) self app set( 'ip' , process env IP 127 0 0 1 ) self app use( express static( dirname)) self app use(express bodyParser()) self app use( express json()) self app use( express urlencoded()) Add handlers for the app (from the routes) for ( var r in self routes ) self app get(r, self routes r ) maps the HTTP GET request self app post(r, self routes r ) maps the HTTP POST request Initializes the sample application self initialize function () self setupVariables() self populateCache() self setupTerminationHandlers() Create the express server and routes self initializeServer() Start the server (starts up the sample application) self start function () Start the app on the specific interface (and port) self app listen(self app get( 'port' ), function () console log( ' s Node server started on s d ' , Date ( Date now() ), self app get( 'ip' ), self app get( 'port' )) ) Sample Application main() Main code var zapp new SampleApp () zapp initialize() zapp start() ", "question_description": "

*Questions 1 - 3 are based on the original index.html source code provided by the instructor. Questions 4 5 are based on the server.js source code.<\/p>

<\/p>

Question 1: What type of variable is langs<\/strong>, is it an integer, a float, a boolean, a string, or an array?<\/p>

<\/p>

<\/p>

<\/p>

<\/p>

<\/p>

<\/p>

Question 2: What do you think webkitSpeechRecognition<\/strong> is on line 225? Do you think this mysterious thing exists only in Chrome web browser? Why?<\/p>

<\/p>

<\/p>

<\/p>

<\/p>

<\/p>

<\/p>

Question 3: What do you think the recognition<\/strong> variable is? How many events and their corresponding handlers are registered with this object? What are they?<\/p>

<\/p>

<\/p>

<\/p>

<\/p>

<\/p>

<\/p>

Question 4: Can you point out where the in the server.js file the feedback is logged in the Node server console? (You can type the code out or give the line number.)<\/p>

<\/p>

<\/p>

<\/p>

<\/p>

<\/p>

<\/p>

<\/p>

Question 5: What do I need to change if I want this web application to run on localhost port 3333 instead of port 5000? (Which line to change? How will you change it?)<\/p>

<\/p>

index.html<\/p>

html<\/strong>> <meta<\/strong> charset=<\/strong>\"utf-8\"<\/strong>> <title<\/strong>>Web Speech API Demonstration<\/title<\/strong>> <style<\/strong>> *<\/strong> { font-family<\/strong>: Verdana<\/strong>, Arial<\/strong>, sans-serif<\/strong>; } a<\/strong>:link<\/strong> { color<\/strong>:#000<\/strong>; text-decoration<\/strong>: none<\/strong>; } a<\/strong>:visited<\/strong> { color<\/strong>:#000<\/strong>; } a<\/strong>:hover<\/strong> { color<\/strong>:#33F<\/strong>; } .button<\/strong> { background<\/strong>: -webkit-linear-gradient<\/strong>(top<\/strong>,#008dfd<\/strong> 0,#0370ea<\/strong> 100%); border<\/strong>: 1px solid<\/strong> #076bd2<\/strong>; border-radius<\/strong>: 3px<\/strong>; color<\/strong>: #fff<\/strong>; display<\/strong>: none<\/strong>; font-size<\/strong>: 13px<\/strong>; font-weight<\/strong>: bold<\/strong>; line-height<\/strong>: 1.3; padding<\/strong>: 8px<\/strong> 25px<\/strong>; text-align<\/strong>: center<\/strong>; text-shadow<\/strong>: 1px<\/strong> 1px<\/strong> 1px<\/strong> #076bd2<\/strong>; letter-spacing<\/strong>: normal<\/strong>; } .center<\/strong> { padding<\/strong>: 10px<\/strong>; text-align<\/strong>: center<\/strong>; } .final<\/strong> { color<\/strong>: black<\/strong>; padding-right<\/strong>: 3px<\/strong>; } .interim<\/strong> { color<\/strong>: gray<\/strong>; } .info<\/strong> { font-size<\/strong>: 14px<\/strong>; text-align<\/strong>: center<\/strong>; color<\/strong>: #777<\/strong>; display<\/strong>: none<\/strong>; } .right<\/strong> { float<\/strong>: right<\/strong>; } .sidebyside<\/strong> { display<\/strong>: inline-block<\/strong>; width<\/strong>: 45%; min-height<\/strong>: 40px<\/strong>; text-align<\/strong>: left<\/strong>; vertical-align<\/strong>: top<\/strong>; } #headline<\/strong> { font-size<\/strong>: 40px<\/strong>; font-weight<\/strong>: 300; } #info<\/strong> { font-size<\/strong>: 20px<\/strong>; text-align<\/strong>: center<\/strong>; color<\/strong>: #777<\/strong>; visibility<\/strong>: hidden<\/strong>; } #results<\/strong> { font-size<\/strong>: 14px<\/strong>; font-weight<\/strong>: bold<\/strong>; border<\/strong>: 1px solid<\/strong> #ddd<\/strong>; padding<\/strong>: 15px<\/strong>; text-align<\/strong>: left<\/strong>; min-height<\/strong>: 150px<\/strong>; } #start_button<\/strong> { border<\/strong>: 0; background-color<\/strong>:transparent<\/strong>; padding<\/strong>: 0; } <\/style<\/strong>> <h1<\/strong> class=<\/strong>\"center\"<\/strong> id=<\/strong>\"headline\"<\/strong>> <a<\/strong> href=<\/strong>\"http:\/\/dvcs.w3.org\/hg\/speech-api\/raw-file\/tip\/speechapi.html\"<\/strong>> Wake Tech Credit Union (WTCU) Customer Feedback<\/a<\/strong>><\/h1<\/strong>> <div<\/strong> id=<\/strong>\"info\"<\/strong>> <p<\/strong> id=<\/strong>\"info_start\"<\/strong>>We would like to hear from you.<\/p<\/strong>> <p<\/strong> id=<\/strong>\"info_speak_now\"<\/strong>>Speak now.<\/p<\/strong>> <p<\/strong> id=<\/strong>\"info_no_speech\"<\/strong>>No speech was detected. You may need to adjust your <a<\/strong> href=<\/strong>\"\/\/support.google.com\/chrome\/bin\/answer.py?hl=en<\/strong>&<\/strong>answer=1407892\"<\/strong>> microphone settings<\/a<\/strong>>.<\/p<\/strong>> <p<\/strong> id=<\/strong>\"info_no_microphone\"<\/strong> style=<\/strong>\"<\/strong>display<\/strong>:none\"<\/strong>> No microphone was found. Ensure that a microphone is installed and that <a<\/strong> href=<\/strong>\"\/\/support.google.com\/chrome\/bin\/answer.py?hl=en<\/strong>&<\/strong>answer=1407892\"<\/strong>> microphone settings<\/a<\/strong>> are configured correctly.<\/p<\/strong>> <p<\/strong> id=<\/strong>\"info_allow\"<\/strong>>Click the \"Allow\" button above to enable your microphone.<\/p<\/strong>> <p<\/strong> id=<\/strong>\"info_denied\"<\/strong>>Permission to use microphone was denied.<\/p<\/strong>> <p<\/strong> id=<\/strong>\"info_blocked\"<\/strong>>Permission to use microphone is blocked. To change, go to chrome:\/\/settings\/contentExceptions#media-stream<\/p<\/strong>> <p<\/strong> id=<\/strong>\"info_upgrade\"<\/strong>>Web Speech API is not supported by this browser. Upgrade to <a<\/strong> href=<\/strong>\"\/\/www.google.com\/chrome\"<\/strong>>Chrome<\/a<\/strong>> version 25 or later.<\/p<\/strong>> <\/div<\/strong>> <div<\/strong> class=<\/strong>\"right\"<\/strong>> <button<\/strong> id=<\/strong>\"start_button\"<\/strong> onclick=<\/strong>\"<\/strong>startButton<\/em>(event<\/em><\/strong>)\"<\/strong>> <img<\/strong> id=<\/strong>\"start_img\"<\/strong> src=<\/strong>\"mic.gif\"<\/strong> alt=<\/strong>\"Start\"<\/strong>><\/button<\/strong>> <\/div<\/strong>> <div<\/strong> id=<\/strong>\"results\"<\/strong>> <span<\/strong> id=<\/strong>\"final_span\"<\/strong> class=<\/strong>\"final\"<\/strong>><\/span<\/strong>> <span<\/strong> id=<\/strong>\"interim_span\"<\/strong> class=<\/strong>\"interim\"<\/strong>><\/span<\/strong>> <p<\/strong>> <\/div<\/strong>> <div<\/strong> class=<\/strong>\"center\"<\/strong>> <div<\/strong> class=<\/strong>\"sidebyside\"<\/strong> style=<\/strong>\"<\/strong>text-align<\/strong>:right\"<\/strong>> <button<\/strong> id=<\/strong>\"copy_button\"<\/strong> class=<\/strong>\"button\"<\/strong> onclick=<\/strong>\"<\/strong>copyButton<\/em>()\"<\/strong>> Copy and Paste<\/button<\/strong>> <div<\/strong> id=<\/strong>\"copy_info\"<\/strong> class=<\/strong>\"info\"<\/strong>> Press Control-C to copy text.<br<\/strong>>(Command-C on Mac.) <\/div<\/strong>> <\/div<\/strong>> <div<\/strong> class=<\/strong>\"sidebyside\"<\/strong>> <button<\/strong> id=<\/strong>\"email_button\"<\/strong> class=<\/strong>\"button\"<\/strong> onclick=<\/strong>\"<\/strong>emailButton<\/em>()\"<\/strong>> Create Email<\/button<\/strong>> <div<\/strong> id=<\/strong>\"email_info\"<\/strong> class=<\/strong>\"info\"<\/strong>> Text sent to default email application.<br<\/strong>> (See chrome:\/\/settings\/handlers to change.) <\/div<\/strong>> <\/div<\/strong>> <p<\/strong>> <div<\/strong> id=<\/strong>\"div_language\"<\/strong>> <select<\/strong> id=<\/strong>\"select_language\"<\/strong> onchange=<\/strong>\"<\/strong>updateCountry<\/em>()\"<\/strong>><\/select<\/strong>> <\/strong> <select<\/strong> id=<\/strong>\"select_dialect\"<\/strong>><\/select<\/strong>> <\/div<\/strong>> <\/div<\/strong>> <script<\/strong>> var<\/strong> langs<\/em><\/strong> = [['Afrikaans'<\/strong>, ['af-ZA'<\/strong>]], ['Bahasa Indonesia'<\/strong>,['id-ID'<\/strong>]], ['Bahasa Melayu'<\/strong>, ['ms-MY'<\/strong>]], ['Catal'<\/strong>, ['ca-ES'<\/strong>]], ['etina'<\/strong>, ['cs-CZ'<\/strong>]], ['Deutsch'<\/strong>, ['de-DE'<\/strong>]], ['English'<\/strong>, ['en-AU'<\/strong>, 'Australia'<\/strong>], ['en-CA'<\/strong>, 'Canada'<\/strong>], ['en-IN'<\/strong>, 'India'<\/strong>], ['en-NZ'<\/strong>, 'New Zealand'<\/strong>], ['en-ZA'<\/strong>, 'South Africa'<\/strong>], ['en-GB'<\/strong>, 'United Kingdom'<\/strong>], ['en-US'<\/strong>, 'United States'<\/strong>]], ['Espaol'<\/strong>, ['es-AR'<\/strong>, 'Argentina'<\/strong>], ['es-BO'<\/strong>, 'Bolivia'<\/strong>], ['es-CL'<\/strong>, 'Chile'<\/strong>], ['es-CO'<\/strong>, 'Colombia'<\/strong>], ['es-CR'<\/strong>, 'Costa Rica'<\/strong>], ['es-EC'<\/strong>, 'Ecuador'<\/strong>], ['es-SV'<\/strong>, 'El Salvador'<\/strong>], ['es-ES'<\/strong>, 'Espaa'<\/strong>], ['es-US'<\/strong>, 'Estados Unidos'<\/strong>], ['es-GT'<\/strong>, 'Guatemala'<\/strong>], ['es-HN'<\/strong>, 'Honduras'<\/strong>], ['es-MX'<\/strong>, 'Mxico'<\/strong>], ['es-NI'<\/strong>, 'Nicaragua'<\/strong>], ['es-PA'<\/strong>, 'Panam'<\/strong>], ['es-PY'<\/strong>, 'Paraguay'<\/strong>], ['es-PE'<\/strong>, 'Per'<\/strong>], ['es-PR'<\/strong>, 'Puerto Rico'<\/strong>], ['es-DO'<\/strong>, 'Repblica Dominicana'<\/strong>], ['es-UY'<\/strong>, 'Uruguay'<\/strong>], ['es-VE'<\/strong>, 'Venezuela'<\/strong>]], ['Euskara'<\/strong>, ['eu-ES'<\/strong>]], ['Franais'<\/strong>, ['fr-FR'<\/strong>]], ['Galego'<\/strong>, ['gl-ES'<\/strong>]], ['Hrvatski'<\/strong>, ['hr_HR'<\/strong>]], ['IsiZulu'<\/strong>, ['zu-ZA'<\/strong>]], ['slenska'<\/strong>, ['is-IS'<\/strong>]], ['Italiano'<\/strong>, ['it-IT'<\/strong>, 'Italia'<\/strong>], ['it-CH'<\/strong>, 'Svizzera'<\/strong>]], ['Magyar'<\/strong>, ['hu-HU'<\/strong>]], ['Nederlands'<\/strong>, ['nl-NL'<\/strong>]], ['Norsk bokml'<\/strong>, ['nb-NO'<\/strong>]], ['Polski'<\/strong>, ['pl-PL'<\/strong>]], ['Portugus'<\/strong>, ['pt-BR'<\/strong>, 'Brasil'<\/strong>], ['pt-PT'<\/strong>, 'Portugal'<\/strong>]], ['Romn'<\/strong>, ['ro-RO'<\/strong>]], ['Slovenina'<\/strong>, ['sk-SK'<\/strong>]], ['Suomi'<\/strong>, ['fi-FI'<\/strong>]], ['Svenska'<\/strong>, ['sv-SE'<\/strong>]], ['Trke'<\/strong>, ['tr-TR'<\/strong>]], [''<\/strong>, ['bg-BG'<\/strong>]], ['P'<\/strong>, ['ru-RU'<\/strong>]], [''<\/strong>, ['sr-RS'<\/strong>]], ['<\/strong><\/strong>'<\/strong>, ['ko-KR'<\/strong>]], ['<\/strong><\/strong>'<\/strong>, ['cmn-Hans-CN'<\/strong>, '<\/strong><\/strong><\/strong> (<\/strong><\/strong><\/strong>)'<\/strong>], ['cmn-Hans-HK'<\/strong>, '<\/strong><\/strong><\/strong> (<\/strong><\/strong>)'<\/strong>], ['cmn-Hant-TW'<\/strong>, '<\/strong><\/strong> (<\/strong><\/strong>)'<\/strong>], ['yue-Hant-HK'<\/strong>, '<\/strong><\/strong> (<\/strong><\/strong>)'<\/strong>]], ['<\/strong><\/strong>'<\/strong>, ['ja-JP'<\/strong>]], ['Lingua latna'<\/strong>, ['la'<\/strong>]]]; for<\/strong> (var<\/strong> i<\/em><\/strong> = 0; i<\/em><\/strong> < langs<\/em><\/strong>.length; i<\/em><\/strong>++) { select_language.options[i<\/em><\/strong>] = new<\/strong> Option<\/em><\/strong>(langs<\/em><\/strong>[i<\/em><\/strong>][0], i<\/em><\/strong>); } select_language.selectedIndex<\/strong> = 6; updateCountry<\/em>(); select_dialect.selectedIndex<\/strong> = 6; showInfo<\/em>('info_start'<\/strong>); function<\/strong> updateCountry<\/em>() { for<\/strong> (var<\/strong> i = select_dialect.options.length - 1; i >= 0; i--) { select_dialect.remove(i); } var<\/strong> list = langs<\/em><\/strong>[select_language.selectedIndex<\/strong>]; for<\/strong> (var<\/strong> i = 1; i < list.length<\/strong>; i++) { select_dialect.options.add(new<\/strong> Option<\/em><\/strong>(list[i][1], list[i][0])); } select_dialect.style.visibility = list[1].length<\/strong> == 1 ? 'hidden'<\/strong> : 'visible'<\/strong>; } var<\/strong> create_email<\/em><\/strong> = false<\/strong>; var<\/strong> final_transcript<\/em><\/strong> = ''<\/strong>; var<\/strong> recognizing<\/em><\/strong> = false<\/strong>; var<\/strong> ignore_onend<\/em><\/strong>; var<\/strong> start_timestamp<\/em><\/strong>; if<\/strong> (!('webkitSpeechRecognition'<\/strong> in<\/strong> window<\/em><\/strong>)) { upgrade<\/em>(); } else<\/strong> { start_button.style.display = 'inline-block'<\/strong>; var<\/strong> recognition<\/em><\/strong> = new<\/strong> webkitSpeechRecognition(); recognition<\/em><\/strong>.continuous<\/strong> = true<\/strong>; recognition<\/em><\/strong>.interimResults<\/strong> = true<\/strong>; recognition<\/em><\/strong>.onstart = function<\/strong>() { recognizing<\/em><\/strong> = true<\/strong>; showInfo<\/em>('info_speak_now'<\/strong>); start_img.src<\/strong> = 'mic-animate.gif'<\/strong>; }; recognition<\/em><\/strong>.onerror = function<\/strong>(event) { if<\/strong> (event.error<\/strong> == 'no-speech'<\/strong>) { start_img.src<\/strong> = 'mic.gif'<\/strong>; showInfo<\/em>('info_no_speech'<\/strong>); ignore_onend<\/em><\/strong> = true<\/strong>; } if<\/strong> (event.error<\/strong> == 'audio-capture'<\/strong>) { start_img.src<\/strong> = 'mic.gif'<\/strong>; showInfo<\/em>('info_no_microphone'<\/strong>); ignore_onend<\/em><\/strong> = true<\/strong>; } if<\/strong> (event.error<\/strong> == 'not-allowed'<\/strong>) { if<\/strong> (event.timeStamp - start_timestamp<\/em><\/strong> < 100) { showInfo<\/em>('info_blocked'<\/strong>); } else<\/strong> { showInfo<\/em>('info_denied'<\/strong>); } ignore_onend<\/em><\/strong> = true<\/strong>; } }; recognition<\/em><\/strong>.onend = function<\/strong>() { recognizing<\/em><\/strong> = false<\/strong>; if<\/strong> (ignore_onend<\/em><\/strong>) { return<\/strong>; } start_img.src<\/strong> = 'mic.gif'<\/strong>; if<\/strong> (!final_transcript<\/em><\/strong>) { showInfo<\/em>('info_start'<\/strong>); return<\/strong>; } showInfo<\/em>(''<\/strong>); if<\/strong> (window<\/em><\/strong>.getSelection) { window<\/em><\/strong>.getSelection().removeAllRanges(); var<\/strong> range = document<\/em><\/strong>.createRange(); range.selectNode(document<\/em><\/strong>.getElementById('final_span'<\/strong>)); window<\/em><\/strong>.getSelection().addRange(range); } if<\/strong> (create_email<\/em><\/strong>) { create_email<\/em><\/strong> = false<\/strong>; createEmail<\/em>(); } }; recognition<\/em><\/strong>.onresult = function<\/strong>(event) { var<\/strong> interim_transcript = ''<\/strong>; for<\/strong> (var<\/strong> i = event.resultIndex; i < event.results.length<\/strong>; ++i) { if<\/strong> (event.results[i].isFinal) { final_transcript<\/em><\/strong> += event.results[i][0].transcript; } else<\/strong> { interim_transcript += event.results[i][0].transcript; } } final_transcript<\/em><\/strong> = capitalize<\/em>(final_transcript<\/em><\/strong>); final_span.innerHTML<\/strong> = linebreak<\/em>(final_transcript<\/em><\/strong>); interim_span.innerHTML<\/strong> = linebreak<\/em>(interim_transcript); if<\/strong> (final_transcript<\/em><\/strong> || interim_transcript) { showButtons<\/em>('inline-block'<\/strong>); } }; } function<\/strong> upgrade<\/em>() { start_button.style.visibility = 'hidden'<\/strong>; showInfo<\/em>('info_upgrade'<\/strong>); } var<\/strong> two_line<\/em><\/strong> = \/ \/g; var<\/strong> one_line<\/em><\/strong> = \/ \/g; function<\/strong> linebreak<\/em>(s) { return<\/strong> s.replace(two_line<\/em><\/strong>, '

<\/p>'<\/strong>).replace(one_line<\/em><\/strong>, ' '<\/strong>); } var<\/strong> first_char<\/em><\/strong> = \/\\S\/; function<\/strong> capitalize<\/em>(s) { return<\/strong> s.replace(first_char<\/em><\/strong>, function<\/strong>(m) { return<\/strong> m.toUpperCase(); }); } function<\/strong> createEmail<\/em>() { var<\/strong> n = final_transcript<\/em><\/strong>.indexOf('<\/strong> <\/strong>'<\/strong>); if<\/strong> (n < 0 || n >= 80) { n = 40 + final_transcript<\/em><\/strong>.substring(40).indexOf(' '<\/strong>); } var<\/strong> subject = encodeURI<\/em>(final_transcript<\/em><\/strong>.substring(0, n)); var<\/strong> body = encodeURI<\/em>(final_transcript<\/em><\/strong>.substring(n + 1)); window<\/em><\/strong>.location.href = 'mailto:?subject='<\/strong> + subject + '&body='<\/strong> + body; } function<\/strong> copyButton<\/em>() { if<\/strong> (recognizing<\/em><\/strong>) { recognizing<\/em><\/strong> = false<\/strong>; recognition<\/em><\/strong>.stop(); } copy_button.style.display = 'none'<\/strong>; copy_info.style.display = 'inline-block'<\/strong>; showInfo<\/em>(''<\/strong>); } function<\/strong> emailButton<\/em>() { if<\/strong> (recognizing<\/em><\/strong>) { create_email<\/em><\/strong> = true<\/strong>; recognizing<\/em><\/strong> = false<\/strong>; recognition<\/em><\/strong>.stop(); } else<\/strong> { createEmail<\/em>(); } email_button.style.display = 'none'<\/strong>; email_info.style.display = 'inline-block'<\/strong>; showInfo<\/em>(''<\/strong>); } function<\/strong> startButton<\/em>(event) { if<\/strong> (recognizing<\/em><\/strong>) { recognition<\/em><\/strong>.stop(); return<\/strong>; } final_transcript<\/em><\/strong> = ''<\/strong>; recognition<\/em><\/strong>.lang<\/strong> = select_dialect.value<\/strong>; recognition<\/em><\/strong>.start(); ignore_onend<\/em><\/strong> = false<\/strong>; final_span.innerHTML<\/strong> = ''<\/strong>; interim_span.innerHTML<\/strong> = ''<\/strong>; start_img.src<\/strong> = 'mic-slash.gif'<\/strong>; showInfo<\/em>('info_allow'<\/strong>); showButtons<\/em>('none'<\/strong>); start_timestamp<\/em><\/strong> = event.timeStamp; } function<\/strong> showInfo<\/em>(s) { if<\/strong> (s) { for<\/strong> (var<\/strong> child = info.firstChild; child; child = child.nextSibling) { if<\/strong> (child.style) { child.style.display = child.id == s ? 'inline'<\/strong> : 'none'<\/strong>; } } info.style.visibility = 'visible'<\/strong>; } else<\/strong> { info.style.visibility = 'hidden'<\/strong>; } } var<\/strong> current_style<\/em><\/strong>; function<\/strong> showButtons<\/em>(style) { if<\/strong> (style == current_style<\/em><\/strong>) { return<\/strong>; } current_style<\/em><\/strong> = style; copy_button.style.display = style; email_button.style.display = style; copy_info.style.display = 'none'<\/strong>; email_info.style.display = 'none'<\/strong>; } <\/script<\/strong>><\/p>

server.js<\/p>

#!\/bin\/env node <\/em>\/\/ OpenShift sample Node application <\/em>var <\/strong>express <\/strong>= require('express'<\/strong>); var <\/strong>fs = require('fs'<\/strong>); \/** <\/em> * Define the sample application. <\/em> *\/ <\/em>var <\/strong>SampleApp <\/em>= function<\/strong>() { \/\/ Scope. <\/em> <\/em>var <\/strong>self = this<\/strong>; \/* ================================================================ *\/ <\/em> \/* Helper functions. *\/ <\/em> \/* ================================================================ *\/ <\/em>  \/** <\/em> * Set up server IP address and port # using env variables\/defaults. <\/em> *\/ <\/em> <\/em>self.setupVariables = function<\/strong>() { \/\/ Set the environment variables we need. <\/em> \/\/self.ipaddress = process.env.IP; <\/em> \/\/self.port = process.env.PORT || 5000; <\/em>  \/\/if (typeof self.ipaddress === \"undefined\") { <\/em> \/\/ self.ipaddress = \"127.0.0.1\"; <\/em> \/\/}; <\/em> <\/em>}; \/** <\/em> * Populate the cache. <\/em> *\/ <\/em> <\/em>self.populateCache = function<\/strong>() { if <\/strong>(typeof <\/strong>self.zcache <\/strong>=== \"undefined\"<\/strong>) { self.zcache <\/strong>= { 'index.html'<\/strong>: '' <\/strong>}; } \/\/ Local cache for static content. <\/em> <\/em>self.zcache<\/strong>['index.html'<\/strong>] = fs.readFileSync('.\/index.html'<\/strong>); }; \/** <\/em> * Retrieve entry (content) from cache. <\/em> * <\/em>@param <\/em>{string} key Key identifying content to retrieve from cache. <\/em> *\/ <\/em> <\/em>self.cache_get = function<\/strong>(key) { return <\/strong>self.zcache<\/strong>[key]; }; \/** <\/em> * terminator === the termination handler <\/em> * Terminate server on receipt of the specified signal. <\/em> * <\/em>@param <\/em>{string} sig Signal to terminate on. <\/em> *\/ <\/em> <\/em>self.terminator = function<\/strong>(sig){ if <\/strong>(typeof <\/strong>sig === \"string\"<\/strong>) { console<\/em>.log('%s: Received %s - terminating sample app ...'<\/strong>, Date<\/em>(Date<\/em>.now()), sig); process.exit(1); } console<\/em>.log('%s: Node server stopped.'<\/strong>, Date<\/em>(Date<\/em>.now()) ); }; \/** <\/em> * Setup termination handlers (for exit and a list of signals). <\/em> *\/ <\/em> <\/em>self.setupTerminationHandlers = function<\/strong>(){ \/\/ Process on exit and signals. <\/em> <\/em>process.on('exit'<\/strong>, function<\/strong>() { self.terminator(); }); \/\/ Removed 'SIGPIPE' from the list - bugz 852598. <\/em> <\/em>['SIGHUP'<\/strong>, 'SIGINT'<\/strong>, 'SIGQUIT'<\/strong>, 'SIGILL'<\/strong>, 'SIGTRAP'<\/strong>, 'SIGABRT'<\/strong>, 'SIGBUS'<\/strong>, 'SIGFPE'<\/strong>, 'SIGUSR1'<\/strong>, 'SIGSEGV'<\/strong>, 'SIGUSR2'<\/strong>, 'SIGTERM' <\/strong> <\/strong>].forEach(function<\/strong>(element, index, array) { process.on(element, function<\/strong>() { self.terminator(element); }); }); }; \/* ================================================================ *\/ <\/em> \/* App server functions (main app logic here). *\/ <\/em> \/* ================================================================ *\/ <\/em>  \/** <\/em> * Create the routing table entries + handlers for the application. <\/em> *\/ <\/em> <\/em>self.createRoutes = function<\/strong>() { self.routes <\/strong>= { }; self.routes<\/strong>['\/feedback'<\/strong>] = function<\/strong>(req, res) { console<\/em>.log(\"-- Received a customer feedback: [\" <\/strong>+ req.body.feedback + \"]\"<\/strong>); res.send(\"WTCU Feedback<\/title><\/head><body><div>Thanks for your feedback!<\/div><\/body><\/html>\"<\/strong>); }; self.<strong>routes<\/strong>[<strong>'\/'<\/strong>] = <strong>function<\/strong>(req, res) { res.setHeader(<strong>'Content-Type'<\/strong>, <strong>'text\/html'<\/strong>); res.send(self.cache_get(<strong>'index.html'<\/strong>) ); }; }; <em>\/** <\/em><em> * Initialize the server (express) and create the routes and register <\/em><em> * the handlers. <\/em><em> *\/ <\/em><em> <\/em>self.initializeServer = <strong>function<\/strong>() { self.createRoutes(); <em>\/\/self.app = express.createServer(); <\/em><em> <\/em>self.<strong>app <\/strong>= <strong>express<\/strong>(); self.<strong>app<\/strong>.set(<strong>'port'<\/strong>, process.env.PORT || 5000); self.<strong>app<\/strong>.set(<strong>'ip'<\/strong>, process.env.IP || <strong>\"127.0.0.1\"<\/strong>); self.<strong>app<\/strong>.use(<strong>express<\/strong>.static(__dirname)); <em>\/\/self.app.use(express.bodyParser()); <\/em><em> <\/em>self.<strong>app<\/strong>.use(<strong>express<\/strong>.json()); self.<strong>app<\/strong>.use(<strong>express<\/strong>.urlencoded()); <em>\/\/ Add handlers for the app (from the routes). <\/em><em> <\/em><strong>for <\/strong>(<strong>var <\/strong>r <strong>in <\/strong>self.<strong>routes<\/strong>) { self.<strong>app<\/strong>.get(r, self.<strong>routes<\/strong>[r]); <em>\/\/ maps the HTTP GET request <\/em><em> <\/em>self.<strong>app<\/strong>.post(r, self.<strong>routes<\/strong>[r]); <em>\/\/ maps the HTTP POST request <\/em><em> <\/em>} }; <em>\/** <\/em><em> * Initializes the sample application. <\/em><em> *\/ <\/em><em> <\/em>self.initialize = <strong>function<\/strong>() { self.setupVariables(); self.populateCache(); self.setupTerminationHandlers(); <em>\/\/ Create the express server and routes. <\/em><em> <\/em>self.initializeServer(); }; <em>\/** <\/em><em> * Start the server (starts up the sample application). <\/em><em> *\/ <\/em><em> <\/em>self.start = <strong>function<\/strong>() { <em>\/\/ Start the app on the specific interface (and port). <\/em><em> <\/em>self.<strong>app<\/strong>.listen(self.<strong>app<\/strong>.get(<strong>'port'<\/strong>), <strong>function<\/strong>() { <em>console<\/em>.log(<strong>'%s: Node server started on %s:%d ...'<\/strong>, <em>Date<\/em>(<em>Date<\/em>.now() ), self.<strong>app<\/strong>.get(<strong>'ip'<\/strong>), self.<strong>app<\/strong>.get(<strong>'port'<\/strong>)); }); }; }; <em>\/* Sample Application. *\/ <\/em> <em>\/** <\/em><em> * main(): Main code. <\/em><em> *\/ <\/em><strong>var <\/strong>zapp = <strong>new <\/strong><em>SampleApp<\/em>(); zapp.initialize(); zapp.start(); <\/pre>",
    "transcribed_text": "",
    "related_book": {
        "title": "Graph Database Modeling With Neo4j",
        "isbn": "B0BDWT2XLR, 979-8351798783",
        "edition": "2nd Edition",
        "authors": "Ajit Singh",
        "cover_image": "https:\/\/dsd5zvtm8ll6.cloudfront.net\/si.question.images\/book_images\/64ed80eccb8dc_47798.jpg",
        "uri": "\/textbooks\/graph-database-modeling-with-neo4j-2nd-edition-9798351798783",
        "see_more_uri": "\/textbooks\/computer-science-game-development-2480"
    },
    "question_posted": "2024-08-28 08:15:43",
    "step_by_step_answer": "The Answer is in the image, click to view ...",
    "students_also_viewed": [
        {
            "url": "\/use-the-information-for-merrill-corporation-from-be206-assume-that-for",
            "description": "Use the information for Merrill Corporation from BE206. Assume that for Moxey Corporation, the lessor, collectibility is reasonably predictable, there are no important uncertainties concerning costs,...",
            "stars": 3
        },
        {
            "url": "\/study-help\/modern-mathematical-statistics-with-applications\/b-show-that-if-f-is-continuous-at-each-1987132",
            "description": "=+ (b) Show that if F is continuous at each point of F-'A, then P[F(X) A] is at most the Lebesgue measure of A.",
            "stars": 3
        },
        {
            "url": "\/at-particular-axial-station-velocity-and-temperature-profiles-for",
            "description": "At a particular axial station, velocity and temperature profiles for laminar flow in a parallel plate channel have the form u(y) = 0.75[1  (y\/y o ) 2 ] T(y) = 5.0 + 95.66(y\/y o ) 2  47.83(y\/yo) 4...",
            "stars": 3
        },
        {
            "url": "\/study-help\/questions\/whos-decision-is-it-who-has-the-option-to-convert-10106568",
            "description": "Whos decision is it (who has the option) to convert preferred stock?",
            "stars": 3
        },
        {
            "url": "\/study-help\/questions\/part-a-you-can-use-stata-when-you-answer-the-4983032",
            "description": "PART A: You can use STATA when you answer the following questions when it's helpful. 1. (15 points) Consider the response function E{Y} = 25 + 3X 1 + 4X2 + 1.5X1X2. Draw a conditional effects plot of...",
            "stars": 3
        },
        {
            "url": "\/study-help\/business-essentials\/an-etf-is-a-a-contract-that-gives-a-buyer-1326770",
            "description": "An ETF is a. a contract that gives a buyer the right to buy or sell a security at a specified price on or before a certain date. b. an agreement between a buyer and seller to buy an asset at a later...",
            "stars": 3
        },
        {
            "url": "\/study-help\/business-essentials\/treasury-notes-are-bonds-that-mature-in-2-3-5-1326767",
            "description": "Treasury notes are bonds that mature in 2, 3, 5, 7, and 10 years. True or False",
            "stars": 3.5
        },
        {
            "url": "\/study-help\/business-essentials\/if-you-own-a-5000-bond-that-has-a-coupon-1326772",
            "description": "If you own a $5,000 bond that has a coupon of 4 percent and pays interest semiannually, how much interest would you receive? a. $200 every six months b. $200 once a year c. $200 every two years d....",
            "stars": 3
        },
        {
            "url": "\/study-help\/computer-organization-design\/compare-the-resiliency-to-failure-of-ncube-to-a-fully-1157944",
            "description": "Compare the resiliency to failure of n-cube to a fully- connected interconnection network. Plot a comparison of reliability as a function of the added number of links for the two topologies. Refer to...",
            "stars": 3
        },
        {
            "url": "\/study-help\/statistical-techniques-in-business-\/write-the-kalman-filter-equations-for-an-operatornamear1-process-written-1409237",
            "description": "Write the Kalman filter equations for an \\(\\operatorname{AR}(1)\\) process written is state space form with \\(H_{t}=1, \\alpha_{t}=z_{t}\\) and \\(V_{t}=0, \\Omega_{t}=\\phi, R_{t}=\\sigma_{a}^{2}\\). Show...",
            "stars": 3.5
        },
        {
            "url": "\/study-help\/management-information-systems\/5-are-you-in-favor-of-legislation-enforcing-network-neutrality-2118127",
            "description": "5. Are you in favor of legislation enforcing network neutrality? Why or why not? What kind of Internet user are you? Do you primarily use the Net to do a little e-mail and online banking? Or are you...",
            "stars": 3.5
        },
        {
            "url": "\/study-help\/business-communication-essentials\/write-a-job-description-you-can-use-to-hire-a-2118113",
            "description": "Write a job description you can use to hire a word processing clerk to assist you with written projects.",
            "stars": 3.5
        },
        {
            "url": "\/study-help\/business-communication-essentials\/assume-that-you-accepted-another-position-the-week-after-the-2118112",
            "description": "Assume that you accepted another position the week after the scenario described in Application Exercise 12.Write a letter of resignation from your present job. (Objective 4)",
            "stars": 3.5
        }
    ],
    "next_back_navigation": {
        "previous": "\/study-help\/questions\/question-4-10-marks-prepare-two-estimates-of-pearsons-cost-8569834",
        "next": "\/study-help\/questions\/information-taken-from-warranty-cards-would-be-stored-in-which-8569836"
    },
    "breadcrumbs": [
        {
            "name": "Study help",
            "link": "https:\/\/www.solutioninn.com\/study-help\/questions-and-answers"
        },
        {
            "name": "Computer Science",
            "link": "https:\/\/www.solutioninn.com\/study-help\/questions-and-answers\/computer-science"
        },
        {
            "name": "Databases",
            "link": "https:\/\/www.solutioninn.com\/study-help\/questions\/computer-science-databases"
        },
        {
            "name": "*Questions 1 - 3 are based on the original index.html source code",
            "link": "https:\/\/www.solutioninn.com\/study-help\/questions\/questions-1-3-are-based-on-the-original-indexhtml-8569835"
        }
    ],
    "skill_details": {
        "skill_id": "656",
        "skill_name": "Databases",
        "parent_id": "8"
    }
}