Tuesday, December 17, 2019

Security Beware Phishing

I happened to attend Security Hacker Jam session. It was an eye opening session never thought of there are so many things we tend to forget and act unknowingly in a spur of a moment. Digital world and technology has changed lot of things for us whether it is a web cam, an app or any sort of software you use. it is very difficult to assess and certify it is 100% secure. Moment you start using them you might be in risk of security vulnerable.
Having said that Phishing of different kind is taking toll on our personal data and we compromise so many things in the process.


  • Never act under pressure, take 3 sec to think if you have to act. For example you're in a meeting and you got an email, you see some urgency to reply and it happened that you acted upon an urgency to get rid off one of your task perhaps you have risk the data. You have opened up spam email thar resulted in breach in security.
  • Never leave your system unattended someone can use Rubber Ducky USB to get access to your sensitive data.
  • Never ever use lost USB , it might be left for purpose so that you can use them and it just do its magic
  • Phishing scams are the most common way for criminals to steal information, take control of a network or cause harm to organisations or individuals.
  • They use ‘bait’ to have you click on a link, download an attachment or perform an action. 
  • The objective is to get users to provide personal or account information, or to make wire transfer funds to fraudulent accounts.

Type of Phishing

  1. Smishing - Doggie Links through SMS
  2. Vishing - Voice +phishing- Through call
  3. Spear Phishing- sending emails to millions of unknown users
  4. Whaling- Whaling is not very different from spear phishing, but the targeted group becomes more specific and confined in this type of phishing attack.This technique targets C-suite posts like CEO, CFO, COO – or any other senior management positions – who are considered to be big players in the information chain of any organization, commonly known as “whales” in phishing terms.

Best practice to act on email

  1. Don't trust the display name. 
  2. Does it sound too good  to be true? 
  3. Think before you click. 
  4. Check for spelling errors. 
  5. Beware of urgency. Asking for personal information. 
  6. Check the email signature. 
  7. When in doubt, ask for help. 



Thursday, November 21, 2019

AI for For the Blind and Visually Impaired

I'm not sure if there is any device or product around that just replaces human eye with digital smart camera. What I mean is Smart Eye Device can do?

Wearable Smart Eye Device WSED Features:


  • Identity obstacles , identify people around while walking. 
  • Look for traffic light  any object to assist visually challenged person to move around with ease like normal eye can. Assistive and adaptive vision to make a clear mapping of path for visually challenged. 360 eye vision smart device for safety.
  •  Read image, text and recognize any people and object. Just like any eye.
Just imagine if automated car can  manoeuvre then on similar line we can think of solution to replace eye with smart eye.

This product is one step forward to achieve one of the above functions what if AI revolutionized and does wonder. 

Not sure if Microsoft HOLO lens 2.0 or vitual reality to Actual reality

Monday, November 18, 2019

My Xamarin Journey So far

Xamarin.forms

  • MVVM
  • Data Binding
  • Resource
  • MainActivity - Icon 
  • Splash Screen On load launcher
  • ResourceDictionary
  • Dynamic vs static Resource
  • Frame
  • Use of Application setting

Controls-Component


  • Listview/Collection View
  • Tab View
  • Carousal
  • Grid View
  • TabbedPage

Explore AdMob

Thursday, October 31, 2019

Web Scrapping


Math: Pascal Triangle unknown facts and mysteries


This may look like a neatly arranged stack of numbers, but it's actually a mathematical treasure trove. Indian mathematicians called it the Staircase of Mount Meru. In Iran, it's the Khayyam Triangle. And in China, it's Yang Hui's Triangle. To much of the Western world, it's known as Pascal's Triangle after French mathematician Blaise Pascal, which seems a bit unfair since he was clearly late to the party, but he still had a lot to contribute. So what is it about this that has so intrigued mathematicians the world over? In short, it's full of patterns and secrets. 

