我正在尝试编写一个查询,以找出哪些用户未注册某些课程.
我有2张桌子; 课程和用户.两者都包含字段'id',然后分别包含'coursename'和username'.
使用这两个表,现有系统将用户添加到第三个表(称为enrolled_users).用户每个占用一行.例如,如果用户ID为'1'在4个课程上,则enrolled_users如下所示:
-----------------------
| user_id | course_id |
-----------------------
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 1 | 4 |
-----------------------
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,这个表数据不是基于关系构建的,而是使用两个表'courses'和'users'在PHP中生成的.
我不知道如何写出如何查找用户'1'未注册的课程的查询,如果有10个课程,但我们可以看到用户'1'仅在1-4课程.
我想用像LIKE或NOT LIKE这样的东西?
SELECT u.id, c.id, ec.user_id, ec.course_id
FROM users u, courses c, enrolled_courses ec
WHERE u.id = ec.user_id
AND c.id = ec.course_id
AND u.id = '1'
Run Code Online (Sandbox Code Playgroud)
我尝试过使用!=和<>,但这并没有显示我需要的东西; 用户未注册的课程列表.
对不起,如果我是模糊的,试着让我的头围绕它!
使用MySQL 5.0,在现有系统上我无法修改,只能从(目前)查询.
作为一个爱好项目的思想实验,我一直在想一种方法来确保不会发生这种微妙的错误/错字:
public void MyMethod(int useCaseId)
{
// Do something with the useCaseId
}
public void SomeOtherMethod()
{
int userId = 12;
int useCaseId = 15;
MyMethod(userId); // Ooops! Used the wrong value!
}
Run Code Online (Sandbox Code Playgroud)
这个bug很难找到,因为没有编译时错误,你甚至不一定会在运行时获得异常.你只会得到"意想不到的结果".
为了以简单的方式解决这个问题,我尝试使用空枚举定义.有效地使用户id成为一种数据类型(没有像一个类或一个结构那么远):
public enum UseCaseId { // Empty… }
public enum UserId { // Empty… }
public void MyMethod(UseCaseId useCaseId)
{
// Do something with the useCaseId
}
public void SomeOtherMethod()
{
UserId userId = (UserId)12;
UseCaseId useCaseId = (UseCaseId)15;
MyMethod(userId); // Compile error!!
}
Run Code Online (Sandbox Code Playgroud)
你觉得怎么样?
我试图使用jQuery的"ui-corner-all"类在IE7中获得圆角.这就是我的页面的样子.
<html>
<head>
<script language="javascript" type="text/javascript" src="jquery.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$('#btnSearch').addClass("ui-corner-all");
});
</script>
</head>
<body>
<!--some code here-->
<asp:Button ID="btnSearch" Text="Search" runat="server" OnClick="btnSearch_Click" />
<!--some code here-->
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
但是,我无法获得圆角的效果.我在这里做错了吗?我也尝试过包含jQuery的smoothness.css文件,但仍然没有用!
应用程序在被iOS踢出之前可以占用多少内存?内存量取决于设备版本吗?我开发了一个使用30+ mb的应用程序,它在iPhone 2g上被踢了.它可以在iPhone 4或3GS上运行吗?
我有一个巨大的对象,我当然有它的类,我从中提取一些值,但因为它真的很大,我不知道在哪个列表或我正在寻找的值是什么.
有没有办法创建某种对象分解路由并搜索每个部分的我期望的值,它隐藏在对象的某个地方,我只是在eclipse中找不到它太嵌套了.
我想过使用反射来遍历对象类的所有字段并搜索每个字段内的值(列表中的字段(列表列表等)).还有其他想法吗?
不幸的是,这些答案都没有帮助我,我正在开始赏金
Microsoft发布了适用于WPF的Microsoft Ribbon,可在此处下载。
我们也有RibbonControlsLibrary.dll,它也是一个功能区控件,可从Office网站下载。当前它是CTP版本。
现在,这两个功能区之间有什么区别?
到目前为止,我发现:
WPF的MS Ribbon不提供任何主题支持,并且具有Office 2010功能区外观。不支持Office 2007功能区外观。
RibbonControlsLibrary.dll(仍为CTP)中的功能区支持Office 2007外观主题,还支持Office 2010外观。但是它不能在.NET 4.0中正常运行。显示组合框,文本框等控件时会出现一些错误。
有人与这些人合作吗?您可以给我链接到RibbonControlsLibrary.dll的稳定版本吗?是否存在?实际上,WPF的MS Ribbon是RibbonControlsLibrary.dll的RTW还是只有2个单独的Ribbon?
我想对UIImageView缩放,旋转进行2次操作,我有2个问题:
答:我为ex做了缩放操作.当我尝试进行旋转时,将
UIImageView其设置为初始大小,我想知道如何保持缩放UIImageView并从缩放图像进行旋转.B.我想将缩放操作与旋转相结合,我不知道如何实现这一点:
- (void)viewDidLoad
{
foo = [[UIImageView alloc]initWithFrame:CGRectMake(100.0, 100.0, 600, 800.0)];
foo.userInteractionEnabled = YES;
foo.multipleTouchEnabled = YES;
foo.image = [UIImage imageNamed:@"earth.jpg"];
foo.contentMode = UIViewContentModeScaleAspectFit;
foo.clipsToBounds = YES;
[self.view addSubview:foo];
}
//---pinch gesture---
UIPinchGestureRecognizer *pinchGesture =
[[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinchGesture:)];
[foo addGestureRecognizer:pinchGesture];
[pinchGesture release];
//---rotate gesture---
UIRotationGestureRecognizer *rotateGesture =
[[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(handleRotateGesture:)];
[foo addGestureRecognizer:rotateGesture];
[rotateGesture release];
//---handle pinch gesture---
-(IBAction) handlePinchGesture:(UIGestureRecognizer *) sender {
NSLog(@"Pinch");
CGFloat factor = [(UIPinchGestureRecognizer *) …Run Code Online (Sandbox Code Playgroud) 请参阅下面的pom.xml中的插件配置.
我可以:
mvn myplugin:myGoal
哪个运行myGoal(我认为都是执行)但我希望能够独立选择第一个或第二个执行.
我知道我可以在执行元素中添加一个id,但是如何在命令行中引用该id.我想得到一些能够完成这个想象命令的功能:
mvn myplugin:myGoal --executionId=1
这是可能的,还是我以错误的方式解决这个问题?
<plugin>
<groupId>org.myplugin</groupId>
<artifactId>myplugin-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<goals>
<goal>myGoal</goal>
</goals>
<configuration>
<myParam>cats</myParam>
</configuration>
</execution>
<execution>
<goals>
<goal>myGoal</goal>
</goals>
<configuration>
<myParam>dogs</myParam>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud) 我目前正在我的主机上测试脚本.此脚本用于接受PayPal IPN数据,执行一些操作(即数据验证),将必要的数据发送到特定的电子邮件地址等.
我在PayPal网站上使用测试工具将测试数据发布到我的脚本中.我的脚本不起作用:应该发出代码,但我看不到错误.PayPal中的测试工具只是做了帖子,似乎不接受任何回复.我想看看我的脚本中发生了什么,以便我可以解决它.如何获取脚本输出的错误消息?
有任何想法吗?
是什么声明字段作为之间的差异val,lazy val以及objectScala的类中,如下面的代码片断:
class A
class B {
val a1 = new A { def foo = 1 }
object a2 extends A { def foo = 1 }
lazy val a3 = new A { def foo = 1 }
}
Run Code Online (Sandbox Code Playgroud)