最新评论
Re:爱因斯坦的超级问题(谁养鱼)SQL解法 Pandear 2010-09-05 14:55
看来空军很闲啊。。。
Re:数的分解,据说是清华的一道复试上机题 空间/IV 2010-04-07 10:50
具体计算的C#程序见 [url]http://topic.csdn.net/u/20100327/10/943968eb-9c66-44f1-b086-b58c7f6a1060.html[/url] 129楼。
另见:[url]http://bbs.emath.ac.cn/thread-2276-1-1.html[/url]
非常不错的文章。
更一般的,可以讨论整数的分划(或者说整数的分拆)。请参见:
[url=http://en.wikipedia.org/wiki/Partition_%28number_theory%29]Partition (number theory)[/url]
re: f(f(x)) = -x icesheep 2009-06-16 17:06
A=R,1和1/2配对,2和1/4配对,4和1/8配对,...其它的x>0和1/x配对
re: 数据库访问模块 候玉虎 2009-04-15 09:06
我想要买
re: 天书奇谈C#版 空间/IV 2009-03-14 19:15
re: 一个Delphi写的DES算法, 翻译成C# 111111112323 2009-01-07 17:47
楼主,怎么弄,都不成功啊,我用C#加密,但是不能用DELPHI解密
另一种C#解法 空间/IV 2008-08-09 18:39
另一种C#解法
using System;
using System.Collections.Generic;
class EinsteinPuzzle
{
static void Main()
{
const int N = 5;
List<int[]>[] A = new List<int[]>[N];
for (int p = 0; p < N; p++) // 序号
{
A[p] = new List<int[]>();
for (int q = 0; q < N; q++) // 房子颜色
{
if (p == 1 && q != 4 || p != 1 && q == 4) continue; // (N&I)2号为蓝色房子
for (int r = 0; r < N; r++) // 国籍
{
if (q == 0 && r != 0 || q != 0 && r == 0) continue; // (A)英国人住红色房子
if (p == 0 && r != 3 || p != 0 && r == 3) continue; // (I)1号为挪威
for (int s = 0; s < N; s++) // 饮料
{
if (r == 2 && s != 0 || r != 2 && s == 0) continue; // (C)丹麦人喝茶
if (q == 1 && s != 1 || q != 1 && s == 1) continue; // (E)绿色房子主人喝咖啡
if (p == 2 && s != 2 || p != 2 && s == 2) continue; // (H)3号喝牛奶
for (int t = 0; t < N; t++) // 香烟
{
if (q == 3 && t != 1 || q != 3 && t == 1) continue; // (G)黄色房子主人抽Dunhill
if (s == 3 && t != 3 || s != 3 && t == 3) continue; // (L)抽Blue Master的人喝啤酒
if (r == 4 && t != 4 || r != 4 && t == 4) continue; // (M)德国人抽Prince香烟
for (int u = 0; u < N; u++) // 宠物
{
if (r == 1 && u != 0 || r != 1 && u == 0) continue; // (B)瑞典人养狗
if (t == 0 && u != 1 || t != 0 && u == 1) continue; // (F)抽Pall Mall的人养鸟
A[p].Add(new int[]{q, r, s, t, u, p});
}
}
}
}
}
}
foreach (int[] a in A[0])
{
foreach (int[] b in A[1])
{
if (a[0] == b[0] || a[1] == b[1] || a[2] == b[2] || a[3] == b[3] || a[4] == b[4]) continue;
foreach (int[] c in A[2])
{
if (a[0] == c[0] || a[1] == c[1] || a[2] == c[2] || a[3] == c[3] || a[4] == c[4]) continue;
if (b[0] == c[0] || b[1] == c[1] || b[2] == c[2] || b[3] == c[3] || b[4] == c[4]) continue;
foreach (int[] d in A[3])
{
if (a[0] == d[0] || a[1] == d[1] || a[2] == d[2] || a[3] == d[3] || a[4] == d[4]) continue;
if (b[0] == d[0] || b[1] == d[1] || b[2] == d[2] || b[3] == d[3] || b[4] == d[4]) continue;
if (c[0] == d[0] || c[1] == d[1] || c[2] == d[2] || c[3] == d[3] || c[4] == d[4]) continue;
foreach (int[] e in A[4])
{
if (a[0] == e[0] || a[1] == e[1] || a[2] == e[2] || a[3] == e[3] || a[4] == e[4]) continue;
if (b[0] == e[0] || b[1] == e[1] || b[2] == e[2] || b[3] == e[3] || b[4] == e[4]) continue;
if (c[0] == e[0] || c[1] == e[1] || c[2] == e[2] || c[3] == e[3] || c[4] == e[4]) continue;
if (d[0] == e[0] || d[1] == e[1] || d[2] == e[2] || d[3] == e[3] || d[4] == e[4]) continue;
// (D)绿色房子在白色房子左面 (如果“左面”不是严格的“左隔壁”的意思,则有7组解答)
int green = -1;
if (a[0] == 1) green = 0;
if (b[0] == 1) green = 1;
if (c[0] == 1) green = 2;
if (d[0] == 1) green = 3;
if (e[0] == 1) green = 4;
int white = -1;
if (a[0] == 2) white = 0;
if (b[0] == 2) white = 1;
if (c[0] == 2) white = 2;
if (d[0] == 2) white = 3;
if (e[0] == 2) white = 4;
if (green > white) continue;
/* (D)绿色房子在白色房子左隔壁 ------------------------------------------------------------- *
if (! (a[0] == 1 && b[0] == 2 || b[0] == 1 && c[0] == 2
|| c[0] == 1 && d[0] == 2 || d[0] == 1 && e[0] == 2)) continue;
* ------------------------------------------------------------------------------------------ */
// (J)抽 Blends 香烟的人住在养猫的人隔壁
if (! (b[3] == 2 && (a[4] == 2 || c[4] == 2)|| b[4] == 2 && (a[3] == 2 || c[3] == 2)
|| c[3] == 2 && (b[4] == 2 || d[4] == 2)|| c[4] == 2 && (b[3] == 2 || d[3] == 2)
|| d[3] == 2 && (c[4] == 2 || e[4] == 2)|| d[4] == 2 && (c[3] == 2 || e[3] == 2))) continue;
// (K)养马的人住抽 Dunhill 香烟的人隔壁
if (! (b[3] == 1 && (a[4] == 3 || c[4] == 3)|| b[4] == 3 && (a[3] == 1 || c[3] == 1)
|| c[3] == 1 && (b[4] == 3 || d[4] == 3)|| c[4] == 3 && (b[3] == 1 || d[3] == 1)
|| d[3] == 1 && (c[4] == 3 || e[4] == 3)|| d[4] == 3 && (c[3] == 1 || e[3] == 1))) continue;
// (O)抽 Blends 香烟的人有一个喝水的邻居
if (! (b[3] == 2 && (a[2] == 4 || c[2] == 4)|| b[2] == 4 && (a[3] == 2 || c[3] == 2)
|| c[3] == 2 && (b[2] == 4 || d[2] == 4)|| c[2] == 4 && (b[3] == 2 || d[3] == 2)
|| d[3] == 2 && (c[2] == 4 || e[2] == 4)|| d[2] == 4 && (c[3] == 2 || e[3] == 2))) continue;
Console.WriteLine(Format(a));
Console.WriteLine(Format(b));
Console.WriteLine(Format(c));
Console.WriteLine(Format(d));
Console.WriteLine(Format(e));
Console.WriteLine();
}
}
}
}
}
}
static string Format(int[] a)
{
return string.Format("{0} {1} {2} {3} {4,-11} {5}",P[a[5]],Q[a[0]],R[a[1]],S[a[2]],T[a[3]],U[a[4]]);
}
static readonly string[] P = {"1" ,"2" ,"3" ,"4" ,"5" };
static readonly string[] Q = {"红色","绿色","白色","黄色","蓝色"};
static readonly string[] R = {"英国","瑞典","丹麦","挪威","德国"};
static readonly string[] S = {"茶 ","咖啡","牛奶","啤酒","水 "};
static readonly string[] T = {"Pall Mall","Dunhill","Blends","Blue Master","Prince"};
static readonly string[] U = {"狗" ,"鸟" ,"猫" ,"马" ,"鱼" };
}
C#解法 空间/IV 2008-08-09 17:17
用C#重写了一下:
using System;
using System.Collections.Generic;
class EinsteinPuzzle
{
static void Main()
{
const int N = 5;
List<string>[] A = new List<string>[N];
for (int p = 0; p < N; p++) // 序号
{
A[p] = new List<string>();
for (int q = 0; q < N; q++) // 房子颜色
{
if (p == 1 && q != 4 || p != 1 && q == 4) continue; // (N&I)2号为蓝色房子
for (int r = 0; r < N; r++) // 国籍
{
if (q == 0 && r != 0 || q != 0 && r == 0) continue; // (A)英国人住红色房子
if (p == 0 && r != 3 || p != 0 && r == 3) continue; // (I)1号为挪威
for (int s = 0; s < N; s++) // 饮料
{
if (r == 2 && s != 0 || r != 2 && s == 0) continue; // (C)丹麦人喝茶
if (q == 1 && s != 1 || q != 1 && s == 1) continue; // (E)绿色房子主人喝咖啡
if (p == 2 && s != 2 || p != 2 && s == 2) continue; // (H)3号喝牛奶
for (int t = 0; t < N; t++) // 香烟
{
if (q == 3 && t != 1 || q != 3 && t == 1) continue; // (G)黄色房子主人抽Dunhill
if (s == 3 && t != 3 || s != 3 && t == 3) continue; // (L)抽Blue Master的人喝啤酒
if (r == 4 && t != 4 || r != 4 && t == 4) continue; // (M)德国人抽Prince香烟
for (int u = 0; u < N; u++) // 宠物
{
if (r == 1 && u != 0 || r != 1 && u == 0) continue; // (B)瑞典人养狗
if (t == 0 && u != 1 || t != 0 && u == 1) continue; // (F)抽Pall Mall的人养鸟
//Console.WriteLine("{0} {1} {2} {3} {4} {5}", P[p], Q[q], R[r], S[s], T[t], U[u]);
A[p].Add(string.Format("{0}{1}{2}{3}{4}", q, r, s, t, u));
}
}
}
}
}
}
foreach (string a in A[0])
{
foreach (string b in A[1])
{
if (a[0] == b[0] || a[1] == b[1] || a[2] == b[2] || a[3] == b[3] || a[4] == b[4]) continue;
foreach (string c in A[2])
{
if (a[0] == c[0] || a[1] == c[1] || a[2] == c[2] || a[3] == c[3] || a[4] == c[4]) continue;
if (b[0] == c[0] || b[1] == c[1] || b[2] == c[2] || b[3] == c[3] || b[4] == c[4]) continue;
foreach (string d in A[3])
{
if (a[0] == d[0] || a[1] == d[1] || a[2] == d[2] || a[3] == d[3] || a[4] == d[4]) continue;
if (b[0] == d[0] || b[1] == d[1] || b[2] == d[2] || b[3] == d[3] || b[4] == d[4]) continue;
if (c[0] == d[0] || c[1] == d[1] || c[2] == d[2] || c[3] == d[3] || c[4] == d[4]) continue;
foreach (string e in A[4])
{
if (a[0] == e[0] || a[1] == e[1] || a[2] == e[2] || a[3] == e[3] || a[4] == e[4]) continue;
if (b[0] == e[0] || b[1] == e[1] || b[2] == e[2] || b[3] == e[3] || b[4] == e[4]) continue;
if (c[0] == e[0] || c[1] == e[1] || c[2] == e[2] || c[3] == e[3] || c[4] == e[4]) continue;
if (d[0] == e[0] || d[1] == e[1] || d[2] == e[2] || d[3] == e[3] || d[4] == e[4]) continue;
// (D)绿色房子在白色房子左面
if (! (a[0] == '1' && b[0] == '2' || b[0] == '1' && c[0] == '2'
|| c[0] == '1' && d[0] == '2' || d[0] == '1' && e[0] == '2')) continue;
// (J)抽 Blends 香烟的人住在养猫的人隔壁
if (! (b[3] == '2' && (a[4] == '2' || c[4] == '2')|| b[4] == '2' && (a[3] == '2' || c[3] == '2')
|| c[3] == '2' && (b[4] == '2' || d[4] == '2')|| c[4] == '2' && (b[3] == '2' || d[3] == '2')
|| d[3] == '2' && (c[4] == '2' || e[4] == '2')|| d[4] == '2' && (c[3] == '2' || e[3] == '2'))) continue;
// (K)养马的人住抽 Dunhill 香烟的人隔壁
if (! (b[3] == '1' && (a[4] == '3' || c[4] == '3')|| b[4] == '3' && (a[3] == '1' || c[3] == '1')
|| c[3] == '1' && (b[4] == '3' || d[4] == '3')|| c[4] == '3' && (b[3] == '1' || d[3] == '1')
|| d[3] == '1' && (c[4] == '3' || e[4] == '3')|| d[4] == '3' && (c[3] == '1' || e[3] == '1'))) continue;
/* ------------------------------------ 经实际测试,条件O是多余的 ------------------------------------
// (O)抽 Blends 香烟的人有一个喝水的邻居
if (! (b[3] == '2' && (a[2] == '4' || c[2] == '4')|| b[2] == '4' && (a[3] == '2' || c[3] == '2')
|| c[3] == '2' && (b[2] == '4' || d[2] == '4')|| c[2] == '4' && (b[3] == '2' || d[3] == '2')
|| d[3] == '2' && (c[2] == '4' || e[2] == '4')|| d[2] == '4' && (c[3] == '2' || e[3] == '2'))) continue;
* ----------------------------------------------------------------------------------------------------- */
Console.WriteLine(Format(0, a));
Console.WriteLine(Format(1, b));
Console.WriteLine(Format(2, c));
Console.WriteLine(Format(3, d));
Console.WriteLine(Format(4, e));
}
}
}
}
}
}
static string Format(int i, string s)
{
return string.Format("{0} {1} {2} {3} {4,-11} {5}",P[i],Q[s[0]-'0'],R[s[1]-'0'],S[s[2]-'0'],T[s[3]-'0'],U[s[4]-'0']);
}
static readonly string[] P = {"1" ,"2" ,"3" ,"4" ,"5" };
static readonly string[] Q = {"红色","绿色","白色","黄色","蓝色"};
static readonly string[] R = {"英国","瑞典","丹麦","挪威","德国"};
static readonly string[] S = {"茶 ","咖啡","牛奶","啤酒","水 "};
static readonly string[] T = {"Pall Mall","Dunhill","Blends","Blue Master","Prince"};
static readonly string[] U = {"狗" ,"鸟" ,"猫" ,"马" ,"鱼" };
}
re: 在局域网内获取本机的外部IP KKcat 2008-07-21 14:02
和气和气
我是新人,看到大哥们这样真的郁闷,本着讨论的精神多好啊。
顺便谢谢楼主,满足了我需求~
拜一记
re: 表达式计算器 Michael 2008-06-13 17:10
CompilerResults cr = new VBCodeProvider().CompileAssemblyFromSource这里编译报错:
“Microsoft.VisualBasic.VBCodeProvider”并不包含对“CompileAssemblyFromSource”的定义
vrhero使用集合排序的方法 空间/IV 2008-01-29 21:18
以下是vrhero的方法,详见:
http://topic.csdn.net/u/20080129/20/900a776f-92ed-435a-bb26-1ecebf804a8f.html
using System;
using System.Collections;
class Test
{
static void Main()
{
Console.WriteLine(Max()); // 输出: (null)
Console.WriteLine(Max(1)); // 输出: 1
Console.WriteLine(Max(.3, -.5)); // 输出: 0.3
Console.WriteLine(Max(0M, -3M, 3.14M)); // 输出: 3.14
Console.WriteLine(Max(9f, -1f, 3.14f, -2.718f)); // 输出: 9
Console.WriteLine(Max(0u, 23u, 3114u, 120718u, 5678u)); // 输出: 120718
}
static object Max(params object[] x)
{
if(x.Length == 0) return null;
ArrayList a = new ArrayList(x.Length);
a.AddRange(x);
a.Sort();
return a[x.Length - 1];
}
}
re: 一个Delphi写的DES算法, 翻译成C# hehe1234 2008-01-27 19:38
@eastasp
晕,当然是不一样的,还原一样就OK了
re: 不让拖动的标题栏, 双击标题栏无反应 zhanghw 2007-12-31 13:47
最好的办法,你试一试看看吧
protected override void WndProc(ref Message m)
{
if (m.Msg == 0xa1 && (int)m.WParam == 0x3)
{
return;
}
if (m.Msg == 0xa3 && ((int)m.WParam == 0x3 || (int)m.WParam == 0x2))
{
return;
}
if (m.Msg == 0xa4 && ((int)m.WParam == 0x2 || (int)m.WParam == 0x3))
{
return;
}
if (m.Msg == 0x112 && (int)m.WParam == 0xf100)
{
return;
}
base.WndProc(ref m);
}
除了可以点击关闭按钮以外,任何针对标题栏的操作都无效,非常不错。
re: 表达式计算器 空间/IV 2007-11-03 20:32
'Fibonacci Number: F(73)
n=73
x=sqrt(5)
y=((1+x)/2)^n
z=((1-x)/2)^n
return (y-z)/x
re: 表达式计算器 空间/IV 2007-11-03 19:39
1
// SuperCalc.cs - 超级计算器
2
// 编译方法: csc /t:winexe SuperCalc.cs VBExpression.cs
3
4
using System;
5
using System.Windows.Forms;
6
using Skyiv.Util;
7
8
namespace Skyiv
9

{
10
class Calc : Form
11
{
12
TextBox tbxA1;
13
TextBox tbxA3;
14
15
Calc()
16
{
17
Text = "Super Calculator";
18
StartPosition = FormStartPosition.CenterScreen;
19
Width = 300;
20
Height = 300;
21
22
tbxA1 = new TextBox();
23
tbxA1.Parent = this;
24
tbxA1.Multiline = true;
25
tbxA1.WordWrap = false;
26
tbxA1.Dock = DockStyle.Fill;
27
tbxA1.BorderStyle = BorderStyle.FixedSingle;
28
29
Panel pnlA1 = new Panel();
30
pnlA1.Parent = this;
31
pnlA1.Height = 22;
32
pnlA1.Dock = DockStyle.Top;
33
34
tbxA3 = new TextBox();
35
tbxA3.Parent = pnlA1;
36
tbxA3.Dock = DockStyle.Fill;
37
tbxA3.BorderStyle = BorderStyle.FixedSingle;
38
tbxA3.ReadOnly = true;
39
40
Button btnA3 = new Button();
41
btnA3.Text = "&Calculate";
42
btnA3.Parent = pnlA1;
43
btnA3.Width = 80;
44
btnA3.Dock = DockStyle.Left;
45
btnA3.Click += new EventHandler(Calc_Clicked);
46
}
47
48
void Calc_Clicked(object sender, EventArgs ea)
49
{
50
(sender as Control).Enabled = false;
51
try
52
{
53
tbxA3.Text = (new Expression(tbxA1.Text)).Compute().ToString();
54
}
55
catch (Exception ex)
56
{
57
MessageBox.Show(ex.Message, "Error");
58
}
59
finally
60
{
61
(sender as Control).Enabled = true;
62
}
63
}
64
65
[STAThread]
66
static void Main(string [] args)
67
{
68
Application.Run(new Calc());
69
}
70
}
71
}
72
1
// VBExpression.cs - 动态生成数学表达式并计算其值
2
// 表达式使用 Visual Baisc 语法
3
// 可使用 pi、e 等常量,sin、cos、tan、log、sqrt 等函数
4
5
using System;
6
using System.CodeDom.Compiler;
7
using Microsoft.VisualBasic;
8
using System.Reflection;
9
using System.Text;
10
using System.Globalization;
11
12
namespace Skyiv.Util
13

{
14
sealed class Expression
15
{
16
object instance;
17
MethodInfo method;
18
19
public Expression(string expression)
20
{
21
if (expression.ToUpper(CultureInfo.InvariantCulture).IndexOf("RETURN") < 0)
22
{
23
expression = "Return " + expression.Replace(Environment.NewLine, " ");
24
}
25
string className = "Expression";
26
string methodName = "Compute";
27
CompilerParameters p = new CompilerParameters();
28
p.GenerateInMemory = true;
29
CompilerResults cr = new VBCodeProvider().CompileAssemblyFromSource
30
(
31
p,
32
string.Format
33
(
34
@"Option Explicit Off
35
Option Strict Off
36
Imports System, System.Math, Microsoft.VisualBasic
37
NotInheritable Class {0}
38
Public Function {1} As Double
39
{2}
40
End Function
41
End Class",
42
className, methodName, expression
43
)
44
);
45
if(cr.Errors.Count > 0)
46
{
47
string msg = "Expression(\"" + expression + "\"): \n";
48
foreach (CompilerError err in cr.Errors) msg += err.ToString() + "\n";
49
throw new Exception(msg);
50
}
51
instance = cr.CompiledAssembly.CreateInstance(className);
52
method = instance.GetType().GetMethod(methodName);
53
}
54
55
public double Compute()
56
{
57
return (double)method.Invoke(instance, null);
58
}
59
}
60
}
61
re: 表达式计算器 空间/IV 2007-08-27 13:54
同意用银河的代码代替 Calc.cs 源程序中的 89 - 93 行。
re: 在局域网内获取本机的外部IP 路過 2007-08-26 18:58
我也喜歡用繁體
本來是研究問題的 怎麽說著就變成~
希望會的就答不會的就請教學習 不要動不動就擺出一副領導的架勢給誰看呀!!
re: 表达式计算器 银河 2007-08-26 10:29
Calc.cs 源程序中的 89 - 93 行可用以下一行代替:
if (!double.TryParse(tbxA2.Text, out x))
re: 表达式计算器 银河 2007-08-24 18:00
很好的文章
:)
re: 表达式计算器 空间/IV 2007-08-21 20:35
re: 表达式计算器[未登录] 吕昆 2007-08-21 20:10
代码很简练!而且难度也有所提高!改日我再重新我那个,呵呵,见笑了!
re: 数据库访问模块 八宝齐 2007-08-20 00:11
★:挂接事务的例子:这段代码一定要在try中执行,在错误处理中要有关闭Conn的代码,这样才能将未提交的事务回滚
SqlTransaction tx = null;
Conn = NF.CreateConn();
SqlCommand cmdt = new SqlCommand();
cmdt.Connection = Conn;
cmdt.CommandText = "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED";//这样被封锁的表就都能被读取了
cmdt.ExecuteNonQuery();
tx = Conn.BeginTransaction();//如果不和tx挂接则这个Conn便不能再读取其他数据了,要读取必须再开连接
xzyiau iau = new xzyiau(Conn);
iau.tablename = "_XZY信息发布";
iau.keyfield = "id";
iau.transaction = tx;
iau.action = "insert";
iau.addfield("ids", "");
iau.addfield("栏目", "建设新闻");
iau.addfield("标题", "视察情况");
iau.addfield("创建日期", "2007-08-01 13:05");
iau.addfield("创建人", "邢志云");
iau.execute();
xzyiau iau2 = new xzyiau(Conn);
iau2.tablename = "_XZY信息发布";
iau2.keyfield = "ids";
iau2.transaction = tx;
iau2.action = "update";
iau2.addfield("ids", "e36165d1-b266-483d-93fb-ab4c7ba4fba9");
iau2.addfield("栏目", "vv");
iau2.addfield("标题", "Excel使用简介2");
iau2.addfield("创建日期", "2007-08-01 13:05");
iau2.addfield("创建人", "邢志云");
iau2.execute();
xzyiau iau3 = new xzyiau(Conn);
iau3.transaction = tx;
iau3.tablename = "_XZY信息发布";
iau3.action = "delete";
iau3.deletewhere = "where ids in('03d5a35a-b53a-4e77-b4aa-27176044bd15')";
int k = iau3.execute();//返回影响数据的数量
tx.Commit();//如果上面出错,则不会执行到这里,在错误捕获中关闭连接的时候,会自动将未提交的事务关闭
re: 数据库访问模块 八宝齐 2007-08-20 00:10
★修该:
Conn = NF.CreateConn();
xzyiau iau = new xzyiau(Conn);
iau.tablename = "_XZY信息发布";
iau.keyfield="ids";//必须是字符或uniqueidtifier类型的
iau.action="update";
iau.addfield("ids", "e36165d1-b266-483d-93fb-ab4c7ba4fba9");//根据这个来定位记录
iau.addfield("栏目", "学习园地");
iau.addfield("标题", "Excel使用简介");
iau.addfield("创建日期", "2007-08-01 13:05");
iau.addfield("创建人", "邢志云");
iau.execute();
re: 数据库访问模块 八宝齐 2007-08-20 00:07
每个人都攒了一些数据库操作的代码,我也有个数据库增删改的,是这么用的
★新增:
Conn = NF.CreateConn();
xzyiau iau = new xzyiau(Conn);
iau.tablename = "_XZY信息发布";
iau.keyfield="ids";//必须是字符或uniqueidtifier类型的
iau.action="insert";
iau.addfield("ids", "");//主键为空则会自动创建,如果不为空则用传入的作为主键
iau.addfield("栏目", "学习园地");
iau.addfield("标题", "word使用简介");
iau.addfield("创建日期", "2007-08-01 12:55");
iau.addfield("创建人", "邢志云");
iau.execute();//返回影响数据的数量,一般是1
re: 在局域网内获取本机的外部IP zoti 2007-06-17 22:53
to Pootow:
你看我用繁体字回复的的就想当然我是在台湾香港,呵呵,我这里用简体回复你肯定会认为我在大陆,如果我下次用E文回复的话,你可能会又以为我在M国了。呵呵,开个玩笑。 :)
请原谅我上次回复的语气冲了点,说声对不起。
其它的不想多说了,随便说一声,我是地地道道的大陆人。
re: 在局域网内获取本机的外部IP Pootow 2007-06-02 12:17
to zoti:
看了你的回复才让人啼笑皆非,你用繁体字,难道是台湾香港的?不过不管怎么样,看来中国人的确做事不严谨,你请注意我说的是“可能”,不是一定。
你说的那种情况确实会拥有多个出口IP,但是,即使只有一个Internet连接也会有不同的公网IP,你不了解大陆的网络运营和拓扑情况,你的ISP的路由配置你是做不了主的。如果你的ISP有很多带宽资源的提供商,你访问不同地域的主机,得到的你的公网IP也会不同。
就凭你的反问句,我就知道你很鄙视作网管的人。
此外,我并没有说搂主的文章有错误,只是补充说明。
我还是要说,中国的气氛就这样。我没见过几个Dev同时Tech也很好的。
re: 在局域网内获取本机的外部IP zoti 2007-06-02 11:29
非常反感Pootow的態度﹐
首先﹐"如果你多添加几个外部测试主机,你可能会得到不同的“本机的外部地址”"這個是不可能的﹐除非是這台上網的電腦有多個internet出口﹐并且路由器那邊會動態調整出口 ﹐否則不可能會有多個外部IP。
其次﹐"现在的程序员,没有一点Tech的素质"﹐唉﹐不想說什么﹐動不動就批評別人的人﹐可想而已心胸如何
"去问问你们平时鄙视的做低技术含量工作的网管,他们估计没有一个会不知道的"﹐我只想問的是﹐到底是誰在"鄙视做低技术含量工作的网管"?
"真是悲哀。中国的气氛就是这样"怎么什么事情都動不動就扯到"中國"這么大的名詞上來﹐如果說是悲哀﹐那這確實是很悲哀。
樓主的這篇文章沒錯﹐如果大家知道不通過外部反饋IP得到自己IP的方法﹐請賜教。先謝了。
@在北京的湖南人
这是微软的实现,句号转成问号应该是因为微软不知道句号对应哪个符号,因为半角句点(.)已经有全角的下圆点(.)对应了。
非常谢谢你!
感叹一下:.NET实在太强大了!!!!
楼主的这些方法恐怕没有经过自己的测试吧?
比如你的全角转半角,竟然把全角的句号转换成了问号
刚才少了第一行,完整的代码是这样的,谢谢……
function myenctstr(const s:string; skey:string):string;
var
i,j: integer;
hexS,hexskey,midS,tmpstr:string;
a,b,c:byte;
begin
hexS :=myStrtoHex(s);
hexskey:=myStrtoHex(skey);
midS :=hexS;
for i:=1 to (length(hexskey) div 2) do
begin
if i<>1 then midS:= tmpstr;
for j:=1 to (length(midS) div 2) do
begin
a:=strtoint('$'+midS[2*j-1]+midS[2*j]);
showmessage(inttostr(a));
b:=strtoint('$'+hexskey[2*i-1]+hexskey[2*i]);
c:=a xor b;
tmpstr := tmpstr+myStrtoHex(chr(c));
end;
end;
result := tmpstr;
end;
楼主你好!能否帮我翻译一段Delphi代码?也是加密的,我一直搞不定,拜托你了!
如果可以帮我,请将翻译后的代码发我邮箱:pollyzlb@hotmail.com
小弟不胜感激!
var
i,j: integer;
hexS,hexskey,midS,tmpstr:string;
a,b,c:byte;
begin
hexS :=myStrtoHex(s);
hexskey:=myStrtoHex(skey);
midS :=hexS;
for i:=1 to (length(hexskey) div 2) do
begin
if i<>1 then midS:= tmpstr;
for j:=1 to (length(midS) div 2) do
begin
a:=strtoint('$'+midS[2*j-1]+midS[2*j]);
showmessage(inttostr(a));
b:=strtoint('$'+hexskey[2*i-1]+hexskey[2*i]);
c:=a xor b;
tmpstr := tmpstr+myStrtoHex(chr(c));
end;
end;
result := tmpstr;
end;
鎮ㄥ湪2006-12-01搴旇仒浜嗚嫃宸炲瘜椤哄寘瑁呭埗鍝佹湁闄愬叕鍙哥殑浜轰簨涓€鑱屽凡琚祻瑙?/td>