venerdì 31 agosto 2012

How to hide the CheckOut button in the Ribbon

As you may know, Microsoft spent a lot of money few years ago before releasing their Office 2010 suite. One of the most famous feature was the 'ribbon'. Some people like it, other ones don't, but that ribbon is there to stay.
Still sometimes someone would like to change the look and feel of the ribbon. Let's say that you need to hide a button in the ribbon from an application page.
The easiest way I've found, in my humble opinion, for achiving this result is via a css style tag within the application page.
You could use the developer tools (F12) in IE and look for the ID of the element you need to hide.
Furthermore you may find here the Default Server Ribbon Customization Locations
Those are the information you need.
Thus your css should look like this one:

<style type="text/css">
#Ribbon\.ListForm\.Display\.Manage\.CheckOut-Large
 display:none;
</style>


giovedì 30 agosto 2012

How to add a script inline in a SharePoint 2010 Application Page

By default, adding inline code into an application page is forbidden for security reasons.
This behavior can be changed by editing the web.config configuration file for the IIS Web Application.
Look for the SafeMode element and add a child element that looks like the following one:

<PageParserPaths>
          <PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true"
             IncludeSubFolders="true" />
</PageParserPaths>

In this way allow the server side scripts on all the paths.
Then we can edit an application page using by SharePoint Designer 2010 (Home Ribbon, Editing Menu,
Advanced Mode)

<script type="text/c#" runat="server">
protected override void OnLoad(EventArgs e)
{
   //some actions here
    base.OnLoad(e);
}
</script>

How to develop a 'Send email with attachment' SharePoint Designer 2010 custom workflow activity

So fare this blog has been just about leisure, it's time to talk a bit about serious stuff.
In a project I have been involved with, our customer wants to send an email with an attachmed document file.
As some among you which have landed on this page already know, the security policies of Microsoft don't allow to send attachments from an email within a SharePoint workflow. Thus, we have to develop some code for implementing this functionality.
Personally I've used Visual Studio 2010 (VS2010), SharePoint Designer 2010 (SPD2010) and the useful insights of Dave Stuart.
You may find his own blog here: Dave Stuart's blog
Most of the code that follows, it owes much to this Patrick Bloom's article on how to develop a Custom Email activity for SharePoint Designer 2010
In order to deliver the solution we need to follow the following steps:
  1. Set up a standard SharePoint solution in VS2010;
  2. Define our custom ACTIONS file, which tell SharePoint and SPD2010 which activities to include;
  3. Define our SendMailActivity class, which will implement the action specified in the ACTIONS file;
  4. Package, deploy and test.
1 Set up the SharePoint solution in VS2010
First of all, create a new Visual Studio solution using the SharePoint empty project template.
Now we can add a SharePoint Mapped Folder that point to the following location:
Template\<yourlanguageLCID>\Workflow
This folder is were the ACTIONS file related to the workflow are stored.
SharePoint 2010 comes out of the box with its own file called WSS.ACTIONS. This file contains all the standard actions you may find in SharePoint Designer.
You may add custom actions to this file, but personally I preferred to create a new ACTIONS file as shown below.


2 Define our custom ACTIONS file
Now we can populate the ACTIONS file (basically an XML document) with the information that desscribe our custom action. It should be noticed that we can add several actions in an ACTIONS file, I needed just one.


Let’s discuss the contents. The WorkflowInfo node just indications this definition applies to Workflows. The Actions node defines how the text is build up in the workflow designer. For example, if used in a sequential action, the action will read <actiondescription> then.
The actual action starts with the Action node. In there, the attributes Name, ClassName, Assembly, AppliesTo and Category define the name of the action in the SPD2010 actions menu, the class and assembly for the code, if it relates to list items, documents only or all, and the Category in which it is listed in the actions menu.
The RuleDesigner node specifies the text shown in the editor and related input parameters. The attribute Sentence specifies the sentence shown in the designer. Unlike Boom's one, my custom activity doesn't accept input parameters because I preferred another implementation. That's why the Parameters node specifies only the workflow context parameters.
Now the hard part begins.

