If you need to find out the IP address of the visitor of your website then you can use the following code to get it
Request.UserHostAddress()
This will provide you the IP address of the user.
If you need to find out the IP address of the visitor of your website then you can use the following code to get it
Request.UserHostAddress()
This will provide you the IP address of the user.
Step 1
In Visual Studio Go to Tools > Library Package Manager > Manage Nuget Packages for Solution.
Step 2
You would get the following screen, you can check the packages which you have already available in your solution, you can search for new packages and install them to your solution.
Remember: These packages need to be downloaded , each time you create a new Visual Studio solution
I realised that in my MVC5 project in Visual Studio I could not get the Ajax.BeginForm to work properly. It will always do a full postback.
I was trying to complete a Video Rating Page, where there are buttons to rate a video and once the user presses one of the rating button, it should thank the user and display the new rating value. I wanted this to shown on the same page without reloading the page, So I considered using AJAX.BeginForm which will simply work fine.
In order to have this AJAX functionality you will have to download the AJAX from NUGET.
Step 1
Install the following two highlighted packages from NUGET. Click here to check how to load Packages from NUGET in Visual Studio
Step 2
Once you have installed the above two packages through NUGET then do the following.
Go to the _Layout file in your _shared folder in the Views. ( Note that I am using VB.NET but the example will work for C# also.
Open the _Layout.vbhtml file and browse to the bottom.
You will see the following two lines.
@Scripts.Render(“~/bundles/jquery”)
@Scripts.Render(“~/bundles/bootstrap”)
Now add the following line after the above two lines.
<script src=”~/Scripts/jquery.unobtrusive-ajax.min.js”></script>
I made a mistake of adding this script at the top of my page and my AJAX calls refused to work.
Then I realised that the AJAX has to be loaded after loading the jquery. So I added it at the last.
Step 3
Run your application.
Your AJAX Calls should work fine.
Favicon is the little icon which appears in the tab of your browser when you visit a website.
When people save your website URL as favourite, then this symbol will be displayed in the favourite in their browser, tablet or mobile device.
Step 1
If you do not have a FAVICON then just google “create a favicon” and you would see lots of sites offering online creation tools.
Step 2
Go to your WordPress and click on Plugins
Click on Add New
Search for plugins Type in favicon.
I chose one called Captain Favicon.
Install it.
Activate it.
Step 3
There should be a button which suggest to upload the favicon. Upload the favicon which you created in step 1.
Upload and save.
Now you should be able to see your favicon when you browse your website.
Here is a short video showing the steps.
While working on the Visual Studio 2013 Express, I was happily burning the midnight oil to produce a new application, the application was coming on nicely.
But When I started work next day, suddenly I started getting the following error message.
Could not load file or assembly 'Antlr3.Runtime' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
After searching for long and trying different optionx the following solution did work for me and I was back in action. Hope you can benefit it from as well.
Step 1
Go to the file explorer and search for %Temp% (See the screen below)
Step 2
You would see lots of file in Temp folder. Delete them all.
Step 3
Run Visual Studio 2013 Express again and you would be able to work again on your project.
If you wish to add a YouTube Video in your WordPress Post then just take the following steps.
Step 1
Goto YouTube and look for the suitable Video and play it
Step 2
When it is playing just copy the URL which is displayed in the browser
Step 3
Copy and Paste the URL in your WordPress Post.
Voila !
When you are using the WordPress to create new Posts it will usually add the Author Name and the Date on which the post was made.
There are various posts on the internet as to how to remove this.
The most simple method I have found through Editing the Content.PHP file and remove the following text from it.
See the pictures below for easier explanation. If you want to remove the Author name also then there will be another tag above it which will have the Author info, you can also delete that to get rid of the Author name.
One word of caution, if you change the Template of your WordPress site by using another Theme then you might have to repeat this step again.
The following code will help if you have a need to convert the month number such as 3 to the month name like March.
//the following line of code will convert the month number to month name
string sMonthName = DateTime.Today.ToString(“MMM”);
// the following line of code will give you the Month Name and the Year
this.btnOne.Content = sFirstMonth + “-” + DateTime.Today.Year.ToString();
See the video below to see the working of the code live.
This is how you would open a second window in WPF.
private void btnAppointmentPage_Click(object sender, RoutedEventArgs e)
{
//In this example we have already created a WPF Window and called
//it AppointmentsMain.xaml
AppointmentsMain AppointmentWindow = newAppointmentsMain();
AppointmentWindow.Show();
this.Close();
}
If you have to select one of the options from various possibilities then your best option is to use the case
In VB.NET you would used something like below.
Select [ Case ] testexpression
[ Case expressionlist
[ statements ] ]
[ Case Else
[ elsestatements ] ]
End Select
Here is more practical example:
Dim intMyNumber as Integer = 20
Select Case intMyNumber
Case 1
Debug.WriteLine("The value of my number is 1")
Case 2,3,4
Debug.WriteLine("The value of my number is between 2 and 4.")
Case 5 to 9
Debug.WriteLine("The value of my number is between 5 and 9")
Case Else
Debug.WriteLine("The value of my number is not in 1 to 9")
End Select