- js中的循环问题
sybil052
写了这么久的react-native,但是最近却被一个js循环给难住了。一、需求有一个数组arr,长度不固定,而数组中存储的对象根据type不同分为两种,obj1和obj2,格式如下:obj1={storeCode:'',storeNum:''}obj2={goodCode:'',goodName:'',goodNum:''}当type=2时,arr=[obj1,obj1...],当type=其他
- laravel项目开发规范第一天
赵旻峰
前言本次实践是对一个现有的app的项目的后台进行代码规范,通过对比来实现badcode到goodcode的一次实践目的是提高代码的可读性关于规范高效编码-避免了过多的选择造成的『决策时间』浪费;风格统一-最大程度统一了开发团队成员代码书写风格和思路,代码阅读起来如出一辙;减少错误-减小初级工程师的犯错几率。开发哲学DRY–「Don’tRepeatYourself」不写重复的逻辑代码;约定俗成-「C
- 代码整洁之道,好的代码就是为了更美好的生活。
SYBH.
掘金生活代码
美国童子军有一条简单的军规:让营地比你来时更干净。当梳理代码时,坚守此军规:每次review代码,让代码比你发现它时更整洁。一位大神说过:“衡量代码质量的唯一有效标准:WTF/min”,并配了一个形象的图:通过别人在review代码过程中,每分钟“爆粗”的次数来衡量这个代码好的程度。代码整洁的必要性好的代码就是为了更美好的生活!CleanCode==GoodCode==GoodLife!为了把自己
- 怎么避免写出烂代码
javascript
命名规则:除非在小于5行的函数里,否则不要使用单字命名变量说明:含义不清晰,不能做到「望文生义」BadCodevarl=data.length;GoodCode//闭包只有一行代码,可以使用单字变量data.map(d=>d.length)规则:不要使用名词加数字的命名方法说明:含义不清晰,不能做到「望文生义」BadCodevarobj={};varobj2={...obj,key:1};Good
- jq input出发事件
科小洋_Lmy
mysqljqueryjavascript
//加入购物车手动修改数量$(".div_input").live("input",function(){vargoodcode=$(this).attr('data-goodcode');varnum=$(this).val().replace(/\D/g,'');varbuynum=$(this).attr('data-buynum');if(num>buynum){$(this).val(b
- 代码这样写不止于优雅(Python版)
liuzhijun
Martin(Bob大叔)曾在《代码整洁之道》一书打趣地说:当你的代码在做CodeReview时,审查者要是愤怒地吼道:“Whatthefuckisthisshit?”“Dude,Whatthefuck!”等言辞激烈的词语时,那说明你写的代码是BadCode,如果审查者只是漫不经心的吐出几个“Whatthefuck?”,那说明你写的是GoodCode。衡量代码质量的唯一标准就是每分钟骂出“WTF”
- 【转】java,画图,可调画笔粗细
索引在线
Java基础
/*可调画笔粗细-Java画图实验-Java源代码-goodcode*画直线,曲线,矩形,椭圆,可调颜色,有橡皮擦功能*可调画笔粗细*没有解决闪烁功能*hxz*/importjava.awt.*;importjava.awt.event.*;importjava.util.*;importjavax.swing.*;importjava.awt.geom.*;classPoint{intx,y;C
- 写出优雅的代码
俺就不起网名
java原理
《代码整洁之道》一书中说:当你的代码在做CodeReview时,审查者要是愤怒地吼道:“Whatthefuck,isthisshit?”、“Dude,Whatthefuck!”等言辞激烈的词语,那说明你写的代码是BadCode,如果审查者只是漫不经心的吐出几个:“Whatthefuck?”,那说明你写的是GoodCode。衡量代码质量的唯一标准就是每分钟骂出“WTF”的频率。代码不规范会带来很多负
- 究竟怎样写代码才算是好代码
weixin_34192816
今天让我们来谈谈代码吧。代码重要吗?当然,代码就是设计(JackW.Reeves,1992);代码是最有价值的交付物。我们需要好代码吗?在给“好代码”下个定义之前,这个问题无法回答。那么,究竟什么是好代码?看下面这段英文解释:'Goodcode'iscodethatworks,isbugfree,andisreadableandmaintainable.Someorganizationshavec
- 编码的道与禅
坎普利特
该文章发布在github中,如果您觉得写的还不错的话,可以star一下进行支持,传送门:TechShare。Bob大叔在《代码整洁之道》一书的前言打趣着说,当你写的代码在经受代码审查时,如果审查者愤怒的吼道“Whatthefuckisthisshit?”等言辞激烈的词语时,那说明你写的是BadCode;如果审查者只是漫不经心的吐出几个“Whatthefuck?”,那说明你写的是GoodCode。这
- 原来它才是我寻找良久的笔记应用
泽宇
之前学习时用印象笔记,记下一些硬件开发,机械视觉的创意思路,伪代码,当时感觉很爽.简洁明快,不用担心它会关门大吉,销毁我的数据.就是这样.如果你体察细微或者是个文字控.你一定会发现我的标点符号没有使用全角符号.这是我的职业所致.我是一个文艺程序员.我需要输入一些可爱的东西比如:Classobj;obj.goodcode这个栗子能否让你理解它呢?也许.我还是一名反病毒工程师.自封?我喜欢黑色调的屏纸
- 怎样写出好代码
layjoy
怎样写出好代码【指南】如何写出好代码代码就是设计(JackW.Reeves,1992)代码是最有价值的交付物。我们需要好代码吗?在给“好代码”下个定义之前,这个问题无法回答。那么,究竟什么是好代码?看下面这段英文解释:'Goodcode'iscodethatworks,isbugfree,andisreadableandmaintainable.Someorganizationshavecodin
- 究竟怎样写代码才算是好代码
小程故事多
今天让我们来谈谈代码吧。代码重要吗?当然,代码就是设计(JackW.Reeves,1992);代码是最有价值的交付物。我们需要好代码吗?在给“好代码”下个定义之前,这个问题无法回答。那么,究竟什么是好代码?看下面这段英文解释:'Goodcode'iscodethatworks,isbugfree,andisreadableandmaintainable.Someorganizationshavec
- Python中那些 Pythonic的写法详解
FOOFISH-PYTHON之禅
前言Martin(Bob大叔)曾在《代码整洁之道》一书打趣地说:当你的代码在做CodeReview时,审查者要是愤怒地吼道:“Whatthefuckisthisshit?”“Dude,Whatthefuck!”等言辞激烈的词语时,那说明你写的代码是BadCode,如果审查者只是漫不经心的吐出几个“Whatthefuck?”,那说明你写的是GoodCode。衡量代码质量的唯一标准就是每分钟骂出“WT
- 代码这样写不止于优雅(Python版)
liu志军
Martin(Bob大叔)曾在《代码整洁之道》一书打趣地说:当你的代码在做CodeReview时,审查者要是愤怒地吼道:“Whatthefuckisthisshit?”“Dude,Whatthefuck!”等言辞激烈的词语时,那说明你写的代码是BadCode,如果审查者只是漫不经心的吐出几个“Whatthefuck?”,那说明你写的是GoodCode。衡量代码质量的唯一标准就是每分钟骂出“WTF”
- SSM 框架的批量删除
cyy_ln1001
springMVC
JSP页面部分批量删除里面${QX.del}是来判断该用户是否有该权限">图片货物编号货物名称货物规格所属品牌计量单位零售价自提价格配送价格货物分类供应商库存量已售量是否上架是否推荐操作../uploadFiles/uploadImgs/${agl.imgurl}"οnclick="photo('${agl.pk_ax_goods}');">${agl.goodcode}${agl.goodnam
- 代码这样写不止于优雅(Python版)
weixin_33774308
python设计模式java
Martin(Bob大叔)曾在《代码整洁之道》一书打趣地说:当你的代码在做CodeReview时,审查者要是愤怒地吼道:“Whatthefuckisthisshit?”“Dude,Whatthefuck!”等言辞激烈的词语时,那说明你写的代码是BadCode,如果审查者只是漫不经心的吐出几个“Whatthefuck?”,那说明你写的是GoodCode。衡量代码质量的唯一标准就是每分钟骂出“WTF”
- Testing in iOS
Patty_温暖的弦
翻译自[rayWenderlich视频](https://videos.raywenderlich.com/courses/testing-in-ios/lessons/1)###GoodCode-->GoodTests**在写测试之前最基本的就是准备好可测试的代码,也就意味着要尽可能的避免类和方法有很多相互紧密联系的代码,如果业务逻辑是和model(和Views分离)分离的,那么你的app每一部
- 究竟怎样写代码才算是好代码
u013970991
设计
今天让我们来谈谈代码吧。代码重要吗?当然,代码就是设计(JackW.Reeves,1992);代码是最有价值的交付物。我们需要好代码吗?在给“好代码”下个定义之前,这个问题无法回答。那么,究竟什么是好代码?看下面这段英文解释:‘Goodcode’iscodethatworks,isbugfree,andisreadableandmaintainable.Someorganizationshavec
- keil l251 command summary --Lib
[无名]
keil l251 command summaryLIB251 LIST MYLIB.LIB TO MYLIB.LST PUBLICSLIB251 EXTRACT MYLIB.LIB (GOODCODE) TO GOOD.OBJ
- 关于好的代码(Aspects to good code)
HorkyChen
测试javadocperformancedocumentationtestingScalability
我常常思考是什么造就了好的代码(goodcode).使用最新的语言特性、最佳的模式(bestpattern)、最好的层次化设计(bestlayereddesign)、使用最少内存、亦或最佳的执行性能(performsthebest)?很明显,这些项目都会在设计时考虑,但它们是首先要最主要的原因吗(thefirstthingsyouthinkof)?或许并不是!那什么呢?经过一段冥思苦想之后,我有了
- 字符串“6sabcsssfsfs33”,掉字符“ab3”
luoyahu
C++cC#
public class GoodCode {
//假如有字符串“6sabcsssfsfs33” ,
//用最有快速的方法去掉字符“ab3”,不能用java内置字符串方法(indeOf,substring,replaceAll等)?
public void isGood() {
String str = "6sabcsssfsfs33";
c
- 一道从字符串中提取字符
wfwkiss
javaC++cC#
public class GoodCode{
//假如有字符串“6sabcsssfsfs33” ,
//用最有快速的方法去掉字符“ab3”,不能用java内置字符串方法(indeOf,substring,replaceAll等)?
public void isGood(){
String str = "6sabcsssfsfs33";
cha
- 一道从字符串中提取字符
wfwkiss
javaC++cC#
public class GoodCode{
//假如有字符串“6sabcsssfsfs33” ,
//用最有快速的方法去掉字符“ab3”,不能用java内置字符串方法(indeOf,substring,replaceAll等)?
public void isGood(){
String str = "6sabcsssfsfs33";
cha
- 【原】Good disign , good code !
一亩三分地
【原】Gooddisign,goodcode!下面的代码表现出使用set带来的好处。 1public class TaskTemplate { 2 private String id; 3 private String title; 4 private String detail; 5 6 private Set preconditions; 7
- Hadoop(一)
朱辉辉33
hadooplinux
今天在诺基亚第一天开始培训大数据,因为之前没接触过Linux,所以这次一起学了,任务量还是蛮大的。
首先下载安装了Xshell软件,然后公司给了账号密码连接上了河南郑州那边的服务器,接下来开始按照给的资料学习,全英文的,头也不讲解,说锻炼我们的学习能力,然后就开始跌跌撞撞的自学。这里写部分已经运行成功的代码吧.
在hdfs下,运行hadoop fs -mkdir /u
- maven An error occurred while filtering resources
blackproof
maven报错
转:http://stackoverflow.com/questions/18145774/eclipse-an-error-occurred-while-filtering-resources
maven报错:
maven An error occurred while filtering resources
Maven -> Update Proje
- jdk常用故障排查命令
daysinsun
jvm
linux下常见定位命令:
1、jps 输出Java进程
-q 只输出进程ID的名称,省略主类的名称;
-m 输出进程启动时传递给main函数的参数;
&nb
- java 位移运算与乘法运算
周凡杨
java位移运算乘法
对于 JAVA 编程中,适当的采用位移运算,会减少代码的运行时间,提高项目的运行效率。这个可以从一道面试题说起:
问题:
用最有效率的方法算出2 乘以8 等於几?”
答案:2 << 3
由此就引发了我的思考,为什么位移运算会比乘法运算更快呢?其实简单的想想,计算机的内存是用由 0 和 1 组成的二
- java中的枚举(enmu)
g21121
java
从jdk1.5开始,java增加了enum(枚举)这个类型,但是大家在平时运用中还是比较少用到枚举的,而且很多人和我一样对枚举一知半解,下面就跟大家一起学习下enmu枚举。先看一个最简单的枚举类型,一个返回类型的枚举:
public enum ResultType {
/**
* 成功
*/
SUCCESS,
/**
* 失败
*/
FAIL,
- MQ初级学习
510888780
activemq
1.下载ActiveMQ
去官方网站下载:http://activemq.apache.org/
2.运行ActiveMQ
解压缩apache-activemq-5.9.0-bin.zip到C盘,然后双击apache-activemq-5.9.0-\bin\activemq-admin.bat运行ActiveMQ程序。
启动ActiveMQ以后,登陆:http://localhos
- Spring_Transactional_Propagation
布衣凌宇
springtransactional
//事务传播属性
@Transactional(propagation=Propagation.REQUIRED)//如果有事务,那么加入事务,没有的话新创建一个
@Transactional(propagation=Propagation.NOT_SUPPORTED)//这个方法不开启事务
@Transactional(propagation=Propagation.REQUIREDS_N
- 我的spring学习笔记12-idref与ref的区别
aijuans
spring
idref用来将容器内其他bean的id传给<constructor-arg>/<property>元素,同时提供错误验证功能。例如:
<bean id ="theTargetBean" class="..." />
<bean id ="theClientBean" class=&quo
- Jqplot之折线图
antlove
jsjqueryWebtimeseriesjqplot
timeseriesChart.html
<script type="text/javascript" src="jslib/jquery.min.js"></script>
<script type="text/javascript" src="jslib/excanvas.min.js&
- JDBC中事务处理应用
百合不是茶
javaJDBC编程事务控制语句
解释事务的概念; 事务控制是sql语句中的核心之一;事务控制的作用就是保证数据的正常执行与异常之后可以恢复
事务常用命令:
Commit提交
- [转]ConcurrentHashMap Collections.synchronizedMap和Hashtable讨论
bijian1013
java多线程线程安全HashMap
在Java类库中出现的第一个关联的集合类是Hashtable,它是JDK1.0的一部分。 Hashtable提供了一种易于使用的、线程安全的、关联的map功能,这当然也是方便的。然而,线程安全性是凭代价换来的――Hashtable的所有方法都是同步的。此时,无竞争的同步会导致可观的性能代价。Hashtable的后继者HashMap是作为JDK1.2中的集合框架的一部分出现的,它通过提供一个不同步的
- ng-if与ng-show、ng-hide指令的区别和注意事项
bijian1013
JavaScriptAngularJS
angularJS中的ng-show、ng-hide、ng-if指令都可以用来控制dom元素的显示或隐藏。ng-show和ng-hide根据所给表达式的值来显示或隐藏HTML元素。当赋值给ng-show指令的值为false时元素会被隐藏,值为true时元素会显示。ng-hide功能类似,使用方式相反。元素的显示或
- 【持久化框架MyBatis3七】MyBatis3定义typeHandler
bit1129
TypeHandler
什么是typeHandler?
typeHandler用于将某个类型的数据映射到表的某一列上,以完成MyBatis列跟某个属性的映射
内置typeHandler
MyBatis内置了很多typeHandler,这写typeHandler通过org.apache.ibatis.type.TypeHandlerRegistry进行注册,比如对于日期型数据的typeHandler,
- 上传下载文件rz,sz命令
bitcarter
linux命令rz
刚开始使用rz上传和sz下载命令:
因为我们是通过secureCRT终端工具进行使用的所以会有上传下载这样的需求:
我遇到的问题:
sz下载A文件10M左右,没有问题
但是将这个文件A再传到另一天服务器上时就出现传不上去,甚至出现乱码,死掉现象,具体问题
解决方法:
上传命令改为;rz -ybe
下载命令改为:sz -be filename
如果还是有问题:
那就是文
- 通过ngx-lua来统计nginx上的虚拟主机性能数据
ronin47
ngx-lua 统计 解禁ip
介绍
以前我们为nginx做统计,都是通过对日志的分析来完成.比较麻烦,现在基于ngx_lua插件,开发了实时统计站点状态的脚本,解放生产力.项目主页: https://github.com/skyeydemon/ngx-lua-stats 功能
支持分不同虚拟主机统计, 同一个虚拟主机下可以分不同的location统计.
可以统计与query-times request-time
- java-68-把数组排成最小的数。一个正整数数组,将它们连接起来排成一个数,输出能排出的所有数字中最小的。例如输入数组{32, 321},则输出32132
bylijinnan
java
import java.util.Arrays;
import java.util.Comparator;
public class MinNumFromIntArray {
/**
* Q68输入一个正整数数组,将它们连接起来排成一个数,输出能排出的所有数字中最小的一个。
* 例如输入数组{32, 321},则输出这两个能排成的最小数字32132。请给出解决问题
- Oracle基本操作
ccii
Oracle SQL总结Oracle SQL语法Oracle基本操作Oracle SQL
一、表操作
1. 常用数据类型
NUMBER(p,s):可变长度的数字。p表示整数加小数的最大位数,s为最大小数位数。支持最大精度为38位
NVARCHAR2(size):变长字符串,最大长度为4000字节(以字符数为单位)
VARCHAR2(size):变长字符串,最大长度为4000字节(以字节数为单位)
CHAR(size):定长字符串,最大长度为2000字节,最小为1字节,默认
- [强人工智能]实现强人工智能的路线图
comsci
人工智能
1:创建一个用于记录拓扑网络连接的矩阵数据表
2:自动构造或者人工复制一个包含10万个连接(1000*1000)的流程图
3:将这个流程图导入到矩阵数据表中
4:在矩阵的每个有意义的节点中嵌入一段简单的
- 给Tomcat,Apache配置gzip压缩(HTTP压缩)功能
cwqcwqmax9
apache
背景:
HTTP 压缩可以大大提高浏览网站的速度,它的原理是,在客户端请求网页后,从服务器端将网页文件压缩,再下载到客户端,由客户端的浏览器负责解压缩并浏览。相对于普通的浏览过程HTML ,CSS,Javascript , Text ,它可以节省40%左右的流量。更为重要的是,它可以对动态生成的,包括CGI、PHP , JSP , ASP , Servlet,SHTML等输出的网页也能进行压缩,
- SpringMVC and Struts2
dashuaifu
struts2springMVC
SpringMVC VS Struts2
1:
spring3开发效率高于struts
2:
spring3 mvc可以认为已经100%零配置
3:
struts2是类级别的拦截, 一个类对应一个request上下文,
springmvc是方法级别的拦截,一个方法对应一个request上下文,而方法同时又跟一个url对应
所以说从架构本身上 spring3 mvc就容易实现r
- windows常用命令行命令
dcj3sjt126com
windowscmdcommand
在windows系统中,点击开始-运行,可以直接输入命令行,快速打开一些原本需要多次点击图标才能打开的界面,如常用的输入cmd打开dos命令行,输入taskmgr打开任务管理器。此处列出了网上搜集到的一些常用命令。winver 检查windows版本 wmimgmt.msc 打开windows管理体系结构(wmi) wupdmgr windows更新程序 wscrip
- 再看知名应用背后的第三方开源项目
dcj3sjt126com
ios
知名应用程序的设计和技术一直都是开发者需要学习的,同样这些应用所使用的开源框架也是不可忽视的一部分。此前《
iOS第三方开源库的吐槽和备忘》中作者ibireme列举了国内多款知名应用所使用的开源框架,并对其中一些框架进行了分析,同样国外开发者
@iOSCowboy也在博客中给我们列出了国外多款知名应用使用的开源框架。另外txx's blog中详细介绍了
Facebook Paper使用的第三
- Objective-c单例模式的正确写法
jsntghf
单例iosiPhone
一般情况下,可能我们写的单例模式是这样的:
#import <Foundation/Foundation.h>
@interface Downloader : NSObject
+ (instancetype)sharedDownloader;
@end
#import "Downloader.h"
@implementation
- jquery easyui datagrid 加载成功,选中某一行
hae
jqueryeasyuidatagrid数据加载
1.首先你需要设置datagrid的onLoadSuccess
$(
'#dg'
).datagrid({onLoadSuccess :
function
(data){
$(
'#dg'
).datagrid(
'selectRow'
,3);
}});
2.onL
- jQuery用户数字打分评价效果
ini
JavaScripthtmljqueryWebcss
效果体验:http://hovertree.com/texiao/jquery/5.htmHTML文件代码:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery用户数字打分评分代码 - HoverTree</
- mybatis的paramType
kerryg
DAOsql
MyBatis传多个参数:
1、采用#{0},#{1}获得参数:
Dao层函数方法:
public User selectUser(String name,String area);
对应的Mapper.xml
<select id="selectUser" result
- centos 7安装mysql5.5
MrLee23
centos
首先centos7 已经不支持mysql,因为收费了你懂得,所以内部集成了mariadb,而安装mysql的话会和mariadb的文件冲突,所以需要先卸载掉mariadb,以下为卸载mariadb,安装mysql的步骤。
#列出所有被安装的rpm package rpm -qa | grep mariadb
#卸载
rpm -e mariadb-libs-5.
- 利用thrift来实现消息群发
qifeifei
thrift
Thrift项目一般用来做内部项目接偶用的,还有能跨不同语言的功能,非常方便,一般前端系统和后台server线上都是3个节点,然后前端通过获取client来访问后台server,那么如果是多太server,就是有一个负载均衡的方法,然后最后访问其中一个节点。那么换个思路,能不能发送给所有节点的server呢,如果能就
- 实现一个sizeof获取Java对象大小
teasp
javaHotSpot内存对象大小sizeof
由于Java的设计者不想让程序员管理和了解内存的使用,我们想要知道一个对象在内存中的大小变得比较困难了。本文提供了可以获取对象的大小的方法,但是由于各个虚拟机在内存使用上可能存在不同,因此该方法不能在各虚拟机上都适用,而是仅在hotspot 32位虚拟机上,或者其它内存管理方式与hotspot 32位虚拟机相同的虚拟机上 适用。
- SVN错误及处理
xiangqian0505
SVN提交文件时服务器强行关闭
在SVN服务控制台打开资源库“SVN无法读取current” ---摘自网络 写道 SVN无法读取current修复方法 Can't read file : End of file found
文件:repository/db/txn_current、repository/db/current
其中current记录当前最新版本号,txn_current记录版本库中版本