CHUVASH.eu

CHunky Universe of Vigouros Astonishing SHarepoint :)

Configuring VirtualBox for SharePoint-Hosted Apps

Recently I have switched from VMWare to VirtualBox for my SharePoint Development. So far it really works good. I have prepared this guide for configuring VirtualBox for SharePoint-hosted apps. That means we need a new adapter with a static ip address. All the steps done inside the virtual machine are applicable for VMWare and Hyper-V, too. This guide does not cover the full configuration of the app environment, it covers only the network and dns settings needed for SharePoint-hosted apps on Premises in a Development machine.

In VirtualBox open Preferences:

002-vbox

In Preferences, click on Network, then on Host-only Networks, click on “plus”

003-vbox

After a new host-only Network adapter has been created, click on the screwdriver image to configure the network:

004-vbox

Remember this ip address, you can alter it, of course. Or use this: 192.168.64.1, then you can have the same settings in your environment as I have:

005-vbox

Go on to the settings for your Virtual Machine. Enable Adapter 2, as shown on the picture below.

006-vbox

The rest are the settings in your virtual machine. Open Network Connections in the Control Panel. For the newly added Network Adapter (Ethernet 2), open Properties:

007-vbox

Then open Properties for “Internet Protocol Version 4 (TCP/IPv4)”

008-vbox

Remember the ip address for you VirtualBox host-only Network? I have 192.168.64.1. Increment the last number (192.168.64.2) and use it as the ip address for your adapter. The default gateway is 192.168.64.1 as the the VirtualBox host-only Network. The DNS Server should be the same as the virtual machine, the same adapter: 192.168.64.2:

009-vbox

Open DNS Manager, right-click on Forward Lookup Zones and start the New Zone Wizard by clicking on “New Zone…”:

010-vbox

Follow the steps in the wizard:

011-vbox

Choose “Primary Zone”:

012-vbox

Keep the default setting: “To all DNS Servers running on domain controllers in this domain:

to-all-servers-vbox

Write your app domain. I use takanaapps.local:

014-vbox

Choose “Do not allow dynamic updates”:

015-vbox

Then finish the New Zone Wizard:

016-png

In the new forward lookup zone (takanaapps.local), add a new wildcard cname entry (alias):

017-vbox

Just add an asterisk and point it to your main domain (takana.local in my case):

018-vbox

After that you should be able to ping any subdomains of your app domain (xyz.takanaapps.local, abc.takanaapps.local):

019-vbox

When you start adding apps to your sites, you should add app sites to your local intranet zone (to be automatically signed in in apps webs). This setting in IE will affect Chrome as well. Go to the Options in the Internet Explorer:

020-vbox

In the Security tab -> Local Intranet, click on Sites:

021-vbox

Click on Advanced button:

022-vbox

Add your new app domain with an asterisk in front of it to the “Websites” of the Local Intranet:

023-vbox

Sources

A presentation about PowerShell and SharePoint

Yesterday I had a little presentation about PowerShell basics in the SharePoint context. Here you can see the presentation I’ve published on slideshare. The text is in Swedish.

A PowerShell one liner

PowerShell is powerful. You can write concise, well formulated, functional-style code. Recently I got the following quiz:

You’ve got $100. You have to buy exactly 100 animal, at least 1 dog, 1 cat and 1 mouse. 1 dog costs $15, 1 cat costs $1, 1 mouse costs $0.25.

There can be  many ways to solve it. But look at this one line solution. It is quite impressive what you can do with PowerShell

1..98 | % {
    $dog = $_
    1..98 | % {
      $cat = $_
      @{
        "Dog" = $dog
        "Cat" = $cat
        "Mouse" = 100 - $dog -$cat
      }
    }
  } | ? {
      $_.Mouse -gt 0
  } | ? { $_.Dog * 15 + $_.Cat * 1 + $_.Mouse * 0.25 -eq 100 }

This solution uses ranges, dynamic objects (PSObject), nested for loops, implicit returns and advanced filtering. All that is is out-of-the-box PowerShell.

AngularJS Performance Tuning for Long Lists

Anatoly Mironov:

This is a must-read for all SharePoint Developers who use Angular.

Originally posted on Small Improvements:

AnglarJS is great! But when dealing with large lists containing complex data structure, things can get very slow! We ran into that problem when migrating our core admin screens to AngularJS. The screens were supposed to work smoothly when displaying some 500 rows. But the first approach took up to 7 seconds to rende. Terrible!

