我的Android进阶之旅------>Android实现用Android手机控制PC端的关机和重启的功能(一)PC服务器端
(地址:http://blog.csdn.net/ouyang_peng/article/details/47004617)

我的Android进阶之旅------>Android实现用Android手机控制PC端的关机和重启的功能(二)Android客户端功能展示
(地址:http://blog.csdn.net/ouyang_peng/article/details/47005739)

通过以上两篇文章,我们了解了Android实现用Android手机控制PC端的关机和重启的的大概功能,现在我们来实现Android客户端的代码。

首先来看看整个项目的结构,如下图所示:

                   

第一步:扫描局域网内所有PC,看是否有PC端的服务器在运行并监听30000端口。

此界面的布局文件为:/res/layout/layout_scanip.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent" >
  5. <RelativeLayout
  6. android:id="@+id/ll"
  7. android:layout_width="200dp"
  8. android:layout_height="100dp"
  9. android:layout_centerHorizontal="true"
  10. android:layout_centerVertical="true"
  11. android:orientation="vertical" >
  12. <LinearLayout
  13. android:layout_width="wrap_content"
  14. android:layout_height="wrap_content"
  15. android:layout_centerHorizontal="true"
  16. android:layout_centerVertical="true"
  17. android:orientation="vertical" >
  18. <TextView
  19. android:layout_width="wrap_content"
  20. android:layout_height="wrap_content"
  21. android:text="@string/scaning" />
  22. <ProgressBar
  23. android:id="@+id/progressBar"
  24. style="?android:attr/progressBarStyleHorizontal"
  25. android:layout_width="100dp"
  26. android:layout_height="1dp" />
  27. </LinearLayout>
  28. </RelativeLayout>
  29.  
  30. </RelativeLayout>

扫描IP的Activity为com.oyp.shutdown.ScanActivity,代码如下:

  1. package com.oyp.shutdown;
  2.  
  3. import java.io.IOException;
  4. import java.net.InetSocketAddress;
  5. import java.net.Socket;
  6.  
  7. import android.app.Activity;
  8. import android.content.Intent;
  9. import android.os.Bundle;
  10. import android.os.Handler;
  11. import android.os.Message;
  12. import android.view.Window;
  13. import android.widget.ProgressBar;
  14. import android.widget.Toast;
  15.  
  16. public class ScanActivity extends Activity {
  17. private MyWifiManager myWifiManager = null;
  18. private String serverIP = "", resultIP = "";
  19. private ScanIPThread scanThread = null;
  20. private ProgressBar progressBar;
  21.  
  22. @Override
  23. protected void onCreate(Bundle savedInstanceState) {
  24. super.onCreate(savedInstanceState);
  25. getWindow().requestFeature(Window.FEATURE_NO_TITLE);
  26. int height = getWindow().getWindowManager().getDefaultDisplay()
  27. .getHeight();
  28. int width = getWindow().getWindowManager().getDefaultDisplay()
  29. .getWidth();
  30. setContentView(R.layout.layout_scanip);
  31. progressBar = (ProgressBar) findViewById(R.id.progressBar);
  32. myWifiManager = new MyWifiManager(ScanActivity.this);
  33. scanThread = new ScanIPThread();
  34. scanThread.start();
  35. }
  36.  
  37. private Handler handler = new Handler() {
  38. @Override
  39. public void handleMessage(Message msg) {
  40. switch (msg.what) {
  41. case 1000:
  42. Toast.makeText(ScanActivity.this, getString(R.string.find),
  43. Toast.LENGTH_SHORT).show(); // 找到可连接PC
  44. Intent controlIntent = new Intent(ScanActivity.this,
  45. ControlActivity.class);
  46. // 将可以连接的ip发过去
  47. controlIntent.putExtra("ip", (String) msg.obj);
  48. startActivity(controlIntent);
  49. finish();
  50. break;
  51. case 2000:
  52. Toast.makeText(ScanActivity.this, getString(R.string.notFind),
  53. Toast.LENGTH_SHORT).show(); // 没有找到可连接PC
  54. Intent reScanIntent = new Intent(ScanActivity.this,
  55. ReScanActivity.class);
  56. startActivity(reScanIntent);
  57. finish();
  58. break;
  59. default:
  60. progressBar.setMax(254);
  61. progressBar.setProgress(msg.what);
  62. break;
  63. }
  64. super.handleMessage(msg);
  65. }
  66. };
  67.  
  68. // 扫描连接的WiFi所在网段开启了30000端口的C类ip
  69. // 例如,wifi的ip是192.168.1.1 则扫描 192.168.1.1-192.168.1.254
  70. class ScanIPThread extends Thread {
  71. @Override
  72. public void run() {
  73. serverIP = myWifiManager.getServerIp();
  74. int t = serverIP.lastIndexOf(".") + 1;
  75. resultIP = serverIP.substring(0, t);
  76. boolean flag = false;
  77. for (int i = 1; i < 255; i++) {
  78. try {
  79. Socket socket = new Socket();
  80. InetSocketAddress s = new InetSocketAddress(resultIP + i,
  81. 30000);
  82. socket.connect(s, 50);
  83. Message message = new Message();
  84. message.what = 1000;
  85. message.obj = resultIP + i;
  86. handler.sendMessage(message);
  87. flag = true;
  88. socket.close();
  89. break;
  90. } catch (IOException e) {
  91. handler.sendEmptyMessage(i);
  92. }
  93. }
  94. if (!flag) {
  95. handler.sendEmptyMessage(2000);
  96. }
  97. super.run();
  98. }
  99. }
  100. }

第二步:如果没有扫描到有PC端的服务器在运行并监听30000端口,则重新扫描或者退出。如上述代码中,当msg.what=2000时,重新进行扫描。

此界面的布局文件为:/res/layout/layout_rescan.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="wrap_content"
  4. android:layout_height="wrap_content"
  5. android:orientation="vertical" >
  6.  
  7. <Button
  8. android:id="@id/btnReScan"
  9. style="@style/StyleButton"
  10. android:text="@string/rescan" />
  11.  
  12. <Button
  13. android:id="@id/btnClose"
  14. style="@style/StyleButtonClose"
  15. android:text="@string/close" />
  16.  
  17. </LinearLayout>

重新扫描IP的Activity为com.oyp.shutdown.ReScanActivity,代码如下:

  1. package com.oyp.shutdown;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.view.View.OnClickListener;
  8. import android.view.Window;
  9. import android.widget.Button;
  10.  
  11. public class ReScanActivity extends Activity implements OnClickListener {
  12. private Button btn_rescan, btn_close;
  13.  
  14. @Override
  15. protected void onCreate(Bundle savedInstanceState) {
  16. super.onCreate(savedInstanceState);
  17. getWindow().requestFeature(Window.FEATURE_LEFT_ICON);
  18. setContentView(R.layout.layout_rescan);
  19. getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
  20. R.drawable.acticon);
  21.  
  22. btn_rescan = (Button) findViewById(R.id.btnReScan);
  23. btn_close = (Button) findViewById(R.id.btnClose);
  24.  
  25. btn_rescan.setOnClickListener(this);
  26. btn_close.setOnClickListener(this);
  27. }
  28.  
  29. @Override
  30. public void onClick(View v) {
  31. switch (v.getId()) {
  32. case R.id.btnReScan:
  33. Intent intent = new Intent(ReScanActivity.this,ScanActivity.class);
  34. startActivity(intent);
  35. finish();
  36. break;
  37. case R.id.btnClose:
  38. finish();
  39. break;
  40. default:
  41. break;
  42. }
  43. }
  44. }

第二步:扫描到了有PC端的服务器在运行并监听30000端口,则控制PC端关机、重启或者取消关机。如上述代码中,当msg.what=1000时,则打开控制PC端界面。

此界面的布局文件为:/res/layout/layout_control.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="wrap_content"
  4. android:layout_height="wrap_content"
  5. android:orientation="vertical" >
  6.  
  7. <Button
  8. android:id="@id/btnShutdown"
  9. style="@style/StyleButton"
  10. android:text="@string/shutdown" />
  11.  
  12. <Button
  13. android:id="@id/btnReboot"
  14. style="@style/StyleButton"
  15. android:text="@string/reboot" />
  16.  
  17. <Button
  18. android:id="@id/btnCancel"
  19. style="@style/StyleButton"
  20. android:text="@string/cancel" />
  21.  
  22. <Button
  23. android:id="@id/btnClose"
  24. style="@style/StyleButtonClose"
  25. android:text="@string/close" />
  26.  
  27. <TextView
  28. android:layout_width="wrap_content"
  29. android:layout_height="wrap_content"
  30. android:layout_gravity="center_horizontal"
  31. android:layout_marginBottom="6.0dip"
  32. android:text=" "
  33. android:textSize="12.0dip" />
  34.  
  35. </LinearLayout>

控制PC端的Activity为com.oyp.shutdown.ControlActivity,代码如下:

  1. package com.oyp.shutdown;
  2.  
  3. import java.io.DataInputStream;
  4. import java.io.DataOutputStream;
  5. import java.io.IOException;
  6. import java.net.Socket;
  7.  
  8. import android.app.Activity;
  9. import android.content.Intent;
  10. import android.os.Bundle;
  11. import android.os.Handler;
  12. import android.os.Message;
  13. import android.view.View;
  14. import android.view.View.OnClickListener;
  15. import android.view.Window;
  16. import android.widget.Button;
  17. import android.widget.Toast;
  18.  
  19. public class ControlActivity extends Activity implements OnClickListener {
  20. private Button btn_shutdown, btn_restart, btn_cancel, btn_close;
  21. private Socket clientSocket;// 客户端socket
  22. private DataOutputStream dataOutput = null;// 客户端发送数据
  23. private DataInputStream dataInput = null;// 客户端接收数据
  24. private String connIP = "";
  25. private ConnThread connThread = null;
  26. private Handler handler = new Handler() {
  27. @Override
  28. public void handleMessage(Message msg) {
  29. switch (msg.what) {
  30. case 1:
  31. Toast.makeText(ControlActivity.this, (String) msg.obj,
  32. Toast.LENGTH_SHORT).show();
  33. break;
  34. default:
  35. break;
  36. }
  37. super.handleMessage(msg);
  38. }
  39. };
  40.  
  41. @Override
  42. public void onCreate(Bundle savedInstanceState) {
  43. super.onCreate(savedInstanceState);
  44. getWindow().requestFeature(Window.FEATURE_LEFT_ICON);
  45. setContentView(R.layout.layout_control);
  46. getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
  47. R.drawable.acticon);
  48.  
  49. btn_shutdown = (Button) findViewById(R.id.btnShutdown);
  50. btn_restart = (Button) findViewById(R.id.btnReboot);
  51. btn_cancel = (Button) findViewById(R.id.btnCancel);
  52. btn_close = (Button) findViewById(R.id.btnClose);
  53.  
  54. Intent intent = getIntent();
  55. connIP = intent.getStringExtra("ip");
  56.  
  57. btn_shutdown.setOnClickListener(this);
  58. btn_restart.setOnClickListener(this);
  59. btn_cancel.setOnClickListener(this);
  60. btn_close.setOnClickListener(this);
  61. }
  62.  
  63. @Override
  64. public void onClick(View v) {
  65. // 连接服务器
  66. switch (v.getId()) {
  67. case R.id.btnShutdown:
  68. final String shutdown = "shutdown";
  69. if (connThread != null) {
  70. connThread.interrupt();
  71. }
  72. connThread = new ConnThread(connIP, 30000, shutdown);
  73. connThread.start();
  74. break;
  75. case R.id.btnReboot:
  76. final String reboot = "reboot";
  77. if (connThread != null) {
  78. connThread.interrupt();
  79. }
  80. connThread = new ConnThread(connIP, 30000, reboot);
  81. connThread.start();
  82. break;
  83. case R.id.btnCancel:
  84. final String cancel = "cancel";
  85. if (connThread != null) {
  86. connThread.interrupt();
  87. }
  88. connThread = new ConnThread(connIP, 30000, cancel);
  89. connThread.start();
  90. break;
  91. case R.id.btnClose:
  92. finish();
  93. break;
  94. default:
  95. break;
  96. }
  97. }
  98.  
  99. class ConnThread extends Thread {
  100. private String ip;
  101. private int port;
  102. private String content;
  103.  
  104. public ConnThread(String ip, int port, String content) {
  105. this.ip = ip;
  106. this.port = port;
  107. this.content = content;
  108. }
  109.  
  110. @Override
  111. public void run() {
  112. try {
  113. clientSocket = new Socket(ip, port);
  114. while (true) {
  115. dataOutput = new DataOutputStream(
  116. clientSocket.getOutputStream());
  117. dataInput = new DataInputStream(
  118. clientSocket.getInputStream());
  119. String msg = "";
  120. if ((dataOutput != null) && (!content.equals(""))) {
  121. dataOutput.writeUTF(content);
  122. }
  123. msg = dataInput.readUTF();
  124. if (msg != null && !"".equals(msg)) {
  125. Message message = new Message();
  126. message.what = 1;
  127. message.obj = msg;
  128. handler.sendMessage(message);
  129. }
  130. }
  131. } catch (Exception e) {
  132. e.printStackTrace();
  133. } finally {
  134. try {
  135. if (dataOutput != null) {
  136. dataOutput.close();
  137. }
  138. if (dataInput != null) {
  139. dataInput.close();
  140. }
  141. if (clientSocket != null) {
  142. clientSocket = null;
  143. }
  144. } catch (IOException e) {
  145. e.printStackTrace();
  146. }
  147. }
  148. super.run();
  149. }
  150. }
  151. }

