Category: Soft/Programming

  • RAD Studio XE on the road in the Europe

    Today I was on event of Embarcadero. David I presents the new RAD Studio XE.
    He told about new features of XE, DataSnap and shown the Delphi Prism on Mac (MonoDeveloper).

    He also shown the beta of 64 bit compiler (compiled the simple project).
    Also in the next version (XE 2) they will add the new abstract layer for VCL for any custom render of winforms (for example, use the QT library instead standard Windows controls). The VCL+ is a draft name.

    Generally great session. In 5 PM he flayed in Moscow

    PS: DataSnap is the extension for WinServices from Microsoft. They extended with callbacks, protocols over http (RECT), objects from json, different wizards, languages for client and server scripting etc

  • Parser for ePub files (e-book)

    Today I finished the component to parse the e-books in .epub format:

    http://en.wikipedia.org/wiki/Epub

    I added this parser in SMWord suite  Also I added this file format to Fast Document Viewer and ABA DocConvert

  • C#: generate image thumbnail

    //create the thumbnail 
    int image_width = 96; 
    int image_height = 96; 
    Image imgThumbnail = imgOriginal.GetThumbnailImage(image_width, image_height, null, IntPtr.Zero); 
    
    //save to file 
    imgThumbnail.Save(Path.GetDirectoryName(AFileName) + @"\a2.bmp", ImageFormat.Bmp);

    or

            private bool ThumbnailCallback()
            {
                return false;
            }
    
            private void ProcessImage(Image imgOriginal)
            {
                //create the thumbnail
                int image_width = 96;
                int image_height = 96;
                Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback);
                Image imgThumbnail = imgOriginal.GetThumbnailImage(image_width, image_height, myCallback, IntPtr.Zero);
    
                //save to files
                imgThumbnail.Save(Path.GetDirectoryName(AFileName) + @"\a2.png");
            }
    
  • C#: random file name

    string path = Path.GetRandomFileName();
    
  • C# and MS SQL Server: add System.Drawing assembly

    Working with images in SQL Server 2005 is not easy because the System.Drawing.dll is not included in the assemblies with SQL Server.

    This library was not added because it does not pass the CLR Verifier, and it has not been fully tested in SQL Server hosted environment (i.e. it could damage the stability and security of SQL Server). Careful consideration should be taken when attempting to manipulate images (or even load images from a file system or webservice).

    To add the System.Drawing.dll assembly to SQL Server use the new create assembly statement. The database you are adding this assembly to must have its TrustWorthy property turned on. The following code demonstrates how to add System.Drawing.dll to the ImageGen database.

    ALTER DATABASE yourDatabase
    SET TRUSTWORTHY ON
    GO
    CREATE ASSEMBLY [System.Drawing]
    FROM 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll'
    WITH PERMISSION_SET = UNSAFE
    GO
    

    Now a managed stored procedure can be created that uses the System.Drawing.dll assembly as shown below (although do not forget to add the assembly reference in the VS project).

    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Data.SqlTypes;
    using Microsoft.SqlServer.Server;
    using System.Drawing;
    using System.Drawing.Imaging;
    
  • C#: password characters for property in Property Grid

    To not show your passwords in plain text on a propertygrid, just use the PasswordPropertyText attribute:

    [DisplayName("Password"), Category("Authentication"), PasswordPropertyText(true)] 
    public string Password 
    { 
       … 
    }
    
  • C#: image to byte array

        private byte[] ImageToByteArray(Image img) 
        { 
            // stream to save the image to byte array 
            Stream ms = new MemoryStream(); 
            img.Save(ms, img.RawFormat); 
    
            // read to end 
            byte[] imgBytes = new byte[ms.Length-1]; 
            ms.Position = 0; 
            ms.Read(imgBytes, 0, imgBytes.Length); 
            ms.Close(); 
    
            return imgBytes; 
        }
  • ShareIt: new control panel

    ShareIt сегодня запустили уже всем свою новую контрольную панель (v7.0).

    Может я и консерватор, но старая мне больше нравилась. Если бы они еще какой-то новый функционал прикрутили, я бы понял. А так просто изменили весь GUI. По сути старое дерево навигации запихнули в меню+выпадающие окошки. Пока первое впечатление скорее отрицательное…

  • Protected Storage Viewer

    http://www.scalabium.com/psv

    Today I added the possibility to view the storages of Internet Explorer 7.x/8.x

  • SMLog suite v1.7

    Yesterday I changed the default error dialog in SMLog suite

    Error dialog in SMLog v1.7

    The format of log file now is text or XML (see the new Formatting property)

    Also a few minor bugs fixed (list of all graphic adapters, computer name in Windows XP etc)