tonyqus.cn

2008貌似是个灾年
随笔 - 201, 文章 - 1, 评论 - 1196, 引用 - 56
数据加载中……

2007年12月29日

如何隐藏UpdatePanel

一些人看了文章标题的第一反应也许是——这点破东西需要写篇文章吗? 直接UpdatePanel.Visible=false不就行了(俗话说:用屁股想想都知道,呵呵~~),我今天在实现这段代码时也是这么想的,没想到竟然报错了,UpdatePanel也没有隐藏掉。回过头来一捉摸,之所以没有效果的原因其实也不难解释,我们使用UpdatePanel的原因就是为了实现局部刷新,每一次刷新都是把UpdatePanel作为容器,既然是容器,它本身是不能动的,而让UpdatePanel不可见的另一种说法就是让UpdatePanel所生成的div从DOM中消失,既然刷新的容器都消失了,靠什么作刷新,简直就是在作白日梦~。

客户端解决方法
于是去MSDN论坛上搜了一把,确实有好几个贴子问到这个问题,但看到的回答基本都是加一段javascript,把UpdatePanel生成的div的display设置为none,这的确是一种可行的解决方式,但这种方式会造成服务器端和客户端的控件状态不统一(除非你打算自己写一段JavaScript代码更新服务器的状态),一旦作了full postback,用户有可能再次看到这个UpdatePanel。更何况,这样的隐藏代码通常要执行一些服务器端判断逻辑,都在客户端做恐怕达不到预期的效果。

提示
在ASP.NET中如果控件的Visible=false,整个控件就不会被呈现出来,即不会有任何的HTML元素(如span、div、a等)。

服务器端解决方法
首先想到的是UpdatePanel套Panel,既然没有办法自己刷新自己,那就让父UpdatePanel来刷新子Panel,从技术上讲这当然是可行的,但要注意一点,Panel所生成的div中不能有任何元素,且UpdatePanel不能设置宽度和高度。这是因为div默认情况下display为block,但如果没有宽度和高度,它就不会占据任何空间,否则就会充当占位符的角色。一旦把子Panel的Visible变成false,UpdatePanel及其子元素生成的代码如下所示:
<div id="UpdatePanel1"></div>

这就是我们需要的解决方法!

posted @ 2008-04-22 10:08 Tony Qu 阅读(418) | 评论 (1)编辑

Silverlight 2.0 通过OpenFileDialog动态加载本地图像文件

尽管Silverlight官方网站上都明确指出:出于安全原因,Silverlight不能访问本地文件系统。但是在Silverlight 2.0中有一个例外,就能通过OpenFileDialog来访问本地文件。

代码如下:

public void Button1_Click(object sender, RoutedEventArgs e)
{
    OpenFileDialog ofd = new OpenFileDialog();
    ofd.Filter = "JPEG Files (*.jpg;*.jpeg)|*.jpg;*.jpeg | All Files (*.*)|*.*";
    ofd.FilterIndex = 1;

    if (ofd.ShowDialog() == DialogResult.OK)
    {
        Stream stream = ofd.SelectedFile.OpenRead();
        BitmapImage bi = new BitmapImage();

        bi.SetSource(stream);
        Image img = new Image();
        img.Source = bi;
        bd.Child = img;

        stream.Close();
    }

}

其中,bd是一个Border控件,Button1_Click是一个按钮的Click事件处理程序。

使用起来和WinForm的OpenFileDialog差不多,这里就不详细讲解了。但要指出的一点是,根据Jeff Prosise的博客上的说法,这里我们本可以不用Border控件,而直接使用Image控件来实现,但是实验后发现,如果Image不动态添加,无法正确显示图像文件,不知道是不是Silverlight2的Bug,也有可能是我哪里没有设置正确,如果哪位兄弟觉得可以实现,请联系我。

演示代码下载地址为http://www.cnblogs.com/Files/tonyqus/Silverlight2OpenFileDialog.rar

posted @ 2008-04-08 09:43 Tony Qu 阅读(426) | 评论 (1)编辑

Silverlight 2.0 命中测试(HitTest)

对于某个对象的点击事件,我们可以通过Click、MouseLeftButtonUp、MouseLeftButtonDown来捕获,但是如果有几十个、甚至几百个这样的对象需要判断是否被点击,可能你就会觉得很不爽,因为你要添加同样数量的Button_Click或者MouseDown、MouseUp事件处理程序,更不用说有控件重叠的情况了(两个控件甚至有可能重合)。

Silverlight 2.0在这方面做了改进,引入了WPF的HitTest方法。使用起来还是比较简单的。例如,我们有一个Canvas叫做LayoutRoot(Canvas根元素),那么我们就可以使用下面的代码:

IEnumerable<UIElement> elements=LayoutRoot.HitTest(mousePt);

foreach(UIElement element in elements)
{

FrameworkElement fe=element as FrameworkElement;

...

}

这里的mousePt为鼠标的当前坐标,我想明眼人已经看出来了,这段代码是写在MouseDown或者MouseUp事件处理程序中的,你可以把它直接写在Root Canvas的MouseDown或MouseUp事件中,这样可以保证能够捕获并判断所有的鼠标点击事件,当然如果有其他需求,可以单独写在某个特定的容器元素的MouseDown或MouseUp中。

为了方便大家更好的理解HitTest,我写了一个小的sample,只要你的鼠标点击位置处存在Rectangle,下面的TextBlock就会把相应的Rectangle的Name显示出来。该代码在VS2008和Expression Blend 2.5 march preview下编译通过。

下载地址为http://www.cnblogs.com/Files/tonyqus/Silverlight2HitTest.rar

posted @ 2008-04-07 11:20 Tony Qu 阅读(1825) | 评论 (9)编辑

搭建Silverlight2.0开发环境

