2009年3月26日星期四

March 27th Links:ASP.NET,JAVASCRIPT,C# Using,Delegate,SQL SERVER

ASP.NET
    where compilation seems to mysteriously( 不可思议的) pause for 30+ seconds(or even minutes),before continuing each time you do a build or F5 of the project.VS2005 Web Sites will copy the assembly picked into the \bin directory of the project as well as(by default) add a .refresh file into the \bin directory that contains a relative path string that points back to the original assembly path location.When you build the solution,VS will automactically check those assembiles with .refresh files to see if a newer version of the assembly is available,and if so automatically re-copy the assembly and re-compile the solution using it.
    1) So Which Project Option Builds Faster?
    When doing full builds of projects,the VS2005 web application project options will complie projects much faster that the vs2005 web site

C#

JAVASCRIPT

SQL SERVER

.NET Framework

Other

English
    1. fledged: 成熟的
    2. unobtrusive: 不打扰的
    3. scratch the surface: 冰山一角

2009年3月25日星期三

March 25th-26th Links: C#,Silverlight,Effective Web Developer,HTML Editor

ASP.NET

C#
    Definition: Extension Methods allows us to define new methods on existing types,which can be either .NET type or use defined class.We can define new methods without extending or deriving existing type.
    Restrictions: If there is an already existing method with same signature as extentsion method in a type. Than, extension method will be ignored and never called.Fist,it looks for inbuilt method.if it won't find a match,it will look for extension method.if it is not there,it will throw an error.

Javascript

JQuery

Silverlight

Other
    ASP.NET
    IDE: Visual Studio 2008 Express
    Unit Testing: NUnit
    Mocking: Rhino Mocks
    ORM: NHibernate
    MVC: ASP.NET MVC
    Javascript: JQuery

2009年3月21日星期六

March 22th-23th Links: .NET Framework,Silverlight,SQL Server

1. .NET
    3) What is .NET RIA Services?

2. Silverlight
    Here's the source to the WriteableBitmap sample I showed at Mix.The sample uses WriteableBitmap to take a "snapshot" of the running video to make a thumbnail

3. SQL Server
    1) Index Maintenance 
    if your indexes are less than 30% fragmented(碎片) than you can run a DBCC INDEXDEFRAG else rebuild.

English
    1. Resemble:相似,像
    2. Encounter:遇到,偶遇
    3. Revealed:透露,显示
    4. overlap: 重复,重叠
    5. rectangle: 长方形,矩形
    6. ellipse: 椭圆
    7. replicate: 折叠,复制

2009年3月18日星期三

March 19th-21th: C#,SQL SERVER,Silverlight 3

C#
    bad:
    1) No two consecutive(连续的) empty lines
    2) No empty line before a closing curly(卷发的,弯曲的,大括号)
    3) No empty line after an opeing curly
    good:
    1) one empty line between same level declarations.
    2) one emtp line between members of a type
    3) one empty line after #region and before #endregion
    Ruby's send functionality is that being able to dynamically invoke a method on an object like this:  
thisobject.Send("Foo",1,2,3);
Web
    Yesterday we released a new people selector widget on Flickr.This widget downloads a list of all of your contacts,in javasript,in under 200ms(this is even for member with 10,000+ contacts).In order to get this level of performance,we had to completely rethink how we send data from the server to the client.
    1) Server Side:Cache Everything
    2) Testing the Performance of Differenct Data Formats
      a) JSON,Eval() is Slow
      b) JSON and Dynamic Script Tags: Fast but Insecture

Silverlight

SQL SERVER
    One way to script the Stored Procedures of your SQL SERVER2008 databse is to use the SQL SERVER Management Stuio(SSMS).
    1) Open SSMS > Your Database > Programmablility > Stored Procedures > Right Click Stored Procedure Name > 'Script Stored Procedure As' > 'Creat To'
    2) Or Complete the same task using below T-SQL:

USE NORTHWIND
SELECT obj.Name as SPName,
modu.definition as SPDefinition,
obj.create_date as SPCreatinDate
FROM sys.sql_modules modu
INNER JOIN sys.objects obj
ON modu.object_id = obj.object_id
WHERE obj.type = 'P'
    2. Find All Servers From Local Network- Using sqlcmd- Pinal Dave
    1) Go to command prompt and type in "osql -L" or "sqlcmd -L"
    
CREATE TABLE #servers(sname VARCHAR(255))
INSERT #servers(sname)
EXEC master..xp_CMDShell 'ISQL -L'
DELETE
FROM #server
WHERE sname = 'Servers:'
OR sname IS NULL
SELECT LTRIM(sname)
FROM #servers
DROP TABLE #servers
Other

2009年3月17日星期二

March 17th:C#,Debug,HTML

