有一个带有服务器数据库的网站.我正在构建一个桌面应用程序,它使用其中一个表中的数据.黑客可以从汇编中获取密码.
我该如何保护数据库?
似乎在调用后两个结果都是一样的.
这段代码出了什么问题?
>>> from urllib.request import urlopen
>>> for line in urlopen("http://google.com/"):
print(line.decode("utf-8"))
<!doctype html><html><head><meta http-equiv="content-type" content="text/html; charset=windows-1251"><title>Google</title><script>window.google={kEI:"XMECT7XyDcGn0AWFk7ywAQ",getEI:function(a){var b;while(a&&!(a.getAttribute&&(b=a.getAttribute("eid"))))a=a.parentNode;return b||google.kEI},https:function(){return window.location.protocol=="https:"},kEXPI:"33492,35300",kCSI:{e:"33492,35300",ei:"XMECT7XyDcGn0AWFk7ywAQ"},authuser:0,
ml:function(){},kHL:"uk",time:function(){return(new Date).getTime()},log:function(a,b,c,e){var d=new Image,g=google,h=g.lc,f=g.li,j="";d.onerror=(d.onload=(d.onabort=function(){delete h[f]}));h[f]=d;if(!c&&b.search("&ei=")==-1)j="&ei="+google.getEI(e);var i=c||"/gen_204?atyp=i&ct="+a+"&cad="+b+j+"&zx="+google.time(),k=/^http:/i;if(k.test(i)&&google.https()){google.ml(new Error("GLMM"),false,{src:i});
delete h[f];return}d.src=i;g.li=f+1},lc:[],li:0,Toolbelt:{},y:{},x:function(a,b){google.y[a.id]=
[a,b];return false}};
window.google.sn="webhp";window.google.timers={};window.google.startTick=function(a,b){window.google.timers[a]={t:{start:(new Date).getTime()},bfr:!(!b)}};window.google.tick=function(a,b,c){if(!window.google.timers[a])google.startTick(a);window.google.timers[a].t[b]=c||(new Date).getTime()};google.startTick("load",true);try{}catch(u){}
var _gjwl=location;function _gjuc(){var e=_gjwl.href.indexOf("#");if(e>=0){var a=_gjwl.href.substring(e);if(a.indexOf("&q=")>0||a.indexOf("#q=")>=0){a=a.substring(1);if(a.indexOf("#")==-1){for(var c=0;c<a.length;){var d=c;if(a.charAt(d)=="&")++d;var b=a.indexOf("&",d);if(b==-1)b=a.length;var f=a.substring(d,b);if(f.indexOf("fp=")==0){a=a.substring(0,c)+a.substring(b,a.length);b=c}else if(f=="cad=h")return 0;c=b}_gjwl.href="/search?"+a+"&cad=h";return 1}}}return 0}function _gjp(){!(window._gjwl.hash&&
window._gjuc())&&setTimeout(_gjp,500)};
Traceback (most recent call last):
File "<pyshell#109>", line 2, in <module>
print(line.decode("utf-8"))
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc2 in position 2364: invalid continuation byte
Run Code Online (Sandbox Code Playgroud) 我正在使用Quickblox创建一个简单的聊天应用程序.
所以我将项目添加到XCode中,就像在本教程中一样:http://quickblox.com/developers/IOS-how-to-connect-Quickblox-framework
QBUsers类工作得很好,但是当我使用QBChat时,我开始遇到链接器错误:
体系结构i386的未定义符号:"operator delete(void*)",引自: - Quickblox中的[QBVideoChat initAudioCapture](QBVideoChat.o)"operator new(unsigned long)",引自: - Quickblox中的[QBVideoChat initAudioCapture]( QBVideoChat.o)"___ gxx_personality_v0",引自:Quickblox中的Dwarf异常展开信息(__eh_frame)(QBVideoChat.o)ld:未找到架构i386 clang的符号:错误:链接器命令失败,退出代码为1(使用 - v看看调用)
这是导致问题的那一行(如果我将其注释掉,链接器错误就会消失):
[[QBChat instance] setDelegate:self];
Run Code Online (Sandbox Code Playgroud)
发生问题的类实现以下协议:
<QBActionStatusDelegate, QBChatDelegate>
Run Code Online (Sandbox Code Playgroud)
这是我导入项目的框架列表:
-lxml2 -lresolv -lz -framework AVFoundation -framework CoreVideo -framework加速-framework CoreMedia -framework AudioToolbox -framework CoreData -framework CoreLocation -framework CoreGraphics -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework Quickblox -framework UIKit -framework Foundation
尝试将二进制文件上传到iTunes Connect时出现以下错误:
即使图像是在plist中指定的:
它们也被添加到项目和项目目录中:
可能是什么问题?
我需要验证Rails ActiveRecord对象的布尔字段.我用这个问题的常见解决方案:
validates :boolean_field, :inclusion => { :in => [true, false] }
Run Code Online (Sandbox Code Playgroud)
但是虽然这个解决方案解决了验证false
值的问题,但它仍然允许将字符串保存到boolean_field
:
my_object.boolean_field = "string"
my_object.save # => true
my_object.boolean_field # => false
Run Code Online (Sandbox Code Playgroud)
如果我将包含指定为[true, false]
?为什么会发生这种情况?更重要的是,我如何仅验证真值和假值?
PS如果这个问题很重要,我正在使用PostgreSQL.
我使用QT在C++中创建了一个Windows应用程序.如果我想将它移植到Linux或Mac OS,将sizeof(int)
或sizeof(long)
改变?换句话说,不同平台的QT应用程序中的类型是否具有相似的大小?
我不想发动圣战.我只是想知道是否有这样的基准?或者也许你可以从你的经历中谈谈这个话题?
我想处理点击UICollectionView单元格.尝试使用以下代码实现此目的:
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"cvCell";
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
// Some code to initialize the cell
[cell addTarget:self action:@selector(showUserPopover:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
- (void)showUserPopover:(id)sender
{
//...
}
Run Code Online (Sandbox Code Playgroud)
但执行中断[cell addTarget:...]
了以下错误:
- [UICollectionViewCell addTarget:action:forControlEvents:]:无法识别的选择器发送到实例0x9c75e40
无论我的服务器实际返回什么,Chai 总是会告诉我res.body={}
内容类型是否为“application/javascript”。
这是我的服务器:
const http = require('http');
const server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "application/javascript"});
response.end('console.log("test");');
});
module.exports = server;
server.listen(process.env.PORT || 8000);
console.log("Server running at http://localhost:8000/");
Run Code Online (Sandbox Code Playgroud)
但测试没有看到它:
const chai = require('chai');
const chaiHttp = require('chai-http');
const server = require('./test-server');
const should = chai.should();
chai.use(chaiHttp);
describe('GET /test', () => {
it('it should give test result', (done) => {
chai.request(server)
.get('/test')
.end((err, res) => {
console.log(err);
console.log(res);
console.log(res.body); // {}
console.log(res.text); // undefined
res.body.should.be.eql('console.log("test");'); …
Run Code Online (Sandbox Code Playgroud)