Silverlight 2.0已经发布了一段时间,很多朋友也许还未开始编写Silverlight 2.0的代码,本文将协助你搭建一个可马上投入Silverlight 2开发工作的环境。

 

基本安装

logo

Silverlight 2.0

下载地址:http://www.microsoft.com/silverlight/resources/InstallationFiles.aspx?v=2.0

Microsoft Silverlight Tools Beta 1 for Visual Studio 2008
 http://www.microsoft.com/downloads/details.aspx?FamilyId=E0BAE58E-9C0B-4090-A1DB-F134D9F095FD&displaylang=en
(如果不安装该软件包,VS2008无法打开Silverlight 2.0的项目文件)

安装设计软件

expressionstudio2betanw5

Expression Studio 2 beta (内带Expression Blend、Expression Design、Expression Media、Expression Web)

下载地址:http://www.microsoft.com/expression/products/download.aspx?key=studio2beta

boxShot_Blend

Expression Blend 2.5 March Preview

下载地址:http://www.microsoft.com/downloads/details.aspx?FamilyId=32A3E916-E681-4955-BC9F-CFBA49273C7C&displaylang=en 

 

安装开发软件

VSE_VS2008_Header

Visual Studio 2008 或Visual Studio 2008 Express

Visual Studio 2008 Express下载地址:http://www.microsoft.com/express/download/

 

FAQ

Q: 既然我有了Expression Studio 2,我还需要安装Visual Studio 2008吗?

A: Expression Studio主要由图形设计师和前台开发设计师使用进行图形设计和动画设计的,没有办法编写代码,所有项目中的.cs和.vb文件都是在Visual Studio 2008中进行编辑的。

Q: 既然ExpressionStudio 2中有Blend了,为啥我还要安装Blend 2.5?

A: 因为Expression Studio内带的Blend 2仅支持Silverlight 1.0的开发,不支持Silverlight 2.0(或者说没有内建的Silverlight 2.0模版),而2.5既支持Silverlight 1.0的开发,也支持Silverlight2.0的开发。

Q: Expression Studio的项目文件与Visual Studio的项目文件兼容吗?

A: 兼容,同一个项目既可以在Expression Studio中打开,也可以在Visual Studio中打开。

Q: 安装Expression Studio 2对机器配置有什么要求?

A: 参见http://www.microsoft.com/expression/products/SysReq.aspx?key=studio2beta

Q: 我的计算机是Apple Mac的,能否安装Expression Studio 2 beta?

A: 恐怕不行,因为只有Expression Media才支持Mac。

Q: 我可否不装Exression Studio 2 beta?

A: 可以,但是前提是你不准备使用Expression Design、Expression Media等软件作图形和视频编辑。目前除了Expression Blend有2.5预览版外,其他都是2.0版本。

 

如果你还有其他问题,请写在回帖中,我会及时更新!

posted @ 2008-04-06 20:43 Tony Qu 阅读(1110) | 评论 (4)编辑

[翻译].NET牛人应该知道些什么

原文地址:http://www.hanselman.com/blog/WhatGreatNETDevelopersOughtToKnowMoreNETInterviewQuestions.aspx 作者:Scott Hanselman
译者:Tony Qu

前些日子我发了一份ASP.NET面试题 清单. 有一些访客比较保守,觉得我是没事找事,里面都是些很琐碎的问题。剩下的人则说“蛮不错的,我得去看一看其中的一些问题” 我更喜欢后者的回复,我觉得后者才是正确的态度。

当然我并不想把.NET软件开发概括为一些简单的小问题,我只是想让大家多思考。我相信一个真正优秀的ASP.NET(及WinForm)开发人员应该不仅仅会拖放控件到设计器中,也应该掌握更多的东西。一个优秀的赛车比赛选手很了解他自己的坐驾,他知道哪些可以做?哪些不能做?

所以我准备了另外一份清单——一份扩展的清单,供你使用。这是我上个星期在从博伊西去波特兰的路上写在一块板上的,并且我也考虑到了那些觉得我的清单过于琐碎的意见,试图把这个清单按节管理。如果你从来没有深入ASP.NET,你肯定不会知道所有ASP.NET问题的答案。如果你是一个独立顾问,你可能从来没有遇到过这些概念。但在我呆在科林斯的这4年中,这些问题我都遇到过。因此,是否全面理解这些问题也许与你是不是一个优秀的开发者没有关系,但在遇到问题时它的确可以帮你节省不少时间。 

.NET牛人应该知道些什么?

任何一个使用.NET的人

  • 描述线程与进程的区别?
  • 什么是Windows服务,它的生命周期与标准的EXE程序有什么不同
  • Windows上的单个进程所能访问的最大内存量是多少?它与系统的最大虚拟内存一样吗?这对于系统设计有什么影响?
  • EXE和DLL之间的区别是什么?
  • 什么是强类型,什么是弱类型?哪种更好些?为什么?
  • PID是什么?在做系统的故障排除时如何使用它?
  • 单个TCP/IP端口上能够侦听多少个进程?
  • 什么是GAC?它解决了什么问题?

中级.NET开发人员

  • 阐述面向接口、面向对象、面向方面编程的区别
  • 什么是Interface?它与Class有什么区别?
  • 什么是反射?
  • 使用ASMX的XML Web服务与使用SOAP的.NET Remoting的区别?
  • 类型系统是由XMLSchema表示的吗?CLS是XMLSchema表示的吗?
  • 从概念上阐述前期绑定(early-binding)和后期绑定(late-binding)的区别?
  • 调用Assembly.Load算静态引用还是动态引用?
  • 何时使用Assembly.LoadFrom?何时使用Assembly.LoadFile?
  • 什么叫Assembly Qualified Name?它是一个文件名吗?它有什么不同?
  • Assembly.Load("foo.dll"); 这句话是否正确?
  • 做强签名的assembly与不做强签名的assembly有什么不同?
  • DateTime是否可以为null?
  • 什么叫JIT?什么是NGEN?它们分别有什么限制和好处?
  • .NET CLR中一代的垃圾收集器是如何管理对象的生命周期的?什么叫非确定性终结?
  • Finalize()和Dispose()之间的区别?
  • using() 语法有用吗?什么是IDisposable?它是如何实现确定性终结的。
  • tasklist /m "mscor*" 这句命令是干嘛的?
  • in-proc和out-of-proc的区别
  • .NET里的哪一项技术能够实现out-of-proc通讯?
  • 当你在ASP.NET中运行一个组件时,它在Windows XP, Windows 2000, Windows 2003上分别跑在哪个进程里面?