C#
    This post touches on four major expression subjects:
    1) String Comparison - does a string contain a particular sub-string?
    a. finding valid HTML tags- RegEx.Matches return MactchCollection
    valid html tags: Regex HTMLTag = new Regex(@"(<\/?[^>]+>)");
    2) Splitting a string into segments(分割,部分)- we will take an IPv4 address and retrieve its dotted components
    a. splitting decimal Tcp/IP address looks like xxx.xxx.xxx.xxx with x being a decimal number
    Regex tcpIp = new Regex(@"(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})");
    3) String Replacement
    4) Substitution Patterns
    5) Stricter input validation- how to harden your expressions
    1) The ? conditional evaluation operator
    example:int max = (x > y) ? x : y;
    2) Null-Coalesce(合并,联合) operator(??)
    example:obejct e = ( c != null ) ? c : d; => object e = c ?? d;
    3) Object Initializers
    Customer c = new Customer{ Name="James",Address="204 Lime Street"};(c# 3.0)
    4) The using statement
    5) Aliases(别名) for long winded namespaces and types
    example: using Word = Microsoft.Office.Interop.Word;
                     Word.Application = new Word.Application(){ Visible = true};
    6) Nullable objects
    example: Nullable x = null;
     int? x =  null;
    7) Automatic Properties(c# 3.0)
    8) Type inference(c#3.0 var)
    note: There is no performance impact results form using type inference.The compiler does all the work figuring out the data type at compile time.
    9) Lambda Expressions
    10) string.IsNullOrEmpty
    Optional and named parameters in C# 4.0
    Example:app.Document.open(ref filename,ref missing.......);
    app.Documents.open(@"c:\Document.docx",Readonly:true);
    1) what is an anonymous type?
      One important motivation(动机)for this was to make code written with LINQ easier to read.Anonymous types simply mean that you don't specify the type- but let the complier do it instead.
    2) what is the beneficial for Anonymous type?
    a. simple definitions,simplified
    b. using anonymous types for creating arrays
    c. Saving time and code with anonymous types
    d. Combining Lambda expressions with Queries
    3) other questions?
    a. Is var typesafe? yes
    b. Is there a performance penalty(处罚,征罚) for using "var"? no
    c. On using anonymous definitions in large projects

Debugger
    1) Install the Visual Studio 2008 QFE( Quick-Fix-Engineering)
    2) Start Visual Studio 2008 and bring up Tools > Options > Debugging > General
      Turn OFF the "Enable Just My Code" setting
      Turn ON the "Enable Source Server Support" setting
    3) Next,bring up the "Symbols" page and set the symbols download URL and a cache location.
      Set the symbol file location to be:http://referencesource.microsoft.com/symbols

Sliverlight

Other

2009年3月14日星期六

March 14th-16th Links:ASP.NET Task,SOLID,Regular Experssion,ReSharper,SQL SERVER...

ASP.NET
    In this article,I'll take about scheduled Task Manager in a ASP.NET Environment.We often need to make scheduled tasks running in background but it's not very simple to make it with asp.net.I based my article on StackoverFlow article which uses ASP.NET Cache to schedule tasks.

C#

Continous Intergration,NAnt,NUnit,NCover

ReSharper

SQL SERVER
     P.S. : Use ROW_NUMBER() clause and PARTITION BY clause

Other
    Regardless of which software development methodology and hierarchy(等级制度)you use,there's 1 core practice I think every team should use: estimation(估计) and tracking.
    What do you need to do?
    The first thing you need to break-down(分离) tasks and assign them to people.The next thing you need to do is put an estimate,in hours or days,on each task.This can either be done together by the team(preferred)or you can let each developer estimate his or her own tasks.
    All of these things can be done using a modern bug-tracker.We currently use Redmine.
    1) MSBuild/NANT/Build Automation
    2) WCF,WPF and WF
    3) Silverlight and Expression
    4) JQuery
    5) W3C Design Compliance & "Table-less Design"
    6) AZure
    1) Never check in changes that can't be built.
    2) Check in related changes atomically.
    Atomically(原子性)means all related changes are checked in at the same time.
    3) Make use of shelving.
    4) Get All Current code and build before checking in.

2009年3月10日星期二

March 10th-13th Links:C#,Struct,Word,Javascript

C#
    1. What The Defference Between Const and Readonly in .NET?
    1) The readonly keywork differs from the const keyword.A const field can only be initialized at the declaration of the field.A readonly field can be initialized either at the declaration or in a constructor.
    2) A const field is a compile-time constant,the readonly field can be used for run-time constants,as in this line: public static readonly unit l = (uint)DateTime.Now.Ticks;
    3) When using const,the value has to be set before compiling,and can not be changed. Once u make your assembly,the value of the const is baked in there.if u want to change the value of the const,u must go back into your code,change the value,then recompile.if another assemly(Assembly B) wants to use the const in the first assembly(Assembly A),the const is also baked in there as well.So,if u change the value of the const,not only will you have to rebuild your first Assembly A,you will also have to build all other assembly(e.g.:assembly B,C,D...).
    4) Another difference between const and readonly,is that const are static by default,where with readonly,you must define it as static(if you wnat it to be).
    c# 2.0(which shipped with VS2005) introduced the concept of anonymous methods,which allow code blocks to be wrritten "in-line" where delegate values are expected.
    Lambda Expressions provide a more concise(简明的),functional syntax for writing anonymous methods.Since they provide a very compact and type-safe way to write functions that can be passed as arguments for subsequent evaluation.
    syntax: params => expression
    One of the things that make Lambda expressions particularly(adv尤其) powerful from a framework developer's perspective(看法) is that they can be compiled as either a code delegate(int the form of IL based method) or as a expression tree object which can be used at runtime to analyze,transform or optimize the expression.
    1) Lambda Expressions to Code Delegates
    2) Lambda Expressions to Expression Trees

