自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(28)
  • 收藏
  • 关注

原创 leetcode14

14、Longest Common Prefix Write a function to find the longest common prefix string amongst an array of strings.class Solution(object): def longestCommonPrefix(self, strs): """ :ty

2016-06-03 18:12:23 430

原创 leetcode 165

165 easy Compare Version Numbers *Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0. You may assume that the ve

2016-06-02 20:32:27 342

原创 leetcode7

7 easy****Reverse Integer *Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321**class Solution(object): def reverse(self, x): """ :type x

2016-06-02 13:01:11 415

原创 leetcode58

58 easy Length of Last Word *Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string. If the last word does not exist, ret

2016-06-02 11:49:56 384

原创 leetcode263

263 easy ugly number *Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 1

2016-06-02 11:21:10 352

原创 leetcode350

350、easy Intersection of Two Arrays II Given two arrays, write a function to compute their intersection.Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].Note: Each element in the

2016-06-02 11:17:35 362

原创 leetcode349

349 easy Intersection of Two Arrays *Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element in the

2016-06-01 15:52:20 350

原创 leetcode27

Remove Element*Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you must do this in place with constant

2016-06-01 15:35:50 327

原创 leetcode283

Move Zeroes *Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 12], after c

2016-06-01 15:17:29 298

原创 leetcode345

easy,345 *Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Given s = “hello”, return “holle”. Example 2: Given s = “leetcode”, return “leotcede”.*

2016-06-01 13:49:19 516

原创 leetcode344