高级开发人员/架构师

  • DateTime.Parse(myString); 这行代码有什么问题?
  • PDB是什么东西? 在调试中它应该放在哪里?
  • 什么叫圈复杂度(cyclomatic complexity)?为什么它很重要?
  • 写一个标准的lock(),在访问变量的前后创建临界区,要有"双重检查",
  • 什么叫FullTrust?放入GAC的assembly是否是FullTrust的?
  • 代码加上需要安全权限的特性有什么好处?
  • gacutil /l | find /i "Corillian" 这句命令的作用是什么?
  • sn -t foo.dll 这句命令是干嘛的?
  • DCOM需要防火墙打开哪些端口?端口135是干嘛用的?
  • 对比OOP和SOA,它们的目的分别是什么?
  • XmlSerializer是如何工作的?使用这个类的进程需要什么ACL权限?
  • 为什么不提倡catch(Exception)?
  • Debug.Write和Trace.Write有什么不同?何时应该使用哪一个?
  • Debug Build和Release Build的区别,是否会有明显的速度变化?请说明理由。
  • JIT是以assembly为单位发生还是以方法为单位发生?这对于工作区有何影响?
  • 对比抽象基类和接口的使用
  • a.Equals(b)和a == b一样吗?
  • 在对象比较中,对象一致和对象相等分别是指什么?
  • 在.NET中如何实现深拷贝(deep copy)?
  • 请解释一下IClonable
  • 什么叫装箱?
  • string是值类型还是引用类型?
  • XmlSerializer使用的针对属性的模式有什么好处?解决了什么问题?
  • 为什么不应该在.NET中使用out参数?它究竟好不好?
  • 特性能够放到某个方法的参数上?如果可以,这有什么用?

C# 组件开发人员

  • 什么时候使用override?什么时候使用new? 什么叫shadowing?
  • 解释virtual、sealed、override和abstract的区别
  • Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d 解释这个字符串每个部分的重要性和作用
  • 解释public、protected、private和internal的区别
  • 使用Primary Interop Assembly (PIA)有什么好处?
  • NUnit是通过什么机制获知需要测试哪些方法的?
  • catch(Exception e){throw e;}和catch(Exception e){throw;}的区别
  • typeof(foo)和myFoo.GetType()的区别?
  • public class c{ public c(string a) : this() {;}; public c() {;} } 解释第一个构造函数中发生了什么? 这个构造函数有什么用?
  • this是干嘛用的?能够用在static方法中?

