Monday, January 21, 2013

Change the Calendar Reginal Setting Calendar Type Gour


 using (SPSite oSiteCollection = new SPSite(SPContext.Current.Web.Site.Url))
        {
            using (SPWeb oWebsiteRoot = oSiteCollection.RootWeb)
            {
                //Response.Write(oWebsiteRoot.RegionalSettings.CalendarType);
                SPRegionalSettings oRegionalSettings = oWebsiteRoot.RegionalSettings;
                oRegionalSettings.CalendarType = 6;
                oRegionalSettings.AdjustHijriDays = 2;
                DateTimeControl1.Calendar = SPCalendarType.Hijri;
                oWebsiteRoot.Update();
                Response.Write(oWebsiteRoot.RegionalSettings.CalendarType);
            }
        }

Monday, September 17, 2012

Entity Framework 4


Getting Started with Entity Framework 4.0 Part 1
at you tube 

Wednesday, May 2, 2012

Compressing the ViewState of pages in ASP.net

Article Source : http://www.codeproject.com/Articles/14733/ViewState-Compression

the code
you just need to put this code in your page.


public byte[] Compress(byte[] data)
    {
        MemoryStream output = new MemoryStream();
        GZipStream gzip = new GZipStream(output,
                          CompressionMode.Compress, true);
        gzip.Write(data, 0, data.Length);
        gzip.Close();
        return output.ToArray();
    }

    public byte[] Decompress(byte[] data)
    {
        MemoryStream input = new MemoryStream();
        input.Write(data, 0, data.Length);
        input.Position = 0;
        GZipStream gzip = new GZipStream(input,
                          CompressionMode.Decompress, true);
        MemoryStream output = new MemoryStream();
        byte[] buff = new byte[64];
        int read = -1;
        read = gzip.Read(buff, 0, buff.Length);
        while (read > 0)
        {
            output.Write(buff, 0, read);
            read = gzip.Read(buff, 0, buff.Length);
        }
        gzip.Close();
        return output.ToArray();
    }

    protected override object LoadPageStateFromPersistenceMedium()
    {
        string viewState = Request.Form["__VSTATE"];
        byte[] bytes = Convert.FromBase64String(viewState);
        bytes = Decompress(bytes);
        LosFormatter formatter = new LosFormatter();
        return formatter.Deserialize(Convert.ToBase64String(bytes));
    }

    protected override void SavePageStateToPersistenceMedium(object viewState)
    {
        LosFormatter formatter = new LosFormatter();
        StringWriter writer = new StringWriter();
        formatter.Serialize(writer, viewState);
        string viewStateString = writer.ToString();
        byte[] bytes = Convert.FromBase64String(viewStateString);
        bytes = Compress(bytes);
        ClientScript.RegisterHiddenField("__VSTATE", Convert.ToBase64String(bytes));
    }


Tuesday, May 1, 2012

stsadm - upgrade solution script + deploy solution force


stsadm -o upgradesolution -name "Tatweer.Centers.Core.wsp" -filename "Tatweer.Centers.Core.wsp" -immediate -allowgacdeployment -allowcaspolicies
stsadm -o execadmsvcjobs

for deploying a solution with -force option

stsadm -o deploysolution -name "BackReport.wsp" -url "http:
//mdm-sp01:190" -immediate -allowgacdeployment -allowcaspolicies -force 



For updating the DLL File in sharepoint 2013 use the below script 

Set-location "C:\Users\ahindash\Desktop\Clearance\Finance"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")            
$publish = New-Object System.EnterpriseServices.Internal.Publish            

$publish.GacInstall("C:\Users\ahindash\Desktop\Clearance\Finance\ServiceRequestWFV3.dll")

Parameters: the first one for the path of the folder the second one is for the file path 



Wednesday, April 18, 2012

FIX: Secure VPN Connection terminated locally by the Client Reason 442: Failed to enable Virtual Adapter


  1. Press Windows and R key to open Run window, type inservices.msc
  2. Stop the Cisco Systems … service
  3. Stop the Internet Connection Sharing (ICS) service
  4. Right click on ICS service and choose Properties. Then changeStartup type to Disabled or Manual
    I prefer to stop this service until you finish working on the VPN 
  5. Start Cisco Systems … service
  6. Done. Now create a VPN connection, error 442 no more !

Wednesday, April 11, 2012

Adding WSP Solution to SharePoint 2010 using Power Shell


1.    Open SharePoint 2010 Management Shell write the folowing command for each wsp file in the “WSP Solutions” folder ()
-          Add-SpSolution “WSP File Path” .
2.    Open the SharePoint 2010 Central Administration
3.    Click on the System Settings èManage Farm Solutions èclick on each WSP File and click on deploye link

Sunday, April 8, 2012

Recommendation 
try to use extended query web part in order to expose the  XSLT over the share point list

this link for shows some good libraries which are good for the share point developers
http://www.purecoding.net/CodeZone/SharePoint/tabid/67/ItemID/19/Default.aspx