The following piece of code uses the My.Computer.Network.IsAvailable property to determine whether or not the computer is connected to a network. This network could be the Internet or a local network; for as long as the computer is connected to one such network, the response retrieved will be positive. This Visual Basic (VB.NET) code snippet is used […]
Internals Visible to Declarations Cannot Have a Version in SQL Server 2005 CTP
If you’re getting an error similar to the one below: [C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SqlServer.SmoEnum\9.0.242.0__89845dcd8080cc91\Microsoft.SqlServer.SmoEnum.dll] InternalsVisibleTo declarations cannot have a version, culture, public key token, or processor architecture specified. (ObjectExplorer) If you’re getting this error when you try to connect to a SQL Server 2005 database using SQL Server Management Studio CTP, it’s because you installed .NET Framework 2.0 […]
How to get the current Unix timestamp in PHP
The Unix timestamp represents the time measured in seconds since the start of the Unix epoch (January 1st, 1970). The Unix timestamp is often inserted into databases, to date the records. Getting the Unix timestamp in PHP is done by using the time() function, which returns the current Unix timestamp of the server. Here we output the […]
How to retrieve a list of installed printers
Retrieving a list of available printers using .NET 2.0 is quite easy since it’s supported by the framework itself, and there’s no need to mess with unmanaged code. First add the using statement: Here’s the entire code in one page:
How to go back one page in the browser history using JavaScript
Using JavaScript you can go back or forward in the browser’s navigation history. Most of the time you want to go back one page by clicking a link in the page. For doing that, use the following code: <a href=”javascript:history.go(-1)”>Go back</a> It’s easy to figure out that to go back more pages in history, you […]
How do I get the values when submitting a form (either using GET or POST)?
This is a popular question among ASP.NET beginners, because this is done fairly different with .NET. While in PHP you would use $HTTP_POST_VARS[‘field1’] and $HTTP_GET_VARS[‘field1’] to get the value passed from a form (either using POST or GET method), in ASP.NET there is a big difference.First, if you pass the value using the GET method (passed as parameters in […]
Python Developers Survey: The Decline of Python 2 and the Rise of Python 3
Python has long stood as a titan in the programming world, renowned for its simplicity and versatility. The Python Developers Survey serves as a barometer for the language’s evolving ecosystem, capturing the changing preferences of its vast community. As we pore over the latest survey results, a narrative unfolds, chronicling the gradual sunset of Python […]
Cannot implicitly convert type ‘string’ to ‘System.Drawing.Color’
Certain ASP.NET controls such as the label can be assigned to it colors (background colors, foreground colors, etc.) at runtime from the code-behind files. Even though the label renders into an HTML entity, you cannot directly assign a color that is in the Hex format (such as #FF00EE); if you try you will receive the […]
Error while trying to run project: Unable to start debugging on the web server
If while trying to debug your ASP.NET web application you receive the following error: Error while trying to run project: Unable to start debugging on the web server. Catastrophic failure.Would you like to disable future attempts to debug ASP.NET pages for this project? You most probably don’t have ASP.NET registered correctly on the system in […]
Open a web page in the default browser
Opening an URL in the default browser using VB.NET could not be any simpler. All you need to do is to invoke the Process.Start() method and pass the URL of the page that you wish to open: