This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void Process() | |
| { | |
| while (!finalizeService) | |
| { | |
| PerformanceCounter PC = new PerformanceCounter(); | |
| PC.CategoryName = "Processor"; | |
| PC.CounterName = "% Processor Time"; | |
| PC.InstanceName = "_Total"; | |
| PC.ReadOnly = true; | |
| var value = PC.NextValue(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void SendAlertMessage(AlertType alertType, double value, long ramValue) | |
| { | |
| List<RTPMProcess> list = new List<RTPMProcess>(); | |
| lstPerformance = new List<PerformanceCounter>(); | |
| Process[] processes = System.Diagnostics.Process.GetProcesses(); | |
| for (int i = 0; i < processes.Length; i++) | |
| { | |
| PerformanceCounter pc = new PerformanceCounter("Process", "% Processor Time", processes[i].ProcessName, true); | |
| try | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.pubnub.api.PubNubException; | |
| import com.pubnub.api.PubNubUtil; | |
| import javax.net.ssl.HttpsURLConnection; | |
| import java.io.BufferedReader; | |
| import java.io.IOException; | |
| import java.io.InputStreamReader; | |
| import java.net.MalformedURLException; | |
| import java.net.URL; | |
| import java.util.Date; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.pubnub.android.pubnubpublishdemo; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.os.Bundle; | |
| import android.view.View; | |
| import android.widget.Button; | |
| import android.widget.TextView; | |
| import com.google.gson.JsonObject; | |
| import com.google.gson.JsonParser; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.we.pubnubtest.utils; | |
| import com.pubnub.api.models.consumer.history.PNFetchMessagesResult; | |
| /** | |
| * Created by tukunare on 2/8/2017. | |
| */ | |
| public abstract class CallbackSkeleton { | |
| public CallbackSkeleton() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pubNub.addListener(new SubscribeCallback() { | |
| @Override | |
| public void status(PubNub pubnub, PNStatus status) { | |
| if (status.getOperation() != null) { | |
| switch (status.getOperation()) { | |
| // let's combine unsubscribe and subscribe handling for ease of use | |
| case PNSubscribeOperation: | |
| case PNUnsubscribeOperation: | |
| // note: subscribe statuses never have traditional | |
| // errors, they just have categories to represent the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.google.gson.JsonObject; | |
| import com.pubnub.api.PNConfiguration; | |
| import com.pubnub.api.PubNub; | |
| import com.pubnub.api.callbacks.SubscribeCallback; | |
| import com.pubnub.api.enums.PNLogVerbosity; | |
| import com.pubnub.api.enums.PNReconnectionPolicy; | |
| import com.pubnub.api.models.consumer.PNStatus; | |
| import com.pubnub.api.models.consumer.pubsub.PNMessageResult; | |
| import com.pubnub.api.models.consumer.pubsub.PNPresenceEventResult; | |
| import org.slf4j.Logger; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apply plugin: 'com.android.application' | |
| android { | |
| signingConfigs { | |
| config { | |
| keyAlias 'PubNub' | |
| keyPassword '123456' | |
| storeFile file('C:/temp/pubnubKeyStore.jks') | |
| storePassword '123456' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| JSONArray position = new JSONArray(); | |
| position.put(32L); | |
| System.out.println("before pub: " + position); | |
| pubnub.publish() | |
| .message(position.toList()) | |
| .channel("my_channel") | |
| .async(new PNCallback<PNPublishResult>() { | |
| @Override | |
| public void onResponse(PNPublishResult result, PNStatus status) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| JSONArray position = new JSONArray(); | |
| position.put(32L); | |
| System.out.println("before pub: " + position); | |
| pubnub.publish() | |
| .message(toList(position)) | |
| .channel("my_channel") | |
| .async(new PNCallback<PNPublishResult>() { | |
| @Override | |
| public void onResponse(PNPublishResult result, PNStatus status) { |
OlderNewer