3 Define our custom SendEmailActivity class
Add a new class to your project. Call the class in a meaningful way (i.e. SendEmailActivity) as stated in the ACTIONS file. Have the class inherit from the System.Workflow.ComponentModel.Activity class.
Now for each of the parameters we stated in the ACTIONS file, we need to create properties and ensure that they map. As I stated before, my ACTIONS file uses only the Workflow Context properties; and the custom activity class will do the same. The Workflow Context properties use a DepencyProperty to map the property in the class to the parameter stated in the ACTIONS file.
The using statements and the Workflow Context properties code snippets follow:




Please note that  the name of each DependencyProperty is equal to the name of the property in the class, appended with Property. Also, the name of the property should be equal to the name of the parameter in the ACTIONS file.
Now it's the turn of the method that actually performs our custom activty.
As aforementioned, our custom class inherits from hhe base class System.Workflow.ComponentModel.Activity, which contains a method called Execute. That method represents the entry point for our custom activity. To implement, override the method in your custom activity. See the implementation of the method below:


To walk through the method, we first get the current web via its URL (we could use the Workflow Context property as well). Then we get the SP SMTP information and we build the message with to and from info, body and subject. The next step is to download our attachment and we add it to the email message (in my project a SP List Item has just an attachment, that's why we take the URL for just the first attachment of the Item). Finally we can send the email message.
Before you can use your custom action, you need to register it with SharePoint in the web.config for the farm in which we are going to install the feature. We therefore use a feature receiver to do this when activated. Add a feature to your solution and attach a feature receiver. Implement the receiver as follows:


4 Package, deploy and test
Be sure the Deploy Configuration for VS2010 will deploy the package on GAC so when you'll deploy the solution you should expect to find a dll file there.
Futhermore VS2010 will add the assembly details to the web.config automatically as follow:


Perform an iisreset and then launch SPD2010. The new custom activity should be listed among the other actions.

That's all folks.

martedì 28 agosto 2012

Mission accomplished. Part 1.

This is going to be a very short post, but a very important one.
My probation has ended successfully, so now I can say I have a long-term contract.
A huge leap for my staying here in Canada.
Let's celebrate!

----------------------------------------------------------------------------------------

Questo sarà un posto molto breve, ma parecchio importante.
Il mio periodo di prova è terminato con successo, perciò ora ho a tutti gli effetti un contratto a tempo indeterminato.
Un enorme passo in avanti per la mia permanenza qui in Canada.
E' tempo di festeggiare!

mercoledì 22 agosto 2012

Zombies will inherit the earth

This post is going to be different from the previous ones for two reasons.
First because I'll talk about some my interests which I haven't talked about yet: horror genre and musicals.
Furthermore you won't find an English version of my post because you can find it here Evil Dead The Musical - A Review.
Lynn Marie Calder is among the author of the blog, along with Susan Orr, calgarymusicals.com and the organizer of the Meetup GroupThe Calgary Musicals+Meetup Group.
Last Friday we went, in company of other musical lovers, to watch the play 'Evil Dead - The Musical' and she asked me to write a review of the play due my passion for the horror.
I accepted gladly the offer and you can find the review at the link aforementioned.
Hope you'll enjoy it.

-------------------------------------------------------------------------------------------------------

Come già scritto nella parte precedente in inglese, questo post sarà diverso per due motivi.
Primo perché parlerò di alcuni interessi che ancora non ho toccato: il genere horror e i musical.
Secondariamente perché la versione italiana del post è sensibilimente più lunga di quella inglese. Infatti questo post è la traduzione (per chi interessasse, ma questo vale anche per la parte inglese) di una recensione che ho scritto per un blogi di un'amica.
Lynn Marie Calder è tra le autrici del blog, insieme a Susan Orr, calgarymusicals.com e l'organizzatrice del Gruppo Meetup The Calgary Musicals+Meetup Group.
Lo scorso venerdì siamo andati, insieme ad altri appassionati di musical, 'La Casa - Il Musical' e mi ha chiesto di scrivere una recensione data la mia passione per il genere horror.
Ho accettato di buon grado la sua offerta e di seguito troverete la recensione. Quest'ultima contiene anche una sinossi (sì, strano a dirsi per un Dott. Ing., ma so cosa voglia dire sinossi) della trama e i titoli della trama in corsivo.
Sperando vi faccia piacere.

E' abbastanza comune per i film essere adattati in opere teatrali, specialmente di questi tempi. Per la maggior parte, comunque, il genere horror è stato per lo più intoccato tranne per alcuni classici come Frankestein, Dracula e pochi altri. Per fortuna ci sono dei genuini fan dell'horror anche tra gli scrittori teatrali di musical ed è grazie ad alcuni canadesi - George Reinblatt (Libretto e Testi), e Frank Cipolla, Christopher Bond, e Melissa Morris (musiche) - che "La Casa" sia stata adattata in un musical, essendo stata prodotta per la prima volta a Toronto nel 2003. Per quelli di voi che non sono fan dell'horror come me, "La Casa" è una trilogia horror che va dal 1981 al 1992, diretta da Sam Raimi - sì, il regista di Spider-Man. Perché i film de "La Casa" sono così amati dai fanatici degli zombie? La ragione è abbastanza semplice. E' perché sono, a mio modesto parere, la miglior fusione di horror e commedia finora.

Dopo la necessaria introduzione, parliamo un poco dell'opera...

Atto Primo

 La trama è abbastanza semplice, come in ogni classico film horror. Cinque amici decidono di trascorrere lo Spring brak - specie di vacanza made in USA di metà primavera - in una baita nel bosco dove nessuno va mai. Dovrebbero i nostri felici protagonisti preoccuparsi che ci sia un solo ponte che conduca alla baita? Oppure della misteriosa assenza del proprietario della baita? E che dire di quel libro spettrale, il Necronomicon, visto durante l'introduzione? Cheddiavolo! Non c'è nulla di cui preoccuparsi, come nel 100% dei film horror, tutto andrà perfettamente bene.

Comunque, chi sono questi giovini? Troviamo Ash, un un addetto agli elettrodomestici della S-mart, e la sua collega e fidanzata Linda (che è anche la coreografa del musical). Poi ci sono Scott, il miglior amico di Ash, e Shelly, una ragazza non proprio sveglia rimorchiata qualche giorno prima sa Scott. Infine c'è Cheryl, la non proprio attraente sorella minore di Ash. Cosa possono fare questi lieti giovini insieme per trascorrere il tmepo? La cosa più ovvia da fare - ascoltare il mangianastri - cosa che quelli nati dopo il 1990 hanno bisogno di Google per sapere di cosa stia parlando - trovato nella sinistra cantina. Ahimé, niente musica, ma soltanto un diario del proprietario della baita, un professore che cerca di tradurre il Necronomicon. Non sono delle parole spaventose quelle che provengono dal nastro, vero? E perché tutto d'un tratto si possono sentire delle voci?

Decisamente la cosa migliore da fare in una situazione del genere è andare fuori nel bosco da soli. Andiamo, Cheryl, tua madre non ti ha insegnato in buonsenso? No, è un horror, e i personaggi non è previsto si comportino in maniera assennata. Abbastanza tristemente, Cheryl ha un incontro molto ravvicinato con gli alberi nel bosco e realizza che non ci lascerà andare via. Chi è esso? Meglio non prestare attenzione a quello che dice la stupida p**** e fare come dice e portarla in un motel. Ma aspetta! Il ponte è crollato (sorpresa!), e non hanno una via di fuga. E guarda chi è malvagio adesso! Sì, Cheryl - trasformata in uno zombie, anche conosciuto, per ragioni inspiegate, come Demone Candariano! Ed è appena l'inizio...

Alberi animati? Demoni? Zombie? Cercate della logica? Dimenticavela. Meglio scaricare del bel piombo caldo nella pancia della figa Shelly. Due volte. Che c***o è quello? Un demone - eppure l'ho detto - ma negli horror non ogni personaggio è disposto ad accettare la nuova realtà, meno tra tutti Scott. Ed è solo questione di tempo prima che anche Linda soccomba. Con tutti i suoi amici morti, il povero Ash è da solo e ha i suoi problemi al resistere al richiamo del male. Unisciti a noi dicono i demoni. Dopo tutto, la sua mano ha già accettato l'offerta, essendo stata morsa da una testa d'alce parlante. Cosa dovrebbe fare un eroe in un caso del genere? Tagliare la mano traditrice con un'accetta, ovvio! Che lo splatter cominci!

Poco sollievo porta ad Ash il sapere che i soccorsi stanno per arrivare nella forma di Annie (la stessa attrice che interpretava Shelly), la figlia del professore, e il suo non molto ciarlero fidanzato Ed guidati dal buon vecchio ed affidabile Jake - forse perché l'attore che lo interpretava nel film è un amico stretto di Sam Raimi? Annie ha trovato le ultime, importanti, pagine del Necronomicon e si sta dirigendo verso la baita per completare la traduzione insieme a suo padre. Si spera che non sia sconvolta da quello che troverà là. Come Ash dice a sé stesso nella scena finale, Non sono un assassino, devo solo segare la testa del demone/Linda a metà... (più splatter).

Atto Secondo

I nuovi membri di questo dramma raggiungono la baita proprio mentre Ash finisce di segare (e riprendere la canzone precedente). Ovvio che siano sconvolti, ma Annie sente che può fidarsi di Ash - perfino se, dall'apparenza delle cose, potrebbe aver ucciso tutti i suoi amici e il professore. Si sa, l'amore è più forte del buonsenso - specie nei film horror. Si fida ancor di più di Ash quando Ed si trasforma in un demone ed Ash non mostra alcuna paura. Povero ragazzo, Ed. Aveva sperato di essere un cattivo di primaria importanza, ma è solo un demone di una piccola parte. In nessun modo il protagonista maschile sarà ucciso da lui ed Ash lo sa! E povera Annie. Sembra che, a suo dire, tutti gli uomini nella mia vita siano uccisi da Demoni Candariani - potenzialmente un cattivo auspicio per Ash e Jake. Ash non ha paura - è ancora l'eroe, e l'eroe non può morire, non per ora almeno. Jake, sapendo di non essere l'ero, decide saggiamente di fuggire prima che sia troppo tardi. Ma è ancora notte fonda là fuori nel bosco, e i demoni stanno aspettando. Meglio ricevere l'aiuto di qualche amico. Cosa succede però se gli amici hanno una mira scarsa? Suvvia, cantiamo un'ode a una pugnalata accidentale.


Ora sono rimasti soltanto Ash ed Annie (il cui abito ha la bizzarra abitudine di strapparsi in brandelli) a dover capire come sfuggire a questa follia. Fortunatamente Annie sa leggere le pagine del Necronomicon, perciò prima leggerà le pagine di una lode al libro maledetto. Poi leggerà un incantesimo per spedire i demoni in uno spazio e tempo distanti. Sembra che abbiamo un piano! Perciò facciamo il Necronomicon tutti insieme, un ballo con più di qualche più che piccolo contenuto sessuale. Dopo tutto questo divertimento, è tempo di fuggire o morire. Annie è pugnalata dalla mano traditrice di Ash, e un Ash pieno di furia omicida sega ogni demone che gli capiti a tiro, ma a che serve quando lo informano che non moriremo mai. E' la fine? Ovviamente no. Col suo ultimo respiro Annie lancia il secondo incantesimo e i demoni vengono scacciati, insieme ad Ash - ma quella è un'altra storia come Ash racconta agli increduli clienti della S-mart dopo tali eventi. Scettici in un primo istante, sono più propensi a crederlo dopo che una cliente si trasforma in uno zombie ed Ash dimostra di che pasta sia fatto spazzando via quella t****.
In conclusione posso davvero dire che mi sono divertito a guardare La Casa - Il Musical. Non avevo grandi attese ma è stato davvero esilarante e ben scritto - un omaggio da parte di fan dell'horror a un capolavoro del genere.

Mi auguro arrivi presto in Italia.





lunedì 20 agosto 2012

Italians do it better. Part 9.

I cannot disappoint the twentythree readers of this blog too much, so now and then I've to come back to the most readed (maybe because it's the most posted) topic of this blog: food.
By the way, aren't you excited by the third place competition for number of pages hits among Russia, Germany and Canada? Am I the only one? I already knew that.
Let's go to the recipe, then.

