首页 文章 精选 留言 我的

精选列表

搜索[文件操作],共10046篇文章
优秀的个人博客,低调大师

数据集操作

代码运行报错: ----------> Parent Classloader: java.net.URLClassLoader@1c53fd30 : java.lang.ClassNotFoundException: org.springframework.dao.TransientDataAccessResourceException 八月 10, 2018 5:45:28 下午 com.caucho.hessian.io.SerializerFactory getDeserializer 警告: Hessian/Burlap: 'org.springframework.dao.TransientDataAccessResourceException' is an unknown class in ParallelWebappClassLoader context: cc-web delegate: false ----------> Parent Classloader: java.net.URLClassLoader@1c53fd30 : java.lang.ClassNotFoundException: org.springframework.dao.TransientDataAccessResourceException com.weibo.api.motan.exception.MotanServiceException: error_message: biz exception cause is throwable error:class java.lang.Throwable, errmsg:PreparedStatementCallback; SQL [SELECT `free_pricing` FROM `account` WHERE `account_id`=?]; Before start of result set, status: 503, error_code: 10001,r=null at com.weibo.api.motan.proxy.RefererInvocationHandler.invoke(RefererInvocationHandler.java:127) at com.sun.proxy.$Proxy71.getFreePricingStatus(Unknown Source) at com.btzh.resource.ProfileResource.toCopyright(ProfileResource.java:285) 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.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) 代码是很简单的一个sql查询: @Override public YesOrNo getFreePricingStatus(Integer accountId) { return jdbcTemplate.query("SELECT `free_pricing` FROM `account` WHERE `account_id`=?", new Object[] { accountId }, new ResultSetExtractor<YesOrNo>() { @Override public YesOrNo extractData(ResultSet rs) throws SQLException, DataAccessException { return YesOrNo.getByValue(rs.getInt("free_pricing")); } }); } 单元测试没有任何问题, 放到项目中运行就出现上面的报错. 后来想是不是因为缺少rs.next(), 导致指针仍然在第一个元素的前一个位置, 导致指针没有下移, 改了下: @Override public YesOrNo getFreePricingStatus(Integer accountId) { return jdbcTemplate.query("SELECT `free_pricing` FROM `account` WHERE `account_id`=?", new Object[] { accountId }, new ResultSetExtractor<YesOrNo>() { @Override public YesOrNo extractData(ResultSet rs) throws SQLException, DataAccessException { if (rs.next()) { return YesOrNo.getByValue(rs.getInt("free_pricing")); } return YesOrNo.NO; } }); } 好了. 但是没想清楚为什么单元测试没有报错, 待续.

优秀的个人博客,低调大师

