我正在使用PIL库.
我试图使图像看起来更红,这就是我所拥有的.
from PIL import Image
image = Image.open('balloon.jpg')
pixels = list(image.getdata())
for pixel in pixels:
pixel[0] = pixel[0] + 20
image.putdata(pixels)
image.save('new.bmp')
Run Code Online (Sandbox Code Playgroud)
但是我收到此错误: TypeError: 'tuple' object does not support item assignment
这是我关注的两个表:
CREATE TABLE IF NOT EXISTS `tutorial` (
`beggingTime` time NOT NULL,
`day` varchar(8) NOT NULL,
`tutorId` int(3) NOT NULL,
`maxMembers` int(2) NOT NULL,
`minMembers` int(1) NOT NULL,
PRIMARY KEY (`beggingTime`,`day`,`tutorId`),
KEY `tutorId` (`tutorId`)
)
CREATE TABLE IF NOT EXISTS `group` (
`groupId` tinyint(3) NOT NULL AUTO_INCREMENT,
`status` varchar(20) NOT NULL,
`groupName` varchar(50) NOT NULL,
PRIMARY KEY (`groupId`)
)
Run Code Online (Sandbox Code Playgroud)
我想在'group'中创建一个链接到'tutorial'中复合唯一键的字段.所以我想我的问题是,我如何联系这些表?我是否必须在'tutorial'中为每个主键创建外键字段?
你好我想知道在facebooks图API中的offset_y意味着什么:https://developers.facebook.com/docs/graph-api/reference/cover-photo/.
y_offset:当大于0%但小于100%时,封面照片会垂直溢出.该值表示垂直手动偏移(用户垂直拖动照片以显示感兴趣的部分的量),作为使照片适合空间所需的偏移的百分比.
我已经尝试在facebook graph api中使用解决方案:offset_y offset_x,但它确实有效.
例如,此活动https://www.facebook.com/events/164312630996898/.事件图片的css顶部偏移量为-3px:
为了计算这个,我将尝试在facebook图形api中使用该方法:offset_y offset_x
图像为500x622像素(调整大小以适应时),事件图像空间为500x262像素.622px-262px = 360px.使用facebook图形API(https://developers.facebook.com/tools/explorer?method=GET&path=164312630996898%3Ffields%3Dcover&version=v2.12)给出的偏移量为9:
所以360px的9%是32.4px,但实际答案应该是3px.
任何帮助将不胜感激!
所以,假设我有一个有符号整数(几个例子):
-1101363339 = 10111110 01011010 10000111 01110101 in binary.
-2147463094 = 10000000 00000000 01010000 01001010 in binary.
-20552 = 11111111 11111111 10101111 10111000 in binary.
Run Code Online (Sandbox Code Playgroud)
现在:-1101363339 >> 31
例如,应该等于1对吗?但在我的电脑上,我得到-1.无论我选择什么负整数,如果x =负数,x >> 31 = -1
.为什么?显然是二进制的,它应该是1.
这是一些C,在我正在学习的教科书中找到:
...
do {
...
n--;
} while (n > 0)
...
Run Code Online (Sandbox Code Playgroud)
我假设n
是在%edx
.
生成的汇编代码是:
testl %edx, %edx
jle .L5
Run Code Online (Sandbox Code Playgroud)
我明白jle
测试小于或等于(SF ^ OF) | ZF
.但是我不确定这条指令是如何对应的n > 0
.有谁能解释一下?
我需要以下div来获得背景颜色 - 简单吧.但是,它无法正常工作.我已经完成了一些测试,并弄清楚它上面的浮子正在拧紧它.那么,我该如何解决这个问题呢?
.days{
background-color:#000;
}
span {
display:block;
width:200px;
float:left;
}
<div class="days">
<span>
<input id="Field9" name="Field9" type="checkbox" value="" size="3" maxlength="4" tabindex="4" />
<label class="days" >Monday</label>
</span> <span>
<input id="Field5" name="Field10" type="checkbox" value="" size="3" maxlength="4" tabindex="4" />
<label class="days" >Tuesday</label>
</span> <span>
<input id="Field5" name="Field11" type="checkbox" value="" size="3" maxlength="4" tabindex="4" />
<label class="days" >Wednesday</label>
</span> <span>
<!-- goes till sunday --!>
</div>
Run Code Online (Sandbox Code Playgroud) 为什么我不能改变这个元素的CSS?
$("div.example ul li").mouseover(function () {
var ul_teirs = $("div.example ul li").find('ul');
var second_teir = ul_teirs[0];
var third_teir = ul_teirs[1];
second_teir.css({
...
});
});
Run Code Online (Sandbox Code Playgroud)
错误我得到:
Uncaught TypeError: Object #<HTMLUListElement> has no method 'css'
Run Code Online (Sandbox Code Playgroud) 我想我知道我有一个事件ID.我想要事件URL(将用户链接到它),但图形API似乎没有它(https://developers.facebook.com/docs/graph-api/reference/event/),例如我使用命令GET /v2.9/310917539364835 HTTP/1.1
输出是:
{
"description": "...",
"end_time": "2017-06-23T22:30:00+1000",
"name": "UQ Postgrad Masquerade Party (End of Semester)",
"place": {
"name": "Cloudland",
"location": {
"city": "Brisbane",
"country": "Australia",
"latitude": -27.45891,
"longitude": 153.0349699,
"state": "QLD",
"street": "641 Ann Street",
"zip": "4006"
},
"id": "103221159774910"
},
"start_time": "2017-06-23T19:30:00+1000",
"id": "310917539364835"
}
Run Code Online (Sandbox Code Playgroud)
但是没有URL.
谢谢
似乎无法让这个工作.
var current_times = new Date();
var future_times = new Date();
function time(){
current_times = current_times.setMinutes(current_times.getMinutes());
future_times = future_times.setMinutes(future_times.getMinutes() + 1);
}
Run Code Online (Sandbox Code Playgroud)
错误即时获取是:current_times.getMinutes不是一个函数
请注意这确实有帮助,但时间函数是从一个在身体负载上启动的函数调用的.
这两个陈述是一样的吗?
查询1: WHERE salary > 999;
查询2: WHERE salary >= 1000;
我以为他们是,但显然根据我的同龄人他们不是(虽然他们没有解释原因).
facebook ×2
javascript ×2
sql ×2
assembly ×1
c ×1
css ×1
html ×1
instructions ×1
jquery ×1
mysql ×1
phpmyadmin ×1
python ×1
x86 ×1
x86-16 ×1