Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Tuesday, March 04, 2008

加入全球网上营销的“冠军联盟”--Zanox

Zanox.de AG是德国网络广告联盟公司,在欧洲有辉煌的运作业绩,在世界许多地区也设有分公司,由于刚刚进入中国市场,所以更加注重信誉。并且,德国的良好信誉,一直以来都获得了全世界的认可。该广告联盟以欧元作为主要货币单位,最低付款底线是25欧元。
主要赚钱方式:
1、申请点击类广告,最低的是一个点击0.1个欧元,即大约人民币1元;
2、申请注册、销售等提成类,佣金比例相当大;
3、推荐站长,有效推荐一个站长,得2欧元。









zanox Affiliates find Affiliates

作为站长,还有什么理由不开始轻松的赚钱之旅!(全中文页面)

下面详细介绍申请步骤,使用方法说明见后面!

注册前,先到当地银行开一个储蓄帐户(或卡),中国银行的活期本(或卡)最好,其它银行的也行!

第一步,进入申请页面:

Zanox总公司申请页面: Register for free and tap into new sources of income!

此页面非常简单,只要认识汉字都会填写,用户名即为你的信箱,填好后按“注册”按钮进入第二步。

 

第二步,填写你的地址资料

简单,不用说了!点击“保存”按钮,进入下一步。

第三步,填写税务信息

在公司名处,填上你刚才填写的个人姓名,点击“保存”按钮,进入下一步。

第四步,填写网站信息

如下图:

8

这页是问你想通过哪种途径去宣传它们的广告,请一定要选择第一行后面的“网站”!图片见下方

第五步,填写你网站信息

此页填写要注意,要用英文填写

用英文填写:网站名,URL,

使用:? 选个人

描述与目标群体:即网站内容描述,用英文

关键词:用英文,并用英文逗号隔开

每月访问量、访问人数,尽量比你网站访问量大些!

我使用下列例外情况:不要改变选择,即选择“无详细资料”

类别:至少选择三个

点击“保存”按钮,进入第六步,选择你的第一个广告项目,即zanox自己的项目,用来推广zanox广告联盟的广告,推荐一个站长得2欧元!

1
2

第六步,选择第一个广告项目 即zanox,如下图:

在页面下方,将“我已阅读。。。”前打勾,点击“申请”按钮。

3

 

中间的图片省略。。。。。。。。

 

4

第七步,申请成功,显示你的广告项目,如下图:

此广告项目还要得到公司确认,才能点击“代码”,获得投放权利!

6

 

至此,你可以到你信箱里看一下,应该收到一份zanox的激活邮件,一定要点击其中的激活连接,你的帐户才真正有效!

 

使用方法:

第一次登陆,填写你的汇款信息,即银行信息

从邮件激活中进入帐户登陆页面,先做好收藏,以便下次登陆!用户名即为你的邮箱!

如下图,点击左边中间的“帐户信息”

6

进入的页面后,再点击“付款帐户”,然后点击新页面下方的“创建新的付款账户”,进入的页面如下,如何填写见后!

8

目的地国:中国

BIC:银行卡所在银行的swift code,即银行国际代码,你可以到开帐户(卡)的银行查询一下,或者自己直接查:

?进入查询网站:http://www.swift.com/biconline/index.cfm?fuseaction=display_freesearch

可以看到国际代码查询画面

8

 

BIC cide:

输入 BKCHCNBJ 查中国银行BIC。

输入 ICBKCNBJ 查中国工商银行BIC。

输入 CMBCCNBS 查招商银行BIC。

输入 PCBCCNBJ 查中国建设行BIC。

输入 SZDBCNBS 查广东发展银行BIC。
City heading:

输入城市名,一般是所在省会城市,如:
江苏省,输入南京的拼音:nanjin
Country name:

选择:CHINA



点击search,即可查出银行国际代码

如下图中“BIC code”下方即为

江苏省内所有中国银行的国际代码:BKCHCNBJ940

8

IBAN:主要是针对欧盟的国家,我们不需要填写

帐户号:填写你存折(卡)上的帐户号码

类别码:同 BIC,银行国际代码 SWIFT code

银行名称:填写你开户行的英文名称

银行地址:填写你开户行所在地址的英文

户名:自己姓名的拼音

账户持有人(新):自己姓名的拼音

最小值 付款金额:中国用户选:200EUR

点击“保存”完成银行帐户设置!!!1

 

申请广告商:

进入帐户后,点击“项目管理员”,将显示出你已经申请的广告项目,如图:

5

项目中是你刚才申请的zanox公司的推广项目!在状态栏,用鼠标移上去,可以显示此广告的申请是否通过,一旦通过,即可点击此行中“代码”连接,获得广告代码!

要申请新广告商,可以点击“项目搜索”(或“项目目录”),将显示出广告商清单,里面有广告商的说明,右边有此广告商的佣金情况。

当你看中一个广告商后,点击“预览广告媒体”可以看到它的广告形式(广告图片);

想加入某广告商的话,点击“给申请”即可!

 

广告商申请后,将在“我的项目”中显示,需要等待审核,通过后才能获得代码播放广告!

 

查看广告投放情况,点击“统计数据”即可,注意,进入统计页面后要选择货币类型,美元还是欧元。

是站长,现在就赶快去申请,开始轻松赚钱之旅:




adserver 400x265


How to earn money at Helium

