PowerBI: Change calculation on child value of Pivot

Measure = 
VAR IsLowestLevel =
    HASONEVALUE(Table[RowColumn1]) &&
    HASONEVALUE(Table[RowColumn2]) &&
    HASONEVALUE(Table[RowColumn3]) &&
    HASONEVALUE(Table[RowColumn4]) &&
    HASONEVALUE(Table[RowColumn5])

VAR Is2ndToTheLowestLevel =
    HASONEVALUE(Table[RowColumn1]) &&
    HASONEVALUE(Table[RowColumn2]) &&
    HASONEVALUE(Table[RowColumn3]) &&
    HASONEVALUE(Table[RowColumn4]) 



RETURN
IFERROR(IF (
    IsLowestLevel,
    [BaseColumnToCompute1]/
    SUMX(
        FILTER(
            ALL(Table),
            Table[GlobalFilter1] = SELECTEDVALUE(Table[GlobalFilter1]) &&            
            Table[RowColumn1] = SELECTEDVALUE(Table[RowColumn1]) &&
            Table[RowColumn2] = SELECTEDVALUE(Table[RowColumn2]) &&
            Table[RowColumn3] = SELECTEDVALUE(Table[RowColumn3]) &&
            Table[RowColumn3] = SELECTEDVALUE(Table[RowColumn4])
        ),
        [BaseColumnToCompute1]+500 /*Sample custom compute*/
    ),
    IF (
        Is2ndToTheLowestLevel,
        [BaseColumnToCompute1]/
        (SUMX(
            FILTER(
                ALL(Table),
                Table[GlobalFilter1] = SELECTEDVALUE(Table[GlobalFilter1]) &&            
                Table[RowColumn1] = SELECTEDVALUE(Table[RowColumn1]) &&
                Table[RowColumn2] = SELECTEDVALUE(Table[RowColumn2]) &&
                Table[RowColumn3] = SELECTEDVALUE(Table[RowColumn3])
            ),
            [BaseColumnToCompute1]+1000 /*Sample custom compute*/
        )),
        [DefaultBaseColumnToCompute1]
    )
),0)

Active Directory via C#

There is a requirement to perform CRUD operation on an Active Directory and we need to create it on C#. The following code will help an engineer accordingly:

Create

using (DirectoryEntry directoryEntry = new DirectoryEntry("LDAP:\\url\ou", "username", "password"))
                {
                    using (DirectoryEntry newUser = directoryEntry.Children.Add("CN=Name", "User"))
                    {
                        if (!DirectoryEntry.Exists(newUser.Path))
                        {
                            newUser.Properties["property1"].Add(propertyValue);
                            newUser.CommitChanges();
                            ret = true;
                        }
                    }
                }

Update

using (DirectoryEntry directoryEntry = new DirectoryEntry("LDAP:\\url\ou", "username", "password"))
                {
                    using (DirectorySearcher search = new DirectorySearcher(directoryEntry))
                    {
                        search.Filter = String.Format("(IdentifierProperty={0})", identifier);
                        search.PropertiesToLoad.Add("property1");
                        SearchResult result = search.FindOne();
                        if (result != null)
                        {
                            using (DirectoryEntry entryToUpdate = result.GetDirectoryEntry())
                            {
                                entryToUpdate.Properties["property1"].Value = "property1value";
                                entryToUpdate.CommitChanges();
                                ret = true;
                            }
                        }
                    }
                }

Delete

using (DirectoryEntry directoryEntry = new DirectoryEntry("LDAP:\\url\ou", "username", "password"))
                {
                    using (DirectorySearcher search = new DirectorySearcher(directoryEntry))
                    {
                        search.Filter = String.Format("(IdentifierProperty={0})", identifier);
                        search.PropertiesToLoad.Add("property1");
                        SearchResult result = search.FindOne();
                        if (result != null)
                        {
                            using (DirectoryEntry entryToUpdate = result.GetDirectoryEntry())
                            {
                                directoryEntry.Children.Remove(entryToUpdate);
                                directoryEntry.CommitChanges();
                                ret = true;
                            }
                        }
                    }
                }

Tip: Healthcard doesn’t cover Pandemic

Did you know that COVID-19 was already declare by WHO as Pandemic. Currently DOH has not yet declared it as Pandemic.

If DOH happened to declare COVID-19 as Pandemic, healthcard will not cover it anymore.

Source: https://economictimes.indiatimes.com/wealth/insure/health-insurance/your-health-insurance-policy-might-not-cover-coronavirus-in-these-situations/articleshow/74570246.cms

MSSQL Grant Execute Stored Procedure only

There are cases that we only want to grant read-write only access then also enable users to execute stored procedure with in the SQL Server database.

