Wednesday, 20 March 2019

Different case styles in programming

Camel case 

"theQuickBrownFoxJumpsOverTheLazyDog" or "TheQuickBrownFoxJumpsOverTheLazyDog"
First letter of each word is capitalised. In languages such as C# it is almost imperative to use low case for the first word

Snake case 

"the_quick_brown_fox_jumps_over_the_lazy_dog"
Spaces are replaced by underscore. Words can be lower case, upper case or mixed.

Kebab case

"the-quick-brown-fox-jumps-over-the-lazy-dog"
Same as Snake case, however underscores are replaced with hyphens.

Studly caps

"tHeqUicKBrOWnFoXJUmpsoVeRThElAzydOG"
Complete chaos and pattern whatsoever - use it if you want to offend other programmers. 

Sunday, 17 February 2019

Blender - Quick tips to reduce poly count

Un-Subdivide


 If mesh is made out of quads in edit mode, select the mesh, then ctrl+e and choose Un-Subdivide


Delete Edge Loops

Quite common tactic to reduce poly count in oval shapes objects.
In edit mode select edge loop by pressing alt+right click, then space and type Delete Edge Loop



Limited Dissolve


One of my favorite and quickest techniques. Quickly remove unnecessary vertices without breaking the mesh structure. Still might require some manual adjustment but dramatically reduce poly counts.
We reduced poly count from 49,216 to 436. You can also play with max angle value under limited dissolve menu. It works well on square objects with lots of edge loops.




Decimate modifier


Select object and add Decimate modifier




9750 polygons on the the top photo vs 436 after using decimate modifier.

Wednesday, 6 February 2019

Use of @Input in Angular 6+

According to official angular documentation it declares a data-bound input property.

Let's have a look at this simple example.


Example

The following example creates a component with two input properties.


See the Pen
ErwOgM
by Adam Bielecki (@adambielecki)
on CodePen.




Thursday, 31 January 2019

Using Singleton in C#

Singleton is used in application when we want to store consistent unique data in an object disallowing creating a new instances of this object in the same time.

Here are the bullet points that defines Singleton.

  • cannot be instantiated (private constructor instead of public)
  • cannot be inherited (sealed class)
  • public static instance has to be available across the whole application
Singleton concept is quite popular in mobile apps and video games, less in web/desktop applications.

Here is a simple example of Singleton usage.








Wednesday, 30 January 2019

Understanding Predicate delegate with simple example in C#

Predicate is a delegate that always returns boolean value (True or False).

Predicate is used in conjunction with lambda expression.

Below example shows how can we simply replace static method with Predicate.


public class Program
{
 public static void Main()
 {
  
  Predicate<int> isGreaterThan5Predicate = m => m > 5;
  Console.WriteLine("Using Predicate to determine condition - 4 is not greater than 5 hence: " + isGreaterThan5Predicate(4));
  
  Console.WriteLine("Using static method to determine condition - 6 is greater than 5 hence: " + isGreaterThan5(6));

 }
 
 public static bool isGreaterThan5(int number)
 {
  return number > 5? true: false;
 }
}

Running above code will produce those messages in the console.

Using Predicate to determine condition - 4 is not greater than 5 hence: False
Using Predicate to determine condition - 6 is greater than 5 hence: True