Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In
Continue with Google
Continue with Facebook
or use


Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here
Continue with Google
Continue with Facebook
or use


Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.


Have an account? Sign In Now

Sorry, you do not have a permission to ask a question, You must login to ask question.

Continue with Google
Continue with Facebook
or use


Forgot Password?

Need An Account, Sign Up Here

Sorry, you do not have a permission to ask a question, You must login to ask question.

Continue with Google
Continue with Facebook
or use


Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Stack Ask

Stack Ask Logo Stack Ask Logo

Stack Ask Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us

tvd12

Enlightened
Ask tvd12
9 Followers
65 Questions
Home/ tvd12/Best Answers
  • About
  • Questions
  • Answers
  • Best Answers
  • Asked Questions
  • Posts
  • Comments
  • Followers Questions
  • Followers Answers
  • Followers Posts
  • Followers Comments
  1. Asked: May 3, 2022In: Unity

    [Ezyfox Server] Làm sao để lấy thông tin user đang đăng nhập vào zone

    tvd12 Enlightened
    Added an answer on May 3, 2022 at 3:50 am

    1. Nếu tất cả user của em chung 1 room thì em có thể lấy user manager của app rồi gửi. 2. Nếu em muốn gửi tất cả user trong 1 zone không cùng app, em có thể lấy ra user manager của zone rồi gửi em ạ.

    1. Nếu tất cả user của em chung 1 room thì em có thể lấy user manager của app rồi gửi.

    2. Nếu em muốn gửi tất cả user trong 1 zone không cùng app, em có thể lấy ra user manager của zone rồi gửi em ạ.

    See less
    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  2. Asked: April 10, 2022In: Unity

    Lỗi khi chạy server của project EzySmashers

    tvd12 Enlightened
    Replied to answer on April 10, 2022 at 2:36 am

    Khả năng cao là em đang không dùng java 8?

    Khả năng cao là em đang không dùng java 8?

    See less
    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  3. Asked: March 13, 2022In: Spring

    Hỏi về đa luồng khi làm việc với Kafka Consumer

    tvd12 Enlightened
    Added an answer on March 13, 2022 at 1:52 pm

    1. Đầu tiên em phải hiểu cách mà Spring nó lấy record từ kafka như thế nào đã, em hãy nhìn vào KafkaTemplate em sẽ thấy mỗi 1 lần gọi receive nó sẽ lấy ra 1 record để xử lý 2. Tiếp theo cái spring.kafka.listener.concurrency=10 nó sẽ tác động vào ConcurrentMessageListenerContainer 3. Và cuối cùng làRead more

    1. Đầu tiên em phải hiểu cách mà Spring nó lấy record từ kafka như thế nào đã, em hãy nhìn vào KafkaTemplate em sẽ thấy mỗi 1 lần gọi receive nó sẽ lấy ra 1 record để xử lý
    2. Tiếp theo cái spring.kafka.listener.concurrency=10 nó sẽ tác động vào ConcurrentMessageListenerContainer
    3. Và cuối cùng là nó sẽ tác động vào lớp KafkaMessageListenerContainer

    Như vậy sẽ trả lời cho 2 câu hỏi của em như sau:

    1. Việc em tăng số lượng luồng thì sẽ lấy ra nhiều message khỏi kafka hơn. Từ đó mà sẽ có nhiều message được xử lý đồng thời hơn, và điều này là tốt nên không có nhược điểm gì em ạ, trừ khi dữ liệu của em ở các topic cần phải xử lý tuần tự thì nhược điểm là em sẽ phải code phức tạp để đảm để đảm bảo việc xử lý theo đứng thứ tự
    2. Cái này tuỳ vào tốc độ xử lý ở lớp listener của em, nếu nó xử lý nhanh thì không vấn đề gì, nhưng nếu mỗi topic lại xử lý khác nhau thì việc sử dụng số luồng tương ứng với số topic sẽ cho hiệu năng tốt hơn. Mỗi luồng trong java sẽ chiếm khoảng 2MB nên em tạo ra nhiều luồng sẽ tốn RAM, nên anh nghĩ em nên set số luồng = số topic là ổn em ạ.

    See less
    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  4. Asked: January 2, 2022In: Android

    Failed to resolve

    tvd12 Enlightened
    Added an answer on January 2, 2022 at 4:15 am

    Đây là do em chưa add dependency của stringee vào file build.gradle nhé: implementation group: 'com.stringee.sdk.android', name: 'stringee-android-sdk', version: '1.8.5'

    Đây là do em chưa add dependency của stringee vào file build.gradle nhé:

    implementation group: 'com.stringee.sdk.android', name: 'stringee-android-sdk', version: '1.8.5'
    
    See less
    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  5. Asked: December 10, 2021In: Blockchain

    Hỏi về Non-crypto blockchain

    tvd12 Enlightened
    Added an answer on December 10, 2021 at 2:08 pm

    1. Anh chưa hiểu câu hỏi của em lắm 2. Với mục đích học tập thì em không nhất thiết phải mua crypto, em có thể sử dụng Ropsten Test Networking là được em nhé 3. Nếu như theo ý hiểu của anh thì em muốn hỏi là: liệu rằng em tạo ra hệ thống blockchain để thay thế cho các hệ thống lưu trữ tiền tệ thôngRead more

    1. Anh chưa hiểu câu hỏi của em lắm
    2. Với mục đích học tập thì em không nhất thiết phải mua crypto, em có thể sử dụng Ropsten Test Networking là được em nhé
    3. Nếu như theo ý hiểu của anh thì em muốn hỏi là: liệu rằng em tạo ra hệ thống blockchain để thay thế cho các hệ thống lưu trữ tiền tệ thông thường có được không đúng không? Nếu câu hỏi của em đúng là vậy thì hiện nay blockchain cũng đang là một trong những lựa chọn hàng đầu cho Tiền điện tử của ngân hàng trung ương (Central Bank Digital Currency – CBDC) em có thể đọc để tham khảo thêm nhé
    4. Một blockchain không nhất thiết phải có crypto, em có thể tự viết ra 1 mạng chỉ phục vụ cho việc xác thực và lưu trữ hàng hoá thôi cũng OK kiểu như mấy cái ipfs này. Tuy nhiên ở giai đoạn này thì đa phần ai cũng muốn phát hành crypto để gọi vốn. Nếu em có nhà đầu tư không cần quan tâm crypto thì hãy thực hiện ý tương đó nhé

    See less
    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  6. Asked: December 5, 2021In: Java

    Câu hỏi MultiThread sử dụng cho bài toán đếm tăng dần

    tvd12 Enlightened
    Added an answer on December 5, 2021 at 4:14 am
    This answer was edited.

    1. Chương trình của em gặp vấn đề là sử dụng biến int count, nó không phải thread safe, dẫn đến bị sai 2. Các cách giải quyết Cách 1. Dùng join như em: public class MultiThreadCountingTest { static AtomicInteger count = new AtomicInteger(); public static void main(String[] args) throws Exception { iRead more

    1. Chương trình của em gặp vấn đề là sử dụng biến int count, nó không phải thread safe, dẫn đến bị sai
    2. Các cách giải quyết

    Cách 1. Dùng join như em:

    public class MultiThreadCountingTest {
        static AtomicInteger count = new AtomicInteger();
        
        public static void main(String[] args) throws Exception {
            int threadCount = 50;
            List list = new ArrayList();
            for (int i = 0; i  {
                    for (int i1 = 0; i1 < 200000; i1++) {
                        count.incrementAndGet();
                    }
                });
                th.start();
                list.add(th);
            }
            for (Thread thread : list) {
                thread.join();
            }
            System.out.println("Count: "+count);
        }
    }
    

    Cách 2. Dùng CountDownLatch:

    public class MultiThreadCountingTest {
        static AtomicInteger count = new AtomicInteger();
    
        public static void main(String[] args) throws Exception {
            int threadCount = 50;
            CountDownLatch countDownLatch = new CountDownLatch(threadCount);
            for (int i = 0; i  {
                    for (int i1 = 0; i1 < 200000; i1++) {
                        count.incrementAndGet();
                    }
                    countDownLatch.countDown();
                });
                th.start();
            }
            countDownLatch.await();
            System.out.println("Count: "+count);
        }
    }
    

    Cách 3. Dùng biến count thread done:

    public class MultiThreadCountingTest {
        static AtomicInteger count = new AtomicInteger();
    
        public static void main(String[] args) throws Exception {
            int threadCount = 50;
            AtomicInteger doneCount = new AtomicInteger();
            for (int i = 0; i  {
                    for (int i1 = 0; i1 < 200000; i1++) {
                        count.incrementAndGet();
                    }
                    doneCount.incrementAndGet();
                });
                th.start();
            }
            while (doneCount.get() != threadCount) {
                Thread.sleep(1);
            }
            System.out.println("Count: "+count);
        }
    }
    

    3. Join: Waits for this thread to die. An invocation of this method behaves in exactly the same way as the invocation join(0). Như vậy là nó sẽ phải đợi cho đến khi nào cái thread gọi join nó kết thúc em ạ.

    See less
    • 2
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  7. Asked: December 4, 2021In: .Netcore

    Giống và khác nhau giữa async await và multi thread trong c#

    tvd12 Enlightened
    Added an answer on December 4, 2021 at 2:34 pm
    This answer was edited.

    Hãy nhìn vào chương trình này nhé: class Program { public static void Main(string[] args) { Thread.CurrentThread.Name = "main"; Console.WriteLine("Start Thread: " + Thread.CurrentThread.Name); Hello().GetAwaiter().GetResult(); Console.WriteLine("End Thread: " + Thread.CurrentThread.Name); Thread.SleRead more

    Hãy nhìn vào chương trình này nhé:

    class Program
    {
        public static void Main(string[] args)
        {
            Thread.CurrentThread.Name = "main";
            Console.WriteLine("Start Thread: " + Thread.CurrentThread.Name);
            Hello().GetAwaiter().GetResult();
            Console.WriteLine("End Thread: " + Thread.CurrentThread.Name);
            Thread.Sleep(100);
        }
    
        public static async Task Hello()
        {
            Console.WriteLine("Current Thread at Start Hello: " + Thread.CurrentThread.Name);
            await Task.Run(() =>
            {
                Thread.CurrentThread.Name = "task";
                Console.WriteLine("Current Thread at Task: " + Thread.CurrentThread.Name);
                Console.WriteLine("Hello World");
            });
            Thread.CurrentThread.Name = "async";
            Console.WriteLine("Current Thread at End Hello: " + Thread.CurrentThread.Name);
        }
    }
    

    Và kết quả nó sẽ thế này:

    Start Thread: main
    Current Thread at Start Hello: main
    Current Thread at Task: task
    Hello World
    Current Thread at End Hello: async
    End Thread: main
    

    Như vậy có nghĩa là việc async await đang diễn ra trên các thread khác nhau, vậy nên theo quan điểm của anh thì trong C# async / await chẳng quan chỉ là 1 cách viết đơn giản hơn cho lập trình multi thread mà thôi.

    Em có thể tham khảo source code của lớp Task sẽ thấy là nó đang sử dụng kết hợp giữa thread pool và task queue.

    Đọc source code lớp threadpool anh đang thấy khởi tạo mặc định ban đầu max 32 thread:

    private const int INITIAL_SIZE = 32;
    internal volatile IThreadPoolWorkItem[] m_array = new IThreadPoolWorkItem[INITIAL_SIZE];
    private volatile int m_mask = INITIAL_SIZE - 1;
    
    See less
    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  8. Asked: November 26, 2021In: Anything

    Sử dụng IPFS để làm headless CMS cho blog?

    tvd12 Enlightened
    Added an answer on November 27, 2021 at 3:18 am

    Đầu tiên: Đây là một ý tưởng khá hay khi em có thể tận dụng các store kiểu IPFS mà không cần tổ chức DB và cũng không cần lo lắng việc sẽ bị mất dữ liệu khí máy chủ có vấn đề, nghĩa là nó sẽ giúp em không cần phải backup dữ liệu, tuy nhiên có 1 số nhược điểm thế này: 1. Em sẽ phải tổ chức dữ liệu khRead more

    Đầu tiên: Đây là một ý tưởng khá hay khi em có thể tận dụng các store kiểu IPFS mà không cần tổ chức DB và cũng không cần lo lắng việc sẽ bị mất dữ liệu khí máy chủ có vấn đề, nghĩa là nó sẽ giúp em không cần phải backup dữ liệu, tuy nhiên có 1 số nhược điểm thế này:

    1. Em sẽ phải tổ chức dữ liệu khác đi vì mọi thông tin của em bây giờ sẽ phải gói gọn trong 1 cái tạm gọi là transaction.
    2. Việc sửa đổi sẽ tương đương với việc em tạo 1 transaction mới chứ không sửa được trên dữ liệu cũ, vì các IPFS thường sử dụng blockchain. Như vậy em vẫn phải có database để quản lý rằng bài viết sẽ đang sử dụng version nào trên IPFS
    3. Tốc độ truy cập liệu có được đảm bảo không? Cái này anh không chắc, có thể em phải tự tổ chức 1 node IPFS của riêng mình để tốc độ truy cập được đảm bảo nhanh nhất, nhưng việc này lại gây ra tốn kém
    4. Không có gì đảm bảo rằng pinata sẽ tính phí trong tương lai gần, vì họ cũng phải lưu trữ hàng nghìn thậm chí hàng tỉ TB thì tiền ở đâu ra, không có bữa trưa nào miễn phí cả, và anh tin em sẽ sớm phải trả tiền cho chi phí dung lượng hoặc số lần gọi API

    Vậy nên phương án tốt nhất cho blog vẫn là sử dụng database thông thường và backup dữ liệu thường xuyên, chi phí cũng không đáng là bao mà đỡ phức tạp em ạ.

    See less
    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  9. Asked: November 25, 2021In: Programming

    Lựa chọn ngôn ngữ để làm việc

    tvd12 Enlightened
    Added an answer on November 26, 2021 at 1:00 am
    This answer was edited.

    1. Ngôn ngữ nào cũng có thị trường riêng và ở từng giai đoạn, từng công ty sẽ trả lương khác nhau cho mỗi loại ngôn ngữ khác nhau. Tuy nhiên về mặt bằng chung thì Java giờ đang nhỉnh hơn. Nhưng như vậy không có nghĩa là mọi công ty đều trả lương cho java cao hơn Node.js. Tất cả nó phụ thuộc vào nhuRead more

    1. Ngôn ngữ nào cũng có thị trường riêng và ở từng giai đoạn, từng công ty sẽ trả lương khác nhau cho mỗi loại ngôn ngữ khác nhau. Tuy nhiên về mặt bằng chung thì Java giờ đang nhỉnh hơn. Nhưng như vậy không có nghĩa là mọi công ty đều trả lương cho java cao hơn Node.js. Tất cả nó phụ thuộc vào nhu cầu của thị trường lao động và phụ thuộc vào năng lực cá nhân của em.

    2. Con người lúc nào cũng thế, luôn thấy đĩa cơm của người khác ngon hơn nhưng thực ra mỗi đĩa cơm lại có những món khác nhau, không thể so sánh được. Vậy nên em hãy chọn ngôn ngữ nào mà em cảm thấy thích, cảm thấy dễ tiếp cận và cảm thấy dễ trở thành chuyên gia được, em sẽ có mức lương cao hơn những người khác.

    3. Đừng học 2 ngôn ngữ 1 lúc, một ngày chỉ có 24 tiếng, theo đuổi 2 mục tiêu sẽ là cách tốt nhất để bắn trượt cả 2.

    4. Ngôn ngữ nào cũng vậy, em nên xin đi thực tập hoặc làm fresher, để vừa có lương mà lại vừa học hỏi được nhanh nhất.

    See less
    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  10. Asked: November 14, 2021In: CSS

    Cắt text bị dài trong thẻ span

    tvd12 Enlightened
    Added an answer on November 14, 2021 at 3:33 pm
    This answer was edited.

    Thêm 4 thuộc tính này: width: 100%; display: inline-block; overflow: hidden; text-overflow: ellipsis; Tham khảo: 1. Cắt cho 1 dòng: https://www.w3schools.com/cssref/css3_pr_text-overflow.asp 2. Cắt cho nhiều dòng: https://codepen.io/martinwolf/pen/qlFdp

    Thêm 4 thuộc tính này:

    width: 100%;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    

    Tham khảo:

    1. Cắt cho 1 dòng: https://www.w3schools.com/cssref/css3_pr_text-overflow.asp
    2. Cắt cho nhiều dòng: https://codepen.io/martinwolf/pen/qlFdp

    See less
    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
1 2 3 4

Sidebar

Ask A Question

Stats

  • Questions 581
  • Answers 1k
  • Best Answers 63
  • Users 299
  • Popular
  • Answers
  • monkey

    [Deep Learning] Làm thế nào để xác định được cái ...

    • 16 Answers
  • Tú Trần Anh

    [Ezyfox Server] Unity game client không gửi được command khi ...

    • 12 Answers
  • monkey

    [Go] khi nào go func được gọi?

    • 10 Answers
  • Nguyễn Thái Sơn
    Nguyễn Thái Sơn added an answer em cảm ơn, vậy mỗi câu truy vấn luôn có… June 24, 2022 at 4:31 pm
  • tvd12
    tvd12 added an answer Việc chuyển này cũng có nhiều khó khăn là nó… June 24, 2022 at 3:08 pm
  • tvd12
    tvd12 added an answer 1. Vì socket là giữ kết nối nên em sẽ… June 24, 2022 at 3:02 pm

Top Members

tvd12

tvd12

  • 65 Questions
  • 1k Points
Enlightened
monkey

monkey

  • 91 Questions
  • 620 Points
Enlightened
Nguyễn Thái Sơn

Nguyễn Thái Sơn

  • 148 Questions
  • 229 Points
Professional

Trending Tags

.net core abstract class analytics android ansible anti-flooding apache poi api async asyncawait atomicboolean backend backend nestjs bash script batch bean big project binding bitcoin blockchain blog boot-nodes branch british buffered build bundle c# cache caching callback career career path cast centos chat cloud cloud reliability commit company content-disposition contract cors cosmos css database datasource datastructure decentralized exchange deep learning design-pattern devops dex distraction programing docker download draw.io du học dữ liệu lớn eclip editor employee english erc20 erc721 eth ethereum ethereum login extensions exyfox ezyfox ezyfox-boot ezyfox-server ezyfoxserver ezyhttp facebook fe flutter freetank french front-end frontend fullstack fulltextsearch future game game-box game-room game-server get git go golang google grapql grpc guide hazelcast hibernate hibernateconfig html http https index indexing integration-test intellij interface interview io ipfs isolate issue it java javacore java core javascript java spring javaw java web job jpa js json jsp & servlet jvm jwt kafka keep promise kerberos keycloak kotlin language languague library load-balancing log log4j log4j-core login lưu trữ machine learning macos math maven merge messaging metamask microservice model mongo msgpack multiple tenant multithread multithreading mysql n naming naming convention netcore netty nft nft game nio nodejs non-blocking io opensource optimize orm pagination pancakeswap panic pgpool phỏng vấn pointer postgresql pre programming promise push message android python python unicode question queue rabbitmq reactive reactjs reactjs download recyclerview redis request resource rest roadmap ropssten ropsten rust rxjava schedule search security server shift jis singleton sjis slack smart contract socket soft delete sosanh spring spring-boot-test spring-jpa spring aop spring boot springboot spring data jpa spring redis spring security springsecurity springwebflux mysql sql sql server sse stackask storage stream structure trong spring boot system environment variables thread threadjava thymeleaf totp tracking location unit test unity upload file vector view volatile vue vue cli web3 web3 client webpack websocket windows 11 winforms work zookeeper

Footer

Stack Ask

Stack Ask is where Developers Ask & Answers. It will help you resolve any questions and connect you with other people.

About Us

  • Meet The Team
  • About Us
  • Contact Us

Legal Stuff

  • Terms of Service
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2021 Stack Ask. All Rights Reserved
Powered by youngmonkeys.org