We pay our writing members because it’s the right thing to do. Think of Helium as a co-op — we’re all stakeholders. We provide the publishing platform and the marketing investment to attract writers, readers and advertisers, while the community — that’s you — writes, rates and moderates the site. For all your efforts, you share in a percentage of Helium’s revenue.Helium pays members based on the value of each article, which is based on a combination of three market factors:

  1. Article quality: The best-written and highest-ranked articles earn the most money. Why? Because quality matters. Those ranked at the top will be read more often and are considered more valuable to Helium members, readers and advertisers.
  2. Traffic: How many readers are interested in the article’s topic? Some subjects draw more total viewers than others. Topics and articles with more page views earn more money.
  3. Advertiser interest: Some topics have higher-paying advertisers or more buzz than others. Each topic attracts a unique set of advertisers with varying budgets. For example, subjects in the area of personal finance will generally draw a higher ad rate than subjects like chess.
Ways to earn on Helium by writing

You can earn through writing articles and contributing to Debates. But there are more ways. You can also enter:

  • Contests: Helium loves to hold writing contests. And they help you earn some extra cash! They can be seasonal, topical or run indefinitely. They are a fun way for Helium members to increase their writing skills by writing to selected channels and topics. If you win, earnings show up in your account immediately.

When contests are being held, the main Contests page explains how the contest works and what’s expected of you. Typically we’ll also display running contest statistics. Of course, there you’ll find a link to more in-depth rules.

If you’re looking to earn some relatively big money, bring your A-game. Check out the latest Helium contests today.

  • Marketplace: Get hired by publishers — write to Marketplace titles today.

Marketplace provides access to big-name publishers looking for freelancers. Currently, earnings range from $16 to $200 per article! Marketplace article titles are specific in their needs, which are described by each publisher. If the publisher chooses your article, you get paid as soon as possible.

How to increase your earnings while sitting on the couch eating chocolate chip ice cream

  • Invite-a-writer ™: Let your smart friends do the work for you. “Invite-a-writer” is a way for you to spread the word about the great communal writing spirit at Helium, to help the site grow and to earn more money. For every person you invite who registers and writes, you earn a 5% bonus based on his or her article earnings. The more successful invites you have, the greater your Invite-a-Writer earnings.
  • Link in: Let the World (Wide Web) do the work for you. Cast a wide net throughout the Internet to spread the word about your Helium articles. Place Helium links on your website, blog, MySpace and Facebook accounts — anywhere on the web. These links will draw people and revenue directly to your articles.



Wednesday, January 30, 2008

ASP.NET域名查询系统源代码

<% @Page Language="C#" %>
<% @Import Namespace="System.Net.Sockets" %>
<% @Import Namespace="System.Text" %>
<% @Import Namespace="System.IO" %>


 要查询的域名域名:
www.
  text ="查询!" runat="server" />(只能查询.Com/.Net/.Org/.Cn 域名Whois的信息)       源代码在这里








Monday, January 28, 2008

另外一种DataGrid与Datalist的嵌套--更好的方式

相对于上一次的使用Relation的缺点:
1. 不能限制返回的纪录数;2. 邦定时不方便,甚至不能邦定上;3. 程序简单,但不容易理解。4. 可能对于三层以上的嵌套不容易实现。
这次给出的嵌套方案,使用的ItemDataBound事件进行嵌套,实现起来很方便,其容易理解。并且解决了以上四个问题。
以下是主要的代码:
BackColor="#ffffff" BorderWidth="0px" CellPadding="1"
ShowFooter="False" ShowHeader="False" runat="server"
CellSpacing="20" HorizontalAlign="Justify" RepeatColumns="2"
RepeatDirection="Horizontal" RepeatLayout="Table" >


<%# DataBinder.Eval(Container.DataItem,"NavigatorID") %> @
<%# DataBinder.Eval(Container.DataItem,"NodeCaption") %>



AutoGenerateColumns="false"
ShowHeader="false" ShowFooter="false" PageSize="10" AllowPaging="true"
PagerStyle-Visible="false" BorderWidth="1" BackColor="#ffffff" BorderColor="#ffffff"
CellPadding="0" CellSpacing="0" GridLines=Horizontal
OnItemDataBound='DG_SubClass_ItemDataBound'>



















private void DList_Class_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DataGrid dg=(DataGrid)e.Item.FindControl("DG_SubClass");
string itemIndex =this.DList_Class.DataKeys[e.Item.ItemIndex].ToString();

string[] strSqlArray =new string[3]{"select Top 10 IOrder, ILevel, IParentID, NavigatorID, NodeCaption,ModuleID, ModuleType from NavigatorNodes where IParentID in ( ", itemIndex, ");"};
string strSql=string.Concat(strSqlArray);
string TableName ="SubClass"+itemIndex;

this.dbClass.AdapterFill(ds, CommandType.Text, strSql, TableName, new OleDbParameter[0]);

dg.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.DG_SubClass_ItemDataBound);

dg.DataSource =ds.Tables[TableName].DefaultView;
dg.DataBind();
}
}


DataList嵌套DataGrid

private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
this.DL_DataClass.Attributes.Add("style","word-break:keep-all;word-wrap:normal");
//Class1
string[] strSqlArray =new string[2]{"select IOrder, ILevel, IParentID, NavigatorID, NodeCaption from NavigatorNodes where ILevel = 1"," Order By IOrder" };
string strSql=string.Concat(strSqlArray);
this.dbClass.AdapterFill(ds,CommandType.Text,strSql,"Class1",new OleDbParameter[0]);

