Need job

Looking for job in Europe. Please contact thru LinkedIn profile.

Thursday, November 14, 2013

How to hide keyboard without first responder

In any place call:
[self.view endEditing:true];
will hide keyboard. 

So, result the same as you call [sender resignFirstResponder] but in this case you need an object or you need to find him.

Friday, August 23, 2013

UITableView custom Separator Insets workaround

Hello everybody.
Here is a workaround when you try to set custom separator insets thru IB in Xcode Version 5.0 (5A11365j).
If you try, you will get:
Exception while running ibtool: *** -[NSKeyedArchiver encodeValueOfObjCType:at:]: this archiver cannot encode structs

Fix with coding:

UIEdgeInsets edges;
edges.left = 0;
tableTripPoints.separatorInset = edges;

Thursday, August 15, 2013

How to change "Placeholder" text colour for UITextField

You need to assign colour for key path "_placeholderLabel.textColor" in User defined runtime attributes.
Its simple and "no coding".


Wednesday, August 14, 2013

Make view controller transparent

You need to place a view controller in to "Container view".
Its new iOS 6 control.
Then you just need to change an alpha to desired value.
Thats it!

Thursday, July 4, 2013

Powershell remote .NET assembly deploy to GAC

If you need to deploy something to remote iis server by coping assemblies, here is a script. 
In my case i have a hyper-v sharepoint 2013 for development. 
I can compile, deploy and debug remotely.

To copy files you can use another post from this blog.

$s = New-PSSession -computerName someserverHostname.ru
Invoke-Command -Session $s -Scriptblock {
    $gacUtil = "${Env:ProgramFiles(x86)}\NETFX 4.0 Tools\gacutil.exe";
    $filesOnServer = Get-ChildItem C:\folderNameOnServer  -Recurse | Where-Object {$_.name -like '*.dll'}  | Select-Object fullname
    $filesOnServer  | % {
        & $gacUtil '/nologo' '/if' $_.fullname;
        $_.fullname;
    }
    iisreset;
;}
Remove-PSSession $s

Wednesday, April 24, 2013

Sharepoint REST with cyrillic column names

To use link like that {site}/_vti_bin/listdata.svc/{list}?$filter=Название eq 'London'
you need to encode cyrillic word.
Here is a service to do it http://meyerweb.com/eric/tools/dencoder/

Proper link is {site}/_vti_bin/listdata.svc/{list}?$filter=%D0%9D%D0%B0%D0%B7%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5 eq 'London'

Thursday, February 21, 2013

Remote upgrade Sharepoint solution with PowerShell

Hello everybody!
Here is a script to upgrade Sharepoint solution on remote server.
U need to allow the remote powershell on the server.
U can replace the sriptblock with any commands. For example Add-Solution)

net use W: /delete
net use W: \\serverName\C$\folder
copy "C:\Users\user\Documents\Visual Studio 2012\Projects\Project\bin\Debug\Project.wsp" W:\
$s = New-PSSession -computerName serverName
Invoke-Command -Session $s -Scriptblock {Add-PSSnapin Microsoft.SharePoint.Powershell;Update-SPSolution -Identity Project.wsp -LiteralPath c:\folder\Project.wsp -GACDeployment}
Remove-PSSession $s

Monday, February 18, 2013

SPItemEventReceiver invoke source detection

How to detect who has update item? User from web browser or web service?
The solution is to store "Label" in thread data slot.
Sync receivers like Adding and Updating executes in the same thread as update code, in my case is web service.

Update Ready-to-use code
using System;
using System.Threading;

namespace Common
{
    public class Threading
    {
        public static void MarkThreadWith(string mark, object val)
        {
            LocalDataStoreSlot store = Thread.GetNamedDataSlot(mark);
            if (store == null)
            {
                store = Thread.AllocateNamedDataSlot(mark);
            }

            Thread.SetData(store, val);
        }

        public static bool CheckThreadFor(string mark, T val) where T : IEquatable
        {
            LocalDataStoreSlot store = Thread.GetNamedDataSlot(mark);
            if (store == null)
            {
                return false;
            }
            try
            {
                T newSlotData = (T)Thread.GetData(store);
                return newSlotData.Equals(val);
            }
            ///wrong thread
            catch (NullReferenceException)
            {
                return false;
            }
        }
    }
}

Saturday, January 12, 2013

Masterpage location error while creating site from site template


Failed to instantiate file "default.master" from module
"DefaultMasterPage"

I found one possible reason for the error.
File "webtemp_SiteDefinition1.xml" contains something like that:

<?xml version="1.0" encoding="utf-8"?>
<Templates xmlns:ows="Microsoft SharePoint">
  <Template Name="ArchiveSiteDefinition"
            ID="10001">
    <Configuration ID="0"
                   Title="Archive Template Configuration Title"
                   Hidden="FALSE"
                   ImageUrl="/_layouts/images/CPVW.gif"
                   Description="Archive Template Configuration Description"
                   DisplayCategory="Content">
    </Configuration>
  </Template>
</Templates>

Bold text above can't contains white spaces, and maybe other symbols which nonalphanumeric.

Will work - "ArchiveSiteDefinition"
Will not work - "Archive SiteDefinition"

File "webtemp_SiteDefinition1.xml" must be located in folder with name ArchiveSiteDefinition in your studio project.