easy:344、Reverse String Write a function that takes a string as input and returns the string reversed. 我自己是这样写的:class Solution(object): def reverseString(self, s): """ :type s: st

2016-06-01 12:49:23 282

原创 排序算法的学习

最好的情况下 时间复杂度是n 最会的情况下 时间复杂度是n^2 def Bubble(list): for i in range(len(list))[::-1]: for j in range(i): if list[j]>list[j+1]: list[j],list[j+1] = list[j+1],li

2016-05-21 17:49:25 362

原创 python challenge心得

0.pow(2,38) 或者2**381.def f(str): l=[] for x in str: if 'a'<=x<='z' or 'A'<=x<='Z': x=chr((ord(x)+2-ord('a'))%26+ord('a')) l.append(x) return ''.join(l)s="g fmnc

2016-05-14 18:13:00 418

原创 django开发的投票系统

不用通用视图的时候: urls.py:from django.conf.urls import urlfrom . import viewsurlpatterns = [ url(r'^$',views.index,name='index'), url(r'^(?P<question_id>[0-9]+)/$',views.detail,name='detail'), u

2016-04-11 21:58:59 815

原创 django的模版标签和过滤器

python manage.py shellfrom django import templateif标签的使用t = template.Template(‘{%if a%}A is true{%else%}A is False{%endif%}')t.render(template.Context({‘a’:True}))for标签的使用t = template.Template('{%for

2016-04-09 20:54:43 374

原创 django的模版

1、使用template context 然后使用render来渲染 2、新建一个文件夹 templates,用来存放模版 在settings中加入这样一句,告诉应用模版在什么位置TEMPLATE_DIRS = os.path.join(os.path.dirname(__file__),'templates')2.html<html><body><p>Hello World!hhhhhhh

2016-04-08 11:35:38 362

原创 Django开发 hello world

首先建立项目 在终端中输入如下命令:django-admin.py startproject mysitecd mysitedjango-admin.py startapp myapp用sublime打开 在settings中加入myapp 在views中from django.shortcuts import renderfrom django.http import HttpRespon

2016-04-08 10:41:13 359

原创 模型开发与数据库交互--数据库处理

models.pyfrom django.db import modelsclass Mysite(models.Model): title = models.CharField(max_length = 100) url = models.URLField() author = models.CharField(max_length = 100) num = mo

2016-04-06 22:26:40 508

原创 django的下载安装以及第一个项目的创建

django的下载安装以及第一个项目的创建 1、django可以通过两种方式进行安装: 【1】在django的官网上下载,然后解压 ,进入解压的目录,命令 行:python setup.py install 【2】通过pip install django==1.9.4进行安装 安装之后要配置环境变量 将D:\Python27\Lib\site-packages\django

2016-04-05 21:53:11 415

原创 MySQLdb的安装以及python连接数据库(win,Mac)

MySQLdb的安装以及python与数据库的连接1, http://www.codegood.com/downloads在这里下载相对应的mysqlbd版本 双击安装 在命令行中输入python import MySQLdb 如果没有任何提示 则说明安装正确 注意:MySQLbd的大小写 否则还是提示不正确 2.安装好后 可以建立python与数据库的连接了import MySQLdbco

2016-03-29 21:57:40 395

原创 django的下载安装以及第一个项目的创建

django的下载安装以及第一个项目的创建1、django可以通过两种方式进行安装:【1】在django的官网上下载,然后解压 ,进入解压的目录,命令行:python setup.py install 【2】通过pip install django==1.9.4进行安装 安装之后要配置环境变量 将D:\Python27\Lib\site-packages\django加入path中

2016-03-28 22:42:39 403

转载 JSP指令元素:page指令 include指令 tag lib指令。

JSP指令元素:page指令 include指令 tag lib指令。一、指令元素(directive elements):控制所生成的servlet结构。 JSP指令用于“转换阶段”提供整个JSP页面的相关信息,影响由JSP页面生成的Servlet的整体结构。 指令不会产生任何的输出到当前的输出流中。  1,指令元素语法:     说明:  之间不能有

2015-12-14 22:40:59 1187

原创 struts2

基本概念struts2(主要负责表现层)并不是一个陌生的web框架,它是以webwork的设计思想为核心,吸收struts1的优点,可以说struts2是struts1和webwork的结合产物。struts2大致可以分为3个部分:核心控制器FilterDispatcher,业务控制器Action和用户实现的企业业务逻辑组建。核心控制器FilterDispacher是struts2框架的基础,包含了

2015-12-13 23:23:59 281

原创 关于DAO模式的心得体会

概念DAO(Data Accesss Object)数据访问对象 javabean jsp + javabean 有待完善。。。。。。

2015-12-13 23:10:54 643

原创 关于网站分层设计的学习

简介web设计遵循简单的原则,通常分为三个层次进行开发,分别为表现层,业务逻辑层,和持久层。下面分别介绍这三个名词。表现层表现层就是我们平时所看到的页面,主要采用的是struts构架,struts构架实现了MVC模型,使得显示(view),控制(controler),和模型(model)部分相互分离,提高了代码的可重复性。业务逻辑层通常也成为中间层,包含服务层和dao层,对整个网站的业务逻辑进行处理

2015-12-13 23:01:43 560

原创 tomcat启动失败,原因端口占用

启动tomcat发现端口被占用0x00 背景在点击了tomcat/bin/startup.bat,启动tomcat后,在浏览器访问本地tomcat,发现打不开,于是我到tomcat的logs目录下查看catalina.log文件,查看到以下错误: 百度之后,发现错误为端口被占用,使用的是win7系统,解决办法如下: 0x01 解决方法一、检查正在使用的端口首先打开cmd,打开的方法很

2015-12-11 21:32:20 3793

转载 web研发模式演变史

一、简单明快的早期时代 可称之为 Web 1.0 时代,非常适合创业型小项目,不分前后端,经常 3-5 人搞定所有开发。页面由 JSP、PHP 等工程师在服务端生成,浏览器负责展现。基本上是服务端给什么浏览器就展现什么,展现的控制在 Web Server 层。这种模式的好处是:简单明快,本地起一个 Tomcat 或 Apache 就能开发,调试什么的都还好,只要业务不太复杂。 然而业务总会变复

2015-12-10 23:14:09 353

原创 使用命令行对java程序的编译运行和打包

0x00 背景我们平时使用了在有IDE的环境下编写代码,编译的工作会由IDE自动完成,这样方便了我们工作,但是却使我们忽略了代码是如何执行的本质,或者当电脑上只有jre环境,没有开发环境,就需要在cmd环境下进行java程序的编译和运行,本文详细介绍了如何在cmd环境下使用命令行执行java程序。0x01 使用javac和java编译和执行java程序1、Java源程序经过编译器编译后编成字节码,

2015-12-03 14:17:39 6635 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除