الثلاثاء، 22 مارس، 2016

Increase VMware Performance and Decrease the Needed Space by Disabling the .vmem File

Dear all,
I you want to increase the I/O performance, and decrease the disk space needed to run your VM, your should consider disabling the memory swap file (.vmem).

Actually, .vmem is the virtual machine's paging file, which backs up the guest main memory on the host file system. This file exists only when the virtual machine is running, or if the virtual machine has crashed.

Therefore, if you do not want VMware to create a memory swap file, which is as large as the chosen RAM of your guest OS, go to:
C:\ProgramData\VMware\VMware Workstation\config.ini
And add the following: 
mainMem.useNamedFile = "FALSE"
prefvmx.minVmMemPct = "100"
MemTrimRate = "0"

This supposed to increase the performance of your VM; Since VMware will no more maintain duplicating your guest RAM to the hard disk. Therefore, you should notice the performance difference. Additionally, you will gain more disk space, because VMware now will not create a large file to duplicate your guest OS RAM.

However, here are something you have to pay attention for:
  • If the VM has crashed, you will not be able to restore the state of your guest OS with the running applications.
  • Suspend will take more time than before changing those configuration.
  • For suspend and resume, you still need a file with the size of the configured RAM of your gust OS. Such that, for every suspend action, VMware will create a new "<snapshot_name_and_number>.vmem" file.
You may find more info at:

Best Wishes,

الأربعاء، 5 سبتمبر، 2012

SharePoint 2010 >> Useful Web Part Configuration

When you add some Web Part you can do handful things like following:
  • Change the Web Part Group:

Change the group that the Web Part will be categorized in, which is shown when inserting the web part on a page:At the file Elements.xml, exists under your Web Part folder, modify value="Cusotm" at the following line to be something like "Starways":
<Property Name="Group" Value="Custom" />
  • Change Web Part Title and Description

Those which are used when inserting the web part:
At file YourWebPartName.webpart, exists under your Web Part folder, change the text in the following nodes to some meaning full one:

        <property name="Title" type="string">YourWebPartName</property>
        <property name="Description" type="string">My Visual WebPart</property>
  • Hide Chrome immediately when the Web Part is added:

At file YourWebPartName.webpart, exists under your Web Part folder, add the following node under <properties>:
        <property name="ChromeType" type="chrometype">None</property>
  • Provide any default value for your Web Part properties:

Similar to hiding the Chrome. At file YourWebPartName.webpart, exists under your Web Part folder, add something similar to the following node, under <properties>:
        <property name="ListName" type="string">You Default List Name</property>


Kindly support me by giving some good feedback, adding some useful comments, share it at Facebook and/or make a +1 for this article at Google from the bottom of the page.
________________________________
(Muhammad Altabba)محمد الطباع 
SharePoint Developer with Project Management and Team Leadership Activities
.


الجمعة، 24 فبراير، 2012

SharePoint 2010 >> Possible ways to get logged in User Name & Handling Changes in FBA Users' Names if Membership Provider Name Changed

بسم الله الرحمن الرحيم 

You may needed, in many cases, to have the logged in user name in SharePoint 2010. And you may found all old FBA (Form Based Authentication) user names changed suddenly after you change the Membership Provider name. For this or that, you need to read this article.
To get the logged in user name you have the following methods available in SharePoint 2010 Web Part User Control:
  • this.Page.User.Identity.Name
  • HttpContext.Current.User.Identity.Name
  • SPContext.Current.Web.CurrentUser.LoginName
  • SPContext.Current.Web.CurrentUser.Name