ASP.NET (UI)开发人员

  • 阐述一个基于浏览器的Form POST如何变成一个服务器端的事件,如Button1_OnClick。
  • 什么是PostBack?
  • 什么是ViewState? 它是否被编码过? 是否被加密过?谁会使用ViewState?
  • <machinekey>元素是干嘛用的?它用于哪两项ASP.NET技术?
  • 说出ASP.NET 1.1中的3种Session State提供程序以及它们的优缺点?
  • 什么叫Web Gardening? 在设计中如何使用它?
  • 假设有一个ASP.NET应用程序,那么单独一个进程中允许多少应用程序对象?那两个进程呢?启用了Web Gardening的2个进程呢?这对设计有何影响?
  • ASP.NET会重用多个请求之间的线程吗?是否每个HttpRequest都有自己的线程?你是否应该用ASP.NET的Thread Local存储?
  • [ThreadStatic]属性在ASP.NET中有用吗?它有没有副作用?是好是坏?
  • 如何使用HttpHandler简化现有的为.aspx页面提供验证图片的设计
  • HttpModule订阅的是什么类型的事件? 这对于实现有何影响?如果不打算重新编译ASP.NE应用程序,应该怎么做?
  • 说出表示任意一个终端(URL)的方式,以及ASP.NET中把请求路由到那个终点的方式
  • 解释cookie的工作原理。给出一个滥用Cookie的例子。
  • 解释HttpRequest.ValidateInput()的重要性?
  • 哪些数据是通过HTTP Header传递的?
  • 对比HTTP动词GET和POST? 什么是HEAD?
  • 说出至少6个HTTP状态码以及它们的含义
  • if-not-modified-since的工作原理是什么? 用ASP.NET如何实现它?
  • 解释 <@OutputCache%>和如何使用VaryByParam、VaryByHeader.
  • VaryByCustom是如何工作的?
  • 如何通过q=? (除了q=5)来实现ASP.NET HTML输出缓冲和缓冲过期(比如http://localhost/page.aspx?q=5)?

XML开发人员

  • XML命名空间的作用?
  • 何时适合使用DOM?何时不适合?有没有尺度限制?
  • 什么是WS-I基本配置?它重要在哪里?
  • 写一个小XML文档,其中使用的是默认的命名空间,以及一个合法的(前缀)命名空间,其中要有分别属性这两个命名空间的元素
  • 元素和特性的基本区别在哪里?
  • 格式完好的XML和有效的XML有什么区别?
  • .NET中如何验证XML?
  • myXmlDocument.SelectNodes("//mynode"); 为什么这句代码不好?什么时候它是好的?
  • 拉式解析(XmlReader)与事件读取器(Sax)的区别
  • XPathDocument和XmlDocument的区别? 在何种情况下应该用哪一个?
  • “XML片断”与“XML文档”有什么区别
  • 什么叫格式规范的XML?
  • XML InfoSet规范与Xml DOM有什么不同? InfoSet是要解决什么问题?
  • 比较DTD和XSD,它们的相似点与区别分别是什么?哪个更好些?为什么?
  • System.Xml支持DTD吗?如果支持,如何使用?
  • XML Schema能够表示为对象图?对象图能够表示为XML Schema?

posted @ 2008-02-22 15:05 Tony Qu 阅读(1093) | 评论 (4)编辑

猎头招聘: 北京 Senior Software Engineer

有兴趣的请通过以下方式联系我朋友:

Tel:010-87665001/87665115-609
MSN:fangfang_0523@hotmail.com
E-mail:  Tina@phrt.com.cn

POSITION NAME:

Principle Software Engineer or Senior Software Engineer

REPORTS TO:

Technical Team Manager

DEPARTMENT:

ADD

LOCATION:

Beijing

JOB DESCRIPTION – DUTIES AND RESPONSIBILITIES

Data Collection Development comprises several teams who are responsible for the development of real-time systems that collect data from stock exchanges and produce value added data. This data is critical to hundreds of thousands of customers around the globe. A Software Engineer in Data Collection Development is to design, develop and maintain data collection/value adding applications and system software. This role involves programming the well documented Fixes in C#. The Fixes plug into and interact with a central Fixing Engine providing standard interfaces and functionality. The individual fixes take data from internal Reuters databases via the fixing engine and apply fix specific processing. The fix follows a state machine type implementation and outputs results and status back through the engine interface.

The Principle Software Engineer is responsible for:

l Analyze customer and internal requirements for new or enhanced financial data or infrastructure products;

l Design software solutions to address assigned data requirements;

l Generate/participate in the production of designs and assess ‘best fit’ solutions for infrastructure requirements with particular regard to conforming to Reuters process and technical standards, as well as meeting the parameters of performance, reliability, time to market and costs (development, operational, support);

l Participate with others in the development, testing and implementation of solutions;

l Produce documentation according to current process standards (e.g. requirements, design, functional specifications, release notes, operations guides, test plans etc.);

l Participate in meetings to identify and solve problems before, during and post implementation;

l Participate in the planning process to create project implementation plans;

l Conduct user training and assist system implementation when necessary;

l Participate in service support for production systems;

l Maintain an up-to-date knowledge of technology, its current developments, especially those appropriate to Reuters and use that knowledge in conjunction with Reuters architectures to design appropriate solutions and transfer that knowledge, as appropriate, to other Reuters employees;

l Function as a domain expert and act as a coach on various aspects of data collection. Mentor junior members of the development team. Take on role of moderator or reviewer during formal peer review sessions;

l Identify ways to improve the operation of own area and to achieve efficiencies and results;

l Provide status updates for projects;

l Complete the objectives of each assignment within the agreed timeframe;

l Work with onshore partners and process team to ensure all processes conform to the standards defined for the development centre;

JOB SPECIFICATIONS – REQUIRED SKILLS, KNOWLEDGE AND EXPERIENCE

Technical and/or Functional skills

Mandatory skills

· Degree in Computer Science or other computer related subject with experience developing system software;

· Strong knowledge of C# (.NET Framework 2.0 under Windows Server 2003)

· Strong programming experience in other computer language such as VC++, COM under Microsoft Windows Server 2003 is a plus)

· Object-oriented design (OOD) methodologies using UML and Design Patterns;

· Real-time and multi-threaded software design and development, using Win32 Threads;

· Full project life-cycle development experience, including using configuration management tools like SourceSafe.

· Experience in development using IP based networking protocols (TCP/IP, UDP), exposure to any middle-ware is a plus.

  • Practical knowledge of standards covering coding, testing and documentation and have an understanding of commonly used design standards and methodologies;
  • Experience of managing several project initiatives concurrently;
  • Experience of geographically distributed and multi disciplinary project steams;

· Excellent communication skills including technical writing and presentation skills;

· Excellent written and oral communications skills (English)

· Ability to solve complex problems in a real-time production environment

· Ability to estimate work efforts for complex technology implementations, and meet deadlines.

Other useful skills

· Exposure to the mission-critical real-time software in the financial sector;

· Real-time software design and development;

· Willing to work late for teleconference with overseas developers occasionally, to provide technical support over telephone to assist first and second level support, round the clock;

  • Structured design methodologies;
  • Financial Markets, Experience in Reuters SSL, Network and communication protocols EG. TCP/IP and Market-feed;

The ideal candidate would have the following attributes:

  • Self-motivated, co-operative team player;
  • Good timekeeping;
  • Ability to work effectively on several projects simultaneously;
  • Determination;
  • Commitment;
  • Methodical and organised;
  • Good attention to detail;
  • Ability to work under pressure.
  • Strong interpersonal skills.

posted @ 2008-02-19 16:45 Tony Qu 阅读(569) | 评论 (1)编辑

支付宝实名制实现思路

随着网络的普及,网站实名制已经被列入政府的工作日程,尽管很多人觉得网络就应该足够自由,而不应该采取类似户籍制的制度,因为这样可能导致网络版文字狱的出现,当然本文不想涉及任何政治问题,也不想就网络是否应该采取实名制展开,本文纯粹是一篇关于业务需求实现的文章 :)

淘宝的银行卡认证其实就是实名制认证,原理很简单——用户输入一个银行卡号和对应的真实姓名,然后支付宝向那个银行卡汇入一笔几分钱的金额作为认证信息,接着用户查看自己的银行帐号获得那个金额(比如说0.13元),最后用户在以下界面中输入看到的金额,身份认证流程结束!

alipay_identity