其中MyWifiManager.java代码如下:

  1. package com.oyp.shutdown;
  2.  
  3. import android.content.Context;
  4. import android.net.DhcpInfo;
  5. import android.net.wifi.WifiInfo;
  6. import android.net.wifi.WifiManager;
  7.  
  8. public class MyWifiManager {
  9.  
  10. private WifiManager wifiManager;
  11. private WifiInfo wifiInfo;
  12. private DhcpInfo dhcpInfo;
  13. public MyWifiManager(Context context){
  14. wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
  15. wifiInfo = wifiManager.getConnectionInfo();
  16. dhcpInfo = wifiManager.getDhcpInfo();
  17. }
  18. //得到本机ip
  19. public String getLocalIp(){
  20. return FormatString(dhcpInfo.ipAddress);
  21. }
  22. //得到服务器ip(热点ip)
  23. public String getServerIp(){
  24. return FormatString(dhcpInfo.serverAddress);
  25. }
  26. //转换ip格式为*.*.*.*
  27. public String FormatString(int value){
  28. String strValue="";
  29. byte[] ary = intToByteArray(value);
  30. for(int i=ary.length-1;i>=0;i--){
  31. strValue+=(ary[i]&0xFF);
  32. if(i>0){
  33. strValue+=".";
  34. }
  35. }
  36. return strValue;
  37. }
  38. public byte[] intToByteArray(int value){
  39. byte[] b=new byte[4];
  40. for(int i=0;i<4;i++){
  41. int offset = (b.length-1-i)*8;
  42. b[i]=(byte) ((value>>>offset)&0xFF);
  43. }
  44. return b;
  45. }
  46. }