First and foremost, there's the pattern that generates it. Start with one and imagine invisible zeros on either side of it. Add them together in pairs, and you'll generate the next row. Now, do that again and again. Keep going and you'll wind up with something like this, though really Pascal's Triangle goes on infinitely. Now, each row corresponds to what's called the coefficients of a binomial expansion of the form (x+y)^n, where n is the number of the row, and we start counting from zero. So if you make n=2 and expand it, you get (x^2) + 2xy + (y^2). The coefficients, or numbers in front of the variables, are the same as the numbers in that row of Pascal's Triangle. You'll see the same thing with n=3, which expands to this. So the triangle is a quick and easy way to look up all of these coefficients. But there's much more. For example, add up the numbers in each row, and you'll get successive powers of two. Or in a given row, treat each number as part of a decimal expansion. In other words, row two is (1x1) + (2x10) + (1x100). You get 121, which is 11^2. And take a look at what happens when you do the same thing to row six. It adds up to 1,771,561, which is 11^6, and so on. There are also geometric applications. Look at the diagonals. The first two aren't very interesting: all ones, and then the positive integers, also known as natural numbers. But the numbers in the next diagonal are called the triangular numbers because if you take that many dots, you can stack them into equilateral triangles. The next diagonal has the tetrahedral numbers because similarly, you can stack that many spheres into tetrahedra. Or how about this: shade in all of the odd numbers. It doesn't look like much when the triangle's small, but if you add thousands of rows, you get a fractal known as Sierpinski's Triangle. This triangle isn't just a mathematical work of art. It's also quite useful, especially when it comes to probability and calculations in the domain of combinatorics. 

Say you want to have five children, and would like to know the probability of having your dream family of three girls and two boys. In the binomial expansion, that corresponds to girl plus boy to the fifth power. So we look at the row five, where the first number corresponds to five girls, and the last corresponds to five boys. The third number is what we're looking for. Ten out of the sum of all the possibilities in the row. so 10/32, or 31.25%. Or, if you're randomly picking a five-player basketball team out of a group of twelve friends, how many possible groups of five are there? 

In combinatoric terms, this problem would be phrased as twelve choose five, and could be calculated with this formula, or you could just look at the sixth element of row twelve on the triangle and get your answer. The patterns in Pascal's Triangle are a testament to the elegantly interwoven fabric of mathematics. And it's still revealing fresh secrets to this day. For example, mathematicians recently discovered a way to expand it to these kinds of polynomials. What might we find next? Well, that's up to you.

Friday, October 18, 2019

Geogera: Algorithm Bezier Curve Steps



    Bezier Curve
    1 Point A
    2 Point B
    3 Segment a Segment [A, B]
    4 Point C
    5 Segment b Segment [A, C]
    6 Number n
    7 List listAB Sequence[A + i / n (B - A), i, 1, n]
    8 List listAC Sequence[A + i / n (C - A), i, 1, n]
    9 List list3 Sequence[Segment[Element[listAB, i], Element[listAC, n - i]], i, 1, n]
    10 List listBC Sequence[C + i / n (B - C), i, 1, n]
    11 List list5 Sequence[Segment[Element[listAB, i], Element[listBC, n - i]], i, 1, n]
    12 Segment c Segment [C, B]
    13 List listCB Sequence[B + i / n (C - B), i, 1, n]
    14 List list6 Sequence[Segment[Element[listAC, i], Element[listCB, n - i]], i, 1, n]

Geogebra: Divide Cirlce with n parts with polar view


https://www.geogebra.org/graphing/qz9nvmbp

Divide Circle with n parts

 Sequence(Rotate(B, i°, A), i, 0, 360, 360 / n)

Join segments from Center A to n points on circle circumference

 Sequence(Segment(A, l1(n)), n, 0, 100)

Wednesday, October 16, 2019

Coding Standards, Guidelines and Best Practices: Avoid Aysnc Void


Getting Started with Asynchronous Programming in .NET


Use Async Void