请注意,在此过程中有一个细节:银行汇款是需要持卡人的真实姓名的,如果姓名不对是不可能成功汇款的,这就是关键!

为什么用银行卡,而不用身份证?这是因为到目前为止身份证的网上验证仍然没有普及,大量的身份证刚刚转成数字身份证;即使身份证都已经数字化了,这些信息普通的网站根本无法访问到,更不用说身份证号和姓名的验证了,这样会造成一系列的技术壁垒和限制,毕竟这些信息涉及到国家安全,如果存在访问接口就很难保证不被黑客攻击甚至侵入核心数据库的可能,这是政府绝对不允许的,毕竟谁敢说Web Service这样的技术一定安全!其实自Web Service推广以来安全问题就是讨论的热门话题,虽然这一技术的确提高了系统的可扩展性,降低了耦合度,但是有得必有失,即使是加密过的数据包也很难保证不被强行破解。

但说到这,很多人会问,那银行卡的信息就能随便访问吗?当然也不能!但有一个例外,就是银行卡的受益人自己,但是又有另外一个问题了:谁能保证注册银行卡使用的是真名?是的,没错,但要注意——使用支付宝的人他们的动机是什么,自然是买东西和卖东西,如果名字是假的,那么使用的身份证也是假的(银行卡注册时是需要出示身份证的),但这种情况多吗?大部分人还不具有制造假身份证的能力,这是违法的,而且也没有太大的必要,除非是那些拥有大量灰色收入、不愿意让别人知道的人。

其实淘宝的成功有相当一部分功劳要归功于实名制,当然实名制也不是万能的,我们仍然会听到一些买家被骗取钱财的情况,但是这毕竟是少数,而且那些骗子仍然要通过银行来获得脏款,其实很多大数额的网络诈骗案都是通过银行闭路电视破获的,所以建议那些骗子还是量力而行。当然我不是鼓励他们犯罪,这就好像有些老公是很色,但是有色心没色胆,一样是好老公,其实道理都是一样的,呵呵,大家自己体会吧!

posted @ 2008-02-19 11:59 Tony Qu 阅读(2521) | 评论 (8)编辑

Silverlight 1.0中实现全屏布局调整

全屏对于用户体验还是很重要的,虽然在网上已经有讲如何实现全屏的文章了,但不是很全面,也没有讲到onFullScreenChanged事件,在此就当作个学习笔记。

创建Silverlight插件的代码在此就不详细讲解了,如果大家有啥不清楚的,可以去看silverlight 1.0 SDK中的QuickStart教程。我们首先来添加一个onLoad事件的事件处理程序,叫做myLoad,如下面红色代码所示:
function createMySilverlightPlugin()

    Silverlight.createObject(
       
"myxaml.xaml",                  // Source property value.
        parentElement,                    // DOM reference to hosting DIV tag.
        "mySilverlightPlugin",         // Unique plug-in ID value.
        {                               // Per-instance properties.
            width:'400',                // Width of rectangular region of
                                        // plug-in area in pixels.
            height:'400',               // Height of rectangular region of
                                        // plug-in area in pixels.
            inplaceInstallPrompt:false, // Determines whether to display
                                        // in-place install prompt if
                                        // invalid version detected.
            background:'#00FFFFFF',       // Background color of plug-in.
            isWindowless:'true',       // Determines whether to display plug-in
                                        // in Windowless mode.
            framerate:'24',             // MaxFrameRate property value.
            version:'1.0'               // Silverlight version to use.
        }
,
       
{
            onError:
null,               // OnError property value --
                                        // event handler function name.
            onLoad:myLoad                 // OnLoad property value --
                                        // event handler function name.
        }
,
       
null);                          // Context value -- event handler function name.
}

然后我们添加对应的myLoad函数:

function myload(control,context,root)

control.Content.OnFullScreenChange 
= onFullScreenChanged;
}

这里的control表示整个插件对象,在实际开发中我们经常会用到这个对象。在这里我们为OnFullScreenChange添加一个相对应的事件处理函数,叫做onFullScreenChanged,这个事件会在每次全屏状态改变时触发,有了它你才可以在全屏切换时对控件的布局进行调整,从而适应容器大小的变化,使用户体验趋于完美。例如你可以把一些原本在非全屏下显示不下的内容展开,一旦从全屏切换回非全屏,再把这些内容折叠起来。

为了让大家能够更清楚地看到Silverlight Control尺寸的变化,我特地在myxaml.xaml中增加了两个TextBlock:text1和text2,分别显示宽度和高度。在没有全屏时,由于设置了width:400和height:400,所以一开始是400*400。请注意,这里所说的宽度和高度是指Silverlight Control的宽度和高度,与myxaml.xaml中Canvas的宽度和高度无关,这也是学习Silverlight时一个比较容易混淆的概念。

myxaml.xaml中有个Ellipse,其MouseLeftButtonDown事件与fullscreen函数相对应,而fullscreen中就是切换全屏的代码,如下所示:  

function fullscreen(sender, keyEventArgs)
{
    sender.GetHost().Content.FullScreen 
= !sender.GetHost().Content.FullScreen;    
}

在onFullScreenChanged函数会更新那两个TextBlock为当前的宽度和高度值,同时还会计算Canvas的居中位置,并对Canvas的位置作调整,代码如下:

function onFullScreenChanged(sender, eventArgs)
{
    control
=sender.getHost();
    control.content.findname(
"text1").Text=control.content.actualWidth.toString();
    control.content.findname(
"text2").Text=control.content.actualHeight.toString();
    circle1
=control.content.findname("circle1");    
    
    tleft
=(control.content.actualWidth-circle1["Width"])/2;
    ttop=(control.content.actualHeight-circle1["Height"])/2;
    tleft=tleft>0?tleft:0;
    ttop
=ttop>0?ttop:0;

    circle1[
"Canvas.Left"]=tleft;
    circle1[
"Canvas.Top"]=ttop;
}

