Wednesday, September 19, 2012

Why Windows 8 is the best for IT Pros?

What is my daily round?

  1. I am a consultant and have to make demos and presentations every week as well as to work on projects
  2. I have to run multiple virtual machines, most of them x64 based
  3. All VMs have to run on Hyper-V (I am working at Microsoft), I have many preinstalled VMs/vhd
  4. I need also client experience
    1. Working on laptop I want relevant power management
    2. Using of WiFi network as connectivity for my VMs
    3. The computer has to be domain joined

 

Where was the issue with Windows 7 (Enterprise)

  1. There was not an option to run x64 bit Hyper-V VMs on Windows 7
  2. I configured my laptop for dual boot with Windows Server 2008 R2 and Hyper-V role enabled – disadvantages:
    1. Often I have to switch (reboot) between Windows 7 and Server
    2. No sleep function on Windows server
    3. Could not use the WiFi network as external network for Hyper-V

 

A real business case

Waiting for boarding on Zagreb’s airport I was writing a project document on my Windows 7 PC. I had to add a screenshot of tool for SharePoint 2010 (console app) which I developed during the build phase. Options:

  • To reboot the laptop, run in server mode, start a VM, snap the tool and reboot back to 7 – Wow, awfully!
  • To send the app (.exe) to friend, ask him to run the tool, to make a screen shot and return it back via E-mail – sounds better, right?

I choose the 2nd option!

 

Now, the solution!

image

 

Finally I am happy, Windows 8 is exactly what I want!

  • My Hyper-V VMs work with no need of dual boot!
  • I can use the wireless link in virtual network – could have a real working environment everywhere
  • Could use dynamic memory and assign up to 8 virtual processors per VM (I have quad core Intel i7 with HT)
  • Even on PC sleep, when a VM is powered on, it comes back again on wake up
  • I can use all my other tools and apps when I work on VM, perfect!

 

image

 

Do not wait to improve your life, do it now! Smile

Tuesday, July 17, 2012

Let’s start with SharePoint 2013 Preview

Finally it is here, with no NDA! Smile

Let’s start, check what is new: http://technet.microsoft.com/en-us/library/cc261970(v=office.15)

Check the requirements: http://sharepoint.microsoft.com/en-us/Preview/sharepoint-requirements.aspx

Download the bits from here: http://technet.microsoft.com/en-us/evalcenter/hh973397

IT pros training: http://technet.microsoft.com/en-US/sharepoint/fp123606

Developer training: http://msdn.microsoft.com/en-US/office/apps/fp123626

 

And of course, the Vesa’s blog

Wednesday, May 30, 2012

Open the Edit Form of External List from BCS Profile Page

Recently I had a business scenario, where the user wanted to use a Business data in not traditional way:

  • To find a particular entity instance with not using of search – the external system contains 20+ millions of entries, the crawl time (full and incremental) will be significant and have to be processed daily
  • To edit an entity instance with no browsing of External List – there is no way to find the particular item in the EL

Finally I designed the following solution:

  • Developed a BCS .net assembly connector in Visual Studio, which connects to Oracle database. It contains a few entities, but for simplicity we will focus on only one – Customer. It has three operations – Finder, Specific Finder and Updater and identifier UNID (string)
  • After deployment on my SPS 2010 I created a profile page in the standard way, through BDC service application’s management page in CA
  • Meanwhile I created a small configurable web part which accepts two parameters (text boxes) Customer_ID and Date (because of the business users), executes a SQL query against the Oracle and returns the UNID of the only record. The web part redirects the user to the profile page, created in the previous step. Actually this small component plays as an “item picker” which opens the item’s profile page!
  • Additionally I created an external list with view and edit forms

So, the biggest question was HOW once landed on the profile page the user can jump directly to the Edit form ??? Where is the problem? The edit form expects a parameter BcsIdentity instead of UNID and there is not a normal way to get it.

  • I added a BCS action (not external list custom action) from BDC service application’s management page in CA. Named it “EDIT” and the URL was the URL of my EditForm.aspx http://myportal/List/MyExternalList/EditForm.aspx?UNID={0}, where UNID is the identifier of my entity
  • The action is visible/accessible from the profile page. Clicking on it the user jumps to EditForm.aspx, but with wrong parameter ?UNID=123456, instead of ?ID=<BcsIdentity> and the form is empty
  • I developed a second web part, which reads the UNID parameter from the query string and encodes it in “a BCS way”

