Tuesday, September 17, 2013

How To Set Up Wireless Ad Hoc Internet Connection In Windows 8

Copyright from: www.redmondpie.com

Windows 8 isn’t just missing the Start Orb or the ability to easily restart/shut down the PC; there are certain other elements that Microsoft either decided to bury deep within the settings, or omit altogether, when compared with Windows 7 and earlier iterations of the operating system. Among them is also the ability to easily create ad-hoc wireless networks using your current internet connection and wireless adapter. Essentially, an ad-hoc wireless connection turns your PC into a virtual Wi-Fi router, allowing other devices to connect to the internet through a shared internet connection, each with its own unique IP address. Until Windows 7, ad hoc connections were a breeze, since there was an option to create one right in the Network Management utility. With Windows 8, the ability does exist; it’s just a little hard to achieve. In this article, we’ll guide you how to create a wireless ad hoc connection under Windows 8.
The procedure outlined here makes use of Windows’ native Network Shell utility, deploying thewlan command within the utility to enable a hosted network that will, in turn, serve as your ad hoc connection. If all this sounds daunting, fret not, for the actual procedure is fairly easy. Follow the steps outlined below, and you should be good to go.
Windows8AdHoc
It should be noted that for this method to work, your network interface must be capable of supporting hosted networks. It’s always advisable to update your network adapter to the latest drivers before doing this.
Procedure
Step 1: Launch an elevated command prompt under Windows 8 (one with administrator privileges).
Step 2: Run the following command to verify that your network interface supports virtualization:
netsh wlan show drivers
Hosted Network support
If Hosted network supported says Yes, you’re all set. Otherwise, you need to upgrade your hardware, if the software update doesn’t fix it.
Step 3: Now, set up the ad hoc wireless network using this command. Replace the parts in markup tags with your own choices
netsh wlan set hostednetwork mode=allow ssid= key=
image
Step 4: Until now, your hosted network has been created. Now, you need to start it. Use the command below:
netsh wlan start hostednetwork
image
Step 5: You’re all set, with just one thing remaining. If it’s not already enabled, you need to allow Internet Connection Sharing (ICS) for your currently-active internet connection. Simply head over to Network & Sharing Center, and in the properties for the current internet connection, enable ICS. Make sure to select the ad hoc connection under Home networking connection.
Allow ICS


Now you can connect any device to the internet using the ad hoc wireless network with internet connection sharing that you just created on your Windows 8 PC.
Networks
It’s worth noting that this isn’t the only method to create an ad hoc connection. If you don’t want to play around with netsh command, or just need an easier solution, you may simply use a Virtual Router application for Windows, and that should do the trick for you. Google them out, you’ll find various good candidates there.

Monday, September 16, 2013

SP.UI.ModalDialog.showModalDialog(options) in SharePoint 2013

