Monday, January 25, 2016

Unable to see files and folders in my pen drive

External hardware devices such as pen drives are widely used for easy storage and transfer of files or folders. Sometimes users may not be able to see files or folders stored on pen drives. This be down to several reasons, the most common being that all files and folders are in the hidden mode. If the storage device doesn't have this setting enabled, it could be due to undetected malware. Users may need to remove the autorun files first and then proceed with removing the infected files using a recommended anti-malware


Issue
I can't see the files and folders in my pen drive after scanning with "Advanced Options - clean files" with nod antivirus software. The files are not in hidden mode and I know they are on the pen drive as I can tell from looking in "properties". How can I fix this problem? 


  1. Click on "Start" --> Run --> then type cmd and click on OK. 
  2. Assuming your pendrive is G, enter the following command: attrib -h -r -s /s /d g:\*.* 
  3. You can copy the above command then right click in the Command Prompt and paste it.
  4. NB: Replace the letter g with your flash drive letter. 
  5. Now check for your files in the pen drive. 

Monday, November 23, 2015

Deploying a WSP to SharePoint 2013



How to deploy a WSP to SharePoint Farm Solution library

This need to be done on the Server which host the SharePoint Central Administration.
  1. Add the WSP to the SharePoint Server
    1. The first thing you need to do is copy over the wsp deployment file. The best things to do is to create a deployment folder, where all the deployed files are kept.
    2. Copy over the deployment files to: c:\Deploy\WSP
  2. Add the WSP to the SharePoint Farm Solution library
    1. Open "SharePoint 2013 Management Shell " as administrator
      a. Open the Search on Server 2012
      b. Search for "SharePoint 2013 Management Shell"
      c. Right click "SharePoint 2013 Management Shell"
      d. Select "Run as Administrator"
    2. Run this script: 

      Add-SPSolution "c:\Deploy\WSP\{file name}.wsp"  
  3. Deploy the WSP to the SharePoint Farm Solution library

    1. Open Central Administration
    2. Click "System Settings"
    3. Click "Manage farm solutions", under "Farm Management"
    4. Click on the {file name}.wsp package
    5. Click "Deploy Solution"
    6. Deployment settings
      Deploy When: Now
      Deploy to: All content Web application
    7. Click "OK"

How to activate the WSP Feature on the Site Collection

  1. Activate the WSP Feature on the Site Collection
    1. Open the Root Site (the Site Collection)
    2. Click the cog, in the top right corner (Site Actions)
    3. Select "Site Settings"
    4. Click "Site collection features", under "Site Collection Administrator"
    5. Go to {file name}
    6. Click "Activate", to the right

Sunday, November 8, 2015

GitHub - From Fork to clone then push back to server