In order to do this we will need to:

  1. Create a new Role named, db_exec_storedprocedure

    CREATE ROLE db_exec_storedprocedure
  2. Grant that role with execute stored procedure

    GRANT EXECUTE TO db_exec_storedprocedure
  3. Then add the user as a member of that role.

That’s it you can now grant specific permission to execute stored procedure.

God Bless!
Thanks,
Thomie

Azure DevOps Export to Excel Error TF400051

When requesting an Open in Excel a pop-up shows this error.

TF400051: Cannot process URL when attempting to open a query in Excel….

Azure DevOps

This is maybe your installed Visual Studio (VS) that is a lower version recently. Example. Before you’ve install VS 2017 and then VS 2019, but recently you’ve install VS 2010 due to a legacy project support. That sometimes changes a registry that produce this error.

To fix it follow the following:

  1. Open RegEdit
  2. Navigate to

    Computer\HKEY_CLASSES_ROOT\tfs\shell\open\command
  3. Change the value to the following

    C:\Program Files\Common Files\Microsoft Shared\Team Foundation Server\15.0\TfsProtocolHandler.exe “%1”
  4. Save the changes.

That’s it. Try exporting again and it should work now.

God Bless!
Thanks,
Thomie

Dynamic Object in C#

In my experience there was a need to create an object and its properties dynamically. Namely as follows:

thisIsMyObject.MyProperty1 = "AnyValueOfAnyType";
thisIsMyObject.MyProperty2 = true;
thisIsMyObject.MyProperty3 = 1;

To do this there could be different approaches like using a dictionary

Dictionary<string,object> c = new Dictionary<string,object>();
//adding a value
c.Add("MyProperty1", "AnyValueOfAnyType");
c.Add("MyProperty2", true);
c.Add("MyProperty3", 1);
//getting the value
c["MyProperty1"]; //AnyValueOfAnyType
c["MyProperty2"]; //true
c["MyProperty3"]; //1

But you may also use a dynamic object like as follows

var c = new System.Dynamic.ExpandoObject() as IDictionary<string, Object>; //namespace for note only
//adding a value
c["MyProperty1"] = "AnyValueOfAnyType";
c["MyProperty2"] = true;
c["MyProperty3"] = 1;
//getting the value
c["MyProperty1"]; //AnyValueOfAnyType
c["MyProperty2"]; //true
c["MyProperty3"]; //1

This way its more presentable and like using an array.

God Bless!

Thanks,
Thomie

Visual Studio Extension -Ngrok

Ngrok is now widely being used. From simple web development up to complex development. Is hard to run Ngrok everytime you are coding specially when using IIS Express that if not configured to use a specific IP it will generate random port which is a hard to map.

Thankfully there is a plug-in for our beloved Visual Studio to integrate this.

Ngrok Extensions

With Ngrok Extension we only open our Visual Studio solution and navigate to Tool>Start ngrok Tunnel and it will create a tunnel for the websites under your solution.

Try it now!

God Bless!

Thanks,
Thomie

Ngrok – Free Web Tunneling

In the verge of today’s web development we encounter cases that in order to proceed we need to have a public accessible URL. Thankfully, Ngrok provide a free service to do this.

What it does is tunnel your machine to a Ngrok URL with a specific port. We just need to download the ngrok.exe from their website and run the command like

ngrok http 80


With this command your service on your local machine that is running on port 80 will be mapped and accessible publicly for FREE. For a full documentation view it here.

God Bless!

Thanks,
Thomie

Want to convert your load to cash?

I was once a user of load that expires. Expiring load is a past as with the ability to convert load to cash emerges with LoadToCash

LoadToCash support the following:

  1. All SIMs
  2. Postpaid and Prepaid
  3. Unlimited conversions
  4. Several options to cashout

Availing the service is just a app away. Download LoadToCash via Play Store. Register. Convert. and then Wait.

LoadToCash allows cashout to the following:

  1. BDO
  2. BPI
  3. GCash
  4. Coins.ph
  5. Paymaya

Just a tip your consumables is not allowed to be pasaload. But they can be converted via LoadToCash.

God Bless!

Thanks,
Thomie

Adding Proxy on Web.Config

Hi,

There are some cases when developing your web application on .net you may experience proxy issues when you are accessing APIs on your application. To fix this you may add this on your web.config/app.config under the configuration section

 

<system.net>
<defaultProxy useDefaultCredentials=”true”>
<proxy usesystemdefault=”true” proxyaddress=”http://proxy:8080″ bypassonlocal=”true” />
<bypasslist />
</defaultProxy>
</system.net>

God Bless!

Thanks,
Thomie

Compress files on windows via Command Line

Hi,

There are time we want to perform things via CLI. Today I encountered to perform compression via CLI for my windows machine as it has problem performing the task via the UI. Here are the codes:

  • Compression

