Types of Number literals in C#

Hi Folks,

In this post I touch briefly on types of number literals in C# programming language.

An illustration is

var f = 0f; // float
var d = 0d; // double
var m = 0m; // decimal (money)
var u = 0u; // unsigned int
var l = 0l; // long
var ul = 0ul; // unsigned long

For example, this menas if you see a number with “m” suffix, it is a decimal literal.

That’s all for now. Till next time, happy software development.

How to assign data to properties when instantiating an object in c#

Hi Folks,

In this post, we talk about how to assign data to properties when instantiating an object in c#.

Suppose you have a class like

 

public class Album 
{
    public string Name {get; set;}
    public string Artist {get; set;}
    public int Year {get; set;}

    public Album()
    { }

    public Album(string name, string artist, int year)
    {
        this.Name = name;
        this.Artist = artist;
        this.Year = year;
    }
}

You can create an instance of Album class either via the constructor e.g.

var albumData = new Album("Albumius")
{
Artist = "Artistus",
Year = 2013
};

After compilation, this is similar to the following:

var albumData = new Album("Albumius");
albumData.Artist = "Artistus";
albumData.Year = 2013;

That’s all for now. Till next time, happy software development.

References

C# : assign data to properties via constructor vs. instantiating. stackoverflow. https://stackoverflow.com/questions/19138195/c-sharp-assign-data-to-properties-via-constructor-vs-instantiating

How to convert .mov file to .mp4 using ffmpeg

Hi Folks,

In this post I go over how to convert a .mov file to a .mp4 file using the terminal. Why should you know this skill? Well, you may have recorded a video using an iPhone. Usually these videos are formatted as .mov files. Let’s imagine you need to convert this to mp4 for whatever reason, how do you go about it?

If you have ffmpeg installed, you can use it for the conversion via the terminal. The command to run looks like:

ffmpeg -i {in-video}.mov -vcodec h264 -acodec aac {out-video}.mp4

That’s all for now. Till next time, happy video conversion!

Reference

convert .mov video to .mp4 with ffmpeg. Super User. https://superuser.com/questions/1155186/convert-mov-video-to-mp4-with-ffmpeg

Verbatim String Literal in C#

Hi Folks,

In this short post I talk about how to write verbatim string literals in C#. You write this by using using the @ keyword just before the string. What does a verbatim string literal mean? It means that the characters in it will be interpreted verbatim. This means that escape sequences such as \ \ for backslash, hexadecimal escape sequences such as \x0041 for uppercase A, and Unicode sequences such as \u0041 for uppercase A, are interpreted literally. To demonstrate this, consider that the following two strings are equivalent.

string filename1 = @"c:\documents\file.txt";
string filename2 = "c:\\documents\\file.text";

That’s all for now. Till next time, happy software development.

 

Reference

1. Verbatim text and strings – @ – C# reference. https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/verbatim

How to resolve error of java.lang.reflect.InaccessibleObjectException: Unable to make field private static final java.lang.ProcessEnivironment java.lang.ProcessEnvironment.theEnvironment accessible: module java.lang.base does not “opens java.lang” to unnamed module

Hi Folks,

In this short post we talk about how to work around an error I got when trying to build a Kotlin project. The error looks like:

java.lang.reflect.InaccessibleObjectException: Unable to make field private static final java.lang.ProcessEnivironment java.lang.ProcessEnvironment.theEnvironment  accessible: module java.lang.base does not “opens java.lang” to unnamed module

After some research, I found a way to build the project. The workaround is as follows:

  • Click to Edit Configurations…
  • Find the current build configuration
  • Paste the following under VM options.
--add-opens java.base/java.lang=ALL-UNAMED --add-opens java.base/java.nio=ALL-UNAMED --add-opens java.base/sun.nio.ch=ALL-UNAMED
  • Click Apply
  • Close the configurations dialog.

That’s it. Your build should now work. That’s all for now. Till next time, happy software development.

Àwọ̀ ní èdè Yorùbá

Ẹ ǹlẹ́ o,

Ẹ kúu dédé àsìkò yí. Nínú àròkó yìí a ó sọ̀rọ̀ ní ṣókí nípa àwọ̀ ní èdè Yorùbá àti ìtúmọ̀ wọn ní ède Gẹ̀ẹ́sì. Àwọn nìyìí:

Funfun – white/ cream
Dúdú – black / dark colours
Pupa – red / bright colours
Ewéko – green(ish)
Ewé – green(ish)
Wúrà – golden
Fàdákà – silver
Igi – brown
Ara – brown
Búráùn – brown
Aró – blue
Búlúù – blue
Elese àlùkò – purple
Pọ́pù – purple
Pupa fẹ́ẹ́rẹ́fẹ́ – pink
Òféèfé – orange
Omi ọsàn – orange
Ìyèyè – yellow
Pupa rúsúrúsú – yellow
Yẹ́lò – yellow
Eérú – ash colour/grey

Ó dàbọ̀.

An easy way to type in Yoruba on a Mac

Hi folks,

In this post I will talk about an easy way to type in Yoruba on a Mac. The little challenge with typing Yoruba properly with a standard keyboard is that it takes some effort to add diacritics, which are various dots and squiggles that appear on certain Yoruba alphabets. One solution to writing Yoruba easily is to use the Yoruba keyboard layout talked about on the Manemo Matemu website.

Once you install the layout in your Library/Keyboard Layouts folder, you can then select the layout as your keyboard input source.

