Saturday, January 26, 2013

How to get Line break in a button using HTML and CSS

Some times there are some scenarios where we might put some line breaks in buttons while doing HTML code your pages. There are few different ways that you can achieve this using HTML and CSS.

Here are few code snippets

   1: <!-- Method 1 -->
   2: <input type='submit' value='my \n button'>
   3: <!-- Method 2 Using HTML break-->
   4: <input type='submit' value='my &lt;br> button'> 
   5: <!-- Method 3: Using CSS -->
   6: <input type="submit" value="My button" style="white-space:normal"/>

Hope this helps!!

Friday, July 20, 2012

How To: Delete/Remove Services In Windows

Users can usually uninstall applications from their computers quite easily, however the same cannot be said for Windows services, of course you can disable a service, but the entry for it may still remain.

If you are looking for a way to completely delete a service from Windows here is how we can do this.

Open a command prompt, by going to Start > Run and type in cmd without the quotes and hit the Enter key.

Once a command prompt has opened up, type the command sc delete service name without the quotes

image

Once a service has been deleted you should see a message saying [SC] DeleteService SUCCESS, this should mean that the service has been deleted, to ensure that, just click on the refresh button in the services.msc window and confirm that the service has been deleted.

Note: You should always delete services in safe mode, just in case it causes you any problem, you may also want to create system restore points, just in case something goes wrong. But If you are a developer and its your own service then you don’t need to do this since you know about your service how it works.  Smile

Get time in AM/PM Time format in SQL Server

There are times that you want to display non-Military or AM/PM time format. The standard Convert formats do not have an option to return the time in this format. The SQL below will return only the time portion of the current date/time in the AM/PM format. 

 

SELECT substring(convert(varchar(20), GetDate(), 9), 13, 5)
+ ' ' + substring(convert(varchar(30), GetDate(), 9), 25, 2)


You can use this to update see your custom results by updating getdate() with your date object.

C#: How to Get Machine name of the webserver

Here is how you can do using C#,

Response.Write("machinename " +System.Environment.MachineName +"<BR>" )


This gives you name computer where your webserver is located.


If you need with the domain name here is how you can achieve using the following code snippet:


You need to import following namespace to use this,


using System.Net; 


public static string GetServerMachineName()
{
string domainName = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;
string hostName = Dns.GetHostName();
string sysdn = "";
if (!hostName.Contains(domainName))
sysdn = hostName + "." + domainName;
else
sysdn = hostName;

return sysdn;
}

Happy Coding Smile