React-Redux类似任务管理示例

概述:

基于React、Redux,参考官方示例,实现组件状态管理。

图示:
React-Redux类似任务管理示例_第1张图片

文件目录:

│  .babelrc
│  .eslintrc
│  package.json
│
├─config
│      webpack.config.js
│      webpack.production.config.js
│
├─public
└─src
    ├─company
    │  │  index.js
    │  │  index.tmpl.html
    │  │
    │  ├─actions
    │  │      items.js
    │  │      visible.js
    │  │
    │  ├─component
    │  │      Create.js
    │  │      Error.js
    │  │      Footer.js
    │  │      Header.js
    │  │      index.js
    │  │      Item.js
    │  │      ItemList.js
    │  │      Link.js
    │  │      RowLink.js
    │  │      style.js
    │  │      Title.js
    │  │
    │  ├─container
    │  │      CreateItem.js
    │  │      FilterLink.js
    │  │      VisibleItemList.js
    │  │
    │  └─reducers
    │          filter.js
    │          index.js
    │          items.js
    │
    └─static
        ├─css
        │      common.css
        │
        └─images
                180403.png
                favicon.png

package.json

{
  "name": "demos",
  "version": "1.0.0",
  "description": "demos",
  "main": "index.js",
  "scripts": {
    "eslint": "eslint --ext .js src",
    "eslint-fix": "eslint --fix src",
    "deves": "webpack-dev-server --open --mode development --config ./config/webpack.config.js",
    "build": "webpack --mode production --progress --config ./config/webpack.production.config.js"
  },
  "author": "HeJun",
  "license": "ISC",
  "repository": {
    "type": "git",
    "url": "git.nsecn.com"
  },
  "devDependencies": {
    "autoprefixer": "^8.4.1",
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.4",
    "babel-plugin-react-transform": "^3.0.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react": "^6.24.1",
    "babel-standalone": "^6.26.0",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-eslint": "^8.2.2",
    "babel-polyfill": "^6.26.0",
    "clean-webpack-plugin": "^0.1.19",
    "css-loader": "^0.28.11",
    "extract-text-webpack-plugin": "^4.0.0-beta.0",
    "file-loader": "^1.1.11",
    "html-loader": "^0.5.5",
    "html-webpack-plugin": "^3.1.0",
    "lodash": "^4.17.5",
    "postcss-loader": "^2.1.4",
    "react-transform-hmr": "^1.0.4",
    "style-loader": "^0.20.3",
    "uglifyjs-webpack-plugin": "^1.2.4",
    "url-loader": "^1.0.1",
    "webpack": "~4.5.0",
    "webpack-cli": "^2.0.13",
    "webpack-dev-server": "^3.1.1",
    "zip-webpack-plugin": "^3.0.0",
    "moment": "^2.22.0",
    "eslint": "^4.19.1",
    "eslint-plugin-import": "^2.10.0",
    "eslint-plugin-react": "^7.7.0"
  },
  "dependencies": {
    "prop-types": "^15.6.1",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "redux": "^4.0.0",
    "react-redux": "^5.0.7",
    "react-router-dom": "^4.2.2"
  }
}

.babelrc

{
  presets: ["env", "react"],
  "env": {
    "development": {
      "plugins": [
        [
          "react-transform", {
            "transforms": [
              {
                "transform": "react-transform-hmr",
                "imports": ["react"],
                "locals": ["module"]
              }
            ]
          }
        ],
        ["transform-object-rest-spread", {
          "useBuiltIns": true
        }]
      ]
    }
  }
}

webpack.config.js

const path = require('path');
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const base = path.join(__dirname, '..', 'src');
const dist = path.join(__dirname, '..', 'public');
const favicon = path.join(base, 'static', 'images', 'favicon.png');

// 常量
const company = 'company';

module.exports = {
    // 入口文件
    entry: {
        company: ['babel-polyfill', path.join(base, company, 'index.js')]
    },
    // 抽取公共JS
    optimization: {
        splitChunks: {
            cacheGroups: {
                vendor: {
                    test: /[\\/]node_modules[\\/]/,
                    name: 'common',
                    priority: 10,
                    chunks: 'all'
                }
            }
        }
    },
    output: {
        // 打包后文件路径
        path: path.join(dist),
        // 打包后输出文件
        filename: 'bundle.[name].[hash:8].js'
    },
    // 发布时设置为null
    devtool: 'eval-source-map',
    performance: {
        hints: false
    },
    devServer: {
        // 本地服务器加载的目录
        contentBase: path.join(dist),
        port: 8000,
        // 不跳转
        historyApiFallback: true,
        // 实时刷新
        inline: true
    },
    module: {
        rules: [
            {
                test: /(\.jsx|\.js)$/,
                use: {
                    loader: 'babel-loader'
                },
                exclude: /node_modules/
            },
            {
                test: /\.html$/,
                use: {
                    loader: 'html-loader?minimize=false'
                }
            },
            {
                test: /\.(png|jpe?g|gif|svg)$/,
                use: {
                    loader: 'url-loader?limit=1024&name=images/[hash:12].[ext]'
                }
            },
            {
                test: /\.css$/,
                use: [
                    {
                        loader: 'style-loader'
                    },
                    {
                        // 启用CSS模块
                        loader: 'css-loader',
                        options: {
                            module: true
                        }
                    },
                    {
                        // CSS类自动名称
                        loader: 'postcss-loader',
                        options: {
                            plugins: [
                                autoprefixer
                            ]
                        }
                    }
                ]
            }
        ]
    },
    plugins: [
        new webpack.BannerPlugin('DEMO COPYRIGHT'),
        new HtmlWebpackPlugin({
            chunks: ['common', company],
            template: path.join(base, company, 'index.tmpl.html'),
            filename: 'index.html',
            favicon: favicon
        }),
        // 热加载模块插件
        new webpack.HotModuleReplacementPlugin()
    ]
}

webpack.production.config.js

const path = require('path');
const moment = require('moment');
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CleanWebpackPlugin = require("clean-webpack-plugin");
const ZipPlugin = require('zip-webpack-plugin');

const base = path.join(__dirname, '..', 'src');
const dist = path.join(__dirname, '..', 'public');
const favicon = path.join(base, 'static', 'images', 'favicon.png');

// 常量
const company = 'company';

module.exports = {
    // 入口文件
    entry: {
        company: ['babel-polyfill', path.join(base, company, 'index.js')]
    },
    // 抽取公共JS
    optimization: {
        splitChunks: {
            cacheGroups: {
                vendor: {
                    test: /[\\/]node_modules[\\/]/,
                    name: 'common',
                    priority: 10,
                    chunks: 'all'
                }
            }
        }
    },
    output: {
        // 打包后文件路径
        path: path.join(dist),
        // 打包后输出文件
        filename: 'bundle.[name].[hash:8].js'
    },
    // 发布时设置为null
    devtool: 'null',
    performance: {
        hints: false
    },
    module: {
        rules: [
            {
                test: /(\.jsx|\.js)$/,
                use: {
                    loader: 'babel-loader'
                },
                exclude: /node_modules/
            },
            {
                test: /\.html$/,
                use: {
                    // 压缩HTML设置true
                    loader: 'html-loader?minimize=false'
                }
            },
            {
                test: /\.(png|jpe?g|gif|svg)$/,
                use: {
                    loader: 'url-loader?limit=1024&name=images/[hash:12].[ext]'
                }
            },
            {
                test: /\.css$/,
                use: [
                    {
                        loader: 'style-loader'
                    },
                    {
                        // 启用CSS模块
                        loader: 'css-loader',
                        options: {
                            module: true
                        }
                    },
                    {
                        // CSS类自动名称
                        loader: 'postcss-loader',
                        options: {
                            plugins: [
                                autoprefixer
                            ]
                        }
                    }
                ]
            }
        ]
    },
    plugins: [
        new webpack.BannerPlugin('DEMO COPYRIGHT'),
        new HtmlWebpackPlugin({
            chunks: ['common', company],
            template: path.join(base, company, 'index.tmpl.html'),
            filename: 'index.html',
            favicon: favicon
        }),
        // 热加载模块插件
        new webpack.HotModuleReplacementPlugin(),
        // 为组建分配ID
        new webpack.optimize.OccurrenceOrderPlugin(),
        // 压缩JS
        new UglifyJsPlugin({
            uglifyOptions: {
                compress: {
                    drop_console: true
                }
            }
        }),
        // 分离CSS[存在BUG]
        new ExtractTextPlugin('[name].[hash:10].css'),
        // 清除文件
        new CleanWebpackPlugin(['*'], {
            root: path.join(dist)
        }),
        // ZIP打包
        new ZipPlugin({
            path: path.join(dist),
            filename: 'Release-' + moment().format('YYHHmmss') + '.zip'
        })
    ]
}

common.css

/*!
 * Hon by 2018-05-02
 */
body {
    color: #526475;
    margin: 0px;
    padding: 0px;
    font-family: Monospaced Number, Chinese Quote, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif;
    font-size: 16px;
    font-weight: 300;
    width: 100%;
    background-color: #ffffff;
}

h1, h2, h3, h4, h5, h6 {
    color: #526475;
    font-weight: 300;
    display: block;
    margin-bottom: 20px;
    margin-top: 0px;
    white-space: nowrap;
}

h1 {
    font-size: 36px;
    line-height: 50px;
}

h2 {
    font-size: 32px;
    line-height: 46px;
}

h3 {
    font-size: 28px;
    line-height: 42px;
}

h4 {
    font-size: 24px;
    line-height: 38px;
}

h5 {
    font-size: 20px;
    line-height: 34px;
}

h6 {
    font-size: 16px;
    line-height: 30px;
}

.btn {
    font-family: 'Open Sans';
    font-size: 16px;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    text-align: center;
    text-decoration: none !important;
    line-height: 36px;
    margin: 5px;
    padding: 0 20px;
    display: inline-block;
    border-radius: 3px;
    transition: all 0.3s;
    color: #ffffff;
    border: 1px solid #09a0f6;
    white-space: nowrap;
    background-color: #09a0f6;
    outline: 0px;
    cursor: pointer;
}

.btn:hover {
    text-decoration: none;
    opacity: 0.8;
}

.btn:active {
    background-color: #0077e6;
    border-color: #0077e6;
    opacity:.8;
    -webkit-animation: buttonEffect .4s;
    animation: buttonEffect .4s;
}