这里的sender.getHost()很有用,用它你能够轻易的获得Silverlight Control 对象实例。

最后,我把源代码放上来,讲得不清楚的地方大家可以看源代码。
源代码下载地址:http://www.cnblogs.com/Files/tonyqus/fullscreen.zip

posted @ 2008-02-14 17:42 Tony Qu 阅读(507) | 评论 (0)编辑

再谈招聘信息

招聘信息的重点在于“信息”两字——无论是求职者、HR还是猎头,理解招聘职位的要求和所在部门的职能至关重要,有的时候就连HR自己也不清楚这个部门到底是干嘛的?招的人是做什么的?因为是Team Manager告诉她要招的,JD也是人家给的,她只不过负责整理和发布招聘而已,所以有时会出现很多“不对口”的candidate,很多猎头甚至觉得招聘的要求纯粹是理想状态,只要满足一两条的candidate就推荐了。当然这不能全怪猎头,确实有多方面的原因,比如说有些部门经理招人总把能与部门沾上边的技术都写上去,这样就会显得部门很有档次,招进来的人质量也会比较高,但其实并不是这样的;还有些HR则把她所知道的技术名词(其他她根本不懂),反正多写没有错的!这种招聘通常喜欢把 这与“传话游戏”差不多,涉及的人越多,理解越容易出现偏差,特别是当HR遇到了太多的不符合要求的candidate之后,他就会考虑是否要降低门槛,所以才出现所谓“理想状态”的说法。

好吧,现在就让我们重新审视一下招聘信息。在招聘信息中,我们经常会看到公司或部门介绍,这样的介绍可以告诉我们这个公司或部门的一些业务及职责,比如下面就是微软CPG部门的介绍:

CPG及其开发维护的Commerce Platform系统为微软内部的其他各大在线部门提供完整的商务方案。这些部门包括:AdCenter,Xbox Live,Office Live,OneCare,Zune,Windows Marketplace,Windows Live Mail,  MSN等。Commerce Platform系统帮助微软内部的其他事业部解决复杂的商务逻辑、数据安全与恢复、与银行、第三方支付网关和信用卡联盟的集成, 用户交易数据的处理与分析等基础架构问题,同时提供丰富的跨越多平台的一致用户体验。未来,Commerce Platform也将逐渐将一些功能开放给微软外部,例如:我们从技术上将支持第三方网站作为合作伙伴推广Microsoft Points;我们将为第三方电子商务网站提供网上支付方案和相关合作,从技术上实现更具有吸引力和更便捷的优惠与现金返还 等等

这段描述告诉我们:CPG目前仅提供内部商业解决方案,但其产品暂不对外,但不排除与其它产品或服务捆绑销售的可能。同时,“未来,。。。”告诉我们,该部门将逐步为微软外部提供在线支付方面的解决方案,也许在未来5年里我们将看到带着Microsoft标志的支付平台,就像支付宝、贝宝一样。对于竞争对手而言,这样的信息意味着什么——这表示新的竞争对手正在招兵买马,需要做好应战准备了,还要防止恶意挖人的情况发生。

有时一些招聘中的要求也会反映出一些很细节的信息,特别是preferred或者plus的技能,比如:

Your experience in Flex/Flash, ActionScript3, VML, SVG is a plus.

这表示该公司使用Flash作为前端呈现引擎,同时还用到诸如VML, SVG这样的三维模型描述语言,也许有虚拟现实或电子地图之类的项目。

Experience of writing software in a technology R&D environment is a particular advantage

Experience with analytical instruments for example electron microscopes, X-ray spectroscopy or crystallography techniques.

这表示这个职位需要像微软研究院这样的机构的经验,也许他们是搞科学仪器、医疗仪器设计和制造的,下面还提到要有一些精密分析仪器的使用经验,看来的确是研制仪器的科研机构。

从以上例子不难发现,一个优秀的猎头、HR知识必须广博,我们并不要求他们精通招聘上说的那些技能,但必须知道这些术语到底指什么,用在哪些方面,比如说前面提到的VML和SVG,这两样东西如果不知道是什么,是很难搞清楚到底需要哪方面的人的(尽管不是必须的)。更何况应聘者的简历上也许没有提到这两个词,但从经验中可以推断出他的确接触过这种技术,这其实叫做技能/经验的模糊匹配,当然这不是本文要阐述的重点,就不做展开了。作为求职者,也必须懂得量力而行,不可无乱投简历,这样只会让你的简历变成垃圾邮件——也许HR看都不看就删除了!

posted @ 2008-02-14 13:24 Tony Qu 阅读(691) | 评论 (2)编辑

[猎头急聘] 上海:软件开发培训专员/技术培训师

联系信息
Katrina Wen
katrina@jmep.com

Tel: 86-28-6882-2790


软件开发培训专员
/技术培训师

Software Training Specialist/Technical Trainer

工作地点 上海

职责描述 · 制定公司产品的培训工作规范、流程和培训方案、计划;

· 组织公司产品对内和对外的培训事务,包括需求调研、资料和场

地设施等准备工作;

· 实施培训事务,包括课程讲授、疑难解答、结果考核等;

· 跟进培训效果,包括满意度调查和改进培训课程。

任职资格 · 本科或以上学历,计算机及相关专业;

· 良好的英语听、说、读、写能力,CET6或英语专业八级

· 2年及以上软件技术培训或软件开发的相关工作经验;

· 精通基于J2EE架构的Java核心语法、Java Web 编程及EJB级编程, 熟悉Oracle数据库开发、SQLPLSQL。熟悉UML

· 良好的培训管理及授课能力;

· 具有较强的个人影响力及沟通协调能力。

posted @ 2008-01-29 11:59 Tony Qu 阅读(553) | 评论 (2)编辑

