码迷,mamicode.com
首页 >  
搜索关键字:switch case    ( 15339个结果)
Python笔记:替代case语句的字典和匿名函数(lambda)
在linux的shell中我们习惯使用case语句来做分支处理,然而Python中却省略了这个函数,经过多方查找,发现其实case语句在C语言中是通过查对应的hash表,来进行跳转的。在Python中我们可以通过三种方法来实现这种功能。1、字典;2、lambda;3、switch类。1、字典dictCase={‘case1..
分类:编程语言   时间:2014-08-12 17:41:15    阅读次数:487
LVS多VIP脚本
#!/bin/bash #description:Configrealserverloandapplynoarp SNS_VIP=( 192.168.100.210 192.168.100.220 ) case"$1"in start) for((i=0;i<`echo${#SNS_VIP[*]}`;i++)) do interface="lo:`echo${SNS_VIP[$i]}|awk-F.‘{print$4}‘`" /sbin/ifconfig$interface${SNS_VIP[$i]}br..
分类:其他好文   时间:2014-08-12 17:37:45    阅读次数:205
调用Camera返回为空的分析及处理方法
前言 大家可能遇到了这样的情况,调用Camera,然后指定自定义的保存路径,结果返回的Intent为空。我们来分析一下原因。 分析 首先看Camera的部分逻辑,在源码中的Camera.java的doAttach()方法里面。   // First handle the no crop case -- just return the value. If the // caller sp...
分类:其他好文   时间:2014-08-12 17:30:54    阅读次数:276
Python流程控制 if / for/ while
在Python中没有switch语句If语句if condition:do sthelif condition: Do sthelse: Do sthwhile语句有一个可选的else从句while condition: do sthelse: do sthfor循环for i in range(1...
分类:编程语言   时间:2014-08-12 16:38:44    阅读次数:193
UML类图学习
UML(Unified Modeling Language)统一建模语言。包括以下几个重要功能:可视化功能(Visualizing)说明功能(specifying)建造功能(Construting)建文档功能(Documenting)UML包括:使用案例图(User case diagrams)类图...
分类:其他好文   时间:2014-08-12 13:17:24    阅读次数:309
为SecureCRT做脚本实现在交换机上自动ping服务器网卡
进入交换机后,在SecureCRT中点击执行脚本,找到文件.vbs,脚本内容如下#$Language="VBScript"#$Interface="1.0"crt.Screen.Synchronous=TrueSubMain() Dimnum Fornum=1To40Step1 crt.Screen.Send"ping192.168.100."&num&chr(13) crt.Screen.WaitForString"Switch>"..
分类:其他好文   时间:2014-08-12 03:29:53    阅读次数:347
划分树模板题
原题http://poj.org/problem?id=2104 K-th Number Time Limit: 20000MS   Memory Limit: 65536K Total Submissions: 37130   Accepted: 11974 Case Time Limit: 2000MS Description ...
分类:其他好文   时间:2014-08-11 17:57:42    阅读次数:233
学MFC之前必须会的金典创建窗口程序的过程代码
#include // 窗口过程函数 LRESULT CALLBACK MyWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_DESTROY: PostQuitMessage (0); return 0; case WM_PAINT: PAINTSTRU...
分类:其他好文   时间:2014-08-11 12:03:12    阅读次数:175
Android 简述touch事件中的MotionEvent
有关touchEvent的事件里都有一个 MotionEvent 参数,下面来简单介绍一下它的属性的一些含义和使用的方法 通常单指操作时,一般如下: switch (event.getAction()) {//第一个触摸点 case MotionEvent.ACTION_DOWN: //按下 = 0 float x = event.getX(); break; case Mo...
分类:移动开发   时间:2014-08-11 12:00:02    阅读次数:199
linq中使用case when
select中使用case whenlinq代码:Products.Select(P => new{ID = P.ProductID,Name = P.Name,Color = P.Color,Price = (P.Color == "Red" ? P.StandardCost : (P.Color...
分类:其他好文   时间:2014-08-11 11:39:02    阅读次数:726
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!