Actually, there is also: "System.Web.Security.Membership.GetUser().UserName". But it gave me Exception with message: [Method or operation is not implemented]
However, I called each of the previous four properties for both windows (SharePoint System Account) and forms authentication. They returned with the following:
For "System Account" user with user called "user _name" and domain named "domain_name":
Property
Returned Value
Page.User.Identity.Name or
HttpContext.Current.User.Identity.Name
0#.w|domain_name\user_name
SPContext.Current.Web.CurrentUser.LoginName
SHAREPOINT\system
SPContext.Current.Web.CurrentUser.Name
System Account
For a Form Based Authenticated User called "fba_user" and Membership Provider called "membership_provider":
Property
Returned Value
Page.User.Identity.Name or
HttpContext.Current.User.Identity.Name
0#.f|membership_provider|fba_user
SPContext.Current.Web.CurrentUser.LoginName
0#.f|membership_provider|fba_user
SPContext.Current.Web.CurrentUser.Name
fba_user

But, the value for the last one (SPContext.Current.Web.CurrentUser.Name) could be changed to the format: 0#.f|membership_provider|fba_user, instantly, if you changed the membership provider named! This means that the user name will be ugly. Moreover, this ugly name will be shown in the ribbon!
However, get relaxed you can easily fix the name at your code; you can just extract the username from the long text. This can be easily done by:

public string GetFlatUserName()
{
    //First, be sure that the user is not anonymous user:
    if (SPContext.Current == null || SPContext.Current.Web.CurrentUser == null)
        return "Anonymous";
    //Second, parse it:
    else
    {
        string flatUserName = this.Page.User.Identity.Name;
        if (flatUserName.Contains("\\"))
        {
            flatUserName = flatUserName.Substring(flatUserName.IndexOf("\\") + 1);
        }
        else if (flatUserName.Contains("|"))
        {
            flatUserName = flatUserName.Substring(flatUserName.IndexOf("|") + 1);
        }
        return flatUserName;
    }
}
For more on fixing the ugly name shown in the Ribbon check: SharePoint 2010 Custom Welcome Control)

Kindly support me by giving some good feedback, adding some useful comments, share it at Facebook and/or make a +1 for this article at Google from the bottom of the page.
________________________________
(Muhammad Altabba)محمد الطباع 
SharePoint Developer with Project Management and Team Leadership Activities
.


الثلاثاء، 14 فبراير، 2012

Configuring Windows Users for SharePoint 2010 Administration and Development

بسم الله الرحمن الرحيم
Configure a users to do Administration and Development on a Web Application
You will need to do two things:
I)             Give user Full Control at Web Application Level Permission Policies
  1. Verify that you have the following administrative credentials:
·         You must be a member of the Farm Administrators group on the computer that is running the SharePoint Central Administration Web site.
  1. On the Central Administration Web site, in the Application Management section, click Manage web applications.
  2. Click to highlight the line for the Web application whose permission policy you want to manage.
  3. In the Policy group of the ribbon, click User Policy.
  4. In the Policy for Web Application dialog box, select the check box next to the user or group that you want to manage, and then click Add Users.
  5. In the Add Users dialog box, in the Zone list, click the zone to which you want the permission policy to apply.
  6. In the Choose Users section, type the user names, group names, or e-mail addresses that you want to add to the permission policy. You can also click the applicable icon to check a name or browse for names.
  7. In the Choose Permissions section, select the permissions that you want the users to have. In case that you want the user to be able to do everything including deployment, you choose “Full Control”.
  8. In the Choose System Settings section, check Account operates as System if you want to specify whether a user account should be displayed as SHAREPOINT\System instead of the actual accounts that perform specific tasks within the SharePoint environment.
  9. Click Finish.
II)            Provide the User with the ability to run the needed tools as Administrator:
After login to the server, the user must be able to run applications and tools, provided by Microsoft, like: SharePoint PowerShell, Visual Studio, Command Prompt, SPMetal…
And he must be able to install and run, as an administrator, programs and tools like: CAML Query Builder.
You may manage to do this by adding the user to the Local Administrators group; Or, any other good way.
However, the previous configuring will not give the user the ability to do administration control on the farm level. If you in need for that check the next section.
Plan for Farm Administration User:
To be able to act as an administrator on all SharePoint web applications and be able to configure thins like Quota and Service Applications (such as Search and Profile Synchronization), a user has to be a Farm Administrator. For that you have to do many things. For more information about managing Farm Administrators, kindly check this article: Creating Additional SharePoint 2010 Farm Administrators.