[猎头招聘] 南京的职位

对以下职位感兴趣的请联系温小姐:
Katrina Wen

Tel: 86-28-6882-2790
MSN: wenyinting(at)hotmail.com
Email: katrina(at)jmep.com

1.QA Manager

Job description:
Manages, perhaps through subordinate leads/supervisors, the coordination of the activities of one function or department with responsibility for results, including time, costs, methods, staffing, and policy compliance.

Requirement:

1. Demonstrated experiences in team leading, quality improving and member growing

2. Hands-on test planning and enforcement based on customer and development requirement

3. Product quality risk/index analysis for decision making of product release

4. Strong testing, management, problem solving, communication and decision making skills

5. 2+ years managing test teams


2.Senior Quality Assurance Engineer

Job Description:

1.Test planning and test feasibility study, in parallel with the progress in product development plan and design stage

2.Test environment design and build up, based on the product goals in customer's requirement

3.Design product test strategy and methodology in performance, stress, volume and etc.

4.Automate the testing and improve the test efficiency

5.Test case design, execution, and bug submission, reporting, and issue follow-up for bug resolution

6.Design and analyze test quality with measurable metrics to ensure and improve the quality of the test process and deliverables

7.Provide product quality report, quality analysis for product release and further improvement plan

8.Deliver quality training and documentation for product supporting and sustaining


Requirements:

1.Capable in writing, reading email, tech document. Good spoken English to participate meetings is prefered

2.Experience in test improvement as test automation or system administration in internet/intranet or security is preferred

3.Familiar with software testing; QA; windows/unix plateform


3.Senior SQA

Job Location:Nanjing, China

Job Responsibilities: Work closely with software development, service, market teams ensure Trend process to be executed properly; Help project manager to mitigate project risks via process education, experience sharing and best practice adoption; Audit projects to ensure standards compliance; Measure and evaluate product quality, and facilitate root causes analysis of project issues; Facilitate and advocate product quality improvement through continuously process improvement.  Required Qualification: MS/BS in Computer Science or related field; 5+ years experience in software development industry, and 2+ year in SQA or Project Management areas are required; Strong inter-person skills such as communication and coordination among functional groups and product development teams; Quick learner and be able to adapt to flexible and result-oriented environment; Self-motivated and able to work independently; Software engineering or SEI CMM knowledge is a plusGood at Communication, Fluent oral English


3.Software Engineer  


Description:


1. Write functional specifications based on directions and requirements

2. Develop software modules from design specification.

3. Problem solving and troubleshooting against submitted cases from QA or customer

4. Conduct unit tests and integration tests to ensure best product quality.

5. Apply learned technical knowledge to improve software development process.

Requirements:

1. Solid experience with C++ development under Windows or Linux

2. Indepth knowledge of network infrastructure and communication

3. 2+ years experience of software developers

4. Detail oriented, analytical with excellent problem solving and troubleshooting abilities

5. Self-motivated, can work with minimum supervision

6. Indepth knowledge of network infrastructure and communication


Prefer

1. Knowledge about Solaris and other Unix platforms

2. Familiar with product development lifecycle and process

3. Exposure to C# would be an asset


4. Buildmaster 


(在其他公司职位叫配置管理,不同点在于我们对于其开发语言和工具掌握要求更高些, 希望有开发或测试2年以上经验,1年或以上配置管理经验)

Job Responsibilities:

o Administrate and maintain the product autobuild environment.

o Develop and integrate the supporting tools of build automation system.

o Write automation scripts to realize product build process.

o Proactively communicate with developers in understanding the needs, and help on troubleshooting.

o System administration for Perforce, TeamTracker and other servers for SCM.

o Internal web tools development and maintenance.

Required Qualification:

o Knowledge in Windows systems, Linux, TCP/IP, and Networking services is required.

o Familiar with C/C++, Perl, Unix/Linux Shell, web developing.

o Ability to communicate effectively in English.

o Aggressive working attitude with a friendly manner and customer insight.

o Willing to take challenges and being systematic in follow-up.

o 3+years software related work experience.

o Experience of SCM is preferred.


5. Research Engineer / Researcher 
Description:
We have one position opening at the Senior Engineer/Research Engineer level.
In this position you will be responsible for seeking for research topic & doing research on new technologies in security domain. 
As part of the China Research Team, you will have chances to evaluate various research topics, and be responsible for conducting the selected research projects, and transfer the knowledge obtained and prototype developed to the product teams. You will face the varying technical challenges and share the great success with you team mates.
Requirements:
1) PH.D or MS in Computer Science, Math or related fields.
2) 3+ years overall experience in security domain
3) Knowledge/Experience on Computer Language, Operating system and Network Security
4) Excellent written and verbal English & Chinese communication skills.
5) The candidate should be fast leaner, self-started, then can work independently under the team's full support.
Prefer
  with real experience on database security solution is highly preferred
1) Knowledge/Experience on Statistics Analysis, Artificial Intelligent, and Data Mining
2) or Knowledge/Experience on Anti-Virus / Anti-Spam / Anti-Spyware / Anti-Phishing
3) or Knowledge/Experience on Vulnerability Assessment / Penetration test / Reverse engineering
P.S. 有产品原型开发经验,有安全领域经验

posted @ 2008-01-17 14:24 Tony Qu 阅读(655) | 评论 (2)编辑

如何写招聘

最近看到院子里的不少兄弟创业了,我个人还是很支持他们的,相信大家作了身份转换之后,是不是觉得有些不习惯,原来是人家面你,现在是你面人家,而且还要自己决定招聘些什么人,是否值得招聘这些人。

我平时接触的猎头和HR相对多些,说起来俺也是个兼职猎头(虽然业绩不太好),因此看过不少的JD(Job Description),对于招聘的套路我还是比较熟悉的,所以写篇文章出来,给兄弟们晒晒经验。

