Why is there an error parsing the returned XML signature? - itfoxtec-identity-saml2

Ensure that the SecurityTokenResolver is populated with the required key.
ID4037: The key needed to verify the signature could not be resolved from the following security key identifier 'SecurityKeyIdentifier
(
IsReadOnly = False,
Count = 1,
Clause[0] = System.IdentityModel.Tokens.Saml2SecurityKeyIdentifierClause
)

Related

Enterprise Architect - how to extract nullability of a database table column?

I have a database table defined in EA. In this table I have a column where NULL is allowed. When I use a script or an API to extract nullability from this column, I understand this should be done using the LowerBound and UpperBound values. When LowerBound is 0, it is a nullable field, if it is 1, NULL is not allowed.
However, when I set the NULL field, LowerBound is still 1, as noted on the following picture:
How can I correctly extract nullability from a database column?
You have to look into Attribute.AllowDuplicates or t_attribute.AllowDuplicates (well, it's EA).
There seem to be two ways of retrieving that information:
Via SQL
Via API
Extending your example I defined to additional columns: NotNullAttribute and NullAttribute as shown in the figure below:
Now you get the results shown below when querying the element and its attributes:
LINQ and SQL query showing nullable columns:
SELECT *
FROM
[t_attribute] [t]
WHERE
[t].[Name] LIKE '%NullAttribute%'
Script for showing database table columns attributes:
function main(id)
{
var element AS EA.Element;
element = Repository.GetElementByID(id);
var attributes AS EA.Collection;
attributes = element.Attributes;
for(var c = 0; c < attributes.Count; c++)
{
var attribute AS EA.Attribute;
attribute = attributes.GetAt(c);
Session.Output(attribute.Name + ": " + attribute.AllowDuplicates);
}
}
main(18365);
// Output
/*
Id: true
Name: false
CustomerTypeEnumId: true
NotNullAttribute: true
NullAttribute: false
*/

Cassandra counter type in User defined type

I have a type and a table
CREATE TYPE IF NOT EXISTS info(
street text,
c_counter counter
);
CREATE TABLE customer (
id UUID PRIMARY KEY,
customer_info info
);
which's way to use the counter on customer table within the UDT?
I tried with this
UPDATE customer SET customer_info.c_counter = customer_info.c_counter + 1 WHERE id = 6ab09bec-e68e-48d9-a5f8-97e6fb4c9b47;
and I got the error:
SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line xxx no viable alternative at input '+' (...customer SET customer_info.c_counter = [customer_info].c_counter...)">
Thank you so much guys.

How can I set the value of a SQL Server column to True / False?

I have this SQL:
var sql = #"UPDATE TestQuestion
SET UserDataJSON = #UserDataJSON,
Answered = TRUE
WHERE TestQuestionId = #TestQuestionId";
List<SqlParameter> parameterList = new List<SqlParameter>();
parameterList.Add(new SqlParameter("#TestQuestionId", testQuestionId));
CREATE TABLE [dbo].[TestQuestion] (
[TestQuestionId] INT IDENTITY (1, 1) NOT NULL,
[TestId] VARCHAR (20) NOT NULL,
[Answered] BIT DEFAULT ((0)) NULL,
CONSTRAINT [PK_TestQuestion] PRIMARY KEY CLUSTERED ([TestQuestionId] ASC)
);
How can I set the Answered to TRUE? I tried this but it mentions about invalid
column name.
SQL Server, technically, has neither a boolean data type nor any boolean literals. It has the bit data type, that you've indicated that you're using, which is a numeric type accepting the values 0 or 1. Some data access layers (such as ADO) will pretend that this is a boolean type in foreign languages (such as C#), but such data access layers aren't involved when you're writing a piece of literal SQL code as a string
If you wish to continue to pretend that SQL Server has a boolean data type, because ADO pretends that it does, then you need to let ADO perform the necessary adjustments for you:
var sql = #"UPDATE TestQuestion
SET UserDataJSON = #UserDataJSON,
Answered = #Answered
WHERE TestQuestionId = #TestQuestionId";
List<SqlParameter> parameterList = new List<SqlParameter>();
parameterList.Add(new SqlParameter("#TestQuestionId", testQuestionId));
parameterList.Add(new SqlParameter("#Answered", true));
ADO will translate a boolean value in a parameter into a value suitable for a SQL Server bit type - 0 or 1.
Try this: (Give the value within ' i.e. 'TRUE')
var sql = #"UPDATE TestQuestion
SET UserDataJSON = #UserDataJSON,
Answered = 'TRUE'
WHERE TestQuestionId = #TestQuestionId";
Otherwise, it will be taken as Column Name. So set the value with '
Replace TRUE with 1: ie, you want to set Answered = 1 because this is a bit type. 1 represents TRUE in TSQL.

Yii MANY_MANY on clause

I have the following tables in my database.
subscriber(
subscriber_id int,
status char(1),
...
)
sendlist(
sendlist_id int,
...
)
subscriber_list(
subscriber_id int,
sendlist_id int,
status char(1)
)
in my SendList model I have a relation defined as follows:
'Subscribers'=>array(self::MANY_MANY, 'Subscriber', 'subscriber_list(sendlist_id, subscriber_id)',"on"=>"Subscribers_Subscribers.status='a' and Subscribers.status='a'")
I have tried setting both the on and condition clause, and one or the other, however the sole Subscriber in the table at present (linked to this sendlist) is ALWAYS returned, regardless of whether it's status in the subscriber table, or the subscriber_list table is set to 's'.
When I check the DB - the query that the join supposedly gives something along the lines of:
SELECT `Subscribers`.`subscriber_id` AS `t1_c0`, `Subscribers`.`full_phone` AS `t1_c1`, `Subscribers`.`status` AS `t1_c2`, `Subscribers`.`contact` AS `t1_c3`, `Subscribers`.`client_id` AS `t1_c4`, `Subscribers`.`date_joined` AS `t1_c5` FROM `subscriber` `Subscribers`
INNER JOIN `subscriber_list` `Subscribers_Subscribers` ON (`Subscribers_Subscribers`.`sendlist_id`=7075) AND (`Subscribers`.`subscriber_id`=`Subscribers_Subscribers`.`subscriber_id`) AND (Subscribers.status='a' and Subscribers_Subscribers.status='a')
WHERE (Subscribers.status='a' and Subscribers_Subscribers.status='a');
returns an empty set (as it should). But when I print_r the $list->Subscribers array, I get the following:
Array(
[0] => Subscriber Object
(
...
[_attributes:CActiveRecord:private] => Array
(
[subscriber_id] => 2043221
[full_phone] => 447944426885
[status] => s
[contact] => 0
[client_id] => 14002
[date_joined] =>
)
so it recognises that the subscriber is status 's', but still loads it!
The code that causes the issue is here:
$client = new Client();
$client->save(false);
//ensure that we are working with a clean subscriber set.
$subscribers = Subscriber::model()->findAll();
foreach($subscribers as $subscriber){
$subscriber->delete();
}
//create a new subscriber with a set of filter options.
$subscriber = new Subscriber();
$subscriber->client_id = $client->client_id;
$subscriber->full_phone = "44712345678";
$subscriber->country = "England";
$subscriber->gender = "Male";
$subscriber->save(false);
//create a new list with a set of matching options
$list = new SendList();
$list->client_id = $client->client_id;
$list->gender = "=Male";
$list->save(false);
//confirm that the subscriber can be added to the list.
self::assertTrue($list->canImport($subscriber));
$list->import();
//confirm that the subscriber has been added to the list.
self::assertEquals(1, $list->active_subscriber_count);
self::assertEquals(1, sizeof($list->Subscribers));
//remove all subscribers (set status to 's')
$list->remove();
//check that the list no longer records the subscribers presence.
self::assertEquals(0, $list->active_subscriber_count);
self::assertEquals(1, $list->stopped_subscriber_count);
//check that the subscriber has no lists associated with it.
$subscriber->refresh();
self::assertEquals('s', $subscriber->status, sizeof($subscriber->SendLists));
//attempts to refresh the list. Tested without these with the same result.
$list_id = $list->sendlist_id;
unset($list);
unset($subscriber);
$list2 = SendList::model()->findByPk($list_id);
$list2->refresh();
//check that the the list has no subscribers - this fails.
self::assertEquals(0, sizeof($list2->Subscribers));
Have I missed something silly?

How to convert an anorm resultlist from a two-field data table to a Tuple2, in Scala

I have the following table (maximum number of records 999) I use for a lookup:
CREATE TABLE lga
(
lgacode character varying(3) NOT NULL DEFAULT '000'::character varying,
lganame character varying(32) NOT NULL,
CONSTRAINT pk_lga PRIMARY KEY (lganame),
CONSTRAINT uk_lga UNIQUE (lgacode)
);
Using Anorm, I easily get a result list lgas of the type List[models.LgaTable]
How do I get this result list into the form List[Tuple2[String,String]]?
I searched Stack Overflow and found something close ([a link]http://stackoverflow.com/questions/4927260/filling-a-scala-immutable-map-from-a-database-table) but this contained Set, which I have an aversion for, meanwhile: I just needed something simple. Thanks
Just call a map on your result:
val lgas: List[models.LgaTable] = ...
val lgas_tupled = lags.map(row => (row.lgacode, lganame))

Resources