Have you ever tried using SP.UI.ModalDialog.showModalDialog(options) in SharePoint 2013. I discovered some strange behavior…
After migrating my code from SharePoint 2010 to SharePoint 2013 the calls to showModalDialog failed with message that the method cannot be found (javascript). When checking it in IE Developer Tools this isn’t surprising at all. The required js-file isn’t loaded.
But why? I guess it must be the new SOD-Model (Script on Demand) that was introduced in SharePoint 2013.
So I looked for a function that would force to load the missing js. Here it is:
SP.SOD.executeFunc(‘sp.ui.dialog.js’, ‘SP.UI.ModalDialog.showModalDialog’, function () { ShowUploadDialog(); });
With that function you can force IE to load the missing js with the needed method. The last parameter ist a delegate where you can e.g. call a function that uses the function you just ensured to be loaded.
Simple as that…
Notice: I first tried the “executeOrDelayUntilScriptLoaded”-function. But it was not of much help. It just “swallowed” my function call but never executed it because the js-file I specified was never loaded :-(
Hope this helps anyone out there!

SharePoint Internals: Resources

copyright from: tomblog.insomniacminds.com

In a country where English is not the native tongue, localisation can be pretty important. Localisation within SharePoint is achieved by using resources and resource files. Although the use of resources is not mandatory, it’s usually good practise to use them anyway. You don’t want to hard code strings in your application, and, moreover, you never know when your application should be localized. Setting up and using these resources in SharePoint can be quite confusing. So here is a little article covering this topic.
Resources
Resources – in this case: strings – are contained within XML based .resx files. Every resource in such a file is identified by a fixed name. (quite like a HashTable) Here is a little example.


Manage the field of this application.

For every new localization, you need a new .resx file with the same names as keys. You can just copy the original .resx file to achieve this quickly. In this new resource file you translate the original values within the value tag. The new resource file has to be named as follows: ..resx.
eg. – myresource.resx
- myresource.en-US.resx
- myresource.fr-FR.resx
SharePoint & Resources
First thing you need to know, SharePoint defines two kinds of Resource files: Application resources and Provisioning resources. Application resources are resources used within the normal execution of the SharePoint application. Normal SharePoint execution include: Application Pages, Web Parts and Controls. SharePoint also makes a difference between application resources used in normal web applications and application resources used in the central administration. Don’t forget that. Provisioning resources, on the other hand, are used when provisioning elements, so you have to use them within features, site definitions and list definitions. Ok, now let’s see the practical side of it: deployment and usage.
1. Deployment
Resource files in SharePoint are located in different folders. Here is a list:
  • C:\Inetpub\wwwroot\wss\VirtualDirectories\\App_GlobalResources\
  • \12\Resources\
  • \12\CONFIG\Resources\
  • \12\CONFIG\AdminResources\
  • \12\TEMPLATE\FEATURES\\Resources\
So, how do you know where to put your resource files? Well, every type of resource has its own folders.
Provisioning resources
  • \12\TEMPLATE\FEATURES\\Resources\Resources..resx
  • \12\TEMPLATE\FEATURES\\Resources\
  • \12\Resources\
Every feature uses the resources file located in its Resources folder. You can however use another resource file or even share resources. To share resource files you have to put them in the 12\Resources\ folder. Site definitions and list definitions also get their resources from this folder.
Application resources
  • \12\CONFIG\Resources\
  • C:\Inetpub\wwwroot\wss\VirtualDirectories\\App_GlobalResources\
Application resources are located in CONFIG\Resources folder. For a web application to use those resources, they have to be copied to their App_GlobalResources folder. (each web application has its own Global Resources folder) How is this done? At creation of the web application, the resources are initially copied to the App_GlobalResources folder. When adding new resources to the CONFIG\Resources folder, the resources have to be copied to existing web applications. You can do this manually or use the STSADM command: copyappbincontent.
Application resources: admin
  • \12\CONFIG\AdminResources\
  • C:\Inetpub\wwwroot\wss\VirtualDirectories\\App_GlobalResources\
Application resources for the central administration work the same way as normal application resources, except that the base folder is CONFIG\AdminResources.
2. Usage
This last part will focus on how to use resources within SharePoint elements. Luckily it doesn’t really matter which kind of resource you are using. Here are the different ways:
In C#:HttpContext.GetGlobalResourceObject("MyResource", "MyName").ToString();
In ASPX properties:<%$Resources:MyResource, MyName%>
In ASPX as text:
In XML:$Resources:MyResource, MyName
In XML features, using the default resource file:$Resources:MyName
3. Conclusion
There you go. Everything you will ever want to know about resources in SharePoint.
Part of this article is derived from the excellent article of Mikhail Dikov. You can consider this article as some sort of extension of his article. Be sure to read it. Also, I’d like to thank Tom Verhelst for the heads up on the copyappbincontent. Thanks man!
Have a great week!

Sunday, August 11, 2013

How to Dual Boot Windows 8 with Windows 7

copyright from: www.pagestart.com
Your newly purchased computer or the one you just built has Windows 8 installed. You now want to install Windows 7 as a second operating system thus creating a Dual Boot computer and giving you the best of both worlds and full app compatibility as some of your Windows 7 applications may not be supported in a Windows 8 environment.
 
Considerations before you start:
A) If you purchased your Windows 8 computer:
1 - Installing Windows 7 may void your warrantee. Call the PC manufacture and ask !!!
2 - Installing Windows 7 may render your Windows 8 “Recovery Partition” useless. Before you start, contact the PC manufacture and obtain the “Recovery media” for Windows 8. Also ask the manufacture’s support team about activation when using recovery media as your new computer may no longer have a product key code sticker, Windows 8 uses a BIOS imbedded product key for activation.
 
Partition arrangements on a computer purchased with Windows 8 may vary from manufacture to manufacture. For example a Dell computer could typically have a large number of predefined partitions:
 
