Posts

Showing posts from October, 2012

String Format for Double C#

String Format for Double [C#] The following examples show how to format float numbers to string in C#. You can use static method String.Format or instance methods double.ToString and float.ToString . Digits after decimal point This example formats double to string with fixed number of decimal places . For two decimal places use pattern „ 0.00 “. If a float number has less decimal places, the rest digits on the right will be zeroes. If it has more decimal places, the number will be rounded. [C#] // just two decimal places String .Format( "{0:0.00}" , 123.4567); // "123.46" String .Format( "{0:0.00}" , 123.4); // "123.40" String .Format( "{0:0.00}" , 123.0); // "123.00" Next example formats double to string with floating number of decimal places . E.g. for maximal two decimal places use pattern „ 0.## “. [C#] // max. two decimal places String .Format( "{0:0.##}" , 123.4567);

Jquery UI Multiselect bind items from codebehind

you can use : $ ( "#<%=ddlTeste.ClientID%>" ). multiselect ({         checkAllText : "All" ,         uncheckAllText : "Clear" ,     noneSelectedText : "Select a country" ,     selectedText : "# item(s) selected" ,     close : function ( event , ui ) {         var values = $ ( "#<%=ddlTeste.ClientID%>" ). val ();         var array_of_checked_values = $ ( "#<%=ddlTeste.ClientID%>" ). multiselect ( "getChecked" ). map ( function () {             return this . value ;         }). get ();         document . getElementById ( "<%=txtHidDataTeste.ClientID%>" ). value = array_of_checked_values ;     } }); var s = $ ( "#<%=ddlTeste.ClientID%>" ). multiselect (); s . val ([ '1' , '2' , '5' ]); $ ( "#<%=ddlTeste.ClientID%>" ). multiselect ( 'refresh' ); ASPX code: <asp:DropDownList

jQuery UI Multiselect widget clear all check boxes

you can use methiods like Methods After an instance has been initialized, interact with it by calling any of these methods: // example: $("#multiselect").multiselect("method_name"); ...which can be found in the widgets  documentation  under  Methods $ ( "#multiselect" ). multiselect ( "uncheckAll" );

check file exist on Server from SQL Query

use Usage: EXECUTE xp_fileexist <filename> [, <file_exists INT> OUTPUT] OR Create a function like so: CREATE FUNCTION dbo . fn_FileExists (@ path varchar ( 512 )) RETURNS BIT AS BEGIN       DECLARE @ result INT       EXEC master . dbo . xp_fileexist @ path , @ result OUTPUT       RETURN cast (@ result as bit ) END ; GO Edit your table and add a computed column (IsExists BIT). Set the expression to: dbo . fn_FileExists ( filepath )

redirect - go to with javascript

you can use  window . location = url ;

Visual Studio setup project, generate an uninstall .

%windir%\system32\msiexec /x {Product Key}

sql server collation conflict

To resolve the collation conflict add following keywords around "=" operator. SELECT ID FROM ItemsTable INNER JOIN AccountsTable WHERE ItemsTable.Collation1Col COLLATE DATABASE_DEFAULT= AccountsTable.Collation2Col COLLATE DATABASE_DEFAULT Collation can affect following areas: 1) Where clauses 2) Join predicates 3) Functions 4) Databases (e.g. TempDB may be in a different collation database_default than the other databases some times)

Getting files by creation date in C#

using System.Linq; DirectoryInfo info = new DirectoryInfo(""); FileInfo[] files = info.GetFiles().OrderBy(p => p.CreationTime).ToArray(); foreach (FileInfo file in files) { // DO Something... }

full screen windows form c#

this .FormBorderStyle = FormBorderStyle.None; this .Left = (Screen.PrimaryScreen.Bounds.Width/2 - this .Width/2); this .Top = (Screen.PrimaryScreen.Bounds.Height/2 - this .Height/2);
Image
Geocode with Google Maps API v3 The purpose of this post is to show how to implement a simple address search tool with auto-completion using Google’s Google Maps API v3 with both client side geocoding and reverse geocoding. The search menu will propose to search for addresses in two ways: the first will be direct address typing with suggestions for auto-completion and the second will finding addresses by dragging a marker on a map. See it working here This is done in 5 steps: create a page and download the jquery libraries initialize a map, a geocoder and a marker setup the jquery search widget to work with the geocoder to fetch suggestions and pin a marker down upon selection of a result configure a listener to reverse geocode marker position when it is being dragged Create a page We start by creating a file structure which includes an index.html file, a css/ and a js/ folders. We need as well to go on the jquery website to download the autocomplete widget library a

SVN Working Copy ... locked

One approach would be to: Copy edited items to another location. Delete the folder containing the problem path. Update the containing folder through Subversion. Copy your files back. Commit

Full text index search using one-character word

I'm using full text index search. There are few cases when for our customer it is important to find words even with only one character. Unfortunately it seems that SQL server ignores such words, although I haven't found assurance for that in docs. So here is the scenario. Suppose I want to find word 3. My table data are as follows: select * from test_fts ; id txt ----------- -------------------------------------------------- 1 3 trees 2 33 trees 3 green trees Now I'm trying to find the word 3. select * from test_fts where contains ( txt , '"3"' ) id txt ----------- -------------------------------------------------- Informational : The full-text search condition contained noise word ( s ). select * from test_fts where contains ( txt , '"3*"' ) id txt ----------- -------------------------------------------------- 2 33 trees OK 3 is a nois

Creating Full Text Catalog and Full Text Search - SQL SERVER

Image
SQL SERVER – 2008 – Creating Full Text Catalog and Full Text Search September 5, 2008 by pinaldave Full Text Index helps to perform complex queries against character data.  These queries can include word or phrase searching. We can create a full-text index on a table or indexed view in a database. Only one full-text index is allowed per table or indexed view. The index can contain up to 1024 columns. Software developer Monica who helped with screenshots also informed that this feature works with RTM (Ready to Manufacture) version of SQL Server 2008 and does not work on CTP (Community Technology Preview) versions. To create an Index, follow the steps: Create a Full-Text Catalog Create a Full-Text Index Populate the Index 1) Create a Full-Text Catalog Full – Text can also be created while creating a Full-Text Index in its Wizard. 2) Create a Full-Text Index 3) Populate the Index As the Index Is created and populated, you can write