SmileSmileSmile

string unid = qstr["UNID"];
object[] identifiers = { unid };
string identifiersEnc = EntityInstanceIdEncoder.EncodeEntityInstanceId(identifiers);
string newUrl = string.Format("{0}&{1}={2}&source={3}", Page.Request.Url.ToString(),newQstrParamName, identifiersEnc, SPContext.Current.Site.Url);
Page.Response.Redirect(newUrl, true);

Finally the code redirects the browser to the same page (EditForm.aspx) but with newly added parameter ID=”myEncodedIdentifier” and the Edit form work as expected!

Special thanks to Pradeep Kamalakumar, for his significant help!

Tuesday, October 11, 2011

Ribbon Customizations and CustomActions in SharePoint 2010

In the beginning of October 2011 we did the second off-site meeting with our User Groups in Bansko (Bulgaria). Below are the slides and demo code from my presentation.


I covered the development of customizations, for SharePoint 2010 user interface, meaning custom actions, ribbon elements, notifications, statuses and dialog framework.




You could download the full Visual Studio project from here:http://db.tt/eZncKy2E


It contains an extra code for playing with bulk selection, ribbon button and modal dialog. Feel free to use it Smile


Simple ribbon button


                <!-- Simple button -->
<
CommandUIDefinition Location="Ribbon.Library.Share.Controls._children">
<
Button Id="Ribbon.Library.Share.SugbgButton"
Command="SugbgButtonCommand"
Image32by32="/_layouts/images/PPEOPLE.GIF"
LabelText="Hello SUGBG"
TemplateAlias="o1" />
</
CommandUIDefinition>


Tooltip ribbon button


                <!-- ToolTip button -->
<
CommandUIDefinition Location="Ribbon.Documents.New.Controls._children">
<
Button Id="Ribbon.Documents.New.Ribbontest"
Alt ="Test Button"
Sequence="5"
Command="RibbonTestCommand"
LabelText="Test Button"
Image32by32="/_layouts/images/QuickTagILikeIt_32.png"
TemplateAlias="o1"
ToolTipTitle="My test button tool tip"
ToolTipDescription="My tool tip description"
ToolTipShortcutKey="Ctrl-T,E"
ToolTipImage32by32="/_layouts/images/mwac_infob.gif"
ToolTipHelpKeyWord="WSSEndUser"/>
</
CommandUIDefinition>


Replace an existing ribbon button (New Folder)


                <!-- Replace a button -->
<
CommandUIDefinition Location="Ribbon.Documents.New.NewFolder" >
<
Button Id="Ribbon.Documents.New.NewFolder.MyNewFolderButton"
Alt ="Test button"
Sequence="5"
Command="MyNewFolderButtonCommand"
LabelText="New Folder"
Image32by32="/_layouts/images/menureply.gif"
TemplateAlias="o1" />
</
CommandUIDefinition>


Add ribbon button to edit form


                <!--Add a button to the edit form-->
<
CommandUIDefinition Location="Ribbon.DocLibListForm.Edit.Actions.Controls._children" >
<
Button Id="Ribbon.DocLibListForm.Edit.Actions.MySettings"
Command="EditFormButtonCommand"
Description="Go to settings"
LabelText="Site Settings"
Image32by32="_layouts/images/settingsIcon.png"
TemplateAlias="o2"
Sequence="91"/>
</
CommandUIDefinition>


All elements above are using the these handlers:



            <CommandUIHandlers>
<
CommandUIHandler Command="SugbgButtonCommand"
CommandAction="javascript:HelloRibbon();" />


<
CommandUIHandler Command="RibbonTestCommand"
CommandAction="javascript:alert('RIBBON-test was clicked');" />


<
CommandUIHandler Command="MyNewFolderButtonCommand"
CommandAction="javascript:alert('I replaced the OOB New Folder :)');" />


<
CommandUIHandler Command="EditFormButtonCommand"
CommandAction="/_layouts/settings.aspx" />
</
CommandUIHandlers>


HelloRibbon() function and related javascriptcode also could be deployed with CustomAction



    <CustomAction Id="Ribbon.Library.Actions.NewButton.Script"
Location="ScriptLink"
ScriptBlock="
function HelloRibbon()
{
alert('Hello, Ribbon Script is here!');
}
" />


