Common sense for server

本文介绍了JavaWeb开发中的关键技术,包括JDBC、Servlet、Spring框架、Struts2、Hibernate、MyBatis、SpringDataJPA和SpringMVC等,并简要概述了Linux的基本命令与配置,如环境变量设置、防火墙管理等。

Common sense for server


java web

  • JDBC 是 Java 对关系型数据库进行访问的最主要的 API
  • Servlet 是 Server Applet 的缩写,也称为服务端小程序
  • Spring 是一个开源框架,也是一个基于控制反转、依赖注入的轻量级容器,它的出现大大简化了传统的 J2EE 开发模式。
  • Struts2框架是MVC流程框架,适合分层开发。框架应用实现不依赖于Servlet,使用大量的拦截器来处理用户请求,属于无侵入式的设计。作为web层框架Struts2提供了数据封装、表单验证、文件上传、OGNL标签、国际化等功能
  • Hibernate 是一个开放源代码的对象关系映射框架,它对 JDBC 进行了非常轻量级的对象封装,使得Java程序员可以随心所欲的使用对象编程思维来操纵数据库。
  • MyBatis 开源持久层框架
  • Spring Data JPA 由 Spring 提供的一个用于简化 JPA 开发的框架可以极大的简化 JPA 的写法,可以在几乎不用写实现的情况下,实现对数据的访问和操作。除了 CRUD 外,还包括如分页、排序等一些常用的功能。
  • SpringMVC框架,包括注解驱动控制器、请求及响应的信息处理、视图解析、本地化解析、上传文件解析、异常处理以及表单标签绑定等内容。

Linux

文件位置

  • /etc/profile #环境变量
  • /etc/sysconfig/iptables 防火墙配置

常用命令

  • wget是linux上的命令行的下载工具
  • ifconfig 命令用来查看和配置网络设备。
  • pwd 查看当前工作目录的完整路径
  • su 和sudo

       su用于用户之间的切换。
       sudo用于普通用户可以使用root权限来执行指定命令。
    
  • source /etc/profile

    也称为“点命令”,也就是一个点符号(.)。source命令通常用于重新执行刚修改的初始化文件,使之立即生效,而不必注销并重新登录。
    
  • rpm -qal | grep httpd         #[搜索rpm包]

  • sudo yum remove xxxx # 删除程序包
  • tar -zxvf xxx #解压缩

  • 查找

    find <指定目录> <指定条件> <指定动作>
    locate “find -name”的另一种写法,但要比后者快得多,原因在于它不搜索具体目录,而是搜索一个数据库(/var/lib/locatedb),在使用locate之前,先使用updatedb命令,手动更新数据库
    whereis 命令只能用于程序名的搜索,而且只搜索二进制文件(参数-b)、man说明文件(参数-m)和源代码文件(参数-s)

Vi

  • 普通模式下输入 i(插入)、c(修改)、o(另起一行) 命令时进入编辑模式
  • 退出: q q! wq ZZ
  • 光标:

     0  一行开头
     $  一行结尾
    () 定位句子开头结尾
    {} 定位段落开头结尾
     n| 移动到n列
    
  • 控制

    ctrl+d  往下翻页半屏 
    ctrl+u  往上~
    
  • 编辑

    u 撤销
    o 当前位置下创建一行
    O 当前位置上创建一行
    dd 删除光标所在行
    x 删除光标后字符
    X 删除光标前字符
    yy 复制当前行
    p  粘贴
    J 当前行连接下一行
    
  • 查找

    /  查找
    n 继续查找
    

Tomcat

  • download
  • 环境变量
  • 字符集
  • startup

Maven

  • download
  • unzip
  • env
  • source
  • cmd:

    mvn clean
    mvn compile
    mvn package
    mvn clean package -Dmaven.test.skip=true
    

vsftp

  • 安装

    - yum -y install vsftpd
    - rpm -qal | grep vsftp     # 是否安装
    - /etc/vsftpd/vsftpd.conf # 配置
    
  • 创建用户

  • 配置
  • 防火墙

