Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

Feb 4, 2019

Quora - Những game như FIFA14 hay GTA5 được viết bằng ngôn ngữ lập trình nào?

Trả lời: Alec Menke, I've been programming for over 10 years.

Rockstar, nhà sản xuất của GTA V, đã tự xây dựng game engine độc quyền cho riêng mình, được gọi là Rockstar Advanced Game Engine (RAGE).
Tôi đoán rằng họ đã xây dựng game engine của mình bằng cách kết hợp C và C++,  và sau đó tiếp tục sử dụng C++ (có thể Javascript với V8) ở các tầng trên game engine để xây dựng các tính năng dành riêng cho từng trò chơi khác nhau.
Sau khi thực hiện nhiều tìm kiếm, nghiên cứu ở trên Internet, tôi có thể kết luận rằng luận điểm ban đầu của tôi đã đúng, tuy nhiên có lẽ họ cũng sử dụng C# trong các server nhiều người chơi của họ. Trong: ngôn ngữ nào đã được sử dụng để lập trình GTA IV?
Để biết thêm thông tin về cách họ mô hình hoá thành phố trong GTA, có thể đọc thêm câu trả lời của Manish Sharma.

Chú thích:
[1] Rockstar Advanced Game Engine
[2] Rockstar Advanced Game Engine
[3] Development of Grand Theft Auto V

Nguồn: https://qr.ae/TUrNil

Oct 3, 2018

Setup NODE.JS and NPM install behind a web proxy

Check your settings with:
npm config list

Settings behind a proxy:
npm config set registry http://registry.npmjs.org/
npm config set http-proxy http://username:password@ip:port
npm config set https-proxy http://username:password@ip:port
npm config set proxy http://username:password@ip:port
npm set strict-ssl false


Mar 15, 2018

React Native: Delete Installed Library

1. rnpm unlink package_name (if library with native content requires linking)
2. npm uninstall --save package_name 

Aug 16, 2016

Load Facebook SDK for JavaScript

<script>
    window.fbAsyncInit = function() {
        FB.init({
            appId    :    'your facebook app id',
            xfbml    :    true,
            version:    'v2.6'
        });
    };
    (function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s) [0];
        if (d.getElementById(id)) {return;}
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/sdk.js";
        fjs.parentNode.insertBefore(js, fjs);
    } (document, 'script', 'facebook-jssdk'));
</script>

Dec 22, 2015

JavaScript: Chuyển tiếng Việt có dấu sang không dấu

function change_alias(alias) {
    var str = alias;
    str = str.toLowerCase();
    str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g,"a");
    str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g,"e");
    str = str.replace(/ì|í|ị|ỉ|ĩ/g,"i");
    str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g,"o");
    str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g,"u");
    str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g,"y");
    str = str.replace(/đ/g,"d");
    str = str.replace(/!|@|%|\^|\*|\(|\)|\+|\=|\<|\>|\?|\/|,|\.|\:|\;|\'|\"|\&|\#|\[|\]|~|\$|_|`|-|{|}|\||\\/g," ");
    str = str.replace(/ + /g," ");
    str = str.trim();
    return str;
}

Dec 17, 2015

Chatbot with Mitsuku

You need never feel lonely again! Mitsuku is your new virtual friend and is here 24 hours a day just to talk to you. She learns by experience, so the more people talk to her, the smarter she becomes. She is friendly but will stand her ground if you start arguing with her. To begin talking to her, go to page: www.mitsuku.com
                                                                   Thanks Misuku for my test nodejs!

Read XML file into Node.js as a JSON

Installation:
npm install --save xml2js

Usage:
//Read XML
var returnJSONResults = function(baseName, queryName) {
    var XMLPath = "data.xml";
    var rawJSON = loadXMLDoc(XMLPath);
    function loadXMLDoc(filePath) {
        var fs = require('fs');
        var xml2js = require('xml2js');
        var json;
        try {
            var fileData = fs.readFileSync(filePath, 'ascii');
            var parser = new xml2js.Parser();
            parser.parseString(fileData.substring(0, fileData.length), function (err, result) {
                json = JSON.stringify(result);
                console.log(JSON.stringify(result));
            });
            console.log("File '" + filePath + "/ was successfully read.\n");
            return json;
        } catch (ex) {
            console.log(ex)
        }
    }
}();