.disable {
    font-family: 'Open Sans';
    font-size: 14px;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    margin: 5px;
    border-radius: 3px;
    transition: all 0.3s;
    color: #777777;
    background-color: #f7f7f7;
    white-space: nowrap;
    border: 1px solid #d9d9d9;
    outline: 0px;
    cursor: not-allowed;
}

.btn-small {
    font-size: 14px !important;
    line-height: 26px !important;
    padding: 0 12px !important;
}

.btn-clean {
    margin: 0px;
}

.form-input[type="text"], .form-input[type="password"], .form-input[type="number"], .form-input[type="email"] {
    font-size: 16px;
    display: inline-block;
    width: 100%;
    transition: all 0.3s;
    color: #526475;
    padding-left: 10px;
    padding-right: 10px;
    border: 1px solid #d1e1e8;
    border-radius: 3px;
    outline: 0px;
    box-sizing: border-box;
    height: 38px;
}

.form-input[type="text"]:focus, .form-input[type="password"]:focus, .form-input[type="number"]:focus, .form-input[type="email"]:focus {
    border: 1px solid #09a0f6;
}

.form-input[type="date"] {
    font-size: 16px;
    display: inline-block;
    width: 100%;
    transition: all 0.3s;
    color: #526475;
    padding: 10px;
    border: 1px solid #d1e1e8;
    border-radius: 5px;
    outline: 0px;
    box-sizing: border-box;
    width: auto !important;
    height: 40px;
}

.form-input[type="date"]:focus {
    border: 1px solid #09a0f6;
}

.form-input[disabled] {
    font-size: 16px;
    display: inline-block;
    width: 100%;
    transition: all 0.3s;
    color: #526475;
    padding: 10px;
    border: 1px solid #d1e1e8;
    border-radius: 5px;
    outline: 0px;
    box-sizing: border-box;
    cursor: not-allowed;
    background-color: #d1e1e8;
    height: 40px;
}

.form-input[disabled]:focus {
    border: 1px solid #09a0f6;
}

.form-input[type="submit"], .form-input[type="button"] {
    font-size: 16px;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    outline: none;
    text-align: center;
    text-decoration: none !important;
    line-height: 28px;
    margin-left: 5px;
    margin-right: 5px;
    margin: 5px;
    padding: 5px 25px;
    display: inline-block;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.3s;
    color: #ffffff;
    background-color: #09a0f6;
    border: 0px;
}

.form-input[type="submit"]:hover, .form-input[type="button"]:hover {
    text-decoration: none;
}

.form-input[type="submit"]:hover, .form-input[type="button"]:hover {
    opacity: 0.8;
}

.form-select {
    font-size: 16px;
    display: inline-block;
    width: 100%;
    transition: all 0.3s;
    color: #526475;
    padding: 10px;
    margin: 5px;
    border: 1px solid #d1e1e8;
    border-radius: 5px;
    outline: 0px;
    box-sizing: border-box;
    padding-top: 6px;
    height: 40px;
    background-color: #ffffff;
}

.form-select:focus {
    border: 1px solid #09a0f6;
}

.form-textarea {
    font-size: 16px;
    display: inline-block;
    width: 100%;
    transition: all 0.3s;
    color: #526475;
    padding: 10px;
    margin: 5px;
    border: 1px solid #d1e1e8;
    border-radius: 5px;
    outline: 0px;
    box-sizing: border-box;
    resize: vertical;
}

.form-textarea:focus {
    border: 1px solid #09a0f6;
}

@media (max-width: 960px) {
    .grid {
        width: 94%;
    }
}

.row {
    display: inline-block;
    width: 100%;
    margin: 10px 0px;
}

.row:after {
    content: " ";
    clear: both;
    display: table;
    line-height: 0;
}

.col-1 {
    width: 6.33%;
    display: inline-block;
    vertical-align: top;
    float: left;
    padding: 1%;
}

.col-2 {
    width: 14.66%;
    display: inline-block;
    vertical-align: top;
    float: left;
    padding: 1%;
}

.col-3 {
    width: 22.99%;
    display: inline-block;
    vertical-align: top;
    float: left;
    padding: 1%;
}

.col-4 {
    width: 31.33%;
    display: inline-block;
    vertical-align: top;
    float: left;
    padding: 1%;
    white-space: nowrap;
}

.col-5 {
    width: 39.66%;
    display: inline-block;
    vertical-align: top;
    float: left;
    padding: 1%;
}

.col-6 {
    width: 47.99%;
    display: inline-block;
    vertical-align: top;
    float: left;
    padding: 1%;
}

.col-7 {
    width: 56.33%;
    display: inline-block;
    vertical-align: top;
    float: left;
    padding: 1%;
}

.col-8 {
    width: 64.66%;
    display: inline-block;
    vertical-align: top;
    float: left;
    padding: 1%;
}

.col-9 {
    width: 72.99%;
    display: inline-block;
    vertical-align: top;
    float: left;
    padding: 1%;
}

.col-10 {
    width: 81.33%;
    display: inline-block;
    vertical-align: top;
    float: left;
    padding: 1%;
}

.col-11 {
    width: 89.66%;
    display: inline-block;
    vertical-align: top;
    float: left;
    padding: 1%;
}

.col-12 {
    width: 97.99%;
    display: inline-block;
    vertical-align: top;
    float: left;
    padding: 1%;
}

@media (max-width: 400px) {
    .col-1 {
        width: 98%;
    }

    .col-2 {
        width: 98%;
    }

    .col-3 {
        width: 98%;
    }

    .col-4 {
        width: 98%;
    }

    .col-5 {
        width: 98%;
    }

    .col-6 {
        width: 98%;
    }

    .col-7 {
        width: 98%;
    }

    .col-8 {
        width: 98%;
    }

    .col-9 {
        width: 98%;
    }

    .col-10 {
        width: 98%;
    }

    .col-11 {
        width: 98%;
    }

    .col-12 {
        width: 98%;
    }
}

.table {
    display: table;
    width: 100%;
    border-width: 0px;
    border-collapse: collapse;
    color: #526475;
    margin-top: 0px;
    margin-bottom: 20px;
}

.table thead tr th {
    font-weight: 500;
    border: 1px solid #d1e1e8;
    padding: 8px 12px;
    background-color: #fcfcfc;
    border-left: none;
    border-right: none;
    white-space: nowrap;
    text-align: left;
}

.table tr td {
    border: 1px solid #d1e1e8;
    border-left: none;
    border-right: none;
    padding: 10px;
    white-space: nowrap;
}

.center {
    text-align: center;
}

.alert {
    display: block;
    font-size: 16px;
    text-align: left;
    padding: 6px 10px;
    margin-top: 5px;
    border-radius: 2px;
    border: 1px solid;
    background-color: #E1F5FE;
    color: #03A9F4;
    border-color: #03A9F4;
}

.alert a {
    text-decoration: none;
    font-weight: normal;
}

.alert-error {
    color: #D32F2F;
    background-color: #FFEBEE;
    border-color: #FFEBEE;
}

.alert-warning {
    background-color: #FFF8E1;
    color: #FF8F00;
    border-color: #FFC107;
}

.alert-done {
    background-color: #E8F5E9;
    color: #388E3C;
    border-color: #4CAF50;
}

.logo {
    background-image: url("../images/180403.png");
    background-size: 35px 35px;
    background-repeat: no-repeat;
    width: 35px;
    height: 35px;
    display: inline-block;
    margin-right: 8px;
    margin-bottom: -5px;
    overflow: hidden;
}

.footer {
    font-size: 12px;
    color: #999999;
    text-align: center;
    line-height: 50px;
    height: 50px;
    margin: 0px;
    overflow: hidden;
    position: relative;
}

.footer a {
    color: #777777;
    text-decoration: none;
}

.footer a:hover {
    color: #f54343;
}



.block {
    margin: 20px auto;
    width: 350px;
    padding: 20px 0px;
    border: 1px solid #cccccc;
    box-shadow: 5px 5px 3px #cccccc;
}

.block .having {
    font-size: 20px;
    color: #f54343;
    font-weight: bold;
    padding-right: 10px;
}

.bood {
    background-color: #20232a;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: inline-block;
    float: left;
    margin-top: -10px;
    margin-left: -26px;
}

.gap {
    padding-left: 45px;
}

images
React-Redux类似任务管理示例_第2张图片

图片描述

index.tmpl.html




    
    REDUX COMPY


index.js

// 入口
import React from 'react';
import {render} from 'react-dom';
import {createStore} from 'redux';
import {Provider} from 'react-redux';

import Index from './component/index';
import reducer from './reducers';

const store = createStore(reducer);

render(
    
        
    ,
    document.querySelector('#root')
);

index.js

import React from 'react';
import style from './style';
import Title from './Title';
import CreateItem from '../container/CreateItem';
import VisibleItemList from '../container/VisibleItemList';
import RowLink from './RowLink';
import Footer from './Footer';

const title = 'COMPANY MANAGEMENT';