Ingredients (for 4 persons)
  • 320g of pappardelle (a type of pasta)
  • 200g of shelled peas
  • 300g of salmon fillet
  • 1 chopped leek
  • basil
  • 1dl of olive oil
  • 1dl of cream
  • salt and pepper 
Remove salmon of the bones, wash and cut it into strips.
Let the leek dry in 4 tablespoons of olive oil; add the peas, let them simmer, season them with salt and pepper, pour 2 dls of water and bring to a boil, cook for 10-15 minutes stirring occasionally. Set aside a spoonful of well drained peas, pass those left into the masher and put the puree in a baking pan, add the peas kept aside, the cream, the basil, washed, dried and chopped, and heat the whole.
Brown slightly the slices of salmon for 2-3 minutes in a pan with the remaining oil, season with salt and pepper.
Cook the pasta in salted water; dry it 'al dente', topped with cream of peas, add the slices of salmon and serve.
Buon appetito.
The result sholud be similar (hopefully better) of this one.






----------------------------------------------------------------------------------------------

Non posso deludere troppo i ventitrè lettori di questo blog, perciò ogni tanto devo tornare all'argomento più letto (forse perché è quello di cui scrivo maggiormente) di questo blog: cibo.
Comunque, non siete eccitati dalla competizione per il terzo posto per il paese con il più alto numero di visualizzazioni di pagina tra Russia, Germania e Canada? Sono l'unico? Lo sapevo già.
Passiamo alla ricetta, quindi.