Design Patterns
    If u want to do something that requires interacting with multiple subsystems you can create a facade that same only a few methods that handle all the interaction with the subsystem.

JAVASCRIPT

Silverlight
    I have been wording extensively with both WPF and Silverlight over the past many months.Not too long ago,my workstation started having trouble - specifically Visual Studio 2008 was crashing when tring to open XAML files.Not just crashing either.maybe u should need this patch:  download this patch

English
    1. Unethical
    2. Survey: 调查,民意调查
    3. reusable: 重复使用
    4. fetch: 取得
    5. paragraphs:段
    6. Enumerable: IEnumerable
    7. concise
    8. syntax
    9. subsequent: 后续的
    10. evaluation: 付值,评估,评价
    11. perspective: 看法,透视

2009年3月7日星期六

March 7th-8th Links: ASP.NET MVC,Expression Tree,SQL Injection,Delegate,Lambda Expressions

ASP.NET

ASP.NET MVC

C#
    WHAT DOES IT MEAN TO SAY THAT A TYPE IS A REFERENCE TYPE?
    Basically,it means that every variable of that type that you manipulate is actually a pointer to the actual object on the heap.When you make a copy of this reference,you get another reference that points the same object.
    Now,let's consider what it means to compare these reference. What does equality mean between two reference variables? The answer is ,it depends on what your needs are and how you define equality.
    2. Fast Reflection Library- Codeplex
    You use a generic whenever you have a piece of code which can be re-used by different types.The classic example is a data structure,like a list or hashtable.  

Security

English:
    Vulnerabilities: 易受伤,弱点,漏洞
    aka: Also known as
    malicious: 恶意的,恶毒的
    Exponentially: 成倍的
    Utilize: 利用
    Fed up with:受够了..

2009年3月1日星期日

March 2th-6th Links:Design Patterns,Observer Pattern,Decorator Pattern

ASP.NET

ASP.NET MVC

c#
    2. Snippet: Check for Internet Connectivity(c#)
    WHAT IS AN INTERFACE?
    Interface is a contract that implementer must follow.In other words,an interface says what class must defined.Importantly,an interface doesn't specify(or care) how the implemention is actually achieved. As we move forward we'll see how helpful this can be to us.
    An interface can define zero or more members(methods or propties) and a class can implement zero or more interface.Interface members always have public.An interface with zero member is called marker-interface,they don't require implementer to do anything.
    An raise exist of interface is to provide developers with a language-level tool that allows classes to be decoupled from each other.

Design Patterns
    The decorator pattern can be used to make it possible to extend (decorate) the functionality of a class at runtime.
    

Web

English
    1. legacy: 继承,遗产
    2. merciless: 殘忍的
    3. pair with: 搭配
    4. violation: 违反,违背
    5. proper: 适当的,正确的
    6. crucial: 关键的,决定性的
    7. snippet: 小片,片段
    8. badminton: 羽毛球
    9. decouple:
    10. overlap: 重叠

March 1th Links:ASP.NET MVC,

ASP.NET MVC

C#  
    1) The Action delegate
     encapsulate a method which dosen't reutn a value,and which holds a variable number of parameters.
     a. public delegate void Action()- if the method is parameterless,use it.
     b. public delegate void Action(T arg1).
     c. public delegate void Action(T1 arg1,T2 arg2).
     d. public delegate void Action(T1 arg1,T2 arg2,T3 arg3).
     e. public delegate void Action(T1 arg1,T2 arg2,T3 arg3,T4 arg4).
    e.g: Foreach
    2) The Comparison delegate
    sorting elements within a collection
    e.g: Sort
    3) The Converter
    convert an object from on type to another type
    e.g: List toysNames = toys.ConvertAll(toy => toy.Name);
    4) The Predicate delegate
    defines a set of criteria and determines whether the specified object meets those criteria.
    e.g: Exists,Find,FindAll,FindIndex,etc..
    4. Infinite Lists With C# Yield- Justin Etheredge

CodePlex

JAVASCRIPT
    1. Time to grok Closures- Sergio Pereira
    This happens when the returned(or inner) function has a reference to anything defined in the parent(or outer) function,i.e.(换言之),the parent local scope.When this happens,we way that a closure has been created.

SQL SERVER
    1) Unidirectional(单向的) synchronization
    2) Bidirectional(双向的) synchronization

English
    1. Comfortable: 舒适的
    2. encapsulate: 装入内部,封装(encapsulate method)
    3. intention: 意图
    4. Infinite: 无限的,无穷的,极大的
    5. Closure: 闭合