随笔-63  评论-1  文章-0  trackbacks-0
  2012年2月21日

原来看过项目到底画不画uml的争论,我觉得真正聪明的人可以不画uml,他们可以通过代码在大脑中展现出图像。

一般人还是画吧,不论项目大小,uml都能让自己让别人的思路清晰。
我是一般人,写一个简单的程序,画一个简单的uml图。

 

层关系图

类图

活动图

这是一个简单的模拟mvc的程序

代码:

    public class mvc_m
{
public List<int> i { get; set; }

public mvc_m()
{
i = new List<int>();
i.Add(1);
i.Add(2);
i.Add(3);
}
}

public class mvc_c
{
public static int get_max(List<int> i)
{
int temp = i[0];
foreach (var item in i)
{
if (item > temp)
{
temp = item;
}
}
return temp;
}

public static int get_min(List<int> i)
{
int temp = i[0];
foreach (var item in i)
{
if (item < temp)
{
temp = item;
}
}
return temp;
}
}

public class mvc_v
{
public static void show()
{
mvc_m m1 = new mvc_m();
Console.WriteLine(mvc_c.get_max(m1.i));
Console.WriteLine(mvc_c.get_min(m1.i));
// m1.i=new ;
}
}

public class work48
{
public static void Main()
{
mvc_v.show();
Console.Read();
}
}

学而时习之不亦乐乎,我有时没事会画画这种图.

 

 

posted @ 2012-02-21 14:58 xinshenghu 阅读(194) 评论(0) 编辑
  2012年2月20日
svn

svn是一款很好的版本管理软件 分为server和cilent 下载地址baidu能搜到

在server新建一个资源 新建一个目录 在cilent把本地目录import进去 就ok了 其他就是迁入迁出操作了

我自己写项目也会用svn 这样自己的项目就不用备份了 并且随时随地可以修改

觉得比tfs方便,tfs与vs的耦合性太大了,违反了软件开发的模块独立原则。 不知道微软的那些科学家是怎么想的。

posted @ 2012-02-20 12:35 xinshenghu 阅读(22) 评论(0) 编辑
js动画总是很别扭 不知道是我水平问题还是js的异步特性问题
放一个简单的动画实现 顺便复习一下js的数组 古人云 学而时习之不亦乐乎
虽然简单但也有些微的成就感
/// <reference path="..\jquery-1.4.1-vsdoc.js"/>
var i = 0;
function move_div() {
var a = [50, 100, 150, 200, 250];
$("#content").css("left", a[i]);
i++;
if (i > a.length) {
clearInterval(intervalProcess);
i = 0;
return false;
}
}

function change_div(oid, width, height, left, backgroundcolor) {
var a = $("#" + oid + "");
a.css("width", width);
a.css("position", "absolute");
a.css("left", left);
a.css("height", height);
a.css("background-color", backgroundcolor);
return a;
}

$(function () {
var div = $("#content");
change_div("content", 50, 50, 50, "blue");
div.before($("<button>").html("move").attr("id", "move"));
$("#move").click(function () { intervalProcess = setInterval(move_div, 1000); });
})

 

posted @ 2012-02-20 10:29 xinshenghu 阅读(16) 评论(0) 编辑
  2012年2月16日
/// //做一个动画 一个方块从原来的位置慢慢往下移动
/// 用timer picturebox两个控件