EFI System Partition - 500 MB
OEM Partition - 40 MB
Recovery Partition - 500 MB
Recovery Partition - 10.63 GB
Boot, Page File, Crash Dump, Primary Partition 919.74 (Windows 8 OS C:)
 
New computers come with a feature called “Secure Boot”. You may need to temporarily disable secure boot in the BIOS before you can install Windows 7. Check your owner’s manual or contact your PC manufacture’s support team for help on how to do this.
 
3 - Are there Windows 7 device drivers for your computer’s make and model available from the manufacture’s driver support download web site? If there are no Windows 7 device drivers then installing Windows 7 may be a waste of time as your Display, Touch pad, Camera, USB and other devices may not function properly.
 
B) If you have built your own computer:
1) Verify there Windows 7 device drivers for your motherboard’s make and model available from the manufacture’s driver support download site. There is a good chance there are Windows 7 drivers and in fact less of a chance there are a full set Windows 8 drivers for older motherboards. More recently released boards will support XP, Vista, Windows 7 and Windows 8. The assumption however is that you already have Windows 8 installed as your first operating system on the disk drive.
 
Conceptual overview:
1) This article is based on a home built computer using a 1TB hard drive.
2) The free version of EaseUS Todo Backup will be used to create an image backup of the drive to an external USB drive before starting. Todo supports both Windows 7 and Windows 8.
3) You need to shrink the Windows 8 partition to make room for a Windows 7 partition. For this task you will use Windows 8’s ‘Disk Management’. To access Disk Management, open the ‘Desktop’ and press the Windows key + X, then select ‘Disk Management’.
4) You will need to disable Windows 8’s ‘Fast Startup’ option before you install Windows 7.
Why disable ‘Fast Startup’:
Failure to disable the fast startup option can result in ‘Check Disk’ (chkdsk) running when installing Windows 7. You may also no longer see the dual boot menu the next time you turn on your computer. Also if you have more than 1 disk drive chkdsk will run each time you shut down from within Windows 8 and then boot to Windows 7.
 
Fast Startup in Windows 8 is designed to close and reopen by fast booting (Hybrid Boot), it has left your system in a partially hibernated state, with the drive mounted and according to Microsoft "effectively saving the system state and memory contents to a file on disk (hiberfil.sys) and then reading that back in on resume and restoring contents back to memory."
 
Turning off the “fast startup/hybrid boot” option fixes the chkdsk problem during the installation of Windows 7, the missing boot menu problem (more on this later) and the multiple disk drives “Dirty bit” issue when booting to Windows 7.Windows 8 may take little longer to boot but not all that much as to be meaningful. Boot times for Windows 7 are unaffected and the boot menu will be displayed each time you turn on or reboot the computer.
 
How to disable ‘Fast Boot’:
Make the following changes to the Windows 8 Power Options.
1. Control Panel --> View by: Small Icons -->Power Options
2. Select "Choose what the power button does" on left hand side.
3. Click on "Change settings that are currently unavailable".
4. Uncheck "Turn on fast startup" under shutdown settings.
5. Click on the ‘Save changes’ button.
Create an Image Backup:
Before you make any changes to your Windows 8 computer, create an image backup. Its your safety net should something go wrong. I used the free version of EaseUS’s Todo Backup and an external USB drive to store the image file.
EaseUS Todo Backup: http://www.todo-backup.com/products/home/free-backup-software.htm
 
