Thursday 21 December 2017

Stress : Enemy of life

 How it Affect us

One of the difficulties with stress is that people experience stress in different ways. This contributes to stress manifesting itself differently. So it would be wrong to over generalize when giving advice on how to identify stress in others. However, what we can say is that because stress has negative effects, it will usually manifest itself one way or another.

👉  Stress targets the weakest part of our physiology or character; if you are prone to headaches or eczema, this will flare up.

👉 If you have low levels of patience or tolerance for others, this will be the first area to present under times of stress.

 ðŸ‘‰ A key action in order to minimize risk is to identify stress-related problems as early as possible, so that action can be taken before serious stress-related illness occurs.


"Stress isn’t avoidable but it is manageable"


Changes in the target person


👉 These changes may be emotional, physical or behavioral, or a combination of all three. 

 Emotional

 ðŸ‘‰ Depression
👉  Moodiness
👉 Irritability
👉  Fatalistic Thinking
👉 Panic
👉  Cynicism
👉 Anxiety
👉  Feeling Overwhelmed
👉 Frustration

 Physical 

👉  Chest Pain
👉 Rapid Heartbeat
👉 Aches and Pains
👉 Frequent Colds
👉  Skin Complaints
👉 Indigestion
👉  High Blood Pressure

 

 Behavioral

👉  Increase Intake in Alcohol, Cigarettes and Caffeine to Relax
👉 Isolating Yourself from Others
👉 Sleeping too Little or too Much
👉 Demotivated
👉  Loss of sense of humor

 


 

Thursday 29 June 2017

Sharepoint 2013: Responsive Top Navigation menu using bootstrap

Sharepoint 2013: Responsive Top Navigation menu using bootstrap
There are many things we can do in sharepoint but for responsivnes we faild in sharepoint.
I tried to make sharepoint top navigation menu responive, Please follow steps which I have done and you will get same screen like below picture-


Step 1-
Search for “DeltaTopNavigation” in settle.master and select whole tag > Copy the code and place in between bootstrap navigation tags like below-

 Step 2-
Place these css in you css file-
/*************************************************************************/
.static,.dynamic {
    padding-left: 10px;
    padding-right: 10px;
}
.ms-core-listMenu-horizontalBox li.static > .ms-core-listMenu-item
{
                margin-right:0px!important;
}
ul.dynamic li:hover {
    background-color: red;
}
.static.menu-item.ms-core-listMenu-item.ms-displayInline.ms-navedit-linkNode:hover {
    background-color: red;
}

.ms-core-listMenu-horizontalBox li.static > a{
display: none !important;
}
.ms-core-listMenu-horizontalBox li.static > ul a{
display: block !important;
}
@media screen and (max-width:767px) {
.ms-core-listMenu-horizontalBox ul, .ms-core-listMenu-horizontalBox li, .ms-core-listMenu-horizontalBox .ms-core-listMenu-item, .ms-core-listMenu-horizontalBox > ul > li > table
{
               
                display:block;
}
.hideonsmall
{
                display:none;
}
.navbar-inverse .navbar-toggle:hover, .navbar-inverse .navbar-toggle:focus {
    background-color: transparent!important;
}
.navbar-inverse .navbar-toggle {
    border-color: transparent!important;
}
.navbar-nav {
    margin: 7.5px -15px;
    padding-left: 15px!important;
    line-height: 25px!important;
}
.ms-core-listMenu-horizontalBox {
    color: #666666;
    display: inline-block;
    vertical-align: middle;
    line-height: 30px;
    height: auto;
}
.ms-core-listMenu-horizontalBox
{
                width:100%;
}
.static, .dynamic {
    padding-left: 0px!important;
    padding-right: 0px!important;
}
.menu-item-text {
    padding-left: 10px;
}

.navbar-collapse
{
                padding-left: 0px!important;
}
ul.dynamic
{
                left:25%!important;
}
}

Thursday 22 June 2017

Sharepoint 2013 Search refiner customization with css

I did some work for SharePoint search refiners and and changed look and feel of default refiners

Here I am sharing ccs for that-




