Decrypt the Particular column(i.e.Email) of a list from a list using linq.
Here is the code:
List<sp_Ticketlist_Result> _dbData;
_dbData = _repository.GetTicket(UserId).ToList();
In this _dbData a column name Email.This email is decrypted.
Here is the class to encypt the Email (AESCryptography.AES256_Decrypt).
I am try this code :
_dbData = (decrypted.ToList().Select(u => AESCryptography.AES256_Decrypt(u.Email))).ToList();
but not working.
I want to Fetch the list with the email column decrypted value.
Related
I have a table 'EMPLOYEES' where the users have an incorrect email address.
I need to update the email address using 3 service providers like gmail, yahoo, outlook. I have a large number of records so I can't do it one by one.
How can I write that query to update them all at once.?
In the email column, each record must have a valid email address
The first record in my table in the email field is sking. After update it should become jusking#yahoo.com it should only take one domain not all 3 together.
The second record should be nkochhar#gmail.com
The third party ledhaan#yahoo.com
And so it should be with each record, one of the three domains must be added to make it a valid email address.
sking#gmail.com
nkochhar#yahoo.com
ldehaan#outlook.com
name4#yahoo.com
name5#outlook.com
name6#yahoo.com
name7#yahoo.com
name8#outlook.com
name#gmail.com
name#gmail.com
...
I found this on Google but I don't know how to apply it to what I need:
for (int i = 0; i <rowsCount; i ++) {
cv.put (column2, columnValue [1]);
cv.put (column3, columnValue [1]);
db.update (tableName, cv, null, null);
}
I tried to do this but it shows an error:
I need help please, I'm a beginner at this :(
To update email field randomly with #outlook.com, #yahoo.com or #gmail.com use below query:
update employees
set email= (case when mod(employee_id,3)=0 then concat(email,'#outlook.com') when mod(employee_id ,2)=1 then concat(email,'#yahoo.com') else concat(email, '#gmail.com') end);
In both MySql and Oracle database this query will work fine.
For table cmdb_rel_ci, I want to retrieve unique parent.sys_class_name with count for "type=In Rack::Rack contains". I am doing practice in out of the box instance.
At table level URL is as below:
URL
I want to retrieve result from above URL with my below script.
var count = new GlideAggregate('cmdb_rel_ci');
count.addQuery('type','e76b8c7b0a0a0aa70082c9f7c2f9dc64');// sys_id of type In Rack::Rack contains e76b8c7b0a0a0aa70082c9f7c2f9dc64
count.addAggregate('COUNT', 'parent.sys_class_name');
count.query();
while(count.next()){
var parentClassName = count.parent.sys_class_name.toString();
var parentClassNameCount = count.getAggregate('COUNT','parent.sys_class_name');
gs.log(parentClassName + " : " + parentClassNameCount );
}
The issue is I am getting parentClassName empty.
Try this instead:
var parentClassName = count.getValue("parent.sys_class_name")
Since it's a GlideAggregate query (instead of GlideRecord), the query being issued isn't returning all of the fields on the target table. With GlideRecord, dot-walking through a reference field (e.g. parent.sys_class_name) automatically resolves that referenced record to provide access to its field values. This is made possible by the fact that the driving/original query brought back the value of the parent field. This is not happening with GlideAggregate. The query in this case basically looks like:
SELECT cmdb1.`sys_class_name` AS `parent_sys_class_name`, count(*)
FROM (cmdb_rel_ci cmdb_rel_ci0 LEFT JOIN cmdb cmdb1 ON cmdb_rel_ci0.`parent` = cmdb1.`sys_id` )
WHERE cmdb_rel_ci0.`type` = 'e76b8c7b0a0a0aa70082c9f7c2f9dc64'
GROUP BY cmdb1.`sys_class_name`
ORDER BY cmdb1.`sys_class_name`
So, you actually have access specifically to that dot-walked sys_class_name that's being grouped, but not through the dot-walk. The call to getValue("parent.sys_class_name") is expectedly resolved to the returned column aliased as parent_sys_class_name.
That being said, what you're doing probably should also work, based on user expectations, so you've not done anything incorrect here.
I am using the following key to create encrypted data bag. The key is loaded on the sever node in file /etc/chef/encrypted_data_bag_secret:
ERKYMi6xbv36xkrg1N4eXOuKbI6f5zogCXOGNyrs66fjRXI7wtOvK7eA5A9XJcJGdcAt0EuTQcZKtwY5mmTGn21OEOEZlcxWBekB/2NmmVSJJSoA2xlya2dm3CZ97gLES8g4z/XKfNJHP07/cDOnmpCjFWMRSE/qEld/a+YgmW2oTF4zqTHteik0ePclebh7SXSd4lf+GL1oip2aM3yXY6ZJBd6yraXm8CPWfvrswk7VmqnmMGFqR0xi7pSPCOFrmHRs1gxskrqKfbnts0Zy0UU+MNzp5rDIlKHmLL5KO014vDkukV4dIiR2CxjeldJsaqGvRvPC7VIVC2HyMJvAqW772dpi0y5wiBd5HhcjAIQrfqIvVXNLg7Zjk6Eh1xxESe2YJUF7djHAJfru6Hv5b8DsQq/z6OgLJtTkToILRNmd4sBV66CAvw3m0xC4PUhi4c+7pTBiqV1/q+dTQhx2k7G0GM9hsRosCP0Erz7H3jfyUroUPPEMWMsgqXP33fNEz3txBHDPM2L1PcObzT2FHXjHQMgsaTH+oIqlLXWmnqBAtZTIMkG49DVIjj9NrkiN5267+rlIJORAGV6CY7QX4TKuTZqcReYmLpcdMA33Tzius/ife3TOZoN8IoPb1RFLQfn3KFAwI50eOQ0KyEYDKjzwmJOkra5jcEww4GNlzd4=
I created the data bag using following command:
knife data bag create tokens masterkey --secret-file PATH_TO_SECRET
Now, within the recipe, I am using data_bag_items API to retrieve value of the data bag item as follows:
value = data_bag_item("tokens", "masterkey", "/etc/chef/encrypted_data_bag_secret")
token2_hash = lambda { token1_hash.deep_merge({ "value" => value['key'] } ) }
However, I am getting below compile time error:
ERROR: Error decrypting data bag value: 'bad decrypt'. Most likely the provided key is incorrect
I have a DataTable I would like to filter based on elements in a Dictionary.
The Dictionary key is an integer and the value portion is a class.
The contained class has a field called ItemId. This ItemId is a field in the datatable.
I have a value for the key portion of the dictionary.
What I would like is a LINQ query which returns an Enumerable subset of the datatable based on the value I have for the key.
In other words I want a result set of all records in the datatable whose ItemId column is in records contained in the dictionary for which I have the Key value.
Is this possible?
If I understand, you have a key. So with the key, you have one value of the dictionary. This seems very simple to obtain what you want :
int key = 3;
var enumerable = dataTable.Where(t => t.ItemId == dictionary[key].ItemId);
I'm trying to query Facebook with the PHP Library and what I've read it shouldn't required a session key, or rather it shouldn't require one for my case, but my code below gives me the following error: "Session key invalid or no longer valid".
http://wiki.developers.facebook.com/index.php/Fql.query
"For example, querying the user table is like calling users.getInfo without a session key -- you can query only on a few fields."
$fb = new Facebook(FACEBOOK_KEY, FACEBOOK_SECRET);
$query = "SELECT uid,
name,
sex,
pic_square,
profile_url
FROM user WHERE name = 'some name' OR username = 'some name'";
$result = $fb->api_client->fql_query($query);
Any ideas?
/Thanks
I think that policy has changed and you cannot query user table without session.
You can try to query standard_user_info table. Think it doesn't need session.