Ingredienti (per 4 persone)
  • 320g di pappardelle
  • 200g di piselli sgranati
  • 300g di filetto di salmone
  • 1 porro tritato
  • 1 mazzetto di basilico
  • 1dl di olio d'oliva extravergine
  • 1dl di panna
  • sale e pepe

Private il salmone delle lische, lavatelo e tagliatelo a listarelle.
Mettete il porro ad appassire in 4 cucchiai d'olio; unite i piselli, fateli insaporire, regolate di sale e pepe, versate 2dl di acqua e portate a ebollizione; cuocete per 10-15 minuti, mescolando ogni tanto. Mettete da parte una cucchiaiata di piselli ben sgocciolati, passate quelli rimasti al passaverdure e raccogliete il purè nel tegame di cottura; unite i piselli tenuti da parte, la panna, il basilico, lavato, asciugato e tritato, e fate scaldare il tutto.
Rosolate le listarelle di salmone per 2-3 minuti in un tegame con il resto dell'olio, facendole dorare leggermente; regolate di sale e di pepe.
Fate cuocere le pappardelle in abbondante acqua salata; scolatele al dente, condite con la crema di piselli, aggiungete e listarelle di salmone e servite. 


 

giovedì 16 agosto 2012

Moviedrome. Part 1.

Just for changing a bit the tone of my posts on this blog, I'd like to share with people who read me another my facet.
I'm really a huge movie lover. That doesn't mean that I spend a day per week at the movie theatre. Actually I'm quite picky and my friends usually have problems when they try to convince me to watch a movie that I judge just-good-enough along with them.
I know it could sound pretentious but I've quite good tastes. Thus I'd like to suggest the last movie I watched The Illusionist : a lovely animated drama about a French illusionist. Very sensitive. Hope you'd like it too.
Enjoy

