Determine the name of the local Administrators group in Vista - language-agnostic

How can I determine the name of the local Administrators group in Vista? This can vary depending on the operating system language.

Look it up by the well known SID.
In .NET you can use the enum value: System.Security.Principal.BuiltinAdministratorsSid
In Win32 you can use the enum value: WELL_KNOWN_SID_TYPE.WinBuiltinAdministratorsSid and see MSDN for details.

As Richard proposes, use the wellknown sid to find the group.
var adminGroupSid = new SecurityIdentifier("S-1-5-32-544");
var adminGroup = (NTAccount)adminGroupSid.Translate(typeof(NTAccount));
var adminGroupName = adminGroup.Value;

Related

How to get all ip attached to compute using python oci

I want to use python oci package to get information about environment.
how to list all IPs addresses (both public or private) attached to compute node?
list_instances() does not provide this part of compute details unfortunately.
thanks.
As shared by #Char above, this oci-python-sdk example should help you here.
You can find a list of all supported services by SDK for Python here - https://docs.cloud.oracle.com/en-us/iaas/Content/API/SDKDocs/pythonsdk.htm
Additionally, full documentation for OCI Python SDK can be found here - https://docs.cloud.oracle.com/en-us/iaas/tools/python/2.21.5/
Please use this code. Basically you have to lookup VNIC Attachment object and filter VNIC_ID based on InstanceId. VNIC_ID can be used for looking up IP Addresses subsequently.
I have used data[0] to indicate the first attachment. You could use a loop to go through all attachments and print the IP.
compute_client = oci.core.ComputeClient(config={}, signer=signer)
network_client = oci.core.VirtualNetworkClient(
config={}, signer=signer)
vnic_id = compute_client.list_vnic_attachments(
cd_compartment_id, instance_id=instanceId).data[0].vnic_id
private_ip = network_client.get_vnic(vnic_id).data.private_ip
Assuming that you have the display name of an OCI compute instance and you need its private and public IP addresses, provided that you already created an API key in your profile and that you configured your ~/.oci/config with valid pem private key downloaded when creating the API Key, the following Python code can help:
import oci
display_name = "your display name"
config = oci.config.from_file()
identity = oci.identity.IdentityClient(config)
user = identity.get_user(config["user"]).data
instances = oci.core.ComputeClient(config).list_instances(
compartment_id=user.compartment_id).data
instance_id = {i.display_name: i.id for i in instances}[display_name]
compute_client = oci.core.ComputeClient(config)
vnic_data = compute_client.list_vnic_attachments(
compartment_id=user.compartment_id, instance_id=instance_id).data
network_client = oci.core.VirtualNetworkClient(config)
vnic_list = [network_client.get_vnic(vnic_attachment.vnic_id).data
for vnic_attachment in vnic_data]
public_ip = {i.display_name: i.public_ip for i in vnic_list}[display_name]
private_ip = {i.display_name: i.private_ip for i in vnic_list}[display_name]
print(public_ip, private_ip)
This implies:
pip3 install oci oci-cli

Power BI Embedded: Use Hash Value in RLS?

All examples of Row Level Security in Power BI Embedded that I see on the internet are using Username() functions in RLS.
But I want to use a hash value to do RLS in my system. I want to create a role in my power bi report that compares a column value of a dimension to a Hash passed via iframe.
DimensionA:
[Column7] = 'hashValuePassedByIframe'
Is possible? There are articles/examples on the internet with this approach that I want? Or all RLS techniques of PowerBy are bound to User() functions?
Thank You

Windows Phone 8.1: DeviceExtendedProperties or DeviceStatus for Device Unique ID

