15 oct 2008

Share data between multiple threads - Lock & mutate

If you have been using the Parallel Extension CTP or simply writing multi-threaded code yourself, you probably have run into situations where you needed to share data between multiple threads.   So long as the data is read-only, this isn’t a problem, but what about mutating data?

The easy answer is to use a lock.  There are a lot of blog entries and white papers talking about how to use locks correctly, how to avoid deadlocks, or what are the best locks for the particular scenario, or even how to correctly write lock-free code. You could read all of these and still run into trouble using locks.  You see, the problem isn’t sharing one piece of data; it’s when you are sharing multiple pieces of data – for instance data that has a complex schema involving multiple complex objects such as trees or lists. 

So, locks are a basic tool in your arsenal.  From the simple lock, you can build synchronization mechanisms that hopefully protect your data, correctly, and don’t impact your scalability.

Ah, I hear you sigh.  Yes, hope is eternal, software has bugs and multithreaded software has race conditions, deadlocks, and scalability problems.  Why?  Well, because many find it is hard and fraught with peril to correctly use anything more than a single lock or at most some really small set of course-grained locks. As code matures, locking hierarchies to provide fine-grained-locking often morph from elegant to clumsy.  You may also find that as your project grows, lock depth blossoms, unnecessarily, or alternatively race conditions are introduced simply because programmers were unaware that it necessary to lock a specific resource.  The end result is code that simply doesn’t scale or your application’s reliability plummets without some of your best and brightest spending time tuning, fixing, “right-sizing” and eliminating locks.  Even after all that work, are you confident that your code is bug-free?  Do race conditions exist in it?  How can you even inspect the code and reason about its correctness?

So, I suspect you are living with some rather course-grained locks or with fear.

Many of my coworkers argue quite persuasively that you should get rid of locks by decomposing the data such that there is no sharing.  They point to the use of “agents” and “messaging” as a good programming paradigm to ensure that data accessed by a specific thread is logically isolated from other threads.  This is a great method but can you re-architect your code to do this?  Can you use it over multiple data structures?  Can you compose them together?

The jury is still out, but I suspect that not all programming patterns in traditional object-oriented languages can be decomposed to a point where there is no sharing.  I find that advocates of the agent model still have concurrency problems!  They have shared data within their agents and they are hampered by either requiring one thread per agent or to use locks or interlocked operations to manage this shared state.

What would you say if I told you that you could reason about your code in a sequential fashion and be relieved of worrying about other code interacting with its data?  Oh, let’s say it’s in a way that scales?   Would that help you?

Well, that is what transactional memory (TM) promises to provide.

Transactional memory is not about “removing locks” but is about abstracting away the requirement to specify a particular lock.  Instead, you can structure your code in well defined sequential blocks of code, what in the database world we call “units of work”, and then let the underlying runtime system, compiler, or hardware provide you the guarantees you desire.  Further, you want this work to scale.  To do that, the underlying system provides concurrency control optimistically.  Instead of always locking a resource, the transactional memory system assumes that there is no contention.  Instead, it detects when these assumptions are incorrect and rolls back changes that were made in the block. Depending on the implementation, the transactional memory system may then re-execute your block of code.

In this way, transactional memory provides an execution pattern of multithreaded code that can be reasoned about sequentially and when there is very little contention, scales well.  What about when there is contention?  Well, “it depends” will likely be the answer.  How big the transaction is and how often it re-executes (due to contention) changes the performance curves significantly. Transactional Memory systems usually include some code to manage contention.  That contention manager will significantly impact how code scales under contention.  We would hope that the resulting performance is not worse than fully serialized execution.

So what does this look like?  Various experimental TM systems have been produced.  Some integrate with the compiler, others, like SXM, provide library support.  When I talk about TM and show examples I prefer to use a simple syntax which delineates a block of code as “atomic”.  For instance:

                Atomic {

                                myBigCollection.insert(someStuff);

                                if (condition)

                                                otherCollection.mutate (myBigCollection);

}

 

