When you publish your programs probably you see bunch of other files along with your executable. You may want package your published files to single file. Here is how to do it: Edit your project file. Add these lines to your config file. <!– Publish single file settings –> <PublishSingleFile>true</PublishSingleFile> <SelfContained>true</SelfContained> <RuntimeIdentifier>win-x64</RuntimeIdentifier> <PublishReadyToRun>true</PublishReadyToRun> <!– Publish […]
Firefox status bar and javascript
If you hava a javascript like this: You will see Firefox is not showing “some text” in the status bar. Too see your text you must enable it from “Advanced Javascript Settings” window: Happy coding…
Using clipboard with console applications
Clipboard is a windows object. If you want to use clipboard in your .NET framework console applications you must reference `System.Windows.Forms` and mark your main method with `STAThreadAttribute` attribute. Then you can use this class's methods e.g. Clipboard.SetText("some text to store in the clipboard"); Happy coding.
inherit In Child Applications
You can add the <location> element with the “inheritInChildApplications” attribute to the root web.config. This attribute will prevent child applications inherit some specified configuration from the root web.config. The attribute must be placed in the <configuration> section of the web.config. It looks like this: Referance: SectionInformation.InheritInChildApplications Property
Visual Studio 2008 Apply Cutting To Blank Lines
While we are coding we used to delete blank lines with ‘Shift + Del’. Shift + Del shortcut is same as ‘Ctrl + X’. And if you copy something to clipboard before cutting the blank lines, it will be replaced by the blank line. You can change this behaviour with VS 2008 settings. Tools > […]
Switch bit field value with single T-SQL
You can switch the bit field’s value with single update statement by using exclusive or operator. Happy codding… Referance: ^ (Bitwise Exclusive OR) (Transact-SQL)
SiteMapPath Url Querystring problem
When you are using the SiteMapPath control page Urls with the querystrings, pages don't show the control. Because url can't be matched with url in your Web.Sitemap file. To handle this situation, a little web.sitemap file trick is enough. Write the static part of your Url and define the dynamic querystring parameters at "reliantOn" attribute. […]
Timespan and Databases
When you are developing application you may need to store timespan database. (Assuming you are using Sql Server 2005) TimeSpan.TotalSeconds can be used to store. This returns a double. And maps to decimal data type of the sql server. For reverse action to get the time span you can use TimeSpan.FromSeconds method. This will give […]
Converting a List of Inherited Type to a List of Base type
For example you have a base class and a class that inherits it like below. And you have generic list of these types. Then if you want to convert List<B> to List<A> You can use this code block: Happy coding.
How to use overloaded methods with ASP.NET Web Services
In .NET world it’s very common to write methods with same name but different parameters. This is called overloading. And if you use this technique wisely you can prevent some code repetation. But in the web services world of .net its not allowed by default. If you try you get an exception says : “Bla, […]