Wednesday, July 31, 2013

CSS vertical middle align

I had two child div within a parent div with different heights and I wanted to align them at middle of the parent div. I used float:right on both of them and removed clear:both. Then I used margin property of the less tall element to align them at verticle middle.

The next problem was to expand the parent element when these elements float out of their container, this was achived using display:table; attribute on the parent div css

Final html looks like



<div class="topbar">
    <div class="rightelement"></div>
    <div class="leftelement">
    </div>
</div>


and here is the css



  .topbar
{
    width: 100%;
    background-color:black;
    height:29px;
    display:table;
}


.leftelement {
       float: right;
       margin:0px;
       text-align: right;
       width:auto;
    background-color:transparent;
    margin-top:7px;
}


.rightelement {
       float: right;
       margin:0px;
       text-align: right;
       width:auto;
    background-color:transparent;
}
 

Uninstall SharePoint 2010 feature using folder name

stsadm -o uninstallfeature -filename "MyFeatureFolder\feature.xml" -force

To list all installed features
Get-SPFeature -Site http://mysitecollection/

before using above command make sure the user has permissions to SP Content and Config Databases

Tuesday, July 30, 2013

Create master page module in SP 2010

http://pratapreddypilaka.blogspot.co.uk/2013/03/deploying-custom-master-page-using.html

<Module> element has a path attribute which specifies the path where files inside this element are searched for.
<File> element also has a path which specifies the path to be searched after <Module> element's path.
Add below attribute to the file element
Type="GhostableInLibrary"


The final elements.xml looks like



<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="_catalogs" Url="_catalogs/masterpage" Path="_catalogs\masterpage" >
    <File  Url="MyNightandday.master" Type="GhostableInLibrary">
      <Property Name="Title" Value="My Custom Master Page" />
      <Property Name="MasterPageDescription" Value="Master page for My Custom website" />
      <Property Name="ContentType" Value="$Resources:cmscore,contenttype_masterpage_name;" />
    </File>
  </Module>
</Elements>


SSL Error - The connection for this site is not secure

 After cloning a git repo of dot net framework website and trying to run it all I could see was this error Turns out the fix was to simply e...