pwd

Asp.net WebApi的授权安全机制 Basic认证

青春壹個敷衍的年華 提交于 2019-12-03 07:03:47
1:Home/index.cshtml下面的Html代码 <div> <input value="1点击先登陆" type="button" id="btnLogin"/><br /> <input value="2再点击授权后调用接口" type="button" id="btnAuthenrazation" /><br /> </div>       2:Home/index 下面的HomeController [skipLogAttribute] public ActionResult Index() { return View(); } 3: Ajax的模拟代码,先登录,后获取授权,再带上Ticket,后台过滤器校验ok杂可以请求对应的接口 <script type="text/javascript"> $(function () { var ticket = ""; $("#btnLogin").click(function () { //---登陆的操作 $.ajax({ url: "http://localhost:8899/api/values", data: { "uid": "zrf", "pwd": "123" }, type: "get", success: function (res) { if (res.result) { ticket = res

shell script: bad interpreter: No such file or directory when using pwd

吃可爱长大的小学妹 提交于 2019-12-03 06:15:40
I want to go through the files in a directory with a for loop but this comes up. echo: bad interpreter: No such file or directory code: #!/bin/bash count=0 dir=`pwd` echo "$dir" FILES=`ls $dir` for file in $FILES do if [ -f $file ] then count=$(($count + 1)) fi done echo $count Better do : #!/bin/bash count=0 dir="$PWD" echo "$dir" for file in "$dir"/* do if [[ -f $file ]] then ((count++)) fi done echo $count or a simplest/shortest solution : #!/bin/bash echo "$PWD" for file; do [[ -f $file ]] && ((count++)) done echo $count I had the same problem. Removing #!/bin/bash did the trick for me. It

shell init issue when click tab, what's wrong with getcwd?

不问归期 提交于 2019-12-03 02:29:09
问题 once i click Tab on bash, the error message will appear, what's wrong? symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: Success symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: Success symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: Success symlink

Hello world kernel module for android &amp; unknown relocation: 27 when insmod

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to create a simple kernel module. I am trying to print messages to dmesg but i keep getting insmod: init_module 'hello.ko' failed (Exec format error) in android after : dmesg: unknown relocation: 27 #include <linux/module.h> #include <linux/kdb.h> int init_module(void) { printk(KERN_ALERT "Hello world!\n"); return 1; } void cleanup_module(void) { printk(KERN_INFO "Goodbye world 1.\n"); } MODULE_AUTHOR("Robert P. J. Day"); MODULE_LICENSE("Dual BSD/GPL"); MODULE_VERSION("2:1.0") ; MODULE_DESCRIPTION("You have to start somewhere.");

No code coverage with Mac OS X Lion and XCode 4 / llvm-g++-4.2

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Other people have reported not being able to generate code coverage with XCode 4 , but I find not only can I not do it from within XCode 4, I can't do it even with a simple toy program from the command line. I followed the examples given here and here , which led me to create this cov.c file: #include int main (void) { int i; for (i = 1; i I then used the following commands in an attempt to generate code coverage: g++ -c -g -O0 --coverage -o $PWD/obj/cov.o $PWD/cov.c g++ -g -O0 --coverage -o $PWD/bin/cov $PWD/obj/*.o $PWD/bin/cov Alas, no

用户登录之密码加密

匿名 (未验证) 提交于 2019-12-03 00:43:02
import hashlib def md5(arg):   ooo = hashlib.md5(bytes(‘qazwsx‘,encoding=‘utf-8‘))   ooo.update(bytes(‘arg‘,encoding=‘utf-8‘))   return ooo.hexdigest() def login(user,pwd):   with open(‘db‘,‘r‘,encoding=‘utf-8‘) as f:     for line in f:       u,p = line.strip().split(‘|‘)       if u ==user and p ==md5(pwd):         return Ture def register(user,pwd):   with open(‘db‘,‘a‘,encoding=‘utf-8‘) as f:     temp = user + ‘|‘ +md5(pwd)     f.write(temp) i = input (‘1,登录;2,注册‘) if i==2:   user = input(‘用户名:‘)   pwd = input(‘密码:’)   register(user,pwd) elif i==1:   user = input(‘用户名:‘)   pwd = input(‘密码:’)

auth组件

蹲街弑〆低调 提交于 2019-12-03 00:32:01
auth组件 -auth是什么? -django内置的用户认证系统,可以快速的实现,登录,注销,修改密码.... -怎么用? -(1)先创建超级用户: -python3 manage.py createsuperuser -输入用户名,邮箱(可以不输入),密码,敲回车,这样就创建出一个超级用户 -也就是在auth_user这个表中插入了一条数据(密码是加密的,所以我不能手动插入) -(2)验证用户: -from django.contrib import auth -user = auth.authenticate(request, username=name, password=pwd) -相当于在查询:user=models.User.objects.filter(name=name,pwd=pwd).first() -如果校验通过,会返回一个user对象,通过判断user对象,校验是否验证成功 -(3)登录 -auth.login(request,user) -其实就是在session中写了一条数据 -(4)一旦登录成功,调了这个函数login(request,user) -以后再视图类,函数中的request对象中,就有一个user对象,就是当前登录的用户对象 -如果没有登录,request.user=AnonymousUser,匿名用户 -(5)注销 -auth

Asp.net WebApi的授权安全机制 Basic认证

匿名 (未验证) 提交于 2019-12-03 00:16:01
1:Home/index.cshtml下面的Html代码 <div> <input value="1点击先登陆" type="button" id="btnLogin"/><br /> <input value="2再点击授权后调用接口" type="button" id="btnAuthenrazation" /><br /> </div>       2:Home/index 下面的HomeController [skipLogAttribute] public ActionResult Index() { return View(); } 3: Ajax的模拟代码,先登录,后获取授权,再带上Ticket,后台过滤器校验ok杂可以请求对应的接口 <script type="text/javascript"> $(function () { var ticket = ""; $("#btnLogin").click(function () { //---登陆的操作 $.ajax({ url: "http://localhost:8899/api/values", data: { "uid": "zrf", "pwd": "123" }, type: "get", success: function (res) { if (res.result) { ticket = res

django Q查询补充

匿名 (未验证) 提交于 2019-12-02 23:42:01
第一种方式     models.UserInfo.objects.filter(Q(Q(username=u)&Q(pwd=p))|Q(Q(emial=u)&Q(pwd=p))) 第二种方式     con = Q()     q1 = Q()     q1.connector = 'AND'     q1.children.append(('username', u))     q1.children.append(('pwd', p))     # Q(Q(username=u)&Q(pwd=p))     q2 = Q()     q2.connector = 'AND'     q2.children.append(('email',e))     q2.children.append(('pwd', p))     # Q(Q(email=e)&Q(pwd=p))     con.add(q1, 'OR')     con.add(q2, 'OR')     models.UserInfo.objects.filter(con)

yaml自定义与读取

匿名 (未验证) 提交于 2019-12-02 23:32:01
基本语法: 大小写敏感 使用缩进表示层级关系 缩进时不允许使用tab键,只能使用空格 缩进的空格数目不重要,只要相同层级的元素左对齐即可 '#' 表示注释,与python类似 支持的数据结构: 对象: 键值对的集合,又称字典 数组: 列表/序列 纯量: 单个的、不可再分的值。字符串、布尔值、整数、浮点数 pip instal pyyaml # python { "user": "admin", "pwd": "123456", } # yaml user: admin pwd: 123456 字典嵌套字典 # python "nb1":{ "user": "admin", "pwd": "123456", } # yaml nb1: user: admin pwd: 123456 yaml里面写一个数组,前面加一个'-'符号 - admin1: 123 - admin2: 345 int/float: n1: 12.30 bool: n2: true None: n4: ~ 强制转换类型: n6: !!str 123 , int->str list嵌套dict # yaml - user: admin1 pwd: '123' - user: admin2 pwd: '234' - user: admin3 pwd: '413' 用python读出来的结果 [ {'user':