ja

阅读 / 问答 / 标签

POI中的jar包都是干嘛的 我该导哪个

好多依赖包你都要导入:poi-version-yyyymmdd.jar用于操作.xls文件;依赖于commons-logging, commons-codec, log4j;poi-scratchpad-version-yyyymmdd.jar用于操作.ppt、.doc、.vsd、.pub、.msg文件;依赖于poi;poi-ooxml-version-yyyymmdd.jar、poi-ooxml-schemas-version-yyyymmdd.jar用于操作.xlsx、.pptx、docx文件;依赖于poi, dom4j,xmlbeans, stax-api-1.0.1;操作Excel主要是指ss包、xssf包;也就是目录lib下面是poi依赖的jar包,目录ooxml-lib下面是poi-ooxml依赖的jar包;

谁能给我一个详细的Java通过Apache POI导出Excel方法,最好能给完整代码

这是在开发中操作excel等等是最常见不过的问题了,今天给大家分享一下Apache POI导出Excel方法,ExportExcel 可以直接copy过去改改就可以用代码如下:01.package com.smnpc.util; 02. 03.import java.io.FileOutputStream; 04.import java.io.IOException; 05.import java.util.Calendar; 06. 07.import org.apache.poi.hssf.usermodel.HSSFCell; 08.import org.apache.poi.hssf.usermodel.HSSFCellStyle; 09.import org.apache.poi.hssf.usermodel.HSSFDataFormat; 10.import org.apache.poi.hssf.usermodel.HSSFRow; 11.import org.apache.poi.hssf.usermodel.HSSFSheet; 12.import org.apache.poi.hssf.usermodel.HSSFWorkbook; 13. 14./** 15.* 生成导出Excel文件对象 16.*17.* @author Robert 18.*19.*/ 20.public class ExportExcel { 21.// 设置cell编码解决中文高位字节截断 22.// private static short XLS_ENCODING = HSSFWorkbook.ENCODING_UTF_16; 23.// 定制日期格式 24.private static String DATE_FORMAT = " m/d/yy "; // "m/d/yy h:mm" 25.// 定制浮点数格式 26.private static String NUMBER_FORMAT = " #,##0.00 "; 27. 28.private String xlsFileName; 29. 30.private HSSFWorkbook workbook; 31. 32.private HSSFSheet sheet; 33. 34.private HSSFRow row; 35. 36./** 37.* 初始化Excel 38.*39.* @param fileName 40.* 导出文件名 41.* @return 42.*/ 43.public void XLSExport(String fileName) { 44.this.xlsFileName = fileName; 45.this.workbook = new HSSFWorkbook(); 46.this.sheet = workbook.createSheet(); 47.} 48. 49./** 50.* 导出Excel文件 51.*52.* @throws IOException 53.* @throws XLSException 54.*/ 55.public void exportXLS() throws IOException { 56.FileOutputStream fOut = new FileOutputStream(xlsFileName); 57.workbook.write(fOut); 58.fOut.flush(); 59.fOut.close(); 60.} 61. 62./** 63.* 增加一行 64.*65.* @param index 66.* 行号 67.*/ 68.public void createRow(int index) { 69.this.row = this.sheet.createRow(index); 70.} 71. 72./** 73.* 设置单元格 74.*75.* @param index 76.* 列号 77.* @param value 78.* 单元格填充值 79.*/ 80.public void setCell(int index, String value) { 81.HSSFCell cell = this.row.createCell((short) index); 82.cell.setCellType(HSSFCell.CELL_TYPE_STRING); 83.// cell.setEncoding(XLS_ENCODING); 84.cell.setCellValue(value); 85.} 86. 87./** 88.* 设置单元格 89.*90.* @param index 91.* 列号 92.* @param value 93.* 单元格填充值 94.*/ 95.public void setCell(int index, Calendar value) { 96.HSSFCell cell = this.row.createCell((short) index); 97.// cell.setEncoding(XLS_ENCODING); 98.cell.setCellValue(value.getTime()); 99.HSSFCellStyle cellStyle = workbook.createCellStyle(); // 建立新的cell样式 100.cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat(DATE_FORMAT)); // 设置cell样式为定制的日期格式 101.cell.setCellStyle(cellStyle); // 设置该cell日期的显示格式 102.} 103. 104./** 105.* 设置单元格 106.*107.* @param index 108.* 列号 109.* @param value 110.* 单元格填充值 111.*/ 112.public void setCell(int index, int value) { 113.HSSFCell cell = this.row.createCell((short) index); 114.cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); 115.cell.setCellValue(value); 116.} 117. 118./** 119.* 设置单元格 120.*121.* @param index 122.* 列号 123.* @param value 124.* 单元格填充值 125.*/ 126.public void setCell(int index, double value) { 127.HSSFCell cell = this.row.createCell((short) index); 128.cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); 129.cell.setCellValue(value); 130.HSSFCellStyle cellStyle = workbook.createCellStyle(); // 建立新的cell样式 131.HSSFDataFormat format = workbook.createDataFormat(); 132.cellStyle.setDataFormat(format.getFormat(NUMBER_FORMAT)); // 设置cell样式为定制的浮点数格式 133.cell.setCellStyle(cellStyle); // 设置该cell浮点数的显示格式 134.} 135. 136. 137.public static void main(String[] args) { 138.ExportExcel excel = new ExportExcel(); 139.excel.XLSExport("d:\测试.xls"); 140.excel.createRow(0); 141.excel.setCell(0, "序号"); 142.excel.setCell(1, "公司"); 143.excel.setCell(2, "网址"); 144.excel.setCell(3, "姓名"); 145.excel.createRow(1);// excel正文 146.excel.setCell(0, "1"); 147.excel.setCell(1, "程序员之家"); 148.excel.setCell(2, "http://bbs.it-home.org"); 149.excel.setCell(3, "小贝"); 150.try { 151.excel.exportXLS(); 152.System.out.println("导出excel成功"); 153.} catch (IOException e) { 154.System.out.println("导出excel失败"); 155.e.printStackTrace(); 156.} 157.} 158.}

java读取doc,pdf问题。

环境准备txt利用common-iopdf利用pdfbox剩下的用POI关于POI,读取xls没啥特别的,主要是读取doc和ppt,需要下载poi源代码,然后将poi-src-3.7-20101029.zippoi-3.7srcscratchpadsrc下的所有文件copy到工程,或者自己封装个jar包jar包依赖code如下:package test;import java.io.BufferedInputStream;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.IOException;import java.text.NumberFormat;import org.apache.commons.io.FileUtils;import org.apache.pdfbox.pdfparser.PDFParser;import org.apache.pdfbox.pdmodel.PDDocument;import org.apache.pdfbox.util.PDFTextStripper;import org.apache.poi.POIXMLDocument;import org.apache.poi.POIXMLTextExtractor;import org.apache.poi.hslf.HSLFSlideShow;import org.apache.poi.hslf.model.Slide;import org.apache.poi.hslf.model.TextRun;import org.apache.poi.hslf.usermodel.RichTextRun;import org.apache.poi.hslf.usermodel.SlideShow;import org.apache.poi.hssf.usermodel.HSSFCell;import org.apache.poi.hssf.usermodel.HSSFRow;import org.apache.poi.hssf.usermodel.HSSFSheet;import org.apache.poi.hssf.usermodel.HSSFWorkbook;import org.apache.poi.hwpf.extractor.WordExtractor;import org.apache.poi.openxml4j.exceptions.OpenXML4JException;import org.apache.poi.openxml4j.opc.OPCPackage;import org.apache.poi.ss.usermodel.Cell;import org.apache.poi.xslf.extractor.XSLFPowerPointExtractor;import org.apache.poi.xssf.usermodel.XSSFCell;import org.apache.poi.xssf.usermodel.XSSFRow;import org.apache.poi.xssf.usermodel.XSSFSheet;import org.apache.poi.xssf.usermodel.XSSFWorkbook;import org.apache.poi.xwpf.extractor.XWPFWordExtractor;import org.apache.xmlbeans.XmlException;public class ReadFileUtils {/** * @param args * @throws Exception */public static void main(String[] args) throws Exception {ReadFileUtils rf = new ReadFileUtils();String s = "";// s = rf.readTXT("E:/itsm文档的后缀名分析报告2.txt");// s = rf.readPDF("E:/memcached全面剖析.pdf");// s = rf.readEXCEL("E:/副本工作量及成本模板.xls");// s = rf.readEXCEL2007("E:/功能点估算方案.xlsx");// s = rf.readWORD("E:/pms中文.doc");// s = rf.readWORD2007("E:/功能点估算方法.docx");//s = rf.readPPT("E:/精细化管理信息系统项目汇报v1.0.ppt");s = rf.readPPT2007("e:/精细化管理信息系统项目汇报v1.0.pptx");System.out.println(s);}// 读取pptpublic String readPPT(String file) throws IOException {StringBuilder sb = new StringBuilder();SlideShow ppt = new SlideShow(new HSLFSlideShow(file));Slide[] slides = ppt.getSlides();//提取文本信息 for (Slide each : slides) { TextRun[] textRuns = each.getTextRuns(); for (int i=0 ;i< textRuns.length; i++ ) { RichTextRun[] richTextRuns = textRuns.getRichTextRuns(); for (int j = 0; j < richTextRuns.length; j++) { sb.append(richTextRuns[j].getText()); } sb.append(" "); } sb.append(" ");}return sb.toString();}// 读取pptxpublic String readPPT2007(String file) throws IOException, XmlException, OpenXML4JException { return new XSLFPowerPointExtractor(POIXMLDocument.openPackage(file)).getText(); }// 读取xls文件public String readEXCEL(String file) throws IOException {StringBuilder content = new StringBuilder();HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(file));// 创建对Excel工作簿文件的引用for (int numSheets = 0; numSheets < workbook.getNumberOfSheets(); numSheets++) {if (null != workbook.getSheetAt(numSheets)) {HSSFSheet aSheet = workbook.getSheetAt(numSheets);// 获得一个sheetfor (int rowNumOfSheet = 0; rowNumOfSheet <= aSheet.getLastRowNum(); rowNumOfSheet++) {if (null != aSheet.getRow(rowNumOfSheet)) {HSSFRow aRow = aSheet.getRow(rowNumOfSheet); // 获得一个行for (short cellNumOfRow = 0; cellNumOfRow <= aRow.getLastCellNum(); cellNumOfRow++) {if (null != aRow.getCell(cellNumOfRow)) {HSSFCell aCell = aRow.getCell(cellNumOfRow);// 获得列值if (this.convertCell(aCell).length() > 0) {content.append(this.convertCell(aCell));}}content.append(" ");}}}}}return content.toString();}// 读取xlsx文件public String readEXCEL2007(String file) throws IOException {StringBuilder content = new StringBuilder();XSSFWorkbook workbook = new XSSFWorkbook(file);for (int numSheets = 0; numSheets < workbook.getNumberOfSheets(); numSheets++) {if (null != workbook.getSheetAt(numSheets)) {XSSFSheet aSheet = workbook.getSheetAt(numSheets);// 获得一个sheetfor (int rowNumOfSheet = 0; rowNumOfSheet <= aSheet.getLastRowNum(); rowNumOfSheet++) {if (null != aSheet.getRow(rowNumOfSheet)) {XSSFRow aRow = aSheet.getRow(rowNumOfSheet); // 获得一个行for (short cellNumOfRow = 0; cellNumOfRow <= aRow.getLastCellNum(); cellNumOfRow++) {if (null != aRow.getCell(cellNumOfRow)) {XSSFCell aCell = aRow.getCell(cellNumOfRow);// 获得列值if (this.convertCell(aCell).length() > 0) {content.append(this.convertCell(aCell));}}content.append(" ");}}}}}return content.toString();}private String convertCell(Cell cell) {NumberFormat formater = NumberFormat.getInstance();formater.setGroupingUsed(false);String cellValue = "";if (cell == null) {return cellValue;}switch (cell.getCellType()) {case HSSFCell.CELL_TYPE_NUMERIC:cellValue = formater.format(cell.getNumericCellValue());break;case HSSFCell.CELL_TYPE_STRING:cellValue = cell.getStringCellValue();break;case HSSFCell.CELL_TYPE_BLANK:cellValue = cell.getStringCellValue();break;case HSSFCell.CELL_TYPE_BOOLEAN:cellValue = Boolean.valueOf(cell.getBooleanCellValue()).toString();break;case HSSFCell.CELL_TYPE_ERROR:cellValue = String.valueOf(cell.getErrorCellValue());break;default:cellValue = "";}return cellValue.trim();}// 读取pdf文件public String readPDF(String file) throws IOException {String result = null;FileInputStream is = null;PDDocument document = null;try {is = new FileInputStream(file);PDFParser parser = new PDFParser(is);parser.parse();document = parser.getPDDocument();PDFTextStripper stripper = new PDFTextStripper();result = stripper.getText(document);} finally {if (is != null) {is.close();}if (document != null) {document.close();}}return result;}// 读取doc文件public String readWORD(String file) throws Exception {String returnStr = "";try {WordExtractor wordExtractor = new WordExtractor(new FileInputStream(new File(file)));returnStr = wordExtractor.getText();} catch (FileNotFoundException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}return returnStr;}// 读取docx文件public String readWORD2007(String file) throws Exception { return new XWPFWordExtractor(POIXMLDocument.openPackage(file)).getText(); }// 读取txt文件public String readTXT(String file) throws IOException {String encoding = ReadFileUtils.get_charset(new File(file));if (encoding.equalsIgnoreCase("GBK")) {return FileUtils.readFileToString(new File(file), "gbk");} else {return FileUtils.readFileToString(new File(file), "utf8");}}private static String get_charset(File file) throws IOException {String charset = "GBK";byte[] first3Bytes = new byte[3];BufferedInputStream bis = null;try {boolean checked = false;bis = new BufferedInputStream(new FileInputStream(file));bis.mark(0);int read = bis.read(first3Bytes, 0, 3);if (read == -1)return charset;if (first3Bytes[0] == (byte) 0xFF && first3Bytes[1] == (byte) 0xFE) {charset = "UTF-16LE";checked = true;} else if (first3Bytes[0] == (byte) 0xFE&& first3Bytes[1] == (byte) 0xFF) {charset = "UTF-16BE";checked = true;} else if (first3Bytes[0] == (byte) 0xEF&& first3Bytes[1] == (byte) 0xBB&& first3Bytes[2] == (byte) 0xBF) {charset = "UTF-8";checked = true;}bis.reset();if (!checked) {// int len = 0;int loc = 0;while ((read = bis.read()) != -1) {loc++;if (read >= 0xF0)break;if (0x80 <= read && read <= 0xBF) // 单独出现BF以下的,也算是GBKbreak;if (0xC0 <= read && read <= 0xDF) {read = bis.read();if (0x80 <= read && read <= 0xBF) // 双字节 (0xC0 - 0xDF)// (0x80// - 0xBF),也可能在GB编码内continue;elsebreak;} else if (0xE0 <= read && read <= 0xEF) {// 也有可能出错,但是几率较小read = bis.read();if (0x80 <= read && read <= 0xBF) {read = bis.read();if (0x80 <= read && read <= 0xBF) {charset = "UTF-8";break;} elsebreak;} elsebreak;}}// System.out.println( loc + " " + Integer.toHexString( read )// );}} catch (Exception e) {e.printStackTrace();} finally {if (bis != null) {bis.close();}}return charset;}}

java操作Office办公软件(office办公软件基本操作)

说一下具体方式,首先java操作office需要有第三方的jar来支持比如poi-32jar、jacobjar、jxljar、poi-contrib-32-FINAL-20081019jar、poi-scratchpad-32-FINAL-20081019jar之类的jar,有了这些第三方包的支持,然后根据自己的需求来对照包里面具体的工具类来实现,自动播放和自动下来观看建议自己写个timer来实现javautilTimer和javautilTimerTask

JAVA中如何将带%号的编码转换为汉字?

是utf码,有类的

你好,我的新浪微博登陆页面,按钮点击一直没反应,做下角一直出现的是javascrip:void(0)这个符号,

我也遇到同样的问题,今晚上弄了一晚。后来发现,原来是我的IE旧了。之前用的是IE7,经过更新现在是IE8。因为在网上看人家说过,新浪微博现在久不久的更新,而且现在网上很多的东西都要求支持更高版本的IE浏览器。你试试更新下载一下IE浏览器。希望你也能解决。

java new date(str) 在tostring() 对象会报错?为什么?

明明是Date d = new Date(str);这个报错,new Date();

blood Just Jack的歌词

Tom Jones - The Hitter lrc by buchao @ LK姝岃瘝缁?Rock 鍒嗛槦 @ www.cococ.com @ Come to the door Ma, and unlock the chain I was just passin钬?through and got caught in the rain There钬檚 nothing I want, nothin钬?that you need say Just let me lie down for a while and I钬檒l be on my way隆 I was no more than a kid when you put me on the Southern Queen With the police on my back I fled to New Orleans I fought in the dockyards and with the money I made I knew the fight was my home and blood was my trade Baton Rouge, Poncitoula, and Lafayette town Well they paid me their money Ma I knocked the men down I did what I did well it come easily Restraint and mercy Ma were always strangers to me I fought champion Jack Thompson in a field full of mud Rain poured through the tent to the canvas and mixed with our blood In the twelfth I slipped my tongue over my broken jaw I stood over him and pounded his bloody body into the floor Well the bell rang and rang and still I kept on 钬楾ill I felt my glove leather slip 钬榯ween his skin and bone Then the women and the money came fast and the days I lost track The women red, the money green, but the numbers were black I fought for the men in their silk suits to lay down their bets I took my good share Ma, I have no regrets Then I took the fix at the state armory with big John McDowell From high in the rafters I watched myself fall As he raised his arm my stomach twisted and the sky it went black I stuffed my bag with their good money and I never looked back Understand, in the end Ma every man plays the game If you know me one different then speak out his name Ma if my voice now you don钬檛 recognize Then just open the door and look into your dark eyes I ask of you nothin钬? not a kiss not a smile, Just open the door and let me lie down for a while Now the gray rain钬檚 fallin钬?and my ring fightin钬檚 done So in the work fields and alleys I take all who钬檒l come If you钬檙e a better man than me then just step to the line Now there钬檚 nothin钬?I want Ma nothin钬?that you need say Just let me lie down for a while and I钬檒l be on my way Tonight in the shipyard a man draws a circle in the dirt I move to the center and I take off my shirt I study him for the cuts, the scars, the pain, Man, nor the time can erase I move hard to the left and I strike to the face

django 没有 migrate, makemigration选项

事django1.7对python2.6支持可能有点问题,而且你的事1.7.7,我记得django1.8已经移除了python2.6的支持,因此你的解决方法有两个,装python2.7,或者pipinstalldjango==1.6版本1.7以下。

python中django的migrate命令总出问题,显示Errno 0,为何?

windows 不支持 linux类型的文件操作权限(r+/w+等等)建议用windows做一个linux虚拟机,或者docker也行,然后运行python就没这个问题了。

如何解决Django 1.8在migrate时失败

1. 创建项目运行下面命令就可以创建一个 django 项目,项目名称叫 mysite :$ django-admin.py startproject mysite创建后的项目目录如下:mysite├── manage.py└── mysite ├── __init__.py ├── settings.py ├── urls.py └── wsgi.py1 directory, 5 files说明:__init__.py :让 Python 把该目录当成一个开发包 (即一组模块)所需的文件。 这是一个空文件,一般你不需要修改它。manage.py :一种命令行工具,允许你以多种方式与该 Django 项目进行交互。 键入python manage.py help,看一下它能做什么。 你应当不需要编辑这个文件;在这个目录下生成它纯是为了方便。settings.py :该 Django 项目的设置或配置。urls.py:Django项目的URL路由设置。目前,它是空的。wsgi.py:WSGI web 应用服务器的配置文件。更多细节,查看 How to deploy with WSGI接下来,你可以修改 settings.py 文件,例如:修改 LANGUAGE_CODE、设置时区 TIME_ZONESITE_ID = 1LANGUAGE_CODE = "zh_CN"TIME_ZONE = "Asia/Shanghai"USE_TZ = True 上面开启了 [Time zone](https://docs.djangoproject.com/en/1.7/topics/i18n/timezones/) 特性,需要安装 pytz:$ sudo pip install pytz2. 运行项目在运行项目之前,我们需要创建数据库和表结构,这里我使用的默认数据库:$ python manage.py migrateOperations to perform: Apply all migrations: admin, contenttypes, auth, sessionsRunning migrations: Applying contenttypes.0001_initial... OK Applying auth.0001_initial... OK Applying admin.0001_initial... OK Applying sessions.0001_initial... OK然后启动服务:$ python manage.py runserver你会看到下面的输出:Performing system checks...System check identified no issues (0 silenced).January 28, 2015 - 02:08:33Django version 1.7.1, using settings "mysite.settings"Starting development server at http://127.0.0.1:8000/Quit the server with CONTROL-C.这将会在端口8000启动一个本地服务器, 并且只能从你的这台电脑连接和访问。 既然服务器已经运行起来了,现在用网页浏览器访问 http://127.0.0.1:8000/。你应该可以看到一个令人赏心悦目的淡蓝色 Django 欢迎页面它开始工作了。你也可以指定启动端口:$ python manage.py runserver 8080以及指定 ip:$ python manage.py runserver 0.0.0.0:80003. 创建 app前面创建了一个项目并且成功运行,现在来创建一个 app,一个 app 相当于项目的一个子模块。在项目目录下创建一个 app:$ python manage.py startapp polls如果操作成功,你会在 mysite 文件夹下看到已经多了一个叫 polls 的文件夹,目录结构如下:polls├── __init__.py├── admin.py├── migrations│ └── __init__.py├── models.py├── tests.py└── views.py1 directory, 6 files4. 创建模型每一个 Django Model 都继承自 django.db.models.Model在 Model 当中每一个属性 attribute 都代表一个 database field通过 Django Model API 可以执行数据库的增删改查, 而不需要写一些数据库的查询语句打开 polls 文件夹下的 models.py 文件。创建两个模型:import datetimefrom django.db import modelsfrom django.utils import timezoneclass Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField("date published") def was_published_recently(self): return self.pub_date >= timezone.now() - datetime.timedelta(days=1)class Choice(models.Model): question = models.ForeignKey(Question) choice_text = models.CharField(max_length=200) votes = models.IntegerField(default=0)然后在 mysite/settings.py 中修改 INSTALLED_APPS 添加 polls:INSTALLED_APPS = ( "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "polls",)在添加了新的 app 之后,我们需要运行下面命令告诉 Django 你的模型做了改变,需要迁移数据库:$ python manage.py makemigrations polls你会看到下面的输出日志:Migrations for "polls": 0001_initial.py: - Create model Choice - Create model Question - Add field question to choice你可以从 polls/migrations/0001_initial.py 查看迁移语句。运行下面语句,你可以查看迁移的 sql 语句:$ python manage.py sqlmigrate polls 0001输出结果:BEGIN;CREATE TABLE "polls_choice" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "choice_text" varchar(200) NOT NULL, "votes" integer NOT NULL);CREATE TABLE "polls_question" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "question_text" varchar(200) NOT NULL, "pub_date" datetime NOT NULL);CREATE TABLE "polls_choice__new" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "choice_text" varchar(200) NOT NULL, "votes" integer NOT NULL, "question_id" integer NOT NULL REFERENCES "polls_question" ("id"));INSERT INTO "polls_choice__new" ("choice_text", "votes", "id") SELECT "choice_text", "votes", "id" FROM "polls_choice";DROP TABLE "polls_choice";ALTER TABLE "polls_choice__new" RENAME TO "polls_choice";CREATE INDEX polls_choice_7aa0f6ee ON "polls_choice" ("question_id");COMMIT;你可以运行下面命令,来检查数据库是否有问题:$ python manage.py check再次运行下面的命令,来创建新添加的模型:$ python manage.py migrateOperations to perform: Apply all migrations: admin, contenttypes, polls, auth, sessionsRunning migrations: Applying polls.0001_initial... OK总结一下,当修改一个模型时,需要做以下几个步骤:修改 models.py 文件运行 python manage.py makemigrations 创建迁移语句运行 python manage.py migrate,将模型的改变迁移到数据库中你可以阅读 django-admin.py documentation,查看更多 manage.py 的用法。创建了模型之后,我们可以通过 Django 提供的 API 来做测试。运行下面命令可以进入到 python shell 的交互模式:$ python manage.py shell下面是一些测试:>>> from polls.models import Question, Choice # Import the model classes we just wrote.# No questions are in the system yet.>>> Question.objects.all()[]# Create a new Question.# Support for time zones is enabled in the default settings file, so# Django expects a datetime with tzinfo for pub_date. Use timezone.now()# instead of datetime.datetime.now() and it will do the right thing.>>> from django.utils import timezone>>> q = Question(question_text="What"s new?", pub_date=timezone.now())# Save the object into the database. You have to call save() explicitly.>>> q.save()# Now it has an ID. Note that this might say "1L" instead of "1", depending# on which database you"re using. That"s no biggie; it just means your# database backend prefers to return integers as Python long integer# objects.>>> q.id1# Access model field values via Python attributes.>>> q.question_text"What"s new?">>> q.pub_datedatetime.datetime(2012, 2, 26, 13, 0, 0, 775217, tzinfo=<UTC>)# Change values by changing the attributes, then calling save().>>> q.question_text = "What"s up?">>> q.save()# objects.all() displays all the questions in the database.>>> Question.objects.all()[<Question: Question object>]打印所有的 Question 时,输出的结果是 [<Question: Question object>],我们可以修改模型类,使其输出更为易懂的描述。修改模型类:from django.db import modelsclass Question(models.Model): # ... def __str__(self): # __unicode__ on Python 2 return self.question_textclass Choice(models.Model): # ... def __str__(self): # __unicode__ on Python 2 return self.choice_text接下来继续测试:>>> from polls.models import Question, Choice# Make sure our __str__() addition worked.>>> Question.objects.all()[<Question: What"s up?>]# Django provides a rich database lookup API that"s entirely driven by# keyword arguments.>>> Question.objects.filter(id=1)[<Question: What"s up?>]>>> Question.objects.filter(question_text__startswith="What")[<Question: What"s up?>]# Get the question that was published this year.>>> from django.utils import timezone>>> current_year = timezone.now().year>>> Question.objects.get(pub_date__year=current_year)<Question: What"s up?># Request an ID that doesn"t exist, this will raise an exception.>>> Question.objects.get(id=2)Traceback (most recent call last): ...DoesNotExist: Question matching query does not exist.# Lookup by a primary key is the most common case, so Django provides a# shortcut for primary-key exact lookups.# The following is identical to Question.objects.get(id=1).>>> Question.objects.get(pk=1)<Question: What"s up?># Make sure our custom method worked.>>> q = Question.objects.get(pk=1)# Give the Question a couple of Choices. The create call constructs a new# Choice object, does the INSERT statement, adds the choice to the set# of available choices and returns the new Choice object. Django creates# a set to hold the "other side" of a ForeignKey relation# (e.g. a question"s choice) which can be accessed via the API.>>> q = Question.objects.get(pk=1)# Display any choices from the related object set -- none so far.>>> q.choice_set.all()[]# Create three choices.>>> q.choice_set.create(choice_text="Not much", votes=0)<Choice: Not much>>>> q.choice_set.create(choice_text="The sky", votes=0)<Choice: The sky>>>> c = q.choice_set.create(choice_text="Just hacking again", votes=0)# Choice objects have API access to their related Question objects.>>> c.question<Question: What"s up?># And vice versa: Question objects get access to Choice objects.>>> q.choice_set.all()[<Choice: Not much>, <Choice: The sky>, <Choice: Just hacking again>]>>> q.choice_set.count()3# The API automatically follows relationships as far as you need.# Use double underscores to separate relationships.# This works as many levels deep as you want; there"s no limit.# Find all Choices for any question whose pub_date is in this year# (reusing the "current_year" variable we created above).>>> Choice.objects.filter(question__pub_date__year=current_year)[<Choice: Not much>, <Choice: The sky>, <Choice: Just hacking again>]# Let"s delete one of the choices. Use delete() for that.>>> c = q.choice_set.filter(choice_text__startswith="Just hacking")>>> c.delete()>>> 上面这部分测试,涉及到 django orm 相关的知识,详细说明可以参考 Django中的ORM。5. 管理 adminDjango有一个优秀的特性, 内置了Django admin后台管理界面, 方便管理者进行添加和删除网站的内容.新建的项目系统已经为我们设置好了后台管理功能,见 mysite/settings.py:INSTALLED_APPS = ( "django.contrib.admin", #默认添加后台管理功能 "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "mysite",)同时也已经添加了进入后台管理的 url, 可以在 mysite/urls.py 中查看:url(r"^admin/", include(admin.site.urls)), #可以使用设置好的url进入网站后台接下来我们需要创建一个管理用户来登录 admin 后台管理界面:$ python manage.py createsuperuserUsername (leave blank to use "june"): adminEmail address:Password:Password (again):Superuser created successfully.总结最后,来看项目目录结构:mysite├── db.sqlite3├── manage.py├── mysite│ ├── __init__.py│ ├── settings.py│ ├── urls.py│ ├── wsgi.py├── polls│ ├── __init__.py│ ├── admin.py│ ├── migrations│ │ ├── 0001_initial.py│ │ ├── __init__.py│ ├── models.py│ ├── templates│ │ └── polls│ │ ├── detail.html│ │ ├── index.html│ │ └── results.html│ ├── tests.py│ ├── urls.py│ ├── views.py└── templates └── admin └── base_site.htm 通过上面的介绍,对 django 的安装、运行以及如何创建视 图和模型有了一个清晰的认识,接下来就可以深入的学习 django 的自动化测试、持久化、中间件、国 际 化等知识。

java时间戳多少位

1414820032229

JavaWeb的实体类定义中一般日期定义成什么格式?

string类型好处理,你的想法是对的,如果获取一个日期类型的数据,后台写起来麻烦的很,直接String类型的传过来,想存String和Date都有办法

java里面的JTabbedPane选项卡里面添加的按钮怎么实现功能啊

JTabbedPane tabPanel = new JTabbedPane(........);tabPane.setIconAt(tabPane.getTabCount()-1, new ImageIcon(""));

java中14位时间戳怎么获取

时间戳现在是13位的从1970年以来的毫秒数,不知道你说的14位的是?

阿汤哥和jascha richter与保罗·沃克谁最帅,谁演的电影更好看,谁是最佳男主角!

我最喜欢的是阿汤哥,碟中谍简直是经典啊。阿汤哥有种的独特魅力在吸引着我们,而且他戏路也很宽,喜剧天赋也很强,并不是只能扮演大英雄或大情圣。他演什么像什么。你觉得他是阿甘、是米勒、是典狱警长、是fbi、是保险律师、是同性恋、是10岁的儿子父亲、是困在机场是人士、是鲁滨逊、是菲利普斯船长,明明那么多那么多经典作品,但看每一部的时候你都不会被其他经典形象干扰,你会相信,他就是这个角色,他就是他要表现的那一个人,每一个人。这才是演员。至于保罗沃克,就只有速度与激情系列比较出名了,和阿汤哥根本没法比。而jascha richter好像是歌手吧。

美国歌手Jascha Richter他帅吗?

Jascha Richter作为MLTR乐队(迈克学摇滚)的主唱,他的唱功无容置疑。更值得一提的是,乐队几乎所有的歌曲都是Jascha一人写的,对于乐队来说,Jascha绝对是灵魂中的灵魂!63年出生的他已经过了帅与不帅的年纪,但是说他是个萌叔倒最贴切!

《TWILIGHT》中的Jacob

https://www.google.com/search?q=jacob&hl=en&client=firefox-a&hs=7GW&rls=org.mozilla:zh-CN:official&prmd=imvns&source=lnms&tbm=isch&ei=NRjUTvWGH-qw2QW_kr17&sa=X&oi=mode_link&ct=mode&cd=2&ved=0CBUQ_AUoAQ&biw=1280&bih=696诶不我有个问题你知道你在说什么么Taylor就是演Jacob那个,Robert是淹Edward那个。你要是觉得Jacob"那么丑"你还要他图片干嘛……最后bella和Edward是在一起了……

杰克-斯帕罗(Jack Sparrow)历史上真有其人吗?

日语翻译oh.shit.japenese

え?くそ、日本人だ

laranja bestvit-c vitamina-c comprimidos b.p.200mg是什么意思

这些英文字母什么意思

Dear Jack,How are you? I have been in the USA for six months. I like the life here. I have a fe...

小题1:T小题2:F小题3:T小题4:T小题5:F试题分析:这是一封David写给Jack的信,在信中David告诉了Jack他在美国的生活,他很喜欢那的生活,有很多朋友,没有太多的家庭作业。信中David还提到了他喜欢吃的和喝的东西。在信的最后,David说他有时候会生病,但是他不知道为什么,他的父母说是他不爱运动、吃得太多的缘故。小题1:根据文章的第二句话IhavebeenintheUSAforsixmonths.可知,David在美国已经6个月了。故这个题的表述和原文是一致的。故是T。小题2:根据文章中Idon"thavemuchhomework可知,David在信中说他并没有太多的家庭作业,故这句话说David有很多家庭作业是错误的,与原文表达不一致,故是F。小题3:根据文章中Therearealotofsportsatmyschool可知,在David的学校有很多的体育运动,这句话的alotof是许多的这个意思,和这个题目中的many是一个意思,因此这句话是正确的。故是T。小题4:根据文章中Ilikecokeverymuch.Idon"tdrinkwater可知,David非常喜欢可乐,但是他不喜欢喝水。故由此我们可以知道,比起水来,David更喜欢可乐。故这句话在正确的。小题5:根据短文中ThesadthingisthatsometimesIgetill.Idon"tknowwhy可知,David在信中说他有时候会生病,但是他不知道为什么,由此可知,这句话说David知道他为什么经常生病是错误的。故是F。

请按照java编程语言的语境。翻译Graphics+User+Interface?

在 Java 编程语言中,"Graphics + User + Interface" 通常被翻译为 "图形用户界面" 或简称 "GUI"。

Java程序面向对象编程的基本架构 接口的定义和使用 求完整代码……谢谢

public class Admins implements Userinterface{ private String name; private String password; private static int userNum; public Admins() { userNum ++; } public Admins(String name, String password) { this.name = name; this.password = password; userNum ++; } public void setPassword(String password) { this.password = password; } public String getPassword() { return this.password; } public String toString() { return "Total: " + Admins.userNum + " Name: " + this.name + " Password: " + this.password; } public static void main(String [] args) { Userinterface [] users = new Userinterface[]{new Admins("jeryy", "11111"), new Admins("green", "123123")}; for(Userinterface u: users) { System.out.println(u); } } }interface Userinterface{ public void setPassword(String password); public String getPassword(); public String toString();}public class Bins{ public static void main(String [] args) { int len = 10; int [] dist = new int [len]; for(int i = 0; i < dist.length; i ++) { dist[i] = (int)(Math.random() * 100); } java.util.Arrays.sort(dist); System.out.println("生成数组如下: "); for(int i: dist) { System.out.print(i + " "); } java.util.Scanner san = new java.util.Scanner(System.in); System.out.print("输入要查找的数: "); int key = san.nextInt(); int res = Bins.binSearch(dist, key); //System.out.println(res); String info = (res >=0 ) ? (key + ":" + res) : "查找失败"; System.out.println(info); } public static int binSearch(int [] dist, int key) { java.util.Arrays.sort(dist); return java.util.Arrays.binarySearch(dist, key);} }

使用java连接oracle数据库的详细步骤,以及怎样在oracle数据库里建库建表,和用户名及权限的设置

这个说起来话有点长了。。。

It is timefor Jack The Ripper to let er rip(er是什么意思?)

ItistimeforJackTheRippertolete...的中文翻译_百度翻译ItistimeforJackTheRippertoleterrip现在开膛手杰克让二RIP全部释义和例句试试人工翻译

开膛手Jake是否真实存在?

现实中不存在,在名侦探柯南中出现。他代表着杀人狂魔。

Jack the Ripper是谁?

见百科http://baike.baidu.com/view/34472.htm?subLemmaId=8387866&fromId=254265Jack the Ripper,是1888年8月7日到11月9日间,于伦敦东区的白教堂(Whitechapel)一带以残忍手法连续杀害至少五名妓女的凶手代称。犯案期间,凶手多次写信至相关单位挑衅,却始终未落入法网。其大胆的犯案手法,又经媒体一再渲染而引起当时英国社会的恐慌。至今他依然是欧美文化中最恶名昭彰的杀手之一。虽然犯案期间距今已达百年之久,研究该案的书籍与相关研究也日渐增多。但因缺乏证据,凶手是谁却是各说其词、毫无交集,因而使案情更加扑朔迷离。可是开膛手杰克的身影却透过媒体、摇滚乐、玩具等物品不断出现在今日的大众文化之中。

什么是jackripper病毒?感染最严重的后果是什么?

Jack Ripper是一种驱动感染病毒,感染它的电脑一般杀毒软件都无法清除,感染最严重后果是是分区表丢失。其名字来源于Jack the ripper。解决办法:1、马上下载一个分区表恢复软件,一般是可以将丢失文件恢复的。2、升级360杀毒软件到最新;3、关闭系统还原防止病毒复活;4、重启,按动F8进入安全模式;5、在里面全盘查杀病毒;结束后,正常重启,病毒彻底杀掉,干干净净。启示:只有进入安全模式,才可以彻底查杀病毒; 关闭系统还原,是防止病毒复活的。所以,对付所有顽固病毒,这才是最有效的办法。

请问福尔摩斯和Jack The Ripper 是生活在同一个时代吗?

直到十九世纪初,对于一般居民而言伦敦还是个相当危险的都市;事实上,要到1829年,苏格兰警场才建立辖管全市的警察制度。半个多世纪后的一八八八年,在殖民帝国日渐耀眼的光芒下,伦敦表面上已成为一个对人身和财产安全相当有保障的首善之都。然而在维多利亚社会的底层,却汹涌著因虚伪、贫困和不公而产生的诸多社会、政治变动暗潮;这尤其彰显在以移民和贫穷著称的伦敦东区(East End)。不到一哩见方的土地上,伦敦东区除了汇聚大批传统英国阶级社会最底层的劳力工人外,还吸纳了四万名左右来自东欧与俄罗斯一带的犹太难民。 为了生存,这些东区住民,男性幸者在附近的批发市场和货栈码头间出卖劳力赚取微薄,不幸者则因劳力竞争者过多而失业,流落街头。东区的女性和孩童,则从织布、清扫烟囱等据统计达两百种左右的卑微行当中,每天平均必须出卖十一个小时的劳力以糊口或者贴补家用。对于女性而言,出卖肉体是一种相对收入较高的行业。一八八八年全伦敦据估计有六到八万的妓女,而东区则是全市几处****易最频繁的地区之一,且属其中最“低阶”者。 <<波希米亚丑闻>>中艾林艾德勒的才智被福尔摩斯欣赏.福尔摩斯一直称艾林艾德勒为“那位女士”。关于the Woman. 是啊,是啊,我马上就要提起这位伟大的女性了。福尔摩斯心目中永远的“那位女士”。到底有多少位福尔摩斯学者控制不住自己的幻想,在毫无事实基础的情况下让艾琳?艾德勒小姐和福尔摩斯先生喜结良缘?有人说是在福尔摩斯失踪的那四年,有人说是在福尔摩斯退休之后,有人说并没有结婚,只是同居。而关于他们两个的孩子更有长篇累牍,不着边际的各种推测。就连Hall先生也在他的《福尔摩斯十研究》中用最后一章来写这两个人的罗曼史。

去服务中心系统重装后,刚装完mse,重启之后mse提示有个病毒:Virus:DOS/JackTheRipper?

如果有什么病毒洁癖那就全部格式化

javascript中NaN == NaN的返回值是?

NaN “Not a Number” NaN 值非常特殊,因为它“不是数字”,所以任何数跟它都不相等,甚至 NaN 本身也不等于 NaN 。 isNaN(numValue)其中必选项 numvalue 参数为要检查是否为 NAN 的值。 如果值是 NaN, 那么 isNaN 函数返回 true ,否则返回 false 。

jack是什么意思英语

jack的意思是杰克(人名)、千斤顶,起重器;(电)插孔,插座;J牌,杰克;丝毫,一点(不)。短语:jack in停止、辞掉、放弃;jack up提高、顶起、用千斤顶托起;hydraulic jack液压千斤顶、液压起重器;jack johnson杰克·约翰逊;jack the ripper开膛手杰克;jack welch杰克·韦尔奇。hoisting jack千斤顶、起重器;union jack英国国旗、联合王国国旗;black jack闪锌矿;铁闪锌矿;screw jack螺旋千斤顶;jack and jill男男女女;jack frost(拟人化)霜、严寒。同近义词:enhance、boost、mount、hot、gain。jack的例句:1、Jack was a born teacher.杰克是个天生的教师。2、Jack"s teacher is doing very well,he often batches homework until late at night.杰克的老师做得非常好,他经常批作业到深夜。3、The car was picked up and was about to fall.这个汽车被千斤顶顶起来了,它摇摇欲坠。4、Today,the school taught us how to use jacks correctly.今天学校教了我们如何正确地使用千斤顶。

开膛手杰克 jack the ripper

有关电影名 《来自地狱》

java中NaN是什么意思

表示不是一个数,例如计算0/0或者负数的平方根结果就是NaN。Java所有的浮点数值计算都遵循IEEE 754标准,用于表示溢出和出错情况的三个特殊的浮点数值:正无穷大负无穷大NaN望采纳~

Jack The Ripper 杀人动机是什么?是怎么死的?拜托各位了 3Q

他憎恨妓女,因此杀了很多妓女,这是资料:1888年8月31日起到该年的11月9日,在10个星期中,开膛手杰克在伦敦以极为相似的手法犯下了5宗凶残的谋杀案,害人且大都是社会最底层的廉价妓女。案件发生后,在当时的伦敦乃至整个英国引发了一片疯狂的议论、谣传以及恐慌,警方四处侦缉也没抓获到凶手。第4起案件发生后,九月二十七日,一家新闻社接到一封用红墨水书写,并盖有指印的信件,写信的人以带著非劳动阶层调调的戏谑语气表明自己是连续命案的凶手,并且署名Jack the Ripper 。开膛手杰克的名声就这样不胫而走,以后全英国乃至全世界自此开始以此称呼白教堂连续凶案的凶手。开膛手杰克成了犯罪史上一个永远的谜,他(她)最为其他罪犯所不及的是他没被捕过而且其真实身份永远没有人知晓——除了凶手自己。 在一八八八年八月三十一日至十一月九日间,伦敦东区(East End)曾连续发生五起谋杀事件,受害者全是沦落风尘的妓女,犯罪地点均在闹市区的暗角,案发时间多为深夜至凌晨之间。谋杀者既不为色也不谋财,受害者却个个被残忍地开膛剖肚。这个自称为“开膛手杰克”(Jack the Ripper)的杀人凶手更胆大妄为地投书警方,声称:“我最恨妓女,我将继续把她们开膛剖肚!”消息传开,整个英伦社会为之震惊,伦敦市民人人自危,女子夜间更不敢轻易出门。 伦敦警方,也就是大名鼎鼎的苏格兰广场,出动了数千警力,殚精竭虑予以侦破,然而最终一无所获。截止当年十一月九日,犯罪活动突然中止,从此该案成为百年悬案,至今没有任何可信的解释或明显答案。 那么,这位“开膛手杰克”究竟是谁?当时的人们纷纷议论,万般猜测,也成为日后一个长兴不衰的历史话题。有人说,他是一位医生,因为他能在短时间内把受害人开膛剖肚,手法极为娴熟利落;也有人说他是英国政坛的一位高官,因为只有这种身份的人,才有能力阻止伦敦警方迟迟不能破案;还有人说,凶手是一位犹太屠夫,当然这种说法仅仅反应出当时欧洲社会对犹太民族的仇视;甚至还有人怀疑凶手是一位奔走在伦敦大街小巷、随时都有理由出门的接生婆……

Jack the ribber开膛手杰克真有其人?

确有其人

谁知到“Jack The Ripper”是什么意思?他是谁?

1. 开膛手杰克一个多世纪前的开膛手杰克(Jack the Ripper),是1889年8月31日至11月9日英国伦敦系列凶杀案的凶手绰号。他被认为在那一年至少杀害了7名妓女,死者颈部被割,内脏被挖。 www.amibatoy.com- 基于391个网页 2. 開膛手傑克開膛手傑克(Jack the Ripper):英國史上第一位變態殺人魔。歷史上真有其人,但是「開膛手傑克」之明確早先一步不逕而走

Jack the Ripper怎么读

Jack the Ripper 在日本被称为: 切り裂きジャック 读作:きりさきじゃっく 开膛手杰克 Jack the Ripper 切り裂き ジャック 切り裂き

JamesGordonWhite是哪里人

JamesGordonWhiteJamesGordonWhite是一名演员及编剧,主要作品有《TheThingwithTwoHeads》、《美国磨坊》。外文名:JamesGordonWhite职业:演员代表作品:《美国磨坊》合作人物:ElijahDrenner

javascript里面NaN到底是什么意思?

你可以用isNaN(i)来判断是不是NaN

jillian janson是谁

x factor美版第二季的选手

没学html能否一开始只学javascript,两者之间有什么关系?

javasctipt 是脚步语言,可以在多中语言中使用。没有学html的话 没有关系的。他们之间的关系无非就是 我写一个javascsript要到html中显示!看效果罢了!javascsript 操作html html显示结果

如何用Javascript 将汉字转换为gb2312编码?

function EncodeUtf8(s1){var s = escape(s1);var sa = s.split("%");var retV ="";if(sa[0] != ""){retV = sa[0];}for(var i = 1; i < sa.length; i ++){if(sa[i].substring(0,1) == "u"){retV += Hex2Utf8(Str2Hex(sa[i].substring(1,5)));}else retV += "%" + sa[i];}return retV;}function Str2Hex(s){var c = "";var n;var ss = "0123456789ABCDEF";var digS = "";for(var i = 0; i < s.length; i ++){c = s.charAt(i);n = ss.indexOf(c);digS += Dec2Dig(eval(n));}//return value;return digS;}function Dec2Dig(n1){var s = "";var n2 = 0;for(var i = 0; i < 4; i++){n2 = Math.pow(2,3 - i);if(n1 >= n2){s += "1";n1 = n1 - n2;}elses += "0";}return s;}function Dig2Dec(s){var retV = 0;if(s.length == 4){for(var i = 0; i < 4; i ++){retV += eval(s.charAt(i)) * Math.pow(2, 3 - i);}return retV;}return -1;} function Hex2Utf8(s){var retS = "";var tempS = "";var ss = "";if(s.length == 16){tempS = "1110" + s.substring(0, 4);tempS += "10" + s.substring(4, 10); tempS += "10" + s.substring(10,16); var sss = "0123456789ABCDEF";for(var i = 0; i < 3; i ++){retS += "%";ss = tempS.substring(i * 8, (eval(i)+1)*8);retS += sss.charAt(Dig2Dec(ss.substring(0,4)));retS += sss.charAt(Dig2Dec(ss.substring(4,8)));}return retS;}return "";}http://www.javanb.com/javascript/1/5898.html实际上IE 5.5+,Netscape 6+,Mozilla中已经有了转换函数,即encodeURIComponent,但对于低版本的浏览器则需要一下代码。/* ***************************** Most of this code was kindly ** provided to me by** Andrew Clover (and at doxdesk dot com)** http://and.doxdesk.com/ ;** in response to my plea in my blog at ** http://worldtimzone.com/blog/date/2002/09/24** It was unclear whether he created it.*/function utf8(wide) {var c, s;var enc = "";var i = 0;while(i c= wide.charCodeAt(i++);// handle UTF-16 surrogatesif (c>=0xDC00 %26amp;%26amp; c<0xE000) continue;if (c>=0xD800 %26amp;%26amp; c<0xDC00) {if (i>=wide.length) continue;s= wide.charCodeAt(i++);if (s<0xDC00 || c>=0xDE00) continue;c= ((c-0xD800)<<10)+(s-0xDC00)+0x10000;}// output valueif (c<0x80) enc += String.fromCharCode(c);else if (c<0x800) enc += String.fromCharCode(0xC0+(c>>6),0x80+(c%26amp;0x3F));else if (c<0x10000) enc += String.fromCharCode(0xE0+(c>>12),0x80+(c>>6%26amp;0x3F),0x80+(c%26amp;0x3F));else enc += String.fromCharCode(0xF0+(c>>18),0x80+(c>>12%26amp;0x3F),0x80+(c>>6%26amp;0x3F),0x80+(c%26amp;0x3F));}return enc;}var hexchars = "0123456789ABCDEF";function toHex(n) {return hexchars.charAt(n>>4)+hexchars.charAt(n %26amp; 0xF);}var okURIchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";function encodeURIComponentNew(s) {var s = utf8(s);var c;var enc = "";for (var i= 0; i if (okURIchars.indexOf(s.charAt(i))==-1)enc += "%"+toHex(s.charCodeAt(i));elseenc += s.charAt(i);}return enc;}function URLEncode(fld){if (fld == "") return false;var encodedField = "";var s = fld;if (typeof encodeURIComponent == "function"){// Use javascript built-in function// IE 5.5+ and Netscape 6+ and MozillaencodedField = encodeURIComponent(s);}else {// Need to mimic the javascript version// Netscape 4 and IE 4 and IE 5.0encodedField = encodeURIComponentNew(s);}//alert ("New encoding: " + encodeURIComponentNew(fld) +// " escape(): " + escape(fld));return encodedField;}http://www.javanb.com/javascript/1/5794.html

java String类封装的index方法是用的KMP匹配吗?

什么意思啊 indexof() 是吧

java中关于native使用错误的是

无源文件。必须加上文件后缀名.java,否则将提示以下信息:D:Native>javac-h.HelloNative错误:仅当显式请求注释处理时才接受类名称。源代码,native是用做java和其他语言(如C++)进行协作时使用,也就是native后的函数的实现不是用java写的。

在java中native是一个什么修饰啊

见http://baike.baidu.com/view/1272329.htm

native是java关键字吗

不是吧;48个关键字:abstract、assert、boolean、break、byte、case、catch、char、class、continue、default、do、double、else、enum、extends、final、finally、float、for、if、implements、import、int、interface、instanceof、long、native、new、package、private、protected、public、return、short、static、strictfp、super、switch、synchronized、this、throw、throws、transient、try、void、volatile、while。2个保留字(现在没用以后可能用到作为关键字):goto、const。3个特殊直接量:true、false、null。如有帮助请采纳(不懂请提问),可以看我主页,欢迎来交流学习;

java中native的用法

其实就是JNI。native是方法修饰符。Native方法是由另外一种语言(如c/c++,FORTRAN,汇编)实现的本地方法。因为在外部实现了方法,所以在java代码中,就不需要声明了,有点类似于借口方法。Native可以和其他一些修饰符连用,但是abstract方法和Interface方法不能用native来修饰。

java中的native关键字有什么作用

配合JNI使用

java中的native关键字有什么作用?

貌似是用来掉c代码的.. 用的很少 ...

Java中,return的具体用法是什么?

你好,看样子你是新学的,对这个体会还不是很深刻,我之前也有这样的疑惑,但是程序写的多了,就越来越清晰了。网上return的用法我也就不给你粘了,相信你自己也可以搜得到。我说下你可能的误区是在循环中,break和return的用法不是很清晰。这么说吧:x0dx0a1、如果一个方法有返回值,那么必须出现return。x0dx0a2、一个方法的返回值为void,也可以出现return,但是后面什么也不可以写,直接写return;x0dx0a3、return语句后面的内容都不在执行,这是与break不同的地方,二者虽然都可以跳出循环,但是break跳出循环,后面的额代码还将继续执行。x0dx0a4、3的一个特殊情况是有finally出现的情况,这个你日后学异常的时候就明白了。x0dx0a上面都是我在编程中的一点心得体会,你不要着急,慢慢来,体会也就深刻了。

Java中,return的具体用法!

在顺序结构中return 后不能再有语句;

Java中,return的具体用法是什么?

你好,看样子你是新学的,对这个体会还不是很深刻,我之前也有这样的疑惑,但是程序写的多了,就越来越清晰了。网上return的用法我也就不给你粘了,相信你自己也可以搜得到。我说下你可能的误区是在循环中,break和return的用法不是很清晰。这么说吧:1、如果一个方法有返回值,那么必须出现return。2、一个方法的返回值为void,也可以出现return,但是后面什么也不可以写,直接写return ;3、return 语句后面的内容都不在执行,这是与break不同的地方,二者虽然都可以跳出循环,但是break跳出循环,后面的额代码还将继续执行。4、3的一个特殊情况是有finally出现的情况,这个你日后学异常的时候就明白了。上面都是我在编程中的一点心得体会,你不要着急,慢慢来,体会也就深刻了。

Java里return用法

你好,看样子你是新学的,对这个体会还不是很深刻,我之前也有这样的疑惑,但是程序写的多了,就越来越清晰了。网上return的用法我也就不给你粘了,相信你自己也可以搜得到。我说下你可能的误区是在循环中,break和return的用法不是很清晰。这么说吧:1、如果一个方法有返回值,那么必须出现return。2、一个方法的返回值为void,也可以出现return,但是后面什么也不可以写,直接写return ;3、return 语句后面的内容都不在执行,这是与break不同的地方,二者虽然都可以跳出循环,但是break跳出循环,后面的额代码还将继续执行。4、3的一个特殊情况是有finally出现的情况,这个你日后学异常的时候就明白了。上面都是我在编程中的一点心得体会,你不要着急,慢慢来,体会也就深刻了。

Java中return的用法

问的太简单,请补充。

java中return的用法

你可以用myEclipse 自己调试一下

在java中cyclibarriar和countdownlatch有什么区别

cyclibarriar 就是栅栏,顾名思义:就是一个拦截的装置。多个线程start后,在栅栏处阻塞住,一般定义栅栏的时候会定义有多少个线程。比如定义为4个,那么有三个线程到栅栏处,就阻塞住,如果没有第四个,就会一直阻塞,知道启动第四个线程到栅栏处,所有的线程开始全部进行工作。有点像赛马的例子。所有的赛马一个一个到起点,然后到齐了,在开始跑。countdownlatch:初始化定义一个数字(整型),比如定义2,一个线程启动后在await处停止下来阻塞,调用一次countDown,会减一,知道countDown后变为0时的时候,线程才会继续进行工作,否则会一直阻塞。自己写个赛马的程序,其实就什么都懂了。

跪求《I just played jax》歌词

Album:The Confessions TourMadonna-Lucky StarMadonna RitchieYou must be my lucky star"Cause you shine on me wherever you areI just think of you and I start to glowAnd I need your lightAnd baby you knowStarlight, starbright first star I see tonightStarlight, (starbright) make everything all rightStarlight, starbright first star I see tonightStarlight, (starbright) yeahStarlight, starbright, starlightYou must be my lucky star"Cause you make the darkness seem so farAnd when I"m lost you"ll be my guideI just turn around and you"re by my side Starlight, starbright first star I see tonightStarlight, (starbright) make everything all rightStarlight, starbright first star I see tonightStarlight, (starbright) yeah You may be my lucky starBut I"m the luckiest by farYou may be my lucky starBut I"m the luckiest by farYou may be my lucky starBut I"m the luckiest by farYou may be my lucky starBut I"m the luckiest by farStarlight, starbright first star I see tonightStarlight, (starbright) make everything all rightStarlight, starbright first star I see tonightStarlight, (starbright) yeahStarlight, starbright first star I see tonightStarlight, (starbright)make everything all rightStarlight, starbright first star I see tonightStarlight, (starbright) yeahDo you wanna hear some more? Every little thing that you say or doI"m hung upI"m hung up on youWaiting for your call baby night and dayI"m fed upI"m tired of waiting on you

James Bryan的《Trust》 歌词

歌曲名:Trust歌手:James Bryan专辑:Beautiful Worldずっと信じている终わらない梦を 握りしめて Trust me my wayTRUST原属:これが私の御主人様 OP作词曲: 奥井雅美/编曲: 长冈成贡原唱:奥井雅美翻唱:栗林みな実BY:黑崎ルキアHands 手と手をつないで今というこの瞬间 -toki- までただ前を见つめ 每日を歩いてた私达Don"t mind 时にこの想い 空回りするけど‘ちょっとポジティブ"がいいんじゃない?自分らしいキャラでいいでもね...ハチャメチャなシナリオは爱すべき未来 -asu- に変わっていくTrust me my way...Blowing 頬をなでる风と一绪に心地好く 楽しめる速度でこれからもずっと変わらない想い终わらない梦を 握りしめて Trust me my wayCan"t 手に追えない事件 -koko-抱えきれない瞬间时々はあるよ でも笑颜绝やさずに歩いてるSo but たまに火がついて!? 激情もするけど‘ちょっとポジティブ"でいたいから自分をおさえこまずにでもね...过激なシナリオ达は爱すべき未来 -asu- を连れて来るよTrust me my way...Blowing 风が诱う“ため息を吹き飞ばしたら君らしい速度で行けばいい”きっと素敌な想い限りない空に 両手広げ Getting my wayねぇ どんな时も自分らしく生きることは简単じゃないけど...これからもBlowing 頬をなでる风と一绪に心地好く 楽しめる速度で行けばいいずっと笑颜のままで终わらない梦を 握りしめて Trust me my way终わったhttp://music.baidu.com/song/8037128

java技术相比C++有什么优势?

java技术相比C++有什么优势? 其实根本没有比较的价值和意义,原因有以下几点: 计算机语言更多的是特定一个领域,也就是说如果不指定一个具体的领域,实在没法比较孰优孰劣,比如java在web开发方面的确见长,不过C++在一些传统的应用软件甚至系统级软件引用广泛。 各有所侧重,比如Java——奉行一次编译处处运行的哲学,这带来跨平台的有点,不过,也带来虚拟机带来的低性能。这就是C++的长处。不过Java的抽象程度更高,也就表明同等数量的代码,Java的更少。但是C++11以及C++14的引入也为C++注入了新的生命力。 java相比C++优势何在? 安全性 跨平台 对程序员来说会写一个东西会更稳定更健壮吧好学 《万户OA》JAVA技术开发的OA具有什么优势 云海OA办公自动化系统,基于java开发平台,MVP架构,跨操作系统(windows/linux/unix等)跨数据库(mysql/mssqlserver/oracel/db2/sybase等)跨应用服务器(tomcat/oracel weblogic/ibm websphere/jboss/apace geronim等)跨浏览器(ie/firefox/chrome/sogou/safari/opera/360等),配备各版本移动客户端,阿里钉钉、微信企业号接口,大量控件直接免费内置,产品包含200多个标准化的功能组件。 怎样学好Csharp?Csharp与C,C++,JAVA相比有什么优势?有什么缺点? 找个免费视频学习软件看看,再多练练就可以了,Csharp感觉比C,C++容易,JAVA优势是可以跨平台. Fluke和FOTRIC的热像技术相比有什么优势? 后者还是很不错的,是铝合金外壳,技术更好一些。 纯色技术相比量子点技术有什么优势? 纯色技术是一种新的色彩提升技术,相对于之前在色彩领域广泛应用的量子点技术更为先进,画面播放出来的效果更真实,色准更高。了解了一下,这种纯色技术是在广色域背光灯和液晶模组之间添加了一层光纳米材料,这种材料能吸收几乎所有的杂光,从而得到最纯的色彩。 JSP相比于其他技术(ASP和PHP等)有什么优势 JSP,JavaScript嘛,运行在浏览器的语言,使用率比后面两个都高,谈不上优势,取决于你使用的场景 3d打印FDM技术与其他技术相比,有什么优势? 优势:1,整个系统构造原理和操作简单,维护成本低,系统运行安全。可以使用无毒的原材料,设备系统可在办公环境中安装使用。  ,2、工艺干净、简单、易于操作且不产生垃圾。  ,3、独有的水溶性支撑技术,使得去除支撑结构简单易行,可快速构建瓶状或中空零件以及一次成型的装配结构件。  ,4、原材料以材料卷的形式提供,易于搬运和快速更换。  ,5、可选用多种材料,如各种色彩的工程塑料ABS、PC、PPSF以及医用ABS等。 当然其他技术在另外方面也有优势,各有所长吧。极光尔沃3D打印机大多数机型都是采用FDM技术。而这类的3d打印机是市场买的最好的。 C++和其它语言相比有什么优势和劣势? 优势和劣势永远都是相对的,都要看和谁比。 比C开发方便,但是没有c#,VB等方便。 比c#等支持底层较好,但不如C。 总之,学号c++,让你受用一辈子。 质子重离子技术与传统技术相比有什么优势? 质子重离子技术对人体伤害更小,携康长荣有人已经去过了,据了解还是很不错的。

ElijahNelson出生于哪里

ElijahNelsonElijahNelson是一名演员,主要作品有《拯救林肯》、《HouseofLastThings》、《InMyShoes》等。外文名:ElijahNelson职业:演员代表作品:拯救林肯合作人物:SalvadorLitvak

django 数据模型中 null=True 和 blank=True 有什么区别

null: If True, Django will store empty values as NULL in the database. Defaultis False. 如果为True,空值将会被存储为NULL,默认为False。blank: If True, the field is allowed to be blank. Default is False. 如果为True,字段允许为空,默认不允许。

initializing javascript tooling 怎么 解决

多个情况会导致这种报错。通过【重置窗口布局】,可解决大部分情况: 点击菜单导航栏的 windows>perspective>reset perspective (网上主流方案是删除一个配置文件夹,会对原有项目有影响,建议:如果【重置窗口布局】无效,再尝试那个方案)

Rebbie Jackson的《Fly Away》 歌词

歌曲名:Fly Away歌手:Rebbie Jackson专辑:Yours FaithfullyThe Cheetah Girls - Fly AwayWe"re standing on the edge of somethingDo we stay or do we runIt"s obvious that everything"s changedMy head can"t seem to figure outWhy my heart is full of doubtMaybe we"re just tired of the gameGuess you never know what"s gonna happenSo you do the best you canFollowing your soul might bring you backOr it may have another planPlease don"t let it fly away, high awayGotta keep it togetherFeel for the flowDon"t fly away, high awayPlease don"tNo don"t, don"t let it fly awayWe"ve never felt this place beforeWondering if anymoreWe can find in us what it takesIt"s not about who"s to blameI pray that they"re just growing painsLaughing while they"re testing our faith"Cause you never know what"s gonna happenSo you do the best you canFollowing our souls might bring us backUnless it has another planPlease don"t let it fly away, high awayGotta keep it togetherFeel for the flowDon"t fly away, high awayPlease don"tNo don"t, don"t let it fly awayIt"s yes, it"s noWe stay, we goFeels like we"re questioning everything, yeahWe run, we fall, but through it all (through it all)We never thought we would breakWe never thought we would breakPlease don"t let it fly away, high awayGotta keep it togetherFeel for the flowDon"t fly away, high awayPlease don"tNo don"t, don"t let it fly awayPlease don"t let it fly away, high awayGotta keep it togetherFeel for the flowDon"t fly away, high awayPlease don"tNo don"t, don"t let it fly awayPlease don"t let it fly away, high awayGotta keep it togetherFeel for the flowDon"t fly away, high awayPlease don"tNo don"t, don"t let it fly awayhttp://music.baidu.com/song/8242896

谁知道Linkin Park&Jay-Z合唱NUMB的歌词

冷亦清悠发的那个才是LP&jay-z合唱的其他几个人发的都是Linkin park 《meteora》中原版的Numb~~~

Autumn Leaves (Japanese Version) (24-Bit Digitally Remastered 04) 歌词

歌曲名:Autumn Leaves (Japanese Version) (24-Bit Digitally Remastered 04)歌手:Nat King Cole专辑:The World Of Nat King Cole - His Very BestAutumn Leaves - Laura Fygi"千金百分百电视原声带"The falling leavesdrift by the windowThe autumn leavesof red and goldI see your lipsThe summer kissesThe sunburned handsI used to holdSince you went awayThe days grow longAnd soon I"ll hearold winter"s songBut I miss you most of all, my darlingWhen autumn leavesstart to fallhttp://music.baidu.com/song/2938034

New Order的《Slow Jam》 歌词

歌曲名:Slow Jam歌手:New Order专辑:Get ReadySlow JamNew OrderRadio One SessionsAs I look at the morning skyToday the wind is blowing hardSee that bird is floating highPretty soon it will be tiredI spent a day all by myselfA rich man without his wealthSometimes I get it wrongBut I"m not the only oneThe afternoon was very clearThe sun was beating down on meI got thirsty for a beerThat I had to go to seaThe sea was very roughIt made me feel sickBut I like that kind of stuffIt beats arithmeticI don"t want the world to changeI like the way it isJust give me one more wishI can"t get enough of thisWhen it gets to be aliveAnd not just still surviveTo hit and not to missI can"t get enough of thisThe early evening mistsLook beautiful to meWas sweeter than a kissI wish you all could seeI"m a long long way from homeBut this photograph of youEven though it"s monochromeTells me what I should doSo I got up on my feetI knew it would be alrightFor my clothes were looking beatIn the middle of the nightI don"t want the world to changeI like the way it isJust give me one more wishI can"t get enough of thisWhen it gets to be aliveAnd not just still surviveTo hit and not to missI can"t get enough of thisI don"t want the world to changeI like the way it isJust give me one more wishI can"t get enough of thisWhen it gets to be aliveAnd not just still surviveTo hit and not to missI can"t get enough of thisI can"t get enough of thisI can"t get enough of thisI can"t get enough of thisI can"t get enough of thisI can"t get enough of thisI can"t get enough of thisI can"t get enough of thisI can"t get enough of thishttp://music.baidu.com/song/719424

java为什么“一旦向上转型,就不能调用子类中的新方法”?

当子类重写了父类方法,向上造成后调用的是子类方法;子类没有重写父类方法,向上造型后调用的是父类方法。publicclassTest1{publicstaticvoidmain(String[]args){Ak=newB();k.sayHi();k.hello();}}classA{publicvoidsayHi(){System.out.println("我是父类");}publicvoidhello(){System.out.println("我是父类hello");}}classBextendsA{publicvoidsayHi(){System.out.println("我是子类");}}输出结果:我是子类我是父类hello

java的annotation继承问题

好像方法重写了之后就不会继承了(无论是否设定为可继承)。这里有个实验说的很详细:http://elf8848.iteye.com/blog/1621392

在JAVA中,怎么利用反射获取一个方法

import java.lang.reflect.*;public class TestClass{ public static void main(String[] args) throws Exception{ /*Class c=Class.forName("Student"); Field[] fs=c.getDeclaredFields(); System.out.println("class "+c.getSimpleName()+"{"); for(Field f:fs){ System.out.println(f.getType().getSimpleName()+" "+f.getName()+";"); } Method[] ms=c.getDeclaredMethods(); for(Method m:ms){ System.out.print(m.getReturnType().getSimpleName()+" "); System.out.print(m.getName()+"("); Class[] ps=m.getParameterTypes(); for(Class p:ps){ System.out.print(p.getSimpleName()+","); } System.out.println("){}"); } Constructor[] cons=c.getConstructors(); for(Constructor con:cons){ System.out.println(c.getSimpleName()+"("); Class[] ps=con.getParameterTypes(); for(Class p:ps){ System.out.print(p.getSimpleName()+","); } System.out.println("){}");}*/ Object s=new Student("chun ",18); Class c=s.getClass(); Field[] fs=c.getDeclaredFields(); for(Field f:fs){ f.setAccessible(true); System.out.println(f.getName()+"="+f.get(s)); // f.set(s,"123"); // System.out.println(f.getName()+"="+f.get(s)); } Class[] ps={};//无参数 Method m=c.getDeclaredMethod("study",ps); Object[] os={}; m.invoke(s); /* Class[] ps={String.class,int.class};//有参数 Method m=c.getDeclaredMethod("study",ps);//说明是哪个方法 Object[] os={"CoreJava",new Integer(3)};//简单类型变成包装类; m.invoke(s,os);*/ }}class Student{ private String name; private int age; public Student(){} public Student(String name,int age){ this.name=name; this.age=age; } public void setName(String name){ this.name=name; } public void setAge(int age){ this.age=age; } public void study(){ System.out.println("Student "+name+" study1"); } public String study(String course,int time){ System.out.println("Student "+name+" studies "+course+" for "+time+" times"); if(time>=3)return "good"; else return "bad"; }}这是我们当时学反射的时候打的代码 属性 方法 构造方法 都有

Java题,求大佬给个源码

public class StudentTest {public static void main(String[] args) {Student student = new Student();student.id = "190351111";student.name = "张三";student.gender = "男";student.age = 19;System.out.println(student.sayHi());}}class Student {public String id;public String name;public String gender;public int age;public String sayHi() {return "大家好, 我叫" + name + ", 学号" + id + ", 性别" + gender + ", 今年" + age + ", 很高兴认识大家!";}}

java 问题 翻译

该接口,你将实施的是一包(或多重集)用于收集 存储一组对象钬攊ncluding重复。 收集,便称之为钬渞械钬袋,因为它有一些其他方法 访问最小,第二小的,和第k -最小项存储在它。你的 执行第1部分: 将实施的RankBagArray类RankBag接口; 将用于存储对象的数组的排序;及 不会使用任何内置的收集与工作对象(与例外 在uniqueSet()方法)。

很急,java定时器问题,出错?

对于贴一大堆错误出来,但是不贴源代码的问题

jass和蓝调怎么区分呢?

Jazz吧?

Java:Executors、Runnable一起使用时如何设置线程名称呢?

不需要你自己知道吧,有点类似匿名内部类的感觉,只调用一次

Java:描述反射机制的作用?举几个反射的应用?

说多多的也没用,我就简单给你介绍几个。既然你学了Java,那么反射就算你不会,你在学习过程中也会经常遇到。1、有了反射机制,那么就能逆向代码了,反编译器就是这个原理。2、像流行的框架,Spring,Hibernate等,就是利用反射机制,要不然怎么可能你配置下文件就完事呢3、动态生成类啊,当然spring里面都用到了。希望我的回答对你有帮助!

java 反射 类的带参数实例化

把参数里面的int改成Integer public Person(String name, Integer age) 这种 /** * 得到带构造的类的实例 * */ public static Object newInstance(String className, Object[] args) throws Exception { Class newoneClass = Class.forName(className); Class[] argsClass = new Class[args.length]; for (int i = 0, j = args.length; i < j; i++) { argsClass[i] = args[i].getClass(); } Constructor cons = newoneClass.getConstructor(argsClass); return cons.newInstance(args); }

java怎样将多个实例化对象放在数组里

Card[] oneCard = new Card[52];for(int i=0; i<52; i++){ oneCard[i] = new Card();}

java:子类对象向上转型为父类实例后,调用的是父类方法,还是子类方法?

调用的是自子类的方法,这就是所谓的多态。比如说class Shape { public void draw() { System.out.println("画一个图形"); }}class Square extends Shape { public void draw() { System.out.println("画一个正方形"); }}在main方法中:public static void main(String[] args) { Shape shape = new Square();// Square向上转型为Shape shape.draw();//输出:画一个正方形。这就是所谓的多态。}
 首页 上一页  99 100 101 102 103 104 105 106 107 108 109  下一页  尾页