Skip to main content

Posts

Autocomplete control with ASP.NET MVC 4 and jQuery

Almost in each modern website project one of the feature is suggesting user possible items to select when he start typing one of them. Such functionality is done by using control named autocomplete . Under the hood  it consists of at least three elements: UI control which allow user to type some text - mainly this in HTML input of text type Server-side function which serves data to be auto-completed Client-side logic (written in JavaScript) which , by using AJAX, send request to the server asynchronously and then process the results. When we think about creating autocomplete control in ASP.NET MVC 4 we definitely should take a look at  jQueryUI framework. One of the feature of this framework is autocomplete control which enables users to quickly find and select from a pre-populated list of values as they type, leveraging searching and filtering. That sounds very good and is excellently what we are looking for. ...

Custom configuration in Web.config

Almost all projects have come configuration which is mostly unique and absolutely custom. That configuration allow to customize some application behaviors, settings and switching some parts of implementation. In Microsoft .NET Framework configuration can be stored in two types of files: *.config - XML based file which differ depending on project type. In web application such ASP.NET or WCF we working with Web.config file and in desktop application use App.config . *. setting - deprecated type of file which allow to store custom settings in XML  based, strongly typed file.  In this post I focus on Web.config file and demonstrate how to create custom section for this type of file.  At the beginning  we need some basic configuration file which is easy to get one because after we created new ASP.NET project from a template we already should have one. Simplified version on Web.config looks like as rese...

Compression in BAT by using 7z

To compress direcotry or files in batch program all You need to do is  to install 7z opensource and create simple 'task.bat' file with only few line of code: @echo Start processing "C:\Program Files\7-Zip"\7zg.exe a C:\Backup\important_data_%date:~0,4%%date:~5,2%%date:~8,2%.7z C:\inetpub\wwwroot\BestWebsite -t7z -mx9 -m0=LZMA -pMYPassword @echo End PAUSE What we do here is: 1) Run 7zg.exe program 2) Create target file important_data_(current data).7z in C:\Backup\ directory 3) Indicate file or folder to compress in this ex we compress 'BestWebsite' directory 4) Set compression parameter in this example we have-t7z -mx9 -m0=LZMA 5) Optionally set a password to compressed document Thank you

WCF Pagination

In many of my projects  including last one I need to user N-Tier architecture for my application. This is very good approach because you can centralize your business logic and have many type of clients (WWW, mobile devices) thanks WCF and REST technology. The other thing is that most of business solutions displays some data in tabular format knows as grids and grid has always one problem: number of records increasing in time. So we need to ask ourselves do we really need to display all the data together  to user on one page? Of course not! Such approach is incorrect and not against best practices because its extends the time of response and send a much more data to client. To deal with that problem many developers uses pagination mechanism which is part of ASP.NET (ex. asp:Grid) but such approach is not correct when working with N-Tier architecture and its not supported in any mobile devices. In my ap...