定义控件ID的文件为/res/values/id.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <resources>
  3. <item type="id" name="btnAirplane">false</item>
  4. <item type="id" name="btnShutdown">false</item>
  5. <item type="id" name="btnReScan">false</item>
  6. <item type="id" name="btnCancel">false</item>
  7. <item type="id" name="btnReboot">false</item>
  8. <item type="id" name="btnRecovery">false</item>
  9. <item type="id" name="btnBootloader">false</item>
  10. <item type="id" name="btnClose">false</item>
  11. </resources>

/res/values/strings.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <resources>
  3. <string name="app_name">控制PC</string>
  4. <string name="shutdown">关机</string>
  5. <string name="rescan">重新扫描</string>
  6. <string name="reboot">重启</string>
  7. <string name="cancel">取消</string>
  8. <string name="please_wait">请稍等......</string>
  9. <string name="warning">错误</string>
  10. <string name="root">无法获得 Root 权限!</string>
  11. <string name="close">退出</string>
  12. <string name="ok">确定</string>
  13. <string name="scaning">正在扫描......</string>
  14. <string name="find">找到可连接PC.</string>
  15. <string name="notFind">没有找到可连接PC</string>
  16. </resources>

/res/values/styles.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <resources>
  3. <style name="StyleButton">
  4. <item name="android:textSize">16.0dip</item>
  5. <item name="android:textStyle">bold</item>
  6. <item name="android:textColor">#ffffffff</item>
  7. <item name="android:layout_gravity">center_horizontal</item>
  8. <item name="android:background">@drawable/btn_selector</item>
  9. <item name="android:layout_width">wrap_content</item>
  10. <item name="android:layout_height">wrap_content</item>
  11. <item name="android:layout_marginLeft">30.0dip</item>
  12. <item name="android:layout_marginRight">30.0dip</item>
  13. <item name="android:layout_marginBottom">8.0dip</item>
  14. </style>
  15. <style name="StyleButtonClose">
  16. <item name="android:textSize">16.0dip</item>
  17. <item name="android:textStyle">bold</item>
  18. <item name="android:textColor">#ffffffff</item>
  19. <item name="android:layout_gravity">center_horizontal</item>
  20. <item name="android:background">@drawable/btn_close_selector</item>
  21. <item name="android:layout_width">wrap_content</item>
  22. <item name="android:layout_height">wrap_content</item>
  23. <item name="android:layout_marginLeft">30.0dip</item>
  24. <item name="android:layout_marginRight">30.0dip</item>
  25. <item name="android:layout_marginBottom">8.0dip</item>
  26. </style>
  27. </resources>

