savedinstancestate ){Super. oncreate (savedinstancestate );Setcontentview (R. layout. Main );Btntest = (button) This. findviewbyid (R. Id. btn_01 );Textview = (textview) This. findviewbyid (R. Id. view_01 );Btntest. setonclicklistener (New View. onclicklistener (){@ OverridePublic void onclick (view arg0 ){Logoff logoff = logoff. getmainlogoff (); // logoff object of the main thread// Handler is created with the logoff object of the main thread,// Therefore, the message sent by the handler will
or a binary streaming problem with PHP
Before a post: http://bbs.csdn.net/topics/391024843
Moderator gave the answer, but also can parse out, but found out the results and the actual results are completely different, such as the server returned to me is: ip:107.145.107.140, port:26773
But I resolved it into: ip:46.48.46.48, port:63271
This is far away, I use PHP to get nodes information, and then the nodes information to parse the output, by the way, the unresolved data sent to Pthon parsing aga
registration: Register with the label life in Androidmanifest.xml and set the filter in the label.
Dynamic registration: use Intentfilter to dynamically register a broadcast in code
Intentfilter intentfilter = new Intentfilter ();
Specifies the action for the Broadcastreceiver to receive a broadcast
intentfilter.addaction (String) with the action,
Registerreceiver ( Broadcastreceiver,intentfilter);
Also noteworthy is that when we use dynamic registration, when th
Background: To replace the 1. At first it may be written like this: Public class Main { publicstaticvoid main (string[] args) { = "Hello everyone:),; New msgprocessor (); Mp.setmsg (msg); = mp.processor (); SYSTEM.OUT.PRINTLN (result);} } Public classMsgprocessor {PrivateString msg; PublicString getmsg () {returnmsg; } Public voidsetmsg (String
the system default exception class;* Step Two: When an exception is encountered, throw an exception with throw, such as Ex1 ($num 2), and the parameter of the exception is $num2 with the getmessage () of the exception;* Step three: Trigger the exception, use the TRY clause, throw new Ex1 ($num) when the condition is met;* Step fourth: Catch catch catching exception catch (Ex2 $e), which is equivalent to instantiating a well-defined exception class ex2 as $e;** Note that exceptions can be define
queueA queue can be implemented by a linked list or by an array, where the loop linked list implemented by the array is used as the queue model for our message queue.typedef struct QUEUE_S {int head; int rear; sem_t sem; msg_t Data[queue_size]; }queue_t; int Msgqueueinit (queue_t* Q) {if (! Q) {printf ("Invalid queue!\n"); return-1; } q->rear = 0; Q->head = 0; Sem_init (q->sem, 0, 1); return 0; } int Msgdequeue (queue_t* Q, msg_t*
Possible problems with compiling code when the GCC version is high in Linux
The problem is this, first look at the function prototype:
void SomeFunc (char *somestr);
And look at this function call:
SomeFunc ("I ' m a string!");
Combine these two things and compile them with the latest g++ to get a warning in the title.
Why, then? the original char * behind the meaning is: Give me a string, I want to modify it.
In theory, the literal constants we pass to a function cannot be modified .
Therefore
Some time ago, prepare to design a table about error information, each error has a unique Errid, and the corresponding error message and other auxiliary information. In the C language, it is natural to achieve the following:
enum { Err_id_1, Err_id_2, Err_id_3, Err_id_4} Errid;Const char* errmsg[] = { "This is Error 1 msg",/*err_id_1*/ "This is Error 2 msg",/*err_id_2*/ "This is Error
There are many and thorough descriptions of this topic on the Internet, such:
Http://www.cnblogs.com/xirihanlin/archive/2011/04/11/2012746.html
Http://disanji.net/2011/01/23/android-looper-handler-thread/
Http://zhoujianghai.iteye.com/blog/1097156
In the process of using handler, the following should be the most:
Mhandler. sendmessage (MSG,...); (1)
Mhandler. Post (mrunnable); (2)
I believe that the first sentence can be used every day. Here message
Find a reprinted copy of the MSN P2P protocol. Save it. There is another URL that is invalid.
/*Msnp2p. cpp-MSN P2P protocol
Copyright (c) 2003 by Olivier goffart
**************************************** ************************************ This program is free software; you can redistribute it and/or modify ** It under the terms of the GNU General Public License as published ** The Free Software Foundation; either version 2 of the license, or ** (At your option) any later version .*******
. Of course, Linux does not support dx.From the brief example, we can see that the main loop of the game is carried out by judging whether the device is run. Run () for Win32 is as follows:View plaincopy to clipboardprint?Bool cirrdevicewin32: Run (){OS: Timer: Tick ();MSG;Bool quit = false;While (peekmessage ( MSG, null, 0, 0, pm_remove )){Translatemessage ( MSG
Erlang send analysis and parameter significance, erlangsendErlang send is a basic message sending function used by a process to send a message to another process. This function can be used for local node process communication or remote node Process Communication.Preface recently, some colleagues encountered the problem of message accumulation caused by erlang: send, which aroused my strong attention. I also read this code. Here is a simple example.Function prototype:Erlang: send (Dest,
"); } sThreadLocal.set(new Looper(quitAllowed)); }private Looper(boolean quitAllowed) { mQueue = new MessageQueue(quitAllowed); mThread = Thread.currentThread();}
After executing lorule. preparemainlorule (), it starts lorule. loop () to read and distribute messages cyclically. This will be analyzed after Handler is analyzed.
Next we will analyze Handler.We often use this in code:
private Handler handler = new Handler(){ public void handleMessage(Message
When multiple processes open the same file to write logs, the o_append parameter is specified during open. UNIX can ensure that this operation is atomic,ProgramNo need to lock yourself
/* Log1.c */ # Include # Include String . H> # Include # Include Int Max = 300 ; Int Main (){ Int I; Int FD; FD = Open ( " 1. Log " , O_wronly | O_append ); For (I = 0 ; I ){ Char MSG [ 100 ]; Sprintf (MSG
Execution method:First modify the IP of server.php and index.htmlExecute [PHP path]\php.exe] [file path]\server.php] from the command lineThen open index.html through the browser
Include ' websocket.class.php ';
$config =array (
' Address ' = ' 192.168.0.200 ',
' Port ' = ' 8000 ',
' Event ' = ' wsevent ',//function name of the callback function
' Log ' =>true,
);
$websocket = new WebSocket ($config);
$websocket->run ();
funct
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.