python操作csv

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_34173549/article/details/81285438 '''def build_excel(self): workbook = xlwt.Workbook(encoding='ascii') # 创建表 worksheet = workbook.add_sheet('My Worksheet') # 往表写内容 行 ,列 worksheet.write(1, 3, label='Row 0, Column 0 Value') workbook.save('Excel_Workbook.xlsx') csvFile = open("test42.cs v", 'w', newline='') try: writer = csv.writer(csvFile) writer.writerow(('id', '标题', '发布时间','视频时长', '播放次数', '评论数', '喜欢数', '分享数', '上传用户', '下载地址' )) for i in range(10): writer.writerow((1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) finally: csvFile.close() return csvFile;

优秀的个人博客,低调大师

Python操作MySql

一、linux客户端连接mssql server 1.linux下安装unixODBC 2.linux安装FreeTDS (1) 配置FreeTDS。 /etc/freetds/freetds.conf [egServer70] host = server ip port = 1433 tds Version = 7.0 [dsnName] host = server ip port = 1433 tds Version = 8.0 client charset = UTF-8 (2)配置odbc /etc/odbc.ini [dsnName] Driver = FreeTDS Description = Odbc connection via FreeTDS Trace = No Servername = dsnName Database = oneicdb (3)配置odbc /etc/odbc [FreeTDS] Description = FreeTDS Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so FileUsage = 1 CPTimeout = CPResure = client charset = utf-8 UsageCount = 1 [SQL Server] Description = FreeTDS ODBC driver for MSSQL Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so FileUsage = 1 import pyodbc strconn= 'DRIVER={SQL Server};SERVER=.;DATABASE=test;UID=sa;PWD=sa' db = pyodbc.connect(strconn) c = db.cursor() sql = '.....................' c.execute(sql) c.fetchone() c.fetchall() c.close() db.close() 存储过程调用:c.execute("{call sp_MemberAdrInsert_py (?,?,?,?,?,?,?,?,?,?)}", ('a','b','c','d','e','f','g','h','100086',0)) 1、存储过程可以直接返回值,如果返回一个值,那么存储过程里必须有:SET NOCOUNT ON 2、存储过程不可以output值 Welcome to Python world! I have a contract in this world! How about you?

优秀的个人博客,低调大师

phoenix操作hbase

代码实例 package oa.epoint.com.phoenix; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class PhoenixTest { private static String driver = "org.apache.phoenix.jdbc.PhoenixDriver"; public static void main(String[] args) throws SQLException { try { Class.forName(driver); System.out.println("驱动加载成功"); } catch (ClassNotFoundException e) { e.printStackTrace(); } Statement stmt = null; ResultSet rs = null; System.out.println("准备数据库连接"); Connection con = DriverManager.getConnection("jdbc:phoenix:100.2.5.1:2181:/hbase-unsecure"); System.out.println("连接成功"); stmt = con.createStatement(); stmt.executeUpdate("drop table if exists test5"); stmt.executeUpdate("create table if not exists test5 (id BIGINT not null primary key,name varchar)"); stmt.executeUpdate("UPSERT INTO test5 VALUES(123,'xubin')"); con.commit(); String sql = "select * from test5"; rs = stmt.executeQuery(sql); while (rs.next()) { System.out.print("id:"+rs.getInt("id")); System.out.println(",name:"+rs.getString("name")); } stmt.close(); con.close(); } }

优秀的个人博客,低调大师

python操作gmail

import imaplib, re class pygmail( object ): def __init__( self ): self .IMAP_SERVER = 'imap.gmail.com' self .IMAP_PORT = 993 self .M = None self .response = None self .mailboxes = [] def login( self , username, password): self .M = imaplib.IMAP4_SSL( self .IMAP_SERVER, self .IMAP_PORT) rc, self .response = self .M.login(username, password) return rc def get_mailboxes( self ): rc, self .response = self .M. list () for item in self .response: self .mailboxes.append(item.split()[ - 1 ]) return rc def get_mail_count( self , folder = 'Inbox' ): rc, self .response = self .M.select(folder) return self .response[ 0 ] def get_unread_count( self , folder = 'Inbox' ): rc, self .response = self .M.status(folder, "(UNSEEN)" ) unreadCount = re.search( "UNSEEN (\d+)" , self .response[ 0 ]).group( 1 ) return unreadCount def get_imap_quota( self ): quotaStr = self .M.getquotaroot( "Inbox" )[ 1 ][ 1 ][ 0 ] r = re. compile ( '\d+' ).findall(quotaStr) if r = = []: r.append( 0 ) r.append( 0 ) return float (r[ 1 ]) / 1024 , float (r[ 0 ]) / 1024 def get_mails_from( self , uid, folder = 'Inbox' ): status, count = self .M.select(folder, readonly = 1 ) status, response = self .M.search( None , 'FROM' , uid) email_ids = [e_id for e_id in response[ 0 ].split()] return email_ids def get_mail_from_id( self , id ): status, response = self .M.fetch( id , '(body[header.fields (subject)])' ) return response def rename_mailbox( self , oldmailbox, newmailbox): rc, self .response = self .M.rename(oldmailbox, newmailbox) return rc def create_mailbox( self , mailbox): rc, self .response = self .M.create(mailbox) return rc def delete_mailbox( self , mailbox): rc, self .response = self .M.delete(mailbox) return rc def logout( self ): self .M.logout() if __name__ = = "__main__" : demo = pygmail() demo.login( "renwenchao888@gmail.com" , "qqq191430791" ) mailBoxex = demo.get_mailboxes() for i in demo.response: print i demo.logout() ============================================================================= 本文转自被遗忘的博客园博客,原文链接:http://www.cnblogs.com/rollenholt/archive/2011/12/08/2280652.html,如需转载请自行联系原作者

资源下载

更多资源
Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册