-----------------------------------------------------------------------------------------------

Tanto per cambiare il tono dei miei postdi questo blog, mi piacerebbe condividere con chi mi legge un altro mio aspett
Sono un grande appassionato di cinema. Questo non significa che spenda un giorno a settimana al cinema. A dire il vero sono abbastanza selettivo e i miei amici di solito hanno problemi quando provano a convincermi di guardare un film con loro che reputo appena sufficiente.
So che potrebbe sembrare pretenziono ma ho dei gusti abbastanza buoni. Perciò mi piacerebbe suggerire l'ultimo film che ho visto L'Illusionista : un adorabile dramma in cartoni animati su un illusionista francese. Molto poetico. Spero piaccia anche a voi.
Godetevelo.

martedì 14 agosto 2012

Italians do it better. Part 8.

After the Olympics and its kitsch and faboulous closing ceremony let's go back to the usual post regarding food. Maybe it's that reason why I have a few Russian readers on this blog.

Ingredients (for 4 persons)
  • 320g of tagliatelle (a type of pasta)
  • 5 zucchini
  • 600g of shelled shrimps
  • 1 chopped garlic clove
  • chopped pearsley
  • olive oil
  • 100g of bechamel
  • salt
Wash the zucchini, dry, cut them into thin slices and fry the chopped garlic and parsley in a little oil
In the meanwhile, boil for a few minutes the shrimps in boiling salted water.
When the zucchini are lightly golden, put the shrimos and cook them for a few minutes.
Cook the tagliatelle  in salted water until al dente, drain and mashthem  in pan with the sauce of zucchini and shrimps, then add the sauce to amalgamate. Transferred to a warmed serving dish and serve piping hot tagliatelle.  
Buon appetito.
The result sholud be similar (hopefully better) of this one.


