How to disconnect the public network by SL API? - ibm-cloud

In SL portal I can select "disconnect" attribute from speed field. Do we have SL API to do it?

You should be able to disconnect the network through the setPublicNetworkInterfaceSpeed method.
SoftLayer_Hardware_Server::setPublicNetworkInterfaceSpeed (for hardware servers)
SoftLayer_Virtual_Guest::setPublicNetworkInterfaceSpeed (for virtual guests).
The speed values can only be 0 (Disconnect), 10, 100, or 1000. The new speed must be equal to or less than the max speed of the interface.
POST:
https://[userName]:[apiKey]#api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/111122/setPublicNetworkInterfaceSpeed
BODY:
{
"parameters": [
0
]
}
Note: Set [userName] and [apiKey] with your own data and the value 111122 with the ID of the virtual guest device

Related

Flutter: Twilio programmable video cannot get the correct participant Network Quality Level

I am using the twilio_programmable_video package, been trying to get the Network quality level but I always get an "UNKNOWN" value, here is my connection option.
connectOptions = ConnectOptions(
token,
roomName: name,
preferredAudioCodecs: [OpusCodec()],
audioTracks: [LocalAudioTrack(true, 'audio_track-$trackId')],
dataTracks: [
LocalDataTrack(
DataTrackOptions(name: 'data_track-$trackId'),
)
],
videoTracks: [LocalVideoTrack(true, _cameraCapturer)],
networkQualityConfiguration: NetworkQualityConfiguration(
local: NetworkQualityVerbosity.NETWORK_QUALITY_VERBOSITY_MINIMAL,
remote: NetworkQualityVerbosity.NETWORK_QUALITY_VERBOSITY_MINIMAL,
),
enableNetworkQuality: true,
enableDominantSpeaker: true,
);
how I access the participant Network quality level
participant.networkQualityLevel
Twilio developer evangelist here.
You can log room.localParticipant.networkQualityLevel.
If you are using this in Group Rooms, the Network API only works in Group rooms, not P2P. If you grep the repo you'll probably be able to determine the logic stating why we see it "unknown".
These may also be helpful!
https://github.com/twilio/twilio-video.js/issues/519 or you might be seeing something closer to https://github.com/twilio/twilio-video.js/issues/1679.
Let me know if this helps at all!
I was able to figure it out
for the localParticipant I listen to this event (call this onConnectedEvent)
_streamSubscriptions.add(
_room.localParticipant!.onNetworkQualityLevelChanged.listen((event) =>
localParticipantNetworkLevel(event.networkQualityLevel)));
localParticipantNetworkLevel(NetworkQualityLevel level) {
print("LOCAL PARTICIPANT NETWORK LEVEL =======> $level");
}
Remote participant ( trigger this inside the onParticipantConnected event)
_streamSubscriptions.add( event.remoteParticipant.onNetworkQualityLevelChanged.listen((event) => remoteParticipantNetworkLeve(event.networkQualityLevel)));
remoteParticipantNetworkLeve(NetworkQualityLevel level) {
print("REMOTE LEVEL $level");
}

How to get the build jobs using Azure DevOps REST APi?

So, I can get the build details, but it does not contain any info on the build jobs. E.g. Each build job has run on a build agent - how can I get this piece using REST Api?
We are talking about a vNext build, not XAML.
You can find all tasks and jobs in timeline records: Timeline - Get. You can paste into browser this template to check results for a specific build:
https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/timeline
I use Microsoft.TeamFoundationServer.Client package and this is example for it:
static void PrintTimeLine(string TeamProjectName, int BuildId)
{
var timeline = BuildClient.GetBuildTimelineAsync(TeamProjectName, BuildId).Result;
if (timeline.Records.Count > 0)
{
Console.WriteLine("Task Name-----------------------------Start Time---Finish Time---Result");
foreach(var record in timeline.Records)
if (record.RecordType == "Task")
Console.WriteLine("{0, -35} | {1, -10} | {2, -10} | {3}",
(record.Name.Length < 35) ? record.Name : record.Name.Substring(0, 35),
(record.StartTime.HasValue) ? record.StartTime.Value.ToLongTimeString() : "",
(record.FinishTime.HasValue) ? record.FinishTime.Value.ToLongTimeString() : "",
(record.Result.HasValue) ? record.Result.Value.ToString() : "");
}
}
https://github.com/ashamrai/TFRestApi/blob/master/19.TFRestApiAppQueueBuild/TFRestApiApp/Program.cs
https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId} will let you know the Agent used under the object queue and there it shows the agent queue (91) number and the pool id (8)
"queue":{
"id":91,
"name":"MotBuild-Default",
"pool":{
"id":8,
"name":"MotBuild-Default"
}
Use
https://dev.azure.com/{org}/_apis/distributedtask/pools/{pool_id}?api-version=5.0-preview.1 or https://dev.azure.com/{org}/{project}/_apis/distributedtask/queues/{queue_id} will return the pool.
So now using https://dev.azure.com/{org}/_apis/distributedtask/pools/{pool_id}/agents will return a LIST of agents under the Agent Pools
Now that I've explained all that let's try to tie everything together.
1) Use https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId} and find the Queue and Pool IDs.
2) use https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/timeline and find the record of type Job and the property workerName which will return NAME of the Agent used.
3) Query the Agents with https://dev.azure.com/{org}/_apis/distributedtask/pools/{pool_id}/agents and find the agent id by filtering the name from the name found in step #2 above.
4) Finally query https://dev.azure.com/{org}/_apis/distributedtask/pools/{pool_id}/agents/{agent_id} will return a high-level info of the agent, not much info.
This next api is undocumented
5) To get the detailed capabilities query https://dev.azure.com/{org}/_apis/distributedtask/pools/{pool_id}/agents/{agent_id}?includeCapabilities=true which a huge result set will be returned!! I think this is what you want.
Read more about the APIs at:
Pools
Queues
Agents

