How to process SAML from idp initiated SSO using PHP?

Uncategorized
Question: I'm a service provider. The SSO process is being initiated at the idp, when someone clicks on a link, and the idp is posting SAML to my specified url endpoint. They've only provided me a metadata.xml file. Not sure this is all I need. Using PHP, how do I process that SAML data, and how do I use the metadata.xml? do I need to install simplesamlphp or is there something simpler? Answer: Read more
Read More

How to check 2 different types of things using ===?

javascript
Question: I want to check whether the value in an input box is equal to a variable. When I use ===, it returns false but when I use ==, it returns true, provided both are equal. Try function myFunction() { var d1; d1 = Math.floor(Math.random()*100) if( document.getElementById("g1").value == d1) { document.getElementById("d").innerHTML = "Correct"; } Answer: This happens because JavaScript == can compare numeric strings to numbers whereas === does not. Similarly the "value" property your using returns a string that you're comparing to an integer. You'll need to use parseInt to convert the value first. parseInt(document.getElementById("g1").value) === d1 A few things to consider with parseInt:parseInt returns NaN when you try to convert non-number strings (i.e. converting 'bogus' returns NaN. It will convert decimals into integers by dropping the decimals. So…
Read More

Load numeric data from file and generate mapping between columns

Uncategorized
Question: The dataset:1 6.6156E-13 2 3.0535E-13 3 6.2224E-13 4 3.0885E-13 5 1.1117E-10 6 3.8244E-11 7 5.3916E-11 8 1.7591E-11 9 2.2733E-10 I want to extract just the coefficients and perform some operation . The coefficients are 6.6156E-13, 3.0535E-13 etc. How do i extract just the coefficients while preserving their id(id is the int value associated with the coefficients)? I want to do this using python.I think i can use a dictionary for this and thus have key-value pairs. Code:text_file = open("SENS-BUCK.txt", "r") lines = text_file.readlines() a=[] for l in lines: print (l) text_file.close() Answer: This is what you'll need to do: Load your data using np.loadtxt Generate your mapping using a dict comprehension x = np.loadtxt("SENS-BUCK.txt").reshape(-1, 2) # load your text file # https://stackoverflow.com/a/45688392/4909087 mapping = {int(k) : v for k,…
Read More

Separating options with logical OR (“|”) in C++

c#
Question: I know that options can be added when initializing an instance of fstream, for example:fstream file("filename.txt", ios::in | ios::out | ios::binary); In this case there are 3 options. I have several questions:How should I implement that in my own function? Should I define any const values or marcos? How to parse the options and deal with the them properly? Answer: How should I implement that in my own function? Make it a bitmask type: The bitmask type supports a finite number of bitmask elements, which are distinct non-zero values of the bitmask type, such that, for any pair Ci and Cj, Ci & Ci != 0 and Ci & Cj == 0. In addition, the value 0 is used to represent an empty bitmask, with no values set. Should…
Read More

OrgChart binding with data source [on hold]

Uncategorized
Question: I'm using this library OrgChart Library how to bind this data source to OrgChart var dataSource = { 'name': 'Manager ', 'id': 1, 'children':[ { "id": 2, "name": "Luke Warm", "title": "VP Marketing/Sales", "parent": 1 }, { "id": 3, "name": "Meg Meehan Hoffa", "title": "Sales", "parent": 2 }, { "id": 4, "name": "Peggy Flaming", "title": "VP Engineering", "parent": 1 }, { "id": 5, "name": "Saul Wellingood", "title": "Manufacturing", "parent": 4 }, { "id": 6, "name": "Al Ligori", "title": "Marketing", "parent": 2 }, { "id": 7, "name": "Dot Stubadd", "title": "Sales Rep", "parent": 3 }, { "id": 8, "name": "Les Ismore", "title": "Project Mgr", "parent": 5 }, { "id": 9, "name": "April Lynn Parris", "title": "Events Mgr", "parent": 6 }, { "id": 10, "name": "Xavier Breath", "title": "Engineering", "parent": 4…
Read More

Office JavaScript API: Hiding the title of a bound ContentControl

Uncategorized
Question: Using the Office JavaScript API in MS Word, I am binding a ContentControl by using its title property. This works fine, but Word displays this title, causing confusion for end users. I am wondering if there is a way to prevent the title from being shown. Current result: a ContentControl which displays its custom title cc_typo5. Desired result: a ContentControl which doesn't display its custom title cc_typo5. Answer: Read more
Read More

How do use catchAll component in yii2 framwork?

Uncategorized
Question: how do use catchAll component in yii2 framwork? It gives error, when I am configuring as it described in documentation. 'catchAll' => [ 'site/offline', 'h' => 2, ], browser show this message: The page isn’t redirecting properly Answer: Could be you need a $h2 param in your controller/action signature public function actionOffline($h) { if ($h ==2){ return $this->render('offline_h2'); } return $this->render('offline'); } Read more
Read More