存在问题的JD

例1:你必须熟悉VB.NET/C++/C#/Perl/PHP/ASP/JavaScript等语言
点评:nnd,这哪是招人阿,简直就是招畜牲,啥都要会,摆明着人手不够,进去做义务工,经常加班,待遇也不高,如果你写出这种招聘等于砸自己公司的招牌,大公司的招聘绝对不会这么无理取闹。

例2:精通.NET,熟悉Java者优先
点评:这个就是我最近看到的一份JD上写的,搞什么东西,两个阵营的东西,怎么能够一起招,我们不需要全才,这种招聘也是那种希望节省成本的小公司贴出来的,既然你要Java的人就干脆再招一个。

例3:精通.NET、精通SQL Server
点评:这种写法似乎司空见惯,大家可能会觉得这种招聘要求似乎没有问题,其实不然!我们都知道对于一项直接技能通常有三种描述:了解、熟悉、精通,但你仔细想想就会明白,所谓的精通是仁者见仁智者见智的!比如说对于一个搞普通MIS开发的人(没有涉及过BI),他会觉得你懂得聚集索引、对SQL语句十分熟悉等就已经算精通了,但是对于一个搞过BI的人,之前的技能水平在他看来只能算“熟悉”,有些高手甚至觉得那只能算“了解”。

又比如说,如果微软的招聘上写精通.NET,那你就得好好掂量一下自己够不够格了——要熟悉MSIL、熟悉底层.NET实现、会用windbg SOS调试.NET程序,而不仅仅是会用.NET自带的高级数据结构类写.NET程序。

对于这种招聘要求,我个人的建议是把需求写详细了,比如了解MSIL、熟悉Reflection等类似的描述,这样会显得专业许多,也可以让来面试的人心里有个数,不懂这些的人也不会跑到你这来撞枪口。

例4:懂UML
点评:这种招聘要求写了就和没写差不多——这个“懂”字学问大了,认得UML图标也是懂,会画UML类图也是懂,会画时序图也是懂,这还不如写“了解”、“熟悉”、“精通”。

例5:只招重点大学或参与211工程的大学毕业的人
点评:这种招聘其实就是在搞“种族歧视”,难道不是重点大学毕业的就没有人才,这分明是那些原本就是重点大学毕业的领导“回馈母校”的做法!个人觉得不可取,人才是没有地域、种族、阶级之分的,什么时候开始按学校划分了,一些优秀的人才(虽然是少数)可都是不知名的大学毕业的,这样子只会让你与这些顶尖人才擦肩而过。另外,从我个人的经验来看,有些重点大学毕业的人(这里就不点名了)素质差也就算了,还自命清高,自认为自己学校很好,就开始乱来了~~遇到这种人,我理都不想理~说句不好听的——还不如我们的民工兄弟,人家至少朴实、实在。

如何写一份好的JD

写一份招聘前先要想清楚以下几个问题:
1. 人手不够吗?是否真的需要招人?
2. 为什么要招这些人?招进来后他们的价值体现在哪里?
3. 招的人需要具有哪些技能?(对于技术人员的招聘最好具体到某项具体技术,如.NET Reflection、ADO.NET等)
4. 对于应聘者的前提筛选条件或者限制?(如x年工作经验、学历、性别、年龄、身体状况等)

如果你把这些问题都想清楚了,基本上能够写出一份很专业的JD了。

我们可以利用项目管理软件来做分析(如Project 2007),看你的资源使用表中有没有人过载了,如果看到某个人的被使用率已经达到200%,那肯定要招人了,总不能把人家当畜牲用吧~~另外,你要了解你这种项目计划或分析结果的误差是多少,我曾经在一个部门中就遇到过这样的情况,明明大家都很忙(至少要加1小时班),但报给领导的labor hour通常只占工作时间的70%,有些时候并不是说大家都在玩,而是很多时候很难估计出真正用了多久去思考问题、解决问题,你不可能在开始思考问题时启动一个Timer是吧~所以这就是问题所在。作为领导,如果你不能体察到员工的“民怨”,那你只有被唾骂的份!要深入群众才能真正知道员工有多忙~另外不同level的人完成工作的速度也是不一样的,只看报表只会得出错误的结论,从而做出错误的决定!

说到人的利用率不得不说一下加班问题,目前IT行业普遍存在加班问题,据说每个人的使用率都至少在130%,汗一个!不知道什么时候这成为了行规,无理取闹!老板们只知道督促你早点上班,不要迟到,却不知下班的时候让你早点走(至少我没遇到过让你早点下班的老板),就拿我目前部门的领导来说,规定了9:15一定要到,说实话我觉得很奇怪的——你怎么不多写一句:18:15必须走,nnd,更何况我们公司是美国企业,应该是很free的style,美国的同事都是保证做满8小时,但绝对不会多的!我倒不是鼓励大家迟到,其实大部分人还是很自觉地,何必弄个这种规定呢,其实下面的人意见都比较大,只是不方便说,哎,俺领导的素质有待提高~~

当然有些公司的领导是拍脑袋招人的——“哦,好象可以招几个人嘛”,这也是不可取的,作为企业自然是要把资源最大化利用,而不是让资源过分闲置,所以通常情况下,外企的话招人还是比较慎重的,当然资金多的话养几个闲人问题也是不大的,呵呵:)

posted @ 2008-01-15 05:31 Tony Qu 阅读(1869) | 评论 (8)编辑

程序员的必备装备——为健康加油

     摘要: 身体是革命的本钱,有健康的身体才能事半功倍,程序员绝对不是民工!我们要学会好好生活、好好保重身体,这不仅是为了你自己,也是为了你的家人、朋友、老婆、孩子。  阅读全文

posted @ 2007-12-29 11:56 Tony Qu 阅读(2595) | 评论 (28)编辑