Then you can type Yoruba as follows:

  • All the keys remain the same as on the regular U.S. keyboard
  • To add a dot under e, s, and o:  ALT + letter (eg ALT + o to type ọ).
  • Capital s, e or o with dot: SHIFT + ALT + letter
  • High tone (mi): ALT + h
  • Low tone (do): ALT + l

That’s all for now. Till next time, happy Yoruba writing.

Tonic Sol-fa

Hi folks,

In this post I’ll talk about Tonic Sol-fa.

Tonic sol-fa is a tool for teaching sight singing, invented boy Sarah Ann Glover.

It is based on movable do solfège.

You use it to learn the notes of the major scale, which is one of the most commonly used music scales, especially in Western music.

There are 7 notes in the major scale in the key of C. C major scale is the easiet scale to learn because it has all white keys.

The notes of the C major scale are C D E F G A and B.

The names we give to these keys in tonic sol-fa are:

do re mi fa sol la and ti

or in shorter form we call them:

d r m f s l t

To remember these you can use the song Do-Re-mi

It goes as follows:

Doe – a dear, a female dear (do)
Ray – a drop of golden sun (re)
Me – a name I call myself (mi)
Far – a long long way to run (fa)
Sew – a needle pulling thread (sol)
La – a note to follow so (la)
Tea – a drink with jam and bread (ti)
and that brings us back to to Doe.

See Do-Re-Mi video below:

The solfège syllables for all notes of the scale are shown below:

Major scale degree Mova. do solfège syllable # of half steps from Do Trad. pron.
1 Do 0 /doʊ/
Raised 1 Di 1 /diː/
Lowered 2 Ra 1 /ɹɑː/
2 Re 2 /ɹeɪ/
Raised 2 Ri 3 /ɹiː/
Lowered 3 Me (& Ma) 3 /meɪ/ (/mɑː/)
3 Mi 4 /miː/
4 Fa 5 /fɑː/
Raised 4 Fi 6 /fiː/
Lowered 5 Se 6 /seɪ/
5 Sol 7 /soʊ/
Raised 5 Si 8 /siː/
Lowered 6 Le (& Lo) 8 /leɪ/ (/loʊ/)
6 La 9 /lɑː/
Raised 6 Li 10 /liː/
Lowered 7 Te (& Ta) 10 /teɪ/ (/tɑː/)
7 Ti 11 /tiː/

That’s all for now. Till next time, happy music learning.

References

Tonic sol-fa. Wikipedia. https://en.wikipedia.org/wiki/Tonic_sol-fa
Solfège. Wikipedia. https://en.wikipedia.org/wiki/Solf%C3%A8ge

How to record your piano from overhead

Hi folks,

In this article I go over how to record yourself playing a piano from overhead using a smartphone camera.

I got inspiration by watching this very useful video on YouTube:

The EASIEST Way to Record Piano OVERHEAD (with a PHONE!📱)

All I had to do was follow the instructions there and I could get mine set up.

The four components needed are

  1. A smartphone with a camera
  2. Tripod boom mic stand
  3. Phone adapter
  4. Ball head adapter

Setup Procedure

  1. Set up the mic stand
  2. Attach the ball head adapter to the mic stand
  3. Attach the phone adapter to the ball head adapter
  4. Mount your phone into the phone adapter.

Below are Amazon links to the last 3 components should you wish to purchase them.

GLEAM Microphone Stand – Tripod Boom Mic Stand with Carrying Bag (Tripod)
https://www.amazon.co.uk/dp/B082285YXD?psc=1&ref=ppx_yo2ov_dt_b_product_details

H&S Mobile Phone Tripod Mount Holder Adapter Bracket Smartphone Clamp for Ring Light iPhone Samsung 360° Rotation
https://www.amazon.co.uk/dp/B07DZHXPL6?psc=1&ref=ppx_yo2ov_dt_b_product_details

Neewer Video Camera Digital Recorder Adapter with Mini Ball Head-360 Degree Pan and 180 Degree Tilt Movement for Connecting 1/4-inch Thread Camera, Camcorder, Recorder with 5/8-inch Mic Stand or Boom
https://www.amazon.co.uk/dp/B07571NL5G?psc=1&ref=ppx_yo2ov_dt_b_product_details

That’s all for now. Till next time, happy music production.

Further considerations when choosing a spouse

Hi folks,

Here’s another article on relationships. Again I’ll follow up on my previous article on choice of spouse.

The new point to add here is that you must not take things at the surface when choosing a spouse, rather you must pay close attention to all factors you cosider important in a potential spouse, and seek and apply wisdom from God and from people who have more experience than you.

You must not overemphasize one factor to the detriment of other important factors when picking a spouse.

For example, one may you may be looking for a husband or wife who is caring, responsible etc. i.e. you’re interested in the behaviour of the person. That’s fine. But you must not ignore the person’s background. This is important because the behaviour that a person exhibits during courtship may or may not be their real behaviour.

If you want to know a person’s real behaviour, yes, it’s important to observe how they act towards you, but you must also consider the family the person grew up in. How do people in the person’s family behave? Also, you must consider the behaviour of the friends the person mingles with. This is how you would really know if a person’s beviour is likely to be their real behaviour, or an act.

As a Christian, I also believe it’s imprtant to put one’s endeavours in God’s hands, including choosing a spouse, for only God can give the grace to make good decisions.

That’s all for now. Ciao.