So, in this example I have two collections and some operation that may optionally work on one depending on the other.  Obviously, my code is demonstrating composability over these two collections.  What might not be so obvious is that I didn’t have to catch any errors here – my code completed successfully or an exception was thrown and nothing was done.  How would I do that with locks now?

 

                Lock (myCollectionLock) {

                                Bool a = false;

                                Bool b = false;

                                try {

                                myBigCollection.insert(someStuff);

                                a = true;

 

                                if (condition) {

                                                otherCollection.mutate (myBigCollection);

                                                b = true;

                                }

                Catch (exception e) {

                                If (a) myBigCollection.remove(someStuff);

                                If (b) myStaticStuff.unmutate(otherCollection, myBigCollection);

// I probably had to write my own unmutate

Throw e;

                }

} // lock

 

Which one do you want to maintain or test?  Oh, did you catch that I had to write my own ‘unmutate’?  Ugh, I hope that is possible.  Also, did you note that I had to keep the lock through the catch?  If I didn’t, there would be a race condition when a failure occurred and the work undone.  Heck, just setting the flags is error prone.  Consider what would have happened if I set “b = true” but forgot to correctly enclose the “if (condition)” clause.

Could your test team find this bug?

…

                                if (condition)

                                                otherCollection.mutate (myBigCollection);

                                                b = true;

…

 

This blog is about transactional memory with entries written by the team at Microsoft that is implementing an experimental transactional memory system in .NET.  While we work in the Developer Division’s Parallel Computing Platformproduct group, we are not working on a product release at this time.  Instead we have been incubating, researching, and experimenting with transactional memory. 

Our goal is to create a TM system that lives up to its promise.  This work has lead us to what we think is some industry-leading work – but we have been so busy doing it that we haven’t had a chance to talk about it; share what we have found; and more importantly hear what the community thinks of this effort. 

This blog is our first step to remedy that.  

 

fuente

  http://blogs.msdn.com/stmteam/archive/2008/10/08/welcome-to-the-transactional-memory-team-s-blog.aspx

Gracias a Mauricio Salatino por su colaboracón al blog.

 

Alejandro A Sfrede
Arquitecto de Software
Microsoft Certified Professional

  

 

.

 

11 oct 2008

Administracion de Proyectos de SW - ¿ Iterativo porqué ? EL CLIENTE.

Luego de hacer un curso de administracion de proyectos de software y analizando con el trabajo de coordinar proyectos de software factory . voy a añadir al blogs tips interesantes de la Administracion de Proyectos de SW e estimacion de software y planning.

El primer punto. EL CLIENTE su Cashflow y no solo tener Fé en el proyecto hasta que termine. Midamos el éxito, la satisfacción con "entregales de valor" : "Solo el producto" o "parte del mismo".






En una sola entrega de valor "la version beta", es el peor momento de cashflow del cliente. Todavia no tiene lo que necesita y casi lo termina de pagar... ( Cliente... lo puedo ver? ) ( Siii, pero es beta, probalo y nos avisas ) . No tiene sentido desde la perspectiva del cliente.

Si es progresivo , iterativo, con poca inversion inicial puede (o no) ya usarlo y tomar valor que compense su inversion. y nos bajamos los riegos del proyecto y la insertidumbre .

26 sept 2008

Un Poco de Humor - Es Viernes


 LOBO,
 
POR QUÉ TIENES ESA FRENTE TAN SUDADA,
 LOS OJOS TAN AJUSTADOS 
Y ESOS DIENTES TAN APRETADOS?
  COÑO CAPERUCITA, DÉJAME CAGAR TRANQUILO ¿YA?



13 sept 2008

MS patterns & practices: App Arch Guide - Updates (Dic.2002 to Date.Now !)


Architecture and Design

The following diagram represents a common application architecture with components grouped by different areas of concern

 Arch.JPG

Architecture and Design Guidelines
 

Pattern Map


Area Relevant Patterns
Authentication and Authorization Direct Authentication
Brokered Authentication
Federated Authentication (SSO)
Trusted Sub-System
Caching Cache Dependency
Page Cache
Communication Pipes and Filters
Intercepting Filter
Composition Composite View
Template View
Transform View
Two-step View
Concurrency and Transactions Coarse Grained Lock
Implicit Lock
Optimistic Offline Lock
Pessimistic Offline Lock
Transaction Script
Capture Transaction Details
Configuration Management Provider
Coupling and Cohesion Adapter
Dependency Injection
Data Access Active Record
Data Mapper
Query Object
Repository
Row Data Gateway
Table Data Gateway
Exception Management Exception Shielding
Layering Entity Translator
Façade
Layered Architecture
Service Interface
Service Layer
Logging and Instrumentation Provider
State Management Context Object
Structure Client/Server
N-Tier
Software + Services (S+S)
Software as a Service (SaaS)
Platform as a Service (PaaS)
User Experience Asynchronous Callback
Chain of Responsibility
Validation Publish/Subscribe
_Workflow_ Data-driven workflow
Human workflow
Sequential workflow
State-driven workflow

 
 Business Layer Guidelines
 
Business Layer – When designing the business layer following are the key activities that you need to perform.
  • Identify the consumers of your business layer
  • Determine how you expose your business layer
  • Determine security requirements of your business layer
  • Determine your validation requirements and strategy for business layer
  • Determine caching strategy for your business layer
  • Determine exception management strategy for your business layer

Business Components – When designing the business components following are the key activities that you need to perform.
  • Identify different types of business components
  • Determine application design considerations
  • Identify transactional requirements
  • Identify how business rules are handled
  • Identify patterns that fit the requirements

Business entities – When designing the business entities following are the key activities that you need to perform.
  • Identify common data formats for business entities
  • Determine how data will be used in the application
  • Choose your approach for managing rules
  • Optionally choose your design for custom objects
  • Optionally determine serialization support
Presentation Layer Guidelines
 

Approach

Use the following steps to help organize your thinking when designing the presentation layer:
  1. Identify your client type. Choose a client type that satisfies your requirements and adheres to the infrastructure and deployment constraints of your organization.
  2. Determine how you present data. Choose the data format for your presentation layer and decide how you will present the data in your User Interface (UI).
  3. Determine your data validation strategy. Use data validation techniques to protect your system from un-trusted input.
  4. Determine your business logic strategy. Factor your business logic to decouple business logic from presentation layer code.
  5. Determine your strategy for communication with other layers. If your application has multiple layers, such as a data access layer and a business layer, determine a strategy for communicating from your presentation layer to these other layers.

Design Considerations

Use the following design principles when designing the presentation layer:
  • Choose the appropriate UI technology. Determine if you will implement a rich client, a web client, or a rich internet application.
  • Choose relevant patterns. Review the presentation layer patterns for proven solutions to common presentation problems.
  • Design for separation of concerns. Use dedicated UI components to focus on rendering and display. Use dedicated presentation entities to manage the data required to present your views. Use dedicated UI process components to manage user interaction processing.
  • Consider human interface guidelines. Review guidelines that have been established for your organization. Review common user interface guidelines based upon the client type and technologies that you have chosen.
  • Adhere to user-driven design. Before designing your presentation layer, understand your customer. Use surveys, usability studies and interviews to determine the best presentation design for your customer's needs.
 

Guidelines Index

J.D. Meier , Alex Homer, Jason Taylor , Prashant Bansode , Lonnie Wall, Rob Boucher, Akshay Bogawat.

Guidelines present the "what to do", "why", and "how." They're organized using frames. A frame is simply a collection of hot spot areas to organize the guidance into meaningful buckets.

Architecture and Design

Layers

 
 
 
 

11 sept 2008

MODELO WIN FORMS TO WEB !!, .NET DESKTOP TO WEB - AND OPEN SOURCES



COMO DIRIA UN AMIGO  2 PALABRAS :  IMPRE - SIONATE


AJAX  for Enterprises app

Visual WebGui (VWG) is a new 'Web like Desktop' platform that offers open source rapid application development (RAD) framework to develop Line-Of-Bussines AJAX & Silverlight applications atop the platform. VWG cuts down development time (proven up to 90%) , without compromising on extensibility, scalability, performance, security or complexity

4 sept 2008

SQLSERVER - Random Number Generator Script

 SQL SERVER - Random Number Generator Script - SQL Query


Random Number Generator

There are many methods to generate random number in SQL Server.

Method 1 : Generate Random Numbers (Int) between Rang

---- Create the variables for the random number generation
DECLARE @Random INT;
DECLARE @Upper INT;
DECLARE @Lower INT
 
---- This will create a random number between 1 and 999
SET @Lower = 1 ---- The lowest random number
SET @Upper = 999 ---- The highest random number
SELECT @Random = ROUND(((@Upper - @Lower -1) * RAND() + @Lower), 0)
SELECT @Random

Method 2 : Generate Random Float Numbers

SELECT RAND( (DATEPART(mm, GETDATE()) * 100000 )
                + (DATEPART(ss, GETDATE()) * 1000 )
                + DATEPART(ms, GETDATE()) )

Method 3 : Random Numbers Quick Scripts

---- random float from 0 up to 20 - [0, 20)
SELECT 20*RAND()
    -- random float from 10 up to 30 - [10, 30)
 SELECT 10 + (30-10)*RAND()
            --random integer BETWEEN 0 
        AND 20 - [0, 20]
SELECT CONVERT(INT, (20+1)*RAND())
            ----random integer BETWEEN 10 
        AND 30 - [10, 30]
SELECT 10 + CONVERT(INT, (30-10+1)*RAND())

Method 4 : Random Numbers (Float, Int) Tables Based with Time

DECLARE @t TABLE( randnum float )
DECLARE @cnt INT; SET @cnt = 0
WHILE  @cnt <=10000
    BEGIN
    SET @cnt = @cnt + 1
    INSERT INTO @t
        SELECT RAND( (DATEPART(mm, GETDATE()) * 100000 )
                    + (DATEPART(ss, GETDATE()) * 1000 )
                    + DATEPART(ms, GETDATE()) )
    END
SELECT randnum, COUNT(*)
    FROM @t
    GROUP BY randnum

Method 5 : Random number on a per row basis

    ---- The distribution is pretty good however there are the occasional peaks.
    ---- If you want to change the range of values just change the 1000 to the maximum value you want.
     ---- Use this as the source of a report server report and chart the results to see the distribution
SELECT randomNumber, COUNT(1) countOfRandomNumber
    FROM (
    SELECT ABS(CAST(NEWID() AS binary(6)) %1000) + 1 randomNumber
        FROM sysobjects) sample
    GROUP BY randomNumber
    ORDER BY randomNumber

Alejandro A Sfrede
Arquitecto de Software
Microsoft Certified Professional

 

 

 


2 sept 2008

http://www.google.com/chrome download & conference

http://www.google.com/chrome


10:53 Good morning, browser battler watchers!

10:54 I'm installed in the front row at the Google press conference.
People are still filing in, hang on while I get everything set up.


10:54 [Image] Chrome Logo View
10:55 Today's topic, Google Chrome.
If you're looking for a live video stream, Google said they'd have
one. Links here:
http://news.cnet.com/8301-17939_109-10030035-2.html?tag=mncol;title

10:55 This blog will be my color commentary of the launch announcement.


10:55 [Comment From CovinaBob]
Good morning. Is this Rafe?
10:56 Yes, it's Rafe.
For everyone else sending me feedback... Wow! Thanks for all the
kinds words, sorry I won't be able to post and reply to most of them.
But I really do appreciate it, and if you have a really good question
I can address, I'll put up your note.


10:57 [Comment From Shen]
When and where to download?
10:58 [Comment From el lobo del mar]
Any word on when Chrome will be ready for downloading?
10:58 I hear 11am pacific.

10:58 We'll see

11:01 [Comment From RJS, Los Angeles, CA]
Hi Rafe, I read your post yesterday in regards to chrome being
available to PC users only at first...any idea when we could expect to
see the chrome make its way over to mac?
11:01 Good Q, I expect that will be a topic discussed here today

11:07 I'm trying to add some photos to the blog here, having some issues.

11:07 Oh well, we're going live now. Brian O'Shaugnassey (sp?) introing now

11:08 Demo will be first "in advance of launch"
Download will be available at NOON PACIFIC

11:08 Up now: Sundar Pichai, VP Prod Mgmt

11:09 How the comic came about: Scott McCloud is "a legend in the
comic world," and has handled complex topics. Scott was "embedded with
the team."

11:09 Why we built chrome....

11:09 (10 min on this, he says, then 30 min of demo)

11:10 Why we built chrome:
Web has evolved from static text to interactive pages (eg Google StreetView)
But "underlying browser architecuture is still very similar to
original Netscape"


11:11 We believe browsers should evolve a lot more to keep pace with
how the Web is evolving.

Sundar says, "I do all my work in a browser."


11:11 What could you do if you built a browser from scratch? That was
the genesis of Chrome


11:12 Google Search informed a lot of Chrome.
Simple, but powerful due to its powerful core
Chrome tried to emulate this: Simple experience but with a lot of
underlying technology


11:12 [Comment From Michel]
can you post the live video stream again please, the link you posted
is redirecting to this page

11:12 "This is Chrome... it has a very simple look"

11:13 Try this link for video stream
http://google.client.shareholder.com/Visitors/event/build2/MediaPresentation.cfm?MediaID=33101&Player=1


11:13 The slide of chrome -- VERY SIMPLE. Just a bunch of tabs and
an address bar.
"We don't interrupt the user at all... the browser should stay out of the way."


11:14 70% of time on browser is spent going back to things you've seen
before... we spent a lot of time on that use case.


11:14 The core...


11:14 Based on Webkit, same as Safari. "We wanted to make sure we
didn't make a headache for developers."


11:15 Why webkit?
It's fast.
It's a simple code base
It was "friendly to a lot of google devs"
And it's also used by Android


11:15 Chrome is multi-process
(this is the same stuff that we heard about in the comic so far)


11:17 Each tab runs as own process.
* browser is more responsive
* crash-resistant (can close a tab indep)
* more secure - tabs are sandboxed


11:17 "The multiprocess architecture is funamental to chrome and we
were able to do it since we rebuilt the browser from scratch"


11:18 Google rewrote javascript code from scratch, calling it V8.
Executes javascript "much much faster" than existing techs


11:18 Most web devs don't use javascript because it's slow. Sundar
thinks that will change thanks to V8


11:19 Chrome will launch today for vista and XP
"We are working very hard on Mac and Linux versions"


11:19 Was designed for multi platform, but we decided to launch Win
ver as soon as it was ready.
"A lot of use inside use Mac and Linux, there's enough internal
pressure" to get it out


11:19 Launching 43 languages, tho.


11:20 Final point:
Chrome is "fully open source, under a very permissive license."


11:20 "We borrowed code from Firefox"


11:20 Why do this?
"As the Web gets better, it has a very serious benefit for google."
"We can write better apps"


11:21 Announcing today:
CHROMIUM, the open source reousrce


11:21 Next up...
DEMO
by Ben Goodger (UI guy)
was at Mozilla... hmm


11:21 [Comment From danser]
Chromium will be at http://code.google.com/p/chromium/ - note the page
is forbidden instead of 404 right now.

11:22 UI coming up now...


11:22 Big focus on tab browsing... "a primary element of the browser"
"Kind of like title bars for web pages and apps"


11:23 "Wanted to make feature scale for heavy usage."
"We think tabs are coolest thing to come to browsers in 10 yrs"


11:23 can grab and drag tabs. "They're very friendly, it's almost like
you want to drag them"
You can drag them off the browser, or back in


11:24 some subtle niceties... ex if you close a tab, the next one over
slides so its close box is right under your mouse.

Editorial comment: Nice!


11:25 Address bar demo:
"Where's the search box??"
Isn't one -- there's just one address bar that doubles as search
Confusing to user since "you had to decide what you were going to do
before you did it."


11:25 They shall call it...

The Omnibox


11:26 "It's a little bit psychic"
They used to call it the "psychic omnibox"


11:26 Ok, let's see it...

It's a lot like the Firefox awesomebar, except the pre-fill is already
in your address bar, so you don't have to click down on a list to
select top result


11:27 If you keep typing, you can enter in URLs or enter search quereies


11:28 You can use other search engines, like Amazon, Wikipedia
Once you use a search box on a site, you then get a "press tab to
search" cue in the omnibox when you begin to type that url again, and
you'll get that site's search function.

This is cool, and smart


11:30 Start page / New Tab page
automatically shows you thumbnails of nice sites you visit most often,
plus list of your most-used search engines, recent bookmakrs you've
made, and recently closed tabs.

More nice features. Looks really useful.


11:31 It's the default home page.
Or if you have one you like, "we import that as well."
You can also choose to open browser with your own set of tabs

Required features, no big deal


11:31 Private browsing mode aka porn mode:


11:32 You don't want to clear out your history and cache, you'll erase
your omnibox history and top tabs.

So they have an "incognito window"

has a visual cue, a little detective in it

Dude, that is totally the wrong graphic for this mode


11:33 But the benefit is that you can browse in private w/o putting
data in your history, cache, etc.

Just like IE8 InPrivate mode. A new required feature... Hello, Mozilla??


11:34 Moving on..

The download file experience...
"You shouldnt have to manage a lot of things to make downloads work"

When you kick off a download, they pop into a little status bar on the
window. When they are completed, you can drag the files to wherever
you want.

So simple, but seems more clear than other browsers' DL functions.


11:35 [Comment From Siddharth]
when can i download this please tell me and where?

11:35 Gotta wait, sorry. They say noon pacific


11:36 A new kind of window for apps that "want to break free of the
browser window"...
the "pinocchio feature"

You can take a site (Gears only? not clear) and "create destkop
shortcut" from it.

The window it opens shows no browser UI, just the app itself.

It acts like a windows app - you can alt-tab to it, etc.


11:37 Next up...
Daren Fisher, Tech Lead
Topic: Under the hood


11:37 "We were very interested in the use case of users who leave
their browsers open for a long time" ... "who have a lot of different
things going on in parallel."


11:39 "It's really unforuntate when you lose your whole browser."
"It seemed obvious to us that it would be nice if the browser were subdivided."
Web pages should be separate from each other.
They are in Chrome. The rendering engine are in "sub child processes"
If one tab dies, you don't lose the other
Tabs can execute in parallel, there's no delay if one tab is busy

11:39 "It's especially nice if you have a dual-core CPU."

Heh, I gots 4 cores on my desktop at home, can't wait to try this


11:40 Security:
The rendering engine has no prividleges to talk to your PC.


11:40 "Bad guys have to find a way out of the sandbox. "


11:41 Demo of Chrome Task Manager
Looks like Windows Task Manager, shows all the processes, their memory
use, CPU use, and network use.

Neat. And yo ucan kill the processes/tab you don't like

Hints that you can minimze tabs

Says plugins run in a process... for example FLASH.

11:43 Demo: What to do with a misbehaving tab...

showing a locked up tab. can't interact or scroll.
But can still switch tabs.

Bad tabs get a cute "sad tab" display


11:44 can recover a crashed tab, back to where it was before crash


11:45 How about a bad plugin?

Showing what happens if you kill Flash process while playing a YouTube
vid... you get a "sad plugin" on the page, but the rest of the page
stays live.

And is easy to refresh the plugin by reloading the page


11:45 And now, the speed demo...


11:46 IE Demo, loading pages off of local file system... takes 220 ms.

Chrome, same demo... 77 ms.

Your milage may vary... we will test this when we get the code


11:47 The download is live, folks!
http://www.google.com/chrome

11:47 Now the V8 talk.

If anyone is still with me....


11:48 BTW I have Chrome running right now... it took like 30 sec to
install. More later, now back to our press conf...


11:49 Guy is talking about how the new virtual machine has "hidden
classes" with shared structure, like java and smalltalk. and I have
no idea what this means.

2 ago 2008

Rapidpik

19 jul 2008

Feliz Dia a Mis Amigos de Hoy y de Siempre

Feliz Dia a Mis Amigos de Hoy y de Siempre

19 mar 2008

QueryOnlyNeededData hiberante

 

public void QueryOnlyNeededData()
{
ISession session = NHibernateSessionFactory.OpenSession();
ICriteria criteria = null; IList result = null; string buffer = null;

// get all sales when querying products we will hit the N+1 select problem
criteria = session.CreateCriteria(typeof(Sale));
result = criteria.List();

// because product.Supplier is mapped as fetch=join the select issued
// for each product will join with the supplier table
foreach (Sale s in result) buffer = s.Product.Name;

// get all sales with the product (no N+1 problem, also don't need supplier so don't get it)
criteria = session.CreateCriteria(typeof(Sale))
.SetFetchMode("Product", FetchMode.Join)
.SetFetchMode("Product.Supplier", FetchMode.Select);
result = criteria.List();

// this cycle will not issue any additional select statements
foreach (Sale s in result) buffer = s.Product.Name;
Program.ListResult("ICriteriaSamples.QueryOnlyNeededData", result);
}

23 dic 2007

Visual Studio 2008 Training Kit

Descarga este contenido tecnico para 5 dias incluyendo 20 hands-on-labs, 28 presentaciones y 20 demos con scipts.

El VS2008 Training Kit cubre las siguientes tecnologías:

  • LINQ
  • C# 3.0
  • VB 9
  • WCF
  • WF
  • WPF
  • Windows Cardspace
  • Silverlight
  • ASP.NET AJAX
  • .NET Compact Framework 3.5
  • VSTO 3.0
  • Visual Studio Team System y
  • Team Foundation Server

Descargalo: http://go.microsoft.com/?linkid=7602397 (~120 Mb)

25 nov 2007

Binary Serializers Methods

 Core Serialization Methods

 #region Binary Serializers public static System.IO.MemoryStream SerializeBinary(object request) {   System.Runtime.Serialization.Formatters.Binary.BinaryFormatter serializer =    new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();   System.IO.MemoryStream memStream = new System.IO.MemoryStream();   serializer.Serialize(memStream, request);   return memStream; }  public static object DeSerializeBinary(System.IO.MemoryStream memStream) {   memStream.Position=0;   System.Runtime.Serialization.Formatters.Binary.BinaryFormatter deserializer =    new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();   object newobj = deserializer.Deserialize(memStream);   memStream.Close();   return newobj; } 

4 nov 2007

CodeTranslator: Free Code Translation From VB.NET <-> C#

Free Code Translation for .NET (C#<->VB.NET


For now it only supports from VB.NET to C# and from C# to VB.NET.



3 nov 2007

Eval en .NET - Microsoft.JScript.Eval.JScriptEvaluate

   Dim overhead As String = "10"
        Dim a As Integer
        Dim b As Integer
        Dim c As Integer
        c = 20
        a = 10
        b = 15
        Dim sExpression As String = "a+b"
        sExpression = Replace(sExpression, "a", a)
        sExpression = Replace(sExpression, "b", b)
        MsgBox(sExpression)
        Dim oResult As Object

        Try
            Dim myEngine As Microsoft.JScript.Vsa.VsaEngine = Microsoft.JScript.Vsa.VsaEngine.CreateEngine()
            oResult = Microsoft.JScript.Eval.JScriptEvaluate (sExpression, myEngine)

            MsgBox(oResult)
        Catch ex As Exception
            MsgBox(ex.Message & ex.Source)
        End Try

Patterns con Ejemplos y Usos - Net & Java

Descriptions of the patterns
 
 
 
 
Patterns of Enterprise Application Architecture
 
 
 
 
 
 
.

Patterns of Enterprise Application Architecture (P of EAA).

 Patterns of Enterprise Application Architecture (P of EAA).

These pages are a brief overview of each of the patterns in P of EAA. They aren't intended to stand alone, but merely as a quick aide-memoire for those familiar with them, and a handy link if you want to refer to one online. In the future I may add some post-publication comments into the material here, but we'll see how that works out.

Many of these diagrams demonstrate the rather poor GIF output of Visio. The nice diagrams were redrawn for me by David Heinemeier Hansson

Domain Logic Patterns: Transaction Script (110), Domain Model (116), Table Module (125), Service Layer (133).

Data Source Architectural Patterns: Table Data Gateway (144), Row Data Gateway (152), Active Record (160), Data Mapper (165).

Object-Relational Behavioral Patterns: Unit of Work (184), Identity Map (195), Lazy Load (200)

Object-Relational Structural Patterns: Identity Field (216), Foreign Key Mapping (236), Association Table Mapping (248), Dependent Mapping (262), Embedded Value (268), Serialized LOB (272), Single Table Inheritance (278), Class Table Inheritance (285), Concrete Table Inheritance (293), Inheritance Mappers (302).

Object-Relational Metadata Mapping Patterns: Metadata Mapping (306), Query Object (316), Repository (322).

Web Presentation Patterns: Model View Controller (330), Page Controller (333), Front Controller (344), Template View (350), Transform View (361), Two-Step View (365), Application Controller (379).

Distribution Patterns: Remote Facade (388), Data Transfer Object (401)

Offline Concurrency Patterns: Optimistic Offline Lock (416), Pessimistic Offline Lock (426), Coarse Grained Lock (438), Implicit Lock (449).

Session State Patterns: Client Session State (456), Server Session State (458), Database Session State (462).

Base Patterns: Gateway (466), Mapper (473), Layer Supertype (475), Separated Interface (476), Registry (480), Value Object (486), Money (488), Special Case (496), Plugin (499), Service Stub (504), Record Set (508)

 

http://martinfowler.com/ 

FeedCount

analytics

 
sfrede