八字基本教程
1.五行生克 五行相生: 金生水, 水生木, 木生火, 火生土, 土生金. 五行相克: 金克木, 木克土, 土克水, 水克火, 火克金. 2. 天干地支 十天干: 甲, 乙, 丙, 丁, 戊, 己, 庚, 辛, 壬, 癸. 十二地支: 子, 丑, 寅, 卯, 辰, 巳, 午, 未, 申, 酉, 戌, 亥. 3. 干支阴阳: 甲乙同属木, 甲为阳, 乙为阴 丙丁同属火, 丙为阳, 丁为阴 戊己同属土, 戊为阳, 己为阴 庚辛同属金, 庚为阳, 辛为阴 壬癸同属水, 壬为阳, 癸为阴 亥子同属水, 子为阳, 亥为阴 寅卯同属木, 寅为阳, 卯为阴 巳午同属火, 午为阳, 巳为阴 申酉同属金, 申为阳, 酉为阴 戌未同属土, 子为阳, 未为阴 辰丑同属土, 辰为阳, 丑为阴 干支方位: 甲乙东方木 丙丁南方火 戊己中央土 庚辛西方金 壬癸北方水 亥子北方水 寅卯东方木 巳午南方火 申酉西方金 辰戌丑未四季土 4.天干地支作用关系 4.1 天干化合: 己合化土, 乙庚合化金, 丙辛合化水, 丁壬合化木, 戊癸合化火. 4.2 地支会合冲刑: […]
View Details元素的class与ID命名常用关键字
由于项目中编写文档结构、编写CSS的人员较多,并与程序员协同工作,就需要统一class与id的名称,前天花了一点时间,按照大多人的习惯,制定了下面的常用关键字: 容 器:container/box 头 部:header 主 导 航:mainNav 子 导 航:subNav 顶 导 航:topNav 网站标志:logo 大 广 告:banner 页面中部:mainBody 底 部:footer 菜 单:menu 菜单内容:menuContent 子 菜 单:subMenu 子菜单内容:subMenuContent 搜 索:search 搜索关键字:keyword 搜索范围:range 标签文字:tagTitle 标签内容:tagContent 当前标签:tagCurrent/currentTag 标 题:title 内 容:content 列 表:list 当前位置:currentPath 侧 边 栏:sidebar 图 标:icon 注 释:note 登 录:login 注 册:register 列 定 义:column_1of3 (三列中的第一列) column_2of3 (三列中的第二列) column_3of3 (三列中的第三列) 转自:http://www.lanrentuku.com/lanren/superlazy/20070526/superlazy182717.html
View DetailsCSS样式命名规则(仅供参考)
1.样式命名外 套: wrap主导航: mainnav子导航: subnav页 脚: footer整个页面: content页 眉: header页 脚: footer商 标: label标 题: title主导航: mainbav(globalnav)顶导航: topnav边导航: sidebar左导航: leftsidebar右导航: rightsidebar旗 志: logo标 语: banner菜单内容1: menu1 content菜单容量: menu container子菜单: submenu边导航图标:sidebarIcon注释: note面包屑: breadcrumb(即页面所处位置导航提示)容器: container内容: content搜索: search登陆: Login功能区: shop(如购物车,收银台)当前的 current 2.另外在编辑样式表时可用的注释可这样写:<-- Footer -->内容区<-- End Footer --> 3.样式文件命名主要的 master.css布局,版面 layout.css专栏 columns.css文字 font.css打印样式 print.css主题 themes.css http://www.lanrentuku.com/lanren/superlazy/20070419/000757.html
View Details企业网站常用中英文对照表
门户网站 portals website 网站导航 site map 公司简介 profile / company profile / company 公司设备 equipment 公司荣誉 glories 企业文化 culture 产品展示 product 资质认证 quality certification 企业规模 scale 营销网络 sales network 组织机构 organization 合作加盟 join in cooperation 技术力量 technology 经理致辞 managers oration 发展历程 development history 工程案例 engineering projects 业务范围 business scope 分支机构 branches 供求信息 supply & demand 经营理念 operation principle 产品销售 sales 联系我们 contact us 信息发布 information 返回首页 homepage 产品定购 order 分类浏览 browse by category 电子商务 e-business 公司实力 strength 版权所有 copy right 友情连结 hot link 应用领域 application fields 人力资源 human […]
View DetailsC# UDP通信示例
大家好,这是我最近写了一个Udp通信的小程序,发表出来和大家共同学习,我希望和大家共同进步。 upd通信接受端:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
using System; using System.Net; using System.Net.Sockets; namespace Zhty.Socket.UDPSocket { public class UDP_Client { #region 属性 private IPAddress _ClientAddress = IPAddress.Any; private int _ClientPort = 0; private byte[] _data = new byte[] { }; public IPEndPoint Client { get { return new IPEndPoint(_ClientAddress, _ClientPort); } set { _ClientAddress = value.Address; _ClientPort = value.Port; } } public IPAddress ClientAddress { get { return _ClientAddress; } set { _ClientAddress = value; } } public int ClientPort { get { return _ClientPort; } set { _ClientPort = value; } } #endregion #region 方法 public void SendMessage(byte[] message) { // Encode message per settings // Send the message _data = message; try { SendUDPMessage(_data); } catch (Exception ex) { throw ex; } } private int SendUDPMessage(Byte[] _data) { //' Create a UDP Server and send the message, then clean up UdpClient _UDPServer = null; int ReturnCode; try { _UDPServer = new UdpClient(); ReturnCode = 0; _UDPServer.Connect(Client); ReturnCode = _UDPServer.Send(_data, _data.Length); } catch (Exception ex) { throw ex; } finally { if (_UDPServer != null) { _UDPServer.Close(); } } return ReturnCode; } #endregion } } |
udp通信的发送端:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Net.Sockets; using System.Net; namespace Zhty.Socket.UDPSocket { public class UDP_Server { private Thread _ThreadReceive; private int _ClientPort = 0; private string _Message = null; private UdpClient _UDPClient; private IPEndPoint _Server = new IPEndPoint(IPAddress.Any, 0); private int _BytesReceived = 0; #region 事件定义 public delegate void OnReceivedDataHandler(object sender, DataReceivedEventArgs e); public event OnReceivedDataHandler OnRecivedData; public delegate void OnStateChangedHandler(object sender, ServerStateChangeEventArgs e); public event OnStateChangedHandler OnStateChanged; #endregion #region 属性 int _bufferSize = 1024; public int BufferSize { get { return _bufferSize; } set { _bufferSize = value; } } public int BytesReceived { get { return _BytesReceived; } } public string Message { get { return _Message; } } public int ClientPort { get { return _ClientPort; } set { _ClientPort = value; } } #endregion #region 方法 void DataReceiveProc() { //BeforeReceive(this,new EventArgs()); _Message = ""; byte[] data = new byte[BufferSize]; try { data = _UDPClient.Receive(ref _Server); if (OnRecivedData != null) OnRecivedData(this, new DataReceivedEventArgs(data)); Thread.Sleep(100); } catch (Exception ex) { if (OnStateChanged != null) OnStateChanged(this, new ServerStateChangeEventArgs(false)); throw ex; } finally { InitializeThread(); } } private void InitializeClient() { if (_UDPClient == null) { this._UDPClient = new UdpClient(ClientPort); } } private void InitializeThread() { try { _ThreadReceive = new Thread(new ThreadStart(DataReceiveProc)); _ThreadReceive.Start(); } catch (Exception ex) { throw ex; } } public void Start() { InitializeClient(); InitializeThread(); } #endregion public void Stop() { try { _ThreadReceive.Abort(); if (_UDPClient != null) { // ' Close the UDPClient and then force it to Nothing _UDPClient.Close(); _UDPClient = null; } } catch (Exception ex) { throw ex; } } #region 析构方法 ~UDP_Server() { Stop(); } #endregion } } |
辅助类:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
using System; using System.Collections.Generic; using System.Text; namespace Zhty.Socket.UDPSocket { public class DataReceivedEventArgs : EventArgs { public DataReceivedEventArgs(byte[] data) { Data = data; } byte[] m_Data; public byte[] Data { get { return m_Data; } set { m_Data = value; } } } public class ServerStateChangeEventArgs : EventArgs { public ServerStateChangeEventArgs(bool state) { Running = state; } bool m_Running; public bool Running { get { return m_Running; } set { m_Running = value; } } } } |
转自:http://www.cnblogs.com/zhaotianyu001/articles/549259.html
View DetailsC#UDP通信 | C#UDP广播
Internet协议族中有支持无连接的传输协议,即UDP协议。UDP协议提供了一种方法来发送经过封装的IP数据报,而且不必建立连接就 可以发送这些IP数据报。 服务器端:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
using System; using System.Collections.Generic; using System.Text; using System.Net; using System.Net.Sockets; namespace UDPServer { class Program { static void Main(string[] args) { int recv; byte[] data = new byte[1024]; //构建TCP 服务器 //得到本机IP,设置TCP端口号 IPEndPoint ipep = new IPEndPoint(IPAddress.Any, 8001); Socket newsock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); //绑定网络地址 newsock.Bind(ipep); Console.WriteLine("This is a Server, host name is {0}", Dns.GetHostName()); //等待客户机连接 Console.WriteLine("Waiting for a client"); //得到客户机IP IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0); EndPoint Remote = (EndPoint)(sender); recv = newsock.ReceiveFrom(data, ref Remote); Console.WriteLine("Message received from {0}: ", Remote.ToString()); Console.WriteLine(Encoding.ASCII.GetString(data, 0, recv)); //客户机连接成功后,发送欢迎信息 string welcome = "Welcome ! "; //字符串与字节数组相互转换 data = Encoding.ASCII.GetBytes(welcome); //发送信息 newsock.SendTo(data, data.Length, SocketFlags.None, Remote); while (true) { data = new byte[1024]; //发送接受信息 recv = newsock.ReceiveFrom(data, ref Remote); Console.WriteLine(Encoding.ASCII.GetString(data, 0, recv)); newsock.SendTo(data, recv, SocketFlags.None, Remote); } } } } |
客户端:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.Net.Sockets; namespace UDPClient { class Program { static void Main(string[] args) { byte[] data = new byte[1024]; string input, stringData; //构建TCP 服务器 Console.WriteLine("This is a Client, host name is {0}", Dns.GetHostName()); //设置服务IP,设置TCP端口号 IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8001); //定义网络类型,数据连接类型和网络协议UDP Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); string welcome = "Hello! "; data = Encoding.ASCII.GetBytes(welcome); server.SendTo(data, data.Length, SocketFlags.None, ipep); IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0); EndPoint Remote = (EndPoint)sender; data = new byte[1024]; //对于不存在的IP地址,加入此行代码后,可以在指定时间内解除阻塞模式限制 //server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 100); int recv = server.ReceiveFrom(data, ref Remote); Console.WriteLine("Message received from {0}: ", Remote.ToString()); Console.WriteLine(Encoding.ASCII.GetString(data, 0, recv)); while (true) { input = Console.ReadLine(); if (input == "exit") break; server.SendTo(Encoding.ASCII.GetBytes(input), Remote); data = new byte[1024]; recv = server.ReceiveFrom(data, ref Remote); stringData = Encoding.ASCII.GetString(data, 0, recv); Console.WriteLine(stringData); } Console.WriteLine("Stopping Client."); server.Close(); } } } |
MSDN 实例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
// This constructor arbitrarily assigns the local port number. UdpClient udpClient = new UdpClient(11000); try{ udpClient.Connect("www.contoso.com ", 11000); // Sends a message to the host to which you have connected. Byte[] sendBytes = Encoding.ASCII.GetBytes("Is anybody there?"); udpClient.Send(sendBytes, sendBytes.Length); // Sends a message to a different host using optional hostname and port parameters. UdpClient udpClientB = new UdpClient(); udpClientB.Send(sendBytes, sendBytes.Length, "AlternateHostMachineName", 11000); //IPEndPoint object will allow us to read datagrams sent from any source. IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0); // Blocks until a message returns on this socket from a remote host. Byte[] receiveBytes = udpClient.Receive(ref RemoteIpEndPoint); string returnData = Encoding.ASCII.GetString(receiveBytes); // Uses the IPEndPoint object to determine which of these two hosts responded. Console.WriteLine("This is the message you received " + returnData.ToString()); Console.WriteLine("This message was sent from " + RemoteIpEndPoint.Address.ToString() + " on their port number " + RemoteIpEndPoint.Port.ToString()); udpClient.Close(); udpClientB.Close(); } catch (Exception e ) { Console.WriteLine(e.ToString()); } |
Microsoft Visual Studio 2005/.NET Framework 2.0 同时提供下列产品的其他版本: •.NET Framework 3.0 •Microsoft Visual Studio 2008/.NET Framework 3.5 .NET Framework 类库UdpClient 成员 提供用户数据报 (UDP) 网络服务。 下表列出了由 UdpClient 类型公开的成员。 公共构造函数 名称 说明 UdpClient 已重载。初始化 UdpClient 类的新实例。 公共属性 (请参见 受保护的属性 ) 名称 说明 Available 获取从网络接收的可读取的数据量。 Client 获取或设置基础网络 Socket。 DontFragment 获取或设置 Boolean 值,指定 UdpClient 是否允许对 Internet 协议 (IP) 数据报进行分段。 EnableBroadcast 获取或设置 Boolean 值,指定 UdpClient 是否可以发送或接收广播数据包。 ExclusiveAddressUse 获取或设置 Boolean 值,指定 UdpClient 是否只允许一个客户端使用端口。 MulticastLoopback 获取或设置 Boolean 值,指定是否将输出多路广播数据包传递给发送应用程序。 Ttl 获取或设置一个值,指定由 UdpClient 发送的 Internet […]
View Details使IE6下PNG背景透明的七种方法任你选
PNG图像格式介绍: PNG是20世纪90年代中期开始开发的图像文件存储格式,其目的是企图替代GIF和TIFF文件格式,同时增加一些GIF文件格式所不具备的特性。流式 网络图形格式(Portable Network Graphic Format,PNG)名称来源于非官方的“PNG’s Not GIF”,是一种位图文件(bitmap file)存储格式,读成“ping”。PNG用来存储灰度图像时,灰度图像的深度可多到16位,存储彩色图像时,彩色图像的深度可多到48位,并且还可 存储多到16位的α通道数据。 IE6下PNG背景透明的显示问题 PNG格式比起GIF来表现色彩更丰富,特别是表现渐变以及背景透明的渐变要比GIF格式出色很多,目前,最新的浏览器基本上都支持PNG格式。但是IE6不支持PNG背景透明,会显示一个灰色的框。 IE6下PNG背景透明的解决办法 .pngImg { background:url(image.png); _background:url(image.gif);} 注意上文的_号,目前IE7,8以及Firefox浏览器等都不支持此CSS语法,只有IE6识别。因此,其他浏览器会调用PNG,而IE6刚调用GIF。 二.滤镜filter解决IE6下背景灰 background:url(a.png) repeat-x 0 0; _background:none; _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="a.png" ,sizingMethod="crop"); 上面的原理是其他调用PNG,IE6,则先设背景没有,然后调用滤镜使之显示PNG图片。 缺陷:IE6下背景无法平铺,这个问题很严重。同时在性能上也有小问题,页面中次数不是很多的时候该办法还是可行的。 AlphaImageLoader滤镜会导致该区域的链接和按钮无效,解决的办法是为链接或按钮添加:position: relative;这样条代码,使其相对浮动。AlphaImageLoader无法设置背景的重复,所以对图片的切图精度会有很高的精确度要求。 解决IE下的链接无效可用最后面的方法: 三.利用JS解决html中的img(插入在网页中的png图像)png背景灰问题 页面中插入一段js即可。原理同上,只是将img标签用<span>标签替换掉,并且通过滤镜设置该<span>标签的background。它会将所有插入的PNG都如此处理。<!--[if IE 6]> <script>function correctPNG() {for(var i=0; i<document.images.length; i++){var img = document.images[i];var imgName = img.src.toUpperCase();if (imgName.substring(imgName.length-3, imgName.length) == "PNG"){var imgID = (img.id) ? "id=’" + img.id + "' " : "";var imgClass = (img.className) ? "class=’" + img.className + "' " : "";var imgTitle = (img.title) ? "title=’" + img.title + "' " : "title=’" + […]
View Detailscss实现强制不换行/自动换行/强制换行
强制不换行 div{white-space:nowrap;} 自动换行 div{ word-wrap: break-word; word-break: normal; } 强制英文单词断行 div{word-break:break-all;}
View DetailsC:\WINDOWS\Installer 刪除解決
1.C:\WINDOWS\$hf_mig$ 文件夹下是升级、安装补丁的备份存档文件,删了也没什么大碍,不过如果你想还原到安装补丁以前的状态就不要删(通常没人会还原到安装补丁以前)。 2.C:\WINDOWS\SoftwareDistribution\Download中也是更新的文件,也可以删除。 3.C:\WINDOWS\Installer 是用来存放MSI文件或者程序安装所需要的临时文件,所有基于 Windows Installer 安装的应用软件,其注册信息和有关的组件都保存在这里,不要轻易删除 Windows\Installer 文件夹中的任何数据,否则可能导致全盘大乱。比如Office 就属于这种基于 Windows Installer 安装的软件。如果删除了 Windows\Installer 中的数据,Office 从表面上会表现为正常运行但找不到图标,实质上会表现为多数功能组件都无法正常使用,甚至在“添加删除程序”中试图删除 Office,都会出现未知错误。到时候就会变成乱糟糟的一个乱摊子,想用用不了、想删删不了,欲哭无泪。其它的 Windows Installer 软件还有Altova XMLSpy、Microsoft Visual Studio、Windows Live Messenger(MSN)、Adobe CS套件、金山词霸等以Office为例,当你删除了这个文件夹 中的内容后,Office的安装程序将无法使用,无论是重新安装,修复、添加和删除Office组件,都无法运行,此时你必须手动删除Office,然后 再重新安装。打开注册表定位到HKEY_CLASSES_ROOT\Insaller\products,在这里找到Office的卸载信息,将对应注册表项删除,然后手动 删除Office文件夹,再重新运行Office的安装程序,方可正常运行,其余所有基于Windows Installer的软件都要如此处理。你到别人相同的系统中去复制这个文件基本是不可行的,因为每个人安装的软件怎么可能完全一样呢?
View Details