We discovered two main performance issues for our implementation. One is related to the ng-repeat directive, the other was related to the filtering.

The following article summarizes our experiences with different approaches to solve or mitigate the performance problem. It will give you ideas and hints, what you can try out yourself and what is maybe not be worth a try.

Why is ng-repeat in AngularJS slow with large lists?

The ng-repeat directive of AngularJS is getting slow above 2500 two-way data bindings. You can read more about this in a post by Misko Hevery…

View original 1,404 more words

Updating hover style in IE8 Developer Tools

In our project we still have to support Internet Explorer 8. The CSS issues in IE8 are most difficult to debug and solve. You can not add a new rule in Developer Tools or toggle the state of an element to hover as in moder web browser dev tools.

One solution that I’ve come up to today, is to add a style with javascript or jQuery, open the script pane in IE8 Dev Tools and add this line:

$('<style>.ms-srch-item:hover {filter:none !important;}</style>')
   .appendTo($('body'))

This will fill update the hover effect of the .ms-srch-item directly.

ie8-devtools-001

 

That’s it, just a little tip.

Debugging “What’s happening” in Communities

Recently an issue was reported about count mismatches in SharePoint 2013 Communities. The number of replies in category tiles sometimes is different compared to the community stats in the web part called “What’s happening”. The actual number of replies is 1 in the figure below. The user who has reported has tried to add, update and delete discussions and replies.

 

category-replies-count.png   comm-002

I have invested some time debugging this issue. It would be pity to not share my findings. Well the first thing to do was to determine the type name for the “What’s happening” web part. To do so just edit the  page and export the web part. In the exported .webpart file I saw that the type was Microsoft.SharePoint.Portal.WebControls.DashboardWebPart.

With that knowledge it is time to open ILSpy, an awesome and free(!) assembly browser and decompiler. Load the “Microsoft.SharePoint.Portal” assembly from GAC into ILSpy. Then use F3 to search for DashboardWebPart:

comm-003

The number of replies is retrieved from SPWeb.AllProperties:

comm-004

If the Property Bag does not contain it, it gets the number of replies from the list. The formula is as follows:

list.ItemCount - list.RootFolder.ItemCount

It means that it gets the number of both discussions and replies: ItemCount of Discusssions List. The number of Discussions is determined by the ItemCount in the RootFolder of the Discussions List. Discussions are List Items in the RootFolder (num2 in the figure below). Replies are saved in the subfolders, every discussion gets an own folder. The number of all replies are num3 in the figure below.

comm-005

After checking the web properties I could see that the number of replies there were wrong: 2.

The next step was to determine where and when the Web Properties are updated. The first guess every SharePoint Developer has in such cases is an EventReceiver. Here are all EventReceivers connected to the Discussions List:

$list.EventReceivers | select class, Type, Synchronization | Out-GridView

comm-006

Allright, CommunityEventReceiver then:

comm-007

Found where the actual update happens: CommunityUtils.UpdateWebIndexedPropertyBag

comm-008

The method is used in DiscussionListCommunityEventHandler.HandleEvent

comm-009

There is a flag, flag5 that is used to determine if the Web Properties should be updated:

comm-010

But the flag5 is not true on Delete operations in some code flows:

comm-011

 

That’s it. So deleting a reply will not have any effect on “What’s happening”. But adding a new discussion will also update the stats:

comm-012

To summarize the debug session, there is an issue in the OOB code that misses to update community stats when deleting a discussion or a reply. Adding a new discussion, or a reply will synchronize the stats.

How to reference nested class or struct etc, in PowerShell

Originally posted on Discovering SharePoint:

I had a problem trying to reference a struct inside a public class from PowerShell. I tried to do it just like in C#, only with PowerShell syntax, simply adding the nested class or struct in the namespace, separated by a dot.

Doesn’t work:

$myProperty = [MyProject.MyClass.MyClassStruct]::MyProperty

But this didn’t work. Instead I got the following error:
Unable to find type [MyProject.MyClass.MyClassStruct]: make sure that the assembly containing this type is loaded.”

It seems, after fiddling around a bit and doing a quick search, that PowerShell has it’s very own way of calling a nested class or struct. Instead of adding the nested class with a dot, you actually have to use a +, like this:

Works:

$myProperty = [MyProject.MyClass+MyClassStruct]::MyProperty

I don’t know why, but that’s the way you do it. =)