/***search Refiner css****/
.ms-ref-ctrl {
    background-color: #fff;
}
.ms-ref-refiner {
    padding: 0px!important;
}
.ms-ref-refinername:link, .ms-ref-refinername:visited
{
 width:100%!important;
}
.ms-displayInlineBlock {
    display: inline-block;
    padding: 10px 0px 10px 15px;
    color: #333;
}
.ms-ref-refiner #Container {
    padding: 0;
    padding-bottom: 0px!important;
}

.ms-ref-refinername
{
    border: 1px solid #CED4E0!important;
 
    font-family: 'roboto_condensedbold'!important;
    height: 40px !important;
    padding: 0 !important;
    border-top: none !important;
    border-right: none !important;
    border-left: none !important;
    background: linear-gradient(to top, #E6E9F0 0%,#f6f6f6 100%) !important;
}
#Container div {
    padding-left: 10px;
}
.ms-ref-uparrow, .ms-ref-downarrow {
    width: 16px;
    height: 16px;
    margin-top: 15px!important;
    float: right;
    margin-right: 10px!important;
}
.ms-disabled {
    color: #333!important;
    padding: 20px!important;
    font-size: 18px!important;
}


Wednesday 21 June 2017

Convert DateTime to time spams in c#


Sometime we need to convert DateTime to time spams like an hour ago, few minutes ago or seconds ago.

public string convertDate(DateTime dt)
        {
            string result = "";
            TimeSpan span = DateTime.Now - dt;
            int days = span.Days;
            int hrs = span.Hours;
            int min = span.Minutes;
            int sec = span.Seconds;
            if (days!=0)
            {
                result = days + " days ago";
            }
            else if (hrs >= 1)
            {
                result = hrs + " hours ago";
            }
            else if (min <= 59 && min>0)
            {

                result = min + " minutes ago";
            }
            else
            {
                result = sec + " seconds ago";
            }

            return result;


        }

Monday 19 June 2017

How to download files from SharePoint document library programmatically using C#

Sometimes, we would want to download multiple files based on a pre-defined query such as a monthly report or a bulk download.
If it is a few files or if it is a complete folder, we can use the explorer view to copy paste the files. However, if we want to customize the query or automate the process, then we need to write custom code to download the files programmatically. This is also true, if we want to access the metadata of the files along with downloading the actual files.

Use the standard object model to access the SharePoint site and web.
string siteUrl = "site url";
using(SPSite site = new SPSite(siteUrl)
{
  using(SPWeb web = site.OpenWeb())
  {
    // code to download documents
  }
}
Retrieve the document library object using the SPWeb object from the above step.
// get the required document library
SPList docLib = web.Lists["Shared Documents"];
Access the items to be downloaded and download the files.
// loop through each item or document in the document library
foreach(SPListItem item in docLib.Items)
{
  // Access the file
  SPFile file = item.File;
  if(file != null)
  {
    // retrieve the file as a byte array
    byte[] bArray = file.OpenBinary();
    string filePath = Path.Combine("c:\\temp", file.Name);
    //open the file stream and write the file
    using(FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.ReadWrite))
    {
      fs.Write(bArray, 0, bArray.Length);
    }
  }
}
The above server side code can be used if you are using page code behind, event handler, timer job etc. I will do another post for downloading the documents from client side such a console application or a windows application.
In case you do not want to download all the files, you can use CAML query to filter the items in a document library or even a site collection and loop through those items. If it is spanning multiple site collections, you can use search query to retrieve the items.
Instead of using the file object from the SharePoint item, we can also use the file url to download the file from the document library. Following code will download the file located at url fileUrl to C:\Docs folder locally on the server:
FileStream fstream = null;
string fileName = Path.GetFileName(fileUrl);
if (!string.IsNullOrEmpty(fileName))
{
  byte[] data;
  byte[] buffer = new byte[2048];
  WebRequest request = WebRequest.Create(url);
  using (WebResponse response = request.GetResponse())
  {
    using (Stream responseStream = response.GetResponseStream())
    {
      using (MemoryStream ms = new MemoryStream())
      {
        int count = 0;
        do
        {
          count = responseStream.Read(buffer, 0, buffer.Length);
          ms.Write(buffer, 0, count);
        } while (count != 0);
        data = ms.ToArray();
      }
    }
  }
  string filePath = "C:\Docs";
  using (fstream = new FileStream(filePath, FileMode.Create, FileAccess.ReadWrite))
  {
    fstream.Write(data, 0, data.Length);
    fstream.Close();
  }
}