`

CUPSPrintServiceProvider

    博客分类:
  • j2ee
阅读更多
/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
/** 
 * @author Igor A. Pyankov 
 */ 

package org.apache.harmony.x.print.cups;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Vector;

import javax.print.DocFlavor;
import javax.print.MultiDocPrintService;
import javax.print.PrintException;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.attribute.AttributeSet;

import org.apache.harmony.x.print.DefaultPrintService;
import org.apache.harmony.x.print.ipp.IppAttribute;
import org.apache.harmony.x.print.ipp.IppAttributeGroup;
import org.apache.harmony.x.print.ipp.IppClient;
import org.apache.harmony.x.print.ipp.IppOperation;
import org.apache.harmony.x.print.ipp.IppPrinter;
import org.apache.harmony.x.print.ipp.IppRequest;
import org.apache.harmony.x.print.ipp.IppResponse;


/*
 * The class extends PrintServiceLookup and is intended for
 * looking up CUPS/IPP printers
 * 
 * 1. The class allways looks printers on http://localhost:631
 *    This URL is default URL for default installation of CUPS server
 * 2. The class accepts two properties:
 *      print.cups.servers - a list of CUPS servers
 *      print.ipp.printers - a list of IPP printers 
 *                           (note, that CUPS printer is IPP printer too) 
 */
public class CUPSPrintServiceProvider extends PrintServiceLookup {
    private static String cupsdefault = "http://localhost:631";
    private static ArrayList services = new ArrayList();
    /*
     * 0 - no
     * 1 - more
     * 2 - more and more
     * ...
     */
    private static int verbose = 0;

    static {
        String verbose_property = (String) AccessController
                .doPrivileged(new PrivilegedAction() {
                    public Object run() {
                        return System.getProperty("print.cups.verbose");
                    }
                });
        if (verbose_property != null) {
            try {
                Integer v = new Integer(verbose_property);
                setVerbose(v.intValue());
            } catch (NumberFormatException e) {
                setVerbose(0);
            }

        }
    }

    public CUPSPrintServiceProvider() {
        super();
    }

    /*
     * The method returns array of URLs of CUPS servers
     */
    private static String[] getCUPSServersByProperty() {
        ArrayList cupslist = new ArrayList();
        cupslist.add(cupsdefault);

        String cupspath = (String) AccessController
                .doPrivileged(new PrivilegedAction() {
                    public Object run() {
                        return System.getProperty("print.cups.servers");
                    }
                });
        String pathsep = ",";
        if (cupspath != null && !cupspath.equals("")) {
            String[] cupss = cupspath.split(pathsep);
            for (int i = 0, ii = cupss.length; i < ii; i++) {
                if (!cupss[i].equals("")) {
                    try {
                        URI cupsuri = new URI(cupss[i]);
                        cupslist.add(cupsuri.toString());
                    } catch (URISyntaxException e) {
                        if (verbose > 0) {
                            System.err.println("CUPS url: " + cupss[i]);
                            e.printStackTrace();
                        } else {
                            // IGNORE bad URI exception
                        }
                    }
                }
            }
        }

        return (String[]) cupslist.toArray(new String[0]);
    }

    /*
     * The method returns array of URLs of IPP printers
     */
    private static String[] getIppPrintersByProperty() {
        ArrayList ipplist = new ArrayList();

        String ipppath = (String) AccessController
                .doPrivileged(new PrivilegedAction() {
                    public Object run() {
                        return System.getProperty("print.ipp.printers");
                    }
                });
        String pathsep = ","; //System.getProperty("path.separator");
        if (ipppath != null && !ipppath.equals("")) {
            String[] ipps = ipppath.split(pathsep);
            for (int i = 0, ii = ipps.length; i < ii; i++) {
                if (!ipps[i].equals("")) {
                    try {
                        URI cupsuri = new URI(ipps[i]);
                        ipplist.add(cupsuri.toString());
                    } catch (URISyntaxException e) {
                        if (verbose > 0) {
                            System.err.println("IPP url: " + ipps[i]);
                            e.printStackTrace();
                        } else {
                            // IGNORE bad URI exception
                        }
                    }
                }
            }
        }

        return (String[]) ipplist.toArray(new String[0]);
    }

    /*
     * @see javax.print.PrintServiceLookup#getDefaultPrintService()
     */
    public PrintService getDefaultPrintService() {
        synchronized (this) {
            String defaultService = findDefaultPrintService();

            if (defaultService != null) {
                PrintService service = getServiceStored(defaultService,
                        services);
                if (service != null) {
                    return service;
                }

                CUPSClient client;
                try {
                    client = new CUPSClient(defaultService);
                    service = new DefaultPrintService(defaultService, client);
                    services.add(service);
                    return service;
                } catch (PrintException e) {
                    // just ignore
                    e.printStackTrace();
                }
            }

            if (services.size() == 0) {
                getPrintServices();
            }
            if (services.size() > 0) {
                return (PrintService) services.get(0);
            }

        }
        return null;
    }

    /*
     * @see javax.print.PrintServiceLookup#getPrintServices()
     */
    public PrintService[] getPrintServices() {
        synchronized (this) {
            String[] serviceNames = findPrintServices();
            if (serviceNames == null || serviceNames.length == 0) {
                services.clear();
                return new PrintService[0];
            }

            ArrayList newServices = new ArrayList();
            for (int i = 0; i < serviceNames.length; i++) {
                PrintService service = getServiceStored(serviceNames[i],
                        services);
                if (service != null) {
                    newServices.add(service);
                } else if (getServiceStored(serviceNames[i], newServices) == null) {
                    try {
                        CUPSClient client = new CUPSClient(serviceNames[i]);

                        service = new DefaultPrintService(serviceNames[i],
                                client);
                        newServices.add(service);
                    } catch (PrintException e) {
                        // just ignore
                        e.printStackTrace();
                    }
                }
            }

            services.clear();
            services = newServices;
            return (services.size() == 0) ? new PrintService[0]
                    : (PrintService[]) services.toArray(new PrintService[0]);
        }
    }

    /*
     * find printers on particular CUPS server
     */
    private PrintService[] getCUPSPrintServices(String cups) {
        synchronized (this) {
            // just update static field 'services'
            findPrintServices();

            // next find services on server 'cups'
            String[] serviceNames = (String[]) findCUPSPrintServices(cups)
                    .toArray(new String[0]);
            if (serviceNames == null || serviceNames.length == 0) {
                return new PrintService[0];
            }

            // return only those are stored in field 'services'
            ArrayList newServices = new ArrayList();
            for (int i = 0; i < serviceNames.length; i++) {
                PrintService service = getServiceStored(serviceNames[i],
                        services);
                if (service != null) {
                    newServices.add(service);
                }
            }

            return (newServices.size() == 0) ? new PrintService[0]
                    : (PrintService[]) services.toArray(new PrintService[0]);
        }
    }

    /*
     * find printers on localhost only
     */
    public PrintService[] getPrintServicesOnLocalHost() {
        return getCUPSPrintServices(cupsdefault);
    }

    /*
     * find service which name is same as serviceName
     */
    private PrintService getServiceStored(String serviceName,
            ArrayList servicesList) {
        for (int i = 0; i < servicesList.size(); i++) {
            PrintService service = (PrintService) servicesList.get(i);
            if (service.getName().equals(serviceName)) {
                return service;
            }
        }
        return null;
    }

    /*
     * @see javax.print.PrintServiceLookup#getPrintServices(javax.print.DocFlavor
     *      , javax.print.attribute.AttributeSet)
     */
    public PrintService[] getPrintServices(DocFlavor flavor,
            AttributeSet attributes) {
        PrintService[] cupsservices = getPrintServices();
        if (flavor == null && attributes == null) {
            return cupsservices;
        }

        ArrayList requestedServices = new ArrayList();
        for (int i = 0; i < cupsservices.length; i++) {
            try {
                AttributeSet unsupportedSet = cupsservices[i]
                        .getUnsupportedAttributes(flavor, attributes);
                if (unsupportedSet == null) {
                    requestedServices.add(cupsservices[i]);
                }
            } catch (IllegalArgumentException iae) {
                // DocFlavor not supported by service, skiping.
            }
        }
        return (requestedServices.size() == 0) ? new PrintService[0]
                : (PrintService[]) requestedServices
                        .toArray(new PrintService[0]);
    }

    /*
     * @see javax.print.PrintServiceLookup#getMultiDocPrintServices(javax.print.DocFlavor[]
     *      , javax.print.attribute.AttributeSet)
     */
    public MultiDocPrintService[] getMultiDocPrintServices(DocFlavor[] flavors,
            AttributeSet attributes) {
        // No multidoc print services available, yet.
        return new MultiDocPrintService[0];
    }

    /*
     * find all printers
     */
    private static String[] findPrintServices() {
        ArrayList ippservices = new ArrayList();

        /*
         * First, find on localhost and servers from print.cups.servers property
         * and add them to full list
         */
        String[] cupses = CUPSPrintServiceProvider.getCUPSServersByProperty();
        for (int j = 0; j < cupses.length; j++) {
            ippservices.addAll(findCUPSPrintServices(cupses[j]));
        }

        /*
         * Then, check URLs from print.ipp.printers property and 
         * if is valid ipp printer add them to full list
         */
        String[] ippp = CUPSPrintServiceProvider.getIppPrintersByProperty();
        for (int j = 0; j < ippp.length; j++) {
            try {
                URI ippuri = new URI(ippp[j]);
                IppPrinter printer = new IppPrinter(ippuri);
                IppResponse response;

                response = printer.requestPrinterAttributes(
                        "printer-uri-supported", null);

                Vector gg = response
                        .getGroupVector(IppAttributeGroup.TAG_GET_PRINTER_ATTRIBUTES);
                if (gg != null) {
                    for (int i = 0, ii = gg.size(); i < ii; i++) {
                        IppAttributeGroup g = (IppAttributeGroup) gg.get(i);
                        int ai = g.findAttribute("printer-uri-supported");

                        if (ai >= 0) {
                            IppAttribute a = (IppAttribute) g.get(ai);
                            Vector v = a.getValue();
                            if (v.size() > 0) {
                                ippservices.add(new String((byte[]) v.get(0)));
                            }
                        }
                    }
                }
            } catch (Exception e) {
                if (verbose > 0) {
                    System.err.println("IPP url: " + ippp[j]);
                    e.printStackTrace();
                } else {
                    // IGNORE - connection refused due to no server, etc.
                }
            }
        }

        // return array of printers
        return (String[]) ippservices.toArray(new String[0]);
    }

    /*
     * find ipp printers on CUPS server 'cups'
     */
    public static ArrayList findCUPSPrintServices(String cups) {
        ArrayList ippservices = new ArrayList();

        URI cupsuri = null;
        IppClient c = null;
        IppRequest request;
        IppResponse response;
        IppAttributeGroup agroup;
        Vector va = new Vector();

        request = new IppRequest(1, 1, IppOperation.TAG_CUPS_GET_PRINTERS,
                "utf-8", "en-us");
        agroup = request.getGroup(IppAttributeGroup.TAG_OPERATION_ATTRIBUTES);
        va.add("printer-uri-supported".getBytes());
        agroup.add(new IppAttribute(IppAttribute.TAG_KEYWORD,
                "requested-attributes", va));

        try {
            cupsuri = new URI(cups);
            c = new IppClient(cupsuri);

            response = c.request(request.getBytes());

            Vector gg = response
                    .getGroupVector(IppAttributeGroup.TAG_GET_PRINTER_ATTRIBUTES);
            if (gg != null) {
                for (int i = 0, ii = gg.size(); i < ii; i++) {
                    IppAttributeGroup g = (IppAttributeGroup) gg.get(i);
                    int ai = g.findAttribute("printer-uri-supported");

                    if (ai >= 0) {
                        IppAttribute a = (IppAttribute) g.get(ai);
                        Vector v = a.getValue();
                        if (v.size() > 0) {
                            ippservices.add(new String((byte[]) v.get(0)));
                        }
                    }
                }
            }
        } catch (Exception e) {
            if (verbose > 0) {
                System.err.println("CUPS url: " + cups);
                System.err.println("CUPS uri: " + cupsuri);
                System.err.println("Ipp client: " + c);
                System.err.println(request.toString());
                e.printStackTrace();
            } else {
                // IGNORE - connection refused due to no server, etc.
            }
        }

        return ippservices;
    }

    /*
     * find default printer
     * At first, try to find default printer on CUPS servers and return first found 
     * If failed, return first found IPP printer
     * If failed return null
     */
    private static String findDefaultPrintService() {
        String serviceName = null;

        String[] cupses = CUPSPrintServiceProvider.getCUPSServersByProperty();
        for (int i = 0; i < cupses.length; i++) {
            try {
                URI cupsuri = new URI(cupses[i]);
                IppClient c = new IppClient(cupsuri);
                IppRequest request;
                IppResponse response;
                IppAttributeGroup agroup;
                Vector va = new Vector();

                request = new IppRequest(1, 1,
                        IppOperation.TAG_CUPS_GET_DEFAULT, "utf-8", "en-us");
                agroup = request
                        .getGroup(IppAttributeGroup.TAG_OPERATION_ATTRIBUTES);
                va.add("printer-uri-supported".getBytes());
                agroup.add(new IppAttribute(IppAttribute.TAG_KEYWORD,
                        "requested-attributes", va));

                response = c.request(request.getBytes());

                IppAttributeGroup g = response
                        .getGroup(IppAttributeGroup.TAG_GET_PRINTER_ATTRIBUTES);
                if (g != null) {
                    int ai = g.findAttribute("printer-uri-supported");

                    if (ai >= 0) {
                        IppAttribute a = (IppAttribute) g.get(ai);
                        Vector v = a.getValue();
                        if (v.size() > 0) {
                            serviceName = new String((byte[]) v.get(0));
                            break;
                        }
                    }
                }
            } catch (URISyntaxException e) {
                //e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (Exception e) {
                //e.printStackTrace();
            }
        }
        if (serviceName != null && !serviceName.equals("")) {
            return serviceName;
        }

        String[] ippp = CUPSPrintServiceProvider.getIppPrintersByProperty();
        for (int i = 0; i < ippp.length; i++) {
            try {
                URI ippuri = new URI(ippp[i]);
                IppClient c = new IppClient(ippuri);
                IppRequest request;
                IppResponse response;
                IppAttributeGroup agroup;
                Vector va = new Vector();

                request = new IppRequest(1, 1,
                        IppOperation.GET_PRINTER_ATTRIBUTES, "utf-8", "en-us");
                agroup = request
                        .getGroup(IppAttributeGroup.TAG_OPERATION_ATTRIBUTES);
                va.add("printer-uri-supported".getBytes());
                agroup.add(new IppAttribute(IppAttribute.TAG_KEYWORD,
                        "requested-attributes", va));

                response = c.request(request.getBytes());

                IppAttributeGroup g = response
                        .getGroup(IppAttributeGroup.TAG_GET_PRINTER_ATTRIBUTES);
                if (g != null) {
                    int ai = g.findAttribute("printer-uri-supported");

                    if (ai >= 0) {
                        IppAttribute a = (IppAttribute) g.get(ai);
                        Vector v = a.getValue();
                        if (v.size() > 0) {
                            serviceName = new String((byte[]) v.get(0));
                            break;
                        }
                    }
                }
            } catch (URISyntaxException e) {
                //e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (Exception e) {
                //e.printStackTrace();
            }
        }

        return serviceName;
    }

    public static int isVerbose() {
        return verbose;
    }

    public static void setVerbose(int newverbose) {
        CUPSPrintServiceProvider.verbose = newverbose;
        CUPSClient.setVerbose(newverbose);
    }
}
分享到:
评论

相关推荐

    node-v8.15.0-linux-s390x.tar.xz

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    Java基础知识总结(超详细整理).txt

    Java基础知识总结(超详细整理)

    ISO IEC 27021-2017 信息技术.安全技术.信息安全管理系统专业人员的能力要求.pdf

    ISO IEC 27021-2017 信息技术.安全技术.信息安全管理系统专业人员的能力要求.pdf

    2024年中国DFB激光器芯片行业研究报告.docx

    2024年中国DFB激光器芯片行业研究报告

    公开整理-ESG视角下的多期DID构建数据集(2009-2022年).xlsx

    详细介绍及样例数据:https://blog.csdn.net/li514006030/article/details/138510939

    红帆OA(医疗版)漏洞细节未授权SQL注入请求注入数据包

    红帆OA(医疗版)是**一款专为医疗机构设计的办公自动化软件,旨在提高医院和相关卫生机构的工作效率和管理效能**。其功能特点包括: 1. **日常办公管理**:提供医院日常行政办公所需的基本功能,如文档处理、通知公告、会议管理等。 2. **科室管理**:支持医院内部各科室的管理需求,包括人员管理、资源分配、绩效考核等。 3. **信息集成**:能够整合医院内部的各类信息系统,实现数据共享和业务协同。 4. **多样化的医院类型支持**:适用于不同类型和规模的医院,如大学附属教学医院、综合性医院、专科医院、民营医院和集团医院等。 5. **业务范围广泛**:涵盖行政办公、医务室管理、科研管理、护士排班管理、党政管理和医患关系管理等多个方面。 6. **综合业务管理平台**:结合了卫生主管部门的管理规范和众多行业特色应用,是符合医院行业特点的综合业务管理平台。 7. **丰富的成功案例**:拥有众多成功案例,是医院综合业务管理软件中应用最广泛的之一。 需要注意的是,尽管红帆OA(医疗版)提供了强大的功能和广泛的应用场景,但任何软件系统都可能存在一定的安全风险,例如SQL注入漏洞等。因

    网页制作基础学习--HTML+CSS常用代码.txt

    网页制作基础学习--HTML+CSS常用代码

    ECHO HCS-2810ES_3810ES 操作手册

    HCS-2810ES_3810ES 说明书

    2024-2030中国3-吗啉丙磺酸市场现状研究分析与发展前景预测报告.docx

    2024-2030中国3-吗啉丙磺酸市场现状研究分析与发展前景预测报告

    node-v4.6.2-x64.msi

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    node-v8.8.1-linux-arm64.tar.xz

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    QYResearch:2023年前10大高流量治疗系统企业占据全球98%的市场份额.docx

    QYResearch:2023年前10大高流量治疗系统企业占据全球98%的市场份额.docx

    0.Python实现3D建模工具(上)内含设计文档和源码.md

    0.Python实现3D建模工具(上)内含设计文档和源码.md

    node-v8.8.1-linux-x86.tar.xz

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    c语言文件读写操作代码

    c语言文件读写操作代码

    node-v9.8.0-linux-arm64.tar.xz

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    公开整理-ESG视角下的多期DID构建数据集(2009-2022年).dta

    详细介绍及样例数据:https://blog.csdn.net/li514006030/article/details/138510939

    MATLAB编程高效实战:涵盖核心数学、科学计算、数据可视化及算法应用,助力工程师与研究人员的必备函数代码集

    这款“matlab常用的函数代码”资源是您的最佳助手!它详细介绍了matlab中常用的函数代码,包括基本数学运算、数组创建和操作、控制流、数据导入和导出、绘图、数学函数以及字符串操作等。无论您是工程师、研究人员、学生还是matlab爱好者,这个资源都适合您。 资源以通俗易懂的语言,配合实例演示,帮助您更好地理解和掌握matlab编程的核心技巧。您可以在学习matlab的过程中,将其作为参考资料,随时查阅和巩固知识点。也可以在准备matlab项目或考试时,通过这个资源进行复习和提升。此外,这个资源还可以作为教学资料,辅助教学和学习。 这个资源的优势在于它的全面性和实用性。它不仅涵盖了matlab中的常用函数代码,还提供了一些实用的编程技巧和经验分享。通过学习这个资源,您将能够更加熟练地使用matlab,解决实际问题和项目挑战。 这款“matlab常用的函数代码”资源旨在帮助您快速掌握matlab编程的基本知识和技能,为您的学术和职业生涯提供坚实的支持。还等什么呢?快来学习这个资源,开启您的matlab编程之旅吧!

    node-v8.9.3-linux-s390x.tar.xz

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    validate_before_handin.py

    validate_before_handin

Global site tag (gtag.js) - Google Analytics