To start, please make sure that you already have:

  1. GitHub account (https://github.com/)
  2. Git Bash software (http://git-scm.com/)


This is step by step guideline to fork, clone and push back at GitHub server.

1. Open any folder at GitHub that you want to fork (copy to your GitHub folder). Then press Fork at top-right of the page


2. After fork, the page will redirect you to your GitHub account. Next, we want to clone the file to your local repository (own computer). Copy the link first at the folder you want to clone.


3. Open Git Bash application then change the working directory to your preferred folder first.

         code: cd "folder url"
         example: cd "/e/Training/Training 2015/Data/Module 4/Week 1 - Course Project 1"
        Then request for clone by entering the following command:

         code: git clone URL
         example: git clone https://github.com/fairulshahrizat/practice_assignment.git


After that you can closed Git Bash & check your preferred folder for content.


4. After you are done with your task, you will want to push the emended in the folder to your GitHub account back. To do this, follow this step:
  1. From the local repository folder, right click and select 'Git Commit Tool'.
  2. There, select the files you want to upload, under 'Unstaged Changes' and click 'Stage Changed' button. (You can initially click on 'Rescan' button to check what files are modified and not uploaded yet.)
  3. Then write a Commit Message and click 'Commit' button.



      4. Now right click in the folder again and select 'Git Bash'
      5. Type: git push origin master and enter your credentials (GitHub account). 


         6. Then you can check back your GitHub folder to see the update. Click commits for version details. 









Wednesday, October 7, 2015

Query times out (very slow) when executed from web, but super-fast when executed from SQL Server Management Studio (SSMS)


Some cache corrupt on your SQL server, Run 2 commands to clean:

DBCC DROPCLEANBUFFERS 
DBCC FREEPROCCACHE

DBCC DROPCLEANBUFFERS removes any non dirty (iow, clean) pages:
Use DBCC DROPCLEANBUFFERS to test queries with a cold buffer cache without shutting down and restarting the server. To drop clean buffers from the buffer pool, first use CHECKPOINT to produce a cold buffer cache. This forces all dirty pages for the current database to be written to disk and cleans the buffers. After you do this, you can issue DBCC DROPCLEANBUFFERS command to remove all buffers from the buffer pool.

DBCC FREEPROCCACHE does is empty the procedure cache.
Removes all elements from the plan cache, removes a specific plan from the plan cache by specifying a plan handle or SQL handle, or removes all cache entries associated with a specified resource pool. Use DBCC FREEPROCCACHE to clear the plan cache carefully. Freeing the plan cache causes, for example, a stored procedure to be recompiled instead of reused from the cache. This can cause a sudden, temporary decrease in query performance

Extra Note:

The ARITHABORT setting is one of the things the optimizer looks at when it is determining how to execute your query (more specifically, for plan matching). It is possible that the plan in cache has the same setting as SSMS, so it uses the cached plan, but with the opposite setting your C# code is forcing a recompile (or perhaps you are hitting a really BAD plan in the cache), which can certainly hurt performance in a lot of cases.

 SET ARITHABORT ON; SELECT ...

Reference: http://www.sommarskog.se/query-plan-mysteries.html

Clearing the cache DBCC DROPCLEANBUFFERS and DBCC FREEPROCCACHE did the trick! The execution plan was somehow corrupt or not updated.

Reference: http://stackoverflow.com/questions/6585417/stored-procedure-slow-when-called-from-web-fast-from-management-studio

Monday, September 21, 2015

Trans-SQL Query - return empty row from Sql Server

Generally, if you must have an empty row returned..
If your original query is:
 select a,b,c from query_table where a='something'

You can turn it into a subquery:

select t.a,t.b,t.c
from (select 1 as adummy) a left join (
    select a,b,c from query_table where a='something'
) t on 1=1

Which ensures the query will always have a rowcount of at least one.

Wednesday, May 20, 2015

The list of workflow actions on the server references an assembly that does not exist. Some actions will not be available

When I tried to create SharePoint 2010 workflows in SharePoint Designer 2013, I got the following error message shown below:


This error may occur if the system does not have enough memory, I was running a VM at 4GB; when I scale up to 6GB, it’s working fine. in some cases, This error comes up if you don’t have local privileges, therefore, you need to check you local admin privileges. 

If you already checked the previous reasons and the problem not solved! so you need to clear the cache of the following Folders (If didn’t work delete them):
  • %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache
  • %USERPROFILE%\AppData\Roaming\Microsoft\SharePoint Designer\ProxyAssemblyCache
  • %USERPROFILE%\AppData\Roaming\Microsoft\Web Server Extensions\Cache
If the problem still exists that mean someone has extended the Workflow actions available in SPD with a custom action developed in Visual Studio.These custom actions are loaded when your workstation reads the WSS.ACTIONS file on the server.

The file is located in the 14 hive under Template\1033\workflow.Your WSS.Actions file contains a reference to a custom action .dll. Delete WSS.Actions file and your designer should start working again.

Make sure you take a backup of the file first.


Reference: https://mohamedelkassas.wordpress.com/2014/12/26/the-list-of-workflow-actions-on-the-server-references-an-assembly-that-does-not-exist-some-actions-will-not-be-available/

Thursday, April 9, 2015

How to Sign in as a Different User in SharePoint 2013

SharePoint used to have a menu option called “Sign in as Different User” in the top-right corner of every page. It was a handy tool for developers and IT professionals in SharePoint 2007 and 2010, which allowed them to login with another account to test their solutions or customizations. Microsoft removed the option in SharePoint 2013, but you can still do it with workarounds or a one-click bookmarklet.

Navigate to the Close Connection Page

http://<site URL>/_layouts/closeConnection.aspx?loginasanotheruser=true

Reference: http://blog.credera.com/technology-insights/microsoft-solutions/how-to-sign-in-as-a-different-user-in-sharepoint-2013/

Sunday, March 29, 2015

SharePoint 2013: How to hide All Day Event, Recurrence and Category fields from Calendar New Item form

Using Content Editor Web part and JQuery, you can easily hide the unwanted fields like All Day Event, Recurrence, Category fields from SharePoint Calendar new item form.
  • Navigate to the SharePoint Calendar in SharePoint site where you need to remove the fields.
  • From ribbon, Click on Calendar tab
  • In Customize list section of Calendar ribbon, click on arrow besides Form Web Part. You will see three forms named Default New form, Default Display form and Default Edit form. Click on Default New form.
  • In Default New form edit page, click on Add a Web Part and select the Content Editor Web part.
  • From Content Editor Web part, Click on Click here to add new Content
  • Now select Edit Source from ribbon and add java script to HTML Source editor to hide the fields from calendar form and click OK. To hide exact field, you can start count of TR from Title field as 0 and update the number in java script.
you can also use following scripts to hide fields:

 <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
 <script type="text/javascript">
 $(document).ready(function()
 {
 $('nobr:contains("All Day Event")').closest('tr').hide();
 $('nobr:contains("Recurrence")').closest('tr').hide();
 });
 </script>

Reference: https://hpatel.wordpress.com/2014/06/05/sharepoint-2013-how-to-hide-all-day-event-recurrence-and-category-fields-from-calendar-new-item-form/

Change the default tile size/tumbnails view in image library in Sharepoint 2013


Using a CSS only approach, add the following CSS inside the content editor webpart or add it to your custom css.

<style type="text/css">
            div.ms-promlink-body {
                height: 130px;
            }
            div.ms-tileview-tile-root {
                height: 150px !important;
                width: 150px !important;
            }
            div.ms-tileview-tile-content, div.ms-tileview-tile-detailsBox,  div.ms-tileview-tile-content > a > div > span {
                height: 140px !important;
                width: 140px !important;
            }
            div.ms-tileview-tile-content > a > div > img {
                max-width: 100%;
                width: 100% !important;
            }

            ul.ms-tileview-tile-detailsListMedium {
                height: 100px;
                padding: 0;
            }
            li.ms-tileview-tile-descriptionMedium {
                font-size: 11px;
                line-height: 16px;
            }
            div.ms-tileview-tile-titleTextMediumExpanded, div.ms-tileview-tile-titleTextLargeCollapsed, div.ms-tileview-tile-titleTextLargeExpanded {
                padding: 3px;
            }
             div.ms-tileview-tile-titleTextMediumCollapsed {
                font-size: 12px; !important;
                padding-left: 6px; !important;
            }
             li.ms-tileview-tile-descriptionMedium {
                font-size: 11px;
                line-height: 14px;
                padding: 3px;
            }
           
</style>

Monday, February 9, 2015

Clearing remembered / default login for SQL Server Management Studio


Removing the remembered login and password list in SQL Management Studio

SQL Server Management Studio 2014 delete the file C:\Users\%username%\AppData\Roaming\Microsoft\SQL Server Management Studio\12.0\SqlStudio.bin

SQL Server Management Studio 2012 delete the file C:\Users\%username%\AppData\Roaming\Microsoft\SQL Server Management Studio\11.0\SqlStudio.bin

SQL Server Management Studio 2008 delete the file C:\Users\%username%\AppData\Roaming\Microsoft\Microsoft SQL Server\100\Tools\Shell\SqlStudio.bin

Or find SqlStudio.bin at C using window explorer and delete the file.

Replace SQL Server Profiler with ExpressProfiler (aka SqlExpress Profiler)

Download at https://expressprofiler.codeplex.com/

ExpressProfiler (aka SqlExpress Profiler) is a simple and fast replacement for SQL Server Profiler with basic GUI and integration with Red Gate Ecosystem project.

Can be used with both Express and non-Express editions of SQL Server 2005/2008/2008r2/2012/2014 (including LocalDB)
Distribution package contains both standalone version of ExpressProfiler (can be used without installation) and installation package.


Make sure to grant the "Alter trace" permission to the selected user.

Tuesday, January 6, 2015

Combining 2 SQL queries and getting result set in one

You can aliasing both query and Selecting them in the select query

SELECT x.a, y.b FROM (SELECT * from a) as x, (SELECT * FROM b) as y

Sunday, December 14, 2014

SharePoint 2013 - Change URL of document library

When you create a document library, it ask you the name for the DL. Once you give it, it will create library with same name and URL. You can change the name of the library any time but cannot change the url. Here are the things i followed to create url accroding to my needs:
  1. Just go to a library trough 'Site Content'
  2. When inside the library choose on the ribbon 'Library' tab.
  3. Then select 'Open with Explorer'.That will open your SharePoint's library in Windows Explorer window.
  4. Navigate one folder up and you will see list of your libraries as folders.
  5. Rename required library's folder name as you want the URL to look like.
  6. Close the windows and refresh the browser or go back to home page and browse the library again.
Reference:
http://sharepoint.stackexchange.com/questions/111524/sharepoint-2013-change-url-of-document-library
http://stackoverflow.com/questions/12904944/change-sharepoint-library-url

Wednesday, November 12, 2014

SharePoint 2013 - Check Correlation ID using Management Shell

<GUID> = Correlation ID = 0e90cb9c-1855-80fc-177a-ebaed1a55500

Code:
get-splogevent | ?{$_.Correlation -eq "<GUID>"} | select Area, Category, Level, EventID, Message | Format-List
Example:
get-splogevent | ?{$_.Correlation -eq "0e90cb9c-1855-80fc-177a-ebaed1a55500"} | select Area, Category, Level, EventID, Message | Format-List

Tuesday, November 11, 2014

Minimal Download Strategy in SharePoint 2013 ( _layouts/15/start.aspx issue)

_layouts/15/start.aspx is part of the Minimal Download Strategy in SharePoint 2013 which helps in improving the performance of page rendering. If you are having issues with it you can deactivate this feature at the site level using the below step.

Site Settings >>  Site Actions >>   Manage Site Features >>  Deactivate Minimal Download Strategy Feature.

Wednesday, October 29, 2014

How to Enable or Disable Document Property Promotion (ParserEnabled) in SharePoint 2013

This is the way to solve issues on uploading document into SharePoint 2013 Document Library. After upload the document into SharePoint library, the document had the metadata (document properties) of the original document. Metadata that is changed on the document will revert to the original values that were given to the document; this occurs both from SharePoint and from MS Word.
 
Solution 1 – Remove Document Properties & personal Information using Inspect
1.      Open file using Microsoft office
2.      Click file and the inspect document (check for issues)
3.      Tick only on document properties & personal information
4.      Inspect & then remove
5.      Then Save
6.      Upload document into SharePoint.
 
Solution 2 – Disable Document Property Promotion using PowerShell
The SPWeb object has a ParserEnabled property, which enables or disables this functionality.  Using the PowerShell script, we can turn off this functionality at the web level. Sample script to disable the document parser feature in SharePoint:
1.      Open the SharePoint 2013 Management Shell as Administrator.
2.      Run the following script to disable document property promotion.
 
C:\> $web
        Url
        ---
        http://spfe01/sites/SITENAME/SUBSITENAME
C:\> $web.parserenabled
        True
C:\> $web.parserenabled  = $false
C:\> $web.Update()
C:\> $web.parserenabled
        false
 
 
3.      Document Property Promotion is disabled successfully and when you try to upload a document you will find that all the fields are empty
 

Wednesday, October 8, 2014

Clear SharePoint Designer 2013 Cache

When using SharePoint Designer, especially in a development environment where content and assemblies can frequently change, SPD can start to behave erratically, sometimes loading content that has been removed from the web site, or using an older version of an assembly. This is due to how SPD caches content, which thankfully, is easy enough to clear.


Step 1: First, close SPD and then remove all files from the following folder:
%APPDATA%\Microsoft\Web Server Extensions\Cache

This contains things like page caches.

Step 2: Then, do the same for this folder:
%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache

This contains cached items such as assemblies used and lots of other xml configuration files.

Step 3: Restart SPD and all should be good in the world

Reference: http://www.stuartroberts.net/index.php/2012/07/18/quick-tip-9/

Wednesday, April 2, 2014

sharepoint 2010 Position modal dialog box relative to current screen


Place this code @ css in master page

.ms-dlgContent
{
position: fixed!important;
}

Tuesday, December 11, 2012

Free Google Chart Sharepoint Web Part


Download here: http://www.amrein.com/apps/page.asp?Q=5749

The Google Chart Web Part allows to chart data contained in the specified SharePoint List. The charts are created using Google's public Chart API (see official Google Documentation)

The Web Part can be used with Windows SharePoint Services V3, MOSS 2007 and SharePoint 2010.

The Google Chart Web Part is the winner in the "Favorite Free SharePoint  web Part" category of the Andy Dale 2010 SharePoint Awards!



SharePoint Filtered Lookup Field

Download here: http://filteredlookup.codeplex.com/

This project creates a custom SharePoint lookup field that offers new functionalities to default SharePoint lookup field by allowing filters to be applied to retrieved data. Applied filters can be either dynamic CAML queries or pre-defined list views residing in source lists

Below is a few of the features offered by Filtered Lookup field over standard SharePoint Lookup field:
  • Cross-site lookup (all sites within same site collection)
  • Filter retrieved data using list views
  • Filter retrieved data using dynamic/ad-hoc CAML queries. This means you don't need to create a list view each time you want to apply a lookup filter to source data
  • Supports retrieving data recursively using either list views or dynamic queries
  • Supports MultiLookup with filtered data
  • Same look and feel as default SharePoint Lookup and MultiLookup (i.e. in list forms)