node-pg-pool: How can specify the max size in Pool

I am using node-pg-pool to query my Postgres db (host in AWS, db.t2.micro) in my REST API.
I have a concern how to specify a optimal number for max size of Pool.
I got some useful formulas to get pool size from https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing
I need to know how many threads, cores and hard-drives using in an AWS instance (example: db.t2.micro). I searched AWS documents, and still cannot find all those infos
I'm successfully setting pool size when I connect to my postgres db on elephantsql using the following code, aws should be similar. BTW how are you connecting to AWS RDS? as I am having loads of trouble
var poolConfig = {
max: 5, //connections (was 20 in brianc's repo)
min: 2, //connections (was 4 in brianc's repo)
idleTimeoutMillis: 1000 //close idle clients after 1 second
}
poolConfig.user = 'aaaa';
poolConfig.password = 'bbbb';
poolConfig.database = 'ccccc';
poolConfig.host = 'ddddd';
poolConfig.port = 5432;
poolConfig.ssl = true;
var pool = new Pool(poolConfig);
pool.connect().then(client => {
client.query("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';")
.then(data=>{});

PubNub to server data transfer

I am building an IoT application. I am using PubNub to communicate between the harware and the user.
Now I need to store all the messages and data coming from the hardware and from the user in a central server. We want to do a bit of machine learning.
Is there a way to do this other than having the server subscribe to all the output channels (There will be a LOT of them)?
I was hoping for some kind of once-a-day data dump involving the storage and playback module in PubNub
Thanks in advance
PubNub to Server Data Transfer
Yes you can perform once-a-day data dumps involving the storage and playback feature.
But first check this out! You can subscribe to Wildcard Channels like a.* and a.b.* to receive all messages in the hierarchy below. That way you can receive messages on all channels if you prefix each channel with a root channel like: root.chan_1 and root.chan_2. Now you can subscribe to root.* and receive all messages in the root.
To enable once-a-day data dumps involving Storage and Playback, first enable Storage and Playback on your account. PubNub will store all your messages on disk over multiple data centers for reliability and read latency performance boost. Lastly you can use the History API on your server to fetch all data stored as far back as forever as long as you know the channels to fetch.
Here is a JavaScript function that will fetch all messages from a channel.
Get All Messages Usage
get_all_history({
limit : 1000,
channel : "my_channel_here",
error : function(e) { },
callback : function(messages) {
console.log(messages);
}
});
Get All Messages Code
function get_all_history(args) {
var channel = args['channel']
, callback = args['callback']
, limit = +args['limit'] || 5000
, start = 0
, count = 100
, history = []
, params = {
channel : channel,
count : count,
callback : function(messages) {
var msgs = messages[0];
start = messages[1];
params.start = start;
PUBNUB.each( msgs.reverse(), function(m) {history.push(m)} );
callback(history);
if (history.length >= limit) return;
if (msgs.length < count) return;
count = 100;
add_messages();
},
error : function(e) {
log( message_out, [ 'HISTORY ERROR', e ], '#FF2262' );
}
};
add_messages();
function add_messages() { pubnub.history(params) }
}

How to find the all LAN systems mode using c# whether the system is in log off or hibernate

I am using ip address to find the active state of the machine
System.Net.NetworkInformation.Ping p = new System.Net.NetworkInformation.Ping();
System.Net.NetworkInformation.PingReply rep = p.Send(ip);
if (rep.Status == System.Net.NetworkInformation.IPStatus.Success)
You could use this code to check the status..and also explore this site you could get some idea...System.Net.NetworkInformation Namespace
using System.Net.NetworkInformation;
public bool IsNetworkLikelyAvailable()
{
return NetworkInterface
.GetAllNetworkInterfaces()
.Any(x => x.OperationalStatus == OperationalStatus.Up);
}