i have a problem with an application for mobile devices, when i test the app in my pc the webservice conection is ok, i get an answer. however when i test the application in my mobile devices, the first use of the application takes too long to get an answer from the server and the screen stays in "SENDING..." , after many attemps and resets of the application, the conection is ok and after that, the application works fine. what could be my problem? pd: i dont speak english very well.
the code is:
private function panicStart(e:MouseEvent = null):void
{
trace("han presionado el boton de panico");
//Alert.show(_canvas, "Datos de Usuario :" + "\nNombre: " + _currentName + "\nKey: " + _currentKey + "\nD.N.I. :" + _currentDni + "\nMóvil: " + _currentPhone + "\n\nDatos de Geoposición:\n" + "\Latitud: " + _latitud + "\nLongitud: " + _longitud + "\n ", "Envío de Datos", new Array("ok"), null);
var url:String = "http://appmovil.munijesusmaria.gob.pe/1380panico/ws_panico.asmx?WSDL";
webService = new WebService();
webService.loadWSDL(url);
webService.addEventListener(LoadEvent.LOAD, BuildServiceRequest);
_state = STATE_STARTSEND
}
function BuildServiceRequest(evt:LoadEvent)
{
_state = STATE_SENDING;
serviceOperation = webService.getOperation("Insertar");
trace("esperando respuesta");
serviceOperation.addEventListener(FaultEvent.FAULT, DisplayError);
serviceOperation.addEventListener(ResultEvent.RESULT, DisplayResult);
if (_panicScreen.txtReference.text == _textReference || _panicScreen.txtReference.text == "")
serviceOperation.send(_currentDni, _currentName, _currentPhone, _latitud.toString(), _longitud.toString(), "ninguna", "285DF565H5654CC");
else
serviceOperation.send(_currentDni, _currentName, _currentPhone, _latitud.toString(), _longitud.toString(), _panicScreen.txtReference.text, "285DF565H5654CC");
}
function sentgotoPanic(e:MouseEvent = null):void
{
ScreenManager.gotoScreen("panic");
_state = STATE_SENT;
}
function DisplayError(evt:FaultEvent)
{
_state = STATE_JUSTSENT;
sentgotoPanic();
Alert.show(_canvas, "Error al enviar los datos" + "\n ", "Alerta", new Array("ok"), new Array("ok"), null);
trace("error");
_panicScreen.txtReference.text = "";
_state = STATE_SENT;
}
function DisplayResult(evt:ResultEvent)
{
_state = STATE_JUSTSENT;
trace("EEEEEEEXITO")
var result:String = evt.result as String;
sentgotoPanic();
Alert.show(_canvas, "Datos Enviados" + "\n ", "Alerta", new Array("ok"), null);
trace("error");
_panicScreen.txtReference.text = "";
_state = STATE_SENT;
}
Related
I want to get the details of the unread missed calls list in my android app.
I came up with this code but this shows the whole list of my missed calls not only those which are unread.
lv= (ListView)findViewById(R.id.listView1);
List<String> lst=new ArrayList<String>();
String miss_read="read";
String unread_condition=miss_read+"=0";
String[] projection = {CallLog.Calls.NUMBER,CallLog.Calls.CACHED_NAME,CallLog.Calls.TYPE};
//String[] projection = {Integer.parseInt(CallLog.Calls.MISSED_TYPE};
//String where = (CallLog.Calls.TYPE+CallLog.Calls.NEW+"="+CallLog.Calls.MISSED_TYPE);
String where = (CallLog.Calls.NEW+" = "+"new"+" AND "+CallLog.Calls.TYPE+" = "+CallLog.Calls.MISSED_TYPE);
Cursor c = this.getContentResolver().query(CallLog.Calls.CONTENT_URI,projection,where, null, null);
int i=0;
if(c.moveToFirst())
{
do
{
if(CallLog.Calls.IS_READ!="is_read")
lst.add(c.getString(0)+"not read");
//i++;
}while(c.moveToNext());
}
ArrayAdapter<String> adpt=new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,lst);
lv.setAdapter(adpt);
does anybody provide me the solution for my problem...??
Try this.
String[] projection = new String[] { CallLog.Calls.NUMBER,
CallLog.Calls.TYPE, CallLog.Calls.NEW };
String where = (CallLog.Calls.NEW + " = " + "1" + " AND "
+ CallLog.Calls.TYPE + " = " + CallLog.Calls.MISSED_TYPE);
Cursor c = context.getContentResolver().query(CallLog.Calls.CONTENT_URI,
projection, where, null, null);
I made a console application which detects plugin and plugout events for all type of usb devices. but I wanted some filteration in it like I wanted to detect only webcams . This was done by using GUID class. The class for webcam is 'Image' class with GUID "{6bdd1fc5-810f-11d0-bec7-08002be2092f}" .The problem is that this 'Image' class is also used for scanners and I dont want to detect scanners.The code is given below:
static void Main(string[] args)
{
WqlEventQuery weqQuery = new WqlEventQuery();
weqQuery.EventClassName = "__InstanceOperationEvent";
weqQuery.WithinInterval = new TimeSpan(0, 0, 3);
weqQuery.Condition = #"TargetInstance ISA 'Win32_PnPEntity'";
ManagementEventWatcher m_mewWatcher = new ManagementEventWatcher(weqQuery);
m_mewWatcher.EventArrived += new EventArrivedEventHandler(m_mewWatcher_EventArrived);
m_mewWatcher.Start();
Console.ReadLine();
}
static void m_mewWatcher_EventArrived(object sender, EventArrivedEventArgs e)
{
bool bUSBEvent = false;
string deviceCaption = "";
string deviceType = "";
foreach (PropertyData pdData in e.NewEvent.Properties)
{
try
{
ManagementBaseObject mbo = (ManagementBaseObject)pdData.Value;
if (mbo != null)
{
foreach (PropertyData pdDataSub in mbo.Properties)
{
Console.WriteLine(pdDataSub.Name + " = " + pdDataSub.Value);
if (pdDataSub.Name == "Caption")
{
deviceCaption = pdDataSub.Value.ToString();
}
if (pdDataSub.Name == "ClassGuid" && pdDataSub.Value.ToString() == "{6bdd1fc5-810f-11d0-bec7-08002be2092f}")
{
bUSBEvent = true;
deviceType = "Image";
}
}
if (bUSBEvent)
{
if (e.NewEvent.ClassPath.ClassName == "__InstanceCreationEvent")
{
Console.WriteLine("A " + deviceType + " device " + deviceCaption + " was plugged in at " + DateTime.Now.ToString());
}
else if (e.NewEvent.ClassPath.ClassName == "__InstanceDeletionEvent")
{
Console.WriteLine("A " + deviceType + " device " + deviceCaption + " was plugged out at " + DateTime.Now.ToString());
}
}
}
}
catch (Exception ex)
{
}
}
}
for references check this link
I waited but no body answered this question so, after seeing all properties of ManagementBaseObject I found that there is a property named Service which is different for scanners. In scanners the value of Service property is usbscan while in cameras it is usbvideo.
eg.
you can do something like this
if (mbo.Properties["Service"].Value.ToString() == "usbscan")
{
//then it means it is a scanner
}
else
{
//then it means it is a camera
}
note: The main question was that how can we differentiate between a scanner and a webcam because they both use same GUID.
Here is my code
//private void GetUnsubscribers(string apikey, string MailChimpCampaignID)
//{
// campaignUnsubscribesInput input = new campaignUnsubscribesInput();
// input.api_AccessType = PerceptiveMCAPI.EnumValues.AccessType.Serial;
// input.api_CustomErrorMessages = true;
// input.api_MethodType = PerceptiveMCAPI.EnumValues.MethodType.POST;
// input.api_Validate = true;
// input.api_OutputType = PerceptiveMCAPI.EnumValues.OutputType.XML;
// input.parms.apikey = apikey;
// input.parms.cid = MailChimpCampaignID;
// campaignUnsubscribes unsubscribe = new campaignUnsubscribes();
// campaignUnsubscribesOutput output = unsubscribe.Execute(input);
// Unsubscribers.AddRange(output.result.data);
// string unsubscriber = "0";
// string[] unsubs;
// foreach (listMembers list1 in output.result)
// {
// unsubscriber = list1.ToString();
// }
// string unsubscribers = Unsubscribers.Count.ToString();
// Page.ClientScript.RegisterStartupScript(typeof(Page), "alert", "<script language=JavaScript>alert('Unsubscribers:: '+ ' " + unsubscribers + " ');</script>");
//}
But the problem is, i am unable to pass campaign id to this function because i am creating a new campaign every time, so each time a new id is generated for campaign.
please help, As i am new in this line, so sorry in advance if there is something wrong in the code......................
We have developed a multiplayer game using google play services.
When we send a request to the api for inviting friends to play, on clicking auto pick, the opponent's name does not show, instead the list shows any random name as in Player_1231,Player_3333 etc.
We need help regarding this issue. We need proper player names to play the game.Kindly check the screenshots attached.
Immediate help will be appreciated.
Please find the code below:
public void onRoomConnected(int statusCode, Room room) {
// TODO Auto-generated method stub
if (statusCode != mGamesClient.STATUS_PARTICIPANT_NOT_CONNECTED) {
// Toast.makeText(this, " is PARTICIPANT_CONNECTED.",
// Toast.LENGTH_SHORT).show();
roomId = room.getRoomId();
room_creator_id = room.getCreatorId();
// participantId = p.getParticipantId();
current_player_id = room.getParticipantId(mGamesClient
.getCurrentPlayerId());
Asset.self = Asset.username;
if (room_creator_id != null) {
if (room_creator_id.equals(current_player_id)) {
Server = true;
}
}
// Toast.makeText(this,
// " is PARTICIPANT_CONNECTED."+room_creator_id,
// Toast.LENGTH_SHORT).show();
par = null;
par = room.getParticipants();
for (Participant p : par) {
if (!p.getParticipantId().equals(current_player_id)) {
System.out.println(current_player_id
+ " After 1 connect " + p.getParticipantId());
participantId = p.getParticipantId();
Asset.opponent = p.getDisplayName();
break;
}
}
menu.initPage(GameConst.SELECTLEVEL_PAGE_ONLINE);
menu.Start_Selection_Timer();
}
// Toast.makeText(this, " is onRoomConnected.",
// Toast.LENGTH_SHORT).show();
}
PLAY ONLINE---------------
public void startQuickGame() {
// automatch criteria to invite 1 random automatch opponent.
// You can also specify more opponents (up to 3).
if (mGamesClient.isConnected()) {
Bundle am = RoomConfig.createAutoMatchCriteria(1, 1, 0);
// build the room config:
RoomConfig.Builder roomConfigBuilder = makeBasicRoomConfigBuilder();
roomConfigBuilder.setAutoMatchCriteria(am);
RoomConfig roomConfig = roomConfigBuilder.build();
// create room:
mGamesClient.createRoom(roomConfig);
} else {
Toast.makeText(con, "Wait for connection or try after some time",
Toast.LENGTH_SHORT).show();
mGamesClient.connect();
}
// go to game screen
}
I would like to know how to retrieve the list of users that are logged onto a Remote machine. I can do it with qwinsta /server:xxxx, but would like to do it in C#.
check out wmi in .net under system.management.
something like:
ConnectionOptions conn = new ConnectionOptions();
conn.Authority = "ntdlmdomain:NAMEOFDOMAIN";
conn.Username = "";
conn.Password = "";
ManagementScope ms = new ManagementScope(#"\\remotecomputer\root\cimv2", conn);
ms.Connect();
ObjectQuery qry = new ObjectQuery("select * from Win32_ComputerSystem");
ManagementObjectSearcher search = new ManagementObjectSearcher(ms, qry);
ManagementObjectCollection return = search.Get();
foreach (ManagementObject rec in return)
{
Console.WriteLine("Logged in user: " + rec["UserName"].ToString());
}
You may not need the ConnectionOptions...
I ended up using the qwinsta /server:server1 command from C# -- it was much easier
thanks Ken
All this checks all 8 servers at the same time -- I put the result in sql server
but you can do what ever you want
query_citrix.bat script
cd C:.......\bin\citrix_boxes
qwinsta -server:servername or ip > servername.txt
string sAppCitrixPath = Application.StartupPath.ToString() + "\\citrix_boxes\\";
//Run Script for current citrix boxes
Process proc = new Process();
ProcessStartInfo si = new ProcessStartInfo();
si.FileName = sAppCitrixPath + "query_citrix.bat";
proc.StartInfo = si;
proc.Start();
proc.WaitForExit();
int exitCode = proc.ExitCode;
proc.Close();
if (exitCode == 0)
{
//Execute update who is on the Citrix_Boxes Currently
DirectoryInfo dic = new DirectoryInfo(sAppCitrixPath);
FileInfo[] fic = dic.GetFiles("*.txt");
for (int i = 0; i < fic.Length; i++)
{
ParseQWinStaServerFile(fic[i].FullName.ToString(), fic[i].Name.ToString().ToUpper().Replace(".TXT",""));
File.Delete(fic[i].FullName.ToString());
}
}
private void ParseQWinStaServerFile(string sLocation,string sServer)
{
using (StreamReader sr = File.OpenText(sLocation))
{
string sRecord = String.Empty;
char[] cSep = new char[] {' '};
bool bFirst = true;
while ((sRecord = sr.ReadLine()) != null)
{
if (bFirst == false)
{
string[] items = sRecord.Split(cSep, StringSplitOptions.RemoveEmptyEntries);
//Make sure all columns are present on the split for valid records
if (sRecord.Substring(19, 1) != " ") // check position of user id to see if it's their
{
//Send the user id and server name where you want to.
//here is your user
id = items[1].ToString().ToLower().Trim()
//here is your server
};
}
else
{
bFirst = false;
}
}
}
}