MarchQRShow

 

FileDepart
package march.io;

import java.io.*;

public class FileDepart {

    public static void main(String[] args) throws Exception{
        String sourceFile = "C:\\Users\\Administrator\\Desktop\\xpath\\run.zip";
        String descDir = "C:\\Users\\Administrator\\Desktop\\xpath\\runDepart";
        int blockSize = 512;

        byte[] fileData = readFile(sourceFile);
        int eIndex = 0;int sIndex = 0;int fileName = 0;
        while (eIndex!=fileData.length-1){
            fileName++;
            eIndex = fileName*blockSize-1;
            if(eIndex>fileData.length-1){
                eIndex=fileData.length-1;
            }
            byte[] outputData = new byte[eIndex-sIndex+1];
            for(int i=0;i<outputData.length;i++){
                outputData[i] = fileData[sIndex+i];
            }
            System.out.println((fileData.length-1)+" "+eIndex);
            writeFileBlock(descDir,fileName,outputData);
            sIndex= eIndex+1;
        }
    }

    public static byte[] readFile(String fileName) throws Exception{
        FileInputStream fileInputStream = new FileInputStream(fileName);
        DataInputStream dataInputStream = new DataInputStream(fileInputStream);
        byte[] res = new byte[dataInputStream.available()];
        dataInputStream.readFully(res);
        fileInputStream.close();
        return res;
    }

    public static void writeFileBlock(String savePath,int blockName,byte[] data) throws Exception{
        String fileString = blockName+" "+bytesToHexString(data);

        File file = new File(savePath+"/"+blockName+".txt");
        if(!file.exists()){
            file.createNewFile();
        }
        FileWriter fileWriter = new FileWriter(file);
        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
        bufferedWriter.write(fileString);
        bufferedWriter.close();
    }

    public static String bytesToHexString(byte[] src){
        StringBuilder stringBuilder = new StringBuilder("");
        if (src == null || src.length <= 0) {
            return null;
        }
        for (int i = 0; i < src.length; i++) {
            int v = src[i] & 0xFF;
            String hv = Integer.toHexString(v);
            if (hv.length() < 2) {
                stringBuilder.append(0);
            }
            stringBuilder.append(hv);
        }
        return stringBuilder.toString();
    }

    public static byte[] hexStringToBytes(String hexString) {
        if (hexString == null || hexString.equals("")) {
            return null;
        }
        hexString = hexString.toUpperCase();
        int length = hexString.length() / 2;
        char[] hexChars = hexString.toCharArray();
        byte[] d = new byte[length];
        for (int i = 0; i < length; i++) {
            int pos = i * 2;
            d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
        }
        return d;
    }

    private static byte charToByte(char c) {
        return (byte) "0123456789ABCDEF".indexOf(c);
    }
}
QRShow
package march.io;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.HashMap;
import java.util.Map;

public class QRShow extends JFrame {
    private String _sourcePath;
    private int _qrCodeSizeW = 800;
    private int _qrCodeSizeH = 800;
    JTextField textField = new JTextField("0",20);
    ImagePanel imagePanel = null;

    public static void main(String[] args){
        String sourcePath ="C:\\Users\\Administrator\\Desktop\\xpath\\runDepart";
        int qrCodeSizeW = 1000;
        int qrCodeSizeH = 1000;
        QRShow q = new QRShow(sourcePath,qrCodeSizeW,qrCodeSizeH);
    }

    public QRShow(String sourcePath,int qrCodeSizeW,int qrCodeSizeH){
        this._sourcePath = sourcePath;
        this._qrCodeSizeW = qrCodeSizeW;
        this._qrCodeSizeH = qrCodeSizeH;
        imagePanel = new ImagePanel(this);
        init();
        this.setSize(new Dimension(800,600));
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        this.setVisible(true);
    }

