Parallel Extension per .Net 3.5 (Px)

La programmazione parallela nel framework 3.5 era possibile fino a un po’ di tempo fa con una CTP apposita. Poi si disse che le estensioni parallele erano disponibili solo su .Net 4. Invece si posso ritrovare le stesse estensioni anche in 3.5. Infatti le ho ritrovate dentro Rx: Reactive Extensions to .NET. Rx è una libreria per la creazione di programmi asincroni e basati su eventi utilizzando delle observable collection. Rx l’ho scoperto guardando le sessioni del PDC. Sono rimasto impressionato dalla potenza espressiva dei costrutti messi a disposizione. Ma dentro Rx è stato inserito Px esattamente come è disponibile in .Net 4.

Basta inserire nel programma un riferimento alla dll System.Threading.dll ovviamente dopo aver installato Rx. Questo è un passo che non si deve fare in .Net 4 poichè è già presente nei componenti del CLR. Ci possono essere differenze nelle prestazioni a favore di .Net 4 poichè quest’ultimo si avvantaggia delle migliorie apportate al ThreadPool

Altra risorsa per Px è il blog Parallel Programming with .NET
Mentre chi fosse interessato a delle best practices per sviluppare usando dei pattern paralleli c’è il documento Patterns for Parallel Programming

Microsoft consiglia e regala questo portatile

Al recente PDC Microsoft ha regalato ai partecipanti un portatile che serve a dimostrare tutte le bellezze di Windows 7. Si tratta di un modello derivato dall’Acer Aspire 1420P di serie a cui sono state apportate alcune migliorie e su cui è stato installata una suite di SW molto corposo.
Intanto diciamo dove si trova la user guide ufficiale : Acer Aspire 1420P Convertible Tablet PC

Se è stato scelto da Microsoft evidentemente deve essere la “cosa” che al momento sul mercato serve ad esprimere meglio le potenzialità di Windows 7 e quindi vale la pena analizzarlo. Le caratteristiche tecniche sono :

Una CPU Intel Celeron U2300 dual core a 1.2GHz, non molto performante purtroppo, nel Windows Experience Index la CPU ha un punteggio di 3,9
2GB of DDR3 1066MHz RAM upgradabile ad 8GB),
250GB HD,
un monitor da 11.6” multitouch (2 soli punti) usabile anche come tablet,
un sensore  accelerometro che orienta automaticamente il desktop quando si gira il computer da orizzontale a verticale

Qualche altra immagine la si puo’ trovare qui

Purtroppo come dicevo non è in commercio ma spero che i costruttori prendano esempio e offrano presto qualcosa di simile o migliore … dopotutto Natale è vicino

Compilare del codice a runtime in Silverlight

Supponiamo di voler iniettare dei nuovi algoritmi in un’applicazione Silverlight a runtime. Spediamo gli il codice sorgente che viene compilato a runtime e richiamato subito dopo. Vedere un esempio qui : Silverlight C# Compiler and Loading DLLs from a server at runtime in Silverlight

Perhaps the most interesting part of this sample is loading and assembly at runtime from within the Silverlight client application:

I’ve seen several heavy and not-so-obvious implementations on the web. It’s just a few lines of code, once you know how.

AssemblyPart part = new AssemblyPart();

MemoryStream stream = new MemoryStream(e.Result.AssemblyRawData);

 _compiledAssembly = part.Load(stream);

Scelta dell’MTU ottimale

Una prova veloce per calcolare la MTU ottmale della rete:

By default, Windows Server 2003, 2000 and XP use a fixed maximum transmission unit (MTU) size of 1500 bytes for all PPP connections and use a fixed MTU size of 1400 bytes for all VPN connections.

How to determine the optimal MTU
In a case you may need to modify the MTU size and wonder how to determine the optimal MTU for your system. You can use ping command to do so, for example, ping http://www.chicagotech.net -f -l xxxx, where chicagotech.net is the domain name you want to reach and xxxx is the packet size used to determine the optimal MTU for your system. For example, you can start with 1472 as showing here:

ping chicagotech.net -f -l 1472

Pinging chicagotech.net [64.176.153.103] with 1472 bytes of data:
Packet needs to be fragmented but DF set.
If the result indicates that the packet needs to be fragmented. Lower the size the packet in increments of -10 (e.g. 1462, 1452, 1442) until you have a packet size that does not fragment. Then, start increasing the packet size from this number in small increments until you find the largest size that does not fragment.

Per vedere i parametri di rete e cambiarli si puo’ usare il tool :

DRTCP: How do I use it and what are all these settings?