Very powerful Visual Studio add-in for quick start with ribbon customizations are SharePoint 2010 Extensibility Projects and especially SharePoint Ribbon VSIX



 



Other CustomActions



    <!-- Custom Action Group in Site Settings page -->
<
CustomActionGroup
Id="MyActionGroup"
Description="This group contains all my custom actions."
Title="My Action Group"
Location="Microsoft.SharePoint.SiteSettings"
Sequence="30"
ImageUrl="/_layouts/images/mwac_textpb.gif"/>

<!--
Custom Action in Custom Action Group in Site Settings page -->
<
CustomAction
Id="MyCustomAction"
Description="This link is a custom action."
Title="My Custom Action"
GroupId="MyActionGroup"
Location="Microsoft.SharePoint.SiteSettings"
Rights="ManageWeb"
RequireSiteAdministrator="FALSE"
Sequence="20">
<
UrlAction Url="~sitecollection/_layouts/create.aspx" />
</
CustomAction>

<!--
Custom Action in Site Actions Menu -->
<
CustomAction
Id="MyNewCustomAction"
Description="This menu item is a new custom action."
Title="My New Custom Action"
GroupId="SiteActions"
Location="Microsoft.SharePoint.StandardMenu"
ImageUrl="/_layouts/images/mwac_thumbb.gif"
Sequence="10">
<
UrlAction Url="~sitecollection/_layouts/settings.aspx" />
</
CustomAction>

<!--
Adding Custom action for items in Document Library-->
<
CustomAction Id="ListMenuForMyPage"
RegistrationType="List"
RegistrationId="101"
ImageUrl="/_layouts/images/GORTL.GIF"
Location="EditControlBlock"
Sequence="105"
Title="My Page" >
<
UrlAction Url="DispForm.aspx?ItemId={ItemId}&amp;ListId={ListId}" />
</
CustomAction>


Playing with Dialogs – below is the client code which shows dialogs, using Sharepoint 2010dialog framework



<a href="javascript:showMyDialog();" id="ShaowMydialogID" style="display:inline;">
Show MyDialog
</a>


<!--Define dialog inline-->

<div id="SugbgDiv" style="display:none; padding:5px">

    <
input type="text" value="SUGBG dialog" />

    <
input type="button" value="OK" onclick="closeDialog()" />

</
div>







<!--Load Sharepoint ScriptLink-->

<SharePoint:ScriptLink ID="SPScript" runat="server" Localizable="false" LoadAfterUI="true" />







<!--Open Dialogs-->

<script language="ecmascript" type="text/ecmascript">




    var