Resources:

http://stackoverflow.com/questions/14141690/special-use-of-plus-sign-in-powershell

View original

IntelliJ Keyboard Shortcuts

Anatoly Mironov:

I want to use shortcuts. I prefer the IntelliJ keyboard scheme. Which do you use?

Originally posted on Cheat Sheets for Quick Reference:

Command Shortcut
(Visual Studio)
Shortcut
(IntelliJ IDEA/ReSharper 2.x)
Show available quick-fixes and context actions Alt+Enter Alt+Enter
Paste multiple Ctrl+Shift+V
Code cleanup Ctrl+E, C Ctrl+Alt+F
Silent code cleanup Ctrl+E, F Ctrl+Shift+Alt+F
Symbol code completion Ctrl+Space Ctrl+Space
Smart code completion Ctrl+Alt+Space Ctrl+Shift+Space
Import symbol completion Shift+Alt+Space Ctrl+Alt+Space
Complete statement Ctrl+Shift+Enter Ctrl+Shift+Enter
Parameter information Ctrl+Shift+Space Ctrl+P
Quick documentation Ctrl+Shift+F1 Ctrl+Q
Insert live template Ctrl+E, L Ctrl+J
Surround with template Ctrl+E, U Ctrl+Alt+J
Generate code Alt+Insert Alt+Insert
Create file from template Ctrl+Alt+Insert Ctrl+Alt+Insert
Move code up Ctrl+Shift+Alt+Up Ctrl+Shift+Alt+Up
Move code down Ctrl+Shift+Alt+Down Ctrl+Shift+Alt+Down
Move code left Ctrl+Shift+Alt+Left Ctrl+Shift+Alt+Left
Move code right Ctrl+Shift+Alt+Right Ctrl+Shift+Alt+Right
Extend selection Ctrl+Alt+Right Ctrl+W
Shrink selection Ctrl+Alt+Left Ctrl+Shift+W
Duplicate a line or selection Ctrl+D Ctrl+D
Comment with line comment Ctrl+Alt+/ Ctrl+/
Comment with block comment Ctrl+Shift+/ Ctrl+Shift+/
Inspect this Ctrl+Shift+Alt+A Ctrl+Shift+Alt+A
Inspection Results window Ctrl+Alt+V
Turn code analysis on/off Ctrl+Shift+Alt+8 Ctrl+Shift+Alt+8

Navigation and Search

Command Shortcut
(Visual Studio)
Shortcut
(IntelliJ IDEA/ReSharper 2.x)
Find…

View original 312 more words

Tip: Use the weakest CSS selectors

I am reading Mobile HTML5 written by Estelle Weyle. It is an awesome recap and new knowledge about html, css and javascript. I want to highlight one of tips I got: Use the weakest CSS selectors (can be found on page 204).

We all know, that inline CSS and !important are evil. They have a higher level of specifity and override the standard cascade of the CSS rules. If you use !important, then it will be hard to override CSS rules when you really need it. After these two classic “evils” the evil number three is overqualifying of CSS selectors. You should really never add more classes or ids or elements than needed. Consider this:

.warning {
  background-color: red;
}

It is often enough, you don’t need those:

html .warning
div .warning
div.warning, div &gt; .warning
body p#myP.blue strong.warning

SharePoint

In SharePoint sometimes we want override some OOB CSS rules. We have our own “namespace” to do that really simple. We have added a class to the html tag: “contoso-html”. Then it was really easy to update any OOB CSS rules, just copy the selector and add .contoso-html:

.contoso-html #s4-workspace { }

We also use less preprocessor and nest our selectors which has resulted that almost all of our selectors contain .contoso-html. Now back to the tip of that blog. This “namespace” made it harder to adjust CSS rules for special cases, like left navigation in the Search Center, we were forced to add more specific selectors, and selectors became bigger and bigger.

What I would recommend today is to skip the .contoso-html namespace in the CSS but keep it in the masterpage markup, use it wisely, meaning only if the original rule doesn’t work. Don’t nest too much in less files. Try always to find the weakest CSS selector. It is especially important in the SharePoint “markup djungle”.

It is time to standardize the Chuvash Keyboard Layout

Proto-Bulgarian Runes. Wonder if they are supported in Unicode :)

Proto-Bulgarian Runes (Chuvash language is the closest language to the Proto-Bulgar language). Wonder if they are supported in Unicode :)

