Generator 生成器的问题

Problem Description
We can generate a random string by generating a sequence of random characters and concatenating them together. Each character is chosen independently from the first n letters in the English alphabet with equal probability. Only capital letters are used in this problem. The generation is stopped as soon as one of specific patterns occurs in the random string.

Your task is to predict the expected length of the generated string.

Input
Standard input will contain multiple test cases.

First line is the number of case x.

Each test case consists of integer N (1<=N<=8) which is the number of letters used, and M (1<=M<=10) which is the number of patterns used. The following M lines contain the patterns which are non-empty strings consisting of letters chosen from the first N upper case English letters. The length of any pattern will not exceed 10.

Output
For each test case, print the expected length of the generated random string. All output numbers are rounded to the second digit after the decimal point.

Sample Input
4
2 1
A
2 1
ABA
3 1
AAAAA
2 2
A
AA

Sample Output
2.00
10.00
363.00
2.00

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Generator 生成器的问题
Problem Description We can generate a random string by generating a sequence of random characters and concatenating them together. Each character is chosen independently from the first n letters in the English alphabet with equal probability. Only capital letters are used in this problem. The generation is stopped as soon as one of specific patterns occurs in the random string. Your task is to predict the expected length of the generated string. Input Standard input will contain multiple test cases. First line is the number of case x. Each test case consists of integer N (1<=N<=8) which is the number of letters used, and M (1<=M<=10) which is the number of patterns used. The following M lines contain the patterns which are non-empty strings consisting of letters chosen from the first N upper case English letters. The length of any pattern will not exceed 10. Output For each test case, print the expected length of the generated random string. All output numbers are rounded to the second digit after the decimal point. Sample Input 4 2 1 A 2 1 ABA 3 1 AAAAA 2 2 A AA Sample Output 2.00 10.00 363.00 2.00
mybatis-generator生成java类型问题请教
最近在用mybatis-generator通过数据库生成表格,感觉很方便,但有个问题解决不了。我用的是Oracle数据库,我的主键是Integer类型的。然后生成的Entity类的,主键类型是BigDecimal。在配置里面这个配置的是false。 <javaTypeResolver> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> 官方的解释是 如果精度大于零,或长度大于18,java.math。将使用BigDecimal类型 如果精度是零,和长度是10到18之间,然后解析器将替代java.lang.Long的Java类型。 如果精度是零,和长度是5到9,那么Java类型解析器将替代java.lang.Integer。 如果精度是零,和长度小于5,那么Java类型解析器将替代java.lang.Short。 但我这个主键是Integer类型的,我是通过powerdesigner设计的,无法写长度。 就问,这个怎么转成Integer类型。是不是需要把powerdesigner设计成number精度怎么定义?还是其他什么。主键想用序列还没生成,对oracle不太熟悉
使用MyBatis Generator生成器后,出现了不知明的错误
各位大佬求帮下小弟,晚上第一次使用MyBatis Generator,跟着网课学,不知怎么生成出来的文件多了很多不知明的代码(第二、三、四张图),另外好像还少生成一个UserExample.java文件 恩,另外我的数据库是MySQL8.0,MyBatis Generator插件是1.4的 下面是我 generatorConfig.xml的程序片 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> <generatorConfiguration> <context id="context1"> <commentGenerator> <!-- 关闭自动生成的注释 --> <property name="suppressAllComments" value="true"/> </commentGenerator> <jdbcConnection connectionURL="jdbc:mysql://localhost:3306/test?serverTimezone=GMT%2B8&amp;useSSL=false" driverClass="com.mysql.cj.jdbc.Driver" password="123456" userId="root" > <property name="nullCatalogMeansCurrent" value="true"/> </jdbcConnection> <javaModelGenerator targetPackage="com.chenjg.ssm.model" targetProject="ssm" /> <sqlMapGenerator targetPackage="com.chenjg.ssm.mapper" targetProject="ssm"/> <javaClientGenerator targetPackage="com.chenjg.ssm.mapper" targetProject="ssm" type="XMLMAPPER" /> <table tableName="user"> <columnOverride column="id" property="id" /> </table> </context> </generatorConfiguration> ``` ``` ![图片说明](https://img-ask.csdn.net/upload/202003/05/1583338015_556002.png) 这个是生成的UserDynamicSqlSupport文件 ![图片说明](https://img-ask.csdn.net/upload/202003/05/1583338049_676719.png) 这个是生成的User文件 ![图片说明](https://img-ask.csdn.net/upload/202003/05/1583338065_592577.png) 这个是生成的UserMapper接口 ![图片说明](https://img-ask.csdn.net/upload/202003/05/1583338076_244597.png)
python 生成器的输出问题
generator_ex = (x*x for x in range(10)) print(next(generator_ex)) print(next(generator_ex)) print(next(generator_ex)) print(next(generator_ex)) print(next(generator_ex)) for i in generator_ex: print(i) 在print几次之后,为什么for 循环的时候不是从生成器的第一个数字输出呢? 反而是接着next的数据输出?
python中 Generator[Any,Any,None],这三个变量类型分别对应的是什么变量?
最近写python用利用yield 返回生成器Generator的时候,想指定一下生成器的返回变量类型 ,诸如List[int],发现Generator里可以指定三个变量的变量类型,默认的是: [Any,Any,None],我想知道这三个分别表示什么变量的变量类型。 可能描述的术语不太精准,请见谅。。。
generator集成maven插件时报Root class cannot be loaded
问题:Root class cannot be loaded, checking for member overrides is disabled 使用工具为intelli idea 在使用generator集成maven插件时设置rootClass无法达到预期效果(子类没有根据父类中的字段内容去生成实体),实体类是可以正常生成的。但控制台报 Root class cannot be loaded, checking for member overrides is disable, 有一篇国外的论坛讨论过这个问题,思路似乎很正确,但我无法get到的操作, 国外论坛地址:http://mybatis-user.963551.n3.nabble.com/mybatis-generator-Root-class-xxx-cannot-be-loaded-td3576094.html 国内的论坛中许多文章都是忽略这个问题的。 有解决过这个问题的人么。希望提供帮助,万分感谢!
大家都在用什么mybatis代码生成器?
我们公司里统一规定,所有项目中使用的mybatis代码生成器,只能使用fwjava.com这个网站生成的代码. 以前常用的mybatis-generator或mybatis-mapper之类的,好像不让用了.说是sql代码质量不好... 大家都在用什么MyBatis或iBatis的代码生成器?也在用fwjava吗? 你们的公司里也有这类规定吗?
一个杨辉三角的生成器问题
杨辉三角如下: [1] [1, 1] [1, 2, 1] [1, 3, 3, 1] [1, 4, 6, 4, 1] [1, 5, 10, 10, 5, 1] 实现一个生成器,不断输出下一行的列表,实现代码如下: ``` def triangles(): N = [1] while True: yield N N.append(0) N = [N[i-1] + N[i] for i in range(len(N))] n = 0 results = [] for t in triangles(): print(t) results.append(t) n = n + 1 if n == 5: break print(results) ``` 运行结果: ![图片说明](https://img-ask.csdn.net/upload/201812/03/1543810772_237098.png) results.append(t)语句里的t和print(t)里的t应该一样呀,为何results中的列表末项会多一个零?
【mybatis generator的报错】前期配置问题!!!!!官方文件看了一直也一头雾水
错误如下 Description Resource Path Location Type The content of element type "context" must match "(property*,plugin*,commentGenerator?,(connectionFactory|jdbcConnection),javaTypeResolver?,javaModelGenerator,sqlMapGenerator?,javaClientGenerator?,table+)". generatorConfig.xml /oracle/generator line 4 XML Problem 指向的代码错误是这样的 ``` <generatorConfiguration> <context id="oracleTables" defaultModelType="hierachical" targetRuntime="MyBatis3"> ``` 错误指向context id 改了半天一直报错。。难道是pom.xml的代码顺序问题?? 补源代码 ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> <generatorConfiguration> <context id="oracleTables" defaultModelType="hierachical" targetRuntime="MyBatis3"> <!-- 自动识别数据库关键字段,默认false --> <property name="autoDelimitKeywords" value="false"/> <!-- 生成的Java文件的编码 --> <property name="javaFileEncoding" value="UTF-8"/> <!-- 格式化XML代码 --> <property name="xmlFormatter" value="org.mybatis.generator.api.dom.DefaultXmlFormatter"/> <!-- 指明数据库的用于标记数据库对象名的符号 --> <property name="beginningDelimiter" value='"'/> <property name="endingDelimiter" value='"'/> <!-- 连接oracle --> <jdbcConnection connectionURL="jdbc:oracle:thin:@localhost:1521:orcl" driverClass="oracle.jdbc.driver.OracleDriver" password="S123456" userId="c##refeal" /> <!-- Java类型处理器 --> <javaTypeResolver type="org.mybatis.generator.internal.types.JavaTypeResolverDefaultImpl"> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> <!-- Java模型创建器 --> <javaModelGenerator targetPackage="com.SJY.domain" targetProject="src/main/java" /> <!-- for mabatis3 自动为每个生成的类创建一个构造方法 --> <property name="constructorBased" value="false"/> <!-- 在targetPachage的基础上,根据数据库的schema再生成一层package,最终生成的类放到这个package下 --> <property name="enableSubPackages" value="true"/> <!-- for MyBatis3 是否创建一个不可变类 --> <property name="immutable" value="false"/> <!-- 设置是否在getter方法中,对String类型字段调用trim()方法 --> <property name="rootClass" value="com.sjy.domain"/> <!-- 生成SQLmap的XML文件生成器 --> <sqlMapGenerator targetPackage="com.SJY.dao" targetProject="src/main/resources" /> <!-- 在targetPackage的基础上,根据数据库的schema再生成一层package --> <property name="enableSubPackages" value="true"/> <!-- 生成mapper接口 --> <javaClientGenerator targetPackage="com.SJY.domain" targetProject="src/main/java" type="XMLMAPPER" /> <!-- 在targetPackage的基础上,根据数据库的schema再生成一层package --> <property name="enableSubPackages" value="true"/> <!-- 与数据库相对应 --> <table schema="" tableName="SJY_YH_YHXXB" domainObjectName="YH_YHXXB" mapperName="YH_YHXXBMapper" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"> <generatedKey column="USERID" sqlStatement="SELECT SJY_YH_YHXXB_SEQUENCE.nextval AS USERID from DUAL"/> <columnOverride column="USERID" property="???" /> </table> </context> </generatorConfiguration> ``` 表字段暂时可以无视吧
python生成器输出值?
``` >>> stack = [(v for u, v in G.edges('130'))] >>> stack [<generator object <genexpr> at 0x09E6F120>] >>> for i in stack: print i <generator object <genexpr> at 0x09E6F120> >>> type(stack) <type 'list'> >>> ``` 为什么不能输出stack里面的值,如何才能输出stack里面的值?
使用Mybatis的代码生成器报错java.sql.SQLException: Column 'IS_GENERATEDCOLUMN' not found.
我在使用mybatis的代码生成器生成代码的时候报错如下 : java.sql.SQLException: Column 'IS_GENERATEDCOLUMN' not found. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926) at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1093) at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5488) at org.mybatis.generator.internal.db.DatabaseIntrospector.getColumns(DatabaseIntrospector.java:619) at org.mybatis.generator.internal.db.DatabaseIntrospector.introspectTables(DatabaseIntrospector.java:221) at org.mybatis.generator.config.Context.introspectTables(Context.java:653) at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:257) at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:139) at com.Junit.Test.test(Test.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675) at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:125) at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:132) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:124) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:74) at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115) at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:104) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:62) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:43) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:35) at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104) at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:202) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:198) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80) at java.util.ArrayList.forEach(ArrayList.java:1249) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80) at java.util.ArrayList.forEach(ArrayList.java:1249) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229) at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197) at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) 这是我生成代码的测试类: package com.Junit; import org.mybatis.generator.api.MyBatisGenerator; import org.mybatis.generator.config.Configuration; import org.mybatis.generator.config.xml.ConfigurationParser; import org.mybatis.generator.internal.DefaultShellCallback; import org.springframework.cglib.core.DefaultGeneratorStrategy; import javax.swing.*; import java.io.File; import java.util.ArrayList; import java.util.List; public class Test { @org.junit.jupiter.api.Test public void test() throws Exception { List<String> warnings = new ArrayList<String>(); boolean overwrite = true; File configFile = new File("H:\\TestTable\\LAST\\LAST\\PageSystem\\src\\main\\resources\\generatorConfig.xml"); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(configFile); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config,callback,warnings); myBatisGenerator.generate(null); } } 这个是配置文件 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <!-- 配置全局属性 --> <settings> <!-- 使用jdbc的getGeneratedKeys获取数据库自增主键值 --> <setting name="useGeneratedKeys" value="true" /> <!-- 使用列别名替换列名 默认:true --> <setting name="useColumnLabel" value="true" /> <!-- 开启驼峰命名转换:Table{create_time} -> Entity{createTime} --> <setting name="mapUnderscoreToCamelCase" value="true" /> </settings> <typeAliases> <package name="com.pojo"></package> </typeAliases> <!--<property name="mapperLocations" value="classpath:mapper/*"></property>--> <!--<mappers>--> <!--<mappers>--> <!--<mapper resource="mapper/GetTableDaoMapper.xml"/>--> <!--</mappers>--> <!--</mappers>--> </configuration> 今天学习mybatis想使用代码生成器生成代码,但是一直报这个错,网上也找了一些相关的错误,但是都没能解决问题,这里大神云集,希望问题能被解决,多谢。
keras.util.sequence + fit_generator 如何实现多输出model
输入输出的形式是下面这样: ``` model = Model(inputs=input_img, outputs=[mask,net2_opt,net3_opt]) ``` 由于sequence要求一定要返回一个两个参数的远足,所以生成器的_getitem_的实现如下: ``` class DataGenerator(keras.utils.Sequence): def __getitem__(self, index): #生成每个batch数据,这里就根据自己对数据的读取方式进行发挥了 # 生成batch_size个索引 batch_indexs = self.indexes[index*self.batch_size:(index+1)*self.batch_size] # 根据索引获取datas集合中的数据 batch_datas = [self.datas[k] for k in batch_indexs] # 生成数据 images, masks,heatmaps,xyzs = self.data_generation(batch_datas) return (images, [masks,heatmaps,xyzs]) ``` output中的mask并不能与getitem的返回值匹配。 会报错: ValueError: Error when checking target: expected conv_1x1_x14 to have 4 dimensions, but got array with shape (3,1) 请问,是不是keras.util.sequence不能实现多输出问题?
Tensorflow代码转到Keras
我现在有Tensortflow的代码和结构图如下,这是AC-GAN中生成器的部分,我用原生tf是可以跑通的,但当我想转到Keras中实现却很头疼。 ``` def batch_norm(inputs, is_training=is_training, decay=0.9): return tf.contrib.layers.batch_norm(inputs, is_training=is_training, decay=decay) # 构建残差块 def g_block(inputs): h0 = tf.nn.relu(batch_norm(conv2d(inputs, 3, 64, 1, use_bias=False))) h0 = batch_norm(conv2d(h0, 3, 64, 1, use_bias=False)) h0 = tf.add(h0, inputs) return h0 # 生成器 # batch_size = 32 # z : shape(32, 128) # label : shape(32, 34) def generator(z, label): with tf.variable_scope('generator', reuse=None): d = 16 z = tf.concat([z, label], axis=1) h0 = tf.layers.dense(z, units=d * d * 64) h0 = tf.reshape(h0, shape=[-1, d, d, 64]) h0 = tf.nn.relu(batch_norm(h0)) shortcut = h0 for i in range(16): h0 = g_block(h0) h0 = tf.nn.relu(batch_norm(h0)) h0 = tf.add(h0, shortcut) for i in range(3): h0 = conv2d(h0, 3, 256, 1, use_bias=False) h0 = tf.depth_to_space(h0, 2) h0 = tf.nn.relu(batch_norm(h0)) h0 = tf.layers.conv2d(h0, kernel_size=9, filters=3, strides=1, padding='same', activation=tf.nn.tanh, name='g', use_bias=True) return h0 ``` ![生成器结构图](https://img-ask.csdn.net/upload/201910/29/1572278934_997142.png) 在Keras中都是先构建Model,在Model中不断的加层 但上面的代码却是中间包含着新旧数据的计算,比如 ``` .... shortcut = h0 .... h0 = tf.add(h0, shortcut) ``` 难不成我还要构建另外一个model作为中间输出吗? 大佬们帮帮忙解释下,或者能不能给出翻译到Keras中应该怎么写
hibernate中load延迟加载在IDEA的精确debug下会失效?
今天的问题仅仅是讨论在IDEA编译器的环境下,我的load懒加载的失效问题 这个是我的customer类的配置,基本没变,什么都没改 ``` <class name="Customer" table="customer" > <id name="custId" column="cust_id"> <generator class="native"></generator> </id> <property name="custLevel" column="cust_level"></property> <property name="custSource" column="cust_source"></property> <property name="custName" column="cust_name"></property> </class> ``` 下面是我的主体代码,其实很简便,就是为了测试load方法 ``` @Test public void testLoad(){ Session s= HibernateUtil.getSession(); Transaction ts=s.beginTransaction(); Customer customer =s.load(Customer.class, 106L); System.out.println(customer); ts.commit(); s.close(); } ``` 然后问题就来了,我用IDEA的debug在Customer customer =s.load(Customer.class, 106L);这一行打上断点。然后执行debug,然后Step Over(F8),即执行下一行,表示开始执行Customer customer =s.load(Customer.class, 106L);这一行,结果下方的控制台就已经把sql语句生成了。 我的疑惑恰恰在此,不是说load方法是懒加载嘛,懒加载的话,为什么我没有用它,他就会生成了sql语句并且执行呢?难道不应该在执行到System.out.println(customer);这一行的时候再生成sql语句再打印出来吗 ![图片说明](https://img-ask.csdn.net/upload/201907/12/1562921390_930198.png) 但是我发现,如果我把System.out.println(customer);这一行删掉的话,那么 执行程序,不是debug,就是run,那么就不会出现打印的sql语句 如下 ![图片说明](https://img-ask.csdn.net/upload/201907/12/1562921587_321942.png) 但是同样的代码用debug调试,就一定会出现打印的sql语句。 这也就是我在这里向各位大佬请教的初衷。 而且我也通过查资料证明了,比如load查不到会报错,而get查不到就会返回null,一系列特性来验证了我的load就是懒加载,但是问题就在于debug的 时候会出现sql查询。 所以我怀疑这是不是IDEAdebug的机制的特殊性?! 我是初学hibernate的新手,不太懂这里的规矩,也没什么悬赏给你们,对不起。恳请有经验的人帮帮我。感激不尽!
基于tensorflow的pix2pix代码中如何做到输入图像和输出图像分辨率不一致
问题:例如在自己制作了成对的输入(input256×256 target 200×256)后,如何让输入图像和输出图像分辨率不一致,例如成对图像中:input的分辨率是256×256, output 和target都是200×256,需要修改哪里的参数。 论文参考:《Image-to-Image Translation with Conditional Adversarial Networks》 代码参考:https://blog.csdn.net/MOU_IT/article/details/80802407?utm_source=blogxgwz0 # coding=utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf import numpy as np import os import glob import random import collections import math import time # https://github.com/affinelayer/pix2pix-tensorflow train_input_dir = "D:/Project/pix2pix-tensorflow-master/facades/train/" # 训练集输入 train_output_dir = "D:/Project/pix2pix-tensorflow-master/facades/train_out/" # 训练集输出 test_input_dir = "D:/Project/pix2pix-tensorflow-master/facades/val/" # 测试集输入 test_output_dir = "D:/Project/pix2pix-tensorflow-master/facades/test_out/" # 测试集的输出 checkpoint = "D:/Project/pix2pix-tensorflow-master/facades/train_out/" # 保存结果的目录 seed = None max_steps = None # number of training steps (0 to disable) max_epochs = 200 # number of training epochs progress_freq = 50 # display progress every progress_freq steps trace_freq = 0 # trace execution every trace_freq steps display_freq = 50 # write current training images every display_freq steps save_freq = 500 # save model every save_freq steps, 0 to disable separable_conv = False # use separable convolutions in the generator aspect_ratio = 1 #aspect ratio of output images (width/height) batch_size = 1 # help="number of images in batch") which_direction = "BtoA" # choices=["AtoB", "BtoA"]) ngf = 64 # help="number of generator filters in first conv layer") ndf = 64 # help="number of discriminator filters in first conv layer") scale_size = 286 # help="scale images to this size before cropping to 256x256") flip = True # flip images horizontally no_flip = True # don't flip images horizontally lr = 0.0002 # initial learning rate for adam beta1 = 0.5 # momentum term of adam l1_weight = 100.0 # weight on L1 term for generator gradient gan_weight = 1.0 # weight on GAN term for generator gradient output_filetype = "png" # 输出图像的格式 EPS = 1e-12 # 极小数,防止梯度为损失为0 CROP_SIZE = 256 # 图片的裁剪大小 # 命名元组,用于存放加载的数据集合创建好的模型 Examples = collections.namedtuple("Examples", "paths, inputs, targets, count, steps_per_epoch") Model = collections.namedtuple("Model", "outputs, predict_real, predict_fake, discrim_loss, discrim_grads_and_vars, gen_loss_GAN, gen_loss_L1, gen_grads_and_vars, train") # 图像预处理 [0, 1] => [-1, 1] def preprocess(image): with tf.name_scope("preprocess"): return image * 2 - 1 # 图像后处理[-1, 1] => [0, 1] def deprocess(image): with tf.name_scope("deprocess"): return (image + 1) / 2 # 判别器的卷积定义,batch_input为 [ batch , 256 , 256 , 6 ] def discrim_conv(batch_input, out_channels, stride): # [ batch , 256 , 256 , 6 ] ===>[ batch , 258 , 258 , 6 ] padded_input = tf.pad(batch_input, [[0, 0], [1, 1], [1, 1], [0, 0]], mode="CONSTANT") ''' [0,0]: 第一维batch大小不扩充 [1,1]:第二维图像宽度左右各扩充一列,用0填充 [1,1]:第三维图像高度上下各扩充一列,用0填充 [0,0]:第四维图像通道不做扩充 ''' return tf.layers.conv2d(padded_input, out_channels, kernel_size=4, strides=(stride, stride), padding="valid", kernel_initializer=tf.random_normal_initializer(0, 0.02)) # 生成器的卷积定义,卷积核为4*4,步长为2,输出图像为输入的一半 def gen_conv(batch_input, out_channels): # [batch, in_height, in_width, in_channels] => [batch, out_height, out_width, out_channels] initializer = tf.random_normal_initializer(0, 0.02) if separable_conv: return tf.layers.separable_conv2d(batch_input, out_channels, kernel_size=4, strides=(2, 2), padding="same", depthwise_initializer=initializer, pointwise_initializer=initializer) else: return tf.layers.conv2d(batch_input, out_channels, kernel_size=4, strides=(2, 2), padding="same", kernel_initializer=initializer) # 生成器的反卷积定义 def gen_deconv(batch_input, out_channels): # [batch, in_height, in_width, in_channels] => [batch, out_height, out_width, out_channels] initializer = tf.random_normal_initializer(0, 0.02) if separable_conv: _b, h, w, _c = batch_input.shape resized_input = tf.image.resize_images(batch_input, [h * 2, w * 2], method=tf.image.ResizeMethod.NEAREST_NEIGHBOR) return tf.layers.separable_conv2d(resized_input, out_channels, kernel_size=4, strides=(1, 1), padding="same", depthwise_initializer=initializer, pointwise_initializer=initializer) else: return tf.layers.conv2d_transpose(batch_input, out_channels, kernel_size=4, strides=(2, 2), padding="same", kernel_initializer=initializer) # 定义LReLu激活函数 def lrelu(x, a): with tf.name_scope("lrelu"): # adding these together creates the leak part and linear part # then cancels them out by subtracting/adding an absolute value term # leak: a*x/2 - a*abs(x)/2 # linear: x/2 + abs(x)/2 # this block looks like it has 2 inputs on the graph unless we do this x = tf.identity(x) return (0.5 * (1 + a)) * x + (0.5 * (1 - a)) * tf.abs(x) # 批量归一化图像 def batchnorm(inputs): return tf.layers.batch_normalization(inputs, axis=3, epsilon=1e-5, momentum=0.1, training=True, gamma_initializer=tf.random_normal_initializer(1.0, 0.02)) # 检查图像的维度 def check_image(image): assertion = tf.assert_equal(tf.shape(image)[-1], 3, message="image must have 3 color channels") with tf.control_dependencies([assertion]): image = tf.identity(image) if image.get_shape().ndims not in (3, 4): raise ValueError("image must be either 3 or 4 dimensions") # make the last dimension 3 so that you can unstack the colors shape = list(image.get_shape()) shape[-1] = 3 image.set_shape(shape) return image # 去除文件的后缀,获取文件名 def get_name(path): # os.path.basename(),返回path最后的文件名。若path以/或\结尾,那么就会返回空值。 # os.path.splitext(),分离文件名与扩展名;默认返回(fname,fextension)元组 name, _ = os.path.splitext(os.path.basename(path)) return name # 加载数据集,从文件读取-->解码-->归一化--->拆分为输入和目标-->像素转为[-1,1]-->转变形状 def load_examples(input_dir): if input_dir is None or not os.path.exists(input_dir): raise Exception("input_dir does not exist") # 匹配第一个参数的路径中所有的符合条件的文件,并将其以list的形式返回。 input_paths = glob.glob(os.path.join(input_dir, "*.jpg")) # 图像解码器 decode = tf.image.decode_jpeg if len(input_paths) == 0: input_paths = glob.glob(os.path.join(input_dir, "*.png")) decode = tf.image.decode_png if len(input_paths) == 0: raise Exception("input_dir contains no image files") # 如果文件名是数字,则用数字进行排序,否则用字母排序 if all(get_name(path).isdigit() for path in input_paths): input_paths = sorted(input_paths, key=lambda path: int(get_name(path))) else: input_paths = sorted(input_paths) sess = tf.Session() with tf.name_scope("load_images"): # 把我们需要的全部文件打包为一个tf内部的queue类型,之后tf开文件就从这个queue中取目录了, # 如果是训练模式时,shuffle为True path_queue = tf.train.string_input_producer(input_paths, shuffle=True) # Read的输出将是一个文件名(key)和该文件的内容(value,每次读取一个文件,分多次读取)。 reader = tf.WholeFileReader() paths, contents = reader.read(path_queue) # 对文件进行解码并且对图片作归一化处理 raw_input = decode(contents) raw_input = tf.image.convert_image_dtype(raw_input, dtype=tf.float32) # 归一化处理 # 判断两个值知否相等,如果不等抛出异常 assertion = tf.assert_equal(tf.shape(raw_input)[2], 3, message="image does not have 3 channels") ''' 对于control_dependencies这个管理器,只有当里面的操作是一个op时,才会生效,也就是先执行传入的 参数op,再执行里面的op。如果里面的操作不是定义的op,图中就不会形成一个节点,这样该管理器就失效了。 tf.identity是返回一个一模一样新的tensor的op,这会增加一个新节点到gragh中,这时control_dependencies就会生效. ''' with tf.control_dependencies([assertion]): raw_input = tf.identity(raw_input) raw_input.set_shape([None, None, 3]) # 图像值由[0,1]--->[-1, 1] width = tf.shape(raw_input)[1] # [height, width, channels] a_images = preprocess(raw_input[:, :width // 2, :]) # 256*256*3 b_images = preprocess(raw_input[:, width // 2:, :]) # 256*256*3 # 这里的which_direction为:BtoA if which_direction == "AtoB": inputs, targets = [a_images, b_images] elif which_direction == "BtoA": inputs, targets = [b_images, a_images] else: raise Exception("invalid direction") # synchronize seed for image operations so that we do the same operations to both # input and output images seed = random.randint(0, 2 ** 31 - 1) # 图像预处理,翻转、改变形状 with tf.name_scope("input_images"): input_images = transform(inputs) with tf.name_scope("target_images"): target_images = transform(targets) # 获得输入图像、目标图像的batch块 paths_batch, inputs_batch, targets_batch = tf.train.batch([paths, input_images, target_images], batch_size=batch_size) steps_per_epoch = int(math.ceil(len(input_paths) / batch_size)) return Examples( paths=paths_batch, # 输入的文件名块 inputs=inputs_batch, # 输入的图像块 targets=targets_batch, # 目标图像块 count=len(input_paths), # 数据集的大小 steps_per_epoch=steps_per_epoch, # batch的个数 ) # 图像预处理,翻转、改变形状 def transform(image): r = image if flip: r = tf.image.random_flip_left_right(r, seed=seed) # area produces a nice downscaling, but does nearest neighbor for upscaling # assume we're going to be doing downscaling here r = tf.image.resize_images(r, [scale_size, scale_size], method=tf.image.ResizeMethod.AREA) offset = tf.cast(tf.floor(tf.random_uniform([2], 0, scale_size - CROP_SIZE + 1, seed=seed)), dtype=tf.int32) if scale_size > CROP_SIZE: r = tf.image.crop_to_bounding_box(r, offset[0], offset[1], CROP_SIZE, CROP_SIZE) elif scale_size < CROP_SIZE: raise Exception("scale size cannot be less than crop size") return r # 创建生成器,这是一个编码解码器的变种,输入输出均为:256*256*3, 像素值为[-1,1] def create_generator(generator_inputs, generator_outputs_channels): layers = [] # encoder_1: [batch, 256, 256, in_channels] => [batch, 128, 128, ngf] with tf.variable_scope("encoder_1"): output = gen_conv(generator_inputs, ngf) # ngf为第一个卷积层的卷积核核数量,默认为 64 layers.append(output) layer_specs = [ ngf * 2, # encoder_2: [batch, 128, 128, ngf] => [batch, 64, 64, ngf * 2] ngf * 4, # encoder_3: [batch, 64, 64, ngf * 2] => [batch, 32, 32, ngf * 4] ngf * 8, # encoder_4: [batch, 32, 32, ngf * 4] => [batch, 16, 16, ngf * 8] ngf * 8, # encoder_5: [batch, 16, 16, ngf * 8] => [batch, 8, 8, ngf * 8] ngf * 8, # encoder_6: [batch, 8, 8, ngf * 8] => [batch, 4, 4, ngf * 8] ngf * 8, # encoder_7: [batch, 4, 4, ngf * 8] => [batch, 2, 2, ngf * 8] ngf * 8, # encoder_8: [batch, 2, 2, ngf * 8] => [batch, 1, 1, ngf * 8] ] # 卷积的编码器 for out_channels in layer_specs: with tf.variable_scope("encoder_%d" % (len(layers) + 1)): # 对最后一层使用激活函数 rectified = lrelu(layers[-1], 0.2) # [batch, in_height, in_width, in_channels] => [batch, in_height/2, in_width/2, out_channels] convolved = gen_conv(rectified, out_channels) output = batchnorm(convolved) layers.append(output) layer_specs = [ (ngf * 8, 0.5), # decoder_8: [batch, 1, 1, ngf * 8] => [batch, 2, 2, ngf * 8 * 2] (ngf * 8, 0.5), # decoder_7: [batch, 2, 2, ngf * 8 * 2] => [batch, 4, 4, ngf * 8 * 2] (ngf * 8, 0.5), # decoder_6: [batch, 4, 4, ngf * 8 * 2] => [batch, 8, 8, ngf * 8 * 2] (ngf * 8, 0.0), # decoder_5: [batch, 8, 8, ngf * 8 * 2] => [batch, 16, 16, ngf * 8 * 2] (ngf * 4, 0.0), # decoder_4: [batch, 16, 16, ngf * 8 * 2] => [batch, 32, 32, ngf * 4 * 2] (ngf * 2, 0.0), # decoder_3: [batch, 32, 32, ngf * 4 * 2] => [batch, 64, 64, ngf * 2 * 2] (ngf, 0.0), # decoder_2: [batch, 64, 64, ngf * 2 * 2] => [batch, 128, 128, ngf * 2] ] # 卷积的解码器 num_encoder_layers = len(layers) # 8 for decoder_layer, (out_channels, dropout) in enumerate(layer_specs): skip_layer = num_encoder_layers - decoder_layer - 1 with tf.variable_scope("decoder_%d" % (skip_layer + 1)): if decoder_layer == 0: # first decoder layer doesn't have skip connections # since it is directly connected to the skip_layer input = layers[-1] else: input = tf.concat([layers[-1], layers[skip_layer]], axis=3) rectified = tf.nn.relu(input) # [batch, in_height, in_width, in_channels] => [batch, in_height*2, in_width*2, out_channels] output = gen_deconv(rectified, out_channels) output = batchnorm(output) if dropout > 0.0: output = tf.nn.dropout(output, keep_prob=1 - dropout) layers.append(output) # decoder_1: [batch, 128, 128, ngf * 2] => [batch, 256, 256, generator_outputs_channels] with tf.variable_scope("decoder_1"): input = tf.concat([layers[-1], layers[0]], axis=3) rectified = tf.nn.relu(input) output = gen_deconv(rectified, generator_outputs_channels) output = tf.tanh(output) layers.append(output) return layers[-1] # 创建判别器,输入生成的图像和真实的图像:两个[batch,256,256,3],元素值值[-1,1],输出:[batch,30,30,1],元素值为概率 def create_discriminator(discrim_inputs, discrim_targets): n_layers = 3 layers = [] # 2x [batch, height, width, in_channels] => [batch, height, width, in_channels * 2] input = tf.concat([discrim_inputs, discrim_targets], axis=3) # layer_1: [batch, 256, 256, in_channels * 2] => [batch, 128, 128, ndf] with tf.variable_scope("layer_1"): convolved = discrim_conv(input, ndf, stride=2) rectified = lrelu(convolved, 0.2) layers.append(rectified) # layer_2: [batch, 128, 128, ndf] => [batch, 64, 64, ndf * 2] # layer_3: [batch, 64, 64, ndf * 2] => [batch, 32, 32, ndf * 4] # layer_4: [batch, 32, 32, ndf * 4] => [batch, 31, 31, ndf * 8] for i in range(n_layers): with tf.variable_scope("layer_%d" % (len(layers) + 1)): out_channels = ndf * min(2 ** (i + 1), 8) stride = 1 if i == n_layers - 1 else 2 # last layer here has stride 1 convolved = discrim_conv(layers[-1], out_channels, stride=stride) normalized = batchnorm(convolved) rectified = lrelu(normalized, 0.2) layers.append(rectified) # layer_5: [batch, 31, 31, ndf * 8] => [batch, 30, 30, 1] with tf.variable_scope("layer_%d" % (len(layers) + 1)): convolved = discrim_conv(rectified, out_channels=1, stride=1) output = tf.sigmoid(convolved) layers.append(output) return layers[-1] # 创建Pix2Pix模型,inputs和targets形状为:[batch_size, height, width, channels] def create_model(inputs, targets): with tf.variable_scope("generator"): out_channels = int(targets.get_shape()[-1]) outputs = create_generator(inputs, out_channels) # create two copies of discriminator, one for real pairs and one for fake pairs # they share the same underlying variables with tf.name_scope("real_discriminator"): with tf.variable_scope("discriminator"): # 2x [batch, height, width, channels] => [batch, 30, 30, 1] predict_real = create_discriminator(inputs, targets) # 条件变量图像和真实图像 with tf.name_scope("fake_discriminator"): with tf.variable_scope("discriminator", reuse=True): # 2x [batch, height, width, channels] => [batch, 30, 30, 1] predict_fake = create_discriminator(inputs, outputs) # 条件变量图像和生成的图像 # 判别器的损失,判别器希望V(G,D)尽可能大 with tf.name_scope("discriminator_loss"): # minimizing -tf.log will try to get inputs to 1 # predict_real => 1 # predict_fake => 0 discrim_loss = tf.reduce_mean(-(tf.log(predict_real + EPS) + tf.log(1 - predict_fake + EPS))) # 生成器的损失,生成器希望V(G,D)尽可能小 with tf.name_scope("generator_loss"): # predict_fake => 1 # abs(targets - outputs) => 0 gen_loss_GAN = tf.reduce_mean(-tf.log(predict_fake + EPS)) gen_loss_L1 = tf.reduce_mean(tf.abs(targets - outputs)) gen_loss = gen_loss_GAN * gan_weight + gen_loss_L1 * l1_weight # 判别器训练 with tf.name_scope("discriminator_train"): # 判别器需要优化的参数 discrim_tvars = [var for var in tf.trainable_variables() if var.name.startswith("discriminator")] # 优化器定义 discrim_optim = tf.train.AdamOptimizer(lr, beta1) # 计算损失函数对优化参数的梯度 discrim_grads_and_vars = discrim_optim.compute_gradients(discrim_loss, var_list=discrim_tvars) # 更新该梯度所对应的参数的状态,返回一个op discrim_train = discrim_optim.apply_gradients(discrim_grads_and_vars) # 生成器训练 with tf.name_scope("generator_train"): with tf.control_dependencies([discrim_train]): # 生成器需要优化的参数列表 gen_tvars = [var for var in tf.trainable_variables() if var.name.startswith("generator")] # 定义优化器 gen_optim = tf.train.AdamOptimizer(lr, beta1) # 计算需要优化的参数的梯度 gen_grads_and_vars = gen_optim.compute_gradients(gen_loss, var_list=gen_tvars) # 更新该梯度所对应的参数的状态,返回一个op gen_train = gen_optim.apply_gradients(gen_grads_and_vars) ''' 在采用随机梯度下降算法训练神经网络时,使用 tf.train.ExponentialMovingAverage 滑动平均操作的意义在于 提高模型在测试数据上的健壮性(robustness)。tensorflow 下的 tf.train.ExponentialMovingAverage 需要 提供一个衰减率(decay)。该衰减率用于控制模型更新的速度。该衰减率用于控制模型更新的速度, ExponentialMovingAverage 对每一个(待更新训练学习的)变量(variable)都会维护一个影子变量 (shadow variable)。影子变量的初始值就是这个变量的初始值, shadow_variable=decay×shadow_variable+(1−decay)×variable ''' ema = tf.train.ExponentialMovingAverage(decay=0.99) update_losses = ema.apply([discrim_loss, gen_loss_GAN, gen_loss_L1]) # global_step = tf.train.get_or_create_global_step() incr_global_step = tf.assign(global_step, global_step + 1) return Model( predict_real=predict_real, # 条件变量(输入图像)和真实图像之间的概率值,形状为;[batch,30,30,1] predict_fake=predict_fake, # 条件变量(输入图像)和生成图像之间的概率值,形状为;[batch,30,30,1] discrim_loss=ema.average(discrim_loss), # 判别器损失 discrim_grads_and_vars=discrim_grads_and_vars, # 判别器需要优化的参数和对应的梯度 gen_loss_GAN=ema.average(gen_loss_GAN), # 生成器的损失 gen_loss_L1=ema.average(gen_loss_L1), # 生成器的 L1损失 gen_grads_and_vars=gen_grads_and_vars, # 生成器需要优化的参数和对应的梯度 outputs=outputs, # 生成器生成的图片 train=tf.group(update_losses, incr_global_step, gen_train), # 打包需要run的操作op ) # 保存图像 def save_images(output_dir, fetches, step=None): image_dir = os.path.join(output_dir, "images") if not os.path.exists(image_dir): os.makedirs(image_dir) filesets = [] for i, in_path in enumerate(fetches["paths"]): name, _ = os.path.splitext(os.path.basename(in_path.decode("utf8"))) fileset = {"name": name, "step": step} for kind in ["inputs", "outputs", "targets"]: filename = name + "-" + kind + ".png" if step is not None: filename = "%08d-%s" % (step, filename) fileset[kind] = filename out_path = os.path.join(image_dir, filename) contents = fetches[kind][i] with open(out_path, "wb") as f: f.write(contents) filesets.append(fileset) return filesets # 将结果写入HTML网页 def append_index(output_dir, filesets, step=False): index_path = os.path.join(output_dir, "index.html") if os.path.exists(index_path): index = open(index_path, "a") else: index = open(index_path, "w") index.write("<html><body><table><tr>") if step: index.write("<th>step</th>") index.write("<th>name</th><th>input</th><th>output</th><th>target</th></tr>") for fileset in filesets: index.write("<tr>") if step: index.write("<td>%d</td>" % fileset["step"]) index.write("<td>%s</td>" % fileset["name"]) for kind in ["inputs", "outputs", "targets"]: index.write("<td><img src='images/%s'></td>" % fileset[kind]) index.write("</tr>") return index_path # 转变图像的尺寸、并且将[0,1]--->[0,255] def convert(image): if aspect_ratio != 1.0: # upscale to correct aspect ratio size = [CROP_SIZE, int(round(CROP_SIZE * aspect_ratio))] image = tf.image.resize_images(image, size=size, method=tf.image.ResizeMethod.BICUBIC) # 将数据的类型转换为8位无符号整型 return tf.image.convert_image_dtype(image, dtype=tf.uint8, saturate=True) # 主函数 def train(): # 设置随机数种子的值 global seed if seed is None: seed = random.randint(0, 2 ** 31 - 1) tf.set_random_seed(seed) np.random.seed(seed) random.seed(seed) # 创建目录 if not os.path.exists(train_output_dir): os.makedirs(train_output_dir) # 加载数据集,得到输入数据和目标数据并把范围变为 :[-1,1] examples = load_examples(train_input_dir) print("load successful ! examples count = %d" % examples.count) # 创建模型,inputs和targets是:[batch_size, height, width, channels] # 返回值: model = create_model(examples.inputs, examples.targets) print("create model successful!") # 图像处理[-1, 1] => [0, 1] inputs = deprocess(examples.inputs) targets = deprocess(examples.targets) outputs = deprocess(model.outputs) # 把[0,1]的像素点转为RGB值:[0,255] with tf.name_scope("convert_inputs"): converted_inputs = convert(inputs) with tf.name_scope("convert_targets"): converted_targets = convert(targets) with tf.name_scope("convert_outputs"): converted_outputs = convert(outputs) # 对图像进行编码以便于保存 with tf.name_scope("encode_images"): display_fetches = { "paths": examples.paths, # tf.map_fn接受一个函数对象和集合,用函数对集合中每个元素分别处理 "inputs": tf.map_fn(tf.image.encode_png, converted_inputs, dtype=tf.string, name="input_pngs"), "targets": tf.map_fn(tf.image.encode_png, converted_targets, dtype=tf.string, name="target_pngs"), "outputs": tf.map_fn(tf.image.encode_png, converted_outputs, dtype=tf.string, name="output_pngs"), } with tf.name_scope("parameter_count"): parameter_count = tf.reduce_sum([tf.reduce_prod(tf.shape(v)) for v in tf.trainable_variables()]) # 只保存最新一个checkpoint saver = tf.train.Saver(max_to_keep=20) init = tf.global_variables_initializer() with tf.Session() as sess: sess.run(init) print("parameter_count =", sess.run(parameter_count)) if max_epochs is not None: max_steps = examples.steps_per_epoch * max_epochs # 400X200=80000 # 因为是从文件中读取数据,所以需要启动start_queue_runners() # 这个函数将会启动输入管道的线程,填充样本到队列中,以便出队操作可以从队列中拿到样本。 coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(coord=coord) # 运行训练集 print("begin trainning......") print("max_steps:", max_steps) start = time.time() for step in range(max_steps): def should(freq): return freq > 0 and ((step + 1) % freq == 0 or step == max_steps - 1) print("step:", step) # 定义一个需要run的所有操作的字典 fetches = { "train": model.train } # progress_freq为 50,每50次计算一次三个损失,显示进度 if should(progress_freq): fetches["discrim_loss"] = model.discrim_loss fetches["gen_loss_GAN"] = model.gen_loss_GAN fetches["gen_loss_L1"] = model.gen_loss_L1 # display_freq为 50,每50次保存一次输入、目标、输出的图像 if should(display_freq): fetches["display"] = display_fetches # 运行各种操作, results = sess.run(fetches) # display_freq为 50,每50次保存输入、目标、输出的图像 if should(display_freq): print("saving display images") filesets = save_images(train_output_dir, results["display"], step=step) append_index(train_output_dir, filesets, step=True) # progress_freq为 50,每50次打印一次三种损失的大小,显示进度 if should(progress_freq): # global_step will have the correct step count if we resume from a checkpoint train_epoch = math.ceil(step / examples.steps_per_epoch) train_step = (step - 1) % examples.steps_per_epoch + 1 rate = (step + 1) * batch_size / (time.time() - start) remaining = (max_steps - step) * batch_size / rate print("progress epoch %d step %d image/sec %0.1f remaining %dm" % ( train_epoch, train_step, rate, remaining / 60)) print("discrim_loss", results["discrim_loss"]) print("gen_loss_GAN", results["gen_loss_GAN"]) print("gen_loss_L1", results["gen_loss_L1"]) # save_freq为500,每500次保存一次模型 if should(save_freq): print("saving model") saver.save(sess, os.path.join(train_output_dir, "model"), global_step=step) # 测试 def test(): # 设置随机数种子的值 global seed if seed is None: seed = random.randint(0, 2 ** 31 - 1) tf.set_random_seed(seed) np.random.seed(seed) random.seed(seed) # 创建目录 if not os.path.exists(test_output_dir): os.makedirs(test_output_dir) if checkpoint is None: raise Exception("checkpoint required for test mode") # disable these features in test mode scale_size = CROP_SIZE flip = False # 加载数据集,得到输入数据和目标数据 examples = load_examples(test_input_dir) print("load successful ! examples count = %d" % examples.count) # 创建模型,inputs和targets是:[batch_size, height, width, channels] model = create_model(examples.inputs, examples.targets) print("create model successful!") # 图像处理[-1, 1] => [0, 1] inputs = deprocess(examples.inputs) targets = deprocess(examples.targets) outputs = deprocess(model.outputs) # 把[0,1]的像素点转为RGB值:[0,255] with tf.name_scope("convert_inputs"): converted_inputs = convert(inputs) with tf.name_scope("convert_targets"): converted_targets = convert(targets) with tf.name_scope("convert_outputs"): converted_outputs = convert(outputs) # 对图像进行编码以便于保存 with tf.name_scope("encode_images"): display_fetches = { "paths": examples.paths, # tf.map_fn接受一个函数对象和集合,用函数对集合中每个元素分别处理 "inputs": tf.map_fn(tf.image.encode_png, converted_inputs, dtype=tf.string, name="input_pngs"), "targets": tf.map_fn(tf.image.encode_png, converted_targets, dtype=tf.string, name="target_pngs"), "outputs": tf.map_fn(tf.image.encode_png, converted_outputs, dtype=tf.string, name="output_pngs"), } sess = tf.InteractiveSession() saver = tf.train.Saver(max_to_keep=1) ckpt = tf.train.get_checkpoint_state(checkpoint) saver.restore(sess,ckpt.model_checkpoint_path) start = time.time() coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(coord=coord) for step in range(examples.count): results = sess.run(display_fetches) filesets = save_images(test_output_dir, results) for i, f in enumerate(filesets): print("evaluated image", f["name"]) index_path = append_index(test_output_dir, filesets) print("wrote index at", index_path) print("rate", (time.time() - start) / max_steps) if __name__ == '__main__': train() #test()
caffe生成解决方案时出错
编译环境:win10 vs2017 15.5.6 boost_1_70_0 主要报错: Unknown compiler version - please run the configure tests and report the results 再次点生成解决方案时的主要报错: for each 语句不能在“std::array *”类型的变量上操作 ; “std::array”: 模板 参数太少 ; 无法打开文件“libboost_date_time-vc140-mt-gd-1_59.lib” 等等; 因为只能一条条复制,所以如有需要,可提供详细错误; 下面是重新生成解决方案的具体报错,有大佬来救救我吗,感激不尽!需要更详细信息可以直说。 报错:1>------ 已启动全部重新生成: 项目: libcaffe, 配置: Debug x64 ------ 1>ProtoCompile.cmd : Create proto temp directory "C:\Users\Kay Chow\Documents\caffe-master\windows\..\src\caffe\proto\temp" 1>ProtoCompile.cmd : Generating "C:\Users\Kay Chow\Documents\caffe-master\windows\..\src\caffe\proto\temp\caffe.pb.h" and "C:\Users\Kay Chow\Documents\caffe-master\windows\..\src\caffe\proto\temp\caffe.pb.cc" 1>ProtoCompile.cmd : Create proto include directory 1>子目录或文件 C:\Users\Kay Chow\Documents\caffe-master\windows\..\include\caffe\proto 已经存在。 1>ProtoCompile.cmd : Compare newly compiled caffe.pb.h with existing one 1>blob.cpp 1>common.cpp 1>data_reader.cpp 1>data_transformer.cpp 1>internal_thread.cpp 1>layer.cpp 1>absval_layer.cpp 1>accuracy_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>argmax_layer.cpp 1>base_conv_layer.cpp 1>base_data_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>batch_norm_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>batch_reindex_layer.cpp 1>bias_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>bnll_layer.cpp 1>box_annotator_ohem_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>concat_layer.cpp 1>contrastive_loss_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>conv_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>crop_layer.cpp 1>cudnn_conv_layer.cpp 1>cudnn_lcn_layer.cpp 1>cudnn_lrn_layer.cpp 1>cudnn_pooling_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>cudnn_relu_layer.cpp 1>cudnn_sigmoid_layer.cpp 1>cudnn_softmax_layer.cpp 1>cudnn_tanh_layer.cpp 1>data_layer.cpp 1>deconv_layer.cpp 1>dropout_layer.cpp 1>dummy_data_layer.cpp 1>eltwise_layer.cpp 1>elu_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>embed_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>euclidean_loss_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>exp_layer.cpp 1>filter_layer.cpp 1>flatten_layer.cpp 1>hdf5_data_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>hdf5_output_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>hinge_loss_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>im2col_layer.cpp 1>image_data_layer.cpp 1>infogain_loss_layer.cpp 1>inner_product_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>input_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>log_layer.cpp 1>loss_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>lrn_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>memory_data_layer.cpp 1>multinomial_logistic_loss_layer.cpp 1>mvn_layer.cpp 1>neuron_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>parameter_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>pooling_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>power_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>prelu_layer.cpp 1>psroi_pooling_layer.cpp 1>reduction_layer.cpp 1>relu_layer.cpp 1>reshape_layer.cpp 1>scale_layer.cpp 1>sigmoid_cross_entropy_loss_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>sigmoid_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>silence_layer.cpp 1>slice_layer.cpp 1>smooth_l1_loss_layer.cpp 1>smooth_L1_loss_ohem_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>softmax_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>softmax_loss_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>softmax_loss_ohem_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>split_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>spp_layer.cpp 1>tanh_layer.cpp 1>threshold_layer.cpp 1>tile_layer.cpp 1>window_data_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>layer_factory.cpp 1>net.cpp 1>parallel.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>caffe.pb.cc 1>solver.cpp 1>adadelta_solver.cpp 1>adagrad_solver.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>adam_solver.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>nesterov_solver.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>rmsprop_solver.cpp 1>sgd_solver.cpp 1>syncedmem.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>benchmark.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>blocking_queue.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>cudnn.cpp 1>db.cpp 1>db_leveldb.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>db_lmdb.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>hdf5.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>im2col.cpp 1>insert_splits.cpp 1>io.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>math_functions.cpp 1>signal_handler.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>upgrade_proto.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>libcaffe.vcxproj -> C:\Users\Kay Chow\Documents\caffe-master\windows\..\Build\x64\Debug\libcaffe.lib 1>BinplaceCudaDependencies : CPU only build, don't copy cuda dependencies. 2>------ 已启动全部重新生成: 项目: caffe, 配置: Debug x64 ------ 3>------ 已启动全部重新生成: 项目: caffe.managed, 配置: Debug x64 ------ 4>------ 已启动全部重新生成: 项目: convert_cifar_data, 配置: Debug x64 ------ 5>------ 已启动全部重新生成: 项目: classification, 配置: Debug x64 ------ 6>------ 已启动全部重新生成: 项目: convert_mnist_data, 配置: Debug x64 ------ 7>------ 已启动全部重新生成: 项目: convert_mnist_siamese_data, 配置: Debug x64 ------ 8>------ 已启动全部重新生成: 项目: upgrade_net_proto_binary, 配置: Debug x64 ------ 9>------ 已启动全部重新生成: 项目: upgrade_net_proto_text, 配置: Debug x64 ------ 2>caffe.cpp 9>upgrade_net_proto_text.cpp 2>Unknown compiler version - please run the configure tests and report the results 4>convert_cifar_data.cpp 3>Stdafx.cpp 9>Unknown compiler version - please run the configure tests and report the results 5>classification.cpp 6>convert_mnist_data.cpp 7>convert_mnist_siamese_data.cpp 4>Unknown compiler version - please run the configure tests and report the results 5>Unknown compiler version - please run the configure tests and report the results 8>upgrade_net_proto_binary.cpp 6>Unknown compiler version - please run the configure tests and report the results 8>Unknown compiler version - please run the configure tests and report the results 7>Unknown compiler version - please run the configure tests and report the results 3>AssemblyInfo.cpp 3>caffelib.cpp 3>caffelib.cpp(61): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(62): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(62): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(68): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(68): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(68): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(69): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(69): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(127): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(128): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(128): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(136): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(136): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(136): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(137): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(137): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(64): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(64): error C2027: 使用了未定义类型“std::array” 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(64): error C3536: “outputs”: 初始化之前无法使用 3>caffelib.cpp(64): error C2109: 下标要求数组或指针类型 3>caffelib.cpp(65): error C2440: “return”: 无法从“int”转换为“std::array *” 3>caffelib.cpp(65): note: 从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换 3>caffelib.cpp(71): error C3285: for each 语句不能在“std::array *”类型的变量上操作 3>caffelib.cpp(72): error C2065: “name”: 未声明的标识符 3>caffelib.cpp(74): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(74): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(74): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(74): error C2027: 使用了未定义类型“std::array” 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(78): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(78): error C2027: 使用了未定义类型“std::array” 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(78): error C3536: “values”: 初始化之前无法使用 3>caffelib.cpp(78): error C2109: 下标要求数组或指针类型 3>caffelib.cpp(79): error C3536: “outputs”: 初始化之前无法使用 3>caffelib.cpp(79): error C2109: 下标要求数组或指针类型 3>caffelib.cpp(81): error C2440: “return”: 无法从“int”转换为“std::array *” 3>caffelib.cpp(81): note: 从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换 3>caffelib.cpp(132): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(132): error C2027: 使用了未定义类型“std::array” 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(132): error C3536: “outputs”: 初始化之前无法使用 3>caffelib.cpp(132): error C2109: 下标要求数组或指针类型 3>caffelib.cpp(133): error C2440: “return”: 无法从“int”转换为“std::array *” 3>caffelib.cpp(133): note: 从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换 3>caffelib.cpp(141): error C3285: for each 语句不能在“std::array *”类型的变量上操作 3>caffelib.cpp(142): error C2065: “name”: 未声明的标识符 3>caffelib.cpp(144): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(144): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(144): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(144): error C2027: 使用了未定义类型“std::array” 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(148): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(148): error C2027: 使用了未定义类型“std::array” 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(148): error C3536: “values”: 初始化之前无法使用 3>caffelib.cpp(148): error C2109: 下标要求数组或指针类型 3>caffelib.cpp(149): error C3536: “outputs”: 初始化之前无法使用 3>caffelib.cpp(149): error C2109: 下标要求数组或指针类型 3>caffelib.cpp(151): error C2440: “return”: 无法从“int”转换为“std::array *” 3>caffelib.cpp(151): note: 从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换 3>已完成生成项目“caffe.managed.vcxproj”的操作 - 失败。 4>LINK : fatal error LNK1104: 无法打开文件“libboost_thread-vc140-mt-gd-1_59.lib” 10>------ 已启动全部重新生成: 项目: upgrade_solver_proto_text, 配置: Debug x64 ------ 4>已完成生成项目“convert_cifar_data.vcxproj”的操作 - 失败。 6>LINK : fatal error LNK1104: 无法打开文件“libboost_thread-vc140-mt-gd-1_59.lib” 6>已完成生成项目“convert_mnist_data.vcxproj”的操作 - 失败。 10>upgrade_solver_proto_text.cpp 7>LINK : fatal error LNK1104: 无法打开文件“libboost_thread-vc140-mt-gd-1_59.lib” 7>已完成生成项目“convert_mnist_siamese_data.vcxproj”的操作 - 失败。 10>Unknown compiler version - please run the configure tests and report the results 9>LINK : fatal error LNK1104: 无法打开文件“libboost_date_time-vc140-mt-gd-1_59.lib” 9>已完成生成项目“upgrade_net_proto_text.vcxproj”的操作 - 失败。 8>LINK : fatal error LNK1104: 无法打开文件“libboost_date_time-vc140-mt-gd-1_59.lib” 8>已完成生成项目“upgrade_net_proto_binary.vcxproj”的操作 - 失败。 5>LINK : fatal error LNK1104: 无法打开文件“libboost_date_time-vc140-mt-gd-1_59.lib” 5>已完成生成项目“classification.vcxproj”的操作 - 失败。 2>LINK : fatal error LNK1104: 无法打开文件“libboost_date_time-vc140-mt-gd-1_59.lib” 2>已完成生成项目“caffe.vcxproj”的操作 - 失败。 11>------ 已启动全部重新生成: 项目: compute_image_mean, 配置: Debug x64 ------ 12>------ 已启动全部重新生成: 项目: convert_imageset, 配置: Debug x64 ------ 13>------ 已启动全部重新生成: 项目: extract_features, 配置: Debug x64 ------ 14>------ 已启动全部重新生成: 项目: test_all, 配置: Debug x64 ------ 15>------ 已启动全部重新生成: 项目: pycaffe, 配置: Debug x64 ------ 16>------ 已启动全部重新生成: 项目: matcaffe, 配置: Debug x64 ------ 15>Skipping project pycaffe, Python support is not enabled in CommonSettings.props. 16>Skipping project matcaffe, Matlab support is not enabled in CommonSettings.props. 12>convert_imageset.cpp 11>compute_image_mean.cpp 13>extract_features.cpp 14>test_accuracy_layer.cpp 14>test_argmax_layer.cpp 14>test_batch_norm_layer.cpp 14>test_batch_reindex_layer.cpp 14>test_benchmark.cpp 14>test_bias_layer.cpp 14>test_blob.cpp 14>test_caffe_main.cpp 14>Unknown compiler version - please run the configure tests and report the results 13>Unknown compiler version - please run the configure tests and report the results 12>Unknown compiler version - please run the configure tests and report the results 11>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 10>LINK : fatal error LNK1104: 无法打开文件“libboost_date_time-vc140-mt-gd-1_59.lib” 10>已完成生成项目“upgrade_solver_proto_text.vcxproj”的操作 - 失败。 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 11>LINK : fatal error LNK1104: 无法打开文件“libboost_filesystem-vc140-mt-gd-1_59.lib” 11>已完成生成项目“compute_image_mean.vcxproj”的操作 - 失败。 12>LINK : fatal error LNK1104: 无法打开文件“libboost_filesystem-vc140-mt-gd-1_59.lib” 12>已完成生成项目“convert_imageset.vcxproj”的操作 - 失败。 13>LINK : fatal error LNK1104: 无法打开文件“libboost_filesystem-vc140-mt-gd-1_59.lib” 13>已完成生成项目“extract_features.vcxproj”的操作 - 失败。 14>test_common.cpp 14>test_concat_layer.cpp 14>test_contrastive_loss_layer.cpp 14>test_convolution_layer.cpp 14>test_crop_layer.cpp 14>test_data_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_data_transformer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_db.cpp 14>test_deconvolution_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_dummy_data_layer.cpp 14>test_eltwise_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_embed_layer.cpp 14>test_euclidean_loss_layer.cpp 14>test_filler.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_filter_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_flatten_layer.cpp 14>test_gradient_based_solver.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_hdf5data_layer.cpp 14>test_hdf5_output_layer.cpp 14>test_hinge_loss_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_im2col_layer.cpp 14>test_image_data_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_infogain_loss_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_inner_product_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_internal_thread.cpp 14>test_io.cpp 14>test_layer_factory.cpp 14>test_lrn_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_math_functions.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_maxpool_dropout_layers.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_memory_data_layer.cpp 14>test_multinomial_logistic_loss_layer.cpp 14>test_mvn_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_net.cpp 14>test_neuron_layer.cpp 14>test_platform.cpp 14>test_pooling_layer.cpp 14>test_power_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_protobuf.cpp 14>test_random_number_generator.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_reduction_layer.cpp 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(1010): error C2220: 警告被视为错误 - 没有生成“object”文件 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(992): note: 编译 类 模板 成员函数 "void caffe::NetTest_TestLossWeightMidNet_Test<T>::TestBody(void)" 时 14> with 14> [ 14> T=Type 14> ] 14>c:\users\kay chow\documents\caffe-master\src\gtest\gtest.h(7341): note: 参见对正在编译的 类 模板 实例化 "caffe::NetTest_TestLossWeightMidNet_Test<T>" 的引用 14> with 14> [ 14> T=Type 14> ] (编译源文件 ..\..\src\caffe\test\test_net.cpp) 14>c:\users\kay chow\documents\caffe-master\src\gtest\gtest.h(7327): note: 编译 类 模板 成员函数 "bool testing::internal::TypeParameterizedTest<caffe::NetTest,testing::internal::TemplateSel<caffe::NetTest_TestLossWeightMidNet_Test>,caffe::gtest_type_params_NetTest_>::Register(const char *,const char *,const char *,int)" 时 (编译源文件 ..\..\src\caffe\test\test_net.cpp) 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(992): note: 参见对正在编译的函数 模板 实例化“bool testing::internal::TypeParameterizedTest<caffe::NetTest,testing::internal::TemplateSel<caffe::NetTest_TestLossWeightMidNet_Test>,caffe::gtest_type_params_NetTest_>::Register(const char *,const char *,const char *,int)”的引用 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(992): note: 参见对正在编译的 类 模板 实例化 "testing::internal::TypeParameterizedTest<caffe::NetTest,testing::internal::TemplateSel<caffe::NetTest_TestLossWeightMidNet_Test>,caffe::gtest_type_params_NetTest_>" 的引用 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(1010): warning C4838: 从“double”转换到“Dtype”需要收缩转换 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(961): warning C4838: 从“double”转换到“Dtype”需要收缩转换 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(941): note: 编译 类 模板 成员函数 "void caffe::NetTest_TestLossWeight_Test<T>::TestBody(void)" 时 14> with 14> [ 14> T=Type 14> ] 14>c:\users\kay chow\documents\caffe-master\src\gtest\gtest.h(7341): note: 参见对正在编译的 类 模板 实例化 "caffe::NetTest_TestLossWeight_Test<T>" 的引用 14> with 14> [ 14> T=Type 14> ] (编译源文件 ..\..\src\caffe\test\test_net.cpp) 14>c:\users\kay chow\documents\caffe-master\src\gtest\gtest.h(7327): note: 编译 类 模板 成员函数 "bool testing::internal::TypeParameterizedTest<caffe::NetTest,testing::internal::TemplateSel<caffe::NetTest_TestLossWeight_Test>,caffe::gtest_type_params_NetTest_>::Register(const char *,const char *,const char *,int)" 时 (编译源文件 ..\..\src\caffe\test\test_net.cpp) 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(941): note: 参见对正在编译的函数 模板 实例化“bool testing::internal::TypeParameterizedTest<caffe::NetTest,testing::internal::TemplateSel<caffe::NetTest_TestLossWeight_Test>,caffe::gtest_type_params_NetTest_>::Register(const char *,const char *,const char *,int)”的引用 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(941): note: 参见对正在编译的 类 模板 实例化 "testing::internal::TypeParameterizedTest<caffe::NetTest,testing::internal::TemplateSel<caffe::NetTest_TestLossWeight_Test>,caffe::gtest_type_params_NetTest_>" 的引用 14>test_reshape_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_scale_layer.cpp 14>test_sigmoid_cross_entropy_loss_layer.cpp 14>test_slice_layer.cpp 14>test_softmax_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_softmax_with_loss_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_solver.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_solver_factory.cpp 14>test_split_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_spp_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_stochastic_pooling.cpp 14>test_syncedmem.cpp 14>test_tanh_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_threshold_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_tile_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_upgrade_proto.cpp 14>test_util_blas.cpp 14>gtest-all.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>已完成生成项目“test_all.vcxproj”的操作 - 失败。 ========== 全部重新生成: 成功 3 个,失败 13 个,跳过 0 个 ==========
网上下载的项目-导入ssm小米商城的后台项目访问登录界面login的时候无法跳转到其他页面是怎么回事?
在网上下载的ssm小米商城的后台项目 1:项目没有错误,,, 2:在访问登录界面login的时候- 却无法跳转到其他页面 3:数据库不知道是不是正常 4:我的数据库设置了管理员登录:admin 密码123456 5: 写了个generatorConfig.xml 6:::新增:看到有人回复说数据库的名字没有改: 我用的是mysql 数据库名是:shop 密码是:1234 userId我不知道是要赋值什么值,,一般不是userName吗??但是这个项目中的确实userId ,,所以我也给他 赋值了数据库的用户名 “root”但是这样配置根本就没有用,,同样无法跳转页面:::: 如果配置错了,,麻烦指出来,,非常感谢,,新手新手,,实力有限抱歉 求大神帮助,,,呜呜,,还是跳转不了 数据库图片: ![图片说明](https://img-ask.csdn.net/upload/201812/26/1545786449_770158.png) 数据库配置图: ![图片说明](https://img-ask.csdn.net/upload/201812/26/1545786860_325497.png) 按照网友提出的问题:修改数据库名和密码: 我把connectionURL 的 work_attendance也改成了shop,, 如下: //connectionURL="jdbc:mysql://localhost:3306/work_attendance" connectionURL="jdbc:mysql://localhost:3306/shop" <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/shop" userId="root" password="1234"> </jdbcConnection> 但是还是没有用,,,依然无法跳转,,总感觉没有错误,,,不知道错在哪了。。。。,,,,大神,,大神们求帮助中 代码如下: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" > <generatorConfiguration> <!--classPathEntry:数据库的JDBC驱动 --> <!-- location="D:\Develop\MvnRepo\mysql\mysql-connector-java\5.1.34\mysql-connector-java-5.1.34.jar"/> --> <classPathEntry location="D:\Users\lydia\workspaceSSH\shopCMS\src\main\webapp\WEB-INF\lib\mysql-connector-java-5.1.34.jar"/> <context id="MysqlTables" targetRuntime="MyBatis3"> <!-- 注意这里面的顺序确定的,不能随变更改 --> <!-- 自定义的分页插件 <plugin type="com.deppon.foss.module.helloworld.shared.PaginationPlugin"/> --> <!-- 可选的(0 or 1) --> <!-- 注释生成器 --> <commentGenerator> <!-- 是否去除自动生成的注释 true:是 : false:否 --> <property name="suppressAllComments" value="true"/> </commentGenerator> <!-- 必须的(1 required) --> <!--数据库连接的信息:驱动类、连接地址、用户名、密码 connectionURL="jdbc:mysql://localhost:3306/work_attendance" --> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/shop" userId="root" password="1234"> </jdbcConnection> ,, 登录界面 ![图片说明](https://img-ask.csdn.net/upload/201812/24/1545659180_616623.jpg) 每次一点击登录: console界面就显示: [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:845) DispatcherServlet with name 'SpringMVC' processing POST request for [/shopCMS/login/check] [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:297) Looking up handler method for path /login/check [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:302) Returning handler method [public java.lang.String com.shop.shopmanager.controller.LoginController.checkLogin(javax.servlet.http.HttpServletRequest) throws java.io.UnsupportedEncodingException,java.security.NoSuchAlgorithmException] [DEBUG][2018-12-24 21:47:08] org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:248) Returning cached instance of singleton bean 'loginController' [DEBUG][2018-12-24 21:47:08] org.mybatis.spring.SqlSessionUtils.getSqlSession(SqlSessionUtils.java:104) Creating a new SqlSession [DEBUG][2018-12-24 21:47:08] org.mybatis.spring.SqlSessionUtils.getSqlSession(SqlSessionUtils.java:140) SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7738ee46] was not registered for synchronization because synchronization is not active [DEBUG][2018-12-24 21:47:08] org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:110) Fetching JDBC Connection from DataSource [DEBUG][2018-12-24 21:47:08] org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:86) JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@41131e6d] will not be managed by Spring [DEBUG][2018-12-24 21:47:08] org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:139) ==> Preparing: SELECT cu.user_id AS user_id4, login_name, login_password, salt, user_name, real_name, sex, age, pic_img, cu.`status` AS status4, email, telephone, cu.create_time AS create_time4, cu.update_time AS update_time4, cr.role_id AS role_id2, role_name, role_sign, is_system, cr.`status` AS status2, cr.create_time AS create_time2, cr.update_time AS update_time2, cr.remarks AS remarks2, cm.menu_id AS menu_id1, parent_id, menu_type, menu_code, menu_name, sort, href, icon, cm.`status` AS status1, permission, cm.create_time AS create_time1, cm.update_time AS update_time1, cm.remarks AS remarks1 FROM cms_menu cm, cms_role cr, cms_role_menu crm, cms_user cu, cms_user_role cur WHERE crm.role_id = cr.role_id AND crm.menu_id = cm.menu_id AND cur.user_id = cu.user_id AND cur.role_id = cr.role_id AND cu.login_name = ?; [DEBUG][2018-12-24 21:47:08] org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:139) ==> Parameters: admin(String) [DEBUG][2018-12-24 21:47:08] org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:139) <== Total: 73 [DEBUG][2018-12-24 21:47:08] org.mybatis.spring.SqlSessionUtils.closeSqlSession(SqlSessionUtils.java:168) Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7738ee46] [DEBUG][2018-12-24 21:47:08] org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:327) Returning JDBC Connection to DataSource [DEBUG][2018-12-24 21:47:08] org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:569) Looked up AuthenticationInfo [admin] from doGetAuthenticationInfo [DEBUG][2018-12-24 21:47:08] org.apache.shiro.realm.AuthenticatingRealm.cacheAuthenticationInfoIfPossible(AuthenticatingRealm.java:507) AuthenticationInfo caching is disabled for info [admin]. Submitted token: [org.apache.shiro.authc.UsernamePasswordToken - admin, rememberMe=false]. [DEBUG][2018-12-24 21:47:08] org.mybatis.spring.SqlSessionUtils.getSqlSession(SqlSessionUtils.java:104) Creating a new SqlSession [DEBUG][2018-12-24 21:47:08] org.mybatis.spring.SqlSessionUtils.getSqlSession(SqlSessionUtils.java:140) SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@33b81d6e] was not registered for synchronization because synchronization is not active [DEBUG][2018-12-24 21:47:08] org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:110) Fetching JDBC Connection from DataSource [DEBUG][2018-12-24 21:47:08] org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:86) JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@41131e6d] will not be managed by Spring [DEBUG][2018-12-24 21:47:08] org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:139) ==> Preparing: SELECT cu.user_id AS user_id4, login_name, login_password, salt, user_name, real_name, sex, age, pic_img, cu.`status` AS status4, email, telephone, cu.create_time AS create_time4, cu.update_time AS update_time4, cr.role_id AS role_id2, role_name, role_sign, is_system, cr.`status` AS status2, cr.create_time AS create_time2, cr.update_time AS update_time2, cr.remarks AS remarks2, cm.menu_id AS menu_id1, parent_id, menu_type, menu_code, menu_name, sort, href, icon, cm.`status` AS status1, permission, cm.create_time AS create_time1, cm.update_time AS update_time1, cm.remarks AS remarks1 FROM cms_menu cm, cms_role cr, cms_role_menu crm, cms_user cu, cms_user_role cur WHERE crm.role_id = cr.role_id AND crm.menu_id = cm.menu_id AND cur.user_id = cu.user_id AND cur.role_id = cr.role_id AND cu.login_name = ?; [DEBUG][2018-12-24 21:47:08] org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:139) ==> Parameters: admin(String) [DEBUG][2018-12-24 21:47:08] org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:139) <== Total: 73 [DEBUG][2018-12-24 21:47:08] org.mybatis.spring.SqlSessionUtils.closeSqlSession(SqlSessionUtils.java:168) Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@33b81d6e] [DEBUG][2018-12-24 21:47:08] org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:327) Returning JDBC Connection to DataSource 原密码:123456Dts7jk 加密之后的密码为:lZQ/OoEBjTylEoEfxoyWeQ== [DEBUG][2018-12-24 21:47:08] org.apache.shiro.web.servlet.SimpleCookie.addCookieHeader(SimpleCookie.java:226) Added HttpServletResponse Cookie [rememberMe=deleteMe; Path=/shopCMS; Max-Age=0; Expires=Sun, 23-Dec-2018 13:47:08 GMT] [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdviceChain.invoke(ResponseBodyAdviceChain.java:61) Invoking ResponseBodyAdvice chain for body=login_fail [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdviceChain.invoke(ResponseBodyAdviceChain.java:83) After ResponseBodyAdvice chain body=login_fail [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:163) Written [login_fail] as "text/plain;charset=ISO-8859-1" using [org.springframework.http.converter.StringHttpMessageConverter@395cf6a4] [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1018) Null ModelAndView returned to DispatcherServlet with name 'SpringMVC': assuming HandlerAdapter completed request handling [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:996) Successfully completed request [DEBUG][2018-12-24 21:47:08] org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:248) Returning cached instance of singleton bean 'sqlSessionFactory' [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:845) DispatcherServlet with name 'SpringMVC' processing GET request for [/shopCMS/login] [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:297) Looking up handler method for path /login [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:302) Returning handler method [public java.lang.String com.shop.shopmanager.controller.LoginController.login()] [DEBUG][2018-12-24 21:47:08] org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:248) Returning cached instance of singleton bean 'loginController' [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:931) Last-Modified value for [/shopCMS/login] is: -1 [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1225) Rendering view [org.springframework.web.servlet.view.JstlView: name 'login'; URL [/WEB-INF/views/login.jsp]] in DispatcherServlet with name 'SpringMVC' [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:166) Forwarding to resource [/WEB-INF/views/login.jsp] in InternalResourceView 'login' [DEBUG][2018-12-24 21:47:08] org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:996) Successfully completed request [DEBUG][2018-12-24 21:47:08] org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:248) Returning cached instance of singleton bean 'sqlSessionFactory' ``` ``` 我的数据库中有admin和密码 123456,,但是就是无法跳转到登录后的页面希望大佬能帮我看看是什么原因》》》 ------------------------------------ 后续添加,,,,麻烦大佬结合上述和下述看看是什么问题,,拜托拜托, 1:数据库用户表信息: ![图片说明](https://img-ask.csdn.net/upload/201812/28/1545962958_570862.png) 2:我的项目结构: ![图片说明](https://img-ask.csdn.net/upload/201812/28/1545962858_134226.png) 3:以下是登录控制器“LoginController”的代码: package com.shop.shopmanager.controller; import java.io.UnsupportedEncodingException; import java.security.NoSuchAlgorithmException; import javax.servlet.http.HttpServletRequest; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.subject.Subject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.shop.shopmanager.service.CmsUserService; /** * @Author 康健 * @Date 2017/8/14 14:54 */ @Controller @RequestMapping("login") public class LoginController { @Autowired private CmsUserService cmsUserService; /** * @Author JackWang [www.coder520.com] * @Date 2017/6/18 12:47 * @Description 登录页面 */ @RequestMapping public String login() { return "login"; } /** * @Author JackWang [www.coder520.com] * @Date 2017/6/18 12:47 * @Description 校验登录 */ @RequestMapping("/check") @ResponseBody public String checkLogin(HttpServletRequest request) throws UnsupportedEncodingException, NoSuchAlgorithmException { String username = request.getParameter("username"); String pwd = request.getParameter("password"); UsernamePasswordToken token = new UsernamePasswordToken(username, pwd); // token.setRememberMe(true); Subject subject = SecurityUtils.getSubject(); try { subject.login(token); SecurityUtils.getSubject().getSession().setTimeout(1800000); } catch (Exception e) { return "login_fail"; } return "login_succ"; } /* @RequestMapping("/register") @ResponseBody public String register(@RequestBody User user) throws UnsupportedEncodingException, NoSuchAlgorithmException { userService.createUser(user); return "succ"; }*/ } 4:UsernamePasswordToken 我没有这个类,这好像是一个方法-------网上好像说这是个认证机制,,不知道跳转不了跟这个有没有关系 网上解释:是最常见的用户名/密码的认证机制;同时,由于它实现了RememberMeAuthenticationToken接口,我们可以通过令牌设置“记住我”的功能。 但是,“已记住”和“已认证”是有区别的: 已记住的用户仅仅是非匿名用户,你可以通过subject.getPrincipals()获取用户信息。但是它并非是认证通过的用户,当你访问需要认证用户的功能时,你仍然需要重新提交认证信息。 这一区别可以参考淘宝网站,网站会默认记住登录的用户,再次访问网站时,对于非敏感的页面功能,页面上会显示记住的用户信息,但是当你访问网站账户信息时仍然需要再次进行登录认证。 5: 我的自定义数据库配置“jdbc.properties”: driverClassName=com.mysql.jdbc.Driver validationQuery=SELECT 1 jdbc_url=jdbc:mysql://localhost:3306/shop?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false jdbc_username=root jdbc_password=1234 6:"generatorConfig.xml" 这个就是上面的数据库驱动的配置 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" > <generatorConfiguration> <!--classPathEntry:数据库的JDBC驱动 --> <!-- location="D:\Develop\MvnRepo\mysql\mysql-connector-java\5.1.34\mysql-connector-java-5.1.34.jar"/> --> <classPathEntry location="D:\Users\lydia\workspaceSSH\shopCMS\src\main\webapp\WEB-INF\lib\mysql-connector-java-5.1.34.jar"/> <context id="MysqlTables" targetRuntime="MyBatis3"> <!-- 注意这里面的顺序确定的,不能随变更改 --> <!-- 自定义的分页插件 <plugin type="com.deppon.foss.module.helloworld.shared.PaginationPlugin"/> --> <!-- 可选的(0 or 1) --> <!-- 注释生成器 --> <commentGenerator> <!-- 是否去除自动生成的注释 true:是 : false:否 --> <property name="suppressAllComments" value="true"/> </commentGenerator> <!-- 必须的(1 required) --> <!--数据库连接的信息:驱动类、连接地址、用户名、密码 connectionURL="jdbc:mysql://localhost:3306/work_attendance" --> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/shop" userId="root" password="1234"> </jdbcConnection> <!-- 可选的(0 or 1) --> <!-- 类型转换器或者加类型解析器 --> <!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer true,把JDBC DECIMAL 和 NUMERIC 类型解析为java.math.BigDecimal --> <javaTypeResolver> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> <!-- 必须的(1 required) --> <!-- java模型生成器 --> <!-- targetProject:自动生成代码的位置 --> <javaModelGenerator targetPackage="com.coder520.user.entity" targetProject="D:\Develop\IDEAWorkPlace\work-attendance\src\main\java" > <!--TODO enableSubPackages:是否让schema作为包的后缀 --> <property name="enableSubPackages" value="true"/> <!-- 从数据库返回的值被清理前后的空格 --> <property name="trimStrings" value="true"/> </javaModelGenerator> <!-- 必须的(1 required) --> <!-- map xml 生成器 <sqlMapGenerator targetPackage="com.coder520.user.dao" targetProject="D:\Develop\IDEAWorkPlace\work-attendance\src\main\java"> <property name="enableSubPackages" value="true"/> </sqlMapGenerator> --> <sqlMapGenerator targetPackage="com.coder520.user.dao" targetProject="D:\Users\lydia\workspaceSSH\shopCMS\src\main\java"> <property name="enableSubPackages" value="true"/> </sqlMapGenerator> <!-- 可选的(0 or 1) --> <!-- mapper 或者就是dao接口生成器 --> <javaClientGenerator targetPackage="com.coder520.user.dao" targetProject="D:\Users\lydia\workspaceSSH\shopCMS\src\main\java" type="XMLMAPPER"> <property name="enableSubPackages" value="true"/> </javaClientGenerator> <!-- 必须的(1...N) --> <!-- pojo 实体生成器 --> <!-- tableName:用于自动生成代码的数据库表;domainObjectName:对应于数据库表的javaBean类名 --> <!-- schema即为数据库名 可不写 --> <table tableName="role" domainObjectName="Role" enableInsert="true" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> <!-- 忽略字段 可选的(0 or 1) --> <!-- <ignoreColumn column="is_use" /> --> <!--//无论字段是什么类型,生成的类属性都是varchar。 可选的(0 or 1) 测试无效 --> <!-- <columnOverride column="city_code" jdbcType="VARCHAR" /> --> </table> <table tableName="permission" domainObjectName="Permission" enableInsert="true" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> <!-- 忽略字段 可选的(0 or 1) --> <!-- <ignoreColumn column="is_use" /> --> <!--//无论字段是什么类型,生成的类属性都是varchar。 可选的(0 or 1) 测试无效 --> <!-- <columnOverride column="city_code" jdbcType="VARCHAR" /> --> </table> </context> </generatorConfiguration> 万分感谢大佬,,,,,帮我解决这问题我就认你当师傅,,,大佬 ,,拜托了,,,还需要什么麻烦留下言哈
使用的ejb3-persistence.jar进行注解开发,请问源码是什么
import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; @Entity @Table(name = "t_h_user") public class User { @Id @Column(name = "u_id") // 生成器+生成策略 @SequenceGenerator(name = "seq_u", sequenceName = "seq_user") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_u") private int id; @Column(name = "u_name") private String name; @ManyToOne() private Role role; . . .. ..
一个hibernate保存对象问题。
我的SSH,用的是orcale,User表的主键ehrid是varchar2类型的,我想实现自动递增功能。 我的做法是: 1.-- Create sequence create sequence SEHRID minvalue 44030000000000000000000 maxvalue 999999999999999999999999999 start with 44030000000000000000000 increment by 1 cache 20; 2.通过触发器来产生. create or replace trigger tehrid before insert on user for each row declare begin select sehrid.nextval into:New.ehrid from dual; end tehrid; -------------------- CREATE TABLE "CITIZEN_BASE_INFO" ( EHRID VARCHAR2(23) NOT NULL, NAME VARCHAR2(20) NOT NULL, PWD VARCHAR2(20) NOT NULL } ---------------------------------------------------------------- POJO 测试类 public class UserDaoTest extends BaseDaoTest { @Autowired public IUserDao UserDao; @Test public void testFindById() { try { User user=new User(); System.out.println(user); user.setName("hc"); user.setPwd("123"); this.userDao.save(user); //[color=red] oracle中能查到记录已插入,记录的ehrid有值[/color] System.out.println(user.getEhrid()); //[color=red]怎么这里打出来的居然是rowid的值哦?[/color] } catch (DaoException e) { e.printStackTrace(); } } ---------------------------接口-------------- public interface IUserDao { public void save(User user); } ---------------------------实现类------------ public class UserDaoImpl extends HibernateDaoSupport implements IUserDao { public void save(User user){ this.getHibernateTemplate().save(user); this.log.debug("保存市民信息成功!"); } } -------------------------- 这里是User.hbm.xml文件 <hibernate-mapping> <class name="com.gd.project.po.CitizenBaseInfo" table="citizen_base_info" > <id name="ehrid" type="java.lang.String"> <column name="EHRID" length="23" /> <generator class="native" /> </id> <property name="name" type="java.lang.String"> <column name="NAME" length="20" not-null="true" /> </property> <property name="pwd" type="java.lang.String"> <column name="PWD" length="20" not-null="true"/> </property> <hibernate-mapping> ------------------------------------------------ [size=large][size=xx-small]请帮忙解答一下哦,谢谢![/size][/size] [b]问题补充:[/b] 问题是我的主键是varchar2类型的,可以用sequence嘛? [b]问题补充:[/b] 我试了,还是不行哦,用sequence,我想是因为我主键JAVA类型是String的, ------------------ 用触发器的时候和表关联的都提示下面这个错误。 ORA-02291: 违反完整约束条件 (SCOTT.FK_MOBILE_C_RELATIONS_CITIZEN_) - 未找到父项关键字 [b]问题补充:[/b] User.hbm.xml文件写错了! 应该这样 <hibernate-mapping> <class name="com.gd.project.po.[color=red]User[/color]" table="citizen_base_info" > <id name="ehrid" type="java.lang.String"> <column name="EHRID" length="23" /> <generator class="native" /> </id> <property name="name" type="java.lang.String"> <column name="NAME" length="20" not-null="true" /> </property> <property name="pwd" type="java.lang.String"> <column name="PWD" length="20" not-null="true"/> </property> <hibernate-mapping> ------------------ 希望有人能帮我想想办法。我想通过触发器来生成业务ID,这个ID是varchar的 但是我保存对象可以保存进去,就是我想得到刚保存的对象生成的ID应该怎么做呢!
在中国程序员是青春饭吗?
今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...
《MySQL 性能优化》之理解 MySQL 体系结构
本文介绍 MySQL 的体系结构,包括物理结构、逻辑结构以及插件式存储引擎。
程序员请照顾好自己,周末病魔差点一套带走我。
程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。
复习一周,京东+百度一面,不小心都拿了Offer
京东和百度一面都问了啥,面试官百般刁难,可惜我全会。
Java 14 都快来了,为什么还有这么多人固守Java 8?
从Java 9开始,Java版本的发布就让人眼花缭乱了。每隔6个月,都会冒出一个新版本出来,Java 10 , Java 11, Java 12, Java 13, 到2020年3月份,...
达摩院十大科技趋势发布:2020 非同小可!
【CSDN编者按】1月2日,阿里巴巴发布《达摩院2020十大科技趋势》,十大科技趋势分别是:人工智能从感知智能向认知智能演进;计算存储一体化突破AI算力瓶颈;工业互联网的超融合;机器间大规模协作成为可能;模块化降低芯片设计门槛;规模化生产级区块链应用将走入大众;量子计算进入攻坚期;新材料推动半导体器件革新;保护数据隐私的AI技术将加速落地;云成为IT技术创新的中心 。 新的画卷,正在徐徐展开。...
轻松搭建基于 SpringBoot + Vue 的 Web 商城应用
首先介绍下在本文出现的几个比较重要的概念: 函数计算(Function Compute): 函数计算是一个事件驱动的服务,通过函数计算,用户无需管理服务器等运行情况,只需编写代码并上传。函数计算准备计算资源,并以弹性伸缩的方式运行用户代码,而用户只需根据实际代码运行所消耗的资源进行付费。Fun: Fun 是一个用于支持 Serverless 应用部署的工具,能帮助您便捷地管理函数计算、API ...
讲真,这两个IDE插件,可以让你写出质量杠杠的代码
周末躺在床上看《拯救大兵瑞恩》 周末在闲逛的时候,发现了两个优秀的 IDE 插件,据说可以提高代码的质量,我就安装了一下,试了试以后发现,确实很不错,就推荐给大家。 01、Alibaba Java 代码规范插件 《阿里巴巴 Java 开发手册》,相信大家都不会感到陌生,其 IDEA 插件的下载次数据说达到了 80 万次,我今天又贡献了一次。嘿嘿。 该项目的插件地址: https://github....
Python+OpenCV实时图像处理
目录 1、导入库文件 2、设计GUI 3、调用摄像头 4、实时图像处理 4.1、阈值二值化 4.2、边缘检测 4.3、轮廓检测 4.4、高斯滤波 4.5、色彩转换 4.6、调节对比度 5、退出系统 初学OpenCV图像处理的小伙伴肯定对什么高斯函数、滤波处理、阈值二值化等特性非常头疼,这里给各位分享一个小项目,可通过摄像头实时动态查看各类图像处理的特点,也可对各位调参、测试...
2020年一线城市程序员工资大调查
人才需求 一线城市共发布岗位38115个,招聘120827人。 其中 beijing 22805 guangzhou 25081 shanghai 39614 shenzhen 33327 工资分布 2020年中国一线城市程序员的平均工资为16285元,工资中位数为14583元,其中95%的人的工资位于5000到20000元之间。 和往年数据比较: yea...
为什么猝死的都是程序员,基本上不见产品经理猝死呢?
相信大家时不时听到程序员猝死的消息,但是基本上听不到产品经理猝死的消息,这是为什么呢? 我们先百度搜一下:程序员猝死,出现将近700多万条搜索结果: 搜索一下:产品经理猝死,只有400万条的搜索结果,从搜索结果数量上来看,程序员猝死的搜索结果就比产品经理猝死的搜索结果高了一倍,而且从下图可以看到,首页里面的五条搜索结果,其实只有两条才是符合条件。 所以程序员猝死的概率真的比产品经理大,并不是错...
害怕面试被问HashMap?这一篇就搞定了!
声明:本文以jdk1.8为主! 搞定HashMap 作为一个Java从业者,面试的时候肯定会被问到过HashMap,因为对于HashMap来说,可以说是Java集合中的精髓了,如果你觉得自己对它掌握的还不够好,我想今天这篇文章会非常适合你,至少,看了今天这篇文章,以后不怕面试被问HashMap了 其实在我学习HashMap的过程中,我个人觉得HashMap还是挺复杂的,如果真的想把它搞得明明白...
毕业5年,我问遍了身边的大佬,总结了他们的学习方法
我问了身边10个大佬,总结了他们的学习方法,原来成功都是有迹可循的。
python爬取百部电影数据,我分析出了一个残酷的真相
2019年就这么匆匆过去了,就在前几天国家电影局发布了2019年中国电影市场数据,数据显示去年总票房为642.66亿元,同比增长5.4%;国产电影总票房411.75亿元,同比增长8.65%,市场占比 64.07%;城市院线观影人次17.27亿,同比增长0.64%。 看上去似乎是一片大好对不对?不过作为一名严谨求实的数据分析师,我从官方数据中看出了一点端倪:国产票房增幅都已经高达8.65%了,为什...
推荐10个堪称神器的学习网站
每天都会收到很多读者的私信,问我:“二哥,有什么推荐的学习网站吗?最近很浮躁,手头的一些网站都看烦了,想看看二哥这里有什么新鲜货。” 今天一早做了个恶梦,梦到被老板辞退了。虽然说在我们公司,只有我辞退老板的份,没有老板辞退我这一说,但是还是被吓得 4 点多都起来了。(主要是因为我掌握着公司所有的核心源码,哈哈哈) 既然 4 点多起来,就得好好利用起来。于是我就挑选了 10 个堪称神器的学习网站,推...
这些软件太强了,Windows必装!尤其程序员!
Windows可谓是大多数人的生产力工具,集娱乐办公于一体,虽然在程序员这个群体中都说苹果是信仰,但是大部分不都是从Windows过来的,而且现在依然有很多的程序员用Windows。 所以,今天我就把我私藏的Windows必装的软件分享给大家,如果有一个你没有用过甚至没有听过,那你就赚了????,这可都是提升你幸福感的高效率生产力工具哦! 走起!???? NO、1 ScreenToGif 屏幕,摄像头和白板...
阿里面试,面试官没想到一个ArrayList,我都能跟他扯半小时
我是真的没想到,面试官会这样问我ArrayList。
曾经优秀的人,怎么就突然不优秀了。
职场上有很多辛酸事,很多合伙人出局的故事,很多技术骨干被裁员的故事。说来模板都类似,曾经是名校毕业,曾经是优秀员工,曾经被领导表扬,曾经业绩突出,然而突然有一天,因为种种原因,被裁员了,...
大学四年因为知道了这32个网站,我成了别人眼中的大神!
依稀记得,毕业那天,我们导员发给我毕业证的时候对我说“你可是咱们系的风云人物啊”,哎呀,别提当时多开心啦????,嗯,我们导员是所有导员中最帅的一个,真的???? 不过,导员说的是实话,很多人都叫我大神的,为啥,因为我知道这32个网站啊,你说强不强????,这次是绝对的干货,看好啦,走起来! PS:每个网站都是学计算机混互联网必须知道的,真的牛杯,我就不过多介绍了,大家自行探索,觉得没用的,尽管留言吐槽吧???? 社...
良心推荐,我珍藏的一些Chrome插件
上次搬家的时候,发了一个朋友圈,附带的照片中不小心暴露了自己的 Chrome 浏览器插件之多,于是就有小伙伴评论说分享一下我觉得还不错的浏览器插件。 我下面就把我日常工作和学习中经常用到的一些 Chrome 浏览器插件分享给大家,随便一个都能提高你的“生活品质”和工作效率。 Markdown Here Markdown Here 可以让你更愉快的写邮件,由于支持 Markdown 直接转电子邮...
看完这篇HTTP,跟面试官扯皮就没问题了
我是一名程序员,我的主要编程语言是 Java,我更是一名 Web 开发人员,所以我必须要了解 HTTP,所以本篇文章就来带你从 HTTP 入门到进阶,看完让你有一种恍然大悟、醍醐灌顶的感觉。 最初在有网络之前,我们的电脑都是单机的,单机系统是孤立的,我还记得 05 年前那会儿家里有个电脑,想打电脑游戏还得两个人在一个电脑上玩儿,及其不方便。我就想为什么家里人不让上网,我的同学 xxx 家里有网,每...
2020 年,大火的 Python 和 JavaScript 是否会被取而代之?
Python 和 JavaScript 是目前最火的两大编程语言,但是2020 年,什么编程语言将会取而代之呢? 作者 |Richard Kenneth Eng 译者 |明明如月,责编 | 郭芮 出品 | CSDN(ID:CSDNnews) 以下为译文: Python 和 JavaScript 是目前最火的两大编程语言。然而,他们不可能永远屹立不倒。最终,必将像其他编程语言一...
史上最全的IDEA快捷键总结
现在Idea成了主流开发工具,这篇博客对其使用的快捷键做了总结,希望对大家的开发工作有所帮助。
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
谁是华为扫地僧?
是的,华为也有扫地僧!2020年2月11-12日,“养在深闺人不知”的华为2012实验室扫地僧们,将在华为开发者大会2020(Cloud)上,和大家见面。到时,你可以和扫地僧们,吃一个洋...
Idea 中最常用的10款插件(提高开发效率),一定要学会使用!
学习使用一些插件,可以提高开发效率。对于我们开发人员很有帮助。这篇博客介绍了开发中使用的插件。
AI 没让人类失业,搞 AI 的人先失业了
最近和几个 AI 领域的大佬闲聊 根据他们讲的消息和段子 改编出下面这个故事 如有雷同 都是巧合 1. 老王创业失败,被限制高消费 “这里写我跑路的消息实在太夸张了。” 王葱葱哼笑一下,把消息分享给群里。 阿杰也看了消息,笑了笑。在座几位也都笑了。 王葱葱是个有名的人物,21岁那年以全额奖学金进入 KMU 攻读人工智能博士,累计发表论文 40 余篇,个人技术博客更是成为深度学习领域内风向标。 ...
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆每天早上8:30推送 作者|Mr.K 编辑| Emma 来源|技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯...
作为一名大学生,如何在B站上快乐的学习?
B站是个宝,谁用谁知道???? 作为一名大学生,你必须掌握的一项能力就是自学能力,很多看起来很牛X的人,你可以了解下,人家私底下一定是花大量的时间自学的,你可能会说,我也想学习啊,可是嘞,该学习啥嘞,不怕告诉你,互联网时代,最不缺的就是学习资源,最宝贵的是啥? 你可能会说是时间,不,不是时间,而是你的注意力,懂了吧! 那么,你说学习资源多,我咋不知道,那今天我就告诉你一个你必须知道的学习的地方,人称...
那些年,我们信了课本里的那些鬼话
教材永远都是有错误的,从小学到大学,我们不断的学习了很多错误知识。 斑羚飞渡 在我们学习的很多小学课文里,有很多是错误文章,或者说是假课文。像《斑羚飞渡》: 随着镰刀头羊的那声吼叫,整个斑羚群迅速分成两拨,老年斑羚为一拨,年轻斑羚为一拨。 就在这时,我看见,从那拨老斑羚里走出一只公斑羚来。公斑羚朝那拨年轻斑羚示意性地咩了一声,一只半大的斑羚应声走了出来。一老一少走到伤心崖,后退了几步,突...
一个程序在计算机中是如何运行的?超级干货!!!
强烈声明:本文很干,请自备茶水!???? 开门见山,咱不说废话! 你有没有想过,你写的程序,是如何在计算机中运行的吗?比如我们搞Java的,肯定写过这段代码 public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } ...
立即提问