Async Void is only appropriate for Event Handler
protected async void search_click( object sender, RouteEventArgs e)
{
     await GetStocks()


Alternate Solution 

private async Task GetStock()
{

}

Take Away:
Async Void crashes an application or may results in 500 exception if something went wrong. As there is no way to propagate exception even you have proper try catch. 

Call GetStock()

private async void GetStock()
{
 try
{}
catch()
}

Monday, October 14, 2019

Geogebra: Circle with Sequence, Dilate and Segment geometry tricks

Learn Geometry 

You can open my geogebra activity and can try similar activity.
Click here


Hint:
Sequence(Dilate(C, i / s, B), i, 1, s)
To divide segment into equal parts with dynamic points in it

Sequence(Segment(G, l5(n)), n, 0, s)
To create dynamic segments 









It makes lot of sense when you.....

It makes lot of sense when you're SEEN, HEARD and VALUED! If that is the case then you're actually part of it or you're acknowledged or you've been respected Otherwise that is not the place you should be.
Just imagine you're in a meeting or discussion, you're seen but not heard if heard not valued that means you're not required.
Now in this case you're part of the team and you're seen but heard perhaps not valued . Your opinion doesn't stands any good. In and all it is very important you should be seen , heard and at the same time valued. That means you're respected and people needs you.
So bottom line is, the only way you should feel you're R equired or C onnected or R espected, it is only through these sense of acknowledgment of being Seen, heard and valued .
Eventually it shapes your whole career path for Being what you'reBelong to place you want to be and Become is the path to your career progression ...you want to be.
If none of these happens then it is a call for ....?

Monday, September 23, 2019

.Net core http pipeline processing Use, Run or Map

Request processing pattern showing a request arriving, processing through three middlewares, and the response leaving the app. Each middleware runs its logic and hands off the request to the next middleware at the next() statement. After the third middleware processes the request, the request passes back through the prior two middlewares in reverse order for additional processing after their next() statements before leaving the app as a response to the client.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseSession(); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); }); }

public void Configure(IApplicationBuilder app) { app.Map("/map1/seg1", HandleMultiSeg); app.Run(async context => { await context.Response.WriteAsync("Hello from non-Map delegate."); }); }

Dependency Injection Overview

Highlevel
  •  Register Services(Collection) in container
  • Define Object lifetime- Transient| Scoped|Singleton
  • Create Instance at run time



Transient

Create instance of an object everytime it is requested

Scoped

Create object and lifetime of an object stays as scope defined

Singleton

Created once for an application level and served single object for all request.

Monday, September 16, 2019

Solr Value cannot be null. Parameter name: fieldNameTranslator

Problem

Server Error in '/' Application.

