mardi 2 janvier 2018

Where and how to perform segues in VIPER architecture?

As a beginner, I used to perform segues in ViewControllers. Moreover, Apple encourages such approach, because UIViewController has methods performSegue and prepareForSegue.

But learning VIPER, I read that Router is responsible for transitions between scenes. And the second thing is that according to VIPER flowcharts like this: VIPER flowchart, Router mustn't be tied with View.

I absolutely don't want to refuse from using segues, because it is extremely powerful and allows me to easily transfer data between ViewControllers.

So, how should I perform transitions between ViewControllers?

How should I remember design patterns?

I have read around 2-3 books on design patterns, but still I don't feel confident in design patterns?

How should I remember design patterns?

Is there any good way to memorize the design patterns?

I know this will come only with experience but there must be some way to master these?

lundi 1 janvier 2018

Searching a pattern in String

I have one string object which contain multiple words. From this String I need to find a 10 values Alpha-Numeric value which is in capital letters.

The pattern can vary like It can be other 10 Values (Which contain any Character and Digit)

EX:

My Name is batman. I am B012HIOL8L.

OutPut: B012HIOL8L

Finding Image string in RTF File

Hi I am trying to extract image string from the RTf file. For example consider following is my the string

My Regex: \bjpgblip(.)(\s.)+}

This expression selects upto last curly braces but i want select to the first curly brace.

wmetafile\jpgblip 000ea080000700e0000a00900 000000000052000000 700100000007c 30cc74d00f0000000000000000000000 000000000000000f 7f0 260000}\par\pard\keepnLay(Material):\par\pard\b0\f1\fs20\tro \wmetafile\jpgblip 000ea080000700e0000a00900 000000000052000000 700100000007c 30cc74d00f0000000000000000000000 000000000000000f 7f0 260000}\par\pard\keepnLay(Material):\par\pard\b0\f1\fs20\tro

I am using C# Programming Language.

Thanks in Advance.

Passing props to higher-order components

Lets say if we have the following HOC:

const myHoc = someProps => ComposedComponent => {
  const propsToPass = { /* ...some calculations... */ }; 
  return <ComposedComponent {...propsToPass} />;
};

How would I pass a prop to ComposedComponent in myHoc outside of myHoc?

Why does android use ContextWrapper?

Why not just let 'Activity' be a subclass of ContextImpl?

What's the benefits of the wrapper pattern here?

Structure of classes

Happy New Year. I would like to know your opinion about this task. My task is to upload zip file from different sources like Local disc, GitHab, GoogleDrive. What source is input parameter.

It is not problem to implement it technicality. But what the best way for structure of classes for this task.

I can proposal this scheme:

public interface IStorage
{
    Task Download();
}


public class LocalDiscStorage : IStorage
{
    public async Task Download(){}
}

public class GithubStorage : IStorage
{
    public async Task Download(){}
}

public class StorageManager
{
    public IStorage CreateStorage(StorageType storageType)
    {

        if (storageType == StorageType.GitHub)
        {
            return new GithubStorage(destinationPath, repositoryName);
        }

        return new LocalDiscStorage(destinationPath, formFile);
    }
}

Сan anyone describe the disadvantages of this scheme ?