Blog

Here I document some issues for searching of which I spent more then 15 minutes

  • Manage serialization in .Net Core 2.0

    Hello everybody,

    today I want to write a short notice on how to manage uppercase/lowercase options for serialization in .Net Core.

    In mine practice I often had situation, when javascript or typescript code sends me some staff in lowercase class names, but in C# I'm used to Upper case class names. 

    Another option that you sometime can need is switching between xml and json serialization. How those options can be managed in .Net Core 2.0 ?

    For both of those options ( and even more ) you can use pipeline management of Startup class of ConfigureServices method.

    For example if you need to have xml serialization output you can use following code:

    public class Startup

        {

            // This  … more

  • Some notes on Jira usage

    Hello everybody,

    today I want to make a short recording of the following video: Introduction to Jira & Agile and Project management.

    Actually I just want to have short text version of Dan Chuparkoff's  advices.

    Task is something that is bigger then 30 minutes but smaller then 3 days to complete. It is practical don't have tasks that take more then one day to do.

    You can't wait in the middle of the task. If you are waiting in the middle of the task, then take another look, maybe you have series of tasks. 

    You can be in three modes: in progress, done, not started.

    Estimating is hard, but use estimates. And use story points, not the hours. 

    There are different kinds of story points.  … more

  • Ridge regression in C# with help of Math .Net Numerics

    Hello everybody,

    today I want to share a piece of code that took me almost few months of learning in order to implement it. It is Ridge regression. Below goes code that gives you weights for Ridge regression:

    public double[] RidgeRegression(double[][] xTrain, double[] yTrain, double lambda = 0.1)

    {

        var M = Matrix<double>.Build;

        var x = M.DenseOfRowArrays(xTrain);

        

        var ones = Vector<double>.Build.Dense(x.RowCount, 1);

        x = x.InsertColumn(0, ones);

        var y = Vector<double>.Build.DenseOfArray(yTrain);

        var xt = x.Transpose();

        var lambdaIdentity = lambda * M.DenseIdentity(x.ColumnCount);

        var sumDot = xt.Multiply(x) + lambdaIdentity;

        var  … more

  • Linear regression behavior with free weight

    Hello everybody,

    recently I've decided to implement some ML library in C#. But mine ultimate goal of that C# library was to make it use as much as possible TPL features of C#. 

    I'm aware about other ML libraries, but as often is said, if you wish to understand how some ML algorithm works, program it by yourself. I've decided to start with Linear regression.

    Here you can see how mine library utilizes processor:

    as you can see it uses 85% of mine 4-cores CPU, which is impossible with only one thread running.

    First step for me was to understand how that algorithm works. In order to understand it I've took course Machine Learning Specializationfrom University of Washington.

    I'll omit … more

  • Practical value of unit tests

    Hello everybody,

    Here will be another interesting benefit of writing unit tests which I've discovered recently for myself. 

    Simplified testability

    Imagine, that for you as for developer arrived some kind of bug. After investigation you've found that bug is caused with imporper method functionality. How can you fix method without unit tests? Way will be like this:

    Add code fix

    Execute application and make effort to re-prodcue bug

    If bug is not re-produced, you make commit/push and enjoy life

    If bug is not fixed, go to steps 1 - 3 one more time.

    Here is how those steps can look like in unit test:

    Add unit test that feed into method with bug wrong values

    Add fix to code … more

  • Some notes on xUnit usage

    Hello everybody,

    today I want to share with you small explanation about how xUnit works. 

    Take a look at presented code:

    [Theory]

    [InlineData(3, 4, 5)]

    [InlineData(7, 8, 9)]

    public void MethodDemo(int numberOne, int numberTwo, int numberThree)

    {

        double[][] data = new double[1][];

        data[0] = new double[3];

        data[0][0] = numberOne;

        data[0][1] = numberTwo;

        data[0][2] = numberThree;

        var sut = new Matrix(data);

    }

    If to describe this code in words, it has following meaning. 

    Attribute Theory says that it is test method which should be exeuted.

    Repeated twice Attribute InlineData says that method MethodDemo should be executed twice, with assigning to … more

  • Access rights in Acumatica

    Hello everybody,

    today I want to leave a short notice on how access rights work in Acumatica. So, if to enumerate them, there are following access permissions: revoked, select, update, insert, delete. 

    If to enumerate them in the list of smallest permissions to biggest, it will be list like this:

    Revoked - user can't see or edit

    Select - user can see, can't edit

    Update - user can see and edit

    Insert - user can see, edit, create new

    Delete - user can see, edit, create, delete

    So, if you configure permissions, and want to give highest level, then give Delete. But if you want to protect system from accidental deletion, then most probably you'll need give them Select set of … more

  • C# async/await usage

    Hello everybody,

    today I want to describe in simple words what C# does for .Net cases in IIS.

    Before I continue, I want to point the following. As usually IIS has 500 threads. It means that one IIS server can simultaneously server 500 customers. Keeping this idea in mind

    take a look at the following code:

    [HttpGet]

    public IEnumerable<string> GetSync()

    {

        string val1 = "value" +  LongRunningMethod().ToString();

        string val2 = "value2";

        return new[] { val1, val2 };

    }

    private int LongRunningMethod()

    {

        Thread.Sleep(10000);

        return 10;

    }

    and imagine that you have 600 customers simultaneously. For 500 lucky users of your web site it will mean that their … more

  • Import export data between different SQL servers

    Hello everybody,

    today I want to share some information on how to import some big chunks of data from one server to another. Need for this movement for me personally arised when I had a need to transfer big amounts of data on a regular basis. Big amount means 2.5 millons of records. My first apporach was to use SQL Server 2017 Import and Export Data. Initially I've used 32 bit tool, and found out that I sometime face strange error messages. After some googling I've found that for big volumes of data it's better to use SQL Server 2017 Import and Export Data 64 bit. 

    and all of the sudden strange configuration errors, drivers lack error, ODBC driver error had leave me. 

    So, one of the … more

  • Some notes on usage Table variables

    Hello everybody,

    today I want to share some fragment of SQL, that I've used for updating tables in Acumatica.

    First of all, I'd like to show table variable that I've created:

    DECLARE @SalesOrderInformation TABLE

    (

      OrderType nvarchar(2),

      OrderNbr nvarchar(12)

    )

    It has nothing special, just two fields: ordertype and ordernbr. 

    I need them as temporar storage for future update. T-SQL allows to use two kind of temporary tables: table variable and temp table, which starts from #.

    I prefer table variables for the following reasons:

    1. Performance. Because limited scope, as usually performance fo table variables is faster then temp tables. 

    2. Temporary tables instead of table … more

General information

Greetings to everybody stopping at my blog. Purpose of this web site is to be google of my brain. Everything I found useful, or of possible beneficial for usage in future I've save here at this blog

Contact information

If you want to contact me more on any subject printed at this web stie, you can email me: zaletskiy(at)gmail.com

Job information

If to speak in general, I'm developer. For now I work as team lead in company GlobalLogic.