public partial class Form3 : Form
{
PictureBox p;
public Form3()
{
InitializeComponent();
}

private void Form3_Load(object sender, EventArgs e)
{

this.Width = 800;
this.Height = 600;

Bitmap newBitmap = new Bitmap(50, 50, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
Graphics g = Graphics.FromImage(newBitmap);
g.FillRectangle(new SolidBrush(Color.Red), new Rectangle(0, 0, 50, 50));
//newBitmap.Save(System.IO.Path.Combine (Environment.CurrentDirectoryEnvironment.CurrentDirectory,"1.png"), ImageFormat.Png);

p = new PictureBox();
p.Image = newBitmap;
this.Controls.Add(p);

p.Top = 50;
p.Left = 10;

System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer();
timer1.Tick += new System.EventHandler(this.timer1_Tick);
timer1.Interval = 1000; // 设置timer时间,单位是毫秒
timer1.Enabled = true; // 启动 timer




//Button

}
private void timer1_Tick(object sender, EventArgs e)
{
p.Top = p.Top + 50;
}

}

 

编辑器加载中...

posted @ 2012-02-16 18:21 xinshenghu 阅读(23) 评论(0) 编辑
我的理解wcf是webservice的升级版
就是部署在另外的机器上的一个函数
我的水平是简单应用阶段 我觉得这个阶段也就够了
首先在vs2010建立wcf服务应用程序
自动生成接口文件和svc文件
如果想写一个方法
分别在接口文件和svc文件写方法
[OperationContract]
string GetDate();

public string GetDate()
{
return DateTime.Now.ToShortDateString();
}

之后随便建一个项目
添加服务器引用
配置文件中会自动添加如下配置
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:61230/Service1.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IService1"
name="BasicHttpBinding_IService1" />
</client>


封装方法的时候用如下代码
public static string GetDate()
{
Service1Client client = new Service1Client();
string s = client.GetDate();
return s;
}

如果想在别的项目里面应用GetDate方法
需要把那段xml配置粘贴到别的项目的配置文件中 也就是client.GetDate();方法只是与那段带endpoint的xml耦合。

简单的wcf就是如此应用,指不定以后微软又研究出什么东西呢,只要wcf的东西在工作中够用就成了,除非你觉得这种纯文字的东西有意思,要不为什么非得研究的那么深呢。

 

posted @ 2012-02-16 14:57 xinshenghu 阅读(12) 评论(0) 编辑
  2012年2月15日
很多时候做一个项目需要定位一个div相对于另一个div的位置
可以直接在js里面做,css里面定位的方法太多,我觉得太乱,
基本我只用relative absolute 试试拿个可以就用哪个。

//
function t10() {
var div1 = $("<div>");
div1.css("width", "100");
div1.css("height", "100");
div1.css("background-color", "red");
div1.css("position", "relative");
div1.css("left",100);

$("#content").append(div1);

var div2 = $("<div>");
div2.css("width", "100");
div2.css("height", "100");
div2.css("background-color", "green");

$("#content").append(div2);
// div2.css("position", "relative");
div2.css("position", "absolute");
div2.css("left", div1.width() / 2);
// div2.css("left", Number(div1.css("left")) + div1.width() / 2);
// div2.css("left", "100px");
//alert(div1.offset());




}

 

posted @ 2012-02-15 11:55 xinshenghu 阅读(18) 评论(0) 编辑
  2012年2月14日
/// <reference path="..\jquery-1.4.1-vsdoc.js"/>

//获取元素的方法 从标签取得 从元素的特性取得 从元素的相邻相关元素取得

$(function () {
//alert(1);
var content = $("#content");
var show = $("#show");
var show1 = $("[name='show1']");
var show2 = $("[data-my='show2']");

var div = $("div");

content.html("11");
show1.html("22");
div.html("3");
show2.html("4");

content.append(show2);
content.children("div").html("5");


})



<script src="../jquery-1.4.4.min.js"></script>
<script src="2012-02-14 获取元素.js"></script>
<script src="cookies_oper.js"></script>

<div id="content"></div>
<div id="show" ></div>
<div name="show1"></div>
<div data-my="show2"></div>

 

编辑器加载中...

posted @ 2012-02-14 15:41 xinshenghu 阅读(15) 评论(0) 编辑

乐观幽默 志向在技术路线发展的程序员 java 一个在深圳拼杀的程序员日记 http://topic.csdn.net/u/20101213/14/5ba7e805-3bea-4b11-b33c-a01bb54ac9cd_73.html

知足常乐 脾气温和 走技术路线的程序员 vb 写在冬日的第一天--一个女程序员第六年工作总结 http://hi.csdn.net/space.php?uid=24922

已经成功的拥有自己公司的程序员 梦想就是更大规模的公司 浪潮之巅

辛辛苦苦 走创业路线 最老程序员创业札记:全文检索、数据挖掘、推荐引擎应用52 http://www.cnblogs.com/yantao7589/

有些古龙风格 继续当程序员的程序员 dba 混来混去 -- 一个70后的IT经历 http://www.qidian.com/BookReader/vol,2115730,5322766.aspx#34771819

悲剧的程序员 很多理想无法实现 转行去做别的 也许是开个小店卖东西 呵呵 当程序员的那些狗日日子 http://blog.csdn.net/tangtdd/article/details/7169302

还在研究程序的程序员 嵌入式 《那些年啊,那些事——一个程序员的奋斗史》——71 http://blog.csdn.net/norains

早期创业的程序员 vb asp net 我的十年IT生涯 http://topic.csdn.net/t/20061215/01/5232028_2.html

一个程序员7年的成长史 作者当前境况未知 疯狂的程序员  http://blog.csdn.net/hitetoshi/article/details/3319917

 

 

 

 

posted @ 2012-02-14 14:49 xinshenghu 阅读(69) 评论(0) 编辑
  2012年2月13日
摘要: 最近看了几篇程序员的现实文学 看这篇文章最先想起的就是知足常乐 低头做事,抬头做人 过幸福的小日子 :) 作为工作了几年的程序员来讲,看这种文章都会有一种同是天涯沦落人的感觉。 我身边的人经常问当程序员是不是干不长啊 我曾经看到一个做java的干了9年的女程序员,做的也挺好。 想想男人在工作方面本来就比女性有优势,为什么不能一直做下去呢。阅读全文
posted @ 2012-02-13 18:31 xinshenghu 阅读(20) 评论(0) 编辑
摘要: cookie 就是js里面的文件操作 地位是很重要的ie 和 firefox存储cookie的位置不同 所以会有两个浏览器一个登录了 另一个不能登录的现象cookie文件时不能手动修改的两个域名不能共享cookiecookie还有个过期时间对于一个文件来讲 只要能够存取就够了function getCookie(name){ var cookieValue = ""; var search = name + "="; if(document.cookie.length > 0) { offset = document.cookie.indexOf(阅读全文
posted @ 2012-02-13 17:44 xinshenghu 阅读(43) 评论(0) 编辑
仅列出标题  下一页