项目描述文件:AndroidManifest.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3. package="com.oyp.shutdown"
  4. android:versionCode="1"
  5. android:versionName="1.0" >
  6.  
  7. <uses-sdk android:minSdkVersion="8" />
  8.  
  9. <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
  10. <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  11. <uses-permission android:name="android.permission.INTERNET" />
  12.  
  13. <application
  14. android:allowBackup="true"
  15. android:icon="@drawable/icon"
  16. android:label="@string/app_name" >
  17. <activity
  18. android:name=".ScanActivity"
  19. android:theme="@android:style/Theme.Dialog" >
  20. <intent-filter>
  21. <action android:name="android.intent.action.MAIN" />
  22. <category android:name="android.intent.category.LAUNCHER" />
  23. </intent-filter>
  24. </activity>
  25. <activity
  26. android:name=".ReScanActivity"
  27. android:icon="@drawable/icon"
  28. android:label="@string/app_name"
  29. android:theme="@android:style/Theme.Dialog" >
  30. </activity>
  31. <activity
  32. android:name=".ControlActivity"
  33. android:icon="@drawable/icon"
  34. android:label="@string/app_name"
  35. android:theme="@android:style/Theme.Dialog" >
  36. </activity>
  37. </application>
  38. </manifest>

代码可以在此处下载:Android实现用Android手机控制PC端的关机和重启的功能  地址:(http://download.csdn.net/detail/qq446282412/8923991)


                            ====================================================================================

  作者:欧阳鹏  欢迎转载,与人分享是进步的源泉!

  转载请保留原文地址:http://blog.csdn.net/ouyang_peng

====================================================================================

 

我的Android进阶之旅------>Android实现用Android手机控制PC端的关机和重启的功能(三)Android客户端功能实现的更多相关文章

  1. 我的Android进阶之旅------&gt;Android实现用Android手机控制PC端的关机和重新启动的功能(二)Androidclient功能展示

    Androidclient的实现思路大致例如以下: 1.首先扫描局域网内全部PC,看是否有PC端的server在执行并监听30000port. watermark/2/text/aHR0cDovL2J ...

  2. [置顶] 我的Android进阶之旅------>介绍一款集录制与剪辑为一体的屏幕GIF 动画制作工具 GifCam

    由于上一篇文章:我的Android进阶之旅------>Android之动画之Frame Animation实例 中展示的是Frame动画效果,但是之前我是将图片截取下来,不好说明确切的动画过程 ...

  3. 我的Android进阶之旅------&gt; Android在TextView中显示图片方法

    面试题:请说出Android SDK支持哪些方式显示富文本信息(不同颜色.大小.并包括图像的文本信息).并简要说明实现方法. 答案:Android SDK支持例如以下显示富文本信息的方式. 1.使用T ...

  4. 【我的Android进阶之旅】推荐一款视频转换GIF图片格式的转换工具(Video to GIF)

    一.背景 最近想把一些Android Demo的运行效果图获取下来,但是一直使用真机进行调试,在电脑上不好截取一段gif动画.而之前使用模拟器的时候可以使用 GifCam 工具进行屏幕动画截取.Gif ...

  5. 我的Android进阶之旅------&gt;Android字符串资源中的单引號问题error: Apostrophe not preceded by 的解决的方法

    刚刚在string字符串资源文件里,写了一个单引號.报错了,错误代码例如以下 error: Apostrophe not preceded by \ (in OuyangPeng's blog ) 资 ...

  6. 我的Android进阶之旅------>Android颜色值(#AARRGGBB)透明度百分比和十六进制对应关系以及计算方法

    我的Android进阶之旅-->Android颜色值(RGB)所支持的四种常见形式 透明度百分比和十六进制对应关系表格 透明度 十六进制 100% FF 99% FC 98% FA 97% F7 ...

  7. 我的Android进阶之旅------>解决Jackson等第三方转换Json的开发包在开启混淆后转换的实体类数据都是null的bug

    1.错误描述 今天测试人员提了一个bug,说使用我们的app出现了闪退的bug,后来通过debug断点调试,发现我们的app转换服务器发送过来的json数据后,都是为null.而之前已经提测快一个月的 ...

  8. 我的Android进阶之旅------>关于android:layout_weight属性的详细解析

    关于androidlayout_weight属性的详细解析 效果一 效果二 图3的布局代码 图4的布局代码 效果三 图7代码 图8代码 效果四 效果五 版权声明:本文为[欧阳鹏]原创文章,欢迎转载,转 ...

  9. 我的Android进阶之旅------>如何解决Android 5.0中出现的警告: Service Intent must be explicit:

    我的Android进阶之旅-->如何解决Android 5.0中出现的警告: java.lang.IllegalArgumentException: Service Intent must be ...

随机推荐

  1. osx中Grapher的使用

    Grapher 是一个可创建方程图形的应用程序,因此您能够使结果可视化.您能够输入各种数学函数,以二维和三维图形方式查看它们. 您甚至能够让图形动起来.用图形制作影片文件. 打开osx中的Graphe ...

  2. [PWA] Add Push Notifications to a PWA with React in Chrome and on Android

    On Android and in Chrome (but not on iOS), it's possible to send push notifications with a PWA. We'l ...

  3. 网络相关系列之中的一个:Android中使用HttpClient发送HTTP请求

    一.HTTP协议初探: HTTP(Hypertext Transfer Protocol)中文 "超文本传输协议",是一种为分布式,合作式,多媒体信息系统服务,面向应用层的协议,是 ...

  4. oc 之中的 汉字字符串转化成为拼音 汉字字符串的排序

    在oc 之中的字符串为汉字的时候,我们经常要进行字符串比較,可是汉字不能比較,所以就要将汉字转化成为拼音,详细步骤例如以下: //可变字符串 必须是可变字符串.     NSMutableString ...

  5. IO流(一)File类

    1.File类:表示文件和目录路径的抽象的表示形式,可以实现文件的创建,删除,重命名等,是唯一与文件本 有关的操作类. 2.File类的API定义:public class File extends ...

  6. Angular 学习笔记——表单验证

    <!DOCTYPE html> <html lang="en" ng-app="myApp"> <head> <met ...

  7. JAVA经常使用集合框架使用方法具体解释基础篇二之Colletion子接口List

    接着上一篇,接着讲讲集合的知识.上一篇讲了Collection接口.它能够说是集合的祖先了,我们这一篇就说说它的子孙们. 一.Collection的子接口 List:有序(存入和取出的顺序一致).元素 ...

  8. 文件json

    import jsondef op_data(filename,dic=None): if dic:#写入进去 with open(filename,'w',encoding='utf-8') as ...

  9. Unhandled event loop exception No more handles 解决办法

    1 http://stackoverflow.com/questions/9074189/unhandled-event-loop-exception-in-plugin-org-eclipse-ui ...

  10. ubuntu16.04 安装系统之后的开发必备-sourcelist--idk-sublime--opencv

    设置sourcelist.txt # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释deb https://mirrors.tuna.tsinghua.edu.cn/ub ...