________________________________
محمد الطباع (Muhammad Altabba)
SharePoint Developer with Project Management and Team Leadership Activities.

الاثنين، 6 فبراير، 2012

Removing selection dotted borders around links that shows up on focus in Internet Explorer!

بسم الله الرحمن الرحيم
Dear all,
If you want to remove the selection dotted borders, that is made by Internet Explorer on links, that shows up when there is a focus on a link; when for example the user clicks on that link. You can add the following to your page. Absolutely, if you are using ASP.net, you will put this in the master page:
<script type="text/javascript" src=" http://code.jquery.com/jquery-1.7.1.js"></script>

<script language="javascript" type="text/javascript">
    jQuery(document).ready(function () {
        jQuery('a').focus(function () { jQuery(this).blur(); });
    });
</script>
The code will execute when the page finish loading, and will be applied on all ‘a’ tags. And, it will remove the focus on that tag immediately after focusing on it.
For more information about ready() function check: Tutorials: Introducing $(document).ready() at url: (http://docs.jquery.com/Tutorials:Introducing_$(document).ready()). And for more information about focus() function: http://api.jquery.com/focus/. Also, you can check http://api.jquery.com/blur/ for information about blur().
However, if you need to still apply this after Ajax calls! You will need to do as the following. In case, you are using ASP.Net and C#:
//Remove focus on links:
string scriptblock = "jQuery('a').focus(function(){jQuery(this).blur();});";
ScriptManager.RegisterClientScriptBlock(this.upLibraryEvents,
    typeof(UpdatePanel),
    "RemoveFocus", scriptblock, true);

You may ask: Why? Why caring about this? This is not even noticeable from normal user! And even if, the user noticed it, it does no harm!
The answer is that it is just to be used if the one, who is in somehow, responsible of quality assurance of your sites, tends to check the site not as a normal user!
Thanks to Alaa' Alkateeb.
Best Wishes,

Kindly support me by giving some good feedback, adding some useful comments, share it at Facebook and/or make a +1 for the article at Google from the bottom of the page.

________________________________
محمد الطباع (Muhammad Altabba)
SharePoint Developer with Project Management and Team Leadership Activities.

الاثنين، 12 ديسمبر، 2011

Search Configuration Best Practices

 This is the best practice I had find to configure search in SharePoint 2010:
    1. Add a crawl component to a Search Service Application
1)    In Central Administration, in the Application Management section, click Manage service applications.
2)    On the Service Applications page, click the name of the Search Service Application to which you want to add a crawl component.
3)    On the Search Administration page, in the Search Application Topology section, click the Modify button.
noteNote: The SharePoint Search topology cannot be changed in Standalone installations.
4)     On the Manage Search Topology page, click New, and then click Crawl Component.
5)    In the Add Crawl Component dialog box, in the Server list, click the farm server to which you want to add the crawl component.
6)    In the Associated Crawl Database list, click the crawl database you want to associate with the new crawl component.
7)    In the Temporary Location of Index field, you can optionally enter the location on the server that will be used for creating the index files before propagating them to the query components. If you want to accept the default location, leave the contents of this field unchanged.
8)    Click OK to add the new crawl component to the job queue.
9)    On the Manage Search Topology page, click the Apply Topology Changes button to start the SharePoint timer job that will add the new crawl component to the farm on the specified server.
    1. Create or Edit a content source.  
From Search Administration Page, in the Crawling section at the quick navigation bar, click Content Sources.

To create a content source