compact /c /s:”full path of folder” /i /Q

  • Uncompress

compact /u /s:”full path of folder” /i /Q

That’s it

Source: https://www.tenforums.com/tutorials/26340-compress-uncompress-files-folders-windows-10-a.html

Review: Tab Manager

In a world of development cycle we open several tabs for research and development, requirement gathering, and even when presenting. In cases like this we want to open tabs simultaneously. Most of us will do this by creating folder on our Bookmarks and open them up. For me I use Tab Manager on chrome to do this. Its so easy.

  1. Open the tabs you want
  2. Name them on Tab Manager
  3. Then click the + sign

Thats it. It will save that as a group and with just one click you will open them all. The best part of it is its free and it sync the data along with your google account. Download it now at https://chrome.google.com/webstore/detail/tab-manager/mcidendbndlekegaphipeeoaemckemhm

God Bless!

Thanks,
Thomie

Fix SignalR OnDisconnected not working

This just come up and after searching and testing it like to Fix SignalR OnDisconnected if not working is to implement on the client at least one method so that this method will be called. Think of it like a requirement.

Example for the SignalR residing on the same server

<!– Reference to jQuery –>
<!– Reference to SignalR –>
<script src=”~/hubs/signalr“></script>
<script>
var onlineHubProxy = $.connection.onlineHub;

onlineHubProxy.client.void = function(){
//do nothing
};

$.connection.start();

</script>

Then try again now and the Default methods of hubs will now be working properly.

God Bless!

Thanks,
Thomie

DateTime not parsing MM/dd/yyyy correctly on Windows 10 on ASP .Net MVC

Have you experienced coding and all of a sudden when on windows 10 you experienced that MM/dd/yyyy is not a valid date? This is because of the culture that is default implemented on your device, in this case on my device with Windows 10 Pro. To cause of this is the machine is by default is using dd/MM/yyyy and in this case apps that we are developing is having this kind of issue.

Thank fully the fastest way to fix is via the web.config with the following code:

<system.web>

<globalization culture=”en-US” uiCulture=”en-US”/>

 

And then run again your application and it will now accept your MM/dd/yyyy.

Replace words on MS Word using C#

Hi,

Recently I was instructed to create an application that will be able to replace an array of words and replace them with an array of corresponding words on an MS Word document. With this I’ve searched the following:

Prerequisites

  1. Visual Stduio
  2. Install the nuget package DocX
  3. Administrative access on the context the application is running

Code

Dictionary<string, string> lReplacements = new Dictionary<string, string>();
string newFullPath = @”c:\sample.docx”;

using (DocX document = DocX.Load(newFullPath))
{

//for loop is better than foreach
foreach (var item in lReplacements)
{

document.ReplaceText(item.Key, item.Value);

}
document.Save();

}

Hope it helped you as it helped me with this simple snippet.

God Bless!
Thanks,
Thomie

Convert Hard-drive from Dynamic to Basic

Hi,

Just recently we had a requirement to enable bitlocker on our development machines. Unfortunately you can’t use bitlocker on hard drive that of type DYNAMIC. So initially we were advised to have our machines reformatted. We all know that having our development machines reformatted will result to downtime on development task so I tried searching the web for solution and I found one.

As always for a peace of mind you may backup your files just in case you did something that is not part of the steps.

 

Summary

  1. Delete volume of the drive using Diskpart and convert drive to basic
  2. Use Gparted to recreate the volume
  3. Enable bitlocker