Value cannot be null.
Parameter name: fieldNameTranslator

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: fieldNameTranslator

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[ArgumentNullException: Value cannot be null.
Parameter name: fieldNameTranslator]
   Sitecore.ContentSearch.Linq.Solr.SolrIndexParameters..ctor(
   Sitecore.ContentSearch.SolrProvider.LinqToSolrIndex`1..ctor
   Sitecore.ContentSearch.SolrProvider.SolrSearchContext.GetQueryable(IExecutionContext[] executionContexts) +229
   Sitecore.ContentSearch.SolrProvider.SolrSearchContext.GetQueryable() +65
   Sitecore.ContentTesting.ContentSearch.TestingSearch.GetAllTests() +132
   Sitecore.ContentTesting.Data.SitecoreContentTestStore.GetAllTestsForItem(DataUri hostItemDataUri, String searchText) +80
   Sitecore.ContentTesting.Pipelines.GetContentEditorWarnings.GetContentTestingWarnings.AddSuspende
   Sitecore.ContentTesting.Pipelines.GetContentEditorWarnings.GetContentTestingWarnings.Process(GetContentEditorWarningsArgs args) +45
   (Object , Object[] ) +56

Bit of a hack!


Temporary Solution
Go to sitecore.contentsearch
EnableSearch=false



Tuesday, September 10, 2019

Types of Cryptograph Algorithms


  1. Symmetry
  2. Asymmetry
  3. Hash function

Symmetry Cryptograph


E.g One time pad/ Caeser Cipher /Enigma Machine they have same key to encrypt and decrypt

Asymmetry Cryptograph 

E.g One time pad/ Caeser Cipher /Enigma Machine they have same key to encrypt and decrypt



Encryption and decryption should follow this mechanism
  • Confusion- Message and Key 
  • Diffusion- Message and Cipher Text
Data Encryption Standard: DES vs AES: Advanced Encryption Standard

AES 256
Provides confusion

Cipher Block Chaining 
Provide Diffusion


Classes Of Cryptographic Hash Functions

There are several different classes of hash functions. Here are some of the most commonly used:
  • Secure Hashing Algorithm (SHA-2 and SHA-3)
  • RACE Integrity Primitives Evaluation Message Digest (RIPEMD)
  • Message Digest Algorithm 5 (MD5)
  • BLAKE2

An Intro To One-Way Hash Functions

Hash functions are often called one-way functions because, according to the properties listed above, they must not be reversible. If an attacker could easily reverse a hash function, it would be totally useless. Therefore, cryptography requires one-way hash functions.
The best way to demonstrate a one-way function is with a simple modular function, also called modular arithmetic or clock arithmetic. Modular functions are mathematical functions that, put simply, produce the remainder of a division problem.
So, for example, 10 mod 3 = 1. This is true because 10 divided by 3 is 3 with a remainder of 1. We ignore the number of times 3 goes into 10 (which is 3 in this case) and the only output is the remainder: 1.
Let’s use the equation X mod 5 = Y as our function. Here’s a table to help get the point across:
cryptographic hash function table
You can probably spot the pattern. There are only five possible outputs for this function. They rotate in this order to infinity.
This is significant because both the hash function and the output can be made public but no one will ever be able to learn your input. As long as you keep the number you chose to use as X a secret, it’s impossible for an attacker to figure it out.
Let’s say that your input is 27. This gives an output of 2. Now, imagine that you announce to the world that you’re using the hash function X mod 5 = Y and that your personal output is 2. Would anyone be able to guess your input?
Obviously not. There are literally an infinite number of possible inputs that you could have used to get a result of 2. For instance, your number could be 7, 52, 3492, or 23390787. Or, it could be any of the other infinite number of possible inputs.
The important point to understand here is that one-way hash functions are just that: one-way. They cannot be reversed.
When these same principles are applied to a much more sophisticated hash function, and much, much bigger numbers, it becomes impossible to determine the inputs. This is what makes a cryptographic hash function so secure and useful.

Regardless of the length of the input, the output will always be the same fixed length and it will always appear completely random. Play around with this tool to see for yourself.

SHA256 Hash of your string:

Custom Iterators


Custom Iterators

By Bill Wagner

In this article, I’ll discuss custom iterators, predicates, and generic methods. You can combine these three techniques to create small building blocks that plug together in a variety of ways to solve everyday development problems.  Once you can recognize when to apply this pattern, you will be able to create a large number of reusable building blocks.
When we build software, we rarely work with one instance of a data type.  Instead, most of our work centers on collections of data: Lists, Arrays, Dictionaries, or other collections. As a result, so much of our code appears in a series of loops:
foreach ( Thing a in someContainer)
    doWorkWith(a);
That’s simple enough, and there’s little point in trying to get more reuse from that simple construct.  But most of our daily work isn’t really that simple. Sometimes the iteration creates a new collection, or a new sequence. Sometimes the iteration should only affect some of the elements in a collection, not all them. Sometimes the iteration will remove some elements from the collection.  With all the different variations, we’re back to copying code and modifying it.  That lowers our productivity. When you create custom iterators and predicates instead of copying and modifying loops, you decouple the common actions from the specific code. And, often, you will use the output from one iteration as the input to another.  By using custom iterators to perform the iteration, you can save memory and increase performance as well.
Let’s start with a simple sample, and modify that code to create a set of reusable custom iterators and predicates. Suppose you’ve been asked to print out a list of people you know from the New York City phone book. It is a contrived problem, but it exhibits the characteristics of many real-world problems. You need to process a large number of objects (the list of all entries in the New York City phonebook). You need to extract a subset of the properties of each object (the first and last names). Finally, you need to filter the input set to generate the output set (only the people you know).  Your first attempt might look like this:

// First attempt:
public List PeopleIKnowInNewYork()
{
    IEnumerable newYorkNumbers =
        PhoneBook.FindListFor(“New York”);

    List peopleIKnow = new List();

    foreach ( PhoneBookEntry ph in newYorkNumbers)
    {
        string name = string.Format(“{0} {1}”, ph.FirstName, ph.LastName);
        if ( RecognizePerson( name ) )
            peopleIKnow.Add(name);
    }

    return peopleIKnow;
}

This code does produce the proper output, but there’s a lot to criticize. You’ve loaded every name in the New York phone book into one list.  That’s very wasteful. Chances are you know a very small percentage of people in New York. It is a big place, after all.  However, by creating a local List of all the people in New York, you prevent the garbage collector from freeing any of those entries until the entire list is processed.  At best, that’s very wasteful. If you don’t require a very large memory configuration, your application probably fails. Also, from a design standpoint, it falls short of expectations.  Chances are that as this imaginary sample application grows, you will get other requests for similar, but not identical, features. For example, you may be asked to find everyone you called in the last six months, and print out the phone number you dialed. Right now, that produces another method that has almost the exact same contents, with one or two changes.
As a first step to creating more usable code, you can create a custom iterator that returns a sequence of names from a sequence of PhoneBookEntries.  That would look like this:

IEnumerable ConvertToNames(IEnumerable list)
{
    foreach ( PhoneBookEntry entry in list)
        yield return string.Format(“{0} {1}”, entry.FirstName, entry.LastName);
}

This additional method changes your PeopleIKnow method to this:

// Second attempt:
public List PeopleIKnowInNewYork()
{
    IEnumerable newYorkNumbers =
        PhoneBook.FindListFor(“New York”);

    List peopleIKnow = new List();

    foreach ( string name in CovertToNames(newYorkNumbers))
    {
        if ( RecognizePerson( name ) )
            peopleIKnow.Add(name);
    }

    return peopleIKnow;
}
It’s a little better. Now, anytime you get a new request that requires you to convert a set of phone entries to a set of strings, you’ve already got the method to do it. One more quick modification to the method saves you a lot of memory.  If you examine the application, you’ll almost certainly find that you never need the full list of names. You really only need to enumerate the list of names.  So, you can try this modification and see if everything still compiles:
public IEnumerable PeopleIKnowInNewYork()
That works, so you can change the PeopleIKnowInNewYork method to a custom enumerator method:
// Third attempt:
public IEnumerable PeopleIKnowInNewYork()
{
    IEnumerable newYorkNumbers =
        PhoneBook.FindListFor(“New York”);

    foreach ( string name in ConvertToNames(newYorkNumbers))
    {
        if ( RecognizePerson( name ) )
            yield return name;
    }
}
Let’s stop a minute and consider what you’ve accomplished, and how you can use these techniques in other use cases and other applications.  For this discussion, let’s assume you’ve changed PhoneBook.FindListFor() to be an enumerator method as well.
You started with a pipeline that looked like this:
  1. Create a list of every phone book entry in the New York phonebook
  2. Examine every entry in that list
  3. Create name from the phone book entry
  4. If the name is recognized, add it to the output list
By changing methods to enumerators, you’ve created a pipeline that looks like this:
  1. Read an entry from the phone book.
  2. Create a name for that entry
  3. If the name is recognized, return the name
  4. repeat

That’s a good start.  This set of changes took away much of the memory pressure that this method placed on the system. There may only be one PhoneBookEntry and one string representation of a name in memory at one time. Any PhoneBookEntry objects already processed are eligible for garbage collection. 
You can do better by introducing predicates, in the form of .NET delegates. The code you created is a little bit more reusable, but still suffers from being very specific to the operation at hand:  finding recognized names from the New York Phone book.  In order to make this code more reusable, you need to parameterize that specific portion of the algorithm. The problem, though, is that the specific portion of the algorithm is actually code.  Luckily, the .NET Framework and C# have a way to introduce code as a parameter to a method: a delegate.
Start with your ConvertToNames method. With that as a base, you can build what we want: a method that transforms an input sequence into an output sequence of a different type.  Here is the ConvertToNames method:
IEnumerable ConvertToNames(IEnumerable list)
{
    foreach ( PhoneBookEntry entry in list)
        yield return string.Format(“{0} {1}”, entry.FirstName, entry.LastName);
}

What you want is to pass the code ‘string.Format(…)” as a parameter to the method. So you change the signature of ConvertToNames like this:
// A generic method to transform one sequence into another:
delegate Tout Action(Tin element);
IEnumerable Transform(IEnumerable list, Action method)
{
    foreach( Tin entry in list)
        yield return method(entry);
}
This has some new syntax, but it’s really fairly simple.  The delegate definition defines the signature of any method that takes one input parameter and returns a single object of another type. Transform simple defines a pipeline that returns the output of the delegate for every object in the input sequence. It’s the same thing as ConvertToName, but it can be used for any input type, any output type, and any algorithm that transforms one type into another.
You’d call that method like this:
// Fourth attempt:
public IEnumerable PeopleIKnowInNewYork()
{
    IEnumerable newYorkNumbers =
        PhoneBook.FindListFor(“New York”);

    foreach ( string name in Transform(newYorkNumbers,
        delegate(PhoneEntry entry)
        {
            return string.Format(“{0} {1}”, entry.FirstName, entry.LastName);
        }))
    {
        if ( RecognizePerson( name ) )
            yield return name;
    }
}

There are a few new concepts here, so let’s go over it in detail. This code is a little easier to understand if you change the structure just a bit.  So here’s the fifth version:

// Fifth attempt:
public IEnumerable PeopleIKnowInNewYork()
{
    IEnumerable newYorkNumbers =
        PhoneBook.FindListFor(“New York”);

    IEnumerable names = Transform(newYorkNumbers,
        delegate(PhoneEntry entry)
        {
            return string.Format(“{0} {1}”, entry.FirstName, entry.LastName);
        });

    foreach (string name in names)
    {
        if ( RecognizePerson( name ) )
            yield return name;
    }
}
The expression defining names defines a new enumeration over all the names harvested from the phone book.  It defines the delegate method inline, making use of anonymous delegates.  Note that I’m only creating a single line delegate here. I’d recommend against creating complicated methods as anonymous delegates. But, when you need to wrap an existing function call in a delegate, this syntax is much simpler for other developers to follow.
There’s one last loop to convert to something more generic:  The loop that checks for names you know. This one can be refactored into a well-known generic pattern:
delegate bool Predicate(T inputValue);
IEnumerable Filter(IEnumerable list, Predicate condition)
{
    foreach (T item in list)
        if (condition(item))
            yield return item;
}
You should recognize this pattern by now. The Filter is just a pipeline that returns all members of a list that match the condition specified by the predicate.  One last look at that PeopleIKnowInNewYork method shows how you can use it:

// Fifth attempt:
public IEnumerable PeopleIKnowInNewYork()
{
    IEnumerable newYorkNumbers =
        PhoneBook.FindListFor(“New York”);

    IEnumerable names = Transform(newYorkNumbers,
        delegate(PhoneEntry entry)
        {
            return string.Format(“{0} {1}”, entry.FirstName, entry.LastName);
        });

    return Filter(names, delegate(string name)
        { return RecognizePerson(name);} );
}
The final version is quite a bit different than what you started with, and some may argue that it’s not that different.  But it depends on how you apply it. The final version is structured around much more powerful building blocks.  You built a generic method that filters a list of any type, as long as you supply the specific condition for a single item. You built a generic method that transforms a sequence of one type into a sequence of another type. You can leverage this same technique for other operations.  This method samples an input sequence, returning every Nth item:
IEnumerable NthItem(IEnumerable input, int sampleRate)
{
    int sample = 0;
    foreach (T aSample in input)
    {
        ++sample;
        if (sample % sampleRate == 0)
            yield return aSample;
    }
}

This method generates a sequence, based on some factory method you define:
delegate T Generator();
IEnumerable Generate(int number, Generator factory)
{
    for (int i = 0; i < number; i++)
        yield return factory();
}
And this method merges two sequences of the same type into a new type combining them:
delegate Tout MergeOne(Tin a, Tin b);
IEnumerable Merge(IEnumerable first,
    IEnumerable second, MergeOne factory)
{
    IEnumerator firstIter = first.GetEnumerator();
    IEnumerator secondIter = second.GetEnumerator();
    while (firstIter.MoveNext() && secondIter.MoveNext())
        yield return factory(firstIter.Current, secondIter.Current);
}
By separating the actions on a single object from the actions on a sequence of types, you created a set of more powerful building blocks to work with very large sets of sophisticated data types.

Summary

In this article, I showed you how custom iterators, delegates, and generic methods can be combined to create more powerful reusable building blocks for your applications.  By applying these techniques yourself, you’ll find many uses for these techniques, and you’ll be more ready for C# 3.0, where many of these techniques enjoy more embedded language support.

Monday, September 9, 2019

Cryptography Funcdamentals- One Time Pad vs Caesar Cipher

Encryption/ Decryption
Encipher/Decipher

Improvement on Caesar Cipher


Shift any number of space to shuffle the alphabet

One Time Pad




I recently saw The Spy Netflix by Sacha Baron 
It used Morse code. The topic is different but it shows in olden days how things were transmitted.

Thursday, August 29, 2019

Why Automation test is not worth investing?

It is a vicious cycle.

Here is the thing. Why automation test suite not worth investing? Most of us may debate but CIO don't have time to seek return of investment or audit the whole investment. It is just another brick in the wall.


This explains why?

  • We hire consultant to do the job. 
  • Consulting or contractor create Automation suite and automate it.
  • It keep adding more and more functionality.
  • It create a big giant pack.


  1. Problem 1. A big suite is not enough to run on time. Consume a whole day because automation tester doesn't understand the architecture. They have less idea about performance or coding on daily basis.
  2. Problem 2. If it automation suite yield no results on time. It is futile
  3. Problem 3. No one has time to look into this. No one wants to do parallel programming or identify the sweet and simple solution to meet objective. Per say think about regression that runs and yield results in just no time. Add to release pipeline.
  4. Problem 4. Agile is fragile. So is our functional domain. Changes are radical. Automation Suite is not actual production copy or real time match. It fails the whole objective.
  5. Problem 5. No one looks into it. No one question. If question it is taken care for given point of time and later the same old story. 


Bottom line is it automation test suite should be devops and ingrain in the process.

Tuesday, August 27, 2019

Chaining the C# null coalescing ?? Operator

Simple example

string partner = Request.QueryString["GoogleId"] ?? 
                 Request.QueryString["PartnerId"] ?? 
                 Request.QueryString["UserKey"] ?? 
                 string.Empty;

How to make internal class assembly exposed to specific assembly use InternalsVisibleTo

Important thing to note, internal assembly if stronly typed then you have to mention the public key as well.

Assembly A- A.dll  have internal class = I
Assembly B- B.dll can access internal class .

In Assembly A , .net go to property file and update this line

assembly: InternalsVisibleTo("A.I")

Performance Optimization:SItecore 9.2 Content Delivery Server

After migrating website from sitecore 8.2.1 to sitecore 9.2 I noticed my application was extremely slow. The only place I could search for an issues , is sitecore log app_data/logs . The initial reaction after looking at it was seeing whole lot of different log files.

The first reaction was to look at this logs closely. I found there were lot of exception around Xdb to Xconnect which is kind of real problem. Then later I realised Redis cache is playing up. Then I found there is no need of Email EXM manager as I'm not using it. I even created config patch to remove unnecessary log files which is not adding any value. One of the kind was performance log counter that sits under app_data diagnostic folder. Health Monitor an all.
https://doc.sitecore.com/developers/91/platform-administration-and-architecture/en/content-delivery--cd-.html







Thursday, August 22, 2019

Glass Mapper V5 for sitecore 9.2 breaking change SitecoreChildren Islazy is not lazy any more

    public partial interface ICategoryFolderEntity
    {
        /// 
        /// Gets list of category in this folder
        /// 
        [SitecoreChildren()]
        IEnumerable CategoryList { get; }
    }
public partial class CategoryFolderEntity : ICategoryFolderEntity
    {
        /// 
        /// Gets list of category in this folder
        /// 
        [SitecoreChildren]
        public virtual IEnumerable CategoryList { get; set; }
    }

No need of
[SitecoreChildren(IsLazy = false)]
Just  [SitecoreChildren]
And virtual IEnumerable CategoryList
Remember Virtual

Reference:

https://sitecore.stackexchange.com/questions/16530/after-upgrading-to-glass-mapper-5-unable-to-globally-enable-lazy-loading