Skip to main content

Posts

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 approach I wish to implement all my business logic and services by using Service Facto

Full-Text Search with PDF in Microsoft SQL Server

Last week I get interesting task to develop. The task was to search input text in PDF file stored in database as FileStream. The task implementation took me some time so I decided to share it with other developers. Here we are going to use SQL Server 2008 R2 (x64 Developers Edition), external driver from Adobe, Full-Text Search technology and FileStream technology.Because this sems a little bit comlicated let`s make this topic clear and do it step by step. 1) Enable FileStream - this part is pretty easy, just check wheter You already have enabled filestream on Your SQL Server instance - if no simply enable it as in the picture below. Picture 1. Enable filestream in SQL Server instance. 2) Create SQL table to store files  - mainly ther will be PDF file stored but some others is also be allright. Out table DocumentFile will be created in dbo schema and contain one column primary key with default value as sequential GUID. Important this is out table contains FileStream

Unexpected error while debugging Windows Phone 7.1

Today I`ve  some strange which occurred before my debugger attached to the Windows Mobile emulator. Exception message text  was: " File or assembly name 'System.Windows.debug.resources, Version=2.0.5.0, Culture=en-US, PublicKeyToken=7cec85d7bea7798e', or one of its dependencies, was not found . " As You can see this in not helpful and hard to resolve. But after some investigation I remembered that I changed some exception settings in my Visual Studio. All thing You need to do, when you get such error is  to turn off any other exception types than ' CLR Exceptions ". To change this in Visual Studio go to the Debug->Exceptions. Thank You.

Creating common partial class with Entity Framework

When we use the Entity Framework (EF) in multilayer information systems sometimes we want to extend classes generated by EF by adding some common properties or functions. Such operation can`t be conduct on *.edmx data model so we need to make some improvement in our solution. Let`s begin... Lets assumed that in our soulution we have only three layer (three project): Client console application which has reference to the second layer  - ' ConsoleApplication ' project name Class library project with class interfaces only - ' Interfaces ' project name Class library class implementation and data model referenced to 'Interfaces' project - ' Classes ' project name. Picture 1. Solution structure. Now when we have all solution structure we can focus on data model. In the ' Classes ' project we create a new folder named ' Model ' and inside add new item of ADO.NET Entity Data Model named ' Learning.edmx ' - it may be empty