Nginx

  • 反向代理服务器
  • 配置 .conf
  • 安装

    yum -y install gcc  pcre-develzlib zlib-devel openssl openssl-devel
    wget ...
    tar ..
    ./configure  --prefix =usr/nginx
    whereis nginx
    make 
    make install 
    
  • 命令

    /nginx/sbin/nginx -t
    /nginx/sbin/nginx -s stop/quit/reload
    ps -ef|grep nginx 
    kill -HUP [nginx pid]
    
  • 防火墙

  • 域名配置

    指向域名
    指向目录
    
  • autoindex off


MySQL

  • 安装

    yum -y install mysql-server
    rpm -qa| grep mysql-server
    /etc/my.cnf  #默认配置
    
  • 字符集配置

  • 自启动配置

    chkconfig mysqld on
    chkconfig --list mysqld
    
  • 防火墙
  • 启动

        service mysqld start
        /etc/rc.d/init.d/mysqld start
       mysql -u root 
    
  • 修改配置

    select user,host,password from mysql.user   # 查看用户
    set password for root@localhost=password('123456');
    delete from mysql.user where use='';
    insert into mysql.user(Host,User,Password) values ("localhsot","yourname",password("yourpwd"));
    
    flush privilege # 生效
    
    CREATE DATABASE `mdatabase` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;  # 创建数据库 
    
        grant all privileges on mdatabase.* to youruser@localhost identified by 'yourpassword'  # 赋予权限
    

git

  • 配置

     git config --global user.name "justin"
     git config --global user.email "xxx"
     ~ merge.tool "kdiff3"
     ~ core.autocrlf false
     ~ gui.encoding utf-8
     ~ core.quotepath off  # git status乱码
     ~ core.ignorecase false
    
  • ssh key pair

    ssh-keygen -t rsa -C "xx@xx.com"
    ssh-add ~/.ssh/id_rsa
    cat ~/.ssh/id_rsa.pub
    
### SQL Server 2012 Code Examples and Programming Guide For creating a database structure specifically tailored for Microsoft SQL Server, including defining tables with appropriate data types such as `job_id` being of type `VARCHAR`, `salary` as `NUMBER`, or more accurately in SQL Server context using `NVARCHAR` and `DECIMAL` respectively to ensure compatibility and performance optimization[^3]. Below is an example demonstrating how one might define a simple table within SQL Server 2012: ```sql CREATE TABLE Employees ( EmployeeID INT IDENTITY(1,1) PRIMARY KEY, FirstName NVARCHAR(50), LastName NVARCHAR(50), JobTitle NVARCHAR(50), HireDate DATE, Salary DECIMAL(18, 4), CommissionPct DECIMAL(5, 2) ); ``` When it comes to executing complex operations that involve capturing multiple outputs from procedures or functions which cannot be directly achieved through T-SQL alone due to its limitations on handling collections efficiently, developers often resort to implementing these functionalities at the application level using languages like C# within the .NET framework environment. This approach leverages the strengths of both platforms while adhering to best practices recommended by industry experts[^2]. However, when working strictly within SQL Server 2012's capabilities without involving external applications, stored procedures can encapsulate logic requiring multi-step processes or returning several result sets. Here’s an illustration of declaring variables inside a procedure body along with performing basic insertions into previously created tables: ```sql DECLARE @EmployeeName NVARCHAR(100); SET @EmployeeName = 'John Doe'; INSERT INTO Employees (FirstName, LastName, JobTitle, HireDate, Salary, CommissionPct) VALUES ('John', 'Doe', 'Sales Representative', GETDATE(), 75000.00, 0.05); ``` Additionally, triggers offer another powerful feature available since earlier versions up until SQL Server 2012 allowing automatic execution of actions based upon certain events happening either before or after changes occur against specified objects. --related questions-- 1. How does one optimize queries written for SQL Server 2012? 2. What are some common pitfalls encountered during migration projects targeting SQL Server 2012? 3. Can you provide guidance on securing databases running under SQL Server 2012 environments? 4. In what scenarios would integrating Entity Framework ORM make sense over traditional ADO.NET approaches when developing applications intended for use with SQL Server 2012?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值