    public void init(){
        this.setLayout(new BorderLayout(10,5));
        JPanel panel = new JPanel();
        panel.setLayout(new GridLayout(20,1));
        final JButton btnNext = new JButton("->");
        final JButton btnPre = new JButton("<-");
        panel.add(textField);
        panel.add(btnPre);
        panel.add(btnNext);
        this.add(panel,BorderLayout.EAST);
        this.add(imagePanel,BorderLayout.CENTER);
        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
            public void eventDispatched(AWTEvent event) {
                if(event.getID()==KeyEvent.KEY_PRESSED){
                    switch (((KeyEvent)event).getKeyCode()) {
                        case KeyEvent.VK_RIGHT:
                            btnNext.doClick();
                            break;
                        case KeyEvent.VK_LEFT:
                            btnPre.doClick();
                            break;
                    }
                }
            }
        }, AWTEvent.KEY_EVENT_MASK);

        btnNext.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                showQr(true);
            }
        });
        btnPre.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                showQr(false);
            }
        });
    }

    public void showQr(boolean next){
        try{
            int blockName = Integer.parseInt(this.textField.getText());
            blockName = next?(blockName+1):(blockName-1);
            imagePanel.displayBlock(blockName);
            this.textField.setText(blockName+"");
        }catch (Exception e){
            //e.printStackTrace();
        }
    }

    public class ImagePanel extends JPanel{
        public Image image;
        private QRShow _qrShow;

        ImagePanel(QRShow qrShow){
            _qrShow = qrShow;
        }

        public void displayBlock(int blockName){
            String filePath = _sourcePath+"/"+blockName+".txt";
            File file = new File(filePath);
            if(file.exists()){
                try {
                    FileReader fileReader = new FileReader(file);
                    BufferedReader bufferedReader = new BufferedReader(fileReader);
                    String dataString = bufferedReader.readLine();
                    bufferedReader.close();
                    this.image = getBarCode(dataString);
                    this.repaint();
                    _qrShow.setTitle(blockName+"");
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }else{
                _qrShow.setTitle("-------");
            }
        }

        public Image getBarCode(String fileString){
            try {
                Map<EncodeHintType,String> map =new HashMap<EncodeHintType, String>();
                map.put(EncodeHintType.CHARACTER_SET,"UTF-8");
                map.put(EncodeHintType.MARGIN,"0");
                BitMatrix bitMatrix = new MultiFormatWriter().encode(fileString, BarcodeFormat.QR_CODE,_qrCodeSizeW,_qrCodeSizeH,map);
                BufferedImage bufferedImage = MatrixToImageWriter.toBufferedImage(bitMatrix);
                return bufferedImage;
            }catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        public void paint(Graphics graphics){
            super.paint(graphics);
            graphics.drawImage(image,0,0,this.getSize().height,this.getSize().height,null);
        }
    }
}

pom

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>march.io</groupId>
    <artifactId>march-qrcode</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>com.google.zxing</groupId>
            <artifactId>core</artifactId>
            <version>3.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.zxing</groupId>
            <artifactId>javase</artifactId>
            <version>3.3.0</version>
        </dependency>
    </dependencies>
</project>

 

(Mathcad+Simulink仿真)基于扩展描述函数法的LLC谐振变换器小信号分析设计内容概要:本文围绕“基于扩展描述函数法的LLC谐振变换器小信号分析设计”展开,结合Mathcad与Simulink仿真工具,系统研究LLC谐振变换器的小信号建模方法。重点利用扩展描述函数法(Extended Describing Function Method, EDF)对LLC变换器在非线性工作条件下的动态特性进行线性化近似,建立适用于频域分析的小信号模型,并通过Simulink仿真验证模型准确性。文中详细阐述了建模理论推导过程,包括谐振腔参数计算、开关网络等效处理、工作模态分析及频响特性提取,最后通过仿真对比验证了该方法在稳定性分析与控制器设计中的有效性。; 适合人群:具备电力电子、自动控制理论基础,熟悉Matlab/Simulink和Mathcad工具,从事开关电源、DC-DC变换器或新能源变换系统研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①掌握LLC谐振变换器的小信号建模难点与解决方案;②学习扩展描述函数法在非线性系统线性化中的应用;③实现高频LLC变换器的环路补偿与稳定性设计;④结合Mathcad进行公式推导与参数计算,利用Simulink完成动态仿真验证。; 阅读建议:建议读者结合Mathcad中的数学推导与Simulink仿真模型同步学习,重点关注EDF法的假设条件与适用范围,动手复现建模步骤和频域分析过程,以深入理解LLC变换器的小信号行为及其在实际控制系统设计中的应用。
基于蚂蚁优化算法的柔性车间调度研究(Python代码实现)内容概要:本文围绕基于蚂蚁优化算法的柔性车间调度问题展开研究,利用Python代码实现该算法在柔性车间调度中的应用。通过构建数学模型,定义工序约束与资源分配规则,采用蚂蚁优化算法模拟工件在不同机器上的加工顺序,以最小化最大完工时间(makespan)为目标,提升车间调度效率与资源利用率。文中详细阐述了算法的设计思路、关键步骤及代码实现过程,包括信息素更新机制、路径选择策略和调度结果可视化,展示了蚂蚁优化算法在解决复杂组合优化问题上的有效性与实用性。; 适合人群:具备一定Python编程基础和运筹优化背景的高校学生、科研人员及智能制造领域的工程技术人员,尤其适合从事生产调度、智能算法研究的相关从业者; 使用场景及目标:①学习并掌握蚂蚁优化算法的基本原理及其在柔性车间调度中的具体应用;②通过实际代码实现理解智能优化算法的编程逻辑与调试方法;③为解决现实生产环境中复杂的调度问题提供算法参考与技术支撑; 阅读建议:建议读者结合文中代码逐行理解算法实现细节,配合测试不同规模的算例以观察算法性能变化,同时可尝试将算法扩展至多目标调度或与其他元启发式算法进行对比分析,以深化对智能优化方法的理解与应用能力。
已经博主授权,源码转载自 https://pan.quark.cn/s/637afac216e2 fw-mini-crawler fw-mini-crawler是一整套java爬虫框架. 核心模块有爬虫引擎、爬虫任务、爬虫下载器、爬虫解析器、爬虫处理器、爬虫存储器、 爬虫校验器、数据过滤器、数据格式化等。 整个爬虫框架完全模块化设计,对于框架的每一个节点都可以进行自定义扩展,拥有超强的可扩展能力。 核心概念说明 功能特性 支持分布式网络爬虫。 基于java注解的实现方式。 同时支持HttpClient和浏览器方式爬取数据。 支持html、json、xml等爬取数据解析方式。 采用类css selector方式的字段注解选择器。 爬虫任务可存储于本地内存、数据库、redis等。 针对爬取文件可自动存储到本地、S3等。 针对爬取的数据可自动入库。 支持Ajax请求处理。 支持获取接口方式的分页数据。 支持获取页面点击分页按钮方式的分页数据。 支持针对爬取的数据进行数据格式化。 支持针对爬取的数据进行校验,以确定是否继续后面流程。 支持父子url之间的cookies、header、attribute等传递。 支持父子url之间爬取字段值的传递。 主要第三方依赖包 hutool jsoup selenium jexl3 lombok 爬取字段定义解析方式 json数据字段解析 ~~~ @JsonPath("result.records") private List list; ~~~ html数据字段解析 @HtmlText注解 (文本内容) ~~~ @HtmlCssPath(value = "tr>td:eq(0)") @HtmlText private String code;...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值