Archives

Archives / 2017
  • DeletedDatabaseRecord in Acumatica

    Hello everybody,

    today I want to write few words about interesting feature of Acumatica: column DeletedDatabaseRecord. As you may know plenty of ERP systems have strategy of holding everything that ever passed through them, and even if user has huge desire to ask ERP system to forget something via deletion of some entity, ERP "pretends" that record was deleted, but leaves it in db. 

    From this standpoint Acumatica can be exception. It allows to preserve records that lived inside of it. Allows mean can preserve or not preserve. 

    How programmer can achieve this kind of behaviour? Via column DeletedDatabaseRecord. 

    If you want Acumatica to hold some kind of entities in db, just add this … more

  • Multithreading in Acumatica

    Hello everybody,

    today I want to say a few words about my practice of usage Multithreading in Acumatica. I have a dedicated server which has 40 cores. And I have a need to read plenty of records from some other system. General schema is like this:

    Create some graph instance.

    Fill created graph instance data views with needed data

    At created graph instance call method graphInstance.Actions.PressSave();

    And that schema is perfectly workable, but for my disappoitment my 40 cores were not busy at all with doing something useful. So I had to figure out how to use them more fully. 

    Here are some fragments of code that I've used:

    int numberOfLogicalCores = Environment. … more

  • Some notes on Buttons creation in Acumatica

    Hello everybody,

    today I want to write few words about buttons usage in Acumatica.

    So, first of all, if you just need to add button at your form, you can use following syntax:

    public PXAction<PrimaryDACClass> SomeAction;

    [PXButton(CommitChanges = true)][PXUIField(DisplayName = "Some Action")]protected virtual void someAction(){      ...}

    Following syntax will create a button for you in the top buttons panel of Acumatica.

    Take note of CommitChanges=true attribute. In case if you need just some activity without persistance to database, then you can set it to false. But if you want button to save some changes to database then set it always to true.

    There is one more way of declaring … more

  • How to make back up of db smaller in MS SQL

    Hello everybody,

    today I want to document one hack that preserved me plenty of space on my hard drive.

    Recently I've tried to make back up of production database and was shocked to see that it had almost 200 Gb on my hard drive.  So it made me wonder how can I have smaller backups. 

    And here is the solution.

    In Microsoft SQL Server Management Studio click on database, and choose new query

    enter there following command: sp_configure 'backup compression default', 1

    then this: reconfigure WITH OVERRIDE;

    After such manipulations I've got back up that had only 27 Gb. more

  • Some digging in tables of Acumatica

    Hello everybody,

    today I want to document one useful sql query that can be beneficial for cases if you need to dig in Acumatica tables, and need quickly to find type of some particular column.

    Here it is:

    select * from information_schema.columns where table_name = 'SOLine' and COLUMN_NAME like '%OrderQty%'

    that sql will let you know all information about column OrderQty. more

  • Types of learning in AI

    Hello everybody,

    today I want to make a short notice on question that I often receive: what kinds of learning exists in Machine Learning. I want to provide simple answer:

    Learning with teacher: questions and answers.

    Learning with teacher: just questions

    Partial learning: questions, and some of them with answers

    Active learning: at which object you'll get an answer

    I suppose maybe some variations of this also exists, but as usually ML in one or another way manipulates with those four. 

    Consider example of clusterization. You have some data set of values. And you need somehow to group them or in other words find groups of similar objects. This task has two problems: nobody know … more

  • Unit test Acumatica PXGraph

    Hello everybody,

    today I want to make another description of how to cover with Unit Tests Graphs in Acumatica. 

    First of all I want to say that Acumatica controllers or as Acumatica names them graphs do not have any way to inject any dependency from interface. In such case it can be useful idea to use Microsoft Fakes library. 

    So in order to unit test Acumatica code you will have a need to make mix of Acumatica code with Microsoft shims. Imagine that you have following graph declaration:

    public class PAllocs : PXGraph<PaymentsAllocation>

    and somewhere in your graph you have method like this:

    [PXButton(Tooltip = "Saves values from grid")]

            [PXUIField(DisplayName = "Save" … more

  • Stubs vs Shims difference

    Hello everybody,

    today I want to mention difference between two kinds of testing. Shim vs Stub. 

    Take a look at the following code sample:

    // Stub sample

    public interface IDependency

    {

        void SomeMethod();

    }

    // Take note that class TestTarget allows to inject 

    // interface IDependency

    public class TestTarget

    {

        private IDependency _dependency { get; set; }

        public TestTarget(IDependency dependency)

        {

            _dependency = dependency;

        }

        public void TestMethod()

        {

            _dependency.SomeMethod();

            

        }

    }

    // Shim sample. Take note that class ShimTarget doesn't allow to inject 

    // interface as dependency

    public class Dep :  … more

  • Types of screens in Acumatica

    Hello everybody,

    today  I want to describe one more feature of Acumatica: types of screens in Acumatica. In Acumatica majority of screens are the following:

    Data Entry pages

    Maintenance pages

    Inquiery pages

    Setup pages

    Processing pages

    Reports.

    Now let's talk in more details about those screens:

    Data entry pages

    As usually data entry pages located at following icon in the red rectangle.

    These pages are the most frequently used pages of the Acumatica. Typically, data entry pages are used for the input of business documents, such as sales orders in a distribution module.

    Maintenance pages

    As usually maintenance pages located at following icon in the red rectangle. … more

  • Types of controls in Acumatica

    Hello everybody,

    today I want to describe with some screenshots kind of controls that you can get from Acumatica developer like me or any other Acumatica programmer.

    Main purpose of this blog post is the following. Imagine, that you want to write super detailed instructions for Acumatica developers. After reading this article I suppose you'll be able to write instructions to them with any kind of detalization. Or even super detailed.

    First of all, I want to point that as usually Acumatica pages consists of two parts: top and bottom. Top part often is named summary, and bottom is considered to be detalization of top. Take a look at following screenshot:

    At presented screeshot red part … more

  • How to override action "Create " at form SO301000 or "Sales orders"

    Hello everybody,

    today I want to document one important piece of functionality in Acumatica. Sales order screen. This is very important screen and has many staff. One of the important screens in it is "Sales orders"  screen. From prospective of understanding Acumatica source code of method "Actions" has plenty of food for mind.

    Take a look at it's declaration:

    public PXAction<SOOrder> action;

    [PXUIField(DisplayName = "Actions", MapEnableRights = PXCacheRights.Select)]

    [PXButton]

    protected virtual IEnumerable Action(PXAdapter adapter,

    [PXInt]

    [PXIntList(new int[] { 1, 2, 3, 4, 5 }, new string[] { "Create Shipment", "Apply Assignment Rules",

                    … more

  • My thoughts after start of first Indiegogo campaign

    Here I want to describe how I felt before starting Indiegogo campaign during it's execution and few minutes after starting Indiegogo campaign.

    Initially I want to describe road map to this campaign. I was and still is a happy person whose main job is integration of different enterprise systems. I like such kind of activities because it helps to speed up life inside of company of any size. Imagine that with help of software inside of some small company ( 30 people ) can save around 5 minutes of time daily. Then in one month this company can save 22 * 5 * 30 = 3300 minutes or 55 working hours. It means faster delivery of product, or faster producing of product or faster salary receive or … more

  • AWS Product categories

    Hello everybody,

    today I want to document few main features of AWS. Below I want to mention AWS Product Categories:

    Compute services. Provide you with virtual machines

    Storage services. Raw block of content.

    Database services. Organized in some way data in organized chunks.

    Networking services. Provide with network assets.

    Messaging services. Communication between systems.

    Content delivery services - cached location for frequently accessed content. 

    Deployment and management - allows to pack, secure, monitor AWS apps.

    Next goes question, how developer can interact with AWS? As always in two ways: visual tools or through API.

    API in turn can be divided into two categories: SOAP/ … more

  • Acumatica DAC class generator

    Hello everyboydy,

    today I want to share with anybody mine implementation of DAC class generator.

    By default Acumatica provides you with DAC class generator which is pretty good.

    But time from the time I had a need to generate DAC class into text field, and then

    put it somewhere in my solution, and Acumatica DAC class generator didn't feet to

    mine needs. So I decided to create my own DAC class generator. 

    This form has simple interface. In the first line you enter Connection string, at second

    line you enter table name, press at generate, and receive DAC class.

    You can download source code here. 

    Below goes also some C# code which I've comment later:

        public  … more

  • How to add sitemap into your customization

    Hello everybody,

    today I want to describe some simple steps of how to add into your customizaiton sitemap. As you already know, sitemap of Acumatica is saved in database. And if you make customization of your sitemap you may need to add to your project.xml something like this:

    <Customization level="0" description="" product-version="5.30">

        <SiteMapNode>

            <data-set>

                <relations version="3" main-table="SiteMap" />

                <layout>

                    <table name="SiteMap" />

                </layout>

                <data>

                    <SiteMap>

    <row Position="72" Title="Warehouse"  Url="~/Frames/Default.aspx"  … more

  • How to make yourself as Administrator in Acumatica with SQL

    Hello everybody,

    today I want to share some piece of SQL code that can help you to add yourself to Administrators group in Acumatica:

    INSERT INTO [dbo].[UsersInRoles]

               ([CompanyID]

             ,[Username]

             ,[Rolename]

             ,[ApplicationName]

             ,[CompanyMask]

             ,[CreatedByID]

             ,[CreatedByScreenID]

             ,[CreatedDateTime]

             ,[LastModifiedByID]

             ,[LastModifiedByScreenID]

             ,[LastModifiedDateTime])

       VALUES

               (2

             ,'yourAccountName'

             ,'Administrator'

             ,'/'

             ,0xAA

             ,'B5344897-037E-4D58-B5C3-1BDFD0F47BF9'

             ,'00000000'

             ,'2010-07-27 17:25:00.000' … more

  • .Net core tag helpers

    Hello everybody,

    today I want to describe some .Net core tag helpers that you can use in order to create your web pages. There are plenty of already implemented tag helpers that can simplify your life as a developer.

    Here is the list of already made:

    Anchor

    Cache

    Distributed

    Environment

    Form

    FormAction

    Img

    Input

    Label

    Link

    Option

    Script

    Select

    TextArea

    ValidationMessage

    ValidationSummary

    It is not a complete list, but I suppose those 16 elements help you to grasp how wide it's functionality.

    Anchor Tag Helper

    Consider following declaration:

    <a asp-controller='Presenter' asp-action='Presentation' asp-route-id=@Model.PresenterID>Presenter ID: @Model.PresenterID</a> … more

  • How to validate input on Insert

    Hello everybody,

    today I want to document small feature in Acumatica which I can call validation of insert. 

    As usually if you need to validate some logic of insertion you can use something like RowXXXXd event. But for simple validations you can use PXUIVerify attribute. Below goes example take from Acumatica itself:

    [PXUIVerify(typeof (Where<LandedCostTran.curyLCAmount, NotEqual<decimal0>>), PXErrorLevel.Error, "The value must be greater than zero", new System.Type[] {}, CheckOnInserted = false)]

    What this command says to you is pretty obvious:

    Verify at ui level ( generate javascript verification code ) that value at LandedCostTran.CuryLCAmount is not equal to zero.  … more

  • Some Elastic search featues

    Hello everybody,

    For few days I've got assigned to work with Elastic search. As faithful to my principles before doing any activity I'd like to familiarize myself with instrument that I had to use. In ordre to use it more effectively.

    So, first of all I want to mention terminology. As a lot of developers I have expereince of working with databases, so I will use analogies from relational db world.

    First of all Kibana has indexes. It has nothing in common with indexes in relational db. Index in terms of relational db would be named database. 

    So each Kibana has one or more indexes ( databases ).

    Each index has one or more types. Types in terms of relational db would be named table.

    In … more

  • How to switch google developer platform to English

    Hello,

    recently I've went into google development platform and faced following issue: 

    all of it's user interface was in Russian. I prefer to see English interface because majority of manuals are written in English, not in Russian. How to switch that language to English? Very simply. Just add to page following line: &hl=en

    For example like this:

    and you'll all set. You'll see everything in english more

  • How to use package manager console for creating migrations

    Hello everybody,

    today I want to describe some basic steps that you can use in order to create and apply migrations to your code.

    So, let's start. 

    Imagine that in your .Net Core project you made some changes and would like them to be created in a form of C# code migration. How to do this in package manager console? Below are steps that I've applied:

    1. add-migration "identity"

    2. update-database

    Enjoy with results. The first command will create for your C# code that will describe which tables need to be created. Second command will execute that C# code and will create on your db them. 

    more

  • How can you explain the role, meaning and substance of ERP in layman's terms?

    Well. It depends from what kind of layman is in front of me. I’ll discuss following layman:

    my mom

    my father

    Some abstract CEO

    Let’s start from my mom. Last time when she asked me what programs I do make I was puzzled. What should I say her? She knows about Android apps, Windows apps and before retirement she used to be train driver. Be she have no idea what is ERP. As you can guess, I can’t say here standard definition of ERP from wikipedia ( actually I can, but it will not add any knowledge to her ). So I started a conversation with her like this ( Y. will stand for me, and M. for my mom ) .

    M. Yuriy, what programs you make?

    Y. ERP systems.

    M. What is this? Is this like my … more

  • How to create plugins that can be loaded/unloaded

    Hello everybody,

    today I want to show sample of code that you can use for your plugins.

    Sometime it can happen that you have some application with it's dlls and you can decide to make ad hoc dlls.

    In order to demonstrate how to do it I prepared following code:

    Create first class library as BaseLib:

    using System;

    namespace BaseClass

    {

        public class BaseClass : MarshalByRefObject

        {

            public virtual bool IsProcessable(string message)

            {

                return true;

            }

            public virtual void Process(string message)

            {

                

            }

        }

    }

    Then create following implementation:

    using System;

    namespace Ext1

    {

        public  … more

  • How to convert excel file to CSV file

    Hello everybody,

    today I want to document a few lines of code which can help to convert excel file to CSV file with help of OLE:

    static void ConvertExcelToCsv(string excelFileName, string csvOutputFileName, int worksheetNumber = 1)

    {

        if (!File.Exists(excelFileName)) throw new FileNotFoundException(excelFileName);

        if (File.Exists(csvOutputFileName)) throw new ArgumentException("File already exists: " + csvOutputFileName);

        var connectionString =

            $"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={excelFileName};Extended Properties=\"Excel 8.0;IMEX=1;HDR=NO\"";

        var oleDbConnection = new OleDbConnection(connectionString);

        // get schema, then data

        var  … more

  • Different types of views

    Hello everybody,

    today I want to write few words about different kinds of Views in .Net core.

    So, if you decide somehow to create new view you can see something like this:

    and now question. What is the difference between MVC View Page, MVC View Layout Page, MVC View Start Page and MVC View Imports page?

    So, if to draw the lines then following can be said. 

    MVC View Page is fitting for displaying different models.

    MVC View Layout Page is inteded as View that has @RenderBody() statement. RenderBody will be placeholder where MVC View Page will be rendered. 

    MVC View Start Page is used as mediator between MVC View Page and MVC View Layout page.

    The last puzzling view is MVC View … more

  • How to check if type in Assembly implements particular Interface

    Hello everybody,

    today I want to give sample of reading available types from dll .net assembly, check if at least one of them implements interface, and if implements then to create instance of that type and return it. 

    So, imagine you have such interface declaration in your code:

    public interface ILogger

        {

            /// <summary>

            /// Convert <see cref="LoggerMessage"/> to string based on the formats specified.

            /// </summary>

            /// <param name="message">The message to be converted.</param>

            /// <returns>Converted <paramref name="message"/>.</returns>

            LoggerMessage Handle(LoggerMessage message);

            bool Handlable(LoggerMessage message); … more

  • Concurent collections of C#

    Hello everybody,

    today I want to write few words about Concurent collections in C#. First of all  I want to point there there are only four of them:

    ConcurrentDictionary

    ConcurrentQueue

    ConcurrentStack

    ConcurrentBag

    BlockingCollection

    Partitioner

    EnumerablePartitionerOptions

    IProducerConsumerCollection

    OrderablePartitioner

    Not very impressive set of collections if to compare with diversity of other collections in .Net.

    Also keep in mind that ConcurrentQueue, ConcurrentStack and ConcurrentBag are not suitable for a lot of purposes. For example those last three do not allow direct access to any element in the collection which makes them unfitting for many goals. In practical … more

  • Features of System.Reflection

    Hello everybody,

    today I want to document few features of System.Reflection namespace.

    It has following important types:

    Type ( with methods GetType, GetMemberInfo, GetPropertyInfo, GetFieldInfo ), Activator ( with method CreateInstance ), Assembly ( Load, LoadFrom, GetTypes, GetName, GetFiles ), ILGenerator ( Emit ).

    Some code fragments for reflection

    var lst = new List<double>();

    Type listType = typeof(List<double>);

    Type[] pars = {typeof(double)};

    MethodInfo addMeth = listType.GetMethod("Add", pars);

    addMethod.Invoke(lst, new object[] {8.3});

    Create an isntace of type:

    public static Type GetType(string typeName)

    public static object CreateInstance(Type type)

    How to work with … more

  • New feature of C# that I've discovered

    Hello everybody,

    today I want to describe one new feature of C# that I discovered today. At MSDN it is named Type pattern. It looks like this:

    expr is type varname

    such code gives you to shorter your code.

    Take a look at the following code:

    using System;

    public class Student : IComparable

    {

    public String Course { get; set; }

    public int Id { get; set; }

    public int CompareTo(Object o)

    {

    if (o is Student)

    {

    e = o as Student; if(e == null) { throw new ArgumentException("some explanatory error message"); } return Course.CompareTo(e.Course);

    }

    throw … more

  • EMA in jForex. Full code

    Hello everybody,

    recently one of my readers asked me to show whole code of taking value of ema.

    Here it is:

    package jforex;

    import java.util.*;

    import com.dukascopy.api.*;

    public class CountSamples implements IStrategy {

    private IEngine engine;

    private IConsole console;

    private IHistory history;

    private IContext context;

    private IIndicators indicators;

    private IUserInterface userInterface;

    public void onStart(IContext context) throws JFException {

    this.engine = context.getEngine();

    this.console = context.getConsole();

    this.history = context.getHistory();

    this.context = context;

    this.indicators = context.getIndicators();

    this.userInterface = … more

  • How to make sales

    Recently friend of mine shared with me how he makes sales. 

    Here is his algorithm:

    Introduce to your potential customer ( linkedin, facebook )

    Send useful advices

    Send 3 useful advices according to your topic of activity

    Call to him. It shouldn't be call for sales. Just clarify what questions he has or which tasks he tries to solve

    Send sample of project

    Send useful advises

    Propose for him diagnostics and solution of most prioritized task

    Invite him on master class or webinar

    Sned him link on article in your blog

    Tell him about your services

    Send him useful advices

    Send him sample of project or feedback from customer

    more

  • Interception

    Hello everybody,

    today I want to write few words about Interception.

    First of all one of the questions that requires consideration can be why we may need interception at all? Need in interception arises in cases when we have some kind of logic, that is dispersed around whole application. Some candidates for interception can be:

    Logging

    Authorization

    Validation

    Exception handling

    Caching

    Performance collecting and analysis

    etc.... . So, after knowing at which places interception can be used following statement can be considered as explanation: interception is inserting code between calling code and target object. Code can be inserted before or after method call. If code is … more

  • shfbproj file format for Visual Studio 2015

    Hello everybody,

    today I'd like to say few words about project file of format shfbproj.

    Recently at one project I had to face following error message:

    Overview

    ProjectPathErrorsWarningsMessages

    Documentation

    Source\Documentation.shfbproj

    1

    0

    0

    ConveyorSubsystem.Documentation

    Source\ConveyorSubsystem.Documentation.shfbproj

    1

    0

    0

    PISubsystem.Documentation

    Source\PISubsystem.Documentation.shfbproj

    1

    0

    0

    SSubsystem.Documentation

    Source\SSubsystem.Documentation.shfbproj

    1

    0

    0

    Subsystem.Documentation

    Source\Subsystem.Documentation.shfbproj

    1

    0

    0

    So, I started to dig about it. 

    After some research I found that shfbproj stands for … more

  • How to install latest nuget in Dockerfile for windows

    Hello everybody,

    today I want to write few words about how to instal latest Nuget into Windows docker container. For this purpose you can use following commands:

    RUN mkdir c:\NugetRUN Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe' -OutFile 'c:\Nuget\nuget.exe'; \ $env:PATH = $env:PATH + 'c:\Nuget\;c:\Nuget'; \ Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH more

  • How to find file with powershell

    Hello everybody,

    today I want to document one simple trick. Recently I've configured docker container and faced following issue with nuget.

    For nuget I've used following command from powershell:

    nuget install MSBuildTasks -Version 1.4.0.65

    Nuget installed MSBuildTasks, and I didn't know where exactly nuget placed file MSBuild.Community.Tasks.Targets. So, I needed to find it. With help of following command:

    Get-ChildItem -Path C:\ -Filter MSBuild.Community.Tasks.Targets -Recurse

    I was able to execute search on the whole drive C for the file MSBuild.Community.Tasks.Targets and successfully find where Nuget placed that file. more

  • How to get response from Walmart

    Hello everybody,

    today I want to share with the world another piece of code, producing of which took me significant amount of efforts, getting response from Walmart.

    Yesterday I've posted code that signs provided by Walmart credentials.

    And today I decided to post code that retrieves orders information from Walmart.

    private void MakeRequests()

    {

    HttpWebResponse response;

    if (Request_marketplace_walmartapis_com(out response))

    {

    response.Close();

    }

    }

    private bool Request_marketplace_walmartapis_com(out HttpWebResponse response)

    {

    response = null;

    try

    {

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https:// … more

  • Walmart signer

    Hello everybody,

    today I want to preserve at my blog piece of code that almost eaten my brain. Walmart signer. 

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Linq;

    using System.Text;

    using System.Threading.Tasks;

    using System.Globalization;

    using Org.BouncyCastle.Crypto.Parameters;

    using Org.BouncyCastle.Security;

    namespace Walmart

    {

    public class WallmartSigner

    {

    /// <summary>

    /// Begining of time according to Java world.

    /// </summary>

    private static readonly DateTime JanuaryFirst1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

    /// <summary>

    /// … more

  • How to measure size of Vector

    Hello everybody,

    today  I want to share with everybody information about function that is known as norm. Here it is:

    ||x|| p = ( Σ(|x|i)p) p -1

    For p ∈ R, p ≥ 1

    Also it is named as Lp norm. On intuition level it measures distance from some beginning point to locatio of x.

    L2 norm is often named Euclidian norm. Also due to heavy usage L2  is presented just as ||x|| with skipped 2. It means that if you see ||x|| it was intended to show you ||x||2.

    Sometime you can find L∞ norm. It is nothing more then maximum value of vector. 

    ||x||∞= maxi|xi|.

    more

  • How to execute bash docker image of Cent OS

    Hello,

    recently I had a need to execute CentOS image with bash. Following command proved helpful for me:

    docker run -i -t --rm centos /bin/bash

    Then at executed image you can do whatever you want. For example I had  a need to validate DNS server activity. 

    For this purpose I had to find what provides dig.

    Following command told me what:

    yum whatprovides dig

    And next command installed:

    yum install bind-utils more

  • How to redirect from port 80 on port 9000 with nginx

    Hello everybody,

    today I want to share with you how to make redirects with help of nginx. 

    I have executed docker image of portainer in my linux environment on port 9000. 

    And I need to make nginx to redirect incoming trafic from port 80 on port 9000. In order to achieve it I've made the following modifications in nginx.conf:

                   

    server {                listen 80 default_server;                listen [::]:80 default_server;                server_name _;                root /usr/share/nginx/html;

                   # Load configuration files for the default server block.                include /etc/nginx/default.d/*.conf;

                   location / {                              … more

  • Bind9 in CentOS

    Hello everybody,

    recently I've got a task to configure Bind9 on CentOS.

    While doing this I have found some hardly documented features of CentOS.

    File locations and defaults

    By default bind9 is has name named. It means that you can start it with command systemctl. For example you can get status of bind with this command:

    systemctl status named

    Information about zones are stored in zone files. By default named stroes zone files at /var/named/.

    Infromation about bind itself is stored at /etc/named* location.

    Following command tells us something more about those files:

     ls -ld /var/named

    drwxr-x--- 5 root named 127 May 17 17:25 /var/named

    It says that access to those files has two … more

  • Content of ping command according to Wireshark

    Hello everybody,

    today I want to share few words about usage of Wireshark and what it discovers about ping.

    As usually everyboydy who want to check does he have internet connection tries to enter command prompt and ping some web site. If ping is successful then person believes he has internet connection. If ping is not successful, it means that internet connection is somehow invalid. 

    But have you ever wondered what ping sends?

    Wireshark will help to get an answer!

    First step will be to open Wireshark, and type there in line for filters ICMP ( which stands for internet control messaging protocol )

    Second step will be to generate some kind of ping trafic. You can open command prompt … more

  • How to execute some process in Dockerfile

    Hello everybody,

    today I want to share another piece of code, that proved to be helpful for me in creating docker containers.

    Here it is:

    Start-Process c:\sdksetup.exe -ArgumentList '/Quiet /NoRestart' -Wait; \

    First time when I seen it I was sceptical. Why I should use Start-Process instead of just running application? The answer is simple: because quite often installers just execute some processes and give control to powershell in asyncronous way. And if other parts of your docker image are dependable from your sdksetup.exe, then you'll not get needed container.

    For example you can install Dot net 4.6.2 package in the following way:

    RUN Invoke-WebRequest 'https://download.microsoft. … more

  • One more example of selectors

    Hello everybody,

    today I want to present one more example of selectors, but the one, that has multiple fields in it. 

    Consider following code:

    using System;

    using System.Collections;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using System.Threading.Tasks;

    using PX.Data;

    using PX.Objects.CS;

    using PX.Objects.CT;

    using PX.Objects.DR;

    namespace MyBlog

    {

    public class DeliverySelectorAttribute : PXCustomSelectorAttribute

    {

    public DeliverySelectorAttribute(Type selectorField, params System.Type[] fieldList)

    : base(selectorField, fieldList)

    {

    }

    public override void FieldVerifying(PXCache … more

  • How to copy Folder in Dockerfile

    Hello everybody,

    recently I had following issue:

    copy folder dotnet-dev-win-x64.1.0.1 into c:\Program Files\Dotnet in container. After different dancing and triings I've found following command that worked:

    COPY ["dotnet-dev-win-x64.1.0.1", "c:/Program Files/dotnet"] more

  • How pageSource in Acumatica works

    Hello everybody,

    recently I was asked by one friends of mine, how pageSource in Acumatica works, i.e. how to code/decode pagesource contents. 

    After different methods of trial and error I've created following C# code in order to code/decode pageSource:

    Snippet

    private static string Compress(string src)

            {

                if (src.IsNullOrEmpty())

                {

                    return null;

                }

                byte[] bytes = Encoding.UTF8.GetBytes(src);

                using (MemoryStream stream = new MemoryStream())

                {

                    using (DeflateStream stream2 = new DeflateStream(stream, CompressionMode.Compress))

                    {

                        stream2. … more

  • Working with Nuget in Visual Studio 2015

    Hello everybody,

    today I want to describe some useful from my prospective commands for working with Nuget.

    First of all, I want to say that you can work with Nuget as usually with usage of wizard, but if wizard fails for some unknown reason, console can give you interesting facts, that otherwise will be hidden from your eyes. 

    First step is how to find Nuget manager console?

    You can use top right edit for opening nuget manager console, as shown at screenshot:

    After console window is opened, you can try following combinations.

    Get-Package -ListAvailable EntityFramework - search in all sources for library named Entity framework

    In newer version of nuget ( 3.0 + ) you can use Find- … more

  • How to add to docker image dot net sdk and other useful staff

    Hello everybody,

    today I want to write few rakes of Dockerfile.

    First of all I want to document how to install dot net sdk 1.1. It isn't installable by chocolatey, so I had to use following workaround:

    RUN Invoke-WebRequest 'https://download.microsoft.com/download/1/1/4/114223DE-0AD6-4B8A-A8FB-164E5862AF6E/dotnet-dev-win-x64.1.0.3.exe' -OutFile dotnetDev.exeRUN .\dotnetDev.exe /Silent /Full

    Another issue, that I faced was installing of Git, or for containers I prefer MinGit. It can be achieved in the following way:

    RUN Invoke-WebRequest 'https://github.com/git-for-windows/git/releases/download/v2.12.2.windows.2/MinGit-2.12.2.2-64-bit.zip' -OutFile MinGit.zip

    RUN Expand-Archive c:\ … more

  • Virtual machine management service

    If you see following error message:

    Virtual machine management service is running and that you are authorized to connect to the server.

    You need to check "Hyper-V Virtual Machine Management" and start it up. more

  • How to make grid to locate all available space

    Hello everybody,

    toda I want to document one simple how-to issue. Recently I've spent some time in figuring how to make grid to locate all available space.

    Below goes how to make it:

    <AutoSize Container="Window" Enabled="True" MinHeight="400" />

    You can add it somewhere before end of px:PXGrid tag. For example like this:

          <AutoSize Container="Window" Enabled="True" MinHeight="400" /> </px:PXGrid>

    more

  • Working with Dockerfile

    Hello everybody,

    today I want to write a few words about Dockerfile. 

    So, as usually for developer it will not be enough just ordinary docker images. Quite often they need to add some more features to docker images. One of the useful ways to organize it can be creating Dockerfile. 

    Dockerfile in itself just a text file with instructions. Of course that instructions are docker specific. And it's similar to making program say in C#. While after C# program I need to execute compiler, with Dockerfile I need to execute command docker build. You can consider docker build as compiler from Docker. 

    Executed image is a container. 

    Dockerfile has build instructions. 

    Some docker instructions … more

  • How to analyze condition of your docker under windows

    Hello everybody,

    today I want to share one more piece of search, which I've found today.

    My current situation with docker is the following: it refuses to be executed.

    In order to see, why, following command can be used:

    wget https://github.com/Microsoft/Virtualization-Documentation/raw/master/windows-server-container-tools/Debug-ContainerHost/Debug-ContainerHost.ps1 -UseBasicParsin | iex

    This command gave me following output:

    Describing Windows Version and Prerequisites [+] Is Windows 10 Anniversary Update or Windows Server 2016 86ms [+] Has KB3192366, KB3194496, or later installed if running Windows build 14393 17ms [+] Is not a build with blocking issues 16ms [+] Has 'Containers' … more

  • WCF RabbitMQ binding

    Hello everybody,

    recently I've spent plenty of time with the following task: Create Publisher/Subscriber application that via WCF send/receive messages from RabbitMQ. As foundation for my code I've used code from Dieg web site, just modified binding.

    Bindings were modified in App.config files. 

    Below goes bindings declarations:

    <system.serviceModel>

    <extensions>

    <bindingExtensions>

    <add name="rabbitMQBinding"

    type="RabbitMQ.ServiceModel.RabbitMQBindingSection, RabbitMQ.ServiceModel, Version=3.5.7.0, Culture=neutral,PublicKeyToken=null"/>

    </bindingExtensions>

    </extensions>

    <client>

    <endpoint address="soap.amq:///myqueue" … more

  • Some notes about MSMQ

    Hello everybody,

    today I want to document few features of MSMQ.

    First of all I want to say that MSMQ is ancient technology. It started it's life from Windows 95 as windows service. So for time of writing of this blog post it already had 22 years! 

    General principle of working of MSMQ is save - forward activity. Store message, forward it to something. By default MSMQ is stored in memory. But you can also store it on disk.

    There are two kinds of Queues in MSMQ : public and private. 

    Public has following features:

    Active directory is used for publishing

    Clients can ask Active Directory for search, manipulate, send messages

    Integrated with windows security

    Private has following … more

  • How to configure WCF for MSMQ

    Hello everybody,

    today I want to document how to configure WCF for usage with MSMQ.

    Of course I suppose you know how to add in windows features MSMQ at each instance where WCF service will work.

    So, first of all, let's see how to configure basic interface:

    [ServiceContract(SessionMode = SessionMode.Required)]

    public interface IService1

    {

    [OperationContract(IsOneWay = true)]

    void GetData(int value);

    [OperationContract(IsOneWay = true)]

    void GetDataUsingDataContract(CompositeType composite);

    // TODO: Add your service operations here

    }

    Take not on two features of each method: 

    Each method has IsOneWay set to true in … more

  • Subtle difference between Html.TextAreaFor and Html.EditorFor

    Hello everybody,

    today I want to document one gotcha related to difference between Html.TextAreaFor and Html.EditorFor.

    Recently I've had a requirement to add hint text to text fields. In Html world there are two ways to create input field which accepts text: <input type="text" /> and <textarea>some text </textarea>. In MVC world you can create those tags with help of Html.TextAreaFor and Html.EditorFor.

    I've had challenges with trying to apply attribute placeholder to TextAreaFor. EditorFor was pretty simplte to google and find:

    @Html.EditorFor(model => model.YourName, new { htmlAttributes = new { @class = "form-control", placeholder="Your name" } })

    But finally after a research I've … more

  • How to manage docker from C# with SSH

    Hello everybody,

    today I want to write a few words about how to work with Docker with help of C#.

    Recently I've got a challenge to find the way how to manage Docker. Initially I've tried Docker.Dotnet library. It has quite interesting options for management of docker, but from my own prospective it's not very convenient for management.  After some trial/error efforts I've decided to try another option. I tried using SSH connection in order to manage linux instance with Docker. In order to have access to CentOs I've used SSH.Net.

    In order to have option for mocking of SSH I've created following interface:

    public interface ISshManager

    {

    string IpHost { get; set; } … more

  • How to add redirect to grid in Acumatica

    Hello everybody,

    today I want to write a few words on how to add links to some entites in Acumatica.

    So, recently I've had an assignment to add redirect into existing grid, so intead of showing some text show nice link which will lead to Purchase order.

    Here is what I've done in order to achieve it.

    First of all I've noticed, what is primary DAC class in graph. It was VendFilt. 

    Then following steps were needed:

    create code for button:

    Snippet

    public PXAction<VendFilt> gotoPOOrder;

    [PXButton(Tooltip = "Open Purchase order")]

    [PXUIField(DisplayName = "Open PO")]

    public virtual void GotoPOOrder()

    {

        var poOrdEntryGraph = PXGraph.CreateInstance<POOrderEntry>();

        var  … more

  • Usage of openssl

    Hello everybody,

    today I want to note just short usage of openssl command:

    openssl req -nodes -days 10 -newkey rsa:2048 -keyout keyfile.pem -out certfile.pem

    this command will generate two files: keyfile.pem and certfile.pem. more

  • How to build private docker registry

    Hello everybody,

    today I want to describe to ways of how private registry of docker can be used and created. Before I'll go in details of it's creation I want to point what is purpose of docker registry in itself. Imagine that you spent a lot of time and money in order to create your own docker image. And for some reasons you don't want to share it with whole world, just with your own customer. What you can do? You have two options:

    Use private docker registry

    Create your own docker registry

    I will omit how to use 1 for now and will go directly to point 2. 

    There are two ways how to create local docker registry:

    Direct installation

    Registry image

    Before you continue to any … more

  • How to open specific port in Cent OS permanently

    Hello everybody,

    today I want to document how to permanently open port in CentOS linux permanently. You can achieve it with following command:

    firewall-cmd --zone=public --add-port=22/tcp --permanent

    or with usage of iptables:

    iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT

    Key --permanent ensures that port will remain working after the reboot. more

  • ngrok and it's usage

    Hello everybody,

    today I want to say a few words about interesting program: ngrok. The main idea of it is to allow other computers to see ports which you've configured in your virtual box machine. And surprisingly it is very cross platform. Take note of the list of platforms at download page: Mac OS X 64-Bit, Windows 64-Bit, Linux 64-Bit, Linux ARM, FreeBSD 64-Bit. more

  • Stop and clean all docker containers in ubuntu

    Hi,

    just small note on topic how to remove and delete all docker containers in ubuntu:

    sudo docker stop $(sudo docker ps -a -q)

    sudo docker rm $(sudo docker ps -a -q) more

  • PXSplitter basic template for autosize grid in Acumatica

    Hello everybody,

    today I want to write a few words about UI in Acumatica and if to be more precise about combination of splitter with other UI controls.

    As you maybe know, in order to allow user to modify height of input control, splitter conrol should be used.

    For now I found following configuration of splitter useful: 

    Snippet

    <px:PXSplitContainer runat="server" ID="PXSplitContainer" Height="100%" Width="100%" Panel1MinSize="120" Panel2MinSize="120" 

        SplitterPosition="210" Size="3" SkinID="Transparent" Orientation="Horizontal">

        <AutoSize Enabled="true" Container="Window" MinHeight="300" MinWidth="100" />

        <ContentLayout AutoSizeControls="True" Orientation="Horizontal" /> … more

  • How to enable ports for Docker swarm in ubuntu

    Hello everybody,

    today I want to document how to enable ports for dokcer swarm in ubuntu:

    sudo ufw enablesudo ufw allow 2377/tcpsudo ufw allow 7946/tcpsudo ufw allow 7946/udpsudo ufw allow 4789/tcpsudo ufw verbose more

  • Install shipyard with curl

    Hello everybody,

    today in order to preserve shortcut for shipyard installation I've decided to preserve it's shortcut in my blog.

    curl -sSL https://shipyard-project.com/deploy | bash -s

    this will install shipyard at your centOS machine. User name will be admin, password: shipyard. more

  • Two kinds of buttons in Acumatica

    Hello everybody,

    today I want to write a few words about two types of buttons in Acumatica.

    usual form of declaration

    unusual form of declaration

    What is difference from code prospecitve?

    In the begining they are equal:

    public PXAction<Shipment> CancelShipment; 

    Even very similar with attributes:

    1. 

             [PXButton(CommitChanges = true)]

             [PXUIField(DisplayName = "Cancel Shipment")] 

    2. 

            [PXButton]

            [PXUIField(DisplayName = "Release")] 

    But different with declaration:

    protected virtual void cancelShipment() 

    protected virtual IEnumerable release(PXAdapter adapter) 

    and different with last statement. Those with PXAdaapter should return … more

  • How to start with Acumatica development

    Hello everybody,

    this post is intended for those people who want to make development for Acumatica, but don't know where to start or how to start. Or for those, who know C#, but absolutely can't figure out how to work with Acumatica.

    So, first of all, I'll describe some general ideas, and then provide few examples of how development for Acumatica is done.

    Acumatica has the following development or extension schema.

    Acumtica is installed on some IIS server. Further in this document I'll name it production instance or production.

    Developer installs Acumatica on hiw working computer with IIS. Without IIS development for Acumatica will not be possible

    Developer creates his extensions … more

  • Three grids in Acumatica

     Recently I've posted following question on stackoverflow:

    I have following request from my customer to be implemented in Acumatica:

    Create form which have input fields on top.

    Form should have first grid, which reacts on parameters on top

    Form should have second grid, which reacts on top parameters and grid 1.

    Form should have third grid, which reacts on top parameters and grid 1 and 2. Acumatica has following master templates: Form2Detail.master, FormDetail.master, FormTab.master, FormView.master, ListView.master, TabDetail.master, Workspace.master. But there is nothing like Form3Detail.master. Also three grids are not available in T200, T300 manuals of Acumatica. So, my … more

  • Customization internals Part 2

    Hello everybody,

    today I want to continue few more details about customization internals. In one of my long time ago posts I've described how to create customization file by yourself without Acumatica engine. 

    Today I want a bit extend my comment with few more details.

    Quite often it is needed to add sql code to your customization. How to do it? Acumatica customizations allows it with usage of projext.xml file. 

    Take a loot at following example:

    <Customization level="0" description=""> <File AppRelativePath="Bin\Blablabla.Acumatica.dll" FileID="d701b330-7c72-4f51-b1ae-75c4e2c02194" /> <File AppRelativePath="Pages\AP\AP306010.aspx" FileID="b9e88968-7f36-4cfc-9383-caed8363c269" /> < … more

  • How to show smart tag in visual studio 2015 for data source in Acumatica

    Hello everybody,

    today I want to share simple trick of how to show smart tag at DataSource control in Acumatica. Recently I had to generate class, and for my disappointment I wasn't able to get window that can generate class for me. So, in order to get that window, following steps are needed:

    1. Go to design mode

    2. In properties window select ds

    3. Press Show Smart Tag keyboard combination - [Shift]+[Alt]+[F10]

    4. Choose anything what you need.

    more

  • Enable disable features disappeared from acumatica

    Hello everybody,

    today I want to write a few notes about difference between Acumatica instance created with "Acumatica Framework Configuration Wizard" and "Acumatica ERP Configuration Wizard". If to summarize there are plenty of differences, but one of the biggest is availabilty of "Enable/Disable features" in Acumatica. Take a note of screenshot:

    Following screenshot was taken from Acumatica instance which was created with  Acumatica Framework Configuration Wizard.

    Compare it with screenshot of Acumatica that taken from instance created with "Acumatica ERP Configuration Wizard":

    so, in case if you need deep access to modules configuration then "Acumatica ERP Configuration … more

  • PXFilter set up fields only once

    Hello everybody,

    today I want to document in my blog interesting behavior of PXFilter in Acumatica. 

    First of all, few words about it's behavior. If Acumatica sees PXFilter, it will create single record, which will remain only in cache and never will travel to the db. Recently I faced interesting issue, fields from PXFilter DAC object was updated only once. After deep investigation I've found that it is because anything that works with PXFilter shouldn't have any field marked as IsKey. If field is marked as IsKey, it will not be updated after each modification of UI. more

  • Create new column if it doesn't exist

    Hello everybody,

    today I just want to preserve simple sql which creates column, if it is not created yet in ms sql db. Important feature of this code is indempotency.

    IF Col_length('APPayment', 'usrPOSkipped') IS NULL   BEGIN       PRINT '[usrPOAllocated] will be created'       ALTER TABLE appayment         ADD usrposkipped BIT   END ELSE   BEGIN       PRINT '[usrPOAllocated] already exists'   END 

    Few explanations. This code will create column usrPOSkipped in table APPayment. more

  • Execute command on Linux start up ( reboot )

    Hello everybody,

    recently I had a need to configure CentOS edition of Linux.

    One of the tasks that I need to accomplish after each CentOS reboot is turning of ip receival. This can be done with the following command:

    dhclient. 

    Another part that I also needed was starting up of docker daemon. Docker daemon can be started in the following way:

    After repeating it more then three times I've decided to ask CentOS to execute it instead of me. This can be done in the following way:

    vim /etc/rc.d/rc.local

    sudo dhclient

    sudo systemctl start docker

    execute chmod +x /etc/rc.d/rc.local

    So, in case if you need to run something on start of system, then you know where to move. more

  • Mesos terminology

    Hello everybody,

    today I want to share few words of my knowledge related to mesos and mesosphere.

    Recently I've subscribed myself for making investigation for mesosphere. And quite often I was asked by my project manager what is difference between mesos and mesosphere. For now I've found that mainly difference lies in fact that mesosphere is built on mesos. According to this interview Matt Trifio which is Mesosphere SVP of Marketing says that Mesosphere is built above mesos. I like his analogy, that in the same way as Android is built on Linux, in similar way Mesosphere is built on Mesos. 

    Next part which was confusing for me what is Framework? Framework has many meanings. I was … more

  • HTTP status codes

    Hello everybody,

    today I want to write a few words about http status codes which some kind are common among developers for web api clients.

    So,

    For POST request following are common to return: 201 ( item was created ), 400 ( bad request ), 500 ( internal server error )

    For GET: 200 ( ok ), 404 ( not found ), 400, 500.

    For DELETE: 200 ( delete was successful ), 404 ( not found ), 400, 500

    PUT: 200, 404, 400, 500

    PATCH: 200, 404, 400, 500.

    Also ther are general codes:

    401 - not authorized,

    403 - forbidden

    405 - method not allowed.

    more

  • Container orchestration with Kubernetes, Docker Swarm and Mesos-marathon

    Hello everybody,

    today I want to leave few notes about following video: https://www.youtube.com/watch?v=_uw1ISM_uRU which is done by Adrian Mouat.

    First of all, what is orchestration definition: "The planing  or coordination of the elements of a situation to produce a desired effect, especially surreptitiously". 

    So, what are elements in Kubernetes, Docker Swarm and Mesos maraphon?

    Containers

    Hosts

    Networking

    What are desired effects? Here they are:

    Running application

    Automatically scale

    Fault tolerant

    Node failover, node rebalancing, health checks

    Efficient use of resources

    Require little of manual intervention

    Swarm and compose

    Docker official solution

    Uses … more

  • Windows container types in docker

    Hello everybody,

    today I want to write a few words about two types of containers in windows:

    Windows server containers

    Hyper-V containers

    Windows server containers provide application isolation through process and namespace isolation. Windows server container shares a kernel with the container host and all containres running on the host.

    Hyper-V containers expand on the isolation provided by Windows server containers by running each container in a highly optimized virtual machine. In this configuration kernel of the container host is not shared with other Hyper-V containers.

    more

  • Some notes on usage of docker

    Hello everybody,

    today I want to write a few words about usage of docker for windows.

    First of all, I want to point what is docker at all. There are many ideas of how to explain it, but in my opinion docker is like installed and configured piece of software with needed fragment of operating system. It can be installed software with windows or with Linux fragment. What is also interesting is that Windows 10 with docker for windows knows how to execute Linux docker containers. So it means that from inside of windows you can have nginx Linux server.

    As you can see from my screenshot, docker for windows installed MobyLinuxVM and if there is a need to execute docker contaner for Linux, it … more

  • TypeScript class creation

    Hello everybody,

    today I want to document some demos for class declaration in Angular 2. 

    So, let's say you have following class declared:

    Snippet

    import { Component, Injectable } from '@angular/core'

    import { Http, Response } from '@angular/http'

    @Component({

    })

    export class Config {

        public apiKey: string = 'xxxxxyy117c24d8b9085187163f5d241';

        public url: string = 'https://public-api.blablacar.com/api/v2/trips?key=';

        constructor(private http: Http) {

        }

        getReqUrl(): string{

            return this.url + this.apiKey;

        }

    }

    Then the way to create it is the following:

    Snippet

    findTrips()

    {

        let conf = new Config();

        let url: string  … more

  • Angular 2 property binding

    Hello everybody,

    today I want to write few words about binding in AngularJS 2.

    There are two ways of making one way binding:

    element property binded to template expression

    property interpolation

    I've described it with following picture:

    Two-way Binding

    <input [(ngModel)]='property'>

    And property is decalred in Component class like this:

    export class ClassComponent {

           property: string = "Property value";

    } more

  • Ionic2 running apps

    Hello everybody,

    today I want to document few usefull commands which are usefull in ionic 2.

    Add platform:

    If you need your app to be able to execute on some platform you can use following command:

    ionic platform add xxx

    Where xxx stands for name of platform. It can have following values: windows, android, ios

    Run app

    If you want to run app in emulator, use the following command:

    ionic serve

    this command will execute your app in default browser.

    ionic run android 

    this command will deploy app on your android device and execute it there

    Add page

    ionic generate page specialPage

    this command will generate for you page specialPage with html, scss and ts file. For example when I … more