The Chuvash Computer Keyboard layouts have existed since 2001, but due to the lack for Unicode support we were forced to use the look-alike letters  from other latin-based keyboard layouts. On Linux The Chuvash keyboard layout was added in 2007 and Linux is still the only operating system that has a native keyboard layout for Chuvash language. On Windows we have used the Keyboard Layout Creator and distributed it as an executable file.

Today, when Windows XP is not supported anymore, the majority of users now have full support for the correct Chuvash letters from the Extended Cyrillic table. These four Chuvash letters are “additional” to the Russian alphabet: ӐӖҪ and Ӳ.

Now when new “keyboards” appear on Android, in web browser (they use the standardized letters) and hopefully in Windows and iOS, we have to consider put the correct letters into the keyboard layouts. For Linux the /usr/share/X11/xkb/symbols/ru file has to be updated:

// Chuvash language layout
// Anatoly Mironov @mirontoli
partial alphanumeric_keys
xkb_symbols "cv" {
    include "ru(winkeys)"

    name[Group1]= "Chuvash";

    key.type[group1]="FOUR_LEVEL";

    key        <AD03> {        [      Cyrillic_u,	Cyrillic_U,
                            0x010004f3,    0x010004f2      ]       };
    key        <AD05> {        [      Cyrillic_ie,     Cyrillic_IE,
                       0x010004d7,	0x010004d6     ]       };
    key        <AC04> {        [      Cyrillic_a,	Cyrillic_A,
                          0x010004d1,  0x010004d0      ]       };
    key        <AB03> {        [      Cyrillic_es,     Cyrillic_ES,
                            0x010004ab,    0x010004aa      ]       };

    include "level3(ralt_switch)"
};

Impact

This switch will have a huge impact on the Chuvash language. Much of content on forums, websites and Chuvash Wikipedia will be hardly searchable. But we have to do it, to standardize and prepare for the future. The Chuvash language Committee is not against it, despite it has not been updated the guidelines for using letters from 2009.

Edit 2014-04-30

The bug in the freedesktop bugzilla was solved very quickly. In fact, in the new Ubuntu 14.04 you’ll find a correct keyboard layout:

chuvash-keyboard-map

Here is the source code:
chuvash-keyboard-xkb

partial alphanumeric_keys
xkb_symbols "cv" {
    include "ru(winkeys)"

    name[Group1]= "Chuvash";

    key.type[group1]="FOUR_LEVEL";

    key        <AD03> {        [      Cyrillic_u,	Cyrillic_U,
                          U04F3,    U04F2      ]       };
    key        <AD05> {        [      Cyrillic_ie,     Cyrillic_IE,
                          U04D7,    U04D6     ]       };
    key        <AC04> {        [      Cyrillic_a,	Cyrillic_A,
                          U04D1,    U04D0      ]       };
    key        <AB03> {        [      Cyrillic_es,     Cyrillic_ES,
                          U04AB,    U04AA      ]       };

    include "level3(ralt_switch)"
};
Discovering SharePoint

And having fun doing it

Bram de Jager's SharePoint blog

My view and thoughts on SharePoint.

My programming life

and everything in between

SharePoint Development Lab by @avishnyakov

It is a good place to share some SharePoint stories and development practices.

SharePoint Dragons

Nikander & Margriet on SharePoint

The Zuul Cat Idea Brewery

Where ideas on software development and entrepreneurship brew.

Paul J. Swider

Inspire! Teach! Awe!

Mai Omar Desouki - Avid SharePointer

Egyptian & Vodafoner - Senior SharePoint Consultant

Alexander Ahrens

MCPD | SharePoint | Web Development | JavaScript | .NET

Cameron Dwyer | SharePoint, Outlook, OnePlaceMail

OnePlaceMail, SharePoint, Outlook & Life's Other Little Wonders

.:paul.tavares:.

Me and My doings!

Share SharePoint Points

By Mohit Vashishtha

Jimmy Janlén "Den Scrummande Konsulten"

Erfarenheter, synpunkter och raljerande om Scrum från Jimmy Janlén

SPJoel

SharePoint for everyone

SharePointRyan.com

Ryan Dennis is a SharePoint Solutions Architect with a passion for SharePoint and PowerShell

SharePoint 2020

The Vision for a Future of Clarity

Aharoni in Unicode, ya mama

Treacle tarts for great justice

Follow

Get every new post delivered to your Inbox.

Join 205 other followers