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!