Details

  1. Create a Gparted bootable disk
    1. Download the latest YUMI Multiboot creator
    2. Download the latest GParted ISO either the x64 or the one that is compatible to your machine
    3. Insert the USB drive to your machine
    4. Run YUMI
    5. On Step 1 select the USB drive and check on Format drive preferably as FAT32
    6. On Step 2 select Gparted
    7. On Step 3 locate the downloaded ISO file from Step 1.2
    8. Click Create and wait for the USB drive to be created successfully
    9. Keep it for now as we will use it later
  2. Create a local administrator
    1. This is a different from a domain admin that is created for corporate machine this is an account that binded only to your machine
    2. To create open Computer Management
    3. Navigate to Local User admin Groups > Users
    4. Right click and select New User
    5. Fill up the following accordingly
      1. User name
      2. Full Name
      3. Password
      4. Confirm Password
      5. User must change password at next logon : UNCHECKED
    6. Double click on the newly created account and select the Member of Tab
    7. Click Add and search for Administrators
  3. Boot your machine to command prompt, on our Machine we are using Windows 10 and below are the steps to boot to the command prompt
    1. On your task bar go to All Settings
    2. Select Update & Security
    3. Select Recovery
    4. Under Advance startup click on Restart Now
    5. Your machine will restart
    6. On the said screen navigate to find the Command Prompt usually it is found by:
      1. Troubleshooting > Advanced > Command prompt
      2. Then select the local admin you have created on Step #2
    7. Type in Diskpart
    8. Type in  list disk take note of the disk you want to convert to basic
    9. Type in select disk <disknumber>
    10. Type in detail disk take note of the details for later reference #3.10
    11. This time we will delete all the volume of the said disk by
      1. select volume <volumenumber>
      2. delete volume
      3. Repeat step untill all volume has been deleted
    12. When all volumes has been deleted you may now convert that selected disk on #3.10 by typing convert basic
    13. Now our disk is converted to basic we need to reboot our machine and boot unto our USB live drive that we have created on Step #1
  4. After booting up on the USB Drive just look for the Gparted and just press enter until you see the desktop of Gparted
    1. Open GParted app and make sure that the drive we wanted to convert to basic is showing unallocated as we have deleted the volume on Step #3
    2. Now open terminal and type the following steps
      1. sudo -s
      2. testdisk
        1. On the testdisk follow this steps
          1. Select No Log.
          2. Select the disk drive you want to recover, e.g. /dev/sdc.
          3. Select your partition table type. Usually it’s Intel.
          4. Select Analyse and Quick Search.
          5. If you get asked whether your partition was created under Vista, answer yes/no.
          6. Your drive will be analysed and you will see a list of all found partitions. If you know what you are doing, you can edit the list, but usually that list is already the volume we’ve got on Step #3.10 and if yes just press Enter.
          7. On the next screen you have the option to either perform a second Deeper Search, or Write the current partition table to disk. If the quick search, which we checked if it matched our volume on Step #3.10, was successful, choose Write.
      3. Close and Open the GParted app to verify the changes
      4. If all is well you can now exit GParted and boot again
  5. Your machine will now boot properly and your drive will now be on Basic type.
  6. You can now enable bitlocker as needed.

 

Hope it helped you as it did to me.

 

God Bless!

Thanks,
Thomie

 

Referrences:

https://www.partition-tool.com/easeus-partition-manager/convert-dynamic-disk-to-basic-disk.htm

YUMI – Multiboot USB Creator

https://gparted.org/download.php

https://ubuverse.com/recover-a-disk-partition-with-testdisk-and-gparted-live/

FotoJet Create Collage Online!

I was requested to review this tool called FotoJet. And what can I say is “Its worth it”. Let me tell you why with this technical review.

Programming Language

The programming language used is Action Script i think because its running under the context of Adobe Flash Player. Even though they have mobile have which is very nice and we’ll review it on another session.

If you want to use fotojet web make sure you are accessing it on a desktop because it is design for a desktop environment. Even though there is a browser that is capabale of running Adobe Flash Player like Puffin it is not designed to work on a mobile environment which it is detecting via the said screenshot.

UI

The ui is like you are using a desktop application which give a native app feel. It has inbuilt ui guided step by step to creage your wonderful collage.

Input and Output

Its input just require your image to be browsed and all the design can be done via the web app itself. It has also inbuilt font but some of them need payment which is explainable due to copyright or agreements I think.

In any case after building with the app I am satisfied with how easy it is to create one. Here are the samples I created that I loved much.

Review: Skywave Zensei Ultra Dual Polarity Antenna

In a mist of an island which is a case of my wife’s family is a need for a remote way to access internet. Here in my mother-in-law residence internet connection is a difficulty. You get internet connection in a few minutes and none for few minutes also. There are cases that I meed internet connection and we had to go thru an exploration just to get a internet from a neighbor.

Today is diffrent. We constructed to have a modem along with a Skywave Zensei Ultra Dual Polarity Antenna and poof its worth it. Let me explain why.

Powerful Gain

With the 2×24 dbi gain it absolutely give you the boost that your modem needs. From a 1 to none bar of signal that you get of your modem you will really get 3-full bar of signal that can give yo the experience of internet just like if you are on the Urban area. I will assure you that with proper implementation you’ll get satisfied with it.

A thought material

Its build with a high grade aluminum that is power-coated that will surely stand most climate on your area. We had experienced it on thought wind and it never bend with the help of its dual clamping tools that I really loved.

The frequency

Its frequency is a good coverage 1790~2170 Mhz will cover your 3G and 4G need. Just make sure that your area cover those frequency before proceeding with the purchase.

Conclusion

If you want get a boost and be satisfied I strongly suggest to buy one. Its not that cheap to buy one but investing to have a wonderful internet experience, specially to your love ones, will make it a worth. It cost P7450.00 c/o uplift.ph which has Cash on Deliver and comes with a 10m cable or upgrade it with a fee.

God Bless and Happy New Year!