Note: The Image should include “All” partitions on your disk drive. Therefore use the Disk and Partition backup option and not the ‘System Backup’ option. Click on the left edge of the image of the disk’s partition map to select the entire drive (this will highlight the entire drive in a golden box. Change the destination to your USB drive. Note: You can create a unique destination and folder name for each backup you create by clicking on the File Explore (formerly called “Windows Explorer”).
 
Using Disk Management to create a partition for Windows 7:
1) Open Windows 8’s ‘Disk Management’ (press and hold the ‘Windows’ key and tap the X key). Then select the ‘Disk Management’ (or tap the ‘K’ key) option from the list.
2) Change the ‘Volume name’ to “Windows 8 Pro” (Without the quotes). Right click on the Windows 8 partition (C:) and select ‘Properties’. In the ‘General’ tab change the existing name to: Windows 8 Pro and click the ‘Apply’ button.
3) Shrink the Windows 8 partition to create unallocated space for use when installing Windows 7. Right click on the Windows 8 partition (C:) and select the ‘Shrink Volume’ option. Now enter a value for the amount of space to shrink in MB. For the 931GB partition in this example I wanted to create a 460GB partition for Windows 7, so I entered a value of 471040 (460 X 1024). If your Windows 8 partition contains a lot of data you want to consider a smaller partition size for Windows 7 (75 to 100GB).
Click the ‘Shrink’ button to start the process. After the shrink operation has completed you will see 460.00GB in “Unallocated” space.
4) Create a “Primary” partition and format it. Right click on the unallocated space and select ‘New Simple Volume’.
In the “Format Partition” window you want an ‘NTFS’ partition, leave the allocation unit size set to ‘Default’ and either choose a ‘Quick’ or ‘Full’ format. I prefer a full format (takes longer to complete, but it’s safer) so as the screenshot below shows, the ‘Perform a quick format’ option is unchecked. Click ‘Next’ to continue.
5) Change the volume name to Windows 7 (or Windows 7 Pro or Windows 7 Ult if Home Premium is not what you are installing). This will make it easy for you to select the proper location on the drive during the Windows 7 installation process.
6) At this point I created another Image Backup of the drive (all partitions) using Todo Backup. This allows me or you to return to the current state should Windows 7 fail to install properly the first time around.
 
7) You are now ready to install Windows 7. This will be a “Keyless” install, should anything go wrong your Windows 7 product key will not have been used or activated and you can try again.
 
For reference purposes a “Keyless” install simply means you will skip entering in a product key during the install and activate Windows 7 at a later point in time. More on this subject later.
 
I’m not going to show you screenshots for each step in the installation of Windows 7 as this has been documented many times.
 
What I will provide is the basic information and screenshots at key points in the installation process that you will need to know and follow.

Monday, July 22, 2013

SharePoint 2013 – Oh wherefore art thou Blank Site Template

Copyright from: itproafrica.com/technology/

Blankman this one’s for you :)
Just because it’s about the Blank site template.
If you upgrading or just looking to create a blank site in SharePoint 2013 you will notice its not there by default.
Have no fear for it still exists in the web template gallery.
To have this activated on you site.
* Browse to : C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\1033\XML* Edit file : WEBTEMP.XML
* Locate this line of code :
Not really :P
* You will see the blank site when you create a site collection via CA
* But not when you create a site in that site collection or subsite
* To activate for sites or sub sites
* Browse to your site
* Browse to site settings
* Under look and feel select Page layouts and site templates
* Under the sub site templates select Blank Site all and add it to the window on the right
Now you are done
Happy Blank site creation

Friday, July 19, 2013

Offline install of Office Developer Tools for Visual Studio 2012


*********************************************  Update - 3/12/2013  ******************************************
Microsoft has release RTM versions of some of the items above and the links have been update.
****************************************************************************************************************

If you are getting started with App or Microsoft SharePoint Server 2013 development, you will notice that there is no option in Visual Studio 2012 when you first install it.
clip_image002
In order to get the templates into VS, you need to install Microsoft Office Developer Tools for Visual Studio 2012 which can be found here: http://www.microsoft.com/visualstudio/eng/office-dev-tools-for-visual-studio (direct install : http://aka.ms/OfficeDevToolsForVS2012).
Unfortunately, this leverages the Microsoft Web Platform Installer which does not play well in closed environments. The Microsoft Web Platform Installer will install the following items:
Microsoft Identity Extensions
Workflow Manager Client 1.0
Microsoft Exchange Web Services 2.0
Microsoft Windows Identity Foundation SDK 4.0
Microsoft SharePoint Client Components
Microsoft Workflow Manger Tools
Cumulative Update 1.0 for Microsoft Workflow Manager Tools

Open XML SDK 2.5
Microsoft Visual Studio Tools for Office Runtime
Microsoft LightSwitch HTML Client Preview 2 for Visual Studio 2012
Microsoft Office Developer Tools for Visual Studio 2012 - Preview 2
Microsoft Office Developer Tools for Visual Studio 2012 - RTM