I want to get the Device ID in Windows Phone 8.1.
The DeviceExtendedProperties or DeviceStatus are not available in WP8.1 (there is no Microsoft.Phone.Info namespace). I've just found the EasClientDeviceInformation class that I can't get the Id from it. There is an exception in the Id property:
And other properties are't unique.
There is another solution here but I don't know if it is safe or reliable to use: (?) https://stackoverflow.com/a/23537207/3682369
Yes, you can use the GetPackageSpecificToken(). I have looked into it and haven't found any other way. Although MSDN says that the Id property contains some hardware info, it's actually an unique value for any device, even of the same model. So you can use it to identify the user's device.
This is how I use it in my application. Feel free to use my code:
private string GetDeviceId()
{
var token = Windows.System.Profile.HardwareIdentification.GetPackageSpecificToken(null);
var hardwareId = token.Id;
var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
byte[] bytes = new byte[hardwareId.Length];
dataReader.ReadBytes(bytes);
return BitConverter.ToString(bytes).Replace("-", "");
}

What's the difference between 'developmentAppKey' and 'productionAppKey' in the airshipconfig?

I couldn't find a real explanation of the difference between the developmentAppKey(secret) and the productionAppKey(secret).
I've looked at stuff like: https://support.urbanairship.com/customer/portal/articles/1138363-configuring-your-airshipconfig-plist-for-multiple-targets, but couldn't get through the help there. What is the difference between the developmentAppKey(secret) and the productionAppKey(secret)?
From what I understand; the developmentAppKey will be used if inProduction is set to false. Whereas the productionAppKey will be used if inProduction is true. Is this correct? And if this is correct, consider the following example:
Two apps, A-Debug and B-Release, both exist in Urban airship. If I create the following airshipconfig (for the sake of explaining I've left out all unnecessary info):
developmentAppKey = App-A-KEY
productionAppKey = App-B-KEY
gcmSender = 1234567891
inProduction = false
Is it possible to switch between the two apps using the inProduction flag? Or is this impossible due to the difference in Google Project Numbers (gcmSender) for the two apps?
Development app key/secret are for development environments (connecting to development servers).
Production app key/secret are for production environments (connecting to production servers).
DO NOT SWITCH BETWEEN THE TWO IN THE APP!!
I recommend creating two apps in Urban Airship (as you mentioned with A-Debug and B-Release). One for development, and another for production. From there, use the inProduction = false for developing and inProduction = true for when you publish the app. EG:
developmentAppKey = A-Debug-KEY
developmentAppSecret = A-Debug-SECRET
productionAppKey = B-Release-KEY
productionAppSecret = B-Release-SECRET
gcmSender = 1234567891
inProduction = false will use A-Debug Key and Secret
inProduction = true will use A-Release Key and Secret
This will help with testing your push notifications before sending them out to your entire audience.

Multiple items in one objectStore

I am trying to do simple application with Indexed DB. I want to store multiple items in one objectStore. Is it possible? I tried something like that, but it does not work:
itemsDB.indexedDB.addTodo = function(Name, Desp) {
var db = itemsDB.indexedDB.db;
var trans = db.transaction(['items'], IDBTransaction.READ_WRITE);
var store = trans.objectStore("items");
var data = {
"name": Name,
"description": Desp,
};
var request = store.put(data);
}
I have used sample from http://www.html5rocks.com/en/tutorials/indexeddb/todo/
Targetting "just" IndexedDB will narrow down your compatible clients to chrome and firefox users. Have a look at JayData, it supports your object store pattern with an option of fallback provider list: if the client has IndexedDB it will be used but if only WebSQL what the client has (95% of the mobile devices) then webSQL will be used.
Also the syntax is much easier for storing or retrieving, check the ToDo list example, this also shows the fallback provider option.
IndexedDB object stores were designed to house multiple objects and let you cursor across their attributes.
It's not clear exactly what's causing your put issue but if you have a key on either name or description it's going to just replace an existing object rather than add a new one. You'd want to use add instead of put.
One thing to keep in mind about the HTML5Rocks examples is that currently they will only work in Chrome (which happens to have a lagging IndexedDB implementation).
FWIW, a small tip is that there's an error in your JavaScript here (extra comma after Desp var) which might prevent it from running in IE10:
var data = {
"name": Name,
"description": Desp,
};