myDialog;


    var sid;





    function showMyDialog() {


        var MyDialogDiv = document.getElementById("SugbgDiv"); MyDialogDiv.style.display = "block";





        var options = { html: MyDialogDiv, width: 200, height: 200 };


        myDialog = SP.UI.ModalDialog.showModalDialog(options);





    }





    function closeDialog() {


        myDialog.close();








</script>


You could show everything in the modal window, see how to use it to show en ExcelServices chart as image, using REST



<a href="javascript:ExcelChart();" id="ExcelChartID" style="display:inline;">
Excel MyDialog
</a>




<script language="ecmascript" type="text/ecmascript">



function ExcelChart() {
var options = { url: 'http://intranet/_vti_bin/ExcelRest.aspx/Shared%20Documents/Gears%20Sales%20History.xlsx/model/Charts(\'Chart 1\')?$format=image', width: 400, height: 400 };
myDialog = SP.UI.ModalDialog.showModalDialog(options);
}


</script>



Playing with StatusBar



<script language="ecmascript" type="text/ecmascript">



var sid;



//Status bar

function createStatusBar() {
sid = SP.UI.Status.addStatus("My status bar title", "My status bar <a href=\"#\">message<\a>", true);
}

function removeStatusBar() {
SP.UI.Status.removeStatus(sid);
}

function removeAllStatusBars() {
SP.UI.Status.removeAllStatus(true);
}

function updateStatusBar() {
SP.UI.Status.updateStatus(sid,"This is a status update");
}

function appendStatusBar() {
SP.UI.Status.appendStatus(sid,"This is appended", "This is my appended <i>status</i>");
}

function redStatusBar() {
SP.UI.Status.setStatusPriColor(sid, "red");
}

function greenStatusBar() {
SP.UI.Status.setStatusPriColor(sid, "green");
}

function blueStatusBar() {
SP.UI.Status.setStatusPriColor(sid, "blue");
}

function yellowStatusBar() {
SP.UI.Status.setStatusPriColor(sid, "yellow");
}


</script>



Notifications



<script language="ecmascript" type="text/ecmascript">



//Notifications
var notificationId;

function showNotification() {
notificationId = SP.UI.Notify.addNotification("The party has to begin after 6 hours! :)");
}

function removeNotification() {
SP.UI.Notify.removeNotification(notificationId);
}



</script>



Find the download link above to get the full VS project. Enjoy!

Sunday, September 11, 2011

Попово езеро

Бих искал да споделя този маршрут, удачен за приятна разходка с ниска трудност, ако се намирате в Банско, Добринище или околността Smile

Изходна точка – лифтът на Добринище при х. Гоце Делчев, през лятото отваря в 8:30. Пътуване с лифта до х. Безбог, около 30 мин.

P1020659

P1020666

От хижата тръгвате по маркирана пътека за Поповото езеро. Гледката е невероятна, трудността ниска, единственият стръмен участък е непосредствено след езерото пред х. Безбог.

P1020673

P1020676

P1020677

До езерото е около час и половина умерено към бързо темпо. Препоръчвам да се тръгне от долна станция на лифта възможно най-рано, зада се избегнат тълпите, особено през почивните дни.

P1020679

P1020683

P1020691

Изключително примамливо е да решите да “отскочите” до Крменските езера с допълнителен двучасов преход.

ВНИМАНИЕ, преценете добре и времето за връщане до х.Безбог, лифтът затваря в 16ч

P1020696

Водата в езерото е порядъчно студена, но ентусиасти винаги има. И рибата е в изобилие, но не мисля че риболовът е разрешен Smile

P1020697

P1020698

image

и линк до .GPX файла: http://db.tt/zxgzYSa

Sunday, August 7, 2011

От Бистрица до Алеко

Трябваше обезателно днес да се покатеря из Витоша, но от и до- къде, кой маршрут да хвана? Реших да тръгна от Драгалевци под лифта, да се изкача до Голи връх а от там ще му мисля.

И най-важното, този път без колата! Това последното много променя пейзажа, повярвайте ми! В крайна сметка се озовах на бул. Г. М. Димитров на временната спирка на автобусите за Витоша, които по принцип тръгват от Дървеница,… и гледам стои и чака автобус за Железница! Не се чудих много-много и скочих вътре. Поразпитах пътниците къде трябва да сляза в Бистрица, за да тръгна към х. Алеко, но след като не получих особено убедителни отговори реших, че ще сляза в центъра на селото и там ще видим кое накъде.

Поради ремонта по Бистришко шосе раздрънканият автобус пое през Студентски град и Симеоново, но за 20-тина  минути се затътрихме до крайната ми цел.

Та казано накратко от центъра на селото по ул. Стефан Стамболов (посоката е запад) след около 30 минути се стига до малък паркинг, в дъното на който има табела:

P1020637

От там поех на дясно и след малко се стига до “разклон”

P1020639

Както се вижда от бялата табела, до Алеко е 3:30 ч, но в крайна сметка аз го взех за 2:40 и то с умерено темпо.

Пътят в един момент минава покрай реката, ето и малко снимки:

P1020643

P1020641

P1020642

После навлязох в резервата Бистришко бранище

P1020646

И тук стана интересно! Първо, покрай пътеката имаше супер много узрели и необрани горски малинки, явно този маршрут не беше от най “оборотните”. Второ, навлязох в областта, където миналата година беше вилняла бурята и там гледката е меко казано странна – огромни изпочупени дървета, разхвърляни на всички посоки като кибритени клечки. Благодарности към управата на парк Витоша, изчистили са пътеките и се преминава безпрепятствено. След това се навлиза във вече “здрава” гора и тук срещнах първите туристи идващи от Алеко – две семейства с деца. оказа се, че остава съвсем малко, което доста ме учуди! наистина започнах да срещам повече хора и 20 минути по-късно бях на оживените пътеки до ски пистите.

Тотал – 2 часа и 40 мин, по невнимание за малко бях спрял GPS тракера, но ето и картинката:

281682_10150277720879791_643429790_7404111_5485440_n

Горната картинка в Google Maps

http://maps.google.com/maps/ms?msid=203956868503440711176.0004aa2a9a082971aaa9f&msa=0

и линк до .GPX файла: http://db.tt/AMDx58m