• Python 如何操作.dll 文件?

    import ctypes
    from ctypes import *
    dll=cdll.LoadLibrary('C:\xxx.dll')
    floatAdd=dll.floatAdd      #加载函数对象
    floatAdd.argtypes=[c_float,c_float]
    floatAdd.restype=c_float
    print floatAdd(1.4,3.45)

  • MySQL 中,order by 语句和 select 语句哪个先执行?

    这要看order by的位置 一般讲order by是最后执行的 如果它在sql语句的最后面 ,有先于select执行的例子可以发出来 一起探讨一下

  • 多个线程读写 zookeeper 节点上数据过程中,读操作需要加锁么?

    setData和getData在api中有好多同名的方法 你指的是哪一个?

  • 用 java 怎么写 multi-threaded client server chat?

    public class server implements Runnable {// 服务端
    static List socketList=new ArrayList();
    // 读取 In
    static Socket socket = null;
    static ServerSocket serverSocket = null;
    public server() {// 构造方法
    try {
    serverSocket = new ServerSocket(9999);
    } catch (IOException e) {
    e.printStackTrace();
    }
    }
    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    System.out.println("****服务端*****");
    server t = new server();
    int count = 0;
    while (true) {
    try {
    // System.out.println("端口9999等待被连接......");
    socket = serverSocket.accept();
    count++;
    System.out.println("第" + count + "个客户已连接");
    socketList.add(socket);
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    Print p = new Print(socket);
    Thread read = new Thread(t);
    Thread print = new Thread(p);
    read.start();
    print.start();
    }
    }
    @Override
    public void run() {
    // 重写run方法
    try {
    Thread.sleep(1000);
    BufferedReader in = new BufferedReader(new InputStreamReader(socket
    .getInputStream()));
    while (true) {
    String jieshou = in.readLine();
    System.out.println( jieshou);
    for (int i = 0; i < socketList.size(); i++) {
    Socket socket=socketList.get(i);
    PrintWriter out = new PrintWriter(socket.getOutputStream());
    if (socket!=this.socket) {
    out.println(jieshou);
    }else{
    out.println("(你)"+jieshou);
    }
    out.flush();
    }
    }
    } catch (Exception e) {

            e.printStackTrace();
        }
    }

    }
    class Print implements Runnable {
    static List socketList=new ArrayList();
    Scanner input = new Scanner(System.in);
    public Print(Socket s) {// 构造方法
    try {
    socketList.add(s);
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    @Override
    public void run() {
    try {
    Thread.sleep(1000);
    while (true) {
    String msg = input.next();
    for (int i = 0; i < socketList.size(); i++) {
    Socket socket=socketList.get(i);
    PrintWriter out = new PrintWriter(socket.getOutputStream());
    // System.out.println("对客户端说:");
    out.println("服务端说:"+msg);
    out.flush();
    }
    }
    } catch (Exception e) {
    // TODO: handle exception
    e.printStackTrace();
    }
    }
    }
    //client.java
    package Socket;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.Socket;
    import java.util.Scanner;
    public class client implements Runnable {// 客户端
    static Socket socket = null;
    Scanner input = new Scanner(System.in);
    static String name=null;
    public static void main(String[] args) {
    int x=(int)(Math.random()*100);
    client.name="client"+x;
    System.out.println("****客户端"+x+"*****");
    try {
    socket = new Socket("127.0.0.1", 9999);
    System.out.println("已经连上服务器了");
    } catch (Exception e) {
    e.printStackTrace();
    }
    client t = new client();
    Read r = new Read(socket);
    Thread print = new Thread(t);
    Thread read = new Thread(r);
    print.start();
    read.start();
    }
    @Override
    public void run() {
    try {
    Thread.sleep(1000);
    PrintWriter out = new PrintWriter(socket.getOutputStream());
    while (true) {
    String msg = input.next();
    out.println(name+"说:"+msg);
    out.flush();
    }
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    }
    class Read implements Runnable {
    static Socket socket = null;
    public Read(Socket socket) {
    this.socket = socket;
    }
    @Override
    public void run() {
    try {
    Thread.sleep(1000);
    BufferedReader in = new BufferedReader(new InputStreamReader(socket
    .getInputStream()));
    while (true) {
    System.out.println( in.readLine());
    }
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    }
    ————————————————
    原文链接:https://blog.csdn.net/qq_29606255/article/details/78679815

  • hadoop streaming,但是当-file 指定路径的 mapper.py,就报错?是什么原因?

    把整个命令贴一下

  • 请问通过 jdbc 精确查询 MySQL 数据库怎么写?

    public static void main(String[] args) {
    System.out.println("MySQL JDBC Example.");
    Connection conn = null;
    String url = "jdbc:mysql://...:3306/test?autoReconnect=true&useSSL=false";
    String driver = "com.mysql.jdbc.Driver";
    String userName = "root";
    String password = "XXXXXXXX";
    Statement stmt = null;
    ResultSet rs = null;
    try {
    Class.forName(driver);
    conn = DriverManager.getConnection(url, userName, password);
    stmt = conn.createStatement();
    String sql = "select * from AAA";
    rs = stmt.executeQuery(sql);
    while (rs.next()) {
    int id = rs.getInt("emp_id");
    String name = rs.getString("name");
    System.out.println("id = " + id + ", name = " + name);
    }
    // 关闭资源
    rs.close();
    stmt.close();
    conn.close();
    } catch (Exception e) {
    e.printStackTrace();
    } finally {
    if (rs != null) {
    try {
    rs.close();
    } catch (SQLException sqlEx) { } // ignore
    }
    if (stmt != null) {
    try {
    stmt.close();
    } catch (SQLException sqlEx) { } // ignore
    }
    }
    }

  • 请问 conda.exe 与 python.exe 区别大吗?

    不是一个东西 conda.exe是conda的环境启动 python.exe是启动python用的 这两个都没关系

  • Python 中 asyncio 与 gevent 有什么区别?

    gevent是第三方库,通过greenlet实现协程,其基本思路是:
    当一个greenlet遇到IO操作时,就自动切换到其他的greenlet,等到IO操作完成,再在适当的时候切换回来继续执行。
    asyncio是Python 3.4版本引入的标准库,直接内置了对异步IO的支持,不需要第三方的支持,
    asyncio的编程模型就是一个消息循环。我们从asyncio模块中直接获取一个EventLoop的引用,然后把需要执行的协程扔到EventLoop中执行,就实现了异步IO。很多异步io操作这两个库都可以用,只是他们在不同场景下的效率和易用性可能有区别,当然这个得进行深入的测试和研究,单就现在普通的场景来说 区别并不大

  • 多个线程读写 zookeeper 节点上数据过程中,读操作需要加锁么?

    setData和getData在api中有好多同名的方法 你指的是哪一个?

  • 请问通过 jdbc 精确查询 MySQL 数据库怎么写?

    public static void main(String[] args) {
    System.out.println("MySQL JDBC Example.");
    Connection conn = null;
    String url = "jdbc:mysql://...:3306/test?autoReconnect=true&useSSL=false";
    String driver = "com.mysql.jdbc.Driver";
    String userName = "root";
    String password = "XXXXXXXX";
    Statement stmt = null;
    ResultSet rs = null;
    try {
    Class.forName(driver);
    conn = DriverManager.getConnection(url, userName, password);
    stmt = conn.createStatement();
    String sql = "select * from AAA";
    rs = stmt.executeQuery(sql);
    while (rs.next()) {
    int id = rs.getInt("emp_id");
    String name = rs.getString("name");
    System.out.println("id = " + id + ", name = " + name);
    }
    // 关闭资源
    rs.close();
    stmt.close();
    conn.close();
    } catch (Exception e) {
    e.printStackTrace();
    } finally {
    if (rs != null) {
    try {
    rs.close();
    } catch (SQLException sqlEx) { } // ignore
    }
    if (stmt != null) {
    try {
    stmt.close();
    } catch (SQLException sqlEx) { } // ignore
    }
    }
    }

  • Java 成员变量有没有用 public 修饰的情景?

    一般的情况是成员变量不用public修饰,可以增加专门的get 和set方法来访问成员变量

  • Python 怎么创建高维数组最高效?

    直接用均匀分布创建

  • SQL-on-Hadoop 技术与数据库技术的差异在哪里?

    其实本质是一样的 只是实现方式不一样 为什么呢?因为存储不一样,传统数据库只在一台或是几台机器上,机器之间的数据都是整块存储的 比如一个表就存在一个服务器上,所以查询sql的时候是直接提到内存查找,SQL-on-Hadoop解决的是数据表存在hadoop集群上,因为hadoop的块存储可能会使一个表跨多台服务器,那查表的时候要在多台服务器上查询,同时不同的sql查询的逻辑也不一样,这就需要一个分布式的sql引擎,这就是SQL-on-Hadoop的核心思想

  • hdfs 里的数据块到底指的是 namenode 元信息还是 datanode 数据块?

    datanode 数据块

  • hdfs2.x 源码剖析里为什么会提交两次?

    啥地方写了 能发个地址或是截个图吗