----------------------------------------------------------------------------------------------

Dopo le Olimpiadi e la sua kitsch e meravigliosa cerimonia di chiusura torniamo ai post riguardanti il cibo. Forse è per questo che ci sono anche dei russi seguono il blog.

Ingredienti (for 4 persone)

  • 320g di tagliatelle paglia e fieno
  • 5 zucchine
  • 600g di gamberi sgusciati
  • 1 spicchio d'aglio tritato
  • prezzemolo tritato
  • olio d'oliva estravergine
  • 100g di besciamella
  • sale
Lavate bene le zucchine, asciugatele, tagliatele a rondelle sottili e fatele rosolare con il trito di aglio e prezzemolo in poco olio.
Nel frattempo, lessate per qualche minuto i gamberi in acqua bollente salata.
Appena la zucchine saranno leggermente dorate, unite i gamberi e fate cuocere per qualche minuto.
Cuocete le tagliatelle in abbondante acqua salata, scolatele al dente e passatele nella padella con il sugo di zucchine e gamberi, aggiungendo infine la besciamella per legare il tutto. Trasferite su un piatto da portata riscaldato e servite le tagliatelle ben calde.




lunedì 6 agosto 2012

A midsummer long weekend

The tradition of long weekend is something pretty new for me, being an Italian and a new immigrant.
Back in Italy we don't have this kind of statuatory holiday, so every time my coworkers or room mates tell me about an upcoming long weeking I'm usually the last one to know about that.
Last week was pretty gloomy and rainy, so I took advantage of the sunny - and a bit too warm - weekend for an hike along with friends on Saturday at the Rawson Lake. A place of an extraordinary beauty.
I shot a bit of photos. There're some of them. Oh, I apologize for my not so intelligent look in the photo. Lol




On Sunday, instead, I managed to watch "A midsummer night's dream" performed by the folks of  Shakespeare in the Park 
They are a bunch of very talented actors (and crew) that can give you surely 2 hours of good play. They deserve a little donation.






That's all folks.
-------------------------------------------------------------------------------------------
La tradizione dei weekend lunghi è qualcosa di nuovo per me, essendo italiano e nuovo nel paese.
In Italia non abbiamo questo tipo di feste civili, perciò ogni volta che i colleghi o i coinquilini mi parlano di un prossimo weekend lungo, sono l'ultimo a saperlo.
La scorsa settimana è stata abbastanza nuvolosa e piovosa, quindi ho approfittato del weekend soleggiato - e un po' troppo caldo - per andare a fare un'escursione con amici sabato scorso al Lago Rawson. Un posto di straordinario bellezza.
Ho scattato delle foto e ne ho pubblicata qualcuna. Chiedo scusa in anticipo per la mia espressione non proprio intelligente nella foto.
Domenica, invece, sono riuscito a partecipare a "Sogno di una notte di mezza estate" eseguito dai membri di Shakespeare in the Park 
Sono degli attori (e cast, in generale) talentuosi che intrattengono con piacere per 2 ore. Meritano una piccola donazione.
Questo è quanto.