string[] strSqlArray1 =new string[1]{"select IOrder, ILevel, IParentID, NavigatorID, NodeCaption from NavigatorNodes where IParentID in (select NavigatorID from NavigatorNodes where ILevel = 1)"};
string strSql1=string.Concat(strSqlArray1);
this.dbClass.AdapterFill(ds,CommandType.Text,strSql1,"ClassList",new OleDbParameter[0]);

ds.Relations.Add("MyRelation",ds.Tables["Class1"].Columns["NavigatorID"],ds.Tables["ClassList"].Columns["IParentID"]);

this.DL_Class1.DataSource =ds.Tables["Class1"].DefaultView;
this.DL_Class1.DataBind();

ds.Dispose();
}
}

[asp:datalist id="DL_Class1" runat="server" BorderColor="Black" ShowFooter="False" ShowHeader="False"
RepeatDirection="Horizontal" RepeatColumns="2" BorderWidth="0px" CellPadding="2" BackColor="White"
CellSpacing="15" GridLines="Vertical" CaptionAlign="Bottom">
[SeparatorStyle BorderWidth="1px" BorderStyle="Solid" BorderColor="Silver" BackColor="Transparent">
[ItemStyle ForeColor="White" Width="300px" VerticalAlign="Top" BackColor="WhiteSmoke">
[ItemTemplate>
[div style="BACKGROUND-COLOR: background" style="BORDER-BOTTOM: #003366 1px solid; Height:20px; vAlign:middle">[b>[%# DataBinder.Eval(Container.DataItem,"NavigatorID") %> [%# DataBinder.Eval(Container.DataItem,"NodeCaption") %>
[/div>
[asp:DataGrid ID=dg1 Width=300px Runat=server DataSource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("MyRelation") %>' AutoGenerateColumns="false" ShowHeader="false" ShowFooter="false" PageSize="4" AllowPaging="true" PagerStyle-Visible="false" BorderWidth="0" CellPadding="0" CellSpacing="1" GridLines="Vertical">
[ItemStyle Height="15px">
[AlternatingItemStyle BackColor="#ddeedd" Height="15px">[/AlternatingItemStyle>
[Columns>
[asp:TemplateColumn>
[ItemTemplate>
[%# DataBinder.Eval(Container.DataItem,"[\"IParentID\"]") %>
@[%# DataBinder.Eval(Container.DataItem,"[\"NodeCaption\"]") %>
[/ItemTemplate>
[/asp:TemplateColumn>
[/Columns>
[/asp:DataGrid>
[div align="right">[a href="javascript:;">[i>More[/i>[/div>
[/ItemTemplate>
[/asp:datalist>


C#最中的修饰符(.net 1.1)

访问修饰符
public private internal protected
这些修饰符控制类的访问能力,指定声明的类型和类型成员的可访问性。根据类什么所在的上下文,这些修饰符中的一些也许不被允许。
public 访问不受限制
private 只有包含该类的成员的类可以访问
internal 只有当前工程可以访问
protected 只有包含该成员的类和继承的类可以访问

还有一些:
abstract指示某个类只能是其他类的基类。
const指定无法修改字段或局部变量的值。
event声明一个事件。
extern指示外部实现此方法。
override提供从基类继承的虚拟成员的新实现。
readonly声明一个字段,该字段只能赋值为该声明的一部分或者在同一类的构造函数中。
sealed指定类不能被继承。
static声明属于类型本身而不是属于特定对象的成员。
unsafe声明不安全的上下文。
virtual在派生类中声明其实现可由重写成员更改的方法或访问器。
volatile指示字段可由操作系统、硬件或并发执行的线程等在程序中进行修改。


Unable to start debugging on the server. You do not have permission to debug the server.

废话少说。
我的机子操作系统是server2003,.NET环境是1.1的。这几天机子出现以下问题:
在调试WEB项目时,CTRL + F5 能运行。但是F5 的时候,会在编译完成后,提示一下信息:
Unable to start debugging on the server. You do not have permission to debug the server.
Verify that you are a member of the The ‘Debugger Users’ group on the server.

在网上google一下,会找到很有用的信息,不过不一定就是需要的。我就找了,也做了,也看了帮助,但是就是没有能够解决,郁闷。

不过今天我有重新做了一下,居然解决了,呵呵!
下面给出具体的办法,系统能解决你的问题,是英文的,不过简单,不用我翻译了吧,呵呵。其实,我懒 ^-^ :P)

* Cause 1: Make sure that “Integrated Windows Authentication” is enabled. Probably, you enabled only “Basic authentication” for Directory security of IIS.

* Cause 2: If you are using “Integrated Windows authentication”, you need to make sure that your user account has full control on the directory of the IIS.

*

Cause 3: If you created the web project with a full machine name (like “machinename.domainname.something”), the web site is recognized as “Internet” site. So the default setting of IE will impact on the behavior of log on. In this case, you need to enable logging on with your current user account in “Internet” area with IE setting.

But it is not the default setting of IE, so you’d be better off if you create project with only the machine name.
*

这个是我需要的。如果还没有解决你的问题,你可能要看看是不是你的IE设置有问题了。大家知道Server2003的IE的安全级默认是高,所以用IE的时候,是需要权限的。恩,问题就出在这里。打开IE,CTRL + T ,Ctrl + O,之后出来Internet选项。
选择安全,在 请为不同区域的Web内容指定安全设置下的图标中,选择本地Intranet,自定义级别中,找到用户验证节,选择自动使用当前用户名和密码登录(最后一项)。




最后,最好是重启一下你的机子。好了问题解决了。祝你愉快!如果你还有什么问题,可以联系我:richabstract@gmail.com


Primary IDE channel no 80 conductor cable installed

这几天,我的机子开机时老是提示:Primary IDE channel no 80 conductor cable installed。但是系统能正常运行。开始我认为是硬盘出问题了。后来baidu了一下,找到如下的信息:
【故障现象】
开机后系统显示提示信息Primary IDE channel no 80 conductor cable installed,但能正常启动系统。
--------------------------------------------------------------------------------
【分析处理】
此信息表明硬盘支持UDMA/66传输模式,但目前只能工作在UDMA/33模式下。首先检查是否使用了专用的80针数据线,使用普通的40针数据线则会出现此提示信息。其次,应检查80针数据线的两个插头是否连接正确,蓝色端接硬盘,黑色端接主板。

先是看数据线,接着尝试着修改了设备管理器,甚至到bios下面找了一番。结果还是有提示,百思不得其解。
最后的解决办法,相对简单。我下了一个Windows优化大师,在
系统性能优化 == 文件系统优化 版面中有一个选项[ 打开IDE硬盘的UDMA66传输模式]
选中它,然后优化。

重起系统后,没有了提示!^0^


VS.NET 2003 Command

我的整理的VS.NET 2003 的工具集合:
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 的目录

2003-03-19 14:52 53,248 al.exe
2004-07-24 03:41 20,480 aspnet_regiis.exe
2004-07-24 03:41 32,768 aspnet_state.exe
2004-07-24 03:41 32,768 aspnet_wp.exe
2003-02-27 17:11 94,208 CasPol.exe
2003-02-27 17:11 49,152 ConfigWizards.exe
2004-07-24 03:37 49,152 csc.exe
2003-03-25 18:43 28,672 cvtres.exe
2002-05-31 02:15 186,696 dw15.exe
2003-03-25 18:43 81,920 gacutil.exe
2003-02-27 17:11 7,680 IEExec.exe
2004-07-24 03:41 196,608 ilasm.exe
2003-02-27 17:11 15,872 InstallUtil.exe
2003-02-27 17:11 40,960 jsc.exe
2004-07-24 03:37 49,152 migpol.exe
2004-07-24 03:37 49,152 migpolwin.exe
2004-07-17 17:32 106,496 netfxupdate.exe
2003-03-25 18:44 73,728 ngen.exe
2003-02-27 17:11 28,672 RegAsm.exe
2003-02-27 17:11 12,288 RegSvcs.exe
2004-10-13 10:19 102,400 setregni.exe
2004-07-17 17:32 118,784 togac.exe
2004-07-24 03:37 737,280 vbc.exe
2003-03-18 23:43 19,968 vjc.exe

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 的目录

24 个文件 2,188,104 字节
0 个目录 8,408,932,352 可用字节
============================================
D:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin 的目录

2003-03-19 17:49 45,056 AxImp.exe
2001-01-30 12:07 7,440 cert2spc.exe
2001-01-30 12:07 59,152 certmgr.exe
2001-01-30 12:07 18,192 ChkTrust.exe
2003-02-21 11:09 241,664 cordbg.exe
2003-03-19 17:52 45,056 disco.exe
2003-02-21 11:09 12,288 FUSLOGVW.exe
2003-02-21 11:09 81,920 gacutil.exe
2003-02-21 11:09 311,296 ildasm.exe
2003-03-19 17:53 278,528 Jbimp.exe
2003-03-19 17:53 32,768 lc.exe
2001-01-30 12:07 39,184 makecert.exe
2003-03-19 17:53 24,576 MgmtClassGen.exe
2003-02-21 11:09 69,632 mscordmp.exe
2003-03-19 11:38 81,920 nmake.exe
2003-02-21 11:09 69,632 PermView.exe
2003-02-21 11:09 69,632 PEVerify.exe
2003-03-19 17:51 36,864 ResGen.exe
2003-03-19 17:51 16,384 SecUtil.exe
2001-01-30 12:07 55,568 setreg.exe
2001-01-30 12:07 25,872 signcode.exe
2003-02-21 11:09 77,824 sn.exe
2003-03-19 17:51 15,360 SoapSuds.exe
2003-03-19 17:51 9,216 StoreAdm.exe
2003-03-19 17:51 24,576 TlbExp.exe
2003-03-19 17:51 32,768 TlbImp.exe
2003-03-19 17:52 81,920 WinCV.exe
2003-03-19 17:52 131,072 WinRes.exe
2003-03-19 17:52 65,536 wsdl.exe
2003-03-19 17:52 53,248 xsd.exe
30 个文件 2,114,144 字节
0 个目录 16,233,050,112 可用字节


在程序中创建虚拟目录(C#)

public DirectoryEntry CreateVir(string vdirname,string serverID,string vdirPath ,bool criaAppliaction)
{
DirectoryEntry newvdir,root;

string strPath ="IIS://localhost/" + serverID;
root =new DirectoryEntry(strPath);

newvdir = root.Children.Add(vdirname, "IIsWebVirtualDir");
newvdir.Properties["Path"][0] = vdirPath;

if(criaAppliaction)
{
newvdir.Invoke("AppCreate", true);
newvdir.Properties["AppFriendlyName"][0] = vdirname;
newvdir.Properties["AppIsolated"][0] = 2;
}

newvdir.CommitChanges();

return newvdir;
}


开始学习汇编和CRL!

学习汇编,其实是基于想对计算机底层有更好的了解,还有就是想对软件加密有更好的了解了。

在网上找了一些资料,还是有很不错的咚咚,看运气了,^0^

这里列举一些我认为关键的东西:

汇编的环境:dos的edit,masm6.X及其以上,link 得到obj文件,然后生成exe,debug调试
汇编指令格式:操作码助记符(必须) 目的操作数,源操作数;注释
没有没有操作数,或者只有一个操作数

五个问题:
2与16进制的转换
有呼号数的源码反码补码
8086的寄存器(通用,专用,状态标志的含义)
存储器的管理(分段,段寄存器,逻辑地址,物理地址,段超越)
8086的寻址方式7种。

有时间把这5个问题的答案整理出来!

希望大家能给我一些建议哦,或者给我介绍一些网站行。
大恩不言谢!


给出一些一流的网站

这些网站都是符合web标准的。
看了之后,真的感觉到什么叫设计!

http://www.nitzdesign.com/index.php
http://www.brandydejerez.es/
http://e-lusion.com/index.htm
http://justwatchthesky.com/index.asp
http://www.neubix.com/thestandard.asp
http://overcaffeinated.net/
http://www.designerinaction.de/
http://www.guatemalastreetkids.co.uk/
http://smalltransport.com/
http://www.indesain.net/index.php/
http://www.malarkey.co.uk/Default.aspx
http://rockthetriad.com/
http://destroydrop.com/
http://veerle.duoh.com/
http://resource.reh3.com/index.html
http://www.sodesires.com/about/index.html


Reflector for NET的使用心得

昨天,利用reflector把一个很流行的新闻网站的3.0版本使用的Dll给还原了出来。今天试着这样做,结果出了一些问题。不管怎么样,我想这个网站的源代码肯定会对我有很大帮助。

Reflector和它的插件FileDisassembler,真是很好用,不过反编译的效果还是不太好:
1.函数内的变量名难读懂,比如 table1,text1,hashtable1等等
2.使用goto标记
3.没有注释

这里还给出一些文章:

让Reflector的反编译不能正常工作
http://www.cnblogs.com/midea0978/articles/110365.html

AssemblyGrapher, a small utility for generating Type Graphs
http://www.codeproject.com/csharp/typegraph.asp


ASP.NET的Page对象

这几天收获不小,学会了不少东西。这里把握重新找到的一些关于ASP.NET的文章列出来:

Page Members(我用的是E文的msdn)[推荐]
ms-help://MS.MSDNQTR.2004JUL.1033/cpref/html/frlrfSystemWebUIPageMembersTopic.htm

从 ASP.NET 服务器控件插入客户端脚本
http://blog.joycode.com/uestc95/articles/5043.aspx

在视图状态中保存自定义的对象
http://www.pconline.com.cn/pcedu/empolder/net/0408/445732.html

把aspx文件编译成DLL文件
http://www.ccw.com.cn/htm/center/prog/02_11_12_3.asp

我今后的要更多的从事Web开发了,希望能和大家一起学习,多多交流!
我的msn:guo_gcy@hotmail.com

发表于 2005年2月26日 9:42


VS.NET式的状态栏

我在Codeproject上找到一个VS.NET式的状态栏,但是它并不能很好的使用在我们的项目中,我将它做了一些改进,使之有了一定的灵活性。具体的,我改进了两个公共属性:
// 取得窗体上控件的屏幕坐标(以窗体的左上角为(0,0))
public System.Drawing.PointF Pos
{
get { return _Pos; }
set
{
_Pos = value;

int xStart = _MessagePanel.Width; // start x of the bounding box
FrmMain fm =new FrmMain();
//Graphics g = this.CreateGraphics();
Graphics g =fm.GetCurrentMap().CreateGraphics();
OnDrawItem(new StatusBarDrawItemEventArgs(g,Font,
new Rectangle(xStart,2,_PosPanel.Width-2,Height-1),1,DrawItemState.Default,_PosPanel));
g.Dispose();
}
}
// 消息面板的消息内容
public string Message
{
get { return _MessagePanel.Text; }
set
{
_MessagePanel.Text = value;

int xStart = 0;
Graphics g = this.CreateGraphics();
StatusBarDrawItemEventArgs ea = new StatusBarDrawItemEventArgs(this.CreateGraphics(),Font,
new Rectangle(xStart,2,_MessagePanel.Width-2,Height-1),1,DrawItemState.Default,_MessagePanel);
OnDrawItem(ea);
g.Dispose();
}
}

在调用的时候,我是这样用的:
#region [ 状态栏生成 ]
void SetupStatusBar()
{
_statusBar.Parent = this;
this._statusBar.Name = "statusBar1";
}
private void Supermap_main_MouseMoveEvent(object sender, AxSuperMapLib._DSuperMapEvents_MouseMoveEvent e)
{
AxSuperMapLib.AxSuperMap sm =this.GetCurrentMap();
_statusBar.Panels[1].Text =String.Format(" X:{0:F4}",sm.PixelToMapX(e.x)) + " "+ String.Format(" Y:{0:F4}",sm.PixelToMapY(e.y));
}
#endregion
///


/// 设置状态提示信息
///

/// 要显示的信息
private void GetStatusBarText(string str)
{
_statusBar.Panels[0].Text =" "+ str;
}


正则表达式相关

正则表达式,相关链接

http://www.microsoft.com/china/msdn/library/webservices/asp.net/regexnet.mspx

正则表达式库 http://www.regexlib.com/

正则表达式讨论列表 http://aspadvice.com/login.aspx?ReturnUrl=%2fSignUp%2flist.aspx%3fl%3d68%26c%3d16&l=68&c=16

正则表达式论坛 http://forums.regexadvice.com/

正则表达式 Web 日志 http://blogs.regexadvice.com/

Mastering Regular Expressions (O'Reilly),作者 Jeffrey Friedl http://www.regex.info/

.NET 正则表达式参考
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemTextRegularExpressions.asp

Jscript 正则表达式语法
http://www.msdn.microsoft.com/library/en-us/script56/html/js56jsgrpRegExpSyntax.asp

正则表达式信息 http://www.regular-expressions.info/

正则表达式语法
http://msdn.microsoft.com/scripting/default.htm?/scripting/vbscript/doc/jsgrpregexpsyntax.htm
正则表达式简介
http://msdn.microsoft.com/scripting/default.htm?/scripting/vbscript/doc/
reconIntroductionToRegularExpressions.htm

正则表达式语言元素(Microsoft .NET 框架通用参考)
Regex 类(Microsoft .NET 框架类库)
作为语言的正则表达式(Microsoft .NET 框架开发指南)
==========================================================
==========================================================
免费工具
Regulator (
http://royo.is-a-geek.com/iserializable/regulator/) - 一种在客户端运行的正则表达式测试工具,通过 Web 服务与 RegexLib 紧密集成,提供对“匹配”、“拆分”和“替换”等的支持。包括性能分析和语法突出显示功能。

RegexDesigner.NET (http://www.sellsbrothers.com/tools/) - 一种功能强大的可视工具,可帮助构造并测试正则表达式。它可生成 C# 和/或 VB.NET 代码和已编译汇编代码,帮助您将表达式集成到应用程序中。

Regular Expression Workbench (v2.0) (http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=C712F2DF-B026-4D58-8961-4EE2729D7322) - Eric Gunnerson 开发的工具,用于创建、测试和研究正则表达式。具有“Examine-o-matic”功能,允许将鼠标悬停在正则表达式的上方,对其含义进行解码。


正则表达式学习笔记

------------------------2004/9/19--------------------------------
=======限定符:

*,描述“出现 0 或多次”

+,描述“出现 1 或多次”

?,描述“出现 0 或 1 次”

x{ , }

ab{2,3}c

=======元字符:

. 匹配任何单字符

.* 任意字符串

^ 元字符可指定字符串(或行)的开始 ^c:\\ ==>c:\ 后跟任何其他内容

$ 元字符可指定字符串(或行)的结束 abc$ ==>以 abc 结束的任意字符串

\ 转义字符

|

--------------------------------------2004/10/7----------------------------------------------
=======字符类:
字符类是正则表达式中的“迷你”语言,在方括号 [ ] 中定义
连字符 - 来定义字符的范围
因此,字符在(例如)ASCII 或 Unicode 表中出现的顺序确定了在范围中包括的字符。如果需要在范围中包括连字符,将它指定为第一个字符。例如:[-.? ] 将匹配 4 个字符中任何一个字符(注意,最后的字符是个空格)。
如 果使用字符 ^ 作为字符类的第一个字符来否定此类,也可以匹配字符类成员以外的任何字符。因此,要匹配任何非元音字符,可以使用字符类 [^aAeEiIoOuU]。注意,如果要否定连字符,应将连字符作为字符类的第二个字符,如 [^-]。记住,^ 在字符类中的作用与它在正则表达式模式中的作用完全不同:就是在[]里的^(否定)不同于一般的元字符^(开始)。
[aeiou] 元音中的一个
[a-z] [A-Z] 单个的字符
[0123456789] 等价于 \d{1}

=======预定义的集合元字符

\a
匹配铃声(警报);\u0007

\b
匹配字符类外的字边界,它匹配退格字符,\u0008

\t
匹配制表符,\u0009

\r
匹配回车符,\u000D

\w
匹配垂直制表符,\u000B

\f
匹配换页符,\u000C

\n
匹配新行,\u000A

\e
匹配转义符,\u001B

\040
匹配 3 位 8 进制 ASCII 字符。\040 表示空格(十进制数 32)。

\x20
使用 2 位 16 进制数匹配 ASCII 字符。此例中,\x2- 表示空格。

\cC
匹配 ASCII 控制字符,此例中是 ctrl-C。

\u0020
使用 4 位 16 进制数匹配 Unicode 字符。此例中 \u0020 是空格。

\*
不代表预定义字符类的任意字符都只作为该字符本身对待。因此,\* 等同于 \x2A(是文字 *,不是 * 元字符)。

\p{name}
匹配已命名字符类“name”中的任意字符。支持名称是 Unicode 组和块范围。例如,Ll、Nd、Z、IsGreek、IsBoxDrawing 和 Sc(货币)。

\p{name}
匹配已命名字符类“name”中不包括的文本。

\w
匹配任意单词字符。对于非 Unicode 和 ECMAScript 实现,这等同于 [a-zA-Z_0-9]。在 Unicode 类别中,这等同于 [\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}]。

\W
\w 的否定,等效于 ECMAScript 兼容集合 [^a-zA-Z_0-9] 或 Unicode 字符类别 [^\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}]。

\s
匹配任意空白区域字符。等效于 Unicode 字符类 [\f\n\r\t\v\x85\p{Z}]。如果使用 ECMAScript 选项指定 ECMAScript 兼容方式,\s 等效于 [ \f\n\r\t\v] (请注意前导空格)。

\S
匹配任意非空白区域字符。等效于 Unicode 字符类别 [^\f\n\r\t\v\x85\p{Z}]。如果使用 ECMAScript 选项指定 ECMAScript 兼容方式,\S 等效于 [^ \f\n\r\t\v] (请注意 ^ 后的空格)。

\d
匹配任意十进制数字。在 ECMAScript 方式下,等效于 Unicode 的 [\p{Nd}]、非 Unicode 的 [0-9]。

\D
匹配任意非十进制数字。在 ECMAScript 方式下,等效于 Unicode 的 [\p{Nd}]、非 Unicode 的 [^0-9]。

==============================
这里仅仅是把正则表达式的语法搞懂一些吧!!


IE出问题,方便解决!!!

昨天,IE突然出问题了,怎么也打不开,提示信息:
NTVDM CPU 遇到无效指令 cs:055a IP: 0115 Op:ff ff ff ff 01 选择“关闭”终止应用程序。
晕,不知道啥子错误。弄了好半天没有解决,不过后来,在C:\Program Files\Internet Explorer里面发现一个软件包:ie6setup.exe
不用讲,都知道是做什么的。
重装了IE后,重起,一切又恢复正常,而且以前的设置没有改变的。
哈哈,原来很多问题,本来可以这样简单..........................


数据资料的显示,修改等,内容太多,给出一部分了

定义datagrid的页导航和脚注。
private void Dg_DownList_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
this.tbl_DownList.Visible =true;
ListItemType elemtype =e.Item.ItemType;

if(elemtype ==ListItemType.Pager)
{
TableCell pager =(TableCell)e.Item.Controls[0];

for(int i=0;i {
object o=pager.Controls[i];
if(o is LinkButton)
{
LinkButton h =(LinkButton)o;
h.CssClass="blue";
h.Text ="[" +h.Text+ "]";
}
else
{
Label l=(Label)o;
l.CssClass="red";
l.Text = "第" + l.Text + "页";
}
}
}

if(elemtype ==ListItemType.Footer)
{
TableCellCollection tcc =e.Item.Cells;
int ntotalcols =tcc.Count;
for(int i=0;i
{
e.Item.Cells.RemoveAt(1);
}
TableCell c =e.Item.Cells[0];
c.HorizontalAlign =HorizontalAlign.Right;
c.ColumnSpan =ntotalcols;
c.Text ="共有 " + itemcount +"项,当前是 "+ this.Dg_DownList.CurrentPageIndex.ToString()
+"/" + itemcount/this.Dg_DownList.PageSize +"页 ";
}
}
定义数据源,和datagrid的实际项数
private System.Data.OleDb.OleDbDataReader CreateDataSource(int nPageIndex)
{
int npagesize =this.Dg_DownList.PageSize;
int nBaseID =nPageIndex * npagesize;
string DbName =Server.MapPath(@"..\db\Sources.mdb");
string ConnSourcesStr ="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" + DbName;
Dbconn_Sources =new System.Data.OleDb.OleDbConnection(ConnSourcesStr);
Dbconn_Sources.Open();
string strCmd ="SELECT TOP " + npagesize + " " +
"*" +
"FROM Download " +
"WHERE ID >" + nBaseID;
Dbcom_Admin =new System.Data.OleDb.OleDbCommand(strCmd,Dbconn_Sources);
Dr_Down =Dbcom_Admin.ExecuteReader(CommandBehavior.CloseConnection);
return Dr_Down;
}

public void SetVICount()
{
string DbName =Server.MapPath(@"..\db\Sources.mdb");
string ConnSourcesStr ="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" + DbName;
Dbconn_Sources =new System.Data.OleDb.OleDbConnection(ConnSourcesStr);
Dbconn_Sources.Open();
string strcount ="select count(*) from download";
Dbcom_Admin =new System.Data.OleDb.OleDbCommand(strcount,Dbconn_Sources);
int nItemCount =(int)Dbcom_Admin.ExecuteScalar();
Dbconn_Sources.Close();
this.Dg_DownList.VirtualItemCount =nItemCount;
itemcount =this.Dg_DownList.VirtualItemCount;
return;
}
这里是页面切换的
private void Dg_DownList_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
this.tbl_DownList.Visible =true;
this.tbl_ChangeInfo.Visible =false;
try
{
this.Dg_DownList.CurrentPageIndex =e.NewPageIndex;
this.Dg_DownList.DataSource =CreateDataSource(this.Dg_DownList.CurrentPageIndex);
this.Dg_DownList.DataBind();
Dr_Down.Close();
}
catch(Exception ex)
{
Response.Write(" ex.Message.ToString() ");
}
}


文件上传的程序

引用输入输出命名空间using System.IO;

类型绑定,因为类型是可以后台更改的,不是固定的
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
TypeBind();
}
private void TypeBind()
{
try
{
string DbName =Server.MapPath(@"..\db\Sources.mdb");
string ConnSourcesStr ="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" + DbName;
Conn =new System.Data.OleDb.OleDbConnection(ConnSourcesStr);
Conn.Open();
string strb="select * from bType order by ID";
System.Data.OleDb.OleDbCommand Cmd =new System.Data.OleDb.OleDbCommand(strb ,Conn);
System.Data.OleDb.OleDbDataReader Drb =Cmd.ExecuteReader();
while(Drb.Read())
{
this.ddl_btype.Items.Add(Drb["bTypeName"].ToString());
this.ddl_stype.Items.Add("----"+ Drb["bTypeName"].ToString() +"----");

System.Data.OleDb.OleDbConnection conn =new System.Data.OleDb.OleDbConnection(ConnSourcesStr);
conn.Open();
string strs ="select * from sType where bTypeID =" + Convert.ToInt16(Drb["ID"]);
System.Data.OleDb.OleDbCommand cmd =new System.Data.OleDb.OleDbCommand(strs ,conn);
System.Data.OleDb.OleDbDataReader Dr =cmd.ExecuteReader();
while(Dr.Read())
{
this.ddl_stype.Items.Add(Dr["sTypeName"].ToString());
}
Dr.Close();
}
Drb.Close();
Conn.Close();
}
catch(Exception ex)
{
Response.Write(" ex.Message.ToString() ");
}
}

上传文件,这里根据日期,每半个月建立一个文件夹
private void btn_fileUp_Click(object sender, System.EventArgs e)
{
if(this.tb_net.PostedFile !=null)
{
try
{
string path=Server.MapPath(@"..\UploadFile\down\");
string dir,filename,chldir;
int n;
string day =DateTime.Now.Day.ToString();

if( Convert.ToInt16(day) < 16)
{
dir=path +DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() +"-1";
bool dirExit =System.IO.Directory.Exists(dir);
if(! dirExit)
{
System.IO.Directory.CreateDirectory(dir);
}
n =this.tb_net.PostedFile.FileName.LastIndexOf("\\") +1;
chldir =DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() +"-1";
filename =DateTime.Now.ToShortDateString().Replace(@"-","") +this.tb_net.PostedFile.FileName.Substring(n);
}
else
{
dir=path + DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() +"-2";
bool dirExit =System.IO.Directory.Exists(dir);
if(! dirExit)
{
System.IO.Directory.CreateDirectory(dir);
}
n =this.tb_net.PostedFile.FileName.LastIndexOf("\\") +1;
chldir = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() +"-2";
filename =DateTime.Now.ToShortDateString().Replace(@"-","") +this.tb_net.PostedFile.FileName.Substring(n);
}
this.tb_net.PostedFile.SaveAs(path + chldir+"\\"+ filename);

this.tb_name.Text =filename;
this.tb_size.Text =this.tb_net.PostedFile.ContentLength.ToString();
this.tb_down1.Text
=@"UploadFile/down/" + chldir +@"/"+ filename;
Response.Write(" ");
}
catch(Exception ex)
{
Response.Write ex.Message.ToString() ;
}
}
}

这里是添加记录到数据库,我这里用的是access,需要注意的就是更新的sql语句。
private void btn_OK_Click(object sender, System.EventArgs e)
{
string fname =this.tb_name.Text.Trim();
string flng =this.ddl_lng.SelectedItem.Text.Trim();
string fbtype =this.ddl_btype.SelectedItem.Text.Trim();
string fstype =this.ddl_stype.SelectedItem.Text;
string fsize =this.tb_size.Text;
string fmode =this.ddl_mode.SelectedItem.Text;
string fvalue =this.ddl_value.SelectedItem.Text;
string findate =DateTime.Now.ToShortDateString();
string fshow =this.tb_show.Text;
string fdown1 =this.tb_down1.Text;
string fdown2 =this.tb_down2.Text;
string fdown3 =this.tb_down3.Text;
string fpic1 =picpath1.Text;
string fpic2 =picpath2.Text;
string fpic3 =picpath3.Text;
try
{
string DbName =Server.MapPath(@"..\db\Sources.mdb");
string ConnSourcesStr ="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" + DbName;
Conn =new System.Data.OleDb.OleDbConnection(ConnSourcesStr);
Conn.Open();
string instr ="INSERT INTO download (Dname,Dintime,Dbtype,Dstype,Dmode,Dlanguage,Dvalue,Dsize,Dpic,Dpic2,Dpic3,Dintroduce,down1,down2,down3) VALUES ('"
+ fname +"','" +findate +"','" +fbtype +"','" +fstype +"','" +fmode +"','" +flng +"','" +fvalue +"','" +fsize +"','" +fpic1
+"','"+fpic2+"','"+fpic3 +"','" + fshow +"','" +fdown1 +"','" +fdown2 +"','" +fdown3 +"')";
Cmd =new System.Data.OleDb.OleDbCommand(instr,Conn);
Cmd.ExecuteNonQuery();
Response.Write(" ");
Conn.Close();
}
catch(Exception ex)
{
Response.Write(" ex.Message.ToString() ");
}
}


 

gf

rgdfgfdg

gf

gf

gf