// 组装UI组件
const Index = () => (
    
<CreateItem/> <VisibleItemList/> <RowLink/> </div> <div className={style["col-3"]}></div> <div className={style["col-12"]}> <Footer/> </div> </div> ); export default Index;</code></pre> <p>style.js</p> <pre><code>const style = require('../../static/css/common.css'); // CSS模块 export default style;</code></pre> <p>Create.js</p> <pre><code>import React from 'react'; import style from './style'; import Error from './Error'; // 添加组件 const Create = ({createError, addItem, resetCreate}) => { let input; return ( <div className={style.row}> <form onSubmit={(e) => { e.preventDefault(); input.focus(); addItem(input.value.trim()); }}> <div className={style["col-8"]}> <input type={'text'} className={style["form-input"]} placeholder="请输入公司名称" ref={node => { input = node }} /> <Error error={createError}/> </div> <div className={style["col-4"]} style={{marginTop: '-5px'}}> <button type={'submit'} className={`${style.btn} ${style["btn-clean"]}`}> 添加 </button> <button type={'button'} className={`${style.btn}`} onClick={(e) => { input.value = ''; resetCreate(); }} >重置 </button> </div> </form> </div> ) } export default Create;</code></pre> <p>Error.js</p> <pre><code>import React from 'react'; import style from './style'; // 错误提示 const Error = ({error}) => { if (error) { return ( <div className={`${style.alert} ${style["alert-error"]}`}> {error} </div> ) } return ( <span></span> ) } export default Error;</code></pre> <p>Footer.js</p> <pre><code>import React from 'react'; import style from './style'; // 页脚组件 const Footer = () => ( <div> <div className={style.footer}>@2018 <a href="/">XXX</a> 版权所有 京A2-20186XXX号</div> </div> ); export default Footer;</code></pre> <p>Header.js</p> <pre><code>import React from 'react'; // 表头组件 const Header = () => ( <thead> <tr> <th>名称 NAME</th> <th style={{textAlign: 'center'}}>操作 OPERATION</th> </tr> </thead> ); export default Header;</code></pre> <p>Item.js</p> <pre><code>import React from 'react'; import style from './style'; import Error from './Error'; import {connect} from 'react-redux'; import {saveItem} from '../actions/items'; const Item = ({toggleItem, editItem, removeItem, cancelEdit, dispatch, ...item}) => { if (item.isEditing) { let editInput; return ( <tr> <td> <input className={style["form-input"]} type="text" defaultValue={item.text} ref={node => editInput = node} autoFocus="autofocus" /> <Error error={item.error}/> </td> <td className={style.center}> <button className={`${style.btn} ${style["btn-small"]}`} onClick={(e) => { e.preventDefault(); editInput.focus(); const it = Object.assign({}, {...item}, {text: editInput.value.trim()}); // 调用 dispatch dispatch(saveItem(it)); }} >保存 </button> <button className={`${style.btn} ${style["btn-small"]}`} onClick={(e) => { e.preventDefault(); cancelEdit(item.id); }} >取消 </button> </td> </tr> ); } let itemStyle = { color: item.isCompleted ? 'green' : 'red', textDecoration: item.isCompleted ? 'line-through' : 'none', cursor: 'pointer' } return ( <tr> <td onClick={toggleItem} style={itemStyle}> {item.text} </td> <td className={style.center}> <button className={`${style.btn} ${style["btn-small"]}`} onClick={(e) => { e.preventDefault(); editItem(item.id); }} >编辑 </button> <button className={`${style.btn} ${style["btn-small"]}`} onClick={(e) => { e.preventDefault(); removeItem(item.id); }} >删除 </button> </td> </tr> ); }; export default connect()(Item);</code></pre> <p>ItemList.js</p> <pre><code>import React from 'react'; import style from './style'; import Header from './Header'; import Item from './Item'; // 列表组件 const ItemList = ({data, toggleItem, editItem, removeItem, cancelEdit}) => ( <table className={style.table}> <Header/> <tbody> { data.items.map(item => ( <Item key={item.id} {...item} toggleItem={() => toggleItem(item.id)} editItem={() => editItem(item.id)} removeItem={() => removeItem(item.id)} cancelEdit={() => cancelEdit(item.id)} /> )) } </tbody> </table> ); export default ItemList;</code></pre> <p>Link.js</p> <pre><code>import React from 'react'; import style from './style'; // UI - 三个参数[是否激活,按钮内容,点击事件] const Link = ({active, children, onClick}) => { if (active) { return ( <button className={`${style.disable} ${style["btn-small"]}`}> {children} </button> ) } return ( <button className={`${style.btn} ${style["btn-small"]}`} onClick={e => { e.preventDefault(); onClick(); }}> {children} </button> ) } export default Link;</code></pre> <p>RowLink.js</p> <pre><code>import React from 'react'; import FilterLink from '../container/FilterLink'; // UI const RowLink = () => ( <div> <span style={{marginLeft: '5px'}}></span> <FilterLink filter="SHOW_ALL"> 全部 </FilterLink> <FilterLink filter="SHOW_ACTIVE"> 激活 </FilterLink> <FilterLink filter="SHOW_COMPLETED"> 完成 </FilterLink> <a href={'counter.html'} style={{textDecoration: 'none', fontSize: '14px', marginLeft: '30px', whiteSpace: 'nowrap', color: '#8B668B'}}> 计数器 </a> </div> ); export default RowLink;</code></pre> <p>Title.js</p> <pre><code>import React from 'react'; import style from './style'; // 标题组件 const Title = ({title}) => ( <h2><span className={style.logo}></span>{title}</h2> ); export default Title;</code></pre> <p>CreateItem.js</p> <pre><code>import {connect} from 'react-redux'; import {addItem, resetCreate} from '../actions/items'; import Create from '../component/Create'; // 定义输入逻辑 - 将state映射到UI组件的参数 const mapStateToProps = (state) => { return { createError: state.data.createError } }; // 定义输出逻辑 - UI操作到dispatch的映射 const mapDispatchToProps = dispatch => { return { addItem: (text) => { // 触发Action dispatch(addItem(text)); }, resetCreate: () => { dispatch(resetCreate()); } } }; // 从UI组件生成容器组件 const CreateItem = connect( // 不需要映射参数[null或() => ({})] mapStateToProps, mapDispatchToProps )(Create); export default CreateItem;</code></pre> <p>FilterLink.js</p> <pre><code>import {connect} from 'react-redux'; import {visible} from '../actions/visible'; import Link from '../component/Link'; // 定义输入逻辑 - 将state映射到UI组件的参数 const mapStateToProps = (state, props) => { return { active: props.filter === state.filter } }; // 定义输出逻辑 - UI操作到dispatch的映射 const mapDispatchToProps = (dispatch, props) => { return { onClick: () => { dispatch(visible(props.filter)); } } }; // 从UI组件生成容器组件 const FilterLink = connect( mapStateToProps, mapDispatchToProps )(Link); export default FilterLink;</code></pre> <p>VisibleItemList.js</p> <pre><code>import {connect} from 'react-redux'; import {toggleItem, editItem, removeItem, cancelEdit} from '../actions/items'; import ItemList from '../component/ItemList'; // 传入状态[当前数据,当前过滤值] const getVisibleItems = (data, filter) => { switch (filter) { case 'SHOW_COMPLETED': return { items: data.items.filter(t => t.isCompleted) } case 'SHOW_ACTIVE': return { items: data.items.filter(t => !t.isCompleted) } case 'SHOW_ALL': default: return data } }; // 定义输入逻辑 - 将state映射到UI组件的参数 const mapStateToProps = state => { return { data: getVisibleItems(state.data, state.filter) } }; // 定义输出逻辑 - UI操作到dispatch的映射 const mapDispatchToProps = dispatch => { return { toggleItem: id => { // 触发Action dispatch(toggleItem(id)) }, editItem: id => { dispatch(editItem(id)) }, removeItem: id => { dispatch(removeItem(id)) }, cancelEdit: id => { dispatch(cancelEdit(id)) } } }; // 从UI组件生成容器组件 const VisibleItemList = connect( mapStateToProps, mapDispatchToProps )(ItemList); export default VisibleItemList;</code></pre> <p>actions - items.js</p> <pre><code>export const addItem = text => ({ type: 'ADD_ITEM', id: new Date().getTime(), text }); export const toggleItem = id => ({ type: 'TOGGLE_ITEM', id }); export const removeItem = id => ({ type: 'REMOVE_ITEM', id }); export const editItem = id => ({ type: 'EDIT_ITEM', id }); export const saveItem = item => ({ type: 'SAVA_ITEM', item }); export const cancelEdit = id => ({ type: 'CANCEL_EDIT', id }); export const resetCreate = () => ({ type: 'RESET_CREATE' });</code></pre> <p>actions - visible.js</p> <pre><code>// Action Creator export const visible = filter => ({ type: 'SET_VISIBILITY_FILTER', filter });</code></pre> <p>reducers - filter.js</p> <pre><code>// 把state和action串起来返回新的state const filter = (state = 'SHOW_ALL', action) => { switch (action.type) { case 'SET_VISIBILITY_FILTER': return action.filter; default: return state; } } export default filter;</code></pre> <p>reducers - items.js</p> <pre><code>import _ from 'lodash'; // 初始化数据 const def = { items: [ { id: new Date().getTime(), text: "ASKE(北京)信息技术有限公司", isCompleted: false, isEditing: false }, { id: new Date().getHours(), text: "SWSN(北京)网络科技有限公司", isCompleted: true, isEditing: false }, { id: new Date().getMonth(), text: "SLMI(杭州)网络科技有限公司", isCompleted: false, isEditing: false } ], createError: '' }; const items = (state = def, action) => { // state = {}, switch (action.type) { case 'ADD_ITEM': { // 非空检查 if (!action.text) { return { items: state.items, createError: '请输入公司名称' } } // 验证重复 let foundItem = _.find(state.items, item => (action.text === item.text) ); if (foundItem) { return { items: state.items, createError: '公司名称已存在' } } // 将新加的数据与原数据合并 return { items: [ ...state.items, { id: action.id, text: action.text, isCompleted: false, isEditing: false } ], defaultValue: '', createError: '' } } case 'TOGGLE_ITEM': // 切换状态数据 return { items: state.items.map(item => (item.id === action.id) ? { ...item, isCompleted: !item.isCompleted } : item ), createError: '' } case 'REMOVE_ITEM': // 删除数据[根据ID] return { items: _.remove(state.items, item => item.id !== action.id), createError: '' } case 'EDIT_ITEM': // 编辑数据 return { items: state.items.map(item => (item.id === action.id) ? {...item, isEditing: true} : item ), createError: '' } case 'SAVA_ITEM': { // 非空检查 if (!action.item.text) { return { items: state.items.map(item => (item.id === action.item.id) ? { ...item, error: '请输入公司名称' } : item ), createError: '' } } // 验证重复 let foundItem = _.find(state.items, item => (action.item.text === item.text && action.item.id !== item.id) ); if (foundItem) { return { items: state.items.map(item => (item.id === action.item.id) ? { ...item, error: '公司名称已存在' } : item ), createError: '' } } // 修改数据 return { items: state.items.map(item => (item.id === action.item.id) ? { ...item, text: action.item.text, isEditing: false, error: null } : item ), createError: '' } } case 'CANCEL_EDIT': // 取消编辑 return { items: state.items.map(item => (item.id === action.id) ? { ...item, isEditing: false, error: null } : item ), createError: '' } case 'RESET_CREATE': // 重置添加 return { items: state.items, createError: '' } default: return state; } } export default items;</code></pre> <p>reducers - index.js</p> <pre><code>import {combineReducers} from 'redux'; import items from './items'; import filter from './filter'; // 生成一个整体的Reducer函数[状态 - Reducer] export default combineReducers({ data: items, filter: filter });</code></pre> <p>运行:</p> <pre><code>npm run deves</code></pre> <p>结果:<br><span class="img-wrap"><a href="http://img.e-com-net.com/image/info8/e9312ba961e846ce912e8d23035ca965.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/e9312ba961e846ce912e8d23035ca965.jpg" alt="React-Redux类似任务管理示例_第3张图片" title="图片描述" width="650" height="375" style="border:1px solid black;"></a></span></p> <p><span class="img-wrap"><a href="http://img.e-com-net.com/image/info8/58ce47e289e64729b87c71c24773f5ca.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/58ce47e289e64729b87c71c24773f5ca.jpg" alt="React-Redux类似任务管理示例_第4张图片" title="图片描述" width="650" height="396" style="border:1px solid black;"></a></span></p> <p>备注:</p> <pre><code>代码可精简合并,仅供学习参考。</code></pre> </div> </div> </div> </div> </div> </div> <!--PC和WAP自适应版--> <div id="SOHUCS" sid="1293460559844417536"></div> <script type="text/javascript" src="/views/front/js/chanyan.js"></script> <!-- 文章页-底部 动态广告位 --> <div class="youdao-fixed-ad" id="detail_ad_bottom"></div> </div> <div class="col-md-3"> <div class="row" id="ad"> <!-- 文章页-右侧1 动态广告位 --> <div id="right-1" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad"> <div class="youdao-fixed-ad" id="detail_ad_1"> </div> </div> <!-- 文章页-右侧2 动态广告位 --> <div id="right-2" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad"> <div class="youdao-fixed-ad" id="detail_ad_2"></div> </div> <!-- 文章页-右侧3 动态广告位 --> <div id="right-3" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad"> <div class="youdao-fixed-ad" id="detail_ad_3"></div> </div> </div> </div> </div> </div> </div> <div class="container"> <h4 class="pt20 mb15 mt0 border-top">你可能感兴趣的:(React-Redux类似任务管理示例)</h4> <div id="paradigm-article-related"> <div class="recommend-post mb30"> <ul class="widget-links"> <li><a href="/article/1835512920797179904.htm" title="element实现动态路由+面包屑" target="_blank">element实现动态路由+面包屑</a> <span class="text-muted">软件技术NINI</span> <a class="tag" taget="_blank" href="/search/vue%E6%A1%88%E4%BE%8B/1.htm">vue案例</a><a class="tag" taget="_blank" href="/search/vue.js/1.htm">vue.js</a><a class="tag" taget="_blank" href="/search/%E5%89%8D%E7%AB%AF/1.htm">前端</a> <div>el-breadcrumb是ElementUI组件库中的一个面包屑导航组件,它用于显示当前页面的路径,帮助用户快速理解和导航到应用的各个部分。在Vue.js项目中,如果你已经安装了ElementUI,就可以很方便地使用el-breadcrumb组件。以下是一个基本的使用示例:安装ElementUI(如果你还没有安装的话):你可以通过npm或yarn来安装ElementUI。bash复制代码npmi</div> </li> <li><a href="/article/1835508130608410624.htm" title="html 中如何使用 uniapp 的部分方法" target="_blank">html 中如何使用 uniapp 的部分方法</a> <span class="text-muted">某公司摸鱼前端</span> <a class="tag" taget="_blank" href="/search/html/1.htm">html</a><a class="tag" taget="_blank" href="/search/uni-app/1.htm">uni-app</a><a class="tag" taget="_blank" href="/search/%E5%89%8D%E7%AB%AF/1.htm">前端</a> <div>示例代码:Documentconsole.log(window);效果展示:好了,现在就可以uni.使用相关的方法了</div> </li> <li><a href="/article/1835504217729626112.htm" title="Python教程:一文了解使用Python处理XPath" target="_blank">Python教程:一文了解使用Python处理XPath</a> <span class="text-muted">旦莫</span> <a class="tag" taget="_blank" href="/search/Python%E8%BF%9B%E9%98%B6/1.htm">Python进阶</a><a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a> <div>目录1.环境准备1.1安装lxml1.2验证安装2.XPath基础2.1什么是XPath?2.2XPath语法2.3示例XML文档3.使用lxml解析XML3.1解析XML文档3.2查看解析结果4.XPath查询4.1基本路径查询4.2使用属性查询4.3查询多个节点5.XPath的高级用法5.1使用逻辑运算符5.2使用函数6.实战案例6.1从网页抓取数据6.1.1安装Requests库6.1.2代</div> </li> <li><a href="/article/1835503712899002368.htm" title="linux中sdl的使用教程,sdl使用入门" target="_blank">linux中sdl的使用教程,sdl使用入门</a> <span class="text-muted">Melissa Corvinus</span> <a class="tag" taget="_blank" href="/search/linux%E4%B8%ADsdl%E7%9A%84%E4%BD%BF%E7%94%A8%E6%95%99%E7%A8%8B/1.htm">linux中sdl的使用教程</a> <div>本文通过一个简单示例讲解SDL的基本使用流程。示例中展示一个窗口,窗口里面有个随机颜色快随机移动。当我们鼠标点击关闭按钮时间窗口关闭。基本步骤如下:1.初始化SDL并创建一个窗口。SDL_Init()初始化SDL_CreateWindow()创建窗口2.纹理渲染存储RGB和存储纹理的区别:比如一个从左到右由红色渐变到蓝色的矩形,用存储RGB的话就需要把矩形中每个点的具体颜色值存储下来;而纹理只是一</div> </li> <li><a href="/article/1835502282603589632.htm" title="509. 斐波那契数(每日一题)" target="_blank">509. 斐波那契数(每日一题)</a> <span class="text-muted">lzyprime</span> <div>lzyprime博客(github)创建时间:2021.01.04qq及邮箱:2383518170leetcode笔记题目描述斐波那契数,通常用F(n)表示,形成的序列称为斐波那契数列。该数列由0和1开始,后面的每一项数字都是前面两项数字的和。也就是:F(0)=0,F(1)=1F(n)=F(n-1)+F(n-2),其中n>1给你n,请计算F(n)。示例1:输入:2输出:1解释:F(2)=F(1)+</div> </li> <li><a href="/article/1835499615491813376.htm" title="四章-32-点要素的聚合" target="_blank">四章-32-点要素的聚合</a> <span class="text-muted">彩云飘过</span> <div>本文基于腾讯课堂老胡的课《跟我学Openlayers--基础实例详解》做的学习笔记,使用的openlayers5.3.xapi。源码见1032.html,对应的官网示例https://openlayers.org/en/latest/examples/cluster.htmlhttps://openlayers.org/en/latest/examples/earthquake-clusters.</div> </li> <li><a href="/article/1835498218293653504.htm" title="2020-04-12每天三百字之连接与替代" target="_blank">2020-04-12每天三百字之连接与替代</a> <span class="text-muted">冷眼看潮</span> <div>不知道是不是好为人师,有时候还真想和别人分享一下我对某些现象的看法或者解释。人类社会不断发展进步的过程,就是不断连接与替代的过程。人类发现了火并应用火以后,告别了茹毛饮血的野兽般的原始生活(火烧、烹饪替代了生食)人类用石器代替了完全手工,工具的使用使人类进步一大步。类似这样的替代还有很多,随着科技的发展,有更多的原始的事物被替代,代之以更高效、更先进的技术。在近现代,汽车替代了马车,高速公路和铁路</div> </li> <li><a href="/article/1835497665337585664.htm" title="使用LLaVa和Ollama实现多模态RAG示例" target="_blank">使用LLaVa和Ollama实现多模态RAG示例</a> <span class="text-muted">llzwxh888</span> <a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E4%BA%BA%E5%B7%A5%E6%99%BA%E8%83%BD/1.htm">人工智能</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a> <div>本文将详细介绍如何使用LLaVa和Ollama实现多模态RAG(检索增强生成),通过提取图像中的结构化数据、生成图像字幕等功能来展示这一技术的强大之处。安装环境首先,您需要安装以下依赖包:!pipinstallllama-index-multi-modal-llms-ollama!pipinstallllama-index-readers-file!pipinstallunstructured!p</div> </li> <li><a href="/article/1835494538001608704.htm" title="121. 买卖股票的最佳时机" target="_blank">121. 买卖股票的最佳时机</a> <span class="text-muted">薄荷糖的味道_fb40</span> <div>给定一个数组,它的第i个元素是一支给定股票第i天的价格。如果你最多只允许完成一笔交易(即买入和卖出一支股票),设计一个算法来计算你所能获取的最大利润。注意你不能在买入股票前卖出股票。示例1:输入:[7,1,5,3,6,4]输出:5解释:在第2天(股票价格=1)的时候买入,在第5天(股票价格=6)的时候卖出,最大利润=6-1=5。注意利润不能是7-1=6,因为卖出价格需要大于买入价格。示例2:输入:</div> </li> <li><a href="/article/1835493626688401408.htm" title="Python快速入门 —— 第三节:类与对象" target="_blank">Python快速入门 —— 第三节:类与对象</a> <span class="text-muted">孤华暗香</span> <a class="tag" taget="_blank" href="/search/Python%E5%BF%AB%E9%80%9F%E5%85%A5%E9%97%A8/1.htm">Python快速入门</a><a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a> <div>第三节:类与对象目标:了解面向对象编程的基础概念,并学会如何定义类和创建对象。内容:类与对象:定义类:class关键字。类的构造函数:__init__()。类的属性和方法。对象的创建与使用。示例:classStudent:def__init__(self,name,age,major):self.name&#</div> </li> <li><a href="/article/1835493266645151744.htm" title="2023-10-22" target="_blank">2023-10-22</a> <span class="text-muted">奥雷里亚诺第n</span> <div>昨天在B站看到关于猫喜欢挠人的视频,视频教导说猫挠人的话就抓住它的后脖颈然后用手打打挠人的那个爪子。视频本身没什么,但评论区却炸开了锅(真是符合挑食者厌食心理)。令我印象最深刻的一个甚至上升到了关于我是谁这种终极问题。它说,猫就是畜生,它挠人就打它别惯着它,反正我六道轮回成了人就应该保持人的高贵,谁都别想来打破。我顿时汗颜,但看到下面全是类似的言论只不过后面的理由各有不同,本来想骂人的心都凉了一半</div> </li> <li><a href="/article/1835491353451130880.htm" title="【华为OD技术面试真题 - 技术面】- python八股文真题题库(4)" target="_blank">【华为OD技术面试真题 - 技术面】- python八股文真题题库(4)</a> <span class="text-muted">算法大师</span> <a class="tag" taget="_blank" href="/search/%E5%8D%8E%E4%B8%BAod/1.htm">华为od</a><a class="tag" taget="_blank" href="/search/%E9%9D%A2%E8%AF%95/1.htm">面试</a><a class="tag" taget="_blank" href="/search/python/1.htm">python</a> <div>华为OD面试真题精选专栏:华为OD面试真题精选目录:2024华为OD面试手撕代码真题目录以及八股文真题目录文章目录华为OD面试真题精选**1.Python中的`with`**用途和功能自动资源管理示例:文件操作上下文管理协议示例代码工作流程解析优点2.\_\_new\_\_和**\_\_init\_\_**区别__new____init__区别总结3.**切片(Slicing)操作**基本切片语法</div> </li> <li><a href="/article/1835491354004779008.htm" title="【华为OD技术面试真题 - 技术面】-测试八股文真题题库(1)" target="_blank">【华为OD技术面试真题 - 技术面】-测试八股文真题题库(1)</a> <span class="text-muted">算法大师</span> <a class="tag" taget="_blank" href="/search/%E5%8D%8E%E4%B8%BAod/1.htm">华为od</a><a class="tag" taget="_blank" href="/search/%E9%9D%A2%E8%AF%95/1.htm">面试</a><a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E7%AE%97%E6%B3%95/1.htm">算法</a><a class="tag" taget="_blank" href="/search/%E5%89%8D%E7%AB%AF/1.htm">前端</a> <div>华为OD面试真题精选专栏:华为OD面试真题精选目录:2024华为OD面试手撕代码真题目录以及八股文真题目录文章目录华为OD面试真题精选1.黑盒测试和白盒测试的区别2.假设我们公司现在开发一个类似于微信的软件1.0版本,现在要你测试这个功能:打开聊天窗口,输入文本,限制字数在200字以内。问你怎么提取测试点。功能测试性能测试安全性测试可用性测试跨平台兼容性测试网络环境测试3.接口测试的工具你了解哪些</div> </li> <li><a href="/article/1835484672059076608.htm" title="mac电脑命令行获取电量" target="_blank">mac电脑命令行获取电量</a> <span class="text-muted">小米人er</span> <a class="tag" taget="_blank" href="/search/%E6%88%91%E7%9A%84%E5%8D%9A%E5%AE%A2/1.htm">我的博客</a><a class="tag" taget="_blank" href="/search/macos/1.htm">macos</a><a class="tag" taget="_blank" href="/search/%E5%91%BD%E4%BB%A4%E8%A1%8C/1.htm">命令行</a> <div>在macOS上,有几个命令行工具可以用来获取电量信息,最常用的是pmset命令。你可以通过以下方式来查看电池状态和电量信息:查看电池状态:pmset-gbatt这个命令会返回类似下面的输出:Nowdrawingfrom'BatteryPower'-InternalBattery-0(id=1234567)95%;discharging;4:02remainingpresent:true输出中包括电</div> </li> <li><a href="/article/1835482277870661632.htm" title="简介Shell、zsh、bash" target="_blank">简介Shell、zsh、bash</a> <span class="text-muted">zhaosuningsn</span> <a class="tag" taget="_blank" href="/search/Shell/1.htm">Shell</a><a class="tag" taget="_blank" href="/search/zsh/1.htm">zsh</a><a class="tag" taget="_blank" href="/search/bash/1.htm">bash</a><a class="tag" taget="_blank" href="/search/shell/1.htm">shell</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a><a class="tag" taget="_blank" href="/search/bash/1.htm">bash</a> <div>Shell是Linux和Unix的外壳,类似衣服,负责外界与Linux和Unix内核的交互联系。例如接收终端用户及各种应用程序的命令,把接收的命令翻译成内核能理解的语言,传递给内核,并把内核处理接收的命令的结果返回给外界,即Shell是外界和内核沟通的桥梁或大门。Linux和Unix提供了多种Shell,其中有种bash,当然还有其他好多种。Mac电脑中不但有bash,还有一个zsh,预装的,据说</div> </li> <li><a href="/article/1835481395884027904.htm" title="209. 长度最小的子数组(滑动窗口)" target="_blank">209. 长度最小的子数组(滑动窗口)</a> <span class="text-muted">追光者2020</span> <a class="tag" taget="_blank" href="/search/leetcode/1.htm">leetcode</a><a class="tag" taget="_blank" href="/search/%E5%8F%8C%E6%8C%87%E9%92%88%2F%E6%BB%91%E5%8A%A8%E7%AA%97%E5%8F%A3/1.htm">双指针/滑动窗口</a> <div>题目描述给定一个含有n个正整数的数组和一个正整数target。找出该数组中满足其和≥target的长度最小的连续子数组[numsl,numsl+1,…,numsr-1,numsr],并返回其长度。如果不存在符合条件的子数组,返回0。示例1:输入:target=7,nums=[2,3,1,2,4,3]输出:2解释:子数组[4,3]是该条件下的长度最小的子数组。示例2:输入:target=4,nums</div> </li> <li><a href="/article/1835479001825636352.htm" title="209. 长度最小的子数组(中等 数组 滑动窗口)" target="_blank">209. 长度最小的子数组(中等 数组 滑动窗口)</a> <span class="text-muted">风雨中de宁静</span> <a class="tag" taget="_blank" href="/search/leetcode/1.htm">leetcode</a><a class="tag" taget="_blank" href="/search/%E7%AE%97%E6%B3%95/1.htm">算法</a><a class="tag" taget="_blank" href="/search/%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95/1.htm">排序算法</a> <div>209.长度最小的子数组给定一个含有n个正整数的数组和一个正整数target。找出该数组中满足其和≥target的长度最小的连续子数组[numsl,numsl+1,…,numsr-1,numsr],并返回其长度。如果不存在符合条件的子数组,返回0。示例1:输入:target=7,nums=[2,3,1,2,4,3]输出:2解释:子数组[4,3]是该条件下的长度最小的子数组。示例2:输入:targe</div> </li> <li><a href="/article/1835466901216653312.htm" title="209. 长度最小的子数组-滑动窗口" target="_blank">209. 长度最小的子数组-滑动窗口</a> <span class="text-muted">hequnwang10</span> <a class="tag" taget="_blank" href="/search/Java/1.htm">Java</a><a class="tag" taget="_blank" href="/search/LeetCode/1.htm">LeetCode</a><a class="tag" taget="_blank" href="/search/%E7%AE%97%E6%B3%95/1.htm">算法</a> <div>一、题目描述给定一个含有n个正整数的数组和一个正整数target。找出该数组中满足其和≥target的长度最小的连续子数组[numsl,numsl+1,…,numsr-1,numsr],并返回其长度。如果不存在符合条件的子数组,返回0。示例1:输入:target=7,nums=[2,3,1,2,4,3]输出:2解释:子数组[4,3]是该条件下的长度最小的子数组。示例2:输入:target=4,nu</div> </li> <li><a href="/article/1835463117237219328.htm" title="2024.9.14 Python,差分法解决区间加法,消除游戏,压缩字符串" target="_blank">2024.9.14 Python,差分法解决区间加法,消除游戏,压缩字符串</a> <span class="text-muted">RaidenQ</span> <a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E6%B8%B8%E6%88%8F/1.htm">游戏</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a><a class="tag" taget="_blank" href="/search/%E7%AE%97%E6%B3%95/1.htm">算法</a><a class="tag" taget="_blank" href="/search/%E5%8A%9B%E6%89%A3/1.htm">力扣</a> <div>1.区间加法假设你有一个长度为n的数组,初始情况下所有的数字均为0,你将会被给出k个更新的操作。其中,每个操作会被表示为一个三元组:[startIndex,endIndex,inc],你需要将子数组A[startIndex…endIndex](包括startIndex和endIndex)增加inc。请你返回k次操作后的数组。示例:输入:length=5,updates=[[1,3,2],[2,4,</div> </li> <li><a href="/article/1835462863683153920.htm" title="2024.8.22 Python,链表两数之和,链表快速反转,二叉树的深度,二叉树前中后序遍历,N叉树递归遍历,翻转二叉树" target="_blank">2024.8.22 Python,链表两数之和,链表快速反转,二叉树的深度,二叉树前中后序遍历,N叉树递归遍历,翻转二叉树</a> <span class="text-muted">RaidenQ</span> <a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E9%93%BE%E8%A1%A8/1.htm">链表</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a> <div>1.链表两数之和输入:l1=[2,4,3],l2=[5,6,4]输出:[7,0,8]解释:342+465=807.示例2:输入:l1=[0],l2=[0]输出:[0]示例3:输入:l1=[9,9,9,9,9,9,9],l2=[9,9,9,9]输出:[8,9,9,9,0,0,0,1]昨天的这个题,用自己的办法写的麻烦的要死,然后刚才一看chat归类的办法,感觉自己像个智障。classListNode</div> </li> <li><a href="/article/1835462232612368384.htm" title="python语法——三目运算符" target="_blank">python语法——三目运算符</a> <span class="text-muted">HappyRocking</span> <a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E4%B8%89%E7%9B%AE%E8%BF%90%E7%AE%97%E7%AC%A6/1.htm">三目运算符</a> <div>在java中,有三目运算符,如:intc=(a>b)?a:b表示c取两者中的较大值。但是在python,不能直接这样使用,估计是因为冒号在python有分行的关键作用。那么在python中,如何实现类似功能呢?可以使用ifelse语句,也是一行可以完成,格式为:aifbelsec表示如果b为True,则表达式等于a,否则等于c。如:c=(aif(a>b)elseb)同样是完成了取最大值的功能。</div> </li> <li><a href="/article/1835450511071997952.htm" title="android 更改窗口的层次,浮窗开发之窗口层级" target="_blank">android 更改窗口的层次,浮窗开发之窗口层级</a> <span class="text-muted">Ms.Bu</span> <a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/%E6%9B%B4%E6%94%B9%E7%AA%97%E5%8F%A3%E7%9A%84%E5%B1%82%E6%AC%A1/1.htm">更改窗口的层次</a> <div>最近在项目中遇到了这样的需求:需要在特定的其他应用之上悬浮自己的UI交互(拖动、输入等复杂的UI交互),和九游的浮窗类似,不过我们的比九游的体验更好,我们越过了很多授权的限制。浮窗效果很多人都知道如何去实现一个简单的浮窗,但是却很少有人去深入的研究背后的流程机制,由于项目中浮窗交互比较复杂,遇到了些坑查看了很多资料,故总结浮窗涉及到的知识点:窗口层级关系(浮窗是如何“浮”的)?浮窗有哪些限制,如何</div> </li> <li><a href="/article/1835448111909138432.htm" title="react-intl——react国际化使用方案" target="_blank">react-intl——react国际化使用方案</a> <span class="text-muted">苹果酱0567</span> <a class="tag" taget="_blank" href="/search/%E9%9D%A2%E8%AF%95%E9%A2%98%E6%B1%87%E6%80%BB%E4%B8%8E%E8%A7%A3%E6%9E%90/1.htm">面试题汇总与解析</a><a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a><a class="tag" taget="_blank" href="/search/%E4%B8%AD%E9%97%B4%E4%BB%B6/1.htm">中间件</a><a class="tag" taget="_blank" href="/search/spring/1.htm">spring</a><a class="tag" taget="_blank" href="/search/boot/1.htm">boot</a><a class="tag" taget="_blank" href="/search/%E5%90%8E%E7%AB%AF/1.htm">后端</a> <div>国际化介绍i18n:internationalization国家化简称,首字母+首尾字母间隔的字母个数+尾字母,类似的还有k8s(Kubernetes)React-intl是React中最受欢迎的库。使用步骤安装#usenpmnpminstallreact-intl-D#useyarn项目入口文件配置//index.tsximportReactfrom"react";importReactDOMf</div> </li> <li><a href="/article/1835446975806402560.htm" title="【Bugs】Python:“ModuleNotFoundError: No module named ‘XXX‘”" target="_blank">【Bugs】Python:“ModuleNotFoundError: No module named ‘XXX‘”</a> <span class="text-muted">系'辞</span> <a class="tag" taget="_blank" href="/search/%E5%B7%A5%E5%85%B7%E7%AE%B1/1.htm">工具箱</a><a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/bug/1.htm">bug</a><a class="tag" taget="_blank" href="/search/anaconda/1.htm">anaconda</a> <div>问题描述Python使用库的前提是必须已安装了相应的库,往往利用“命令行指令”实现安装,一般安装解法类似。但,还是具有延伸问题,本博客对此作记录。【1】Nomodulenamed‘seaborn’(1.1):情况1:为Anaconda安装【图1-2】.定位Anaconda路径【图3】.Anaconda路径加入Path>&</div> </li> <li><a href="/article/1835443569528238080.htm" title="Vue( ElementUI入门、vue-cli安装)" target="_blank">Vue( ElementUI入门、vue-cli安装)</a> <span class="text-muted">m0_l5z</span> <a class="tag" taget="_blank" href="/search/elementui/1.htm">elementui</a><a class="tag" taget="_blank" href="/search/vue.js/1.htm">vue.js</a> <div>一.ElementUI入门目录:1.ElementUI入门1.1ElementUI简介1.2Vue+ElementUI安装1.3开发示例2.搭建nodejs环境2.1nodejs介绍2.2npm是什么2.3nodejs环境搭建2.3.1下载2.3.2解压2.3.3配置环境变量2.3.4配置npm全局模块路径和cache默认安装位置2.3.5修改npm镜像提高下载速度2.3.6验证安装结果3.运行n</div> </li> <li><a href="/article/1835443013749403648.htm" title="入门MySQL——查询语法练习" target="_blank">入门MySQL——查询语法练习</a> <span class="text-muted">K_un</span> <div>前言:前面几篇文章为大家介绍了DML以及DDL语句的使用方法,本篇文章将主要讲述常用的查询语法。其实MySQL官网给出了多个示例数据库供大家实用查询,下面我们以最常用的员工示例数据库为准,详细介绍各自常用的查询语法。1.员工示例数据库导入官方文档员工示例数据库介绍及下载链接:https://dev.mysql.com/doc/employee/en/employees-installation.h</div> </li> <li><a href="/article/1835440673550069760.htm" title="20个新手学习c++必会的程序 输出*三角形、杨辉三角等(附代码)" target="_blank">20个新手学习c++必会的程序 输出*三角形、杨辉三角等(附代码)</a> <span class="text-muted">X_StarX</span> <a class="tag" taget="_blank" href="/search/c%2B%2B/1.htm">c++</a><a class="tag" taget="_blank" href="/search/%E5%AD%A6%E4%B9%A0/1.htm">学习</a><a class="tag" taget="_blank" href="/search/%E7%AE%97%E6%B3%95/1.htm">算法</a><a class="tag" taget="_blank" href="/search/%E5%A4%A7%E5%AD%A6%E7%94%9F/1.htm">大学生</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a><a class="tag" taget="_blank" href="/search/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/1.htm">数据结构</a> <div>示例1:HelloWorld#includeusingnamespacestd;intmain(){coutusingnamespacestd;intmain(){inta=5;intb=10;intsum=a+b;coutusingnamespacestd;intfactorial(intn){if(nusingnamespacestd;voidprintFibonacci(intn){intt</div> </li> <li><a href="/article/1835435253867573248.htm" title="Python实现TIFF 文件转换为 PNG 和 JPG 格式" target="_blank">Python实现TIFF 文件转换为 PNG 和 JPG 格式</a> <span class="text-muted">sand&wich</span> <a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a> <div>在日常的图像处理工作中,可能会遇到需要将TIFF格式的图像转换为其他格式的情况,例如PNG和JPG。下面,本文将介绍如何使用Python和GDAL库实现这一功能。准备工作在开始之前,请确保已经安装了必要的库:GDAL(GeospatialDataAbstractionLibrary)可以使用以下命令安装GDAL:pipinstallgdal代码实现以下是一个将TIFF文件转换为PNG文件的示例代码</div> </li> <li><a href="/article/1835429074617593856.htm" title="【数据结构-一维差分】力扣2848. 与车相交的点" target="_blank">【数据结构-一维差分】力扣2848. 与车相交的点</a> <span class="text-muted">hlc@</span> <a class="tag" taget="_blank" href="/search/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/1.htm">数据结构</a><a class="tag" taget="_blank" href="/search/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/1.htm">数据结构</a><a class="tag" taget="_blank" href="/search/leetcode/1.htm">leetcode</a><a class="tag" taget="_blank" href="/search/%E7%AE%97%E6%B3%95/1.htm">算法</a> <div>给你一个下标从0开始的二维整数数组nums表示汽车停放在数轴上的坐标。对于任意下标i,nums[i]=[starti,endi],其中starti是第i辆车的起点,endi是第i辆车的终点。返回数轴上被车任意部分覆盖的整数点的数目。示例1:输入:nums=[[3,6],[1,5],[4,7]]输出:7解释:从1到7的所有点都至少与一辆车相交,因此答案为7。示例2:输入:nums=[[1,3],[5</div> </li> <li><a href="/article/1835427057279004672.htm" title="经纬恒润二面&三七互娱一面&元象二面" target="_blank">经纬恒润二面&三七互娱一面&元象二面</a> <span class="text-muted">Redstone Monstrosity</span> <a class="tag" taget="_blank" href="/search/%E9%9D%A2%E8%AF%95/1.htm">面试</a><a class="tag" taget="_blank" href="/search/%E5%89%8D%E7%AB%AF/1.htm">前端</a> <div>1.请尽可能详细地说明,进程和线程的区别,分别有哪些应用场景?进程间如何通信?线程间如何通信?你的回答中不要写出示例代码。进程和线程是操作系统中的两个基本概念,它们在计算机系统中扮演着不同的角色,并且在不同的应用场景中发挥作用。进程和线程的区别定义:进程:进程是操作系统进行资源分配和调度的基本单位。每个进程都有独立的内存空间和系统资源。线程:线程是进程内的一个执行单元,是操作系统进行调度的最小单位</div> </li> <li><a href="/article/3.htm" title="枚举的构造函数中抛出异常会怎样" target="_blank">枚举的构造函数中抛出异常会怎样</a> <span class="text-muted">bylijinnan</span> <a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/enum/1.htm">enum</a><a class="tag" taget="_blank" href="/search/%E5%8D%95%E4%BE%8B/1.htm">单例</a> <div>首先从使用enum实现单例说起。 为什么要用enum来实现单例? 这篇文章( http://javarevisited.blogspot.sg/2012/07/why-enum-singleton-are-better-in-java.html)阐述了三个理由: 1.enum单例简单、容易,只需几行代码: public enum Singleton { INSTANCE;</div> </li> <li><a href="/article/130.htm" title="CMake 教程" target="_blank">CMake 教程</a> <span class="text-muted">aigo</span> <a class="tag" taget="_blank" href="/search/C%2B%2B/1.htm">C++</a> <div>转自:http://xiang.lf.blog.163.com/blog/static/127733322201481114456136/   CMake是一个跨平台的程序构建工具,比如起自己编写Makefile方便很多。 介绍:http://baike.baidu.com/view/1126160.htm 本文件不介绍CMake的基本语法,下面是篇不错的入门教程: http:</div> </li> <li><a href="/article/257.htm" title="cvc-complex-type.2.3: Element 'beans' cannot have character" target="_blank">cvc-complex-type.2.3: Element 'beans' cannot have character</a> <span class="text-muted">Cb123456</span> <a class="tag" taget="_blank" href="/search/spring/1.htm">spring</a><a class="tag" taget="_blank" href="/search/Webgis/1.htm">Webgis</a> <div>  cvc-complex-type.2.3: Element 'beans' cannot have character     Line 33 in XML document from ServletContext resource [/WEB-INF/backend-servlet.xml] is i</div> </li> <li><a href="/article/384.htm" title="jquery实例:随页面滚动条滚动而自动加载内容" target="_blank">jquery实例:随页面滚动条滚动而自动加载内容</a> <span class="text-muted">120153216</span> <a class="tag" taget="_blank" href="/search/jquery/1.htm">jquery</a> <div><script language="javascript"> $(function (){ var i = 4;$(window).bind("scroll", function (event){ //滚动条到网页头部的 高度,兼容ie,ff,chrome var top = document.documentElement.s</div> </li> <li><a href="/article/511.htm" title="将数据库中的数据转换成dbs文件" target="_blank">将数据库中的数据转换成dbs文件</a> <span class="text-muted">何必如此</span> <a class="tag" taget="_blank" href="/search/sql/1.htm">sql</a><a class="tag" taget="_blank" href="/search/dbs/1.htm">dbs</a> <div>旗正规则引擎通过数据库配置器(DataBuilder)来管理数据库,无论是Oracle,还是其他主流的数据都支持,操作方式是一样的。旗正规则引擎的数据库配置器是用于编辑数据库结构信息以及管理数据库表数据,并且可以执行SQL 语句,主要功能如下。 1)数据库生成表结构信息:         主要生成数据库配置文件(.conf文</div> </li> <li><a href="/article/638.htm" title="在IBATIS中配置SQL语句的IN方式" target="_blank">在IBATIS中配置SQL语句的IN方式</a> <span class="text-muted">357029540</span> <a class="tag" taget="_blank" href="/search/ibatis/1.htm">ibatis</a> <div>在使用IBATIS进行SQL语句配置查询时,我们一定会遇到通过IN查询的地方,在使用IN查询时我们可以有两种方式进行配置参数:String和List。具体使用方式如下: 1.String:定义一个String的参数userIds,把这个参数传入IBATIS的sql配置文件,sql语句就可以这样写: <select id="getForms" param</div> </li> <li><a href="/article/765.htm" title="Spring3 MVC 笔记(一)" target="_blank">Spring3 MVC 笔记(一)</a> <span class="text-muted">7454103</span> <a class="tag" taget="_blank" href="/search/spring/1.htm">spring</a><a class="tag" taget="_blank" href="/search/mvc/1.htm">mvc</a><a class="tag" taget="_blank" href="/search/bean/1.htm">bean</a><a class="tag" taget="_blank" href="/search/REST/1.htm">REST</a><a class="tag" taget="_blank" href="/search/JSF/1.htm">JSF</a> <div>         自从 MVC 这个概念提出来之后 struts1.X  struts2.X   jsf 。。。。。 这个view 层的技术一个接一个! 都用过!不敢说哪个绝对的强悍! 要看业务,和整体的设计!      最近公司要求开发个新系统!</div> </li> <li><a href="/article/892.htm" title="Timer与Spring Quartz 定时执行程序" target="_blank">Timer与Spring Quartz 定时执行程序</a> <span class="text-muted">darkranger</span> <a class="tag" taget="_blank" href="/search/spring/1.htm">spring</a><a class="tag" taget="_blank" href="/search/bean/1.htm">bean</a><a class="tag" taget="_blank" href="/search/%E5%B7%A5%E4%BD%9C/1.htm">工作</a><a class="tag" taget="_blank" href="/search/quartz/1.htm">quartz</a> <div>有时候需要定时触发某一项任务。其实在jdk1.3,java sdk就通过java.util.Timer提供相应的功能。一个简单的例子说明如何使用,很简单: 1、第一步,我们需要建立一项任务,我们的任务需要继承java.util.TimerTask package com.test; import java.text.SimpleDateFormat; import java.util.Date; </div> </li> <li><a href="/article/1019.htm" title="大端小端转换,le32_to_cpu 和cpu_to_le32" target="_blank">大端小端转换,le32_to_cpu 和cpu_to_le32</a> <span class="text-muted">aijuans</span> <a class="tag" taget="_blank" href="/search/C%E8%AF%AD%E8%A8%80%E7%9B%B8%E5%85%B3/1.htm">C语言相关</a> <div>大端小端转换,le32_to_cpu 和cpu_to_le32  字节序 http://oss.org.cn/kernel-book/ldd3/ch11s04.html         小心不要假设字节序. PC 存储多字节值是低字节为先(小端为先, 因此是小端), 一些高级的平台以另一种方式(大端)</div> </li> <li><a href="/article/1146.htm" title="Nginx负载均衡配置实例详解" target="_blank">Nginx负载均衡配置实例详解</a> <span class="text-muted">avords</span> <div>[导读] 负载均衡是我们大流量网站要做的一个东西,下面我来给大家介绍在Nginx服务器上进行负载均衡配置方法,希望对有需要的同学有所帮助哦。负载均衡先来简单了解一下什么是负载均衡,单从字面上的意思来理解就可以解 负载均衡是我们大流量网站要做的一个东西,下面我来给大家介绍在Nginx服务器上进行负载均衡配置方法,希望对有需要的同学有所帮助哦。 负载均衡 先来简单了解一下什么是负载均衡</div> </li> <li><a href="/article/1273.htm" title="乱说的" target="_blank">乱说的</a> <span class="text-muted">houxinyou</span> <a class="tag" taget="_blank" href="/search/%E6%A1%86%E6%9E%B6/1.htm">框架</a><a class="tag" taget="_blank" href="/search/%E6%95%8F%E6%8D%B7%E5%BC%80%E5%8F%91/1.htm">敏捷开发</a><a class="tag" taget="_blank" href="/search/%E8%BD%AF%E4%BB%B6%E6%B5%8B%E8%AF%95/1.htm">软件测试</a> <div>从很久以前,大家就研究框架,开发方法,软件工程,好多!反正我是搞不明白! 这两天看好多人研究敏捷模型,瀑布模型!也没太搞明白. 不过感觉和程序开发语言差不多, 瀑布就是顺序,敏捷就是循环. 瀑布就是需求、分析、设计、编码、测试一步一步走下来。而敏捷就是按摸块或者说迭代做个循环,第个循环中也一样是需求、分析、设计、编码、测试一步一步走下来。 也可以把软件开发理</div> </li> <li><a href="/article/1400.htm" title="欣赏的价值——一个小故事" target="_blank">欣赏的价值——一个小故事</a> <span class="text-muted">bijian1013</span> <a class="tag" taget="_blank" href="/search/%E6%9C%89%E6%95%88%E8%BE%85%E5%AF%BC/1.htm">有效辅导</a><a class="tag" taget="_blank" href="/search/%E6%AC%A3%E8%B5%8F/1.htm">欣赏</a><a class="tag" taget="_blank" href="/search/%E6%AC%A3%E8%B5%8F%E7%9A%84%E4%BB%B7%E5%80%BC/1.htm">欣赏的价值</a> <div>  第一次参加家长会,幼儿园的老师说:"您的儿子有多动症,在板凳上连三分钟都坐不了,你最好带他去医院看一看。"  回家的路上,儿子问她老师都说了些什么,她鼻子一酸,差点流下泪来。因为全班30位小朋友,惟有他表现最差;惟有对他,老师表现出不屑,然而她还在告诉她的儿子:"老师表扬你了,说宝宝原来在板凳上坐不了一分钟,现在能坐三分钟。其他妈妈都非常羡慕妈妈,因为全班只有宝宝</div> </li> <li><a href="/article/1527.htm" title="包冲突问题的解决方法" target="_blank">包冲突问题的解决方法</a> <span class="text-muted">bingyingao</span> <a class="tag" taget="_blank" href="/search/eclipse/1.htm">eclipse</a><a class="tag" taget="_blank" href="/search/maven/1.htm">maven</a><a class="tag" taget="_blank" href="/search/exclusions/1.htm">exclusions</a><a class="tag" taget="_blank" href="/search/%E5%8C%85%E5%86%B2%E7%AA%81/1.htm">包冲突</a> <div>包冲突是开发过程中很常见的问题: 其表现有: 1.明明在eclipse中能够索引到某个类,运行时却报出找不到类。 2.明明在eclipse中能够索引到某个类的方法,运行时却报出找不到方法。 3.类及方法都有,以正确编译成了.class文件,在本机跑的好好的,发到测试或者正式环境就 抛如下异常: java.lang.NoClassDefFoundError: Could not in</div> </li> <li><a href="/article/1654.htm" title="【Spark七十五】Spark Streaming整合Flume-NG三之接入log4j" target="_blank">【Spark七十五】Spark Streaming整合Flume-NG三之接入log4j</a> <span class="text-muted">bit1129</span> <a class="tag" taget="_blank" href="/search/Stream/1.htm">Stream</a> <div>先来一段废话: 实际工作中,业务系统的日志基本上是使用Log4j写入到日志文件中的,问题的关键之处在于业务日志的格式混乱,这给对日志文件中的日志进行统计分析带来了极大的困难,或者说,基本上无法进行分析,每个人写日志的习惯不同,导致日志行的格式五花八门,最后只能通过grep来查找特定的关键词缩小范围,但是在集群环境下,每个机器去grep一遍,分析一遍,这个效率如何可想之二,大好光阴都浪费在这上面了</div> </li> <li><a href="/article/1781.htm" title="sudoku solver in Haskell" target="_blank">sudoku solver in Haskell</a> <span class="text-muted">bookjovi</span> <a class="tag" taget="_blank" href="/search/sudoku/1.htm">sudoku</a><a class="tag" taget="_blank" href="/search/haskell/1.htm">haskell</a> <div>这几天没太多的事做,想着用函数式语言来写点实用的程序,像fib和prime之类的就不想提了(就一行代码的事),写什么程序呢?在网上闲逛时发现sudoku游戏,sudoku十几年前就知道了,学生生涯时也想过用C/Java来实现个智能求解,但到最后往往没写成,主要是用C/Java写的话会很麻烦。   现在写程序,本人总是有一种思维惯性,总是想把程序写的更紧凑,更精致,代码行数最少,所以现</div> </li> <li><a href="/article/1908.htm" title="java apache ftpClient" target="_blank">java apache ftpClient</a> <span class="text-muted">bro_feng</span> <a class="tag" taget="_blank" href="/search/java/1.htm">java</a> <div>最近使用apache的ftpclient插件实现ftp下载,遇见几个问题,做如下总结。 1. 上传阻塞,一连串的上传,其中一个就阻塞了,或是用storeFile上传时返回false。查了点资料,说是FTP有主动模式和被动模式。将传出模式修改为被动模式ftp.enterLocalPassiveMode();然后就好了。 看了网上相关介绍,对主动模式和被动模式区别还是比较的模糊,不太了解被动模</div> </li> <li><a href="/article/2035.htm" title="读《研磨设计模式》-代码笔记-工厂方法模式" target="_blank">读《研磨设计模式》-代码笔记-工厂方法模式</a> <span class="text-muted">bylijinnan</span> <a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/1.htm">设计模式</a> <div>声明: 本文只为方便我个人查阅和理解,详细的分析以及源代码请移步 原作者的博客http://chjavach.iteye.com/ package design.pattern; /* * 工厂方法模式:使一个类的实例化延迟到子类 * 某次,我在工作不知不觉中就用到了工厂方法模式(称为模板方法模式更恰当。2012-10-29): * 有很多不同的产品,它</div> </li> <li><a href="/article/2162.htm" title="面试记录语" target="_blank">面试记录语</a> <span class="text-muted">chenyu19891124</span> <a class="tag" taget="_blank" href="/search/%E6%8B%9B%E8%81%98/1.htm">招聘</a> <div>或许真的在一个平台上成长成什么样,都必须靠自己去努力。有了好的平台让自己展示,就该好好努力。今天是自己单独一次去面试别人,感觉有点小紧张,说话有点打结。在面试完后写面试情况表,下笔真的好难,尤其是要对面试人的情况说明真的好难。 今天面试的是自己同事的同事,现在的这个同事要离职了,介绍了我现在这位同事以前的同事来面试。今天这位求职者面试的是配置管理,期初看了简历觉得应该很适合做配置管理,但是今天面</div> </li> <li><a href="/article/2289.htm" title="Fire Workflow 1.0正式版终于发布了" target="_blank">Fire Workflow 1.0正式版终于发布了</a> <span class="text-muted">comsci</span> <a class="tag" taget="_blank" href="/search/%E5%B7%A5%E4%BD%9C/1.htm">工作</a><a class="tag" taget="_blank" href="/search/workflow/1.htm">workflow</a><a class="tag" taget="_blank" href="/search/Google/1.htm">Google</a> <div>Fire Workflow 是国内另外一款开源工作流,作者是著名的非也同志,哈哈.... 官方网站是 http://www.fireflow.org 经过大家努力,Fire Workflow 1.0正式版终于发布了 正式版主要变化: 1、增加IWorkItem.jumpToEx(...)方法,取消了当前环节和目标环节必须在同一条执行线的限制,使得自由流更加自由 2、增加IT</div> </li> <li><a href="/article/2416.htm" title="Python向脚本传参" target="_blank">Python向脚本传参</a> <span class="text-muted">daizj</span> <a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E8%84%9A%E6%9C%AC/1.htm">脚本</a><a class="tag" taget="_blank" href="/search/%E4%BC%A0%E5%8F%82/1.htm">传参</a> <div>如果想对python脚本传参数,python中对应的argc, argv(c语言的命令行参数)是什么呢? 需要模块:sys 参数个数:len(sys.argv) 脚本名:    sys.argv[0] 参数1:     sys.argv[1] 参数2:     sys.argv[</div> </li> <li><a href="/article/2543.htm" title="管理用户分组的命令gpasswd" target="_blank">管理用户分组的命令gpasswd</a> <span class="text-muted">dongwei_6688</span> <a class="tag" taget="_blank" href="/search/passwd/1.htm">passwd</a> <div>NAME: gpasswd - administer the /etc/group file SYNOPSIS: gpasswd group gpasswd -a user group gpasswd -d user group gpasswd -R group gpasswd -r group gpasswd [-A user,...] [-M user,...] g</div> </li> <li><a href="/article/2670.htm" title="郝斌老师数据结构课程笔记" target="_blank">郝斌老师数据结构课程笔记</a> <span class="text-muted">dcj3sjt126com</span> <a class="tag" taget="_blank" href="/search/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B8%8E%E7%AE%97%E6%B3%95/1.htm">数据结构与算法</a> <div><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</div> </li> <li><a href="/article/2797.htm" title="yii2 cgridview加上选择框进行操作" target="_blank">yii2 cgridview加上选择框进行操作</a> <span class="text-muted">dcj3sjt126com</span> <a class="tag" taget="_blank" href="/search/GridView/1.htm">GridView</a> <div>页面代码 <?=Html::beginForm(['controller/bulk'],'post');?> <?=Html::dropDownList('action','',[''=>'Mark selected as: ','c'=>'Confirmed','nc'=>'No Confirmed'],['class'=>'dropdown',])</div> </li> <li><a href="/article/2924.htm" title="linux mysql" target="_blank">linux mysql</a> <span class="text-muted">fypop</span> <a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a> <div>enquiry mysql version in centos linux yum list installed | grep mysql yum -y remove mysql-libs.x86_64 enquiry mysql version in yum repositoryyum list | grep mysql oryum -y list mysql* install mysq</div> </li> <li><a href="/article/3051.htm" title="Scramble String" target="_blank">Scramble String</a> <span class="text-muted">hcx2013</span> <a class="tag" taget="_blank" href="/search/String/1.htm">String</a> <div>Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representation of s1 = "great":</div> </li> <li><a href="/article/3178.htm" title="跟我学Shiro目录贴" target="_blank">跟我学Shiro目录贴</a> <span class="text-muted">jinnianshilongnian</span> <a class="tag" taget="_blank" href="/search/%E8%B7%9F%E6%88%91%E5%AD%A6shiro/1.htm">跟我学shiro</a> <div>历经三个月左右时间,《跟我学Shiro》系列教程已经完结,暂时没有需要补充的内容,因此生成PDF版供大家下载。最近项目比较紧,没有时间解答一些疑问,暂时无法回复一些问题,很抱歉,不过可以加群(334194438/348194195)一起讨论问题。     ----广告-----------------------------------------------------</div> </li> <li><a href="/article/3305.htm" title="nginx日志切割并使用flume-ng收集日志" target="_blank">nginx日志切割并使用flume-ng收集日志</a> <span class="text-muted">liyonghui160com</span> <div>     nginx的日志文件没有rotate功能。如果你不处理,日志文件将变得越来越大,还好我们可以写一个nginx日志切割脚本来自动切割日志文件。第一步就是重命名日志文件,不用担心重命名后nginx找不到日志文件而丢失日志。在你未重新打开原名字的日志文件前,nginx还是会向你重命名的文件写日志,linux是靠文件描述符而不是文件名定位文件。第二步向nginx主</div> </li> <li><a href="/article/3432.htm" title="Oracle死锁解决方法" target="_blank">Oracle死锁解决方法</a> <span class="text-muted">pda158</span> <a class="tag" taget="_blank" href="/search/oracle/1.htm">oracle</a> <div> select p.spid,c.object_name,b.session_id,b.oracle_username,b.os_user_name from v$process p,v$session a, v$locked_object b,all_objects c where p.addr=a.paddr and a.process=b.process and c.object_id=b.</div> </li> <li><a href="/article/3559.htm" title="java之List排序" target="_blank">java之List排序</a> <span class="text-muted">shiguanghui</span> <a class="tag" taget="_blank" href="/search/list%E6%8E%92%E5%BA%8F/1.htm">list排序</a> <div>   在Java Collection Framework中定义的List实现有Vector,ArrayList和LinkedList。这些集合提供了对对象组的索引访问。他们提供了元素的添加与删除支持。然而,它们并没有内置的元素排序支持。   你能够使用java.util.Collections类中的sort()方法对List元素进行排序。你既可以给方法传递</div> </li> <li><a href="/article/3686.htm" title="servlet单例多线程" target="_blank">servlet单例多线程</a> <span class="text-muted">utopialxw</span> <a class="tag" taget="_blank" href="/search/%E5%8D%95%E4%BE%8B/1.htm">单例</a><a class="tag" taget="_blank" href="/search/%E5%A4%9A%E7%BA%BF%E7%A8%8B/1.htm">多线程</a><a class="tag" taget="_blank" href="/search/servlet/1.htm">servlet</a> <div>转自http://www.cnblogs.com/yjhrem/articles/3160864.html 和   http://blog.chinaunix.net/uid-7374279-id-3687149.html Servlet 单例多线程 Servlet如何处理多个请求访问?Servlet容器默认是采用单实例多线程的方式处理多个请求的:1.当web服务器启动的</div> </li> </ul> </div> </div> </div> <div> <div class="container"> <div class="indexes"> <strong>按字母分类:</strong> <a href="/tags/A/1.htm" target="_blank">A</a><a href="/tags/B/1.htm" target="_blank">B</a><a href="/tags/C/1.htm" target="_blank">C</a><a href="/tags/D/1.htm" target="_blank">D</a><a href="/tags/E/1.htm" target="_blank">E</a><a href="/tags/F/1.htm" target="_blank">F</a><a href="/tags/G/1.htm" target="_blank">G</a><a href="/tags/H/1.htm" target="_blank">H</a><a href="/tags/I/1.htm" target="_blank">I</a><a href="/tags/J/1.htm" target="_blank">J</a><a href="/tags/K/1.htm" target="_blank">K</a><a href="/tags/L/1.htm" target="_blank">L</a><a href="/tags/M/1.htm" target="_blank">M</a><a href="/tags/N/1.htm" target="_blank">N</a><a href="/tags/O/1.htm" target="_blank">O</a><a href="/tags/P/1.htm" target="_blank">P</a><a href="/tags/Q/1.htm" target="_blank">Q</a><a href="/tags/R/1.htm" target="_blank">R</a><a href="/tags/S/1.htm" target="_blank">S</a><a href="/tags/T/1.htm" target="_blank">T</a><a href="/tags/U/1.htm" target="_blank">U</a><a href="/tags/V/1.htm" target="_blank">V</a><a href="/tags/W/1.htm" target="_blank">W</a><a href="/tags/X/1.htm" target="_blank">X</a><a href="/tags/Y/1.htm" target="_blank">Y</a><a href="/tags/Z/1.htm" target="_blank">Z</a><a href="/tags/0/1.htm" target="_blank">其他</a> </div> </div> </div> <footer id="footer" class="mb30 mt30"> <div class="container"> <div class="footBglm"> <a target="_blank" href="/">首页</a> - <a target="_blank" href="/custom/about.htm">关于我们</a> - <a target="_blank" href="/search/Java/1.htm">站内搜索</a> - <a target="_blank" href="/sitemap.txt">Sitemap</a> - <a target="_blank" href="/custom/delete.htm">侵权投诉</a> </div> <div class="copyright">版权所有 IT知识库 CopyRight © 2000-2050 E-COM-NET.COM , All Rights Reserved. <!-- <a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">京ICP备09083238号</a><br>--> </div> </div> </footer> <!-- 代码高亮 --> <script type="text/javascript" src="/static/syntaxhighlighter/scripts/shCore.js"></script> <script type="text/javascript" src="/static/syntaxhighlighter/scripts/shLegacy.js"></script> <script type="text/javascript" src="/static/syntaxhighlighter/scripts/shAutoloader.js"></script> <link type="text/css" rel="stylesheet" href="/static/syntaxhighlighter/styles/shCoreDefault.css"/> <script type="text/javascript" src="/static/syntaxhighlighter/src/my_start_1.js"></script> </body> </html>