Once these items have been downloaded and installed on your development machine and double-click to install them, you will see that there is the option to create Apps and other items for Office and SharePoint 2013.
clip_image004
Unfortunately, if you try to create a project for any of these new fun items, you will get the following error:
An error occurred whilst trying to load some required components, Please ensure the following prerequisite components are installed.
Microsoft Web Developer Tools
Microsoft Exchange Web Services"
The problem is that the Microsoft Web Platform Installer adds parameters when installing the Microsoft Exchange Web Services that must be used in order to get around the error. If you have already installed the Microsoft Exchange Web Services, uninstall it from Control Panel and then open up a command prompt. Navigate to the location of EwsManagedApi32.msi. In the command prompt, run
EwsManagedApi32.msi addlocal="ExchangeWebServicesApi_Feature,ExchangeWebServicesApi_Gac"
clip_image006
Once that has finished installing, open up Visual Studio 2012 and enjoy creating apps for Microsoft SharePoint Server 2013.

Thursday, July 18, 2013

Easy way to deploy .resx (resource) files under App_GlobalResources folder in SharePoint 2010


copyright from: blogs.msdn.com/b/yojoshi

Resource files in SharePoint 2010

Resource files are mainly used for localization of the custom solution.
While working with SharePoint 2010, many times the customizations need to be localized and hence, it means that developers have to play around the language specific resx files. Deployment of resx files through the SharePoint solution can be achieved using SharePoint mapped folder named "Resources". However the files those goes under this path can be accessed using SPUtility.GetLocalizedString function. Majority of the times, you may have customizations related to the user interface which are declarative. SharePoint 2010 is based on ASP.NET technology so for, any tags related to resources the resx files will be searched in App_GlobalResources folder located under intepub\wwroot\wss\<> folder hierarchy.
This puts additional overhead of deployment to the developer who want to use the traditional ASP.NET way of localizing UI resources. As, we need to ensure that the resx files should be deployed under both 14 hive and App_GlobalResourcesfolders.
There are multiple ways to deploy the resource files. Following are few of them
  • Write an event handler to copy resx files
  • Custom timer job
  • PowerShell Script as a part of deployment
  • Manual copy and so on....
But what about the solution uninstallations, upgrades and moreover if you have multi server environments, manual deplooyment of resx files is more tedious and erroneous.
SharePoint 2010 Projects supports feature called as "Elements". Using Elements we can deploy number of files at specific locations. Following solution makes use of Elements to deploy resx files to App_GlobalResources folder. Few advantages of this are as below
  • No need to write custom code for deployment
  • Resx files are packaged as a part of WSP
  • No need to worry about upgrades and uninistallations its done automatically in SharePoint way
  • Works perfectly on multi server enviornment
  • No manual steps

 How to do it?

  • Create new Empty SharePoint 2010 Project name it as ResxDeployment
  • Choose a local site for debugging and, choose deployment type Deploy as farm solution
 
  • In Solution Explorer, right click on ResxDeployment project and Add SharePoint Mapped Folder
  • In Add SharePoint Mapped Folder dialog box, choose Resources and click OK
     
  • In Solution Explorer, right click on ResxDeployment project and Add New Item
  • Add few sample resx files to the Resources folder
 
  • In Solution Explorer, right click on ResxDeployment project and Add New Item. Add Empty Element and name it as required for e.g. App_GlobalResources
 
  • In Solution Explorer, click on Show All Files icon to view all files. Open SharePointProjectItem.spdata files located under App_GlobalResources node
 
  • Add the relavent information to the xml file which includes Source, and Type of the file. The type should be set toAppGlobalResource and source should be a relative path of resx file. Following is the example
 
 
  
  
  
  
  
  
  
  
   
  • In Solution Explorer, right click on ResxDeployment project and choose Deploy
  • If everything goes well the solution will be deployed on given web application. Also, you can verify that the resx files are deployed under App_GlobalResources and 14\Resources folders

Points to be noted :

  1. Resource files are deployed at two diffrent locations. You can directly add resx files to only elemets folder if needed.
  2. There is no need to copy the files from Resources mapped folder to App_GlobalResources element folder in Visual studio. There is only one copy of resx file hence, no need to worry about multiple location changes
  3. For every additional resx file, SharePointProjectItem.spdata file should be updated otherwise the file will not be copied to App_GlobalResources folder of web application
  4. Please set the Scope of the Feature that includes this module as relavent. It is preferrable to set, Application Level Scoped
In this way, by using OOTB SharePoint features we can deploy resx files to App_GlobalResources folder.