1.    On the Manage Content Sources page, click New Content Source.
2.    On the Add Content Source page, in the Name section, in the Name box, type a name for the new content source.
3.    In the Content Source Type section, select the type of content that you want to crawl.
4.    In the Start Addresses section, in the Type start addresses below (one per line) box, type the URLs from which the crawler should begin crawling.
5.    In the Crawl Settings section, select the crawling behavior that you want.
6.    In the Crawl Schedules section, to specify a schedule for full crawls, select a defined schedule from the Full Crawl list. A full crawl crawls all content that is specified by the content source, regardless of whether the content has changed. To define a full crawl schedule, click Create schedule.
7.    To specify a schedule for incremental crawls, select a defined schedule from the Incremental Crawl list. An incremental crawl crawls content that is specified by the content source that has changed since the last crawl. To define a schedule, click Create schedule. You can change a defined schedule by clicking Edit schedule.
8.    To prioritize this content source, in the Content Source Priority section, on the Priority list, select Normal or High.
9.    To immediately begin a full crawl, in the Start Full Crawl section, select the Start full crawl of this content source check box, and then click OK.

 

To edit a content source

1.    You can edit a content source to change the schedule on which the content is crawled, the crawl start addresses, the content source priority, or the name of the crawl. Crawl settings and content type cannot be changed when editing a content source.
2.    On the Manage Content Sources page, in the list of content sources, point to the name of the content source that you want to edit, click the arrow that appears, and then click Edit.
3.    After you have made the changes that you want, select the Start full crawl of this content source check box, and then click OK.
    1. Add some crawling rules to include or exclude paths from crawling.
Add rules to exclude the following paths:
    • http://*/_catalogs/*
    • http://*/_layouts/*
    • http://*/Lists/*
    • http://*/Documents/*
    • http://*/Forms/*
    • http://.*?/DocLib[0-9]*/.*?
Note: just for the last rule you have to check the option: “Use regular expression syntax for matching this rule”
You can add a rule, to exclude some URL, as in the following screenshot:
  Adding a rule to exclude some URL


Add the following rule to forcibly include pages as normal http pages. Select the option “Include all items in this path” And check the two options: “Crawl complex URLs” and “Crawl SharePoint content as normal http pages”:
    • http://*/pages/*.*
(Note: if you was using non publishing site you would then use “http://*/sitepages/*.*” and also the previous deny rules may have to be modified.)
You can do the previous include rule as in this screen shoot:
 Adding a rule to include all files that have extensions
           

Also, add the following rule to give the crawler the chance to browse the directories without including those directories in the search. Note: this role work with integration with the previous rule that include all files in the search.
You can do the previous include rule as in this screen shoot:
 Adding rule to allow searching inside directories without including the directories them self.


Unfortunately, the previous configuration will work well only for sites that do not have a redirection page at the root. An example, of a site that has a redirection page at the root, is a multilingual site with a variation redirection page at the root. However, if this is your case, simply do two things. First, replace the rule: "http://*/Forms/*" with an exclude rules for those three: "http://*/Forms/Thumbnails.aspx", "http://*/Forms/AllItems.aspx" and "http://*/Forms/DispForm.aspx". Second, do not use any include rules. This will make you rules list as following:
  • http://*/_catalogs/*
  • http://*/_layouts/*
  • http://*/Lists/*
  • http://*/Documents/*
  • http://*/Forms/Thumbnails.aspx
  • http://*/Forms/AllItems.aspx
  • http://*/Forms/DispForm.aspx
  • http://.*?/DocLib[0-9]*/.*?

 Note: just for the last rule you have to check the option: “Use regular expression syntax for matching this rule”.
Enjoy!


Kindly support me by giving some good feedback, adding some useful comments, share it at Facebook and/or make a +1 for the article at Google from the bottom of the page.
Thanks to Abdullah Sibai & Firas Kassoumeh
________________________________
محمد الطباع (Muhammad Altabba)
SharePoint Developer with Project Management and Team Leadership Activities.