易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 :

一小段关键词分析代码(VB)

帮朋友改的一小段关键词分析代码; 含两个单词复合计数
Private Function CollectWords() As Dictionary(Of String, Integer)
'Create a new dictionary
Dim table As New Dictionary(Of String, Integer)
'Prompt for the user
Console.WriteLine(
"Enter a line : ")
'Get the user's input
Dim input As String = Console.ReadLine()
'Split the line and make an array of words
Dim words As String() = input.Split()
Dim wordPrev As String = ""
'Search the array
For Each word In words
'We can get the lowercase, not necessary here
Dim wordKey As String = word.ToLower()
'If the dictionay contains the words
If table.ContainsKey(wordKey) Then
'increment
table(wordKey) = table(wordKey) + 1
Else
'add a new word with a count of 1 in the dictionary
table.Add(wordKey, 1)
End If
Dim wordKey2 As String = (wordPrev + " " + word).ToLower()
If wordPrev <> "" Then
If table.ContainsKey(wordKey2) Then
'increment
table(wordKey2) = table(wordKey2) + 1
Else
'add a new word with a count of 1 ......

Python 3.x (1):入门

 
1 你好
#打开新窗口,输入:
#! /usr/bin/python
# -*- coding: utf8 -*- 
s1=input("Input your name:")
print("你好,%s" % s1)
'''
知识点:
    * input("某字符串")函数:显示"某字符串",并等待用户输入.
    * print()函数:如何打印.
    * 如何应用中文
    * 如何用多行注释
'''    
2 字符串和数字
但有趣的是,在javascript里我们会理想当然的将字符串和数字连接,因为是动态语言嘛.但在Python里有点诡异,如下:
#! /usr/bin/python
a=2
b="test"
c=a+b
运行这行程序会出错,提示你字符串和数字不能连接,于是只好用内置函数进行转换
#! /usr/bin/python
#运行这行程序会出错,提示你字符串和数字不能连接,于是只好用内置函数进行转换
a=2
b="test"
c=str(a)+b
d="1111"
e=a+int(d)
#How to print multiply values
print ("c is %s,e is %i" % (c,e))
'''
知识点:
    ......

python处理zip文件(转) 2009

 转自 http://hi.baidu.com/xunxun129/blog/item/3befad0f8ff992c07bcbe180.html
有时我们需要在 Python
中使用 zip 文件,而在1.6版中,Python 就已经提供了 zipfile 模块可以进行这样的操作。不过 Python 中的
zipfile 模块不能处理多卷的情况,不过这种情况并不多见,因此在通常情况下已经足够使用了。下面我只是对一些基本的 zipfile
操作进行了记录,足以应付大部分的情况了。
zipfile 模块可以让你打开或写入一个 zip 文件。比如:
import zipfile
z = zipfile.ZipFile('zipfilename', mode='r')
这样就打开了一个 zip 文件,如果mode为'w'或'a'则表示要写入一个 zip 文件。如果是写入,则还可以跟上第三个参数:
compression=zipfile.ZIP_DEFLATED

compression=zipfile.ZIP_STORED
ZIP_DEFLATED是压缩标志,如果使用它需要编译了zlib模块。而后一个只是用zip进行打包,并不压缩。
在打开了zip文件之后就可以根据需要是读出zip文件的内容还是将内容保存到 zip 文件中。
读出zip中的内容
很简单,zipfile 对象提供了一个read(name)的方法。name为zip文件中的一个文件入口,执行完成之后,将返回读出的内容,你把它保存到想到的文件中即可。
写入 ......

Data Access Application Block

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.Practices.EnterpriseLibrary.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
Database db = DatabaseFactory.CreateDatabase("NorthWind");
// Database db = DatabaseFactory.CreateDatabase();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.GridView1.DataSource = GetDateSet("select top 10 * from dbo.Products").Tables[0];
this.GridView1.DataBind();

}
}
/// <summary>
/// 执行单条SQL 语句
/// </summary>
/// <param name="sql">sql</param>
/// < ......

access 日期操作小结

列出某一天, 上一星期的数据
SELECT distinct dateandtime
from ctdate_by_query_date
WHERE dateandtime between ((#2006-5-15#+(Weekday(2006-5-15)-7))-6) and (#2006-5-15#-7)+Weekday(2006-5-15)
sql="SELECT distinct dateandtime from ctarticle WHERE dateandtime between ((#"&date&"#+(Weekday("&date&")"&norp&"7))-6) and (#"&date&"#"&norp&"7)+Weekday("&date&")"
13.5 查询一天, 所隶属星期所有天数的数据
SELECT *
from ctdate_by_query_date
WHERE dateandtime between ((#2006-5-15#+Weekday(2006-5-15))-6) and #2006-5-15#+Weekday(2006-5-15)
13.4 查询一个时间段
SELECT *
from ctdate_by_query_date
WHERE dateandtime between #2006-5-1# and #2006-5-30#
13.3.2 列出不同年份的年份, 并且不要相同
select distinct year(dateandtime) from ctarticle
结果如:
Expr1000
2000
2003
2004
2005
2006
13.3.1 列出某一天, 上一年的第一条记录
SELECT top 1 dateandtime from ctarticle where year(dateandtim ......

SQLServer将日期转换成字符串格式

 SELECT   convert(char,日期字段,120)   as   date2   from   table
mssql默认以系统时间格式输出,你可以调整系统的时间格式来解决
当然是在程序里解决比较灵活,convert(char,date,N)输出的各种样式
N   日期样式  
0   04   2   2005   9:06AM  
1   04/02/05  
2   05.04.02  
3   02/04/05  
4   02.04.05  
5   02-04-05  
6   02   04   05  
7   04   02,   05  
8   09:06:18  
9   04   2   2005   9:06:18:857AM  
10   04-02-05  
11   05/04/02  
12   050402  
13   02   04   2005   09:06:18:857  
14 ......
总记录数:40319; 总页数:6720; 每页6 条; 首页 上一页 [5892] [5893] [5894] [5895] 5896 [5897] [5898] [5899] [5900] [5901]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号